aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild3
-rw-r--r--include/acpi/acexcep.h461
-rw-r--r--include/acpi/acoutput.h53
-rw-r--r--include/acpi/acpi_bus.h73
-rw-r--r--include/acpi/acpi_drivers.h1
-rw-r--r--include/acpi/acpiosxf.h2
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/actbl2.h47
-rw-r--r--include/acpi/actbl3.h55
-rw-r--r--include/acpi/actypes.h16
-rw-r--r--include/acpi/processor.h10
-rw-r--r--include/asm-generic/cputime_nsecs.h28
-rw-r--r--include/asm-generic/hugetlb.h40
-rw-r--r--include/asm-generic/pgtable.h10
-rw-r--r--include/asm-generic/unistd.h18
-rw-r--r--include/asm-generic/vmlinux.lds.h8
-rw-r--r--include/clocksource/arm_arch_timer.h6
-rw-r--r--include/clocksource/samsung_pwm.h36
-rw-r--r--include/crypto/sha.h5
-rw-r--r--include/drm/drmP.h13
-rw-r--r--include/drm/drm_crtc.h23
-rw-r--r--include/drm/drm_edid.h9
-rw-r--r--include/drm/drm_fb_helper.h25
-rw-r--r--include/drm/drm_os_linux.h9
-rw-r--r--include/drm/drm_pciids.h11
-rw-r--r--include/drm/ttm/ttm_bo_driver.h4
-rw-r--r--include/dt-bindings/gpio/gpio.h15
-rw-r--r--include/dt-bindings/interrupt-controller/arm-gic.h22
-rw-r--r--include/dt-bindings/interrupt-controller/irq.h19
-rw-r--r--include/linux/acpi.h13
-rw-r--r--include/linux/acpi_dma.h120
-rw-r--r--include/linux/acpi_gpio.h19
-rw-r--r--include/linux/aio.h178
-rw-r--r--include/linux/amba/serial.h3
-rw-r--r--include/linux/async.h13
-rw-r--r--include/linux/audit.h48
-rw-r--r--include/linux/backing-dev.h16
-rw-r--r--include/linux/basic_mmio_gpio.h1
-rw-r--r--include/linux/bcma/bcma.h58
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h6
-rw-r--r--include/linux/bcma/bcma_regs.h1
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bio.h115
-rw-r--r--include/linux/blk_types.h8
-rw-r--r--include/linux/blkdev.h31
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/brcmphy.h5
-rw-r--r--include/linux/buffer_head.h5
-rw-r--r--include/linux/ceph/auth.h18
-rw-r--r--include/linux/ceph/ceph_features.h2
-rw-r--r--include/linux/ceph/decode.h30
-rw-r--r--include/linux/ceph/libceph.h31
-rw-r--r--include/linux/ceph/messenger.h104
-rw-r--r--include/linux/ceph/msgr.h1
-rw-r--r--include/linux/ceph/osd_client.h204
-rw-r--r--include/linux/ceph/osdmap.h30
-rw-r--r--include/linux/cgroup.h181
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/cleancache.h4
-rw-r--r--include/linux/clk-private.h2
-rw-r--r--include/linux/clk-provider.h63
-rw-r--r--include/linux/clk.h8
-rw-r--r--include/linux/clk/mxs.h16
-rw-r--r--include/linux/clk/sunxi.h (renamed from include/linux/sunxi_timer.h)8
-rw-r--r--include/linux/clk/tegra.h1
-rw-r--r--include/linux/clockchips.h44
-rw-r--r--include/linux/clocksource.h13
-rw-r--r--include/linux/cn_proc.h4
-rw-r--r--include/linux/compat.h53
-rw-r--r--include/linux/compiler-gcc4.h2
-rw-r--r--include/linux/compiler.h6
-rw-r--r--include/linux/console.h1
-rw-r--r--include/linux/context_tracking.h24
-rw-r--r--include/linux/cpu.h16
-rw-r--r--include/linux/cpu_cooling.h25
-rw-r--r--include/linux/cpufreq.h21
-rw-r--r--include/linux/cpuidle.h25
-rw-r--r--include/linux/cpumask.h15
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/ctype.h6
-rw-r--r--include/linux/debug_locks.h2
-rw-r--r--include/linux/device-mapper.h15
-rw-r--r--include/linux/device.h25
-rw-r--r--include/linux/dma-buf.h16
-rw-r--r--include/linux/dmaengine.h15
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/drbd.h5
-rw-r--r--include/linux/drbd_limits.h11
-rw-r--r--include/linux/efi.h90
-rw-r--r--include/linux/errno.h1
-rw-r--r--include/linux/evm.h2
-rw-r--r--include/linux/export.h20
-rw-r--r--include/linux/exportfs.h11
-rw-r--r--include/linux/f2fs_fs.h17
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/filter.h15
-rw-r--r--include/linux/frontswap.h36
-rw-r--r--include/linux/fs.h30
-rw-r--r--include/linux/fsnotify_backend.h1
-rw-r--r--include/linux/ftrace.h10
-rw-r--r--include/linux/ftrace_event.h112
-rw-r--r--include/linux/genalloc.h18
-rw-r--r--include/linux/gpio-pxa.h1
-rw-r--r--include/linux/gpio.h6
-rw-r--r--include/linux/hid-debug.h6
-rw-r--r--include/linux/hid.h101
-rw-r--r--include/linux/hrtimer.h5
-rw-r--r--include/linux/huge_mm.h11
-rw-r--r--include/linux/hugetlb.h23
-rw-r--r--include/linux/hyperv.h80
-rw-r--r--include/linux/i2c-mux.h2
-rw-r--r--include/linux/i2c-tegra.h25
-rw-r--r--include/linux/i2c.h50
-rw-r--r--include/linux/i2c/twl4030-madc.h2
-rw-r--r--include/linux/icmpv6.h18
-rw-r--r--include/linux/idr.h12
-rw-r--r--include/linux/ieee80211.h125
-rw-r--r--include/linux/if_arp.h12
-rw-r--r--include/linux/if_team.h25
-rw-r--r--include/linux/if_vlan.h56
-rw-r--r--include/linux/iio/adc/ad_sigma_delta.h6
-rw-r--r--include/linux/iio/common/st_sensors.h5
-rw-r--r--include/linux/iio/gyro/itg3200.h2
-rw-r--r--include/linux/iio/iio.h79
-rw-r--r--include/linux/iio/imu/adis.h34
-rw-r--r--include/linux/iio/trigger.h26
-rw-r--r--include/linux/ima.h4
-rw-r--r--include/linux/input/auo-pixcir-ts.h4
-rw-r--r--include/linux/input/matrix_keypad.h19
-rw-r--r--include/linux/input/mt.h1
-rw-r--r--include/linux/integrity.h2
-rw-r--r--include/linux/iommu.h18
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/ipack.h42
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/irqchip/arm-gic.h1
-rw-r--r--include/linux/irqchip/chained_irq.h52
-rw-r--r--include/linux/irqchip/mxs.h14
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/jbd2.h4
-rw-r--r--include/linux/jiffies.h1
-rw-r--r--include/linux/journal-head.h11
-rw-r--r--include/linux/kcore.h38
-rw-r--r--include/linux/kernel.h80
-rw-r--r--include/linux/kmalloc_sizes.h45
-rw-r--r--include/linux/kmod.h17
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/kref.h42
-rw-r--r--include/linux/kthread.h1
-rw-r--r--include/linux/ktime.h18
-rw-r--r--include/linux/kvm_host.h166
-rw-r--r--include/linux/leds.h33
-rw-r--r--include/linux/linkage.h16
-rw-r--r--include/linux/list_bl.h5
-rw-r--r--include/linux/lru_cache.h1
-rw-r--r--include/linux/mbus.h27
-rw-r--r--include/linux/mei_cl_bus.h44
-rw-r--r--include/linux/memory.h17
-rw-r--r--include/linux/memory_hotplug.h4
-rw-r--r--include/linux/mfd/abx500.h27
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h61
-rw-r--r--include/linux/mfd/abx500/ab8500-gpadc.h74
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h6
-rw-r--r--include/linux/mfd/abx500/ab8500.h16
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h7
-rw-r--r--include/linux/mfd/arizona/core.h3
-rw-r--r--include/linux/mfd/arizona/pdata.h28
-rw-r--r--include/linux/mfd/arizona/registers.h46
-rw-r--r--include/linux/mfd/cros_ec.h170
-rw-r--r--include/linux/mfd/cros_ec_commands.h1369
-rw-r--r--include/linux/mfd/db8500-prcmu.h10
-rw-r--r--include/linux/mfd/dbx500-prcmu.h38
-rw-r--r--include/linux/mfd/palmas.h36
-rw-r--r--include/linux/mfd/retu.h8
-rw-r--r--include/linux/mfd/rtsx_pci.h36
-rw-r--r--include/linux/mfd/si476x-core.h533
-rw-r--r--include/linux/mfd/si476x-platform.h267
-rw-r--r--include/linux/mfd/si476x-reports.h163
-rw-r--r--include/linux/mfd/stmpe.h3
-rw-r--r--include/linux/mfd/syscon.h3
-rw-r--r--include/linux/mfd/tps65090.h6
-rw-r--r--include/linux/mfd/tps65217.h1
-rw-r--r--include/linux/mfd/wm8994/pdata.h8
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/mlx4/cmd.h6
-rw-r--r--include/linux/mlx4/cq.h16
-rw-r--r--include/linux/mlx4/device.h117
-rw-r--r--include/linux/mlx4/qp.h29
-rw-r--r--include/linux/mlx4/srq.h2
-rw-r--r--include/linux/mm.h102
-rw-r--r--include/linux/mmc/card.h1
-rw-r--r--include/linux/mmc/host.h5
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mod_devicetable.h9
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/msi.h23
-rw-r--r--include/linux/mtd/blktrans.h2
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/nand.h121
-rw-r--r--include/linux/mtd/physmap.h2
-rw-r--r--include/linux/mtd/plat-ram.h4
-rw-r--r--include/linux/mutex.h3
-rw-r--r--include/linux/mv643xx_eth.h1
-rw-r--r--include/linux/mxsfb.h52
-rw-r--r--include/linux/net.h4
-rw-r--r--include/linux/netdev_features.h27
-rw-r--r--include/linux/netdevice.h91
-rw-r--r--include/linux/netfilter.h5
-rw-r--r--include/linux/netfilter/ipset/ip_set.h126
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h1241
-rw-r--r--include/linux/netfilter/ipset/ip_set_bitmap.h6
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h102
-rw-r--r--include/linux/netfilter/ipset/pfxlen.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h11
-rw-r--r--include/linux/netlink.h11
-rw-r--r--include/linux/netpoll.h2
-rw-r--r--include/linux/nfs_fs.h8
-rw-r--r--include/linux/nfs_fs_sb.h3
-rw-r--r--include/linux/nfs_xdr.h29
-rw-r--r--include/linux/notifier.h5
-rw-r--r--include/linux/nubus.h5
-rw-r--r--include/linux/nvme.h158
-rw-r--r--include/linux/of.h29
-rw-r--r--include/linux/of_dma.h10
-rw-r--r--include/linux/of_net.h10
-rw-r--r--include/linux/of_platform.h5
-rw-r--r--include/linux/openvswitch.h431
-rw-r--r--include/linux/pagemap.h2
-rw-r--r--include/linux/pata_arasan_cf_data.h2
-rw-r--r--include/linux/pci-acpi.h31
-rw-r--r--include/linux/pci-aspm.h20
-rw-r--r--include/linux/pci-ats.h26
-rw-r--r--include/linux/pci.h122
-rw-r--r--include/linux/pci_hotplug.h12
-rw-r--r--include/linux/pci_ids.h9
-rw-r--r--include/linux/pcieport_if.h4
-rw-r--r--include/linux/perf_event.h30
-rw-r--r--include/linux/phy.h10
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/pinctrl/pinconf-generic.h12
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/pinctrl/pinctrl.h6
-rw-r--r--include/linux/pipe_fs_i.h11
-rw-r--r--include/linux/platform_data/arm-ux500-pm.h21
-rw-r--r--include/linux/platform_data/asoc-ux500-msp.h27
-rw-r--r--include/linux/platform_data/atmel-aes.h22
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h124
-rw-r--r--include/linux/platform_data/clk-lpss.h23
-rw-r--r--include/linux/platform_data/clk-ux500.h3
-rw-r--r--include/linux/platform_data/coda.h18
-rw-r--r--include/linux/platform_data/cpsw.h2
-rw-r--r--include/linux/platform_data/crypto-atmel.h22
-rw-r--r--include/linux/platform_data/dwc3-omap.h4
-rw-r--r--include/linux/platform_data/elm.h2
-rw-r--r--include/linux/platform_data/emif_plat.h1
-rw-r--r--include/linux/platform_data/gpio-rcar.h26
-rw-r--r--include/linux/platform_data/imx-iram.h41
-rw-r--r--include/linux/platform_data/irq-renesas-intc-irqpin.h29
-rw-r--r--include/linux/platform_data/irq-renesas-irqc.h27
-rw-r--r--include/linux/platform_data/leds-lp55xx.h21
-rw-r--r--include/linux/platform_data/lp855x.h15
-rw-r--r--include/linux/platform_data/mmc-davinci.h3
-rw-r--r--include/linux/platform_data/mmc-sdhci-s3c.h56
-rw-r--r--include/linux/platform_data/mv_usb.h2
-rw-r--r--include/linux/platform_data/ntc_thermistor.h10
-rw-r--r--include/linux/platform_data/serial-omap.h2
-rw-r--r--include/linux/platform_data/serial-sccnxp.h4
-rw-r--r--include/linux/platform_data/si5351.h114
-rw-r--r--include/linux/platform_data/spi-s3c64xx.h3
-rw-r--r--include/linux/platform_data/st1232_pdata.h13
-rw-r--r--include/linux/platform_data/usb-ohci-exynos.h (renamed from include/linux/platform_data/usb-exynos.h)0
-rw-r--r--include/linux/platform_device.h25
-rw-r--r--include/linux/pm.h13
-rw-r--r--include/linux/pm2301_charger.h2
-rw-r--r--include/linux/posix-timers.h3
-rw-r--r--include/linux/power/ab8500.h16
-rw-r--r--include/linux/power_supply.h6
-rw-r--r--include/linux/printk.h23
-rw-r--r--include/linux/proc_fs.h325
-rw-r--r--include/linux/proc_ns.h74
-rw-r--r--include/linux/profile.h4
-rw-r--r--include/linux/pstore_ram.h14
-rw-r--r--include/linux/ramfs.h8
-rw-r--r--include/linux/random.h7
-rw-r--r--include/linux/rculist_bl.h2
-rw-r--r--include/linux/rcupdate.h8
-rw-r--r--include/linux/regmap.h1
-rw-r--r--include/linux/regulator/ab8500.h217
-rw-r--r--include/linux/regulator/consumer.h14
-rw-r--r--include/linux/regulator/driver.h9
-rw-r--r--include/linux/regulator/max8952.h10
-rw-r--r--include/linux/relay.h3
-rw-r--r--include/linux/remoteproc.h13
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/reset-controller.h51
-rw-r--r--include/linux/reset.h17
-rw-r--r--include/linux/ring_buffer.h6
-rw-r--r--include/linux/rio.h18
-rw-r--r--include/linux/rio_drv.h1
-rw-r--r--include/linux/rtc.h6
-rw-r--r--include/linux/rtnetlink.h9
-rw-r--r--include/linux/rwsem.h10
-rw-r--r--include/linux/scatterlist.h44
-rw-r--r--include/linux/sched.h296
-rw-r--r--include/linux/sctp.h6
-rw-r--r--include/linux/security.h10
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/serial_s3c.h260
-rw-r--r--include/linux/sh_eth.h1
-rw-r--r--include/linux/signal.h5
-rw-r--r--include/linux/skbuff.h95
-rw-r--r--include/linux/slab.h231
-rw-r--r--include/linux/slab_def.h54
-rw-r--r--include/linux/slub_def.h136
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/sock_diag.h3
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/spi/at86rf230.h14
-rw-r--r--include/linux/spi/mxs-spi.h4
-rw-r--r--include/linux/spi/spi-tegra.h40
-rw-r--r--include/linux/spi/spi.h12
-rw-r--r--include/linux/ssb/ssb.h60
-rw-r--r--include/linux/ssb/ssb_regs.h10
-rw-r--r--include/linux/ssbi.h38
-rw-r--r--include/linux/string_helpers.h58
-rw-r--r--include/linux/sudmac.h52
-rw-r--r--include/linux/sunrpc/auth.h9
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/gss_api.h32
-rw-r--r--include/linux/sunrpc/msg_prot.h3
-rw-r--r--include/linux/sunrpc/xprt.h6
-rw-r--r--include/linux/swap.h10
-rw-r--r--include/linux/syscalls.h156
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/tegra-powergate.h49
-rw-r--r--include/linux/thermal.h15
-rw-r--r--include/linux/tick.h25
-rw-r--r--include/linux/time.h7
-rw-r--r--include/linux/timekeeper_internal.h9
-rw-r--r--include/linux/timeriomem-rng.h5
-rw-r--r--include/linux/timex.h7
-rw-r--r--include/linux/trace_clock.h1
-rw-r--r--include/linux/tty.h54
-rw-r--r--include/linux/tty_ldisc.h132
-rw-r--r--include/linux/ucb1400.h18
-rw-r--r--include/linux/uio.h3
-rw-r--r--include/linux/uprobes.h8
-rw-r--r--include/linux/usb.h13
-rw-r--r--include/linux/usb/audio-v2.h2
-rw-r--r--include/linux/usb/cdc-wdm.h2
-rw-r--r--include/linux/usb/ch9.h9
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/dwc3-omap.h6
-rw-r--r--include/linux/usb/gadget.h16
-rw-r--r--include/linux/usb/gadget_configfs.h110
-rw-r--r--include/linux/usb/hcd.h6
-rw-r--r--include/linux/usb/musb-ux500.h (renamed from include/linux/irqchip/sunxi.h)28
-rw-r--r--include/linux/usb/nop-usb-xceiv.h5
-rw-r--r--include/linux/usb/otg.h9
-rw-r--r--include/linux/usb/phy.h33
-rw-r--r--include/linux/usb/renesas_usbhs.h6
-rw-r--r--include/linux/usb/serial.h16
-rw-r--r--include/linux/usb/tegra_usb_phy.h10
-rw-r--r--include/linux/usb/usbnet.h7
-rw-r--r--include/linux/vexpress.h3
-rw-r--r--include/linux/vfio.h3
-rw-r--r--include/linux/virtio.h26
-rw-r--r--include/linux/virtio_caif.h24
-rw-r--r--include/linux/virtio_ring.h57
-rw-r--r--include/linux/vm_sockets.h23
-rw-r--r--include/linux/vmalloc.h34
-rw-r--r--include/linux/vmpressure.h47
-rw-r--r--include/linux/vmstat.h7
-rw-r--r--include/linux/vringh.h225
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/wait.h102
-rw-r--r--include/linux/workqueue.h171
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/media/davinci/dm355_ccdc.h6
-rw-r--r--include/media/davinci/dm644x_ccdc.h24
-rw-r--r--include/media/davinci/vpbe.h2
-rw-r--r--include/media/davinci/vpbe_types.h3
-rw-r--r--include/media/media-devnode.h1
-rw-r--r--include/media/mt9p031.h2
-rw-r--r--include/media/omap3isp.h10
-rw-r--r--include/media/rc-core.h2
-rw-r--r--include/media/rc-map.h1
-rw-r--r--include/media/s5p_fimc.h64
-rw-r--r--include/media/saa7115.h32
-rw-r--r--include/media/si476x.h37
-rw-r--r--include/media/soc_camera.h7
-rw-r--r--include/media/soc_mediabus.h3
-rw-r--r--include/media/ths7303.h42
-rw-r--r--include/media/tuner.h6
-rw-r--r--include/media/uda1342.h29
-rw-r--r--include/media/v4l2-chip-ident.h11
-rw-r--r--include/media/v4l2-common.h1
-rw-r--r--include/media/v4l2-ctrls.h29
-rw-r--r--include/media/v4l2-device.h13
-rw-r--r--include/media/v4l2-ioctl.h22
-rw-r--r--include/media/v4l2-of.h111
-rw-r--r--include/media/v4l2-subdev.h25
-rw-r--r--include/media/videobuf-dma-contig.h10
-rw-r--r--include/media/videobuf2-core.h11
-rw-r--r--include/net/af_unix.h8
-rw-r--r--include/net/bluetooth/bluetooth.h20
-rw-r--r--include/net/bluetooth/hci.h30
-rw-r--r--include/net/bluetooth/hci_core.h128
-rw-r--r--include/net/bluetooth/l2cap.h15
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/caif/caif_dev.h2
-rw-r--r--include/net/caif/caif_device.h2
-rw-r--r--include/net/caif/caif_hsi.h1
-rw-r--r--include/net/caif/caif_layer.h2
-rw-r--r--include/net/caif/caif_shm.h26
-rw-r--r--include/net/caif/cfcnfg.h2
-rw-r--r--include/net/caif/cfctrl.h2
-rw-r--r--include/net/caif/cffrml.h2
-rw-r--r--include/net/caif/cfmuxl.h2
-rw-r--r--include/net/caif/cfpkt.h2
-rw-r--r--include/net/caif/cfserl.h2
-rw-r--r--include/net/caif/cfsrvl.h2
-rw-r--r--include/net/cfg80211.h164
-rw-r--r--include/net/cls_cgroup.h4
-rw-r--r--include/net/dn_fib.h28
-rw-r--r--include/net/firewire.h25
-rw-r--r--include/net/genetlink.h1
-rw-r--r--include/net/gre.h51
-rw-r--r--include/net/ieee802154_netdev.h5
-rw-r--r--include/net/if_inet6.h4
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_frag.h29
-rw-r--r--include/net/ip6_tunnel.h21
-rw-r--r--include/net/ip_tunnels.h177
-rw-r--r--include/net/ip_vs.h140
-rw-r--r--include/net/ipip.h87
-rw-r--r--include/net/ipv6.h22
-rw-r--r--include/net/lib80211.h4
-rw-r--r--include/net/mac80211.h236
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netfilter/nf_conntrack_core.h1
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h4
-rw-r--r--include/net/netfilter/nf_log.h17
-rw-r--r--include/net/netfilter/nf_queue.h6
-rw-r--r--include/net/netfilter/nfnetlink_log.h3
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/netns/netfilter.h18
-rw-r--r--include/net/netprio_cgroup.h4
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/request_sock.h10
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/scm.h16
-rw-r--r--include/net/sctp/checksum.h2
-rw-r--r--include/net/sctp/constants.h1
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/structs.h20
-rw-r--r--include/net/sctp/ulpqueue.h1
-rw-r--r--include/net/secure_seq.h1
-rw-r--r--include/net/sock.h18
-rw-r--r--include/net/tcp.h146
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/pcmcia/ds.h12
-rw-r--r--include/scsi/Kbuild1
-rw-r--r--include/scsi/iscsi_if.h117
-rw-r--r--include/scsi/libiscsi.h1
-rw-r--r--include/scsi/libsas.h4
-rw-r--r--include/scsi/osd_protocol.h2
-rw-r--r--include/scsi/sas.h22
-rw-r--r--include/scsi/sas_ata.h4
-rw-r--r--include/scsi/scsi_device.h16
-rw-r--r--include/scsi/scsi_host.h6
-rw-r--r--include/scsi/scsi_transport_iscsi.h147
-rw-r--r--include/scsi/scsi_transport_sas.h7
-rw-r--r--include/sound/compress_driver.h4
-rw-r--r--include/sound/control.h5
-rw-r--r--include/sound/core.h26
-rw-r--r--include/sound/dmaengine_pcm.h97
-rw-r--r--include/sound/emu10k1.h1
-rw-r--r--include/sound/pcm.h33
-rw-r--r--include/sound/soc-dai.h8
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--include/sound/soc.h33
-rw-r--r--include/sound/tas5086.h7
-rw-r--r--include/sound/tegra_wm8903.h26
-rw-r--r--include/sound/tlv.h6
-rw-r--r--include/target/iscsi/iscsi_transport.h83
-rw-r--r--include/target/target_core_backend.h4
-rw-r--r--include/target/target_core_base.h5
-rw-r--r--include/target/target_core_fabric.h2
-rw-r--r--include/trace/events/bcache.h271
-rw-r--r--include/trace/events/block.h12
-rw-r--r--include/trace/events/ext4.h20
-rw-r--r--include/trace/events/f2fs.h682
-rw-r--r--include/trace/events/filemap.h58
-rw-r--r--include/trace/events/host1x.h253
-rw-r--r--include/trace/events/jbd2.h21
-rw-r--r--include/trace/events/kvm.h12
-rw-r--r--include/trace/events/printk.h25
-rw-r--r--include/trace/events/rcu.h55
-rw-r--r--include/trace/events/regmap.h48
-rw-r--r--include/trace/events/timer.h31
-rw-r--r--include/trace/events/writeback.h5
-rw-r--r--include/trace/ftrace.h49
-rw-r--r--include/uapi/asm-generic/socket.h2
-rw-r--r--include/uapi/drm/Kbuild2
-rw-r--r--include/uapi/drm/drm.h6
-rw-r--r--include/uapi/drm/drm_mode.h6
-rw-r--r--include/uapi/drm/qxl_drm.h152
-rw-r--r--include/uapi/drm/radeon_drm.h26
-rw-r--r--include/uapi/drm/tegra_drm.h136
-rw-r--r--include/uapi/linux/Kbuild2
-rw-r--r--include/uapi/linux/audit.h4
-rw-r--r--include/uapi/linux/auxvec.h1
-rw-r--r--include/uapi/linux/btrfs.h32
-rw-r--r--include/uapi/linux/caif/caif_socket.h2
-rw-r--r--include/uapi/linux/caif/if_caif.h2
-rw-r--r--include/uapi/linux/cn_proc.h10
-rw-r--r--include/uapi/linux/connector.h5
-rw-r--r--include/uapi/linux/dvb/dmx.h2
-rw-r--r--include/uapi/linux/elf.h1
-rw-r--r--include/uapi/linux/filter.h3
-rw-r--r--include/uapi/linux/fs.h1
-rw-r--r--include/uapi/linux/fuse.h7
-rw-r--r--include/uapi/linux/if_cablemodem.h12
-rw-r--r--include/uapi/linux/if_ether.h3
-rw-r--r--include/uapi/linux/if_link.h7
-rw-r--r--include/uapi/linux/if_packet.h29
-rw-r--r--include/uapi/linux/input.h5
-rw-r--r--include/uapi/linux/ip_vs.h4
-rw-r--r--include/uapi/linux/kvm.h45
-rw-r--r--include/uapi/linux/magic.h2
-rw-r--r--include/uapi/linux/media.h2
-rw-r--r--include/uapi/linux/neighbour.h3
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h36
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_queue.h10
-rw-r--r--include/uapi/linux/netfilter/xt_NFQUEUE.h9
-rw-r--r--include/uapi/linux/netfilter/xt_set.h9
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_frag.h4
-rw-r--r--include/uapi/linux/netlink.h34
-rw-r--r--include/uapi/linux/netlink_diag.h52
-rw-r--r--include/uapi/linux/nfc.h19
-rw-r--r--include/uapi/linux/nl80211.h156
-rw-r--r--include/uapi/linux/openvswitch.h456
-rw-r--r--include/uapi/linux/packet_diag.h5
-rw-r--r--include/uapi/linux/pci_regs.h30
-rw-r--r--include/uapi/linux/perf_event.h71
-rw-r--r--include/uapi/linux/pkt_sched.h1
-rw-r--r--include/uapi/linux/ptrace.h12
-rw-r--r--include/uapi/linux/rfkill.h2
-rw-r--r--include/uapi/linux/sctp.h (renamed from include/net/sctp/user.h)84
-rw-r--r--include/uapi/linux/snmp.h8
-rw-r--r--include/uapi/linux/tcp.h26
-rw-r--r--include/uapi/linux/time.h6
-rw-r--r--include/uapi/linux/usb/cdc-wdm.h21
-rw-r--r--include/uapi/linux/usb/ch9.h4
-rw-r--r--include/uapi/linux/v4l2-controls.h28
-rw-r--r--include/uapi/linux/v4l2-dv-timings.h18
-rw-r--r--include/uapi/linux/v4l2-mediabus.h6
-rw-r--r--include/uapi/linux/vfio.h1
-rw-r--r--include/uapi/linux/vhost.h28
-rw-r--r--include/uapi/linux/videodev2.h111
-rw-r--r--include/uapi/linux/virtio_balloon.h4
-rw-r--r--include/uapi/linux/virtio_console.h2
-rw-r--r--include/uapi/linux/virtio_ids.h1
-rw-r--r--include/uapi/linux/virtio_net.h2
-rw-r--r--include/uapi/linux/vm_sockets.h23
-rw-r--r--include/uapi/linux/xfrm.h3
-rw-r--r--include/uapi/sound/asound.h4
-rw-r--r--include/video/atmel_lcdc.h4
-rw-r--r--include/video/omap-panel-data.h150
-rw-r--r--include/video/omap-panel-generic-dpi.h37
-rw-r--r--include/video/omap-panel-n8x0.h15
-rw-r--r--include/video/omap-panel-nokia-dsi.h32
-rw-r--r--include/video/omap-panel-picodlp.h23
-rw-r--r--include/video/omap-panel-tfp410.h35
-rw-r--r--include/video/omapdss.h86
-rw-r--r--include/video/platform_lcd.h1
-rw-r--r--include/xen/events.h3
-rw-r--r--include/xen/interface/io/netif.h19
-rw-r--r--include/xen/tmem.h8
582 files changed, 15552 insertions, 6098 deletions
diff --git a/include/Kbuild b/include/Kbuild
index 1dfd33e8d43b..bab1145bc7a7 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,5 +1,2 @@
1# Top-level Makefile calls into asm-$(ARCH) 1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below 2# List only non-arch directories below
3
4header-y += video/
5header-y += scsi/
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 9bf59d0e8aaa..cf051e05a8fe 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -44,17 +44,50 @@
44#ifndef __ACEXCEP_H__ 44#ifndef __ACEXCEP_H__
45#define __ACEXCEP_H__ 45#define __ACEXCEP_H__
46 46
47/* This module contains all possible exception codes for acpi_status */
48
47/* 49/*
48 * Exceptions returned by external ACPI interfaces 50 * Exception code classes
49 */ 51 */
50#define AE_CODE_ENVIRONMENTAL 0x0000 52#define AE_CODE_ENVIRONMENTAL 0x0000 /* General ACPICA environment */
51#define AE_CODE_PROGRAMMER 0x1000 53#define AE_CODE_PROGRAMMER 0x1000 /* External ACPICA interface caller */
52#define AE_CODE_ACPI_TABLES 0x2000 54#define AE_CODE_ACPI_TABLES 0x2000 /* ACPI tables */
53#define AE_CODE_AML 0x3000 55#define AE_CODE_AML 0x3000 /* From executing AML code */
54#define AE_CODE_CONTROL 0x4000 56#define AE_CODE_CONTROL 0x4000 /* Internal control codes */
57
55#define AE_CODE_MAX 0x4000 58#define AE_CODE_MAX 0x4000
56#define AE_CODE_MASK 0xF000 59#define AE_CODE_MASK 0xF000
57 60
61/*
62 * Macros to insert the exception code classes
63 */
64#define EXCEP_ENV(code) ((acpi_status) (code | AE_CODE_ENVIRONMENTAL))
65#define EXCEP_PGM(code) ((acpi_status) (code | AE_CODE_PROGRAMMER))
66#define EXCEP_TBL(code) ((acpi_status) (code | AE_CODE_ACPI_TABLES))
67#define EXCEP_AML(code) ((acpi_status) (code | AE_CODE_AML))
68#define EXCEP_CTL(code) ((acpi_status) (code | AE_CODE_CONTROL))
69
70/*
71 * Exception info table. The "Description" field is used only by the
72 * ACPICA help application (acpihelp).
73 */
74struct acpi_exception_info {
75 char *name;
76
77#ifdef ACPI_HELP_APP
78 char *description;
79#endif
80};
81
82#ifdef ACPI_HELP_APP
83#define EXCEP_TXT(name,description) {name, description}
84#else
85#define EXCEP_TXT(name,description) {name}
86#endif
87
88/*
89 * Success is always zero, failure is non-zero
90 */
58#define ACPI_SUCCESS(a) (!(a)) 91#define ACPI_SUCCESS(a) (!(a))
59#define ACPI_FAILURE(a) (a) 92#define ACPI_FAILURE(a) (a)
60 93
@@ -64,60 +97,60 @@
64/* 97/*
65 * Environmental exceptions 98 * Environmental exceptions
66 */ 99 */
67#define AE_ERROR (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL) 100#define AE_ERROR EXCEP_ENV (0x0001)
68#define AE_NO_ACPI_TABLES (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL) 101#define AE_NO_ACPI_TABLES EXCEP_ENV (0x0002)
69#define AE_NO_NAMESPACE (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL) 102#define AE_NO_NAMESPACE EXCEP_ENV (0x0003)
70#define AE_NO_MEMORY (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL) 103#define AE_NO_MEMORY EXCEP_ENV (0x0004)
71#define AE_NOT_FOUND (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL) 104#define AE_NOT_FOUND EXCEP_ENV (0x0005)
72#define AE_NOT_EXIST (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL) 105#define AE_NOT_EXIST EXCEP_ENV (0x0006)
73#define AE_ALREADY_EXISTS (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL) 106#define AE_ALREADY_EXISTS EXCEP_ENV (0x0007)
74#define AE_TYPE (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL) 107#define AE_TYPE EXCEP_ENV (0x0008)
75#define AE_NULL_OBJECT (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL) 108#define AE_NULL_OBJECT EXCEP_ENV (0x0009)
76#define AE_NULL_ENTRY (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL) 109#define AE_NULL_ENTRY EXCEP_ENV (0x000A)
77#define AE_BUFFER_OVERFLOW (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL) 110#define AE_BUFFER_OVERFLOW EXCEP_ENV (0x000B)
78#define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL) 111#define AE_STACK_OVERFLOW EXCEP_ENV (0x000C)
79#define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL) 112#define AE_STACK_UNDERFLOW EXCEP_ENV (0x000D)
80#define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL) 113#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)
81#define AE_SUPPORT (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL) 114#define AE_SUPPORT EXCEP_ENV (0x000F)
82#define AE_LIMIT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL) 115#define AE_LIMIT EXCEP_ENV (0x0010)
83#define AE_TIME (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL) 116#define AE_TIME EXCEP_ENV (0x0011)
84#define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL) 117#define AE_ACQUIRE_DEADLOCK EXCEP_ENV (0x0012)
85#define AE_RELEASE_DEADLOCK (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL) 118#define AE_RELEASE_DEADLOCK EXCEP_ENV (0x0013)
86#define AE_NOT_ACQUIRED (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL) 119#define AE_NOT_ACQUIRED EXCEP_ENV (0x0014)
87#define AE_ALREADY_ACQUIRED (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL) 120#define AE_ALREADY_ACQUIRED EXCEP_ENV (0x0015)
88#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL) 121#define AE_NO_HARDWARE_RESPONSE EXCEP_ENV (0x0016)
89#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) 122#define AE_NO_GLOBAL_LOCK EXCEP_ENV (0x0017)
90#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) 123#define AE_ABORT_METHOD EXCEP_ENV (0x0018)
91#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) 124#define AE_SAME_HANDLER EXCEP_ENV (0x0019)
92#define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) 125#define AE_NO_HANDLER EXCEP_ENV (0x001A)
93#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) 126#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B)
94#define AE_NOT_CONFIGURED (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) 127#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
95 128
96#define AE_CODE_ENV_MAX 0x001C 129#define AE_CODE_ENV_MAX 0x001C
97 130
98/* 131/*
99 * Programmer exceptions 132 * Programmer exceptions
100 */ 133 */
101#define AE_BAD_PARAMETER (acpi_status) (0x0001 | AE_CODE_PROGRAMMER) 134#define AE_BAD_PARAMETER EXCEP_PGM (0x0001)
102#define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER) 135#define AE_BAD_CHARACTER EXCEP_PGM (0x0002)
103#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER) 136#define AE_BAD_PATHNAME EXCEP_PGM (0x0003)
104#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER) 137#define AE_BAD_DATA EXCEP_PGM (0x0004)
105#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0005 | AE_CODE_PROGRAMMER) 138#define AE_BAD_HEX_CONSTANT EXCEP_PGM (0x0005)
106#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) 139#define AE_BAD_OCTAL_CONSTANT EXCEP_PGM (0x0006)
107#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) 140#define AE_BAD_DECIMAL_CONSTANT EXCEP_PGM (0x0007)
108#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) 141#define AE_MISSING_ARGUMENTS EXCEP_PGM (0x0008)
109#define AE_BAD_ADDRESS (acpi_status) (0x0009 | AE_CODE_PROGRAMMER) 142#define AE_BAD_ADDRESS EXCEP_PGM (0x0009)
110 143
111#define AE_CODE_PGM_MAX 0x0009 144#define AE_CODE_PGM_MAX 0x0009
112 145
113/* 146/*
114 * Acpi table exceptions 147 * Acpi table exceptions
115 */ 148 */
116#define AE_BAD_SIGNATURE (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES) 149#define AE_BAD_SIGNATURE EXCEP_TBL (0x0001)
117#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES) 150#define AE_BAD_HEADER EXCEP_TBL (0x0002)
118#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES) 151#define AE_BAD_CHECKSUM EXCEP_TBL (0x0003)
119#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES) 152#define AE_BAD_VALUE EXCEP_TBL (0x0004)
120#define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES) 153#define AE_INVALID_TABLE_LENGTH EXCEP_TBL (0x0005)
121 154
122#define AE_CODE_TBL_MAX 0x0005 155#define AE_CODE_TBL_MAX 0x0005
123 156
@@ -125,58 +158,58 @@
125 * AML exceptions. These are caused by problems with 158 * AML exceptions. These are caused by problems with
126 * the actual AML byte stream 159 * the actual AML byte stream
127 */ 160 */
128#define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML) 161#define AE_AML_BAD_OPCODE EXCEP_AML (0x0001)
129#define AE_AML_NO_OPERAND (acpi_status) (0x0002 | AE_CODE_AML) 162#define AE_AML_NO_OPERAND EXCEP_AML (0x0002)
130#define AE_AML_OPERAND_TYPE (acpi_status) (0x0003 | AE_CODE_AML) 163#define AE_AML_OPERAND_TYPE EXCEP_AML (0x0003)
131#define AE_AML_OPERAND_VALUE (acpi_status) (0x0004 | AE_CODE_AML) 164#define AE_AML_OPERAND_VALUE EXCEP_AML (0x0004)
132#define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0005 | AE_CODE_AML) 165#define AE_AML_UNINITIALIZED_LOCAL EXCEP_AML (0x0005)
133#define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0006 | AE_CODE_AML) 166#define AE_AML_UNINITIALIZED_ARG EXCEP_AML (0x0006)
134#define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0007 | AE_CODE_AML) 167#define AE_AML_UNINITIALIZED_ELEMENT EXCEP_AML (0x0007)
135#define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x0008 | AE_CODE_AML) 168#define AE_AML_NUMERIC_OVERFLOW EXCEP_AML (0x0008)
136#define AE_AML_REGION_LIMIT (acpi_status) (0x0009 | AE_CODE_AML) 169#define AE_AML_REGION_LIMIT EXCEP_AML (0x0009)
137#define AE_AML_BUFFER_LIMIT (acpi_status) (0x000A | AE_CODE_AML) 170#define AE_AML_BUFFER_LIMIT EXCEP_AML (0x000A)
138#define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000B | AE_CODE_AML) 171#define AE_AML_PACKAGE_LIMIT EXCEP_AML (0x000B)
139#define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000C | AE_CODE_AML) 172#define AE_AML_DIVIDE_BY_ZERO EXCEP_AML (0x000C)
140#define AE_AML_BAD_NAME (acpi_status) (0x000D | AE_CODE_AML) 173#define AE_AML_BAD_NAME EXCEP_AML (0x000D)
141#define AE_AML_NAME_NOT_FOUND (acpi_status) (0x000E | AE_CODE_AML) 174#define AE_AML_NAME_NOT_FOUND EXCEP_AML (0x000E)
142#define AE_AML_INTERNAL (acpi_status) (0x000F | AE_CODE_AML) 175#define AE_AML_INTERNAL EXCEP_AML (0x000F)
143#define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0010 | AE_CODE_AML) 176#define AE_AML_INVALID_SPACE_ID EXCEP_AML (0x0010)
144#define AE_AML_STRING_LIMIT (acpi_status) (0x0011 | AE_CODE_AML) 177#define AE_AML_STRING_LIMIT EXCEP_AML (0x0011)
145#define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0012 | AE_CODE_AML) 178#define AE_AML_NO_RETURN_VALUE EXCEP_AML (0x0012)
146#define AE_AML_METHOD_LIMIT (acpi_status) (0x0013 | AE_CODE_AML) 179#define AE_AML_METHOD_LIMIT EXCEP_AML (0x0013)
147#define AE_AML_NOT_OWNER (acpi_status) (0x0014 | AE_CODE_AML) 180#define AE_AML_NOT_OWNER EXCEP_AML (0x0014)
148#define AE_AML_MUTEX_ORDER (acpi_status) (0x0015 | AE_CODE_AML) 181#define AE_AML_MUTEX_ORDER EXCEP_AML (0x0015)
149#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0016 | AE_CODE_AML) 182#define AE_AML_MUTEX_NOT_ACQUIRED EXCEP_AML (0x0016)
150#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0017 | AE_CODE_AML) 183#define AE_AML_INVALID_RESOURCE_TYPE EXCEP_AML (0x0017)
151#define AE_AML_INVALID_INDEX (acpi_status) (0x0018 | AE_CODE_AML) 184#define AE_AML_INVALID_INDEX EXCEP_AML (0x0018)
152#define AE_AML_REGISTER_LIMIT (acpi_status) (0x0019 | AE_CODE_AML) 185#define AE_AML_REGISTER_LIMIT EXCEP_AML (0x0019)
153#define AE_AML_NO_WHILE (acpi_status) (0x001A | AE_CODE_AML) 186#define AE_AML_NO_WHILE EXCEP_AML (0x001A)
154#define AE_AML_ALIGNMENT (acpi_status) (0x001B | AE_CODE_AML) 187#define AE_AML_ALIGNMENT EXCEP_AML (0x001B)
155#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001C | AE_CODE_AML) 188#define AE_AML_NO_RESOURCE_END_TAG EXCEP_AML (0x001C)
156#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001D | AE_CODE_AML) 189#define AE_AML_BAD_RESOURCE_VALUE EXCEP_AML (0x001D)
157#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML) 190#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E)
158#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML) 191#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F)
159#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML) 192#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
160#define AE_AML_INFINITE_LOOP (acpi_status) (0x0021 | AE_CODE_AML) 193#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021)
161 194
162#define AE_CODE_AML_MAX 0x0021 195#define AE_CODE_AML_MAX 0x0021
163 196
164/* 197/*
165 * Internal exceptions used for control 198 * Internal exceptions used for control
166 */ 199 */
167#define AE_CTRL_RETURN_VALUE (acpi_status) (0x0001 | AE_CODE_CONTROL) 200#define AE_CTRL_RETURN_VALUE EXCEP_CTL (0x0001)
168#define AE_CTRL_PENDING (acpi_status) (0x0002 | AE_CODE_CONTROL) 201#define AE_CTRL_PENDING EXCEP_CTL (0x0002)
169#define AE_CTRL_TERMINATE (acpi_status) (0x0003 | AE_CODE_CONTROL) 202#define AE_CTRL_TERMINATE EXCEP_CTL (0x0003)
170#define AE_CTRL_TRUE (acpi_status) (0x0004 | AE_CODE_CONTROL) 203#define AE_CTRL_TRUE EXCEP_CTL (0x0004)
171#define AE_CTRL_FALSE (acpi_status) (0x0005 | AE_CODE_CONTROL) 204#define AE_CTRL_FALSE EXCEP_CTL (0x0005)
172#define AE_CTRL_DEPTH (acpi_status) (0x0006 | AE_CODE_CONTROL) 205#define AE_CTRL_DEPTH EXCEP_CTL (0x0006)
173#define AE_CTRL_END (acpi_status) (0x0007 | AE_CODE_CONTROL) 206#define AE_CTRL_END EXCEP_CTL (0x0007)
174#define AE_CTRL_TRANSFER (acpi_status) (0x0008 | AE_CODE_CONTROL) 207#define AE_CTRL_TRANSFER EXCEP_CTL (0x0008)
175#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL) 208#define AE_CTRL_BREAK EXCEP_CTL (0x0009)
176#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL) 209#define AE_CTRL_CONTINUE EXCEP_CTL (0x000A)
177#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL) 210#define AE_CTRL_SKIP EXCEP_CTL (0x000B)
178#define AE_CTRL_PARSE_CONTINUE (acpi_status) (0x000C | AE_CODE_CONTROL) 211#define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000C)
179#define AE_CTRL_PARSE_PENDING (acpi_status) (0x000D | AE_CODE_CONTROL) 212#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000D)
180 213
181#define AE_CODE_CTRL_MAX 0x000D 214#define AE_CODE_CTRL_MAX 0x000D
182 215
@@ -188,112 +221,156 @@
188 * String versions of the exception codes above 221 * String versions of the exception codes above
189 * These strings must match the corresponding defines exactly 222 * These strings must match the corresponding defines exactly
190 */ 223 */
191char const *acpi_gbl_exception_names_env[] = { 224static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
192 "AE_OK", 225 EXCEP_TXT("AE_OK", "No error"),
193 "AE_ERROR", 226 EXCEP_TXT("AE_ERROR", "Unspecified error"),
194 "AE_NO_ACPI_TABLES", 227 EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"),
195 "AE_NO_NAMESPACE", 228 EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"),
196 "AE_NO_MEMORY", 229 EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"),
197 "AE_NOT_FOUND", 230 EXCEP_TXT("AE_NOT_FOUND", "The name was not found in the namespace"),
198 "AE_NOT_EXIST", 231 EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"),
199 "AE_ALREADY_EXISTS", 232 EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"),
200 "AE_TYPE", 233 EXCEP_TXT("AE_TYPE", "The object type is incorrect"),
201 "AE_NULL_OBJECT", 234 EXCEP_TXT("AE_NULL_OBJECT", "A required object was missing"),
202 "AE_NULL_ENTRY", 235 EXCEP_TXT("AE_NULL_ENTRY", "The requested object does not exist"),
203 "AE_BUFFER_OVERFLOW", 236 EXCEP_TXT("AE_BUFFER_OVERFLOW", "The buffer provided is too small"),
204 "AE_STACK_OVERFLOW", 237 EXCEP_TXT("AE_STACK_OVERFLOW", "An internal stack overflowed"),
205 "AE_STACK_UNDERFLOW", 238 EXCEP_TXT("AE_STACK_UNDERFLOW", "An internal stack underflowed"),
206 "AE_NOT_IMPLEMENTED", 239 EXCEP_TXT("AE_NOT_IMPLEMENTED", "The feature is not implemented"),
207 "AE_SUPPORT", 240 EXCEP_TXT("AE_SUPPORT", "The feature is not supported"),
208 "AE_LIMIT", 241 EXCEP_TXT("AE_LIMIT", "A predefined limit was exceeded"),
209 "AE_TIME", 242 EXCEP_TXT("AE_TIME", "A time limit or timeout expired"),
210 "AE_ACQUIRE_DEADLOCK", 243 EXCEP_TXT("AE_ACQUIRE_DEADLOCK",
211 "AE_RELEASE_DEADLOCK", 244 "Internal error, attempt was made to acquire a mutex in improper order"),
212 "AE_NOT_ACQUIRED", 245 EXCEP_TXT("AE_RELEASE_DEADLOCK",
213 "AE_ALREADY_ACQUIRED", 246 "Internal error, attempt was made to release a mutex in improper order"),
214 "AE_NO_HARDWARE_RESPONSE", 247 EXCEP_TXT("AE_NOT_ACQUIRED",
215 "AE_NO_GLOBAL_LOCK", 248 "An attempt to release a mutex or Global Lock without a previous acquire"),
216 "AE_ABORT_METHOD", 249 EXCEP_TXT("AE_ALREADY_ACQUIRED",
217 "AE_SAME_HANDLER", 250 "Internal error, attempt was made to acquire a mutex twice"),
218 "AE_NO_HANDLER", 251 EXCEP_TXT("AE_NO_HARDWARE_RESPONSE",
219 "AE_OWNER_ID_LIMIT", 252 "Hardware did not respond after an I/O operation"),
220 "AE_NOT_CONFIGURED" 253 EXCEP_TXT("AE_NO_GLOBAL_LOCK", "There is no FACS Global Lock"),
254 EXCEP_TXT("AE_ABORT_METHOD", "A control method was aborted"),
255 EXCEP_TXT("AE_SAME_HANDLER",
256 "Attempt was made to install the same handler that is already installed"),
257 EXCEP_TXT("AE_NO_HANDLER",
258 "A handler for the operation is not installed"),
259 EXCEP_TXT("AE_OWNER_ID_LIMIT",
260 "There are no more Owner IDs available for ACPI tables or control methods"),
261 EXCEP_TXT("AE_NOT_CONFIGURED",
262 "The interface is not part of the current subsystem configuration")
221}; 263};
222 264
223char const *acpi_gbl_exception_names_pgm[] = { 265static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
224 NULL, 266 EXCEP_TXT(NULL, NULL),
225 "AE_BAD_PARAMETER", 267 EXCEP_TXT("AE_BAD_PARAMETER", "A parameter is out of range or invalid"),
226 "AE_BAD_CHARACTER", 268 EXCEP_TXT("AE_BAD_CHARACTER",
227 "AE_BAD_PATHNAME", 269 "An invalid character was found in a name"),
228 "AE_BAD_DATA", 270 EXCEP_TXT("AE_BAD_PATHNAME",
229 "AE_BAD_HEX_CONSTANT", 271 "An invalid character was found in a pathname"),
230 "AE_BAD_OCTAL_CONSTANT", 272 EXCEP_TXT("AE_BAD_DATA",
231 "AE_BAD_DECIMAL_CONSTANT", 273 "A package or buffer contained incorrect data"),
232 "AE_MISSING_ARGUMENTS", 274 EXCEP_TXT("AE_BAD_HEX_CONSTANT", "Invalid character in a Hex constant"),
233 "AE_BAD_ADDRESS" 275 EXCEP_TXT("AE_BAD_OCTAL_CONSTANT",
276 "Invalid character in an Octal constant"),
277 EXCEP_TXT("AE_BAD_DECIMAL_CONSTANT",
278 "Invalid character in a Decimal constant"),
279 EXCEP_TXT("AE_MISSING_ARGUMENTS",
280 "Too few arguments were passed to a control method"),
281 EXCEP_TXT("AE_BAD_ADDRESS", "An illegal null I/O address")
234}; 282};
235 283
236char const *acpi_gbl_exception_names_tbl[] = { 284static const struct acpi_exception_info acpi_gbl_exception_names_tbl[] = {
237 NULL, 285 EXCEP_TXT(NULL, NULL),
238 "AE_BAD_SIGNATURE", 286 EXCEP_TXT("AE_BAD_SIGNATURE", "An ACPI table has an invalid signature"),
239 "AE_BAD_HEADER", 287 EXCEP_TXT("AE_BAD_HEADER", "Invalid field in an ACPI table header"),
240 "AE_BAD_CHECKSUM", 288 EXCEP_TXT("AE_BAD_CHECKSUM", "An ACPI table checksum is not correct"),
241 "AE_BAD_VALUE", 289 EXCEP_TXT("AE_BAD_VALUE", "An invalid value was found in a table"),
242 "AE_INVALID_TABLE_LENGTH" 290 EXCEP_TXT("AE_INVALID_TABLE_LENGTH",
291 "The FADT or FACS has improper length")
243}; 292};
244 293
245char const *acpi_gbl_exception_names_aml[] = { 294static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
246 NULL, 295 EXCEP_TXT(NULL, NULL),
247 "AE_AML_BAD_OPCODE", 296 EXCEP_TXT("AE_AML_BAD_OPCODE", "Invalid AML opcode encountered"),
248 "AE_AML_NO_OPERAND", 297 EXCEP_TXT("AE_AML_NO_OPERAND", "A required operand is missing"),
249 "AE_AML_OPERAND_TYPE", 298 EXCEP_TXT("AE_AML_OPERAND_TYPE",
250 "AE_AML_OPERAND_VALUE", 299 "An operand of an incorrect type was encountered"),
251 "AE_AML_UNINITIALIZED_LOCAL", 300 EXCEP_TXT("AE_AML_OPERAND_VALUE",
252 "AE_AML_UNINITIALIZED_ARG", 301 "The operand had an inappropriate or invalid value"),
253 "AE_AML_UNINITIALIZED_ELEMENT", 302 EXCEP_TXT("AE_AML_UNINITIALIZED_LOCAL",
254 "AE_AML_NUMERIC_OVERFLOW", 303 "Method tried to use an uninitialized local variable"),
255 "AE_AML_REGION_LIMIT", 304 EXCEP_TXT("AE_AML_UNINITIALIZED_ARG",
256 "AE_AML_BUFFER_LIMIT", 305 "Method tried to use an uninitialized argument"),
257 "AE_AML_PACKAGE_LIMIT", 306 EXCEP_TXT("AE_AML_UNINITIALIZED_ELEMENT",
258 "AE_AML_DIVIDE_BY_ZERO", 307 "Method tried to use an empty package element"),
259 "AE_AML_BAD_NAME", 308 EXCEP_TXT("AE_AML_NUMERIC_OVERFLOW",
260 "AE_AML_NAME_NOT_FOUND", 309 "Overflow during BCD conversion or other"),
261 "AE_AML_INTERNAL", 310 EXCEP_TXT("AE_AML_REGION_LIMIT",
262 "AE_AML_INVALID_SPACE_ID", 311 "Tried to access beyond the end of an Operation Region"),
263 "AE_AML_STRING_LIMIT", 312 EXCEP_TXT("AE_AML_BUFFER_LIMIT",
264 "AE_AML_NO_RETURN_VALUE", 313 "Tried to access beyond the end of a buffer"),
265 "AE_AML_METHOD_LIMIT", 314 EXCEP_TXT("AE_AML_PACKAGE_LIMIT",
266 "AE_AML_NOT_OWNER", 315 "Tried to access beyond the end of a package"),
267 "AE_AML_MUTEX_ORDER", 316 EXCEP_TXT("AE_AML_DIVIDE_BY_ZERO",
268 "AE_AML_MUTEX_NOT_ACQUIRED", 317 "During execution of AML Divide operator"),
269 "AE_AML_INVALID_RESOURCE_TYPE", 318 EXCEP_TXT("AE_AML_BAD_NAME",
270 "AE_AML_INVALID_INDEX", 319 "An ACPI name contains invalid character(s)"),
271 "AE_AML_REGISTER_LIMIT", 320 EXCEP_TXT("AE_AML_NAME_NOT_FOUND",
272 "AE_AML_NO_WHILE", 321 "Could not resolve a named reference"),
273 "AE_AML_ALIGNMENT", 322 EXCEP_TXT("AE_AML_INTERNAL", "An internal error within the interprete"),
274 "AE_AML_NO_RESOURCE_END_TAG", 323 EXCEP_TXT("AE_AML_INVALID_SPACE_ID",
275 "AE_AML_BAD_RESOURCE_VALUE", 324 "An Operation Region SpaceID is invalid"),
276 "AE_AML_CIRCULAR_REFERENCE", 325 EXCEP_TXT("AE_AML_STRING_LIMIT",
277 "AE_AML_BAD_RESOURCE_LENGTH", 326 "String is longer than 200 characters"),
278 "AE_AML_ILLEGAL_ADDRESS", 327 EXCEP_TXT("AE_AML_NO_RETURN_VALUE",
279 "AE_AML_INFINITE_LOOP" 328 "A method did not return a required value"),
329 EXCEP_TXT("AE_AML_METHOD_LIMIT",
330 "A control method reached the maximum reentrancy limit of 255"),
331 EXCEP_TXT("AE_AML_NOT_OWNER",
332 "A thread tried to release a mutex that it does not own"),
333 EXCEP_TXT("AE_AML_MUTEX_ORDER", "Mutex SyncLevel release mismatch"),
334 EXCEP_TXT("AE_AML_MUTEX_NOT_ACQUIRED",
335 "Attempt to release a mutex that was not previously acquired"),
336 EXCEP_TXT("AE_AML_INVALID_RESOURCE_TYPE",
337 "Invalid resource type in resource list"),
338 EXCEP_TXT("AE_AML_INVALID_INDEX",
339 "Invalid Argx or Localx (x too large)"),
340 EXCEP_TXT("AE_AML_REGISTER_LIMIT",
341 "Bank value or Index value beyond range of register"),
342 EXCEP_TXT("AE_AML_NO_WHILE", "Break or Continue without a While"),
343 EXCEP_TXT("AE_AML_ALIGNMENT",
344 "Non-aligned memory transfer on platform that does not support this"),
345 EXCEP_TXT("AE_AML_NO_RESOURCE_END_TAG",
346 "No End Tag in a resource list"),
347 EXCEP_TXT("AE_AML_BAD_RESOURCE_VALUE",
348 "Invalid value of a resource element"),
349 EXCEP_TXT("AE_AML_CIRCULAR_REFERENCE",
350 "Two references refer to each other"),
351 EXCEP_TXT("AE_AML_BAD_RESOURCE_LENGTH",
352 "The length of a Resource Descriptor in the AML is incorrect"),
353 EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS",
354 "A memory, I/O, or PCI configuration address is invalid"),
355 EXCEP_TXT("AE_AML_INFINITE_LOOP",
356 "An apparent infinite AML While loop, method was aborted")
280}; 357};
281 358
282char const *acpi_gbl_exception_names_ctrl[] = { 359static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {
283 NULL, 360 EXCEP_TXT(NULL, NULL),
284 "AE_CTRL_RETURN_VALUE", 361 EXCEP_TXT("AE_CTRL_RETURN_VALUE", "A Method returned a value"),
285 "AE_CTRL_PENDING", 362 EXCEP_TXT("AE_CTRL_PENDING", "Method is calling another method"),
286 "AE_CTRL_TERMINATE", 363 EXCEP_TXT("AE_CTRL_TERMINATE", "Terminate the executing method"),
287 "AE_CTRL_TRUE", 364 EXCEP_TXT("AE_CTRL_TRUE", "An If or While predicate result"),
288 "AE_CTRL_FALSE", 365 EXCEP_TXT("AE_CTRL_FALSE", "An If or While predicate result"),
289 "AE_CTRL_DEPTH", 366 EXCEP_TXT("AE_CTRL_DEPTH", "Maximum search depth has been reached"),
290 "AE_CTRL_END", 367 EXCEP_TXT("AE_CTRL_END", "An If or While predicate is false"),
291 "AE_CTRL_TRANSFER", 368 EXCEP_TXT("AE_CTRL_TRANSFER", "Transfer control to called method"),
292 "AE_CTRL_BREAK", 369 EXCEP_TXT("AE_CTRL_BREAK", "A Break has been executed"),
293 "AE_CTRL_CONTINUE", 370 EXCEP_TXT("AE_CTRL_CONTINUE", "A Continue has been executed"),
294 "AE_CTRL_SKIP", 371 EXCEP_TXT("AE_CTRL_SKIP", "Not currently used"),
295 "AE_CTRL_PARSE_CONTINUE", 372 EXCEP_TXT("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"),
296 "AE_CTRL_PARSE_PENDING" 373 EXCEP_TXT("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops")
297}; 374};
298 375
299#endif /* EXCEPTION_TABLE */ 376#endif /* EXCEPTION_TABLE */
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 9885276178e0..4f52ea795c7a 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -324,9 +324,9 @@
324 324
325/* Helper macro */ 325/* Helper macro */
326 326
327#define ACPI_TRACE_ENTRY(name, function, cast, param) \ 327#define ACPI_TRACE_ENTRY(name, function, type, param) \
328 ACPI_FUNCTION_NAME (name) \ 328 ACPI_FUNCTION_NAME (name) \
329 function (ACPI_DEBUG_PARAMETERS, cast (param)) 329 function (ACPI_DEBUG_PARAMETERS, (type) (param))
330 330
331/* The actual entry trace macros */ 331/* The actual entry trace macros */
332 332
@@ -335,13 +335,13 @@
335 acpi_ut_trace (ACPI_DEBUG_PARAMETERS) 335 acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
336 336
337#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ 337#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
338 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer) 338 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer)
339 339
340#define ACPI_FUNCTION_TRACE_U32(name, value) \ 340#define ACPI_FUNCTION_TRACE_U32(name, value) \
341 ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value) 341 ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value)
342 342
343#define ACPI_FUNCTION_TRACE_STR(name, string) \ 343#define ACPI_FUNCTION_TRACE_STR(name, string) \
344 ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string) 344 ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string)
345 345
346#define ACPI_FUNCTION_ENTRY() \ 346#define ACPI_FUNCTION_ENTRY() \
347 acpi_ut_track_stack_ptr() 347 acpi_ut_track_stack_ptr()
@@ -355,16 +355,37 @@
355 * 355 *
356 * One of the FUNCTION_TRACE macros above must be used in conjunction 356 * One of the FUNCTION_TRACE macros above must be used in conjunction
357 * with these macros so that "_AcpiFunctionName" is defined. 357 * with these macros so that "_AcpiFunctionName" is defined.
358 *
359 * There are two versions of most of the return macros. The default version is
360 * safer, since it avoids side-effects by guaranteeing that the argument will
361 * not be evaluated twice.
362 *
363 * A less-safe version of the macros is provided for optional use if the
364 * compiler uses excessive CPU stack (for example, this may happen in the
365 * debug case if code optimzation is disabled.)
358 */ 366 */
359 367
360/* Exit trace helper macro */ 368/* Exit trace helper macro */
361 369
362#define ACPI_TRACE_EXIT(function, cast, param) \ 370#ifndef ACPI_SIMPLE_RETURN_MACROS
371
372#define ACPI_TRACE_EXIT(function, type, param) \
373 ACPI_DO_WHILE0 ({ \
374 register type _param = (type) (param); \
375 function (ACPI_DEBUG_PARAMETERS, _param); \
376 return (_param); \
377 })
378
379#else /* Use original less-safe macros */
380
381#define ACPI_TRACE_EXIT(function, type, param) \
363 ACPI_DO_WHILE0 ({ \ 382 ACPI_DO_WHILE0 ({ \
364 function (ACPI_DEBUG_PARAMETERS, cast (param)); \ 383 function (ACPI_DEBUG_PARAMETERS, (type) (param)); \
365 return ((param)); \ 384 return (param); \
366 }) 385 })
367 386
387#endif /* ACPI_SIMPLE_RETURN_MACROS */
388
368/* The actual exit macros */ 389/* The actual exit macros */
369 390
370#define return_VOID \ 391#define return_VOID \
@@ -374,13 +395,19 @@
374 }) 395 })
375 396
376#define return_ACPI_STATUS(status) \ 397#define return_ACPI_STATUS(status) \
377 ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status) 398 ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status)
378 399
379#define return_PTR(pointer) \ 400#define return_PTR(pointer) \
380 ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer) 401 ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer)
381 402
382#define return_VALUE(value) \ 403#define return_VALUE(value) \
383 ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value) 404 ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value)
405
406#define return_UINT32(value) \
407 ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value)
408
409#define return_UINT8(value) \
410 ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value)
384 411
385/* Conditional execution */ 412/* Conditional execution */
386 413
@@ -428,8 +455,10 @@
428 455
429#define return_VOID return 456#define return_VOID return
430#define return_ACPI_STATUS(s) return(s) 457#define return_ACPI_STATUS(s) return(s)
431#define return_VALUE(s) return(s)
432#define return_PTR(s) return(s) 458#define return_PTR(s) return(s)
459#define return_VALUE(s) return(s)
460#define return_UINT8(s) return(s)
461#define return_UINT32(s) return(s)
433 462
434#endif /* ACPI_DEBUG_OUTPUT */ 463#endif /* ACPI_DEBUG_OUTPUT */
435 464
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 22ba56e834e2..636c59f2003a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -88,11 +88,30 @@ struct acpi_device;
88 * ----------------- 88 * -----------------
89 */ 89 */
90 90
91enum acpi_hotplug_mode {
92 AHM_GENERIC = 0,
93 AHM_CONTAINER,
94 AHM_COUNT
95};
96
97struct acpi_hotplug_profile {
98 struct kobject kobj;
99 bool enabled:1;
100 enum acpi_hotplug_mode mode;
101};
102
103static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
104 struct kobject *kobj)
105{
106 return container_of(kobj, struct acpi_hotplug_profile, kobj);
107}
108
91struct acpi_scan_handler { 109struct acpi_scan_handler {
92 const struct acpi_device_id *ids; 110 const struct acpi_device_id *ids;
93 struct list_head list_node; 111 struct list_head list_node;
94 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); 112 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
95 void (*detach)(struct acpi_device *dev); 113 void (*detach)(struct acpi_device *dev);
114 struct acpi_hotplug_profile hotplug;
96}; 115};
97 116
98/* 117/*
@@ -142,7 +161,6 @@ struct acpi_device_status {
142 161
143struct acpi_device_flags { 162struct acpi_device_flags {
144 u32 dynamic_status:1; 163 u32 dynamic_status:1;
145 u32 bus_address:1;
146 u32 removable:1; 164 u32 removable:1;
147 u32 ejectable:1; 165 u32 ejectable:1;
148 u32 suprise_removal_ok:1; 166 u32 suprise_removal_ok:1;
@@ -150,7 +168,7 @@ struct acpi_device_flags {
150 u32 performance_manageable:1; 168 u32 performance_manageable:1;
151 u32 eject_pending:1; 169 u32 eject_pending:1;
152 u32 match_driver:1; 170 u32 match_driver:1;
153 u32 reserved:23; 171 u32 reserved:24;
154}; 172};
155 173
156/* File System */ 174/* File System */
@@ -173,10 +191,17 @@ struct acpi_hardware_id {
173 char *id; 191 char *id;
174}; 192};
175 193
194struct acpi_pnp_type {
195 u32 hardware_id:1;
196 u32 bus_address:1;
197 u32 reserved:30;
198};
199
176struct acpi_device_pnp { 200struct acpi_device_pnp {
177 acpi_bus_id bus_id; /* Object name */ 201 acpi_bus_id bus_id; /* Object name */
202 struct acpi_pnp_type type; /* ID type */
178 acpi_bus_address bus_address; /* _ADR */ 203 acpi_bus_address bus_address; /* _ADR */
179 char *unique_id; /* _UID */ 204 char *unique_id; /* _UID */
180 struct list_head ids; /* _HID and _CIDs */ 205 struct list_head ids; /* _HID and _CIDs */
181 acpi_device_name device_name; /* Driver-determined */ 206 acpi_device_name device_name; /* Driver-determined */
182 acpi_device_class device_class; /* " */ 207 acpi_device_class device_class; /* " */
@@ -352,7 +377,6 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
352 unsigned long long *sta); 377 unsigned long long *sta);
353int acpi_bus_get_status(struct acpi_device *device); 378int acpi_bus_get_status(struct acpi_device *device);
354 379
355#ifdef CONFIG_PM
356int acpi_bus_set_power(acpi_handle handle, int state); 380int acpi_bus_set_power(acpi_handle handle, int state);
357const char *acpi_power_state_string(int state); 381const char *acpi_power_state_string(int state);
358int acpi_device_get_power(struct acpi_device *device, int *state); 382int acpi_device_get_power(struct acpi_device *device, int *state);
@@ -360,41 +384,12 @@ int acpi_device_set_power(struct acpi_device *device, int state);
360int acpi_bus_init_power(struct acpi_device *device); 384int acpi_bus_init_power(struct acpi_device *device);
361int acpi_bus_update_power(acpi_handle handle, int *state_p); 385int acpi_bus_update_power(acpi_handle handle, int *state_p);
362bool acpi_bus_power_manageable(acpi_handle handle); 386bool acpi_bus_power_manageable(acpi_handle handle);
387
388#ifdef CONFIG_PM
363bool acpi_bus_can_wakeup(acpi_handle handle); 389bool acpi_bus_can_wakeup(acpi_handle handle);
364#else /* !CONFIG_PM */ 390#else
365static inline int acpi_bus_set_power(acpi_handle handle, int state) 391static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; }
366{ 392#endif
367 return 0;
368}
369static inline const char *acpi_power_state_string(int state)
370{
371 return "D0";
372}
373static inline int acpi_device_get_power(struct acpi_device *device, int *state)
374{
375 return 0;
376}
377static inline int acpi_device_set_power(struct acpi_device *device, int state)
378{
379 return 0;
380}
381static inline int acpi_bus_init_power(struct acpi_device *device)
382{
383 return 0;
384}
385static inline int acpi_bus_update_power(acpi_handle handle, int *state_p)
386{
387 return 0;
388}
389static inline bool acpi_bus_power_manageable(acpi_handle handle)
390{
391 return false;
392}
393static inline bool acpi_bus_can_wakeup(acpi_handle handle)
394{
395 return false;
396}
397#endif /* !CONFIG_PM */
398 393
399#ifdef CONFIG_ACPI_PROC_EVENT 394#ifdef CONFIG_ACPI_PROC_EVENT
400int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 395int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 627749af0ba7..e6168a24b9f0 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -95,7 +95,6 @@ int acpi_pci_link_free_irq(acpi_handle handle);
95struct pci_bus; 95struct pci_bus;
96 96
97struct pci_dev *acpi_get_pci_dev(acpi_handle); 97struct pci_dev *acpi_get_pci_dev(acpi_handle);
98int acpi_pci_bind_root(struct acpi_device *device);
99 98
100/* Arch-defined function to add a bus to the system */ 99/* Arch-defined function to add a bus to the system */
101 100
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd4813a..64b8c7639520 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -77,7 +77,7 @@ struct acpi_signal_fatal_info {
77/* 77/*
78 * OSL Initialization and shutdown primitives 78 * OSL Initialization and shutdown primitives
79 */ 79 */
80acpi_status __initdata acpi_os_initialize(void); 80acpi_status __init acpi_os_initialize(void);
81 81
82acpi_status acpi_os_terminate(void); 82acpi_status acpi_os_terminate(void);
83 83
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 03322dddd88e..454881e6450a 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -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 0x20130117 49#define ACPI_CA_VERSION 0x20130328
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 77dc7a4099a3..ffaac0e7e0c6 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -72,11 +72,13 @@
72#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ 72#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
73#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 73#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
74#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ 74#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
75#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */
75#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ 76#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
76#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 77#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
77#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ 78#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
78#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 79#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
79#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ 80#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
81#define ACPI_SIG_VRTC "VRTC" /* Virtual Real Time Clock Table */
80#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ 82#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */
81#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ 83#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
82#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ 84#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */
@@ -852,6 +854,29 @@ struct acpi_table_mchi {
852 854
853/******************************************************************************* 855/*******************************************************************************
854 * 856 *
857 * MTMR - MID Timer Table
858 * Version 1
859 *
860 * Conforms to "Simple Firmware Interface Specification",
861 * Draft 0.8.2, Oct 19, 2010
862 * NOTE: The ACPI MTMR is equivalent to the SFI MTMR table.
863 *
864 ******************************************************************************/
865
866struct acpi_table_mtmr {
867 struct acpi_table_header header; /* Common ACPI table header */
868};
869
870/* MTMR entry */
871
872struct acpi_mtmr_entry {
873 struct acpi_generic_address physical_address;
874 u32 frequency;
875 u32 irq;
876};
877
878/*******************************************************************************
879 *
855 * SLIC - Software Licensing Description Table 880 * SLIC - Software Licensing Description Table
856 * Version 1 881 * Version 1
857 * 882 *
@@ -1025,6 +1050,28 @@ struct acpi_table_uefi {
1025 1050
1026/******************************************************************************* 1051/*******************************************************************************
1027 * 1052 *
1053 * VRTC - Virtual Real Time Clock Table
1054 * Version 1
1055 *
1056 * Conforms to "Simple Firmware Interface Specification",
1057 * Draft 0.8.2, Oct 19, 2010
1058 * NOTE: The ACPI VRTC is equivalent to The SFI MRTC table.
1059 *
1060 ******************************************************************************/
1061
1062struct acpi_table_vrtc {
1063 struct acpi_table_header header; /* Common ACPI table header */
1064};
1065
1066/* VRTC entry */
1067
1068struct acpi_vrtc_entry {
1069 struct acpi_generic_address physical_address;
1070 u32 irq;
1071};
1072
1073/*******************************************************************************
1074 *
1028 * WAET - Windows ACPI Emulated devices Table 1075 * WAET - Windows ACPI Emulated devices Table
1029 * Version 1 1076 * Version 1
1030 * 1077 *
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index 332b17e3bec8..e2c0931a3d67 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -174,7 +174,7 @@ struct acpi_fpdt_header {
174 174
175enum acpi_fpdt_type { 175enum acpi_fpdt_type {
176 ACPI_FPDT_TYPE_BOOT = 0, 176 ACPI_FPDT_TYPE_BOOT = 0,
177 ACPI_FPDT_TYPE_S3PERF = 1, 177 ACPI_FPDT_TYPE_S3PERF = 1
178}; 178};
179 179
180/* 180/*
@@ -223,7 +223,7 @@ struct acpi_s3pt_header {
223 223
224enum acpi_s3pt_type { 224enum acpi_s3pt_type {
225 ACPI_S3PT_TYPE_RESUME = 0, 225 ACPI_S3PT_TYPE_RESUME = 0,
226 ACPI_S3PT_TYPE_SUSPEND = 1, 226 ACPI_S3PT_TYPE_SUSPEND = 1
227}; 227};
228 228
229struct acpi_s3pt_resume { 229struct acpi_s3pt_resume {
@@ -505,26 +505,59 @@ struct acpi_rasf_shared_memory {
505 u32 signature; 505 u32 signature;
506 u16 command; 506 u16 command;
507 u16 status; 507 u16 status;
508 u64 requested_address; 508 u16 version;
509 u64 requested_length; 509 u8 capabilities[16];
510 u64 actual_address; 510 u8 set_capabilities[16];
511 u64 actual_length; 511 u16 num_parameter_blocks;
512 u32 set_capabilities_status;
513};
514
515/* RASF Parameter Block Structure Header */
516
517struct acpi_rasf_parameter_block {
518 u16 type;
519 u16 version;
520 u16 length;
521};
522
523/* RASF Parameter Block Structure for PATROL_SCRUB */
524
525struct acpi_rasf_patrol_scrub_parameter {
526 struct acpi_rasf_parameter_block header;
527 u16 patrol_scrub_command;
528 u64 requested_address_range[2];
529 u64 actual_address_range[2];
512 u16 flags; 530 u16 flags;
513 u8 speed; 531 u8 requested_speed;
514}; 532};
515 533
516/* Masks for Flags and Speed fields above */ 534/* Masks for Flags and Speed fields above */
517 535
518#define ACPI_RASF_SCRUBBER_RUNNING 1 536#define ACPI_RASF_SCRUBBER_RUNNING 1
519#define ACPI_RASF_SPEED (7<<1) 537#define ACPI_RASF_SPEED (7<<1)
538#define ACPI_RASF_SPEED_SLOW (0<<1)
539#define ACPI_RASF_SPEED_MEDIUM (4<<1)
540#define ACPI_RASF_SPEED_FAST (7<<1)
520 541
521/* Channel Commands */ 542/* Channel Commands */
522 543
523enum acpi_rasf_commands { 544enum acpi_rasf_commands {
524 ACPI_RASF_GET_RAS_CAPABILITIES = 1, 545 ACPI_RASF_EXECUTE_RASF_COMMAND = 1
525 ACPI_RASF_GET_PATROL_PARAMETERS = 2, 546};
526 ACPI_RASF_START_PATROL_SCRUBBER = 3, 547
527 ACPI_RASF_STOP_PATROL_SCRUBBER = 4 548/* Platform RAS Capabilities */
549
550enum acpi_rasf_capabiliities {
551 ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
552 ACPI_SW_PATROL_SCRUB_EXPOSED = 1
553};
554
555/* Patrol Scrub Commands */
556
557enum acpi_rasf_patrol_scrub_commands {
558 ACPI_RASF_GET_PATROL_PARAMETERS = 1,
559 ACPI_RASF_START_PATROL_SCRUBBER = 2,
560 ACPI_RASF_STOP_PATROL_SCRUBBER = 3
528}; 561};
529 562
530/* Channel Command flags */ 563/* Channel Command flags */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 845e75f1ffd8..a64adcc29ae5 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -650,13 +650,14 @@ typedef u32 acpi_event_type;
650 * The encoding of acpi_event_status is illustrated below. 650 * The encoding of acpi_event_status is illustrated below.
651 * Note that a set bit (1) indicates the property is TRUE 651 * Note that a set bit (1) indicates the property is TRUE
652 * (e.g. if bit 0 is set then the event is enabled). 652 * (e.g. if bit 0 is set then the event is enabled).
653 * +-------------+-+-+-+ 653 * +-------------+-+-+-+-+
654 * | Bits 31:3 |2|1|0| 654 * | Bits 31:4 |3|2|1|0|
655 * +-------------+-+-+-+ 655 * +-------------+-+-+-+-+
656 * | | | | 656 * | | | | |
657 * | | | +- Enabled? 657 * | | | | +- Enabled?
658 * | | +--- Enabled for wake? 658 * | | | +--- Enabled for wake?
659 * | +----- Set? 659 * | | +----- Set?
660 * | +------- Has a handler?
660 * +----------- <Reserved> 661 * +----------- <Reserved>
661 */ 662 */
662typedef u32 acpi_event_status; 663typedef u32 acpi_event_status;
@@ -1128,7 +1129,6 @@ struct acpi_memory_list {
1128 u16 object_size; 1129 u16 object_size;
1129 u16 max_depth; 1130 u16 max_depth;
1130 u16 current_depth; 1131 u16 current_depth;
1131 u16 link_offset;
1132 1132
1133#ifdef ACPI_DBG_TRACK_ALLOCATIONS 1133#ifdef ACPI_DBG_TRACK_ALLOCATIONS
1134 1134
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index b327b5a9296d..ea69367fdd3b 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -329,10 +329,16 @@ int acpi_processor_power_init(struct acpi_processor *pr);
329int acpi_processor_power_exit(struct acpi_processor *pr); 329int acpi_processor_power_exit(struct acpi_processor *pr);
330int acpi_processor_cst_has_changed(struct acpi_processor *pr); 330int acpi_processor_cst_has_changed(struct acpi_processor *pr);
331int acpi_processor_hotplug(struct acpi_processor *pr); 331int acpi_processor_hotplug(struct acpi_processor *pr);
332int acpi_processor_suspend(struct device *dev);
333int acpi_processor_resume(struct device *dev);
334extern struct cpuidle_driver acpi_idle_driver; 332extern struct cpuidle_driver acpi_idle_driver;
335 333
334#ifdef CONFIG_PM_SLEEP
335void acpi_processor_syscore_init(void);
336void acpi_processor_syscore_exit(void);
337#else
338static inline void acpi_processor_syscore_init(void) {}
339static inline void acpi_processor_syscore_exit(void) {}
340#endif
341
336/* in processor_thermal.c */ 342/* in processor_thermal.c */
337int acpi_processor_get_limit_info(struct acpi_processor *pr); 343int acpi_processor_get_limit_info(struct acpi_processor *pr);
338extern const struct thermal_cooling_device_ops processor_cooling_ops; 344extern const struct thermal_cooling_device_ops processor_cooling_ops;
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h
index a8ece9a33aef..2c9e62c2bfd0 100644
--- a/include/asm-generic/cputime_nsecs.h
+++ b/include/asm-generic/cputime_nsecs.h
@@ -16,21 +16,27 @@
16#ifndef _ASM_GENERIC_CPUTIME_NSECS_H 16#ifndef _ASM_GENERIC_CPUTIME_NSECS_H
17#define _ASM_GENERIC_CPUTIME_NSECS_H 17#define _ASM_GENERIC_CPUTIME_NSECS_H
18 18
19#include <linux/math64.h>
20
19typedef u64 __nocast cputime_t; 21typedef u64 __nocast cputime_t;
20typedef u64 __nocast cputime64_t; 22typedef u64 __nocast cputime64_t;
21 23
22#define cputime_one_jiffy jiffies_to_cputime(1) 24#define cputime_one_jiffy jiffies_to_cputime(1)
23 25
26#define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor)
27#define cputime_div_rem(__ct, divisor, remainder) \
28 div_u64_rem((__force u64)__ct, divisor, remainder);
29
24/* 30/*
25 * Convert cputime <-> jiffies (HZ) 31 * Convert cputime <-> jiffies (HZ)
26 */ 32 */
27#define cputime_to_jiffies(__ct) \ 33#define cputime_to_jiffies(__ct) \
28 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) 34 cputime_div(__ct, NSEC_PER_SEC / HZ)
29#define cputime_to_scaled(__ct) (__ct) 35#define cputime_to_scaled(__ct) (__ct)
30#define jiffies_to_cputime(__jif) \ 36#define jiffies_to_cputime(__jif) \
31 (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) 37 (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
32#define cputime64_to_jiffies64(__ct) \ 38#define cputime64_to_jiffies64(__ct) \
33 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) 39 cputime_div(__ct, NSEC_PER_SEC / HZ)
34#define jiffies64_to_cputime64(__jif) \ 40#define jiffies64_to_cputime64(__jif) \
35 (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) 41 (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
36 42
@@ -45,7 +51,7 @@ typedef u64 __nocast cputime64_t;
45 * Convert cputime <-> microseconds 51 * Convert cputime <-> microseconds
46 */ 52 */
47#define cputime_to_usecs(__ct) \ 53#define cputime_to_usecs(__ct) \
48 ((__force u64)(__ct) / NSEC_PER_USEC) 54 cputime_div(__ct, NSEC_PER_USEC)
49#define usecs_to_cputime(__usecs) \ 55#define usecs_to_cputime(__usecs) \
50 (__force cputime_t)((__usecs) * NSEC_PER_USEC) 56 (__force cputime_t)((__usecs) * NSEC_PER_USEC)
51#define usecs_to_cputime64(__usecs) \ 57#define usecs_to_cputime64(__usecs) \
@@ -55,7 +61,7 @@ typedef u64 __nocast cputime64_t;
55 * Convert cputime <-> seconds 61 * Convert cputime <-> seconds
56 */ 62 */
57#define cputime_to_secs(__ct) \ 63#define cputime_to_secs(__ct) \
58 ((__force u64)(__ct) / NSEC_PER_SEC) 64 cputime_div(__ct, NSEC_PER_SEC)
59#define secs_to_cputime(__secs) \ 65#define secs_to_cputime(__secs) \
60 (__force cputime_t)((__secs) * NSEC_PER_SEC) 66 (__force cputime_t)((__secs) * NSEC_PER_SEC)
61 67
@@ -69,8 +75,10 @@ static inline cputime_t timespec_to_cputime(const struct timespec *val)
69} 75}
70static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) 76static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
71{ 77{
72 val->tv_sec = (__force u64) ct / NSEC_PER_SEC; 78 u32 rem;
73 val->tv_nsec = (__force u64) ct % NSEC_PER_SEC; 79
80 val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem);
81 val->tv_nsec = rem;
74} 82}
75 83
76/* 84/*
@@ -83,15 +91,17 @@ static inline cputime_t timeval_to_cputime(const struct timeval *val)
83} 91}
84static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) 92static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
85{ 93{
86 val->tv_sec = (__force u64) ct / NSEC_PER_SEC; 94 u32 rem;
87 val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC; 95
96 val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem);
97 val->tv_usec = rem / NSEC_PER_USEC;
88} 98}
89 99
90/* 100/*
91 * Convert cputime <-> clock (USER_HZ) 101 * Convert cputime <-> clock (USER_HZ)
92 */ 102 */
93#define cputime_to_clock_t(__ct) \ 103#define cputime_to_clock_t(__ct) \
94 ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ)) 104 cputime_div(__ct, (NSEC_PER_SEC / USER_HZ))
95#define clock_t_to_cputime(__x) \ 105#define clock_t_to_cputime(__x) \
96 (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) 106 (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
97 107
diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h
new file mode 100644
index 000000000000..d06079c774a0
--- /dev/null
+++ b/include/asm-generic/hugetlb.h
@@ -0,0 +1,40 @@
1#ifndef _ASM_GENERIC_HUGETLB_H
2#define _ASM_GENERIC_HUGETLB_H
3
4static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
5{
6 return mk_pte(page, pgprot);
7}
8
9static inline int huge_pte_write(pte_t pte)
10{
11 return pte_write(pte);
12}
13
14static inline int huge_pte_dirty(pte_t pte)
15{
16 return pte_dirty(pte);
17}
18
19static inline pte_t huge_pte_mkwrite(pte_t pte)
20{
21 return pte_mkwrite(pte);
22}
23
24static inline pte_t huge_pte_mkdirty(pte_t pte)
25{
26 return pte_mkdirty(pte);
27}
28
29static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
30{
31 return pte_modify(pte, newprot);
32}
33
34static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
35 pte_t *ptep)
36{
37 pte_clear(mm, addr, ptep);
38}
39
40#endif /* _ASM_GENERIC_HUGETLB_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index bfd87685fc1f..a59ff51b0166 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -7,6 +7,16 @@
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8#include <linux/bug.h> 8#include <linux/bug.h>
9 9
10/*
11 * On almost all architectures and configurations, 0 can be used as the
12 * upper ceiling to free_pgtables(): on many architectures it has the same
13 * effect as using TASK_SIZE. However, there is one configuration which
14 * must impose a more careful limit, to avoid freeing kernel pgtables.
15 */
16#ifndef USER_PGTABLES_CEILING
17#define USER_PGTABLES_CEILING 0UL
18#endif
19
10#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 20#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
11extern int ptep_set_access_flags(struct vm_area_struct *vma, 21extern int ptep_set_access_flags(struct vm_area_struct *vma,
12 unsigned long address, pte_t *ptep, 22 unsigned long address, pte_t *ptep,
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 4077b5d9ff81..cccc86ecfeaa 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -1,4 +1,5 @@
1#include <uapi/asm-generic/unistd.h> 1#include <uapi/asm-generic/unistd.h>
2#include <linux/export.h>
2 3
3/* 4/*
4 * These are required system calls, we should 5 * These are required system calls, we should
@@ -9,20 +10,3 @@
9#define __ARCH_WANT_STAT64 10#define __ARCH_WANT_STAT64
10#define __ARCH_WANT_SYS_LLSEEK 11#define __ARCH_WANT_SYS_LLSEEK
11#endif 12#endif
12
13/*
14 * "Conditional" syscalls
15 *
16 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
17 * but it doesn't work on all toolchains, so we just do it by hand
18 */
19#ifndef cond_syscall
20#ifdef CONFIG_SYMBOL_PREFIX
21#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
22#else
23#define __SYMBOL_PREFIX
24#endif
25#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \
26 ".set\t" __SYMBOL_PREFIX #x "," \
27 __SYMBOL_PREFIX "sys_ni_syscall")
28#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index afa12c7a025c..eb58d2d7d971 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -52,13 +52,7 @@
52#define LOAD_OFFSET 0 52#define LOAD_OFFSET 0
53#endif 53#endif
54 54
55#ifndef SYMBOL_PREFIX 55#include <linux/export.h>
56#define VMLINUX_SYMBOL(sym) sym
57#else
58#define PASTE2(x,y) x##y
59#define PASTE(x,y) PASTE2(x,y)
60#define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym)
61#endif
62 56
63/* Align . to a 8 byte boundary equals to maximum function alignment. */ 57/* Align . to a 8 byte boundary equals to maximum function alignment. */
64#define ALIGN_FUNCTION() . = ALIGN(8) 58#define ALIGN_FUNCTION() . = ALIGN(8)
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index 2603267b1a29..e6c9c4cc9b23 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -31,18 +31,12 @@
31 31
32#ifdef CONFIG_ARM_ARCH_TIMER 32#ifdef CONFIG_ARM_ARCH_TIMER
33 33
34extern int arch_timer_init(void);
35extern u32 arch_timer_get_rate(void); 34extern u32 arch_timer_get_rate(void);
36extern u64 (*arch_timer_read_counter)(void); 35extern u64 (*arch_timer_read_counter)(void);
37extern struct timecounter *arch_timer_get_timecounter(void); 36extern struct timecounter *arch_timer_get_timecounter(void);
38 37
39#else 38#else
40 39
41static inline int arch_timer_init(void)
42{
43 return -ENXIO;
44}
45
46static inline u32 arch_timer_get_rate(void) 40static inline u32 arch_timer_get_rate(void)
47{ 41{
48 return 0; 42 return 0;
diff --git a/include/clocksource/samsung_pwm.h b/include/clocksource/samsung_pwm.h
new file mode 100644
index 000000000000..5c449c8199e9
--- /dev/null
+++ b/include/clocksource/samsung_pwm.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __CLOCKSOURCE_SAMSUNG_PWM_H
17#define __CLOCKSOURCE_SAMSUNG_PWM_H
18
19#include <linux/spinlock.h>
20
21#define SAMSUNG_PWM_NUM 5
22
23extern spinlock_t samsung_pwm_lock;
24
25struct samsung_pwm_variant {
26 u8 bits;
27 u8 div_base;
28 u8 tclk_mask;
29 u8 output_mask;
30 bool has_tint_cstat;
31};
32
33void samsung_pwm_clocksource_init(void __iomem *base,
34 unsigned int *irqs, struct samsung_pwm_variant *variant);
35
36#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index c6c9c1fe460c..190f8a0e0242 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -87,4 +87,9 @@ struct shash_desc;
87extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data, 87extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,
88 unsigned int len); 88 unsigned int len);
89 89
90extern int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
91 unsigned int len);
92
93extern int crypto_sha512_update(struct shash_desc *desc, const u8 *data,
94 unsigned int len);
90#endif 95#endif
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2d94d7413d71..63d17ee9eb48 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -316,6 +316,7 @@ struct drm_ioctl_desc {
316 int flags; 316 int flags;
317 drm_ioctl_t *func; 317 drm_ioctl_t *func;
318 unsigned int cmd_drv; 318 unsigned int cmd_drv;
319 const char *name;
319}; 320};
320 321
321/** 322/**
@@ -324,7 +325,7 @@ struct drm_ioctl_desc {
324 */ 325 */
325 326
326#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ 327#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \
327 [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl} 328 [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
328 329
329struct drm_magic_entry { 330struct drm_magic_entry {
330 struct list_head head; 331 struct list_head head;
@@ -1022,7 +1023,7 @@ struct drm_info_list {
1022struct drm_info_node { 1023struct drm_info_node {
1023 struct list_head list; 1024 struct list_head list;
1024 struct drm_minor *minor; 1025 struct drm_minor *minor;
1025 struct drm_info_list *info_ent; 1026 const struct drm_info_list *info_ent;
1026 struct dentry *dent; 1027 struct dentry *dent;
1027}; 1028};
1028 1029
@@ -1546,8 +1547,7 @@ extern struct idr drm_minors_idr;
1546extern struct drm_local_map *drm_getsarea(struct drm_device *dev); 1547extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1547 1548
1548 /* Proc support (drm_proc.h) */ 1549 /* Proc support (drm_proc.h) */
1549extern int drm_proc_init(struct drm_minor *minor, int minor_id, 1550extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root);
1550 struct proc_dir_entry *root);
1551extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1551extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1552 1552
1553 /* Debugfs support */ 1553 /* Debugfs support */
@@ -1593,9 +1593,8 @@ extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *s
1593 1593
1594void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); 1594void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);
1595void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); 1595void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
1596int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle); 1596int drm_prime_lookup_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle);
1597int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle); 1597void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf);
1598void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf);
1599 1598
1600int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj); 1599int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj);
1601int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf, 1600int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf,
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e3e0d651c6ca..adb3f9b625f6 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -120,7 +120,7 @@ enum drm_mode_status {
120 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ 120 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
121 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ 121 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
122 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ 122 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
123 .vscan = (vs), .flags = (f), .vrefresh = 0, \ 123 .vscan = (vs), .flags = (f), \
124 .base.type = DRM_MODE_OBJECT_MODE 124 .base.type = DRM_MODE_OBJECT_MODE
125 125
126#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */ 126#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
@@ -310,7 +310,7 @@ struct drm_plane;
310 * drm_crtc_funcs - control CRTCs for a given device 310 * drm_crtc_funcs - control CRTCs for a given device
311 * @save: save CRTC state 311 * @save: save CRTC state
312 * @restore: restore CRTC state 312 * @restore: restore CRTC state
313 * @reset: reset CRTC after state has been invalidate (e.g. resume) 313 * @reset: reset CRTC after state has been invalidated (e.g. resume)
314 * @cursor_set: setup the cursor 314 * @cursor_set: setup the cursor
315 * @cursor_move: move the cursor 315 * @cursor_move: move the cursor
316 * @gamma_set: specify color ramp for CRTC 316 * @gamma_set: specify color ramp for CRTC
@@ -554,7 +554,6 @@ enum drm_connector_force {
554 * @probed_modes: list of modes derived directly from the display 554 * @probed_modes: list of modes derived directly from the display
555 * @display_info: information about attached display (e.g. from EDID) 555 * @display_info: information about attached display (e.g. from EDID)
556 * @funcs: connector control functions 556 * @funcs: connector control functions
557 * @user_modes: user added mode list
558 * @edid_blob_ptr: DRM property containing EDID if present 557 * @edid_blob_ptr: DRM property containing EDID if present
559 * @properties: property tracking for this connector 558 * @properties: property tracking for this connector
560 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling 559 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
@@ -598,7 +597,6 @@ struct drm_connector {
598 struct drm_display_info display_info; 597 struct drm_display_info display_info;
599 const struct drm_connector_funcs *funcs; 598 const struct drm_connector_funcs *funcs;
600 599
601 struct list_head user_modes;
602 struct drm_property_blob *edid_blob_ptr; 600 struct drm_property_blob *edid_blob_ptr;
603 struct drm_object_properties properties; 601 struct drm_object_properties properties;
604 602
@@ -922,15 +920,11 @@ extern void drm_mode_config_reset(struct drm_device *dev);
922extern void drm_mode_config_cleanup(struct drm_device *dev); 920extern void drm_mode_config_cleanup(struct drm_device *dev);
923extern void drm_mode_set_name(struct drm_display_mode *mode); 921extern void drm_mode_set_name(struct drm_display_mode *mode);
924extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); 922extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
923extern bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
925extern int drm_mode_width(const struct drm_display_mode *mode); 924extern int drm_mode_width(const struct drm_display_mode *mode);
926extern int drm_mode_height(const struct drm_display_mode *mode); 925extern int drm_mode_height(const struct drm_display_mode *mode);
927 926
928/* for us by fb module */ 927/* for us by fb module */
929extern int drm_mode_attachmode_crtc(struct drm_device *dev,
930 struct drm_crtc *crtc,
931 const struct drm_display_mode *mode);
932extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
933
934extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); 928extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
935extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); 929extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
936extern void drm_mode_list_concat(struct list_head *head, 930extern void drm_mode_list_concat(struct list_head *head,
@@ -938,6 +932,9 @@ extern void drm_mode_list_concat(struct list_head *head,
938extern void drm_mode_validate_size(struct drm_device *dev, 932extern void drm_mode_validate_size(struct drm_device *dev,
939 struct list_head *mode_list, 933 struct list_head *mode_list,
940 int maxX, int maxY, int maxPitch); 934 int maxX, int maxY, int maxPitch);
935extern void drm_mode_validate_clocks(struct drm_device *dev,
936 struct list_head *mode_list,
937 int *min, int *max, int n_ranges);
941extern void drm_mode_prune_invalid(struct drm_device *dev, 938extern void drm_mode_prune_invalid(struct drm_device *dev,
942 struct list_head *mode_list, bool verbose); 939 struct list_head *mode_list, bool verbose);
943extern void drm_mode_sort(struct list_head *mode_list); 940extern void drm_mode_sort(struct list_head *mode_list);
@@ -1036,14 +1033,6 @@ extern int drm_mode_getfb(struct drm_device *dev,
1036 void *data, struct drm_file *file_priv); 1033 void *data, struct drm_file *file_priv);
1037extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, 1034extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
1038 void *data, struct drm_file *file_priv); 1035 void *data, struct drm_file *file_priv);
1039extern int drm_mode_addmode_ioctl(struct drm_device *dev,
1040 void *data, struct drm_file *file_priv);
1041extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
1042 void *data, struct drm_file *file_priv);
1043extern int drm_mode_attachmode_ioctl(struct drm_device *dev,
1044 void *data, struct drm_file *file_priv);
1045extern int drm_mode_detachmode_ioctl(struct drm_device *dev,
1046 void *data, struct drm_file *file_priv);
1047 1036
1048extern int drm_mode_getproperty_ioctl(struct drm_device *dev, 1037extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
1049 void *data, struct drm_file *file_priv); 1038 void *data, struct drm_file *file_priv);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 5da1b4ae7d84..fc481fc17085 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -244,12 +244,21 @@ struct edid {
244 244
245#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) 245#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))
246 246
247/* Short Audio Descriptor */
248struct cea_sad {
249 u8 format;
250 u8 channels; /* max number of channels - 1 */
251 u8 freq;
252 u8 byte2; /* meaning depends on format */
253};
254
247struct drm_encoder; 255struct drm_encoder;
248struct drm_connector; 256struct drm_connector;
249struct drm_display_mode; 257struct drm_display_mode;
250struct hdmi_avi_infoframe; 258struct hdmi_avi_infoframe;
251 259
252void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); 260void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
261int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
253int drm_av_sync_delay(struct drm_connector *connector, 262int drm_av_sync_delay(struct drm_connector *connector,
254 struct drm_display_mode *mode); 263 struct drm_display_mode *mode);
255struct drm_connector *drm_select_eld(struct drm_encoder *encoder, 264struct drm_connector *drm_select_eld(struct drm_encoder *encoder,
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index c09511625a11..471f276ce8f7 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -50,13 +50,14 @@ struct drm_fb_helper_surface_size {
50 50
51/** 51/**
52 * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library 52 * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library
53 * @gamma_set: - Set the given gamma lut register on the given crtc. 53 * @gamma_set: Set the given gamma lut register on the given crtc.
54 * @gamma_get: - Read the given gamma lut register on the given crtc, used to 54 * @gamma_get: Read the given gamma lut register on the given crtc, used to
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. Futhermore 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 * 61 *
61 * Driver callbacks used by the fbdev emulation helper library. 62 * Driver callbacks used by the fbdev emulation helper library.
62 */ 63 */
@@ -68,6 +69,10 @@ struct drm_fb_helper_funcs {
68 69
69 int (*fb_probe)(struct drm_fb_helper *helper, 70 int (*fb_probe)(struct drm_fb_helper *helper,
70 struct drm_fb_helper_surface_size *sizes); 71 struct drm_fb_helper_surface_size *sizes);
72 bool (*initial_config)(struct drm_fb_helper *fb_helper,
73 struct drm_fb_helper_crtc **crtcs,
74 struct drm_display_mode **modes,
75 bool *enabled, int width, int height);
71}; 76};
72 77
73struct drm_fb_helper_connector { 78struct drm_fb_helper_connector {
@@ -102,12 +107,6 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
102int drm_fb_helper_set_par(struct fb_info *info); 107int drm_fb_helper_set_par(struct fb_info *info);
103int drm_fb_helper_check_var(struct fb_var_screeninfo *var, 108int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
104 struct fb_info *info); 109 struct fb_info *info);
105int drm_fb_helper_setcolreg(unsigned regno,
106 unsigned red,
107 unsigned green,
108 unsigned blue,
109 unsigned transp,
110 struct fb_info *info);
111 110
112bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 111bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
113void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 112void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 393369147a2d..675ddf4b441f 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -87,15 +87,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
87/** Other copying of data from kernel space */ 87/** Other copying of data from kernel space */
88#define DRM_COPY_TO_USER(arg1, arg2, arg3) \ 88#define DRM_COPY_TO_USER(arg1, arg2, arg3) \
89 copy_to_user(arg1, arg2, arg3) 89 copy_to_user(arg1, arg2, arg3)
90/* Macros for copyfrom user, but checking readability only once */
91#define DRM_VERIFYAREA_READ( uaddr, size ) \
92 (access_ok( VERIFY_READ, uaddr, size ) ? 0 : -EFAULT)
93#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
94 __copy_from_user(arg1, arg2, arg3)
95#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
96 __copy_to_user(arg1, arg2, arg3)
97#define DRM_GET_USER_UNCHECKED(val, uaddr) \
98 __get_user(val, uaddr)
99 90
100#define DRM_HZ HZ 91#define DRM_HZ HZ
101 92
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 918e8fe2f5e9..bb1bc485390b 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -152,6 +152,12 @@
152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
158 {0x1002, 0x6665, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
159 {0x1002, 0x6667, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
160 {0x1002, 0x666F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 161 {0x1002, 0x6700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x6701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 162 {0x1002, 0x6701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x6702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 163 {0x1002, 0x6702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
@@ -240,6 +246,7 @@
240 {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 246 {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
241 {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 247 {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
242 {0x1002, 0x6821, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 248 {0x1002, 0x6821, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
249 {0x1002, 0x6822, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
243 {0x1002, 0x6823, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 250 {0x1002, 0x6823, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
244 {0x1002, 0x6824, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 251 {0x1002, 0x6824, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
245 {0x1002, 0x6825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 252 {0x1002, 0x6825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -247,11 +254,13 @@
247 {0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 254 {0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
248 {0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ 255 {0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
249 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ 256 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
250 {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 258 {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
251 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 259 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
252 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 260 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
253 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 261 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
254 {0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 262 {0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
263 {0x1002, 0x6835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
255 {0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ 264 {0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
256 {0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ 265 {0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ 266 {0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
@@ -603,6 +612,8 @@
603 {0x1002, 0x9999, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 612 {0x1002, 0x9999, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
604 {0x1002, 0x999A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 613 {0x1002, 0x999A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
605 {0x1002, 0x999B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 614 {0x1002, 0x999B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
615 {0x1002, 0x999C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
616 {0x1002, 0x999D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
606 {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 617 {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
607 {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 618 {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
608 {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 619 {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 0fbd046e7c93..9c8dca79808e 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -902,6 +902,10 @@ extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo);
902 * ttm_bo_util.c 902 * ttm_bo_util.c
903 */ 903 */
904 904
905int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
906 struct ttm_mem_reg *mem);
907void ttm_mem_io_free(struct ttm_bo_device *bdev,
908 struct ttm_mem_reg *mem);
905/** 909/**
906 * ttm_bo_move_ttm 910 * ttm_bo_move_ttm
907 * 911 *
diff --git a/include/dt-bindings/gpio/gpio.h b/include/dt-bindings/gpio/gpio.h
new file mode 100644
index 000000000000..e6b1e0a808ae
--- /dev/null
+++ b/include/dt-bindings/gpio/gpio.h
@@ -0,0 +1,15 @@
1/*
2 * This header provides constants for most GPIO bindings.
3 *
4 * Most GPIO bindings include a flags cell as part of the GPIO specifier.
5 * In most cases, the format of the flags cell uses the standard values
6 * defined in this header.
7 */
8
9#ifndef _DT_BINDINGS_GPIO_GPIO_H
10#define _DT_BINDINGS_GPIO_GPIO_H
11
12#define GPIO_ACTIVE_HIGH 0
13#define GPIO_ACTIVE_LOW 1
14
15#endif
diff --git a/include/dt-bindings/interrupt-controller/arm-gic.h b/include/dt-bindings/interrupt-controller/arm-gic.h
new file mode 100644
index 000000000000..1ea1b702fec2
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/arm-gic.h
@@ -0,0 +1,22 @@
1/*
2 * This header provides constants for the ARM GIC.
3 */
4
5#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_ARM_GIC_H
6#define _DT_BINDINGS_INTERRUPT_CONTROLLER_ARM_GIC_H
7
8#include <dt-bindings/interrupt-controller/irq.h>
9
10/* interrupt specific cell 0 */
11
12#define GIC_SPI 0
13#define GIC_PPI 1
14
15/*
16 * Interrupt specifier cell 2.
17 * The flaggs in irq.h are valid, plus those below.
18 */
19#define GIC_CPU_MASK_RAW(x) ((x) << 8)
20#define GIC_CPU_MASK_SIMPLE(num) GIC_CPU_MASK_RAW((1 << (num)) - 1)
21
22#endif
diff --git a/include/dt-bindings/interrupt-controller/irq.h b/include/dt-bindings/interrupt-controller/irq.h
new file mode 100644
index 000000000000..33a1003c55aa
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/irq.h
@@ -0,0 +1,19 @@
1/*
2 * This header provides constants for most IRQ bindings.
3 *
4 * Most IRQ bindings include a flags cell as part of the IRQ specifier.
5 * In most cases, the format of the flags cell uses the standard values
6 * defined in this header.
7 */
8
9#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H
10#define _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H
11
12#define IRQ_TYPE_NONE 0
13#define IRQ_TYPE_EDGE_RISING 1
14#define IRQ_TYPE_EDGE_FALLING 2
15#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
16#define IRQ_TYPE_LEVEL_HIGH 4
17#define IRQ_TYPE_LEVEL_LOW 8
18
19#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index bcbdd7484e58..17b5b5967641 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -152,15 +152,6 @@ void acpi_penalize_isa_irq(int irq, int active);
152 152
153void acpi_pci_irq_disable (struct pci_dev *dev); 153void acpi_pci_irq_disable (struct pci_dev *dev);
154 154
155struct acpi_pci_driver {
156 struct list_head node;
157 int (*add)(struct acpi_pci_root *root);
158 void (*remove)(struct acpi_pci_root *root);
159};
160
161int acpi_pci_register_driver(struct acpi_pci_driver *driver);
162void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
163
164extern int ec_read(u8 addr, u8 *val); 155extern int ec_read(u8 addr, u8 *val);
165extern int ec_write(u8 addr, u8 val); 156extern int ec_write(u8 addr, u8 val);
166extern int ec_transaction(u8 command, 157extern int ec_transaction(u8 command,
@@ -204,7 +195,7 @@ extern bool wmi_has_guid(const char *guid);
204#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) 195#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
205 196
206extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); 197extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
207extern long acpi_is_video_device(struct acpi_device *device); 198extern long acpi_is_video_device(acpi_handle handle);
208extern void acpi_video_dmi_promote_vendor(void); 199extern void acpi_video_dmi_promote_vendor(void);
209extern void acpi_video_dmi_demote_vendor(void); 200extern void acpi_video_dmi_demote_vendor(void);
210extern int acpi_video_backlight_support(void); 201extern int acpi_video_backlight_support(void);
@@ -217,7 +208,7 @@ static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle)
217 return 0; 208 return 0;
218} 209}
219 210
220static inline long acpi_is_video_device(struct acpi_device *device) 211static inline long acpi_is_video_device(acpi_handle handle)
221{ 212{
222 return 0; 213 return 0;
223} 214}
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
new file mode 100644
index 000000000000..fb0298082916
--- /dev/null
+++ b/include/linux/acpi_dma.h
@@ -0,0 +1,120 @@
1/*
2 * ACPI helpers for DMA request / controller
3 *
4 * Based on of_dma.h
5 *
6 * Copyright (C) 2013, Intel Corporation
7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __LINUX_ACPI_DMA_H
15#define __LINUX_ACPI_DMA_H
16
17#include <linux/list.h>
18#include <linux/device.h>
19#include <linux/dmaengine.h>
20
21/**
22 * struct acpi_dma_spec - slave device DMA resources
23 * @chan_id: channel unique id
24 * @slave_id: request line unique id
25 * @dev: struct device of the DMA controller to be used in the filter
26 * function
27 */
28struct acpi_dma_spec {
29 int chan_id;
30 int slave_id;
31 struct device *dev;
32};
33
34/**
35 * struct acpi_dma - representation of the registered DMAC
36 * @dma_controllers: linked list node
37 * @dev: struct device of this controller
38 * @acpi_dma_xlate: callback function to find a suitable channel
39 * @data: private data used by a callback function
40 * @base_request_line: first supported request line (CSRT)
41 * @end_request_line: last supported request line (CSRT)
42 */
43struct acpi_dma {
44 struct list_head dma_controllers;
45 struct device *dev;
46 struct dma_chan *(*acpi_dma_xlate)
47 (struct acpi_dma_spec *, struct acpi_dma *);
48 void *data;
49 unsigned short base_request_line;
50 unsigned short end_request_line;
51};
52
53/* Used with acpi_dma_simple_xlate() */
54struct acpi_dma_filter_info {
55 dma_cap_mask_t dma_cap;
56 dma_filter_fn filter_fn;
57};
58
59#ifdef CONFIG_DMA_ACPI
60
61int acpi_dma_controller_register(struct device *dev,
62 struct dma_chan *(*acpi_dma_xlate)
63 (struct acpi_dma_spec *, struct acpi_dma *),
64 void *data);
65int acpi_dma_controller_free(struct device *dev);
66int devm_acpi_dma_controller_register(struct device *dev,
67 struct dma_chan *(*acpi_dma_xlate)
68 (struct acpi_dma_spec *, struct acpi_dma *),
69 void *data);
70void devm_acpi_dma_controller_free(struct device *dev);
71
72struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev,
73 size_t index);
74struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev,
75 const char *name);
76
77struct dma_chan *acpi_dma_simple_xlate(struct acpi_dma_spec *dma_spec,
78 struct acpi_dma *adma);
79#else
80
81static inline int acpi_dma_controller_register(struct device *dev,
82 struct dma_chan *(*acpi_dma_xlate)
83 (struct acpi_dma_spec *, struct acpi_dma *),
84 void *data)
85{
86 return -ENODEV;
87}
88static inline int acpi_dma_controller_free(struct device *dev)
89{
90 return -ENODEV;
91}
92static inline int devm_acpi_dma_controller_register(struct device *dev,
93 struct dma_chan *(*acpi_dma_xlate)
94 (struct acpi_dma_spec *, struct acpi_dma *),
95 void *data)
96{
97 return -ENODEV;
98}
99static inline void devm_acpi_dma_controller_free(struct device *dev)
100{
101}
102
103static inline struct dma_chan *acpi_dma_request_slave_chan_by_index(
104 struct device *dev, size_t index)
105{
106 return NULL;
107}
108static inline struct dma_chan *acpi_dma_request_slave_chan_by_name(
109 struct device *dev, const char *name)
110{
111 return NULL;
112}
113
114#define acpi_dma_simple_xlate NULL
115
116#endif
117
118#define acpi_dma_request_slave_channel acpi_dma_request_slave_chan_by_index
119
120#endif /* __LINUX_ACPI_DMA_H */
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
index b76ebd08ff8e..4c120a1e0ca3 100644
--- a/include/linux/acpi_gpio.h
+++ b/include/linux/acpi_gpio.h
@@ -1,13 +1,25 @@
1#ifndef _LINUX_ACPI_GPIO_H_ 1#ifndef _LINUX_ACPI_GPIO_H_
2#define _LINUX_ACPI_GPIO_H_ 2#define _LINUX_ACPI_GPIO_H_
3 3
4#include <linux/device.h>
4#include <linux/errno.h> 5#include <linux/errno.h>
5#include <linux/gpio.h> 6#include <linux/gpio.h>
6 7
8/**
9 * struct acpi_gpio_info - ACPI GPIO specific information
10 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
11 */
12struct acpi_gpio_info {
13 bool gpioint;
14};
15
7#ifdef CONFIG_GPIO_ACPI 16#ifdef CONFIG_GPIO_ACPI
8 17
9int acpi_get_gpio(char *path, int pin); 18int acpi_get_gpio(char *path, int pin);
19int acpi_get_gpio_by_index(struct device *dev, int index,
20 struct acpi_gpio_info *info);
10void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); 21void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
22void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
11 23
12#else /* CONFIG_GPIO_ACPI */ 24#else /* CONFIG_GPIO_ACPI */
13 25
@@ -16,7 +28,14 @@ static inline int acpi_get_gpio(char *path, int pin)
16 return -ENODEV; 28 return -ENODEV;
17} 29}
18 30
31static inline int acpi_get_gpio_by_index(struct device *dev, int index,
32 struct acpi_gpio_info *info)
33{
34 return -ENODEV;
35}
36
19static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } 37static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
38static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
20 39
21#endif /* CONFIG_GPIO_ACPI */ 40#endif /* CONFIG_GPIO_ACPI */
22 41
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 31ff6dba4872..1bdf965339f9 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -9,91 +9,32 @@
9 9
10#include <linux/atomic.h> 10#include <linux/atomic.h>
11 11
12#define AIO_MAXSEGS 4
13#define AIO_KIOGRP_NR_ATOMIC 8
14
15struct kioctx; 12struct kioctx;
13struct kiocb;
16 14
17/* Notes on cancelling a kiocb: 15#define KIOCB_KEY 0
18 * If a kiocb is cancelled, aio_complete may return 0 to indicate
19 * that cancel has not yet disposed of the kiocb. All cancel
20 * operations *must* call aio_put_req to dispose of the kiocb
21 * to guard against races with the completion code.
22 */
23#define KIOCB_C_CANCELLED 0x01
24#define KIOCB_C_COMPLETE 0x02
25
26#define KIOCB_SYNC_KEY (~0U)
27 16
28/* ki_flags bits */
29/* 17/*
30 * This may be used for cancel/retry serialization in the future, but 18 * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either
31 * for now it's unused and we probably don't want modules to even 19 * cancelled or completed (this makes a certain amount of sense because
32 * think they can use it. 20 * successful cancellation - io_cancel() - does deliver the completion to
21 * userspace).
22 *
23 * And since most things don't implement kiocb cancellation and we'd really like
24 * kiocb completion to be lockless when possible, we use ki_cancel to
25 * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED
26 * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel().
33 */ 27 */
34/* #define KIF_LOCKED 0 */ 28#define KIOCB_CANCELLED ((void *) (~0ULL))
35#define KIF_KICKED 1
36#define KIF_CANCELLED 2
37
38#define kiocbTryLock(iocb) test_and_set_bit(KIF_LOCKED, &(iocb)->ki_flags)
39#define kiocbTryKick(iocb) test_and_set_bit(KIF_KICKED, &(iocb)->ki_flags)
40 29
41#define kiocbSetLocked(iocb) set_bit(KIF_LOCKED, &(iocb)->ki_flags) 30typedef int (kiocb_cancel_fn)(struct kiocb *, struct io_event *);
42#define kiocbSetKicked(iocb) set_bit(KIF_KICKED, &(iocb)->ki_flags)
43#define kiocbSetCancelled(iocb) set_bit(KIF_CANCELLED, &(iocb)->ki_flags)
44 31
45#define kiocbClearLocked(iocb) clear_bit(KIF_LOCKED, &(iocb)->ki_flags)
46#define kiocbClearKicked(iocb) clear_bit(KIF_KICKED, &(iocb)->ki_flags)
47#define kiocbClearCancelled(iocb) clear_bit(KIF_CANCELLED, &(iocb)->ki_flags)
48
49#define kiocbIsLocked(iocb) test_bit(KIF_LOCKED, &(iocb)->ki_flags)
50#define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags)
51#define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags)
52
53/* is there a better place to document function pointer methods? */
54/**
55 * ki_retry - iocb forward progress callback
56 * @kiocb: The kiocb struct to advance by performing an operation.
57 *
58 * This callback is called when the AIO core wants a given AIO operation
59 * to make forward progress. The kiocb argument describes the operation
60 * that is to be performed. As the operation proceeds, perhaps partially,
61 * ki_retry is expected to update the kiocb with progress made. Typically
62 * ki_retry is set in the AIO core and it itself calls file_operations
63 * helpers.
64 *
65 * ki_retry's return value determines when the AIO operation is completed
66 * and an event is generated in the AIO event ring. Except the special
67 * return values described below, the value that is returned from ki_retry
68 * is transferred directly into the completion ring as the operation's
69 * resulting status. Once this has happened ki_retry *MUST NOT* reference
70 * the kiocb pointer again.
71 *
72 * If ki_retry returns -EIOCBQUEUED it has made a promise that aio_complete()
73 * will be called on the kiocb pointer in the future. The AIO core will
74 * not ask the method again -- ki_retry must ensure forward progress.
75 * aio_complete() must be called once and only once in the future, multiple
76 * calls may result in undefined behaviour.
77 *
78 * If ki_retry returns -EIOCBRETRY it has made a promise that kick_iocb()
79 * will be called on the kiocb pointer in the future. This may happen
80 * through generic helpers that associate kiocb->ki_wait with a wait
81 * queue head that ki_retry uses via current->io_wait. It can also happen
82 * with custom tracking and manual calls to kick_iocb(), though that is
83 * discouraged. In either case, kick_iocb() must be called once and only
84 * once. ki_retry must ensure forward progress, the AIO core will wait
85 * indefinitely for kick_iocb() to be called.
86 */
87struct kiocb { 32struct kiocb {
88 struct list_head ki_run_list; 33 atomic_t ki_users;
89 unsigned long ki_flags;
90 int ki_users;
91 unsigned ki_key; /* id of this request */
92 34
93 struct file *ki_filp; 35 struct file *ki_filp;
94 struct kioctx *ki_ctx; /* may be NULL for sync ops */ 36 struct kioctx *ki_ctx; /* NULL for sync ops */
95 int (*ki_cancel)(struct kiocb *, struct io_event *); 37 kiocb_cancel_fn *ki_cancel;
96 ssize_t (*ki_retry)(struct kiocb *);
97 void (*ki_dtor)(struct kiocb *); 38 void (*ki_dtor)(struct kiocb *);
98 39
99 union { 40 union {
@@ -117,7 +58,6 @@ struct kiocb {
117 58
118 struct list_head ki_list; /* the aio core uses this 59 struct list_head ki_list; /* the aio core uses this
119 * for cancellation */ 60 * for cancellation */
120 struct list_head ki_batch; /* batch allocation */
121 61
122 /* 62 /*
123 * If the aio_resfd field of the userspace iocb is not zero, 63 * If the aio_resfd field of the userspace iocb is not zero,
@@ -128,106 +68,40 @@ struct kiocb {
128 68
129static inline bool is_sync_kiocb(struct kiocb *kiocb) 69static inline bool is_sync_kiocb(struct kiocb *kiocb)
130{ 70{
131 return kiocb->ki_key == KIOCB_SYNC_KEY; 71 return kiocb->ki_ctx == NULL;
132} 72}
133 73
134static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) 74static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
135{ 75{
136 *kiocb = (struct kiocb) { 76 *kiocb = (struct kiocb) {
137 .ki_users = 1, 77 .ki_users = ATOMIC_INIT(1),
138 .ki_key = KIOCB_SYNC_KEY, 78 .ki_ctx = NULL,
139 .ki_filp = filp, 79 .ki_filp = filp,
140 .ki_obj.tsk = current, 80 .ki_obj.tsk = current,
141 }; 81 };
142} 82}
143 83
144#define AIO_RING_MAGIC 0xa10a10a1
145#define AIO_RING_COMPAT_FEATURES 1
146#define AIO_RING_INCOMPAT_FEATURES 0
147struct aio_ring {
148 unsigned id; /* kernel internal index number */
149 unsigned nr; /* number of io_events */
150 unsigned head;
151 unsigned tail;
152
153 unsigned magic;
154 unsigned compat_features;
155 unsigned incompat_features;
156 unsigned header_length; /* size of aio_ring */
157
158
159 struct io_event io_events[0];
160}; /* 128 bytes + ring size */
161
162#define AIO_RING_PAGES 8
163struct aio_ring_info {
164 unsigned long mmap_base;
165 unsigned long mmap_size;
166
167 struct page **ring_pages;
168 spinlock_t ring_lock;
169 long nr_pages;
170
171 unsigned nr, tail;
172
173 struct page *internal_pages[AIO_RING_PAGES];
174};
175
176static inline unsigned aio_ring_avail(struct aio_ring_info *info,
177 struct aio_ring *ring)
178{
179 return (ring->head + info->nr - 1 - ring->tail) % info->nr;
180}
181
182struct kioctx {
183 atomic_t users;
184 int dead;
185 struct mm_struct *mm;
186
187 /* This needs improving */
188 unsigned long user_id;
189 struct hlist_node list;
190
191 wait_queue_head_t wait;
192
193 spinlock_t ctx_lock;
194
195 int reqs_active;
196 struct list_head active_reqs; /* used for cancellation */
197 struct list_head run_list; /* used for kicked reqs */
198
199 /* sys_io_setup currently limits this to an unsigned int */
200 unsigned max_reqs;
201
202 struct aio_ring_info ring_info;
203
204 struct delayed_work wq;
205
206 struct rcu_head rcu_head;
207};
208
209/* prototypes */ 84/* prototypes */
210extern unsigned aio_max_size;
211
212#ifdef CONFIG_AIO 85#ifdef CONFIG_AIO
213extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); 86extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
214extern int aio_put_req(struct kiocb *iocb); 87extern void aio_put_req(struct kiocb *iocb);
215extern void kick_iocb(struct kiocb *iocb); 88extern void aio_complete(struct kiocb *iocb, long res, long res2);
216extern int aio_complete(struct kiocb *iocb, long res, long res2);
217struct mm_struct; 89struct mm_struct;
218extern void exit_aio(struct mm_struct *mm); 90extern void exit_aio(struct mm_struct *mm);
219extern long do_io_submit(aio_context_t ctx_id, long nr, 91extern long do_io_submit(aio_context_t ctx_id, long nr,
220 struct iocb __user *__user *iocbpp, bool compat); 92 struct iocb __user *__user *iocbpp, bool compat);
93void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
221#else 94#else
222static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } 95static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
223static inline int aio_put_req(struct kiocb *iocb) { return 0; } 96static inline void aio_put_req(struct kiocb *iocb) { }
224static inline void kick_iocb(struct kiocb *iocb) { } 97static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
225static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
226struct mm_struct; 98struct mm_struct;
227static inline void exit_aio(struct mm_struct *mm) { } 99static inline void exit_aio(struct mm_struct *mm) { }
228static inline long do_io_submit(aio_context_t ctx_id, long nr, 100static inline long do_io_submit(aio_context_t ctx_id, long nr,
229 struct iocb __user * __user *iocbpp, 101 struct iocb __user * __user *iocbpp,
230 bool compat) { return 0; } 102 bool compat) { return 0; }
103static inline void kiocb_set_cancel_fn(struct kiocb *req,
104 kiocb_cancel_fn *cancel) { }
231#endif /* CONFIG_AIO */ 105#endif /* CONFIG_AIO */
232 106
233static inline struct kiocb *list_kiocb(struct list_head *h) 107static inline struct kiocb *list_kiocb(struct list_head *h)
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index f612c783170f..62d9303c2837 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -203,6 +203,9 @@ struct amba_pl011_data {
203 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 203 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
204 void *dma_rx_param; 204 void *dma_rx_param;
205 void *dma_tx_param; 205 void *dma_tx_param;
206 bool dma_rx_poll_enable;
207 unsigned int dma_rx_poll_rate;
208 unsigned int dma_rx_poll_timeout;
206 void (*init) (void); 209 void (*init) (void);
207 void (*exit) (void); 210 void (*exit) (void);
208}; 211};
diff --git a/include/linux/async.h b/include/linux/async.h
index a2e3f18b2ad6..6b0226bdaadc 100644
--- a/include/linux/async.h
+++ b/include/linux/async.h
@@ -16,9 +16,8 @@
16#include <linux/list.h> 16#include <linux/list.h>
17 17
18typedef u64 async_cookie_t; 18typedef u64 async_cookie_t;
19typedef void (async_func_ptr) (void *data, async_cookie_t cookie); 19typedef void (*async_func_t) (void *data, async_cookie_t cookie);
20struct async_domain { 20struct async_domain {
21 struct list_head node;
22 struct list_head pending; 21 struct list_head pending;
23 unsigned registered:1; 22 unsigned registered:1;
24}; 23};
@@ -27,8 +26,7 @@ struct async_domain {
27 * domain participates in global async_synchronize_full 26 * domain participates in global async_synchronize_full
28 */ 27 */
29#define ASYNC_DOMAIN(_name) \ 28#define ASYNC_DOMAIN(_name) \
30 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ 29 struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \
31 .pending = LIST_HEAD_INIT(_name.pending), \
32 .registered = 1 } 30 .registered = 1 }
33 31
34/* 32/*
@@ -36,12 +34,11 @@ struct async_domain {
36 * complete, this domain does not participate in async_synchronize_full 34 * complete, this domain does not participate in async_synchronize_full
37 */ 35 */
38#define ASYNC_DOMAIN_EXCLUSIVE(_name) \ 36#define ASYNC_DOMAIN_EXCLUSIVE(_name) \
39 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ 37 struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \
40 .pending = LIST_HEAD_INIT(_name.pending), \
41 .registered = 0 } 38 .registered = 0 }
42 39
43extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data); 40extern async_cookie_t async_schedule(async_func_t func, void *data);
44extern async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data, 41extern async_cookie_t async_schedule_domain(async_func_t func, void *data,
45 struct async_domain *domain); 42 struct async_domain *domain);
46void async_unregister_domain(struct async_domain *domain); 43void async_unregister_domain(struct async_domain *domain);
47extern void async_synchronize_full(void); 44extern void async_synchronize_full(void);
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 5a6d718adf34..b20b03852f21 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -84,8 +84,13 @@ extern int audit_classify_arch(int arch);
84#define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ 84#define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */
85#define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ 85#define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */
86 86
87/* maximized args number that audit_socketcall can process */
88#define AUDITSC_ARGS 6
89
87struct filename; 90struct filename;
88 91
92extern void audit_log_session_info(struct audit_buffer *ab);
93
89#ifdef CONFIG_AUDITSYSCALL 94#ifdef CONFIG_AUDITSYSCALL
90/* These are defined in auditsc.c */ 95/* These are defined in auditsc.c */
91 /* Public API */ 96 /* Public API */
@@ -120,7 +125,7 @@ static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
120 unsigned long a1, unsigned long a2, 125 unsigned long a1, unsigned long a2,
121 unsigned long a3) 126 unsigned long a3)
122{ 127{
123 if (unlikely(!audit_dummy_context())) 128 if (unlikely(current->audit_context))
124 __audit_syscall_entry(arch, major, a0, a1, a2, a3); 129 __audit_syscall_entry(arch, major, a0, a1, a2, a3);
125} 130}
126static inline void audit_syscall_exit(void *pt_regs) 131static inline void audit_syscall_exit(void *pt_regs)
@@ -185,12 +190,10 @@ static inline int audit_get_sessionid(struct task_struct *tsk)
185 return tsk->sessionid; 190 return tsk->sessionid;
186} 191}
187 192
188extern void audit_log_task_context(struct audit_buffer *ab);
189extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk);
190extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 193extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
191extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); 194extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
192extern int __audit_bprm(struct linux_binprm *bprm); 195extern int __audit_bprm(struct linux_binprm *bprm);
193extern void __audit_socketcall(int nargs, unsigned long *args); 196extern int __audit_socketcall(int nargs, unsigned long *args);
194extern int __audit_sockaddr(int len, void *addr); 197extern int __audit_sockaddr(int len, void *addr);
195extern void __audit_fd_pair(int fd1, int fd2); 198extern void __audit_fd_pair(int fd1, int fd2);
196extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); 199extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
@@ -224,10 +227,11 @@ static inline int audit_bprm(struct linux_binprm *bprm)
224 return __audit_bprm(bprm); 227 return __audit_bprm(bprm);
225 return 0; 228 return 0;
226} 229}
227static inline void audit_socketcall(int nargs, unsigned long *args) 230static inline int audit_socketcall(int nargs, unsigned long *args)
228{ 231{
229 if (unlikely(!audit_dummy_context())) 232 if (unlikely(!audit_dummy_context()))
230 __audit_socketcall(nargs, args); 233 return __audit_socketcall(nargs, args);
234 return 0;
231} 235}
232static inline int audit_sockaddr(int len, void *addr) 236static inline int audit_sockaddr(int len, void *addr)
233{ 237{
@@ -340,11 +344,6 @@ static inline int audit_get_sessionid(struct task_struct *tsk)
340{ 344{
341 return -1; 345 return -1;
342} 346}
343static inline void audit_log_task_context(struct audit_buffer *ab)
344{ }
345static inline void audit_log_task_info(struct audit_buffer *ab,
346 struct task_struct *tsk)
347{ }
348static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) 347static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
349{ } 348{ }
350static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, 349static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
@@ -354,8 +353,10 @@ static inline int audit_bprm(struct linux_binprm *bprm)
354{ 353{
355 return 0; 354 return 0;
356} 355}
357static inline void audit_socketcall(int nargs, unsigned long *args) 356static inline int audit_socketcall(int nargs, unsigned long *args)
358{ } 357{
358 return 0;
359}
359static inline void audit_fd_pair(int fd1, int fd2) 360static inline void audit_fd_pair(int fd1, int fd2)
360{ } 361{ }
361static inline int audit_sockaddr(int len, void *addr) 362static inline int audit_sockaddr(int len, void *addr)
@@ -390,6 +391,11 @@ static inline void audit_ptrace(struct task_struct *t)
390#define audit_signals 0 391#define audit_signals 0
391#endif /* CONFIG_AUDITSYSCALL */ 392#endif /* CONFIG_AUDITSYSCALL */
392 393
394static inline bool audit_loginuid_set(struct task_struct *tsk)
395{
396 return uid_valid(audit_get_loginuid(tsk));
397}
398
393#ifdef CONFIG_AUDIT 399#ifdef CONFIG_AUDIT
394/* These are defined in audit.c */ 400/* These are defined in audit.c */
395 /* Public API */ 401 /* Public API */
@@ -429,14 +435,17 @@ static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
429{ } 435{ }
430#endif 436#endif
431 437
438extern int audit_log_task_context(struct audit_buffer *ab);
439extern void audit_log_task_info(struct audit_buffer *ab,
440 struct task_struct *tsk);
441
432extern int audit_update_lsm_rules(void); 442extern int audit_update_lsm_rules(void);
433 443
434 /* Private API (for audit.c only) */ 444 /* Private API (for audit.c only) */
435extern int audit_filter_user(void); 445extern int audit_filter_user(int type);
436extern int audit_filter_type(int type); 446extern int audit_filter_type(int type);
437extern int audit_receive_filter(int type, int pid, int seq, 447extern int audit_receive_filter(int type, int pid, int seq,
438 void *data, size_t datasz, kuid_t loginuid, 448 void *data, size_t datasz);
439 u32 sessionid, u32 sid);
440extern int audit_enabled; 449extern int audit_enabled;
441#else /* CONFIG_AUDIT */ 450#else /* CONFIG_AUDIT */
442static inline __printf(4, 5) 451static inline __printf(4, 5)
@@ -476,6 +485,13 @@ static inline void audit_log_link_denied(const char *string,
476{ } 485{ }
477static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) 486static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
478{ } 487{ }
488static inline int audit_log_task_context(struct audit_buffer *ab)
489{
490 return 0;
491}
492static inline void audit_log_task_info(struct audit_buffer *ab,
493 struct task_struct *tsk)
494{ }
479#define audit_enabled 0 495#define audit_enabled 0
480#endif /* CONFIG_AUDIT */ 496#endif /* CONFIG_AUDIT */
481static inline void audit_log_string(struct audit_buffer *ab, const char *buf) 497static inline void audit_log_string(struct audit_buffer *ab, const char *buf)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 350459910fe1..c3881553f7d1 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -18,6 +18,7 @@
18#include <linux/writeback.h> 18#include <linux/writeback.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <linux/sysctl.h> 20#include <linux/sysctl.h>
21#include <linux/workqueue.h>
21 22
22struct page; 23struct page;
23struct device; 24struct device;
@@ -27,7 +28,6 @@ struct dentry;
27 * Bits in backing_dev_info.state 28 * Bits in backing_dev_info.state
28 */ 29 */
29enum bdi_state { 30enum bdi_state {
30 BDI_pending, /* On its way to being activated */
31 BDI_wb_alloc, /* Default embedded wb allocated */ 31 BDI_wb_alloc, /* Default embedded wb allocated */
32 BDI_async_congested, /* The async (write) queue is getting full */ 32 BDI_async_congested, /* The async (write) queue is getting full */
33 BDI_sync_congested, /* The sync queue is getting full */ 33 BDI_sync_congested, /* The sync queue is getting full */
@@ -53,10 +53,8 @@ struct bdi_writeback {
53 unsigned int nr; 53 unsigned int nr;
54 54
55 unsigned long last_old_flush; /* last old data flush */ 55 unsigned long last_old_flush; /* last old data flush */
56 unsigned long last_active; /* last time bdi thread was active */
57 56
58 struct task_struct *task; /* writeback thread */ 57 struct delayed_work dwork; /* work item used for writeback */
59 struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */
60 struct list_head b_dirty; /* dirty inodes */ 58 struct list_head b_dirty; /* dirty inodes */
61 struct list_head b_io; /* parked for writeback */ 59 struct list_head b_io; /* parked for writeback */
62 struct list_head b_more_io; /* parked for more writeback */ 60 struct list_head b_more_io; /* parked for more writeback */
@@ -123,14 +121,15 @@ int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
123void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, 121void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
124 enum wb_reason reason); 122 enum wb_reason reason);
125void bdi_start_background_writeback(struct backing_dev_info *bdi); 123void bdi_start_background_writeback(struct backing_dev_info *bdi);
126int bdi_writeback_thread(void *data); 124void bdi_writeback_workfn(struct work_struct *work);
127int bdi_has_dirty_io(struct backing_dev_info *bdi); 125int bdi_has_dirty_io(struct backing_dev_info *bdi);
128void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 126void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
129void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2); 127void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
130 128
131extern spinlock_t bdi_lock; 129extern spinlock_t bdi_lock;
132extern struct list_head bdi_list; 130extern struct list_head bdi_list;
133extern struct list_head bdi_pending_list; 131
132extern struct workqueue_struct *bdi_wq;
134 133
135static inline int wb_has_dirty_io(struct bdi_writeback *wb) 134static inline int wb_has_dirty_io(struct bdi_writeback *wb)
136{ 135{
@@ -336,11 +335,6 @@ static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi)
336 return bdi->capabilities & BDI_CAP_SWAP_BACKED; 335 return bdi->capabilities & BDI_CAP_SWAP_BACKED;
337} 336}
338 337
339static inline bool bdi_cap_flush_forker(struct backing_dev_info *bdi)
340{
341 return bdi == &default_backing_dev_info;
342}
343
344static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) 338static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
345{ 339{
346 return bdi_cap_writeback_dirty(mapping->backing_dev_info); 340 return bdi_cap_writeback_dirty(mapping->backing_dev_info);
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index 1c504ca5bdb3..d8a97ec0e2b8 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -72,5 +72,6 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
72#define BGPIOF_BIG_ENDIAN BIT(0) 72#define BGPIOF_BIG_ENDIAN BIT(0)
73#define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */ 73#define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */
74#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ 74#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */
75#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3)
75 76
76#endif /* __BASIC_MMIO_GPIO_H */ 77#endif /* __BASIC_MMIO_GPIO_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index e0ce311011c0..2e34db82a643 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -134,6 +134,10 @@ struct bcma_host_ops {
134#define BCMA_CORE_I2S 0x834 134#define BCMA_CORE_I2S 0x834
135#define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */ 135#define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */
136#define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */ 136#define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */
137#define BCMA_CORE_PHY_AC 0x83B
138#define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */
139#define BCMA_CORE_USB30_DEV 0x83D
140#define BCMA_CORE_ARM_CR4 0x83E
137#define BCMA_CORE_DEFAULT 0xFFF 141#define BCMA_CORE_DEFAULT 0xFFF
138 142
139#define BCMA_MAX_NR_CORES 16 143#define BCMA_MAX_NR_CORES 16
@@ -173,6 +177,60 @@ struct bcma_host_ops {
173#define BCMA_CHIP_ID_BCM53572 53572 177#define BCMA_CHIP_ID_BCM53572 53572
174#define BCMA_PKG_ID_BCM47188 9 178#define BCMA_PKG_ID_BCM47188 9
175 179
180/* Board types (on PCI usually equals to the subsystem dev id) */
181/* BCM4313 */
182#define BCMA_BOARD_TYPE_BCM94313BU 0X050F
183#define BCMA_BOARD_TYPE_BCM94313HM 0X0510
184#define BCMA_BOARD_TYPE_BCM94313EPA 0X0511
185#define BCMA_BOARD_TYPE_BCM94313HMG 0X051C
186/* BCM4716 */
187#define BCMA_BOARD_TYPE_BCM94716NR2 0X04CD
188/* BCM43224 */
189#define BCMA_BOARD_TYPE_BCM943224X21 0X056E
190#define BCMA_BOARD_TYPE_BCM943224X21_FCC 0X00D1
191#define BCMA_BOARD_TYPE_BCM943224X21B 0X00E9
192#define BCMA_BOARD_TYPE_BCM943224M93 0X008B
193#define BCMA_BOARD_TYPE_BCM943224M93A 0X0090
194#define BCMA_BOARD_TYPE_BCM943224X16 0X0093
195#define BCMA_BOARD_TYPE_BCM94322X9 0X008D
196#define BCMA_BOARD_TYPE_BCM94322M35E 0X008E
197/* BCM43228 */
198#define BCMA_BOARD_TYPE_BCM943228BU8 0X0540
199#define BCMA_BOARD_TYPE_BCM943228BU9 0X0541
200#define BCMA_BOARD_TYPE_BCM943228BU 0X0542
201#define BCMA_BOARD_TYPE_BCM943227HM4L 0X0543
202#define BCMA_BOARD_TYPE_BCM943227HMB 0X0544
203#define BCMA_BOARD_TYPE_BCM943228HM4L 0X0545
204#define BCMA_BOARD_TYPE_BCM943228SD 0X0573
205/* BCM4331 */
206#define BCMA_BOARD_TYPE_BCM94331X19 0X00D6
207#define BCMA_BOARD_TYPE_BCM94331X28 0X00E4
208#define BCMA_BOARD_TYPE_BCM94331X28B 0X010E
209#define BCMA_BOARD_TYPE_BCM94331PCIEBT3AX 0X00E4
210#define BCMA_BOARD_TYPE_BCM94331X12_2G 0X00EC
211#define BCMA_BOARD_TYPE_BCM94331X12_5G 0X00ED
212#define BCMA_BOARD_TYPE_BCM94331X29B 0X00EF
213#define BCMA_BOARD_TYPE_BCM94331CSAX 0X00EF
214#define BCMA_BOARD_TYPE_BCM94331X19C 0X00F5
215#define BCMA_BOARD_TYPE_BCM94331X33 0X00F4
216#define BCMA_BOARD_TYPE_BCM94331BU 0X0523
217#define BCMA_BOARD_TYPE_BCM94331S9BU 0X0524
218#define BCMA_BOARD_TYPE_BCM94331MC 0X0525
219#define BCMA_BOARD_TYPE_BCM94331MCI 0X0526
220#define BCMA_BOARD_TYPE_BCM94331PCIEBT4 0X0527
221#define BCMA_BOARD_TYPE_BCM94331HM 0X0574
222#define BCMA_BOARD_TYPE_BCM94331PCIEDUAL 0X059B
223#define BCMA_BOARD_TYPE_BCM94331MCH5 0X05A9
224#define BCMA_BOARD_TYPE_BCM94331CS 0X05C6
225#define BCMA_BOARD_TYPE_BCM94331CD 0X05DA
226/* BCM53572 */
227#define BCMA_BOARD_TYPE_BCM953572BU 0X058D
228#define BCMA_BOARD_TYPE_BCM953572NR2 0X058E
229#define BCMA_BOARD_TYPE_BCM947188NR2 0X058F
230#define BCMA_BOARD_TYPE_BCM953572SDRNR2 0X0590
231/* BCM43142 */
232#define BCMA_BOARD_TYPE_BCM943142HM 0X05E0
233
176struct bcma_device { 234struct bcma_device {
177 struct bcma_bus *bus; 235 struct bcma_bus *bus;
178 struct bcma_device_id id; 236 struct bcma_device_id id;
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 8390c474f69a..b8b09eac60a4 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -104,6 +104,7 @@
104#define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ 104#define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */
105#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ 105#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */
106#define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */ 106#define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */
107#define BCMA_CC_CHIPST_4360_XTAL_40MZ 0x00000001
107#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ 108#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
108#define BCMA_CC_JCMD_START 0x80000000 109#define BCMA_CC_JCMD_START 0x80000000
109#define BCMA_CC_JCMD_BUSY 0x80000000 110#define BCMA_CC_JCMD_BUSY 0x80000000
@@ -315,6 +316,9 @@
315#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ 316#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
316#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ 317#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
317#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 318#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
319#define BCMA_CC_PMU_CTL_RES 0x00006000 /* reset control mask */
320#define BCMA_CC_PMU_CTL_RES_SHIFT 13
321#define BCMA_CC_PMU_CTL_RES_RELOAD 0x2 /* reload POR values */
318#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400 322#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400
319#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ 323#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
320#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ 324#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
@@ -607,6 +611,8 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
607 611
608extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); 612extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
609 613
614extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
615
610void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); 616void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
611 617
612u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); 618u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask);
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 7e8104bb7a7e..917dcd7965e7 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -37,6 +37,7 @@
37#define BCMA_IOST_BIST_DONE 0x8000 37#define BCMA_IOST_BIST_DONE 0x8000
38#define BCMA_RESET_CTL 0x0800 38#define BCMA_RESET_CTL 0x0800
39#define BCMA_RESET_CTL_RESET 0x0001 39#define BCMA_RESET_CTL_RESET 0x0001
40#define BCMA_RESET_ST 0x0804
40 41
41/* BCMA PCI config space registers. */ 42/* BCMA PCI config space registers. */
42#define BCMA_PCI_PMCSR 0x44 43#define BCMA_PCI_PMCSR 0x44
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c3a09149f793..70cf138690e9 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -118,5 +118,6 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm);
118extern void install_exec_creds(struct linux_binprm *bprm); 118extern void install_exec_creds(struct linux_binprm *bprm);
119extern void set_binfmt(struct linux_binfmt *new); 119extern void set_binfmt(struct linux_binfmt *new);
120extern void free_bprm(struct linux_binprm *); 120extern void free_bprm(struct linux_binprm *);
121extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);
121 122
122#endif /* _LINUX_BINFMTS_H */ 123#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 820e7aaad4fd..ef24466d8f82 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -67,6 +67,7 @@
67#define bio_offset(bio) bio_iovec((bio))->bv_offset 67#define bio_offset(bio) bio_iovec((bio))->bv_offset
68#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 68#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
69#define bio_sectors(bio) ((bio)->bi_size >> 9) 69#define bio_sectors(bio) ((bio)->bi_size >> 9)
70#define bio_end_sector(bio) ((bio)->bi_sector + bio_sectors((bio)))
70 71
71static inline unsigned int bio_cur_bytes(struct bio *bio) 72static inline unsigned int bio_cur_bytes(struct bio *bio)
72{ 73{
@@ -84,11 +85,6 @@ static inline void *bio_data(struct bio *bio)
84 return NULL; 85 return NULL;
85} 86}
86 87
87static inline int bio_has_allocated_vec(struct bio *bio)
88{
89 return bio->bi_io_vec && bio->bi_io_vec != bio->bi_inline_vecs;
90}
91
92/* 88/*
93 * will die 89 * will die
94 */ 90 */
@@ -136,16 +132,27 @@ static inline int bio_has_allocated_vec(struct bio *bio)
136#define bio_io_error(bio) bio_endio((bio), -EIO) 132#define bio_io_error(bio) bio_endio((bio), -EIO)
137 133
138/* 134/*
139 * drivers should not use the __ version unless they _really_ want to 135 * drivers should not use the __ version unless they _really_ know what
140 * run through the entire bio and not just pending pieces 136 * they're doing
141 */ 137 */
142#define __bio_for_each_segment(bvl, bio, i, start_idx) \ 138#define __bio_for_each_segment(bvl, bio, i, start_idx) \
143 for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \ 139 for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \
144 i < (bio)->bi_vcnt; \ 140 i < (bio)->bi_vcnt; \
145 bvl++, i++) 141 bvl++, i++)
146 142
143/*
144 * drivers should _never_ use the all version - the bio may have been split
145 * before it got to the driver and the driver won't own all of it
146 */
147#define bio_for_each_segment_all(bvl, bio, i) \
148 for (i = 0; \
149 bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \
150 i++)
151
147#define bio_for_each_segment(bvl, bio, i) \ 152#define bio_for_each_segment(bvl, bio, i) \
148 __bio_for_each_segment(bvl, bio, i, (bio)->bi_idx) 153 for (i = (bio)->bi_idx; \
154 bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \
155 i++)
149 156
150/* 157/*
151 * get a reference to a bio, so it won't disappear. the intended use is 158 * get a reference to a bio, so it won't disappear. the intended use is
@@ -180,9 +187,12 @@ struct bio_integrity_payload {
180 unsigned short bip_slab; /* slab the bip came from */ 187 unsigned short bip_slab; /* slab the bip came from */
181 unsigned short bip_vcnt; /* # of integrity bio_vecs */ 188 unsigned short bip_vcnt; /* # of integrity bio_vecs */
182 unsigned short bip_idx; /* current bip_vec index */ 189 unsigned short bip_idx; /* current bip_vec index */
190 unsigned bip_owns_buf:1; /* should free bip_buf */
183 191
184 struct work_struct bip_work; /* I/O completion */ 192 struct work_struct bip_work; /* I/O completion */
185 struct bio_vec bip_vec[0]; /* embedded bvec array */ 193
194 struct bio_vec *bip_vec;
195 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
186}; 196};
187#endif /* CONFIG_BLK_DEV_INTEGRITY */ 197#endif /* CONFIG_BLK_DEV_INTEGRITY */
188 198
@@ -211,6 +221,7 @@ extern void bio_pair_release(struct bio_pair *dbio);
211 221
212extern struct bio_set *bioset_create(unsigned int, unsigned int); 222extern struct bio_set *bioset_create(unsigned int, unsigned int);
213extern void bioset_free(struct bio_set *); 223extern void bioset_free(struct bio_set *);
224extern mempool_t *biovec_create_pool(struct bio_set *bs, int pool_entries);
214 225
215extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 226extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
216extern void bio_put(struct bio *); 227extern void bio_put(struct bio *);
@@ -245,6 +256,9 @@ extern void bio_endio(struct bio *, int);
245struct request_queue; 256struct request_queue;
246extern int bio_phys_segments(struct request_queue *, struct bio *); 257extern int bio_phys_segments(struct request_queue *, struct bio *);
247 258
259extern int submit_bio_wait(int rw, struct bio *bio);
260extern void bio_advance(struct bio *, unsigned);
261
248extern void bio_init(struct bio *); 262extern void bio_init(struct bio *);
249extern void bio_reset(struct bio *); 263extern void bio_reset(struct bio *);
250 264
@@ -279,6 +293,9 @@ static inline void bio_flush_dcache_pages(struct bio *bi)
279} 293}
280#endif 294#endif
281 295
296extern void bio_copy_data(struct bio *dst, struct bio *src);
297extern int bio_alloc_pages(struct bio *bio, gfp_t gfp);
298
282extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, 299extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
283 unsigned long, unsigned int, int, gfp_t); 300 unsigned long, unsigned int, int, gfp_t);
284extern struct bio *bio_copy_user_iov(struct request_queue *, 301extern struct bio *bio_copy_user_iov(struct request_queue *,
@@ -286,8 +303,8 @@ extern struct bio *bio_copy_user_iov(struct request_queue *,
286 int, int, gfp_t); 303 int, int, gfp_t);
287extern int bio_uncopy_user(struct bio *); 304extern int bio_uncopy_user(struct bio *);
288void zero_fill_bio(struct bio *bio); 305void zero_fill_bio(struct bio *bio);
289extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); 306extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *);
290extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int); 307extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);
291extern unsigned int bvec_nr_vecs(unsigned short idx); 308extern unsigned int bvec_nr_vecs(unsigned short idx);
292 309
293#ifdef CONFIG_BLK_CGROUP 310#ifdef CONFIG_BLK_CGROUP
@@ -298,39 +315,6 @@ static inline int bio_associate_current(struct bio *bio) { return -ENOENT; }
298static inline void bio_disassociate_task(struct bio *bio) { } 315static inline void bio_disassociate_task(struct bio *bio) { }
299#endif /* CONFIG_BLK_CGROUP */ 316#endif /* CONFIG_BLK_CGROUP */
300 317
301/*
302 * bio_set is used to allow other portions of the IO system to
303 * allocate their own private memory pools for bio and iovec structures.
304 * These memory pools in turn all allocate from the bio_slab
305 * and the bvec_slabs[].
306 */
307#define BIO_POOL_SIZE 2
308#define BIOVEC_NR_POOLS 6
309#define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1)
310
311struct bio_set {
312 struct kmem_cache *bio_slab;
313 unsigned int front_pad;
314
315 mempool_t *bio_pool;
316#if defined(CONFIG_BLK_DEV_INTEGRITY)
317 mempool_t *bio_integrity_pool;
318#endif
319 mempool_t *bvec_pool;
320};
321
322struct biovec_slab {
323 int nr_vecs;
324 char *name;
325 struct kmem_cache *slab;
326};
327
328/*
329 * a small number of entries is fine, not going to be performance critical.
330 * basically we just need to survive
331 */
332#define BIO_SPLIT_ENTRIES 2
333
334#ifdef CONFIG_HIGHMEM 318#ifdef CONFIG_HIGHMEM
335/* 319/*
336 * remember never ever reenable interrupts between a bvec_kmap_irq and 320 * remember never ever reenable interrupts between a bvec_kmap_irq and
@@ -527,6 +511,49 @@ static inline struct bio *bio_list_get(struct bio_list *bl)
527 return bio; 511 return bio;
528} 512}
529 513
514/*
515 * bio_set is used to allow other portions of the IO system to
516 * allocate their own private memory pools for bio and iovec structures.
517 * These memory pools in turn all allocate from the bio_slab
518 * and the bvec_slabs[].
519 */
520#define BIO_POOL_SIZE 2
521#define BIOVEC_NR_POOLS 6
522#define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1)
523
524struct bio_set {
525 struct kmem_cache *bio_slab;
526 unsigned int front_pad;
527
528 mempool_t *bio_pool;
529 mempool_t *bvec_pool;
530#if defined(CONFIG_BLK_DEV_INTEGRITY)
531 mempool_t *bio_integrity_pool;
532 mempool_t *bvec_integrity_pool;
533#endif
534
535 /*
536 * Deadlock avoidance for stacking block drivers: see comments in
537 * bio_alloc_bioset() for details
538 */
539 spinlock_t rescue_lock;
540 struct bio_list rescue_list;
541 struct work_struct rescue_work;
542 struct workqueue_struct *rescue_workqueue;
543};
544
545struct biovec_slab {
546 int nr_vecs;
547 char *name;
548 struct kmem_cache *slab;
549};
550
551/*
552 * a small number of entries is fine, not going to be performance critical.
553 * basically we just need to survive
554 */
555#define BIO_SPLIT_ENTRIES 2
556
530#if defined(CONFIG_BLK_DEV_INTEGRITY) 557#if defined(CONFIG_BLK_DEV_INTEGRITY)
531 558
532#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) 559#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index cdf11191e645..fa1abeb45b76 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -111,12 +111,14 @@ struct bio {
111#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ 111#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */
112#define BIO_QUIET 10 /* Make BIO Quiet */ 112#define BIO_QUIET 10 /* Make BIO Quiet */
113#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */ 113#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
114#define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */
114 115
115/* 116/*
116 * Flags starting here get preserved by bio_reset() - this includes 117 * Flags starting here get preserved by bio_reset() - this includes
117 * BIO_POOL_IDX() 118 * BIO_POOL_IDX()
118 */ 119 */
119#define BIO_RESET_BITS 12 120#define BIO_RESET_BITS 13
121#define BIO_OWNS_VEC 13 /* bio_free() should free bvec */
120 122
121#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 123#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
122 124
@@ -175,6 +177,7 @@ enum rq_flag_bits {
175 __REQ_IO_STAT, /* account I/O stat */ 177 __REQ_IO_STAT, /* account I/O stat */
176 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 178 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
177 __REQ_KERNEL, /* direct IO to kernel pages */ 179 __REQ_KERNEL, /* direct IO to kernel pages */
180 __REQ_PM, /* runtime pm request */
178 __REQ_NR_BITS, /* stops here */ 181 __REQ_NR_BITS, /* stops here */
179}; 182};
180 183
@@ -197,6 +200,8 @@ enum rq_flag_bits {
197 REQ_SECURE) 200 REQ_SECURE)
198#define REQ_CLONE_MASK REQ_COMMON_MASK 201#define REQ_CLONE_MASK REQ_COMMON_MASK
199 202
203#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME)
204
200/* This mask is used for both bio and request merge checking */ 205/* This mask is used for both bio and request merge checking */
201#define REQ_NOMERGE_FLAGS \ 206#define REQ_NOMERGE_FLAGS \
202 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA) 207 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA)
@@ -223,5 +228,6 @@ enum rq_flag_bits {
223#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) 228#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
224#define REQ_SECURE (1 << __REQ_SECURE) 229#define REQ_SECURE (1 << __REQ_SECURE)
225#define REQ_KERNEL (1 << __REQ_KERNEL) 230#define REQ_KERNEL (1 << __REQ_KERNEL)
231#define REQ_PM (1 << __REQ_PM)
226 232
227#endif /* __LINUX_BLK_TYPES_H */ 233#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 78feda9bbae2..2fdb4a451b49 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -361,6 +361,12 @@ struct request_queue {
361 */ 361 */
362 struct kobject kobj; 362 struct kobject kobj;
363 363
364#ifdef CONFIG_PM_RUNTIME
365 struct device *dev;
366 int rpm_status;
367 unsigned int nr_pending;
368#endif
369
364 /* 370 /*
365 * queue settings 371 * queue settings
366 */ 372 */
@@ -838,7 +844,7 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
838 unsigned int cmd_flags) 844 unsigned int cmd_flags)
839{ 845{
840 if (unlikely(cmd_flags & REQ_DISCARD)) 846 if (unlikely(cmd_flags & REQ_DISCARD))
841 return q->limits.max_discard_sectors; 847 return min(q->limits.max_discard_sectors, UINT_MAX >> 9);
842 848
843 if (unlikely(cmd_flags & REQ_WRITE_SAME)) 849 if (unlikely(cmd_flags & REQ_WRITE_SAME))
844 return q->limits.max_write_same_sectors; 850 return q->limits.max_write_same_sectors;
@@ -961,6 +967,27 @@ struct request_queue *blk_alloc_queue_node(gfp_t, int);
961extern void blk_put_queue(struct request_queue *); 967extern void blk_put_queue(struct request_queue *);
962 968
963/* 969/*
970 * block layer runtime pm functions
971 */
972#ifdef CONFIG_PM_RUNTIME
973extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev);
974extern int blk_pre_runtime_suspend(struct request_queue *q);
975extern void blk_post_runtime_suspend(struct request_queue *q, int err);
976extern void blk_pre_runtime_resume(struct request_queue *q);
977extern void blk_post_runtime_resume(struct request_queue *q, int err);
978#else
979static inline void blk_pm_runtime_init(struct request_queue *q,
980 struct device *dev) {}
981static inline int blk_pre_runtime_suspend(struct request_queue *q)
982{
983 return -ENOSYS;
984}
985static inline void blk_post_runtime_suspend(struct request_queue *q, int err) {}
986static inline void blk_pre_runtime_resume(struct request_queue *q) {}
987static inline void blk_post_runtime_resume(struct request_queue *q, int err) {}
988#endif
989
990/*
964 * blk_plug permits building a queue of related requests by holding the I/O 991 * blk_plug permits building a queue of related requests by holding the I/O
965 * fragments for a short period. This allows merging of sequential requests 992 * fragments for a short period. This allows merging of sequential requests
966 * into single larger request. As the requests are moved from a per-task list to 993 * into single larger request. As the requests are moved from a per-task list to
@@ -1484,7 +1511,7 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g)
1484 1511
1485struct block_device_operations { 1512struct block_device_operations {
1486 int (*open) (struct block_device *, fmode_t); 1513 int (*open) (struct block_device *, fmode_t);
1487 int (*release) (struct gendisk *, fmode_t); 1514 void (*release) (struct gendisk *, fmode_t);
1488 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1515 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1489 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1516 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1490 int (*direct_access) (struct block_device *, sector_t, 1517 int (*direct_access) (struct block_device *, sector_t,
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index cdc3bab01832..5f0b0e1f7c08 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -44,7 +44,6 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long endpfn); 44 unsigned long endpfn);
45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46 46
47extern unsigned long free_low_memory_core_early(int nodeid);
48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); 47extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
49extern unsigned long free_all_bootmem(void); 48extern unsigned long free_all_bootmem(void);
50 49
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index b840a4960282..677b4f01b2d0 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -1,3 +1,6 @@
1#ifndef _LINUX_BRCMPHY_H
2#define _LINUX_BRCMPHY_H
3
1#define PHY_ID_BCM50610 0x0143bd60 4#define PHY_ID_BCM50610 0x0143bd60
2#define PHY_ID_BCM50610M 0x0143bd70 5#define PHY_ID_BCM50610M 0x0143bd70
3#define PHY_ID_BCM5241 0x0143bc30 6#define PHY_ID_BCM5241 0x0143bc30
@@ -29,3 +32,5 @@
29#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 32#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
30#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 33#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
31#define PHY_BCM_FLAGS_VALID 0x80000000 34#define PHY_BCM_FLAGS_VALID 0x80000000
35
36#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 5afc4f94d110..9e52b0626b39 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -34,6 +34,8 @@ enum bh_state_bits {
34 BH_Write_EIO, /* I/O error on write */ 34 BH_Write_EIO, /* I/O error on write */
35 BH_Unwritten, /* Buffer is allocated on disk but not written */ 35 BH_Unwritten, /* Buffer is allocated on disk but not written */
36 BH_Quiet, /* Buffer Error Prinks to be quiet */ 36 BH_Quiet, /* Buffer Error Prinks to be quiet */
37 BH_Meta, /* Buffer contains metadata */
38 BH_Prio, /* Buffer should be submitted with REQ_PRIO */
37 39
38 BH_PrivateStart,/* not a state bit, but the first bit available 40 BH_PrivateStart,/* not a state bit, but the first bit available
39 * for private allocation by other entities 41 * for private allocation by other entities
@@ -124,6 +126,8 @@ BUFFER_FNS(Delay, delay)
124BUFFER_FNS(Boundary, boundary) 126BUFFER_FNS(Boundary, boundary)
125BUFFER_FNS(Write_EIO, write_io_error) 127BUFFER_FNS(Write_EIO, write_io_error)
126BUFFER_FNS(Unwritten, unwritten) 128BUFFER_FNS(Unwritten, unwritten)
129BUFFER_FNS(Meta, meta)
130BUFFER_FNS(Prio, prio)
127 131
128#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) 132#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
129 133
@@ -181,6 +185,7 @@ void ll_rw_block(int, int, struct buffer_head * bh[]);
181int sync_dirty_buffer(struct buffer_head *bh); 185int sync_dirty_buffer(struct buffer_head *bh);
182int __sync_dirty_buffer(struct buffer_head *bh, int rw); 186int __sync_dirty_buffer(struct buffer_head *bh, int rw);
183void write_dirty_buffer(struct buffer_head *bh, int rw); 187void write_dirty_buffer(struct buffer_head *bh, int rw);
188int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags);
184int submit_bh(int, struct buffer_head *); 189int submit_bh(int, struct buffer_head *);
185void write_boundary_block(struct block_device *bdev, 190void write_boundary_block(struct block_device *bdev,
186 sector_t bblock, unsigned blocksize); 191 sector_t bblock, unsigned blocksize);
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index d4080f309b56..5f3386844134 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -52,6 +52,9 @@ struct ceph_auth_client_ops {
52 */ 52 */
53 int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type, 53 int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type,
54 struct ceph_auth_handshake *auth); 54 struct ceph_auth_handshake *auth);
55 /* ensure that an existing authorizer is up to date */
56 int (*update_authorizer)(struct ceph_auth_client *ac, int peer_type,
57 struct ceph_auth_handshake *auth);
55 int (*verify_authorizer_reply)(struct ceph_auth_client *ac, 58 int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
56 struct ceph_authorizer *a, size_t len); 59 struct ceph_authorizer *a, size_t len);
57 void (*destroy_authorizer)(struct ceph_auth_client *ac, 60 void (*destroy_authorizer)(struct ceph_auth_client *ac,
@@ -75,6 +78,8 @@ struct ceph_auth_client {
75 u64 global_id; /* our unique id in system */ 78 u64 global_id; /* our unique id in system */
76 const struct ceph_crypto_key *key; /* our secret key */ 79 const struct ceph_crypto_key *key; /* our secret key */
77 unsigned want_keys; /* which services we want */ 80 unsigned want_keys; /* which services we want */
81
82 struct mutex mutex;
78}; 83};
79 84
80extern struct ceph_auth_client *ceph_auth_init(const char *name, 85extern struct ceph_auth_client *ceph_auth_init(const char *name,
@@ -94,5 +99,18 @@ extern int ceph_build_auth(struct ceph_auth_client *ac,
94 void *msg_buf, size_t msg_len); 99 void *msg_buf, size_t msg_len);
95 100
96extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac); 101extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac);
102extern int ceph_auth_create_authorizer(struct ceph_auth_client *ac,
103 int peer_type,
104 struct ceph_auth_handshake *auth);
105extern void ceph_auth_destroy_authorizer(struct ceph_auth_client *ac,
106 struct ceph_authorizer *a);
107extern int ceph_auth_update_authorizer(struct ceph_auth_client *ac,
108 int peer_type,
109 struct ceph_auth_handshake *a);
110extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac,
111 struct ceph_authorizer *a,
112 size_t len);
113extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac,
114 int peer_type);
97 115
98#endif 116#endif
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index 76554cecaab2..4c42080347af 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -41,6 +41,7 @@
41 */ 41 */
42#define CEPH_FEATURES_SUPPORTED_DEFAULT \ 42#define CEPH_FEATURES_SUPPORTED_DEFAULT \
43 (CEPH_FEATURE_NOSRCADDR | \ 43 (CEPH_FEATURE_NOSRCADDR | \
44 CEPH_FEATURE_RECONNECT_SEQ | \
44 CEPH_FEATURE_PGID64 | \ 45 CEPH_FEATURE_PGID64 | \
45 CEPH_FEATURE_PGPOOL3 | \ 46 CEPH_FEATURE_PGPOOL3 | \
46 CEPH_FEATURE_OSDENC | \ 47 CEPH_FEATURE_OSDENC | \
@@ -51,6 +52,7 @@
51 52
52#define CEPH_FEATURES_REQUIRED_DEFAULT \ 53#define CEPH_FEATURES_REQUIRED_DEFAULT \
53 (CEPH_FEATURE_NOSRCADDR | \ 54 (CEPH_FEATURE_NOSRCADDR | \
55 CEPH_FEATURE_RECONNECT_SEQ | \
54 CEPH_FEATURE_PGID64 | \ 56 CEPH_FEATURE_PGID64 | \
55 CEPH_FEATURE_PGPOOL3 | \ 57 CEPH_FEATURE_PGPOOL3 | \
56 CEPH_FEATURE_OSDENC) 58 CEPH_FEATURE_OSDENC)
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 360d9d08ca9e..379f71508995 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -8,6 +8,23 @@
8 8
9#include <linux/ceph/types.h> 9#include <linux/ceph/types.h>
10 10
11/* This seemed to be the easiest place to define these */
12
13#define U8_MAX ((u8)(~0U))
14#define U16_MAX ((u16)(~0U))
15#define U32_MAX ((u32)(~0U))
16#define U64_MAX ((u64)(~0ULL))
17
18#define S8_MAX ((s8)(U8_MAX >> 1))
19#define S16_MAX ((s16)(U16_MAX >> 1))
20#define S32_MAX ((s32)(U32_MAX >> 1))
21#define S64_MAX ((s64)(U64_MAX >> 1LL))
22
23#define S8_MIN ((s8)(-S8_MAX - 1))
24#define S16_MIN ((s16)(-S16_MAX - 1))
25#define S32_MIN ((s32)(-S32_MAX - 1))
26#define S64_MIN ((s64)(-S64_MAX - 1LL))
27
11/* 28/*
12 * in all cases, 29 * in all cases,
13 * void **p pointer to position pointer 30 * void **p pointer to position pointer
@@ -137,14 +154,19 @@ bad:
137static inline void ceph_decode_timespec(struct timespec *ts, 154static inline void ceph_decode_timespec(struct timespec *ts,
138 const struct ceph_timespec *tv) 155 const struct ceph_timespec *tv)
139{ 156{
140 ts->tv_sec = le32_to_cpu(tv->tv_sec); 157 ts->tv_sec = (__kernel_time_t)le32_to_cpu(tv->tv_sec);
141 ts->tv_nsec = le32_to_cpu(tv->tv_nsec); 158 ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec);
142} 159}
143static inline void ceph_encode_timespec(struct ceph_timespec *tv, 160static inline void ceph_encode_timespec(struct ceph_timespec *tv,
144 const struct timespec *ts) 161 const struct timespec *ts)
145{ 162{
146 tv->tv_sec = cpu_to_le32(ts->tv_sec); 163 BUG_ON(ts->tv_sec < 0);
147 tv->tv_nsec = cpu_to_le32(ts->tv_nsec); 164 BUG_ON(ts->tv_sec > (__kernel_time_t)U32_MAX);
165 BUG_ON(ts->tv_nsec < 0);
166 BUG_ON(ts->tv_nsec > (long)U32_MAX);
167
168 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
169 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
148} 170}
149 171
150/* 172/*
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 29818fc3fa49..2e3024881a5e 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -66,6 +66,7 @@ struct ceph_options {
66#define CEPH_OSD_IDLE_TTL_DEFAULT 60 66#define CEPH_OSD_IDLE_TTL_DEFAULT 60
67 67
68#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) 68#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
69#define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024)
69#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) 70#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
70 71
71#define CEPH_AUTH_NAME_DEFAULT "guest" 72#define CEPH_AUTH_NAME_DEFAULT "guest"
@@ -156,31 +157,11 @@ struct ceph_snap_context {
156 u64 snaps[]; 157 u64 snaps[];
157}; 158};
158 159
159static inline struct ceph_snap_context * 160extern struct ceph_snap_context *ceph_create_snap_context(u32 snap_count,
160ceph_get_snap_context(struct ceph_snap_context *sc) 161 gfp_t gfp_flags);
161{ 162extern struct ceph_snap_context *ceph_get_snap_context(
162 /* 163 struct ceph_snap_context *sc);
163 printk("get_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref), 164extern void ceph_put_snap_context(struct ceph_snap_context *sc);
164 atomic_read(&sc->nref)+1);
165 */
166 if (sc)
167 atomic_inc(&sc->nref);
168 return sc;
169}
170
171static inline void ceph_put_snap_context(struct ceph_snap_context *sc)
172{
173 if (!sc)
174 return;
175 /*
176 printk("put_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref),
177 atomic_read(&sc->nref)-1);
178 */
179 if (atomic_dec_and_test(&sc->nref)) {
180 /*printk(" deleting snap_context %p\n", sc);*/
181 kfree(sc);
182 }
183}
184 165
185/* 166/*
186 * calculate the number of pages a given length and offset map onto, 167 * calculate the number of pages a given length and offset map onto,
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 60903e0f665c..7c1420bb1dce 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -64,6 +64,77 @@ struct ceph_messenger {
64 u32 required_features; 64 u32 required_features;
65}; 65};
66 66
67enum ceph_msg_data_type {
68 CEPH_MSG_DATA_NONE, /* message contains no data payload */
69 CEPH_MSG_DATA_PAGES, /* data source/destination is a page array */
70 CEPH_MSG_DATA_PAGELIST, /* data source/destination is a pagelist */
71#ifdef CONFIG_BLOCK
72 CEPH_MSG_DATA_BIO, /* data source/destination is a bio list */
73#endif /* CONFIG_BLOCK */
74};
75
76static __inline__ bool ceph_msg_data_type_valid(enum ceph_msg_data_type type)
77{
78 switch (type) {
79 case CEPH_MSG_DATA_NONE:
80 case CEPH_MSG_DATA_PAGES:
81 case CEPH_MSG_DATA_PAGELIST:
82#ifdef CONFIG_BLOCK
83 case CEPH_MSG_DATA_BIO:
84#endif /* CONFIG_BLOCK */
85 return true;
86 default:
87 return false;
88 }
89}
90
91struct ceph_msg_data {
92 struct list_head links; /* ceph_msg->data */
93 enum ceph_msg_data_type type;
94 union {
95#ifdef CONFIG_BLOCK
96 struct {
97 struct bio *bio;
98 size_t bio_length;
99 };
100#endif /* CONFIG_BLOCK */
101 struct {
102 struct page **pages; /* NOT OWNER. */
103 size_t length; /* total # bytes */
104 unsigned int alignment; /* first page */
105 };
106 struct ceph_pagelist *pagelist;
107 };
108};
109
110struct ceph_msg_data_cursor {
111 size_t total_resid; /* across all data items */
112 struct list_head *data_head; /* = &ceph_msg->data */
113
114 struct ceph_msg_data *data; /* current data item */
115 size_t resid; /* bytes not yet consumed */
116 bool last_piece; /* current is last piece */
117 bool need_crc; /* crc update needed */
118 union {
119#ifdef CONFIG_BLOCK
120 struct { /* bio */
121 struct bio *bio; /* bio from list */
122 unsigned int vector_index; /* vector from bio */
123 unsigned int vector_offset; /* bytes from vector */
124 };
125#endif /* CONFIG_BLOCK */
126 struct { /* pages */
127 unsigned int page_offset; /* offset in page */
128 unsigned short page_index; /* index in array */
129 unsigned short page_count; /* pages in array */
130 };
131 struct { /* pagelist */
132 struct page *page; /* page from list */
133 size_t offset; /* bytes from list */
134 };
135 };
136};
137
67/* 138/*
68 * a single message. it contains a header (src, dest, message type, etc.), 139 * a single message. it contains a header (src, dest, message type, etc.),
69 * footer (crc values, mainly), a "front" message body, and possibly a 140 * footer (crc values, mainly), a "front" message body, and possibly a
@@ -74,21 +145,15 @@ struct ceph_msg {
74 struct ceph_msg_footer footer; /* footer */ 145 struct ceph_msg_footer footer; /* footer */
75 struct kvec front; /* unaligned blobs of message */ 146 struct kvec front; /* unaligned blobs of message */
76 struct ceph_buffer *middle; 147 struct ceph_buffer *middle;
77 struct page **pages; /* data payload. NOT OWNER. */ 148
78 unsigned nr_pages; /* size of page array */ 149 size_t data_length;
79 unsigned page_alignment; /* io offset in first page */ 150 struct list_head data;
80 struct ceph_pagelist *pagelist; /* instead of pages */ 151 struct ceph_msg_data_cursor cursor;
81 152
82 struct ceph_connection *con; 153 struct ceph_connection *con;
83 struct list_head list_head; 154 struct list_head list_head; /* links for connection lists */
84 155
85 struct kref kref; 156 struct kref kref;
86#ifdef CONFIG_BLOCK
87 struct bio *bio; /* instead of pages/pagelist */
88 struct bio *bio_iter; /* bio iterator */
89 int bio_seg; /* current bio segment */
90#endif /* CONFIG_BLOCK */
91 struct ceph_pagelist *trail; /* the trailing part of the data */
92 bool front_is_vmalloc; 157 bool front_is_vmalloc;
93 bool more_to_follow; 158 bool more_to_follow;
94 bool needs_out_seq; 159 bool needs_out_seq;
@@ -98,12 +163,6 @@ struct ceph_msg {
98 struct ceph_msgpool *pool; 163 struct ceph_msgpool *pool;
99}; 164};
100 165
101struct ceph_msg_pos {
102 int page, page_pos; /* which page; offset in page */
103 int data_pos; /* offset in data payload */
104 bool did_page_crc; /* true if we've calculated crc for current page */
105};
106
107/* ceph connection fault delay defaults, for exponential backoff */ 166/* ceph connection fault delay defaults, for exponential backoff */
108#define BASE_DELAY_INTERVAL (HZ/2) 167#define BASE_DELAY_INTERVAL (HZ/2)
109#define MAX_DELAY_INTERVAL (5 * 60 * HZ) 168#define MAX_DELAY_INTERVAL (5 * 60 * HZ)
@@ -161,7 +220,6 @@ struct ceph_connection {
161 struct ceph_msg *out_msg; /* sending message (== tail of 220 struct ceph_msg *out_msg; /* sending message (== tail of
162 out_sent) */ 221 out_sent) */
163 bool out_msg_done; 222 bool out_msg_done;
164 struct ceph_msg_pos out_msg_pos;
165 223
166 struct kvec out_kvec[8], /* sending header/footer data */ 224 struct kvec out_kvec[8], /* sending header/footer data */
167 *out_kvec_cur; 225 *out_kvec_cur;
@@ -175,7 +233,6 @@ struct ceph_connection {
175 /* message in temps */ 233 /* message in temps */
176 struct ceph_msg_header in_hdr; 234 struct ceph_msg_header in_hdr;
177 struct ceph_msg *in_msg; 235 struct ceph_msg *in_msg;
178 struct ceph_msg_pos in_msg_pos;
179 u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */ 236 u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */
180 237
181 char in_tag; /* protocol control byte */ 238 char in_tag; /* protocol control byte */
@@ -218,6 +275,15 @@ extern void ceph_msg_revoke_incoming(struct ceph_msg *msg);
218 275
219extern void ceph_con_keepalive(struct ceph_connection *con); 276extern void ceph_con_keepalive(struct ceph_connection *con);
220 277
278extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
279 size_t length, size_t alignment);
280extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
281 struct ceph_pagelist *pagelist);
282#ifdef CONFIG_BLOCK
283extern void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio,
284 size_t length);
285#endif /* CONFIG_BLOCK */
286
221extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 287extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
222 bool can_fail); 288 bool can_fail);
223extern void ceph_msg_kfree(struct ceph_msg *m); 289extern void ceph_msg_kfree(struct ceph_msg *m);
diff --git a/include/linux/ceph/msgr.h b/include/linux/ceph/msgr.h
index 680d3d648cac..3d94a73b5f30 100644
--- a/include/linux/ceph/msgr.h
+++ b/include/linux/ceph/msgr.h
@@ -87,6 +87,7 @@ struct ceph_entity_inst {
87#define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */ 87#define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */
88#define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */ 88#define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */
89#define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */ 89#define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */
90#define CEPH_MSGR_TAG_SEQ 13 /* 64-bit int follows with seen seq number */
90 91
91 92
92/* 93/*
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 1dd5d466b6f9..186db0bf4951 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -29,6 +29,7 @@ struct ceph_authorizer;
29 */ 29 */
30typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *, 30typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *,
31 struct ceph_msg *); 31 struct ceph_msg *);
32typedef void (*ceph_osdc_unsafe_callback_t)(struct ceph_osd_request *, bool);
32 33
33/* a given osd we're communicating with */ 34/* a given osd we're communicating with */
34struct ceph_osd { 35struct ceph_osd {
@@ -48,7 +49,67 @@ struct ceph_osd {
48}; 49};
49 50
50 51
51#define CEPH_OSD_MAX_OP 10 52#define CEPH_OSD_MAX_OP 2
53
54enum ceph_osd_data_type {
55 CEPH_OSD_DATA_TYPE_NONE = 0,
56 CEPH_OSD_DATA_TYPE_PAGES,
57 CEPH_OSD_DATA_TYPE_PAGELIST,
58#ifdef CONFIG_BLOCK
59 CEPH_OSD_DATA_TYPE_BIO,
60#endif /* CONFIG_BLOCK */
61};
62
63struct ceph_osd_data {
64 enum ceph_osd_data_type type;
65 union {
66 struct {
67 struct page **pages;
68 u64 length;
69 u32 alignment;
70 bool pages_from_pool;
71 bool own_pages;
72 };
73 struct ceph_pagelist *pagelist;
74#ifdef CONFIG_BLOCK
75 struct {
76 struct bio *bio; /* list of bios */
77 size_t bio_length; /* total in list */
78 };
79#endif /* CONFIG_BLOCK */
80 };
81};
82
83struct ceph_osd_req_op {
84 u16 op; /* CEPH_OSD_OP_* */
85 u32 payload_len;
86 union {
87 struct ceph_osd_data raw_data_in;
88 struct {
89 u64 offset, length;
90 u64 truncate_size;
91 u32 truncate_seq;
92 struct ceph_osd_data osd_data;
93 } extent;
94 struct {
95 const char *class_name;
96 const char *method_name;
97 struct ceph_osd_data request_info;
98 struct ceph_osd_data request_data;
99 struct ceph_osd_data response_data;
100 __u8 class_len;
101 __u8 method_len;
102 __u8 argc;
103 } cls;
104 struct {
105 u64 cookie;
106 u64 ver;
107 u32 prot_ver;
108 u32 timeout;
109 __u8 flag;
110 } watch;
111 };
112};
52 113
53/* an in-flight request */ 114/* an in-flight request */
54struct ceph_osd_request { 115struct ceph_osd_request {
@@ -63,15 +124,14 @@ struct ceph_osd_request {
63 int r_pg_osds[CEPH_PG_MAX_SIZE]; 124 int r_pg_osds[CEPH_PG_MAX_SIZE];
64 int r_num_pg_osds; 125 int r_num_pg_osds;
65 126
66 struct ceph_connection *r_con_filling_msg;
67
68 struct ceph_msg *r_request, *r_reply; 127 struct ceph_msg *r_request, *r_reply;
69 int r_flags; /* any additional flags for the osd */ 128 int r_flags; /* any additional flags for the osd */
70 u32 r_sent; /* >0 if r_request is sending/sent */ 129 u32 r_sent; /* >0 if r_request is sending/sent */
71 int r_num_ops;
72 130
73 /* encoded message content */ 131 /* request osd ops array */
74 struct ceph_osd_op *r_request_ops; 132 unsigned int r_num_ops;
133 struct ceph_osd_req_op r_ops[CEPH_OSD_MAX_OP];
134
75 /* these are updated on each send */ 135 /* these are updated on each send */
76 __le32 *r_request_osdmap_epoch; 136 __le32 *r_request_osdmap_epoch;
77 __le32 *r_request_flags; 137 __le32 *r_request_flags;
@@ -85,12 +145,14 @@ struct ceph_osd_request {
85 s32 r_reply_op_result[CEPH_OSD_MAX_OP]; 145 s32 r_reply_op_result[CEPH_OSD_MAX_OP];
86 int r_got_reply; 146 int r_got_reply;
87 int r_linger; 147 int r_linger;
148 int r_completed;
88 149
89 struct ceph_osd_client *r_osdc; 150 struct ceph_osd_client *r_osdc;
90 struct kref r_kref; 151 struct kref r_kref;
91 bool r_mempool; 152 bool r_mempool;
92 struct completion r_completion, r_safe_completion; 153 struct completion r_completion, r_safe_completion;
93 ceph_osdc_callback_t r_callback, r_safe_callback; 154 ceph_osdc_callback_t r_callback;
155 ceph_osdc_unsafe_callback_t r_unsafe_callback;
94 struct ceph_eversion r_reassert_version; 156 struct ceph_eversion r_reassert_version;
95 struct list_head r_unsafe_item; 157 struct list_head r_unsafe_item;
96 158
@@ -104,16 +166,6 @@ struct ceph_osd_request {
104 166
105 struct ceph_file_layout r_file_layout; 167 struct ceph_file_layout r_file_layout;
106 struct ceph_snap_context *r_snapc; /* snap context for writes */ 168 struct ceph_snap_context *r_snapc; /* snap context for writes */
107 unsigned r_num_pages; /* size of page array (follows) */
108 unsigned r_page_alignment; /* io offset in first page */
109 struct page **r_pages; /* pages for data payload */
110 int r_pages_from_pool;
111 int r_own_pages; /* if true, i own page list */
112#ifdef CONFIG_BLOCK
113 struct bio *r_bio; /* instead of pages */
114#endif
115
116 struct ceph_pagelist r_trail; /* trailing part of the data */
117}; 169};
118 170
119struct ceph_osd_event { 171struct ceph_osd_event {
@@ -172,48 +224,8 @@ struct ceph_osd_client {
172 struct workqueue_struct *notify_wq; 224 struct workqueue_struct *notify_wq;
173}; 225};
174 226
175struct ceph_osd_req_op { 227extern int ceph_osdc_setup(void);
176 u16 op; /* CEPH_OSD_OP_* */ 228extern void ceph_osdc_cleanup(void);
177 u32 payload_len;
178 union {
179 struct {
180 u64 offset, length;
181 u64 truncate_size;
182 u32 truncate_seq;
183 } extent;
184 struct {
185 const char *name;
186 const char *val;
187 u32 name_len;
188 u32 value_len;
189 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
190 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
191 } xattr;
192 struct {
193 const char *class_name;
194 const char *method_name;
195 const char *indata;
196 u32 indata_len;
197 __u8 class_len;
198 __u8 method_len;
199 __u8 argc;
200 } cls;
201 struct {
202 u64 cookie;
203 u64 count;
204 } pgls;
205 struct {
206 u64 snapid;
207 } snap;
208 struct {
209 u64 cookie;
210 u64 ver;
211 u32 prot_ver;
212 u32 timeout;
213 __u8 flag;
214 } watch;
215 };
216};
217 229
218extern int ceph_osdc_init(struct ceph_osd_client *osdc, 230extern int ceph_osdc_init(struct ceph_osd_client *osdc,
219 struct ceph_client *client); 231 struct ceph_client *client);
@@ -224,16 +236,71 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
224extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 236extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
225 struct ceph_msg *msg); 237 struct ceph_msg *msg);
226 238
239extern void osd_req_op_init(struct ceph_osd_request *osd_req,
240 unsigned int which, u16 opcode);
241
242extern void osd_req_op_raw_data_in_pages(struct ceph_osd_request *,
243 unsigned int which,
244 struct page **pages, u64 length,
245 u32 alignment, bool pages_from_pool,
246 bool own_pages);
247
248extern void osd_req_op_extent_init(struct ceph_osd_request *osd_req,
249 unsigned int which, u16 opcode,
250 u64 offset, u64 length,
251 u64 truncate_size, u32 truncate_seq);
252extern void osd_req_op_extent_update(struct ceph_osd_request *osd_req,
253 unsigned int which, u64 length);
254
255extern struct ceph_osd_data *osd_req_op_extent_osd_data(
256 struct ceph_osd_request *osd_req,
257 unsigned int which);
258extern struct ceph_osd_data *osd_req_op_cls_response_data(
259 struct ceph_osd_request *osd_req,
260 unsigned int which);
261
262extern void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *,
263 unsigned int which,
264 struct page **pages, u64 length,
265 u32 alignment, bool pages_from_pool,
266 bool own_pages);
267extern void osd_req_op_extent_osd_data_pagelist(struct ceph_osd_request *,
268 unsigned int which,
269 struct ceph_pagelist *pagelist);
270#ifdef CONFIG_BLOCK
271extern void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *,
272 unsigned int which,
273 struct bio *bio, size_t bio_length);
274#endif /* CONFIG_BLOCK */
275
276extern void osd_req_op_cls_request_data_pagelist(struct ceph_osd_request *,
277 unsigned int which,
278 struct ceph_pagelist *pagelist);
279extern void osd_req_op_cls_request_data_pages(struct ceph_osd_request *,
280 unsigned int which,
281 struct page **pages, u64 length,
282 u32 alignment, bool pages_from_pool,
283 bool own_pages);
284extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
285 unsigned int which,
286 struct page **pages, u64 length,
287 u32 alignment, bool pages_from_pool,
288 bool own_pages);
289
290extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
291 unsigned int which, u16 opcode,
292 const char *class, const char *method);
293extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req,
294 unsigned int which, u16 opcode,
295 u64 cookie, u64 version, int flag);
296
227extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 297extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
228 struct ceph_snap_context *snapc, 298 struct ceph_snap_context *snapc,
229 unsigned int num_op, 299 unsigned int num_ops,
230 bool use_mempool, 300 bool use_mempool,
231 gfp_t gfp_flags); 301 gfp_t gfp_flags);
232 302
233extern void ceph_osdc_build_request(struct ceph_osd_request *req, 303extern void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
234 u64 off, u64 len,
235 unsigned int num_op,
236 struct ceph_osd_req_op *src_ops,
237 struct ceph_snap_context *snapc, 304 struct ceph_snap_context *snapc,
238 u64 snap_id, 305 u64 snap_id,
239 struct timespec *mtime); 306 struct timespec *mtime);
@@ -241,12 +308,11 @@ extern void ceph_osdc_build_request(struct ceph_osd_request *req,
241extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, 308extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
242 struct ceph_file_layout *layout, 309 struct ceph_file_layout *layout,
243 struct ceph_vino vino, 310 struct ceph_vino vino,
244 u64 offset, u64 *len, int op, int flags, 311 u64 offset, u64 *len,
312 int num_ops, int opcode, int flags,
245 struct ceph_snap_context *snapc, 313 struct ceph_snap_context *snapc,
246 int do_sync, u32 truncate_seq, 314 u32 truncate_seq, u64 truncate_size,
247 u64 truncate_size, 315 bool use_mempool);
248 struct timespec *mtime,
249 bool use_mempool, int page_align);
250 316
251extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, 317extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
252 struct ceph_osd_request *req); 318 struct ceph_osd_request *req);
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index c819190d1642..d05cc4451af6 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/rbtree.h> 4#include <linux/rbtree.h>
5#include <linux/ceph/types.h> 5#include <linux/ceph/types.h>
6#include <linux/ceph/decode.h>
6#include <linux/ceph/ceph_fs.h> 7#include <linux/ceph/ceph_fs.h>
7#include <linux/crush/crush.h> 8#include <linux/crush/crush.h>
8 9
@@ -119,6 +120,29 @@ static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map,
119 return &map->osd_addr[osd]; 120 return &map->osd_addr[osd];
120} 121}
121 122
123static inline int ceph_decode_pgid(void **p, void *end, struct ceph_pg *pgid)
124{
125 __u8 version;
126
127 if (!ceph_has_room(p, end, 1 + 8 + 4 + 4)) {
128 pr_warning("incomplete pg encoding");
129
130 return -EINVAL;
131 }
132 version = ceph_decode_8(p);
133 if (version > 1) {
134 pr_warning("do not understand pg encoding %d > 1",
135 (int)version);
136 return -EINVAL;
137 }
138
139 pgid->pool = ceph_decode_64(p);
140 pgid->seed = ceph_decode_32(p);
141 *p += 4; /* skip deprecated preferred value */
142
143 return 0;
144}
145
122extern struct ceph_osdmap *osdmap_decode(void **p, void *end); 146extern struct ceph_osdmap *osdmap_decode(void **p, void *end);
123extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, 147extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
124 struct ceph_osdmap *map, 148 struct ceph_osdmap *map,
@@ -131,10 +155,8 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
131 u64 *bno, u64 *oxoff, u64 *oxlen); 155 u64 *bno, u64 *oxoff, u64 *oxlen);
132 156
133/* calculate mapping of object to a placement group */ 157/* calculate mapping of object to a placement group */
134extern int ceph_calc_object_layout(struct ceph_pg *pg, 158extern int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid,
135 const char *oid, 159 struct ceph_osdmap *osdmap, uint64_t pool);
136 struct ceph_file_layout *fl,
137 struct ceph_osdmap *osdmap);
138extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, 160extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
139 struct ceph_pg pgid, 161 struct ceph_pg pgid,
140 int *acting); 162 int *acting);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 900af5964f55..5047355b9a0f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -19,6 +19,7 @@
19#include <linux/idr.h> 19#include <linux/idr.h>
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/xattr.h> 21#include <linux/xattr.h>
22#include <linux/fs.h>
22 23
23#ifdef CONFIG_CGROUPS 24#ifdef CONFIG_CGROUPS
24 25
@@ -27,13 +28,10 @@ struct cgroup_subsys;
27struct inode; 28struct inode;
28struct cgroup; 29struct cgroup;
29struct css_id; 30struct css_id;
31struct eventfd_ctx;
30 32
31extern int cgroup_init_early(void); 33extern int cgroup_init_early(void);
32extern int cgroup_init(void); 34extern int cgroup_init(void);
33extern void cgroup_lock(void);
34extern int cgroup_lock_is_held(void);
35extern bool cgroup_lock_live_group(struct cgroup *cgrp);
36extern void cgroup_unlock(void);
37extern void cgroup_fork(struct task_struct *p); 35extern void cgroup_fork(struct task_struct *p);
38extern void cgroup_post_fork(struct task_struct *p); 36extern void cgroup_post_fork(struct task_struct *p);
39extern void cgroup_exit(struct task_struct *p, int run_callbacks); 37extern void cgroup_exit(struct task_struct *p, int run_callbacks);
@@ -42,16 +40,27 @@ extern int cgroupstats_build(struct cgroupstats *stats,
42extern int cgroup_load_subsys(struct cgroup_subsys *ss); 40extern int cgroup_load_subsys(struct cgroup_subsys *ss);
43extern void cgroup_unload_subsys(struct cgroup_subsys *ss); 41extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
44 42
45extern const struct file_operations proc_cgroup_operations; 43extern int proc_cgroup_show(struct seq_file *, void *);
46 44
47/* Define the enumeration of all builtin cgroup subsystems */ 45/*
46 * Define the enumeration of all cgroup subsystems.
47 *
48 * We define ids for builtin subsystems and then modular ones.
49 */
48#define SUBSYS(_x) _x ## _subsys_id, 50#define SUBSYS(_x) _x ## _subsys_id,
49#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
50enum cgroup_subsys_id { 51enum cgroup_subsys_id {
52#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
51#include <linux/cgroup_subsys.h> 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>
61#undef IS_SUBSYS_ENABLED
52 CGROUP_SUBSYS_COUNT, 62 CGROUP_SUBSYS_COUNT,
53}; 63};
54#undef IS_SUBSYS_ENABLED
55#undef SUBSYS 64#undef SUBSYS
56 65
57/* Per-subsystem/per-cgroup state maintained by the system. */ 66/* Per-subsystem/per-cgroup state maintained by the system. */
@@ -148,6 +157,13 @@ enum {
148 * specified at mount time and thus is implemented here. 157 * specified at mount time and thus is implemented here.
149 */ 158 */
150 CGRP_CPUSET_CLONE_CHILDREN, 159 CGRP_CPUSET_CLONE_CHILDREN,
160 /* see the comment above CGRP_ROOT_SANE_BEHAVIOR for details */
161 CGRP_SANE_BEHAVIOR,
162};
163
164struct cgroup_name {
165 struct rcu_head rcu_head;
166 char name[];
151}; 167};
152 168
153struct cgroup { 169struct cgroup {
@@ -172,11 +188,23 @@ struct cgroup {
172 struct cgroup *parent; /* my parent */ 188 struct cgroup *parent; /* my parent */
173 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 189 struct dentry *dentry; /* cgroup fs entry, RCU protected */
174 190
191 /*
192 * This is a copy of dentry->d_name, and it's needed because
193 * we can't use dentry->d_name in cgroup_path().
194 *
195 * You must acquire rcu_read_lock() to access cgrp->name, and
196 * the only place that can change it is rename(), which is
197 * protected by parent dir's i_mutex.
198 *
199 * Normally you should use cgroup_name() wrapper rather than
200 * access it directly.
201 */
202 struct cgroup_name __rcu *name;
203
175 /* Private pointers for each registered subsystem */ 204 /* Private pointers for each registered subsystem */
176 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 205 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
177 206
178 struct cgroupfs_root *root; 207 struct cgroupfs_root *root;
179 struct cgroup *top_cgroup;
180 208
181 /* 209 /*
182 * List of cg_cgroup_links pointing at css_sets with 210 * List of cg_cgroup_links pointing at css_sets with
@@ -213,6 +241,96 @@ struct cgroup {
213 struct simple_xattrs xattrs; 241 struct simple_xattrs xattrs;
214}; 242};
215 243
244#define MAX_CGROUP_ROOT_NAMELEN 64
245
246/* cgroupfs_root->flags */
247enum {
248 /*
249 * Unfortunately, cgroup core and various controllers are riddled
250 * with idiosyncrasies and pointless options. The following flag,
251 * when set, will force sane behavior - some options are forced on,
252 * others are disallowed, and some controllers will change their
253 * hierarchical or other behaviors.
254 *
255 * The set of behaviors affected by this flag are still being
256 * determined and developed and the mount option for this flag is
257 * prefixed with __DEVEL__. The prefix will be dropped once we
258 * reach the point where all behaviors are compatible with the
259 * planned unified hierarchy, which will automatically turn on this
260 * flag.
261 *
262 * The followings are the behaviors currently affected this flag.
263 *
264 * - Mount options "noprefix" and "clone_children" are disallowed.
265 * Also, cgroupfs file cgroup.clone_children is not created.
266 *
267 * - When mounting an existing superblock, mount options should
268 * match.
269 *
270 * - Remount is disallowed.
271 *
272 * - memcg: use_hierarchy is on by default and the cgroup file for
273 * the flag is not created.
274 *
275 * The followings are planned changes.
276 *
277 * - release_agent will be disallowed once replacement notification
278 * mechanism is implemented.
279 */
280 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
281
282 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
283 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
284};
285
286/*
287 * A cgroupfs_root represents the root of a cgroup hierarchy, and may be
288 * associated with a superblock to form an active hierarchy. This is
289 * internal to cgroup core. Don't access directly from controllers.
290 */
291struct cgroupfs_root {
292 struct super_block *sb;
293
294 /*
295 * The bitmask of subsystems intended to be attached to this
296 * hierarchy
297 */
298 unsigned long subsys_mask;
299
300 /* Unique id for this hierarchy. */
301 int hierarchy_id;
302
303 /* The bitmask of subsystems currently attached to this hierarchy */
304 unsigned long actual_subsys_mask;
305
306 /* A list running through the attached subsystems */
307 struct list_head subsys_list;
308
309 /* The root cgroup for this hierarchy */
310 struct cgroup top_cgroup;
311
312 /* Tracks how many cgroups are currently defined in hierarchy.*/
313 int number_of_cgroups;
314
315 /* A list running through the active hierarchies */
316 struct list_head root_list;
317
318 /* All cgroups on this root, cgroup_mutex protected */
319 struct list_head allcg_list;
320
321 /* Hierarchy-specific flags */
322 unsigned long flags;
323
324 /* IDs for cgroups in this hierarchy */
325 struct ida cgroup_ida;
326
327 /* The path to use for release notifications. */
328 char release_agent_path[PATH_MAX];
329
330 /* The name for this hierarchy - may be empty */
331 char name[MAX_CGROUP_ROOT_NAMELEN];
332};
333
216/* 334/*
217 * A css_set is a structure holding pointers to a set of 335 * A css_set is a structure holding pointers to a set of
218 * cgroup_subsys_state objects. This saves space in the task struct 336 * cgroup_subsys_state objects. This saves space in the task struct
@@ -278,6 +396,7 @@ struct cgroup_map_cb {
278/* cftype->flags */ 396/* cftype->flags */
279#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ 397#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */
280#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */ 398#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */
399#define CFTYPE_INSANE (1U << 2) /* don't create if sane_behavior */
281 400
282#define MAX_CFTYPE_NAME 64 401#define MAX_CFTYPE_NAME 64
283 402
@@ -304,9 +423,6 @@ struct cftype {
304 /* CFTYPE_* flags */ 423 /* CFTYPE_* flags */
305 unsigned int flags; 424 unsigned int flags;
306 425
307 /* file xattrs */
308 struct simple_xattrs xattrs;
309
310 int (*open)(struct inode *inode, struct file *file); 426 int (*open)(struct inode *inode, struct file *file);
311 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 427 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
312 struct file *file, 428 struct file *file,
@@ -404,18 +520,31 @@ struct cgroup_scanner {
404 void *data; 520 void *data;
405}; 521};
406 522
523/*
524 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
525 * function can be called as long as @cgrp is accessible.
526 */
527static inline bool cgroup_sane_behavior(const struct cgroup *cgrp)
528{
529 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR;
530}
531
532/* Caller should hold rcu_read_lock() */
533static inline const char *cgroup_name(const struct cgroup *cgrp)
534{
535 return rcu_dereference(cgrp->name)->name;
536}
537
407int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 538int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
408int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 539int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
409 540
410int cgroup_is_removed(const struct cgroup *cgrp); 541int cgroup_is_removed(const struct cgroup *cgrp);
542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
411 543
412int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); 544int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
413 545
414int cgroup_task_count(const struct cgroup *cgrp); 546int cgroup_task_count(const struct cgroup *cgrp);
415 547
416/* Return true if cgrp is a descendant of the task's cgroup */
417int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
418
419/* 548/*
420 * 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
421 * methods. 550 * methods.
@@ -458,7 +587,6 @@ struct cgroup_subsys {
458 void (*bind)(struct cgroup *root); 587 void (*bind)(struct cgroup *root);
459 588
460 int subsys_id; 589 int subsys_id;
461 int active;
462 int disabled; 590 int disabled;
463 int early_init; 591 int early_init;
464 /* 592 /*
@@ -523,10 +651,16 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
523 * rcu_dereference_check() conditions, such as locks used during the 651 * rcu_dereference_check() conditions, such as locks used during the
524 * cgroup_subsys::attach() methods. 652 * cgroup_subsys::attach() methods.
525 */ 653 */
654#ifdef CONFIG_PROVE_RCU
655extern struct mutex cgroup_mutex;
526#define task_subsys_state_check(task, subsys_id, __c) \ 656#define task_subsys_state_check(task, subsys_id, __c) \
527 rcu_dereference_check(task->cgroups->subsys[subsys_id], \ 657 rcu_dereference_check((task)->cgroups->subsys[(subsys_id)], \
528 lockdep_is_held(&task->alloc_lock) || \ 658 lockdep_is_held(&(task)->alloc_lock) || \
529 cgroup_lock_is_held() || (__c)) 659 lockdep_is_held(&cgroup_mutex) || (__c))
660#else
661#define task_subsys_state_check(task, subsys_id, __c) \
662 rcu_dereference((task)->cgroups->subsys[(subsys_id)])
663#endif
530 664
531static inline struct cgroup_subsys_state * 665static inline struct cgroup_subsys_state *
532task_subsys_state(struct task_struct *task, int subsys_id) 666task_subsys_state(struct task_struct *task, int subsys_id)
@@ -661,8 +795,8 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
661 struct cgroup_iter *it); 795 struct cgroup_iter *it);
662void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); 796void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
663int cgroup_scan_tasks(struct cgroup_scanner *scan); 797int cgroup_scan_tasks(struct cgroup_scanner *scan);
664int cgroup_attach_task(struct cgroup *, struct task_struct *);
665int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 798int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
799int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
666 800
667/* 801/*
668 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works 802 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
@@ -687,13 +821,6 @@ void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
687 821
688struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id); 822struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
689 823
690/*
691 * Get a cgroup whose id is greater than or equal to id under tree of root.
692 * Returning a cgroup_subsys_state or NULL.
693 */
694struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id,
695 struct cgroup_subsys_state *root, int *foundid);
696
697/* Returns true if root is ancestor of cg */ 824/* Returns true if root is ancestor of cg */
698bool css_is_ancestor(struct cgroup_subsys_state *cg, 825bool css_is_ancestor(struct cgroup_subsys_state *cg,
699 const struct cgroup_subsys_state *root); 826 const struct cgroup_subsys_state *root);
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index f204a7a9cf38..6e7ec64b69ab 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -78,3 +78,9 @@ SUBSYS(hugetlb)
78#endif 78#endif
79 79
80/* */ 80/* */
81
82#ifdef CONFIG_CGROUP_BCACHE
83SUBSYS(bcache)
84#endif
85
86/* */
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 42e55deee757..4ce9056b31a8 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -33,7 +33,7 @@ struct cleancache_ops {
33 void (*invalidate_fs)(int); 33 void (*invalidate_fs)(int);
34}; 34};
35 35
36extern struct cleancache_ops 36extern struct cleancache_ops *
37 cleancache_register_ops(struct cleancache_ops *ops); 37 cleancache_register_ops(struct cleancache_ops *ops);
38extern void __cleancache_init_fs(struct super_block *); 38extern void __cleancache_init_fs(struct super_block *);
39extern void __cleancache_init_shared_fs(char *, struct super_block *); 39extern void __cleancache_init_shared_fs(char *, struct super_block *);
@@ -42,9 +42,9 @@ extern void __cleancache_put_page(struct page *);
42extern void __cleancache_invalidate_page(struct address_space *, struct page *); 42extern void __cleancache_invalidate_page(struct address_space *, struct page *);
43extern void __cleancache_invalidate_inode(struct address_space *); 43extern void __cleancache_invalidate_inode(struct address_space *);
44extern void __cleancache_invalidate_fs(struct super_block *); 44extern void __cleancache_invalidate_fs(struct super_block *);
45extern int cleancache_enabled;
46 45
47#ifdef CONFIG_CLEANCACHE 46#ifdef CONFIG_CLEANCACHE
47#define cleancache_enabled (1)
48static inline bool cleancache_fs_enabled(struct page *page) 48static inline bool cleancache_fs_enabled(struct page *page)
49{ 49{
50 return page->mapping->host->i_sb->cleancache_poolid >= 0; 50 return page->mapping->host->i_sb->cleancache_poolid >= 0;
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index 9c7f5807824b..dd7adff76e81 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -152,7 +152,7 @@ struct clk {
152 }, \ 152 }, \
153 .reg = _reg, \ 153 .reg = _reg, \
154 .shift = _shift, \ 154 .shift = _shift, \
155 .width = _width, \ 155 .mask = BIT(_width) - 1, \
156 .flags = _mux_flags, \ 156 .flags = _mux_flags, \
157 .lock = _lock, \ 157 .lock = _lock, \
158 }; \ 158 }; \
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 7f197d7addb0..11860985fecb 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -45,6 +45,14 @@ struct clk_hw;
45 * undo any work done in the @prepare callback. Called with 45 * undo any work done in the @prepare callback. Called with
46 * prepare_lock held. 46 * prepare_lock held.
47 * 47 *
48 * @is_prepared: Queries the hardware to determine if the clock is prepared.
49 * This function is allowed to sleep. Optional, if this op is not
50 * set then the prepare count will be used.
51 *
52 * @unprepare_unused: Unprepare the clock atomically. Only called from
53 * clk_disable_unused for prepare clocks with special needs.
54 * Called with prepare mutex held. This function may sleep.
55 *
48 * @enable: Enable the clock atomically. This must not return until the 56 * @enable: Enable the clock atomically. This must not return until the
49 * clock is generating a valid clock signal, usable by consumer 57 * clock is generating a valid clock signal, usable by consumer
50 * devices. Called with enable_lock held. This function must not 58 * devices. Called with enable_lock held. This function must not
@@ -108,6 +116,8 @@ struct clk_hw;
108struct clk_ops { 116struct clk_ops {
109 int (*prepare)(struct clk_hw *hw); 117 int (*prepare)(struct clk_hw *hw);
110 void (*unprepare)(struct clk_hw *hw); 118 void (*unprepare)(struct clk_hw *hw);
119 int (*is_prepared)(struct clk_hw *hw);
120 void (*unprepare_unused)(struct clk_hw *hw);
111 int (*enable)(struct clk_hw *hw); 121 int (*enable)(struct clk_hw *hw);
112 void (*disable)(struct clk_hw *hw); 122 void (*disable)(struct clk_hw *hw);
113 int (*is_enabled)(struct clk_hw *hw); 123 int (*is_enabled)(struct clk_hw *hw);
@@ -239,9 +249,14 @@ struct clk_div_table {
239 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the 249 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
240 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is 250 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
241 * the raw value read from the register, with the value of zero considered 251 * the raw value read from the register, with the value of zero considered
242 * invalid 252 * invalid, unless CLK_DIVIDER_ALLOW_ZERO is set.
243 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from 253 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
244 * the hardware register 254 * the hardware register
255 * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors. For dividers which have
256 * CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor.
257 * Some hardware implementations gracefully handle this case and allow a
258 * zero divisor by not modifying their input clock
259 * (divide by one / bypass).
245 */ 260 */
246struct clk_divider { 261struct clk_divider {
247 struct clk_hw hw; 262 struct clk_hw hw;
@@ -255,6 +270,7 @@ struct clk_divider {
255 270
256#define CLK_DIVIDER_ONE_BASED BIT(0) 271#define CLK_DIVIDER_ONE_BASED BIT(0)
257#define CLK_DIVIDER_POWER_OF_TWO BIT(1) 272#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
273#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
258 274
259extern const struct clk_ops clk_divider_ops; 275extern const struct clk_ops clk_divider_ops;
260struct clk *clk_register_divider(struct device *dev, const char *name, 276struct clk *clk_register_divider(struct device *dev, const char *name,
@@ -274,7 +290,7 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
274 * @reg: register controlling multiplexer 290 * @reg: register controlling multiplexer
275 * @shift: shift to multiplexer bit field 291 * @shift: shift to multiplexer bit field
276 * @width: width of mutliplexer bit field 292 * @width: width of mutliplexer bit field
277 * @num_clks: number of parent clocks 293 * @flags: hardware-specific flags
278 * @lock: register lock 294 * @lock: register lock
279 * 295 *
280 * Clock with multiple selectable parents. Implements .get_parent, .set_parent 296 * Clock with multiple selectable parents. Implements .get_parent, .set_parent
@@ -287,8 +303,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
287struct clk_mux { 303struct clk_mux {
288 struct clk_hw hw; 304 struct clk_hw hw;
289 void __iomem *reg; 305 void __iomem *reg;
306 u32 *table;
307 u32 mask;
290 u8 shift; 308 u8 shift;
291 u8 width;
292 u8 flags; 309 u8 flags;
293 spinlock_t *lock; 310 spinlock_t *lock;
294}; 311};
@@ -297,11 +314,19 @@ struct clk_mux {
297#define CLK_MUX_INDEX_BIT BIT(1) 314#define CLK_MUX_INDEX_BIT BIT(1)
298 315
299extern const struct clk_ops clk_mux_ops; 316extern const struct clk_ops clk_mux_ops;
317
300struct clk *clk_register_mux(struct device *dev, const char *name, 318struct clk *clk_register_mux(struct device *dev, const char *name,
301 const char **parent_names, u8 num_parents, unsigned long flags, 319 const char **parent_names, u8 num_parents, unsigned long flags,
302 void __iomem *reg, u8 shift, u8 width, 320 void __iomem *reg, u8 shift, u8 width,
303 u8 clk_mux_flags, spinlock_t *lock); 321 u8 clk_mux_flags, spinlock_t *lock);
304 322
323struct clk *clk_register_mux_table(struct device *dev, const char *name,
324 const char **parent_names, u8 num_parents, unsigned long flags,
325 void __iomem *reg, u8 shift, u32 mask,
326 u8 clk_mux_flags, u32 *table, spinlock_t *lock);
327
328void of_fixed_factor_clk_setup(struct device_node *node);
329
305/** 330/**
306 * struct clk_fixed_factor - fixed multiplier and divider clock 331 * struct clk_fixed_factor - fixed multiplier and divider clock
307 * 332 *
@@ -325,6 +350,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
325 const char *parent_name, unsigned long flags, 350 const char *parent_name, unsigned long flags,
326 unsigned int mult, unsigned int div); 351 unsigned int mult, unsigned int div);
327 352
353/***
354 * struct clk_composite - aggregate clock of mux, divider and gate clocks
355 *
356 * @hw: handle between common and hardware-specific interfaces
357 * @mux_hw: handle between composite and hardware-specific mux clock
358 * @rate_hw: handle between composite and hardware-specific rate clock
359 * @gate_hw: handle between composite and hardware-specific gate clock
360 * @mux_ops: clock ops for mux
361 * @rate_ops: clock ops for rate
362 * @gate_ops: clock ops for gate
363 */
364struct clk_composite {
365 struct clk_hw hw;
366 struct clk_ops ops;
367
368 struct clk_hw *mux_hw;
369 struct clk_hw *rate_hw;
370 struct clk_hw *gate_hw;
371
372 const struct clk_ops *mux_ops;
373 const struct clk_ops *rate_ops;
374 const struct clk_ops *gate_ops;
375};
376
377struct clk *clk_register_composite(struct device *dev, const char *name,
378 const char **parent_names, int num_parents,
379 struct clk_hw *mux_hw, const struct clk_ops *mux_ops,
380 struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
381 struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
382 unsigned long flags);
383
328/** 384/**
329 * clk_register - allocate a new clock, register it and return an opaque cookie 385 * clk_register - allocate a new clock, register it and return an opaque cookie
330 * @dev: device that is registering this clock 386 * @dev: device that is registering this clock
@@ -351,6 +407,7 @@ unsigned int __clk_get_enable_count(struct clk *clk);
351unsigned int __clk_get_prepare_count(struct clk *clk); 407unsigned int __clk_get_prepare_count(struct clk *clk);
352unsigned long __clk_get_rate(struct clk *clk); 408unsigned long __clk_get_rate(struct clk *clk);
353unsigned long __clk_get_flags(struct clk *clk); 409unsigned long __clk_get_flags(struct clk *clk);
410bool __clk_is_prepared(struct clk *clk);
354bool __clk_is_enabled(struct clk *clk); 411bool __clk_is_enabled(struct clk *clk);
355struct clk *__clk_lookup(const char *name); 412struct clk *__clk_lookup(const char *name);
356 413
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b3ac22d0fc1f..9a6d04524b1a 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -28,16 +28,16 @@ struct clk;
28 * PRE_RATE_CHANGE - called immediately before the clk rate is changed, 28 * PRE_RATE_CHANGE - called immediately before the clk rate is changed,
29 * to indicate that the rate change will proceed. Drivers must 29 * to indicate that the rate change will proceed. Drivers must
30 * immediately terminate any operations that will be affected by the 30 * immediately terminate any operations that will be affected by the
31 * rate change. Callbacks may either return NOTIFY_DONE or 31 * rate change. Callbacks may either return NOTIFY_DONE, NOTIFY_OK,
32 * NOTIFY_STOP. 32 * NOTIFY_STOP or NOTIFY_BAD.
33 * 33 *
34 * ABORT_RATE_CHANGE: called if the rate change failed for some reason 34 * ABORT_RATE_CHANGE: called if the rate change failed for some reason
35 * after PRE_RATE_CHANGE. In this case, all registered notifiers on 35 * after PRE_RATE_CHANGE. In this case, all registered notifiers on
36 * the clk will be called with ABORT_RATE_CHANGE. Callbacks must 36 * the clk will be called with ABORT_RATE_CHANGE. Callbacks must
37 * always return NOTIFY_DONE. 37 * always return NOTIFY_DONE or NOTIFY_OK.
38 * 38 *
39 * POST_RATE_CHANGE - called after the clk rate change has successfully 39 * POST_RATE_CHANGE - called after the clk rate change has successfully
40 * completed. Callbacks must always return NOTIFY_DONE. 40 * completed. Callbacks must always return NOTIFY_DONE or NOTIFY_OK.
41 * 41 *
42 */ 42 */
43#define PRE_RATE_CHANGE BIT(0) 43#define PRE_RATE_CHANGE BIT(0)
diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h
new file mode 100644
index 000000000000..90c30dc3efc7
--- /dev/null
+++ b/include/linux/clk/mxs.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_CLK_MXS_H
10#define __LINUX_CLK_MXS_H
11
12int mx23_clocks_init(void);
13int mx28_clocks_init(void);
14int mxs_saif_clkmux_select(unsigned int clkmux);
15
16#endif
diff --git a/include/linux/sunxi_timer.h b/include/linux/clk/sunxi.h
index 18081787e5f3..e074fdd5a236 100644
--- a/include/linux/sunxi_timer.h
+++ b/include/linux/clk/sunxi.h
@@ -14,11 +14,9 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16
17#ifndef __SUNXI_TIMER_H 17#ifndef __LINUX_CLK_SUNXI_H_
18#define __SUNXI_TIMER_H 18#define __LINUX_CLK_SUNXI_H_
19 19
20#include <asm/mach/time.h> 20void __init sunxi_init_clocks(void);
21
22void sunxi_timer_init(void);
23 21
24#endif 22#endif
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
index 404d6f940872..642789baec74 100644
--- a/include/linux/clk/tegra.h
+++ b/include/linux/clk/tegra.h
@@ -123,5 +123,6 @@ static inline void tegra_cpu_clock_resume(void)
123void tegra_periph_reset_deassert(struct clk *c); 123void tegra_periph_reset_deassert(struct clk *c);
124void tegra_periph_reset_assert(struct clk *c); 124void tegra_periph_reset_assert(struct clk *c);
125void tegra_clocks_init(void); 125void tegra_clocks_init(void);
126void tegra_clocks_apply_init_table(void);
126 127
127#endif /* __LINUX_CLK_TEGRA_H_ */ 128#endif /* __LINUX_CLK_TEGRA_H_ */
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 66346521cb65..963d71431388 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -8,6 +8,20 @@
8#ifndef _LINUX_CLOCKCHIPS_H 8#ifndef _LINUX_CLOCKCHIPS_H
9#define _LINUX_CLOCKCHIPS_H 9#define _LINUX_CLOCKCHIPS_H
10 10
11/* Clock event notification values */
12enum clock_event_nofitiers {
13 CLOCK_EVT_NOTIFY_ADD,
14 CLOCK_EVT_NOTIFY_BROADCAST_ON,
15 CLOCK_EVT_NOTIFY_BROADCAST_OFF,
16 CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
17 CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
18 CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
19 CLOCK_EVT_NOTIFY_SUSPEND,
20 CLOCK_EVT_NOTIFY_RESUME,
21 CLOCK_EVT_NOTIFY_CPU_DYING,
22 CLOCK_EVT_NOTIFY_CPU_DEAD,
23};
24
11#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD 25#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
12 26
13#include <linux/clocksource.h> 27#include <linux/clocksource.h>
@@ -26,20 +40,6 @@ enum clock_event_mode {
26 CLOCK_EVT_MODE_RESUME, 40 CLOCK_EVT_MODE_RESUME,
27}; 41};
28 42
29/* Clock event notification values */
30enum clock_event_nofitiers {
31 CLOCK_EVT_NOTIFY_ADD,
32 CLOCK_EVT_NOTIFY_BROADCAST_ON,
33 CLOCK_EVT_NOTIFY_BROADCAST_OFF,
34 CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
35 CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
36 CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
37 CLOCK_EVT_NOTIFY_SUSPEND,
38 CLOCK_EVT_NOTIFY_RESUME,
39 CLOCK_EVT_NOTIFY_CPU_DYING,
40 CLOCK_EVT_NOTIFY_CPU_DEAD,
41};
42
43/* 43/*
44 * Clock event features 44 * Clock event features
45 */ 45 */
@@ -55,6 +55,11 @@ enum clock_event_nofitiers {
55#define CLOCK_EVT_FEAT_C3STOP 0x000008 55#define CLOCK_EVT_FEAT_C3STOP 0x000008
56#define CLOCK_EVT_FEAT_DUMMY 0x000010 56#define CLOCK_EVT_FEAT_DUMMY 0x000010
57 57
58/*
59 * Core shall set the interrupt affinity dynamically in broadcast mode
60 */
61#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
62
58/** 63/**
59 * struct clock_event_device - clock event device descriptor 64 * struct clock_event_device - clock event device descriptor
60 * @event_handler: Assigned by the framework to be called by the low 65 * @event_handler: Assigned by the framework to be called by the low
@@ -170,10 +175,16 @@ extern void tick_broadcast(const struct cpumask *mask);
170extern int tick_receive_broadcast(void); 175extern int tick_receive_broadcast(void);
171#endif 176#endif
172 177
178#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
179extern int tick_check_broadcast_expired(void);
180#else
181static inline int tick_check_broadcast_expired(void) { return 0; }
182#endif
183
173#ifdef CONFIG_GENERIC_CLOCKEVENTS 184#ifdef CONFIG_GENERIC_CLOCKEVENTS
174extern void clockevents_notify(unsigned long reason, void *arg); 185extern void clockevents_notify(unsigned long reason, void *arg);
175#else 186#else
176# define clockevents_notify(reason, arg) do { } while (0) 187static inline void clockevents_notify(unsigned long reason, void *arg) {}
177#endif 188#endif
178 189
179#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ 190#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
@@ -181,7 +192,8 @@ extern void clockevents_notify(unsigned long reason, void *arg);
181static inline void clockevents_suspend(void) {} 192static inline void clockevents_suspend(void) {}
182static inline void clockevents_resume(void) {} 193static inline void clockevents_resume(void) {}
183 194
184#define clockevents_notify(reason, arg) do { } while (0) 195static inline void clockevents_notify(unsigned long reason, void *arg) {}
196static inline int tick_check_broadcast_expired(void) { return 0; }
185 197
186#endif 198#endif
187 199
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 27cfda427dd9..7279b94c01da 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -206,6 +206,7 @@ struct clocksource {
206#define CLOCK_SOURCE_WATCHDOG 0x10 206#define CLOCK_SOURCE_WATCHDOG 0x10
207#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 207#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
208#define CLOCK_SOURCE_UNSTABLE 0x40 208#define CLOCK_SOURCE_UNSTABLE 0x40
209#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80
209 210
210/* simplify initialization of mask field */ 211/* simplify initialization of mask field */
211#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 212#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -332,15 +333,23 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
332 333
333extern int clocksource_i8253_init(void); 334extern int clocksource_i8253_init(void);
334 335
336struct device_node;
337typedef void(*clocksource_of_init_fn)(struct device_node *);
335#ifdef CONFIG_CLKSRC_OF 338#ifdef CONFIG_CLKSRC_OF
336extern void clocksource_of_init(void); 339extern void clocksource_of_init(void);
337 340
338#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ 341#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
339 static const struct of_device_id __clksrc_of_table_##name \ 342 static const struct of_device_id __clksrc_of_table_##name \
340 __used __section(__clksrc_of_table) \ 343 __used __section(__clksrc_of_table) \
341 = { .compatible = compat, .data = fn }; 344 = { .compatible = compat, \
345 .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
342#else 346#else
343#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) 347static inline void clocksource_of_init(void) {}
348#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
349 static const struct of_device_id __clksrc_of_table_##name \
350 __attribute__((unused)) \
351 = { .compatible = compat, \
352 .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
344#endif 353#endif
345 354
346#endif /* _LINUX_CLOCKSOURCE_H */ 355#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index 2c1bc1ea04ee..1d5b02a96c46 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -26,6 +26,7 @@ void proc_id_connector(struct task_struct *task, int which_id);
26void proc_sid_connector(struct task_struct *task); 26void proc_sid_connector(struct task_struct *task);
27void proc_ptrace_connector(struct task_struct *task, int which_id); 27void proc_ptrace_connector(struct task_struct *task, int which_id);
28void proc_comm_connector(struct task_struct *task); 28void proc_comm_connector(struct task_struct *task);
29void proc_coredump_connector(struct task_struct *task);
29void proc_exit_connector(struct task_struct *task); 30void proc_exit_connector(struct task_struct *task);
30#else 31#else
31static inline void proc_fork_connector(struct task_struct *task) 32static inline void proc_fork_connector(struct task_struct *task)
@@ -48,6 +49,9 @@ static inline void proc_ptrace_connector(struct task_struct *task,
48 int ptrace_id) 49 int ptrace_id)
49{} 50{}
50 51
52static inline void proc_coredump_connector(struct task_struct *task)
53{}
54
51static inline void proc_exit_connector(struct task_struct *task) 55static inline void proc_exit_connector(struct task_struct *task)
52{} 56{}
53#endif /* CONFIG_PROC_EVENTS */ 57#endif /* CONFIG_PROC_EVENTS */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 377cd8c3395e..7f0c1dd09079 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -27,12 +27,6 @@
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) 27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif 28#endif
29 29
30#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
31#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
32#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
33#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
34#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
35#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
36#define COMPAT_SYSCALL_DEFINE1(name, ...) \ 30#define COMPAT_SYSCALL_DEFINE1(name, ...) \
37 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 31 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
38#define COMPAT_SYSCALL_DEFINE2(name, ...) \ 32#define COMPAT_SYSCALL_DEFINE2(name, ...) \
@@ -46,24 +40,15 @@
46#define COMPAT_SYSCALL_DEFINE6(name, ...) \ 40#define COMPAT_SYSCALL_DEFINE6(name, ...) \
47 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 41 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
48 42
49#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ 44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
53 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ 45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
54 asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ 46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
55 { \ 47 { \
56 return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ 48 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
57 } \ 49 } \
58 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ 50 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
59 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) 51 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
60
61#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
62
63#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
64 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
65
66#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
67 52
68#ifndef compat_user_stack_pointer 53#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer() 54#define compat_user_stack_pointer() current_user_stack_pointer()
@@ -326,21 +311,13 @@ asmlinkage long
326compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, 311compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
327 compat_size_t __user *len_ptr); 312 compat_size_t __user *len_ptr);
328 313
329#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 314asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
330long compat_sys_semctl(int first, int second, int third, void __user *uptr); 315asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
331long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 316asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
332long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 317asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
333 int version, void __user *uptr);
334long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
335 void __user *uptr);
336#else
337long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
338long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
339 compat_ssize_t msgsz, int msgflg); 318 compat_ssize_t msgsz, int msgflg);
340long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, 319asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
341 compat_ssize_t msgsz, long msgtyp, int msgflg); 320 compat_ssize_t msgsz, long msgtyp, int msgflg);
342long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
343#endif
344long compat_sys_msgctl(int first, int second, void __user *uptr); 321long compat_sys_msgctl(int first, int second, void __user *uptr);
345long compat_sys_shmctl(int first, int second, void __user *uptr); 322long compat_sys_shmctl(int first, int second, void __user *uptr);
346long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 323long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
@@ -444,13 +421,13 @@ extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
444asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, 421asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
445 compat_long_t addr, compat_long_t data); 422 compat_long_t addr, compat_long_t data);
446 423
424asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t);
447/* 425/*
448 * epoll (fs/eventpoll.c) compat bits follow ... 426 * epoll (fs/eventpoll.c) compat bits follow ...
449 */ 427 */
450struct epoll_event; 428struct epoll_event; /* fortunately, this one is fixed-layout */
451#define compat_epoll_event epoll_event
452asmlinkage long compat_sys_epoll_pwait(int epfd, 429asmlinkage long compat_sys_epoll_pwait(int epfd,
453 struct compat_epoll_event __user *events, 430 struct epoll_event __user *events,
454 int maxevents, int timeout, 431 int maxevents, int timeout,
455 const compat_sigset_t __user *sigmask, 432 const compat_sigset_t __user *sigmask,
456 compat_size_t sigsetsize); 433 compat_size_t sigsetsize);
@@ -685,6 +662,8 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
685 662
686asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 663asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
687 compat_off_t __user *offset, compat_size_t count); 664 compat_off_t __user *offset, compat_size_t count);
665asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
666 compat_loff_t __user *offset, compat_size_t count);
688asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 667asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
689 compat_stack_t __user *uoss_ptr); 668 compat_stack_t __user *uoss_ptr);
690 669
@@ -694,6 +673,8 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long);
694asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 673asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
695 struct compat_timespec __user *interval); 674 struct compat_timespec __user *interval);
696 675
676asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32,
677 int, const char __user *);
697#else 678#else
698 679
699#define is_compat_task() (0) 680#define is_compat_task() (0)
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 68b162d92254..842de225055f 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -13,7 +13,7 @@
13#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
15 15
16#if GCC_VERSION >= 40100 16#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
17# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) 17# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
18#endif 18#endif
19 19
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 10b8f23fab0f..92669cd182a6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -351,4 +351,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
351 */ 351 */
352#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) 352#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
353 353
354/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
355#ifdef CONFIG_KPROBES
356# define __kprobes __attribute__((__section__(".kprobes.text")))
357#else
358# define __kprobes
359#endif
354#endif /* __LINUX_COMPILER_H */ 360#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/console.h b/include/linux/console.h
index 29680a8cda99..73bab0f58af5 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -141,6 +141,7 @@ struct console {
141 for (con = console_drivers; con != NULL; con = con->next) 141 for (con = console_drivers; con != NULL; con = con->next)
142 142
143extern int console_set_on_cmdline; 143extern int console_set_on_cmdline;
144extern struct console *early_console;
144 145
145extern int add_preferred_console(char *name, int idx, char *options); 146extern int add_preferred_console(char *name, int idx, char *options);
146extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); 147extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options);
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index b28d161c1091..365f4a61bf04 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -1,9 +1,9 @@
1#ifndef _LINUX_CONTEXT_TRACKING_H 1#ifndef _LINUX_CONTEXT_TRACKING_H
2#define _LINUX_CONTEXT_TRACKING_H 2#define _LINUX_CONTEXT_TRACKING_H
3 3
4#ifdef CONFIG_CONTEXT_TRACKING
5#include <linux/sched.h> 4#include <linux/sched.h>
6#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <asm/ptrace.h>
7 7
8struct context_tracking { 8struct context_tracking {
9 /* 9 /*
@@ -13,12 +13,13 @@ struct context_tracking {
13 * may be further optimized using static keys. 13 * may be further optimized using static keys.
14 */ 14 */
15 bool active; 15 bool active;
16 enum { 16 enum ctx_state {
17 IN_KERNEL = 0, 17 IN_KERNEL = 0,
18 IN_USER, 18 IN_USER,
19 } state; 19 } state;
20}; 20};
21 21
22#ifdef CONFIG_CONTEXT_TRACKING
22DECLARE_PER_CPU(struct context_tracking, context_tracking); 23DECLARE_PER_CPU(struct context_tracking, context_tracking);
23 24
24static inline bool context_tracking_in_user(void) 25static inline bool context_tracking_in_user(void)
@@ -33,12 +34,31 @@ static inline bool context_tracking_active(void)
33 34
34extern void user_enter(void); 35extern void user_enter(void);
35extern void user_exit(void); 36extern void user_exit(void);
37
38static inline enum ctx_state exception_enter(void)
39{
40 enum ctx_state prev_ctx;
41
42 prev_ctx = this_cpu_read(context_tracking.state);
43 user_exit();
44
45 return prev_ctx;
46}
47
48static inline void exception_exit(enum ctx_state prev_ctx)
49{
50 if (prev_ctx == IN_USER)
51 user_enter();
52}
53
36extern void context_tracking_task_switch(struct task_struct *prev, 54extern void context_tracking_task_switch(struct task_struct *prev,
37 struct task_struct *next); 55 struct task_struct *next);
38#else 56#else
39static inline bool context_tracking_in_user(void) { return false; } 57static inline bool context_tracking_in_user(void) { return false; }
40static inline void user_enter(void) { } 58static inline void user_enter(void) { }
41static inline void user_exit(void) { } 59static inline void user_exit(void) { }
60static inline enum ctx_state exception_enter(void) { return 0; }
61static inline void exception_exit(enum ctx_state prev_ctx) { }
42static inline void context_tracking_task_switch(struct task_struct *prev, 62static inline void context_tracking_task_switch(struct task_struct *prev,
43 struct task_struct *next) { } 63 struct task_struct *next) { }
44#endif /* !CONFIG_CONTEXT_TRACKING */ 64#endif /* !CONFIG_CONTEXT_TRACKING */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index ce7a074f2519..c6f6e0839b61 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -212,4 +212,20 @@ static inline int disable_nonboot_cpus(void) { return 0; }
212static inline void enable_nonboot_cpus(void) {} 212static inline void enable_nonboot_cpus(void) {}
213#endif /* !CONFIG_PM_SLEEP_SMP */ 213#endif /* !CONFIG_PM_SLEEP_SMP */
214 214
215enum cpuhp_state {
216 CPUHP_OFFLINE,
217 CPUHP_ONLINE,
218};
219
220void cpu_startup_entry(enum cpuhp_state state);
221void cpu_idle(void);
222
223void cpu_idle_poll_ctrl(bool enable);
224
225void arch_cpu_idle(void);
226void arch_cpu_idle_prepare(void);
227void arch_cpu_idle_enter(void);
228void arch_cpu_idle_exit(void);
229void arch_cpu_idle_dead(void);
230
215#endif /* _LINUX_CPU_H_ */ 231#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 40b4ef54cc7d..282e27028418 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -25,34 +25,39 @@
25#define __CPU_COOLING_H__ 25#define __CPU_COOLING_H__
26 26
27#include <linux/thermal.h> 27#include <linux/thermal.h>
28#include <linux/cpumask.h>
28 29
29#define CPUFREQ_COOLING_START 0 30#ifdef CONFIG_CPU_THERMAL
30#define CPUFREQ_COOLING_STOP 1
31
32#if defined(CONFIG_CPU_THERMAL) || defined(CONFIG_CPU_THERMAL_MODULE)
33/** 31/**
34 * cpufreq_cooling_register - function to create cpufreq cooling device. 32 * cpufreq_cooling_register - function to create cpufreq cooling device.
35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen 33 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
36 */ 34 */
37struct thermal_cooling_device *cpufreq_cooling_register( 35struct thermal_cooling_device *
38 const struct cpumask *clip_cpus); 36cpufreq_cooling_register(const struct cpumask *clip_cpus);
39 37
40/** 38/**
41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 39 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
42 * @cdev: thermal cooling device pointer. 40 * @cdev: thermal cooling device pointer.
43 */ 41 */
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
43
44unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device *cpufreq_cooling_register( 46static inline struct thermal_cooling_device *
47 const struct cpumask *clip_cpus) 47cpufreq_cooling_register(const struct cpumask *clip_cpus)
48{ 48{
49 return NULL; 49 return NULL;
50} 50}
51static inline void cpufreq_cooling_unregister( 51static inline
52 struct thermal_cooling_device *cdev) 52void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
53{ 53{
54 return; 54 return;
55} 55}
56static inline
57unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int)
58{
59 return THERMAL_CSTATE_INVALID;
60}
56#endif /* CONFIG_CPU_THERMAL */ 61#endif /* CONFIG_CPU_THERMAL */
57 62
58#endif /* __CPU_COOLING_H__ */ 63#endif /* __CPU_COOLING_H__ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index a22944ca0526..037d36ae63e5 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -106,6 +106,7 @@ struct cpufreq_policy {
106 * governors are used */ 106 * governors are used */
107 unsigned int policy; /* see above */ 107 unsigned int policy; /* see above */
108 struct cpufreq_governor *governor; /* see below */ 108 struct cpufreq_governor *governor; /* see below */
109 void *governor_data;
109 110
110 struct work_struct update; /* if update_policy() needs to be 111 struct work_struct update; /* if update_policy() needs to be
111 * called, but you're in IRQ context */ 112 * called, but you're in IRQ context */
@@ -178,9 +179,11 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu
178 * CPUFREQ GOVERNORS * 179 * CPUFREQ GOVERNORS *
179 *********************************************************************/ 180 *********************************************************************/
180 181
181#define CPUFREQ_GOV_START 1 182#define CPUFREQ_GOV_START 1
182#define CPUFREQ_GOV_STOP 2 183#define CPUFREQ_GOV_STOP 2
183#define CPUFREQ_GOV_LIMITS 3 184#define CPUFREQ_GOV_LIMITS 3
185#define CPUFREQ_GOV_POLICY_INIT 4
186#define CPUFREQ_GOV_POLICY_EXIT 5
184 187
185struct cpufreq_governor { 188struct cpufreq_governor {
186 char name[CPUFREQ_NAME_LEN]; 189 char name[CPUFREQ_NAME_LEN];
@@ -229,6 +232,13 @@ struct cpufreq_driver {
229 struct module *owner; 232 struct module *owner;
230 char name[CPUFREQ_NAME_LEN]; 233 char name[CPUFREQ_NAME_LEN];
231 u8 flags; 234 u8 flags;
235 /*
236 * This should be set by platforms having multiple clock-domains, i.e.
237 * supporting multiple policies. With this sysfs directories of governor
238 * would be created in cpu/cpu<num>/cpufreq/ directory and so they can
239 * use the same governor with different tunables for different clusters.
240 */
241 bool have_governor_per_policy;
232 242
233 /* needed by all drivers */ 243 /* needed by all drivers */
234 int (*init) (struct cpufreq_policy *policy); 244 int (*init) (struct cpufreq_policy *policy);
@@ -268,8 +278,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data);
268int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 278int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
269 279
270 280
271void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); 281void cpufreq_notify_transition(struct cpufreq_policy *policy,
272 282 struct cpufreq_freqs *freqs, unsigned int state);
273 283
274static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) 284static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max)
275{ 285{
@@ -329,6 +339,7 @@ const char *cpufreq_get_current_driver(void);
329 *********************************************************************/ 339 *********************************************************************/
330int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 340int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
331int cpufreq_update_policy(unsigned int cpu); 341int cpufreq_update_policy(unsigned int cpu);
342bool have_governor_per_policy(void);
332 343
333#ifdef CONFIG_CPU_FREQ 344#ifdef CONFIG_CPU_FREQ
334/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 345/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 480c14dc1ddd..8f0406230a0a 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -17,7 +17,7 @@
17#include <linux/completion.h> 17#include <linux/completion.h>
18#include <linux/hrtimer.h> 18#include <linux/hrtimer.h>
19 19
20#define CPUIDLE_STATE_MAX 8 20#define CPUIDLE_STATE_MAX 10
21#define CPUIDLE_NAME_LEN 16 21#define CPUIDLE_NAME_LEN 16
22#define CPUIDLE_DESC_LEN 32 22#define CPUIDLE_DESC_LEN 32
23 23
@@ -57,6 +57,7 @@ struct cpuidle_state {
57/* Idle State Flags */ 57/* Idle State Flags */
58#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ 58#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
59#define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ 59#define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */
60#define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */
60 61
61#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 62#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
62 63
@@ -104,8 +105,8 @@ struct cpuidle_driver {
104 struct module *owner; 105 struct module *owner;
105 int refcnt; 106 int refcnt;
106 107
107 /* set to 1 to use the core cpuidle time keeping (for all states). */ 108 /* used by the cpuidle framework to setup the broadcast timer */
108 unsigned int en_core_tk_irqen:1; 109 unsigned int bctimer:1;
109 /* states array must be ordered in decreasing power consumption */ 110 /* states array must be ordered in decreasing power consumption */
110 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 111 struct cpuidle_state states[CPUIDLE_STATE_MAX];
111 int state_count; 112 int state_count;
@@ -122,17 +123,15 @@ extern void cpuidle_driver_unref(void);
122extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); 123extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
123extern int cpuidle_register_device(struct cpuidle_device *dev); 124extern int cpuidle_register_device(struct cpuidle_device *dev);
124extern void cpuidle_unregister_device(struct cpuidle_device *dev); 125extern void cpuidle_unregister_device(struct cpuidle_device *dev);
125 126extern int cpuidle_register(struct cpuidle_driver *drv,
127 const struct cpumask *const coupled_cpus);
128extern void cpuidle_unregister(struct cpuidle_driver *drv);
126extern void cpuidle_pause_and_lock(void); 129extern void cpuidle_pause_and_lock(void);
127extern void cpuidle_resume_and_unlock(void); 130extern void cpuidle_resume_and_unlock(void);
128extern void cpuidle_pause(void); 131extern void cpuidle_pause(void);
129extern void cpuidle_resume(void); 132extern void cpuidle_resume(void);
130extern int cpuidle_enable_device(struct cpuidle_device *dev); 133extern int cpuidle_enable_device(struct cpuidle_device *dev);
131extern void cpuidle_disable_device(struct cpuidle_device *dev); 134extern void cpuidle_disable_device(struct cpuidle_device *dev);
132extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
133 struct cpuidle_driver *drv, int index,
134 int (*enter)(struct cpuidle_device *dev,
135 struct cpuidle_driver *drv, int index));
136extern int cpuidle_play_dead(void); 135extern int cpuidle_play_dead(void);
137 136
138extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 137extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
@@ -151,7 +150,10 @@ static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
151static inline int cpuidle_register_device(struct cpuidle_device *dev) 150static inline int cpuidle_register_device(struct cpuidle_device *dev)
152{return -ENODEV; } 151{return -ENODEV; }
153static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } 152static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }
154 153static inline int cpuidle_register(struct cpuidle_driver *drv,
154 const struct cpumask *const coupled_cpus)
155{return -ENODEV; }
156static inline void cpuidle_unregister(struct cpuidle_driver *drv) { }
155static inline void cpuidle_pause_and_lock(void) { } 157static inline void cpuidle_pause_and_lock(void) { }
156static inline void cpuidle_resume_and_unlock(void) { } 158static inline void cpuidle_resume_and_unlock(void) { }
157static inline void cpuidle_pause(void) { } 159static inline void cpuidle_pause(void) { }
@@ -159,11 +161,6 @@ static inline void cpuidle_resume(void) { }
159static inline int cpuidle_enable_device(struct cpuidle_device *dev) 161static inline int cpuidle_enable_device(struct cpuidle_device *dev)
160{return -ENODEV; } 162{return -ENODEV; }
161static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 163static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
162static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
163 struct cpuidle_driver *drv, int index,
164 int (*enter)(struct cpuidle_device *dev,
165 struct cpuidle_driver *drv, int index))
166{ return -ENODEV; }
167static inline int cpuidle_play_dead(void) {return -ENODEV; } 164static inline int cpuidle_play_dead(void) {return -ENODEV; }
168#endif 165#endif
169 166
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 032560295fcb..d08e4d2a9b92 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -591,6 +591,21 @@ static inline int cpulist_scnprintf(char *buf, int len,
591} 591}
592 592
593/** 593/**
594 * cpumask_parse - extract a cpumask from from a string
595 * @buf: the buffer to extract from
596 * @dstp: the cpumask to set.
597 *
598 * Returns -errno, or 0 for success.
599 */
600static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
601{
602 char *nl = strchr(buf, '\n');
603 int len = nl ? nl - buf : strlen(buf);
604
605 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
606}
607
608/**
594 * cpulist_parse - extract a cpumask from a user string of ranges 609 * cpulist_parse - extract a cpumask from a user string of ranges
595 * @buf: the buffer to extract from 610 * @buf: the buffer to extract from
596 * @dstp: the cpumask to set. 611 * @dstp: the cpumask to set.
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 8c8a60d29407..cc1b01cf2035 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -11,7 +11,6 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/cgroup.h>
15#include <linux/mm.h> 14#include <linux/mm.h>
16 15
17#ifdef CONFIG_CPUSETS 16#ifdef CONFIG_CPUSETS
@@ -64,10 +63,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
64extern int cpuset_memory_pressure_enabled; 63extern int cpuset_memory_pressure_enabled;
65extern void __cpuset_memory_pressure_bump(void); 64extern void __cpuset_memory_pressure_bump(void);
66 65
67extern const struct file_operations proc_cpuset_operations;
68struct seq_file;
69extern void cpuset_task_status_allowed(struct seq_file *m, 66extern void cpuset_task_status_allowed(struct seq_file *m,
70 struct task_struct *task); 67 struct task_struct *task);
68extern int proc_cpuset_show(struct seq_file *, void *);
71 69
72extern int cpuset_mem_spread_node(void); 70extern int cpuset_mem_spread_node(void);
73extern int cpuset_slab_spread_node(void); 71extern int cpuset_slab_spread_node(void);
diff --git a/include/linux/ctype.h b/include/linux/ctype.h
index 8acfe312f947..653589e3e30e 100644
--- a/include/linux/ctype.h
+++ b/include/linux/ctype.h
@@ -61,4 +61,10 @@ static inline char _tolower(const char c)
61 return c | 0x20; 61 return c | 0x20;
62} 62}
63 63
64/* Fast check for octal digit */
65static inline int isodigit(const char c)
66{
67 return c >= '0' && c <= '7';
68}
69
64#endif 70#endif
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 3bd46f766751..21ca773f77bf 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -27,7 +27,7 @@ extern int debug_locks_off(void);
27 \ 27 \
28 if (!oops_in_progress && unlikely(c)) { \ 28 if (!oops_in_progress && unlikely(c)) { \
29 if (debug_locks_off() && !debug_locks_silent) \ 29 if (debug_locks_off() && !debug_locks_silent) \
30 WARN_ON(1); \ 30 WARN(1, "DEBUG_LOCKS_WARN_ON(%s)", #c); \
31 __ret = 1; \ 31 __ret = 1; \
32 } \ 32 } \
33 __ret; \ 33 __ret; \
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 1e483fa7afb4..3cd32478f2fd 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -79,11 +79,26 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
79typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 79typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
80 struct bio_vec *biovec, int max_size); 80 struct bio_vec *biovec, int max_size);
81 81
82/*
83 * These iteration functions are typically used to check (and combine)
84 * properties of underlying devices.
85 * E.g. Does at least one underlying device support flush?
86 * Does any underlying device not support WRITE_SAME?
87 *
88 * The callout function is called once for each contiguous section of
89 * an underlying device. State can be maintained in *data.
90 * Return non-zero to stop iterating through any further devices.
91 */
82typedef int (*iterate_devices_callout_fn) (struct dm_target *ti, 92typedef int (*iterate_devices_callout_fn) (struct dm_target *ti,
83 struct dm_dev *dev, 93 struct dm_dev *dev,
84 sector_t start, sector_t len, 94 sector_t start, sector_t len,
85 void *data); 95 void *data);
86 96
97/*
98 * This function must iterate through each section of device used by the
99 * target until it encounters a non-zero return code, which it then returns.
100 * Returns zero if no callout returned non-zero.
101 */
87typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, 102typedef int (*dm_iterate_devices_fn) (struct dm_target *ti,
88 iterate_devices_callout_fn fn, 103 iterate_devices_callout_fn fn,
89 void *data); 104 void *data);
diff --git a/include/linux/device.h b/include/linux/device.h
index 9d6464ea99c6..c0a126125325 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -25,6 +25,7 @@
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/atomic.h> 26#include <linux/atomic.h>
27#include <linux/ratelimit.h> 27#include <linux/ratelimit.h>
28#include <linux/uidgid.h>
28#include <asm/device.h> 29#include <asm/device.h>
29 30
30struct device; 31struct device;
@@ -111,17 +112,11 @@ struct bus_type {
111 struct iommu_ops *iommu_ops; 112 struct iommu_ops *iommu_ops;
112 113
113 struct subsys_private *p; 114 struct subsys_private *p;
115 struct lock_class_key lock_key;
114}; 116};
115 117
116/* This is a #define to keep the compiler from merging different 118extern int __must_check bus_register(struct bus_type *bus);
117 * instances of the __key variable */ 119
118#define bus_register(subsys) \
119({ \
120 static struct lock_class_key __key; \
121 __bus_register(subsys, &__key); \
122})
123extern int __must_check __bus_register(struct bus_type *bus,
124 struct lock_class_key *key);
125extern void bus_unregister(struct bus_type *bus); 120extern void bus_unregister(struct bus_type *bus);
126 121
127extern int __must_check bus_rescan_devices(struct bus_type *bus); 122extern int __must_check bus_rescan_devices(struct bus_type *bus);
@@ -302,6 +297,8 @@ void subsys_interface_unregister(struct subsys_interface *sif);
302 297
303int subsys_system_register(struct bus_type *subsys, 298int subsys_system_register(struct bus_type *subsys,
304 const struct attribute_group **groups); 299 const struct attribute_group **groups);
300int subsys_virtual_register(struct bus_type *subsys,
301 const struct attribute_group **groups);
305 302
306/** 303/**
307 * struct class - device classes 304 * struct class - device classes
@@ -471,7 +468,8 @@ struct device_type {
471 const char *name; 468 const char *name;
472 const struct attribute_group **groups; 469 const struct attribute_group **groups;
473 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 470 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
474 char *(*devnode)(struct device *dev, umode_t *mode); 471 char *(*devnode)(struct device *dev, umode_t *mode,
472 kuid_t *uid, kgid_t *gid);
475 void (*release)(struct device *dev); 473 void (*release)(struct device *dev);
476 474
477 const struct dev_pm_ops *pm; 475 const struct dev_pm_ops *pm;
@@ -578,6 +576,10 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
578void __iomem *devm_request_and_ioremap(struct device *dev, 576void __iomem *devm_request_and_ioremap(struct device *dev,
579 struct resource *res); 577 struct resource *res);
580 578
579/* allows to add/remove a custom action to devres stack */
580int devm_add_action(struct device *dev, void (*action)(void *), void *data);
581void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
582
581struct device_dma_parameters { 583struct device_dma_parameters {
582 /* 584 /*
583 * a low level driver may set these to teach IOMMU code about 585 * a low level driver may set these to teach IOMMU code about
@@ -849,7 +851,8 @@ extern int device_rename(struct device *dev, const char *new_name);
849extern int device_move(struct device *dev, struct device *new_parent, 851extern int device_move(struct device *dev, struct device *new_parent,
850 enum dpm_order dpm_order); 852 enum dpm_order dpm_order);
851extern const char *device_get_devnode(struct device *dev, 853extern const char *device_get_devnode(struct device *dev,
852 umode_t *mode, const char **tmp); 854 umode_t *mode, kuid_t *uid, kgid_t *gid,
855 const char **tmp);
853extern void *dev_get_drvdata(const struct device *dev); 856extern void *dev_get_drvdata(const struct device *dev);
854extern int dev_set_drvdata(struct device *dev, void *data); 857extern int dev_set_drvdata(struct device *dev, void *data);
855 858
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 9978b614a1aa..dfac5ed31120 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -112,6 +112,8 @@ struct dma_buf_ops {
112 * @file: file pointer used for sharing buffers across, and for refcounting. 112 * @file: file pointer used for sharing buffers across, and for refcounting.
113 * @attachments: list of dma_buf_attachment that denotes all devices attached. 113 * @attachments: list of dma_buf_attachment that denotes all devices attached.
114 * @ops: dma_buf_ops associated with this buffer object. 114 * @ops: dma_buf_ops associated with this buffer object.
115 * @exp_name: name of the exporter; useful for debugging.
116 * @list_node: node for dma_buf accounting and debugging.
115 * @priv: exporter specific private data for this buffer object. 117 * @priv: exporter specific private data for this buffer object.
116 */ 118 */
117struct dma_buf { 119struct dma_buf {
@@ -123,6 +125,8 @@ struct dma_buf {
123 struct mutex lock; 125 struct mutex lock;
124 unsigned vmapping_counter; 126 unsigned vmapping_counter;
125 void *vmap_ptr; 127 void *vmap_ptr;
128 const char *exp_name;
129 struct list_head list_node;
126 void *priv; 130 void *priv;
127}; 131};
128 132
@@ -162,8 +166,13 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
162 struct device *dev); 166 struct device *dev);
163void dma_buf_detach(struct dma_buf *dmabuf, 167void dma_buf_detach(struct dma_buf *dmabuf,
164 struct dma_buf_attachment *dmabuf_attach); 168 struct dma_buf_attachment *dmabuf_attach);
165struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops, 169
166 size_t size, int flags); 170struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops,
171 size_t size, int flags, const char *);
172
173#define dma_buf_export(priv, ops, size, flags) \
174 dma_buf_export_named(priv, ops, size, flags, __FILE__)
175
167int dma_buf_fd(struct dma_buf *dmabuf, int flags); 176int dma_buf_fd(struct dma_buf *dmabuf, int flags);
168struct dma_buf *dma_buf_get(int fd); 177struct dma_buf *dma_buf_get(int fd);
169void dma_buf_put(struct dma_buf *dmabuf); 178void dma_buf_put(struct dma_buf *dmabuf);
@@ -185,5 +194,6 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
185 unsigned long); 194 unsigned long);
186void *dma_buf_vmap(struct dma_buf *); 195void *dma_buf_vmap(struct dma_buf *);
187void dma_buf_vunmap(struct dma_buf *, void *vaddr); 196void dma_buf_vunmap(struct dma_buf *, void *vaddr);
188 197int dma_buf_debugfs_create_file(const char *name,
198 int (*write)(struct seq_file *));
189#endif /* __DMA_BUF_H__ */ 199#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 91ac8da25020..96d3e4ab11a9 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -967,8 +967,9 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
967#ifdef CONFIG_DMA_ENGINE 967#ifdef CONFIG_DMA_ENGINE
968enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 968enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
969void dma_issue_pending_all(void); 969void dma_issue_pending_all(void);
970struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); 970struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
971struct dma_chan *dma_request_slave_channel(struct device *dev, char *name); 971 dma_filter_fn fn, void *fn_param);
972struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
972void dma_release_channel(struct dma_chan *chan); 973void dma_release_channel(struct dma_chan *chan);
973#else 974#else
974static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 975static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
@@ -978,13 +979,13 @@ static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descript
978static inline void dma_issue_pending_all(void) 979static inline void dma_issue_pending_all(void)
979{ 980{
980} 981}
981static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, 982static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
982 dma_filter_fn fn, void *fn_param) 983 dma_filter_fn fn, void *fn_param)
983{ 984{
984 return NULL; 985 return NULL;
985} 986}
986static inline struct dma_chan *dma_request_slave_channel(struct device *dev, 987static inline struct dma_chan *dma_request_slave_channel(struct device *dev,
987 char *name) 988 const char *name)
988{ 989{
989 return NULL; 990 return NULL;
990} 991}
@@ -1005,9 +1006,9 @@ struct dma_chan *net_dma_find_channel(void);
1005 __dma_request_slave_channel_compat(&(mask), x, y, dev, name) 1006 __dma_request_slave_channel_compat(&(mask), x, y, dev, name)
1006 1007
1007static inline struct dma_chan 1008static inline struct dma_chan
1008*__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn, 1009*__dma_request_slave_channel_compat(const dma_cap_mask_t *mask,
1009 void *fn_param, struct device *dev, 1010 dma_filter_fn fn, void *fn_param,
1010 char *name) 1011 struct device *dev, char *name)
1011{ 1012{
1012 struct dma_chan *chan; 1013 struct dma_chan *chan;
1013 1014
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index f156cca25ad0..b6eb7a05d58e 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -99,6 +99,7 @@ extern const char * dmi_get_system_info(int field);
99extern const struct dmi_device * dmi_find_device(int type, const char *name, 99extern const struct dmi_device * dmi_find_device(int type, const char *name,
100 const struct dmi_device *from); 100 const struct dmi_device *from);
101extern void dmi_scan_machine(void); 101extern void dmi_scan_machine(void);
102extern void dmi_set_dump_stack_arch_desc(void);
102extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); 103extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
103extern int dmi_name_in_vendors(const char *str); 104extern int dmi_name_in_vendors(const char *str);
104extern int dmi_name_in_serial(const char *str); 105extern int dmi_name_in_serial(const char *str);
@@ -114,6 +115,7 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }
114static inline const struct dmi_device * dmi_find_device(int type, const char *name, 115static inline const struct dmi_device * dmi_find_device(int type, const char *name,
115 const struct dmi_device *from) { return NULL; } 116 const struct dmi_device *from) { return NULL; }
116static inline void dmi_scan_machine(void) { return; } 117static inline void dmi_scan_machine(void) { return; }
118static inline void dmi_set_dump_stack_arch_desc(void) { }
117static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) 119static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
118{ 120{
119 if (yearp) 121 if (yearp)
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 0c5a18ec322c..1b4d4ee1168f 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -52,7 +52,7 @@
52#endif 52#endif
53 53
54extern const char *drbd_buildtag(void); 54extern const char *drbd_buildtag(void);
55#define REL_VERSION "8.4.2" 55#define REL_VERSION "8.4.3"
56#define API_VERSION 1 56#define API_VERSION 1
57#define PRO_VERSION_MIN 86 57#define PRO_VERSION_MIN 86
58#define PRO_VERSION_MAX 101 58#define PRO_VERSION_MAX 101
@@ -319,7 +319,8 @@ enum drbd_state_rv {
319 SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ 319 SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */
320 SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ 320 SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */
321 SS_O_VOL_PEER_PRI = -20, 321 SS_O_VOL_PEER_PRI = -20,
322 SS_AFTER_LAST_ERROR = -21, /* Keep this at bottom */ 322 SS_OUTDATE_WO_CONN = -21,
323 SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */
323}; 324};
324 325
325/* from drbd_strings.c */ 326/* from drbd_strings.c */
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 1fa19c5f5e64..1fedf2b17cc8 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -126,13 +126,12 @@
126#define DRBD_RESYNC_RATE_DEF 250 126#define DRBD_RESYNC_RATE_DEF 250
127#define DRBD_RESYNC_RATE_SCALE 'k' /* kilobytes */ 127#define DRBD_RESYNC_RATE_SCALE 'k' /* kilobytes */
128 128
129 /* less than 7 would hit performance unnecessarily. 129 /* less than 7 would hit performance unnecessarily. */
130 * 919 slots context information per transaction,
131 * 32k activity log, 4k transaction size,
132 * one transaction in flight:
133 * 919 * 7 = 6433 */
134#define DRBD_AL_EXTENTS_MIN 7 130#define DRBD_AL_EXTENTS_MIN 7
135#define DRBD_AL_EXTENTS_MAX 6433 131 /* we use u16 as "slot number", (u16)~0 is "FREE".
132 * If you use >= 292 kB on-disk ring buffer,
133 * this is the maximum you can use: */
134#define DRBD_AL_EXTENTS_MAX 0xfffe
136#define DRBD_AL_EXTENTS_DEF 1237 135#define DRBD_AL_EXTENTS_DEF 1237
137#define DRBD_AL_EXTENTS_SCALE '1' 136#define DRBD_AL_EXTENTS_SCALE '1'
138 137
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 3d7df3d32c66..2bc0ad78d058 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -670,6 +670,12 @@ static inline int efi_enabled(int facility)
670 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ 670 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
671 EFI_VARIABLE_APPEND_WRITE) 671 EFI_VARIABLE_APPEND_WRITE)
672/* 672/*
673 * Length of a GUID string (strlen("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"))
674 * not including trailing NUL
675 */
676#define EFI_VARIABLE_GUID_LEN 36
677
678/*
673 * The type of search to perform when calling boottime->locate_handle 679 * The type of search to perform when calling boottime->locate_handle
674 */ 680 */
675#define EFI_LOCATE_ALL_HANDLES 0 681#define EFI_LOCATE_ALL_HANDLES 0
@@ -726,7 +732,6 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
726 *addr &= PAGE_MASK; 732 *addr &= PAGE_MASK;
727} 733}
728 734
729#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)
730/* 735/*
731 * EFI Variable support. 736 * EFI Variable support.
732 * 737 *
@@ -752,19 +757,88 @@ struct efivars {
752 * which is protected by the BKL, so that path is safe. 757 * which is protected by the BKL, so that path is safe.
753 */ 758 */
754 spinlock_t lock; 759 spinlock_t lock;
755 struct list_head list;
756 struct kset *kset; 760 struct kset *kset;
757 struct kobject *kobject; 761 struct kobject *kobject;
758 struct bin_attribute *new_var, *del_var;
759 const struct efivar_operations *ops; 762 const struct efivar_operations *ops;
760 struct efivar_entry *walk_entry;
761 struct pstore_info efi_pstore_info;
762}; 763};
763 764
764int register_efivars(struct efivars *efivars, 765/*
766 * The maximum size of VariableName + Data = 1024
767 * Therefore, it's reasonable to save that much
768 * space in each part of the structure,
769 * and we use a page for reading/writing.
770 */
771
772struct efi_variable {
773 efi_char16_t VariableName[1024/sizeof(efi_char16_t)];
774 efi_guid_t VendorGuid;
775 unsigned long DataSize;
776 __u8 Data[1024];
777 efi_status_t Status;
778 __u32 Attributes;
779} __attribute__((packed));
780
781struct efivar_entry {
782 struct efi_variable var;
783 struct list_head list;
784 struct kobject kobj;
785};
786
787extern struct list_head efivar_sysfs_list;
788
789static inline void
790efivar_unregister(struct efivar_entry *var)
791{
792 kobject_put(&var->kobj);
793}
794
795int efivars_register(struct efivars *efivars,
765 const struct efivar_operations *ops, 796 const struct efivar_operations *ops,
766 struct kobject *parent_kobj); 797 struct kobject *kobject);
767void unregister_efivars(struct efivars *efivars); 798int efivars_unregister(struct efivars *efivars);
799struct kobject *efivars_kobject(void);
800
801int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
802 void *data, bool atomic, bool duplicates,
803 struct list_head *head);
804
805void efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
806void efivar_entry_remove(struct efivar_entry *entry);
807
808int __efivar_entry_delete(struct efivar_entry *entry);
809int efivar_entry_delete(struct efivar_entry *entry);
810
811int efivar_entry_size(struct efivar_entry *entry, unsigned long *size);
812int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
813 unsigned long *size, void *data);
814int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
815 unsigned long *size, void *data);
816int efivar_entry_set(struct efivar_entry *entry, u32 attributes,
817 unsigned long size, void *data, struct list_head *head);
818int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
819 unsigned long *size, void *data, bool *set);
820int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes,
821 bool block, unsigned long size, void *data);
822
823void efivar_entry_iter_begin(void);
824void efivar_entry_iter_end(void);
825
826int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
827 struct list_head *head, void *data,
828 struct efivar_entry **prev);
829int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
830 struct list_head *head, void *data);
831
832struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
833 struct list_head *head, bool remove);
834
835bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len);
836
837extern struct work_struct efivar_work;
838void efivar_run_worker(void);
839
840#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)
841int efivars_sysfs_init(void);
768 842
769#endif /* CONFIG_EFI_VARS */ 843#endif /* CONFIG_EFI_VARS */
770 844
diff --git a/include/linux/errno.h b/include/linux/errno.h
index f6bf082d4d4f..89627b9187f9 100644
--- a/include/linux/errno.h
+++ b/include/linux/errno.h
@@ -28,6 +28,5 @@
28#define EBADTYPE 527 /* Type not supported by server */ 28#define EBADTYPE 527 /* Type not supported by server */
29#define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ 29#define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */
30#define EIOCBQUEUED 529 /* iocb queued, will get completion event */ 30#define EIOCBQUEUED 529 /* iocb queued, will get completion event */
31#define EIOCBRETRY 530 /* iocb queued, will trigger a retry */
32 31
33#endif 32#endif
diff --git a/include/linux/evm.h b/include/linux/evm.h
index 9fc13a760928..1fcb88ca88de 100644
--- a/include/linux/evm.h
+++ b/include/linux/evm.h
@@ -96,5 +96,5 @@ static inline int evm_inode_init_security(struct inode *inode,
96 return 0; 96 return 0;
97} 97}
98 98
99#endif /* CONFIG_EVM_H */ 99#endif /* CONFIG_EVM */
100#endif /* LINUX_EVM_H */ 100#endif /* LINUX_EVM_H */
diff --git a/include/linux/export.h b/include/linux/export.h
index 696c0f48afc7..412cd509effe 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -5,17 +5,24 @@
5 * to reduce the amount of pointless cruft we feed to gcc when only 5 * to reduce the amount of pointless cruft we feed to gcc when only
6 * exporting a simple symbol or two. 6 * exporting a simple symbol or two.
7 * 7 *
8 * If you feel the need to add #include <linux/foo.h> to this file 8 * Try not to add #includes here. It slows compilation and makes kernel
9 * then you are doing something wrong and should go away silently. 9 * hackers place grumpy comments in header files.
10 */ 10 */
11 11
12/* Some toolchains use a `_' prefix for all user symbols. */ 12/* Some toolchains use a `_' prefix for all user symbols. */
13#ifdef CONFIG_SYMBOL_PREFIX 13#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
14#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX 14#define __VMLINUX_SYMBOL(x) _##x
15#define __VMLINUX_SYMBOL_STR(x) "_" #x
15#else 16#else
16#define MODULE_SYMBOL_PREFIX "" 17#define __VMLINUX_SYMBOL(x) x
18#define __VMLINUX_SYMBOL_STR(x) #x
17#endif 19#endif
18 20
21/* Indirect, so macros are expanded before pasting. */
22#define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x)
23#define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
24
25#ifndef __ASSEMBLY__
19struct kernel_symbol 26struct kernel_symbol
20{ 27{
21 unsigned long value; 28 unsigned long value;
@@ -51,7 +58,7 @@ extern struct module __this_module;
51 __CRC_SYMBOL(sym, sec) \ 58 __CRC_SYMBOL(sym, sec) \
52 static const char __kstrtab_##sym[] \ 59 static const char __kstrtab_##sym[] \
53 __attribute__((section("__ksymtab_strings"), aligned(1))) \ 60 __attribute__((section("__ksymtab_strings"), aligned(1))) \
54 = MODULE_SYMBOL_PREFIX #sym; \ 61 = VMLINUX_SYMBOL_STR(sym); \
55 static const struct kernel_symbol __ksymtab_##sym \ 62 static const struct kernel_symbol __ksymtab_##sym \
56 __used \ 63 __used \
57 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ 64 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
@@ -85,5 +92,6 @@ extern struct module __this_module;
85#define EXPORT_UNUSED_SYMBOL_GPL(sym) 92#define EXPORT_UNUSED_SYMBOL_GPL(sym)
86 93
87#endif /* CONFIG_MODULES */ 94#endif /* CONFIG_MODULES */
95#endif /* !__ASSEMBLY__ */
88 96
89#endif /* _LINUX_EXPORT_H */ 97#endif /* _LINUX_EXPORT_H */
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 5b9b5b317180..41b223a59a63 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -85,6 +85,17 @@ enum fid_type {
85 FILEID_NILFS_WITH_PARENT = 0x62, 85 FILEID_NILFS_WITH_PARENT = 0x62,
86 86
87 /* 87 /*
88 * 32 bit generation number, 40 bit i_pos.
89 */
90 FILEID_FAT_WITHOUT_PARENT = 0x71,
91
92 /*
93 * 32 bit generation number, 40 bit i_pos,
94 * 32 bit parent generation number, 40 bit parent i_pos
95 */
96 FILEID_FAT_WITH_PARENT = 0x72,
97
98 /*
88 * Filesystems must not use 0xff file ID. 99 * Filesystems must not use 0xff file ID.
89 */ 100 */
90 FILEID_INVALID = 0xff, 101 FILEID_INVALID = 0xff,
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index f9a12f6243a5..df6fab82f87e 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -139,7 +139,7 @@ struct f2fs_extent {
139 __le32 len; /* lengh of the extent */ 139 __le32 len; /* lengh of the extent */
140} __packed; 140} __packed;
141 141
142#define F2FS_MAX_NAME_LEN 256 142#define F2FS_NAME_LEN 255
143#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ 143#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
144#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 144#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
145#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 145#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
@@ -165,7 +165,8 @@ struct f2fs_inode {
165 __le32 i_flags; /* file attributes */ 165 __le32 i_flags; /* file attributes */
166 __le32 i_pino; /* parent inode number */ 166 __le32 i_pino; /* parent inode number */
167 __le32 i_namelen; /* file name length */ 167 __le32 i_namelen; /* file name length */
168 __u8 i_name[F2FS_MAX_NAME_LEN]; /* file name for SPOR */ 168 __u8 i_name[F2FS_NAME_LEN]; /* file name for SPOR */
169 __u8 i_reserved2; /* for backward compatibility */
169 170
170 struct f2fs_extent i_ext; /* caching a largest extent */ 171 struct f2fs_extent i_ext; /* caching a largest extent */
171 172
@@ -362,10 +363,10 @@ struct f2fs_summary_block {
362typedef __le32 f2fs_hash_t; 363typedef __le32 f2fs_hash_t;
363 364
364/* One directory entry slot covers 8bytes-long file name */ 365/* One directory entry slot covers 8bytes-long file name */
365#define F2FS_NAME_LEN 8 366#define F2FS_SLOT_LEN 8
366#define F2FS_NAME_LEN_BITS 3 367#define F2FS_SLOT_LEN_BITS 3
367 368
368#define GET_DENTRY_SLOTS(x) ((x + F2FS_NAME_LEN - 1) >> F2FS_NAME_LEN_BITS) 369#define GET_DENTRY_SLOTS(x) ((x + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS)
369 370
370/* the number of dentry in a block */ 371/* the number of dentry in a block */
371#define NR_DENTRY_IN_BLOCK 214 372#define NR_DENTRY_IN_BLOCK 214
@@ -377,10 +378,10 @@ typedef __le32 f2fs_hash_t;
377#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \ 378#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
378 BITS_PER_BYTE) 379 BITS_PER_BYTE)
379#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \ 380#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \
380 F2FS_NAME_LEN) * \ 381 F2FS_SLOT_LEN) * \
381 NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP)) 382 NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
382 383
383/* One directory entry slot representing F2FS_NAME_LEN-sized file name */ 384/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
384struct f2fs_dir_entry { 385struct f2fs_dir_entry {
385 __le32 hash_code; /* hash code of file name */ 386 __le32 hash_code; /* hash code of file name */
386 __le32 ino; /* inode number */ 387 __le32 ino; /* inode number */
@@ -394,7 +395,7 @@ struct f2fs_dentry_block {
394 __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP]; 395 __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP];
395 __u8 reserved[SIZE_OF_RESERVED]; 396 __u8 reserved[SIZE_OF_RESERVED];
396 struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK]; 397 struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK];
397 __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_NAME_LEN]; 398 __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN];
398} __packed; 399} __packed;
399 400
400/* file types used in inode_info->flags */ 401/* file types used in inode_info->flags */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58b98606ac26..d49c60f5aa4c 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -501,6 +501,8 @@ struct fb_info {
501 resource_size_t size; 501 resource_size_t size;
502 } ranges[0]; 502 } ranges[0];
503 } *apertures; 503 } *apertures;
504
505 bool skip_vt_switch; /* no VT switch on suspend/resume required */
504}; 506};
505 507
506static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { 508static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index fb7dacae0522..085197bd8812 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -27,7 +27,6 @@ struct fdtable {
27 unsigned long *close_on_exec; 27 unsigned long *close_on_exec;
28 unsigned long *open_fds; 28 unsigned long *open_fds;
29 struct rcu_head rcu; 29 struct rcu_head rcu;
30 struct fdtable *next;
31}; 30};
32 31
33static inline bool close_on_exec(int fd, const struct fdtable *fdt) 32static inline bool close_on_exec(int fd, const struct fdtable *fdt)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index c45eabc135e1..c050dcc322a4 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -48,8 +48,22 @@ extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
48extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); 48extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len);
49 49
50#ifdef CONFIG_BPF_JIT 50#ifdef CONFIG_BPF_JIT
51#include <stdarg.h>
52#include <linux/linkage.h>
53#include <linux/printk.h>
54
51extern void bpf_jit_compile(struct sk_filter *fp); 55extern void bpf_jit_compile(struct sk_filter *fp);
52extern void bpf_jit_free(struct sk_filter *fp); 56extern void bpf_jit_free(struct sk_filter *fp);
57
58static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
59 u32 pass, void *image)
60{
61 pr_err("flen=%u proglen=%u pass=%u image=%p\n",
62 flen, proglen, pass, image);
63 if (image)
64 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS,
65 16, 1, image, proglen, false);
66}
53#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 67#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
54#else 68#else
55static inline void bpf_jit_compile(struct sk_filter *fp) 69static inline void bpf_jit_compile(struct sk_filter *fp)
@@ -126,6 +140,7 @@ enum {
126 BPF_S_ANC_SECCOMP_LD_W, 140 BPF_S_ANC_SECCOMP_LD_W,
127 BPF_S_ANC_VLAN_TAG, 141 BPF_S_ANC_VLAN_TAG,
128 BPF_S_ANC_VLAN_TAG_PRESENT, 142 BPF_S_ANC_VLAN_TAG_PRESENT,
143 BPF_S_ANC_PAY_OFFSET,
129}; 144};
130 145
131#endif /* __LINUX_FILTER_H__ */ 146#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h
index 30442547b9e6..8293262401de 100644
--- a/include/linux/frontswap.h
+++ b/include/linux/frontswap.h
@@ -14,7 +14,7 @@ struct frontswap_ops {
14}; 14};
15 15
16extern bool frontswap_enabled; 16extern bool frontswap_enabled;
17extern struct frontswap_ops 17extern struct frontswap_ops *
18 frontswap_register_ops(struct frontswap_ops *ops); 18 frontswap_register_ops(struct frontswap_ops *ops);
19extern void frontswap_shrink(unsigned long); 19extern void frontswap_shrink(unsigned long);
20extern unsigned long frontswap_curr_pages(void); 20extern unsigned long frontswap_curr_pages(void);
@@ -22,33 +22,19 @@ extern void frontswap_writethrough(bool);
22#define FRONTSWAP_HAS_EXCLUSIVE_GETS 22#define FRONTSWAP_HAS_EXCLUSIVE_GETS
23extern void frontswap_tmem_exclusive_gets(bool); 23extern void frontswap_tmem_exclusive_gets(bool);
24 24
25extern void __frontswap_init(unsigned type); 25extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
26extern void __frontswap_init(unsigned type, unsigned long *map);
26extern int __frontswap_store(struct page *page); 27extern int __frontswap_store(struct page *page);
27extern int __frontswap_load(struct page *page); 28extern int __frontswap_load(struct page *page);
28extern void __frontswap_invalidate_page(unsigned, pgoff_t); 29extern void __frontswap_invalidate_page(unsigned, pgoff_t);
29extern void __frontswap_invalidate_area(unsigned); 30extern void __frontswap_invalidate_area(unsigned);
30 31
31#ifdef CONFIG_FRONTSWAP 32#ifdef CONFIG_FRONTSWAP
33#define frontswap_enabled (1)
32 34
33static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) 35static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)
34{ 36{
35 bool ret = false; 37 return __frontswap_test(sis, offset);
36
37 if (frontswap_enabled && sis->frontswap_map)
38 ret = test_bit(offset, sis->frontswap_map);
39 return ret;
40}
41
42static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset)
43{
44 if (frontswap_enabled && sis->frontswap_map)
45 set_bit(offset, sis->frontswap_map);
46}
47
48static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset)
49{
50 if (frontswap_enabled && sis->frontswap_map)
51 clear_bit(offset, sis->frontswap_map);
52} 38}
53 39
54static inline void frontswap_map_set(struct swap_info_struct *p, 40static inline void frontswap_map_set(struct swap_info_struct *p,
@@ -71,14 +57,6 @@ static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)
71 return false; 57 return false;
72} 58}
73 59
74static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset)
75{
76}
77
78static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset)
79{
80}
81
82static inline void frontswap_map_set(struct swap_info_struct *p, 60static inline void frontswap_map_set(struct swap_info_struct *p,
83 unsigned long *map) 61 unsigned long *map)
84{ 62{
@@ -120,10 +98,10 @@ static inline void frontswap_invalidate_area(unsigned type)
120 __frontswap_invalidate_area(type); 98 __frontswap_invalidate_area(type);
121} 99}
122 100
123static inline void frontswap_init(unsigned type) 101static inline void frontswap_init(unsigned type, unsigned long *map)
124{ 102{
125 if (frontswap_enabled) 103 if (frontswap_enabled)
126 __frontswap_init(type); 104 __frontswap_init(type, map);
127} 105}
128 106
129#endif /* _LINUX_FRONTSWAP_H */ 107#endif /* _LINUX_FRONTSWAP_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c28271ab9d4..43db02e9c9fa 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -675,9 +675,11 @@ static inline loff_t i_size_read(const struct inode *inode)
675static inline void i_size_write(struct inode *inode, loff_t i_size) 675static inline void i_size_write(struct inode *inode, loff_t i_size)
676{ 676{
677#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 677#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
678 preempt_disable();
678 write_seqcount_begin(&inode->i_size_seqcount); 679 write_seqcount_begin(&inode->i_size_seqcount);
679 inode->i_size = i_size; 680 inode->i_size = i_size;
680 write_seqcount_end(&inode->i_size_seqcount); 681 write_seqcount_end(&inode->i_size_seqcount);
682 preempt_enable();
681#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) 683#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
682 preempt_disable(); 684 preempt_disable();
683 inode->i_size = i_size; 685 inode->i_size = i_size;
@@ -2080,7 +2082,6 @@ extern int sync_filesystem(struct super_block *);
2080extern const struct file_operations def_blk_fops; 2082extern const struct file_operations def_blk_fops;
2081extern const struct file_operations def_chr_fops; 2083extern const struct file_operations def_chr_fops;
2082extern const struct file_operations bad_sock_fops; 2084extern const struct file_operations bad_sock_fops;
2083extern const struct file_operations def_fifo_fops;
2084#ifdef CONFIG_BLOCK 2085#ifdef CONFIG_BLOCK
2085extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 2086extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
2086extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); 2087extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
@@ -2090,7 +2091,7 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
2090 void *holder); 2091 void *holder);
2091extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, 2092extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode,
2092 void *holder); 2093 void *holder);
2093extern int blkdev_put(struct block_device *bdev, fmode_t mode); 2094extern void blkdev_put(struct block_device *bdev, fmode_t mode);
2094#ifdef CONFIG_SYSFS 2095#ifdef CONFIG_SYSFS
2095extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); 2096extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
2096extern void bd_unlink_disk_holder(struct block_device *bdev, 2097extern void bd_unlink_disk_holder(struct block_device *bdev,
@@ -2152,10 +2153,6 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
2152extern void make_bad_inode(struct inode *); 2153extern void make_bad_inode(struct inode *);
2153extern int is_bad_inode(struct inode *); 2154extern int is_bad_inode(struct inode *);
2154 2155
2155extern const struct file_operations read_pipefifo_fops;
2156extern const struct file_operations write_pipefifo_fops;
2157extern const struct file_operations rdwr_pipefifo_fops;
2158
2159#ifdef CONFIG_BLOCK 2156#ifdef CONFIG_BLOCK
2160/* 2157/*
2161 * return READ, READA, or WRITE 2158 * return READ, READA, or WRITE
@@ -2223,6 +2220,27 @@ static inline struct inode *file_inode(struct file *f)
2223 return f->f_inode; 2220 return f->f_inode;
2224} 2221}
2225 2222
2223static inline void file_start_write(struct file *file)
2224{
2225 if (!S_ISREG(file_inode(file)->i_mode))
2226 return;
2227 __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true);
2228}
2229
2230static inline bool file_start_write_trylock(struct file *file)
2231{
2232 if (!S_ISREG(file_inode(file)->i_mode))
2233 return true;
2234 return __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, false);
2235}
2236
2237static inline void file_end_write(struct file *file)
2238{
2239 if (!S_ISREG(file_inode(file)->i_mode))
2240 return;
2241 __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE);
2242}
2243
2226/* 2244/*
2227 * get_write_access() gets write permission for a file. 2245 * get_write_access() gets write permission for a file.
2228 * put_write_access() releases this write permission. 2246 * put_write_access() releases this write permission.
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index d5b0910d4961..4b2ee8d12f5e 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -157,7 +157,6 @@ struct fsnotify_group {
157 struct inotify_group_private_data { 157 struct inotify_group_private_data {
158 spinlock_t idr_lock; 158 spinlock_t idr_lock;
159 struct idr idr; 159 struct idr idr;
160 u32 last_wd;
161 struct user_struct *user; 160 struct user_struct *user;
162 } inotify_data; 161 } inotify_data;
163#endif 162#endif
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 52da2a250795..99d0fbcbaf79 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -90,6 +90,8 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
90 * not set this, then the ftrace infrastructure will add recursion 90 * not set this, then the ftrace infrastructure will add recursion
91 * protection for the caller. 91 * protection for the caller.
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
94 * register_ftrace_function() is called, it will initialized the ops)
93 */ 95 */
94enum { 96enum {
95 FTRACE_OPS_FL_ENABLED = 1 << 0, 97 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -100,6 +102,7 @@ enum {
100 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5, 102 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5,
101 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, 103 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6,
102 FTRACE_OPS_FL_STUB = 1 << 7, 104 FTRACE_OPS_FL_STUB = 1 << 7,
105 FTRACE_OPS_FL_INITIALIZED = 1 << 8,
103}; 106};
104 107
105struct ftrace_ops { 108struct ftrace_ops {
@@ -110,6 +113,7 @@ struct ftrace_ops {
110#ifdef CONFIG_DYNAMIC_FTRACE 113#ifdef CONFIG_DYNAMIC_FTRACE
111 struct ftrace_hash *notrace_hash; 114 struct ftrace_hash *notrace_hash;
112 struct ftrace_hash *filter_hash; 115 struct ftrace_hash *filter_hash;
116 struct mutex regex_lock;
113#endif 117#endif
114}; 118};
115 119
@@ -261,8 +265,10 @@ struct ftrace_probe_ops {
261 void (*func)(unsigned long ip, 265 void (*func)(unsigned long ip,
262 unsigned long parent_ip, 266 unsigned long parent_ip,
263 void **data); 267 void **data);
264 int (*callback)(unsigned long ip, void **data); 268 int (*init)(struct ftrace_probe_ops *ops,
265 void (*free)(void **data); 269 unsigned long ip, void **data);
270 void (*free)(struct ftrace_probe_ops *ops,
271 unsigned long ip, void **data);
266 int (*print)(struct seq_file *m, 272 int (*print)(struct seq_file *m,
267 unsigned long ip, 273 unsigned long ip,
268 struct ftrace_probe_ops *ops, 274 struct ftrace_probe_ops *ops,
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 13a54d0bdfa8..4372658c73ae 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -8,6 +8,7 @@
8#include <linux/perf_event.h> 8#include <linux/perf_event.h>
9 9
10struct trace_array; 10struct trace_array;
11struct trace_buffer;
11struct tracer; 12struct tracer;
12struct dentry; 13struct dentry;
13 14
@@ -38,6 +39,12 @@ const char *ftrace_print_symbols_seq_u64(struct trace_seq *p,
38const char *ftrace_print_hex_seq(struct trace_seq *p, 39const char *ftrace_print_hex_seq(struct trace_seq *p,
39 const unsigned char *buf, int len); 40 const unsigned char *buf, int len);
40 41
42struct trace_iterator;
43struct trace_event;
44
45int ftrace_raw_output_prep(struct trace_iterator *iter,
46 struct trace_event *event);
47
41/* 48/*
42 * The trace entry - the most basic unit of tracing. This is what 49 * The trace entry - the most basic unit of tracing. This is what
43 * is printed in the end as a single line in the trace output, such as: 50 * is printed in the end as a single line in the trace output, such as:
@@ -61,6 +68,7 @@ struct trace_entry {
61struct trace_iterator { 68struct trace_iterator {
62 struct trace_array *tr; 69 struct trace_array *tr;
63 struct tracer *trace; 70 struct tracer *trace;
71 struct trace_buffer *trace_buffer;
64 void *private; 72 void *private;
65 int cpu_file; 73 int cpu_file;
66 struct mutex mutex; 74 struct mutex mutex;
@@ -95,8 +103,6 @@ enum trace_iter_flags {
95}; 103};
96 104
97 105
98struct trace_event;
99
100typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, 106typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
101 int flags, struct trace_event *event); 107 int flags, struct trace_event *event);
102 108
@@ -128,6 +134,13 @@ enum print_line_t {
128void tracing_generic_entry_update(struct trace_entry *entry, 134void tracing_generic_entry_update(struct trace_entry *entry,
129 unsigned long flags, 135 unsigned long flags,
130 int pc); 136 int pc);
137struct ftrace_event_file;
138
139struct ring_buffer_event *
140trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer,
141 struct ftrace_event_file *ftrace_file,
142 int type, unsigned long len,
143 unsigned long flags, int pc);
131struct ring_buffer_event * 144struct ring_buffer_event *
132trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, 145trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
133 int type, unsigned long len, 146 int type, unsigned long len,
@@ -182,53 +195,49 @@ extern int ftrace_event_reg(struct ftrace_event_call *event,
182 enum trace_reg type, void *data); 195 enum trace_reg type, void *data);
183 196
184enum { 197enum {
185 TRACE_EVENT_FL_ENABLED_BIT,
186 TRACE_EVENT_FL_FILTERED_BIT, 198 TRACE_EVENT_FL_FILTERED_BIT,
187 TRACE_EVENT_FL_RECORDED_CMD_BIT,
188 TRACE_EVENT_FL_CAP_ANY_BIT, 199 TRACE_EVENT_FL_CAP_ANY_BIT,
189 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 200 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
190 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, 201 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
202 TRACE_EVENT_FL_WAS_ENABLED_BIT,
191}; 203};
192 204
205/*
206 * Event flags:
207 * FILTERED - The event has a filter attached
208 * CAP_ANY - Any user can enable for perf
209 * NO_SET_FILTER - Set when filter has error and is to be ignored
210 * IGNORE_ENABLE - For ftrace internal events, do not enable with debugfs file
211 * WAS_ENABLED - Set and stays set when an event was ever enabled
212 * (used for module unloading, if a module event is enabled,
213 * it is best to clear the buffers that used it).
214 */
193enum { 215enum {
194 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
195 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 216 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
196 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
197 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 217 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
198 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 218 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
199 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), 219 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
220 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
200}; 221};
201 222
202struct ftrace_event_call { 223struct ftrace_event_call {
203 struct list_head list; 224 struct list_head list;
204 struct ftrace_event_class *class; 225 struct ftrace_event_class *class;
205 char *name; 226 char *name;
206 struct dentry *dir;
207 struct trace_event event; 227 struct trace_event event;
208 const char *print_fmt; 228 const char *print_fmt;
209 struct event_filter *filter; 229 struct event_filter *filter;
230 struct list_head *files;
210 void *mod; 231 void *mod;
211 void *data; 232 void *data;
212
213 /* 233 /*
214 * 32 bit flags: 234 * bit 0: filter_active
215 * bit 1: enabled 235 * bit 1: allow trace by non root (cap any)
216 * bit 2: filter_active 236 * bit 2: failed to apply filter
217 * bit 3: enabled cmd record 237 * bit 3: ftrace internal event (do not enable)
218 * bit 4: allow trace by non root (cap any) 238 * bit 4: Event was enabled by module
219 * bit 5: failed to apply filter
220 * bit 6: ftrace internal event (do not enable)
221 *
222 * Changes to flags must hold the event_mutex.
223 *
224 * Note: Reads of flags do not hold the event_mutex since
225 * they occur in critical sections. But the way flags
226 * is currently used, these changes do no affect the code
227 * except that when a change is made, it may have a slight
228 * delay in propagating the changes to other CPUs due to
229 * caching and such.
230 */ 239 */
231 unsigned int flags; 240 int flags; /* static flags of different events */
232 241
233#ifdef CONFIG_PERF_EVENTS 242#ifdef CONFIG_PERF_EVENTS
234 int perf_refcount; 243 int perf_refcount;
@@ -236,6 +245,57 @@ struct ftrace_event_call {
236#endif 245#endif
237}; 246};
238 247
248struct trace_array;
249struct ftrace_subsystem_dir;
250
251enum {
252 FTRACE_EVENT_FL_ENABLED_BIT,
253 FTRACE_EVENT_FL_RECORDED_CMD_BIT,
254 FTRACE_EVENT_FL_SOFT_MODE_BIT,
255 FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
256};
257
258/*
259 * Ftrace event file flags:
260 * ENABLED - The event is enabled
261 * RECORDED_CMD - The comms should be recorded at sched_switch
262 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED
263 * SOFT_DISABLED - When set, do not trace the event (even though its
264 * tracepoint may be enabled)
265 */
266enum {
267 FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
268 FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
269 FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT),
270 FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
271};
272
273struct ftrace_event_file {
274 struct list_head list;
275 struct ftrace_event_call *event_call;
276 struct dentry *dir;
277 struct trace_array *tr;
278 struct ftrace_subsystem_dir *system;
279
280 /*
281 * 32 bit flags:
282 * bit 0: enabled
283 * bit 1: enabled cmd record
284 * bit 2: enable/disable with the soft disable bit
285 * bit 3: soft disabled
286 *
287 * Note: The bits must be set atomically to prevent races
288 * from other writers. Reads of flags do not need to be in
289 * sync as they occur in critical sections. But the way flags
290 * is currently used, these changes do not affect the code
291 * except that when a change is made, it may have a slight
292 * delay in propagating the changes to other CPUs due to
293 * caching and such. Which is mostly OK ;-)
294 */
295 unsigned long flags;
296 atomic_t sm_ref; /* soft-mode reference counter */
297};
298
239#define __TRACE_EVENT_FLAGS(name, value) \ 299#define __TRACE_EVENT_FLAGS(name, value) \
240 static int __init trace_init_flags_##name(void) \ 300 static int __init trace_init_flags_##name(void) \
241 { \ 301 { \
@@ -274,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
274extern int trace_add_event_call(struct ftrace_event_call *call); 334extern int trace_add_event_call(struct ftrace_event_call *call);
275extern void trace_remove_event_call(struct ftrace_event_call *call); 335extern void trace_remove_event_call(struct ftrace_event_call *call);
276 336
277#define is_signed_type(type) (((type)(-1)) < (type)0) 337#define is_signed_type(type) (((type)(-1)) < (type)1)
278 338
279int trace_set_clr_event(const char *system, const char *event, int set); 339int trace_set_clr_event(const char *system, const char *event, int set);
280 340
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index dd7c569aacad..661d374aeb2d 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -29,6 +29,10 @@
29 29
30#ifndef __GENALLOC_H__ 30#ifndef __GENALLOC_H__
31#define __GENALLOC_H__ 31#define __GENALLOC_H__
32
33struct device;
34struct device_node;
35
32/** 36/**
33 * Allocation callback function type definition 37 * Allocation callback function type definition
34 * @map: Pointer to bitmap 38 * @map: Pointer to bitmap
@@ -105,4 +109,18 @@ extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
105extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, 109extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
106 unsigned long start, unsigned int nr, void *data); 110 unsigned long start, unsigned int nr, void *data);
107 111
112extern struct gen_pool *devm_gen_pool_create(struct device *dev,
113 int min_alloc_order, int nid);
114extern struct gen_pool *dev_get_gen_pool(struct device *dev);
115
116#ifdef CONFIG_OF
117extern struct gen_pool *of_get_named_gen_pool(struct device_node *np,
118 const char *propname, int index);
119#else
120static inline struct gen_pool *of_get_named_gen_pool(struct device_node *np,
121 const char *propname, int index)
122{
123 return NULL;
124}
125#endif
108#endif /* __GENALLOC_H__ */ 126#endif /* __GENALLOC_H__ */
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
index d755b28ba635..d90ebbe02ca4 100644
--- a/include/linux/gpio-pxa.h
+++ b/include/linux/gpio-pxa.h
@@ -14,6 +14,7 @@ extern int pxa_last_gpio;
14extern int pxa_irq_to_gpio(int irq); 14extern int pxa_irq_to_gpio(int irq);
15 15
16struct pxa_gpio_platform_data { 16struct pxa_gpio_platform_data {
17 int irq_base;
17 int (*gpio_set_wake)(unsigned int gpio, unsigned int on); 18 int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
18}; 19};
19 20
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index f6c7ae3e223b..552e3f46e4a3 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -39,7 +39,7 @@ struct gpio {
39 const char *label; 39 const char *label;
40}; 40};
41 41
42#ifdef CONFIG_GENERIC_GPIO 42#ifdef CONFIG_GPIOLIB
43 43
44#ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H 44#ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H
45#include <asm/gpio.h> 45#include <asm/gpio.h>
@@ -74,7 +74,7 @@ static inline int irq_to_gpio(unsigned int irq)
74 74
75#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ 75#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
76 76
77#else /* ! CONFIG_GENERIC_GPIO */ 77#else /* ! CONFIG_GPIOLIB */
78 78
79#include <linux/kernel.h> 79#include <linux/kernel.h>
80#include <linux/types.h> 80#include <linux/types.h>
@@ -226,7 +226,7 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
226 WARN_ON(1); 226 WARN_ON(1);
227} 227}
228 228
229#endif /* ! CONFIG_GENERIC_GPIO */ 229#endif /* ! CONFIG_GPIOLIB */
230 230
231struct device; 231struct device;
232 232
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h
index 53744fa1c8b7..8663f216c563 100644
--- a/include/linux/hid-debug.h
+++ b/include/linux/hid-debug.h
@@ -22,11 +22,12 @@
22 * 22 *
23 */ 23 */
24 24
25#define HID_DEBUG_BUFSIZE 512
26
27#ifdef CONFIG_DEBUG_FS 25#ifdef CONFIG_DEBUG_FS
28 26
27#define HID_DEBUG_BUFSIZE 512
28
29void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); 29void hid_dump_input(struct hid_device *, struct hid_usage *, __s32);
30void hid_dump_report(struct hid_device *, int , u8 *, int);
30void hid_dump_device(struct hid_device *, struct seq_file *); 31void hid_dump_device(struct hid_device *, struct seq_file *);
31void hid_dump_field(struct hid_field *, int, struct seq_file *); 32void hid_dump_field(struct hid_field *, int, struct seq_file *);
32char *hid_resolv_usage(unsigned, struct seq_file *); 33char *hid_resolv_usage(unsigned, struct seq_file *);
@@ -50,6 +51,7 @@ struct hid_debug_list {
50#else 51#else
51 52
52#define hid_dump_input(a,b,c) do { } while (0) 53#define hid_dump_input(a,b,c) do { } while (0)
54#define hid_dump_report(a,b,c,d) do { } while (0)
53#define hid_dump_device(a,b) do { } while (0) 55#define hid_dump_device(a,b) do { } while (0)
54#define hid_dump_field(a,b,c) do { } while (0) 56#define hid_dump_field(a,b,c) do { } while (0)
55#define hid_resolv_usage(a,b) do { } while (0) 57#define hid_resolv_usage(a,b) do { } while (0)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index e14b465b1146..0c48991b0402 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -282,6 +282,7 @@ struct hid_item {
282#define HID_QUIRK_BADPAD 0x00000020 282#define HID_QUIRK_BADPAD 0x00000020
283#define HID_QUIRK_MULTI_INPUT 0x00000040 283#define HID_QUIRK_MULTI_INPUT 0x00000040
284#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 284#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
285#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
285#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 286#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
286#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 287#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
287#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 288#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
@@ -456,7 +457,8 @@ struct hid_device { /* device report descriptor */
456 unsigned country; /* HID country */ 457 unsigned country; /* HID country */
457 struct hid_report_enum report_enum[HID_REPORT_TYPES]; 458 struct hid_report_enum report_enum[HID_REPORT_TYPES];
458 459
459 struct semaphore driver_lock; /* protects the current driver */ 460 struct semaphore driver_lock; /* protects the current driver, except during input */
461 struct semaphore driver_input_lock; /* protects the current driver */
460 struct device dev; /* device */ 462 struct device dev; /* device */
461 struct hid_driver *driver; 463 struct hid_driver *driver;
462 struct hid_ll_driver *ll_driver; 464 struct hid_ll_driver *ll_driver;
@@ -477,6 +479,7 @@ struct hid_device { /* device report descriptor */
477 unsigned int status; /* see STAT flags above */ 479 unsigned int status; /* see STAT flags above */
478 unsigned claimed; /* Claimed by hidinput, hiddev? */ 480 unsigned claimed; /* Claimed by hidinput, hiddev? */
479 unsigned quirks; /* Various quirks the device can pull on us */ 481 unsigned quirks; /* Various quirks the device can pull on us */
482 bool io_started; /* Protected by driver_lock. If IO has started */
480 483
481 struct list_head inputs; /* The list of inputs */ 484 struct list_head inputs; /* The list of inputs */
482 void *hiddev; /* The hiddev structure */ 485 void *hiddev; /* The hiddev structure */
@@ -512,6 +515,7 @@ struct hid_device { /* device report descriptor */
512 struct dentry *debug_rdesc; 515 struct dentry *debug_rdesc;
513 struct dentry *debug_events; 516 struct dentry *debug_events;
514 struct list_head debug_list; 517 struct list_head debug_list;
518 spinlock_t debug_list_lock;
515 wait_queue_head_t debug_wait; 519 wait_queue_head_t debug_wait;
516}; 520};
517 521
@@ -599,6 +603,10 @@ struct hid_usage_id {
599 * @resume: invoked on resume if device was not reset (NULL means nop) 603 * @resume: invoked on resume if device was not reset (NULL means nop)
600 * @reset_resume: invoked on resume if device was reset (NULL means nop) 604 * @reset_resume: invoked on resume if device was reset (NULL means nop)
601 * 605 *
606 * probe should return -errno on error, or 0 on success. During probe,
607 * input will not be passed to raw_event unless hid_device_io_start is
608 * called.
609 *
602 * raw_event and event should return 0 on no action performed, 1 when no 610 * raw_event and event should return 0 on no action performed, 1 when no
603 * further processing should be done and negative on error 611 * further processing should be done and negative on error
604 * 612 *
@@ -662,6 +670,9 @@ struct hid_driver {
662 * @hidinput_input_event: event input event (e.g. ff or leds) 670 * @hidinput_input_event: event input event (e.g. ff or leds)
663 * @parse: this method is called only once to parse the device data, 671 * @parse: this method is called only once to parse the device data,
664 * shouldn't allocate anything to not leak memory 672 * shouldn't allocate anything to not leak memory
673 * @request: send report request to device (e.g. feature report)
674 * @wait: wait for buffered io to complete (send/recv reports)
675 * @idle: send idle request to device
665 */ 676 */
666struct hid_ll_driver { 677struct hid_ll_driver {
667 int (*start)(struct hid_device *hdev); 678 int (*start)(struct hid_device *hdev);
@@ -676,6 +687,13 @@ struct hid_ll_driver {
676 unsigned int code, int value); 687 unsigned int code, int value);
677 688
678 int (*parse)(struct hid_device *hdev); 689 int (*parse)(struct hid_device *hdev);
690
691 void (*request)(struct hid_device *hdev,
692 struct hid_report *report, int reqtype);
693
694 int (*wait)(struct hid_device *hdev);
695 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
696
679}; 697};
680 698
681#define PM_HINT_FULLON 1<<5 699#define PM_HINT_FULLON 1<<5
@@ -738,6 +756,44 @@ const struct hid_device_id *hid_match_id(struct hid_device *hdev,
738s32 hid_snto32(__u32 value, unsigned n); 756s32 hid_snto32(__u32 value, unsigned n);
739 757
740/** 758/**
759 * hid_device_io_start - enable HID input during probe, remove
760 *
761 * @hid - the device
762 *
763 * This should only be called during probe or remove and only be
764 * called by the thread calling probe or remove. It will allow
765 * incoming packets to be delivered to the driver.
766 */
767static inline void hid_device_io_start(struct hid_device *hid) {
768 if (hid->io_started) {
769 dev_warn(&hid->dev, "io already started");
770 return;
771 }
772 hid->io_started = true;
773 up(&hid->driver_input_lock);
774}
775
776/**
777 * hid_device_io_stop - disable HID input during probe, remove
778 *
779 * @hid - the device
780 *
781 * Should only be called after hid_device_io_start. It will prevent
782 * incoming packets from going to the driver for the duration of
783 * probe, remove. If called during probe, packets will still go to the
784 * driver after probe is complete. This function should only be called
785 * by the thread calling probe or remove.
786 */
787static inline void hid_device_io_stop(struct hid_device *hid) {
788 if (!hid->io_started) {
789 dev_warn(&hid->dev, "io already stopped");
790 return;
791 }
792 hid->io_started = false;
793 down(&hid->driver_input_lock);
794}
795
796/**
741 * hid_map_usage - map usage input bits 797 * hid_map_usage - map usage input bits
742 * 798 *
743 * @hidinput: hidinput which we are interested in 799 * @hidinput: hidinput which we are interested in
@@ -883,6 +939,49 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
883 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; 939 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;
884} 940}
885 941
942
943/**
944 * hid_hw_request - send report request to device
945 *
946 * @hdev: hid device
947 * @report: report to send
948 * @reqtype: hid request type
949 */
950static inline void hid_hw_request(struct hid_device *hdev,
951 struct hid_report *report, int reqtype)
952{
953 if (hdev->ll_driver->request)
954 hdev->ll_driver->request(hdev, report, reqtype);
955}
956
957/**
958 * hid_hw_idle - send idle request to device
959 *
960 * @hdev: hid device
961 * @report: report to control
962 * @idle: idle state
963 * @reqtype: hid request type
964 */
965static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
966 int reqtype)
967{
968 if (hdev->ll_driver->idle)
969 return hdev->ll_driver->idle(hdev, report, idle, reqtype);
970
971 return 0;
972}
973
974/**
975 * hid_hw_wait - wait for buffered io to complete
976 *
977 * @hdev: hid device
978 */
979static inline void hid_hw_wait(struct hid_device *hdev)
980{
981 if (hdev->ll_driver->wait)
982 hdev->ll_driver->wait(hdev);
983}
984
886int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 985int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
887 int interrupt); 986 int interrupt);
888 987
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index cc07d2777bbe..d19a5c2d2270 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -157,6 +157,7 @@ enum hrtimer_base_type {
157 HRTIMER_BASE_MONOTONIC, 157 HRTIMER_BASE_MONOTONIC,
158 HRTIMER_BASE_REALTIME, 158 HRTIMER_BASE_REALTIME,
159 HRTIMER_BASE_BOOTTIME, 159 HRTIMER_BASE_BOOTTIME,
160 HRTIMER_BASE_TAI,
160 HRTIMER_MAX_CLOCK_BASES, 161 HRTIMER_MAX_CLOCK_BASES,
161}; 162};
162 163
@@ -327,7 +328,9 @@ extern ktime_t ktime_get(void);
327extern ktime_t ktime_get_real(void); 328extern ktime_t ktime_get_real(void);
328extern ktime_t ktime_get_boottime(void); 329extern ktime_t ktime_get_boottime(void);
329extern ktime_t ktime_get_monotonic_offset(void); 330extern ktime_t ktime_get_monotonic_offset(void);
330extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot); 331extern ktime_t ktime_get_clocktai(void);
332extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot,
333 ktime_t *offs_tai);
331 334
332DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 335DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
333 336
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index ee1c244a62a1..528454c2caa9 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -99,7 +99,11 @@ extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
99extern int handle_pte_fault(struct mm_struct *mm, 99extern int handle_pte_fault(struct mm_struct *mm,
100 struct vm_area_struct *vma, unsigned long address, 100 struct vm_area_struct *vma, unsigned long address,
101 pte_t *pte, pmd_t *pmd, unsigned int flags); 101 pte_t *pte, pmd_t *pmd, unsigned int flags);
102extern int split_huge_page(struct page *page); 102extern int split_huge_page_to_list(struct page *page, struct list_head *list);
103static inline int split_huge_page(struct page *page)
104{
105 return split_huge_page_to_list(page, NULL);
106}
103extern void __split_huge_page_pmd(struct vm_area_struct *vma, 107extern void __split_huge_page_pmd(struct vm_area_struct *vma,
104 unsigned long address, pmd_t *pmd); 108 unsigned long address, pmd_t *pmd);
105#define split_huge_page_pmd(__vma, __address, __pmd) \ 109#define split_huge_page_pmd(__vma, __address, __pmd) \
@@ -186,6 +190,11 @@ extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vm
186#define transparent_hugepage_enabled(__vma) 0 190#define transparent_hugepage_enabled(__vma) 0
187 191
188#define transparent_hugepage_flags 0UL 192#define transparent_hugepage_flags 0UL
193static inline int
194split_huge_page_to_list(struct page *page, struct list_head *list)
195{
196 return 0;
197}
189static inline int split_huge_page(struct page *page) 198static inline int split_huge_page(struct page *page)
190{ 199{
191 return 0; 200 return 0;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 16e4e9a643fb..6b4890fa57e7 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
58int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 58int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
59void hugetlb_report_meminfo(struct seq_file *); 59void hugetlb_report_meminfo(struct seq_file *);
60int hugetlb_report_node_meminfo(int, char *); 60int hugetlb_report_node_meminfo(int, char *);
61void hugetlb_show_meminfo(void);
61unsigned long hugetlb_total_pages(void); 62unsigned long hugetlb_total_pages(void);
62int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 63int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
63 unsigned long address, unsigned int flags); 64 unsigned long address, unsigned int flags);
@@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
114{ 115{
115} 116}
116#define hugetlb_report_node_meminfo(n, buf) 0 117#define hugetlb_report_node_meminfo(n, buf) 0
118static inline void hugetlb_show_meminfo(void)
119{
120}
117#define follow_huge_pmd(mm, addr, pmd, write) NULL 121#define follow_huge_pmd(mm, addr, pmd, write) NULL
118#define follow_huge_pud(mm, addr, pud, write) NULL 122#define follow_huge_pud(mm, addr, pud, write) NULL
119#define prepare_hugepage_range(file, addr, len) (-EINVAL) 123#define prepare_hugepage_range(file, addr, len) (-EINVAL)
@@ -185,8 +189,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
185 189
186extern const struct file_operations hugetlbfs_file_operations; 190extern const struct file_operations hugetlbfs_file_operations;
187extern const struct vm_operations_struct hugetlb_vm_ops; 191extern const struct vm_operations_struct hugetlb_vm_ops;
188struct file *hugetlb_file_setup(const char *name, unsigned long addr, 192struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct,
189 size_t size, vm_flags_t acct,
190 struct user_struct **user, int creat_flags, 193 struct user_struct **user, int creat_flags,
191 int page_size_log); 194 int page_size_log);
192 195
@@ -205,8 +208,8 @@ static inline int is_file_hugepages(struct file *file)
205 208
206#define is_file_hugepages(file) 0 209#define is_file_hugepages(file) 0
207static inline struct file * 210static inline struct file *
208hugetlb_file_setup(const char *name, unsigned long addr, size_t size, 211hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
209 vm_flags_t acctflag, struct user_struct **user, int creat_flags, 212 struct user_struct **user, int creat_flags,
210 int page_size_log) 213 int page_size_log)
211{ 214{
212 return ERR_PTR(-ENOSYS); 215 return ERR_PTR(-ENOSYS);
@@ -284,6 +287,13 @@ static inline struct hstate *hstate_file(struct file *f)
284 return hstate_inode(file_inode(f)); 287 return hstate_inode(file_inode(f));
285} 288}
286 289
290static inline struct hstate *hstate_sizelog(int page_size_log)
291{
292 if (!page_size_log)
293 return &default_hstate;
294 return size_to_hstate(1 << page_size_log);
295}
296
287static inline struct hstate *hstate_vma(struct vm_area_struct *vma) 297static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
288{ 298{
289 return hstate_file(vma->vm_file); 299 return hstate_file(vma->vm_file);
@@ -348,11 +358,12 @@ static inline int hstate_index(struct hstate *h)
348 return h - hstates; 358 return h - hstates;
349} 359}
350 360
351#else 361#else /* CONFIG_HUGETLB_PAGE */
352struct hstate {}; 362struct hstate {};
353#define alloc_huge_page_node(h, nid) NULL 363#define alloc_huge_page_node(h, nid) NULL
354#define alloc_bootmem_huge_page(h) NULL 364#define alloc_bootmem_huge_page(h) NULL
355#define hstate_file(f) NULL 365#define hstate_file(f) NULL
366#define hstate_sizelog(s) NULL
356#define hstate_vma(v) NULL 367#define hstate_vma(v) NULL
357#define hstate_inode(i) NULL 368#define hstate_inode(i) NULL
358#define huge_page_size(h) PAGE_SIZE 369#define huge_page_size(h) PAGE_SIZE
@@ -367,6 +378,6 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
367} 378}
368#define hstate_index_to_shift(index) 0 379#define hstate_index_to_shift(index) 0
369#define hstate_index(h) 0 380#define hstate_index(h) 0
370#endif 381#endif /* CONFIG_HUGETLB_PAGE */
371 382
372#endif /* _LINUX_HUGETLB_H */ 383#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index df77ba9a8166..c2559847d7ee 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -27,6 +27,63 @@
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30
31/*
32 * Implementation of host controlled snapshot of the guest.
33 */
34
35#define VSS_OP_REGISTER 128
36
37enum hv_vss_op {
38 VSS_OP_CREATE = 0,
39 VSS_OP_DELETE,
40 VSS_OP_HOT_BACKUP,
41 VSS_OP_GET_DM_INFO,
42 VSS_OP_BU_COMPLETE,
43 /*
44 * Following operations are only supported with IC version >= 5.0
45 */
46 VSS_OP_FREEZE, /* Freeze the file systems in the VM */
47 VSS_OP_THAW, /* Unfreeze the file systems */
48 VSS_OP_AUTO_RECOVER,
49 VSS_OP_COUNT /* Number of operations, must be last */
50};
51
52
53/*
54 * Header for all VSS messages.
55 */
56struct hv_vss_hdr {
57 __u8 operation;
58 __u8 reserved[7];
59} __attribute__((packed));
60
61
62/*
63 * Flag values for the hv_vss_check_feature. Linux supports only
64 * one value.
65 */
66#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005
67
68struct hv_vss_check_feature {
69 __u32 flags;
70} __attribute__((packed));
71
72struct hv_vss_check_dm_info {
73 __u32 flags;
74} __attribute__((packed));
75
76struct hv_vss_msg {
77 union {
78 struct hv_vss_hdr vss_hdr;
79 int error;
80 };
81 union {
82 struct hv_vss_check_feature vss_cf;
83 struct hv_vss_check_dm_info dm_info;
84 };
85} __attribute__((packed));
86
30/* 87/*
31 * An implementation of HyperV key value pair (KVP) functionality for Linux. 88 * An implementation of HyperV key value pair (KVP) functionality for Linux.
32 * 89 *
@@ -1253,6 +1310,25 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1253 } 1310 }
1254 1311
1255/* 1312/*
1313 * VSS (Backup/Restore) GUID
1314 */
1315#define HV_VSS_GUID \
1316 .guid = { \
1317 0x29, 0x2e, 0xfa, 0x35, 0x23, 0xea, 0x36, 0x42, \
1318 0x96, 0xae, 0x3a, 0x6e, 0xba, 0xcb, 0xa4, 0x40 \
1319 }
1320/*
1321 * Synthetic Video GUID
1322 * {DA0A7802-E377-4aac-8E77-0558EB1073F8}
1323 */
1324#define HV_SYNTHVID_GUID \
1325 .guid = { \
1326 0x02, 0x78, 0x0a, 0xda, 0x77, 0xe3, 0xac, 0x4a, \
1327 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \
1328 }
1329
1330
1331/*
1256 * Common header for Hyper-V ICs 1332 * Common header for Hyper-V ICs
1257 */ 1333 */
1258 1334
@@ -1356,6 +1432,10 @@ int hv_kvp_init(struct hv_util_service *);
1356void hv_kvp_deinit(void); 1432void hv_kvp_deinit(void);
1357void hv_kvp_onchannelcallback(void *); 1433void hv_kvp_onchannelcallback(void *);
1358 1434
1435int hv_vss_init(struct hv_util_service *);
1436void hv_vss_deinit(void);
1437void hv_vss_onchannelcallback(void *);
1438
1359/* 1439/*
1360 * Negotiated version with the Host. 1440 * Negotiated version with the Host.
1361 */ 1441 */
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 40cb05a97b46..b5f9a007a3ab 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -42,7 +42,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
42 int (*deselect) (struct i2c_adapter *, 42 int (*deselect) (struct i2c_adapter *,
43 void *mux_dev, u32 chan_id)); 43 void *mux_dev, u32 chan_id));
44 44
45int i2c_del_mux_adapter(struct i2c_adapter *adap); 45void i2c_del_mux_adapter(struct i2c_adapter *adap);
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
48 48
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h
deleted file mode 100644
index 9c85da49857a..000000000000
--- a/include/linux/i2c-tegra.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * drivers/i2c/busses/i2c-tegra.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _LINUX_I2C_TEGRA_H
19#define _LINUX_I2C_TEGRA_H
20
21struct tegra_i2c_platform_data {
22 unsigned long bus_clk_rate;
23};
24
25#endif /* _LINUX_I2C_TEGRA_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index d0c4db7b4872..e988fa935b3c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -125,7 +125,6 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
125 * struct i2c_driver - represent an I2C device driver 125 * struct i2c_driver - represent an I2C device driver
126 * @class: What kind of i2c device we instantiate (for detect) 126 * @class: What kind of i2c device we instantiate (for detect)
127 * @attach_adapter: Callback for bus addition (deprecated) 127 * @attach_adapter: Callback for bus addition (deprecated)
128 * @detach_adapter: Callback for bus removal (deprecated)
129 * @probe: Callback for device binding 128 * @probe: Callback for device binding
130 * @remove: Callback for device unbinding 129 * @remove: Callback for device unbinding
131 * @shutdown: Callback for device shutdown 130 * @shutdown: Callback for device shutdown
@@ -162,12 +161,10 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
162struct i2c_driver { 161struct i2c_driver {
163 unsigned int class; 162 unsigned int class;
164 163
165 /* Notifies the driver that a new bus has appeared or is about to be 164 /* Notifies the driver that a new bus has appeared. You should avoid
166 * removed. You should avoid using this, it will be removed in a 165 * using this, it will be removed in a near future.
167 * near future.
168 */ 166 */
169 int (*attach_adapter)(struct i2c_adapter *) __deprecated; 167 int (*attach_adapter)(struct i2c_adapter *) __deprecated;
170 int (*detach_adapter)(struct i2c_adapter *) __deprecated;
171 168
172 /* Standard driver model interfaces */ 169 /* Standard driver model interfaces */
173 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 170 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
@@ -370,6 +367,45 @@ struct i2c_algorithm {
370 u32 (*functionality) (struct i2c_adapter *); 367 u32 (*functionality) (struct i2c_adapter *);
371}; 368};
372 369
370/**
371 * struct i2c_bus_recovery_info - I2C bus recovery information
372 * @recover_bus: Recover routine. Either pass driver's recover_bus() routine, or
373 * i2c_generic_scl_recovery() or i2c_generic_gpio_recovery().
374 * @get_scl: This gets current value of SCL line. Mandatory for generic SCL
375 * recovery. Used internally for generic GPIO recovery.
376 * @set_scl: This sets/clears SCL line. Mandatory for generic SCL recovery. Used
377 * internally for generic GPIO recovery.
378 * @get_sda: This gets current value of SDA line. Optional for generic SCL
379 * recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
380 * recovery.
381 * @prepare_recovery: This will be called before starting recovery. Platform may
382 * configure padmux here for SDA/SCL line or something else they want.
383 * @unprepare_recovery: This will be called after completing recovery. Platform
384 * may configure padmux here for SDA/SCL line or something else they want.
385 * @scl_gpio: gpio number of the SCL line. Only required for GPIO recovery.
386 * @sda_gpio: gpio number of the SDA line. Only required for GPIO recovery.
387 */
388struct i2c_bus_recovery_info {
389 int (*recover_bus)(struct i2c_adapter *);
390
391 int (*get_scl)(struct i2c_adapter *);
392 void (*set_scl)(struct i2c_adapter *, int val);
393 int (*get_sda)(struct i2c_adapter *);
394
395 void (*prepare_recovery)(struct i2c_bus_recovery_info *bri);
396 void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri);
397
398 /* gpio recovery */
399 int scl_gpio;
400 int sda_gpio;
401};
402
403int i2c_recover_bus(struct i2c_adapter *adap);
404
405/* Generic recovery routines */
406int i2c_generic_gpio_recovery(struct i2c_adapter *adap);
407int i2c_generic_scl_recovery(struct i2c_adapter *adap);
408
373/* 409/*
374 * i2c_adapter is the structure used to identify a physical i2c bus along 410 * i2c_adapter is the structure used to identify a physical i2c bus along
375 * with the access algorithms necessary to access it. 411 * with the access algorithms necessary to access it.
@@ -393,6 +429,8 @@ struct i2c_adapter {
393 429
394 struct mutex userspace_clients_lock; 430 struct mutex userspace_clients_lock;
395 struct list_head userspace_clients; 431 struct list_head userspace_clients;
432
433 struct i2c_bus_recovery_info *bus_recovery_info;
396}; 434};
397#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 435#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
398 436
@@ -450,7 +488,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
450 */ 488 */
451#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 489#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
452extern int i2c_add_adapter(struct i2c_adapter *); 490extern int i2c_add_adapter(struct i2c_adapter *);
453extern int i2c_del_adapter(struct i2c_adapter *); 491extern void i2c_del_adapter(struct i2c_adapter *);
454extern int i2c_add_numbered_adapter(struct i2c_adapter *); 492extern int i2c_add_numbered_adapter(struct i2c_adapter *);
455 493
456extern int i2c_register_driver(struct module *, struct i2c_driver *); 494extern int i2c_register_driver(struct module *, struct i2c_driver *);
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 530e11ba0738..01f595107048 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -39,6 +39,7 @@ struct twl4030_madc_conversion_method {
39 * @do_avgP: sample the input channel for 4 consecutive cycles 39 * @do_avgP: sample the input channel for 4 consecutive cycles
40 * @method: RT, SW1, SW2 40 * @method: RT, SW1, SW2
41 * @type: Polling or interrupt based method 41 * @type: Polling or interrupt based method
42 * @raw: Return raw value, do not convert it
42 */ 43 */
43 44
44struct twl4030_madc_request { 45struct twl4030_madc_request {
@@ -48,6 +49,7 @@ struct twl4030_madc_request {
48 u16 type; 49 u16 type;
49 bool active; 50 bool active;
50 bool result_pending; 51 bool result_pending;
52 bool raw;
51 int rbuf[TWL4030_MADC_MAX_CHANNELS]; 53 int rbuf[TWL4030_MADC_MAX_CHANNELS];
52 void (*func_cb)(int len, int channels, int *buf); 54 void (*func_cb)(int len, int channels, int *buf);
53}; 55};
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index b4f6c29caced..630f45335c73 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -11,9 +11,21 @@ static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
11 11
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13 13
14extern void icmpv6_send(struct sk_buff *skb, 14#if IS_ENABLED(CONFIG_IPV6)
15 u8 type, u8 code, 15extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
16 __u32 info); 16
17typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info);
18extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
19extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
20
21#else
22
23static inline void icmpv6_send(struct sk_buff *skb,
24 u8 type, u8 code, __u32 info)
25{
26
27}
28#endif
17 29
18extern int icmpv6_init(void); 30extern int icmpv6_init(void);
19extern int icmpv6_err_convert(u8 type, u8 code, 31extern int icmpv6_err_convert(u8 type, u8 code,
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 2640c7e99e51..871a213a8477 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -42,6 +42,7 @@ struct idr {
42 struct idr_layer *id_free; 42 struct idr_layer *id_free;
43 int layers; /* only valid w/o concurrent changes */ 43 int layers; /* only valid w/o concurrent changes */
44 int id_free_cnt; 44 int id_free_cnt;
45 int cur; /* current pos for cyclic allocation */
45 spinlock_t lock; 46 spinlock_t lock;
46}; 47};
47 48
@@ -75,6 +76,7 @@ struct idr {
75void *idr_find_slowpath(struct idr *idp, int id); 76void *idr_find_slowpath(struct idr *idp, int id);
76void idr_preload(gfp_t gfp_mask); 77void idr_preload(gfp_t gfp_mask);
77int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); 78int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask);
79int idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp_mask);
78int idr_for_each(struct idr *idp, 80int idr_for_each(struct idr *idp,
79 int (*fn)(int id, void *p, void *data), void *data); 81 int (*fn)(int id, void *p, void *data), void *data);
80void *idr_get_next(struct idr *idp, int *nextid); 82void *idr_get_next(struct idr *idp, int *nextid);
@@ -122,11 +124,13 @@ static inline void *idr_find(struct idr *idr, int id)
122 * @idp: idr handle 124 * @idp: idr handle
123 * @entry: the type * to use as cursor 125 * @entry: the type * to use as cursor
124 * @id: id entry's key 126 * @id: id entry's key
127 *
128 * @entry and @id do not need to be initialized before the loop, and
129 * after normal terminatinon @entry is left with the value NULL. This
130 * is convenient for a "not found" value.
125 */ 131 */
126#define idr_for_each_entry(idp, entry, id) \ 132#define idr_for_each_entry(idp, entry, id) \
127 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ 133 for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)
128 entry != NULL; \
129 ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
130 134
131/* 135/*
132 * Don't use the following functions. These exist only to suppress 136 * Don't use the following functions. These exist only to suppress
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 7e24fe0cfbcd..06b0ed0154a4 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -113,6 +113,34 @@
113#define IEEE80211_CTL_EXT_SSW_FBACK 0x9000 113#define IEEE80211_CTL_EXT_SSW_FBACK 0x9000
114#define IEEE80211_CTL_EXT_SSW_ACK 0xa000 114#define IEEE80211_CTL_EXT_SSW_ACK 0xa000
115 115
116
117#define IEEE80211_SN_MASK ((IEEE80211_SCTL_SEQ) >> 4)
118#define IEEE80211_MAX_SN IEEE80211_SN_MASK
119#define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1)
120
121static inline int ieee80211_sn_less(u16 sn1, u16 sn2)
122{
123 return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1);
124}
125
126static inline u16 ieee80211_sn_add(u16 sn1, u16 sn2)
127{
128 return (sn1 + sn2) & IEEE80211_SN_MASK;
129}
130
131static inline u16 ieee80211_sn_inc(u16 sn)
132{
133 return ieee80211_sn_add(sn, 1);
134}
135
136static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
137{
138 return (sn1 - sn2) & IEEE80211_SN_MASK;
139}
140
141#define IEEE80211_SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
142#define IEEE80211_SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
143
116/* miscellaneous IEEE 802.11 constants */ 144/* miscellaneous IEEE 802.11 constants */
117#define IEEE80211_MAX_FRAG_THRESHOLD 2352 145#define IEEE80211_MAX_FRAG_THRESHOLD 2352
118#define IEEE80211_MAX_RTS_THRESHOLD 2353 146#define IEEE80211_MAX_RTS_THRESHOLD 2353
@@ -185,7 +213,7 @@ struct ieee80211_hdr {
185 u8 addr3[6]; 213 u8 addr3[6];
186 __le16 seq_ctrl; 214 __le16 seq_ctrl;
187 u8 addr4[6]; 215 u8 addr4[6];
188} __packed; 216} __packed __aligned(2);
189 217
190struct ieee80211_hdr_3addr { 218struct ieee80211_hdr_3addr {
191 __le16 frame_control; 219 __le16 frame_control;
@@ -194,7 +222,7 @@ struct ieee80211_hdr_3addr {
194 u8 addr2[6]; 222 u8 addr2[6];
195 u8 addr3[6]; 223 u8 addr3[6];
196 __le16 seq_ctrl; 224 __le16 seq_ctrl;
197} __packed; 225} __packed __aligned(2);
198 226
199struct ieee80211_qos_hdr { 227struct ieee80211_qos_hdr {
200 __le16 frame_control; 228 __le16 frame_control;
@@ -204,7 +232,7 @@ struct ieee80211_qos_hdr {
204 u8 addr3[6]; 232 u8 addr3[6];
205 __le16 seq_ctrl; 233 __le16 seq_ctrl;
206 __le16 qos_ctrl; 234 __le16 qos_ctrl;
207} __packed; 235} __packed __aligned(2);
208 236
209/** 237/**
210 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set 238 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
@@ -581,7 +609,7 @@ struct ieee80211s_hdr {
581 __le32 seqnum; 609 __le32 seqnum;
582 u8 eaddr1[6]; 610 u8 eaddr1[6];
583 u8 eaddr2[6]; 611 u8 eaddr2[6];
584} __packed; 612} __packed __aligned(2);
585 613
586/* Mesh flags */ 614/* Mesh flags */
587#define MESH_FLAGS_AE_A4 0x1 615#define MESH_FLAGS_AE_A4 0x1
@@ -645,6 +673,36 @@ struct ieee80211_channel_sw_ie {
645} __packed; 673} __packed;
646 674
647/** 675/**
676 * struct ieee80211_ext_chansw_ie
677 *
678 * This structure represents the "Extended Channel Switch Announcement element"
679 */
680struct ieee80211_ext_chansw_ie {
681 u8 mode;
682 u8 new_operating_class;
683 u8 new_ch_num;
684 u8 count;
685} __packed;
686
687/**
688 * struct ieee80211_sec_chan_offs_ie - secondary channel offset IE
689 * @sec_chan_offs: secondary channel offset, uses IEEE80211_HT_PARAM_CHA_SEC_*
690 * values here
691 * This structure represents the "Secondary Channel Offset element"
692 */
693struct ieee80211_sec_chan_offs_ie {
694 u8 sec_chan_offs;
695} __packed;
696
697/**
698 * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE
699 */
700struct ieee80211_wide_bw_chansw_ie {
701 u8 new_channel_width;
702 u8 new_center_freq_seg0, new_center_freq_seg1;
703} __packed;
704
705/**
648 * struct ieee80211_tim 706 * struct ieee80211_tim
649 * 707 *
650 * This structure refers to "Traffic Indication Map information element" 708 * This structure refers to "Traffic Indication Map information element"
@@ -812,12 +870,15 @@ struct ieee80211_mgmt {
812 } __packed wme_action; 870 } __packed wme_action;
813 struct{ 871 struct{
814 u8 action_code; 872 u8 action_code;
815 u8 element_id; 873 u8 variable[0];
816 u8 length;
817 struct ieee80211_channel_sw_ie sw_elem;
818 } __packed chan_switch; 874 } __packed chan_switch;
819 struct{ 875 struct{
820 u8 action_code; 876 u8 action_code;
877 struct ieee80211_ext_chansw_ie data;
878 u8 variable[0];
879 } __packed ext_chan_switch;
880 struct{
881 u8 action_code;
821 u8 dialog_token; 882 u8 dialog_token;
822 u8 element_id; 883 u8 element_id;
823 u8 length; 884 u8 length;
@@ -875,7 +936,7 @@ struct ieee80211_mgmt {
875 } u; 936 } u;
876 } __packed action; 937 } __packed action;
877 } u; 938 } u;
878} __packed; 939} __packed __aligned(2);
879 940
880/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ 941/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
881#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 942#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
@@ -906,20 +967,20 @@ struct ieee80211_rts {
906 __le16 duration; 967 __le16 duration;
907 u8 ra[6]; 968 u8 ra[6];
908 u8 ta[6]; 969 u8 ta[6];
909} __packed; 970} __packed __aligned(2);
910 971
911struct ieee80211_cts { 972struct ieee80211_cts {
912 __le16 frame_control; 973 __le16 frame_control;
913 __le16 duration; 974 __le16 duration;
914 u8 ra[6]; 975 u8 ra[6];
915} __packed; 976} __packed __aligned(2);
916 977
917struct ieee80211_pspoll { 978struct ieee80211_pspoll {
918 __le16 frame_control; 979 __le16 frame_control;
919 __le16 aid; 980 __le16 aid;
920 u8 bssid[6]; 981 u8 bssid[6];
921 u8 ta[6]; 982 u8 ta[6];
922} __packed; 983} __packed __aligned(2);
923 984
924/* TDLS */ 985/* TDLS */
925 986
@@ -999,6 +1060,26 @@ enum ieee80211_p2p_attr_id {
999 IEEE80211_P2P_ATTR_MAX 1060 IEEE80211_P2P_ATTR_MAX
1000}; 1061};
1001 1062
1063/* Notice of Absence attribute - described in P2P spec 4.1.14 */
1064/* Typical max value used here */
1065#define IEEE80211_P2P_NOA_DESC_MAX 4
1066
1067struct ieee80211_p2p_noa_desc {
1068 u8 count;
1069 __le32 duration;
1070 __le32 interval;
1071 __le32 start_time;
1072} __packed;
1073
1074struct ieee80211_p2p_noa_attr {
1075 u8 index;
1076 u8 oppps_ctwindow;
1077 struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX];
1078} __packed;
1079
1080#define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7)
1081#define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F
1082
1002/** 1083/**
1003 * struct ieee80211_bar - HT Block Ack Request 1084 * struct ieee80211_bar - HT Block Ack Request
1004 * 1085 *
@@ -1290,11 +1371,6 @@ struct ieee80211_vht_operation {
1290} __packed; 1371} __packed;
1291 1372
1292 1373
1293#define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0
1294#define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1
1295#define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2
1296#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3
1297
1298/* 802.11ac VHT Capabilities */ 1374/* 802.11ac VHT Capabilities */
1299#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 1375#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
1300#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 1376#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
@@ -1310,10 +1386,11 @@ struct ieee80211_vht_operation {
1310#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 1386#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200
1311#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 1387#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
1312#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 1388#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
1389#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
1313#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 1390#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1314#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 1391#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1315#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 1392#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000
1316#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000 1393#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00030000
1317#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 1394#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1318#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 1395#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1319#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 1396#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
@@ -1594,6 +1671,7 @@ enum ieee80211_eid {
1594 1671
1595 WLAN_EID_HT_CAPABILITY = 45, 1672 WLAN_EID_HT_CAPABILITY = 45,
1596 WLAN_EID_HT_OPERATION = 61, 1673 WLAN_EID_HT_OPERATION = 61,
1674 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,
1597 1675
1598 WLAN_EID_RSN = 48, 1676 WLAN_EID_RSN = 48,
1599 WLAN_EID_MMIE = 76, 1677 WLAN_EID_MMIE = 76,
@@ -1628,6 +1706,8 @@ enum ieee80211_eid {
1628 WLAN_EID_VHT_CAPABILITY = 191, 1706 WLAN_EID_VHT_CAPABILITY = 191,
1629 WLAN_EID_VHT_OPERATION = 192, 1707 WLAN_EID_VHT_OPERATION = 192,
1630 WLAN_EID_OPMODE_NOTIF = 199, 1708 WLAN_EID_OPMODE_NOTIF = 199,
1709 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1710 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1631 1711
1632 /* 802.11ad */ 1712 /* 802.11ad */
1633 WLAN_EID_NON_TX_BSSID_CAP = 83, 1713 WLAN_EID_NON_TX_BSSID_CAP = 83,
@@ -1751,6 +1831,7 @@ enum ieee80211_key_len {
1751 1831
1752/* Public action codes */ 1832/* Public action codes */
1753enum ieee80211_pub_actioncode { 1833enum ieee80211_pub_actioncode {
1834 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
1754 WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, 1835 WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,
1755}; 1836};
1756 1837
@@ -1911,6 +1992,16 @@ enum ieee80211_timeout_interval_type {
1911 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, 1992 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
1912}; 1993};
1913 1994
1995/**
1996 * struct ieee80211_timeout_interval_ie - Timeout Interval element
1997 * @type: type, see &enum ieee80211_timeout_interval_type
1998 * @value: timeout interval value
1999 */
2000struct ieee80211_timeout_interval_ie {
2001 u8 type;
2002 __le32 value;
2003} __packed;
2004
1914/* BACK action code */ 2005/* BACK action code */
1915enum ieee80211_back_actioncode { 2006enum ieee80211_back_actioncode {
1916 WLAN_ACTION_ADDBA_REQ = 0, 2007 WLAN_ACTION_ADDBA_REQ = 0,
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 89b4614a4722..f563907ed776 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -33,7 +33,15 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
33 33
34static inline int arp_hdr_len(struct net_device *dev) 34static inline int arp_hdr_len(struct net_device *dev)
35{ 35{
36 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ 36 switch (dev->type) {
37 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; 37#if IS_ENABLED(CONFIG_FIREWIRE_NET)
38 case ARPHRD_IEEE1394:
39 /* ARP header, device address and 2 IP addresses */
40 return sizeof(struct arphdr) + dev->addr_len + sizeof(u32) * 2;
41#endif
42 default:
43 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
44 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
45 }
38} 46}
39#endif /* _LINUX_IF_ARP_H */ 47#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index cfd21e3d5506..4474557904f6 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -112,6 +112,10 @@ struct team_mode_ops {
112 void (*port_disabled)(struct team *team, struct team_port *port); 112 void (*port_disabled)(struct team *team, struct team_port *port);
113}; 113};
114 114
115extern int team_modeop_port_enter(struct team *team, struct team_port *port);
116extern void team_modeop_port_change_dev_addr(struct team *team,
117 struct team_port *port);
118
115enum team_option_type { 119enum team_option_type {
116 TEAM_OPTION_TYPE_U32, 120 TEAM_OPTION_TYPE_U32,
117 TEAM_OPTION_TYPE_STRING, 121 TEAM_OPTION_TYPE_STRING,
@@ -236,7 +240,26 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
236 return NULL; 240 return NULL;
237} 241}
238 242
239extern int team_port_set_team_dev_addr(struct team_port *port); 243static inline struct team_port *
244team_get_first_port_txable_rcu(struct team *team, struct team_port *port)
245{
246 struct team_port *cur;
247
248 if (likely(team_port_txable(port)))
249 return port;
250 cur = port;
251 list_for_each_entry_continue_rcu(cur, &team->port_list, list)
252 if (team_port_txable(port))
253 return cur;
254 list_for_each_entry_rcu(cur, &team->port_list, list) {
255 if (cur == port)
256 break;
257 if (team_port_txable(port))
258 return cur;
259 }
260 return NULL;
261}
262
240extern int team_options_register(struct team *team, 263extern int team_options_register(struct team *team,
241 const struct team_option *option, 264 const struct team_option *option,
242 size_t option_count); 265 size_t option_count);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 218a3b686d90..52bd03b38962 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -86,15 +86,15 @@ static inline int is_vlan_dev(struct net_device *dev)
86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
87 87
88extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, 88extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
89 u16 vlan_id); 89 __be16 vlan_proto, u16 vlan_id);
90extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 90extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
91extern u16 vlan_dev_vlan_id(const struct net_device *dev); 91extern u16 vlan_dev_vlan_id(const struct net_device *dev);
92 92
93extern bool vlan_do_receive(struct sk_buff **skb); 93extern bool vlan_do_receive(struct sk_buff **skb);
94extern struct sk_buff *vlan_untag(struct sk_buff *skb); 94extern struct sk_buff *vlan_untag(struct sk_buff *skb);
95 95
96extern int vlan_vid_add(struct net_device *dev, unsigned short vid); 96extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid);
97extern void vlan_vid_del(struct net_device *dev, unsigned short vid); 97extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid);
98 98
99extern int vlan_vids_add_by_dev(struct net_device *dev, 99extern int vlan_vids_add_by_dev(struct net_device *dev,
100 const struct net_device *by_dev); 100 const struct net_device *by_dev);
@@ -104,7 +104,8 @@ extern void vlan_vids_del_by_dev(struct net_device *dev,
104extern bool vlan_uses_dev(const struct net_device *dev); 104extern bool vlan_uses_dev(const struct net_device *dev);
105#else 105#else
106static inline struct net_device * 106static inline struct net_device *
107__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) 107__vlan_find_dev_deep(struct net_device *real_dev,
108 __be16 vlan_proto, u16 vlan_id)
108{ 109{
109 return NULL; 110 return NULL;
110} 111}
@@ -131,12 +132,12 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
131 return skb; 132 return skb;
132} 133}
133 134
134static inline int vlan_vid_add(struct net_device *dev, unsigned short vid) 135static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid)
135{ 136{
136 return 0; 137 return 0;
137} 138}
138 139
139static inline void vlan_vid_del(struct net_device *dev, unsigned short vid) 140static inline void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid)
140{ 141{
141} 142}
142 143
@@ -157,9 +158,20 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
157} 158}
158#endif 159#endif
159 160
161static inline bool vlan_hw_offload_capable(netdev_features_t features,
162 __be16 proto)
163{
164 if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX)
165 return true;
166 if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX)
167 return true;
168 return false;
169}
170
160/** 171/**
161 * vlan_insert_tag - regular VLAN tag inserting 172 * vlan_insert_tag - regular VLAN tag inserting
162 * @skb: skbuff to tag 173 * @skb: skbuff to tag
174 * @vlan_proto: VLAN encapsulation protocol
163 * @vlan_tci: VLAN TCI to insert 175 * @vlan_tci: VLAN TCI to insert
164 * 176 *
165 * Inserts the VLAN tag into @skb as part of the payload 177 * Inserts the VLAN tag into @skb as part of the payload
@@ -170,7 +182,8 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
170 * 182 *
171 * Does not change skb->protocol so this function can be used during receive. 183 * Does not change skb->protocol so this function can be used during receive.
172 */ 184 */
173static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) 185static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
186 __be16 vlan_proto, u16 vlan_tci)
174{ 187{
175 struct vlan_ethhdr *veth; 188 struct vlan_ethhdr *veth;
176 189
@@ -185,7 +198,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
185 skb->mac_header -= VLAN_HLEN; 198 skb->mac_header -= VLAN_HLEN;
186 199
187 /* first, the ethernet type */ 200 /* first, the ethernet type */
188 veth->h_vlan_proto = htons(ETH_P_8021Q); 201 veth->h_vlan_proto = vlan_proto;
189 202
190 /* now, the TCI */ 203 /* now, the TCI */
191 veth->h_vlan_TCI = htons(vlan_tci); 204 veth->h_vlan_TCI = htons(vlan_tci);
@@ -204,24 +217,28 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
204 * Following the skb_unshare() example, in case of error, the calling function 217 * Following the skb_unshare() example, in case of error, the calling function
205 * doesn't have to worry about freeing the original skb. 218 * doesn't have to worry about freeing the original skb.
206 */ 219 */
207static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) 220static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb,
221 __be16 vlan_proto, u16 vlan_tci)
208{ 222{
209 skb = vlan_insert_tag(skb, vlan_tci); 223 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);
210 if (skb) 224 if (skb)
211 skb->protocol = htons(ETH_P_8021Q); 225 skb->protocol = vlan_proto;
212 return skb; 226 return skb;
213} 227}
214 228
215/** 229/**
216 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting 230 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
217 * @skb: skbuff to tag 231 * @skb: skbuff to tag
232 * @vlan_proto: VLAN encapsulation protocol
218 * @vlan_tci: VLAN TCI to insert 233 * @vlan_tci: VLAN TCI to insert
219 * 234 *
220 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest 235 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
221 */ 236 */
222static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, 237static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
238 __be16 vlan_proto,
223 u16 vlan_tci) 239 u16 vlan_tci)
224{ 240{
241 skb->vlan_proto = vlan_proto;
225 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; 242 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
226 return skb; 243 return skb;
227} 244}
@@ -236,12 +253,13 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
236 * Assumes skb->dev is the target that will xmit this frame. 253 * Assumes skb->dev is the target that will xmit this frame.
237 * Returns a VLAN tagged skb. 254 * Returns a VLAN tagged skb.
238 */ 255 */
239static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) 256static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb,
257 __be16 vlan_proto, u16 vlan_tci)
240{ 258{
241 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 259 if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) {
242 return __vlan_hwaccel_put_tag(skb, vlan_tci); 260 return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
243 } else { 261 } else {
244 return __vlan_put_tag(skb, vlan_tci); 262 return __vlan_put_tag(skb, vlan_proto, vlan_tci);
245 } 263 }
246} 264}
247 265
@@ -256,9 +274,9 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
256{ 274{
257 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 275 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
258 276
259 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { 277 if (veth->h_vlan_proto != htons(ETH_P_8021Q) &&
278 veth->h_vlan_proto != htons(ETH_P_8021AD))
260 return -EINVAL; 279 return -EINVAL;
261 }
262 280
263 *vlan_tci = ntohs(veth->h_vlan_TCI); 281 *vlan_tci = ntohs(veth->h_vlan_TCI);
264 return 0; 282 return 0;
@@ -294,7 +312,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
294 */ 312 */
295static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) 313static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
296{ 314{
297 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 315 if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
298 return __vlan_hwaccel_get_tag(skb, vlan_tci); 316 return __vlan_hwaccel_get_tag(skb, vlan_tci);
299 } else { 317 } else {
300 return __vlan_get_tag(skb, vlan_tci); 318 return __vlan_get_tag(skb, vlan_tci);
@@ -339,7 +357,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
339 */ 357 */
340 358
341 proto = vhdr->h_vlan_encapsulated_proto; 359 proto = vhdr->h_vlan_encapsulated_proto;
342 if (ntohs(proto) >= 1536) { 360 if (ntohs(proto) >= ETH_P_802_3_MIN) {
343 skb->protocol = proto; 361 skb->protocol = proto;
344 return; 362 return;
345 } 363 }
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h
index 2e4eab9868a3..e7fdec4db9da 100644
--- a/include/linux/iio/adc/ad_sigma_delta.h
+++ b/include/linux/iio/adc/ad_sigma_delta.h
@@ -133,9 +133,9 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig);
133 .channel2 = (_channel2), \ 133 .channel2 = (_channel2), \
134 .address = (_address), \ 134 .address = (_address), \
135 .extend_name = (_extend_name), \ 135 .extend_name = (_extend_name), \
136 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 136 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
137 IIO_CHAN_INFO_SCALE_SHARED_BIT | \ 137 BIT(IIO_CHAN_INFO_OFFSET), \
138 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ 138 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
139 .scan_index = (_si), \ 139 .scan_index = (_si), \
140 .scan_type = { \ 140 .scan_type = { \
141 .sign = 'u', \ 141 .sign = 'u', \
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 8bd12be0b02f..172c5b23cb84 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -15,6 +15,7 @@
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h>
18 19
19#define ST_SENSORS_TX_MAX_LENGTH 2 20#define ST_SENSORS_TX_MAX_LENGTH 2
20#define ST_SENSORS_RX_MAX_LENGTH 6 21#define ST_SENSORS_RX_MAX_LENGTH 6
@@ -45,8 +46,8 @@
45{ \ 46{ \
46 .type = device_type, \ 47 .type = device_type, \
47 .modified = 1, \ 48 .modified = 1, \
48 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 49 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
49 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ 50 BIT(IIO_CHAN_INFO_SCALE), \
50 .scan_index = index, \ 51 .scan_index = index, \
51 .channel2 = mod, \ 52 .channel2 = mod, \
52 .address = addr, \ 53 .address = addr, \
diff --git a/include/linux/iio/gyro/itg3200.h b/include/linux/iio/gyro/itg3200.h
index c53f16914b77..2a820850f284 100644
--- a/include/linux/iio/gyro/itg3200.h
+++ b/include/linux/iio/gyro/itg3200.h
@@ -149,6 +149,6 @@ static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
149{ 149{
150} 150}
151 151
152#endif /* CONFIG_IIO_RING_BUFFER */ 152#endif /* CONFIG_IIO_BUFFER */
153 153
154#endif /* ITG3200_H_ */ 154#endif /* ITG3200_H_ */
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index da8c776ba0bd..8d171f427632 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -38,76 +38,6 @@ enum iio_chan_info_enum {
38 IIO_CHAN_INFO_HYSTERESIS, 38 IIO_CHAN_INFO_HYSTERESIS,
39}; 39};
40 40
41#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
42#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
43#define IIO_CHAN_INFO_BITS(type) (IIO_CHAN_INFO_SHARED_BIT(type) | \
44 IIO_CHAN_INFO_SEPARATE_BIT(type))
45
46#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
47 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
48#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \
49 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
50#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \
51 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
52#define IIO_CHAN_INFO_SCALE_SHARED_BIT \
53 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
54#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \
55 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
56#define IIO_CHAN_INFO_OFFSET_SHARED_BIT \
57 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
58#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \
59 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
60#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \
61 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
62#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \
63 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
64#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \
65 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
66#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \
67 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
68#define IIO_CHAN_INFO_PEAK_SHARED_BIT \
69 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
70#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \
71 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
72#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \
73 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
74#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \
75 IIO_CHAN_INFO_SEPARATE_BIT( \
76 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
77#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \
78 IIO_CHAN_INFO_SHARED_BIT( \
79 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
80#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \
81 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
82#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \
83 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
84#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
85 IIO_CHAN_INFO_SHARED_BIT( \
86 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
87#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
88 IIO_CHAN_INFO_SEPARATE_BIT( \
89 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
90#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \
91 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
92#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \
93 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
94#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \
95 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)
96#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \
97 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)
98#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \
99 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
100#define IIO_CHAN_INFO_PHASE_SHARED_BIT \
101 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
102#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \
103 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
104#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
105 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
106#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT \
107 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS)
108#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT \
109 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS)
110
111enum iio_endian { 41enum iio_endian {
112 IIO_CPU, 42 IIO_CPU,
113 IIO_BE, 43 IIO_BE,
@@ -218,6 +148,10 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
218 * endianness: little or big endian 148 * endianness: little or big endian
219 * @info_mask: What information is to be exported about this channel. 149 * @info_mask: What information is to be exported about this channel.
220 * This includes calibbias, scale etc. 150 * This includes calibbias, scale etc.
151 * @info_mask_separate: What information is to be exported that is specific to
152 * this channel.
153 * @info_mask_shared_by_type: What information is to be exported that is shared
154* by all channels of the same type.
221 * @event_mask: What events can this channel produce. 155 * @event_mask: What events can this channel produce.
222 * @ext_info: Array of extended info attributes for this channel. 156 * @ext_info: Array of extended info attributes for this channel.
223 * The array is NULL terminated, the last element should 157 * The array is NULL terminated, the last element should
@@ -253,6 +187,8 @@ struct iio_chan_spec {
253 enum iio_endian endianness; 187 enum iio_endian endianness;
254 } scan_type; 188 } scan_type;
255 long info_mask; 189 long info_mask;
190 long info_mask_separate;
191 long info_mask_shared_by_type;
256 long event_mask; 192 long event_mask;
257 const struct iio_chan_spec_ext_info *ext_info; 193 const struct iio_chan_spec_ext_info *ext_info;
258 const char *extend_name; 194 const char *extend_name;
@@ -275,7 +211,8 @@ struct iio_chan_spec {
275static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
276 enum iio_chan_info_enum type) 212 enum iio_chan_info_enum type)
277{ 213{
278 return chan->info_mask & IIO_CHAN_INFO_BITS(type); 214 return (chan->info_mask_separate & type) |
215 (chan->info_mask_shared_by_type & type);
279} 216}
280 217
281#define IIO_ST(si, rb, sb, sh) \ 218#define IIO_ST(si, rb, sb, sh) \
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index ff781dca2e9a..b665dc7f017b 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -162,8 +162,8 @@ int adis_single_conversion(struct iio_dev *indio_dev,
162 .indexed = 1, \ 162 .indexed = 1, \
163 .channel = (chan), \ 163 .channel = (chan), \
164 .extend_name = name, \ 164 .extend_name = name, \
165 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
166 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ 166 BIT(IIO_CHAN_INFO_SCALE), \
167 .address = (addr), \ 167 .address = (addr), \
168 .scan_index = (si), \ 168 .scan_index = (si), \
169 .scan_type = { \ 169 .scan_type = { \
@@ -184,9 +184,9 @@ int adis_single_conversion(struct iio_dev *indio_dev,
184 .type = IIO_TEMP, \ 184 .type = IIO_TEMP, \
185 .indexed = 1, \ 185 .indexed = 1, \
186 .channel = 0, \ 186 .channel = 0, \
187 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 187 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
188 IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ 188 BIT(IIO_CHAN_INFO_SCALE) | \
189 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ 189 BIT(IIO_CHAN_INFO_OFFSET), \
190 .address = (addr), \ 190 .address = (addr), \
191 .scan_index = (si), \ 191 .scan_index = (si), \
192 .scan_type = { \ 192 .scan_type = { \
@@ -197,13 +197,13 @@ int adis_single_conversion(struct iio_dev *indio_dev,
197 }, \ 197 }, \
198} 198}
199 199
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \ 200#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \
201 .type = (_type), \ 201 .type = (_type), \
202 .modified = 1, \ 202 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \ 203 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 204 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
205 IIO_CHAN_INFO_SCALE_SHARED_BIT | \ 205 info_sep, \
206 info, \ 206 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
207 .address = (addr), \ 207 .address = (addr), \
208 .scan_index = (si), \ 208 .scan_index = (si), \
209 .scan_type = { \ 209 .scan_type = { \
@@ -214,17 +214,17 @@ int adis_single_conversion(struct iio_dev *indio_dev,
214 }, \ 214 }, \
215} 215}
216 216
217#define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \ 217#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits) 218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits)
219 219
220#define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \ 220#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits) 221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits)
222 222
223#define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \ 223#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits) 224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits)
225 225
226#define ADIS_ROT_CHAN(mod, addr, si, info, bits) \ 226#define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits) 227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits)
228 228
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER 229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230 230
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index c66e0a96f6e8..3869c525b052 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -44,7 +44,6 @@ struct iio_trigger_ops {
44 * @id: [INTERN] unique id number 44 * @id: [INTERN] unique id number
45 * @name: [DRIVER] unique name 45 * @name: [DRIVER] unique name
46 * @dev: [DRIVER] associated device (if relevant) 46 * @dev: [DRIVER] associated device (if relevant)
47 * @private_data: [DRIVER] device specific data
48 * @list: [INTERN] used in maintenance of global trigger list 47 * @list: [INTERN] used in maintenance of global trigger list
49 * @alloc_list: [DRIVER] used for driver specific trigger list 48 * @alloc_list: [DRIVER] used for driver specific trigger list
50 * @use_count: use count for the trigger 49 * @use_count: use count for the trigger
@@ -60,7 +59,6 @@ struct iio_trigger {
60 const char *name; 59 const char *name;
61 struct device dev; 60 struct device dev;
62 61
63 void *private_data;
64 struct list_head list; 62 struct list_head list;
65 struct list_head alloc_list; 63 struct list_head alloc_list;
66 int use_count; 64 int use_count;
@@ -92,6 +90,30 @@ static inline void iio_trigger_get(struct iio_trigger *trig)
92} 90}
93 91
94/** 92/**
93 * iio_device_set_drvdata() - Set trigger driver data
94 * @trig: IIO trigger structure
95 * @data: Driver specific data
96 *
97 * Allows to attach an arbitrary pointer to an IIO trigger, which can later be
98 * retrieved by iio_trigger_get_drvdata().
99 */
100static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data)
101{
102 dev_set_drvdata(&trig->dev, data);
103}
104
105/**
106 * iio_trigger_get_drvdata() - Get trigger driver data
107 * @trig: IIO trigger structure
108 *
109 * Returns the data previously set with iio_trigger_set_drvdata()
110 */
111static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)
112{
113 return dev_get_drvdata(&trig->dev);
114}
115
116/**
95 * iio_trigger_register() - register a trigger with the IIO core 117 * iio_trigger_register() - register a trigger with the IIO core
96 * @trig_info: trigger to be registered 118 * @trig_info: trigger to be registered
97 **/ 119 **/
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 86c361e947b9..1b7f268cddce 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -46,7 +46,7 @@ static inline int ima_module_check(struct file *file)
46 return 0; 46 return 0;
47} 47}
48 48
49#endif /* CONFIG_IMA_H */ 49#endif /* CONFIG_IMA */
50 50
51#ifdef CONFIG_IMA_APPRAISE 51#ifdef CONFIG_IMA_APPRAISE
52extern void ima_inode_post_setattr(struct dentry *dentry); 52extern void ima_inode_post_setattr(struct dentry *dentry);
@@ -72,5 +72,5 @@ static inline int ima_inode_removexattr(struct dentry *dentry,
72{ 72{
73 return 0; 73 return 0;
74} 74}
75#endif /* CONFIG_IMA_APPRAISE_H */ 75#endif /* CONFIG_IMA_APPRAISE */
76#endif /* _LINUX_IMA_H */ 76#endif /* _LINUX_IMA_H */
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h
index 75d4be717714..5049f21928e4 100644
--- a/include/linux/input/auo-pixcir-ts.h
+++ b/include/linux/input/auo-pixcir-ts.h
@@ -43,12 +43,10 @@
43 */ 43 */
44struct auo_pixcir_ts_platdata { 44struct auo_pixcir_ts_platdata {
45 int gpio_int; 45 int gpio_int;
46 int gpio_rst;
46 47
47 int int_setting; 48 int int_setting;
48 49
49 void (*init_hw)(struct i2c_client *);
50 void (*exit_hw)(struct i2c_client *);
51
52 unsigned int x_max; 50 unsigned int x_max;
53 unsigned int y_max; 51 unsigned int y_max;
54}; 52};
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 5f3aa6b11bfa..27e06acc509a 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -81,4 +81,23 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
81 unsigned short *keymap, 81 unsigned short *keymap,
82 struct input_dev *input_dev); 82 struct input_dev *input_dev);
83 83
84#ifdef CONFIG_OF
85/**
86 * matrix_keypad_parse_of_params() - Read parameters from matrix-keypad node
87 *
88 * @dev: Device containing of_node
89 * @rows: Returns number of matrix rows
90 * @cols: Returns number of matrix columns
91 * @return 0 if OK, <0 on error
92 */
93int matrix_keypad_parse_of_params(struct device *dev,
94 unsigned int *rows, unsigned int *cols);
95#else
96static inline int matrix_keypad_parse_of_params(struct device *dev,
97 unsigned int *rows, unsigned int *cols)
98{
99 return -ENOSYS;
100}
101#endif /* CONFIG_OF */
102
84#endif /* _MATRIX_KEYPAD_H */ 103#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 2e86bd0bfba1..1b1dfa80d9ff 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -19,6 +19,7 @@
19#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */ 19#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
20#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */ 20#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
21#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */ 21#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */
22#define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */
22 23
23/** 24/**
24 * struct input_mt_slot - represents the state of an input MT slot 25 * struct input_mt_slot - represents the state of an input MT slot
diff --git a/include/linux/integrity.h b/include/linux/integrity.h
index 66c5fe9550a5..83222cebd47b 100644
--- a/include/linux/integrity.h
+++ b/include/linux/integrity.h
@@ -36,5 +36,5 @@ static inline void integrity_inode_free(struct inode *inode)
36{ 36{
37 return; 37 return;
38} 38}
39#endif /* CONFIG_INTEGRITY_H */ 39#endif /* CONFIG_INTEGRITY */
40#endif /* _LINUX_INTEGRITY_H */ 40#endif /* _LINUX_INTEGRITY_H */
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index ba3b8a98a049..3aeb7305e2f5 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -20,6 +20,7 @@
20#define __LINUX_IOMMU_H 20#define __LINUX_IOMMU_H
21 21
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/err.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
25#define IOMMU_READ (1) 26#define IOMMU_READ (1)
@@ -91,8 +92,7 @@ struct iommu_ops {
91 phys_addr_t paddr, size_t size, int prot); 92 phys_addr_t paddr, size_t size, int prot);
92 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 93 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
93 size_t size); 94 size_t size);
94 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 95 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
95 unsigned long iova);
96 int (*domain_has_cap)(struct iommu_domain *domain, 96 int (*domain_has_cap)(struct iommu_domain *domain,
97 unsigned long cap); 97 unsigned long cap);
98 int (*add_device)(struct device *dev); 98 int (*add_device)(struct device *dev);
@@ -105,7 +105,7 @@ struct iommu_ops {
105 105
106 /* Window handling functions */ 106 /* Window handling functions */
107 int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, 107 int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
108 phys_addr_t paddr, u64 size); 108 phys_addr_t paddr, u64 size, int prot);
109 void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr); 109 void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
110 /* Set the numer of window per domain */ 110 /* Set the numer of window per domain */
111 int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count); 111 int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count);
@@ -125,6 +125,7 @@ struct iommu_ops {
125extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); 125extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
126extern bool iommu_present(struct bus_type *bus); 126extern bool iommu_present(struct bus_type *bus);
127extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 127extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
128extern struct iommu_group *iommu_group_get_by_id(int id);
128extern void iommu_domain_free(struct iommu_domain *domain); 129extern void iommu_domain_free(struct iommu_domain *domain);
129extern int iommu_attach_device(struct iommu_domain *domain, 130extern int iommu_attach_device(struct iommu_domain *domain,
130 struct device *dev); 131 struct device *dev);
@@ -134,8 +135,7 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
134 phys_addr_t paddr, size_t size, int prot); 135 phys_addr_t paddr, size_t size, int prot);
135extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 136extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
136 size_t size); 137 size_t size);
137extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 138extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
138 unsigned long iova);
139extern int iommu_domain_has_cap(struct iommu_domain *domain, 139extern int iommu_domain_has_cap(struct iommu_domain *domain,
140 unsigned long cap); 140 unsigned long cap);
141extern void iommu_set_fault_handler(struct iommu_domain *domain, 141extern void iommu_set_fault_handler(struct iommu_domain *domain,
@@ -171,7 +171,8 @@ extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
171 171
172/* Window handling function prototypes */ 172/* Window handling function prototypes */
173extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, 173extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
174 phys_addr_t offset, u64 size); 174 phys_addr_t offset, u64 size,
175 int prot);
175extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr); 176extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
176/** 177/**
177 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework 178 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
@@ -257,7 +258,7 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
257 258
258static inline int iommu_domain_window_enable(struct iommu_domain *domain, 259static inline int iommu_domain_window_enable(struct iommu_domain *domain,
259 u32 wnd_nr, phys_addr_t paddr, 260 u32 wnd_nr, phys_addr_t paddr,
260 u64 size) 261 u64 size, int prot)
261{ 262{
262 return -ENODEV; 263 return -ENODEV;
263} 264}
@@ -267,8 +268,7 @@ static inline void iommu_domain_window_disable(struct iommu_domain *domain,
267{ 268{
268} 269}
269 270
270static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 271static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
271 unsigned long iova)
272{ 272{
273 return 0; 273 return 0;
274} 274}
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 85ac9b9b72a2..89b7c24a36e9 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -192,6 +192,10 @@ extern struct resource * __request_region(struct resource *,
192extern int __check_region(struct resource *, resource_size_t, resource_size_t); 192extern int __check_region(struct resource *, resource_size_t, resource_size_t);
193extern void __release_region(struct resource *, resource_size_t, 193extern void __release_region(struct resource *, resource_size_t,
194 resource_size_t); 194 resource_size_t);
195#ifdef CONFIG_MEMORY_HOTREMOVE
196extern int release_mem_region_adjustable(struct resource *, resource_size_t,
197 resource_size_t);
198#endif
195 199
196static inline int __deprecated check_region(resource_size_t s, 200static inline int __deprecated check_region(resource_size_t s,
197 resource_size_t n) 201 resource_size_t n)
diff --git a/include/linux/ipack.h b/include/linux/ipack.h
index fea12cbb2aeb..1888e06ddf64 100644
--- a/include/linux/ipack.h
+++ b/include/linux/ipack.h
@@ -207,19 +207,41 @@ int ipack_driver_register(struct ipack_driver *edrv, struct module *owner,
207void ipack_driver_unregister(struct ipack_driver *edrv); 207void ipack_driver_unregister(struct ipack_driver *edrv);
208 208
209/** 209/**
210 * ipack_device_register -- register an IPack device with the kernel 210 * ipack_device_init -- initialize an IPack device
211 * @dev: the new device to register. 211 * @dev: the new device to initialize.
212 * 212 *
213 * Register a new IPack device ("module" in IndustryPack jargon). The call 213 * Initialize a new IPack device ("module" in IndustryPack jargon). The call
214 * is done by the carrier driver. The carrier should populate the fields 214 * is done by the carrier driver. The carrier should populate the fields
215 * bus and slot as well as the region array of @dev prior to calling this 215 * bus and slot as well as the region array of @dev prior to calling this
216 * function. The rest of the fields will be allocated and populated 216 * function. The rest of the fields will be allocated and populated
217 * during registration. 217 * during initalization.
218 * 218 *
219 * Return zero on success or error code on failure. 219 * Return zero on success or error code on failure.
220 *
221 * NOTE: _Never_ directly free @dev after calling this function, even
222 * if it returned an error! Always use ipack_put_device() to give up the
223 * reference initialized in this function instead.
224 */
225int ipack_device_init(struct ipack_device *dev);
226
227/**
228 * ipack_device_add -- Add an IPack device
229 * @dev: the new device to add.
230 *
231 * Add a new IPack device. The call is done by the carrier driver
232 * after calling ipack_device_init().
233 *
234 * Return zero on success or error code on failure.
235 *
236 * NOTE: _Never_ directly free @dev after calling this function, even
237 * if it returned an error! Always use ipack_put_device() to give up the
238 * reference initialized in this function instead.
220 */ 239 */
221int ipack_device_register(struct ipack_device *dev); 240int ipack_device_add(struct ipack_device *dev);
222void ipack_device_unregister(struct ipack_device *dev); 241void ipack_device_del(struct ipack_device *dev);
242
243void ipack_get_device(struct ipack_device *dev);
244void ipack_put_device(struct ipack_device *dev);
223 245
224/** 246/**
225 * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table 247 * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index ae221a7b5092..c4d870b0d5e6 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -43,8 +43,8 @@ struct ipc_namespace {
43 43
44 size_t shm_ctlmax; 44 size_t shm_ctlmax;
45 size_t shm_ctlall; 45 size_t shm_ctlall;
46 unsigned long shm_tot;
46 int shm_ctlmni; 47 int shm_ctlmni;
47 int shm_tot;
48 /* 48 /*
49 * Defines whether IPC_RMID is forced for _all_ shm segments regardless 49 * Defines whether IPC_RMID is forced for _all_ shm segments regardless
50 * of shmctl() 50 * of shmctl()
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 3fd8e4290a1c..3e203eb23cc7 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -65,7 +65,6 @@ extern struct irq_chip gic_arch_extn;
65 65
66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, 66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
67 u32 offset, struct device_node *); 67 u32 offset, struct device_node *);
68void gic_secondary_init(unsigned int);
69void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 68void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
70 69
71static inline void gic_init(unsigned int nr, int start, 70static inline void gic_init(unsigned int nr, int start,
diff --git a/include/linux/irqchip/chained_irq.h b/include/linux/irqchip/chained_irq.h
new file mode 100644
index 000000000000..adf4c30f3af6
--- /dev/null
+++ b/include/linux/irqchip/chained_irq.h
@@ -0,0 +1,52 @@
1/*
2 * Chained IRQ handlers support.
3 *
4 * Copyright (C) 2011 ARM Ltd.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef __IRQCHIP_CHAINED_IRQ_H
19#define __IRQCHIP_CHAINED_IRQ_H
20
21#include <linux/irq.h>
22
23/*
24 * Entry/exit functions for chained handlers where the primary IRQ chip
25 * may implement either fasteoi or level-trigger flow control.
26 */
27static inline void chained_irq_enter(struct irq_chip *chip,
28 struct irq_desc *desc)
29{
30 /* FastEOI controllers require no action on entry. */
31 if (chip->irq_eoi)
32 return;
33
34 if (chip->irq_mask_ack) {
35 chip->irq_mask_ack(&desc->irq_data);
36 } else {
37 chip->irq_mask(&desc->irq_data);
38 if (chip->irq_ack)
39 chip->irq_ack(&desc->irq_data);
40 }
41}
42
43static inline void chained_irq_exit(struct irq_chip *chip,
44 struct irq_desc *desc)
45{
46 if (chip->irq_eoi)
47 chip->irq_eoi(&desc->irq_data);
48 else
49 chip->irq_unmask(&desc->irq_data);
50}
51
52#endif /* __IRQCHIP_CHAINED_IRQ_H */
diff --git a/include/linux/irqchip/mxs.h b/include/linux/irqchip/mxs.h
new file mode 100644
index 000000000000..9039a538a919
--- /dev/null
+++ b/include/linux/irqchip/mxs.h
@@ -0,0 +1,14 @@
1/*
2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_IRQCHIP_MXS_H
10#define __LINUX_IRQCHIP_MXS_H
11
12extern void icoll_handle_irq(struct pt_regs *);
13
14#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c8f32975f0e4..7e0b622503c4 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -887,7 +887,7 @@ extern struct kmem_cache *jbd_handle_cache;
887 887
888static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) 888static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
889{ 889{
890 return kmem_cache_alloc(jbd_handle_cache, gfp_flags); 890 return kmem_cache_zalloc(jbd_handle_cache, gfp_flags);
891} 891}
892 892
893static inline void jbd_free_handle(handle_t *handle) 893static inline void jbd_free_handle(handle_t *handle)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 50e5a5e6a712..6e051f472edb 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -480,6 +480,7 @@ struct transaction_s
480 T_COMMIT, 480 T_COMMIT,
481 T_COMMIT_DFLUSH, 481 T_COMMIT_DFLUSH,
482 T_COMMIT_JFLUSH, 482 T_COMMIT_JFLUSH,
483 T_COMMIT_CALLBACK,
483 T_FINISHED 484 T_FINISHED
484 } t_state; 485 } t_state;
485 486
@@ -1144,7 +1145,7 @@ extern struct kmem_cache *jbd2_handle_cache;
1144 1145
1145static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags) 1146static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags)
1146{ 1147{
1147 return kmem_cache_alloc(jbd2_handle_cache, gfp_flags); 1148 return kmem_cache_zalloc(jbd2_handle_cache, gfp_flags);
1148} 1149}
1149 1150
1150static inline void jbd2_free_handle(handle_t *handle) 1151static inline void jbd2_free_handle(handle_t *handle)
@@ -1200,6 +1201,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
1200int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); 1201int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1201int jbd2_journal_force_commit_nested(journal_t *journal); 1202int jbd2_journal_force_commit_nested(journal_t *journal);
1202int jbd2_log_wait_commit(journal_t *journal, tid_t tid); 1203int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1204int jbd2_complete_transaction(journal_t *journal, tid_t tid);
1203int jbd2_log_do_checkpoint(journal_t *journal); 1205int jbd2_log_do_checkpoint(journal_t *journal);
1204int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid); 1206int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
1205 1207
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 82ed068b1ebe..8fb8edf12417 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -75,7 +75,6 @@ extern int register_refined_jiffies(long clock_tick_rate);
75 */ 75 */
76extern u64 __jiffy_data jiffies_64; 76extern u64 __jiffy_data jiffies_64;
77extern unsigned long volatile __jiffy_data jiffies; 77extern unsigned long volatile __jiffy_data jiffies;
78extern seqlock_t jiffies_lock;
79 78
80#if (BITS_PER_LONG < 64) 79#if (BITS_PER_LONG < 64)
81u64 get_jiffies_64(void); 80u64 get_jiffies_64(void);
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index c18b46f8aeeb..98cd41bb39c8 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -30,6 +30,10 @@ struct journal_head {
30 30
31 /* 31 /*
32 * Journalling list for this buffer [jbd_lock_bh_state()] 32 * Journalling list for this buffer [jbd_lock_bh_state()]
33 * NOTE: We *cannot* combine this with b_modified into a bitfield
34 * as gcc would then (which the C standard allows but which is
35 * very unuseful) make 64-bit accesses to the bitfield and clobber
36 * b_jcount if its update races with bitfield modification.
33 */ 37 */
34 unsigned b_jlist; 38 unsigned b_jlist;
35 39
@@ -41,13 +45,6 @@ struct journal_head {
41 unsigned b_modified; 45 unsigned b_modified;
42 46
43 /* 47 /*
44 * This feild tracks the last transaction id in which this buffer
45 * has been cowed
46 * [jbd_lock_bh_state()]
47 */
48 tid_t b_cow_tid;
49
50 /*
51 * Copy of the buffer data frozen for writing to the log. 48 * Copy of the buffer data frozen for writing to the log.
52 * [jbd_lock_bh_state()] 49 * [jbd_lock_bh_state()]
53 */ 50 */
diff --git a/include/linux/kcore.h b/include/linux/kcore.h
new file mode 100644
index 000000000000..d92762286645
--- /dev/null
+++ b/include/linux/kcore.h
@@ -0,0 +1,38 @@
1/*
2 * /proc/kcore definitions
3 */
4#ifndef _LINUX_KCORE_H
5#define _LINUX_KCORE_H
6
7enum kcore_type {
8 KCORE_TEXT,
9 KCORE_VMALLOC,
10 KCORE_RAM,
11 KCORE_VMEMMAP,
12 KCORE_OTHER,
13};
14
15struct kcore_list {
16 struct list_head list;
17 unsigned long addr;
18 size_t size;
19 int type;
20};
21
22struct vmcore {
23 struct list_head list;
24 unsigned long long paddr;
25 unsigned long long size;
26 loff_t offset;
27};
28
29#ifdef CONFIG_PROC_KCORE
30extern void kclist_add(struct kcore_list *, void *, size_t, int type);
31#else
32static inline
33void kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
34{
35}
36#endif
37
38#endif /* _LINUX_KCORE_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 79fdd80a42d4..e9ef6d6b51d5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -486,6 +486,8 @@ enum ftrace_dump_mode {
486void tracing_on(void); 486void tracing_on(void);
487void tracing_off(void); 487void tracing_off(void);
488int tracing_is_on(void); 488int tracing_is_on(void);
489void tracing_snapshot(void);
490void tracing_snapshot_alloc(void);
489 491
490extern void tracing_start(void); 492extern void tracing_start(void);
491extern void tracing_stop(void); 493extern void tracing_stop(void);
@@ -515,10 +517,32 @@ do { \
515 * 517 *
516 * This is intended as a debugging tool for the developer only. 518 * This is intended as a debugging tool for the developer only.
517 * Please refrain from leaving trace_printks scattered around in 519 * Please refrain from leaving trace_printks scattered around in
518 * your code. 520 * your code. (Extra memory is used for special buffers that are
521 * allocated when trace_printk() is used)
522 *
523 * A little optization trick is done here. If there's only one
524 * argument, there's no need to scan the string for printf formats.
525 * The trace_puts() will suffice. But how can we take advantage of
526 * using trace_puts() when trace_printk() has only one argument?
527 * By stringifying the args and checking the size we can tell
528 * whether or not there are args. __stringify((__VA_ARGS__)) will
529 * turn into "()\0" with a size of 3 when there are no args, anything
530 * else will be bigger. All we need to do is define a string to this,
531 * and then take its size and compare to 3. If it's bigger, use
532 * do_trace_printk() otherwise, optimize it to trace_puts(). Then just
533 * let gcc optimize the rest.
519 */ 534 */
520 535
521#define trace_printk(fmt, args...) \ 536#define trace_printk(fmt, ...) \
537do { \
538 char _______STR[] = __stringify((__VA_ARGS__)); \
539 if (sizeof(_______STR) > 3) \
540 do_trace_printk(fmt, ##__VA_ARGS__); \
541 else \
542 trace_puts(fmt); \
543} while (0)
544
545#define do_trace_printk(fmt, args...) \
522do { \ 546do { \
523 static const char *trace_printk_fmt \ 547 static const char *trace_printk_fmt \
524 __attribute__((section("__trace_printk_fmt"))) = \ 548 __attribute__((section("__trace_printk_fmt"))) = \
@@ -538,7 +562,46 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
538extern __printf(2, 3) 562extern __printf(2, 3)
539int __trace_printk(unsigned long ip, const char *fmt, ...); 563int __trace_printk(unsigned long ip, const char *fmt, ...);
540 564
541extern void trace_dump_stack(void); 565extern int __trace_bputs(unsigned long ip, const char *str);
566extern int __trace_puts(unsigned long ip, const char *str, int size);
567
568/**
569 * trace_puts - write a string into the ftrace buffer
570 * @str: the string to record
571 *
572 * Note: __trace_bputs is an internal function for trace_puts and
573 * the @ip is passed in via the trace_puts macro.
574 *
575 * This is similar to trace_printk() but is made for those really fast
576 * paths that a developer wants the least amount of "Heisenbug" affects,
577 * where the processing of the print format is still too much.
578 *
579 * This function allows a kernel developer to debug fast path sections
580 * that printk is not appropriate for. By scattering in various
581 * printk like tracing in the code, a developer can quickly see
582 * where problems are occurring.
583 *
584 * This is intended as a debugging tool for the developer only.
585 * Please refrain from leaving trace_puts scattered around in
586 * your code. (Extra memory is used for special buffers that are
587 * allocated when trace_puts() is used)
588 *
589 * Returns: 0 if nothing was written, positive # if string was.
590 * (1 when __trace_bputs is used, strlen(str) when __trace_puts is used)
591 */
592
593#define trace_puts(str) ({ \
594 static const char *trace_printk_fmt \
595 __attribute__((section("__trace_printk_fmt"))) = \
596 __builtin_constant_p(str) ? str : NULL; \
597 \
598 if (__builtin_constant_p(str)) \
599 __trace_bputs(_THIS_IP_, trace_printk_fmt); \
600 else \
601 __trace_puts(_THIS_IP_, str, strlen(str)); \
602})
603
604extern void trace_dump_stack(int skip);
542 605
543/* 606/*
544 * The double __builtin_constant_p is because gcc will give us an error 607 * The double __builtin_constant_p is because gcc will give us an error
@@ -573,6 +636,8 @@ static inline void trace_dump_stack(void) { }
573static inline void tracing_on(void) { } 636static inline void tracing_on(void) { }
574static inline void tracing_off(void) { } 637static inline void tracing_off(void) { }
575static inline int tracing_is_on(void) { return 0; } 638static inline int tracing_is_on(void) { return 0; }
639static inline void tracing_snapshot(void) { }
640static inline void tracing_snapshot_alloc(void) { }
576 641
577static inline __printf(1, 2) 642static inline __printf(1, 2)
578int trace_printk(const char *fmt, ...) 643int trace_printk(const char *fmt, ...)
@@ -722,18 +787,9 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
722/* Trap pasters of __FUNCTION__ at compile-time */ 787/* Trap pasters of __FUNCTION__ at compile-time */
723#define __FUNCTION__ (__func__) 788#define __FUNCTION__ (__func__)
724 789
725/* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */
726#ifdef CONFIG_SYMBOL_PREFIX
727#define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
728#else
729#define SYMBOL_PREFIX ""
730#endif
731
732/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ 790/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
733#ifdef CONFIG_FTRACE_MCOUNT_RECORD 791#ifdef CONFIG_FTRACE_MCOUNT_RECORD
734# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 792# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
735#endif 793#endif
736 794
737extern int do_sysinfo(struct sysinfo *info);
738
739#endif 795#endif
diff --git a/include/linux/kmalloc_sizes.h b/include/linux/kmalloc_sizes.h
deleted file mode 100644
index e576b848ce10..000000000000
--- a/include/linux/kmalloc_sizes.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#if (PAGE_SIZE == 4096)
2 CACHE(32)
3#endif
4 CACHE(64)
5#if L1_CACHE_BYTES < 64
6 CACHE(96)
7#endif
8 CACHE(128)
9#if L1_CACHE_BYTES < 128
10 CACHE(192)
11#endif
12 CACHE(256)
13 CACHE(512)
14 CACHE(1024)
15 CACHE(2048)
16 CACHE(4096)
17 CACHE(8192)
18 CACHE(16384)
19 CACHE(32768)
20 CACHE(65536)
21 CACHE(131072)
22#if KMALLOC_MAX_SIZE >= 262144
23 CACHE(262144)
24#endif
25#if KMALLOC_MAX_SIZE >= 524288
26 CACHE(524288)
27#endif
28#if KMALLOC_MAX_SIZE >= 1048576
29 CACHE(1048576)
30#endif
31#if KMALLOC_MAX_SIZE >= 2097152
32 CACHE(2097152)
33#endif
34#if KMALLOC_MAX_SIZE >= 4194304
35 CACHE(4194304)
36#endif
37#if KMALLOC_MAX_SIZE >= 8388608
38 CACHE(8388608)
39#endif
40#if KMALLOC_MAX_SIZE >= 16777216
41 CACHE(16777216)
42#endif
43#if KMALLOC_MAX_SIZE >= 33554432
44 CACHE(33554432)
45#endif
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 5398d5807075..0555cc66a15b 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -67,16 +67,15 @@ struct subprocess_info {
67}; 67};
68 68
69extern int 69extern int
70call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, 70call_usermodehelper(char *path, char **argv, char **envp, int wait);
71 int (*init)(struct subprocess_info *info, struct cred *new),
72 void (*cleanup)(struct subprocess_info *), void *data);
73 71
74static inline int 72extern struct subprocess_info *
75call_usermodehelper(char *path, char **argv, char **envp, int wait) 73call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask,
76{ 74 int (*init)(struct subprocess_info *info, struct cred *new),
77 return call_usermodehelper_fns(path, argv, envp, wait, 75 void (*cleanup)(struct subprocess_info *), void *data);
78 NULL, NULL, NULL); 76
79} 77extern int
78call_usermodehelper_exec(struct subprocess_info *info, int wait);
80 79
81extern struct ctl_table usermodehelper_table[]; 80extern struct ctl_table usermodehelper_table[];
82 81
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 4b6ef4d33cc2..ca1d27a0d6a6 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -29,6 +29,7 @@
29 * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi 29 * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi
30 * <prasanna@in.ibm.com> added function-return probes. 30 * <prasanna@in.ibm.com> added function-return probes.
31 */ 31 */
32#include <linux/compiler.h> /* for __kprobes */
32#include <linux/linkage.h> 33#include <linux/linkage.h>
33#include <linux/list.h> 34#include <linux/list.h>
34#include <linux/notifier.h> 35#include <linux/notifier.h>
@@ -49,16 +50,11 @@
49#define KPROBE_REENTER 0x00000004 50#define KPROBE_REENTER 0x00000004
50#define KPROBE_HIT_SSDONE 0x00000008 51#define KPROBE_HIT_SSDONE 0x00000008
51 52
52/* Attach to insert probes on any functions which should be ignored*/
53#define __kprobes __attribute__((__section__(".kprobes.text")))
54
55#else /* CONFIG_KPROBES */ 53#else /* CONFIG_KPROBES */
56typedef int kprobe_opcode_t; 54typedef int kprobe_opcode_t;
57struct arch_specific_insn { 55struct arch_specific_insn {
58 int dummy; 56 int dummy;
59}; 57};
60#define __kprobes
61
62#endif /* CONFIG_KPROBES */ 58#endif /* CONFIG_KPROBES */
63 59
64struct kprobe; 60struct kprobe;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 4972e6e9ca93..484604d184be 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -19,6 +19,7 @@
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/spinlock.h>
22 23
23struct kref { 24struct kref {
24 atomic_t refcount; 25 atomic_t refcount;
@@ -39,8 +40,11 @@ static inline void kref_init(struct kref *kref)
39 */ 40 */
40static inline void kref_get(struct kref *kref) 41static inline void kref_get(struct kref *kref)
41{ 42{
42 WARN_ON(!atomic_read(&kref->refcount)); 43 /* If refcount was 0 before incrementing then we have a race
43 atomic_inc(&kref->refcount); 44 * condition when this kref is freeing by some other thread right now.
45 * In this case one should use kref_get_unless_zero()
46 */
47 WARN_ON_ONCE(atomic_inc_return(&kref->refcount) < 2);
44} 48}
45 49
46/** 50/**
@@ -95,12 +99,44 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)
95 return kref_sub(kref, 1, release); 99 return kref_sub(kref, 1, release);
96} 100}
97 101
102/**
103 * kref_put_spinlock_irqsave - decrement refcount for object.
104 * @kref: object.
105 * @release: pointer to the function that will clean up the object when the
106 * last reference to the object is released.
107 * This pointer is required, and it is not acceptable to pass kfree
108 * in as this function.
109 * @lock: lock to take in release case
110 *
111 * Behaves identical to kref_put with one exception. If the reference count
112 * drops to zero, the lock will be taken atomically wrt dropping the reference
113 * count. The release function has to call spin_unlock() without _irqrestore.
114 */
115static inline int kref_put_spinlock_irqsave(struct kref *kref,
116 void (*release)(struct kref *kref),
117 spinlock_t *lock)
118{
119 unsigned long flags;
120
121 WARN_ON(release == NULL);
122 if (atomic_add_unless(&kref->refcount, -1, 1))
123 return 0;
124 spin_lock_irqsave(lock, flags);
125 if (atomic_dec_and_test(&kref->refcount)) {
126 release(kref);
127 local_irq_restore(flags);
128 return 1;
129 }
130 spin_unlock_irqrestore(lock, flags);
131 return 0;
132}
133
98static inline int kref_put_mutex(struct kref *kref, 134static inline int kref_put_mutex(struct kref *kref,
99 void (*release)(struct kref *kref), 135 void (*release)(struct kref *kref),
100 struct mutex *lock) 136 struct mutex *lock)
101{ 137{
102 WARN_ON(release == NULL); 138 WARN_ON(release == NULL);
103 if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { 139 if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) {
104 mutex_lock(lock); 140 mutex_lock(lock);
105 if (unlikely(!atomic_dec_and_test(&kref->refcount))) { 141 if (unlikely(!atomic_dec_and_test(&kref->refcount))) {
106 mutex_unlock(lock); 142 mutex_unlock(lock);
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 8d816646f766..7dcef3317689 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -43,6 +43,7 @@ bool kthread_should_stop(void);
43bool kthread_should_park(void); 43bool kthread_should_park(void);
44bool kthread_freezable_should_stop(bool *was_frozen); 44bool kthread_freezable_should_stop(bool *was_frozen);
45void *kthread_data(struct task_struct *k); 45void *kthread_data(struct task_struct *k);
46void *probe_kthread_data(struct task_struct *k);
46int kthread_park(struct task_struct *k); 47int kthread_park(struct task_struct *k);
47void kthread_unpark(struct task_struct *k); 48void kthread_unpark(struct task_struct *k);
48void kthread_parkme(void); 49void kthread_parkme(void);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index e83512f63df5..bbca12804d12 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -330,6 +330,24 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
330 330
331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
332 332
333/**
334 * ktime_to_timespec_cond - convert a ktime_t variable to timespec
335 * format only if the variable contains data
336 * @kt: the ktime_t variable to convert
337 * @ts: the timespec variable to store the result in
338 *
339 * Returns true if there was a successful conversion, false if kt was 0.
340 */
341static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts)
342{
343 if (kt.tv64) {
344 *ts = ktime_to_timespec(kt);
345 return true;
346 } else {
347 return false;
348 }
349}
350
333/* 351/*
334 * The resolution of the clocks. The resolution value is returned in 352 * The resolution of the clocks. The resolution value is returned in
335 * the clock_getres() system call to give application programmers an 353 * the clock_getres() system call to give application programmers an
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c13958251927..f0eea07d2c2b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -117,14 +117,13 @@ static inline bool is_error_page(struct page *page)
117#define KVM_REQ_APF_HALT 12 117#define KVM_REQ_APF_HALT 12
118#define KVM_REQ_STEAL_UPDATE 13 118#define KVM_REQ_STEAL_UPDATE 13
119#define KVM_REQ_NMI 14 119#define KVM_REQ_NMI 14
120#define KVM_REQ_IMMEDIATE_EXIT 15 120#define KVM_REQ_PMU 15
121#define KVM_REQ_PMU 16 121#define KVM_REQ_PMI 16
122#define KVM_REQ_PMI 17 122#define KVM_REQ_WATCHDOG 17
123#define KVM_REQ_WATCHDOG 18 123#define KVM_REQ_MASTERCLOCK_UPDATE 18
124#define KVM_REQ_MASTERCLOCK_UPDATE 19 124#define KVM_REQ_MCLOCK_INPROGRESS 19
125#define KVM_REQ_MCLOCK_INPROGRESS 20 125#define KVM_REQ_EPR_EXIT 20
126#define KVM_REQ_EPR_EXIT 21 126#define KVM_REQ_SCAN_IOAPIC 21
127#define KVM_REQ_EOIBITMAP 22
128 127
129#define KVM_USERSPACE_IRQ_SOURCE_ID 0 128#define KVM_USERSPACE_IRQ_SOURCE_ID 0
130#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 129#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -133,6 +132,9 @@ struct kvm;
133struct kvm_vcpu; 132struct kvm_vcpu;
134extern struct kmem_cache *kvm_vcpu_cache; 133extern struct kmem_cache *kvm_vcpu_cache;
135 134
135extern raw_spinlock_t kvm_lock;
136extern struct list_head vm_list;
137
136struct kvm_io_range { 138struct kvm_io_range {
137 gpa_t addr; 139 gpa_t addr;
138 int len; 140 int len;
@@ -149,6 +151,7 @@ struct kvm_io_bus {
149enum kvm_bus { 151enum kvm_bus {
150 KVM_MMIO_BUS, 152 KVM_MMIO_BUS,
151 KVM_PIO_BUS, 153 KVM_PIO_BUS,
154 KVM_VIRTIO_CCW_NOTIFY_BUS,
152 KVM_NR_BUSES 155 KVM_NR_BUSES
153}; 156};
154 157
@@ -252,6 +255,7 @@ struct kvm_vcpu {
252 bool dy_eligible; 255 bool dy_eligible;
253 } spin_loop; 256 } spin_loop;
254#endif 257#endif
258 bool preempted;
255 struct kvm_vcpu_arch arch; 259 struct kvm_vcpu_arch arch;
256}; 260};
257 261
@@ -285,7 +289,8 @@ struct kvm_kernel_irq_routing_entry {
285 u32 gsi; 289 u32 gsi;
286 u32 type; 290 u32 type;
287 int (*set)(struct kvm_kernel_irq_routing_entry *e, 291 int (*set)(struct kvm_kernel_irq_routing_entry *e,
288 struct kvm *kvm, int irq_source_id, int level); 292 struct kvm *kvm, int irq_source_id, int level,
293 bool line_status);
289 union { 294 union {
290 struct { 295 struct {
291 unsigned irqchip; 296 unsigned irqchip;
@@ -296,10 +301,10 @@ struct kvm_kernel_irq_routing_entry {
296 struct hlist_node link; 301 struct hlist_node link;
297}; 302};
298 303
299#ifdef __KVM_HAVE_IOAPIC 304#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
300 305
301struct kvm_irq_routing_table { 306struct kvm_irq_routing_table {
302 int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS]; 307 int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
303 struct kvm_kernel_irq_routing_entry *rt_entries; 308 struct kvm_kernel_irq_routing_entry *rt_entries;
304 u32 nr_rt_entries; 309 u32 nr_rt_entries;
305 /* 310 /*
@@ -385,6 +390,7 @@ struct kvm {
385 long mmu_notifier_count; 390 long mmu_notifier_count;
386#endif 391#endif
387 long tlbs_dirty; 392 long tlbs_dirty;
393 struct list_head devices;
388}; 394};
389 395
390#define kvm_err(fmt, ...) \ 396#define kvm_err(fmt, ...) \
@@ -424,6 +430,19 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
424int __must_check vcpu_load(struct kvm_vcpu *vcpu); 430int __must_check vcpu_load(struct kvm_vcpu *vcpu);
425void vcpu_put(struct kvm_vcpu *vcpu); 431void vcpu_put(struct kvm_vcpu *vcpu);
426 432
433#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
434int kvm_irqfd_init(void);
435void kvm_irqfd_exit(void);
436#else
437static inline int kvm_irqfd_init(void)
438{
439 return 0;
440}
441
442static inline void kvm_irqfd_exit(void)
443{
444}
445#endif
427int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, 446int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
428 struct module *module); 447 struct module *module);
429void kvm_exit(void); 448void kvm_exit(void);
@@ -452,24 +471,39 @@ id_to_memslot(struct kvm_memslots *slots, int id)
452 return slot; 471 return slot;
453} 472}
454 473
474/*
475 * KVM_SET_USER_MEMORY_REGION ioctl allows the following operations:
476 * - create a new memory slot
477 * - delete an existing memory slot
478 * - modify an existing memory slot
479 * -- move it in the guest physical memory space
480 * -- just change its flags
481 *
482 * Since flags can be changed by some of these operations, the following
483 * differentiation is the best we can do for __kvm_set_memory_region():
484 */
485enum kvm_mr_change {
486 KVM_MR_CREATE,
487 KVM_MR_DELETE,
488 KVM_MR_MOVE,
489 KVM_MR_FLAGS_ONLY,
490};
491
455int kvm_set_memory_region(struct kvm *kvm, 492int kvm_set_memory_region(struct kvm *kvm,
456 struct kvm_userspace_memory_region *mem, 493 struct kvm_userspace_memory_region *mem);
457 bool user_alloc);
458int __kvm_set_memory_region(struct kvm *kvm, 494int __kvm_set_memory_region(struct kvm *kvm,
459 struct kvm_userspace_memory_region *mem, 495 struct kvm_userspace_memory_region *mem);
460 bool user_alloc);
461void kvm_arch_free_memslot(struct kvm_memory_slot *free, 496void kvm_arch_free_memslot(struct kvm_memory_slot *free,
462 struct kvm_memory_slot *dont); 497 struct kvm_memory_slot *dont);
463int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 498int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
464int kvm_arch_prepare_memory_region(struct kvm *kvm, 499int kvm_arch_prepare_memory_region(struct kvm *kvm,
465 struct kvm_memory_slot *memslot, 500 struct kvm_memory_slot *memslot,
466 struct kvm_memory_slot old,
467 struct kvm_userspace_memory_region *mem, 501 struct kvm_userspace_memory_region *mem,
468 bool user_alloc); 502 enum kvm_mr_change change);
469void kvm_arch_commit_memory_region(struct kvm *kvm, 503void kvm_arch_commit_memory_region(struct kvm *kvm,
470 struct kvm_userspace_memory_region *mem, 504 struct kvm_userspace_memory_region *mem,
471 struct kvm_memory_slot old, 505 const struct kvm_memory_slot *old,
472 bool user_alloc); 506 enum kvm_mr_change change);
473bool kvm_largepages_enabled(void); 507bool kvm_largepages_enabled(void);
474void kvm_disable_largepages(void); 508void kvm_disable_largepages(void);
475/* flush all memory translations */ 509/* flush all memory translations */
@@ -539,7 +573,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
539void kvm_flush_remote_tlbs(struct kvm *kvm); 573void kvm_flush_remote_tlbs(struct kvm *kvm);
540void kvm_reload_remote_mmus(struct kvm *kvm); 574void kvm_reload_remote_mmus(struct kvm *kvm);
541void kvm_make_mclock_inprogress_request(struct kvm *kvm); 575void kvm_make_mclock_inprogress_request(struct kvm *kvm);
542void kvm_make_update_eoibitmap_request(struct kvm *kvm); 576void kvm_make_scan_ioapic_request(struct kvm *kvm);
543 577
544long kvm_arch_dev_ioctl(struct file *filp, 578long kvm_arch_dev_ioctl(struct file *filp,
545 unsigned int ioctl, unsigned long arg); 579 unsigned int ioctl, unsigned long arg);
@@ -555,10 +589,9 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
555 struct kvm_dirty_log *log); 589 struct kvm_dirty_log *log);
556 590
557int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, 591int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
558 struct 592 struct kvm_userspace_memory_region *mem);
559 kvm_userspace_memory_region *mem, 593int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
560 bool user_alloc); 594 bool line_status);
561int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level);
562long kvm_arch_vm_ioctl(struct file *filp, 595long kvm_arch_vm_ioctl(struct file *filp,
563 unsigned int ioctl, unsigned long arg); 596 unsigned int ioctl, unsigned long arg);
564 597
@@ -632,7 +665,6 @@ static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
632 665
633int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); 666int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
634void kvm_arch_destroy_vm(struct kvm *kvm); 667void kvm_arch_destroy_vm(struct kvm *kvm);
635void kvm_free_all_assigned_devices(struct kvm *kvm);
636void kvm_arch_sync_events(struct kvm *kvm); 668void kvm_arch_sync_events(struct kvm *kvm);
637 669
638int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 670int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
@@ -684,15 +716,11 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
684void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, 716void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
685 bool mask); 717 bool mask);
686 718
687#ifdef __KVM_HAVE_IOAPIC 719int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
688void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, 720 bool line_status);
689 union kvm_ioapic_redirect_entry *entry,
690 unsigned long *deliver_bitmask);
691#endif
692int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level);
693int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); 721int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
694int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, 722int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
695 int irq_source_id, int level); 723 int irq_source_id, int level, bool line_status);
696bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin); 724bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin);
697void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 725void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
698void kvm_register_irq_ack_notifier(struct kvm *kvm, 726void kvm_register_irq_ack_notifier(struct kvm *kvm,
@@ -705,7 +733,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
705/* For vcpu->arch.iommu_flags */ 733/* For vcpu->arch.iommu_flags */
706#define KVM_IOMMU_CACHE_COHERENCY 0x1 734#define KVM_IOMMU_CACHE_COHERENCY 0x1
707 735
708#ifdef CONFIG_IOMMU_API 736#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
709int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 737int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
710void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 738void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
711int kvm_iommu_map_guest(struct kvm *kvm); 739int kvm_iommu_map_guest(struct kvm *kvm);
@@ -714,7 +742,7 @@ int kvm_assign_device(struct kvm *kvm,
714 struct kvm_assigned_dev_kernel *assigned_dev); 742 struct kvm_assigned_dev_kernel *assigned_dev);
715int kvm_deassign_device(struct kvm *kvm, 743int kvm_deassign_device(struct kvm *kvm,
716 struct kvm_assigned_dev_kernel *assigned_dev); 744 struct kvm_assigned_dev_kernel *assigned_dev);
717#else /* CONFIG_IOMMU_API */ 745#else
718static inline int kvm_iommu_map_pages(struct kvm *kvm, 746static inline int kvm_iommu_map_pages(struct kvm *kvm,
719 struct kvm_memory_slot *slot) 747 struct kvm_memory_slot *slot)
720{ 748{
@@ -726,28 +754,11 @@ static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
726{ 754{
727} 755}
728 756
729static inline int kvm_iommu_map_guest(struct kvm *kvm)
730{
731 return -ENODEV;
732}
733
734static inline int kvm_iommu_unmap_guest(struct kvm *kvm) 757static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
735{ 758{
736 return 0; 759 return 0;
737} 760}
738 761#endif
739static inline int kvm_assign_device(struct kvm *kvm,
740 struct kvm_assigned_dev_kernel *assigned_dev)
741{
742 return 0;
743}
744
745static inline int kvm_deassign_device(struct kvm *kvm,
746 struct kvm_assigned_dev_kernel *assigned_dev)
747{
748 return 0;
749}
750#endif /* CONFIG_IOMMU_API */
751 762
752static inline void __guest_enter(void) 763static inline void __guest_enter(void)
753{ 764{
@@ -921,7 +932,7 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
921} 932}
922#endif 933#endif
923 934
924#ifdef KVM_CAP_IRQ_ROUTING 935#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
925 936
926#define KVM_MAX_IRQ_ROUTES 1024 937#define KVM_MAX_IRQ_ROUTES 1024
927 938
@@ -930,6 +941,9 @@ int kvm_set_irq_routing(struct kvm *kvm,
930 const struct kvm_irq_routing_entry *entries, 941 const struct kvm_irq_routing_entry *entries,
931 unsigned nr, 942 unsigned nr,
932 unsigned flags); 943 unsigned flags);
944int kvm_set_routing_entry(struct kvm_irq_routing_table *rt,
945 struct kvm_kernel_irq_routing_entry *e,
946 const struct kvm_irq_routing_entry *ue);
933void kvm_free_irq_routing(struct kvm *kvm); 947void kvm_free_irq_routing(struct kvm *kvm);
934 948
935int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi); 949int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
@@ -998,11 +1012,13 @@ static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; }
998 1012
999#endif 1013#endif
1000 1014
1001#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 1015#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
1002 1016
1003long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, 1017long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
1004 unsigned long arg); 1018 unsigned long arg);
1005 1019
1020void kvm_free_all_assigned_devices(struct kvm *kvm);
1021
1006#else 1022#else
1007 1023
1008static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, 1024static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
@@ -1011,6 +1027,8 @@ static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
1011 return -ENOTTY; 1027 return -ENOTTY;
1012} 1028}
1013 1029
1030static inline void kvm_free_all_assigned_devices(struct kvm *kvm) {}
1031
1014#endif 1032#endif
1015 1033
1016static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) 1034static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
@@ -1028,6 +1046,46 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
1028 } 1046 }
1029} 1047}
1030 1048
1049extern bool kvm_rebooting;
1050
1051struct kvm_device_ops;
1052
1053struct kvm_device {
1054 struct kvm_device_ops *ops;
1055 struct kvm *kvm;
1056 void *private;
1057 struct list_head vm_node;
1058};
1059
1060/* create, destroy, and name are mandatory */
1061struct kvm_device_ops {
1062 const char *name;
1063 int (*create)(struct kvm_device *dev, u32 type);
1064
1065 /*
1066 * Destroy is responsible for freeing dev.
1067 *
1068 * Destroy may be called before or after destructors are called
1069 * on emulated I/O regions, depending on whether a reference is
1070 * held by a vcpu or other kvm component that gets destroyed
1071 * after the emulated I/O.
1072 */
1073 void (*destroy)(struct kvm_device *dev);
1074
1075 int (*set_attr)(struct kvm_device *dev, struct kvm_device_attr *attr);
1076 int (*get_attr)(struct kvm_device *dev, struct kvm_device_attr *attr);
1077 int (*has_attr)(struct kvm_device *dev, struct kvm_device_attr *attr);
1078 long (*ioctl)(struct kvm_device *dev, unsigned int ioctl,
1079 unsigned long arg);
1080};
1081
1082void kvm_device_get(struct kvm_device *dev);
1083void kvm_device_put(struct kvm_device *dev);
1084struct kvm_device *kvm_device_from_filp(struct file *filp);
1085
1086extern struct kvm_device_ops kvm_mpic_ops;
1087extern struct kvm_device_ops kvm_xics_ops;
1088
1031#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1089#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1032 1090
1033static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) 1091static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0d9b5eed714e..0287ab296689 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -142,6 +142,10 @@ extern void led_set_brightness(struct led_classdev *led_cdev,
142/* 142/*
143 * LED Triggers 143 * LED Triggers
144 */ 144 */
145/* Registration functions for simple triggers */
146#define DEFINE_LED_TRIGGER(x) static struct led_trigger *x;
147#define DEFINE_LED_TRIGGER_GLOBAL(x) struct led_trigger *x;
148
145#ifdef CONFIG_LEDS_TRIGGERS 149#ifdef CONFIG_LEDS_TRIGGERS
146 150
147#define TRIG_NAME_MAX 50 151#define TRIG_NAME_MAX 50
@@ -164,9 +168,6 @@ struct led_trigger {
164extern int led_trigger_register(struct led_trigger *trigger); 168extern int led_trigger_register(struct led_trigger *trigger);
165extern void led_trigger_unregister(struct led_trigger *trigger); 169extern void led_trigger_unregister(struct led_trigger *trigger);
166 170
167/* Registration functions for simple triggers */
168#define DEFINE_LED_TRIGGER(x) static struct led_trigger *x;
169#define DEFINE_LED_TRIGGER_GLOBAL(x) struct led_trigger *x;
170extern void led_trigger_register_simple(const char *name, 171extern void led_trigger_register_simple(const char *name,
171 struct led_trigger **trigger); 172 struct led_trigger **trigger);
172extern void led_trigger_unregister_simple(struct led_trigger *trigger); 173extern void led_trigger_unregister_simple(struct led_trigger *trigger);
@@ -199,20 +200,30 @@ extern void led_trigger_rename_static(const char *name,
199 200
200#else 201#else
201 202
202/* Triggers aren't active - null macros */ 203/* Trigger has no members */
203#define DEFINE_LED_TRIGGER(x) 204struct led_trigger {};
204#define DEFINE_LED_TRIGGER_GLOBAL(x)
205#define led_trigger_register_simple(x, y) do {} while(0)
206#define led_trigger_unregister_simple(x) do {} while(0)
207#define led_trigger_event(x, y) do {} while(0)
208 205
209#endif 206/* Trigger inline empty functions */
207static inline void led_trigger_register_simple(const char *name,
208 struct led_trigger **trigger) {}
209static inline void led_trigger_unregister_simple(struct led_trigger *trigger) {}
210static inline void led_trigger_event(struct led_trigger *trigger,
211 enum led_brightness event) {}
212#endif /* CONFIG_LEDS_TRIGGERS */
210 213
211/* Trigger specific functions */ 214/* Trigger specific functions */
212#ifdef CONFIG_LEDS_TRIGGER_IDE_DISK 215#ifdef CONFIG_LEDS_TRIGGER_IDE_DISK
213extern void ledtrig_ide_activity(void); 216extern void ledtrig_ide_activity(void);
214#else 217#else
215#define ledtrig_ide_activity() do {} while(0) 218static inline void ledtrig_ide_activity(void) {}
219#endif
220
221#if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE)
222extern void ledtrig_flash_ctrl(bool on);
223extern void ledtrig_torch_ctrl(bool on);
224#else
225static inline void ledtrig_flash_ctrl(bool on) {}
226static inline void ledtrig_torch_ctrl(bool on) {}
216#endif 227#endif
217 228
218/* 229/*
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 807f1e533226..d3e8ad23a8e0 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -2,6 +2,8 @@
2#define _LINUX_LINKAGE_H 2#define _LINUX_LINKAGE_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/stringify.h>
6#include <linux/export.h>
5#include <asm/linkage.h> 7#include <asm/linkage.h>
6 8
7#ifdef __cplusplus 9#ifdef __cplusplus
@@ -14,6 +16,20 @@
14#define asmlinkage CPP_ASMLINKAGE 16#define asmlinkage CPP_ASMLINKAGE
15#endif 17#endif
16 18
19#ifndef cond_syscall
20#define cond_syscall(x) asm( \
21 ".weak " VMLINUX_SYMBOL_STR(x) "\n\t" \
22 ".set " VMLINUX_SYMBOL_STR(x) "," \
23 VMLINUX_SYMBOL_STR(sys_ni_syscall))
24#endif
25
26#ifndef SYSCALL_ALIAS
27#define SYSCALL_ALIAS(alias, name) asm( \
28 ".globl " VMLINUX_SYMBOL_STR(alias) "\n\t" \
29 ".set " VMLINUX_SYMBOL_STR(alias) "," \
30 VMLINUX_SYMBOL_STR(name))
31#endif
32
17#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) 33#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
18#define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) 34#define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE)
19 35
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 31f9d75adc5b..2eb88556c5c5 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -125,6 +125,11 @@ static inline void hlist_bl_unlock(struct hlist_bl_head *b)
125 __bit_spin_unlock(0, (unsigned long *)b); 125 __bit_spin_unlock(0, (unsigned long *)b);
126} 126}
127 127
128static inline bool hlist_bl_is_locked(struct hlist_bl_head *b)
129{
130 return bit_spin_is_locked(0, (unsigned long *)b);
131}
132
128/** 133/**
129 * hlist_bl_for_each_entry - iterate over list of given type 134 * hlist_bl_for_each_entry - iterate over list of given type
130 * @tpos: the type * to use as a loop cursor. 135 * @tpos: the type * to use as a loop cursor.
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index 4019013c6593..46262284de47 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -256,6 +256,7 @@ extern void lc_destroy(struct lru_cache *lc);
256extern void lc_set(struct lru_cache *lc, unsigned int enr, int index); 256extern void lc_set(struct lru_cache *lc, unsigned int enr, int index);
257extern void lc_del(struct lru_cache *lc, struct lc_element *element); 257extern void lc_del(struct lru_cache *lc, struct lc_element *element);
258 258
259extern struct lc_element *lc_get_cumulative(struct lru_cache *lc, unsigned int enr);
259extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr); 260extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr);
260extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); 261extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr);
261extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); 262extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr);
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index efa1a6d7aca8..dba482e31a13 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -32,6 +32,20 @@ struct mbus_dram_target_info
32 } cs[4]; 32 } cs[4];
33}; 33};
34 34
35/* Flags for PCI/PCIe address decoding regions */
36#define MVEBU_MBUS_PCI_IO 0x1
37#define MVEBU_MBUS_PCI_MEM 0x2
38#define MVEBU_MBUS_PCI_WA 0x3
39
40/*
41 * Magic value that explicits that we don't need a remapping-capable
42 * address decoding window.
43 */
44#define MVEBU_MBUS_NO_REMAP (0xffffffff)
45
46/* Maximum size of a mbus window name */
47#define MVEBU_MBUS_MAX_WINNAME_SZ 32
48
35/* 49/*
36 * The Marvell mbus is to be found only on SOCs from the Orion family 50 * The Marvell mbus is to be found only on SOCs from the Orion family
37 * at the moment. Provide a dummy stub for other architectures. 51 * at the moment. Provide a dummy stub for other architectures.
@@ -44,4 +58,15 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
44 return NULL; 58 return NULL;
45} 59}
46#endif 60#endif
47#endif 61
62int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base,
63 size_t size, phys_addr_t remap,
64 unsigned int flags);
65int mvebu_mbus_add_window(const char *devname, phys_addr_t base,
66 size_t size);
67int mvebu_mbus_del_window(phys_addr_t base, size_t size);
68int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
69 size_t mbus_size, phys_addr_t sdram_phys_base,
70 size_t sdram_size);
71
72#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h
new file mode 100644
index 000000000000..d14af7b722ef
--- /dev/null
+++ b/include/linux/mei_cl_bus.h
@@ -0,0 +1,44 @@
1#ifndef _LINUX_MEI_CL_BUS_H
2#define _LINUX_MEI_CL_BUS_H
3
4#include <linux/device.h>
5#include <linux/uuid.h>
6
7struct mei_cl_device;
8
9struct mei_cl_driver {
10 struct device_driver driver;
11 const char *name;
12
13 const struct mei_cl_device_id *id_table;
14
15 int (*probe)(struct mei_cl_device *dev,
16 const struct mei_cl_device_id *id);
17 int (*remove)(struct mei_cl_device *dev);
18};
19
20int __mei_cl_driver_register(struct mei_cl_driver *driver,
21 struct module *owner);
22#define mei_cl_driver_register(driver) \
23 __mei_cl_driver_register(driver, THIS_MODULE)
24
25void mei_cl_driver_unregister(struct mei_cl_driver *driver);
26
27int mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length);
28int mei_cl_recv(struct mei_cl_device *device, u8 *buf, size_t length);
29
30typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device,
31 u32 events, void *context);
32int mei_cl_register_event_cb(struct mei_cl_device *device,
33 mei_cl_event_cb_t read_cb, void *context);
34
35#define MEI_CL_EVENT_RX 0
36#define MEI_CL_EVENT_TX 1
37
38void *mei_cl_get_drvdata(const struct mei_cl_device *device);
39void mei_cl_set_drvdata(struct mei_cl_device *device, void *data);
40
41int mei_cl_enable_device(struct mei_cl_device *device);
42int mei_cl_disable_device(struct mei_cl_device *device);
43
44#endif /* _LINUX_MEI_CL_BUS_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 45e93b468878..85c31a8e2904 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -18,6 +18,7 @@
18#include <linux/node.h> 18#include <linux/node.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/notifier.h>
21 22
22#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS) 23#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)
23 24
@@ -114,9 +115,10 @@ extern void unregister_memory_notifier(struct notifier_block *nb);
114extern int register_memory_isolate_notifier(struct notifier_block *nb); 115extern int register_memory_isolate_notifier(struct notifier_block *nb);
115extern void unregister_memory_isolate_notifier(struct notifier_block *nb); 116extern void unregister_memory_isolate_notifier(struct notifier_block *nb);
116extern int register_new_memory(int, struct mem_section *); 117extern int register_new_memory(int, struct mem_section *);
118#ifdef CONFIG_MEMORY_HOTREMOVE
117extern int unregister_memory_section(struct mem_section *); 119extern int unregister_memory_section(struct mem_section *);
120#endif
118extern int memory_dev_init(void); 121extern int memory_dev_init(void);
119extern int remove_memory_block(unsigned long, struct mem_section *, int);
120extern int memory_notify(unsigned long val, void *v); 122extern int memory_notify(unsigned long val, void *v);
121extern int memory_isolate_notify(unsigned long val, void *v); 123extern int memory_isolate_notify(unsigned long val, void *v);
122extern struct memory_block *find_memory_block_hinted(struct mem_section *, 124extern struct memory_block *find_memory_block_hinted(struct mem_section *,
@@ -127,13 +129,18 @@ enum mem_add_context { BOOT, HOTPLUG };
127#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 129#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
128 130
129#ifdef CONFIG_MEMORY_HOTPLUG 131#ifdef CONFIG_MEMORY_HOTPLUG
130#define hotplug_memory_notifier(fn, pri) { \ 132#define hotplug_memory_notifier(fn, pri) ({ \
131 static __meminitdata struct notifier_block fn##_mem_nb =\ 133 static __meminitdata struct notifier_block fn##_mem_nb =\
132 { .notifier_call = fn, .priority = pri }; \ 134 { .notifier_call = fn, .priority = pri };\
133 register_memory_notifier(&fn##_mem_nb); \ 135 register_memory_notifier(&fn##_mem_nb); \
134} 136})
137#define register_hotmemory_notifier(nb) register_memory_notifier(nb)
138#define unregister_hotmemory_notifier(nb) unregister_memory_notifier(nb)
135#else 139#else
136#define hotplug_memory_notifier(fn, pri) do { } while (0) 140#define hotplug_memory_notifier(fn, pri) ({ 0; })
141/* These aren't inline functions due to a GCC bug. */
142#define register_hotmemory_notifier(nb) ({ (void)(nb); 0; })
143#define unregister_hotmemory_notifier(nb) ({ (void)(nb); })
137#endif 144#endif
138 145
139/* 146/*
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index b6a3be7d47bf..3e622c610925 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -97,13 +97,13 @@ extern void __online_page_free(struct page *page);
97#ifdef CONFIG_MEMORY_HOTREMOVE 97#ifdef CONFIG_MEMORY_HOTREMOVE
98extern bool is_pageblock_removable_nolock(struct page *page); 98extern bool is_pageblock_removable_nolock(struct page *page);
99extern int arch_remove_memory(u64 start, u64 size); 99extern int arch_remove_memory(u64 start, u64 size);
100extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
101 unsigned long nr_pages);
100#endif /* CONFIG_MEMORY_HOTREMOVE */ 102#endif /* CONFIG_MEMORY_HOTREMOVE */
101 103
102/* reasonably generic interface to expand the physical pages in a zone */ 104/* reasonably generic interface to expand the physical pages in a zone */
103extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, 105extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
104 unsigned long nr_pages); 106 unsigned long nr_pages);
105extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
106 unsigned long nr_pages);
107 107
108#ifdef CONFIG_NUMA 108#ifdef CONFIG_NUMA
109extern int memory_add_physaddr_to_nid(u64 start); 109extern int memory_add_physaddr_to_nid(u64 start);
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 9ead60bc66b7..3301b2031c8d 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -89,6 +89,11 @@ struct abx500_fg;
89 * points. 89 * points.
90 * @maint_thres This is the threshold where we stop reporting 90 * @maint_thres This is the threshold where we stop reporting
91 * battery full while in maintenance, in per cent 91 * battery full while in maintenance, in per cent
92 * @pcut_enable: Enable power cut feature in ab8505
93 * @pcut_max_time: Max time threshold
94 * @pcut_flag_time: Flagtime threshold
95 * @pcut_max_restart: Max number of restarts
96 * @pcut_debounce_time: Sets battery debounce time
92 */ 97 */
93struct abx500_fg_parameters { 98struct abx500_fg_parameters {
94 int recovery_sleep_timer; 99 int recovery_sleep_timer;
@@ -106,6 +111,11 @@ struct abx500_fg_parameters {
106 int battok_raising_th_sel1; 111 int battok_raising_th_sel1;
107 int user_cap_limit; 112 int user_cap_limit;
108 int maint_thres; 113 int maint_thres;
114 bool pcut_enable;
115 u8 pcut_max_time;
116 u8 pcut_flag_time;
117 u8 pcut_max_restart;
118 u8 pcut_debounce_time;
109}; 119};
110 120
111/** 121/**
@@ -173,11 +183,11 @@ struct abx500_battery_type {
173 int low_high_vol_lvl; 183 int low_high_vol_lvl;
174 int battery_resistance; 184 int battery_resistance;
175 int n_temp_tbl_elements; 185 int n_temp_tbl_elements;
176 struct abx500_res_to_temp *r_to_t_tbl; 186 const struct abx500_res_to_temp *r_to_t_tbl;
177 int n_v_cap_tbl_elements; 187 int n_v_cap_tbl_elements;
178 struct abx500_v_to_cap *v_to_cap_tbl; 188 const struct abx500_v_to_cap *v_to_cap_tbl;
179 int n_batres_tbl_elements; 189 int n_batres_tbl_elements;
180 struct batres_vs_temp *batres_tbl; 190 const struct batres_vs_temp *batres_tbl;
181}; 191};
182 192
183/** 193/**
@@ -236,7 +246,11 @@ struct abx500_bm_charger_parameters {
236 * @interval_not_charging charge alg cycle period time when not charging (sec) 246 * @interval_not_charging charge alg cycle period time when not charging (sec)
237 * @temp_hysteresis temperature hysteresis 247 * @temp_hysteresis temperature hysteresis
238 * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm) 248 * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm)
239 * @maxi: maximization parameters 249 * @n_chg_out_curr number of elements in array chg_output_curr
250 * @n_chg_in_curr number of elements in array chg_input_curr
251 * @chg_output_curr charger output current level map
252 * @chg_input_curr charger input current level map
253 * @maxi maximization parameters
240 * @cap_levels capacity in percent for the different capacity levels 254 * @cap_levels capacity in percent for the different capacity levels
241 * @bat_type table of supported battery types 255 * @bat_type table of supported battery types
242 * @chg_params charger parameters 256 * @chg_params charger parameters
@@ -257,6 +271,7 @@ struct abx500_bm_data {
257 bool autopower_cfg; 271 bool autopower_cfg;
258 bool ac_enabled; 272 bool ac_enabled;
259 bool usb_enabled; 273 bool usb_enabled;
274 bool usb_power_path;
260 bool no_maintenance; 275 bool no_maintenance;
261 bool capacity_scaling; 276 bool capacity_scaling;
262 bool chg_unknown_bat; 277 bool chg_unknown_bat;
@@ -270,6 +285,10 @@ struct abx500_bm_data {
270 int interval_not_charging; 285 int interval_not_charging;
271 int temp_hysteresis; 286 int temp_hysteresis;
272 int gnd_lift_resistance; 287 int gnd_lift_resistance;
288 int n_chg_out_curr;
289 int n_chg_in_curr;
290 int *chg_output_curr;
291 int *chg_input_curr;
273 const struct abx500_maxim_parameters *maxi; 292 const struct abx500_maxim_parameters *maxi;
274 const struct abx500_bm_capacity_levels *cap_levels; 293 const struct abx500_bm_capacity_levels *cap_levels;
275 struct abx500_battery_type *bat_type; 294 struct abx500_battery_type *bat_type;
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 8d35bfe164c8..cc892a8d8d6e 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -23,6 +23,7 @@
23 * Bank : 0x5 23 * Bank : 0x5
24 */ 24 */
25#define AB8500_USB_LINE_STAT_REG 0x80 25#define AB8500_USB_LINE_STAT_REG 0x80
26#define AB8500_USB_LINE_CTRL2_REG 0x82
26#define AB8500_USB_LINK1_STAT_REG 0x94 27#define AB8500_USB_LINK1_STAT_REG 0x94
27 28
28/* 29/*
@@ -33,7 +34,7 @@
33#define AB8500_CH_STATUS2_REG 0x01 34#define AB8500_CH_STATUS2_REG 0x01
34#define AB8500_CH_USBCH_STAT1_REG 0x02 35#define AB8500_CH_USBCH_STAT1_REG 0x02
35#define AB8500_CH_USBCH_STAT2_REG 0x03 36#define AB8500_CH_USBCH_STAT2_REG 0x03
36#define AB8500_CH_FSM_STAT_REG 0x04 37#define AB8540_CH_USBCH_STAT3_REG 0x04
37#define AB8500_CH_STAT_REG 0x05 38#define AB8500_CH_STAT_REG 0x05
38 39
39/* 40/*
@@ -69,6 +70,8 @@
69#define AB8500_USBCH_CTRL1_REG 0xC0 70#define AB8500_USBCH_CTRL1_REG 0xC0
70#define AB8500_USBCH_CTRL2_REG 0xC1 71#define AB8500_USBCH_CTRL2_REG 0xC1
71#define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2 72#define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2
73#define AB8540_USB_PP_MODE_REG 0xC5
74#define AB8540_USB_PP_CHR_REG 0xC6
72 75
73/* 76/*
74 * Gas Gauge register offsets 77 * Gas Gauge register offsets
@@ -105,6 +108,7 @@
105#define AB8500_RTC_BACKUP_CHG_REG 0x0C 108#define AB8500_RTC_BACKUP_CHG_REG 0x0C
106#define AB8500_RTC_CC_CONF_REG 0x01 109#define AB8500_RTC_CC_CONF_REG 0x01
107#define AB8500_RTC_CTRL_REG 0x0B 110#define AB8500_RTC_CTRL_REG 0x0B
111#define AB8500_RTC_CTRL1_REG 0x11
108 112
109/* 113/*
110 * OTP register offsets 114 * OTP register offsets
@@ -154,6 +158,7 @@
154#define CH_OP_CUR_LVL_1P4 0x0D 158#define CH_OP_CUR_LVL_1P4 0x0D
155#define CH_OP_CUR_LVL_1P5 0x0E 159#define CH_OP_CUR_LVL_1P5 0x0E
156#define CH_OP_CUR_LVL_1P6 0x0F 160#define CH_OP_CUR_LVL_1P6 0x0F
161#define CH_OP_CUR_LVL_2P 0x3F
157 162
158/* BTEMP High thermal limits */ 163/* BTEMP High thermal limits */
159#define BTEMP_HIGH_TH_57_0 0x00 164#define BTEMP_HIGH_TH_57_0 0x00
@@ -179,10 +184,25 @@
179#define BUP_ICH_SEL_300UA 0x08 184#define BUP_ICH_SEL_300UA 0x08
180#define BUP_ICH_SEL_700UA 0x0C 185#define BUP_ICH_SEL_700UA 0x0C
181 186
182#define BUP_VCH_SEL_2P5V 0x00 187enum bup_vch_sel {
183#define BUP_VCH_SEL_2P6V 0x01 188 BUP_VCH_SEL_2P5V,
184#define BUP_VCH_SEL_2P8V 0x02 189 BUP_VCH_SEL_2P6V,
185#define BUP_VCH_SEL_3P1V 0x03 190 BUP_VCH_SEL_2P8V,
191 BUP_VCH_SEL_3P1V,
192 /*
193 * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
194 * are only available on ab8540. You can't choose these 5
195 * voltage on ab8500/ab8505/ab9540.
196 */
197 BUP_VCH_SEL_2P7V,
198 BUP_VCH_SEL_2P9V,
199 BUP_VCH_SEL_3P0V,
200 BUP_VCH_SEL_3P2V,
201 BUP_VCH_SEL_3P3V,
202};
203
204#define BUP_VCH_RANGE 0x02
205#define VBUP33_VRTCN 0x01
186 206
187/* Battery OVV constants */ 207/* Battery OVV constants */
188#define BATT_OVV_ENA 0x02 208#define BATT_OVV_ENA 0x02
@@ -228,6 +248,8 @@
228#define BAT_CTRL_20U_ENA 0x02 248#define BAT_CTRL_20U_ENA 0x02
229#define BAT_CTRL_18U_ENA 0x01 249#define BAT_CTRL_18U_ENA 0x01
230#define BAT_CTRL_16U_ENA 0x02 250#define BAT_CTRL_16U_ENA 0x02
251#define BAT_CTRL_60U_ENA 0x01
252#define BAT_CTRL_120U_ENA 0x02
231#define BAT_CTRL_CMP_ENA 0x04 253#define BAT_CTRL_CMP_ENA 0x04
232#define FORCE_BAT_CTRL_CMP_HIGH 0x08 254#define FORCE_BAT_CTRL_CMP_HIGH 0x08
233#define BAT_CTRL_PULL_UP_ENA 0x10 255#define BAT_CTRL_PULL_UP_ENA 0x10
@@ -235,6 +257,24 @@
235/* Battery type */ 257/* Battery type */
236#define BATTERY_UNKNOWN 00 258#define BATTERY_UNKNOWN 00
237 259
260/* Registers for pcut feature in ab8505 and ab9540 */
261#define AB8505_RTC_PCUT_CTL_STATUS_REG 0x12
262#define AB8505_RTC_PCUT_TIME_REG 0x13
263#define AB8505_RTC_PCUT_MAX_TIME_REG 0x14
264#define AB8505_RTC_PCUT_FLAG_TIME_REG 0x15
265#define AB8505_RTC_PCUT_RESTART_REG 0x16
266#define AB8505_RTC_PCUT_DEBOUNCE_REG 0x17
267
268/* USB Power Path constants for ab8540 */
269#define BUS_VSYS_VOL_SELECT_MASK 0x06
270#define BUS_VSYS_VOL_SELECT_3P6V 0x00
271#define BUS_VSYS_VOL_SELECT_3P325V 0x02
272#define BUS_VSYS_VOL_SELECT_3P9V 0x04
273#define BUS_VSYS_VOL_SELECT_4P3V 0x06
274#define BUS_POWER_PATH_MODE_ENA 0x01
275#define BUS_PP_PRECHG_CURRENT_MASK 0x0E
276#define BUS_POWER_PATH_PRECHG_ENA 0x01
277
238/** 278/**
239 * struct res_to_temp - defines one point in a temp to res curve. To 279 * struct res_to_temp - defines one point in a temp to res curve. To
240 * be used in battery packs that combines the identification resistor with a 280 * be used in battery packs that combines the identification resistor with a
@@ -283,6 +323,11 @@ struct ab8500_fg;
283 * points. 323 * points.
284 * @maint_thres This is the threshold where we stop reporting 324 * @maint_thres This is the threshold where we stop reporting
285 * battery full while in maintenance, in per cent 325 * battery full while in maintenance, in per cent
326 * @pcut_enable: Enable power cut feature in ab8505
327 * @pcut_max_time: Max time threshold
328 * @pcut_flag_time: Flagtime threshold
329 * @pcut_max_restart: Max number of restarts
330 * @pcut_debunce_time: Sets battery debounce time
286 */ 331 */
287struct ab8500_fg_parameters { 332struct ab8500_fg_parameters {
288 int recovery_sleep_timer; 333 int recovery_sleep_timer;
@@ -299,6 +344,11 @@ struct ab8500_fg_parameters {
299 int battok_raising_th_sel1; 344 int battok_raising_th_sel1;
300 int user_cap_limit; 345 int user_cap_limit;
301 int maint_thres; 346 int maint_thres;
347 bool pcut_enable;
348 u8 pcut_max_time;
349 u8 pcut_flag_time;
350 u8 pcut_max_restart;
351 u8 pcut_debunce_time;
302}; 352};
303 353
304/** 354/**
@@ -415,6 +465,7 @@ void ab8500_fg_reinit(void);
415void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); 465void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
416struct ab8500_btemp *ab8500_btemp_get(void); 466struct ab8500_btemp *ab8500_btemp_get(void);
417int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); 467int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp);
468int ab8500_btemp_get_temp(struct ab8500_btemp *btemp);
418struct ab8500_fg *ab8500_fg_get(void); 469struct ab8500_fg *ab8500_fg_get(void);
419int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); 470int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
420int ab8500_fg_inst_curr_start(struct ab8500_fg *di); 471int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
diff --git a/include/linux/mfd/abx500/ab8500-gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h
index 252966769d93..49ded001049b 100644
--- a/include/linux/mfd/abx500/ab8500-gpadc.h
+++ b/include/linux/mfd/abx500/ab8500-gpadc.h
@@ -4,32 +4,72 @@
4 * 4 *
5 * Author: Arun R Murthy <arun.murthy@stericsson.com> 5 * Author: Arun R Murthy <arun.murthy@stericsson.com>
6 * Author: Daniel Willerud <daniel.willerud@stericsson.com> 6 * Author: Daniel Willerud <daniel.willerud@stericsson.com>
7 * Author: M'boumba Cedric Madianga <cedric.madianga@stericsson.com>
7 */ 8 */
8 9
9#ifndef _AB8500_GPADC_H 10#ifndef _AB8500_GPADC_H
10#define _AB8500_GPADC_H 11#define _AB8500_GPADC_H
11 12
12/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */ 13/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2
13#define BAT_CTRL 0x01 14 * and ADCHwSel[4:0] in GPADCCtrl3 ) */
14#define BTEMP_BALL 0x02 15#define BAT_CTRL 0x01
15#define MAIN_CHARGER_V 0x03 16#define BTEMP_BALL 0x02
16#define ACC_DETECT1 0x04 17#define MAIN_CHARGER_V 0x03
17#define ACC_DETECT2 0x05 18#define ACC_DETECT1 0x04
18#define ADC_AUX1 0x06 19#define ACC_DETECT2 0x05
19#define ADC_AUX2 0x07 20#define ADC_AUX1 0x06
20#define MAIN_BAT_V 0x08 21#define ADC_AUX2 0x07
21#define VBUS_V 0x09 22#define MAIN_BAT_V 0x08
22#define MAIN_CHARGER_C 0x0A 23#define VBUS_V 0x09
23#define USB_CHARGER_C 0x0B 24#define MAIN_CHARGER_C 0x0A
24#define BK_BAT_V 0x0C 25#define USB_CHARGER_C 0x0B
25#define DIE_TEMP 0x0D 26#define BK_BAT_V 0x0C
27#define DIE_TEMP 0x0D
28#define USB_ID 0x0E
29#define XTAL_TEMP 0x12
30#define VBAT_TRUE_MEAS 0x13
31#define BAT_CTRL_AND_IBAT 0x1C
32#define VBAT_MEAS_AND_IBAT 0x1D
33#define VBAT_TRUE_MEAS_AND_IBAT 0x1E
34#define BAT_TEMP_AND_IBAT 0x1F
35
36/* Virtual channel used only for ibat convertion to ampere
37 * Battery current conversion (ibat) cannot be requested as a single conversion
38 * but it is always in combination with other input requests
39 */
40#define IBAT_VIRTUAL_CHANNEL 0xFF
41
42#define SAMPLE_1 1
43#define SAMPLE_4 4
44#define SAMPLE_8 8
45#define SAMPLE_16 16
46#define RISING_EDGE 0
47#define FALLING_EDGE 1
48
49/* Arbitrary ADC conversion type constants */
50#define ADC_SW 0
51#define ADC_HW 1
26 52
27struct ab8500_gpadc; 53struct ab8500_gpadc;
28 54
29struct ab8500_gpadc *ab8500_gpadc_get(char *name); 55struct ab8500_gpadc *ab8500_gpadc_get(char *name);
30int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel); 56int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel,
31int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel); 57 u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type);
58static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel)
59{
60 return ab8500_gpadc_sw_hw_convert(gpadc, channel,
61 SAMPLE_16, 0, 0, ADC_SW);
62}
63
64int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
65 u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type);
66int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
67 u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type,
68 int *ibat);
32int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, 69int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc,
33 u8 channel, int ad_value); 70 u8 channel, int ad_value);
71void ab8540_gpadc_get_otp(struct ab8500_gpadc *gpadc,
72 u16 *vmain_l, u16 *vmain_h, u16 *btemp_l, u16 *btemp_h,
73 u16 *vbat_l, u16 *vbat_h, u16 *ibat_l, u16 *ibat_h);
34 74
35#endif /* _AB8500_GPADC_H */ 75#endif /* _AB8500_GPADC_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index ebf12e793db9..990bc93f46e1 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -12,6 +12,7 @@
12 12
13int ab8500_sysctrl_read(u16 reg, u8 *value); 13int ab8500_sysctrl_read(u16 reg, u8 *value);
14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value); 14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
15void ab8500_restart(char mode, const char *cmd);
15 16
16#else 17#else
17 18
@@ -40,6 +41,7 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
40/* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */ 41/* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */
41struct ab8500_sysctrl_platform_data { 42struct ab8500_sysctrl_platform_data {
42 u8 initial_req_buf_config[8]; 43 u8 initial_req_buf_config[8];
44 u16 (*reboot_reason_code)(const char *cmd);
43}; 45};
44 46
45/* Registers */ 47/* Registers */
@@ -299,4 +301,8 @@ struct ab8500_sysctrl_platform_data {
299#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF 301#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF
300#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0 302#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0
301 303
304#define AB8500_ENABLE_WD 0x1
305#define AB8500_KICK_WD 0x2
306#define AB8500_WD_RESTART_ON_EXPIRE 0x10
307
302#endif /* __AB8500_SYSCTRL_H */ 308#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 9db0bda446a0..0390d5943ed6 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -362,10 +362,10 @@ struct ab8500 {
362 u8 *oldmask; 362 u8 *oldmask;
363 int mask_size; 363 int mask_size;
364 const int *irq_reg_offset; 364 const int *irq_reg_offset;
365 int it_latchhier_num;
365}; 366};
366 367
367struct regulator_reg_init; 368struct ab8500_regulator_platform_data;
368struct regulator_init_data;
369struct ab8500_gpio_platform_data; 369struct ab8500_gpio_platform_data;
370struct ab8500_codec_platform_data; 370struct ab8500_codec_platform_data;
371struct ab8500_sysctrl_platform_data; 371struct ab8500_sysctrl_platform_data;
@@ -373,21 +373,13 @@ struct ab8500_sysctrl_platform_data;
373/** 373/**
374 * struct ab8500_platform_data - AB8500 platform data 374 * struct ab8500_platform_data - AB8500 platform data
375 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 375 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
376 * @pm_power_off: Should machine pm power off hook be registered or not
377 * @init: board-specific initialization after detection of ab8500 376 * @init: board-specific initialization after detection of ab8500
378 * @num_regulator_reg_init: number of regulator init registers
379 * @regulator_reg_init: regulator init registers
380 * @num_regulator: number of regulators
381 * @regulator: machine-specific constraints for regulators 377 * @regulator: machine-specific constraints for regulators
382 */ 378 */
383struct ab8500_platform_data { 379struct ab8500_platform_data {
384 int irq_base; 380 int irq_base;
385 bool pm_power_off;
386 void (*init) (struct ab8500 *); 381 void (*init) (struct ab8500 *);
387 int num_regulator_reg_init; 382 struct ab8500_regulator_platform_data *regulator;
388 struct ab8500_regulator_reg_init *regulator_reg_init;
389 int num_regulator;
390 struct regulator_init_data *regulator;
391 struct abx500_gpio_platform_data *gpio; 383 struct abx500_gpio_platform_data *gpio;
392 struct ab8500_codec_platform_data *codec; 384 struct ab8500_codec_platform_data *codec;
393 struct ab8500_sysctrl_platform_data *sysctrl; 385 struct ab8500_sysctrl_platform_data *sysctrl;
@@ -512,6 +504,8 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
512 return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0)); 504 return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0));
513} 505}
514 506
507void ab8500_override_turn_on_stat(u8 mask, u8 set);
508
515#ifdef CONFIG_AB8500_DEBUG 509#ifdef CONFIG_AB8500_DEBUG
516void ab8500_dump_all_banks(struct device *dev); 510void ab8500_dump_all_banks(struct device *dev);
517void ab8500_debug_register_interrupt(int line); 511void ab8500_debug_register_interrupt(int line);
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
index d43ac0f35526..234c99143bf7 100644
--- a/include/linux/mfd/abx500/ux500_chargalg.h
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -17,8 +17,11 @@ struct ux500_charger;
17 17
18struct ux500_charger_ops { 18struct ux500_charger_ops {
19 int (*enable) (struct ux500_charger *, int, int, int); 19 int (*enable) (struct ux500_charger *, int, int, int);
20 int (*check_enable) (struct ux500_charger *, int, int);
20 int (*kick_wd) (struct ux500_charger *); 21 int (*kick_wd) (struct ux500_charger *);
21 int (*update_curr) (struct ux500_charger *, int); 22 int (*update_curr) (struct ux500_charger *, int);
23 int (*pp_enable) (struct ux500_charger *, bool);
24 int (*pre_chg_enable) (struct ux500_charger *, bool);
22}; 25};
23 26
24/** 27/**
@@ -29,6 +32,7 @@ struct ux500_charger_ops {
29 * @max_out_curr maximum output charger current in mA 32 * @max_out_curr maximum output charger current in mA
30 * @enabled indicates if this charger is used or not 33 * @enabled indicates if this charger is used or not
31 * @external external charger unit (pm2xxx) 34 * @external external charger unit (pm2xxx)
35 * @power_path USB power path support
32 */ 36 */
33struct ux500_charger { 37struct ux500_charger {
34 struct power_supply psy; 38 struct power_supply psy;
@@ -38,6 +42,9 @@ struct ux500_charger {
38 int wdt_refresh; 42 int wdt_refresh;
39 bool enabled; 43 bool enabled;
40 bool external; 44 bool external;
45 bool power_path;
41}; 46};
42 47
48extern struct blocking_notifier_head charger_notifier_list;
49
43#endif 50#endif
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index a710255528d7..cc281368dc55 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -100,6 +100,9 @@ struct arizona {
100 struct regmap_irq_chip_data *aod_irq_chip; 100 struct regmap_irq_chip_data *aod_irq_chip;
101 struct regmap_irq_chip_data *irq_chip; 101 struct regmap_irq_chip_data *irq_chip;
102 102
103 bool hpdet_magic;
104 unsigned int hp_ena;
105
103 struct mutex clk_lock; 106 struct mutex clk_lock;
104 int clk32k_ref; 107 int clk32k_ref;
105 108
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 455c51d22d6b..80dead1f7100 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -78,6 +78,7 @@ struct arizona_micbias {
78 unsigned int ext_cap:1; /** External capacitor fitted */ 78 unsigned int ext_cap:1; /** External capacitor fitted */
79 unsigned int discharge:1; /** Actively discharge */ 79 unsigned int discharge:1; /** Actively discharge */
80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */ 80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */
81 unsigned int bypass:1; /** Use bypass mode */
81}; 82};
82 83
83struct arizona_micd_config { 84struct arizona_micd_config {
@@ -86,6 +87,11 @@ struct arizona_micd_config {
86 bool gpio; 87 bool gpio;
87}; 88};
88 89
90struct arizona_micd_range {
91 int max; /** Ohms */
92 int key; /** Key to report to input layer */
93};
94
89struct arizona_pdata { 95struct arizona_pdata {
90 int reset; /** GPIO controlling /RESET, if any */ 96 int reset; /** GPIO controlling /RESET, if any */
91 int ldoena; /** GPIO controlling LODENA, if any */ 97 int ldoena; /** GPIO controlling LODENA, if any */
@@ -99,7 +105,8 @@ struct arizona_pdata {
99 /** If a direct 32kHz clock is provided on an MCLK specify it here */ 105 /** If a direct 32kHz clock is provided on an MCLK specify it here */
100 int clk32k_src; 106 int clk32k_src;
101 107
102 bool irq_active_high; /** IRQ polarity */ 108 /** Mode for primary IRQ (defaults to active low) */
109 unsigned int irq_flags;
103 110
104 /* Base GPIO */ 111 /* Base GPIO */
105 int gpio_base; 112 int gpio_base;
@@ -117,12 +124,21 @@ struct arizona_pdata {
117 /** GPIO5 is used for jack detection */ 124 /** GPIO5 is used for jack detection */
118 bool jd_gpio5; 125 bool jd_gpio5;
119 126
127 /** Internal pull on GPIO5 is disabled when used for jack detection */
128 bool jd_gpio5_nopull;
129
120 /** Use the headphone detect circuit to identify the accessory */ 130 /** Use the headphone detect circuit to identify the accessory */
121 bool hpdet_acc_id; 131 bool hpdet_acc_id;
122 132
133 /** Check for line output with HPDET method */
134 bool hpdet_acc_id_line;
135
123 /** GPIO used for mic isolation with HPDET */ 136 /** GPIO used for mic isolation with HPDET */
124 int hpdet_id_gpio; 137 int hpdet_id_gpio;
125 138
139 /** Extra debounce timeout used during initial mic detection (ms) */
140 int micd_detect_debounce;
141
126 /** GPIO for mic detection polarity */ 142 /** GPIO for mic detection polarity */
127 int micd_pol_gpio; 143 int micd_pol_gpio;
128 144
@@ -135,9 +151,16 @@ struct arizona_pdata {
135 /** Mic detect debounce level */ 151 /** Mic detect debounce level */
136 int micd_dbtime; 152 int micd_dbtime;
137 153
154 /** Mic detect timeout (ms) */
155 int micd_timeout;
156
138 /** Force MICBIAS on for mic detect */ 157 /** Force MICBIAS on for mic detect */
139 bool micd_force_micbias; 158 bool micd_force_micbias;
140 159
160 /** Mic detect level parameters */
161 const struct arizona_micd_range *micd_ranges;
162 int num_micd_ranges;
163
141 /** Headset polarity configurations */ 164 /** Headset polarity configurations */
142 struct arizona_micd_config *micd_configs; 165 struct arizona_micd_config *micd_configs;
143 int num_micd_configs; 166 int num_micd_configs;
@@ -162,6 +185,9 @@ struct arizona_pdata {
162 185
163 /** Haptic actuator type */ 186 /** Haptic actuator type */
164 unsigned int hap_act; 187 unsigned int hap_act;
188
189 /** GPIO for primary IRQ (used for edge triggered emulation) */
190 int irq_gpio;
165}; 191};
166 192
167#endif 193#endif
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 340355136069..715b6ba3d52a 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -85,12 +85,14 @@
85#define ARIZONA_FLL1_CONTROL_6 0x176 85#define ARIZONA_FLL1_CONTROL_6 0x176
86#define ARIZONA_FLL1_LOOP_FILTER_TEST_1 0x177 86#define ARIZONA_FLL1_LOOP_FILTER_TEST_1 0x177
87#define ARIZONA_FLL1_NCO_TEST_0 0x178 87#define ARIZONA_FLL1_NCO_TEST_0 0x178
88#define ARIZONA_FLL1_CONTROL_7 0x179
88#define ARIZONA_FLL1_SYNCHRONISER_1 0x181 89#define ARIZONA_FLL1_SYNCHRONISER_1 0x181
89#define ARIZONA_FLL1_SYNCHRONISER_2 0x182 90#define ARIZONA_FLL1_SYNCHRONISER_2 0x182
90#define ARIZONA_FLL1_SYNCHRONISER_3 0x183 91#define ARIZONA_FLL1_SYNCHRONISER_3 0x183
91#define ARIZONA_FLL1_SYNCHRONISER_4 0x184 92#define ARIZONA_FLL1_SYNCHRONISER_4 0x184
92#define ARIZONA_FLL1_SYNCHRONISER_5 0x185 93#define ARIZONA_FLL1_SYNCHRONISER_5 0x185
93#define ARIZONA_FLL1_SYNCHRONISER_6 0x186 94#define ARIZONA_FLL1_SYNCHRONISER_6 0x186
95#define ARIZONA_FLL1_SYNCHRONISER_7 0x187
94#define ARIZONA_FLL1_SPREAD_SPECTRUM 0x189 96#define ARIZONA_FLL1_SPREAD_SPECTRUM 0x189
95#define ARIZONA_FLL1_GPIO_CLOCK 0x18A 97#define ARIZONA_FLL1_GPIO_CLOCK 0x18A
96#define ARIZONA_FLL2_CONTROL_1 0x191 98#define ARIZONA_FLL2_CONTROL_1 0x191
@@ -101,12 +103,14 @@
101#define ARIZONA_FLL2_CONTROL_6 0x196 103#define ARIZONA_FLL2_CONTROL_6 0x196
102#define ARIZONA_FLL2_LOOP_FILTER_TEST_1 0x197 104#define ARIZONA_FLL2_LOOP_FILTER_TEST_1 0x197
103#define ARIZONA_FLL2_NCO_TEST_0 0x198 105#define ARIZONA_FLL2_NCO_TEST_0 0x198
106#define ARIZONA_FLL2_CONTROL_7 0x199
104#define ARIZONA_FLL2_SYNCHRONISER_1 0x1A1 107#define ARIZONA_FLL2_SYNCHRONISER_1 0x1A1
105#define ARIZONA_FLL2_SYNCHRONISER_2 0x1A2 108#define ARIZONA_FLL2_SYNCHRONISER_2 0x1A2
106#define ARIZONA_FLL2_SYNCHRONISER_3 0x1A3 109#define ARIZONA_FLL2_SYNCHRONISER_3 0x1A3
107#define ARIZONA_FLL2_SYNCHRONISER_4 0x1A4 110#define ARIZONA_FLL2_SYNCHRONISER_4 0x1A4
108#define ARIZONA_FLL2_SYNCHRONISER_5 0x1A5 111#define ARIZONA_FLL2_SYNCHRONISER_5 0x1A5
109#define ARIZONA_FLL2_SYNCHRONISER_6 0x1A6 112#define ARIZONA_FLL2_SYNCHRONISER_6 0x1A6
113#define ARIZONA_FLL2_SYNCHRONISER_7 0x1A7
110#define ARIZONA_FLL2_SPREAD_SPECTRUM 0x1A9 114#define ARIZONA_FLL2_SPREAD_SPECTRUM 0x1A9
111#define ARIZONA_FLL2_GPIO_CLOCK 0x1AA 115#define ARIZONA_FLL2_GPIO_CLOCK 0x1AA
112#define ARIZONA_MIC_CHARGE_PUMP_1 0x200 116#define ARIZONA_MIC_CHARGE_PUMP_1 0x200
@@ -124,6 +128,10 @@
124#define ARIZONA_MIC_DETECT_1 0x2A3 128#define ARIZONA_MIC_DETECT_1 0x2A3
125#define ARIZONA_MIC_DETECT_2 0x2A4 129#define ARIZONA_MIC_DETECT_2 0x2A4
126#define ARIZONA_MIC_DETECT_3 0x2A5 130#define ARIZONA_MIC_DETECT_3 0x2A5
131#define ARIZONA_MIC_DETECT_LEVEL_1 0x2A6
132#define ARIZONA_MIC_DETECT_LEVEL_2 0x2A7
133#define ARIZONA_MIC_DETECT_LEVEL_3 0x2A8
134#define ARIZONA_MIC_DETECT_LEVEL_4 0x2A9
127#define ARIZONA_MIC_NOISE_MIX_CONTROL_1 0x2C3 135#define ARIZONA_MIC_NOISE_MIX_CONTROL_1 0x2C3
128#define ARIZONA_ISOLATION_CONTROL 0x2CB 136#define ARIZONA_ISOLATION_CONTROL 0x2CB
129#define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3 137#define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3
@@ -213,6 +221,8 @@
213#define ARIZONA_PDM_SPK1_CTRL_2 0x491 221#define ARIZONA_PDM_SPK1_CTRL_2 0x491
214#define ARIZONA_PDM_SPK2_CTRL_1 0x492 222#define ARIZONA_PDM_SPK2_CTRL_1 0x492
215#define ARIZONA_PDM_SPK2_CTRL_2 0x493 223#define ARIZONA_PDM_SPK2_CTRL_2 0x493
224#define ARIZONA_SPK_CTRL_2 0x4B5
225#define ARIZONA_SPK_CTRL_3 0x4B6
216#define ARIZONA_DAC_COMP_1 0x4DC 226#define ARIZONA_DAC_COMP_1 0x4DC
217#define ARIZONA_DAC_COMP_2 0x4DD 227#define ARIZONA_DAC_COMP_2 0x4DD
218#define ARIZONA_DAC_COMP_3 0x4DE 228#define ARIZONA_DAC_COMP_3 0x4DE
@@ -1678,6 +1688,13 @@
1678#define ARIZONA_FLL1_FRC_INTEG_VAL_WIDTH 12 /* FLL1_FRC_INTEG_VAL - [11:0] */ 1688#define ARIZONA_FLL1_FRC_INTEG_VAL_WIDTH 12 /* FLL1_FRC_INTEG_VAL - [11:0] */
1679 1689
1680/* 1690/*
1691 * R377 (0x179) - FLL1 Control 7
1692 */
1693#define ARIZONA_FLL1_GAIN_MASK 0x003c /* FLL1_GAIN */
1694#define ARIZONA_FLL1_GAIN_SHIFT 2 /* FLL1_GAIN */
1695#define ARIZONA_FLL1_GAIN_WIDTH 4 /* FLL1_GAIN */
1696
1697/*
1681 * R385 (0x181) - FLL1 Synchroniser 1 1698 * R385 (0x181) - FLL1 Synchroniser 1
1682 */ 1699 */
1683#define ARIZONA_FLL1_SYNC_ENA 0x0001 /* FLL1_SYNC_ENA */ 1700#define ARIZONA_FLL1_SYNC_ENA 0x0001 /* FLL1_SYNC_ENA */
@@ -1724,6 +1741,17 @@
1724#define ARIZONA_FLL1_CLK_SYNC_SRC_WIDTH 4 /* FLL1_CLK_SYNC_SRC - [3:0] */ 1741#define ARIZONA_FLL1_CLK_SYNC_SRC_WIDTH 4 /* FLL1_CLK_SYNC_SRC - [3:0] */
1725 1742
1726/* 1743/*
1744 * R391 (0x187) - FLL1 Synchroniser 7
1745 */
1746#define ARIZONA_FLL1_SYNC_GAIN_MASK 0x003c /* FLL1_SYNC_GAIN */
1747#define ARIZONA_FLL1_SYNC_GAIN_SHIFT 2 /* FLL1_SYNC_GAIN */
1748#define ARIZONA_FLL1_SYNC_GAIN_WIDTH 4 /* FLL1_SYNC_GAIN */
1749#define ARIZONA_FLL1_SYNC_BW 0x0001 /* FLL1_SYNC_BW */
1750#define ARIZONA_FLL1_SYNC_BW_MASK 0x0001 /* FLL1_SYNC_BW */
1751#define ARIZONA_FLL1_SYNC_BW_SHIFT 0 /* FLL1_SYNC_BW */
1752#define ARIZONA_FLL1_SYNC_BW_WIDTH 1 /* FLL1_SYNC_BW */
1753
1754/*
1727 * R393 (0x189) - FLL1 Spread Spectrum 1755 * R393 (0x189) - FLL1 Spread Spectrum
1728 */ 1756 */
1729#define ARIZONA_FLL1_SS_AMPL_MASK 0x0030 /* FLL1_SS_AMPL - [5:4] */ 1757#define ARIZONA_FLL1_SS_AMPL_MASK 0x0030 /* FLL1_SS_AMPL - [5:4] */
@@ -1816,6 +1844,13 @@
1816#define ARIZONA_FLL2_FRC_INTEG_VAL_WIDTH 12 /* FLL2_FRC_INTEG_VAL - [11:0] */ 1844#define ARIZONA_FLL2_FRC_INTEG_VAL_WIDTH 12 /* FLL2_FRC_INTEG_VAL - [11:0] */
1817 1845
1818/* 1846/*
1847 * R409 (0x199) - FLL2 Control 7
1848 */
1849#define ARIZONA_FLL2_GAIN_MASK 0x003c /* FLL2_GAIN */
1850#define ARIZONA_FLL2_GAIN_SHIFT 2 /* FLL2_GAIN */
1851#define ARIZONA_FLL2_GAIN_WIDTH 4 /* FLL2_GAIN */
1852
1853/*
1819 * R417 (0x1A1) - FLL2 Synchroniser 1 1854 * R417 (0x1A1) - FLL2 Synchroniser 1
1820 */ 1855 */
1821#define ARIZONA_FLL2_SYNC_ENA 0x0001 /* FLL2_SYNC_ENA */ 1856#define ARIZONA_FLL2_SYNC_ENA 0x0001 /* FLL2_SYNC_ENA */
@@ -1862,6 +1897,17 @@
1862#define ARIZONA_FLL2_CLK_SYNC_SRC_WIDTH 4 /* FLL2_CLK_SYNC_SRC - [3:0] */ 1897#define ARIZONA_FLL2_CLK_SYNC_SRC_WIDTH 4 /* FLL2_CLK_SYNC_SRC - [3:0] */
1863 1898
1864/* 1899/*
1900 * R423 (0x1A7) - FLL2 Synchroniser 7
1901 */
1902#define ARIZONA_FLL2_SYNC_GAIN_MASK 0x003c /* FLL2_SYNC_GAIN */
1903#define ARIZONA_FLL2_SYNC_GAIN_SHIFT 2 /* FLL2_SYNC_GAIN */
1904#define ARIZONA_FLL2_SYNC_GAIN_WIDTH 4 /* FLL2_SYNC_GAIN */
1905#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */
1906#define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */
1907#define ARIZONA_FLL2_SYNC_BW_SHIFT 0 /* FLL2_SYNC_BW */
1908#define ARIZONA_FLL2_SYNC_BW_WIDTH 1 /* FLL2_SYNC_BW */
1909
1910/*
1865 * R425 (0x1A9) - FLL2 Spread Spectrum 1911 * R425 (0x1A9) - FLL2 Spread Spectrum
1866 */ 1912 */
1867#define ARIZONA_FLL2_SS_AMPL_MASK 0x0030 /* FLL2_SS_AMPL - [5:4] */ 1913#define ARIZONA_FLL2_SS_AMPL_MASK 0x0030 /* FLL2_SS_AMPL - [5:4] */
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
new file mode 100644
index 000000000000..032af7fc5b2e
--- /dev/null
+++ b/include/linux/mfd/cros_ec.h
@@ -0,0 +1,170 @@
1/*
2 * ChromeOS EC multi-function device
3 *
4 * Copyright (C) 2012 Google, Inc
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __LINUX_MFD_CROS_EC_H
17#define __LINUX_MFD_CROS_EC_H
18
19#include <linux/mfd/cros_ec_commands.h>
20
21/*
22 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
23 */
24enum {
25 EC_MSG_TX_HEADER_BYTES = 3,
26 EC_MSG_TX_TRAILER_BYTES = 1,
27 EC_MSG_TX_PROTO_BYTES = EC_MSG_TX_HEADER_BYTES +
28 EC_MSG_TX_TRAILER_BYTES,
29 EC_MSG_RX_PROTO_BYTES = 3,
30
31 /* Max length of messages */
32 EC_MSG_BYTES = EC_HOST_PARAM_SIZE + EC_MSG_TX_PROTO_BYTES,
33
34};
35
36/**
37 * struct cros_ec_msg - A message sent to the EC, and its reply
38 *
39 * @version: Command version number (often 0)
40 * @cmd: Command to send (EC_CMD_...)
41 * @out_buf: Outgoing payload (to EC)
42 * @outlen: Outgoing length
43 * @in_buf: Incoming payload (from EC)
44 * @in_len: Incoming length
45 */
46struct cros_ec_msg {
47 u8 version;
48 u8 cmd;
49 uint8_t *out_buf;
50 int out_len;
51 uint8_t *in_buf;
52 int in_len;
53};
54
55/**
56 * struct cros_ec_device - Information about a ChromeOS EC device
57 *
58 * @name: Name of this EC interface
59 * @priv: Private data
60 * @irq: Interrupt to use
61 * @din: input buffer (from EC)
62 * @dout: output buffer (to EC)
63 * \note
64 * These two buffers will always be dword-aligned and include enough
65 * space for up to 7 word-alignment bytes also, so we can ensure that
66 * the body of the message is always dword-aligned (64-bit).
67 *
68 * We use this alignment to keep ARM and x86 happy. Probably word
69 * alignment would be OK, there might be a small performance advantage
70 * to using dword.
71 * @din_size: size of din buffer
72 * @dout_size: size of dout buffer
73 * @command_send: send a command
74 * @command_recv: receive a command
75 * @ec_name: name of EC device (e.g. 'chromeos-ec')
76 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
77 * @parent: pointer to parent device (e.g. i2c or spi device)
78 * @dev: Device pointer
79 * dev_lock: Lock to prevent concurrent access
80 * @wake_enabled: true if this device can wake the system from sleep
81 * @was_wake_device: true if this device was set to wake the system from
82 * sleep at the last suspend
83 * @event_notifier: interrupt event notifier for transport devices
84 */
85struct cros_ec_device {
86 const char *name;
87 void *priv;
88 int irq;
89 uint8_t *din;
90 uint8_t *dout;
91 int din_size;
92 int dout_size;
93 int (*command_send)(struct cros_ec_device *ec,
94 uint16_t cmd, void *out_buf, int out_len);
95 int (*command_recv)(struct cros_ec_device *ec,
96 uint16_t cmd, void *in_buf, int in_len);
97 int (*command_sendrecv)(struct cros_ec_device *ec,
98 uint16_t cmd, void *out_buf, int out_len,
99 void *in_buf, int in_len);
100 int (*command_xfer)(struct cros_ec_device *ec,
101 struct cros_ec_msg *msg);
102
103 const char *ec_name;
104 const char *phys_name;
105 struct device *parent;
106
107 /* These are --private-- fields - do not assign */
108 struct device *dev;
109 struct mutex dev_lock;
110 bool wake_enabled;
111 bool was_wake_device;
112 struct blocking_notifier_head event_notifier;
113};
114
115/**
116 * cros_ec_suspend - Handle a suspend operation for the ChromeOS EC device
117 *
118 * This can be called by drivers to handle a suspend event.
119 *
120 * ec_dev: Device to suspend
121 * @return 0 if ok, -ve on error
122 */
123int cros_ec_suspend(struct cros_ec_device *ec_dev);
124
125/**
126 * cros_ec_resume - Handle a resume operation for the ChromeOS EC device
127 *
128 * This can be called by drivers to handle a resume event.
129 *
130 * @ec_dev: Device to resume
131 * @return 0 if ok, -ve on error
132 */
133int cros_ec_resume(struct cros_ec_device *ec_dev);
134
135/**
136 * cros_ec_prepare_tx - Prepare an outgoing message in the output buffer
137 *
138 * This is intended to be used by all ChromeOS EC drivers, but at present
139 * only SPI uses it. Once LPC uses the same protocol it can start using it.
140 * I2C could use it now, with a refactor of the existing code.
141 *
142 * @ec_dev: Device to register
143 * @msg: Message to write
144 */
145int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
146 struct cros_ec_msg *msg);
147
148/**
149 * cros_ec_remove - Remove a ChromeOS EC
150 *
151 * Call this to deregister a ChromeOS EC. After this you should call
152 * cros_ec_free().
153 *
154 * @ec_dev: Device to register
155 * @return 0 if ok, -ve on error
156 */
157int cros_ec_remove(struct cros_ec_device *ec_dev);
158
159/**
160 * cros_ec_register - Register a new ChromeOS EC, using the provided info
161 *
162 * Before calling this, allocate a pointer to a new device and then fill
163 * in all the fields up to the --private-- marker.
164 *
165 * @ec_dev: Device to register
166 * @return 0 if ok, -ve on error
167 */
168int cros_ec_register(struct cros_ec_device *ec_dev);
169
170#endif /* __LINUX_MFD_CROS_EC_H */
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
new file mode 100644
index 000000000000..86fd06953bcd
--- /dev/null
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -0,0 +1,1369 @@
1/*
2 * Host communication command constants for ChromeOS EC
3 *
4 * Copyright (C) 2012 Google, Inc
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * The ChromeOS EC multi function device is used to mux all the requests
16 * to the EC device for its multiple features: keyboard controller,
17 * battery charging and regulator control, firmware update.
18 *
19 * NOTE: This file is copied verbatim from the ChromeOS EC Open Source
20 * project in an attempt to make future updates easy to make.
21 */
22
23#ifndef __CROS_EC_COMMANDS_H
24#define __CROS_EC_COMMANDS_H
25
26/*
27 * Protocol overview
28 *
29 * request: CMD [ P0 P1 P2 ... Pn S ]
30 * response: ERR [ P0 P1 P2 ... Pn S ]
31 *
32 * where the bytes are defined as follow :
33 * - CMD is the command code. (defined by EC_CMD_ constants)
34 * - ERR is the error code. (defined by EC_RES_ constants)
35 * - Px is the optional payload.
36 * it is not sent if the error code is not success.
37 * (defined by ec_params_ and ec_response_ structures)
38 * - S is the checksum which is the sum of all payload bytes.
39 *
40 * On LPC, CMD and ERR are sent/received at EC_LPC_ADDR_KERNEL|USER_CMD
41 * and the payloads are sent/received at EC_LPC_ADDR_KERNEL|USER_PARAM.
42 * On I2C, all bytes are sent serially in the same message.
43 */
44
45/* Current version of this protocol */
46#define EC_PROTO_VERSION 0x00000002
47
48/* Command version mask */
49#define EC_VER_MASK(version) (1UL << (version))
50
51/* I/O addresses for ACPI commands */
52#define EC_LPC_ADDR_ACPI_DATA 0x62
53#define EC_LPC_ADDR_ACPI_CMD 0x66
54
55/* I/O addresses for host command */
56#define EC_LPC_ADDR_HOST_DATA 0x200
57#define EC_LPC_ADDR_HOST_CMD 0x204
58
59/* I/O addresses for host command args and params */
60#define EC_LPC_ADDR_HOST_ARGS 0x800
61#define EC_LPC_ADDR_HOST_PARAM 0x804
62#define EC_HOST_PARAM_SIZE 0x0fc /* Size of param area in bytes */
63
64/* I/O addresses for host command params, old interface */
65#define EC_LPC_ADDR_OLD_PARAM 0x880
66#define EC_OLD_PARAM_SIZE 0x080 /* Size of param area in bytes */
67
68/* EC command register bit functions */
69#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */
70#define EC_LPC_CMDR_PENDING (1 << 1) /* Write pending to EC */
71#define EC_LPC_CMDR_BUSY (1 << 2) /* EC is busy processing a command */
72#define EC_LPC_CMDR_CMD (1 << 3) /* Last host write was a command */
73#define EC_LPC_CMDR_ACPI_BRST (1 << 4) /* Burst mode (not used) */
74#define EC_LPC_CMDR_SCI (1 << 5) /* SCI event is pending */
75#define EC_LPC_CMDR_SMI (1 << 6) /* SMI event is pending */
76
77#define EC_LPC_ADDR_MEMMAP 0x900
78#define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */
79#define EC_MEMMAP_TEXT_MAX 8 /* Size of a string in the memory map */
80
81/* The offset address of each type of data in mapped memory. */
82#define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors */
83#define EC_MEMMAP_FAN 0x10 /* Fan speeds */
84#define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* Temp sensors (second set) */
85#define EC_MEMMAP_ID 0x20 /* 'E' 'C' */
86#define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */
87#define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */
88#define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */
89#define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */
90#define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */
91#define EC_MEMMAP_HOST_CMD_FLAGS 0x27 /* Host command interface flags */
92#define EC_MEMMAP_SWITCHES 0x30
93#define EC_MEMMAP_HOST_EVENTS 0x34
94#define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */
95#define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */
96#define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */
97#define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, defined below */
98#define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */
99#define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */
100#define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */
101#define EC_MEMMAP_BATT_CCNT 0x5c /* Battery Cycle Count */
102#define EC_MEMMAP_BATT_MFGR 0x60 /* Battery Manufacturer String */
103#define EC_MEMMAP_BATT_MODEL 0x68 /* Battery Model Number String */
104#define EC_MEMMAP_BATT_SERIAL 0x70 /* Battery Serial Number String */
105#define EC_MEMMAP_BATT_TYPE 0x78 /* Battery Type String */
106
107/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */
108#define EC_TEMP_SENSOR_ENTRIES 16
109/*
110 * Number of temp sensors at EC_MEMMAP_TEMP_SENSOR_B.
111 *
112 * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2.
113 */
114#define EC_TEMP_SENSOR_B_ENTRIES 8
115#define EC_TEMP_SENSOR_NOT_PRESENT 0xff
116#define EC_TEMP_SENSOR_ERROR 0xfe
117#define EC_TEMP_SENSOR_NOT_POWERED 0xfd
118#define EC_TEMP_SENSOR_NOT_CALIBRATED 0xfc
119/*
120 * The offset of temperature value stored in mapped memory. This allows
121 * reporting a temperature range of 200K to 454K = -73C to 181C.
122 */
123#define EC_TEMP_SENSOR_OFFSET 200
124
125#define EC_FAN_SPEED_ENTRIES 4 /* Number of fans at EC_MEMMAP_FAN */
126#define EC_FAN_SPEED_NOT_PRESENT 0xffff /* Entry not present */
127#define EC_FAN_SPEED_STALLED 0xfffe /* Fan stalled */
128
129/* Battery bit flags at EC_MEMMAP_BATT_FLAG. */
130#define EC_BATT_FLAG_AC_PRESENT 0x01
131#define EC_BATT_FLAG_BATT_PRESENT 0x02
132#define EC_BATT_FLAG_DISCHARGING 0x04
133#define EC_BATT_FLAG_CHARGING 0x08
134#define EC_BATT_FLAG_LEVEL_CRITICAL 0x10
135
136/* Switch flags at EC_MEMMAP_SWITCHES */
137#define EC_SWITCH_LID_OPEN 0x01
138#define EC_SWITCH_POWER_BUTTON_PRESSED 0x02
139#define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04
140/* Recovery requested via keyboard */
141#define EC_SWITCH_KEYBOARD_RECOVERY 0x08
142/* Recovery requested via dedicated signal (from servo board) */
143#define EC_SWITCH_DEDICATED_RECOVERY 0x10
144/* Was fake developer mode switch; now unused. Remove in next refactor. */
145#define EC_SWITCH_IGNORE0 0x20
146
147/* Host command interface flags */
148/* Host command interface supports LPC args (LPC interface only) */
149#define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED 0x01
150
151/* Wireless switch flags */
152#define EC_WIRELESS_SWITCH_WLAN 0x01
153#define EC_WIRELESS_SWITCH_BLUETOOTH 0x02
154
155/*
156 * This header file is used in coreboot both in C and ACPI code. The ACPI code
157 * is pre-processed to handle constants but the ASL compiler is unable to
158 * handle actual C code so keep it separate.
159 */
160#ifndef __ACPI__
161
162/* LPC command status byte masks */
163/* EC has written a byte in the data register and host hasn't read it yet */
164#define EC_LPC_STATUS_TO_HOST 0x01
165/* Host has written a command/data byte and the EC hasn't read it yet */
166#define EC_LPC_STATUS_FROM_HOST 0x02
167/* EC is processing a command */
168#define EC_LPC_STATUS_PROCESSING 0x04
169/* Last write to EC was a command, not data */
170#define EC_LPC_STATUS_LAST_CMD 0x08
171/* EC is in burst mode. Unsupported by Chrome EC, so this bit is never set */
172#define EC_LPC_STATUS_BURST_MODE 0x10
173/* SCI event is pending (requesting SCI query) */
174#define EC_LPC_STATUS_SCI_PENDING 0x20
175/* SMI event is pending (requesting SMI query) */
176#define EC_LPC_STATUS_SMI_PENDING 0x40
177/* (reserved) */
178#define EC_LPC_STATUS_RESERVED 0x80
179
180/*
181 * EC is busy. This covers both the EC processing a command, and the host has
182 * written a new command but the EC hasn't picked it up yet.
183 */
184#define EC_LPC_STATUS_BUSY_MASK \
185 (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING)
186
187/* Host command response codes */
188enum ec_status {
189 EC_RES_SUCCESS = 0,
190 EC_RES_INVALID_COMMAND = 1,
191 EC_RES_ERROR = 2,
192 EC_RES_INVALID_PARAM = 3,
193 EC_RES_ACCESS_DENIED = 4,
194 EC_RES_INVALID_RESPONSE = 5,
195 EC_RES_INVALID_VERSION = 6,
196 EC_RES_INVALID_CHECKSUM = 7,
197 EC_RES_IN_PROGRESS = 8, /* Accepted, command in progress */
198 EC_RES_UNAVAILABLE = 9, /* No response available */
199 EC_RES_TIMEOUT = 10, /* We got a timeout */
200 EC_RES_OVERFLOW = 11, /* Table / data overflow */
201};
202
203/*
204 * Host event codes. Note these are 1-based, not 0-based, because ACPI query
205 * EC command uses code 0 to mean "no event pending". We explicitly specify
206 * each value in the enum listing so they won't change if we delete/insert an
207 * item or rearrange the list (it needs to be stable across platforms, not
208 * just within a single compiled instance).
209 */
210enum host_event_code {
211 EC_HOST_EVENT_LID_CLOSED = 1,
212 EC_HOST_EVENT_LID_OPEN = 2,
213 EC_HOST_EVENT_POWER_BUTTON = 3,
214 EC_HOST_EVENT_AC_CONNECTED = 4,
215 EC_HOST_EVENT_AC_DISCONNECTED = 5,
216 EC_HOST_EVENT_BATTERY_LOW = 6,
217 EC_HOST_EVENT_BATTERY_CRITICAL = 7,
218 EC_HOST_EVENT_BATTERY = 8,
219 EC_HOST_EVENT_THERMAL_THRESHOLD = 9,
220 EC_HOST_EVENT_THERMAL_OVERLOAD = 10,
221 EC_HOST_EVENT_THERMAL = 11,
222 EC_HOST_EVENT_USB_CHARGER = 12,
223 EC_HOST_EVENT_KEY_PRESSED = 13,
224 /*
225 * EC has finished initializing the host interface. The host can check
226 * for this event following sending a EC_CMD_REBOOT_EC command to
227 * determine when the EC is ready to accept subsequent commands.
228 */
229 EC_HOST_EVENT_INTERFACE_READY = 14,
230 /* Keyboard recovery combo has been pressed */
231 EC_HOST_EVENT_KEYBOARD_RECOVERY = 15,
232
233 /* Shutdown due to thermal overload */
234 EC_HOST_EVENT_THERMAL_SHUTDOWN = 16,
235 /* Shutdown due to battery level too low */
236 EC_HOST_EVENT_BATTERY_SHUTDOWN = 17,
237
238 /*
239 * The high bit of the event mask is not used as a host event code. If
240 * it reads back as set, then the entire event mask should be
241 * considered invalid by the host. This can happen when reading the
242 * raw event status via EC_MEMMAP_HOST_EVENTS but the LPC interface is
243 * not initialized on the EC, or improperly configured on the host.
244 */
245 EC_HOST_EVENT_INVALID = 32
246};
247/* Host event mask */
248#define EC_HOST_EVENT_MASK(event_code) (1UL << ((event_code) - 1))
249
250/* Arguments at EC_LPC_ADDR_HOST_ARGS */
251struct ec_lpc_host_args {
252 uint8_t flags;
253 uint8_t command_version;
254 uint8_t data_size;
255 /*
256 * Checksum; sum of command + flags + command_version + data_size +
257 * all params/response data bytes.
258 */
259 uint8_t checksum;
260} __packed;
261
262/* Flags for ec_lpc_host_args.flags */
263/*
264 * Args are from host. Data area at EC_LPC_ADDR_HOST_PARAM contains command
265 * params.
266 *
267 * If EC gets a command and this flag is not set, this is an old-style command.
268 * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with
269 * unknown length. EC must respond with an old-style response (that is,
270 * withouth setting EC_HOST_ARGS_FLAG_TO_HOST).
271 */
272#define EC_HOST_ARGS_FLAG_FROM_HOST 0x01
273/*
274 * Args are from EC. Data area at EC_LPC_ADDR_HOST_PARAM contains response.
275 *
276 * If EC responds to a command and this flag is not set, this is an old-style
277 * response. Command version is 0 and response data from EC is at
278 * EC_LPC_ADDR_OLD_PARAM with unknown length.
279 */
280#define EC_HOST_ARGS_FLAG_TO_HOST 0x02
281
282/*
283 * Notes on commands:
284 *
285 * Each command is an 8-byte command value. Commands which take params or
286 * return response data specify structs for that data. If no struct is
287 * specified, the command does not input or output data, respectively.
288 * Parameter/response length is implicit in the structs. Some underlying
289 * communication protocols (I2C, SPI) may add length or checksum headers, but
290 * those are implementation-dependent and not defined here.
291 */
292
293/*****************************************************************************/
294/* General / test commands */
295
296/*
297 * Get protocol version, used to deal with non-backward compatible protocol
298 * changes.
299 */
300#define EC_CMD_PROTO_VERSION 0x00
301
302struct ec_response_proto_version {
303 uint32_t version;
304} __packed;
305
306/*
307 * Hello. This is a simple command to test the EC is responsive to
308 * commands.
309 */
310#define EC_CMD_HELLO 0x01
311
312struct ec_params_hello {
313 uint32_t in_data; /* Pass anything here */
314} __packed;
315
316struct ec_response_hello {
317 uint32_t out_data; /* Output will be in_data + 0x01020304 */
318} __packed;
319
320/* Get version number */
321#define EC_CMD_GET_VERSION 0x02
322
323enum ec_current_image {
324 EC_IMAGE_UNKNOWN = 0,
325 EC_IMAGE_RO,
326 EC_IMAGE_RW
327};
328
329struct ec_response_get_version {
330 /* Null-terminated version strings for RO, RW */
331 char version_string_ro[32];
332 char version_string_rw[32];
333 char reserved[32]; /* Was previously RW-B string */
334 uint32_t current_image; /* One of ec_current_image */
335} __packed;
336
337/* Read test */
338#define EC_CMD_READ_TEST 0x03
339
340struct ec_params_read_test {
341 uint32_t offset; /* Starting value for read buffer */
342 uint32_t size; /* Size to read in bytes */
343} __packed;
344
345struct ec_response_read_test {
346 uint32_t data[32];
347} __packed;
348
349/*
350 * Get build information
351 *
352 * Response is null-terminated string.
353 */
354#define EC_CMD_GET_BUILD_INFO 0x04
355
356/* Get chip info */
357#define EC_CMD_GET_CHIP_INFO 0x05
358
359struct ec_response_get_chip_info {
360 /* Null-terminated strings */
361 char vendor[32];
362 char name[32];
363 char revision[32]; /* Mask version */
364} __packed;
365
366/* Get board HW version */
367#define EC_CMD_GET_BOARD_VERSION 0x06
368
369struct ec_response_board_version {
370 uint16_t board_version; /* A monotonously incrementing number. */
371} __packed;
372
373/*
374 * Read memory-mapped data.
375 *
376 * This is an alternate interface to memory-mapped data for bus protocols
377 * which don't support direct-mapped memory - I2C, SPI, etc.
378 *
379 * Response is params.size bytes of data.
380 */
381#define EC_CMD_READ_MEMMAP 0x07
382
383struct ec_params_read_memmap {
384 uint8_t offset; /* Offset in memmap (EC_MEMMAP_*) */
385 uint8_t size; /* Size to read in bytes */
386} __packed;
387
388/* Read versions supported for a command */
389#define EC_CMD_GET_CMD_VERSIONS 0x08
390
391struct ec_params_get_cmd_versions {
392 uint8_t cmd; /* Command to check */
393} __packed;
394
395struct ec_response_get_cmd_versions {
396 /*
397 * Mask of supported versions; use EC_VER_MASK() to compare with a
398 * desired version.
399 */
400 uint32_t version_mask;
401} __packed;
402
403/*
404 * Check EC communcations status (busy). This is needed on i2c/spi but not
405 * on lpc since it has its own out-of-band busy indicator.
406 *
407 * lpc must read the status from the command register. Attempting this on
408 * lpc will overwrite the args/parameter space and corrupt its data.
409 */
410#define EC_CMD_GET_COMMS_STATUS 0x09
411
412/* Avoid using ec_status which is for return values */
413enum ec_comms_status {
414 EC_COMMS_STATUS_PROCESSING = 1 << 0, /* Processing cmd */
415};
416
417struct ec_response_get_comms_status {
418 uint32_t flags; /* Mask of enum ec_comms_status */
419} __packed;
420
421
422/*****************************************************************************/
423/* Flash commands */
424
425/* Get flash info */
426#define EC_CMD_FLASH_INFO 0x10
427
428struct ec_response_flash_info {
429 /* Usable flash size, in bytes */
430 uint32_t flash_size;
431 /*
432 * Write block size. Write offset and size must be a multiple
433 * of this.
434 */
435 uint32_t write_block_size;
436 /*
437 * Erase block size. Erase offset and size must be a multiple
438 * of this.
439 */
440 uint32_t erase_block_size;
441 /*
442 * Protection block size. Protection offset and size must be a
443 * multiple of this.
444 */
445 uint32_t protect_block_size;
446} __packed;
447
448/*
449 * Read flash
450 *
451 * Response is params.size bytes of data.
452 */
453#define EC_CMD_FLASH_READ 0x11
454
455struct ec_params_flash_read {
456 uint32_t offset; /* Byte offset to read */
457 uint32_t size; /* Size to read in bytes */
458} __packed;
459
460/* Write flash */
461#define EC_CMD_FLASH_WRITE 0x12
462
463struct ec_params_flash_write {
464 uint32_t offset; /* Byte offset to write */
465 uint32_t size; /* Size to write in bytes */
466 /*
467 * Data to write. Could really use EC_PARAM_SIZE - 8, but tidiest to
468 * use a power of 2 so writes stay aligned.
469 */
470 uint8_t data[64];
471} __packed;
472
473/* Erase flash */
474#define EC_CMD_FLASH_ERASE 0x13
475
476struct ec_params_flash_erase {
477 uint32_t offset; /* Byte offset to erase */
478 uint32_t size; /* Size to erase in bytes */
479} __packed;
480
481/*
482 * Get/set flash protection.
483 *
484 * If mask!=0, sets/clear the requested bits of flags. Depending on the
485 * firmware write protect GPIO, not all flags will take effect immediately;
486 * some flags require a subsequent hard reset to take effect. Check the
487 * returned flags bits to see what actually happened.
488 *
489 * If mask=0, simply returns the current flags state.
490 */
491#define EC_CMD_FLASH_PROTECT 0x15
492#define EC_VER_FLASH_PROTECT 1 /* Command version 1 */
493
494/* Flags for flash protection */
495/* RO flash code protected when the EC boots */
496#define EC_FLASH_PROTECT_RO_AT_BOOT (1 << 0)
497/*
498 * RO flash code protected now. If this bit is set, at-boot status cannot
499 * be changed.
500 */
501#define EC_FLASH_PROTECT_RO_NOW (1 << 1)
502/* Entire flash code protected now, until reboot. */
503#define EC_FLASH_PROTECT_ALL_NOW (1 << 2)
504/* Flash write protect GPIO is asserted now */
505#define EC_FLASH_PROTECT_GPIO_ASSERTED (1 << 3)
506/* Error - at least one bank of flash is stuck locked, and cannot be unlocked */
507#define EC_FLASH_PROTECT_ERROR_STUCK (1 << 4)
508/*
509 * Error - flash protection is in inconsistent state. At least one bank of
510 * flash which should be protected is not protected. Usually fixed by
511 * re-requesting the desired flags, or by a hard reset if that fails.
512 */
513#define EC_FLASH_PROTECT_ERROR_INCONSISTENT (1 << 5)
514/* Entile flash code protected when the EC boots */
515#define EC_FLASH_PROTECT_ALL_AT_BOOT (1 << 6)
516
517struct ec_params_flash_protect {
518 uint32_t mask; /* Bits in flags to apply */
519 uint32_t flags; /* New flags to apply */
520} __packed;
521
522struct ec_response_flash_protect {
523 /* Current value of flash protect flags */
524 uint32_t flags;
525 /*
526 * Flags which are valid on this platform. This allows the caller
527 * to distinguish between flags which aren't set vs. flags which can't
528 * be set on this platform.
529 */
530 uint32_t valid_flags;
531 /* Flags which can be changed given the current protection state */
532 uint32_t writable_flags;
533} __packed;
534
535/*
536 * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash
537 * write protect. These commands may be reused with version > 0.
538 */
539
540/* Get the region offset/size */
541#define EC_CMD_FLASH_REGION_INFO 0x16
542#define EC_VER_FLASH_REGION_INFO 1
543
544enum ec_flash_region {
545 /* Region which holds read-only EC image */
546 EC_FLASH_REGION_RO,
547 /* Region which holds rewritable EC image */
548 EC_FLASH_REGION_RW,
549 /*
550 * Region which should be write-protected in the factory (a superset of
551 * EC_FLASH_REGION_RO)
552 */
553 EC_FLASH_REGION_WP_RO,
554};
555
556struct ec_params_flash_region_info {
557 uint32_t region; /* enum ec_flash_region */
558} __packed;
559
560struct ec_response_flash_region_info {
561 uint32_t offset;
562 uint32_t size;
563} __packed;
564
565/* Read/write VbNvContext */
566#define EC_CMD_VBNV_CONTEXT 0x17
567#define EC_VER_VBNV_CONTEXT 1
568#define EC_VBNV_BLOCK_SIZE 16
569
570enum ec_vbnvcontext_op {
571 EC_VBNV_CONTEXT_OP_READ,
572 EC_VBNV_CONTEXT_OP_WRITE,
573};
574
575struct ec_params_vbnvcontext {
576 uint32_t op;
577 uint8_t block[EC_VBNV_BLOCK_SIZE];
578} __packed;
579
580struct ec_response_vbnvcontext {
581 uint8_t block[EC_VBNV_BLOCK_SIZE];
582} __packed;
583
584/*****************************************************************************/
585/* PWM commands */
586
587/* Get fan target RPM */
588#define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20
589
590struct ec_response_pwm_get_fan_rpm {
591 uint32_t rpm;
592} __packed;
593
594/* Set target fan RPM */
595#define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21
596
597struct ec_params_pwm_set_fan_target_rpm {
598 uint32_t rpm;
599} __packed;
600
601/* Get keyboard backlight */
602#define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22
603
604struct ec_response_pwm_get_keyboard_backlight {
605 uint8_t percent;
606 uint8_t enabled;
607} __packed;
608
609/* Set keyboard backlight */
610#define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23
611
612struct ec_params_pwm_set_keyboard_backlight {
613 uint8_t percent;
614} __packed;
615
616/* Set target fan PWM duty cycle */
617#define EC_CMD_PWM_SET_FAN_DUTY 0x24
618
619struct ec_params_pwm_set_fan_duty {
620 uint32_t percent;
621} __packed;
622
623/*****************************************************************************/
624/*
625 * Lightbar commands. This looks worse than it is. Since we only use one HOST
626 * command to say "talk to the lightbar", we put the "and tell it to do X" part
627 * into a subcommand. We'll make separate structs for subcommands with
628 * different input args, so that we know how much to expect.
629 */
630#define EC_CMD_LIGHTBAR_CMD 0x28
631
632struct rgb_s {
633 uint8_t r, g, b;
634};
635
636#define LB_BATTERY_LEVELS 4
637/* List of tweakable parameters. NOTE: It's __packed so it can be sent in a
638 * host command, but the alignment is the same regardless. Keep it that way.
639 */
640struct lightbar_params {
641 /* Timing */
642 int google_ramp_up;
643 int google_ramp_down;
644 int s3s0_ramp_up;
645 int s0_tick_delay[2]; /* AC=0/1 */
646 int s0a_tick_delay[2]; /* AC=0/1 */
647 int s0s3_ramp_down;
648 int s3_sleep_for;
649 int s3_ramp_up;
650 int s3_ramp_down;
651
652 /* Oscillation */
653 uint8_t new_s0;
654 uint8_t osc_min[2]; /* AC=0/1 */
655 uint8_t osc_max[2]; /* AC=0/1 */
656 uint8_t w_ofs[2]; /* AC=0/1 */
657
658 /* Brightness limits based on the backlight and AC. */
659 uint8_t bright_bl_off_fixed[2]; /* AC=0/1 */
660 uint8_t bright_bl_on_min[2]; /* AC=0/1 */
661 uint8_t bright_bl_on_max[2]; /* AC=0/1 */
662
663 /* Battery level thresholds */
664 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
665
666 /* Map [AC][battery_level] to color index */
667 uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */
668 uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */
669
670 /* Color palette */
671 struct rgb_s color[8]; /* 0-3 are Google colors */
672} __packed;
673
674struct ec_params_lightbar {
675 uint8_t cmd; /* Command (see enum lightbar_command) */
676 union {
677 struct {
678 /* no args */
679 } dump, off, on, init, get_seq, get_params;
680
681 struct num {
682 uint8_t num;
683 } brightness, seq, demo;
684
685 struct reg {
686 uint8_t ctrl, reg, value;
687 } reg;
688
689 struct rgb {
690 uint8_t led, red, green, blue;
691 } rgb;
692
693 struct lightbar_params set_params;
694 };
695} __packed;
696
697struct ec_response_lightbar {
698 union {
699 struct dump {
700 struct {
701 uint8_t reg;
702 uint8_t ic0;
703 uint8_t ic1;
704 } vals[23];
705 } dump;
706
707 struct get_seq {
708 uint8_t num;
709 } get_seq;
710
711 struct lightbar_params get_params;
712
713 struct {
714 /* no return params */
715 } off, on, init, brightness, seq, reg, rgb, demo, set_params;
716 };
717} __packed;
718
719/* Lightbar commands */
720enum lightbar_command {
721 LIGHTBAR_CMD_DUMP = 0,
722 LIGHTBAR_CMD_OFF = 1,
723 LIGHTBAR_CMD_ON = 2,
724 LIGHTBAR_CMD_INIT = 3,
725 LIGHTBAR_CMD_BRIGHTNESS = 4,
726 LIGHTBAR_CMD_SEQ = 5,
727 LIGHTBAR_CMD_REG = 6,
728 LIGHTBAR_CMD_RGB = 7,
729 LIGHTBAR_CMD_GET_SEQ = 8,
730 LIGHTBAR_CMD_DEMO = 9,
731 LIGHTBAR_CMD_GET_PARAMS = 10,
732 LIGHTBAR_CMD_SET_PARAMS = 11,
733 LIGHTBAR_NUM_CMDS
734};
735
736/*****************************************************************************/
737/* Verified boot commands */
738
739/*
740 * Note: command code 0x29 version 0 was VBOOT_CMD in Link EVT; it may be
741 * reused for other purposes with version > 0.
742 */
743
744/* Verified boot hash command */
745#define EC_CMD_VBOOT_HASH 0x2A
746
747struct ec_params_vboot_hash {
748 uint8_t cmd; /* enum ec_vboot_hash_cmd */
749 uint8_t hash_type; /* enum ec_vboot_hash_type */
750 uint8_t nonce_size; /* Nonce size; may be 0 */
751 uint8_t reserved0; /* Reserved; set 0 */
752 uint32_t offset; /* Offset in flash to hash */
753 uint32_t size; /* Number of bytes to hash */
754 uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */
755} __packed;
756
757struct ec_response_vboot_hash {
758 uint8_t status; /* enum ec_vboot_hash_status */
759 uint8_t hash_type; /* enum ec_vboot_hash_type */
760 uint8_t digest_size; /* Size of hash digest in bytes */
761 uint8_t reserved0; /* Ignore; will be 0 */
762 uint32_t offset; /* Offset in flash which was hashed */
763 uint32_t size; /* Number of bytes hashed */
764 uint8_t hash_digest[64]; /* Hash digest data */
765} __packed;
766
767enum ec_vboot_hash_cmd {
768 EC_VBOOT_HASH_GET = 0, /* Get current hash status */
769 EC_VBOOT_HASH_ABORT = 1, /* Abort calculating current hash */
770 EC_VBOOT_HASH_START = 2, /* Start computing a new hash */
771 EC_VBOOT_HASH_RECALC = 3, /* Synchronously compute a new hash */
772};
773
774enum ec_vboot_hash_type {
775 EC_VBOOT_HASH_TYPE_SHA256 = 0, /* SHA-256 */
776};
777
778enum ec_vboot_hash_status {
779 EC_VBOOT_HASH_STATUS_NONE = 0, /* No hash (not started, or aborted) */
780 EC_VBOOT_HASH_STATUS_DONE = 1, /* Finished computing a hash */
781 EC_VBOOT_HASH_STATUS_BUSY = 2, /* Busy computing a hash */
782};
783
784/*
785 * Special values for offset for EC_VBOOT_HASH_START and EC_VBOOT_HASH_RECALC.
786 * If one of these is specified, the EC will automatically update offset and
787 * size to the correct values for the specified image (RO or RW).
788 */
789#define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe
790#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd
791
792/*****************************************************************************/
793/* USB charging control commands */
794
795/* Set USB port charging mode */
796#define EC_CMD_USB_CHARGE_SET_MODE 0x30
797
798struct ec_params_usb_charge_set_mode {
799 uint8_t usb_port_id;
800 uint8_t mode;
801} __packed;
802
803/*****************************************************************************/
804/* Persistent storage for host */
805
806/* Maximum bytes that can be read/written in a single command */
807#define EC_PSTORE_SIZE_MAX 64
808
809/* Get persistent storage info */
810#define EC_CMD_PSTORE_INFO 0x40
811
812struct ec_response_pstore_info {
813 /* Persistent storage size, in bytes */
814 uint32_t pstore_size;
815 /* Access size; read/write offset and size must be a multiple of this */
816 uint32_t access_size;
817} __packed;
818
819/*
820 * Read persistent storage
821 *
822 * Response is params.size bytes of data.
823 */
824#define EC_CMD_PSTORE_READ 0x41
825
826struct ec_params_pstore_read {
827 uint32_t offset; /* Byte offset to read */
828 uint32_t size; /* Size to read in bytes */
829} __packed;
830
831/* Write persistent storage */
832#define EC_CMD_PSTORE_WRITE 0x42
833
834struct ec_params_pstore_write {
835 uint32_t offset; /* Byte offset to write */
836 uint32_t size; /* Size to write in bytes */
837 uint8_t data[EC_PSTORE_SIZE_MAX];
838} __packed;
839
840/*****************************************************************************/
841/* Real-time clock */
842
843/* RTC params and response structures */
844struct ec_params_rtc {
845 uint32_t time;
846} __packed;
847
848struct ec_response_rtc {
849 uint32_t time;
850} __packed;
851
852/* These use ec_response_rtc */
853#define EC_CMD_RTC_GET_VALUE 0x44
854#define EC_CMD_RTC_GET_ALARM 0x45
855
856/* These all use ec_params_rtc */
857#define EC_CMD_RTC_SET_VALUE 0x46
858#define EC_CMD_RTC_SET_ALARM 0x47
859
860/*****************************************************************************/
861/* Port80 log access */
862
863/* Get last port80 code from previous boot */
864#define EC_CMD_PORT80_LAST_BOOT 0x48
865
866struct ec_response_port80_last_boot {
867 uint16_t code;
868} __packed;
869
870/*****************************************************************************/
871/* Thermal engine commands */
872
873/* Set thershold value */
874#define EC_CMD_THERMAL_SET_THRESHOLD 0x50
875
876struct ec_params_thermal_set_threshold {
877 uint8_t sensor_type;
878 uint8_t threshold_id;
879 uint16_t value;
880} __packed;
881
882/* Get threshold value */
883#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
884
885struct ec_params_thermal_get_threshold {
886 uint8_t sensor_type;
887 uint8_t threshold_id;
888} __packed;
889
890struct ec_response_thermal_get_threshold {
891 uint16_t value;
892} __packed;
893
894/* Toggle automatic fan control */
895#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52
896
897/* Get TMP006 calibration data */
898#define EC_CMD_TMP006_GET_CALIBRATION 0x53
899
900struct ec_params_tmp006_get_calibration {
901 uint8_t index;
902} __packed;
903
904struct ec_response_tmp006_get_calibration {
905 float s0;
906 float b0;
907 float b1;
908 float b2;
909} __packed;
910
911/* Set TMP006 calibration data */
912#define EC_CMD_TMP006_SET_CALIBRATION 0x54
913
914struct ec_params_tmp006_set_calibration {
915 uint8_t index;
916 uint8_t reserved[3]; /* Reserved; set 0 */
917 float s0;
918 float b0;
919 float b1;
920 float b2;
921} __packed;
922
923/*****************************************************************************/
924/* MKBP - Matrix KeyBoard Protocol */
925
926/*
927 * Read key state
928 *
929 * Returns raw data for keyboard cols; see ec_response_mkbp_info.cols for
930 * expected response size.
931 */
932#define EC_CMD_MKBP_STATE 0x60
933
934/* Provide information about the matrix : number of rows and columns */
935#define EC_CMD_MKBP_INFO 0x61
936
937struct ec_response_mkbp_info {
938 uint32_t rows;
939 uint32_t cols;
940 uint8_t switches;
941} __packed;
942
943/* Simulate key press */
944#define EC_CMD_MKBP_SIMULATE_KEY 0x62
945
946struct ec_params_mkbp_simulate_key {
947 uint8_t col;
948 uint8_t row;
949 uint8_t pressed;
950} __packed;
951
952/* Configure keyboard scanning */
953#define EC_CMD_MKBP_SET_CONFIG 0x64
954#define EC_CMD_MKBP_GET_CONFIG 0x65
955
956/* flags */
957enum mkbp_config_flags {
958 EC_MKBP_FLAGS_ENABLE = 1, /* Enable keyboard scanning */
959};
960
961enum mkbp_config_valid {
962 EC_MKBP_VALID_SCAN_PERIOD = 1 << 0,
963 EC_MKBP_VALID_POLL_TIMEOUT = 1 << 1,
964 EC_MKBP_VALID_MIN_POST_SCAN_DELAY = 1 << 3,
965 EC_MKBP_VALID_OUTPUT_SETTLE = 1 << 4,
966 EC_MKBP_VALID_DEBOUNCE_DOWN = 1 << 5,
967 EC_MKBP_VALID_DEBOUNCE_UP = 1 << 6,
968 EC_MKBP_VALID_FIFO_MAX_DEPTH = 1 << 7,
969};
970
971/* Configuration for our key scanning algorithm */
972struct ec_mkbp_config {
973 uint32_t valid_mask; /* valid fields */
974 uint8_t flags; /* some flags (enum mkbp_config_flags) */
975 uint8_t valid_flags; /* which flags are valid */
976 uint16_t scan_period_us; /* period between start of scans */
977 /* revert to interrupt mode after no activity for this long */
978 uint32_t poll_timeout_us;
979 /*
980 * minimum post-scan relax time. Once we finish a scan we check
981 * the time until we are due to start the next one. If this time is
982 * shorter this field, we use this instead.
983 */
984 uint16_t min_post_scan_delay_us;
985 /* delay between setting up output and waiting for it to settle */
986 uint16_t output_settle_us;
987 uint16_t debounce_down_us; /* time for debounce on key down */
988 uint16_t debounce_up_us; /* time for debounce on key up */
989 /* maximum depth to allow for fifo (0 = no keyscan output) */
990 uint8_t fifo_max_depth;
991} __packed;
992
993struct ec_params_mkbp_set_config {
994 struct ec_mkbp_config config;
995} __packed;
996
997struct ec_response_mkbp_get_config {
998 struct ec_mkbp_config config;
999} __packed;
1000
1001/* Run the key scan emulation */
1002#define EC_CMD_KEYSCAN_SEQ_CTRL 0x66
1003
1004enum ec_keyscan_seq_cmd {
1005 EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */
1006 EC_KEYSCAN_SEQ_CLEAR = 1, /* Clear sequence */
1007 EC_KEYSCAN_SEQ_ADD = 2, /* Add item to sequence */
1008 EC_KEYSCAN_SEQ_START = 3, /* Start running sequence */
1009 EC_KEYSCAN_SEQ_COLLECT = 4, /* Collect sequence summary data */
1010};
1011
1012enum ec_collect_flags {
1013 /*
1014 * Indicates this scan was processed by the EC. Due to timing, some
1015 * scans may be skipped.
1016 */
1017 EC_KEYSCAN_SEQ_FLAG_DONE = 1 << 0,
1018};
1019
1020struct ec_collect_item {
1021 uint8_t flags; /* some flags (enum ec_collect_flags) */
1022};
1023
1024struct ec_params_keyscan_seq_ctrl {
1025 uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */
1026 union {
1027 struct {
1028 uint8_t active; /* still active */
1029 uint8_t num_items; /* number of items */
1030 /* Current item being presented */
1031 uint8_t cur_item;
1032 } status;
1033 struct {
1034 /*
1035 * Absolute time for this scan, measured from the
1036 * start of the sequence.
1037 */
1038 uint32_t time_us;
1039 uint8_t scan[0]; /* keyscan data */
1040 } add;
1041 struct {
1042 uint8_t start_item; /* First item to return */
1043 uint8_t num_items; /* Number of items to return */
1044 } collect;
1045 };
1046} __packed;
1047
1048struct ec_result_keyscan_seq_ctrl {
1049 union {
1050 struct {
1051 uint8_t num_items; /* Number of items */
1052 /* Data for each item */
1053 struct ec_collect_item item[0];
1054 } collect;
1055 };
1056} __packed;
1057
1058/*****************************************************************************/
1059/* Temperature sensor commands */
1060
1061/* Read temperature sensor info */
1062#define EC_CMD_TEMP_SENSOR_GET_INFO 0x70
1063
1064struct ec_params_temp_sensor_get_info {
1065 uint8_t id;
1066} __packed;
1067
1068struct ec_response_temp_sensor_get_info {
1069 char sensor_name[32];
1070 uint8_t sensor_type;
1071} __packed;
1072
1073/*****************************************************************************/
1074
1075/*
1076 * Note: host commands 0x80 - 0x87 are reserved to avoid conflict with ACPI
1077 * commands accidentally sent to the wrong interface. See the ACPI section
1078 * below.
1079 */
1080
1081/*****************************************************************************/
1082/* Host event commands */
1083
1084/*
1085 * Host event mask params and response structures, shared by all of the host
1086 * event commands below.
1087 */
1088struct ec_params_host_event_mask {
1089 uint32_t mask;
1090} __packed;
1091
1092struct ec_response_host_event_mask {
1093 uint32_t mask;
1094} __packed;
1095
1096/* These all use ec_response_host_event_mask */
1097#define EC_CMD_HOST_EVENT_GET_B 0x87
1098#define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x88
1099#define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x89
1100#define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d
1101
1102/* These all use ec_params_host_event_mask */
1103#define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x8a
1104#define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x8b
1105#define EC_CMD_HOST_EVENT_CLEAR 0x8c
1106#define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e
1107#define EC_CMD_HOST_EVENT_CLEAR_B 0x8f
1108
1109/*****************************************************************************/
1110/* Switch commands */
1111
1112/* Enable/disable LCD backlight */
1113#define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90
1114
1115struct ec_params_switch_enable_backlight {
1116 uint8_t enabled;
1117} __packed;
1118
1119/* Enable/disable WLAN/Bluetooth */
1120#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91
1121
1122struct ec_params_switch_enable_wireless {
1123 uint8_t enabled;
1124} __packed;
1125
1126/*****************************************************************************/
1127/* GPIO commands. Only available on EC if write protect has been disabled. */
1128
1129/* Set GPIO output value */
1130#define EC_CMD_GPIO_SET 0x92
1131
1132struct ec_params_gpio_set {
1133 char name[32];
1134 uint8_t val;
1135} __packed;
1136
1137/* Get GPIO value */
1138#define EC_CMD_GPIO_GET 0x93
1139
1140struct ec_params_gpio_get {
1141 char name[32];
1142} __packed;
1143struct ec_response_gpio_get {
1144 uint8_t val;
1145} __packed;
1146
1147/*****************************************************************************/
1148/* I2C commands. Only available when flash write protect is unlocked. */
1149
1150/* Read I2C bus */
1151#define EC_CMD_I2C_READ 0x94
1152
1153struct ec_params_i2c_read {
1154 uint16_t addr;
1155 uint8_t read_size; /* Either 8 or 16. */
1156 uint8_t port;
1157 uint8_t offset;
1158} __packed;
1159struct ec_response_i2c_read {
1160 uint16_t data;
1161} __packed;
1162
1163/* Write I2C bus */
1164#define EC_CMD_I2C_WRITE 0x95
1165
1166struct ec_params_i2c_write {
1167 uint16_t data;
1168 uint16_t addr;
1169 uint8_t write_size; /* Either 8 or 16. */
1170 uint8_t port;
1171 uint8_t offset;
1172} __packed;
1173
1174/*****************************************************************************/
1175/* Charge state commands. Only available when flash write protect unlocked. */
1176
1177/* Force charge state machine to stop in idle mode */
1178#define EC_CMD_CHARGE_FORCE_IDLE 0x96
1179
1180struct ec_params_force_idle {
1181 uint8_t enabled;
1182} __packed;
1183
1184/*****************************************************************************/
1185/* Console commands. Only available when flash write protect is unlocked. */
1186
1187/* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */
1188#define EC_CMD_CONSOLE_SNAPSHOT 0x97
1189
1190/*
1191 * Read next chunk of data from saved snapshot.
1192 *
1193 * Response is null-terminated string. Empty string, if there is no more
1194 * remaining output.
1195 */
1196#define EC_CMD_CONSOLE_READ 0x98
1197
1198/*****************************************************************************/
1199
1200/*
1201 * Cut off battery power output if the battery supports.
1202 *
1203 * For unsupported battery, just don't implement this command and lets EC
1204 * return EC_RES_INVALID_COMMAND.
1205 */
1206#define EC_CMD_BATTERY_CUT_OFF 0x99
1207
1208/*****************************************************************************/
1209/* Temporary debug commands. TODO: remove this crosbug.com/p/13849 */
1210
1211/*
1212 * Dump charge state machine context.
1213 *
1214 * Response is a binary dump of charge state machine context.
1215 */
1216#define EC_CMD_CHARGE_DUMP 0xa0
1217
1218/*
1219 * Set maximum battery charging current.
1220 */
1221#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1
1222
1223struct ec_params_current_limit {
1224 uint32_t limit;
1225} __packed;
1226
1227/*****************************************************************************/
1228/* System commands */
1229
1230/*
1231 * TODO: this is a confusing name, since it doesn't necessarily reboot the EC.
1232 * Rename to "set image" or something similar.
1233 */
1234#define EC_CMD_REBOOT_EC 0xd2
1235
1236/* Command */
1237enum ec_reboot_cmd {
1238 EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */
1239 EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */
1240 EC_REBOOT_JUMP_RW = 2, /* Jump to RW without rebooting */
1241 /* (command 3 was jump to RW-B) */
1242 EC_REBOOT_COLD = 4, /* Cold-reboot */
1243 EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */
1244 EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */
1245};
1246
1247/* Flags for ec_params_reboot_ec.reboot_flags */
1248#define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */
1249#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */
1250
1251struct ec_params_reboot_ec {
1252 uint8_t cmd; /* enum ec_reboot_cmd */
1253 uint8_t flags; /* See EC_REBOOT_FLAG_* */
1254} __packed;
1255
1256/*
1257 * Get information on last EC panic.
1258 *
1259 * Returns variable-length platform-dependent panic information. See panic.h
1260 * for details.
1261 */
1262#define EC_CMD_GET_PANIC_INFO 0xd3
1263
1264/*****************************************************************************/
1265/*
1266 * ACPI commands
1267 *
1268 * These are valid ONLY on the ACPI command/data port.
1269 */
1270
1271/*
1272 * ACPI Read Embedded Controller
1273 *
1274 * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
1275 *
1276 * Use the following sequence:
1277 *
1278 * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD
1279 * - Wait for EC_LPC_CMDR_PENDING bit to clear
1280 * - Write address to EC_LPC_ADDR_ACPI_DATA
1281 * - Wait for EC_LPC_CMDR_DATA bit to set
1282 * - Read value from EC_LPC_ADDR_ACPI_DATA
1283 */
1284#define EC_CMD_ACPI_READ 0x80
1285
1286/*
1287 * ACPI Write Embedded Controller
1288 *
1289 * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
1290 *
1291 * Use the following sequence:
1292 *
1293 * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD
1294 * - Wait for EC_LPC_CMDR_PENDING bit to clear
1295 * - Write address to EC_LPC_ADDR_ACPI_DATA
1296 * - Wait for EC_LPC_CMDR_PENDING bit to clear
1297 * - Write value to EC_LPC_ADDR_ACPI_DATA
1298 */
1299#define EC_CMD_ACPI_WRITE 0x81
1300
1301/*
1302 * ACPI Query Embedded Controller
1303 *
1304 * This clears the lowest-order bit in the currently pending host events, and
1305 * sets the result code to the 1-based index of the bit (event 0x00000001 = 1,
1306 * event 0x80000000 = 32), or 0 if no event was pending.
1307 */
1308#define EC_CMD_ACPI_QUERY_EVENT 0x84
1309
1310/* Valid addresses in ACPI memory space, for read/write commands */
1311/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */
1312#define EC_ACPI_MEM_VERSION 0x00
1313/*
1314 * Test location; writing value here updates test compliment byte to (0xff -
1315 * value).
1316 */
1317#define EC_ACPI_MEM_TEST 0x01
1318/* Test compliment; writes here are ignored. */
1319#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02
1320/* Keyboard backlight brightness percent (0 - 100) */
1321#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03
1322
1323/* Current version of ACPI memory address space */
1324#define EC_ACPI_MEM_VERSION_CURRENT 1
1325
1326
1327/*****************************************************************************/
1328/*
1329 * Special commands
1330 *
1331 * These do not follow the normal rules for commands. See each command for
1332 * details.
1333 */
1334
1335/*
1336 * Reboot NOW
1337 *
1338 * This command will work even when the EC LPC interface is busy, because the
1339 * reboot command is processed at interrupt level. Note that when the EC
1340 * reboots, the host will reboot too, so there is no response to this command.
1341 *
1342 * Use EC_CMD_REBOOT_EC to reboot the EC more politely.
1343 */
1344#define EC_CMD_REBOOT 0xd1 /* Think "die" */
1345
1346/*
1347 * Resend last response (not supported on LPC).
1348 *
1349 * Returns EC_RES_UNAVAILABLE if there is no response available - for example,
1350 * there was no previous command, or the previous command's response was too
1351 * big to save.
1352 */
1353#define EC_CMD_RESEND_RESPONSE 0xdb
1354
1355/*
1356 * This header byte on a command indicate version 0. Any header byte less
1357 * than this means that we are talking to an old EC which doesn't support
1358 * versioning. In that case, we assume version 0.
1359 *
1360 * Header bytes greater than this indicate a later version. For example,
1361 * EC_CMD_VERSION0 + 1 means we are using version 1.
1362 *
1363 * The old EC interface must not use commands 0dc or higher.
1364 */
1365#define EC_CMD_VERSION0 0xdc
1366
1367#endif /* !__ACPI__ */
1368
1369#endif /* __CROS_EC_COMMANDS_H */
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index 77a46ae2fc17..0bd69446bb05 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -489,7 +489,7 @@ struct prcmu_auto_pm_config {
489 489
490#ifdef CONFIG_MFD_DB8500_PRCMU 490#ifdef CONFIG_MFD_DB8500_PRCMU
491 491
492void db8500_prcmu_early_init(void); 492void db8500_prcmu_early_init(u32 phy_base, u32 size);
493int prcmu_set_rc_a2p(enum romcode_write); 493int prcmu_set_rc_a2p(enum romcode_write);
494enum romcode_read prcmu_get_rc_p2a(void); 494enum romcode_read prcmu_get_rc_p2a(void);
495enum ap_pwrst prcmu_get_xp70_current_state(void); 495enum ap_pwrst prcmu_get_xp70_current_state(void);
@@ -522,12 +522,6 @@ int db8500_prcmu_load_a9wdog(u8 id, u32 val);
522void db8500_prcmu_system_reset(u16 reset_code); 522void db8500_prcmu_system_reset(u16 reset_code);
523int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); 523int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
524u8 db8500_prcmu_get_power_state_result(void); 524u8 db8500_prcmu_get_power_state_result(void);
525int db8500_prcmu_gic_decouple(void);
526int db8500_prcmu_gic_recouple(void);
527int db8500_prcmu_copy_gic_settings(void);
528bool db8500_prcmu_gic_pending_irq(void);
529bool db8500_prcmu_pending_irq(void);
530bool db8500_prcmu_is_cpu_in_wfi(int cpu);
531void db8500_prcmu_enable_wakeups(u32 wakeups); 525void db8500_prcmu_enable_wakeups(u32 wakeups);
532int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); 526int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
533int db8500_prcmu_request_clock(u8 clock, bool enable); 527int db8500_prcmu_request_clock(u8 clock, bool enable);
@@ -553,7 +547,7 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
553 547
554#else /* !CONFIG_MFD_DB8500_PRCMU */ 548#else /* !CONFIG_MFD_DB8500_PRCMU */
555 549
556static inline void db8500_prcmu_early_init(void) {} 550static inline void db8500_prcmu_early_init(u32 phy_base, u32 size) {}
557 551
558static inline int prcmu_set_rc_a2p(enum romcode_write code) 552static inline int prcmu_set_rc_a2p(enum romcode_write code)
559{ 553{
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 3abcca91eecd..689e6a0d9c99 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -237,6 +237,8 @@ struct prcmu_pdata
237 bool enable_set_ddr_opp; 237 bool enable_set_ddr_opp;
238 bool enable_ape_opp_100_voltage; 238 bool enable_ape_opp_100_voltage;
239 struct ab8500_platform_data *ab_platdata; 239 struct ab8500_platform_data *ab_platdata;
240 int ab_irq;
241 int irq_base;
240 u32 version_offset; 242 u32 version_offset;
241 u32 legacy_offset; 243 u32 legacy_offset;
242 u32 adt_offset; 244 u32 adt_offset;
@@ -276,9 +278,9 @@ struct prcmu_fw_version {
276 278
277#if defined(CONFIG_UX500_SOC_DB8500) 279#if defined(CONFIG_UX500_SOC_DB8500)
278 280
279static inline void __init prcmu_early_init(void) 281static inline void prcmu_early_init(u32 phy_base, u32 size)
280{ 282{
281 return db8500_prcmu_early_init(); 283 return db8500_prcmu_early_init(phy_base, size);
282} 284}
283 285
284static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 286static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
@@ -293,36 +295,6 @@ static inline u8 prcmu_get_power_state_result(void)
293 return db8500_prcmu_get_power_state_result(); 295 return db8500_prcmu_get_power_state_result();
294} 296}
295 297
296static inline int prcmu_gic_decouple(void)
297{
298 return db8500_prcmu_gic_decouple();
299}
300
301static inline int prcmu_gic_recouple(void)
302{
303 return db8500_prcmu_gic_recouple();
304}
305
306static inline bool prcmu_gic_pending_irq(void)
307{
308 return db8500_prcmu_gic_pending_irq();
309}
310
311static inline bool prcmu_is_cpu_in_wfi(int cpu)
312{
313 return db8500_prcmu_is_cpu_in_wfi(cpu);
314}
315
316static inline int prcmu_copy_gic_settings(void)
317{
318 return db8500_prcmu_copy_gic_settings();
319}
320
321static inline bool prcmu_pending_irq(void)
322{
323 return db8500_prcmu_pending_irq();
324}
325
326static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) 298static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
327{ 299{
328 return db8500_prcmu_set_epod(epod_id, epod_state); 300 return db8500_prcmu_set_epod(epod_id, epod_state);
@@ -500,7 +472,7 @@ static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
500} 472}
501#else 473#else
502 474
503static inline void __init prcmu_early_init(void) {} 475static inline void prcmu_early_init(u32 phy_base, u32 size) {}
504 476
505static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 477static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
506 bool keep_ap_pll) 478 bool keep_ap_pll)
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 3bbda22721ea..8f21daf62fb5 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -1,9 +1,10 @@
1/* 1/*
2 * TI Palmas 2 * TI Palmas
3 * 3 *
4 * Copyright 2011 Texas Instruments Inc. 4 * Copyright 2011-2013 Texas Instruments Inc.
5 * 5 *
6 * Author: Graeme Gregory <gg@slimlogic.co.uk> 6 * Author: Graeme Gregory <gg@slimlogic.co.uk>
7 * Author: Ian Lartey <ian@slimlogic.co.uk>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -22,6 +23,15 @@
22 23
23#define PALMAS_NUM_CLIENTS 3 24#define PALMAS_NUM_CLIENTS 3
24 25
26/* The ID_REVISION NUMBERS */
27#define PALMAS_CHIP_OLD_ID 0x0000
28#define PALMAS_CHIP_ID 0xC035
29#define PALMAS_CHIP_CHARGER_ID 0xC036
30
31#define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \
32 ((a) == PALMAS_CHIP_ID))
33#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
34
25struct palmas_pmic; 35struct palmas_pmic;
26struct palmas_gpadc; 36struct palmas_gpadc;
27struct palmas_resource; 37struct palmas_resource;
@@ -109,19 +119,6 @@ struct palmas_reg_init {
109 */ 119 */
110 int mode_sleep; 120 int mode_sleep;
111 121
112 /* tstep is the timestep loaded to the TSTEP register
113 *
114 * For SMPS
115 *
116 * 0: Jump (no slope control)
117 * 1: 10mV/us
118 * 2: 5mV/us
119 * 3: 2.5mV/us
120 *
121 * For LDO unused
122 */
123 int tstep;
124
125 /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE 122 /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE
126 * register. Set this is the default voltage set in OTP needs 123 * register. Set this is the default voltage set in OTP needs
127 * to be overridden. 124 * to be overridden.
@@ -154,6 +151,12 @@ enum palmas_regulators {
154 PALMAS_REG_LDO9, 151 PALMAS_REG_LDO9,
155 PALMAS_REG_LDOLN, 152 PALMAS_REG_LDOLN,
156 PALMAS_REG_LDOUSB, 153 PALMAS_REG_LDOUSB,
154 /* External regulators */
155 PALMAS_REG_REGEN1,
156 PALMAS_REG_REGEN2,
157 PALMAS_REG_REGEN3,
158 PALMAS_REG_SYSEN1,
159 PALMAS_REG_SYSEN2,
157 /* Total number of regulators */ 160 /* Total number of regulators */
158 PALMAS_NUM_REGS, 161 PALMAS_NUM_REGS,
159}; 162};
@@ -171,6 +174,9 @@ struct palmas_pmic_platform_data {
171 174
172 /* use LDO6 for vibrator control */ 175 /* use LDO6 for vibrator control */
173 int ldo6_vibrator; 176 int ldo6_vibrator;
177
178 /* Enable tracking mode of LDO8 */
179 bool enable_ldo8_tracking;
174}; 180};
175 181
176struct palmas_usb_platform_data { 182struct palmas_usb_platform_data {
@@ -331,6 +337,8 @@ struct palmas_pmic {
331 int smps457; 337 int smps457;
332 338
333 int range[PALMAS_REG_SMPS10]; 339 int range[PALMAS_REG_SMPS10];
340 unsigned int ramp_delay[PALMAS_REG_SMPS10];
341 unsigned int current_reg_mode[PALMAS_REG_SMPS10];
334}; 342};
335 343
336struct palmas_resource { 344struct palmas_resource {
diff --git a/include/linux/mfd/retu.h b/include/linux/mfd/retu.h
index 1e2715d5b836..65471c4a3926 100644
--- a/include/linux/mfd/retu.h
+++ b/include/linux/mfd/retu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Retu MFD driver interface 2 * Retu/Tahvo MFD driver interface
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General 4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of this 5 * Public License. See the file "COPYING" in the main directory of this
@@ -19,4 +19,10 @@ int retu_write(struct retu_dev *, u8, u16);
19#define RETU_REG_CC1 0x0d /* Common control register 1 */ 19#define RETU_REG_CC1 0x0d /* Common control register 1 */
20#define RETU_REG_STATUS 0x16 /* Status register */ 20#define RETU_REG_STATUS 0x16 /* Status register */
21 21
22/* Interrupt sources */
23#define TAHVO_INT_VBUS 0 /* VBUS state */
24
25/* Interrupt status */
26#define TAHVO_STAT_VBUS (1 << TAHVO_INT_VBUS)
27
22#endif /* __LINUX_MFD_RETU_H */ 28#endif /* __LINUX_MFD_RETU_H */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 26ea7f1b7caf..86bc635f8385 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -500,6 +500,8 @@
500#define BPP_POWER_15_PERCENT_ON 0x08 500#define BPP_POWER_15_PERCENT_ON 0x08
501#define BPP_POWER_ON 0x00 501#define BPP_POWER_ON 0x00
502#define BPP_POWER_MASK 0x0F 502#define BPP_POWER_MASK 0x0F
503#define SD_VCC_PARTIAL_POWER_ON 0x02
504#define SD_VCC_POWER_ON 0x00
503 505
504/* PWR_GATE_CTRL */ 506/* PWR_GATE_CTRL */
505#define PWR_GATE_EN 0x01 507#define PWR_GATE_EN 0x01
@@ -689,6 +691,40 @@
689#define IMAGE_FLAG_ADDR0 0xCE80 691#define IMAGE_FLAG_ADDR0 0xCE80
690#define IMAGE_FLAG_ADDR1 0xCE81 692#define IMAGE_FLAG_ADDR1 0xCE81
691 693
694/* Phy register */
695#define PHY_PCR 0x00
696#define PHY_RCR0 0x01
697#define PHY_RCR1 0x02
698#define PHY_RCR2 0x03
699#define PHY_RTCR 0x04
700#define PHY_RDR 0x05
701#define PHY_TCR0 0x06
702#define PHY_TCR1 0x07
703#define PHY_TUNE 0x08
704#define PHY_IMR 0x09
705#define PHY_BPCR 0x0A
706#define PHY_BIST 0x0B
707#define PHY_RAW_L 0x0C
708#define PHY_RAW_H 0x0D
709#define PHY_RAW_DATA 0x0E
710#define PHY_HOST_CLK_CTRL 0x0F
711#define PHY_DMR 0x10
712#define PHY_BACR 0x11
713#define PHY_IER 0x12
714#define PHY_BCSR 0x13
715#define PHY_BPR 0x14
716#define PHY_BPNR2 0x15
717#define PHY_BPNR 0x16
718#define PHY_BRNR2 0x17
719#define PHY_BENR 0x18
720#define PHY_REG_REV 0x19
721#define PHY_FLD0 0x1A
722#define PHY_FLD1 0x1B
723#define PHY_FLD2 0x1C
724#define PHY_FLD3 0x1D
725#define PHY_FLD4 0x1E
726#define PHY_DUM_REG 0x1F
727
692#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 728#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
693 729
694struct rtsx_pcr; 730struct rtsx_pcr;
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
new file mode 100644
index 000000000000..ba89b94e4a56
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,533 @@
1/*
2 * include/media/si476x-core.h -- Common definitions for si476x core
3 * device
4 *
5 * Copyright (C) 2012 Innovative Converged Devices(ICD)
6 * Copyright (C) 2013 Andrey Smirnov
7 *
8 * Author: Andrey Smirnov <andrew.smirnov@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 as published by
12 * the Free Software Foundation; version 2 of the License.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 */
20
21#ifndef SI476X_CORE_H
22#define SI476X_CORE_H
23
24#include <linux/kfifo.h>
25#include <linux/atomic.h>
26#include <linux/i2c.h>
27#include <linux/regmap.h>
28#include <linux/mutex.h>
29#include <linux/mfd/core.h>
30#include <linux/videodev2.h>
31#include <linux/regulator/consumer.h>
32
33#include <linux/mfd/si476x-platform.h>
34#include <linux/mfd/si476x-reports.h>
35
36/* Command Timeouts */
37#define SI476X_DEFAULT_TIMEOUT 100000
38#define SI476X_TIMEOUT_TUNE 700000
39#define SI476X_TIMEOUT_POWER_UP 330000
40#define SI476X_STATUS_POLL_US 0
41
42/* -------------------- si476x-i2c.c ----------------------- */
43
44enum si476x_freq_supported_chips {
45 SI476X_CHIP_SI4761 = 1,
46 SI476X_CHIP_SI4764,
47 SI476X_CHIP_SI4768,
48};
49
50enum si476x_part_revisions {
51 SI476X_REVISION_A10 = 0,
52 SI476X_REVISION_A20 = 1,
53 SI476X_REVISION_A30 = 2,
54};
55
56enum si476x_mfd_cells {
57 SI476X_RADIO_CELL = 0,
58 SI476X_CODEC_CELL,
59 SI476X_MFD_CELLS,
60};
61
62/**
63 * enum si476x_power_state - possible power state of the si476x
64 * device.
65 *
66 * @SI476X_POWER_DOWN: In this state all regulators are turned off
67 * and the reset line is pulled low. The device is completely
68 * inactive.
69 * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
70 * turned on, reset line pulled high, IRQ line is enabled(polling is
71 * active for polling use scenario) and device is turned on with
72 * POWER_UP command. The device is ready to be used.
73 * @SI476X_POWER_INCONSISTENT: This state indicates that previous
74 * power down was inconsistent, meaning some of the regulators were
75 * not turned down and thus use of the device, without power-cycling
76 * is impossible.
77 */
78enum si476x_power_state {
79 SI476X_POWER_DOWN = 0,
80 SI476X_POWER_UP_FULL = 1,
81 SI476X_POWER_INCONSISTENT = 2,
82};
83
84/**
85 * struct si476x_core - internal data structure representing the
86 * underlying "core" device which all the MFD cell-devices use.
87 *
88 * @client: Actual I2C client used to transfer commands to the chip.
89 * @chip_id: Last digit of the chip model(E.g. "1" for SI4761)
90 * @cells: MFD cell devices created by this driver.
91 * @cmd_lock: Mutex used to serialize all the requests to the core
92 * device. This filed should not be used directly. Instead
93 * si476x_core_lock()/si476x_core_unlock() should be used to get
94 * exclusive access to the "core" device.
95 * @users: Active users counter(Used by the radio cell)
96 * @rds_read_queue: Wait queue used to wait for RDS data.
97 * @rds_fifo: FIFO in which all the RDS data received from the chip is
98 * placed.
99 * @rds_fifo_drainer: Worker that drains on-chip RDS FIFO.
100 * @rds_drainer_is_working: Flag used for launching only one instance
101 * of the @rds_fifo_drainer.
102 * @rds_drainer_status_lock: Lock used to guard access to the
103 * @rds_drainer_is_working variable.
104 * @command: Wait queue for wainting on the command comapletion.
105 * @cts: Clear To Send flag set upon receiving first status with CTS
106 * set.
107 * @tuning: Wait queue used for wainting for tune/seek comand
108 * completion.
109 * @stc: Similar to @cts, but for the STC bit of the status value.
110 * @power_up_parameters: Parameters used as argument for POWER_UP
111 * command when the device is started.
112 * @state: Current power state of the device.
113 * @supplues: Structure containing handles to all power supplies used
114 * by the device (NULL ones are ignored).
115 * @gpio_reset: GPIO pin connectet to the RSTB pin of the chip.
116 * @pinmux: Chip's configurable pins configuration.
117 * @diversity_mode: Chips role when functioning in diversity mode.
118 * @status_monitor: Polling worker used in polling use case scenarion
119 * (when IRQ is not avalible).
120 * @revision: Chip's running firmware revision number(Used for correct
121 * command set support).
122 */
123
124struct si476x_core {
125 struct i2c_client *client;
126 struct regmap *regmap;
127 int chip_id;
128 struct mfd_cell cells[SI476X_MFD_CELLS];
129
130 struct mutex cmd_lock; /* for serializing fm radio operations */
131 atomic_t users;
132
133 wait_queue_head_t rds_read_queue;
134 struct kfifo rds_fifo;
135 struct work_struct rds_fifo_drainer;
136 bool rds_drainer_is_working;
137 struct mutex rds_drainer_status_lock;
138
139 wait_queue_head_t command;
140 atomic_t cts;
141
142 wait_queue_head_t tuning;
143 atomic_t stc;
144
145 struct si476x_power_up_args power_up_parameters;
146
147 enum si476x_power_state power_state;
148
149 struct regulator_bulk_data supplies[4];
150
151 int gpio_reset;
152
153 struct si476x_pinmux pinmux;
154 enum si476x_phase_diversity_mode diversity_mode;
155
156 atomic_t is_alive;
157
158 struct delayed_work status_monitor;
159#define SI476X_WORK_TO_CORE(w) container_of(to_delayed_work(w), \
160 struct si476x_core, \
161 status_monitor)
162
163 int revision;
164
165 int rds_fifo_depth;
166};
167
168static inline struct si476x_core *i2c_mfd_cell_to_core(struct device *dev)
169{
170 struct i2c_client *client = to_i2c_client(dev->parent);
171 return i2c_get_clientdata(client);
172}
173
174
175/**
176 * si476x_core_lock() - lock the core device to get an exclusive access
177 * to it.
178 */
179static inline void si476x_core_lock(struct si476x_core *core)
180{
181 mutex_lock(&core->cmd_lock);
182}
183
184/**
185 * si476x_core_unlock() - unlock the core device to relinquish an
186 * exclusive access to it.
187 */
188static inline void si476x_core_unlock(struct si476x_core *core)
189{
190 mutex_unlock(&core->cmd_lock);
191}
192
193/* *_TUNE_FREQ family of commands accept frequency in multiples of
194 10kHz */
195static inline u16 hz_to_si476x(struct si476x_core *core, int freq)
196{
197 u16 result;
198
199 switch (core->power_up_parameters.func) {
200 default:
201 case SI476X_FUNC_FM_RECEIVER:
202 result = freq / 10000;
203 break;
204 case SI476X_FUNC_AM_RECEIVER:
205 result = freq / 1000;
206 break;
207 }
208
209 return result;
210}
211
212static inline int si476x_to_hz(struct si476x_core *core, u16 freq)
213{
214 int result;
215
216 switch (core->power_up_parameters.func) {
217 default:
218 case SI476X_FUNC_FM_RECEIVER:
219 result = freq * 10000;
220 break;
221 case SI476X_FUNC_AM_RECEIVER:
222 result = freq * 1000;
223 break;
224 }
225
226 return result;
227}
228
229/* Since the V4L2_TUNER_CAP_LOW flag is supplied, V4L2 subsystem
230 * mesures frequency in 62.5 Hz units */
231
232static inline int hz_to_v4l2(int freq)
233{
234 return (freq * 10) / 625;
235}
236
237static inline int v4l2_to_hz(int freq)
238{
239 return (freq * 625) / 10;
240}
241
242static inline u16 v4l2_to_si476x(struct si476x_core *core, int freq)
243{
244 return hz_to_si476x(core, v4l2_to_hz(freq));
245}
246
247static inline int si476x_to_v4l2(struct si476x_core *core, u16 freq)
248{
249 return hz_to_v4l2(si476x_to_hz(core, freq));
250}
251
252
253
254/**
255 * struct si476x_func_info - structure containing result of the
256 * FUNC_INFO command.
257 *
258 * @firmware.major: Firmware major number.
259 * @firmware.minor[...]: Firmware minor numbers.
260 * @patch_id:
261 * @func: Mode tuner is working in.
262 */
263struct si476x_func_info {
264 struct {
265 u8 major, minor[2];
266 } firmware;
267 u16 patch_id;
268 enum si476x_func func;
269};
270
271/**
272 * struct si476x_power_down_args - structure used to pass parameters
273 * to POWER_DOWN command
274 *
275 * @xosc: true - Power down, but leav oscillator running.
276 * false - Full power down.
277 */
278struct si476x_power_down_args {
279 bool xosc;
280};
281
282/**
283 * enum si476x_tunemode - enum representing possible tune modes for
284 * the chip.
285 * @SI476X_TM_VALIDATED_NORMAL_TUNE: Unconditionally stay on the new
286 * channel after tune, tune status is valid.
287 * @SI476X_TM_INVALIDATED_FAST_TUNE: Unconditionally stay in the new
288 * channel after tune, tune status invalid.
289 * @SI476X_TM_VALIDATED_AF_TUNE: Jump back to previous channel if
290 * metric thresholds are not met.
291 * @SI476X_TM_VALIDATED_AF_CHECK: Unconditionally jump back to the
292 * previous channel.
293 */
294enum si476x_tunemode {
295 SI476X_TM_VALIDATED_NORMAL_TUNE = 0,
296 SI476X_TM_INVALIDATED_FAST_TUNE = 1,
297 SI476X_TM_VALIDATED_AF_TUNE = 2,
298 SI476X_TM_VALIDATED_AF_CHECK = 3,
299};
300
301/**
302 * enum si476x_smoothmetrics - enum containing the possible setting fo
303 * audio transitioning of the chip
304 * @SI476X_SM_INITIALIZE_AUDIO: Initialize audio state to match this
305 * new channel
306 * @SI476X_SM_TRANSITION_AUDIO: Transition audio state from previous
307 * channel values to the new values
308 */
309enum si476x_smoothmetrics {
310 SI476X_SM_INITIALIZE_AUDIO = 0,
311 SI476X_SM_TRANSITION_AUDIO = 1,
312};
313
314/**
315 * struct si476x_rds_status_report - the structure representing the
316 * response to 'FM_RD_STATUS' command
317 * @rdstpptyint: Traffic program flag(TP) and/or program type(PTY)
318 * code has changed.
319 * @rdspiint: Program indentifiaction(PI) code has changed.
320 * @rdssyncint: RDS synchronization has changed.
321 * @rdsfifoint: RDS was received and the RDS FIFO has at least
322 * 'FM_RDS_INTERRUPT_FIFO_COUNT' elements in it.
323 * @tpptyvalid: TP flag and PTY code are valid falg.
324 * @pivalid: PI code is valid flag.
325 * @rdssync: RDS is currently synchronized.
326 * @rdsfifolost: On or more RDS groups have been lost/discarded flag.
327 * @tp: Current channel's TP flag.
328 * @pty: Current channel's PTY code.
329 * @pi: Current channel's PI code.
330 * @rdsfifoused: Number of blocks remaining in the RDS FIFO (0 if
331 * empty).
332 */
333struct si476x_rds_status_report {
334 bool rdstpptyint, rdspiint, rdssyncint, rdsfifoint;
335 bool tpptyvalid, pivalid, rdssync, rdsfifolost;
336 bool tp;
337
338 u8 pty;
339 u16 pi;
340
341 u8 rdsfifoused;
342 u8 ble[4];
343
344 struct v4l2_rds_data rds[4];
345};
346
347struct si476x_rsq_status_args {
348 bool primary;
349 bool rsqack;
350 bool attune;
351 bool cancel;
352 bool stcack;
353};
354
355enum si476x_injside {
356 SI476X_INJSIDE_AUTO = 0,
357 SI476X_INJSIDE_LOW = 1,
358 SI476X_INJSIDE_HIGH = 2,
359};
360
361struct si476x_tune_freq_args {
362 bool zifsr;
363 bool hd;
364 enum si476x_injside injside;
365 int freq;
366 enum si476x_tunemode tunemode;
367 enum si476x_smoothmetrics smoothmetrics;
368 int antcap;
369};
370
371int si476x_core_stop(struct si476x_core *, bool);
372int si476x_core_start(struct si476x_core *, bool);
373int si476x_core_set_power_state(struct si476x_core *, enum si476x_power_state);
374bool si476x_core_has_am(struct si476x_core *);
375bool si476x_core_has_diversity(struct si476x_core *);
376bool si476x_core_is_a_secondary_tuner(struct si476x_core *);
377bool si476x_core_is_a_primary_tuner(struct si476x_core *);
378bool si476x_core_is_in_am_receiver_mode(struct si476x_core *core);
379bool si476x_core_is_powered_up(struct si476x_core *core);
380
381enum si476x_i2c_type {
382 SI476X_I2C_SEND,
383 SI476X_I2C_RECV
384};
385
386int si476x_core_i2c_xfer(struct si476x_core *,
387 enum si476x_i2c_type,
388 char *, int);
389
390
391/* -------------------- si476x-cmd.c ----------------------- */
392
393int si476x_core_cmd_func_info(struct si476x_core *, struct si476x_func_info *);
394int si476x_core_cmd_set_property(struct si476x_core *, u16, u16);
395int si476x_core_cmd_get_property(struct si476x_core *, u16);
396int si476x_core_cmd_dig_audio_pin_cfg(struct si476x_core *,
397 enum si476x_dclk_config,
398 enum si476x_dfs_config,
399 enum si476x_dout_config,
400 enum si476x_xout_config);
401int si476x_core_cmd_zif_pin_cfg(struct si476x_core *,
402 enum si476x_iqclk_config,
403 enum si476x_iqfs_config,
404 enum si476x_iout_config,
405 enum si476x_qout_config);
406int si476x_core_cmd_ic_link_gpo_ctl_pin_cfg(struct si476x_core *,
407 enum si476x_icin_config,
408 enum si476x_icip_config,
409 enum si476x_icon_config,
410 enum si476x_icop_config);
411int si476x_core_cmd_ana_audio_pin_cfg(struct si476x_core *,
412 enum si476x_lrout_config);
413int si476x_core_cmd_intb_pin_cfg(struct si476x_core *, enum si476x_intb_config,
414 enum si476x_a1_config);
415int si476x_core_cmd_fm_seek_start(struct si476x_core *, bool, bool);
416int si476x_core_cmd_am_seek_start(struct si476x_core *, bool, bool);
417int si476x_core_cmd_fm_rds_status(struct si476x_core *, bool, bool, bool,
418 struct si476x_rds_status_report *);
419int si476x_core_cmd_fm_rds_blockcount(struct si476x_core *, bool,
420 struct si476x_rds_blockcount_report *);
421int si476x_core_cmd_fm_tune_freq(struct si476x_core *,
422 struct si476x_tune_freq_args *);
423int si476x_core_cmd_am_tune_freq(struct si476x_core *,
424 struct si476x_tune_freq_args *);
425int si476x_core_cmd_am_rsq_status(struct si476x_core *,
426 struct si476x_rsq_status_args *,
427 struct si476x_rsq_status_report *);
428int si476x_core_cmd_fm_rsq_status(struct si476x_core *,
429 struct si476x_rsq_status_args *,
430 struct si476x_rsq_status_report *);
431int si476x_core_cmd_power_up(struct si476x_core *,
432 struct si476x_power_up_args *);
433int si476x_core_cmd_power_down(struct si476x_core *,
434 struct si476x_power_down_args *);
435int si476x_core_cmd_fm_phase_div_status(struct si476x_core *);
436int si476x_core_cmd_fm_phase_diversity(struct si476x_core *,
437 enum si476x_phase_diversity_mode);
438
439int si476x_core_cmd_fm_acf_status(struct si476x_core *,
440 struct si476x_acf_status_report *);
441int si476x_core_cmd_am_acf_status(struct si476x_core *,
442 struct si476x_acf_status_report *);
443int si476x_core_cmd_agc_status(struct si476x_core *,
444 struct si476x_agc_status_report *);
445
446enum si476x_power_grid_type {
447 SI476X_POWER_GRID_50HZ = 0,
448 SI476X_POWER_GRID_60HZ,
449};
450
451/* Properties */
452
453enum si476x_interrupt_flags {
454 SI476X_STCIEN = (1 << 0),
455 SI476X_ACFIEN = (1 << 1),
456 SI476X_RDSIEN = (1 << 2),
457 SI476X_RSQIEN = (1 << 3),
458
459 SI476X_ERRIEN = (1 << 6),
460 SI476X_CTSIEN = (1 << 7),
461
462 SI476X_STCREP = (1 << 8),
463 SI476X_ACFREP = (1 << 9),
464 SI476X_RDSREP = (1 << 10),
465 SI476X_RSQREP = (1 << 11),
466};
467
468enum si476x_rdsint_sources {
469 SI476X_RDSTPPTY = (1 << 4),
470 SI476X_RDSPI = (1 << 3),
471 SI476X_RDSSYNC = (1 << 1),
472 SI476X_RDSRECV = (1 << 0),
473};
474
475enum si476x_status_response_bits {
476 SI476X_CTS = (1 << 7),
477 SI476X_ERR = (1 << 6),
478 /* Status response for WB receiver */
479 SI476X_WB_ASQ_INT = (1 << 4),
480 SI476X_RSQ_INT = (1 << 3),
481 /* Status response for FM receiver */
482 SI476X_FM_RDS_INT = (1 << 2),
483 SI476X_ACF_INT = (1 << 1),
484 SI476X_STC_INT = (1 << 0),
485};
486
487/* -------------------- si476x-prop.c ----------------------- */
488
489enum si476x_common_receiver_properties {
490 SI476X_PROP_INT_CTL_ENABLE = 0x0000,
491 SI476X_PROP_DIGITAL_IO_INPUT_SAMPLE_RATE = 0x0200,
492 SI476X_PROP_DIGITAL_IO_INPUT_FORMAT = 0x0201,
493 SI476X_PROP_DIGITAL_IO_OUTPUT_SAMPLE_RATE = 0x0202,
494 SI476X_PROP_DIGITAL_IO_OUTPUT_FORMAT = 0x0203,
495
496 SI476X_PROP_SEEK_BAND_BOTTOM = 0x1100,
497 SI476X_PROP_SEEK_BAND_TOP = 0x1101,
498 SI476X_PROP_SEEK_FREQUENCY_SPACING = 0x1102,
499
500 SI476X_PROP_VALID_MAX_TUNE_ERROR = 0x2000,
501 SI476X_PROP_VALID_SNR_THRESHOLD = 0x2003,
502 SI476X_PROP_VALID_RSSI_THRESHOLD = 0x2004,
503};
504
505enum si476x_am_receiver_properties {
506 SI476X_PROP_AUDIO_PWR_LINE_FILTER = 0x0303,
507};
508
509enum si476x_fm_receiver_properties {
510 SI476X_PROP_AUDIO_DEEMPHASIS = 0x0302,
511
512 SI476X_PROP_FM_RDS_INTERRUPT_SOURCE = 0x4000,
513 SI476X_PROP_FM_RDS_INTERRUPT_FIFO_COUNT = 0x4001,
514 SI476X_PROP_FM_RDS_CONFIG = 0x4002,
515};
516
517enum si476x_prop_audio_pwr_line_filter_bits {
518 SI476X_PROP_PWR_HARMONICS_MASK = 0x001f,
519 SI476X_PROP_PWR_GRID_MASK = 0x0100,
520 SI476X_PROP_PWR_ENABLE_MASK = 0x0200,
521 SI476X_PROP_PWR_GRID_50HZ = 0x0000,
522 SI476X_PROP_PWR_GRID_60HZ = 0x0100,
523};
524
525enum si476x_prop_fm_rds_config_bits {
526 SI476X_PROP_RDSEN_MASK = 0x1,
527 SI476X_PROP_RDSEN = 0x1,
528};
529
530
531struct regmap *devm_regmap_init_si476x(struct si476x_core *);
532
533#endif /* SI476X_CORE_H */
diff --git a/include/linux/mfd/si476x-platform.h b/include/linux/mfd/si476x-platform.h
new file mode 100644
index 000000000000..88bb93b7a9d5
--- /dev/null
+++ b/include/linux/mfd/si476x-platform.h
@@ -0,0 +1,267 @@
1/*
2 * include/media/si476x-platform.h -- Platform data specific definitions
3 *
4 * Copyright (C) 2013 Andrey Smirnov
5 *
6 * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * 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 */
18
19#ifndef __SI476X_PLATFORM_H__
20#define __SI476X_PLATFORM_H__
21
22/* It is possible to select one of the four adresses using pins A0
23 * and A1 on SI476x */
24#define SI476X_I2C_ADDR_1 0x60
25#define SI476X_I2C_ADDR_2 0x61
26#define SI476X_I2C_ADDR_3 0x62
27#define SI476X_I2C_ADDR_4 0x63
28
29enum si476x_iqclk_config {
30 SI476X_IQCLK_NOOP = 0,
31 SI476X_IQCLK_TRISTATE = 1,
32 SI476X_IQCLK_IQ = 21,
33};
34enum si476x_iqfs_config {
35 SI476X_IQFS_NOOP = 0,
36 SI476X_IQFS_TRISTATE = 1,
37 SI476X_IQFS_IQ = 21,
38};
39enum si476x_iout_config {
40 SI476X_IOUT_NOOP = 0,
41 SI476X_IOUT_TRISTATE = 1,
42 SI476X_IOUT_OUTPUT = 22,
43};
44enum si476x_qout_config {
45 SI476X_QOUT_NOOP = 0,
46 SI476X_QOUT_TRISTATE = 1,
47 SI476X_QOUT_OUTPUT = 22,
48};
49
50enum si476x_dclk_config {
51 SI476X_DCLK_NOOP = 0,
52 SI476X_DCLK_TRISTATE = 1,
53 SI476X_DCLK_DAUDIO = 10,
54};
55
56enum si476x_dfs_config {
57 SI476X_DFS_NOOP = 0,
58 SI476X_DFS_TRISTATE = 1,
59 SI476X_DFS_DAUDIO = 10,
60};
61
62enum si476x_dout_config {
63 SI476X_DOUT_NOOP = 0,
64 SI476X_DOUT_TRISTATE = 1,
65 SI476X_DOUT_I2S_OUTPUT = 12,
66 SI476X_DOUT_I2S_INPUT = 13,
67};
68
69enum si476x_xout_config {
70 SI476X_XOUT_NOOP = 0,
71 SI476X_XOUT_TRISTATE = 1,
72 SI476X_XOUT_I2S_INPUT = 13,
73 SI476X_XOUT_MODE_SELECT = 23,
74};
75
76enum si476x_icin_config {
77 SI476X_ICIN_NOOP = 0,
78 SI476X_ICIN_TRISTATE = 1,
79 SI476X_ICIN_GPO1_HIGH = 2,
80 SI476X_ICIN_GPO1_LOW = 3,
81 SI476X_ICIN_IC_LINK = 30,
82};
83
84enum si476x_icip_config {
85 SI476X_ICIP_NOOP = 0,
86 SI476X_ICIP_TRISTATE = 1,
87 SI476X_ICIP_GPO2_HIGH = 2,
88 SI476X_ICIP_GPO2_LOW = 3,
89 SI476X_ICIP_IC_LINK = 30,
90};
91
92enum si476x_icon_config {
93 SI476X_ICON_NOOP = 0,
94 SI476X_ICON_TRISTATE = 1,
95 SI476X_ICON_I2S = 10,
96 SI476X_ICON_IC_LINK = 30,
97};
98
99enum si476x_icop_config {
100 SI476X_ICOP_NOOP = 0,
101 SI476X_ICOP_TRISTATE = 1,
102 SI476X_ICOP_I2S = 10,
103 SI476X_ICOP_IC_LINK = 30,
104};
105
106
107enum si476x_lrout_config {
108 SI476X_LROUT_NOOP = 0,
109 SI476X_LROUT_TRISTATE = 1,
110 SI476X_LROUT_AUDIO = 2,
111 SI476X_LROUT_MPX = 3,
112};
113
114
115enum si476x_intb_config {
116 SI476X_INTB_NOOP = 0,
117 SI476X_INTB_TRISTATE = 1,
118 SI476X_INTB_DAUDIO = 10,
119 SI476X_INTB_IRQ = 40,
120};
121
122enum si476x_a1_config {
123 SI476X_A1_NOOP = 0,
124 SI476X_A1_TRISTATE = 1,
125 SI476X_A1_IRQ = 40,
126};
127
128
129struct si476x_pinmux {
130 enum si476x_dclk_config dclk;
131 enum si476x_dfs_config dfs;
132 enum si476x_dout_config dout;
133 enum si476x_xout_config xout;
134
135 enum si476x_iqclk_config iqclk;
136 enum si476x_iqfs_config iqfs;
137 enum si476x_iout_config iout;
138 enum si476x_qout_config qout;
139
140 enum si476x_icin_config icin;
141 enum si476x_icip_config icip;
142 enum si476x_icon_config icon;
143 enum si476x_icop_config icop;
144
145 enum si476x_lrout_config lrout;
146
147 enum si476x_intb_config intb;
148 enum si476x_a1_config a1;
149};
150
151enum si476x_ibias6x {
152 SI476X_IBIAS6X_OTHER = 0,
153 SI476X_IBIAS6X_RCVR1_NON_4MHZ_CLK = 1,
154};
155
156enum si476x_xstart {
157 SI476X_XSTART_MULTIPLE_TUNER = 0x11,
158 SI476X_XSTART_NORMAL = 0x77,
159};
160
161enum si476x_freq {
162 SI476X_FREQ_4_MHZ = 0,
163 SI476X_FREQ_37P209375_MHZ = 1,
164 SI476X_FREQ_36P4_MHZ = 2,
165 SI476X_FREQ_37P8_MHZ = 3,
166};
167
168enum si476x_xmode {
169 SI476X_XMODE_CRYSTAL_RCVR1 = 1,
170 SI476X_XMODE_EXT_CLOCK = 2,
171 SI476X_XMODE_CRYSTAL_RCVR2_3 = 3,
172};
173
174enum si476x_xbiashc {
175 SI476X_XBIASHC_SINGLE_RECEIVER = 0,
176 SI476X_XBIASHC_MULTIPLE_RECEIVER = 1,
177};
178
179enum si476x_xbias {
180 SI476X_XBIAS_RCVR2_3 = 0,
181 SI476X_XBIAS_4MHZ_RCVR1 = 3,
182 SI476X_XBIAS_RCVR1 = 7,
183};
184
185enum si476x_func {
186 SI476X_FUNC_BOOTLOADER = 0,
187 SI476X_FUNC_FM_RECEIVER = 1,
188 SI476X_FUNC_AM_RECEIVER = 2,
189 SI476X_FUNC_WB_RECEIVER = 3,
190};
191
192
193/**
194 * @xcload: Selects the amount of additional on-chip capacitance to
195 * be connected between XTAL1 and gnd and between XTAL2 and
196 * GND. One half of the capacitance value shown here is the
197 * additional load capacitance presented to the xtal. The
198 * minimum step size is 0.277 pF. Recommended value is 0x28
199 * but it will be layout dependent. Range is 0–0x3F i.e.
200 * (0–16.33 pF)
201 * @ctsien: enable CTSINT(interrupt request when CTS condition
202 * arises) when set
203 * @intsel: when set A1 pin becomes the interrupt pin; otherwise,
204 * INTB is the interrupt pin
205 * @func: selects the boot function of the device. I.e.
206 * SI476X_BOOTLOADER - Boot loader
207 * SI476X_FM_RECEIVER - FM receiver
208 * SI476X_AM_RECEIVER - AM receiver
209 * SI476X_WB_RECEIVER - Weatherband receiver
210 * @freq: oscillator's crystal frequency:
211 * SI476X_XTAL_37P209375_MHZ - 37.209375 Mhz
212 * SI476X_XTAL_36P4_MHZ - 36.4 Mhz
213 * SI476X_XTAL_37P8_MHZ - 37.8 Mhz
214 */
215struct si476x_power_up_args {
216 enum si476x_ibias6x ibias6x;
217 enum si476x_xstart xstart;
218 u8 xcload;
219 bool fastboot;
220 enum si476x_xbiashc xbiashc;
221 enum si476x_xbias xbias;
222 enum si476x_func func;
223 enum si476x_freq freq;
224 enum si476x_xmode xmode;
225};
226
227
228/**
229 * enum si476x_phase_diversity_mode - possbile phase diversity modes
230 * for SI4764/5/6/7 chips.
231 *
232 * @SI476X_PHDIV_DISABLED: Phase diversity feature is
233 * disabled.
234 * @SI476X_PHDIV_PRIMARY_COMBINING: Tuner works as a primary tuner
235 * in combination with a
236 * secondary one.
237 * @SI476X_PHDIV_PRIMARY_ANTENNA: Tuner works as a primary tuner
238 * using only its own antenna.
239 * @SI476X_PHDIV_SECONDARY_ANTENNA: Tuner works as a primary tuner
240 * usning seconary tuner's antenna.
241 * @SI476X_PHDIV_SECONDARY_COMBINING: Tuner works as a secondary
242 * tuner in combination with the
243 * primary one.
244 */
245enum si476x_phase_diversity_mode {
246 SI476X_PHDIV_DISABLED = 0,
247 SI476X_PHDIV_PRIMARY_COMBINING = 1,
248 SI476X_PHDIV_PRIMARY_ANTENNA = 2,
249 SI476X_PHDIV_SECONDARY_ANTENNA = 3,
250 SI476X_PHDIV_SECONDARY_COMBINING = 5,
251};
252
253
254/*
255 * Platform dependent definition
256 */
257struct si476x_platform_data {
258 int gpio_reset; /* < 0 if not used */
259
260 struct si476x_power_up_args power_up_parameters;
261 enum si476x_phase_diversity_mode diversity_mode;
262
263 struct si476x_pinmux pinmux;
264};
265
266
267#endif /* __SI476X_PLATFORM_H__ */
diff --git a/include/linux/mfd/si476x-reports.h b/include/linux/mfd/si476x-reports.h
new file mode 100644
index 000000000000..e0b9455a79c0
--- /dev/null
+++ b/include/linux/mfd/si476x-reports.h
@@ -0,0 +1,163 @@
1/*
2 * include/media/si476x-platform.h -- Definitions of the data formats
3 * returned by debugfs hooks
4 *
5 * Copyright (C) 2013 Andrey Smirnov
6 *
7 * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 */
19
20#ifndef __SI476X_REPORTS_H__
21#define __SI476X_REPORTS_H__
22
23/**
24 * struct si476x_rsq_status - structure containing received signal
25 * quality
26 * @multhint: Multipath Detect High.
27 * true - Indicatedes that the value is below
28 * FM_RSQ_MULTIPATH_HIGH_THRESHOLD
29 * false - Indicatedes that the value is above
30 * FM_RSQ_MULTIPATH_HIGH_THRESHOLD
31 * @multlint: Multipath Detect Low.
32 * true - Indicatedes that the value is below
33 * FM_RSQ_MULTIPATH_LOW_THRESHOLD
34 * false - Indicatedes that the value is above
35 * FM_RSQ_MULTIPATH_LOW_THRESHOLD
36 * @snrhint: SNR Detect High.
37 * true - Indicatedes that the value is below
38 * FM_RSQ_SNR_HIGH_THRESHOLD
39 * false - Indicatedes that the value is above
40 * FM_RSQ_SNR_HIGH_THRESHOLD
41 * @snrlint: SNR Detect Low.
42 * true - Indicatedes that the value is below
43 * FM_RSQ_SNR_LOW_THRESHOLD
44 * false - Indicatedes that the value is above
45 * FM_RSQ_SNR_LOW_THRESHOLD
46 * @rssihint: RSSI Detect High.
47 * true - Indicatedes that the value is below
48 * FM_RSQ_RSSI_HIGH_THRESHOLD
49 * false - Indicatedes that the value is above
50 * FM_RSQ_RSSI_HIGH_THRESHOLD
51 * @rssilint: RSSI Detect Low.
52 * true - Indicatedes that the value is below
53 * FM_RSQ_RSSI_LOW_THRESHOLD
54 * false - Indicatedes that the value is above
55 * FM_RSQ_RSSI_LOW_THRESHOLD
56 * @bltf: Band Limit.
57 * Set if seek command hits the band limit or wrapped to
58 * the original frequency.
59 * @snr_ready: SNR measurement in progress.
60 * @rssiready: RSSI measurement in progress.
61 * @afcrl: Set if FREQOFF >= MAX_TUNE_ERROR
62 * @valid: Set if the channel is valid
63 * rssi < FM_VALID_RSSI_THRESHOLD
64 * snr < FM_VALID_SNR_THRESHOLD
65 * tune_error < FM_VALID_MAX_TUNE_ERROR
66 * @readfreq: Current tuned frequency.
67 * @freqoff: Signed frequency offset.
68 * @rssi: Received Signal Strength Indicator(dBuV).
69 * @snr: RF SNR Indicator(dB).
70 * @lassi:
71 * @hassi: Low/High side Adjacent(100 kHz) Channel Strength Indicator
72 * @mult: Multipath indicator
73 * @dev: Who knows? But values may vary.
74 * @readantcap: Antenna tuning capacity value.
75 * @assi: Adjacent Channel(+/- 200kHz) Strength Indicator
76 * @usn: Ultrasonic Noise Inticator in -DBFS
77 */
78struct si476x_rsq_status_report {
79 __u8 multhint, multlint;
80 __u8 snrhint, snrlint;
81 __u8 rssihint, rssilint;
82 __u8 bltf;
83 __u8 snr_ready;
84 __u8 rssiready;
85 __u8 injside;
86 __u8 afcrl;
87 __u8 valid;
88
89 __u16 readfreq;
90 __s8 freqoff;
91 __s8 rssi;
92 __s8 snr;
93 __s8 issi;
94 __s8 lassi, hassi;
95 __s8 mult;
96 __u8 dev;
97 __u16 readantcap;
98 __s8 assi;
99 __s8 usn;
100
101 __u8 pilotdev;
102 __u8 rdsdev;
103 __u8 assidev;
104 __u8 strongdev;
105 __u16 rdspi;
106} __packed;
107
108/**
109 * si476x_acf_status_report - ACF report results
110 *
111 * @blend_int: If set, indicates that stereo separation has crossed
112 * below the blend threshold as set by FM_ACF_BLEND_THRESHOLD
113 * @hblend_int: If set, indicates that HiBlend cutoff frequency is
114 * lower than threshold as set by FM_ACF_HBLEND_THRESHOLD
115 * @hicut_int: If set, indicates that HiCut cutoff frequency is lower
116 * than the threshold set by ACF_
117
118 */
119struct si476x_acf_status_report {
120 __u8 blend_int;
121 __u8 hblend_int;
122 __u8 hicut_int;
123 __u8 chbw_int;
124 __u8 softmute_int;
125 __u8 smute;
126 __u8 smattn;
127 __u8 chbw;
128 __u8 hicut;
129 __u8 hiblend;
130 __u8 pilot;
131 __u8 stblend;
132} __packed;
133
134enum si476x_fmagc {
135 SI476X_FMAGC_10K_OHM = 0,
136 SI476X_FMAGC_800_OHM = 1,
137 SI476X_FMAGC_400_OHM = 2,
138 SI476X_FMAGC_200_OHM = 4,
139 SI476X_FMAGC_100_OHM = 8,
140 SI476X_FMAGC_50_OHM = 16,
141 SI476X_FMAGC_25_OHM = 32,
142 SI476X_FMAGC_12P5_OHM = 64,
143 SI476X_FMAGC_6P25_OHM = 128,
144};
145
146struct si476x_agc_status_report {
147 __u8 mxhi;
148 __u8 mxlo;
149 __u8 lnahi;
150 __u8 lnalo;
151 __u8 fmagc1;
152 __u8 fmagc2;
153 __u8 pgagain;
154 __u8 fmwblang;
155} __packed;
156
157struct si476x_rds_blockcount_report {
158 __u16 expected;
159 __u16 received;
160 __u16 uncorrectable;
161} __packed;
162
163#endif /* __SI476X_REPORTS_H__ */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 383ac1512a39..48395a69a7e9 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -26,6 +26,7 @@ enum stmpe_partnum {
26 STMPE801, 26 STMPE801,
27 STMPE811, 27 STMPE811,
28 STMPE1601, 28 STMPE1601,
29 STMPE1801,
29 STMPE2401, 30 STMPE2401,
30 STMPE2403, 31 STMPE2403,
31 STMPE_NBR_PARTS 32 STMPE_NBR_PARTS
@@ -39,6 +40,7 @@ enum {
39 STMPE_IDX_CHIP_ID, 40 STMPE_IDX_CHIP_ID,
40 STMPE_IDX_ICR_LSB, 41 STMPE_IDX_ICR_LSB,
41 STMPE_IDX_IER_LSB, 42 STMPE_IDX_IER_LSB,
43 STMPE_IDX_ISR_LSB,
42 STMPE_IDX_ISR_MSB, 44 STMPE_IDX_ISR_MSB,
43 STMPE_IDX_GPMR_LSB, 45 STMPE_IDX_GPMR_LSB,
44 STMPE_IDX_GPSR_LSB, 46 STMPE_IDX_GPSR_LSB,
@@ -49,6 +51,7 @@ enum {
49 STMPE_IDX_GPFER_LSB, 51 STMPE_IDX_GPFER_LSB,
50 STMPE_IDX_GPAFR_U_MSB, 52 STMPE_IDX_GPAFR_U_MSB,
51 STMPE_IDX_IEGPIOR_LSB, 53 STMPE_IDX_IEGPIOR_LSB,
54 STMPE_IDX_ISGPIOR_LSB,
52 STMPE_IDX_ISGPIOR_MSB, 55 STMPE_IDX_ISGPIOR_MSB,
53 STMPE_IDX_MAX, 56 STMPE_IDX_MAX,
54}; 57};
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index 6aeb6b8da64d..b473577f36db 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -15,8 +15,11 @@
15#ifndef __LINUX_MFD_SYSCON_H__ 15#ifndef __LINUX_MFD_SYSCON_H__
16#define __LINUX_MFD_SYSCON_H__ 16#define __LINUX_MFD_SYSCON_H__
17 17
18struct device_node;
19
18extern struct regmap *syscon_node_to_regmap(struct device_node *np); 20extern struct regmap *syscon_node_to_regmap(struct device_node *np);
19extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); 21extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
22extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
20extern struct regmap *syscon_regmap_lookup_by_phandle( 23extern struct regmap *syscon_regmap_lookup_by_phandle(
21 struct device_node *np, 24 struct device_node *np,
22 const char *property); 25 const char *property);
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 6694cf43e8b8..3f43069413e7 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -27,6 +27,7 @@
27 27
28/* TPS65090 IRQs */ 28/* TPS65090 IRQs */
29enum { 29enum {
30 TPS65090_IRQ_INTERRUPT,
30 TPS65090_IRQ_VAC_STATUS_CHANGE, 31 TPS65090_IRQ_VAC_STATUS_CHANGE,
31 TPS65090_IRQ_VSYS_STATUS_CHANGE, 32 TPS65090_IRQ_VSYS_STATUS_CHANGE,
32 TPS65090_IRQ_BAT_STATUS_CHANGE, 33 TPS65090_IRQ_BAT_STATUS_CHANGE,
@@ -86,6 +87,11 @@ struct tps65090_regulator_plat_data {
86 87
87struct tps65090_platform_data { 88struct tps65090_platform_data {
88 int irq_base; 89 int irq_base;
90
91 char **supplied_to;
92 size_t num_supplicants;
93 int enable_low_current_chrg;
94
89 struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; 95 struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX];
90}; 96};
91 97
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 290762f93930..29eab2bd3dfa 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -228,6 +228,7 @@ enum tps65217_bl_fdim {
228struct tps65217_bl_pdata { 228struct tps65217_bl_pdata {
229 enum tps65217_bl_isel isel; 229 enum tps65217_bl_isel isel;
230 enum tps65217_bl_fdim fdim; 230 enum tps65217_bl_fdim fdim;
231 int dft_brightness;
231}; 232};
232 233
233/** 234/**
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 8e21a094836d..68e776594889 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -17,6 +17,7 @@
17 17
18#define WM8994_NUM_LDO 2 18#define WM8994_NUM_LDO 2
19#define WM8994_NUM_GPIO 11 19#define WM8994_NUM_GPIO 11
20#define WM8994_NUM_AIF 3
20 21
21struct wm8994_ldo_pdata { 22struct wm8994_ldo_pdata {
22 /** GPIOs to enable regulator, 0 or less if not available */ 23 /** GPIOs to enable regulator, 0 or less if not available */
@@ -215,6 +216,13 @@ struct wm8994_pdata {
215 * system. 216 * system.
216 */ 217 */
217 bool spkmode_pu; 218 bool spkmode_pu;
219
220 /**
221 * Maximum number of channels clocks will be generated for,
222 * useful for systems where and I2S bus with multiple data
223 * lines is mastered.
224 */
225 int max_channels_clocked[WM8994_NUM_AIF];
218}; 226};
219 227
220#endif 228#endif
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 9dbb41a4e250..8752dbbc6135 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -19,6 +19,7 @@
19#define PHY_ID_KSZ9021 0x00221610 19#define PHY_ID_KSZ9021 0x00221610
20#define PHY_ID_KS8737 0x00221720 20#define PHY_ID_KS8737 0x00221720
21#define PHY_ID_KSZ8021 0x00221555 21#define PHY_ID_KSZ8021 0x00221555
22#define PHY_ID_KSZ8031 0x00221556
22#define PHY_ID_KSZ8041 0x00221510 23#define PHY_ID_KSZ8041 0x00221510
23#define PHY_ID_KSZ8051 0x00221550 24#define PHY_ID_KSZ8051 0x00221550
24/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ 25/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 260695186256..adf6e0648f20 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -34,6 +34,7 @@
34#define MLX4_CMD_H 34#define MLX4_CMD_H
35 35
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/if_link.h>
37 38
38enum { 39enum {
39 /* initialization and general commands */ 40 /* initialization and general commands */
@@ -232,6 +233,11 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
232void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); 233void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
233 234
234u32 mlx4_comm_get_version(void); 235u32 mlx4_comm_get_version(void);
236int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
237int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
238int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
239int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
240
235 241
236#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 242#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
237 243
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h
index 6f65b2c8bb89..98fa492cf406 100644
--- a/include/linux/mlx4/cq.h
+++ b/include/linux/mlx4/cq.h
@@ -64,6 +64,22 @@ struct mlx4_err_cqe {
64 u8 owner_sr_opcode; 64 u8 owner_sr_opcode;
65}; 65};
66 66
67struct mlx4_ts_cqe {
68 __be32 vlan_my_qpn;
69 __be32 immed_rss_invalid;
70 __be32 g_mlpath_rqpn;
71 __be32 timestamp_hi;
72 __be16 status;
73 u8 ipv6_ext_mask;
74 u8 badfcs_enc;
75 __be32 byte_cnt;
76 __be16 wqe_index;
77 __be16 checksum;
78 u8 reserved;
79 __be16 timestamp_lo;
80 u8 owner_sr_opcode;
81} __packed;
82
67enum { 83enum {
68 MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, 84 MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29,
69 MLX4_CQE_QPN_MASK = 0xffffff, 85 MLX4_CQE_QPN_MASK = 0xffffff,
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 811f91cf5e8c..a51b0134ce18 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -40,6 +40,8 @@
40 40
41#include <linux/atomic.h> 41#include <linux/atomic.h>
42 42
43#include <linux/clocksource.h>
44
43#define MAX_MSIX_P_PORT 17 45#define MAX_MSIX_P_PORT 17
44#define MAX_MSIX 64 46#define MAX_MSIX 64
45#define MSIX_LEGACY_SZ 4 47#define MSIX_LEGACY_SZ 4
@@ -140,6 +142,7 @@ enum {
140 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 142 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
141 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 143 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
142 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 144 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
145 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53,
143 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 146 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
144 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 147 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
145 MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, 148 MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61,
@@ -151,7 +154,10 @@ enum {
151 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, 154 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
152 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, 155 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2,
153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, 156 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3,
154 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4 157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4,
158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7
155}; 161};
156 162
157enum { 163enum {
@@ -443,6 +449,7 @@ struct mlx4_caps {
443 u8 eqe_factor; 449 u8 eqe_factor;
444 u32 userspace_caps; /* userspace must be aware of these */ 450 u32 userspace_caps; /* userspace must be aware of these */
445 u32 function_caps; /* VFs must be aware of these */ 451 u32 function_caps; /* VFs must be aware of these */
452 u16 hca_core_clock;
446}; 453};
447 454
448struct mlx4_buf_list { 455struct mlx4_buf_list {
@@ -837,7 +844,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,
837 844
838int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 845int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
839 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 846 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
840 unsigned vector, int collapsed); 847 unsigned vector, int collapsed, int timestamp_en);
841void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 848void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
842 849
843int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 850int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
@@ -896,11 +903,12 @@ static inline int map_hw_to_sw_id(u16 header_id)
896} 903}
897 904
898enum mlx4_net_trans_promisc_mode { 905enum mlx4_net_trans_promisc_mode {
899 MLX4_FS_PROMISC_NONE = 0, 906 MLX4_FS_REGULAR = 1,
900 MLX4_FS_PROMISC_UPLINK, 907 MLX4_FS_ALL_DEFAULT,
901 /* For future use. Not implemented yet */ 908 MLX4_FS_MC_DEFAULT,
902 MLX4_FS_PROMISC_FUNCTION_PORT, 909 MLX4_FS_UC_SNIFFER,
903 MLX4_FS_PROMISC_ALL_MULTI, 910 MLX4_FS_MC_SNIFFER,
911 MLX4_FS_MODE_NUM, /* should be last */
904}; 912};
905 913
906struct mlx4_spec_eth { 914struct mlx4_spec_eth {
@@ -929,7 +937,7 @@ struct mlx4_spec_ipv4 {
929}; 937};
930 938
931struct mlx4_spec_ib { 939struct mlx4_spec_ib {
932 __be32 r_qpn; 940 __be32 l3_qpn;
933 __be32 qpn_msk; 941 __be32 qpn_msk;
934 u8 dst_gid[16]; 942 u8 dst_gid[16];
935 u8 dst_gid_msk[16]; 943 u8 dst_gid_msk[16];
@@ -962,6 +970,92 @@ struct mlx4_net_trans_rule {
962 u32 qpn; 970 u32 qpn;
963}; 971};
964 972
973struct mlx4_net_trans_rule_hw_ctrl {
974 __be16 prio;
975 u8 type;
976 u8 flags;
977 u8 rsvd1;
978 u8 funcid;
979 u8 vep;
980 u8 port;
981 __be32 qpn;
982 __be32 rsvd2;
983};
984
985struct mlx4_net_trans_rule_hw_ib {
986 u8 size;
987 u8 rsvd1;
988 __be16 id;
989 u32 rsvd2;
990 __be32 l3_qpn;
991 __be32 qpn_mask;
992 u8 dst_gid[16];
993 u8 dst_gid_msk[16];
994} __packed;
995
996struct mlx4_net_trans_rule_hw_eth {
997 u8 size;
998 u8 rsvd;
999 __be16 id;
1000 u8 rsvd1[6];
1001 u8 dst_mac[6];
1002 u16 rsvd2;
1003 u8 dst_mac_msk[6];
1004 u16 rsvd3;
1005 u8 src_mac[6];
1006 u16 rsvd4;
1007 u8 src_mac_msk[6];
1008 u8 rsvd5;
1009 u8 ether_type_enable;
1010 __be16 ether_type;
1011 __be16 vlan_tag_msk;
1012 __be16 vlan_tag;
1013} __packed;
1014
1015struct mlx4_net_trans_rule_hw_tcp_udp {
1016 u8 size;
1017 u8 rsvd;
1018 __be16 id;
1019 __be16 rsvd1[3];
1020 __be16 dst_port;
1021 __be16 rsvd2;
1022 __be16 dst_port_msk;
1023 __be16 rsvd3;
1024 __be16 src_port;
1025 __be16 rsvd4;
1026 __be16 src_port_msk;
1027} __packed;
1028
1029struct mlx4_net_trans_rule_hw_ipv4 {
1030 u8 size;
1031 u8 rsvd;
1032 __be16 id;
1033 __be32 rsvd1;
1034 __be32 dst_ip;
1035 __be32 dst_ip_msk;
1036 __be32 src_ip;
1037 __be32 src_ip_msk;
1038} __packed;
1039
1040struct _rule_hw {
1041 union {
1042 struct {
1043 u8 size;
1044 u8 rsvd;
1045 __be16 id;
1046 };
1047 struct mlx4_net_trans_rule_hw_eth eth;
1048 struct mlx4_net_trans_rule_hw_ib ib;
1049 struct mlx4_net_trans_rule_hw_ipv4 ipv4;
1050 struct mlx4_net_trans_rule_hw_tcp_udp tcp_udp;
1051 };
1052};
1053
1054/* translating DMFS verbs sniffer rule to the FW API would need two reg IDs */
1055struct mlx4_flow_handle {
1056 u64 reg_id[2];
1057};
1058
965int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, 1059int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn,
966 enum mlx4_net_trans_promisc_mode mode); 1060 enum mlx4_net_trans_promisc_mode mode);
967int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, 1061int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port,
@@ -1011,6 +1105,11 @@ void mlx4_counter_free(struct mlx4_dev *dev, u32 idx);
1011int mlx4_flow_attach(struct mlx4_dev *dev, 1105int mlx4_flow_attach(struct mlx4_dev *dev,
1012 struct mlx4_net_trans_rule *rule, u64 *reg_id); 1106 struct mlx4_net_trans_rule *rule, u64 *reg_id);
1013int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); 1107int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id);
1108int mlx4_map_sw_to_hw_steering_mode(struct mlx4_dev *dev,
1109 enum mlx4_net_trans_promisc_mode flow_type);
1110int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev,
1111 enum mlx4_net_trans_rule_id id);
1112int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id);
1014 1113
1015void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, 1114void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port,
1016 int i, int val); 1115 int i, int val);
@@ -1028,4 +1127,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int
1028void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); 1127void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);
1029__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); 1128__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave);
1030 1129
1130cycle_t mlx4_read_clock(struct mlx4_dev *dev);
1131
1031#endif /* MLX4_DEVICE_H */ 1132#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 67f46ad6920a..352eec9df1b8 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -126,7 +126,7 @@ struct mlx4_rss_context {
126 126
127struct mlx4_qp_path { 127struct mlx4_qp_path {
128 u8 fl; 128 u8 fl;
129 u8 reserved1[1]; 129 u8 vlan_control;
130 u8 disable_pkey_check; 130 u8 disable_pkey_check;
131 u8 pkey_index; 131 u8 pkey_index;
132 u8 counter_index; 132 u8 counter_index;
@@ -141,11 +141,32 @@ struct mlx4_qp_path {
141 u8 sched_queue; 141 u8 sched_queue;
142 u8 vlan_index; 142 u8 vlan_index;
143 u8 feup; 143 u8 feup;
144 u8 reserved3; 144 u8 fvl_rx;
145 u8 reserved4[2]; 145 u8 reserved4[2];
146 u8 dmac[6]; 146 u8 dmac[6];
147}; 147};
148 148
149enum { /* fl */
150 MLX4_FL_CV = 1 << 6,
151 MLX4_FL_ETH_HIDE_CQE_VLAN = 1 << 2
152};
153enum { /* vlan_control */
154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6,
155 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2,
156 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */
157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0
158};
159
160enum { /* feup */
161 MLX4_FEUP_FORCE_ETH_UP = 1 << 6, /* force Eth UP */
162 MLX4_FSM_FORCE_ETH_SRC_MAC = 1 << 5, /* force Source MAC */
163 MLX4_FVL_FORCE_ETH_VLAN = 1 << 3 /* force Eth vlan */
164};
165
166enum { /* fvl_rx */
167 MLX4_FVL_RX_FORCE_ETH_VLAN = 1 << 0 /* enforce Eth rx vlan */
168};
169
149struct mlx4_qp_context { 170struct mlx4_qp_context {
150 __be32 flags; 171 __be32 flags;
151 __be32 pd; 172 __be32 pd;
@@ -185,6 +206,10 @@ struct mlx4_qp_context {
185 u32 reserved5[10]; 206 u32 reserved5[10];
186}; 207};
187 208
209enum { /* param3 */
210 MLX4_STRIP_VLAN = 1 << 30
211};
212
188/* Which firmware version adds support for NEC (NoErrorCompletion) bit */ 213/* Which firmware version adds support for NEC (NoErrorCompletion) bit */
189#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232) 214#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232)
190 215
diff --git a/include/linux/mlx4/srq.h b/include/linux/mlx4/srq.h
index 799a0697a383..192e0f7784f2 100644
--- a/include/linux/mlx4/srq.h
+++ b/include/linux/mlx4/srq.h
@@ -39,4 +39,6 @@ struct mlx4_wqe_srq_next_seg {
39 u32 reserved2[3]; 39 u32 reserved2[3];
40}; 40};
41 41
42struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn);
43
42#endif /* MLX4_SRQ_H */ 44#endif /* MLX4_SRQ_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e2091b88d24c..e0c8528a41a4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -44,6 +44,9 @@ extern int sysctl_legacy_va_layout;
44#include <asm/pgtable.h> 44#include <asm/pgtable.h>
45#include <asm/processor.h> 45#include <asm/processor.h>
46 46
47extern unsigned long sysctl_user_reserve_kbytes;
48extern unsigned long sysctl_admin_reserve_kbytes;
49
47#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) 50#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
48 51
49/* to align the pointer to the (next) page boundary */ 52/* to align the pointer to the (next) page boundary */
@@ -899,7 +902,8 @@ extern void pagefault_out_of_memory(void);
899 * Flags passed to show_mem() and show_free_areas() to suppress output in 902 * Flags passed to show_mem() and show_free_areas() to suppress output in
900 * various contexts. 903 * various contexts.
901 */ 904 */
902#define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */ 905#define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */
906#define SHOW_MEM_FILTER_PAGE_COUNT (0x0002u) /* page type count */
903 907
904extern void show_free_areas(unsigned int flags); 908extern void show_free_areas(unsigned int flags);
905extern bool skip_free_areas_node(unsigned int flags, int nid); 909extern bool skip_free_areas_node(unsigned int flags, int nid);
@@ -947,13 +951,19 @@ void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
947 * (see walk_page_range for more details) 951 * (see walk_page_range for more details)
948 */ 952 */
949struct mm_walk { 953struct mm_walk {
950 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *); 954 int (*pgd_entry)(pgd_t *pgd, unsigned long addr,
951 int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *); 955 unsigned long next, struct mm_walk *walk);
952 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); 956 int (*pud_entry)(pud_t *pud, unsigned long addr,
953 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); 957 unsigned long next, struct mm_walk *walk);
954 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); 958 int (*pmd_entry)(pmd_t *pmd, unsigned long addr,
955 int (*hugetlb_entry)(pte_t *, unsigned long, 959 unsigned long next, struct mm_walk *walk);
956 unsigned long, unsigned long, struct mm_walk *); 960 int (*pte_entry)(pte_t *pte, unsigned long addr,
961 unsigned long next, struct mm_walk *walk);
962 int (*pte_hole)(unsigned long addr, unsigned long next,
963 struct mm_walk *walk);
964 int (*hugetlb_entry)(pte_t *pte, unsigned long hmask,
965 unsigned long addr, unsigned long next,
966 struct mm_walk *walk);
957 struct mm_struct *mm; 967 struct mm_struct *mm;
958 void *private; 968 void *private;
959}; 969};
@@ -1078,9 +1088,6 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma,
1078 unsigned long old_addr, struct vm_area_struct *new_vma, 1088 unsigned long old_addr, struct vm_area_struct *new_vma,
1079 unsigned long new_addr, unsigned long len, 1089 unsigned long new_addr, unsigned long len,
1080 bool need_rmap_locks); 1090 bool need_rmap_locks);
1081extern unsigned long do_mremap(unsigned long addr,
1082 unsigned long old_len, unsigned long new_len,
1083 unsigned long flags, unsigned long new_addr);
1084extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, 1091extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,
1085 unsigned long end, pgprot_t newprot, 1092 unsigned long end, pgprot_t newprot,
1086 int dirty_accountable, int prot_numa); 1093 int dirty_accountable, int prot_numa);
@@ -1294,6 +1301,61 @@ extern void free_area_init_node(int nid, unsigned long * zones_size,
1294 unsigned long zone_start_pfn, unsigned long *zholes_size); 1301 unsigned long zone_start_pfn, unsigned long *zholes_size);
1295extern void free_initmem(void); 1302extern void free_initmem(void);
1296 1303
1304/*
1305 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK)
1306 * into the buddy system. The freed pages will be poisoned with pattern
1307 * "poison" if it's non-zero.
1308 * Return pages freed into the buddy system.
1309 */
1310extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
1311 int poison, char *s);
1312#ifdef CONFIG_HIGHMEM
1313/*
1314 * Free a highmem page into the buddy system, adjusting totalhigh_pages
1315 * and totalram_pages.
1316 */
1317extern void free_highmem_page(struct page *page);
1318#endif
1319
1320static inline void adjust_managed_page_count(struct page *page, long count)
1321{
1322 totalram_pages += count;
1323}
1324
1325/* Free the reserved page into the buddy system, so it gets managed. */
1326static inline void __free_reserved_page(struct page *page)
1327{
1328 ClearPageReserved(page);
1329 init_page_count(page);
1330 __free_page(page);
1331}
1332
1333static inline void free_reserved_page(struct page *page)
1334{
1335 __free_reserved_page(page);
1336 adjust_managed_page_count(page, 1);
1337}
1338
1339static inline void mark_page_reserved(struct page *page)
1340{
1341 SetPageReserved(page);
1342 adjust_managed_page_count(page, -1);
1343}
1344
1345/*
1346 * Default method to free all the __init memory into the buddy system.
1347 * The freed pages will be poisoned with pattern "poison" if it is
1348 * non-zero. Return pages freed into the buddy system.
1349 */
1350static inline unsigned long free_initmem_default(int poison)
1351{
1352 extern char __init_begin[], __init_end[];
1353
1354 return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) ,
1355 ((unsigned long)&__init_end) & PAGE_MASK,
1356 poison, "unused kernel");
1357}
1358
1297#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 1359#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1298/* 1360/*
1299 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its 1361 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
@@ -1675,8 +1737,12 @@ int in_gate_area_no_mm(unsigned long addr);
1675#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) 1737#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);})
1676#endif /* __HAVE_ARCH_GATE_AREA */ 1738#endif /* __HAVE_ARCH_GATE_AREA */
1677 1739
1740#ifdef CONFIG_SYSCTL
1741extern int sysctl_drop_caches;
1678int drop_caches_sysctl_handler(struct ctl_table *, int, 1742int drop_caches_sysctl_handler(struct ctl_table *, int,
1679 void __user *, size_t *, loff_t *); 1743 void __user *, size_t *, loff_t *);
1744#endif
1745
1680unsigned long shrink_slab(struct shrink_control *shrink, 1746unsigned long shrink_slab(struct shrink_control *shrink,
1681 unsigned long nr_pages_scanned, 1747 unsigned long nr_pages_scanned,
1682 unsigned long lru_pages); 1748 unsigned long lru_pages);
@@ -1704,12 +1770,12 @@ pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node);
1704void *vmemmap_alloc_block(unsigned long size, int node); 1770void *vmemmap_alloc_block(unsigned long size, int node);
1705void *vmemmap_alloc_block_buf(unsigned long size, int node); 1771void *vmemmap_alloc_block_buf(unsigned long size, int node);
1706void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); 1772void vmemmap_verify(pte_t *, int, unsigned long, unsigned long);
1707int vmemmap_populate_basepages(struct page *start_page, 1773int vmemmap_populate_basepages(unsigned long start, unsigned long end,
1708 unsigned long pages, int node); 1774 int node);
1709int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1775int vmemmap_populate(unsigned long start, unsigned long end, int node);
1710void vmemmap_populate_print_last(void); 1776void vmemmap_populate_print_last(void);
1711#ifdef CONFIG_MEMORY_HOTPLUG 1777#ifdef CONFIG_MEMORY_HOTPLUG
1712void vmemmap_free(struct page *memmap, unsigned long nr_pages); 1778void vmemmap_free(unsigned long start, unsigned long end);
1713#endif 1779#endif
1714void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, 1780void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
1715 unsigned long size); 1781 unsigned long size);
@@ -1756,5 +1822,11 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1756static inline bool page_is_guard(struct page *page) { return false; } 1822static inline bool page_is_guard(struct page *page) { return false; }
1757#endif /* CONFIG_DEBUG_PAGEALLOC */ 1823#endif /* CONFIG_DEBUG_PAGEALLOC */
1758 1824
1825#if MAX_NUMNODES > 1
1826void __init setup_nr_node_ids(void);
1827#else
1828static inline void setup_nr_node_ids(void) {}
1829#endif
1830
1759#endif /* __KERNEL__ */ 1831#endif /* __KERNEL__ */
1760#endif /* _LINUX_MM_H */ 1832#endif /* _LINUX_MM_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 61b2c30c903b..f31725ba49f3 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -17,6 +17,7 @@
17struct mmc_cid { 17struct mmc_cid {
18 unsigned int manfid; 18 unsigned int manfid;
19 char prod_name[8]; 19 char prod_name[8];
20 unsigned char prv;
20 unsigned int serial; 21 unsigned int serial;
21 unsigned short oemid; 22 unsigned short oemid;
22 unsigned short year; 23 unsigned short year;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index d6f20cc6415e..e326ae2882a0 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -280,6 +280,7 @@ struct mmc_host {
280#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */ 280#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 282 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283 284
284 mmc_pm_flag_t pm_caps; /* supported pm features */ 285 mmc_pm_flag_t pm_caps; /* supported pm features */
285 286
@@ -341,9 +342,7 @@ struct mmc_host {
341 342
342 mmc_pm_flag_t pm_flags; /* requested pm features */ 343 mmc_pm_flag_t pm_flags; /* requested pm features */
343 344
344#ifdef CONFIG_LEDS_TRIGGERS
345 struct led_trigger *led; /* activity led */ 345 struct led_trigger *led; /* activity led */
346#endif
347 346
348#ifdef CONFIG_REGULATOR 347#ifdef CONFIG_REGULATOR
349 bool regulator_enabled; /* regulator state */ 348 bool regulator_enabled; /* regulator state */
@@ -361,6 +360,8 @@ struct mmc_host {
361 360
362 unsigned int actual_clock; /* Actual HC clock rate */ 361 unsigned int actual_clock; /* Actual HC clock rate */
363 362
363 unsigned int slotno; /* used for sdio acpi binding */
364
364 unsigned long private[0] ____cacheline_aligned; 365 unsigned long private[0] ____cacheline_aligned;
365}; 366};
366 367
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index c74092eebf5c..5c76737d836b 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -450,7 +450,7 @@ struct zone {
450 * 450 *
451 * present_pages is physical pages existing within the zone, which 451 * present_pages is physical pages existing within the zone, which
452 * is calculated as: 452 * is calculated as:
453 * present_pages = spanned_pages - absent_pages(pags in holes); 453 * present_pages = spanned_pages - absent_pages(pages in holes);
454 * 454 *
455 * managed_pages is present pages managed by the buddy system, which 455 * managed_pages is present pages managed by the buddy system, which
456 * is calculated as (reserved_pages includes pages allocated by the 456 * is calculated as (reserved_pages includes pages allocated by the
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 779cf7c4a3d1..b508016fb76d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -9,6 +9,7 @@
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/uuid.h>
12typedef unsigned long kernel_ulong_t; 13typedef unsigned long kernel_ulong_t;
13#endif 14#endif
14 15
@@ -568,4 +569,12 @@ struct ipack_device_id {
568 __u32 device; /* Device ID or IPACK_ANY_ID */ 569 __u32 device; /* Device ID or IPACK_ANY_ID */
569}; 570};
570 571
572#define MEI_CL_MODULE_PREFIX "mei:"
573#define MEI_CL_NAME_SIZE 32
574
575struct mei_cl_device_id {
576 char name[MEI_CL_NAME_SIZE];
577 kernel_ulong_t driver_info;
578};
579
571#endif /* LINUX_MOD_DEVICETABLE_H */ 580#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index ead1b5719a12..46f1ea01e6f6 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -190,7 +190,7 @@ extern int modules_disabled; /* for sysctl */
190/* Get/put a kernel symbol (calls must be symmetric) */ 190/* Get/put a kernel symbol (calls must be symmetric) */
191void *__symbol_get(const char *symbol); 191void *__symbol_get(const char *symbol);
192void *__symbol_get_gpl(const char *symbol); 192void *__symbol_get_gpl(const char *symbol);
193#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x))) 193#define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x))))
194 194
195/* modules using other modules: kdb wants to see this. */ 195/* modules using other modules: kdb wants to see this. */
196struct module_use { 196struct module_use {
@@ -453,7 +453,7 @@ extern void __module_put_and_exit(struct module *mod, long code)
453#ifdef CONFIG_MODULE_UNLOAD 453#ifdef CONFIG_MODULE_UNLOAD
454unsigned long module_refcount(struct module *mod); 454unsigned long module_refcount(struct module *mod);
455void __symbol_put(const char *symbol); 455void __symbol_put(const char *symbol);
456#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) 456#define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x))
457void symbol_put_addr(void *addr); 457void symbol_put_addr(void *addr);
458 458
459/* Sometimes we know we already have a refcount, and it's easier not 459/* Sometimes we know we already have a refcount, and it's easier not
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ce93a341337d..20c2d6dd5d25 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -13,14 +13,14 @@ struct msi_msg {
13/* Helper functions */ 13/* Helper functions */
14struct irq_data; 14struct irq_data;
15struct msi_desc; 15struct msi_desc;
16extern void mask_msi_irq(struct irq_data *data); 16void mask_msi_irq(struct irq_data *data);
17extern void unmask_msi_irq(struct irq_data *data); 17void unmask_msi_irq(struct irq_data *data);
18extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 18void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
19extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 19void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
20extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 20void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
21extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); 21void read_msi_msg(unsigned int irq, struct msi_msg *msg);
22extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); 22void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
23extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); 23void write_msi_msg(unsigned int irq, struct msi_msg *msg);
24 24
25struct msi_desc { 25struct msi_desc {
26 struct { 26 struct {
@@ -54,9 +54,8 @@ struct msi_desc {
54 */ 54 */
55int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 55int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
56void arch_teardown_msi_irq(unsigned int irq); 56void arch_teardown_msi_irq(unsigned int irq);
57extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 57int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
58extern void arch_teardown_msi_irqs(struct pci_dev *dev); 58void arch_teardown_msi_irqs(struct pci_dev *dev);
59extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 59int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
60
61 60
62#endif /* LINUX_MSI_H */ 61#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 4eb0a50d0c55..e93837f647de 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -74,7 +74,7 @@ struct mtd_blktrans_ops {
74 74
75 /* Called with mtd_table_mutex held; no race with add/remove */ 75 /* Called with mtd_table_mutex held; no race with add/remove */
76 int (*open)(struct mtd_blktrans_dev *dev); 76 int (*open)(struct mtd_blktrans_dev *dev);
77 int (*release)(struct mtd_blktrans_dev *dev); 77 void (*release)(struct mtd_blktrans_dev *dev);
78 78
79 /* Called on {de,}registration and on subsequent addition/removal 79 /* Called on {de,}registration and on subsequent addition/removal
80 of devices, with mtd_table_mutex held. */ 80 of devices, with mtd_table_mutex held. */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index f9ac2897b86b..a5cf4e8d6818 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -362,10 +362,10 @@ struct mtd_partition;
362struct mtd_part_parser_data; 362struct mtd_part_parser_data;
363 363
364extern int mtd_device_parse_register(struct mtd_info *mtd, 364extern int mtd_device_parse_register(struct mtd_info *mtd,
365 const char **part_probe_types, 365 const char * const *part_probe_types,
366 struct mtd_part_parser_data *parser_data, 366 struct mtd_part_parser_data *parser_data,
367 const struct mtd_partition *defparts, 367 const struct mtd_partition *defparts,
368 int defnr_parts); 368 int defnr_parts);
369#define mtd_device_register(master, parts, nr_parts) \ 369#define mtd_device_register(master, parts, nr_parts) \
370 mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) 370 mtd_device_parse_register(master, NULL, NULL, parts, nr_parts)
371extern int mtd_device_unregister(struct mtd_info *master); 371extern int mtd_device_unregister(struct mtd_info *master);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ef52d9c91459..ab6363443ce8 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -86,7 +86,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
86#define NAND_CMD_READOOB 0x50 86#define NAND_CMD_READOOB 0x50
87#define NAND_CMD_ERASE1 0x60 87#define NAND_CMD_ERASE1 0x60
88#define NAND_CMD_STATUS 0x70 88#define NAND_CMD_STATUS 0x70
89#define NAND_CMD_STATUS_MULTI 0x71
90#define NAND_CMD_SEQIN 0x80 89#define NAND_CMD_SEQIN 0x80
91#define NAND_CMD_RNDIN 0x85 90#define NAND_CMD_RNDIN 0x85
92#define NAND_CMD_READID 0x90 91#define NAND_CMD_READID 0x90
@@ -105,25 +104,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
105#define NAND_CMD_RNDOUTSTART 0xE0 104#define NAND_CMD_RNDOUTSTART 0xE0
106#define NAND_CMD_CACHEDPROG 0x15 105#define NAND_CMD_CACHEDPROG 0x15
107 106
108/* Extended commands for AG-AND device */
109/*
110 * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but
111 * there is no way to distinguish that from NAND_CMD_READ0
112 * until the remaining sequence of commands has been completed
113 * so add a high order bit and mask it off in the command.
114 */
115#define NAND_CMD_DEPLETE1 0x100
116#define NAND_CMD_DEPLETE2 0x38
117#define NAND_CMD_STATUS_MULTI 0x71
118#define NAND_CMD_STATUS_ERROR 0x72
119/* multi-bank error status (banks 0-3) */
120#define NAND_CMD_STATUS_ERROR0 0x73
121#define NAND_CMD_STATUS_ERROR1 0x74
122#define NAND_CMD_STATUS_ERROR2 0x75
123#define NAND_CMD_STATUS_ERROR3 0x76
124#define NAND_CMD_STATUS_RESET 0x7f
125#define NAND_CMD_STATUS_CLEAR 0xff
126
127#define NAND_CMD_NONE -1 107#define NAND_CMD_NONE -1
128 108
129/* Status bits */ 109/* Status bits */
@@ -165,28 +145,8 @@ typedef enum {
165 */ 145 */
166/* Buswidth is 16 bit */ 146/* Buswidth is 16 bit */
167#define NAND_BUSWIDTH_16 0x00000002 147#define NAND_BUSWIDTH_16 0x00000002
168/* Device supports partial programming without padding */
169#define NAND_NO_PADDING 0x00000004
170/* Chip has cache program function */ 148/* Chip has cache program function */
171#define NAND_CACHEPRG 0x00000008 149#define NAND_CACHEPRG 0x00000008
172/* Chip has copy back function */
173#define NAND_COPYBACK 0x00000010
174/*
175 * AND Chip which has 4 banks and a confusing page / block
176 * assignment. See Renesas datasheet for further information.
177 */
178#define NAND_IS_AND 0x00000020
179/*
180 * Chip has a array of 4 pages which can be read without
181 * additional ready /busy waits.
182 */
183#define NAND_4PAGE_ARRAY 0x00000040
184/*
185 * Chip requires that BBT is periodically rewritten to prevent
186 * bits from adjacent blocks from 'leaking' in altering data.
187 * This happens with the Renesas AG-AND chips, possibly others.
188 */
189#define BBT_AUTO_REFRESH 0x00000080
190/* 150/*
191 * Chip requires ready check on read (for auto-incremented sequential read). 151 * Chip requires ready check on read (for auto-incremented sequential read).
192 * True only for small page devices; large page devices do not support 152 * True only for small page devices; large page devices do not support
@@ -207,13 +167,10 @@ typedef enum {
207#define NAND_SUBPAGE_READ 0x00001000 167#define NAND_SUBPAGE_READ 0x00001000
208 168
209/* Options valid for Samsung large page devices */ 169/* Options valid for Samsung large page devices */
210#define NAND_SAMSUNG_LP_OPTIONS \ 170#define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG
211 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
212 171
213/* Macros to identify the above */ 172/* Macros to identify the above */
214#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
215#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 173#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
216#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
217#define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ)) 174#define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ))
218 175
219/* Non chip related options */ 176/* Non chip related options */
@@ -361,6 +318,7 @@ struct nand_hw_control {
361 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error 318 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error
362 * @read_subpage: function to read parts of the page covered by ECC; 319 * @read_subpage: function to read parts of the page covered by ECC;
363 * returns same as read_page() 320 * returns same as read_page()
321 * @write_subpage: function to write parts of the page covered by ECC.
364 * @write_page: function to write a page according to the ECC generator 322 * @write_page: function to write a page according to the ECC generator
365 * requirements. 323 * requirements.
366 * @write_oob_raw: function to write chip OOB data without ECC 324 * @write_oob_raw: function to write chip OOB data without ECC
@@ -392,6 +350,9 @@ struct nand_ecc_ctrl {
392 uint8_t *buf, int oob_required, int page); 350 uint8_t *buf, int oob_required, int page);
393 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 351 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
394 uint32_t offs, uint32_t len, uint8_t *buf); 352 uint32_t offs, uint32_t len, uint8_t *buf);
353 int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
354 uint32_t offset, uint32_t data_len,
355 const uint8_t *data_buf, int oob_required);
395 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 356 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
396 const uint8_t *buf, int oob_required); 357 const uint8_t *buf, int oob_required);
397 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, 358 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
@@ -527,8 +488,8 @@ struct nand_chip {
527 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, 488 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
528 int status, int page); 489 int status, int page);
529 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 490 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
530 const uint8_t *buf, int oob_required, int page, 491 uint32_t offset, int data_len, const uint8_t *buf,
531 int cached, int raw); 492 int oob_required, int page, int cached, int raw);
532 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, 493 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
533 int feature_addr, uint8_t *subfeature_para); 494 int feature_addr, uint8_t *subfeature_para);
534 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, 495 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
@@ -589,25 +550,65 @@ struct nand_chip {
589#define NAND_MFR_MACRONIX 0xc2 550#define NAND_MFR_MACRONIX 0xc2
590#define NAND_MFR_EON 0x92 551#define NAND_MFR_EON 0x92
591 552
553/* The maximum expected count of bytes in the NAND ID sequence */
554#define NAND_MAX_ID_LEN 8
555
556/*
557 * A helper for defining older NAND chips where the second ID byte fully
558 * defined the chip, including the geometry (chip size, eraseblock size, page
559 * size). All these chips have 512 bytes NAND page size.
560 */
561#define LEGACY_ID_NAND(nm, devid, chipsz, erasesz, opts) \
562 { .name = (nm), {{ .dev_id = (devid) }}, .pagesize = 512, \
563 .chipsize = (chipsz), .erasesize = (erasesz), .options = (opts) }
564
565/*
566 * A helper for defining newer chips which report their page size and
567 * eraseblock size via the extended ID bytes.
568 *
569 * The real difference between LEGACY_ID_NAND and EXTENDED_ID_NAND is that with
570 * EXTENDED_ID_NAND, manufacturers overloaded the same device ID so that the
571 * device ID now only represented a particular total chip size (and voltage,
572 * buswidth), and the page size, eraseblock size, and OOB size could vary while
573 * using the same device ID.
574 */
575#define EXTENDED_ID_NAND(nm, devid, chipsz, opts) \
576 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
577 .options = (opts) }
578
592/** 579/**
593 * struct nand_flash_dev - NAND Flash Device ID Structure 580 * struct nand_flash_dev - NAND Flash Device ID Structure
594 * @name: Identify the device type 581 * @name: a human-readable name of the NAND chip
595 * @id: device ID code 582 * @dev_id: the device ID (the second byte of the full chip ID array)
596 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 583 * @mfr_id: manufecturer ID part of the full chip ID array (refers the same
597 * If the pagesize is 0, then the real pagesize 584 * memory address as @id[0])
598 * and the eraseize are determined from the 585 * @dev_id: device ID part of the full chip ID array (refers the same memory
599 * extended id bytes in the chip 586 * address as @id[1])
600 * @erasesize: Size of an erase block in the flash device. 587 * @id: full device ID array
601 * @chipsize: Total chipsize in Mega Bytes 588 * @pagesize: size of the NAND page in bytes; if 0, then the real page size (as
602 * @options: Bitfield to store chip relevant options 589 * well as the eraseblock size) is determined from the extended NAND
590 * chip ID array)
591 * @chipsize: total chip size in MiB
592 * @erasesize: eraseblock size in bytes (determined from the extended ID if 0)
593 * @options: stores various chip bit options
594 * @id_len: The valid length of the @id.
595 * @oobsize: OOB size
603 */ 596 */
604struct nand_flash_dev { 597struct nand_flash_dev {
605 char *name; 598 char *name;
606 int id; 599 union {
607 unsigned long pagesize; 600 struct {
608 unsigned long chipsize; 601 uint8_t mfr_id;
609 unsigned long erasesize; 602 uint8_t dev_id;
610 unsigned long options; 603 };
604 uint8_t id[NAND_MAX_ID_LEN];
605 };
606 unsigned int pagesize;
607 unsigned int chipsize;
608 unsigned int erasesize;
609 unsigned int options;
610 uint16_t id_len;
611 uint16_t oobsize;
611}; 612};
612 613
613/** 614/**
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index d2887e76b7f6..aa6a2633c2da 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -30,7 +30,7 @@ struct physmap_flash_data {
30 unsigned int pfow_base; 30 unsigned int pfow_base;
31 char *probe_type; 31 char *probe_type;
32 struct mtd_partition *parts; 32 struct mtd_partition *parts;
33 const char **part_probe_types; 33 const char * const *part_probe_types;
34}; 34};
35 35
36#endif /* __LINUX_MTD_PHYSMAP__ */ 36#endif /* __LINUX_MTD_PHYSMAP__ */
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index e07890aff1cf..44212d65aa97 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -20,8 +20,8 @@
20 20
21struct platdata_mtd_ram { 21struct platdata_mtd_ram {
22 const char *mapname; 22 const char *mapname;
23 const char **map_probes; 23 const char * const *map_probes;
24 const char **probes; 24 const char * const *probes;
25 struct mtd_partition *partitions; 25 struct mtd_partition *partitions;
26 int nr_partitions; 26 int nr_partitions;
27 int bankwidth; 27 int bankwidth;
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 9121595a8ebf..433da8a1a426 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -53,6 +53,9 @@ struct mutex {
53#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) 53#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
54 struct task_struct *owner; 54 struct task_struct *owner;
55#endif 55#endif
56#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
57 void *spin_mlock; /* Spinner MCS lock */
58#endif
56#ifdef CONFIG_DEBUG_MUTEXES 59#ifdef CONFIG_DEBUG_MUTEXES
57 const char *name; 60 const char *name;
58 void *magic; 61 void *magic;
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 49258e0ed1c6..141d395bbb5f 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -19,7 +19,6 @@
19 19
20struct mv643xx_eth_shared_platform_data { 20struct mv643xx_eth_shared_platform_data {
21 struct mbus_dram_target_info *dram; 21 struct mbus_dram_target_info *dram;
22 struct platform_device *shared_smi;
23 /* 22 /*
24 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default 23 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
25 * limit of 9KiB will be used. 24 * limit of 9KiB will be used.
diff --git a/include/linux/mxsfb.h b/include/linux/mxsfb.h
deleted file mode 100644
index f80af8674342..000000000000
--- a/include/linux/mxsfb.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
14 * MA 02110-1301, USA.
15 */
16
17#ifndef __LINUX_MXSFB_H
18#define __LINUX_MXSFB_H
19
20#include <linux/fb.h>
21
22#define STMLCDIF_8BIT 1 /** pixel data bus to the display is of 8 bit width */
23#define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */
24#define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */
25#define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */
26
27#define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6)
28#define MXSFB_SYNC_DOTCLK_FAILING_ACT (1 << 7) /* failing/negtive edge sampling */
29
30struct mxsfb_platform_data {
31 struct fb_videomode *mode_list;
32 unsigned mode_count;
33
34 unsigned default_bpp;
35
36 unsigned dotclk_delay; /* refer manual HW_LCDIF_VDCTRL4 register */
37 unsigned ld_intf_width; /* refer STMLCDIF_* macros */
38
39 unsigned fb_size; /* Size of the video memory. If zero a
40 * default will be used
41 */
42 unsigned long fb_phys; /* physical address for the video memory. If
43 * zero the framebuffer memory will be dynamically
44 * allocated. If specified,fb_size must also be specified.
45 * fb_phys must be unused by Linux.
46 */
47 u32 sync; /* sync mask, contains MXSFB specifics not
48 * carried in fb_info->var.sync
49 */
50};
51
52#endif /* __LINUX_MXSFB_H */
diff --git a/include/linux/net.h b/include/linux/net.h
index aa1673160a45..99c9f0c103c2 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -240,8 +240,8 @@ do { \
240#define net_dbg_ratelimited(fmt, ...) \ 240#define net_dbg_ratelimited(fmt, ...) \
241 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) 241 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
242 242
243#define net_random() random32() 243#define net_random() prandom_u32()
244#define net_srandom(seed) srandom32((__force u32)seed) 244#define net_srandom(seed) prandom_seed((__force u32)(seed))
245 245
246extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 246extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
247 struct kvec *vec, size_t num, size_t len); 247 struct kvec *vec, size_t num, size_t len);
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 3dd39340430e..09906b7ca47d 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -22,9 +22,9 @@ enum {
22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ 22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ 23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ 24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
25 NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */ 25 NETIF_F_HW_VLAN_CTAG_TX_BIT, /* Transmit VLAN CTAG HW acceleration */
26 NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */ 26 NETIF_F_HW_VLAN_CTAG_RX_BIT, /* Receive VLAN CTAG HW acceleration */
27 NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */ 27 NETIF_F_HW_VLAN_CTAG_FILTER_BIT,/* Receive filtering on VLAN CTAGs */
28 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ 28 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
29 NETIF_F_GSO_BIT, /* Enable software GSO. */ 29 NETIF_F_GSO_BIT, /* Enable software GSO. */
30 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ 30 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
@@ -42,9 +42,9 @@ enum {
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ 42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */ 45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */ 46 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
47 = NETIF_F_GSO_LAST, 47 NETIF_F_GSO_UDP_TUNNEL_BIT,
48 48
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -56,6 +56,9 @@ enum {
56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */ 56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */
57 NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */ 57 NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */
58 NETIF_F_RXALL_BIT, /* Receive errored frames too */ 58 NETIF_F_RXALL_BIT, /* Receive errored frames too */
59 NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */
60 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
61 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
59 62
60 /* 63 /*
61 * Add your fresh new feature above and remember to update 64 * Add your fresh new feature above and remember to update
@@ -80,9 +83,9 @@ enum {
80#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) 83#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST)
81#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) 84#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA)
82#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) 85#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM)
83#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER) 86#define NETIF_F_HW_VLAN_CTAG_FILTER __NETIF_F(HW_VLAN_CTAG_FILTER)
84#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX) 87#define NETIF_F_HW_VLAN_CTAG_RX __NETIF_F(HW_VLAN_CTAG_RX)
85#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX) 88#define NETIF_F_HW_VLAN_CTAG_TX __NETIF_F(HW_VLAN_CTAG_TX)
86#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) 89#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM)
87#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) 90#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM)
88#define NETIF_F_LLTX __NETIF_F(LLTX) 91#define NETIF_F_LLTX __NETIF_F(LLTX)
@@ -102,7 +105,11 @@ enum {
102#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) 105#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
103#define NETIF_F_RXFCS __NETIF_F(RXFCS) 106#define NETIF_F_RXFCS __NETIF_F(RXFCS)
104#define NETIF_F_RXALL __NETIF_F(RXALL) 107#define NETIF_F_RXALL __NETIF_F(RXALL)
105#define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE) 108#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
109#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
110#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
111#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
112#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
106 113
107/* Features valid for ethtool to change */ 114/* Features valid for ethtool to change */
108/* = all defined minus driver/device-class-related */ 115/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6151e903eef0..60584b185a0c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -144,8 +144,6 @@ static inline bool dev_xmit_complete(int rc)
144# else 144# else
145# define LL_MAX_HEADER 96 145# define LL_MAX_HEADER 96
146# endif 146# endif
147#elif IS_ENABLED(CONFIG_TR)
148# define LL_MAX_HEADER 48
149#else 147#else
150# define LL_MAX_HEADER 32 148# define LL_MAX_HEADER 32
151#endif 149#endif
@@ -211,6 +209,7 @@ struct netdev_hw_addr {
211#define NETDEV_HW_ADDR_T_UNICAST 4 209#define NETDEV_HW_ADDR_T_UNICAST 4
212#define NETDEV_HW_ADDR_T_MULTICAST 5 210#define NETDEV_HW_ADDR_T_MULTICAST 5
213 bool global_use; 211 bool global_use;
212 int sync_cnt;
214 int refcount; 213 int refcount;
215 int synced; 214 int synced;
216 struct rcu_head rcu_head; 215 struct rcu_head rcu_head;
@@ -594,7 +593,6 @@ struct rps_dev_flow {
594struct rps_dev_flow_table { 593struct rps_dev_flow_table {
595 unsigned int mask; 594 unsigned int mask;
596 struct rcu_head rcu; 595 struct rcu_head rcu;
597 struct work_struct free_work;
598 struct rps_dev_flow flows[0]; 596 struct rps_dev_flow flows[0];
599}; 597};
600#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ 598#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
@@ -785,13 +783,13 @@ struct netdev_fcoe_hbainfo {
785 * 3. Update dev->stats asynchronously and atomically, and define 783 * 3. Update dev->stats asynchronously and atomically, and define
786 * neither operation. 784 * neither operation.
787 * 785 *
788 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 786 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid);
789 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 787 * If device support VLAN filtering this function is called when a
790 * this function is called when a VLAN id is registered. 788 * VLAN id is registered.
791 * 789 *
792 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 790 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
793 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 791 * If device support VLAN filtering this function is called when a
794 * this function is called when a VLAN id is unregistered. 792 * VLAN id is unregistered.
795 * 793 *
796 * void (*ndo_poll_controller)(struct net_device *dev); 794 * void (*ndo_poll_controller)(struct net_device *dev);
797 * 795 *
@@ -935,9 +933,9 @@ struct net_device_ops {
935 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 933 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
936 934
937 int (*ndo_vlan_rx_add_vid)(struct net_device *dev, 935 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
938 unsigned short vid); 936 __be16 proto, u16 vid);
939 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 937 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
940 unsigned short vid); 938 __be16 proto, u16 vid);
941#ifdef CONFIG_NET_POLL_CONTROLLER 939#ifdef CONFIG_NET_POLL_CONTROLLER
942 void (*ndo_poll_controller)(struct net_device *dev); 940 void (*ndo_poll_controller)(struct net_device *dev);
943 int (*ndo_netpoll_setup)(struct net_device *dev, 941 int (*ndo_netpoll_setup)(struct net_device *dev,
@@ -1073,6 +1071,8 @@ struct net_device {
1073 struct list_head dev_list; 1071 struct list_head dev_list;
1074 struct list_head napi_list; 1072 struct list_head napi_list;
1075 struct list_head unreg_list; 1073 struct list_head unreg_list;
1074 struct list_head upper_dev_list; /* List of upper devices */
1075
1076 1076
1077 /* currently active device features */ 1077 /* currently active device features */
1078 netdev_features_t features; 1078 netdev_features_t features;
@@ -1145,6 +1145,13 @@ struct net_device {
1145 spinlock_t addr_list_lock; 1145 spinlock_t addr_list_lock;
1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
1148 struct netdev_hw_addr_list dev_addrs; /* list of device
1149 * hw addresses
1150 */
1151#ifdef CONFIG_SYSFS
1152 struct kset *queues_kset;
1153#endif
1154
1148 bool uc_promisc; 1155 bool uc_promisc;
1149 unsigned int promiscuity; 1156 unsigned int promiscuity;
1150 unsigned int allmulti; 1157 unsigned int allmulti;
@@ -1177,21 +1184,11 @@ struct net_device {
1177 * avoid dirtying this cache line. 1184 * avoid dirtying this cache line.
1178 */ 1185 */
1179 1186
1180 struct list_head upper_dev_list; /* List of upper devices */
1181
1182 /* Interface address info used in eth_type_trans() */ 1187 /* Interface address info used in eth_type_trans() */
1183 unsigned char *dev_addr; /* hw address, (before bcast 1188 unsigned char *dev_addr; /* hw address, (before bcast
1184 because most packets are 1189 because most packets are
1185 unicast) */ 1190 unicast) */
1186 1191
1187 struct netdev_hw_addr_list dev_addrs; /* list of device
1188 hw addresses */
1189
1190 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1191
1192#ifdef CONFIG_SYSFS
1193 struct kset *queues_kset;
1194#endif
1195 1192
1196#ifdef CONFIG_RPS 1193#ifdef CONFIG_RPS
1197 struct netdev_rx_queue *_rx; 1194 struct netdev_rx_queue *_rx;
@@ -1202,18 +1199,14 @@ struct net_device {
1202 /* Number of RX queues currently active in device */ 1199 /* Number of RX queues currently active in device */
1203 unsigned int real_num_rx_queues; 1200 unsigned int real_num_rx_queues;
1204 1201
1205#ifdef CONFIG_RFS_ACCEL
1206 /* CPU reverse-mapping for RX completion interrupts, indexed
1207 * by RX queue number. Assigned by driver. This must only be
1208 * set if the ndo_rx_flow_steer operation is defined. */
1209 struct cpu_rmap *rx_cpu_rmap;
1210#endif
1211#endif 1202#endif
1212 1203
1213 rx_handler_func_t __rcu *rx_handler; 1204 rx_handler_func_t __rcu *rx_handler;
1214 void __rcu *rx_handler_data; 1205 void __rcu *rx_handler_data;
1215 1206
1216 struct netdev_queue __rcu *ingress_queue; 1207 struct netdev_queue __rcu *ingress_queue;
1208 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1209
1217 1210
1218/* 1211/*
1219 * Cache lines mostly used on transmit path 1212 * Cache lines mostly used on transmit path
@@ -1235,6 +1228,12 @@ struct net_device {
1235#ifdef CONFIG_XPS 1228#ifdef CONFIG_XPS
1236 struct xps_dev_maps __rcu *xps_maps; 1229 struct xps_dev_maps __rcu *xps_maps;
1237#endif 1230#endif
1231#ifdef CONFIG_RFS_ACCEL
1232 /* CPU reverse-mapping for RX completion interrupts, indexed
1233 * by RX queue number. Assigned by driver. This must only be
1234 * set if the ndo_rx_flow_steer operation is defined. */
1235 struct cpu_rmap *rx_cpu_rmap;
1236#endif
1238 1237
1239 /* These may be needed for future network-power-down code. */ 1238 /* These may be needed for future network-power-down code. */
1240 1239
@@ -1475,6 +1474,11 @@ static inline void *netdev_priv(const struct net_device *dev)
1475 */ 1474 */
1476#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) 1475#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
1477 1476
1477/* Default NAPI poll() weight
1478 * Device drivers are strongly advised to not use bigger value
1479 */
1480#define NAPI_POLL_WEIGHT 64
1481
1478/** 1482/**
1479 * netif_napi_add - initialize a napi context 1483 * netif_napi_add - initialize a napi context
1480 * @dev: network device 1484 * @dev: network device
@@ -1612,6 +1616,9 @@ extern seqcount_t devnet_rename_seq; /* Device rename seq */
1612 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) 1616 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
1613#define for_each_netdev_continue_rcu(net, d) \ 1617#define for_each_netdev_continue_rcu(net, d) \
1614 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) 1618 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
1619#define for_each_netdev_in_bond_rcu(bond, slave) \
1620 for_each_netdev_rcu(&init_net, slave) \
1621 if (netdev_master_upper_dev_get_rcu(slave) == bond)
1615#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) 1622#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
1616 1623
1617static inline struct net_device *next_net_device(struct net_device *dev) 1624static inline struct net_device *next_net_device(struct net_device *dev)
@@ -1684,7 +1691,6 @@ extern int netdev_refcnt_read(const struct net_device *dev);
1684extern void free_netdev(struct net_device *dev); 1691extern void free_netdev(struct net_device *dev);
1685extern void synchronize_net(void); 1692extern void synchronize_net(void);
1686extern int init_dummy_netdev(struct net_device *dev); 1693extern int init_dummy_netdev(struct net_device *dev);
1687extern void netdev_resync_ops(struct net_device *dev);
1688 1694
1689extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1695extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
1690extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1696extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
@@ -2621,6 +2627,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2621extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); 2627extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2622extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2628extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2623extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2629extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2630extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
2624extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2631extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2625extern void dev_uc_flush(struct net_device *dev); 2632extern void dev_uc_flush(struct net_device *dev);
2626extern void dev_uc_init(struct net_device *dev); 2633extern void dev_uc_init(struct net_device *dev);
@@ -2632,6 +2639,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2632extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2639extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2633extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); 2640extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2634extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2641extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2642extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
2635extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2643extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2636extern void dev_mc_flush(struct net_device *dev); 2644extern void dev_mc_flush(struct net_device *dev);
2637extern void dev_mc_init(struct net_device *dev); 2645extern void dev_mc_init(struct net_device *dev);
@@ -2678,6 +2686,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
2678{ 2686{
2679 return __skb_gso_segment(skb, features, true); 2687 return __skb_gso_segment(skb, features, true);
2680} 2688}
2689__be16 skb_network_protocol(struct sk_buff *skb);
2690
2691static inline bool can_checksum_protocol(netdev_features_t features,
2692 __be16 protocol)
2693{
2694 return ((features & NETIF_F_GEN_CSUM) ||
2695 ((features & NETIF_F_V4_CSUM) &&
2696 protocol == htons(ETH_P_IP)) ||
2697 ((features & NETIF_F_V6_CSUM) &&
2698 protocol == htons(ETH_P_IPV6)) ||
2699 ((features & NETIF_F_FCOE_CRC) &&
2700 protocol == htons(ETH_P_FCOE)));
2701}
2681 2702
2682#ifdef CONFIG_BUG 2703#ifdef CONFIG_BUG
2683extern void netdev_rx_csum_fault(struct net_device *dev); 2704extern void netdev_rx_csum_fault(struct net_device *dev);
@@ -2712,6 +2733,17 @@ static inline netdev_features_t netdev_get_wanted_features(
2712} 2733}
2713netdev_features_t netdev_increment_features(netdev_features_t all, 2734netdev_features_t netdev_increment_features(netdev_features_t all,
2714 netdev_features_t one, netdev_features_t mask); 2735 netdev_features_t one, netdev_features_t mask);
2736
2737/* Allow TSO being used on stacked device :
2738 * Performing the GSO segmentation before last device
2739 * is a performance improvement.
2740 */
2741static inline netdev_features_t netdev_add_tso_features(netdev_features_t features,
2742 netdev_features_t mask)
2743{
2744 return netdev_increment_features(features, NETIF_F_ALL_TSO, mask);
2745}
2746
2715int __netdev_update_features(struct net_device *dev); 2747int __netdev_update_features(struct net_device *dev);
2716void netdev_update_features(struct net_device *dev); 2748void netdev_update_features(struct net_device *dev);
2717void netdev_change_features(struct net_device *dev); 2749void netdev_change_features(struct net_device *dev);
@@ -2756,6 +2788,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2756 dev->gso_max_size = size; 2788 dev->gso_max_size = size;
2757} 2789}
2758 2790
2791static inline bool netif_is_bond_master(struct net_device *dev)
2792{
2793 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
2794}
2795
2759static inline bool netif_is_bond_slave(struct net_device *dev) 2796static inline bool netif_is_bond_slave(struct net_device *dev)
2760{ 2797{
2761 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 2798 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index ee142846f56a..0060fde3160e 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -289,11 +289,6 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
289#endif 289#endif
290} 290}
291 291
292#ifdef CONFIG_PROC_FS
293#include <linux/proc_fs.h>
294extern struct proc_dir_entry *proc_net_netfilter;
295#endif
296
297#else /* !CONFIG_NETFILTER */ 292#else /* !CONFIG_NETFILTER */
298#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 293#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
299#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 294#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 7958e84a65af..d80e2753847c 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -1,7 +1,7 @@
1/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> 1/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
2 * Patrick Schaaf <bof@bof.de> 2 * Patrick Schaaf <bof@bof.de>
3 * Martin Josefsson <gandalf@wlug.westbo.se> 3 * Martin Josefsson <gandalf@wlug.westbo.se>
4 * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> 4 * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
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 version 2 as 7 * it under the terms of the GNU General Public License version 2 as
@@ -47,10 +47,36 @@ enum ip_set_feature {
47 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), 47 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
48}; 48};
49 49
50/* Set extensions */
51enum ip_set_extension {
52 IPSET_EXT_NONE = 0,
53 IPSET_EXT_BIT_TIMEOUT = 1,
54 IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT),
55 IPSET_EXT_BIT_COUNTER = 2,
56 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
57};
58
59/* Extension offsets */
60enum ip_set_offset {
61 IPSET_OFFSET_TIMEOUT = 0,
62 IPSET_OFFSET_COUNTER,
63 IPSET_OFFSET_MAX,
64};
65
66#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
67#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
68
69struct ip_set_ext {
70 unsigned long timeout;
71 u64 packets;
72 u64 bytes;
73};
74
50struct ip_set; 75struct ip_set;
51 76
52typedef int (*ipset_adtfn)(struct ip_set *set, void *value, 77typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
53 u32 timeout, u32 flags); 78 const struct ip_set_ext *ext,
79 struct ip_set_ext *mext, u32 cmdflags);
54 80
55/* Kernel API function options */ 81/* Kernel API function options */
56struct ip_set_adt_opt { 82struct ip_set_adt_opt {
@@ -58,7 +84,7 @@ struct ip_set_adt_opt {
58 u8 dim; /* Dimension of match/target */ 84 u8 dim; /* Dimension of match/target */
59 u8 flags; /* Direction and negation flags */ 85 u8 flags; /* Direction and negation flags */
60 u32 cmdflags; /* Command-like flags */ 86 u32 cmdflags; /* Command-like flags */
61 u32 timeout; /* Timeout value */ 87 struct ip_set_ext ext; /* Extensions */
62}; 88};
63 89
64/* Set type, variant-specific part */ 90/* Set type, variant-specific part */
@@ -69,7 +95,7 @@ struct ip_set_type_variant {
69 * positive for matching element */ 95 * positive for matching element */
70 int (*kadt)(struct ip_set *set, const struct sk_buff *skb, 96 int (*kadt)(struct ip_set *set, const struct sk_buff *skb,
71 const struct xt_action_param *par, 97 const struct xt_action_param *par,
72 enum ipset_adt adt, const struct ip_set_adt_opt *opt); 98 enum ipset_adt adt, struct ip_set_adt_opt *opt);
73 99
74 /* Userspace: test/add/del entries 100 /* Userspace: test/add/del entries
75 * returns negative error code, 101 * returns negative error code,
@@ -151,10 +177,76 @@ struct ip_set {
151 u8 family; 177 u8 family;
152 /* The type revision */ 178 /* The type revision */
153 u8 revision; 179 u8 revision;
180 /* Extensions */
181 u8 extensions;
154 /* The type specific data */ 182 /* The type specific data */
155 void *data; 183 void *data;
156}; 184};
157 185
186struct ip_set_counter {
187 atomic64_t bytes;
188 atomic64_t packets;
189};
190
191static inline void
192ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter)
193{
194 atomic64_add((long long)bytes, &(counter)->bytes);
195}
196
197static inline void
198ip_set_add_packets(u64 packets, struct ip_set_counter *counter)
199{
200 atomic64_add((long long)packets, &(counter)->packets);
201}
202
203static inline u64
204ip_set_get_bytes(const struct ip_set_counter *counter)
205{
206 return (u64)atomic64_read(&(counter)->bytes);
207}
208
209static inline u64
210ip_set_get_packets(const struct ip_set_counter *counter)
211{
212 return (u64)atomic64_read(&(counter)->packets);
213}
214
215static inline void
216ip_set_update_counter(struct ip_set_counter *counter,
217 const struct ip_set_ext *ext,
218 struct ip_set_ext *mext, u32 flags)
219{
220 if (ext->packets != ULLONG_MAX &&
221 !(flags & IPSET_FLAG_SKIP_COUNTER_UPDATE)) {
222 ip_set_add_bytes(ext->bytes, counter);
223 ip_set_add_packets(ext->packets, counter);
224 }
225 if (flags & IPSET_FLAG_MATCH_COUNTERS) {
226 mext->packets = ip_set_get_packets(counter);
227 mext->bytes = ip_set_get_bytes(counter);
228 }
229}
230
231static inline bool
232ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter)
233{
234 return nla_put_net64(skb, IPSET_ATTR_BYTES,
235 cpu_to_be64(ip_set_get_bytes(counter))) ||
236 nla_put_net64(skb, IPSET_ATTR_PACKETS,
237 cpu_to_be64(ip_set_get_packets(counter)));
238}
239
240static inline void
241ip_set_init_counter(struct ip_set_counter *counter,
242 const struct ip_set_ext *ext)
243{
244 if (ext->bytes != ULLONG_MAX)
245 atomic64_set(&(counter)->bytes, (long long)(ext->bytes));
246 if (ext->packets != ULLONG_MAX)
247 atomic64_set(&(counter)->packets, (long long)(ext->packets));
248}
249
158/* register and unregister set references */ 250/* register and unregister set references */
159extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); 251extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);
160extern void ip_set_put_byindex(ip_set_id_t index); 252extern void ip_set_put_byindex(ip_set_id_t index);
@@ -167,19 +259,21 @@ extern void ip_set_nfnl_put(ip_set_id_t index);
167 259
168extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, 260extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,
169 const struct xt_action_param *par, 261 const struct xt_action_param *par,
170 const struct ip_set_adt_opt *opt); 262 struct ip_set_adt_opt *opt);
171extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, 263extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,
172 const struct xt_action_param *par, 264 const struct xt_action_param *par,
173 const struct ip_set_adt_opt *opt); 265 struct ip_set_adt_opt *opt);
174extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, 266extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,
175 const struct xt_action_param *par, 267 const struct xt_action_param *par,
176 const struct ip_set_adt_opt *opt); 268 struct ip_set_adt_opt *opt);
177 269
178/* Utility functions */ 270/* Utility functions */
179extern void *ip_set_alloc(size_t size); 271extern void *ip_set_alloc(size_t size);
180extern void ip_set_free(void *members); 272extern void ip_set_free(void *members);
181extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); 273extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
182extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); 274extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
275extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[],
276 struct ip_set_ext *ext);
183 277
184static inline int 278static inline int
185ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) 279ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr)
@@ -200,6 +294,14 @@ ip_set_eexist(int ret, u32 flags)
200 return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST); 294 return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST);
201} 295}
202 296
297/* Match elements marked with nomatch */
298static inline bool
299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt)
300{
301 return adt == IPSET_TEST &&
302 ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH);
303}
304
203/* Check the NLA_F_NET_BYTEORDER flag */ 305/* Check the NLA_F_NET_BYTEORDER flag */
204static inline bool 306static inline bool
205ip_set_attr_netorder(struct nlattr *tb[], int type) 307ip_set_attr_netorder(struct nlattr *tb[], int type)
@@ -284,4 +386,14 @@ bitmap_bytes(u32 a, u32 b)
284 return 4 * ((((b - a + 8) / 8) + 3) / 4); 386 return 4 * ((((b - a + 8) / 8) + 3) / 4);
285} 387}
286 388
389#include <linux/netfilter/ipset/ip_set_timeout.h>
390
391#define IP_SET_INIT_KEXT(skb, opt, map) \
392 { .bytes = (skb)->len, .packets = 1, \
393 .timeout = ip_set_adt_opt_timeout(opt, map) }
394
395#define IP_SET_INIT_UEXT(map) \
396 { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \
397 .timeout = (map)->timeout }
398
287#endif /*_IP_SET_H */ 399#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
deleted file mode 100644
index 0214c4c146fa..000000000000
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ /dev/null
@@ -1,1241 +0,0 @@
1#ifndef _IP_SET_AHASH_H
2#define _IP_SET_AHASH_H
3
4#include <linux/rcupdate.h>
5#include <linux/jhash.h>
6#include <linux/netfilter/ipset/ip_set_timeout.h>
7
8#define CONCAT(a, b, c) a##b##c
9#define TOKEN(a, b, c) CONCAT(a, b, c)
10
11#define type_pf_next TOKEN(TYPE, PF, _elem)
12
13/* Hashing which uses arrays to resolve clashing. The hash table is resized
14 * (doubled) when searching becomes too long.
15 * Internally jhash is used with the assumption that the size of the
16 * stored data is a multiple of sizeof(u32). If storage supports timeout,
17 * the timeout field must be the last one in the data structure - that field
18 * is ignored when computing the hash key.
19 *
20 * Readers and resizing
21 *
22 * Resizing can be triggered by userspace command only, and those
23 * are serialized by the nfnl mutex. During resizing the set is
24 * read-locked, so the only possible concurrent operations are
25 * the kernel side readers. Those must be protected by proper RCU locking.
26 */
27
28/* Number of elements to store in an initial array block */
29#define AHASH_INIT_SIZE 4
30/* Max number of elements to store in an array block */
31#define AHASH_MAX_SIZE (3*AHASH_INIT_SIZE)
32
33/* Max number of elements can be tuned */
34#ifdef IP_SET_HASH_WITH_MULTI
35#define AHASH_MAX(h) ((h)->ahash_max)
36
37static inline u8
38tune_ahash_max(u8 curr, u32 multi)
39{
40 u32 n;
41
42 if (multi < curr)
43 return curr;
44
45 n = curr + AHASH_INIT_SIZE;
46 /* Currently, at listing one hash bucket must fit into a message.
47 * Therefore we have a hard limit here.
48 */
49 return n > curr && n <= 64 ? n : curr;
50}
51#define TUNE_AHASH_MAX(h, multi) \
52 ((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi))
53#else
54#define AHASH_MAX(h) AHASH_MAX_SIZE
55#define TUNE_AHASH_MAX(h, multi)
56#endif
57
58/* A hash bucket */
59struct hbucket {
60 void *value; /* the array of the values */
61 u8 size; /* size of the array */
62 u8 pos; /* position of the first free entry */
63};
64
65/* The hash table: the table size stored here in order to make resizing easy */
66struct htable {
67 u8 htable_bits; /* size of hash table == 2^htable_bits */
68 struct hbucket bucket[0]; /* hashtable buckets */
69};
70
71#define hbucket(h, i) (&((h)->bucket[i]))
72
73/* Book-keeping of the prefixes added to the set */
74struct ip_set_hash_nets {
75 u8 cidr; /* the different cidr values in the set */
76 u32 nets; /* number of elements per cidr */
77};
78
79/* The generic ip_set hash structure */
80struct ip_set_hash {
81 struct htable *table; /* the hash table */
82 u32 maxelem; /* max elements in the hash */
83 u32 elements; /* current element (vs timeout) */
84 u32 initval; /* random jhash init value */
85 u32 timeout; /* timeout value, if enabled */
86 struct timer_list gc; /* garbage collection when timeout enabled */
87 struct type_pf_next next; /* temporary storage for uadd */
88#ifdef IP_SET_HASH_WITH_MULTI
89 u8 ahash_max; /* max elements in an array block */
90#endif
91#ifdef IP_SET_HASH_WITH_NETMASK
92 u8 netmask; /* netmask value for subnets to store */
93#endif
94#ifdef IP_SET_HASH_WITH_RBTREE
95 struct rb_root rbtree;
96#endif
97#ifdef IP_SET_HASH_WITH_NETS
98 struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */
99#endif
100};
101
102static size_t
103htable_size(u8 hbits)
104{
105 size_t hsize;
106
107 /* We must fit both into u32 in jhash and size_t */
108 if (hbits > 31)
109 return 0;
110 hsize = jhash_size(hbits);
111 if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket)
112 < hsize)
113 return 0;
114
115 return hsize * sizeof(struct hbucket) + sizeof(struct htable);
116}
117
118/* Compute htable_bits from the user input parameter hashsize */
119static u8
120htable_bits(u32 hashsize)
121{
122 /* Assume that hashsize == 2^htable_bits */
123 u8 bits = fls(hashsize - 1);
124 if (jhash_size(bits) != hashsize)
125 /* Round up to the first 2^n value */
126 bits = fls(hashsize);
127
128 return bits;
129}
130
131#ifdef IP_SET_HASH_WITH_NETS
132#ifdef IP_SET_HASH_WITH_NETS_PACKED
133/* When cidr is packed with nomatch, cidr - 1 is stored in the entry */
134#define CIDR(cidr) (cidr + 1)
135#else
136#define CIDR(cidr) (cidr)
137#endif
138
139#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
140#ifdef IP_SET_HASH_WITH_MULTI
141#define NETS_LENGTH(family) (SET_HOST_MASK(family) + 1)
142#else
143#define NETS_LENGTH(family) SET_HOST_MASK(family)
144#endif
145
146/* Network cidr size book keeping when the hash stores different
147 * sized networks */
148static void
149add_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length)
150{
151 int i, j;
152
153 /* Add in increasing prefix order, so larger cidr first */
154 for (i = 0, j = -1; i < nets_length && h->nets[i].nets; i++) {
155 if (j != -1)
156 continue;
157 else if (h->nets[i].cidr < cidr)
158 j = i;
159 else if (h->nets[i].cidr == cidr) {
160 h->nets[i].nets++;
161 return;
162 }
163 }
164 if (j != -1) {
165 for (; i > j; i--) {
166 h->nets[i].cidr = h->nets[i - 1].cidr;
167 h->nets[i].nets = h->nets[i - 1].nets;
168 }
169 }
170 h->nets[i].cidr = cidr;
171 h->nets[i].nets = 1;
172}
173
174static void
175del_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length)
176{
177 u8 i, j;
178
179 for (i = 0; i < nets_length - 1 && h->nets[i].cidr != cidr; i++)
180 ;
181 h->nets[i].nets--;
182
183 if (h->nets[i].nets != 0)
184 return;
185
186 for (j = i; j < nets_length - 1 && h->nets[j].nets; j++) {
187 h->nets[j].cidr = h->nets[j + 1].cidr;
188 h->nets[j].nets = h->nets[j + 1].nets;
189 }
190}
191#else
192#define NETS_LENGTH(family) 0
193#endif
194
195/* Destroy the hashtable part of the set */
196static void
197ahash_destroy(struct htable *t)
198{
199 struct hbucket *n;
200 u32 i;
201
202 for (i = 0; i < jhash_size(t->htable_bits); i++) {
203 n = hbucket(t, i);
204 if (n->size)
205 /* FIXME: use slab cache */
206 kfree(n->value);
207 }
208
209 ip_set_free(t);
210}
211
212/* Calculate the actual memory size of the set data */
213static size_t
214ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 nets_length)
215{
216 u32 i;
217 struct htable *t = h->table;
218 size_t memsize = sizeof(*h)
219 + sizeof(*t)
220#ifdef IP_SET_HASH_WITH_NETS
221 + sizeof(struct ip_set_hash_nets) * nets_length
222#endif
223 + jhash_size(t->htable_bits) * sizeof(struct hbucket);
224
225 for (i = 0; i < jhash_size(t->htable_bits); i++)
226 memsize += t->bucket[i].size * dsize;
227
228 return memsize;
229}
230
231/* Flush a hash type of set: destroy all elements */
232static void
233ip_set_hash_flush(struct ip_set *set)
234{
235 struct ip_set_hash *h = set->data;
236 struct htable *t = h->table;
237 struct hbucket *n;
238 u32 i;
239
240 for (i = 0; i < jhash_size(t->htable_bits); i++) {
241 n = hbucket(t, i);
242 if (n->size) {
243 n->size = n->pos = 0;
244 /* FIXME: use slab cache */
245 kfree(n->value);
246 }
247 }
248#ifdef IP_SET_HASH_WITH_NETS
249 memset(h->nets, 0, sizeof(struct ip_set_hash_nets)
250 * NETS_LENGTH(set->family));
251#endif
252 h->elements = 0;
253}
254
255/* Destroy a hash type of set */
256static void
257ip_set_hash_destroy(struct ip_set *set)
258{
259 struct ip_set_hash *h = set->data;
260
261 if (with_timeout(h->timeout))
262 del_timer_sync(&h->gc);
263
264 ahash_destroy(h->table);
265#ifdef IP_SET_HASH_WITH_RBTREE
266 rbtree_destroy(&h->rbtree);
267#endif
268 kfree(h);
269
270 set->data = NULL;
271}
272
273#endif /* _IP_SET_AHASH_H */
274
275#ifndef HKEY_DATALEN
276#define HKEY_DATALEN sizeof(struct type_pf_elem)
277#endif
278
279#define HKEY(data, initval, htable_bits) \
280(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \
281 & jhash_mask(htable_bits))
282
283/* Type/family dependent function prototypes */
284
285#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal)
286#define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull)
287#define type_pf_data_copy TOKEN(TYPE, PF, _data_copy)
288#define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out)
289#define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask)
290#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
291#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
292#define type_pf_data_next TOKEN(TYPE, PF, _data_next)
293#define type_pf_data_flags TOKEN(TYPE, PF, _data_flags)
294#define type_pf_data_reset_flags TOKEN(TYPE, PF, _data_reset_flags)
295#ifdef IP_SET_HASH_WITH_NETS
296#define type_pf_data_match TOKEN(TYPE, PF, _data_match)
297#else
298#define type_pf_data_match(d) 1
299#endif
300
301#define type_pf_elem TOKEN(TYPE, PF, _elem)
302#define type_pf_telem TOKEN(TYPE, PF, _telem)
303#define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout)
304#define type_pf_data_expired TOKEN(TYPE, PF, _data_expired)
305#define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set)
306
307#define type_pf_elem_add TOKEN(TYPE, PF, _elem_add)
308#define type_pf_add TOKEN(TYPE, PF, _add)
309#define type_pf_del TOKEN(TYPE, PF, _del)
310#define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs)
311#define type_pf_test TOKEN(TYPE, PF, _test)
312
313#define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd)
314#define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem)
315#define type_pf_expire TOKEN(TYPE, PF, _expire)
316#define type_pf_tadd TOKEN(TYPE, PF, _tadd)
317#define type_pf_tdel TOKEN(TYPE, PF, _tdel)
318#define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs)
319#define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest)
320
321#define type_pf_resize TOKEN(TYPE, PF, _resize)
322#define type_pf_tresize TOKEN(TYPE, PF, _tresize)
323#define type_pf_flush ip_set_hash_flush
324#define type_pf_destroy ip_set_hash_destroy
325#define type_pf_head TOKEN(TYPE, PF, _head)
326#define type_pf_list TOKEN(TYPE, PF, _list)
327#define type_pf_tlist TOKEN(TYPE, PF, _tlist)
328#define type_pf_same_set TOKEN(TYPE, PF, _same_set)
329#define type_pf_kadt TOKEN(TYPE, PF, _kadt)
330#define type_pf_uadt TOKEN(TYPE, PF, _uadt)
331#define type_pf_gc TOKEN(TYPE, PF, _gc)
332#define type_pf_gc_init TOKEN(TYPE, PF, _gc_init)
333#define type_pf_variant TOKEN(TYPE, PF, _variant)
334#define type_pf_tvariant TOKEN(TYPE, PF, _tvariant)
335
336/* Flavour without timeout */
337
338/* Get the ith element from the array block n */
339#define ahash_data(n, i) \
340 ((struct type_pf_elem *)((n)->value) + (i))
341
342/* Add an element to the hash table when resizing the set:
343 * we spare the maintenance of the internal counters. */
344static int
345type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
346 u8 ahash_max, u32 cadt_flags)
347{
348 struct type_pf_elem *data;
349
350 if (n->pos >= n->size) {
351 void *tmp;
352
353 if (n->size >= ahash_max)
354 /* Trigger rehashing */
355 return -EAGAIN;
356
357 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
358 * sizeof(struct type_pf_elem),
359 GFP_ATOMIC);
360 if (!tmp)
361 return -ENOMEM;
362 if (n->size) {
363 memcpy(tmp, n->value,
364 sizeof(struct type_pf_elem) * n->size);
365 kfree(n->value);
366 }
367 n->value = tmp;
368 n->size += AHASH_INIT_SIZE;
369 }
370 data = ahash_data(n, n->pos++);
371 type_pf_data_copy(data, value);
372#ifdef IP_SET_HASH_WITH_NETS
373 /* Resizing won't overwrite stored flags */
374 if (cadt_flags)
375 type_pf_data_flags(data, cadt_flags);
376#endif
377 return 0;
378}
379
380/* Resize a hash: create a new hash table with doubling the hashsize
381 * and inserting the elements to it. Repeat until we succeed or
382 * fail due to memory pressures. */
383static int
384type_pf_resize(struct ip_set *set, bool retried)
385{
386 struct ip_set_hash *h = set->data;
387 struct htable *t, *orig = h->table;
388 u8 htable_bits = orig->htable_bits;
389 struct type_pf_elem *data;
390 struct hbucket *n, *m;
391 u32 i, j, flags = 0;
392 int ret;
393
394retry:
395 ret = 0;
396 htable_bits++;
397 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
398 set->name, orig->htable_bits, htable_bits, orig);
399 if (!htable_bits) {
400 /* In case we have plenty of memory :-) */
401 pr_warning("Cannot increase the hashsize of set %s further\n",
402 set->name);
403 return -IPSET_ERR_HASH_FULL;
404 }
405 t = ip_set_alloc(sizeof(*t)
406 + jhash_size(htable_bits) * sizeof(struct hbucket));
407 if (!t)
408 return -ENOMEM;
409 t->htable_bits = htable_bits;
410
411 read_lock_bh(&set->lock);
412 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
413 n = hbucket(orig, i);
414 for (j = 0; j < n->pos; j++) {
415 data = ahash_data(n, j);
416#ifdef IP_SET_HASH_WITH_NETS
417 flags = 0;
418 type_pf_data_reset_flags(data, &flags);
419#endif
420 m = hbucket(t, HKEY(data, h->initval, htable_bits));
421 ret = type_pf_elem_add(m, data, AHASH_MAX(h), flags);
422 if (ret < 0) {
423#ifdef IP_SET_HASH_WITH_NETS
424 type_pf_data_flags(data, flags);
425#endif
426 read_unlock_bh(&set->lock);
427 ahash_destroy(t);
428 if (ret == -EAGAIN)
429 goto retry;
430 return ret;
431 }
432 }
433 }
434
435 rcu_assign_pointer(h->table, t);
436 read_unlock_bh(&set->lock);
437
438 /* Give time to other readers of the set */
439 synchronize_rcu_bh();
440
441 pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
442 orig->htable_bits, orig, t->htable_bits, t);
443 ahash_destroy(orig);
444
445 return 0;
446}
447
448static inline void
449type_pf_data_next(struct ip_set_hash *h, const struct type_pf_elem *d);
450
451/* Add an element to a hash and update the internal counters when succeeded,
452 * otherwise report the proper error code. */
453static int
454type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
455{
456 struct ip_set_hash *h = set->data;
457 struct htable *t;
458 const struct type_pf_elem *d = value;
459 struct hbucket *n;
460 int i, ret = 0;
461 u32 key, multi = 0;
462 u32 cadt_flags = flags >> 16;
463
464 if (h->elements >= h->maxelem) {
465 if (net_ratelimit())
466 pr_warning("Set %s is full, maxelem %u reached\n",
467 set->name, h->maxelem);
468 return -IPSET_ERR_HASH_FULL;
469 }
470
471 rcu_read_lock_bh();
472 t = rcu_dereference_bh(h->table);
473 key = HKEY(value, h->initval, t->htable_bits);
474 n = hbucket(t, key);
475 for (i = 0; i < n->pos; i++)
476 if (type_pf_data_equal(ahash_data(n, i), d, &multi)) {
477#ifdef IP_SET_HASH_WITH_NETS
478 if (flags & IPSET_FLAG_EXIST)
479 /* Support overwriting just the flags */
480 type_pf_data_flags(ahash_data(n, i),
481 cadt_flags);
482#endif
483 ret = -IPSET_ERR_EXIST;
484 goto out;
485 }
486 TUNE_AHASH_MAX(h, multi);
487 ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags);
488 if (ret != 0) {
489 if (ret == -EAGAIN)
490 type_pf_data_next(h, d);
491 goto out;
492 }
493
494#ifdef IP_SET_HASH_WITH_NETS
495 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
496#endif
497 h->elements++;
498out:
499 rcu_read_unlock_bh();
500 return ret;
501}
502
503/* Delete an element from the hash: swap it with the last element
504 * and free up space if possible.
505 */
506static int
507type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags)
508{
509 struct ip_set_hash *h = set->data;
510 struct htable *t = h->table;
511 const struct type_pf_elem *d = value;
512 struct hbucket *n;
513 int i;
514 struct type_pf_elem *data;
515 u32 key, multi = 0;
516
517 key = HKEY(value, h->initval, t->htable_bits);
518 n = hbucket(t, key);
519 for (i = 0; i < n->pos; i++) {
520 data = ahash_data(n, i);
521 if (!type_pf_data_equal(data, d, &multi))
522 continue;
523 if (i != n->pos - 1)
524 /* Not last one */
525 type_pf_data_copy(data, ahash_data(n, n->pos - 1));
526
527 n->pos--;
528 h->elements--;
529#ifdef IP_SET_HASH_WITH_NETS
530 del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
531#endif
532 if (n->pos + AHASH_INIT_SIZE < n->size) {
533 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
534 * sizeof(struct type_pf_elem),
535 GFP_ATOMIC);
536 if (!tmp)
537 return 0;
538 n->size -= AHASH_INIT_SIZE;
539 memcpy(tmp, n->value,
540 n->size * sizeof(struct type_pf_elem));
541 kfree(n->value);
542 n->value = tmp;
543 }
544 return 0;
545 }
546
547 return -IPSET_ERR_EXIST;
548}
549
550#ifdef IP_SET_HASH_WITH_NETS
551
552/* Special test function which takes into account the different network
553 * sizes added to the set */
554static int
555type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
556{
557 struct ip_set_hash *h = set->data;
558 struct htable *t = h->table;
559 struct hbucket *n;
560 const struct type_pf_elem *data;
561 int i, j = 0;
562 u32 key, multi = 0;
563 u8 nets_length = NETS_LENGTH(set->family);
564
565 pr_debug("test by nets\n");
566 for (; j < nets_length && h->nets[j].nets && !multi; j++) {
567 type_pf_data_netmask(d, h->nets[j].cidr);
568 key = HKEY(d, h->initval, t->htable_bits);
569 n = hbucket(t, key);
570 for (i = 0; i < n->pos; i++) {
571 data = ahash_data(n, i);
572 if (type_pf_data_equal(data, d, &multi))
573 return type_pf_data_match(data);
574 }
575 }
576 return 0;
577}
578#endif
579
580/* Test whether the element is added to the set */
581static int
582type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
583{
584 struct ip_set_hash *h = set->data;
585 struct htable *t = h->table;
586 struct type_pf_elem *d = value;
587 struct hbucket *n;
588 const struct type_pf_elem *data;
589 int i;
590 u32 key, multi = 0;
591
592#ifdef IP_SET_HASH_WITH_NETS
593 /* If we test an IP address and not a network address,
594 * try all possible network sizes */
595 if (CIDR(d->cidr) == SET_HOST_MASK(set->family))
596 return type_pf_test_cidrs(set, d, timeout);
597#endif
598
599 key = HKEY(d, h->initval, t->htable_bits);
600 n = hbucket(t, key);
601 for (i = 0; i < n->pos; i++) {
602 data = ahash_data(n, i);
603 if (type_pf_data_equal(data, d, &multi))
604 return type_pf_data_match(data);
605 }
606 return 0;
607}
608
609/* Reply a HEADER request: fill out the header part of the set */
610static int
611type_pf_head(struct ip_set *set, struct sk_buff *skb)
612{
613 const struct ip_set_hash *h = set->data;
614 struct nlattr *nested;
615 size_t memsize;
616
617 read_lock_bh(&set->lock);
618 memsize = ahash_memsize(h, with_timeout(h->timeout)
619 ? sizeof(struct type_pf_telem)
620 : sizeof(struct type_pf_elem),
621 NETS_LENGTH(set->family));
622 read_unlock_bh(&set->lock);
623
624 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
625 if (!nested)
626 goto nla_put_failure;
627 if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE,
628 htonl(jhash_size(h->table->htable_bits))) ||
629 nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)))
630 goto nla_put_failure;
631#ifdef IP_SET_HASH_WITH_NETMASK
632 if (h->netmask != HOST_MASK &&
633 nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask))
634 goto nla_put_failure;
635#endif
636 if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) ||
637 nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
638 (with_timeout(h->timeout) &&
639 nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout))))
640 goto nla_put_failure;
641 ipset_nest_end(skb, nested);
642
643 return 0;
644nla_put_failure:
645 return -EMSGSIZE;
646}
647
648/* Reply a LIST/SAVE request: dump the elements of the specified set */
649static int
650type_pf_list(const struct ip_set *set,
651 struct sk_buff *skb, struct netlink_callback *cb)
652{
653 const struct ip_set_hash *h = set->data;
654 const struct htable *t = h->table;
655 struct nlattr *atd, *nested;
656 const struct hbucket *n;
657 const struct type_pf_elem *data;
658 u32 first = cb->args[2];
659 /* We assume that one hash bucket fills into one page */
660 void *incomplete;
661 int i;
662
663 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
664 if (!atd)
665 return -EMSGSIZE;
666 pr_debug("list hash set %s\n", set->name);
667 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
668 incomplete = skb_tail_pointer(skb);
669 n = hbucket(t, cb->args[2]);
670 pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n);
671 for (i = 0; i < n->pos; i++) {
672 data = ahash_data(n, i);
673 pr_debug("list hash %lu hbucket %p i %u, data %p\n",
674 cb->args[2], n, i, data);
675 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
676 if (!nested) {
677 if (cb->args[2] == first) {
678 nla_nest_cancel(skb, atd);
679 return -EMSGSIZE;
680 } else
681 goto nla_put_failure;
682 }
683 if (type_pf_data_list(skb, data))
684 goto nla_put_failure;
685 ipset_nest_end(skb, nested);
686 }
687 }
688 ipset_nest_end(skb, atd);
689 /* Set listing finished */
690 cb->args[2] = 0;
691
692 return 0;
693
694nla_put_failure:
695 nlmsg_trim(skb, incomplete);
696 ipset_nest_end(skb, atd);
697 if (unlikely(first == cb->args[2])) {
698 pr_warning("Can't list set %s: one bucket does not fit into "
699 "a message. Please report it!\n", set->name);
700 cb->args[2] = 0;
701 return -EMSGSIZE;
702 }
703 return 0;
704}
705
706static int
707type_pf_kadt(struct ip_set *set, const struct sk_buff *skb,
708 const struct xt_action_param *par,
709 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
710static int
711type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
712 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried);
713
714static const struct ip_set_type_variant type_pf_variant = {
715 .kadt = type_pf_kadt,
716 .uadt = type_pf_uadt,
717 .adt = {
718 [IPSET_ADD] = type_pf_add,
719 [IPSET_DEL] = type_pf_del,
720 [IPSET_TEST] = type_pf_test,
721 },
722 .destroy = type_pf_destroy,
723 .flush = type_pf_flush,
724 .head = type_pf_head,
725 .list = type_pf_list,
726 .resize = type_pf_resize,
727 .same_set = type_pf_same_set,
728};
729
730/* Flavour with timeout support */
731
732#define ahash_tdata(n, i) \
733 (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i))
734
735static inline u32
736type_pf_data_timeout(const struct type_pf_elem *data)
737{
738 const struct type_pf_telem *tdata =
739 (const struct type_pf_telem *) data;
740
741 return tdata->timeout;
742}
743
744static inline bool
745type_pf_data_expired(const struct type_pf_elem *data)
746{
747 const struct type_pf_telem *tdata =
748 (const struct type_pf_telem *) data;
749
750 return ip_set_timeout_expired(tdata->timeout);
751}
752
753static inline void
754type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
755{
756 struct type_pf_telem *tdata = (struct type_pf_telem *) data;
757
758 tdata->timeout = ip_set_timeout_set(timeout);
759}
760
761static int
762type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
763 u8 ahash_max, u32 cadt_flags, u32 timeout)
764{
765 struct type_pf_elem *data;
766
767 if (n->pos >= n->size) {
768 void *tmp;
769
770 if (n->size >= ahash_max)
771 /* Trigger rehashing */
772 return -EAGAIN;
773
774 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
775 * sizeof(struct type_pf_telem),
776 GFP_ATOMIC);
777 if (!tmp)
778 return -ENOMEM;
779 if (n->size) {
780 memcpy(tmp, n->value,
781 sizeof(struct type_pf_telem) * n->size);
782 kfree(n->value);
783 }
784 n->value = tmp;
785 n->size += AHASH_INIT_SIZE;
786 }
787 data = ahash_tdata(n, n->pos++);
788 type_pf_data_copy(data, value);
789 type_pf_data_timeout_set(data, timeout);
790#ifdef IP_SET_HASH_WITH_NETS
791 /* Resizing won't overwrite stored flags */
792 if (cadt_flags)
793 type_pf_data_flags(data, cadt_flags);
794#endif
795 return 0;
796}
797
798/* Delete expired elements from the hashtable */
799static void
800type_pf_expire(struct ip_set_hash *h, u8 nets_length)
801{
802 struct htable *t = h->table;
803 struct hbucket *n;
804 struct type_pf_elem *data;
805 u32 i;
806 int j;
807
808 for (i = 0; i < jhash_size(t->htable_bits); i++) {
809 n = hbucket(t, i);
810 for (j = 0; j < n->pos; j++) {
811 data = ahash_tdata(n, j);
812 if (type_pf_data_expired(data)) {
813 pr_debug("expired %u/%u\n", i, j);
814#ifdef IP_SET_HASH_WITH_NETS
815 del_cidr(h, CIDR(data->cidr), nets_length);
816#endif
817 if (j != n->pos - 1)
818 /* Not last one */
819 type_pf_data_copy(data,
820 ahash_tdata(n, n->pos - 1));
821 n->pos--;
822 h->elements--;
823 }
824 }
825 if (n->pos + AHASH_INIT_SIZE < n->size) {
826 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
827 * sizeof(struct type_pf_telem),
828 GFP_ATOMIC);
829 if (!tmp)
830 /* Still try to delete expired elements */
831 continue;
832 n->size -= AHASH_INIT_SIZE;
833 memcpy(tmp, n->value,
834 n->size * sizeof(struct type_pf_telem));
835 kfree(n->value);
836 n->value = tmp;
837 }
838 }
839}
840
841static int
842type_pf_tresize(struct ip_set *set, bool retried)
843{
844 struct ip_set_hash *h = set->data;
845 struct htable *t, *orig = h->table;
846 u8 htable_bits = orig->htable_bits;
847 struct type_pf_elem *data;
848 struct hbucket *n, *m;
849 u32 i, j, flags = 0;
850 int ret;
851
852 /* Try to cleanup once */
853 if (!retried) {
854 i = h->elements;
855 write_lock_bh(&set->lock);
856 type_pf_expire(set->data, NETS_LENGTH(set->family));
857 write_unlock_bh(&set->lock);
858 if (h->elements < i)
859 return 0;
860 }
861
862retry:
863 ret = 0;
864 htable_bits++;
865 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
866 set->name, orig->htable_bits, htable_bits, orig);
867 if (!htable_bits) {
868 /* In case we have plenty of memory :-) */
869 pr_warning("Cannot increase the hashsize of set %s further\n",
870 set->name);
871 return -IPSET_ERR_HASH_FULL;
872 }
873 t = ip_set_alloc(sizeof(*t)
874 + jhash_size(htable_bits) * sizeof(struct hbucket));
875 if (!t)
876 return -ENOMEM;
877 t->htable_bits = htable_bits;
878
879 read_lock_bh(&set->lock);
880 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
881 n = hbucket(orig, i);
882 for (j = 0; j < n->pos; j++) {
883 data = ahash_tdata(n, j);
884#ifdef IP_SET_HASH_WITH_NETS
885 flags = 0;
886 type_pf_data_reset_flags(data, &flags);
887#endif
888 m = hbucket(t, HKEY(data, h->initval, htable_bits));
889 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), flags,
890 ip_set_timeout_get(type_pf_data_timeout(data)));
891 if (ret < 0) {
892#ifdef IP_SET_HASH_WITH_NETS
893 type_pf_data_flags(data, flags);
894#endif
895 read_unlock_bh(&set->lock);
896 ahash_destroy(t);
897 if (ret == -EAGAIN)
898 goto retry;
899 return ret;
900 }
901 }
902 }
903
904 rcu_assign_pointer(h->table, t);
905 read_unlock_bh(&set->lock);
906
907 /* Give time to other readers of the set */
908 synchronize_rcu_bh();
909
910 ahash_destroy(orig);
911
912 return 0;
913}
914
915static int
916type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
917{
918 struct ip_set_hash *h = set->data;
919 struct htable *t = h->table;
920 const struct type_pf_elem *d = value;
921 struct hbucket *n;
922 struct type_pf_elem *data;
923 int ret = 0, i, j = AHASH_MAX(h) + 1;
924 bool flag_exist = flags & IPSET_FLAG_EXIST;
925 u32 key, multi = 0;
926 u32 cadt_flags = flags >> 16;
927
928 if (h->elements >= h->maxelem)
929 /* FIXME: when set is full, we slow down here */
930 type_pf_expire(h, NETS_LENGTH(set->family));
931 if (h->elements >= h->maxelem) {
932 if (net_ratelimit())
933 pr_warning("Set %s is full, maxelem %u reached\n",
934 set->name, h->maxelem);
935 return -IPSET_ERR_HASH_FULL;
936 }
937
938 rcu_read_lock_bh();
939 t = rcu_dereference_bh(h->table);
940 key = HKEY(d, h->initval, t->htable_bits);
941 n = hbucket(t, key);
942 for (i = 0; i < n->pos; i++) {
943 data = ahash_tdata(n, i);
944 if (type_pf_data_equal(data, d, &multi)) {
945 if (type_pf_data_expired(data) || flag_exist)
946 /* Just timeout value may be updated */
947 j = i;
948 else {
949 ret = -IPSET_ERR_EXIST;
950 goto out;
951 }
952 } else if (j == AHASH_MAX(h) + 1 &&
953 type_pf_data_expired(data))
954 j = i;
955 }
956 if (j != AHASH_MAX(h) + 1) {
957 data = ahash_tdata(n, j);
958#ifdef IP_SET_HASH_WITH_NETS
959 del_cidr(h, CIDR(data->cidr), NETS_LENGTH(set->family));
960 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
961#endif
962 type_pf_data_copy(data, d);
963 type_pf_data_timeout_set(data, timeout);
964#ifdef IP_SET_HASH_WITH_NETS
965 type_pf_data_flags(data, cadt_flags);
966#endif
967 goto out;
968 }
969 TUNE_AHASH_MAX(h, multi);
970 ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout);
971 if (ret != 0) {
972 if (ret == -EAGAIN)
973 type_pf_data_next(h, d);
974 goto out;
975 }
976
977#ifdef IP_SET_HASH_WITH_NETS
978 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
979#endif
980 h->elements++;
981out:
982 rcu_read_unlock_bh();
983 return ret;
984}
985
986static int
987type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags)
988{
989 struct ip_set_hash *h = set->data;
990 struct htable *t = h->table;
991 const struct type_pf_elem *d = value;
992 struct hbucket *n;
993 int i;
994 struct type_pf_elem *data;
995 u32 key, multi = 0;
996
997 key = HKEY(value, h->initval, t->htable_bits);
998 n = hbucket(t, key);
999 for (i = 0; i < n->pos; i++) {
1000 data = ahash_tdata(n, i);
1001 if (!type_pf_data_equal(data, d, &multi))
1002 continue;
1003 if (type_pf_data_expired(data))
1004 return -IPSET_ERR_EXIST;
1005 if (i != n->pos - 1)
1006 /* Not last one */
1007 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
1008
1009 n->pos--;
1010 h->elements--;
1011#ifdef IP_SET_HASH_WITH_NETS
1012 del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
1013#endif
1014 if (n->pos + AHASH_INIT_SIZE < n->size) {
1015 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
1016 * sizeof(struct type_pf_telem),
1017 GFP_ATOMIC);
1018 if (!tmp)
1019 return 0;
1020 n->size -= AHASH_INIT_SIZE;
1021 memcpy(tmp, n->value,
1022 n->size * sizeof(struct type_pf_telem));
1023 kfree(n->value);
1024 n->value = tmp;
1025 }
1026 return 0;
1027 }
1028
1029 return -IPSET_ERR_EXIST;
1030}
1031
1032#ifdef IP_SET_HASH_WITH_NETS
1033static int
1034type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
1035{
1036 struct ip_set_hash *h = set->data;
1037 struct htable *t = h->table;
1038 struct type_pf_elem *data;
1039 struct hbucket *n;
1040 int i, j = 0;
1041 u32 key, multi = 0;
1042 u8 nets_length = NETS_LENGTH(set->family);
1043
1044 for (; j < nets_length && h->nets[j].nets && !multi; j++) {
1045 type_pf_data_netmask(d, h->nets[j].cidr);
1046 key = HKEY(d, h->initval, t->htable_bits);
1047 n = hbucket(t, key);
1048 for (i = 0; i < n->pos; i++) {
1049 data = ahash_tdata(n, i);
1050#ifdef IP_SET_HASH_WITH_MULTI
1051 if (type_pf_data_equal(data, d, &multi)) {
1052 if (!type_pf_data_expired(data))
1053 return type_pf_data_match(data);
1054 multi = 0;
1055 }
1056#else
1057 if (type_pf_data_equal(data, d, &multi) &&
1058 !type_pf_data_expired(data))
1059 return type_pf_data_match(data);
1060#endif
1061 }
1062 }
1063 return 0;
1064}
1065#endif
1066
1067static int
1068type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags)
1069{
1070 struct ip_set_hash *h = set->data;
1071 struct htable *t = h->table;
1072 struct type_pf_elem *data, *d = value;
1073 struct hbucket *n;
1074 int i;
1075 u32 key, multi = 0;
1076
1077#ifdef IP_SET_HASH_WITH_NETS
1078 if (CIDR(d->cidr) == SET_HOST_MASK(set->family))
1079 return type_pf_ttest_cidrs(set, d, timeout);
1080#endif
1081 key = HKEY(d, h->initval, t->htable_bits);
1082 n = hbucket(t, key);
1083 for (i = 0; i < n->pos; i++) {
1084 data = ahash_tdata(n, i);
1085 if (type_pf_data_equal(data, d, &multi) &&
1086 !type_pf_data_expired(data))
1087 return type_pf_data_match(data);
1088 }
1089 return 0;
1090}
1091
1092static int
1093type_pf_tlist(const struct ip_set *set,
1094 struct sk_buff *skb, struct netlink_callback *cb)
1095{
1096 const struct ip_set_hash *h = set->data;
1097 const struct htable *t = h->table;
1098 struct nlattr *atd, *nested;
1099 const struct hbucket *n;
1100 const struct type_pf_elem *data;
1101 u32 first = cb->args[2];
1102 /* We assume that one hash bucket fills into one page */
1103 void *incomplete;
1104 int i;
1105
1106 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
1107 if (!atd)
1108 return -EMSGSIZE;
1109 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
1110 incomplete = skb_tail_pointer(skb);
1111 n = hbucket(t, cb->args[2]);
1112 for (i = 0; i < n->pos; i++) {
1113 data = ahash_tdata(n, i);
1114 pr_debug("list %p %u\n", n, i);
1115 if (type_pf_data_expired(data))
1116 continue;
1117 pr_debug("do list %p %u\n", n, i);
1118 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
1119 if (!nested) {
1120 if (cb->args[2] == first) {
1121 nla_nest_cancel(skb, atd);
1122 return -EMSGSIZE;
1123 } else
1124 goto nla_put_failure;
1125 }
1126 if (type_pf_data_tlist(skb, data))
1127 goto nla_put_failure;
1128 ipset_nest_end(skb, nested);
1129 }
1130 }
1131 ipset_nest_end(skb, atd);
1132 /* Set listing finished */
1133 cb->args[2] = 0;
1134
1135 return 0;
1136
1137nla_put_failure:
1138 nlmsg_trim(skb, incomplete);
1139 ipset_nest_end(skb, atd);
1140 if (unlikely(first == cb->args[2])) {
1141 pr_warning("Can't list set %s: one bucket does not fit into "
1142 "a message. Please report it!\n", set->name);
1143 cb->args[2] = 0;
1144 return -EMSGSIZE;
1145 }
1146 return 0;
1147}
1148
1149static const struct ip_set_type_variant type_pf_tvariant = {
1150 .kadt = type_pf_kadt,
1151 .uadt = type_pf_uadt,
1152 .adt = {
1153 [IPSET_ADD] = type_pf_tadd,
1154 [IPSET_DEL] = type_pf_tdel,
1155 [IPSET_TEST] = type_pf_ttest,
1156 },
1157 .destroy = type_pf_destroy,
1158 .flush = type_pf_flush,
1159 .head = type_pf_head,
1160 .list = type_pf_tlist,
1161 .resize = type_pf_tresize,
1162 .same_set = type_pf_same_set,
1163};
1164
1165static void
1166type_pf_gc(unsigned long ul_set)
1167{
1168 struct ip_set *set = (struct ip_set *) ul_set;
1169 struct ip_set_hash *h = set->data;
1170
1171 pr_debug("called\n");
1172 write_lock_bh(&set->lock);
1173 type_pf_expire(h, NETS_LENGTH(set->family));
1174 write_unlock_bh(&set->lock);
1175
1176 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1177 add_timer(&h->gc);
1178}
1179
1180static void
1181type_pf_gc_init(struct ip_set *set)
1182{
1183 struct ip_set_hash *h = set->data;
1184
1185 init_timer(&h->gc);
1186 h->gc.data = (unsigned long) set;
1187 h->gc.function = type_pf_gc;
1188 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1189 add_timer(&h->gc);
1190 pr_debug("gc initialized, run in every %u\n",
1191 IPSET_GC_PERIOD(h->timeout));
1192}
1193
1194#undef HKEY_DATALEN
1195#undef HKEY
1196#undef type_pf_data_equal
1197#undef type_pf_data_isnull
1198#undef type_pf_data_copy
1199#undef type_pf_data_zero_out
1200#undef type_pf_data_netmask
1201#undef type_pf_data_list
1202#undef type_pf_data_tlist
1203#undef type_pf_data_next
1204#undef type_pf_data_flags
1205#undef type_pf_data_reset_flags
1206#undef type_pf_data_match
1207
1208#undef type_pf_elem
1209#undef type_pf_telem
1210#undef type_pf_data_timeout
1211#undef type_pf_data_expired
1212#undef type_pf_data_timeout_set
1213
1214#undef type_pf_elem_add
1215#undef type_pf_add
1216#undef type_pf_del
1217#undef type_pf_test_cidrs
1218#undef type_pf_test
1219
1220#undef type_pf_elem_tadd
1221#undef type_pf_del_telem
1222#undef type_pf_expire
1223#undef type_pf_tadd
1224#undef type_pf_tdel
1225#undef type_pf_ttest_cidrs
1226#undef type_pf_ttest
1227
1228#undef type_pf_resize
1229#undef type_pf_tresize
1230#undef type_pf_flush
1231#undef type_pf_destroy
1232#undef type_pf_head
1233#undef type_pf_list
1234#undef type_pf_tlist
1235#undef type_pf_same_set
1236#undef type_pf_kadt
1237#undef type_pf_uadt
1238#undef type_pf_gc
1239#undef type_pf_gc_init
1240#undef type_pf_variant
1241#undef type_pf_tvariant
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h
index 1a30646d5be8..5e4662a71e01 100644
--- a/include/linux/netfilter/ipset/ip_set_bitmap.h
+++ b/include/linux/netfilter/ipset/ip_set_bitmap.h
@@ -5,6 +5,12 @@
5 5
6#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF 6#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF
7 7
8enum {
9 IPSET_ADD_FAILED = 1,
10 IPSET_ADD_STORE_PLAIN_TIMEOUT,
11 IPSET_ADD_START_STORED_TIMEOUT,
12};
13
8/* Common functions */ 14/* Common functions */
9 15
10static inline u32 16static inline u32
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 41d9cfa08167..3aac04167ca7 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -1,7 +1,7 @@
1#ifndef _IP_SET_TIMEOUT_H 1#ifndef _IP_SET_TIMEOUT_H
2#define _IP_SET_TIMEOUT_H 2#define _IP_SET_TIMEOUT_H
3 3
4/* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> 4/* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
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 version 2 as 7 * it under the terms of the GNU General Public License version 2 as
@@ -17,13 +17,14 @@
17#define IPSET_GC_PERIOD(timeout) \ 17#define IPSET_GC_PERIOD(timeout) \
18 ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) 18 ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1)
19 19
20/* Set is defined without timeout support: timeout value may be 0 */ 20/* Entry is set with no timeout value */
21#define IPSET_NO_TIMEOUT UINT_MAX 21#define IPSET_ELEM_PERMANENT 0
22 22
23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT) 23/* Set is defined with timeout support: timeout value may be 0 */
24#define IPSET_NO_TIMEOUT UINT_MAX
24 25
25#define opt_timeout(opt, map) \ 26#define ip_set_adt_opt_timeout(opt, map) \
26 (with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout) 27((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (map)->timeout)
27 28
28static inline unsigned int 29static inline unsigned int
29ip_set_timeout_uget(struct nlattr *tb) 30ip_set_timeout_uget(struct nlattr *tb)
@@ -38,61 +39,6 @@ ip_set_timeout_uget(struct nlattr *tb)
38 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; 39 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
39} 40}
40 41
41#ifdef IP_SET_BITMAP_TIMEOUT
42
43/* Bitmap specific timeout constants and macros for the entries */
44
45/* Bitmap entry is unset */
46#define IPSET_ELEM_UNSET 0
47/* Bitmap entry is set with no timeout value */
48#define IPSET_ELEM_PERMANENT (UINT_MAX/2)
49
50static inline bool
51ip_set_timeout_test(unsigned long timeout)
52{
53 return timeout != IPSET_ELEM_UNSET &&
54 (timeout == IPSET_ELEM_PERMANENT ||
55 time_is_after_jiffies(timeout));
56}
57
58static inline bool
59ip_set_timeout_expired(unsigned long timeout)
60{
61 return timeout != IPSET_ELEM_UNSET &&
62 timeout != IPSET_ELEM_PERMANENT &&
63 time_is_before_jiffies(timeout);
64}
65
66static inline unsigned long
67ip_set_timeout_set(u32 timeout)
68{
69 unsigned long t;
70
71 if (!timeout)
72 return IPSET_ELEM_PERMANENT;
73
74 t = msecs_to_jiffies(timeout * 1000) + jiffies;
75 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
76 /* Bingo! */
77 t++;
78
79 return t;
80}
81
82static inline u32
83ip_set_timeout_get(unsigned long timeout)
84{
85 return timeout == IPSET_ELEM_PERMANENT ? 0 :
86 jiffies_to_msecs(timeout - jiffies)/1000;
87}
88
89#else
90
91/* Hash specific timeout constants and macros for the entries */
92
93/* Hash entry is set with no timeout value */
94#define IPSET_ELEM_PERMANENT 0
95
96static inline bool 42static inline bool
97ip_set_timeout_test(unsigned long timeout) 43ip_set_timeout_test(unsigned long timeout)
98{ 44{
@@ -101,36 +47,32 @@ ip_set_timeout_test(unsigned long timeout)
101} 47}
102 48
103static inline bool 49static inline bool
104ip_set_timeout_expired(unsigned long timeout) 50ip_set_timeout_expired(unsigned long *timeout)
105{ 51{
106 return timeout != IPSET_ELEM_PERMANENT && 52 return *timeout != IPSET_ELEM_PERMANENT &&
107 time_is_before_jiffies(timeout); 53 time_is_before_jiffies(*timeout);
108} 54}
109 55
110static inline unsigned long 56static inline void
111ip_set_timeout_set(u32 timeout) 57ip_set_timeout_set(unsigned long *timeout, u32 t)
112{ 58{
113 unsigned long t; 59 if (!t) {
114 60 *timeout = IPSET_ELEM_PERMANENT;
115 if (!timeout) 61 return;
116 return IPSET_ELEM_PERMANENT; 62 }
117 63
118 t = msecs_to_jiffies(timeout * 1000) + jiffies; 64 *timeout = msecs_to_jiffies(t * 1000) + jiffies;
119 if (t == IPSET_ELEM_PERMANENT) 65 if (*timeout == IPSET_ELEM_PERMANENT)
120 /* Bingo! :-) */ 66 /* Bingo! :-) */
121 t++; 67 (*timeout)--;
122
123 return t;
124} 68}
125 69
126static inline u32 70static inline u32
127ip_set_timeout_get(unsigned long timeout) 71ip_set_timeout_get(unsigned long *timeout)
128{ 72{
129 return timeout == IPSET_ELEM_PERMANENT ? 0 : 73 return *timeout == IPSET_ELEM_PERMANENT ? 0 :
130 jiffies_to_msecs(timeout - jiffies)/1000; 74 jiffies_to_msecs(*timeout - jiffies)/1000;
131} 75}
132#endif /* ! IP_SET_BITMAP_TIMEOUT */
133 76
134#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
135
136#endif /* _IP_SET_TIMEOUT_H */ 78#endif /* _IP_SET_TIMEOUT_H */
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h
index 199fd11fedc0..1afbb94b4b65 100644
--- a/include/linux/netfilter/ipset/pfxlen.h
+++ b/include/linux/netfilter/ipset/pfxlen.h
@@ -41,4 +41,13 @@ do { \
41 to = from | ~ip_set_hostmask(cidr); \ 41 to = from | ~ip_set_hostmask(cidr); \
42} while (0) 42} while (0)
43 43
44static inline void
45ip6_netmask(union nf_inet_addr *ip, u8 prefix)
46{
47 ip->ip6[0] &= ip_set_netmask6(prefix)[0];
48 ip->ip6[1] &= ip_set_netmask6(prefix)[1];
49 ip->ip6[2] &= ip_set_netmask6(prefix)[2];
50 ip->ip6[3] &= ip_set_netmask6(prefix)[3];
51}
52
44#endif /*_PFXLEN_H */ 53#endif /*_PFXLEN_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index ecbb8e495912..cadb7402d7a7 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -29,10 +29,13 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
29extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 29extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
30 30
31extern int nfnetlink_has_listeners(struct net *net, unsigned int group); 31extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
32extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, 32extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
33 int echo, gfp_t flags); 33 u32 dst_portid, gfp_t gfp_mask);
34extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); 34extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
35extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); 35 unsigned int group, int echo, gfp_t flags);
36extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
37extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net,
38 u32 portid, int flags);
36 39
37extern void nfnl_lock(__u8 subsys_id); 40extern void nfnl_lock(__u8 subsys_id);
38extern void nfnl_unlock(__u8 subsys_id); 41extern void nfnl_unlock(__u8 subsys_id);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index e0f746b7b95c..6358da5eeee8 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -15,11 +15,18 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
15 return (struct nlmsghdr *)skb->data; 15 return (struct nlmsghdr *)skb->data;
16} 16}
17 17
18enum netlink_skb_flags {
19 NETLINK_SKB_MMAPED = 0x1, /* Packet data is mmaped */
20 NETLINK_SKB_TX = 0x2, /* Packet was sent by userspace */
21 NETLINK_SKB_DELIVERED = 0x4, /* Packet was delivered */
22};
23
18struct netlink_skb_parms { 24struct netlink_skb_parms {
19 struct scm_creds creds; /* Skb credentials */ 25 struct scm_creds creds; /* Skb credentials */
20 __u32 portid; 26 __u32 portid;
21 __u32 dst_group; 27 __u32 dst_group;
22 struct sock *ssk; 28 __u32 flags;
29 struct sock *sk;
23}; 30};
24 31
25#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 32#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
@@ -57,6 +64,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)
57extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 64extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
58extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 65extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
59extern int netlink_has_listeners(struct sock *sk, unsigned int group); 66extern int netlink_has_listeners(struct sock *sk, unsigned int group);
67extern struct sk_buff *netlink_alloc_skb(struct sock *ssk, unsigned int size,
68 u32 dst_portid, gfp_t gfp_mask);
60extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); 69extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
61extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, 70extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
62 __u32 group, gfp_t allocation); 71 __u32 group, gfp_t allocation);
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 9d7d8c64f7c8..fa2cb76a7029 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -40,7 +40,7 @@ struct netpoll_info {
40 40
41 unsigned long rx_flags; 41 unsigned long rx_flags;
42 spinlock_t rx_lock; 42 spinlock_t rx_lock;
43 struct mutex dev_lock; 43 struct semaphore dev_lock;
44 struct list_head rx_np; /* netpolls that registered an rx_hook */ 44 struct list_head rx_np; /* netpolls that registered an rx_hook */
45 45
46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ 46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 1cc25682b20b..fc01d5cb4cf1 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -59,11 +59,18 @@ struct nfs_lockowner {
59 pid_t l_pid; 59 pid_t l_pid;
60}; 60};
61 61
62#define NFS_IO_INPROGRESS 0
63struct nfs_io_counter {
64 unsigned long flags;
65 atomic_t io_count;
66};
67
62struct nfs_lock_context { 68struct nfs_lock_context {
63 atomic_t count; 69 atomic_t count;
64 struct list_head list; 70 struct list_head list;
65 struct nfs_open_context *open_context; 71 struct nfs_open_context *open_context;
66 struct nfs_lockowner lockowner; 72 struct nfs_lockowner lockowner;
73 struct nfs_io_counter io_count;
67}; 74};
68 75
69struct nfs4_state; 76struct nfs4_state;
@@ -77,6 +84,7 @@ struct nfs_open_context {
77 unsigned long flags; 84 unsigned long flags;
78#define NFS_CONTEXT_ERROR_WRITE (0) 85#define NFS_CONTEXT_ERROR_WRITE (0)
79#define NFS_CONTEXT_RESEND_WRITES (1) 86#define NFS_CONTEXT_RESEND_WRITES (1)
87#define NFS_CONTEXT_BAD (2)
80 int error; 88 int error;
81 89
82 struct list_head list; 90 struct list_head list;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 6c6ed153a9b4..3b7fa2abecca 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -40,6 +40,7 @@ struct nfs_client {
40#define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */ 40#define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */
41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ 41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
42#define NFS_CS_MIGRATION 2 /* - transparent state migr */ 42#define NFS_CS_MIGRATION 2 /* - transparent state migr */
43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */
43 struct sockaddr_storage cl_addr; /* server identifier */ 44 struct sockaddr_storage cl_addr; /* server identifier */
44 size_t cl_addrlen; 45 size_t cl_addrlen;
45 char * cl_hostname; /* hostname of server */ 46 char * cl_hostname; /* hostname of server */
@@ -197,5 +198,7 @@ struct nfs_server {
197#define NFS_CAP_MTIME (1U << 13) 198#define NFS_CAP_MTIME (1U << 13)
198#define NFS_CAP_POSIX_LOCK (1U << 14) 199#define NFS_CAP_POSIX_LOCK (1U << 14)
199#define NFS_CAP_UIDGID_NOMAP (1U << 15) 200#define NFS_CAP_UIDGID_NOMAP (1U << 15)
201#define NFS_CAP_STATEID_NFSV41 (1U << 16)
202#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
200 203
201#endif 204#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 4b993d358dad..104b62f23ee0 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -14,9 +14,6 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 15#define NFS_MIN_FILE_IO_SIZE (1024U)
16 16
17/* Forward declaration for NFS v3 */
18struct nfs4_secinfo_flavors;
19
20struct nfs4_string { 17struct nfs4_string {
21 unsigned int len; 18 unsigned int len;
22 char *data; 19 char *data;
@@ -349,6 +346,7 @@ struct nfs_openargs {
349 const u32 * bitmask; 346 const u32 * bitmask;
350 const u32 * open_bitmap; 347 const u32 * open_bitmap;
351 __u32 claim; 348 __u32 claim;
349 enum createmode4 createmode;
352}; 350};
353 351
354struct nfs_openres { 352struct nfs_openres {
@@ -486,6 +484,7 @@ struct nfs_readargs {
486 struct nfs_fh * fh; 484 struct nfs_fh * fh;
487 struct nfs_open_context *context; 485 struct nfs_open_context *context;
488 struct nfs_lock_context *lock_context; 486 struct nfs_lock_context *lock_context;
487 nfs4_stateid stateid;
489 __u64 offset; 488 __u64 offset;
490 __u32 count; 489 __u32 count;
491 unsigned int pgbase; 490 unsigned int pgbase;
@@ -507,6 +506,7 @@ struct nfs_writeargs {
507 struct nfs_fh * fh; 506 struct nfs_fh * fh;
508 struct nfs_open_context *context; 507 struct nfs_open_context *context;
509 struct nfs_lock_context *lock_context; 508 struct nfs_lock_context *lock_context;
509 nfs4_stateid stateid;
510 __u64 offset; 510 __u64 offset;
511 __u32 count; 511 __u32 count;
512 enum nfs3_stable_how stable; 512 enum nfs3_stable_how stable;
@@ -1050,25 +1050,14 @@ struct nfs4_fs_locations_res {
1050 struct nfs4_fs_locations *fs_locations; 1050 struct nfs4_fs_locations *fs_locations;
1051}; 1051};
1052 1052
1053struct nfs4_secinfo_oid { 1053struct nfs4_secinfo4 {
1054 unsigned int len; 1054 u32 flavor;
1055 char data[GSS_OID_MAX_LEN]; 1055 struct rpcsec_gss_info flavor_info;
1056};
1057
1058struct nfs4_secinfo_gss {
1059 struct nfs4_secinfo_oid sec_oid4;
1060 unsigned int qop4;
1061 unsigned int service;
1062};
1063
1064struct nfs4_secinfo_flavor {
1065 unsigned int flavor;
1066 struct nfs4_secinfo_gss gss;
1067}; 1056};
1068 1057
1069struct nfs4_secinfo_flavors { 1058struct nfs4_secinfo_flavors {
1070 unsigned int num_flavors; 1059 unsigned int num_flavors;
1071 struct nfs4_secinfo_flavor flavors[0]; 1060 struct nfs4_secinfo4 flavors[0];
1072}; 1061};
1073 1062
1074struct nfs4_secinfo_arg { 1063struct nfs4_secinfo_arg {
@@ -1187,7 +1176,7 @@ struct nfs41_test_stateid_res {
1187 1176
1188struct nfs41_free_stateid_args { 1177struct nfs41_free_stateid_args {
1189 struct nfs4_sequence_args seq_args; 1178 struct nfs4_sequence_args seq_args;
1190 nfs4_stateid *stateid; 1179 nfs4_stateid stateid;
1191}; 1180};
1192 1181
1193struct nfs41_free_stateid_res { 1182struct nfs41_free_stateid_res {
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index d65746efc954..d14a4c362465 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -47,8 +47,11 @@
47 * runtime initialization. 47 * runtime initialization.
48 */ 48 */
49 49
50typedef int (*notifier_fn_t)(struct notifier_block *nb,
51 unsigned long action, void *data);
52
50struct notifier_block { 53struct notifier_block {
51 int (*notifier_call)(struct notifier_block *, unsigned long, void *); 54 notifier_fn_t notifier_call;
52 struct notifier_block __rcu *next; 55 struct notifier_block __rcu *next;
53 int priority; 56 int priority;
54}; 57};
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index a8696bbdfbc4..6165b2c62040 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -80,10 +80,13 @@ extern struct nubus_board* nubus_boards;
80 80
81/* Generic NuBus interface functions, modelled after the PCI interface */ 81/* Generic NuBus interface functions, modelled after the PCI interface */
82void nubus_scan_bus(void); 82void nubus_scan_bus(void);
83#ifdef CONFIG_PROC_FS
83extern void nubus_proc_init(void); 84extern void nubus_proc_init(void);
85#else
86static inline void nubus_proc_init(void) {}
87#endif
84int get_nubus_list(char *buf); 88int get_nubus_list(char *buf);
85int nubus_proc_attach_device(struct nubus_dev *dev); 89int nubus_proc_attach_device(struct nubus_dev *dev);
86int nubus_proc_detach_device(struct nubus_dev *dev);
87/* If we need more precision we can add some more of these */ 90/* If we need more precision we can add some more of these */
88struct nubus_dev* nubus_find_device(unsigned short category, 91struct nubus_dev* nubus_find_device(unsigned short category,
89 unsigned short type, 92 unsigned short type,
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 4fa3b0b9b071..f451c8d6e231 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -107,6 +107,12 @@ struct nvme_id_ctrl {
107 __u8 vs[1024]; 107 __u8 vs[1024];
108}; 108};
109 109
110enum {
111 NVME_CTRL_ONCS_COMPARE = 1 << 0,
112 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
113 NVME_CTRL_ONCS_DSM = 1 << 2,
114};
115
110struct nvme_lbaf { 116struct nvme_lbaf {
111 __le16 ms; 117 __le16 ms;
112 __u8 ds; 118 __u8 ds;
@@ -201,11 +207,11 @@ struct nvme_common_command {
201 __u8 flags; 207 __u8 flags;
202 __u16 command_id; 208 __u16 command_id;
203 __le32 nsid; 209 __le32 nsid;
204 __u32 cdw2[2]; 210 __le32 cdw2[2];
205 __le64 metadata; 211 __le64 metadata;
206 __le64 prp1; 212 __le64 prp1;
207 __le64 prp2; 213 __le64 prp2;
208 __u32 cdw10[6]; 214 __le32 cdw10[6];
209}; 215};
210 216
211struct nvme_rw_command { 217struct nvme_rw_command {
@@ -246,6 +252,31 @@ enum {
246 NVME_RW_DSM_COMPRESSED = 1 << 7, 252 NVME_RW_DSM_COMPRESSED = 1 << 7,
247}; 253};
248 254
255struct nvme_dsm_cmd {
256 __u8 opcode;
257 __u8 flags;
258 __u16 command_id;
259 __le32 nsid;
260 __u64 rsvd2[2];
261 __le64 prp1;
262 __le64 prp2;
263 __le32 nr;
264 __le32 attributes;
265 __u32 rsvd12[4];
266};
267
268enum {
269 NVME_DSMGMT_IDR = 1 << 0,
270 NVME_DSMGMT_IDW = 1 << 1,
271 NVME_DSMGMT_AD = 1 << 2,
272};
273
274struct nvme_dsm_range {
275 __le32 cattr;
276 __le32 nlb;
277 __le64 slba;
278};
279
249/* Admin commands */ 280/* Admin commands */
250 281
251enum nvme_admin_opcode { 282enum nvme_admin_opcode {
@@ -285,6 +316,9 @@ enum {
285 NVME_FEAT_WRITE_ATOMIC = 0x0a, 316 NVME_FEAT_WRITE_ATOMIC = 0x0a,
286 NVME_FEAT_ASYNC_EVENT = 0x0b, 317 NVME_FEAT_ASYNC_EVENT = 0x0b,
287 NVME_FEAT_SW_PROGRESS = 0x0c, 318 NVME_FEAT_SW_PROGRESS = 0x0c,
319 NVME_FWACT_REPL = (0 << 3),
320 NVME_FWACT_REPL_ACTV = (1 << 3),
321 NVME_FWACT_ACTV = (2 << 3),
288}; 322};
289 323
290struct nvme_identify { 324struct nvme_identify {
@@ -362,6 +396,16 @@ struct nvme_download_firmware {
362 __u32 rsvd12[4]; 396 __u32 rsvd12[4];
363}; 397};
364 398
399struct nvme_format_cmd {
400 __u8 opcode;
401 __u8 flags;
402 __u16 command_id;
403 __le32 nsid;
404 __u64 rsvd2[4];
405 __le32 cdw10;
406 __u32 rsvd11[5];
407};
408
365struct nvme_command { 409struct nvme_command {
366 union { 410 union {
367 struct nvme_common_command common; 411 struct nvme_common_command common;
@@ -372,6 +416,8 @@ struct nvme_command {
372 struct nvme_create_sq create_sq; 416 struct nvme_create_sq create_sq;
373 struct nvme_delete_queue delete_queue; 417 struct nvme_delete_queue delete_queue;
374 struct nvme_download_firmware dlfw; 418 struct nvme_download_firmware dlfw;
419 struct nvme_format_cmd format;
420 struct nvme_dsm_cmd dsm;
375 }; 421 };
376}; 422};
377 423
@@ -388,6 +434,7 @@ enum {
388 NVME_SC_FUSED_FAIL = 0x9, 434 NVME_SC_FUSED_FAIL = 0x9,
389 NVME_SC_FUSED_MISSING = 0xa, 435 NVME_SC_FUSED_MISSING = 0xa,
390 NVME_SC_INVALID_NS = 0xb, 436 NVME_SC_INVALID_NS = 0xb,
437 NVME_SC_CMD_SEQ_ERROR = 0xc,
391 NVME_SC_LBA_RANGE = 0x80, 438 NVME_SC_LBA_RANGE = 0x80,
392 NVME_SC_CAP_EXCEEDED = 0x81, 439 NVME_SC_CAP_EXCEEDED = 0x81,
393 NVME_SC_NS_NOT_READY = 0x82, 440 NVME_SC_NS_NOT_READY = 0x82,
@@ -461,4 +508,111 @@ struct nvme_admin_cmd {
461#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) 508#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
462#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) 509#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
463 510
511#ifdef __KERNEL__
512#include <linux/pci.h>
513#include <linux/miscdevice.h>
514#include <linux/kref.h>
515
516#define NVME_IO_TIMEOUT (5 * HZ)
517
518/*
519 * Represents an NVM Express device. Each nvme_dev is a PCI function.
520 */
521struct nvme_dev {
522 struct list_head node;
523 struct nvme_queue **queues;
524 u32 __iomem *dbs;
525 struct pci_dev *pci_dev;
526 struct dma_pool *prp_page_pool;
527 struct dma_pool *prp_small_pool;
528 int instance;
529 int queue_count;
530 int db_stride;
531 u32 ctrl_config;
532 struct msix_entry *entry;
533 struct nvme_bar __iomem *bar;
534 struct list_head namespaces;
535 struct kref kref;
536 struct miscdevice miscdev;
537 char name[12];
538 char serial[20];
539 char model[40];
540 char firmware_rev[8];
541 u32 max_hw_sectors;
542 u32 stripe_size;
543 u16 oncs;
544};
545
546/*
547 * An NVM Express namespace is equivalent to a SCSI LUN
548 */
549struct nvme_ns {
550 struct list_head list;
551
552 struct nvme_dev *dev;
553 struct request_queue *queue;
554 struct gendisk *disk;
555
556 int ns_id;
557 int lba_shift;
558 int ms;
559 u64 mode_select_num_blocks;
560 u32 mode_select_block_len;
561};
562
563/*
564 * The nvme_iod describes the data in an I/O, including the list of PRP
565 * entries. You can't see it in this data structure because C doesn't let
566 * me express that. Use nvme_alloc_iod to ensure there's enough space
567 * allocated to store the PRP list.
568 */
569struct nvme_iod {
570 void *private; /* For the use of the submitter of the I/O */
571 int npages; /* In the PRP list. 0 means small pool in use */
572 int offset; /* Of PRP list */
573 int nents; /* Used in scatterlist */
574 int length; /* Of data, in bytes */
575 dma_addr_t first_dma;
576 struct scatterlist sg[0];
577};
578
579static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector)
580{
581 return (sector >> (ns->lba_shift - 9));
582}
583
584/**
585 * nvme_free_iod - frees an nvme_iod
586 * @dev: The device that the I/O was submitted to
587 * @iod: The memory to free
588 */
589void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod);
590
591int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd,
592 struct nvme_iod *iod, int total_len, gfp_t gfp);
593struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
594 unsigned long addr, unsigned length);
595void nvme_unmap_user_pages(struct nvme_dev *dev, int write,
596 struct nvme_iod *iod);
597struct nvme_queue *get_nvmeq(struct nvme_dev *dev);
598void put_nvmeq(struct nvme_queue *nvmeq);
599int nvme_submit_sync_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,
600 u32 *result, unsigned timeout);
601int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns);
602int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *,
603 u32 *result);
604int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns,
605 dma_addr_t dma_addr);
606int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid,
607 dma_addr_t dma_addr, u32 *result);
608int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11,
609 dma_addr_t dma_addr, u32 *result);
610
611struct sg_io_hdr;
612
613int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr);
614int nvme_sg_get_version_num(int __user *ip);
615
616#endif
617
464#endif /* _LINUX_NVME_H */ 618#endif /* _LINUX_NVME_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index a0f129284948..1fd08ca23106 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -235,6 +235,9 @@ extern struct device_node *of_find_node_with_property(
235extern struct property *of_find_property(const struct device_node *np, 235extern struct property *of_find_property(const struct device_node *np,
236 const char *name, 236 const char *name,
237 int *lenp); 237 int *lenp);
238extern int of_property_read_u32_index(const struct device_node *np,
239 const char *propname,
240 u32 index, u32 *out_value);
238extern int of_property_read_u8_array(const struct device_node *np, 241extern int of_property_read_u8_array(const struct device_node *np,
239 const char *propname, u8 *out_values, size_t sz); 242 const char *propname, u8 *out_values, size_t sz);
240extern int of_property_read_u16_array(const struct device_node *np, 243extern int of_property_read_u16_array(const struct device_node *np,
@@ -353,6 +356,11 @@ static inline struct device_node *of_find_node_by_name(struct device_node *from,
353 return NULL; 356 return NULL;
354} 357}
355 358
359static inline struct device_node *of_get_parent(const struct device_node *node)
360{
361 return NULL;
362}
363
356static inline bool of_have_populated_dt(void) 364static inline bool of_have_populated_dt(void)
357{ 365{
358 return false; 366 return false;
@@ -379,6 +387,11 @@ static inline int of_device_is_compatible(const struct device_node *device,
379 return 0; 387 return 0;
380} 388}
381 389
390static inline int of_device_is_available(const struct device_node *device)
391{
392 return 0;
393}
394
382static inline struct property *of_find_property(const struct device_node *np, 395static inline struct property *of_find_property(const struct device_node *np,
383 const char *name, 396 const char *name,
384 int *lenp) 397 int *lenp)
@@ -394,6 +407,12 @@ static inline struct device_node *of_find_compatible_node(
394 return NULL; 407 return NULL;
395} 408}
396 409
410static inline int of_property_read_u32_index(const struct device_node *np,
411 const char *propname, u32 index, u32 *out_value)
412{
413 return -ENOSYS;
414}
415
397static inline int of_property_read_u8_array(const struct device_node *np, 416static inline int of_property_read_u8_array(const struct device_node *np,
398 const char *propname, u8 *out_values, size_t sz) 417 const char *propname, u8 *out_values, size_t sz)
399{ 418{
@@ -540,4 +559,14 @@ static inline int of_property_read_u32(const struct device_node *np,
540 return of_property_read_u32_array(np, propname, out_value, 1); 559 return of_property_read_u32_array(np, propname, out_value, 1);
541} 560}
542 561
562#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
563extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
564extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
565extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
566 struct property *prop);
567extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
568 struct property *newprop,
569 struct property *oldprop);
570#endif
571
543#endif /* _LINUX_OF_H */ 572#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index d15073e080dd..364dda734877 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -25,7 +25,6 @@ struct of_dma {
25 struct dma_chan *(*of_dma_xlate) 25 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *); 26 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data; 27 void *of_dma_data;
28 int use_count;
29}; 28};
30 29
31struct of_dma_filter_info { 30struct of_dma_filter_info {
@@ -38,9 +37,9 @@ extern int of_dma_controller_register(struct device_node *np,
38 struct dma_chan *(*of_dma_xlate) 37 struct dma_chan *(*of_dma_xlate)
39 (struct of_phandle_args *, struct of_dma *), 38 (struct of_phandle_args *, struct of_dma *),
40 void *data); 39 void *data);
41extern int of_dma_controller_free(struct device_node *np); 40extern void of_dma_controller_free(struct device_node *np);
42extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np, 41extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
43 char *name); 42 const char *name);
44extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, 43extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
45 struct of_dma *ofdma); 44 struct of_dma *ofdma);
46#else 45#else
@@ -52,13 +51,12 @@ static inline int of_dma_controller_register(struct device_node *np,
52 return -ENODEV; 51 return -ENODEV;
53} 52}
54 53
55static inline int of_dma_controller_free(struct device_node *np) 54static inline void of_dma_controller_free(struct device_node *np)
56{ 55{
57 return -ENODEV;
58} 56}
59 57
60static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np, 58static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
61 char *name) 59 const char *name)
62{ 60{
63 return NULL; 61 return NULL;
64} 62}
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index f47464188710..61bf53b02779 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -11,6 +11,16 @@
11#include <linux/of.h> 11#include <linux/of.h>
12extern const int of_get_phy_mode(struct device_node *np); 12extern const int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 13extern const void *of_get_mac_address(struct device_node *np);
14#else
15static inline const int of_get_phy_mode(struct device_node *np)
16{
17 return -ENODEV;
18}
19
20static inline const void *of_get_mac_address(struct device_node *np)
21{
22 return NULL;
23}
14#endif 24#endif
15 25
16#endif /* __LINUX_OF_NET_H */ 26#endif /* __LINUX_OF_NET_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 3863a4dbdf18..2a93b64a3869 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -11,9 +11,10 @@
11 * 11 *
12 */ 12 */
13 13
14#ifdef CONFIG_OF_DEVICE
15#include <linux/device.h> 14#include <linux/device.h>
16#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16
17#ifdef CONFIG_OF_DEVICE
17#include <linux/pm.h> 18#include <linux/pm.h>
18#include <linux/of_device.h> 19#include <linux/of_device.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
@@ -100,7 +101,7 @@ extern int of_platform_populate(struct device_node *root,
100 101
101#if !defined(CONFIG_OF_ADDRESS) 102#if !defined(CONFIG_OF_ADDRESS)
102struct of_dev_auxdata; 103struct of_dev_auxdata;
103struct device; 104struct device_node;
104static inline int of_platform_populate(struct device_node *root, 105static inline int of_platform_populate(struct device_node *root,
105 const struct of_device_id *matches, 106 const struct of_device_id *matches,
106 const struct of_dev_auxdata *lookup, 107 const struct of_dev_auxdata *lookup,
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index d42e174bd0c8..e6b240b6196c 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -19,435 +19,6 @@
19#ifndef _LINUX_OPENVSWITCH_H 19#ifndef _LINUX_OPENVSWITCH_H
20#define _LINUX_OPENVSWITCH_H 1 20#define _LINUX_OPENVSWITCH_H 1
21 21
22#include <linux/types.h> 22#include <uapi/linux/openvswitch.h>
23
24/**
25 * struct ovs_header - header for OVS Generic Netlink messages.
26 * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
27 * specific to a datapath).
28 *
29 * Attributes following the header are specific to a particular OVS Generic
30 * Netlink family, but all of the OVS families use this header.
31 */
32
33struct ovs_header {
34 int dp_ifindex;
35};
36
37/* Datapaths. */
38
39#define OVS_DATAPATH_FAMILY "ovs_datapath"
40#define OVS_DATAPATH_MCGROUP "ovs_datapath"
41#define OVS_DATAPATH_VERSION 0x1
42
43enum ovs_datapath_cmd {
44 OVS_DP_CMD_UNSPEC,
45 OVS_DP_CMD_NEW,
46 OVS_DP_CMD_DEL,
47 OVS_DP_CMD_GET,
48 OVS_DP_CMD_SET
49};
50
51/**
52 * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
53 * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
54 * port". This is the name of the network device whose dp_ifindex is given in
55 * the &struct ovs_header. Always present in notifications. Required in
56 * %OVS_DP_NEW requests. May be used as an alternative to specifying
57 * dp_ifindex in other requests (with a dp_ifindex of 0).
58 * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
59 * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
60 * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
61 * not be sent.
62 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
63 * datapath. Always present in notifications.
64 *
65 * These attributes follow the &struct ovs_header within the Generic Netlink
66 * payload for %OVS_DP_* commands.
67 */
68enum ovs_datapath_attr {
69 OVS_DP_ATTR_UNSPEC,
70 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
71 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
72 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
73 __OVS_DP_ATTR_MAX
74};
75
76#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
77
78struct ovs_dp_stats {
79 __u64 n_hit; /* Number of flow table matches. */
80 __u64 n_missed; /* Number of flow table misses. */
81 __u64 n_lost; /* Number of misses not sent to userspace. */
82 __u64 n_flows; /* Number of flows present */
83};
84
85struct ovs_vport_stats {
86 __u64 rx_packets; /* total packets received */
87 __u64 tx_packets; /* total packets transmitted */
88 __u64 rx_bytes; /* total bytes received */
89 __u64 tx_bytes; /* total bytes transmitted */
90 __u64 rx_errors; /* bad packets received */
91 __u64 tx_errors; /* packet transmit problems */
92 __u64 rx_dropped; /* no space in linux buffers */
93 __u64 tx_dropped; /* no space available in linux */
94};
95
96/* Fixed logical ports. */
97#define OVSP_LOCAL ((__u16)0)
98
99/* Packet transfer. */
100
101#define OVS_PACKET_FAMILY "ovs_packet"
102#define OVS_PACKET_VERSION 0x1
103
104enum ovs_packet_cmd {
105 OVS_PACKET_CMD_UNSPEC,
106
107 /* Kernel-to-user notifications. */
108 OVS_PACKET_CMD_MISS, /* Flow table miss. */
109 OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
110
111 /* Userspace commands. */
112 OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
113};
114
115/**
116 * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
117 * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
118 * packet as received, from the start of the Ethernet header onward. For
119 * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
120 * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
121 * the flow key extracted from the packet as originally received.
122 * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
123 * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
124 * userspace to adapt its flow setup strategy by comparing its notion of the
125 * flow key against the kernel's.
126 * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
127 * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
128 * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
129 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
130 * %OVS_USERSPACE_ATTR_USERDATA attribute.
131 *
132 * These attributes follow the &struct ovs_header within the Generic Netlink
133 * payload for %OVS_PACKET_* commands.
134 */
135enum ovs_packet_attr {
136 OVS_PACKET_ATTR_UNSPEC,
137 OVS_PACKET_ATTR_PACKET, /* Packet data. */
138 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
139 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
140 OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
141 __OVS_PACKET_ATTR_MAX
142};
143
144#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
145
146/* Virtual ports. */
147
148#define OVS_VPORT_FAMILY "ovs_vport"
149#define OVS_VPORT_MCGROUP "ovs_vport"
150#define OVS_VPORT_VERSION 0x1
151
152enum ovs_vport_cmd {
153 OVS_VPORT_CMD_UNSPEC,
154 OVS_VPORT_CMD_NEW,
155 OVS_VPORT_CMD_DEL,
156 OVS_VPORT_CMD_GET,
157 OVS_VPORT_CMD_SET
158};
159
160enum ovs_vport_type {
161 OVS_VPORT_TYPE_UNSPEC,
162 OVS_VPORT_TYPE_NETDEV, /* network device */
163 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
164 __OVS_VPORT_TYPE_MAX
165};
166
167#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
168
169/**
170 * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
171 * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
172 * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
173 * of vport.
174 * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
175 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
176 * plus a null terminator.
177 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
178 * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
179 * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
180 * this port. A value of zero indicates that upcalls should not be sent.
181 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
182 * packets sent or received through the vport.
183 *
184 * These attributes follow the &struct ovs_header within the Generic Netlink
185 * payload for %OVS_VPORT_* commands.
186 *
187 * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
188 * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
189 * optional; if not specified a free port number is automatically selected.
190 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
191 * of vport.
192 * and other attributes are ignored.
193 *
194 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
195 * look up the vport to operate on; otherwise dp_idx from the &struct
196 * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
197 */
198enum ovs_vport_attr {
199 OVS_VPORT_ATTR_UNSPEC,
200 OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
201 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
202 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
203 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
204 OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
205 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
206 __OVS_VPORT_ATTR_MAX
207};
208
209#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
210
211/* Flows. */
212
213#define OVS_FLOW_FAMILY "ovs_flow"
214#define OVS_FLOW_MCGROUP "ovs_flow"
215#define OVS_FLOW_VERSION 0x1
216
217enum ovs_flow_cmd {
218 OVS_FLOW_CMD_UNSPEC,
219 OVS_FLOW_CMD_NEW,
220 OVS_FLOW_CMD_DEL,
221 OVS_FLOW_CMD_GET,
222 OVS_FLOW_CMD_SET
223};
224
225struct ovs_flow_stats {
226 __u64 n_packets; /* Number of matched packets. */
227 __u64 n_bytes; /* Number of matched bytes. */
228};
229
230enum ovs_key_attr {
231 OVS_KEY_ATTR_UNSPEC,
232 OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
233 OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
234 OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
235 OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
236 OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
237 OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
238 OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
239 OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
240 OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
241 OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
242 OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
246 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
247 __OVS_KEY_ATTR_MAX
248};
249
250#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
251
252/**
253 * enum ovs_frag_type - IPv4 and IPv6 fragment type
254 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
255 * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
256 * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
257 *
258 * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
259 * ovs_key_ipv6.
260 */
261enum ovs_frag_type {
262 OVS_FRAG_TYPE_NONE,
263 OVS_FRAG_TYPE_FIRST,
264 OVS_FRAG_TYPE_LATER,
265 __OVS_FRAG_TYPE_MAX
266};
267
268#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
269
270struct ovs_key_ethernet {
271 __u8 eth_src[6];
272 __u8 eth_dst[6];
273};
274
275struct ovs_key_ipv4 {
276 __be32 ipv4_src;
277 __be32 ipv4_dst;
278 __u8 ipv4_proto;
279 __u8 ipv4_tos;
280 __u8 ipv4_ttl;
281 __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
282};
283
284struct ovs_key_ipv6 {
285 __be32 ipv6_src[4];
286 __be32 ipv6_dst[4];
287 __be32 ipv6_label; /* 20-bits in least-significant bits. */
288 __u8 ipv6_proto;
289 __u8 ipv6_tclass;
290 __u8 ipv6_hlimit;
291 __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
292};
293
294struct ovs_key_tcp {
295 __be16 tcp_src;
296 __be16 tcp_dst;
297};
298
299struct ovs_key_udp {
300 __be16 udp_src;
301 __be16 udp_dst;
302};
303
304struct ovs_key_icmp {
305 __u8 icmp_type;
306 __u8 icmp_code;
307};
308
309struct ovs_key_icmpv6 {
310 __u8 icmpv6_type;
311 __u8 icmpv6_code;
312};
313
314struct ovs_key_arp {
315 __be32 arp_sip;
316 __be32 arp_tip;
317 __be16 arp_op;
318 __u8 arp_sha[6];
319 __u8 arp_tha[6];
320};
321
322struct ovs_key_nd {
323 __u32 nd_target[4];
324 __u8 nd_sll[6];
325 __u8 nd_tll[6];
326};
327
328/**
329 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
330 * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
331 * key. Always present in notifications. Required for all requests (except
332 * dumps).
333 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
334 * the actions to take for packets that match the key. Always present in
335 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
336 * %OVS_FLOW_CMD_SET requests.
337 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
338 * flow. Present in notifications if the stats would be nonzero. Ignored in
339 * requests.
340 * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
341 * TCP flags seen on packets in this flow. Only present in notifications for
342 * TCP flows, and only if it would be nonzero. Ignored in requests.
343 * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
344 * the system monotonic clock, at which a packet was last processed for this
345 * flow. Only present in notifications if a packet has been processed for this
346 * flow. Ignored in requests.
347 * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
348 * last-used time, accumulated TCP flags, and statistics for this flow.
349 * Otherwise ignored in requests. Never present in notifications.
350 *
351 * These attributes follow the &struct ovs_header within the Generic Netlink
352 * payload for %OVS_FLOW_* commands.
353 */
354enum ovs_flow_attr {
355 OVS_FLOW_ATTR_UNSPEC,
356 OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
357 OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
358 OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
359 OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
360 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
361 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
362 __OVS_FLOW_ATTR_MAX
363};
364
365#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
366
367/**
368 * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
369 * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
370 * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
371 * %UINT32_MAX samples all packets and intermediate values sample intermediate
372 * fractions of packets.
373 * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
374 * Actions are passed as nested attributes.
375 *
376 * Executes the specified actions with the given probability on a per-packet
377 * basis.
378 */
379enum ovs_sample_attr {
380 OVS_SAMPLE_ATTR_UNSPEC,
381 OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
382 OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
383 __OVS_SAMPLE_ATTR_MAX,
384};
385
386#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
387
388/**
389 * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
390 * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
391 * message should be sent. Required.
392 * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the
393 * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA,
394 */
395enum ovs_userspace_attr {
396 OVS_USERSPACE_ATTR_UNSPEC,
397 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
398 OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */
399 __OVS_USERSPACE_ATTR_MAX
400};
401
402#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
403
404/**
405 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
406 * @vlan_tpid: Tag protocol identifier (TPID) to push.
407 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
408 * (but it will not be set in the 802.1Q header that is pushed).
409 *
410 * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID
411 * values are those that the kernel module also parses as 802.1Q headers, to
412 * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN
413 * from having surprising results.
414 */
415struct ovs_action_push_vlan {
416 __be16 vlan_tpid; /* 802.1Q TPID. */
417 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
418};
419
420/**
421 * enum ovs_action_attr - Action types.
422 *
423 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
424 * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
425 * %OVS_USERSPACE_ATTR_* attributes.
426 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
427 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
428 * value.
429 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
430 * packet.
431 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
432 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
433 * the nested %OVS_SAMPLE_ATTR_* attributes.
434 *
435 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
436 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
437 * type may not be changed.
438 */
439
440enum ovs_action_attr {
441 OVS_ACTION_ATTR_UNSPEC,
442 OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
443 OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
444 OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
445 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
446 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
447 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
448 __OVS_ACTION_ATTR_MAX
449};
450
451#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
452 23
453#endif /* _LINUX_OPENVSWITCH_H */ 24#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0e38e13eb249..e3dea75a078b 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -149,7 +149,7 @@ static inline int page_cache_get_speculative(struct page *page)
149{ 149{
150 VM_BUG_ON(in_interrupt()); 150 VM_BUG_ON(in_interrupt());
151 151
152#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) 152#ifdef CONFIG_TINY_RCU
153# ifdef CONFIG_PREEMPT_COUNT 153# ifdef CONFIG_PREEMPT_COUNT
154 VM_BUG_ON(!in_atomic()); 154 VM_BUG_ON(!in_atomic());
155# endif 155# endif
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h
index a7b4fc386e63..3cc21c9cc1e8 100644
--- a/include/linux/pata_arasan_cf_data.h
+++ b/include/linux/pata_arasan_cf_data.h
@@ -37,8 +37,6 @@ struct arasan_cf_pdata {
37 #define CF_BROKEN_PIO (1) 37 #define CF_BROKEN_PIO (1)
38 #define CF_BROKEN_MWDMA (1 << 1) 38 #define CF_BROKEN_MWDMA (1 << 1)
39 #define CF_BROKEN_UDMA (1 << 2) 39 #define CF_BROKEN_UDMA (1 << 2)
40 /* This is platform specific data for the DMA controller */
41 void *dma_priv;
42}; 40};
43 41
44static inline void 42static inline void
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 9a22b5efb384..170447977278 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -41,8 +41,39 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
41 41
42 return DEVICE_ACPI_HANDLE(dev); 42 return DEVICE_ACPI_HANDLE(dev);
43} 43}
44
45void acpi_pci_add_bus(struct pci_bus *bus);
46void acpi_pci_remove_bus(struct pci_bus *bus);
47
48#ifdef CONFIG_ACPI_PCI_SLOT
49void acpi_pci_slot_init(void);
50void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle);
51void acpi_pci_slot_remove(struct pci_bus *bus);
52#else
53static inline void acpi_pci_slot_init(void) { }
54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus,
55 acpi_handle handle) { }
56static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
44#endif 57#endif
45 58
59#ifdef CONFIG_HOTPLUG_PCI_ACPI
60void acpiphp_init(void);
61void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle);
62void acpiphp_remove_slots(struct pci_bus *bus);
63void acpiphp_check_host_bridge(acpi_handle handle);
64#else
65static inline void acpiphp_init(void) { }
66static inline void acpiphp_enumerate_slots(struct pci_bus *bus,
67 acpi_handle handle) { }
68static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
69static inline void acpiphp_check_host_bridge(acpi_handle handle) { }
70#endif
71
72#else /* CONFIG_ACPI */
73static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
74static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
75#endif /* CONFIG_ACPI */
76
46#ifdef CONFIG_ACPI_APEI 77#ifdef CONFIG_ACPI_APEI
47extern bool aer_acpi_firmware_first(void); 78extern bool aer_acpi_firmware_first(void);
48#else 79#else
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index c8320144fe79..8af4610c2e41 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -23,14 +23,14 @@
23#define PCIE_LINK_STATE_CLKPM 4 23#define PCIE_LINK_STATE_CLKPM 4
24 24
25#ifdef CONFIG_PCIEASPM 25#ifdef CONFIG_PCIEASPM
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev); 26void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32extern void pcie_clear_aspm(struct pci_bus *bus); 32void pcie_clear_aspm(struct pci_bus *bus);
33extern void pcie_no_aspm(void); 33void pcie_no_aspm(void);
34#else 34#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
36{ 36{
@@ -56,8 +56,8 @@ static inline void pcie_no_aspm(void)
56#endif 56#endif
57 57
58#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ 58#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
59extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); 59void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
60extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); 60void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
61#else 61#else
62static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) 62static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
63{ 63{
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 7ef68724f0f0..68bcefd7fca0 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -14,9 +14,9 @@ struct pci_ats {
14 14
15#ifdef CONFIG_PCI_ATS 15#ifdef CONFIG_PCI_ATS
16 16
17extern int pci_enable_ats(struct pci_dev *dev, int ps); 17int pci_enable_ats(struct pci_dev *dev, int ps);
18extern void pci_disable_ats(struct pci_dev *dev); 18void pci_disable_ats(struct pci_dev *dev);
19extern int pci_ats_queue_depth(struct pci_dev *dev); 19int pci_ats_queue_depth(struct pci_dev *dev);
20 20
21/** 21/**
22 * pci_ats_enabled - query the ATS status 22 * pci_ats_enabled - query the ATS status
@@ -54,12 +54,12 @@ static inline int pci_ats_enabled(struct pci_dev *dev)
54 54
55#ifdef CONFIG_PCI_PRI 55#ifdef CONFIG_PCI_PRI
56 56
57extern int pci_enable_pri(struct pci_dev *pdev, u32 reqs); 57int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
58extern void pci_disable_pri(struct pci_dev *pdev); 58void pci_disable_pri(struct pci_dev *pdev);
59extern bool pci_pri_enabled(struct pci_dev *pdev); 59bool pci_pri_enabled(struct pci_dev *pdev);
60extern int pci_reset_pri(struct pci_dev *pdev); 60int pci_reset_pri(struct pci_dev *pdev);
61extern bool pci_pri_stopped(struct pci_dev *pdev); 61bool pci_pri_stopped(struct pci_dev *pdev);
62extern int pci_pri_status(struct pci_dev *pdev); 62int pci_pri_status(struct pci_dev *pdev);
63 63
64#else /* CONFIG_PCI_PRI */ 64#else /* CONFIG_PCI_PRI */
65 65
@@ -95,10 +95,10 @@ static inline int pci_pri_status(struct pci_dev *pdev)
95 95
96#ifdef CONFIG_PCI_PASID 96#ifdef CONFIG_PCI_PASID
97 97
98extern int pci_enable_pasid(struct pci_dev *pdev, int features); 98int pci_enable_pasid(struct pci_dev *pdev, int features);
99extern void pci_disable_pasid(struct pci_dev *pdev); 99void pci_disable_pasid(struct pci_dev *pdev);
100extern int pci_pasid_features(struct pci_dev *pdev); 100int pci_pasid_features(struct pci_dev *pdev);
101extern int pci_max_pasids(struct pci_dev *pdev); 101int pci_max_pasids(struct pci_dev *pdev);
102 102
103#else /* CONFIG_PCI_PASID */ 103#else /* CONFIG_PCI_PASID */
104 104
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 710067f3618c..3a24e4ff3248 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -35,6 +35,21 @@
35/* Include the ID list */ 35/* Include the ID list */
36#include <linux/pci_ids.h> 36#include <linux/pci_ids.h>
37 37
38/*
39 * The PCI interface treats multi-function devices as independent
40 * devices. The slot/function address of each device is encoded
41 * in a single byte as follows:
42 *
43 * 7:3 = slot
44 * 2:0 = function
45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined uapi/linux/pci.h
46 * In the interest of not exposing interfaces to user-space unnecessarily,
47 * the following kernel only defines are being added here.
48 */
49#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn)
50/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
51#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
52
38/* pci_slot represents a physical slot */ 53/* pci_slot represents a physical slot */
39struct pci_slot { 54struct pci_slot {
40 struct pci_bus *bus; /* The bus this slot is on */ 55 struct pci_bus *bus; /* The bus this slot is on */
@@ -232,6 +247,8 @@ struct pci_dev {
232 u8 revision; /* PCI revision, low byte of class word */ 247 u8 revision; /* PCI revision, low byte of class word */
233 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 248 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
234 u8 pcie_cap; /* PCI-E capability offset */ 249 u8 pcie_cap; /* PCI-E capability offset */
250 u8 msi_cap; /* MSI capability offset */
251 u8 msix_cap; /* MSI-X capability offset */
235 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ 252 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */
236 u8 rom_base_reg; /* which config register controls the ROM */ 253 u8 rom_base_reg; /* which config register controls the ROM */
237 u8 pin; /* which interrupt pin this device uses */ 254 u8 pin; /* which interrupt pin this device uses */
@@ -249,8 +266,7 @@ struct pci_dev {
249 pci_power_t current_state; /* Current operating state. In ACPI-speak, 266 pci_power_t current_state; /* Current operating state. In ACPI-speak,
250 this is D0-D3, D0 being fully functional, 267 this is D0-D3, D0 being fully functional,
251 and D3 being off. */ 268 and D3 being off. */
252 int pm_cap; /* PM capability offset in the 269 u8 pm_cap; /* PM capability offset */
253 configuration space */
254 unsigned int pme_support:5; /* Bitmask of states from which PME# 270 unsigned int pme_support:5; /* Bitmask of states from which PME#
255 can be generated */ 271 can be generated */
256 unsigned int pme_interrupt:1; 272 unsigned int pme_interrupt:1;
@@ -348,7 +364,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
348 return dev; 364 return dev;
349} 365}
350 366
351extern struct pci_dev *alloc_pci_dev(void); 367struct pci_dev *alloc_pci_dev(void);
352 368
353#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 369#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
354#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 370#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -504,10 +520,10 @@ struct pci_ops {
504 * ACPI needs to be able to access PCI config space before we've done a 520 * ACPI needs to be able to access PCI config space before we've done a
505 * PCI bus scan and created pci_bus structures. 521 * PCI bus scan and created pci_bus structures.
506 */ 522 */
507extern int raw_pci_read(unsigned int domain, unsigned int bus, 523int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
508 unsigned int devfn, int reg, int len, u32 *val); 524 int reg, int len, u32 *val);
509extern int raw_pci_write(unsigned int domain, unsigned int bus, 525int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
510 unsigned int devfn, int reg, int len, u32 val); 526 int reg, int len, u32 val);
511 527
512struct pci_bus_region { 528struct pci_bus_region {
513 resource_size_t start; 529 resource_size_t start;
@@ -658,7 +674,7 @@ struct pci_driver {
658/* these external functions are only available when PCI support is enabled */ 674/* these external functions are only available when PCI support is enabled */
659#ifdef CONFIG_PCI 675#ifdef CONFIG_PCI
660 676
661extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); 677void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);
662 678
663enum pcie_bus_config_types { 679enum pcie_bus_config_types {
664 PCIE_BUS_TUNE_OFF, 680 PCIE_BUS_TUNE_OFF,
@@ -675,9 +691,11 @@ extern struct bus_type pci_bus_type;
675 * code, or pci core code. */ 691 * code, or pci core code. */
676extern struct list_head pci_root_buses; /* list of all known PCI buses */ 692extern struct list_head pci_root_buses; /* list of all known PCI buses */
677/* Some device drivers need know if pci is initiated */ 693/* Some device drivers need know if pci is initiated */
678extern int no_pci_devices(void); 694int no_pci_devices(void);
679 695
680void pcibios_resource_survey_bus(struct pci_bus *bus); 696void pcibios_resource_survey_bus(struct pci_bus *bus);
697void pcibios_add_bus(struct pci_bus *bus);
698void pcibios_remove_bus(struct pci_bus *bus);
681void pcibios_fixup_bus(struct pci_bus *); 699void pcibios_fixup_bus(struct pci_bus *);
682int __must_check pcibios_enable_device(struct pci_dev *, int mask); 700int __must_check pcibios_enable_device(struct pci_dev *, int mask);
683/* Architecture specific versions may override this (weak) */ 701/* Architecture specific versions may override this (weak) */
@@ -699,7 +717,7 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
699void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 717void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
700 struct pci_bus_region *region); 718 struct pci_bus_region *region);
701void pcibios_scan_specific_bus(int busn); 719void pcibios_scan_specific_bus(int busn);
702extern struct pci_bus *pci_find_bus(int domain, int busnr); 720struct pci_bus *pci_find_bus(int domain, int busnr);
703void pci_bus_add_devices(const struct pci_bus *bus); 721void pci_bus_add_devices(const struct pci_bus *bus);
704struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 722struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
705 struct pci_ops *ops, void *sysdata); 723 struct pci_ops *ops, void *sysdata);
@@ -732,14 +750,14 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev,
732u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); 750u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin);
733int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 751int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
734u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); 752u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
735extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 753struct pci_dev *pci_dev_get(struct pci_dev *dev);
736extern void pci_dev_put(struct pci_dev *dev); 754void pci_dev_put(struct pci_dev *dev);
737extern void pci_remove_bus(struct pci_bus *b); 755void pci_remove_bus(struct pci_bus *b);
738extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); 756void pci_stop_and_remove_bus_device(struct pci_dev *dev);
739void pci_stop_root_bus(struct pci_bus *bus); 757void pci_stop_root_bus(struct pci_bus *bus);
740void pci_remove_root_bus(struct pci_bus *bus); 758void pci_remove_root_bus(struct pci_bus *bus);
741void pci_setup_cardbus(struct pci_bus *bus); 759void pci_setup_cardbus(struct pci_bus *bus);
742extern void pci_sort_breadthfirst(void); 760void pci_sort_breadthfirst(void);
743#define dev_is_pci(d) ((d)->bus == &pci_bus_type) 761#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
744#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) 762#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
745#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) 763#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0))
@@ -1142,18 +1160,17 @@ static inline int pci_msi_enabled(void)
1142 return 0; 1160 return 0;
1143} 1161}
1144#else 1162#else
1145extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); 1163int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
1146extern int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); 1164int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
1147extern void pci_msi_shutdown(struct pci_dev *dev); 1165void pci_msi_shutdown(struct pci_dev *dev);
1148extern void pci_disable_msi(struct pci_dev *dev); 1166void pci_disable_msi(struct pci_dev *dev);
1149extern int pci_msix_table_size(struct pci_dev *dev); 1167int pci_msix_table_size(struct pci_dev *dev);
1150extern int pci_enable_msix(struct pci_dev *dev, 1168int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1151 struct msix_entry *entries, int nvec); 1169void pci_msix_shutdown(struct pci_dev *dev);
1152extern void pci_msix_shutdown(struct pci_dev *dev); 1170void pci_disable_msix(struct pci_dev *dev);
1153extern void pci_disable_msix(struct pci_dev *dev); 1171void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1154extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 1172void pci_restore_msi_state(struct pci_dev *dev);
1155extern void pci_restore_msi_state(struct pci_dev *dev); 1173int pci_msi_enabled(void);
1156extern int pci_msi_enabled(void);
1157#endif 1174#endif
1158 1175
1159#ifdef CONFIG_PCIEPORTBUS 1176#ifdef CONFIG_PCIEPORTBUS
@@ -1168,8 +1185,8 @@ extern bool pcie_ports_auto;
1168static inline int pcie_aspm_enabled(void) { return 0; } 1185static inline int pcie_aspm_enabled(void) { return 0; }
1169static inline bool pcie_aspm_support_enabled(void) { return false; } 1186static inline bool pcie_aspm_support_enabled(void) { return false; }
1170#else 1187#else
1171extern int pcie_aspm_enabled(void); 1188int pcie_aspm_enabled(void);
1172extern bool pcie_aspm_support_enabled(void); 1189bool pcie_aspm_support_enabled(void);
1173#endif 1190#endif
1174 1191
1175#ifdef CONFIG_PCIEAER 1192#ifdef CONFIG_PCIEAER
@@ -1187,8 +1204,8 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
1187} 1204}
1188static inline void pcie_ecrc_get_policy(char *str) {}; 1205static inline void pcie_ecrc_get_policy(char *str) {};
1189#else 1206#else
1190extern void pcie_set_ecrc_checking(struct pci_dev *dev); 1207void pcie_set_ecrc_checking(struct pci_dev *dev);
1191extern void pcie_ecrc_get_policy(char *str); 1208void pcie_ecrc_get_policy(char *str);
1192#endif 1209#endif
1193 1210
1194#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) 1211#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
@@ -1199,9 +1216,9 @@ int ht_create_irq(struct pci_dev *dev, int idx);
1199void ht_destroy_irq(unsigned int irq); 1216void ht_destroy_irq(unsigned int irq);
1200#endif /* CONFIG_HT_IRQ */ 1217#endif /* CONFIG_HT_IRQ */
1201 1218
1202extern void pci_cfg_access_lock(struct pci_dev *dev); 1219void pci_cfg_access_lock(struct pci_dev *dev);
1203extern bool pci_cfg_access_trylock(struct pci_dev *dev); 1220bool pci_cfg_access_trylock(struct pci_dev *dev);
1204extern void pci_cfg_access_unlock(struct pci_dev *dev); 1221void pci_cfg_access_unlock(struct pci_dev *dev);
1205 1222
1206/* 1223/*
1207 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1224 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
@@ -1226,7 +1243,7 @@ static inline int pci_proc_domain(struct pci_bus *bus)
1226/* some architectures require additional setup to direct VGA traffic */ 1243/* some architectures require additional setup to direct VGA traffic */
1227typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1244typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
1228 unsigned int command_bits, u32 flags); 1245 unsigned int command_bits, u32 flags);
1229extern void pci_register_set_vga_state(arch_set_vga_state_t func); 1246void pci_register_set_vga_state(arch_set_vga_state_t func);
1230 1247
1231#else /* CONFIG_PCI is not enabled */ 1248#else /* CONFIG_PCI is not enabled */
1232 1249
@@ -1628,8 +1645,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1628int pcibios_add_device(struct pci_dev *dev); 1645int pcibios_add_device(struct pci_dev *dev);
1629 1646
1630#ifdef CONFIG_PCI_MMCONFIG 1647#ifdef CONFIG_PCI_MMCONFIG
1631extern void __init pci_mmcfg_early_init(void); 1648void __init pci_mmcfg_early_init(void);
1632extern void __init pci_mmcfg_late_init(void); 1649void __init pci_mmcfg_late_init(void);
1633#else 1650#else
1634static inline void pci_mmcfg_early_init(void) { } 1651static inline void pci_mmcfg_early_init(void) { }
1635static inline void pci_mmcfg_late_init(void) { } 1652static inline void pci_mmcfg_late_init(void) { }
@@ -1640,12 +1657,13 @@ int pci_ext_cfg_avail(void);
1640void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1657void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1641 1658
1642#ifdef CONFIG_PCI_IOV 1659#ifdef CONFIG_PCI_IOV
1643extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1660int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1644extern void pci_disable_sriov(struct pci_dev *dev); 1661void pci_disable_sriov(struct pci_dev *dev);
1645extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1662irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1646extern int pci_num_vf(struct pci_dev *dev); 1663int pci_num_vf(struct pci_dev *dev);
1647extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1664int pci_vfs_assigned(struct pci_dev *dev);
1648extern int pci_sriov_get_totalvfs(struct pci_dev *dev); 1665int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1666int pci_sriov_get_totalvfs(struct pci_dev *dev);
1649#else 1667#else
1650static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1668static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1651{ 1669{
@@ -1662,6 +1680,10 @@ static inline int pci_num_vf(struct pci_dev *dev)
1662{ 1680{
1663 return 0; 1681 return 0;
1664} 1682}
1683static inline int pci_vfs_assigned(struct pci_dev *dev)
1684{
1685 return 0;
1686}
1665static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) 1687static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1666{ 1688{
1667 return 0; 1689 return 0;
@@ -1673,8 +1695,8 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1673#endif 1695#endif
1674 1696
1675#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1697#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
1676extern void pci_hp_create_module_link(struct pci_slot *pci_slot); 1698void pci_hp_create_module_link(struct pci_slot *pci_slot);
1677extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); 1699void pci_hp_remove_module_link(struct pci_slot *pci_slot);
1678#endif 1700#endif
1679 1701
1680/** 1702/**
@@ -1818,13 +1840,13 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
1818/* PCI <-> OF binding helpers */ 1840/* PCI <-> OF binding helpers */
1819#ifdef CONFIG_OF 1841#ifdef CONFIG_OF
1820struct device_node; 1842struct device_node;
1821extern void pci_set_of_node(struct pci_dev *dev); 1843void pci_set_of_node(struct pci_dev *dev);
1822extern void pci_release_of_node(struct pci_dev *dev); 1844void pci_release_of_node(struct pci_dev *dev);
1823extern void pci_set_bus_of_node(struct pci_bus *bus); 1845void pci_set_bus_of_node(struct pci_bus *bus);
1824extern void pci_release_bus_of_node(struct pci_bus *bus); 1846void pci_release_bus_of_node(struct pci_bus *bus);
1825 1847
1826/* Arch may override this (weak) */ 1848/* Arch may override this (weak) */
1827extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus); 1849struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);
1828 1850
1829static inline struct device_node * 1851static inline struct device_node *
1830pci_device_to_OF_node(const struct pci_dev *pdev) 1852pci_device_to_OF_node(const struct pci_dev *pdev)
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 45fc162cbdc0..8db71dcd6337 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -125,12 +125,12 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
125 return pci_slot_name(slot->pci_slot); 125 return pci_slot_name(slot->pci_slot);
126} 126}
127 127
128extern int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, 128int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr,
129 int nr, const char *name, 129 const char *name, struct module *owner,
130 struct module *owner, const char *mod_name); 130 const char *mod_name);
131extern int pci_hp_deregister(struct hotplug_slot *slot); 131int pci_hp_deregister(struct hotplug_slot *slot);
132extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 132int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot,
133 struct hotplug_slot_info *info); 133 struct hotplug_slot_info *info);
134 134
135/* use a define to avoid include chaining to get THIS_MODULE & friends */ 135/* use a define to avoid include chaining to get THIS_MODULE & friends */
136#define pci_hp_register(slot, pbus, devnr, name) \ 136#define pci_hp_register(slot, pbus, devnr, name) \
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f11c1c2609d5..c12916248469 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -524,6 +524,8 @@
524#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 524#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603
525#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 525#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604
526#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 526#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605
527#define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533
528#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534
527#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 529#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
528#define PCI_DEVICE_ID_AMD_LANCE 0x2000 530#define PCI_DEVICE_ID_AMD_LANCE 0x2000
529#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 531#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
@@ -1604,6 +1606,7 @@
1604#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 1606#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334
1605 1607
1606#define PCI_VENDOR_ID_MARVELL 0x11ab 1608#define PCI_VENDOR_ID_MARVELL 0x11ab
1609#define PCI_VENDOR_ID_MARVELL_EXT 0x1b4b
1607#define PCI_DEVICE_ID_MARVELL_GT64111 0x4146 1610#define PCI_DEVICE_ID_MARVELL_GT64111 0x4146
1608#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1611#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1609#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1612#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
@@ -2144,11 +2147,13 @@
2144#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 2147#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
2145#define PCI_DEVICE_ID_NX2_57712 0x1662 2148#define PCI_DEVICE_ID_NX2_57712 0x1662
2146#define PCI_DEVICE_ID_NX2_57712E 0x1663 2149#define PCI_DEVICE_ID_NX2_57712E 0x1663
2150#define PCI_DEVICE_ID_NX2_57712_MF 0x1663
2147#define PCI_DEVICE_ID_TIGON3_5714 0x1668 2151#define PCI_DEVICE_ID_TIGON3_5714 0x1668
2148#define PCI_DEVICE_ID_TIGON3_5714S 0x1669 2152#define PCI_DEVICE_ID_TIGON3_5714S 0x1669
2149#define PCI_DEVICE_ID_TIGON3_5780 0x166a 2153#define PCI_DEVICE_ID_TIGON3_5780 0x166a
2150#define PCI_DEVICE_ID_TIGON3_5780S 0x166b 2154#define PCI_DEVICE_ID_TIGON3_5780S 0x166b
2151#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 2155#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
2156#define PCI_DEVICE_ID_NX2_57712_VF 0x166f
2152#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 2157#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
2153#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 2158#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
2154#define PCI_DEVICE_ID_TIGON3_5756 0x1674 2159#define PCI_DEVICE_ID_TIGON3_5756 0x1674
@@ -2174,13 +2179,15 @@
2174#define PCI_DEVICE_ID_TIGON3_5787 0x169b 2179#define PCI_DEVICE_ID_TIGON3_5787 0x169b
2175#define PCI_DEVICE_ID_TIGON3_5788 0x169c 2180#define PCI_DEVICE_ID_TIGON3_5788 0x169c
2176#define PCI_DEVICE_ID_TIGON3_5789 0x169d 2181#define PCI_DEVICE_ID_TIGON3_5789 0x169d
2182#define PCI_DEVICE_ID_NX2_57840_4_10 0x16a1
2183#define PCI_DEVICE_ID_NX2_57840_2_20 0x16a2
2184#define PCI_DEVICE_ID_NX2_57840_MF 0x16a4
2177#define PCI_DEVICE_ID_NX2_57800_MF 0x16a5 2185#define PCI_DEVICE_ID_NX2_57800_MF 0x16a5
2178#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 2186#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
2179#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 2187#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
2180#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 2188#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
2181#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9 2189#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9
2182#define PCI_DEVICE_ID_NX2_5706S 0x16aa 2190#define PCI_DEVICE_ID_NX2_5706S 0x16aa
2183#define PCI_DEVICE_ID_NX2_57840_MF 0x16a4
2184#define PCI_DEVICE_ID_NX2_5708S 0x16ac 2191#define PCI_DEVICE_ID_NX2_5708S 0x16ac
2185#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad 2192#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad
2186#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae 2193#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index e6f91b1406d8..9572669eea97 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -62,7 +62,7 @@ struct pcie_port_service_driver {
62#define to_service_driver(d) \ 62#define to_service_driver(d) \
63 container_of(d, struct pcie_port_service_driver, driver) 63 container_of(d, struct pcie_port_service_driver, driver)
64 64
65extern int pcie_port_service_register(struct pcie_port_service_driver *new); 65int pcie_port_service_register(struct pcie_port_service_driver *new);
66extern void pcie_port_service_unregister(struct pcie_port_service_driver *new); 66void pcie_port_service_unregister(struct pcie_port_service_driver *new);
67 67
68#endif /* _PCIEPORT_IF_H_ */ 68#endif /* _PCIEPORT_IF_H_ */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 1d795df6f4cf..f463a46424e2 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23#ifdef CONFIG_PERF_EVENTS 23#ifdef CONFIG_PERF_EVENTS
24# include <linux/cgroup.h>
25# include <asm/perf_event.h> 24# include <asm/perf_event.h>
26# include <asm/local64.h> 25# include <asm/local64.h>
27#endif 26#endif
@@ -128,6 +127,7 @@ struct hw_perf_event {
128 int event_base_rdpmc; 127 int event_base_rdpmc;
129 int idx; 128 int idx;
130 int last_cpu; 129 int last_cpu;
130 int flags;
131 131
132 struct hw_perf_event_extra extra_reg; 132 struct hw_perf_event_extra extra_reg;
133 struct hw_perf_event_extra branch_reg; 133 struct hw_perf_event_extra branch_reg;
@@ -299,22 +299,7 @@ struct swevent_hlist {
299#define PERF_ATTACH_GROUP 0x02 299#define PERF_ATTACH_GROUP 0x02
300#define PERF_ATTACH_TASK 0x04 300#define PERF_ATTACH_TASK 0x04
301 301
302#ifdef CONFIG_CGROUP_PERF 302struct perf_cgroup;
303/*
304 * perf_cgroup_info keeps track of time_enabled for a cgroup.
305 * This is a per-cpu dynamically allocated data structure.
306 */
307struct perf_cgroup_info {
308 u64 time;
309 u64 timestamp;
310};
311
312struct perf_cgroup {
313 struct cgroup_subsys_state css;
314 struct perf_cgroup_info *info; /* timing info, one per cpu */
315};
316#endif
317
318struct ring_buffer; 303struct ring_buffer;
319 304
320/** 305/**
@@ -583,11 +568,13 @@ struct perf_sample_data {
583 u32 reserved; 568 u32 reserved;
584 } cpu_entry; 569 } cpu_entry;
585 u64 period; 570 u64 period;
571 union perf_mem_data_src data_src;
586 struct perf_callchain_entry *callchain; 572 struct perf_callchain_entry *callchain;
587 struct perf_raw_record *raw; 573 struct perf_raw_record *raw;
588 struct perf_branch_stack *br_stack; 574 struct perf_branch_stack *br_stack;
589 struct perf_regs_user regs_user; 575 struct perf_regs_user regs_user;
590 u64 stack_user_size; 576 u64 stack_user_size;
577 u64 weight;
591}; 578};
592 579
593static inline void perf_sample_data_init(struct perf_sample_data *data, 580static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -601,6 +588,8 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
601 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE; 588 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE;
602 data->regs_user.regs = NULL; 589 data->regs_user.regs = NULL;
603 data->stack_user_size = 0; 590 data->stack_user_size = 0;
591 data->weight = 0;
592 data->data_src.val = 0;
604} 593}
605 594
606extern void perf_output_sample(struct perf_output_handle *handle, 595extern void perf_output_sample(struct perf_output_handle *handle,
@@ -799,6 +788,12 @@ static inline int __perf_event_disable(void *info) { return -1; }
799static inline void perf_event_task_tick(void) { } 788static inline void perf_event_task_tick(void) { }
800#endif 789#endif
801 790
791#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_NO_HZ_FULL)
792extern bool perf_event_can_stop_tick(void);
793#else
794static inline bool perf_event_can_stop_tick(void) { return true; }
795#endif
796
802#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) 797#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
803extern void perf_restore_debug_store(void); 798extern void perf_restore_debug_store(void);
804#else 799#else
@@ -831,6 +826,7 @@ do { \
831struct perf_pmu_events_attr { 826struct perf_pmu_events_attr {
832 struct device_attribute attr; 827 struct device_attribute attr;
833 u64 id; 828 u64 id;
829 const char *event_str;
834}; 830};
835 831
836#define PMU_EVENT_ATTR(_name, _var, _id, _show) \ 832#define PMU_EVENT_ATTR(_name, _var, _id, _show) \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 33999adbf8c8..9e11039dd7a3 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -455,6 +455,14 @@ struct phy_driver {
455 */ 455 */
456 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); 456 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
457 457
458 /* Some devices (e.g. qnap TS-119P II) require PHY register changes to
459 * enable Wake on LAN, so set_wol is provided to be called in the
460 * ethernet driver's set_wol function. */
461 int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
462
463 /* See set_wol, but for checking whether Wake on LAN is enabled. */
464 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
465
458 struct device_driver driver; 466 struct device_driver driver;
459}; 467};
460#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 468#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -560,6 +568,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
560int phy_get_eee_err(struct phy_device *phydev); 568int phy_get_eee_err(struct phy_device *phydev);
561int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); 569int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data);
562int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); 570int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data);
571int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);
572void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);
563 573
564int __init mdio_bus_init(void); 574int __init mdio_bus_init(void);
565void mdio_bus_exit(void); 575void mdio_bus_exit(void);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 215e5e3dda10..e2772666f004 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -4,6 +4,7 @@
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/bug.h> 5#include <linux/bug.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/workqueue.h>
7#include <linux/threads.h> 8#include <linux/threads.h>
8#include <linux/nsproxy.h> 9#include <linux/nsproxy.h>
9#include <linux/kref.h> 10#include <linux/kref.h>
@@ -13,7 +14,9 @@ struct pidmap {
13 void *page; 14 void *page;
14}; 15};
15 16
16#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) 17#define BITS_PER_PAGE (PAGE_SIZE * 8)
18#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
19#define PIDMAP_ENTRIES ((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE)
17 20
18struct bsd_acct_struct; 21struct bsd_acct_struct;
19 22
@@ -28,6 +31,7 @@ struct pid_namespace {
28 struct pid_namespace *parent; 31 struct pid_namespace *parent;
29#ifdef CONFIG_PROC_FS 32#ifdef CONFIG_PROC_FS
30 struct vfsmount *proc_mnt; 33 struct vfsmount *proc_mnt;
34 struct dentry *proc_self;
31#endif 35#endif
32#ifdef CONFIG_BSD_PROCESS_ACCT 36#ifdef CONFIG_BSD_PROCESS_ACCT
33 struct bsd_acct_struct *bacct; 37 struct bsd_acct_struct *bacct;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 72474e18f1e0..6aa238096622 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -37,17 +37,17 @@
37 * if it is 0, pull-down is disabled. 37 * if it is 0, pull-down is disabled.
38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and 38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and
39 * low, this is the most typical case and is typically achieved with two 39 * low, this is the most typical case and is typically achieved with two
40 * active transistors on the output. Sending this config will enabale 40 * active transistors on the output. Setting this config will enable
41 * push-pull mode, the argument is ignored. 41 * push-pull mode, the argument is ignored.
42 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open 42 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open
43 * collector) which means it is usually wired with other output ports 43 * collector) which means it is usually wired with other output ports
44 * which are then pulled up with an external resistor. Sending this 44 * which are then pulled up with an external resistor. Setting this
45 * config will enabale open drain mode, the argument is ignored. 45 * config will enable open drain mode, the argument is ignored.
46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
47 * (open emitter). Sending this config will enabale open drain mode, the 47 * (open emitter). Setting this config will enable open drain mode, the
48 * argument is ignored. 48 * argument is ignored.
49 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will output the current passed as 49 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current
50 * argument. The argument is in mA. 50 * passed as argument. The argument is in mA.
51 * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin. 51 * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin.
52 * If the argument != 0, schmitt-trigger mode is enabled. If it's 0, 52 * If the argument != 0, schmitt-trigger mode is enabled. If it's 0,
53 * schmitt-trigger mode is disabled. 53 * schmitt-trigger mode is disabled.
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index e7a720104a47..1ad4f31ef6b8 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -14,6 +14,8 @@
14 14
15#ifdef CONFIG_PINCONF 15#ifdef CONFIG_PINCONF
16 16
17#include <linux/pinctrl/machine.h>
18
17struct pinctrl_dev; 19struct pinctrl_dev;
18struct seq_file; 20struct seq_file;
19 21
@@ -28,6 +30,7 @@ struct seq_file;
28 * @pin_config_set: configure an individual pin 30 * @pin_config_set: configure an individual pin
29 * @pin_config_group_get: get configurations for an entire pin group 31 * @pin_config_group_get: get configurations for an entire pin group
30 * @pin_config_group_set: configure all pins in a group 32 * @pin_config_group_set: configure all pins in a group
33 * @pin_config_group_dbg_set: optional debugfs to modify a pin configuration
31 * @pin_config_dbg_show: optional debugfs display hook that will provide 34 * @pin_config_dbg_show: optional debugfs display hook that will provide
32 * per-device info for a certain pin in debugfs 35 * per-device info for a certain pin in debugfs
33 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 36 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
@@ -51,6 +54,9 @@ struct pinconf_ops {
51 int (*pin_config_group_set) (struct pinctrl_dev *pctldev, 54 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
52 unsigned selector, 55 unsigned selector,
53 unsigned long config); 56 unsigned long config);
57 int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev,
58 const char *arg,
59 unsigned long *config);
54 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, 60 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
55 struct seq_file *s, 61 struct seq_file *s,
56 unsigned offset); 62 unsigned offset);
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 778804df293f..2c2a9e8d8578 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -118,9 +118,9 @@ struct pinctrl_desc {
118 const char *name; 118 const char *name;
119 struct pinctrl_pin_desc const *pins; 119 struct pinctrl_pin_desc const *pins;
120 unsigned int npins; 120 unsigned int npins;
121 struct pinctrl_ops *pctlops; 121 const struct pinctrl_ops *pctlops;
122 struct pinmux_ops *pmxops; 122 const struct pinmux_ops *pmxops;
123 struct pinconf_ops *confops; 123 const struct pinconf_ops *confops;
124 struct module *owner; 124 struct module *owner;
125}; 125};
126 126
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ad1a427b5267..b8809fef61f5 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -27,6 +27,7 @@ struct pipe_buffer {
27 27
28/** 28/**
29 * struct pipe_inode_info - a linux kernel pipe 29 * struct pipe_inode_info - a linux kernel pipe
30 * @mutex: mutex protecting the whole thing
30 * @wait: reader/writer wait point in case of empty/full pipe 31 * @wait: reader/writer wait point in case of empty/full pipe
31 * @nrbufs: the number of non-empty pipe buffers in this pipe 32 * @nrbufs: the number of non-empty pipe buffers in this pipe
32 * @buffers: total number of buffers (should be a power of 2) 33 * @buffers: total number of buffers (should be a power of 2)
@@ -34,26 +35,27 @@ struct pipe_buffer {
34 * @tmp_page: cached released page 35 * @tmp_page: cached released page
35 * @readers: number of current readers of this pipe 36 * @readers: number of current readers of this pipe
36 * @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)
37 * @waiting_writers: number of writers blocked waiting for room 39 * @waiting_writers: number of writers blocked waiting for room
38 * @r_counter: reader counter 40 * @r_counter: reader counter
39 * @w_counter: writer counter 41 * @w_counter: writer counter
40 * @fasync_readers: reader side fasync 42 * @fasync_readers: reader side fasync
41 * @fasync_writers: writer side fasync 43 * @fasync_writers: writer side fasync
42 * @inode: inode this pipe is attached to
43 * @bufs: the circular array of pipe buffers 44 * @bufs: the circular array of pipe buffers
44 **/ 45 **/
45struct pipe_inode_info { 46struct pipe_inode_info {
47 struct mutex mutex;
46 wait_queue_head_t wait; 48 wait_queue_head_t wait;
47 unsigned int nrbufs, curbuf, buffers; 49 unsigned int nrbufs, curbuf, buffers;
48 unsigned int readers; 50 unsigned int readers;
49 unsigned int writers; 51 unsigned int writers;
52 unsigned int files;
50 unsigned int waiting_writers; 53 unsigned int waiting_writers;
51 unsigned int r_counter; 54 unsigned int r_counter;
52 unsigned int w_counter; 55 unsigned int w_counter;
53 struct page *tmp_page; 56 struct page *tmp_page;
54 struct fasync_struct *fasync_readers; 57 struct fasync_struct *fasync_readers;
55 struct fasync_struct *fasync_writers; 58 struct fasync_struct *fasync_writers;
56 struct inode *inode;
57 struct pipe_buffer *bufs; 59 struct pipe_buffer *bufs;
58}; 60};
59 61
@@ -144,9 +146,8 @@ int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);
144/* Drop the inode semaphore and wait for a pipe event, atomically */ 146/* Drop the inode semaphore and wait for a pipe event, atomically */
145void pipe_wait(struct pipe_inode_info *pipe); 147void pipe_wait(struct pipe_inode_info *pipe);
146 148
147struct pipe_inode_info * alloc_pipe_info(struct inode * inode); 149struct pipe_inode_info *alloc_pipe_info(void);
148void free_pipe_info(struct inode * inode); 150void free_pipe_info(struct pipe_inode_info *);
149void __free_pipe_info(struct pipe_inode_info *);
150 151
151/* Generic pipe buffer ops functions */ 152/* Generic pipe buffer ops functions */
152void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); 153void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
diff --git a/include/linux/platform_data/arm-ux500-pm.h b/include/linux/platform_data/arm-ux500-pm.h
new file mode 100644
index 000000000000..8dff64b29ec0
--- /dev/null
+++ b/include/linux/platform_data/arm-ux500-pm.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010-2013
3 * Author: Rickard Andersson <rickard.andersson@stericsson.com> for
4 * ST-Ericsson.
5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro.
6 * License terms: GNU General Public License (GPL) version 2
7 *
8 */
9
10#ifndef ARM_UX500_PM_H
11#define ARM_UX500_PM_H
12
13int prcmu_gic_decouple(void);
14int prcmu_gic_recouple(void);
15bool prcmu_gic_pending_irq(void);
16bool prcmu_pending_irq(void);
17bool prcmu_is_cpu_in_wfi(int cpu);
18int prcmu_copy_gic_settings(void);
19void ux500_pm_init(u32 phy_base, u32 size);
20
21#endif /* ARM_UX500_PM_H */
diff --git a/include/linux/platform_data/asoc-ux500-msp.h b/include/linux/platform_data/asoc-ux500-msp.h
new file mode 100644
index 000000000000..9991aea3d577
--- /dev/null
+++ b/include/linux/platform_data/asoc-ux500-msp.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __MSP_H
9#define __MSP_H
10
11#include <linux/platform_data/dma-ste-dma40.h>
12
13enum msp_i2s_id {
14 MSP_I2S_0 = 0,
15 MSP_I2S_1,
16 MSP_I2S_2,
17 MSP_I2S_3,
18};
19
20/* Platform data structure for a MSP I2S-device */
21struct msp_i2s_platform_data {
22 enum msp_i2s_id id;
23 struct stedma40_chan_cfg *msp_i2s_dma_rx;
24 struct stedma40_chan_cfg *msp_i2s_dma_tx;
25};
26
27#endif
diff --git a/include/linux/platform_data/atmel-aes.h b/include/linux/platform_data/atmel-aes.h
deleted file mode 100644
index ab68082fbcb0..000000000000
--- a/include/linux/platform_data/atmel-aes.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef __LINUX_ATMEL_AES_H
2#define __LINUX_ATMEL_AES_H
3
4#include <linux/platform_data/dma-atmel.h>
5
6/**
7 * struct aes_dma_data - DMA data for AES
8 */
9struct aes_dma_data {
10 struct at_dma_slave txdata;
11 struct at_dma_slave rxdata;
12};
13
14/**
15 * struct aes_platform_data - board-specific AES configuration
16 * @dma_slave: DMA slave interface to use in data transfers.
17 */
18struct aes_platform_data {
19 struct aes_dma_data *dma_slave;
20};
21
22#endif /* __LINUX_ATMEL_AES_H */
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
new file mode 100644
index 000000000000..1ade657d5fc1
--- /dev/null
+++ b/include/linux/platform_data/brcmfmac-sdio.h
@@ -0,0 +1,124 @@
1/*
2 * Copyright (c) 2013 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _LINUX_BRCMFMAC_PLATFORM_H
18#define _LINUX_BRCMFMAC_PLATFORM_H
19
20/*
21 * Platform specific driver functions and data. Through the platform specific
22 * device data functions can be provided to help the brcmfmac driver to
23 * operate with the device in combination with the used platform.
24 *
25 * Use the platform data in the following (similar) way:
26 *
27 *
28#include <brcmfmac_platform.h>
29
30
31static void brcmfmac_power_on(void)
32{
33}
34
35static void brcmfmac_power_off(void)
36{
37}
38
39static void brcmfmac_reset(void)
40{
41}
42
43static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = {
44 .power_on = brcmfmac_power_on,
45 .power_off = brcmfmac_power_off,
46 .reset = brcmfmac_reset
47};
48
49static struct platform_device brcmfmac_device = {
50 .name = BRCMFMAC_SDIO_PDATA_NAME,
51 .id = PLATFORM_DEVID_NONE,
52 .dev.platform_data = &brcmfmac_sdio_pdata
53};
54
55void __init brcmfmac_init_pdata(void)
56{
57 brcmfmac_sdio_pdata.oob_irq_supported = true;
58 brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB);
59 brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ |
60 IORESOURCE_IRQ_HIGHLEVEL;
61 platform_device_register(&brcmfmac_device);
62}
63 *
64 *
65 * Note: the brcmfmac can be loaded as module or be statically built-in into
66 * the kernel. If built-in then do note that it uses module_init (and
67 * module_exit) routines which equal device_initcall. So if you intend to
68 * create a module with the platform specific data for the brcmfmac and have
69 * it built-in to the kernel then use a higher initcall then device_initcall
70 * (see init.h). If this is not done then brcmfmac will load without problems
71 * but will not pickup the platform data.
72 *
73 * When the driver does not "detect" platform driver data then it will continue
74 * without reporting anything and just assume there is no data needed. Which is
75 * probably true for most platforms.
76 *
77 * Explanation of the platform_data fields:
78 *
79 * drive_strength: is the preferred drive_strength to be used for the SDIO
80 * pins. If 0 then a default value will be used. This is the target drive
81 * strength, the exact drive strength which will be used depends on the
82 * capabilities of the device.
83 *
84 * oob_irq_supported: does the board have support for OOB interrupts. SDIO
85 * in-band interrupts are relatively slow and for having less overhead on
86 * interrupt processing an out of band interrupt can be used. If the HW
87 * supports this then enable this by setting this field to true and configure
88 * the oob related fields.
89 *
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function.
92 *
93 * power_on: This function is called by the brcmfmac when the module gets
94 * loaded. This can be particularly useful for low power devices. The platform
95 * spcific routine may for example decide to power up the complete device.
96 * If there is no use-case for this function then provide NULL.
97 *
98 * power_off: This function is called by the brcmfmac when the module gets
99 * unloaded. At this point the device can be powered down or otherwise be reset.
100 * So if an actual power_off is not supported but reset is then reset the device
101 * when this function gets called. This can be particularly useful for low power
102 * devices. If there is no use-case for this function (either power-down or
103 * reset) then provide NULL.
104 *
105 * reset: This function can get called if the device communication broke down.
106 * This functionality is particularly useful in case of SDIO type devices. It is
107 * possible to reset a dongle via sdio data interface, but it requires that
108 * this is fully functional. This function is chip/module specific and this
109 * function should return only after the complete reset has completed.
110 */
111
112#define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio"
113
114struct brcmfmac_sdio_platform_data {
115 unsigned int drive_strength;
116 bool oob_irq_supported;
117 unsigned int oob_irq_nr;
118 unsigned long oob_irq_flags;
119 void (*power_on)(void);
120 void (*power_off)(void);
121 void (*reset)(void);
122};
123
124#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
diff --git a/include/linux/platform_data/clk-lpss.h b/include/linux/platform_data/clk-lpss.h
new file mode 100644
index 000000000000..23901992b9dd
--- /dev/null
+++ b/include/linux/platform_data/clk-lpss.h
@@ -0,0 +1,23 @@
1/*
2 * Intel Low Power Subsystem clocks.
3 *
4 * Copyright (C) 2013, Intel Corporation
5 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
6 * Rafael J. Wysocki <rafael.j.wysocki@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __CLK_LPSS_H
14#define __CLK_LPSS_H
15
16struct lpss_clk_data {
17 const char *name;
18 struct clk *clk;
19};
20
21extern int lpt_clk_init(void);
22
23#endif /* __CLK_LPSS_H */
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
index 3af0da1f3be5..320d9c39ea0a 100644
--- a/include/linux/platform_data/clk-ux500.h
+++ b/include/linux/platform_data/clk-ux500.h
@@ -10,7 +10,8 @@
10#ifndef __CLK_UX500_H 10#ifndef __CLK_UX500_H
11#define __CLK_UX500_H 11#define __CLK_UX500_H
12 12
13void u8500_clk_init(void); 13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base);
14void u9540_clk_init(void); 15void u9540_clk_init(void);
15void u8540_clk_init(void); 16void u8540_clk_init(void);
16 17
diff --git a/include/linux/platform_data/coda.h b/include/linux/platform_data/coda.h
new file mode 100644
index 000000000000..6ad4410d9e20
--- /dev/null
+++ b/include/linux/platform_data/coda.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2013 Philipp Zabel, Pengutronix
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9#ifndef PLATFORM_CODA_H
10#define PLATFORM_CODA_H
11
12struct device;
13
14struct coda_platform_data {
15 struct device *iram_dev;
16};
17
18#endif
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
index 798fb80b024b..bb3cd58d71e3 100644
--- a/include/linux/platform_data/cpsw.h
+++ b/include/linux/platform_data/cpsw.h
@@ -30,7 +30,7 @@ struct cpsw_platform_data {
30 u32 channels; /* number of cpdma channels (symmetric) */ 30 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 slaves; /* number of slave cpgmac ports */ 31 u32 slaves; /* number of slave cpgmac ports */
32 struct cpsw_slave_data *slave_data; 32 struct cpsw_slave_data *slave_data;
33 u32 cpts_active_slave; /* time stamping slave */ 33 u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */
34 u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */ 34 u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */
35 u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */ 35 u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */
36 u32 ale_entries; /* ale table size */ 36 u32 ale_entries; /* ale table size */
diff --git a/include/linux/platform_data/crypto-atmel.h b/include/linux/platform_data/crypto-atmel.h
new file mode 100644
index 000000000000..b46e0d9062a0
--- /dev/null
+++ b/include/linux/platform_data/crypto-atmel.h
@@ -0,0 +1,22 @@
1#ifndef __LINUX_CRYPTO_ATMEL_H
2#define __LINUX_CRYPTO_ATMEL_H
3
4#include <linux/platform_data/dma-atmel.h>
5
6/**
7 * struct crypto_dma_data - DMA data for AES/TDES/SHA
8 */
9struct crypto_dma_data {
10 struct at_dma_slave txdata;
11 struct at_dma_slave rxdata;
12};
13
14/**
15 * struct crypto_platform_data - board-specific AES/TDES/SHA configuration
16 * @dma_slave: DMA slave interface to use in data transfers.
17 */
18struct crypto_platform_data {
19 struct crypto_dma_data *dma_slave;
20};
21
22#endif /* __LINUX_CRYPTO_ATMEL_H */
diff --git a/include/linux/platform_data/dwc3-omap.h b/include/linux/platform_data/dwc3-omap.h
index ada401244e0b..1d36ca874cc8 100644
--- a/include/linux/platform_data/dwc3-omap.h
+++ b/include/linux/platform_data/dwc3-omap.h
@@ -41,7 +41,3 @@ enum dwc3_omap_utmi_mode {
41 DWC3_OMAP_UTMI_MODE_HW, 41 DWC3_OMAP_UTMI_MODE_HW,
42 DWC3_OMAP_UTMI_MODE_SW, 42 DWC3_OMAP_UTMI_MODE_SW,
43}; 43};
44
45struct dwc3_omap_data {
46 enum dwc3_omap_utmi_mode utmi_mode;
47};
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index 1bd5244d1dcd..bf0a83b7ed9d 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -50,5 +50,5 @@ struct elm_errorvec {
50 50
51void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 51void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
52 struct elm_errorvec *err_vec); 52 struct elm_errorvec *err_vec);
53void elm_config(struct device *dev, enum bch_ecc bch_type); 53int elm_config(struct device *dev, enum bch_ecc bch_type);
54#endif /* __ELM_H */ 54#endif /* __ELM_H */
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h
index 03378ca84061..5c19a2a647c4 100644
--- a/include/linux/platform_data/emif_plat.h
+++ b/include/linux/platform_data/emif_plat.h
@@ -40,6 +40,7 @@
40/* Custom config requests */ 40/* Custom config requests */
41#define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001 41#define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001
42#define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002 42#define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002
43#define EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART 0x00000004
43 44
44#ifndef __ASSEMBLY__ 45#ifndef __ASSEMBLY__
45/** 46/**
diff --git a/include/linux/platform_data/gpio-rcar.h b/include/linux/platform_data/gpio-rcar.h
new file mode 100644
index 000000000000..b253f77a7ddf
--- /dev/null
+++ b/include/linux/platform_data/gpio-rcar.h
@@ -0,0 +1,26 @@
1/*
2 * Renesas R-Car GPIO Support
3 *
4 * Copyright (C) 2013 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __GPIO_RCAR_H__
17#define __GPIO_RCAR_H__
18
19struct gpio_rcar_config {
20 unsigned int gpio_base;
21 unsigned int irq_base;
22 unsigned int number_of_pins;
23 const char *pctl_name;
24};
25
26#endif /* __GPIO_RCAR_H__ */
diff --git a/include/linux/platform_data/imx-iram.h b/include/linux/platform_data/imx-iram.h
deleted file mode 100644
index 022690c33702..000000000000
--- a/include/linux/platform_data/imx-iram.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19#include <linux/errno.h>
20
21#ifdef CONFIG_IRAM_ALLOC
22
23int __init iram_init(unsigned long base, unsigned long size);
24void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr);
25void iram_free(unsigned long dma_addr, unsigned int size);
26
27#else
28
29static inline int __init iram_init(unsigned long base, unsigned long size)
30{
31 return -ENOMEM;
32}
33
34static inline void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr)
35{
36 return NULL;
37}
38
39static inline void iram_free(unsigned long base, unsigned long size) {}
40
41#endif
diff --git a/include/linux/platform_data/irq-renesas-intc-irqpin.h b/include/linux/platform_data/irq-renesas-intc-irqpin.h
new file mode 100644
index 000000000000..e4cb911066a6
--- /dev/null
+++ b/include/linux/platform_data/irq-renesas-intc-irqpin.h
@@ -0,0 +1,29 @@
1/*
2 * Renesas INTC External IRQ Pin Driver
3 *
4 * Copyright (C) 2013 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __IRQ_RENESAS_INTC_IRQPIN_H__
21#define __IRQ_RENESAS_INTC_IRQPIN_H__
22
23struct renesas_intc_irqpin_config {
24 unsigned int sense_bitfield_width;
25 unsigned int irq_base;
26 bool control_parent;
27};
28
29#endif /* __IRQ_RENESAS_INTC_IRQPIN_H__ */
diff --git a/include/linux/platform_data/irq-renesas-irqc.h b/include/linux/platform_data/irq-renesas-irqc.h
new file mode 100644
index 000000000000..3ae17b3e00ed
--- /dev/null
+++ b/include/linux/platform_data/irq-renesas-irqc.h
@@ -0,0 +1,27 @@
1/*
2 * Renesas IRQC Driver
3 *
4 * Copyright (C) 2013 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __IRQ_RENESAS_IRQC_H__
21#define __IRQ_RENESAS_IRQC_H__
22
23struct renesas_irqc_config {
24 unsigned int irq_base;
25};
26
27#endif /* __IRQ_RENESAS_IRQC_H__ */
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
index 1509570d5a3f..202e290faea8 100644
--- a/include/linux/platform_data/leds-lp55xx.h
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -20,18 +20,6 @@
20#define LP55XX_CLOCK_INT 1 20#define LP55XX_CLOCK_INT 1
21#define LP55XX_CLOCK_EXT 2 21#define LP55XX_CLOCK_EXT 2
22 22
23/* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */
24#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
25#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
26#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
27#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
28#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
29#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
30#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
31#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
32#define LP5521_CLK_INT 1 /* Internal clock */
33#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
34
35struct lp55xx_led_config { 23struct lp55xx_led_config {
36 const char *name; 24 const char *name;
37 u8 chan_nr; 25 u8 chan_nr;
@@ -40,9 +28,9 @@ struct lp55xx_led_config {
40}; 28};
41 29
42struct lp55xx_predef_pattern { 30struct lp55xx_predef_pattern {
43 u8 *r; 31 const u8 *r;
44 u8 *g; 32 const u8 *g;
45 u8 *b; 33 const u8 *b;
46 u8 size_r; 34 u8 size_r;
47 u8 size_g; 35 u8 size_g;
48 u8 size_b; 36 u8 size_b;
@@ -79,9 +67,6 @@ struct lp55xx_platform_data {
79 /* Predefined pattern data */ 67 /* Predefined pattern data */
80 struct lp55xx_predef_pattern *patterns; 68 struct lp55xx_predef_pattern *patterns;
81 unsigned int num_patterns; 69 unsigned int num_patterns;
82
83 /* _CONFIG register */
84 u8 update_config;
85}; 70};
86 71
87#endif /* _LEDS_LP55XX_H */ 72#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index 20ee8b221dbd..ea3200527dd3 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -69,11 +69,6 @@ enum lp855x_chip_id {
69 LP8557, 69 LP8557,
70}; 70};
71 71
72enum lp855x_brightness_ctrl_mode {
73 PWM_BASED = 1,
74 REGISTER_BASED,
75};
76
77enum lp8550_brighntess_source { 72enum lp8550_brighntess_source {
78 LP8550_PWM_ONLY, 73 LP8550_PWM_ONLY,
79 LP8550_I2C_ONLY = 2, 74 LP8550_I2C_ONLY = 2,
@@ -116,24 +111,18 @@ struct lp855x_rom_data {
116/** 111/**
117 * struct lp855x_platform_data 112 * struct lp855x_platform_data
118 * @name : Backlight driver name. If it is not defined, default name is set. 113 * @name : Backlight driver name. If it is not defined, default name is set.
119 * @mode : brightness control by pwm or lp855x register
120 * @device_control : value of DEVICE CONTROL register 114 * @device_control : value of DEVICE CONTROL register
121 * @initial_brightness : initial value of backlight brightness 115 * @initial_brightness : initial value of backlight brightness
122 * @period_ns : platform specific pwm period value. unit is nano. 116 * @period_ns : platform specific pwm period value. unit is nano.
123 Only valid when mode is PWM_BASED. 117 Only valid when mode is PWM_BASED.
124 * @load_new_rom_data :
125 0 : use default configuration data
126 1 : update values of eeprom or eprom registers on loading driver
127 * @size_program : total size of lp855x_rom_data 118 * @size_program : total size of lp855x_rom_data
128 * @rom_data : list of new eeprom/eprom registers 119 * @rom_data : list of new eeprom/eprom registers
129 */ 120 */
130struct lp855x_platform_data { 121struct lp855x_platform_data {
131 char *name; 122 const char *name;
132 enum lp855x_brightness_ctrl_mode mode;
133 u8 device_control; 123 u8 device_control;
134 int initial_brightness; 124 u8 initial_brightness;
135 unsigned int period_ns; 125 unsigned int period_ns;
136 u8 load_new_rom_data;
137 int size_program; 126 int size_program;
138 struct lp855x_rom_data *rom_data; 127 struct lp855x_rom_data *rom_data;
139}; 128};
diff --git a/include/linux/platform_data/mmc-davinci.h b/include/linux/platform_data/mmc-davinci.h
index 5ba6b22ce338..9cea4ee377b5 100644
--- a/include/linux/platform_data/mmc-davinci.h
+++ b/include/linux/platform_data/mmc-davinci.h
@@ -23,9 +23,6 @@ struct davinci_mmc_config {
23 /* any additional host capabilities: OR'd in to mmc->f_caps */ 23 /* any additional host capabilities: OR'd in to mmc->f_caps */
24 u32 caps; 24 u32 caps;
25 25
26 /* Version of the MMC/SD controller */
27 u8 version;
28
29 /* Number of sg segments */ 26 /* Number of sg segments */
30 u8 nr_sg; 27 u8 nr_sg;
31}; 28};
diff --git a/include/linux/platform_data/mmc-sdhci-s3c.h b/include/linux/platform_data/mmc-sdhci-s3c.h
new file mode 100644
index 000000000000..249f02387a35
--- /dev/null
+++ b/include/linux/platform_data/mmc-sdhci-s3c.h
@@ -0,0 +1,56 @@
1#ifndef __PLATFORM_DATA_SDHCI_S3C_H
2#define __PLATFORM_DATA_SDHCI_S3C_H
3
4struct platform_device;
5
6enum cd_types {
7 S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */
8 S3C_SDHCI_CD_EXTERNAL, /* use external callback */
9 S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */
10 S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */
11 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
12};
13
14/**
15 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
16 * @max_width: The maximum number of data bits supported.
17 * @host_caps: Standard MMC host capabilities bit field.
18 * @host_caps2: The second standard MMC host capabilities bit field.
19 * @cd_type: Type of Card Detection method (see cd_types enum above)
20 * @ext_cd_init: Initialize external card detect subsystem. Called on
21 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
22 * notify_func argument is a callback to the sdhci-s3c driver
23 * that triggers the card detection event. Callback arguments:
24 * dev is pointer to platform device of the host controller,
25 * state is new state of the card (0 - removed, 1 - inserted).
26 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
27 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
28 * notify_func argument is the same callback as for ext_cd_init.
29 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
30 * cd_type == S3C_SDHCI_CD_GPIO
31 * @ext_cd_gpio_invert: invert values for external CD gpio line
32 * @cfg_gpio: Configure the GPIO for a specific card bit-width
33 *
34 * Initialisation data specific to either the machine or the platform
35 * for the device driver to use or call-back when configuring gpio or
36 * card speed information.
37*/
38struct s3c_sdhci_platdata {
39 unsigned int max_width;
40 unsigned int host_caps;
41 unsigned int host_caps2;
42 unsigned int pm_caps;
43 enum cd_types cd_type;
44
45 int ext_cd_gpio;
46 bool ext_cd_gpio_invert;
47 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
48 int state));
49 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
50 int state));
51
52 void (*cfg_gpio)(struct platform_device *dev, int width);
53};
54
55
56#endif /* __PLATFORM_DATA_SDHCI_S3C_H */
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h
index 944b01dd103e..98b7925f1a2d 100644
--- a/include/linux/platform_data/mv_usb.h
+++ b/include/linux/platform_data/mv_usb.h
@@ -34,8 +34,6 @@ struct mv_usb_addon_irq {
34}; 34};
35 35
36struct mv_usb_platform_data { 36struct mv_usb_platform_data {
37 unsigned int clknum;
38 char **clkname;
39 struct mv_usb_addon_irq *id; /* Only valid for OTG. ID pin change*/ 37 struct mv_usb_addon_irq *id; /* Only valid for OTG. ID pin change*/
40 struct mv_usb_addon_irq *vbus; /* valid for OTG/UDC. VBUS change*/ 38 struct mv_usb_addon_irq *vbus; /* valid for OTG/UDC. VBUS change*/
41 39
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
index 88734e871e3a..c7285b575462 100644
--- a/include/linux/platform_data/ntc_thermistor.h
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -21,6 +21,8 @@
21#ifndef _LINUX_NTC_H 21#ifndef _LINUX_NTC_H
22#define _LINUX_NTC_H 22#define _LINUX_NTC_H
23 23
24struct iio_channel;
25
24enum ntc_thermistor_type { 26enum ntc_thermistor_type {
25 TYPE_NCPXXWB473, 27 TYPE_NCPXXWB473,
26 TYPE_NCPXXWL333, 28 TYPE_NCPXXWL333,
@@ -39,13 +41,17 @@ struct ntc_thermistor_platform_data {
39 * described at Documentation/hwmon/ntc_thermistor 41 * described at Documentation/hwmon/ntc_thermistor
40 * 42 *
41 * pullup/down_ohm: 0 for infinite / not-connected 43 * pullup/down_ohm: 0 for infinite / not-connected
44 *
45 * chan: iio_channel pointer to communicate with the ADC which the
46 * thermistor is using for conversion of the analog values.
42 */ 47 */
43 int (*read_uV)(void); 48 int (*read_uv)(struct ntc_thermistor_platform_data *);
44 unsigned int pullup_uV; 49 unsigned int pullup_uv;
45 50
46 unsigned int pullup_ohm; 51 unsigned int pullup_ohm;
47 unsigned int pulldown_ohm; 52 unsigned int pulldown_ohm;
48 enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect; 53 enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect;
54 struct iio_channel *chan;
49 55
50 int (*read_ohm)(void); 56 int (*read_ohm)(void);
51}; 57};
diff --git a/include/linux/platform_data/serial-omap.h b/include/linux/platform_data/serial-omap.h
index ff9b0aab5281..c860c1b314c0 100644
--- a/include/linux/platform_data/serial-omap.h
+++ b/include/linux/platform_data/serial-omap.h
@@ -43,8 +43,6 @@ struct omap_uart_port_info {
43 int DTR_present; 43 int DTR_present;
44 44
45 int (*get_context_loss_count)(struct device *); 45 int (*get_context_loss_count)(struct device *);
46 void (*set_forceidle)(struct device *);
47 void (*set_noidle)(struct device *);
48 void (*enable_wakeup)(struct device *, bool); 46 void (*enable_wakeup)(struct device *, bool);
49}; 47};
50 48
diff --git a/include/linux/platform_data/serial-sccnxp.h b/include/linux/platform_data/serial-sccnxp.h
index 215574d1e81d..bdc510d03245 100644
--- a/include/linux/platform_data/serial-sccnxp.h
+++ b/include/linux/platform_data/serial-sccnxp.h
@@ -86,10 +86,6 @@ struct sccnxp_pdata {
86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS]; 86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS];
87 /* Timer value for polling mode (usecs) */ 87 /* Timer value for polling mode (usecs) */
88 const unsigned int poll_time_us; 88 const unsigned int poll_time_us;
89 /* Called during startup */
90 void (*init)(void);
91 /* Called before finish */
92 void (*exit)(void);
93}; 89};
94 90
95#endif 91#endif
diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h
new file mode 100644
index 000000000000..92dabcaf6499
--- /dev/null
+++ b/include/linux/platform_data/si5351.h
@@ -0,0 +1,114 @@
1/*
2 * Si5351A/B/C programmable clock generator platform_data.
3 */
4
5#ifndef __LINUX_PLATFORM_DATA_SI5351_H__
6#define __LINUX_PLATFORM_DATA_SI5351_H__
7
8struct clk;
9
10/**
11 * enum si5351_variant - SiLabs Si5351 chip variant
12 * @SI5351_VARIANT_A: Si5351A (8 output clocks, XTAL input)
13 * @SI5351_VARIANT_A3: Si5351A MSOP10 (3 output clocks, XTAL input)
14 * @SI5351_VARIANT_B: Si5351B (8 output clocks, XTAL/VXCO input)
15 * @SI5351_VARIANT_C: Si5351C (8 output clocks, XTAL/CLKIN input)
16 */
17enum si5351_variant {
18 SI5351_VARIANT_A = 1,
19 SI5351_VARIANT_A3 = 2,
20 SI5351_VARIANT_B = 3,
21 SI5351_VARIANT_C = 4,
22};
23
24/**
25 * enum si5351_pll_src - Si5351 pll clock source
26 * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config
27 * @SI5351_PLL_SRC_XTAL: pll source clock is XTAL input
28 * @SI5351_PLL_SRC_CLKIN: pll source clock is CLKIN input (Si5351C only)
29 */
30enum si5351_pll_src {
31 SI5351_PLL_SRC_DEFAULT = 0,
32 SI5351_PLL_SRC_XTAL = 1,
33 SI5351_PLL_SRC_CLKIN = 2,
34};
35
36/**
37 * enum si5351_multisynth_src - Si5351 multisynth clock source
38 * @SI5351_MULTISYNTH_SRC_DEFAULT: default, do not change eeprom config
39 * @SI5351_MULTISYNTH_SRC_VCO0: multisynth source clock is VCO0
40 * @SI5351_MULTISYNTH_SRC_VCO1: multisynth source clock is VCO1/VXCO
41 */
42enum si5351_multisynth_src {
43 SI5351_MULTISYNTH_SRC_DEFAULT = 0,
44 SI5351_MULTISYNTH_SRC_VCO0 = 1,
45 SI5351_MULTISYNTH_SRC_VCO1 = 2,
46};
47
48/**
49 * enum si5351_clkout_src - Si5351 clock output clock source
50 * @SI5351_CLKOUT_SRC_DEFAULT: default, do not change eeprom config
51 * @SI5351_CLKOUT_SRC_MSYNTH_N: clkout N source clock is multisynth N
52 * @SI5351_CLKOUT_SRC_MSYNTH_0_4: clkout N source clock is multisynth 0 (N<4)
53 * or 4 (N>=4)
54 * @SI5351_CLKOUT_SRC_XTAL: clkout N source clock is XTAL
55 * @SI5351_CLKOUT_SRC_CLKIN: clkout N source clock is CLKIN (Si5351C only)
56 */
57enum si5351_clkout_src {
58 SI5351_CLKOUT_SRC_DEFAULT = 0,
59 SI5351_CLKOUT_SRC_MSYNTH_N = 1,
60 SI5351_CLKOUT_SRC_MSYNTH_0_4 = 2,
61 SI5351_CLKOUT_SRC_XTAL = 3,
62 SI5351_CLKOUT_SRC_CLKIN = 4,
63};
64
65/**
66 * enum si5351_drive_strength - Si5351 clock output drive strength
67 * @SI5351_DRIVE_DEFAULT: default, do not change eeprom config
68 * @SI5351_DRIVE_2MA: 2mA clock output drive strength
69 * @SI5351_DRIVE_4MA: 4mA clock output drive strength
70 * @SI5351_DRIVE_6MA: 6mA clock output drive strength
71 * @SI5351_DRIVE_8MA: 8mA clock output drive strength
72 */
73enum si5351_drive_strength {
74 SI5351_DRIVE_DEFAULT = 0,
75 SI5351_DRIVE_2MA = 2,
76 SI5351_DRIVE_4MA = 4,
77 SI5351_DRIVE_6MA = 6,
78 SI5351_DRIVE_8MA = 8,
79};
80
81/**
82 * struct si5351_clkout_config - Si5351 clock output configuration
83 * @clkout: clkout number
84 * @multisynth_src: multisynth source clock
85 * @clkout_src: clkout source clock
86 * @pll_master: if true, clkout can also change pll rate
87 * @drive: output drive strength
88 * @rate: initial clkout rate, or default if 0
89 */
90struct si5351_clkout_config {
91 enum si5351_multisynth_src multisynth_src;
92 enum si5351_clkout_src clkout_src;
93 enum si5351_drive_strength drive;
94 bool pll_master;
95 unsigned long rate;
96};
97
98/**
99 * struct si5351_platform_data - Platform data for the Si5351 clock driver
100 * @variant: Si5351 chip variant
101 * @clk_xtal: xtal input clock
102 * @clk_clkin: clkin input clock
103 * @pll_src: array of pll source clock setting
104 * @clkout: array of clkout configuration
105 */
106struct si5351_platform_data {
107 enum si5351_variant variant;
108 struct clk *clk_xtal;
109 struct clk *clk_clkin;
110 enum si5351_pll_src pll_src[2];
111 struct si5351_clkout_config clkout[8];
112};
113
114#endif
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
index ceba18d23a5a..8447f634c7f5 100644
--- a/include/linux/platform_data/spi-s3c64xx.h
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -11,6 +11,8 @@
11#ifndef __S3C64XX_PLAT_SPI_H 11#ifndef __S3C64XX_PLAT_SPI_H
12#define __S3C64XX_PLAT_SPI_H 12#define __S3C64XX_PLAT_SPI_H
13 13
14#include <linux/dmaengine.h>
15
14struct platform_device; 16struct platform_device;
15 17
16/** 18/**
@@ -38,6 +40,7 @@ struct s3c64xx_spi_info {
38 int src_clk_nr; 40 int src_clk_nr;
39 int num_cs; 41 int num_cs;
40 int (*cfg_gpio)(void); 42 int (*cfg_gpio)(void);
43 dma_filter_fn filter;
41}; 44};
42 45
43/** 46/**
diff --git a/include/linux/platform_data/st1232_pdata.h b/include/linux/platform_data/st1232_pdata.h
new file mode 100644
index 000000000000..cac3e7b4c454
--- /dev/null
+++ b/include/linux/platform_data/st1232_pdata.h
@@ -0,0 +1,13 @@
1#ifndef _LINUX_ST1232_PDATA_H
2#define _LINUX_ST1232_PDATA_H
3
4/*
5 * Optional platform data
6 *
7 * Use this if you want the driver to drive the reset pin.
8 */
9struct st1232_pdata {
10 int reset_gpio;
11};
12
13#endif
diff --git a/include/linux/platform_data/usb-exynos.h b/include/linux/platform_data/usb-ohci-exynos.h
index c256c595be5e..c256c595be5e 100644
--- a/include/linux/platform_data/usb-exynos.h
+++ b/include/linux/platform_data/usb-ohci-exynos.h
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index c082c71f7225..9abf1db6aea6 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -20,12 +20,12 @@
20struct mfd_cell; 20struct mfd_cell;
21 21
22struct platform_device { 22struct platform_device {
23 const char * name; 23 const char *name;
24 int id; 24 int id;
25 bool id_auto; 25 bool id_auto;
26 struct device dev; 26 struct device dev;
27 u32 num_resources; 27 u32 num_resources;
28 struct resource * resource; 28 struct resource *resource;
29 29
30 const struct platform_device_id *id_entry; 30 const struct platform_device_id *id_entry;
31 31
@@ -47,9 +47,12 @@ extern struct bus_type platform_bus_type;
47extern struct device platform_bus; 47extern struct device platform_bus;
48 48
49extern void arch_setup_pdev_archdata(struct platform_device *); 49extern void arch_setup_pdev_archdata(struct platform_device *);
50extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); 50extern struct resource *platform_get_resource(struct platform_device *,
51 unsigned int, unsigned int);
51extern int platform_get_irq(struct platform_device *, unsigned int); 52extern int platform_get_irq(struct platform_device *, unsigned int);
52extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *); 53extern struct resource *platform_get_resource_byname(struct platform_device *,
54 unsigned int,
55 const char *);
53extern int platform_get_irq_byname(struct platform_device *, const char *); 56extern int platform_get_irq_byname(struct platform_device *, const char *);
54extern int platform_add_devices(struct platform_device **, int); 57extern int platform_add_devices(struct platform_device **, int);
55 58
@@ -161,7 +164,8 @@ extern struct platform_device *platform_device_alloc(const char *name, int id);
161extern int platform_device_add_resources(struct platform_device *pdev, 164extern int platform_device_add_resources(struct platform_device *pdev,
162 const struct resource *res, 165 const struct resource *res,
163 unsigned int num); 166 unsigned int num);
164extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); 167extern int platform_device_add_data(struct platform_device *pdev,
168 const void *data, size_t size);
165extern int platform_device_add(struct platform_device *pdev); 169extern int platform_device_add(struct platform_device *pdev);
166extern void platform_device_del(struct platform_device *pdev); 170extern void platform_device_del(struct platform_device *pdev);
167extern void platform_device_put(struct platform_device *pdev); 171extern void platform_device_put(struct platform_device *pdev);
@@ -190,7 +194,8 @@ static inline void *platform_get_drvdata(const struct platform_device *pdev)
190 return dev_get_drvdata(&pdev->dev); 194 return dev_get_drvdata(&pdev->dev);
191} 195}
192 196
193static inline void platform_set_drvdata(struct platform_device *pdev, void *data) 197static inline void platform_set_drvdata(struct platform_device *pdev,
198 void *data)
194{ 199{
195 dev_set_drvdata(&pdev->dev, data); 200 dev_set_drvdata(&pdev->dev, data);
196} 201}
@@ -222,10 +227,10 @@ static void __exit __platform_driver##_exit(void) \
222} \ 227} \
223module_exit(__platform_driver##_exit); 228module_exit(__platform_driver##_exit);
224 229
225extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 230extern struct platform_device *platform_create_bundle(
226 int (*probe)(struct platform_device *), 231 struct platform_driver *driver, int (*probe)(struct platform_device *),
227 struct resource *res, unsigned int n_res, 232 struct resource *res, unsigned int n_res,
228 const void *data, size_t size); 233 const void *data, size_t size);
229 234
230/* early platform driver interface */ 235/* early platform driver interface */
231struct early_platform_driver { 236struct early_platform_driver {
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e5d7230332a4..a224c7f5c377 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -34,6 +34,19 @@
34extern void (*pm_power_off)(void); 34extern void (*pm_power_off)(void);
35extern void (*pm_power_off_prepare)(void); 35extern void (*pm_power_off_prepare)(void);
36 36
37struct device; /* we have a circular dep with device.h */
38#ifdef CONFIG_VT_CONSOLE_SLEEP
39extern void pm_vt_switch_required(struct device *dev, bool required);
40extern void pm_vt_switch_unregister(struct device *dev);
41#else
42static inline void pm_vt_switch_required(struct device *dev, bool required)
43{
44}
45static inline void pm_vt_switch_unregister(struct device *dev)
46{
47}
48#endif /* CONFIG_VT_CONSOLE_SLEEP */
49
37/* 50/*
38 * Device power management 51 * Device power management
39 */ 52 */
diff --git a/include/linux/pm2301_charger.h b/include/linux/pm2301_charger.h
index fc3f026922ae..85c16defe11a 100644
--- a/include/linux/pm2301_charger.h
+++ b/include/linux/pm2301_charger.h
@@ -48,7 +48,7 @@ struct pm2xxx_charger_platform_data {
48 size_t num_supplicants; 48 size_t num_supplicants;
49 int i2c_bus; 49 int i2c_bus;
50 const char *label; 50 const char *label;
51 int irq_number; 51 int gpio_irq_number;
52 unsigned int lpn_gpio; 52 unsigned int lpn_gpio;
53 int irq_type; 53 int irq_type;
54}; 54};
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 042058fdb0af..7794d75ed155 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -55,6 +55,7 @@ struct cpu_timer_list {
55/* POSIX.1b interval timer structure. */ 55/* POSIX.1b interval timer structure. */
56struct k_itimer { 56struct k_itimer {
57 struct list_head list; /* free/ allocate list */ 57 struct list_head list; /* free/ allocate list */
58 struct hlist_node t_hash;
58 spinlock_t it_lock; 59 spinlock_t it_lock;
59 clockid_t it_clock; /* which timer type */ 60 clockid_t it_clock; /* which timer type */
60 timer_t it_id; /* timer id */ 61 timer_t it_id; /* timer id */
@@ -122,6 +123,8 @@ void run_posix_cpu_timers(struct task_struct *task);
122void posix_cpu_timers_exit(struct task_struct *task); 123void posix_cpu_timers_exit(struct task_struct *task);
123void posix_cpu_timers_exit_group(struct task_struct *task); 124void posix_cpu_timers_exit_group(struct task_struct *task);
124 125
126bool posix_cpu_timers_can_stop_tick(struct task_struct *tsk);
127
125void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, 128void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
126 cputime_t *newval, cputime_t *oldval); 129 cputime_t *newval, cputime_t *oldval);
127 130
diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h
new file mode 100644
index 000000000000..cdbb6c2a8c51
--- /dev/null
+++ b/include/linux/power/ab8500.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) ST-Ericsson 2013
3 * Author: Hongbo Zhang <hongbo.zhang@linaro.com>
4 * License terms: GNU General Public License v2
5 */
6
7#ifndef PWR_AB8500_H
8#define PWR_AB8500_H
9
10extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[];
11extern const int ab8500_temp_tbl_a_size;
12
13extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[];
14extern const int ab8500_temp_tbl_b_size;
15
16#endif /* PWR_AB8500_H */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 002a99f96331..3828cefb4f65 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -171,6 +171,12 @@ struct power_supply {
171 char **supplied_to; 171 char **supplied_to;
172 size_t num_supplicants; 172 size_t num_supplicants;
173 173
174 char **supplied_from;
175 size_t num_supplies;
176#ifdef CONFIG_OF
177 struct device_node *of_node;
178#endif
179
174 int (*get_property)(struct power_supply *psy, 180 int (*get_property)(struct power_supply *psy,
175 enum power_supply_property psp, 181 enum power_supply_property psp,
176 union power_supply_propval *val); 182 union power_supply_propval *val);
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 822171fcb1c8..22c7052e9372 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -1,8 +1,10 @@
1#ifndef __KERNEL_PRINTK__ 1#ifndef __KERNEL_PRINTK__
2#define __KERNEL_PRINTK__ 2#define __KERNEL_PRINTK__
3 3
4#include <stdarg.h>
4#include <linux/init.h> 5#include <linux/init.h>
5#include <linux/kern_levels.h> 6#include <linux/kern_levels.h>
7#include <linux/linkage.h>
6 8
7extern const char linux_banner[]; 9extern const char linux_banner[];
8extern const char linux_proc_banner[]; 10extern const char linux_proc_banner[];
@@ -95,8 +97,14 @@ int no_printk(const char *fmt, ...)
95 return 0; 97 return 0;
96} 98}
97 99
100#ifdef CONFIG_EARLY_PRINTK
98extern asmlinkage __printf(1, 2) 101extern asmlinkage __printf(1, 2)
99void early_printk(const char *fmt, ...); 102void early_printk(const char *fmt, ...);
103void early_vprintk(const char *fmt, va_list ap);
104#else
105static inline __printf(1, 2) __cold
106void early_printk(const char *s, ...) { }
107#endif
100 108
101#ifdef CONFIG_PRINTK 109#ifdef CONFIG_PRINTK
102asmlinkage __printf(5, 0) 110asmlinkage __printf(5, 0)
@@ -138,6 +146,9 @@ extern void wake_up_klogd(void);
138 146
139void log_buf_kexec_setup(void); 147void log_buf_kexec_setup(void);
140void __init setup_log_buf(int early); 148void __init setup_log_buf(int early);
149void dump_stack_set_arch_desc(const char *fmt, ...);
150void dump_stack_print_info(const char *log_lvl);
151void show_regs_print_info(const char *log_lvl);
141#else 152#else
142static inline __printf(1, 0) 153static inline __printf(1, 0)
143int vprintk(const char *s, va_list args) 154int vprintk(const char *s, va_list args)
@@ -175,6 +186,18 @@ static inline void log_buf_kexec_setup(void)
175static inline void setup_log_buf(int early) 186static inline void setup_log_buf(int early)
176{ 187{
177} 188}
189
190static inline void dump_stack_set_arch_desc(const char *fmt, ...)
191{
192}
193
194static inline void dump_stack_print_info(const char *log_lvl)
195{
196}
197
198static inline void show_regs_print_info(const char *log_lvl)
199{
200}
178#endif 201#endif
179 202
180extern void dump_stack(void) __cold; 203extern void dump_stack(void) __cold;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 94dfb2aa5533..608e60a74c3c 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -1,318 +1,79 @@
1#ifndef _LINUX_PROC_FS_H
2#define _LINUX_PROC_FS_H
3
4#include <linux/slab.h>
5#include <linux/fs.h>
6#include <linux/spinlock.h>
7#include <linux/magic.h>
8#include <linux/atomic.h>
9
10struct net;
11struct completion;
12struct mm_struct;
13
14/* 1/*
15 * The proc filesystem constants/structures 2 * The proc filesystem constants/structures
16 */ 3 */
4#ifndef _LINUX_PROC_FS_H
5#define _LINUX_PROC_FS_H
17 6
18/* 7#include <linux/types.h>
19 * Offset of the first process in the /proc root directory.. 8#include <linux/fs.h>
20 */
21#define FIRST_PROCESS_ENTRY 256
22
23/* Worst case buffer size needed for holding an integer. */
24#define PROC_NUMBUF 13
25
26/*
27 * We always define these enumerators
28 */
29
30enum {
31 PROC_ROOT_INO = 1,
32 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
33 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
34 PROC_USER_INIT_INO = 0xEFFFFFFDU,
35 PROC_PID_INIT_INO = 0xEFFFFFFCU,
36};
37
38/*
39 * This is not completely implemented yet. The idea is to
40 * create an in-memory tree (like the actual /proc filesystem
41 * tree) of these proc_dir_entries, so that we can dynamically
42 * add new files to /proc.
43 *
44 * The "next" pointer creates a linked list of one /proc directory,
45 * while parent/subdir create the directory structure (every
46 * /proc file has a parent, but "subdir" is NULL for all
47 * non-directory entries).
48 */
49
50typedef int (read_proc_t)(char *page, char **start, off_t off,
51 int count, int *eof, void *data);
52typedef int (write_proc_t)(struct file *file, const char __user *buffer,
53 unsigned long count, void *data);
54
55struct proc_dir_entry {
56 unsigned int low_ino;
57 umode_t mode;
58 nlink_t nlink;
59 kuid_t uid;
60 kgid_t gid;
61 loff_t size;
62 const struct inode_operations *proc_iops;
63 /*
64 * NULL ->proc_fops means "PDE is going away RSN" or
65 * "PDE is just created". In either case, e.g. ->read_proc won't be
66 * called because it's too late or too early, respectively.
67 *
68 * If you're allocating ->proc_fops dynamically, save a pointer
69 * somewhere.
70 */
71 const struct file_operations *proc_fops;
72 struct proc_dir_entry *next, *parent, *subdir;
73 void *data;
74 read_proc_t *read_proc;
75 write_proc_t *write_proc;
76 atomic_t count; /* use count */
77 int pde_users; /* number of callers into module in progress */
78 struct completion *pde_unload_completion;
79 struct list_head pde_openers; /* who did ->open, but not ->release */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 u8 namelen;
82 char name[];
83};
84
85enum kcore_type {
86 KCORE_TEXT,
87 KCORE_VMALLOC,
88 KCORE_RAM,
89 KCORE_VMEMMAP,
90 KCORE_OTHER,
91};
92
93struct kcore_list {
94 struct list_head list;
95 unsigned long addr;
96 size_t size;
97 int type;
98};
99 9
100struct vmcore { 10struct proc_dir_entry;
101 struct list_head list;
102 unsigned long long paddr;
103 unsigned long long size;
104 loff_t offset;
105};
106 11
107#ifdef CONFIG_PROC_FS 12#ifdef CONFIG_PROC_FS
108 13
109extern void proc_root_init(void); 14extern void proc_root_init(void);
110 15extern void proc_flush_task(struct task_struct *);
111void proc_flush_task(struct task_struct *task);
112
113extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
114 struct proc_dir_entry *parent);
115struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
116 struct proc_dir_entry *parent,
117 const struct file_operations *proc_fops,
118 void *data);
119extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
120extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent);
121
122struct pid_namespace;
123
124extern int pid_ns_prepare_proc(struct pid_namespace *ns);
125extern void pid_ns_release_proc(struct pid_namespace *ns);
126
127/*
128 * proc_tty.c
129 */
130struct tty_driver;
131#ifdef CONFIG_TTY
132extern void proc_tty_init(void);
133#else
134static inline void proc_tty_init(void)
135{ }
136#endif
137extern void proc_tty_register_driver(struct tty_driver *driver);
138extern void proc_tty_unregister_driver(struct tty_driver *driver);
139
140/*
141 * proc_devtree.c
142 */
143#ifdef CONFIG_PROC_DEVICETREE
144struct device_node;
145struct property;
146extern void proc_device_tree_init(void);
147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
149extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
150 struct property *prop);
151extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
152 struct property *newprop,
153 struct property *oldprop);
154#endif /* CONFIG_PROC_DEVICETREE */
155 16
156extern struct proc_dir_entry *proc_symlink(const char *, 17extern struct proc_dir_entry *proc_symlink(const char *,
157 struct proc_dir_entry *, const char *); 18 struct proc_dir_entry *, const char *);
158extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 19extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *);
159extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, 20extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
160 struct proc_dir_entry *parent); 21 struct proc_dir_entry *, void *);
161 22extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t,
162static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, 23 struct proc_dir_entry *);
163 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 24
25extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
26 struct proc_dir_entry *,
27 const struct file_operations *,
28 void *);
29
30static inline struct proc_dir_entry *proc_create(
31 const char *name, umode_t mode, struct proc_dir_entry *parent,
32 const struct file_operations *proc_fops)
164{ 33{
165 return proc_create_data(name, mode, parent, proc_fops, NULL); 34 return proc_create_data(name, mode, parent, proc_fops, NULL);
166} 35}
167 36
168static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 37extern void proc_set_size(struct proc_dir_entry *, loff_t);
169 umode_t mode, struct proc_dir_entry *base, 38extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
170 read_proc_t *read_proc, void * data) 39extern void *PDE_DATA(const struct inode *);
171{ 40extern void *proc_get_parent_data(const struct inode *);
172 struct proc_dir_entry *res=create_proc_entry(name,mode,base); 41extern void proc_remove(struct proc_dir_entry *);
173 if (res) { 42extern void remove_proc_entry(const char *, struct proc_dir_entry *);
174 res->read_proc=read_proc; 43extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
175 res->data=data;
176 }
177 return res;
178}
179
180extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
181 struct proc_dir_entry *parent);
182
183extern struct file *proc_ns_fget(int fd);
184extern bool proc_ns_inode(struct inode *inode);
185 44
186extern int proc_alloc_inum(unsigned int *pino); 45#else /* CONFIG_PROC_FS */
187extern void proc_free_inum(unsigned int inum);
188#else
189 46
190static inline void proc_flush_task(struct task_struct *task) 47static inline void proc_flush_task(struct task_struct *task)
191{ 48{
192} 49}
193 50
194static inline struct proc_dir_entry *create_proc_entry(const char *name,
195 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
196
197#define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; })
198
199static inline struct proc_dir_entry *proc_create_data(const char *name,
200 umode_t mode, struct proc_dir_entry *parent,
201 const struct file_operations *proc_fops, void *data)
202{
203 return NULL;
204}
205#define remove_proc_entry(name, parent) do {} while (0)
206#define remove_proc_subtree(name, parent) do {} while (0)
207
208static inline struct proc_dir_entry *proc_symlink(const char *name, 51static inline struct proc_dir_entry *proc_symlink(const char *name,
209 struct proc_dir_entry *parent,const char *dest) {return NULL;} 52 struct proc_dir_entry *parent,const char *dest) { return NULL;}
210static inline struct proc_dir_entry *proc_mkdir(const char *name, 53static inline struct proc_dir_entry *proc_mkdir(const char *name,
211 struct proc_dir_entry *parent) {return NULL;} 54 struct proc_dir_entry *parent) {return NULL;}
55static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
56 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
212static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 57static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
213 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 58 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
59#define proc_create(name, mode, parent, proc_fops) ({NULL;})
60#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
214 61
215static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 62static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
216 umode_t mode, struct proc_dir_entry *base, 63static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
217 read_proc_t *read_proc, void * data) { return NULL; } 64static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
218 65static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; }
219struct tty_driver;
220static inline void proc_tty_register_driver(struct tty_driver *driver) {};
221static inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
222 66
223static inline int pid_ns_prepare_proc(struct pid_namespace *ns) 67static inline void proc_remove(struct proc_dir_entry *de) {}
224{ 68#define remove_proc_entry(name, parent) do {} while (0)
225 return 0; 69static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
226}
227
228static inline void pid_ns_release_proc(struct pid_namespace *ns)
229{
230}
231
232static inline struct file *proc_ns_fget(int fd)
233{
234 return ERR_PTR(-EINVAL);
235}
236
237static inline bool proc_ns_inode(struct inode *inode)
238{
239 return false;
240}
241 70
242static inline int proc_alloc_inum(unsigned int *inum)
243{
244 *inum = 1;
245 return 0;
246}
247static inline void proc_free_inum(unsigned int inum)
248{
249}
250#endif /* CONFIG_PROC_FS */ 71#endif /* CONFIG_PROC_FS */
251 72
252#if !defined(CONFIG_PROC_KCORE) 73static inline struct proc_dir_entry *proc_net_mkdir(
253static inline void 74 struct net *net, const char *name, struct proc_dir_entry *parent)
254kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
255{ 75{
76 return proc_mkdir_data(name, 0, parent, net);
256} 77}
257#else
258extern void kclist_add(struct kcore_list *, void *, size_t, int type);
259#endif
260
261struct nsproxy;
262struct proc_ns_operations {
263 const char *name;
264 int type;
265 void *(*get)(struct task_struct *task);
266 void (*put)(void *ns);
267 int (*install)(struct nsproxy *nsproxy, void *ns);
268 unsigned int (*inum)(void *ns);
269};
270extern const struct proc_ns_operations netns_operations;
271extern const struct proc_ns_operations utsns_operations;
272extern const struct proc_ns_operations ipcns_operations;
273extern const struct proc_ns_operations pidns_operations;
274extern const struct proc_ns_operations userns_operations;
275extern const struct proc_ns_operations mntns_operations;
276
277union proc_op {
278 int (*proc_get_link)(struct dentry *, struct path *);
279 int (*proc_read)(struct task_struct *task, char *page);
280 int (*proc_show)(struct seq_file *m,
281 struct pid_namespace *ns, struct pid *pid,
282 struct task_struct *task);
283};
284
285struct ctl_table_header;
286struct ctl_table;
287
288struct proc_inode {
289 struct pid *pid;
290 int fd;
291 union proc_op op;
292 struct proc_dir_entry *pde;
293 struct ctl_table_header *sysctl;
294 struct ctl_table *sysctl_entry;
295 void *ns;
296 const struct proc_ns_operations *ns_ops;
297 struct inode vfs_inode;
298};
299
300static inline struct proc_inode *PROC_I(const struct inode *inode)
301{
302 return container_of(inode, struct proc_inode, vfs_inode);
303}
304
305static inline struct proc_dir_entry *PDE(const struct inode *inode)
306{
307 return PROC_I(inode)->pde;
308}
309
310static inline struct net *PDE_NET(struct proc_dir_entry *pde)
311{
312 return pde->parent->data;
313}
314
315#include <linux/signal.h>
316 78
317void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set);
318#endif /* _LINUX_PROC_FS_H */ 79#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
new file mode 100644
index 000000000000..34a1e105bef4
--- /dev/null
+++ b/include/linux/proc_ns.h
@@ -0,0 +1,74 @@
1/*
2 * procfs namespace bits
3 */
4#ifndef _LINUX_PROC_NS_H
5#define _LINUX_PROC_NS_H
6
7struct pid_namespace;
8struct nsproxy;
9
10struct proc_ns_operations {
11 const char *name;
12 int type;
13 void *(*get)(struct task_struct *task);
14 void (*put)(void *ns);
15 int (*install)(struct nsproxy *nsproxy, void *ns);
16 unsigned int (*inum)(void *ns);
17};
18
19struct proc_ns {
20 void *ns;
21 const struct proc_ns_operations *ns_ops;
22};
23
24extern const struct proc_ns_operations netns_operations;
25extern const struct proc_ns_operations utsns_operations;
26extern const struct proc_ns_operations ipcns_operations;
27extern const struct proc_ns_operations pidns_operations;
28extern const struct proc_ns_operations userns_operations;
29extern const struct proc_ns_operations mntns_operations;
30
31/*
32 * We always define these enumerators
33 */
34enum {
35 PROC_ROOT_INO = 1,
36 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
37 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
38 PROC_USER_INIT_INO = 0xEFFFFFFDU,
39 PROC_PID_INIT_INO = 0xEFFFFFFCU,
40};
41
42#ifdef CONFIG_PROC_FS
43
44extern int pid_ns_prepare_proc(struct pid_namespace *ns);
45extern void pid_ns_release_proc(struct pid_namespace *ns);
46extern struct file *proc_ns_fget(int fd);
47extern struct proc_ns *get_proc_ns(struct inode *);
48extern int proc_alloc_inum(unsigned int *pino);
49extern void proc_free_inum(unsigned int inum);
50extern bool proc_ns_inode(struct inode *inode);
51
52#else /* CONFIG_PROC_FS */
53
54static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; }
55static inline void pid_ns_release_proc(struct pid_namespace *ns) {}
56
57static inline struct file *proc_ns_fget(int fd)
58{
59 return ERR_PTR(-EINVAL);
60}
61
62static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; }
63
64static inline int proc_alloc_inum(unsigned int *inum)
65{
66 *inum = 1;
67 return 0;
68}
69static inline void proc_free_inum(unsigned int inum) {}
70static inline bool proc_ns_inode(struct inode *inode) { return false; }
71
72#endif /* CONFIG_PROC_FS */
73
74#endif /* _LINUX_PROC_NS_H */
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 21123902366d..aaad3861beb8 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -18,10 +18,10 @@ struct pt_regs;
18struct notifier_block; 18struct notifier_block;
19 19
20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) 20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
21void create_prof_cpu_mask(struct proc_dir_entry *de); 21void create_prof_cpu_mask(void);
22int create_proc_profile(void); 22int create_proc_profile(void);
23#else 23#else
24static inline void create_prof_cpu_mask(struct proc_dir_entry *de) 24static inline void create_prof_cpu_mask(void)
25{ 25{
26} 26}
27 27
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index cb6ab5feab67..9974975d40db 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -26,6 +26,13 @@
26struct persistent_ram_buffer; 26struct persistent_ram_buffer;
27struct rs_control; 27struct rs_control;
28 28
29struct persistent_ram_ecc_info {
30 int block_size;
31 int ecc_size;
32 int symsize;
33 int poly;
34};
35
29struct persistent_ram_zone { 36struct persistent_ram_zone {
30 phys_addr_t paddr; 37 phys_addr_t paddr;
31 size_t size; 38 size_t size;
@@ -39,15 +46,14 @@ struct persistent_ram_zone {
39 struct rs_control *rs_decoder; 46 struct rs_control *rs_decoder;
40 int corrected_bytes; 47 int corrected_bytes;
41 int bad_blocks; 48 int bad_blocks;
42 int ecc_block_size; 49 struct persistent_ram_ecc_info ecc_info;
43 int ecc_size;
44 50
45 char *old_log; 51 char *old_log;
46 size_t old_log_size; 52 size_t old_log_size;
47}; 53};
48 54
49struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, 55struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
50 u32 sig, int ecc_size); 56 u32 sig, struct persistent_ram_ecc_info *ecc_info);
51void persistent_ram_free(struct persistent_ram_zone *prz); 57void persistent_ram_free(struct persistent_ram_zone *prz);
52void persistent_ram_zap(struct persistent_ram_zone *prz); 58void persistent_ram_zap(struct persistent_ram_zone *prz);
53 59
@@ -74,7 +80,7 @@ struct ramoops_platform_data {
74 unsigned long console_size; 80 unsigned long console_size;
75 unsigned long ftrace_size; 81 unsigned long ftrace_size;
76 int dump_oops; 82 int dump_oops;
77 int ecc_size; 83 struct persistent_ram_ecc_info ecc_info;
78}; 84};
79 85
80#endif 86#endif
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 5bf5500db83d..69e37c2d1ea5 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -6,7 +6,13 @@ struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
6extern struct dentry *ramfs_mount(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data); 7 int flags, const char *dev_name, void *data);
8 8
9#ifndef CONFIG_MMU 9#ifdef CONFIG_MMU
10static inline int
11ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
12{
13 return 0;
14}
15#else
10extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); 16extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
11extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, 17extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
12 unsigned long addr, 18 unsigned long addr,
diff --git a/include/linux/random.h b/include/linux/random.h
index 347ce553a306..3b9377d6b7a5 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -29,13 +29,6 @@ u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 29void prandom_bytes(void *buf, int nbytes);
30void prandom_seed(u32 seed); 30void prandom_seed(u32 seed);
31 31
32/*
33 * These macros are preserved for backward compatibility and should be
34 * removed as soon as a transition is finished.
35 */
36#define random32() prandom_u32()
37#define srandom32(seed) prandom_seed(seed)
38
39u32 prandom_u32_state(struct rnd_state *); 32u32 prandom_u32_state(struct rnd_state *);
40void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 33void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
41 34
diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h
index cf1244fbf3b6..4f216c59e7db 100644
--- a/include/linux/rculist_bl.h
+++ b/include/linux/rculist_bl.h
@@ -20,7 +20,7 @@ static inline void hlist_bl_set_first_rcu(struct hlist_bl_head *h,
20static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h) 20static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h)
21{ 21{
22 return (struct hlist_bl_node *) 22 return (struct hlist_bl_node *)
23 ((unsigned long)rcu_dereference(h->first) & ~LIST_BL_LOCKMASK); 23 ((unsigned long)rcu_dereference_check(h->first, hlist_bl_is_locked(h)) & ~LIST_BL_LOCKMASK);
24} 24}
25 25
26/** 26/**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index b758ce17b309..4ccd68e49b00 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -80,6 +80,7 @@ extern void do_trace_rcu_torture_read(char *rcutorturename,
80#define UINT_CMP_LT(a, b) (UINT_MAX / 2 < (a) - (b)) 80#define UINT_CMP_LT(a, b) (UINT_MAX / 2 < (a) - (b))
81#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) 81#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
82#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b)) 82#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b))
83#define ulong2long(a) (*(long *)(&(a)))
83 84
84/* Exported common interfaces */ 85/* Exported common interfaces */
85 86
@@ -999,4 +1000,11 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
999#define kfree_rcu(ptr, rcu_head) \ 1000#define kfree_rcu(ptr, rcu_head) \
1000 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 1001 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
1001 1002
1003#ifdef CONFIG_RCU_NOCB_CPU
1004extern bool rcu_is_nocb_cpu(int cpu);
1005#else
1006static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1007#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
1008
1009
1002#endif /* __LINUX_RCUPDATE_H */ 1010#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index bf77dfdabef9..02d84e24b7c2 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -389,6 +389,7 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
389 bool *change); 389 bool *change);
390int regmap_get_val_bytes(struct regmap *map); 390int regmap_get_val_bytes(struct regmap *map);
391int regmap_async_complete(struct regmap *map); 391int regmap_async_complete(struct regmap *map);
392bool regmap_can_raw_write(struct regmap *map);
392 393
393int regcache_sync(struct regmap *map); 394int regcache_sync(struct regmap *map);
394int regcache_sync_region(struct regmap *map, unsigned int min, 395int regcache_sync_region(struct regmap *map, unsigned int min,
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 7bd73bbdfd1b..7c5ff0c55773 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -5,11 +5,14 @@
5 * 5 *
6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson 6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson 7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
8 * Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson
8 */ 9 */
9 10
10#ifndef __LINUX_MFD_AB8500_REGULATOR_H 11#ifndef __LINUX_MFD_AB8500_REGULATOR_H
11#define __LINUX_MFD_AB8500_REGULATOR_H 12#define __LINUX_MFD_AB8500_REGULATOR_H
12 13
14#include <linux/platform_device.h>
15
13/* AB8500 regulators */ 16/* AB8500 regulators */
14enum ab8500_regulator_id { 17enum ab8500_regulator_id {
15 AB8500_LDO_AUX1, 18 AB8500_LDO_AUX1,
@@ -17,7 +20,6 @@ enum ab8500_regulator_id {
17 AB8500_LDO_AUX3, 20 AB8500_LDO_AUX3,
18 AB8500_LDO_INTCORE, 21 AB8500_LDO_INTCORE,
19 AB8500_LDO_TVOUT, 22 AB8500_LDO_TVOUT,
20 AB8500_LDO_USB,
21 AB8500_LDO_AUDIO, 23 AB8500_LDO_AUDIO,
22 AB8500_LDO_ANAMIC1, 24 AB8500_LDO_ANAMIC1,
23 AB8500_LDO_ANAMIC2, 25 AB8500_LDO_ANAMIC2,
@@ -26,7 +28,28 @@ enum ab8500_regulator_id {
26 AB8500_NUM_REGULATORS, 28 AB8500_NUM_REGULATORS,
27}; 29};
28 30
29/* AB9450 regulators */ 31/* AB8505 regulators */
32enum ab8505_regulator_id {
33 AB8505_LDO_AUX1,
34 AB8505_LDO_AUX2,
35 AB8505_LDO_AUX3,
36 AB8505_LDO_AUX4,
37 AB8505_LDO_AUX5,
38 AB8505_LDO_AUX6,
39 AB8505_LDO_INTCORE,
40 AB8505_LDO_ADC,
41 AB8505_LDO_USB,
42 AB8505_LDO_AUDIO,
43 AB8505_LDO_ANAMIC1,
44 AB8505_LDO_ANAMIC2,
45 AB8505_LDO_AUX8,
46 AB8505_LDO_ANA,
47 AB8505_SYSCLKREQ_2,
48 AB8505_SYSCLKREQ_4,
49 AB8505_NUM_REGULATORS,
50};
51
52/* AB9540 regulators */
30enum ab9540_regulator_id { 53enum ab9540_regulator_id {
31 AB9540_LDO_AUX1, 54 AB9540_LDO_AUX1,
32 AB9540_LDO_AUX2, 55 AB9540_LDO_AUX2,
@@ -45,16 +68,39 @@ enum ab9540_regulator_id {
45 AB9540_NUM_REGULATORS, 68 AB9540_NUM_REGULATORS,
46}; 69};
47 70
48/* AB8500 and AB9540 register initialization */ 71/* AB8540 regulators */
72enum ab8540_regulator_id {
73 AB8540_LDO_AUX1,
74 AB8540_LDO_AUX2,
75 AB8540_LDO_AUX3,
76 AB8540_LDO_AUX4,
77 AB8540_LDO_AUX5,
78 AB8540_LDO_AUX6,
79 AB8540_LDO_INTCORE,
80 AB8540_LDO_TVOUT,
81 AB8540_LDO_AUDIO,
82 AB8540_LDO_ANAMIC1,
83 AB8540_LDO_ANAMIC2,
84 AB8540_LDO_DMIC,
85 AB8540_LDO_ANA,
86 AB8540_LDO_SDIO,
87 AB8540_SYSCLKREQ_2,
88 AB8540_SYSCLKREQ_4,
89 AB8540_NUM_REGULATORS,
90};
91
92/* AB8500, AB8505, and AB9540 register initialization */
49struct ab8500_regulator_reg_init { 93struct ab8500_regulator_reg_init {
50 int id; 94 int id;
95 u8 mask;
51 u8 value; 96 u8 value;
52}; 97};
53 98
54#define INIT_REGULATOR_REGISTER(_id, _value) \ 99#define INIT_REGULATOR_REGISTER(_id, _mask, _value) \
55 { \ 100 { \
56 .id = _id, \ 101 .id = _id, \
57 .value = _value, \ 102 .mask = _mask, \
103 .value = _value, \
58 } 104 }
59 105
60/* AB8500 registers */ 106/* AB8500 registers */
@@ -86,10 +132,58 @@ enum ab8500_regulator_reg {
86 AB8500_REGUCTRL2SPARE, 132 AB8500_REGUCTRL2SPARE,
87 AB8500_REGUCTRLDISCH, 133 AB8500_REGUCTRLDISCH,
88 AB8500_REGUCTRLDISCH2, 134 AB8500_REGUCTRLDISCH2,
89 AB8500_VSMPS1SEL1,
90 AB8500_NUM_REGULATOR_REGISTERS, 135 AB8500_NUM_REGULATOR_REGISTERS,
91}; 136};
92 137
138/* AB8505 registers */
139enum ab8505_regulator_reg {
140 AB8505_REGUREQUESTCTRL1,
141 AB8505_REGUREQUESTCTRL2,
142 AB8505_REGUREQUESTCTRL3,
143 AB8505_REGUREQUESTCTRL4,
144 AB8505_REGUSYSCLKREQ1HPVALID1,
145 AB8505_REGUSYSCLKREQ1HPVALID2,
146 AB8505_REGUHWHPREQ1VALID1,
147 AB8505_REGUHWHPREQ1VALID2,
148 AB8505_REGUHWHPREQ2VALID1,
149 AB8505_REGUHWHPREQ2VALID2,
150 AB8505_REGUSWHPREQVALID1,
151 AB8505_REGUSWHPREQVALID2,
152 AB8505_REGUSYSCLKREQVALID1,
153 AB8505_REGUSYSCLKREQVALID2,
154 AB8505_REGUVAUX4REQVALID,
155 AB8505_REGUMISC1,
156 AB8505_VAUDIOSUPPLY,
157 AB8505_REGUCTRL1VAMIC,
158 AB8505_VSMPSAREGU,
159 AB8505_VSMPSBREGU,
160 AB8505_VSAFEREGU, /* NOTE! PRCMU register */
161 AB8505_VPLLVANAREGU,
162 AB8505_EXTSUPPLYREGU,
163 AB8505_VAUX12REGU,
164 AB8505_VRF1VAUX3REGU,
165 AB8505_VSMPSASEL1,
166 AB8505_VSMPSASEL2,
167 AB8505_VSMPSASEL3,
168 AB8505_VSMPSBSEL1,
169 AB8505_VSMPSBSEL2,
170 AB8505_VSMPSBSEL3,
171 AB8505_VSAFESEL1, /* NOTE! PRCMU register */
172 AB8505_VSAFESEL2, /* NOTE! PRCMU register */
173 AB8505_VSAFESEL3, /* NOTE! PRCMU register */
174 AB8505_VAUX1SEL,
175 AB8505_VAUX2SEL,
176 AB8505_VRF1VAUX3SEL,
177 AB8505_VAUX4REQCTRL,
178 AB8505_VAUX4REGU,
179 AB8505_VAUX4SEL,
180 AB8505_REGUCTRLDISCH,
181 AB8505_REGUCTRLDISCH2,
182 AB8505_REGUCTRLDISCH3,
183 AB8505_CTRLVAUX5,
184 AB8505_CTRLVAUX6,
185 AB8505_NUM_REGULATOR_REGISTERS,
186};
93 187
94/* AB9540 registers */ 188/* AB9540 registers */
95enum ab9540_regulator_reg { 189enum ab9540_regulator_reg {
@@ -139,4 +233,111 @@ enum ab9540_regulator_reg {
139 AB9540_NUM_REGULATOR_REGISTERS, 233 AB9540_NUM_REGULATOR_REGISTERS,
140}; 234};
141 235
236/* AB8540 registers */
237enum ab8540_regulator_reg {
238 AB8540_REGUREQUESTCTRL1,
239 AB8540_REGUREQUESTCTRL2,
240 AB8540_REGUREQUESTCTRL3,
241 AB8540_REGUREQUESTCTRL4,
242 AB8540_REGUSYSCLKREQ1HPVALID1,
243 AB8540_REGUSYSCLKREQ1HPVALID2,
244 AB8540_REGUHWHPREQ1VALID1,
245 AB8540_REGUHWHPREQ1VALID2,
246 AB8540_REGUHWHPREQ2VALID1,
247 AB8540_REGUHWHPREQ2VALID2,
248 AB8540_REGUSWHPREQVALID1,
249 AB8540_REGUSWHPREQVALID2,
250 AB8540_REGUSYSCLKREQVALID1,
251 AB8540_REGUSYSCLKREQVALID2,
252 AB8540_REGUVAUX4REQVALID,
253 AB8540_REGUVAUX5REQVALID,
254 AB8540_REGUVAUX6REQVALID,
255 AB8540_REGUVCLKBREQVALID,
256 AB8540_REGUVRF1REQVALID,
257 AB8540_REGUMISC1,
258 AB8540_VAUDIOSUPPLY,
259 AB8540_REGUCTRL1VAMIC,
260 AB8540_VHSIC,
261 AB8540_VSDIO,
262 AB8540_VSMPS1REGU,
263 AB8540_VSMPS2REGU,
264 AB8540_VSMPS3REGU,
265 AB8540_VPLLVANAREGU,
266 AB8540_EXTSUPPLYREGU,
267 AB8540_VAUX12REGU,
268 AB8540_VRF1VAUX3REGU,
269 AB8540_VSMPS1SEL1,
270 AB8540_VSMPS1SEL2,
271 AB8540_VSMPS1SEL3,
272 AB8540_VSMPS2SEL1,
273 AB8540_VSMPS2SEL2,
274 AB8540_VSMPS2SEL3,
275 AB8540_VSMPS3SEL1,
276 AB8540_VSMPS3SEL2,
277 AB8540_VAUX1SEL,
278 AB8540_VAUX2SEL,
279 AB8540_VRF1VAUX3SEL,
280 AB8540_REGUCTRL2SPARE,
281 AB8540_VAUX4REQCTRL,
282 AB8540_VAUX4REGU,
283 AB8540_VAUX4SEL,
284 AB8540_VAUX5REQCTRL,
285 AB8540_VAUX5REGU,
286 AB8540_VAUX5SEL,
287 AB8540_VAUX6REQCTRL,
288 AB8540_VAUX6REGU,
289 AB8540_VAUX6SEL,
290 AB8540_VCLKBREQCTRL,
291 AB8540_VCLKBREGU,
292 AB8540_VCLKBSEL,
293 AB8540_VRF1REQCTRL,
294 AB8540_REGUCTRLDISCH,
295 AB8540_REGUCTRLDISCH2,
296 AB8540_REGUCTRLDISCH3,
297 AB8540_REGUCTRLDISCH4,
298 AB8540_VSIMSYSCLKCTRL,
299 AB8540_VANAVPLLSEL,
300 AB8540_NUM_REGULATOR_REGISTERS,
301};
302
303/* AB8500 external regulators */
304struct ab8500_ext_regulator_cfg {
305 bool hwreq; /* requires hw mode or high power mode */
306};
307
308enum ab8500_ext_regulator_id {
309 AB8500_EXT_SUPPLY1,
310 AB8500_EXT_SUPPLY2,
311 AB8500_EXT_SUPPLY3,
312 AB8500_NUM_EXT_REGULATORS,
313};
314
315/* AB8500 regulator platform data */
316struct ab8500_regulator_platform_data {
317 int num_reg_init;
318 struct ab8500_regulator_reg_init *reg_init;
319 int num_regulator;
320 struct regulator_init_data *regulator;
321 int num_ext_regulator;
322 struct regulator_init_data *ext_regulator;
323};
324
325#ifdef CONFIG_REGULATOR_AB8500_DEBUG
326int ab8500_regulator_debug_init(struct platform_device *pdev);
327int ab8500_regulator_debug_exit(struct platform_device *pdev);
328#else
329static inline int ab8500_regulator_debug_init(struct platform_device *pdev)
330{
331 return 0;
332}
333static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
334{
335 return 0;
336}
337#endif
338
339/* AB8500 external regulator functions. */
340int ab8500_ext_regulator_init(struct platform_device *pdev);
341void ab8500_ext_regulator_exit(struct platform_device *pdev);
342
142#endif 343#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 7bc732ce6e50..145022a83085 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -141,18 +141,18 @@ void regulator_put(struct regulator *regulator);
141void devm_regulator_put(struct regulator *regulator); 141void devm_regulator_put(struct regulator *regulator);
142 142
143/* regulator output control and status */ 143/* regulator output control and status */
144int regulator_enable(struct regulator *regulator); 144int __must_check regulator_enable(struct regulator *regulator);
145int regulator_disable(struct regulator *regulator); 145int regulator_disable(struct regulator *regulator);
146int regulator_force_disable(struct regulator *regulator); 146int regulator_force_disable(struct regulator *regulator);
147int regulator_is_enabled(struct regulator *regulator); 147int regulator_is_enabled(struct regulator *regulator);
148int regulator_disable_deferred(struct regulator *regulator, int ms); 148int regulator_disable_deferred(struct regulator *regulator, int ms);
149 149
150int regulator_bulk_get(struct device *dev, int num_consumers, 150int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
151 struct regulator_bulk_data *consumers); 151 struct regulator_bulk_data *consumers);
152int devm_regulator_bulk_get(struct device *dev, int num_consumers, 152int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
153 struct regulator_bulk_data *consumers); 153 struct regulator_bulk_data *consumers);
154int regulator_bulk_enable(int num_consumers, 154int __must_check regulator_bulk_enable(int num_consumers,
155 struct regulator_bulk_data *consumers); 155 struct regulator_bulk_data *consumers);
156int regulator_bulk_disable(int num_consumers, 156int regulator_bulk_disable(int num_consumers,
157 struct regulator_bulk_data *consumers); 157 struct regulator_bulk_data *consumers);
158int regulator_bulk_force_disable(int num_consumers, 158int regulator_bulk_force_disable(int num_consumers,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 7df93f52db08..6700cc94bdd1 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -22,6 +22,7 @@
22struct regmap; 22struct regmap;
23struct regulator_dev; 23struct regulator_dev;
24struct regulator_init_data; 24struct regulator_init_data;
25struct regulator_enable_gpio;
25 26
26enum regulator_status { 27enum regulator_status {
27 REGULATOR_STATUS_OFF, 28 REGULATOR_STATUS_OFF,
@@ -199,6 +200,8 @@ enum regulator_type {
199 * output when using regulator_set_voltage_sel_regmap 200 * output when using regulator_set_voltage_sel_regmap
200 * @enable_reg: Register for control when using regmap enable/disable ops 201 * @enable_reg: Register for control when using regmap enable/disable ops
201 * @enable_mask: Mask for control when using regmap enable/disable ops 202 * @enable_mask: Mask for control when using regmap enable/disable ops
203 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable
204 * when using regulator_enable_regmap and friends APIs.
202 * @bypass_reg: Register for control when using regmap set_bypass 205 * @bypass_reg: Register for control when using regmap set_bypass
203 * @bypass_mask: Mask for control when using regmap set_bypass 206 * @bypass_mask: Mask for control when using regmap set_bypass
204 * 207 *
@@ -228,6 +231,7 @@ struct regulator_desc {
228 unsigned int apply_bit; 231 unsigned int apply_bit;
229 unsigned int enable_reg; 232 unsigned int enable_reg;
230 unsigned int enable_mask; 233 unsigned int enable_mask;
234 bool enable_is_inverted;
231 unsigned int bypass_reg; 235 unsigned int bypass_reg;
232 unsigned int bypass_mask; 236 unsigned int bypass_mask;
233 237
@@ -302,8 +306,7 @@ struct regulator_dev {
302 306
303 struct dentry *debugfs; 307 struct dentry *debugfs;
304 308
305 int ena_gpio; 309 struct regulator_enable_gpio *ena_pin;
306 unsigned int ena_gpio_invert:1;
307 unsigned int ena_gpio_state:1; 310 unsigned int ena_gpio_state:1;
308}; 311};
309 312
@@ -329,6 +332,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
329 int min_uV, int max_uV); 332 int min_uV, int max_uV);
330int regulator_map_voltage_iterate(struct regulator_dev *rdev, 333int regulator_map_voltage_iterate(struct regulator_dev *rdev,
331 int min_uV, int max_uV); 334 int min_uV, int max_uV);
335int regulator_map_voltage_ascend(struct regulator_dev *rdev,
336 int min_uV, int max_uV);
332int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); 337int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
333int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); 338int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
334int regulator_is_enabled_regmap(struct regulator_dev *rdev); 339int regulator_is_enabled_regmap(struct regulator_dev *rdev);
diff --git a/include/linux/regulator/max8952.h b/include/linux/regulator/max8952.h
index 45e42855ad05..4dbb63a1d4ab 100644
--- a/include/linux/regulator/max8952.h
+++ b/include/linux/regulator/max8952.h
@@ -122,13 +122,13 @@ struct max8952_platform_data {
122 int gpio_vid1; 122 int gpio_vid1;
123 int gpio_en; 123 int gpio_en;
124 124
125 u8 default_mode; 125 u32 default_mode;
126 u8 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ 126 u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */
127 127
128 u8 sync_freq; 128 u32 sync_freq;
129 u8 ramp_speed; 129 u32 ramp_speed;
130 130
131 struct regulator_init_data reg_data; 131 struct regulator_init_data *reg_data;
132}; 132};
133 133
134 134
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 91cacc34c159..d7c8359693c6 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -20,9 +20,6 @@
20#include <linux/poll.h> 20#include <linux/poll.h>
21#include <linux/kref.h> 21#include <linux/kref.h>
22 22
23/* Needs a _much_ better name... */
24#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
25
26/* 23/*
27 * Tracks changes to rchan/rchan_buf structs 24 * Tracks changes to rchan/rchan_buf structs
28 */ 25 */
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index faf33324c78f..9e7e745dac55 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -401,6 +401,9 @@ enum rproc_crash_type {
401 * @crash_comp: completion used to sync crash handler and the rproc reload 401 * @crash_comp: completion used to sync crash handler and the rproc reload
402 * @recovery_disabled: flag that state if recovery was disabled 402 * @recovery_disabled: flag that state if recovery was disabled
403 * @max_notifyid: largest allocated notify id. 403 * @max_notifyid: largest allocated notify id.
404 * @table_ptr: pointer to the resource table in effect
405 * @cached_table: copy of the resource table
406 * @table_csum: checksum of the resource table
404 */ 407 */
405struct rproc { 408struct rproc {
406 struct klist_node node; 409 struct klist_node node;
@@ -429,9 +432,13 @@ struct rproc {
429 struct completion crash_comp; 432 struct completion crash_comp;
430 bool recovery_disabled; 433 bool recovery_disabled;
431 int max_notifyid; 434 int max_notifyid;
435 struct resource_table *table_ptr;
436 struct resource_table *cached_table;
437 u32 table_csum;
432}; 438};
433 439
434/* we currently support only two vrings per rvdev */ 440/* we currently support only two vrings per rvdev */
441
435#define RVDEV_NUM_VRINGS 2 442#define RVDEV_NUM_VRINGS 2
436 443
437/** 444/**
@@ -462,16 +469,14 @@ struct rproc_vring {
462 * @rproc: the rproc handle 469 * @rproc: the rproc handle
463 * @vdev: the virio device 470 * @vdev: the virio device
464 * @vring: the vrings for this vdev 471 * @vring: the vrings for this vdev
465 * @dfeatures: virtio device features 472 * @rsc_offset: offset of the vdev's resource entry
466 * @gfeatures: virtio guest features
467 */ 473 */
468struct rproc_vdev { 474struct rproc_vdev {
469 struct list_head node; 475 struct list_head node;
470 struct rproc *rproc; 476 struct rproc *rproc;
471 struct virtio_device vdev; 477 struct virtio_device vdev;
472 struct rproc_vring vring[RVDEV_NUM_VRINGS]; 478 struct rproc_vring vring[RVDEV_NUM_VRINGS];
473 unsigned long dfeatures; 479 u32 rsc_offset;
474 unsigned long gfeatures;
475}; 480};
476 481
477struct rproc *rproc_alloc(struct device *dev, const char *name, 482struct rproc *rproc_alloc(struct device *dev, const char *name,
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index c23099413ad6..96a509b6be04 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -13,7 +13,7 @@
13 * info about what this counter is. 13 * info about what this counter is.
14 */ 14 */
15 15
16#include <linux/cgroup.h> 16#include <linux/spinlock.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18 18
19/* 19/*
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
new file mode 100644
index 000000000000..2f61311ae3e0
--- /dev/null
+++ b/include/linux/reset-controller.h
@@ -0,0 +1,51 @@
1#ifndef _LINUX_RESET_CONTROLLER_H_
2#define _LINUX_RESET_CONTROLLER_H_
3
4#include <linux/list.h>
5
6struct reset_controller_dev;
7
8/**
9 * struct reset_control_ops
10 *
11 * @reset: for self-deasserting resets, does all necessary
12 * things to reset the device
13 * @assert: manually assert the reset line, if supported
14 * @deassert: manually deassert the reset line, if supported
15 */
16struct reset_control_ops {
17 int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
18 int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
19 int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
20};
21
22struct module;
23struct device_node;
24
25/**
26 * struct reset_controller_dev - reset controller entity that might
27 * provide multiple reset controls
28 * @ops: a pointer to device specific struct reset_control_ops
29 * @owner: kernel module of the reset controller driver
30 * @list: internal list of reset controller devices
31 * @of_node: corresponding device tree node as phandle target
32 * @of_reset_n_cells: number of cells in reset line specifiers
33 * @of_xlate: translation function to translate from specifier as found in the
34 * device tree to id as given to the reset control ops
35 * @nr_resets: number of reset controls in this reset controller device
36 */
37struct reset_controller_dev {
38 struct reset_control_ops *ops;
39 struct module *owner;
40 struct list_head list;
41 struct device_node *of_node;
42 int of_reset_n_cells;
43 int (*of_xlate)(struct reset_controller_dev *rcdev,
44 const struct of_phandle_args *reset_spec);
45 unsigned int nr_resets;
46};
47
48int reset_controller_register(struct reset_controller_dev *rcdev);
49void reset_controller_unregister(struct reset_controller_dev *rcdev);
50
51#endif
diff --git a/include/linux/reset.h b/include/linux/reset.h
new file mode 100644
index 000000000000..6082247feab1
--- /dev/null
+++ b/include/linux/reset.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_RESET_H_
2#define _LINUX_RESET_H_
3
4struct device;
5struct reset_control;
6
7int reset_control_reset(struct reset_control *rstc);
8int reset_control_assert(struct reset_control *rstc);
9int reset_control_deassert(struct reset_control *rstc);
10
11struct reset_control *reset_control_get(struct device *dev, const char *id);
12void reset_control_put(struct reset_control *rstc);
13struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
14
15int device_reset(struct device *dev);
16
17#endif
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 1342e69542f3..d69cf637a15a 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -4,6 +4,7 @@
4#include <linux/kmemcheck.h> 4#include <linux/kmemcheck.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/seq_file.h> 6#include <linux/seq_file.h>
7#include <linux/poll.h>
7 8
8struct ring_buffer; 9struct ring_buffer;
9struct ring_buffer_iter; 10struct ring_buffer_iter;
@@ -96,6 +97,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
96 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
97}) 98})
98 99
100void ring_buffer_wait(struct ring_buffer *buffer, int cpu);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table);
103
104
99#define RING_BUFFER_ALL_CPUS -1 105#define RING_BUFFER_ALL_CPUS -1
100 106
101void ring_buffer_free(struct ring_buffer *buffer); 107void ring_buffer_free(struct ring_buffer *buffer);
diff --git a/include/linux/rio.h b/include/linux/rio.h
index a3e784278667..18e099342e6f 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -83,7 +83,6 @@
83 83
84extern struct bus_type rio_bus_type; 84extern struct bus_type rio_bus_type;
85extern struct device rio_bus; 85extern struct device rio_bus;
86extern struct list_head rio_devices; /* list of all devices */
87 86
88struct rio_mport; 87struct rio_mport;
89struct rio_dev; 88struct rio_dev;
@@ -237,6 +236,7 @@ enum rio_phy_type {
237 * @name: Port name string 236 * @name: Port name string
238 * @priv: Master port private data 237 * @priv: Master port private data
239 * @dma: DMA device associated with mport 238 * @dma: DMA device associated with mport
239 * @nscan: RapidIO network enumeration/discovery operations
240 */ 240 */
241struct rio_mport { 241struct rio_mport {
242 struct list_head dbells; /* list of doorbell events */ 242 struct list_head dbells; /* list of doorbell events */
@@ -262,8 +262,14 @@ struct rio_mport {
262#ifdef CONFIG_RAPIDIO_DMA_ENGINE 262#ifdef CONFIG_RAPIDIO_DMA_ENGINE
263 struct dma_device dma; 263 struct dma_device dma;
264#endif 264#endif
265 struct rio_scan *nscan;
265}; 266};
266 267
268/*
269 * Enumeration/discovery control flags
270 */
271#define RIO_SCAN_ENUM_NO_WAIT 0x00000001 /* Do not wait for enum completed */
272
267struct rio_id_table { 273struct rio_id_table {
268 u16 start; /* logical minimal id */ 274 u16 start; /* logical minimal id */
269 u32 max; /* max number of IDs in table */ 275 u32 max; /* max number of IDs in table */
@@ -460,6 +466,16 @@ static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
460} 466}
461#endif /* CONFIG_RAPIDIO_DMA_ENGINE */ 467#endif /* CONFIG_RAPIDIO_DMA_ENGINE */
462 468
469/**
470 * struct rio_scan - RIO enumeration and discovery operations
471 * @enumerate: Callback to perform RapidIO fabric enumeration.
472 * @discover: Callback to perform RapidIO fabric discovery.
473 */
474struct rio_scan {
475 int (*enumerate)(struct rio_mport *mport, u32 flags);
476 int (*discover)(struct rio_mport *mport, u32 flags);
477};
478
463/* Architecture and hardware-specific functions */ 479/* Architecture and hardware-specific functions */
464extern int rio_register_mport(struct rio_mport *); 480extern int rio_register_mport(struct rio_mport *);
465extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 481extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index b75c05920ab5..5059994fe297 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -433,5 +433,6 @@ extern u16 rio_local_get_device_id(struct rio_mport *port);
433extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from); 433extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from);
434extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did, 434extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did,
435 struct rio_dev *from); 435 struct rio_dev *from);
436extern int rio_init_mports(void);
436 437
437#endif /* LINUX_RIO_DRV_H */ 438#endif /* LINUX_RIO_DRV_H */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 580b24c8b8ca..c2c28975293c 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -133,7 +133,13 @@ extern struct rtc_device *rtc_device_register(const char *name,
133 struct device *dev, 133 struct device *dev,
134 const struct rtc_class_ops *ops, 134 const struct rtc_class_ops *ops,
135 struct module *owner); 135 struct module *owner);
136extern struct rtc_device *devm_rtc_device_register(struct device *dev,
137 const char *name,
138 const struct rtc_class_ops *ops,
139 struct module *owner);
136extern void rtc_device_unregister(struct rtc_device *rtc); 140extern void rtc_device_unregister(struct rtc_device *rtc);
141extern void devm_rtc_device_unregister(struct device *dev,
142 struct rtc_device *rtc);
137 143
138extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); 144extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
139extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); 145extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 489dd7bb28ec..f28544b2f9af 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -69,6 +69,15 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
69 struct netlink_callback *cb, 69 struct netlink_callback *cb,
70 struct net_device *dev, 70 struct net_device *dev,
71 int idx); 71 int idx);
72extern int ndo_dflt_fdb_add(struct ndmsg *ndm,
73 struct nlattr *tb[],
74 struct net_device *dev,
75 const unsigned char *addr,
76 u16 flags);
77extern int ndo_dflt_fdb_del(struct ndmsg *ndm,
78 struct nlattr *tb[],
79 struct net_device *dev,
80 const unsigned char *addr);
72 81
73extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, 82extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
74 struct net_device *dev, u16 mode); 83 struct net_device *dev, u16 mode);
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 8da67d625e13..0616ffe45702 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -133,10 +133,20 @@ do { \
133 _down_write_nest_lock(sem, &(nest_lock)->dep_map); \ 133 _down_write_nest_lock(sem, &(nest_lock)->dep_map); \
134} while (0); 134} while (0);
135 135
136/*
137 * Take/release a lock when not the owner will release it.
138 *
139 * [ This API should be avoided as much as possible - the
140 * proper abstraction for this case is completions. ]
141 */
142extern void down_read_non_owner(struct rw_semaphore *sem);
143extern void up_read_non_owner(struct rw_semaphore *sem);
136#else 144#else
137# define down_read_nested(sem, subclass) down_read(sem) 145# define down_read_nested(sem, subclass) down_read(sem)
138# define down_write_nest_lock(sem, nest_lock) down_write(sem) 146# define down_write_nest_lock(sem, nest_lock) down_write(sem)
139# define down_write_nested(sem, subclass) down_write(sem) 147# define down_write_nested(sem, subclass) down_write(sem)
148# define down_read_non_owner(sem) down_read(sem)
149# define up_read_non_owner(sem) up_read(sem)
140#endif 150#endif
141 151
142#endif /* _LINUX_RWSEM_H */ 152#endif /* _LINUX_RWSEM_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 2d8bdaef9611..5951e3f38878 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -172,6 +172,22 @@ static inline void sg_mark_end(struct scatterlist *sg)
172} 172}
173 173
174/** 174/**
175 * sg_unmark_end - Undo setting the end of the scatterlist
176 * @sg: SG entryScatterlist
177 *
178 * Description:
179 * Removes the termination marker from the given entry of the scatterlist.
180 *
181 **/
182static inline void sg_unmark_end(struct scatterlist *sg)
183{
184#ifdef CONFIG_DEBUG_SG
185 BUG_ON(sg->sg_magic != SG_MAGIC);
186#endif
187 sg->page_link &= ~0x02;
188}
189
190/**
175 * sg_phys - Return physical address of an sg entry 191 * sg_phys - Return physical address of an sg entry
176 * @sg: SG entry 192 * @sg: SG entry
177 * 193 *
@@ -235,13 +251,13 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
235 * sg page iterator 251 * sg page iterator
236 * 252 *
237 * Iterates over sg entries page-by-page. On each successful iteration, 253 * Iterates over sg entries page-by-page. On each successful iteration,
238 * @piter->page points to the current page, @piter->sg to the sg holding this 254 * you can call sg_page_iter_page(@piter) and sg_page_iter_dma_address(@piter)
239 * page and @piter->sg_pgoffset to the page's page offset within the sg. The 255 * to get the current page and its dma address. @piter->sg will point to the
240 * iteration will stop either when a maximum number of sg entries was reached 256 * sg holding this page and @piter->sg_pgoffset to the page's page offset
241 * or a terminating sg (sg_last(sg) == true) was reached. 257 * within the sg. The iteration will stop either when a maximum number of sg
258 * entries was reached or a terminating sg (sg_last(sg) == true) was reached.
242 */ 259 */
243struct sg_page_iter { 260struct sg_page_iter {
244 struct page *page; /* current page */
245 struct scatterlist *sg; /* sg holding the page */ 261 struct scatterlist *sg; /* sg holding the page */
246 unsigned int sg_pgoffset; /* page offset within the sg */ 262 unsigned int sg_pgoffset; /* page offset within the sg */
247 263
@@ -255,6 +271,24 @@ bool __sg_page_iter_next(struct sg_page_iter *piter);
255void __sg_page_iter_start(struct sg_page_iter *piter, 271void __sg_page_iter_start(struct sg_page_iter *piter,
256 struct scatterlist *sglist, unsigned int nents, 272 struct scatterlist *sglist, unsigned int nents,
257 unsigned long pgoffset); 273 unsigned long pgoffset);
274/**
275 * sg_page_iter_page - get the current page held by the page iterator
276 * @piter: page iterator holding the page
277 */
278static inline struct page *sg_page_iter_page(struct sg_page_iter *piter)
279{
280 return nth_page(sg_page(piter->sg), piter->sg_pgoffset);
281}
282
283/**
284 * sg_page_iter_dma_address - get the dma address of the current page held by
285 * the page iterator.
286 * @piter: page iterator holding the page
287 */
288static inline dma_addr_t sg_page_iter_dma_address(struct sg_page_iter *piter)
289{
290 return sg_dma_address(piter->sg) + (piter->sg_pgoffset << PAGE_SHIFT);
291}
258 292
259/** 293/**
260 * for_each_sg_page - iterate over the pages of the given sg list 294 * for_each_sg_page - iterate over the pages of the given sg list
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e692a022527b..178a8d909f14 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -127,18 +127,6 @@ extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);
127extern void proc_sched_set_task(struct task_struct *p); 127extern void proc_sched_set_task(struct task_struct *p);
128extern void 128extern void
129print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); 129print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
130#else
131static inline void
132proc_sched_show_task(struct task_struct *p, struct seq_file *m)
133{
134}
135static inline void proc_sched_set_task(struct task_struct *p)
136{
137}
138static inline void
139print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
140{
141}
142#endif 130#endif
143 131
144/* 132/*
@@ -243,7 +231,7 @@ extern void init_idle_bootup_task(struct task_struct *idle);
243 231
244extern int runqueue_is_locked(int cpu); 232extern int runqueue_is_locked(int cpu);
245 233
246#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 234#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
247extern void nohz_balance_enter_idle(int cpu); 235extern void nohz_balance_enter_idle(int cpu);
248extern void set_cpu_sd_state_idle(void); 236extern void set_cpu_sd_state_idle(void);
249extern int get_nohz_timer_target(void); 237extern int get_nohz_timer_target(void);
@@ -321,13 +309,10 @@ extern signed long schedule_timeout_killable(signed long timeout);
321extern signed long schedule_timeout_uninterruptible(signed long timeout); 309extern signed long schedule_timeout_uninterruptible(signed long timeout);
322asmlinkage void schedule(void); 310asmlinkage void schedule(void);
323extern void schedule_preempt_disabled(void); 311extern void schedule_preempt_disabled(void);
324extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
325 312
326struct nsproxy; 313struct nsproxy;
327struct user_namespace; 314struct user_namespace;
328 315
329#include <linux/aio.h>
330
331#ifdef CONFIG_MMU 316#ifdef CONFIG_MMU
332extern void arch_pick_mmap_layout(struct mm_struct *mm); 317extern void arch_pick_mmap_layout(struct mm_struct *mm);
333extern unsigned long 318extern unsigned long
@@ -527,7 +512,8 @@ struct signal_struct {
527 unsigned int has_child_subreaper:1; 512 unsigned int has_child_subreaper:1;
528 513
529 /* POSIX.1b Interval Timers */ 514 /* POSIX.1b Interval Timers */
530 struct list_head posix_timers; 515 int posix_timer_id;
516 struct list_head posix_timers;
531 517
532 /* ITIMER_REAL timer for the process */ 518 /* ITIMER_REAL timer for the process */
533 struct hrtimer real_timer; 519 struct hrtimer real_timer;
@@ -571,7 +557,7 @@ struct signal_struct {
571 cputime_t utime, stime, cutime, cstime; 557 cputime_t utime, stime, cutime, cstime;
572 cputime_t gtime; 558 cputime_t gtime;
573 cputime_t cgtime; 559 cputime_t cgtime;
574#ifndef CONFIG_VIRT_CPU_ACCOUNTING 560#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
575 struct cputime prev_cputime; 561 struct cputime prev_cputime;
576#endif 562#endif
577 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 563 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
@@ -607,6 +593,7 @@ struct signal_struct {
607#endif 593#endif
608#ifdef CONFIG_AUDIT 594#ifdef CONFIG_AUDIT
609 unsigned audit_tty; 595 unsigned audit_tty;
596 unsigned audit_tty_log_passwd;
610 struct tty_audit_buf *tty_audit_buf; 597 struct tty_audit_buf *tty_audit_buf;
611#endif 598#endif
612#ifdef CONFIG_CGROUPS 599#ifdef CONFIG_CGROUPS
@@ -638,6 +625,7 @@ struct signal_struct {
638#define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */ 625#define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */
639#define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */ 626#define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */
640#define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */ 627#define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */
628#define SIGNAL_GROUP_COREDUMP 0x00000008 /* coredump in progress */
641/* 629/*
642 * Pending notifications to parent. 630 * Pending notifications to parent.
643 */ 631 */
@@ -769,31 +757,6 @@ enum cpu_idle_type {
769}; 757};
770 758
771/* 759/*
772 * Increase resolution of nice-level calculations for 64-bit architectures.
773 * The extra resolution improves shares distribution and load balancing of
774 * low-weight task groups (eg. nice +19 on an autogroup), deeper taskgroup
775 * hierarchies, especially on larger systems. This is not a user-visible change
776 * and does not change the user-interface for setting shares/weights.
777 *
778 * We increase resolution only if we have enough bits to allow this increased
779 * resolution (i.e. BITS_PER_LONG > 32). The costs for increasing resolution
780 * when BITS_PER_LONG <= 32 are pretty high and the returns do not justify the
781 * increased costs.
782 */
783#if 0 /* BITS_PER_LONG > 32 -- currently broken: it increases power usage under light load */
784# define SCHED_LOAD_RESOLUTION 10
785# define scale_load(w) ((w) << SCHED_LOAD_RESOLUTION)
786# define scale_load_down(w) ((w) >> SCHED_LOAD_RESOLUTION)
787#else
788# define SCHED_LOAD_RESOLUTION 0
789# define scale_load(w) (w)
790# define scale_load_down(w) (w)
791#endif
792
793#define SCHED_LOAD_SHIFT (10 + SCHED_LOAD_RESOLUTION)
794#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT)
795
796/*
797 * Increase resolution of cpu_power calculations 760 * Increase resolution of cpu_power calculations
798 */ 761 */
799#define SCHED_POWER_SHIFT 10 762#define SCHED_POWER_SHIFT 10
@@ -818,62 +781,6 @@ enum cpu_idle_type {
818 781
819extern int __weak arch_sd_sibiling_asym_packing(void); 782extern int __weak arch_sd_sibiling_asym_packing(void);
820 783
821struct sched_group_power {
822 atomic_t ref;
823 /*
824 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
825 * single CPU.
826 */
827 unsigned int power, power_orig;
828 unsigned long next_update;
829 /*
830 * Number of busy cpus in this group.
831 */
832 atomic_t nr_busy_cpus;
833
834 unsigned long cpumask[0]; /* iteration mask */
835};
836
837struct sched_group {
838 struct sched_group *next; /* Must be a circular list */
839 atomic_t ref;
840
841 unsigned int group_weight;
842 struct sched_group_power *sgp;
843
844 /*
845 * The CPUs this group covers.
846 *
847 * NOTE: this field is variable length. (Allocated dynamically
848 * by attaching extra space to the end of the structure,
849 * depending on how many CPUs the kernel has booted up with)
850 */
851 unsigned long cpumask[0];
852};
853
854static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
855{
856 return to_cpumask(sg->cpumask);
857}
858
859/*
860 * cpumask masking which cpus in the group are allowed to iterate up the domain
861 * tree.
862 */
863static inline struct cpumask *sched_group_mask(struct sched_group *sg)
864{
865 return to_cpumask(sg->sgp->cpumask);
866}
867
868/**
869 * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
870 * @group: The group whose first cpu is to be returned.
871 */
872static inline unsigned int group_first_cpu(struct sched_group *group)
873{
874 return cpumask_first(sched_group_cpus(group));
875}
876
877struct sched_domain_attr { 784struct sched_domain_attr {
878 int relax_domain_level; 785 int relax_domain_level;
879}; 786};
@@ -884,6 +791,8 @@ struct sched_domain_attr {
884 791
885extern int sched_domain_level_max; 792extern int sched_domain_level_max;
886 793
794struct sched_group;
795
887struct sched_domain { 796struct sched_domain {
888 /* These fields must be setup */ 797 /* These fields must be setup */
889 struct sched_domain *parent; /* top domain must be null terminated */ 798 struct sched_domain *parent; /* top domain must be null terminated */
@@ -900,6 +809,8 @@ struct sched_domain {
900 unsigned int wake_idx; 809 unsigned int wake_idx;
901 unsigned int forkexec_idx; 810 unsigned int forkexec_idx;
902 unsigned int smt_gain; 811 unsigned int smt_gain;
812
813 int nohz_idle; /* NOHZ IDLE status */
903 int flags; /* See SD_* */ 814 int flags; /* See SD_* */
904 int level; 815 int level;
905 816
@@ -972,18 +883,6 @@ extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
972cpumask_var_t *alloc_sched_domains(unsigned int ndoms); 883cpumask_var_t *alloc_sched_domains(unsigned int ndoms);
973void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); 884void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
974 885
975/* Test a flag in parent sched domain */
976static inline int test_sd_parent(struct sched_domain *sd, int flag)
977{
978 if (sd->parent && (sd->parent->flags & flag))
979 return 1;
980
981 return 0;
982}
983
984unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
985unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
986
987bool cpus_share_cache(int this_cpu, int that_cpu); 886bool cpus_share_cache(int this_cpu, int that_cpu);
988 887
989#else /* CONFIG_SMP */ 888#else /* CONFIG_SMP */
@@ -1018,72 +917,6 @@ struct mempolicy;
1018struct pipe_inode_info; 917struct pipe_inode_info;
1019struct uts_namespace; 918struct uts_namespace;
1020 919
1021struct rq;
1022struct sched_domain;
1023
1024/*
1025 * wake flags
1026 */
1027#define WF_SYNC 0x01 /* waker goes to sleep after wakup */
1028#define WF_FORK 0x02 /* child wakeup after fork */
1029#define WF_MIGRATED 0x04 /* internal use, task got migrated */
1030
1031#define ENQUEUE_WAKEUP 1
1032#define ENQUEUE_HEAD 2
1033#ifdef CONFIG_SMP
1034#define ENQUEUE_WAKING 4 /* sched_class::task_waking was called */
1035#else
1036#define ENQUEUE_WAKING 0
1037#endif
1038
1039#define DEQUEUE_SLEEP 1
1040
1041struct sched_class {
1042 const struct sched_class *next;
1043
1044 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
1045 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
1046 void (*yield_task) (struct rq *rq);
1047 bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);
1048
1049 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
1050
1051 struct task_struct * (*pick_next_task) (struct rq *rq);
1052 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1053
1054#ifdef CONFIG_SMP
1055 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
1056 void (*migrate_task_rq)(struct task_struct *p, int next_cpu);
1057
1058 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1059 void (*post_schedule) (struct rq *this_rq);
1060 void (*task_waking) (struct task_struct *task);
1061 void (*task_woken) (struct rq *this_rq, struct task_struct *task);
1062
1063 void (*set_cpus_allowed)(struct task_struct *p,
1064 const struct cpumask *newmask);
1065
1066 void (*rq_online)(struct rq *rq);
1067 void (*rq_offline)(struct rq *rq);
1068#endif
1069
1070 void (*set_curr_task) (struct rq *rq);
1071 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
1072 void (*task_fork) (struct task_struct *p);
1073
1074 void (*switched_from) (struct rq *this_rq, struct task_struct *task);
1075 void (*switched_to) (struct rq *this_rq, struct task_struct *task);
1076 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1077 int oldprio);
1078
1079 unsigned int (*get_rr_interval) (struct rq *rq,
1080 struct task_struct *task);
1081
1082#ifdef CONFIG_FAIR_GROUP_SCHED
1083 void (*task_move_group) (struct task_struct *p, int on_rq);
1084#endif
1085};
1086
1087struct load_weight { 920struct load_weight {
1088 unsigned long weight, inv_weight; 921 unsigned long weight, inv_weight;
1089}; 922};
@@ -1275,8 +1108,10 @@ struct task_struct {
1275 int exit_code, exit_signal; 1108 int exit_code, exit_signal;
1276 int pdeath_signal; /* The signal sent when the parent dies */ 1109 int pdeath_signal; /* The signal sent when the parent dies */
1277 unsigned int jobctl; /* JOBCTL_*, siglock protected */ 1110 unsigned int jobctl; /* JOBCTL_*, siglock protected */
1278 /* ??? */ 1111
1112 /* Used for emulating ABI behavior of previous Linux versions */
1279 unsigned int personality; 1113 unsigned int personality;
1114
1280 unsigned did_exec:1; 1115 unsigned did_exec:1;
1281 unsigned in_execve:1; /* Tell the LSMs that the process is doing an 1116 unsigned in_execve:1; /* Tell the LSMs that the process is doing an
1282 * execve */ 1117 * execve */
@@ -1328,7 +1163,7 @@ struct task_struct {
1328 1163
1329 cputime_t utime, stime, utimescaled, stimescaled; 1164 cputime_t utime, stime, utimescaled, stimescaled;
1330 cputime_t gtime; 1165 cputime_t gtime;
1331#ifndef CONFIG_VIRT_CPU_ACCOUNTING 1166#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
1332 struct cputime prev_cputime; 1167 struct cputime prev_cputime;
1333#endif 1168#endif
1334#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 1169#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
@@ -1577,6 +1412,10 @@ struct task_struct {
1577#ifdef CONFIG_UPROBES 1412#ifdef CONFIG_UPROBES
1578 struct uprobe_task *utask; 1413 struct uprobe_task *utask;
1579#endif 1414#endif
1415#if defined(CONFIG_BCACHE) || defined(CONFIG_BCACHE_MODULE)
1416 unsigned int sequential_io;
1417 unsigned int sequential_io_avg;
1418#endif
1580}; 1419};
1581 1420
1582/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1421/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1794,7 +1633,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1794#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1633#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1795#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1634#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1796#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1635#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1797#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ 1636#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
1798#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1637#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1799#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1638#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1800#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1639#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
@@ -1928,13 +1767,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
1928} 1767}
1929#endif 1768#endif
1930 1769
1931#ifdef CONFIG_NO_HZ 1770#ifdef CONFIG_NO_HZ_COMMON
1932void calc_load_enter_idle(void); 1771void calc_load_enter_idle(void);
1933void calc_load_exit_idle(void); 1772void calc_load_exit_idle(void);
1934#else 1773#else
1935static inline void calc_load_enter_idle(void) { } 1774static inline void calc_load_enter_idle(void) { }
1936static inline void calc_load_exit_idle(void) { } 1775static inline void calc_load_exit_idle(void) { }
1937#endif /* CONFIG_NO_HZ */ 1776#endif /* CONFIG_NO_HZ_COMMON */
1938 1777
1939#ifndef CONFIG_CPUMASK_OFFSTACK 1778#ifndef CONFIG_CPUMASK_OFFSTACK
1940static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) 1779static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
@@ -2020,10 +1859,17 @@ extern void idle_task_exit(void);
2020static inline void idle_task_exit(void) {} 1859static inline void idle_task_exit(void) {}
2021#endif 1860#endif
2022 1861
2023#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) 1862#if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP)
2024extern void wake_up_idle_cpu(int cpu); 1863extern void wake_up_nohz_cpu(int cpu);
2025#else 1864#else
2026static inline void wake_up_idle_cpu(int cpu) { } 1865static inline void wake_up_nohz_cpu(int cpu) { }
1866#endif
1867
1868#ifdef CONFIG_NO_HZ_FULL
1869extern bool sched_can_stop_tick(void);
1870extern u64 scheduler_tick_max_deferment(void);
1871#else
1872static inline bool sched_can_stop_tick(void) { return false; }
2027#endif 1873#endif
2028 1874
2029#ifdef CONFIG_SCHED_AUTOGROUP 1875#ifdef CONFIG_SCHED_AUTOGROUP
@@ -2413,27 +2259,18 @@ static inline void threadgroup_change_end(struct task_struct *tsk)
2413 * 2259 *
2414 * Lock the threadgroup @tsk belongs to. No new task is allowed to enter 2260 * Lock the threadgroup @tsk belongs to. No new task is allowed to enter
2415 * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or 2261 * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
2416 * perform exec. This is useful for cases where the threadgroup needs to 2262 * change ->group_leader/pid. This is useful for cases where the threadgroup
2417 * stay stable across blockable operations. 2263 * needs to stay stable across blockable operations.
2418 * 2264 *
2419 * fork and exit paths explicitly call threadgroup_change_{begin|end}() for 2265 * fork and exit paths explicitly call threadgroup_change_{begin|end}() for
2420 * synchronization. While held, no new task will be added to threadgroup 2266 * synchronization. While held, no new task will be added to threadgroup
2421 * and no existing live task will have its PF_EXITING set. 2267 * and no existing live task will have its PF_EXITING set.
2422 * 2268 *
2423 * During exec, a task goes and puts its thread group through unusual 2269 * de_thread() does threadgroup_change_{begin|end}() when a non-leader
2424 * changes. After de-threading, exclusive access is assumed to resources 2270 * sub-thread becomes a new leader.
2425 * which are usually shared by tasks in the same group - e.g. sighand may
2426 * be replaced with a new one. Also, the exec'ing task takes over group
2427 * leader role including its pid. Exclude these changes while locked by
2428 * grabbing cred_guard_mutex which is used to synchronize exec path.
2429 */ 2271 */
2430static inline void threadgroup_lock(struct task_struct *tsk) 2272static inline void threadgroup_lock(struct task_struct *tsk)
2431{ 2273{
2432 /*
2433 * exec uses exit for de-threading nesting group_rwsem inside
2434 * cred_guard_mutex. Grab cred_guard_mutex first.
2435 */
2436 mutex_lock(&tsk->signal->cred_guard_mutex);
2437 down_write(&tsk->signal->group_rwsem); 2274 down_write(&tsk->signal->group_rwsem);
2438} 2275}
2439 2276
@@ -2446,7 +2283,6 @@ static inline void threadgroup_lock(struct task_struct *tsk)
2446static inline void threadgroup_unlock(struct task_struct *tsk) 2283static inline void threadgroup_unlock(struct task_struct *tsk)
2447{ 2284{
2448 up_write(&tsk->signal->group_rwsem); 2285 up_write(&tsk->signal->group_rwsem);
2449 mutex_unlock(&tsk->signal->cred_guard_mutex);
2450} 2286}
2451#else 2287#else
2452static inline void threadgroup_change_begin(struct task_struct *tsk) {} 2288static inline void threadgroup_change_begin(struct task_struct *tsk) {}
@@ -2623,6 +2459,47 @@ static inline int spin_needbreak(spinlock_t *lock)
2623} 2459}
2624 2460
2625/* 2461/*
2462 * Idle thread specific functions to determine the need_resched
2463 * polling state. We have two versions, one based on TS_POLLING in
2464 * thread_info.status and one based on TIF_POLLING_NRFLAG in
2465 * thread_info.flags
2466 */
2467#ifdef TS_POLLING
2468static inline int tsk_is_polling(struct task_struct *p)
2469{
2470 return task_thread_info(p)->status & TS_POLLING;
2471}
2472static inline void current_set_polling(void)
2473{
2474 current_thread_info()->status |= TS_POLLING;
2475}
2476
2477static inline void current_clr_polling(void)
2478{
2479 current_thread_info()->status &= ~TS_POLLING;
2480 smp_mb__after_clear_bit();
2481}
2482#elif defined(TIF_POLLING_NRFLAG)
2483static inline int tsk_is_polling(struct task_struct *p)
2484{
2485 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
2486}
2487static inline void current_set_polling(void)
2488{
2489 set_thread_flag(TIF_POLLING_NRFLAG);
2490}
2491
2492static inline void current_clr_polling(void)
2493{
2494 clear_thread_flag(TIF_POLLING_NRFLAG);
2495}
2496#else
2497static inline int tsk_is_polling(struct task_struct *p) { return 0; }
2498static inline void current_set_polling(void) { }
2499static inline void current_clr_polling(void) { }
2500#endif
2501
2502/*
2626 * Thread group CPU time accounting. 2503 * Thread group CPU time accounting.
2627 */ 2504 */
2628void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); 2505void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times);
@@ -2682,28 +2559,7 @@ extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
2682extern long sched_getaffinity(pid_t pid, struct cpumask *mask); 2559extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
2683 2560
2684#ifdef CONFIG_CGROUP_SCHED 2561#ifdef CONFIG_CGROUP_SCHED
2685
2686extern struct task_group root_task_group; 2562extern struct task_group root_task_group;
2687
2688extern struct task_group *sched_create_group(struct task_group *parent);
2689extern void sched_online_group(struct task_group *tg,
2690 struct task_group *parent);
2691extern void sched_destroy_group(struct task_group *tg);
2692extern void sched_offline_group(struct task_group *tg);
2693extern void sched_move_task(struct task_struct *tsk);
2694#ifdef CONFIG_FAIR_GROUP_SCHED
2695extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
2696extern unsigned long sched_group_shares(struct task_group *tg);
2697#endif
2698#ifdef CONFIG_RT_GROUP_SCHED
2699extern int sched_group_set_rt_runtime(struct task_group *tg,
2700 long rt_runtime_us);
2701extern long sched_group_rt_runtime(struct task_group *tg);
2702extern int sched_group_set_rt_period(struct task_group *tg,
2703 long rt_period_us);
2704extern long sched_group_rt_period(struct task_group *tg);
2705extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk);
2706#endif
2707#endif /* CONFIG_CGROUP_SCHED */ 2563#endif /* CONFIG_CGROUP_SCHED */
2708 2564
2709extern int task_can_switch_user(struct user_struct *up, 2565extern int task_can_switch_user(struct user_struct *up,
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c11a28706fa4..3bfe8d6ee248 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -53,7 +53,9 @@
53 53
54#include <linux/in.h> /* We need in_addr. */ 54#include <linux/in.h> /* We need in_addr. */
55#include <linux/in6.h> /* We need in6_addr. */ 55#include <linux/in6.h> /* We need in6_addr. */
56#include <linux/skbuff.h>
56 57
58#include <uapi/linux/sctp.h>
57 59
58/* Section 3.1. SCTP Common Header Format */ 60/* Section 3.1. SCTP Common Header Format */
59typedef struct sctphdr { 61typedef struct sctphdr {
@@ -63,14 +65,10 @@ typedef struct sctphdr {
63 __le32 checksum; 65 __le32 checksum;
64} __packed sctp_sctphdr_t; 66} __packed sctp_sctphdr_t;
65 67
66#ifdef __KERNEL__
67#include <linux/skbuff.h>
68
69static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) 68static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
70{ 69{
71 return (struct sctphdr *)skb_transport_header(skb); 70 return (struct sctphdr *)skb_transport_header(skb);
72} 71}
73#endif
74 72
75/* Section 3.2. Chunk Field Descriptions. */ 73/* Section 3.2. Chunk Field Descriptions. */
76typedef struct sctp_chunkhdr { 74typedef struct sctp_chunkhdr {
diff --git a/include/linux/security.h b/include/linux/security.h
index 032c366ef1c6..4686491852a7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1440,7 +1440,7 @@ struct security_operations {
1440 struct path *new_path); 1440 struct path *new_path);
1441 int (*sb_set_mnt_opts) (struct super_block *sb, 1441 int (*sb_set_mnt_opts) (struct super_block *sb,
1442 struct security_mnt_opts *opts); 1442 struct security_mnt_opts *opts);
1443 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1443 int (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1444 struct super_block *newsb); 1444 struct super_block *newsb);
1445 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1445 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1446 1446
@@ -1726,7 +1726,7 @@ int security_sb_mount(const char *dev_name, struct path *path,
1726int security_sb_umount(struct vfsmount *mnt, int flags); 1726int security_sb_umount(struct vfsmount *mnt, int flags);
1727int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1727int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1728int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1728int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1729void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1729int security_sb_clone_mnt_opts(const struct super_block *oldsb,
1730 struct super_block *newsb); 1730 struct super_block *newsb);
1731int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); 1731int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1732 1732
@@ -2016,9 +2016,11 @@ static inline int security_sb_set_mnt_opts(struct super_block *sb,
2016 return 0; 2016 return 0;
2017} 2017}
2018 2018
2019static inline void security_sb_clone_mnt_opts(const struct super_block *oldsb, 2019static inline int security_sb_clone_mnt_opts(const struct super_block *oldsb,
2020 struct super_block *newsb) 2020 struct super_block *newsb)
2021{ } 2021{
2022 return 0;
2023}
2022 2024
2023static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) 2025static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)
2024{ 2026{
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 68a04a343cad..2da29ac178fc 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -123,6 +123,7 @@ static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
123} 123}
124 124
125int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 125int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
126int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);
126int single_release(struct inode *, struct file *); 127int single_release(struct inode *, struct file *);
127void *__seq_open_private(struct file *, const struct seq_operations *, int); 128void *__seq_open_private(struct file *, const struct seq_operations *, int);
128int seq_open_private(struct file *, const struct seq_operations *, int); 129int seq_open_private(struct file *, const struct seq_operations *, int);
diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
new file mode 100644
index 000000000000..907d9d1d56cf
--- /dev/null
+++ b/include/linux/serial_s3c.h
@@ -0,0 +1,260 @@
1/*
2 * Internal header file for Samsung S3C2410 serial ports (UART0-2)
3 *
4 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
5 *
6 * Additional defines, Copyright 2003 Simtec Electronics (linux@simtec.co.uk)
7 *
8 * Adapted from:
9 *
10 * Internal header file for MX1ADS serial ports (UART1 & 2)
11 *
12 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27*/
28
29#ifndef __ASM_ARM_REGS_SERIAL_H
30#define __ASM_ARM_REGS_SERIAL_H
31
32#define S3C2410_URXH (0x24)
33#define S3C2410_UTXH (0x20)
34#define S3C2410_ULCON (0x00)
35#define S3C2410_UCON (0x04)
36#define S3C2410_UFCON (0x08)
37#define S3C2410_UMCON (0x0C)
38#define S3C2410_UBRDIV (0x28)
39#define S3C2410_UTRSTAT (0x10)
40#define S3C2410_UERSTAT (0x14)
41#define S3C2410_UFSTAT (0x18)
42#define S3C2410_UMSTAT (0x1C)
43
44#define S3C2410_LCON_CFGMASK ((0xF<<3)|(0x3))
45
46#define S3C2410_LCON_CS5 (0x0)
47#define S3C2410_LCON_CS6 (0x1)
48#define S3C2410_LCON_CS7 (0x2)
49#define S3C2410_LCON_CS8 (0x3)
50#define S3C2410_LCON_CSMASK (0x3)
51
52#define S3C2410_LCON_PNONE (0x0)
53#define S3C2410_LCON_PEVEN (0x5 << 3)
54#define S3C2410_LCON_PODD (0x4 << 3)
55#define S3C2410_LCON_PMASK (0x7 << 3)
56
57#define S3C2410_LCON_STOPB (1<<2)
58#define S3C2410_LCON_IRM (1<<6)
59
60#define S3C2440_UCON_CLKMASK (3<<10)
61#define S3C2440_UCON_CLKSHIFT (10)
62#define S3C2440_UCON_PCLK (0<<10)
63#define S3C2440_UCON_UCLK (1<<10)
64#define S3C2440_UCON_PCLK2 (2<<10)
65#define S3C2440_UCON_FCLK (3<<10)
66#define S3C2443_UCON_EPLL (3<<10)
67
68#define S3C6400_UCON_CLKMASK (3<<10)
69#define S3C6400_UCON_CLKSHIFT (10)
70#define S3C6400_UCON_PCLK (0<<10)
71#define S3C6400_UCON_PCLK2 (2<<10)
72#define S3C6400_UCON_UCLK0 (1<<10)
73#define S3C6400_UCON_UCLK1 (3<<10)
74
75#define S3C2440_UCON2_FCLK_EN (1<<15)
76#define S3C2440_UCON0_DIVMASK (15 << 12)
77#define S3C2440_UCON1_DIVMASK (15 << 12)
78#define S3C2440_UCON2_DIVMASK (7 << 12)
79#define S3C2440_UCON_DIVSHIFT (12)
80
81#define S3C2412_UCON_CLKMASK (3<<10)
82#define S3C2412_UCON_CLKSHIFT (10)
83#define S3C2412_UCON_UCLK (1<<10)
84#define S3C2412_UCON_USYSCLK (3<<10)
85#define S3C2412_UCON_PCLK (0<<10)
86#define S3C2412_UCON_PCLK2 (2<<10)
87
88#define S3C2410_UCON_CLKMASK (1 << 10)
89#define S3C2410_UCON_CLKSHIFT (10)
90#define S3C2410_UCON_UCLK (1<<10)
91#define S3C2410_UCON_SBREAK (1<<4)
92
93#define S3C2410_UCON_TXILEVEL (1<<9)
94#define S3C2410_UCON_RXILEVEL (1<<8)
95#define S3C2410_UCON_TXIRQMODE (1<<2)
96#define S3C2410_UCON_RXIRQMODE (1<<0)
97#define S3C2410_UCON_RXFIFO_TOI (1<<7)
98#define S3C2443_UCON_RXERR_IRQEN (1<<6)
99#define S3C2443_UCON_LOOPBACK (1<<5)
100
101#define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
102 S3C2410_UCON_RXILEVEL | \
103 S3C2410_UCON_TXIRQMODE | \
104 S3C2410_UCON_RXIRQMODE | \
105 S3C2410_UCON_RXFIFO_TOI)
106
107#define S3C2410_UFCON_FIFOMODE (1<<0)
108#define S3C2410_UFCON_TXTRIG0 (0<<6)
109#define S3C2410_UFCON_RXTRIG8 (1<<4)
110#define S3C2410_UFCON_RXTRIG12 (2<<4)
111
112/* S3C2440 FIFO trigger levels */
113#define S3C2440_UFCON_RXTRIG1 (0<<4)
114#define S3C2440_UFCON_RXTRIG8 (1<<4)
115#define S3C2440_UFCON_RXTRIG16 (2<<4)
116#define S3C2440_UFCON_RXTRIG32 (3<<4)
117
118#define S3C2440_UFCON_TXTRIG0 (0<<6)
119#define S3C2440_UFCON_TXTRIG16 (1<<6)
120#define S3C2440_UFCON_TXTRIG32 (2<<6)
121#define S3C2440_UFCON_TXTRIG48 (3<<6)
122
123#define S3C2410_UFCON_RESETBOTH (3<<1)
124#define S3C2410_UFCON_RESETTX (1<<2)
125#define S3C2410_UFCON_RESETRX (1<<1)
126
127#define S3C2410_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
128 S3C2410_UFCON_TXTRIG0 | \
129 S3C2410_UFCON_RXTRIG8 )
130
131#define S3C2410_UMCOM_AFC (1<<4)
132#define S3C2410_UMCOM_RTS_LOW (1<<0)
133
134#define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */
135#define S3C2412_UMCON_AFC_56 (1<<5)
136#define S3C2412_UMCON_AFC_48 (2<<5)
137#define S3C2412_UMCON_AFC_40 (3<<5)
138#define S3C2412_UMCON_AFC_32 (4<<5)
139#define S3C2412_UMCON_AFC_24 (5<<5)
140#define S3C2412_UMCON_AFC_16 (6<<5)
141#define S3C2412_UMCON_AFC_8 (7<<5)
142
143#define S3C2410_UFSTAT_TXFULL (1<<9)
144#define S3C2410_UFSTAT_RXFULL (1<<8)
145#define S3C2410_UFSTAT_TXMASK (15<<4)
146#define S3C2410_UFSTAT_TXSHIFT (4)
147#define S3C2410_UFSTAT_RXMASK (15<<0)
148#define S3C2410_UFSTAT_RXSHIFT (0)
149
150/* UFSTAT S3C2443 same as S3C2440 */
151#define S3C2440_UFSTAT_TXFULL (1<<14)
152#define S3C2440_UFSTAT_RXFULL (1<<6)
153#define S3C2440_UFSTAT_TXSHIFT (8)
154#define S3C2440_UFSTAT_RXSHIFT (0)
155#define S3C2440_UFSTAT_TXMASK (63<<8)
156#define S3C2440_UFSTAT_RXMASK (63)
157
158#define S3C2410_UTRSTAT_TXE (1<<2)
159#define S3C2410_UTRSTAT_TXFE (1<<1)
160#define S3C2410_UTRSTAT_RXDR (1<<0)
161
162#define S3C2410_UERSTAT_OVERRUN (1<<0)
163#define S3C2410_UERSTAT_FRAME (1<<2)
164#define S3C2410_UERSTAT_BREAK (1<<3)
165#define S3C2443_UERSTAT_PARITY (1<<1)
166
167#define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \
168 S3C2410_UERSTAT_FRAME | \
169 S3C2410_UERSTAT_BREAK)
170
171#define S3C2410_UMSTAT_CTS (1<<0)
172#define S3C2410_UMSTAT_DeltaCTS (1<<2)
173
174#define S3C2443_DIVSLOT (0x2C)
175
176/* S3C64XX interrupt registers. */
177#define S3C64XX_UINTP 0x30
178#define S3C64XX_UINTSP 0x34
179#define S3C64XX_UINTM 0x38
180
181#define S3C64XX_UINTM_RXD (0)
182#define S3C64XX_UINTM_TXD (2)
183#define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD)
184#define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD)
185
186/* Following are specific to S5PV210 */
187#define S5PV210_UCON_CLKMASK (1<<10)
188#define S5PV210_UCON_CLKSHIFT (10)
189#define S5PV210_UCON_PCLK (0<<10)
190#define S5PV210_UCON_UCLK (1<<10)
191
192#define S5PV210_UFCON_TXTRIG0 (0<<8)
193#define S5PV210_UFCON_TXTRIG4 (1<<8)
194#define S5PV210_UFCON_TXTRIG8 (2<<8)
195#define S5PV210_UFCON_TXTRIG16 (3<<8)
196#define S5PV210_UFCON_TXTRIG32 (4<<8)
197#define S5PV210_UFCON_TXTRIG64 (5<<8)
198#define S5PV210_UFCON_TXTRIG128 (6<<8)
199#define S5PV210_UFCON_TXTRIG256 (7<<8)
200
201#define S5PV210_UFCON_RXTRIG1 (0<<4)
202#define S5PV210_UFCON_RXTRIG4 (1<<4)
203#define S5PV210_UFCON_RXTRIG8 (2<<4)
204#define S5PV210_UFCON_RXTRIG16 (3<<4)
205#define S5PV210_UFCON_RXTRIG32 (4<<4)
206#define S5PV210_UFCON_RXTRIG64 (5<<4)
207#define S5PV210_UFCON_RXTRIG128 (6<<4)
208#define S5PV210_UFCON_RXTRIG256 (7<<4)
209
210#define S5PV210_UFSTAT_TXFULL (1<<24)
211#define S5PV210_UFSTAT_RXFULL (1<<8)
212#define S5PV210_UFSTAT_TXMASK (255<<16)
213#define S5PV210_UFSTAT_TXSHIFT (16)
214#define S5PV210_UFSTAT_RXMASK (255<<0)
215#define S5PV210_UFSTAT_RXSHIFT (0)
216
217#define S3C2410_UCON_CLKSEL0 (1 << 0)
218#define S3C2410_UCON_CLKSEL1 (1 << 1)
219#define S3C2410_UCON_CLKSEL2 (1 << 2)
220#define S3C2410_UCON_CLKSEL3 (1 << 3)
221
222/* Default values for s5pv210 UCON and UFCON uart registers */
223#define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
224 S3C2410_UCON_RXILEVEL | \
225 S3C2410_UCON_TXIRQMODE | \
226 S3C2410_UCON_RXIRQMODE | \
227 S3C2410_UCON_RXFIFO_TOI | \
228 S3C2443_UCON_RXERR_IRQEN)
229
230#define S5PV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
231 S5PV210_UFCON_TXTRIG4 | \
232 S5PV210_UFCON_RXTRIG4)
233
234#ifndef __ASSEMBLY__
235
236/* configuration structure for per-machine configurations for the
237 * serial port
238 *
239 * the pointer is setup by the machine specific initialisation from the
240 * arch/arm/mach-s3c2410/ directory.
241*/
242
243struct s3c2410_uartcfg {
244 unsigned char hwport; /* hardware port number */
245 unsigned char unused;
246 unsigned short flags;
247 upf_t uart_flags; /* default uart flags */
248 unsigned int clk_sel;
249
250 unsigned int has_fracval;
251
252 unsigned long ucon; /* value of ucon for port */
253 unsigned long ulcon; /* value of ulcon for port */
254 unsigned long ufcon; /* value of ufcon for port */
255};
256
257#endif /* __ASSEMBLY__ */
258
259#endif /* __ASM_ARM_REGS_SERIAL_H */
260
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index b17d765ded84..fc305713fc6d 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -6,6 +6,7 @@
6enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; 6enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
7enum { 7enum {
8 SH_ETH_REG_GIGABIT, 8 SH_ETH_REG_GIGABIT,
9 SH_ETH_REG_FAST_RCAR,
9 SH_ETH_REG_FAST_SH4, 10 SH_ETH_REG_FAST_SH4,
10 SH_ETH_REG_FAST_SH3_SH2 11 SH_ETH_REG_FAST_SH3_SH2
11}; 12};
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 9475c5cb28bc..d897484730c0 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -434,4 +434,9 @@ void signals_init(void);
434int restore_altstack(const stack_t __user *); 434int restore_altstack(const stack_t __user *);
435int __save_altstack(stack_t __user *, unsigned long); 435int __save_altstack(stack_t __user *, unsigned long);
436 436
437#ifdef CONFIG_PROC_FS
438struct seq_file;
439extern void render_sigset_t(struct seq_file *, const char *, sigset_t *);
440#endif
441
437#endif /* _LINUX_SIGNAL_H */ 442#endif /* _LINUX_SIGNAL_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b8292d8cc9fa..2e0ced1af3b1 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 <net/flow_keys.h>
35 36
36/* Don't change this without changing skb_csum_unnecessary! */ 37/* Don't change this without changing skb_csum_unnecessary! */
37#define CHECKSUM_NONE 0 38#define CHECKSUM_NONE 0
@@ -316,6 +317,8 @@ enum {
316 SKB_GSO_FCOE = 1 << 5, 317 SKB_GSO_FCOE = 1 << 5,
317 318
318 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320
321 SKB_GSO_UDP_TUNNEL = 1 << 7,
319}; 322};
320 323
321#if BITS_PER_LONG > 32 324#if BITS_PER_LONG > 32
@@ -384,9 +387,11 @@ typedef unsigned char *sk_buff_data_t;
384 * @secmark: security marking 387 * @secmark: security marking
385 * @mark: Generic packet mark 388 * @mark: Generic packet mark
386 * @dropcount: total number of sk_receive_queue overflows 389 * @dropcount: total number of sk_receive_queue overflows
390 * @vlan_proto: vlan encapsulation protocol
387 * @vlan_tci: vlan tag control information 391 * @vlan_tci: vlan tag control information
388 * @inner_transport_header: Inner transport layer header (encapsulation) 392 * @inner_transport_header: Inner transport layer header (encapsulation)
389 * @inner_network_header: Network layer header (encapsulation) 393 * @inner_network_header: Network layer header (encapsulation)
394 * @inner_mac_header: Link layer header (encapsulation)
390 * @transport_header: Transport layer header 395 * @transport_header: Transport layer header
391 * @network_header: Network layer header 396 * @network_header: Network layer header
392 * @mac_header: Link layer header 397 * @mac_header: Link layer header
@@ -461,6 +466,7 @@ struct sk_buff {
461 466
462 __u32 rxhash; 467 __u32 rxhash;
463 468
469 __be16 vlan_proto;
464 __u16 vlan_tci; 470 __u16 vlan_tci;
465 471
466#ifdef CONFIG_NET_SCHED 472#ifdef CONFIG_NET_SCHED
@@ -505,6 +511,7 @@ struct sk_buff {
505 511
506 sk_buff_data_t inner_transport_header; 512 sk_buff_data_t inner_transport_header;
507 sk_buff_data_t inner_network_header; 513 sk_buff_data_t inner_network_header;
514 sk_buff_data_t inner_mac_header;
508 sk_buff_data_t transport_header; 515 sk_buff_data_t transport_header;
509 sk_buff_data_t network_header; 516 sk_buff_data_t network_header;
510 sk_buff_data_t mac_header; 517 sk_buff_data_t mac_header;
@@ -570,7 +577,40 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
570 skb->_skb_refdst = (unsigned long)dst; 577 skb->_skb_refdst = (unsigned long)dst;
571} 578}
572 579
573extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); 580extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
581 bool force);
582
583/**
584 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference
585 * @skb: buffer
586 * @dst: dst entry
587 *
588 * Sets skb dst, assuming a reference was not taken on dst.
589 * If dst entry is cached, we do not take reference and dst_release
590 * will be avoided by refdst_drop. If dst entry is not cached, we take
591 * reference, so that last dst_release can destroy the dst immediately.
592 */
593static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
594{
595 __skb_dst_set_noref(skb, dst, false);
596}
597
598/**
599 * skb_dst_set_noref_force - sets skb dst, without taking reference
600 * @skb: buffer
601 * @dst: dst entry
602 *
603 * Sets skb dst, assuming a reference was not taken on dst.
604 * No reference is taken and no dst_release will be called. While for
605 * cached dsts deferred reclaim is a basic feature, for entries that are
606 * not cached it is caller's job to guarantee that last dst_release for
607 * provided dst happens when nobody uses it, eg. after a RCU grace period.
608 */
609static inline void skb_dst_set_noref_force(struct sk_buff *skb,
610 struct dst_entry *dst)
611{
612 __skb_dst_set_noref(skb, dst, true);
613}
574 614
575/** 615/**
576 * skb_dst_is_noref - Test if skb dst isn't refcounted 616 * skb_dst_is_noref - Test if skb dst isn't refcounted
@@ -611,6 +651,12 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
611 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); 651 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);
612} 652}
613 653
654extern struct sk_buff *__alloc_skb_head(gfp_t priority, int node);
655static inline struct sk_buff *alloc_skb_head(gfp_t priority)
656{
657 return __alloc_skb_head(priority, -1);
658}
659
614extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 660extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
615extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 661extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
616extern struct sk_buff *skb_clone(struct sk_buff *skb, 662extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -1471,6 +1517,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
1471 1517
1472static inline void skb_reset_inner_headers(struct sk_buff *skb) 1518static inline void skb_reset_inner_headers(struct sk_buff *skb)
1473{ 1519{
1520 skb->inner_mac_header = skb->mac_header;
1474 skb->inner_network_header = skb->network_header; 1521 skb->inner_network_header = skb->network_header;
1475 skb->inner_transport_header = skb->transport_header; 1522 skb->inner_transport_header = skb->transport_header;
1476} 1523}
@@ -1516,6 +1563,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
1516 skb->inner_network_header += offset; 1563 skb->inner_network_header += offset;
1517} 1564}
1518 1565
1566static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
1567{
1568 return skb->head + skb->inner_mac_header;
1569}
1570
1571static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
1572{
1573 skb->inner_mac_header = skb->data - skb->head;
1574}
1575
1576static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1577 const int offset)
1578{
1579 skb_reset_inner_mac_header(skb);
1580 skb->inner_mac_header += offset;
1581}
1519static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1582static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1520{ 1583{
1521 return skb->transport_header != ~0U; 1584 return skb->transport_header != ~0U;
@@ -1609,6 +1672,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
1609 skb->inner_network_header = skb->data + offset; 1672 skb->inner_network_header = skb->data + offset;
1610} 1673}
1611 1674
1675static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
1676{
1677 return skb->inner_mac_header;
1678}
1679
1680static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
1681{
1682 skb->inner_mac_header = skb->data;
1683}
1684
1685static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1686 const int offset)
1687{
1688 skb->inner_mac_header = skb->data + offset;
1689}
1612static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1690static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1613{ 1691{
1614 return skb->transport_header != NULL; 1692 return skb->transport_header != NULL;
@@ -1666,6 +1744,19 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1666} 1744}
1667#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1745#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1668 1746
1747static inline void skb_probe_transport_header(struct sk_buff *skb,
1748 const int offset_hint)
1749{
1750 struct flow_keys keys;
1751
1752 if (skb_transport_header_was_set(skb))
1753 return;
1754 else if (skb_flow_dissect(skb, &keys))
1755 skb_set_transport_header(skb, keys.thoff);
1756 else
1757 skb_set_transport_header(skb, offset_hint);
1758}
1759
1669static inline void skb_mac_header_rebuild(struct sk_buff *skb) 1760static inline void skb_mac_header_rebuild(struct sk_buff *skb)
1670{ 1761{
1671 if (skb_mac_header_was_set(skb)) { 1762 if (skb_mac_header_was_set(skb)) {
@@ -2811,6 +2902,8 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb)
2811 2902
2812bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); 2903bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
2813 2904
2905u32 __skb_get_poff(const struct sk_buff *skb);
2906
2814/** 2907/**
2815 * skb_head_is_locked - Determine if the skb->head is locked down 2908 * skb_head_is_locked - Determine if the skb->head is locked down
2816 * @skb: skb to check 2909 * @skb: skb to check
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 5d168d7e0a28..0c621752caa6 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -94,29 +94,6 @@
94#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ 94#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
95 (unsigned long)ZERO_SIZE_PTR) 95 (unsigned long)ZERO_SIZE_PTR)
96 96
97/*
98 * Common fields provided in kmem_cache by all slab allocators
99 * This struct is either used directly by the allocator (SLOB)
100 * or the allocator must include definitions for all fields
101 * provided in kmem_cache_common in their definition of kmem_cache.
102 *
103 * Once we can do anonymous structs (C11 standard) we could put a
104 * anonymous struct definition in these allocators so that the
105 * separate allocations in the kmem_cache structure of SLAB and
106 * SLUB is no longer needed.
107 */
108#ifdef CONFIG_SLOB
109struct kmem_cache {
110 unsigned int object_size;/* The original size of the object */
111 unsigned int size; /* The aligned/padded/added on size */
112 unsigned int align; /* Alignment as calculated */
113 unsigned long flags; /* Active flags on the slab */
114 const char *name; /* Slab name for sysfs */
115 int refcount; /* Use counter */
116 void (*ctor)(void *); /* Called on object slot creation */
117 struct list_head list; /* List of all slab caches on the system */
118};
119#endif
120 97
121struct mem_cgroup; 98struct mem_cgroup;
122/* 99/*
@@ -148,7 +125,63 @@ void kmem_cache_free(struct kmem_cache *, void *);
148 (__flags), NULL) 125 (__flags), NULL)
149 126
150/* 127/*
151 * The largest kmalloc size supported by the slab allocators is 128 * Common kmalloc functions provided by all allocators
129 */
130void * __must_check __krealloc(const void *, size_t, gfp_t);
131void * __must_check krealloc(const void *, size_t, gfp_t);
132void kfree(const void *);
133void kzfree(const void *);
134size_t ksize(const void *);
135
136/*
137 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
138 * alignment larger than the alignment of a 64-bit integer.
139 * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
140 */
141#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
142#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
143#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
144#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
145#else
146#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
147#endif
148
149#ifdef CONFIG_SLOB
150/*
151 * Common fields provided in kmem_cache by all slab allocators
152 * This struct is either used directly by the allocator (SLOB)
153 * or the allocator must include definitions for all fields
154 * provided in kmem_cache_common in their definition of kmem_cache.
155 *
156 * Once we can do anonymous structs (C11 standard) we could put a
157 * anonymous struct definition in these allocators so that the
158 * separate allocations in the kmem_cache structure of SLAB and
159 * SLUB is no longer needed.
160 */
161struct kmem_cache {
162 unsigned int object_size;/* The original size of the object */
163 unsigned int size; /* The aligned/padded/added on size */
164 unsigned int align; /* Alignment as calculated */
165 unsigned long flags; /* Active flags on the slab */
166 const char *name; /* Slab name for sysfs */
167 int refcount; /* Use counter */
168 void (*ctor)(void *); /* Called on object slot creation */
169 struct list_head list; /* List of all slab caches on the system */
170};
171
172#define KMALLOC_MAX_SIZE (1UL << 30)
173
174#include <linux/slob_def.h>
175
176#else /* CONFIG_SLOB */
177
178/*
179 * Kmalloc array related definitions
180 */
181
182#ifdef CONFIG_SLAB
183/*
184 * The largest kmalloc size supported by the SLAB allocators is
152 * 32 megabyte (2^25) or the maximum allocatable page order if that is 185 * 32 megabyte (2^25) or the maximum allocatable page order if that is
153 * less than 32 MB. 186 * less than 32 MB.
154 * 187 *
@@ -158,22 +191,120 @@ void kmem_cache_free(struct kmem_cache *, void *);
158 */ 191 */
159#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ 192#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
160 (MAX_ORDER + PAGE_SHIFT - 1) : 25) 193 (MAX_ORDER + PAGE_SHIFT - 1) : 25)
194#define KMALLOC_SHIFT_MAX KMALLOC_SHIFT_HIGH
195#ifndef KMALLOC_SHIFT_LOW
196#define KMALLOC_SHIFT_LOW 5
197#endif
198#else
199/*
200 * SLUB allocates up to order 2 pages directly and otherwise
201 * passes the request to the page allocator.
202 */
203#define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
204#define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT)
205#ifndef KMALLOC_SHIFT_LOW
206#define KMALLOC_SHIFT_LOW 3
207#endif
208#endif
161 209
162#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) 210/* Maximum allocatable size */
163#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) 211#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
212/* Maximum size for which we actually use a slab cache */
213#define KMALLOC_MAX_CACHE_SIZE (1UL << KMALLOC_SHIFT_HIGH)
214/* Maximum order allocatable via the slab allocagtor */
215#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_MAX - PAGE_SHIFT)
164 216
165/* 217/*
166 * Some archs want to perform DMA into kmalloc caches and need a guaranteed 218 * Kmalloc subsystem.
167 * alignment larger than the alignment of a 64-bit integer.
168 * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
169 */ 219 */
170#ifdef ARCH_DMA_MINALIGN 220#ifndef KMALLOC_MIN_SIZE
171#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN 221#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
222#endif
223
224extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
225#ifdef CONFIG_ZONE_DMA
226extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
227#endif
228
229/*
230 * Figure out which kmalloc slab an allocation of a certain size
231 * belongs to.
232 * 0 = zero alloc
233 * 1 = 65 .. 96 bytes
234 * 2 = 120 .. 192 bytes
235 * n = 2^(n-1) .. 2^n -1
236 */
237static __always_inline int kmalloc_index(size_t size)
238{
239 if (!size)
240 return 0;
241
242 if (size <= KMALLOC_MIN_SIZE)
243 return KMALLOC_SHIFT_LOW;
244
245 if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96)
246 return 1;
247 if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192)
248 return 2;
249 if (size <= 8) return 3;
250 if (size <= 16) return 4;
251 if (size <= 32) return 5;
252 if (size <= 64) return 6;
253 if (size <= 128) return 7;
254 if (size <= 256) return 8;
255 if (size <= 512) return 9;
256 if (size <= 1024) return 10;
257 if (size <= 2 * 1024) return 11;
258 if (size <= 4 * 1024) return 12;
259 if (size <= 8 * 1024) return 13;
260 if (size <= 16 * 1024) return 14;
261 if (size <= 32 * 1024) return 15;
262 if (size <= 64 * 1024) return 16;
263 if (size <= 128 * 1024) return 17;
264 if (size <= 256 * 1024) return 18;
265 if (size <= 512 * 1024) return 19;
266 if (size <= 1024 * 1024) return 20;
267 if (size <= 2 * 1024 * 1024) return 21;
268 if (size <= 4 * 1024 * 1024) return 22;
269 if (size <= 8 * 1024 * 1024) return 23;
270 if (size <= 16 * 1024 * 1024) return 24;
271 if (size <= 32 * 1024 * 1024) return 25;
272 if (size <= 64 * 1024 * 1024) return 26;
273 BUG();
274
275 /* Will never be reached. Needed because the compiler may complain */
276 return -1;
277}
278
279#ifdef CONFIG_SLAB
280#include <linux/slab_def.h>
281#elif defined(CONFIG_SLUB)
282#include <linux/slub_def.h>
172#else 283#else
173#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 284#error "Unknown slab allocator"
174#endif 285#endif
175 286
176/* 287/*
288 * Determine size used for the nth kmalloc cache.
289 * return size or 0 if a kmalloc cache for that
290 * size does not exist
291 */
292static __always_inline int kmalloc_size(int n)
293{
294 if (n > 2)
295 return 1 << n;
296
297 if (n == 1 && KMALLOC_MIN_SIZE <= 32)
298 return 96;
299
300 if (n == 2 && KMALLOC_MIN_SIZE <= 64)
301 return 192;
302
303 return 0;
304}
305#endif /* !CONFIG_SLOB */
306
307/*
177 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 308 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
178 * Intended for arches that get misalignment faults even for 64 bit integer 309 * Intended for arches that get misalignment faults even for 64 bit integer
179 * aligned buffers. 310 * aligned buffers.
@@ -224,42 +355,6 @@ struct seq_file;
224int cache_show(struct kmem_cache *s, struct seq_file *m); 355int cache_show(struct kmem_cache *s, struct seq_file *m);
225void print_slabinfo_header(struct seq_file *m); 356void print_slabinfo_header(struct seq_file *m);
226 357
227/*
228 * Common kmalloc functions provided by all allocators
229 */
230void * __must_check __krealloc(const void *, size_t, gfp_t);
231void * __must_check krealloc(const void *, size_t, gfp_t);
232void kfree(const void *);
233void kzfree(const void *);
234size_t ksize(const void *);
235
236/*
237 * Allocator specific definitions. These are mainly used to establish optimized
238 * ways to convert kmalloc() calls to kmem_cache_alloc() invocations by
239 * selecting the appropriate general cache at compile time.
240 *
241 * Allocators must define at least:
242 *
243 * kmem_cache_alloc()
244 * __kmalloc()
245 * kmalloc()
246 *
247 * Those wishing to support NUMA must also define:
248 *
249 * kmem_cache_alloc_node()
250 * kmalloc_node()
251 *
252 * See each allocator definition file for additional comments and
253 * implementation notes.
254 */
255#ifdef CONFIG_SLUB
256#include <linux/slub_def.h>
257#elif defined(CONFIG_SLOB)
258#include <linux/slob_def.h>
259#else
260#include <linux/slab_def.h>
261#endif
262
263/** 358/**
264 * kmalloc_array - allocate memory for an array. 359 * kmalloc_array - allocate memory for an array.
265 * @n: number of elements. 360 * @n: number of elements.
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 8bb6e0eaf3c6..cd401580bdd3 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -11,8 +11,6 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 14#include <linux/compiler.h>
17 15
18/* 16/*
@@ -97,23 +95,13 @@ struct kmem_cache {
97 * pointer for each node since "nodelists" uses the remainder of 95 * pointer for each node since "nodelists" uses the remainder of
98 * available pointers. 96 * available pointers.
99 */ 97 */
100 struct kmem_list3 **nodelists; 98 struct kmem_cache_node **node;
101 struct array_cache *array[NR_CPUS + MAX_NUMNODES]; 99 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
102 /* 100 /*
103 * Do not add fields after array[] 101 * Do not add fields after array[]
104 */ 102 */
105}; 103};
106 104
107/* Size description struct for general caches. */
108struct cache_sizes {
109 size_t cs_size;
110 struct kmem_cache *cs_cachep;
111#ifdef CONFIG_ZONE_DMA
112 struct kmem_cache *cs_dmacachep;
113#endif
114};
115extern struct cache_sizes malloc_sizes[];
116
117void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 105void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
118void *__kmalloc(size_t size, gfp_t flags); 106void *__kmalloc(size_t size, gfp_t flags);
119 107
@@ -133,26 +121,22 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
133 void *ret; 121 void *ret;
134 122
135 if (__builtin_constant_p(size)) { 123 if (__builtin_constant_p(size)) {
136 int i = 0; 124 int i;
137 125
138 if (!size) 126 if (!size)
139 return ZERO_SIZE_PTR; 127 return ZERO_SIZE_PTR;
140 128
141#define CACHE(x) \ 129 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
142 if (size <= x) \ 130 return NULL;
143 goto found; \ 131
144 else \ 132 i = kmalloc_index(size);
145 i++; 133
146#include <linux/kmalloc_sizes.h>
147#undef CACHE
148 return NULL;
149found:
150#ifdef CONFIG_ZONE_DMA 134#ifdef CONFIG_ZONE_DMA
151 if (flags & GFP_DMA) 135 if (flags & GFP_DMA)
152 cachep = malloc_sizes[i].cs_dmacachep; 136 cachep = kmalloc_dma_caches[i];
153 else 137 else
154#endif 138#endif
155 cachep = malloc_sizes[i].cs_cachep; 139 cachep = kmalloc_caches[i];
156 140
157 ret = kmem_cache_alloc_trace(cachep, flags, size); 141 ret = kmem_cache_alloc_trace(cachep, flags, size);
158 142
@@ -186,26 +170,22 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
186 struct kmem_cache *cachep; 170 struct kmem_cache *cachep;
187 171
188 if (__builtin_constant_p(size)) { 172 if (__builtin_constant_p(size)) {
189 int i = 0; 173 int i;
190 174
191 if (!size) 175 if (!size)
192 return ZERO_SIZE_PTR; 176 return ZERO_SIZE_PTR;
193 177
194#define CACHE(x) \ 178 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
195 if (size <= x) \ 179 return NULL;
196 goto found; \ 180
197 else \ 181 i = kmalloc_index(size);
198 i++; 182
199#include <linux/kmalloc_sizes.h>
200#undef CACHE
201 return NULL;
202found:
203#ifdef CONFIG_ZONE_DMA 183#ifdef CONFIG_ZONE_DMA
204 if (flags & GFP_DMA) 184 if (flags & GFP_DMA)
205 cachep = malloc_sizes[i].cs_dmacachep; 185 cachep = kmalloc_dma_caches[i];
206 else 186 else
207#endif 187#endif
208 cachep = malloc_sizes[i].cs_cachep; 188 cachep = kmalloc_caches[i];
209 189
210 return kmem_cache_alloc_node_trace(cachep, flags, node, size); 190 return kmem_cache_alloc_node_trace(cachep, flags, node, size);
211 } 191 }
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 9db4825cd393..027276fa8713 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -53,17 +53,6 @@ struct kmem_cache_cpu {
53#endif 53#endif
54}; 54};
55 55
56struct kmem_cache_node {
57 spinlock_t list_lock; /* Protect partial list and nr_partial */
58 unsigned long nr_partial;
59 struct list_head partial;
60#ifdef CONFIG_SLUB_DEBUG
61 atomic_long_t nr_slabs;
62 atomic_long_t total_objects;
63 struct list_head full;
64#endif
65};
66
67/* 56/*
68 * Word size structure that can be atomically updated or read and that 57 * Word size structure that can be atomically updated or read and that
69 * contains both the order and the number of objects that a slab of the 58 * contains both the order and the number of objects that a slab of the
@@ -115,111 +104,6 @@ struct kmem_cache {
115 struct kmem_cache_node *node[MAX_NUMNODES]; 104 struct kmem_cache_node *node[MAX_NUMNODES];
116}; 105};
117 106
118/*
119 * Kmalloc subsystem.
120 */
121#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
122#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
123#else
124#define KMALLOC_MIN_SIZE 8
125#endif
126
127#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
128
129/*
130 * Maximum kmalloc object size handled by SLUB. Larger object allocations
131 * are passed through to the page allocator. The page allocator "fastpath"
132 * is relatively slow so we need this value sufficiently high so that
133 * performance critical objects are allocated through the SLUB fastpath.
134 *
135 * This should be dropped to PAGE_SIZE / 2 once the page allocator
136 * "fastpath" becomes competitive with the slab allocator fastpaths.
137 */
138#define SLUB_MAX_SIZE (2 * PAGE_SIZE)
139
140#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
141
142#ifdef CONFIG_ZONE_DMA
143#define SLUB_DMA __GFP_DMA
144#else
145/* Disable DMA functionality */
146#define SLUB_DMA (__force gfp_t)0
147#endif
148
149/*
150 * We keep the general caches in an array of slab caches that are used for
151 * 2^x bytes of allocations.
152 */
153extern struct kmem_cache *kmalloc_caches[SLUB_PAGE_SHIFT];
154
155/*
156 * Sorry that the following has to be that ugly but some versions of GCC
157 * have trouble with constant propagation and loops.
158 */
159static __always_inline int kmalloc_index(size_t size)
160{
161 if (!size)
162 return 0;
163
164 if (size <= KMALLOC_MIN_SIZE)
165 return KMALLOC_SHIFT_LOW;
166
167 if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96)
168 return 1;
169 if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192)
170 return 2;
171 if (size <= 8) return 3;
172 if (size <= 16) return 4;
173 if (size <= 32) return 5;
174 if (size <= 64) return 6;
175 if (size <= 128) return 7;
176 if (size <= 256) return 8;
177 if (size <= 512) return 9;
178 if (size <= 1024) return 10;
179 if (size <= 2 * 1024) return 11;
180 if (size <= 4 * 1024) return 12;
181/*
182 * The following is only needed to support architectures with a larger page
183 * size than 4k. We need to support 2 * PAGE_SIZE here. So for a 64k page
184 * size we would have to go up to 128k.
185 */
186 if (size <= 8 * 1024) return 13;
187 if (size <= 16 * 1024) return 14;
188 if (size <= 32 * 1024) return 15;
189 if (size <= 64 * 1024) return 16;
190 if (size <= 128 * 1024) return 17;
191 if (size <= 256 * 1024) return 18;
192 if (size <= 512 * 1024) return 19;
193 if (size <= 1024 * 1024) return 20;
194 if (size <= 2 * 1024 * 1024) return 21;
195 BUG();
196 return -1; /* Will never be reached */
197
198/*
199 * What we really wanted to do and cannot do because of compiler issues is:
200 * int i;
201 * for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++)
202 * if (size <= (1 << i))
203 * return i;
204 */
205}
206
207/*
208 * Find the slab cache for a given combination of allocation flags and size.
209 *
210 * This ought to end up with a global pointer to the right cache
211 * in kmalloc_caches.
212 */
213static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
214{
215 int index = kmalloc_index(size);
216
217 if (index == 0)
218 return NULL;
219
220 return kmalloc_caches[index];
221}
222
223void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 107void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
224void *__kmalloc(size_t size, gfp_t flags); 108void *__kmalloc(size_t size, gfp_t flags);
225 109
@@ -274,16 +158,17 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
274static __always_inline void *kmalloc(size_t size, gfp_t flags) 158static __always_inline void *kmalloc(size_t size, gfp_t flags)
275{ 159{
276 if (__builtin_constant_p(size)) { 160 if (__builtin_constant_p(size)) {
277 if (size > SLUB_MAX_SIZE) 161 if (size > KMALLOC_MAX_CACHE_SIZE)
278 return kmalloc_large(size, flags); 162 return kmalloc_large(size, flags);
279 163
280 if (!(flags & SLUB_DMA)) { 164 if (!(flags & GFP_DMA)) {
281 struct kmem_cache *s = kmalloc_slab(size); 165 int index = kmalloc_index(size);
282 166
283 if (!s) 167 if (!index)
284 return ZERO_SIZE_PTR; 168 return ZERO_SIZE_PTR;
285 169
286 return kmem_cache_alloc_trace(s, flags, size); 170 return kmem_cache_alloc_trace(kmalloc_caches[index],
171 flags, size);
287 } 172 }
288 } 173 }
289 return __kmalloc(size, flags); 174 return __kmalloc(size, flags);
@@ -310,13 +195,14 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
310static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 195static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
311{ 196{
312 if (__builtin_constant_p(size) && 197 if (__builtin_constant_p(size) &&
313 size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) { 198 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
314 struct kmem_cache *s = kmalloc_slab(size); 199 int index = kmalloc_index(size);
315 200
316 if (!s) 201 if (!index)
317 return ZERO_SIZE_PTR; 202 return ZERO_SIZE_PTR;
318 203
319 return kmem_cache_alloc_node_trace(s, flags, node, size); 204 return kmem_cache_alloc_node_trace(kmalloc_caches[index],
205 flags, node, size);
320 } 206 }
321 return __kmalloc_node(size, flags, node); 207 return __kmalloc_node(size, flags, node);
322} 208}
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 3e07a7df6478..e6564c1dc552 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -20,7 +20,6 @@ struct call_single_data {
20 smp_call_func_t func; 20 smp_call_func_t func;
21 void *info; 21 void *info;
22 u16 flags; 22 u16 flags;
23 u16 priv;
24}; 23};
25 24
26/* total number of cpus in this system (may exceed NR_CPUS) */ 25/* total number of cpus in this system (may exceed NR_CPUS) */
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index e8d702e0fd89..54f91d35e5fd 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -1,6 +1,7 @@
1#ifndef __SOCK_DIAG_H__ 1#ifndef __SOCK_DIAG_H__
2#define __SOCK_DIAG_H__ 2#define __SOCK_DIAG_H__
3 3
4#include <linux/user_namespace.h>
4#include <uapi/linux/sock_diag.h> 5#include <uapi/linux/sock_diag.h>
5 6
6struct sk_buff; 7struct sk_buff;
@@ -22,5 +23,7 @@ int sock_diag_check_cookie(void *sk, __u32 *cookie);
22void sock_diag_save_cookie(void *sk, __u32 *cookie); 23void sock_diag_save_cookie(void *sk, __u32 *cookie);
23 24
24int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); 25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
26int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk,
27 struct sk_buff *skb, int attrtype);
25 28
26#endif 29#endif
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 2b9f74b0ffea..33bf2dfab19d 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -298,13 +298,13 @@ struct ucred {
298#define SOL_IUCV 277 298#define SOL_IUCV 277
299#define SOL_CAIF 278 299#define SOL_CAIF 278
300#define SOL_ALG 279 300#define SOL_ALG 279
301#define SOL_NFC 280
301 302
302/* IPX options */ 303/* IPX options */
303#define IPX_TYPE 1 304#define IPX_TYPE 1
304 305
305extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred); 306extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred);
306 307
307extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
308extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, 308extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
309 int offset, int len); 309 int offset, int len);
310extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 310extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
@@ -313,7 +313,6 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
313 unsigned int len, __wsum *csump); 313 unsigned int len, __wsum *csump);
314 314
315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); 315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
316extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
317extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 316extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
318 int offset, int len); 317 int offset, int len);
319extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); 318extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index b2b1afbb3202..aa327a8105ad 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -26,6 +26,20 @@ struct at86rf230_platform_data {
26 int rstn; 26 int rstn;
27 int slp_tr; 27 int slp_tr;
28 int dig2; 28 int dig2;
29
30 /* Setting the irq_type will configure the driver to request
31 * the platform irq trigger type according to the given value
32 * and configure the interrupt polarity of the device to the
33 * corresponding polarity.
34 *
35 * Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING,
36 * IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW
37 *
38 * Setting it to 0, the driver does not touch the trigger type
39 * configuration of the interrupt and sets the interrupt polarity
40 * of the device to high active (the default value).
41 */
42 int irq_type;
29}; 43};
30 44
31#endif 45#endif
diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h
index 61ae1306db23..4835486f58e5 100644
--- a/include/linux/spi/mxs-spi.h
+++ b/include/linux/spi/mxs-spi.h
@@ -24,7 +24,7 @@
24#ifndef __LINUX_SPI_MXS_SPI_H__ 24#ifndef __LINUX_SPI_MXS_SPI_H__
25#define __LINUX_SPI_MXS_SPI_H__ 25#define __LINUX_SPI_MXS_SPI_H__
26 26
27#include <linux/fsl/mxs-dma.h> 27#include <linux/dmaengine.h>
28 28
29#define ssp_is_old(host) ((host)->devid == IMX23_SSP) 29#define ssp_is_old(host) ((host)->devid == IMX23_SSP)
30 30
@@ -137,9 +137,7 @@ struct mxs_ssp {
137 unsigned int clk_rate; 137 unsigned int clk_rate;
138 enum mxs_ssp_id devid; 138 enum mxs_ssp_id devid;
139 139
140 int dma_channel;
141 struct dma_chan *dmach; 140 struct dma_chan *dmach;
142 struct mxs_dma_data dma_data;
143 unsigned int dma_dir; 141 unsigned int dma_dir;
144 enum dma_transfer_direction slave_dirn; 142 enum dma_transfer_direction slave_dirn;
145 u32 ssp_pio_words[SSP_PIO_NUM]; 143 u32 ssp_pio_words[SSP_PIO_NUM];
diff --git a/include/linux/spi/spi-tegra.h b/include/linux/spi/spi-tegra.h
deleted file mode 100644
index 786932c62edb..000000000000
--- a/include/linux/spi/spi-tegra.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller.
3 *
4 * Copyright (C) 2011 NVIDIA Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _LINUX_SPI_TEGRA_H
22#define _LINUX_SPI_TEGRA_H
23
24struct tegra_spi_platform_data {
25 int dma_req_sel;
26 unsigned int spi_max_frequency;
27};
28
29/*
30 * Controller data from device to pass some info like
31 * hw based chip select can be used or not and if yes
32 * then CS hold and setup time.
33 */
34struct tegra_spi_device_controller_data {
35 bool is_hw_based_cs;
36 int cs_setup_clk_count;
37 int cs_hold_clk_count;
38};
39
40#endif /* _LINUX_SPI_TEGRA_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 38c2b925923d..6ff26c8db7b9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -57,7 +57,7 @@ extern struct bus_type spi_bus_type;
57 * @modalias: Name of the driver to use with this device, or an alias 57 * @modalias: Name of the driver to use with this device, or an alias
58 * for that name. This appears in the sysfs "modalias" attribute 58 * for that name. This appears in the sysfs "modalias" attribute
59 * for driver coldplugging, and in uevents used for hotplugging 59 * for driver coldplugging, and in uevents used for hotplugging
60 * @cs_gpio: gpio number of the chipselect line (optional, -EINVAL when 60 * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when
61 * when not using a GPIO line) 61 * when not using a GPIO line)
62 * 62 *
63 * A @spi_device is used to interchange data between an SPI slave 63 * A @spi_device is used to interchange data between an SPI slave
@@ -228,6 +228,11 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
228 * every chipselect is connected to a slave. 228 * every chipselect is connected to a slave.
229 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 229 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
230 * @mode_bits: flags understood by this controller driver 230 * @mode_bits: flags understood by this controller driver
231 * @bits_per_word_mask: A mask indicating which values of bits_per_word are
232 * supported by the driver. Bit n indicates that a bits_per_word n+1 is
233 * suported. If set, the SPI core will reject any transfer with an
234 * unsupported bits_per_word. If not set, this value is simply ignored,
235 * and it's up to the individual driver to perform any validation.
231 * @flags: other constraints relevant to this driver 236 * @flags: other constraints relevant to this driver
232 * @bus_lock_spinlock: spinlock for SPI bus locking 237 * @bus_lock_spinlock: spinlock for SPI bus locking
233 * @bus_lock_mutex: mutex for SPI bus locking 238 * @bus_lock_mutex: mutex for SPI bus locking
@@ -261,7 +266,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
261 * queue so the subsystem notifies the driver that it may relax the 266 * queue so the subsystem notifies the driver that it may relax the
262 * hardware by issuing this call 267 * hardware by issuing this call
263 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 268 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
264 * number. Any individual value may be -EINVAL for CS lines that 269 * number. Any individual value may be -ENOENT for CS lines that
265 * are not GPIOs (driven by the SPI controller itself). 270 * are not GPIOs (driven by the SPI controller itself).
266 * 271 *
267 * Each SPI master controller can communicate with one or more @spi_device 272 * Each SPI master controller can communicate with one or more @spi_device
@@ -301,6 +306,9 @@ struct spi_master {
301 /* spi_device.mode flags understood by this controller driver */ 306 /* spi_device.mode flags understood by this controller driver */
302 u16 mode_bits; 307 u16 mode_bits;
303 308
309 /* bitmask of supported bits_per_word for transfers */
310 u32 bits_per_word_mask;
311
304 /* other constraints relevant to this driver */ 312 /* other constraints relevant to this driver */
305 u16 flags; 313 u16 flags;
306#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 314#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 22958d68ecfe..c64999fd1660 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -26,9 +26,9 @@ struct ssb_sprom_core_pwr_info {
26 26
27struct ssb_sprom { 27struct ssb_sprom {
28 u8 revision; 28 u8 revision;
29 u8 il0mac[6]; /* MAC address for 802.11b/g */ 29 u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */
30 u8 et0mac[6]; /* MAC address for Ethernet */ 30 u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */
31 u8 et1mac[6]; /* MAC address for 802.11a */ 31 u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */
32 u8 et0phyaddr; /* MII address for enet0 */ 32 u8 et0phyaddr; /* MII address for enet0 */
33 u8 et1phyaddr; /* MII address for enet1 */ 33 u8 et1phyaddr; /* MII address for enet1 */
34 u8 et0mdcport; /* MDIO for enet0 */ 34 u8 et0mdcport; /* MDIO for enet0 */
@@ -340,13 +340,61 @@ enum ssb_bustype {
340#define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ 340#define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */
341#define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ 341#define SSB_BOARDVENDOR_HP 0x0E11 /* HP */
342/* board_type */ 342/* board_type */
343#define SSB_BOARD_BCM94301CB 0x0406
344#define SSB_BOARD_BCM94301MP 0x0407
345#define SSB_BOARD_BU4309 0x040A
346#define SSB_BOARD_BCM94309CB 0x040B
347#define SSB_BOARD_BCM4309MP 0x040C
348#define SSB_BOARD_BU4306 0x0416
343#define SSB_BOARD_BCM94306MP 0x0418 349#define SSB_BOARD_BCM94306MP 0x0418
344#define SSB_BOARD_BCM4309G 0x0421 350#define SSB_BOARD_BCM4309G 0x0421
345#define SSB_BOARD_BCM4306CB 0x0417 351#define SSB_BOARD_BCM4306CB 0x0417
346#define SSB_BOARD_BCM4309MP 0x040C 352#define SSB_BOARD_BCM94306PC 0x0425 /* pcmcia 3.3v 4306 card */
353#define SSB_BOARD_BCM94306CBSG 0x042B /* with SiGe PA */
354#define SSB_BOARD_PCSG94306 0x042D /* with SiGe PA */
355#define SSB_BOARD_BU4704SD 0x042E /* with sdram */
356#define SSB_BOARD_BCM94704AGR 0x042F /* dual 11a/11g Router */
357#define SSB_BOARD_BCM94308MP 0x0430 /* 11a-only minipci */
358#define SSB_BOARD_BU4318 0x0447
359#define SSB_BOARD_CB4318 0x0448
360#define SSB_BOARD_MPG4318 0x0449
347#define SSB_BOARD_MP4318 0x044A 361#define SSB_BOARD_MP4318 0x044A
348#define SSB_BOARD_BU4306 0x0416 362#define SSB_BOARD_SD4318 0x044B
349#define SSB_BOARD_BU4309 0x040A 363#define SSB_BOARD_BCM94306P 0x044C /* with SiGe */
364#define SSB_BOARD_BCM94303MP 0x044E
365#define SSB_BOARD_BCM94306MPM 0x0450
366#define SSB_BOARD_BCM94306MPL 0x0453
367#define SSB_BOARD_PC4303 0x0454 /* pcmcia */
368#define SSB_BOARD_BCM94306MPLNA 0x0457
369#define SSB_BOARD_BCM94306MPH 0x045B
370#define SSB_BOARD_BCM94306PCIV 0x045C
371#define SSB_BOARD_BCM94318MPGH 0x0463
372#define SSB_BOARD_BU4311 0x0464
373#define SSB_BOARD_BCM94311MC 0x0465
374#define SSB_BOARD_BCM94311MCAG 0x0466
375/* 4321 boards */
376#define SSB_BOARD_BU4321 0x046B
377#define SSB_BOARD_BU4321E 0x047C
378#define SSB_BOARD_MP4321 0x046C
379#define SSB_BOARD_CB2_4321 0x046D
380#define SSB_BOARD_CB2_4321_AG 0x0066
381#define SSB_BOARD_MC4321 0x046E
382/* 4325 boards */
383#define SSB_BOARD_BCM94325DEVBU 0x0490
384#define SSB_BOARD_BCM94325BGABU 0x0491
385#define SSB_BOARD_BCM94325SDGWB 0x0492
386#define SSB_BOARD_BCM94325SDGMDL 0x04AA
387#define SSB_BOARD_BCM94325SDGMDL2 0x04C6
388#define SSB_BOARD_BCM94325SDGMDL3 0x04C9
389#define SSB_BOARD_BCM94325SDABGWBA 0x04E1
390/* 4322 boards */
391#define SSB_BOARD_BCM94322MC 0x04A4
392#define SSB_BOARD_BCM94322USB 0x04A8 /* dualband */
393#define SSB_BOARD_BCM94322HM 0x04B0
394#define SSB_BOARD_BCM94322USB2D 0x04Bf /* single band discrete front end */
395/* 4312 boards */
396#define SSB_BOARD_BU4312 0x048A
397#define SSB_BOARD_BCM4312MCGSG 0x04B5
350/* chip_package */ 398/* chip_package */
351#define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ 399#define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */
352#define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ 400#define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 6ecfa02ddbac..3a7256955b10 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -289,11 +289,11 @@
289#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 289#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
290#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 290#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
291#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 291#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
292#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */ 292#define SSB_SPROM4_ANTAVAIL 0x005C /* Antenna available bitfields */
293#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ 293#define SSB_SPROM4_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
294#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 294#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 0
295#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ 295#define SSB_SPROM4_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
296#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 296#define SSB_SPROM4_ANTAVAIL_A_SHIFT 8
297#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */ 297#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */
298#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ 298#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
299#define SSB_SPROM4_AGAIN0_SHIFT 0 299#define SSB_SPROM4_AGAIN0_SHIFT 0
diff --git a/include/linux/ssbi.h b/include/linux/ssbi.h
new file mode 100644
index 000000000000..44ef5da21470
--- /dev/null
+++ b/include/linux/ssbi.h
@@ -0,0 +1,38 @@
1/* Copyright (C) 2010 Google, Inc.
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
3 * Author: Dima Zavin <dima@android.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _LINUX_SSBI_H
16#define _LINUX_SSBI_H
17
18#include <linux/types.h>
19
20struct ssbi_slave_info {
21 const char *name;
22 void *platform_data;
23};
24
25enum ssbi_controller_type {
26 MSM_SBI_CTRL_SSBI = 0,
27 MSM_SBI_CTRL_SSBI2,
28 MSM_SBI_CTRL_PMIC_ARBITER,
29};
30
31struct ssbi_platform_data {
32 struct ssbi_slave_info slave;
33 enum ssbi_controller_type controller_type;
34};
35
36int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len);
37int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
38#endif
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index a3eb2f65b656..3eeee9672a4a 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -13,4 +13,62 @@ enum string_size_units {
13int string_get_size(u64 size, enum string_size_units units, 13int string_get_size(u64 size, enum string_size_units units,
14 char *buf, int len); 14 char *buf, int len);
15 15
16#define UNESCAPE_SPACE 0x01
17#define UNESCAPE_OCTAL 0x02
18#define UNESCAPE_HEX 0x04
19#define UNESCAPE_SPECIAL 0x08
20#define UNESCAPE_ANY \
21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL)
22
23/**
24 * string_unescape - unquote characters in the given string
25 * @src: source buffer (escaped)
26 * @dst: destination buffer (unescaped)
27 * @size: size of the destination buffer (0 to unlimit)
28 * @flags: combination of the flags (bitwise OR):
29 * %UNESCAPE_SPACE:
30 * '\f' - form feed
31 * '\n' - new line
32 * '\r' - carriage return
33 * '\t' - horizontal tab
34 * '\v' - vertical tab
35 * %UNESCAPE_OCTAL:
36 * '\NNN' - byte with octal value NNN (1 to 3 digits)
37 * %UNESCAPE_HEX:
38 * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
39 * %UNESCAPE_SPECIAL:
40 * '\"' - double quote
41 * '\\' - backslash
42 * '\a' - alert (BEL)
43 * '\e' - escape
44 * %UNESCAPE_ANY:
45 * all previous together
46 *
47 * Returns amount of characters processed to the destination buffer excluding
48 * trailing '\0'.
49 *
50 * Because the size of the output will be the same as or less than the size of
51 * the input, the transformation may be performed in place.
52 *
53 * Caller must provide valid source and destination pointers. Be aware that
54 * destination buffer will always be NULL-terminated. Source string must be
55 * NULL-terminated as well.
56 */
57int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
58
59static inline int string_unescape_inplace(char *buf, unsigned int flags)
60{
61 return string_unescape(buf, buf, 0, flags);
62}
63
64static inline int string_unescape_any(char *src, char *dst, size_t size)
65{
66 return string_unescape(src, dst, size, UNESCAPE_ANY);
67}
68
69static inline int string_unescape_any_inplace(char *buf)
70{
71 return string_unescape_any(buf, buf, 0);
72}
73
16#endif 74#endif
diff --git a/include/linux/sudmac.h b/include/linux/sudmac.h
new file mode 100644
index 000000000000..377b8a5788fa
--- /dev/null
+++ b/include/linux/sudmac.h
@@ -0,0 +1,52 @@
1/*
2 * Header for the SUDMAC driver
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 *
6 * This is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
9 */
10#ifndef SUDMAC_H
11#define SUDMAC_H
12
13#include <linux/dmaengine.h>
14#include <linux/shdma-base.h>
15#include <linux/types.h>
16
17/* Used by slave DMA clients to request DMA to/from a specific peripheral */
18struct sudmac_slave {
19 struct shdma_slave shdma_slave; /* Set by the platform */
20};
21
22/*
23 * Supplied by platforms to specify, how a DMA channel has to be configured for
24 * a certain peripheral
25 */
26struct sudmac_slave_config {
27 int slave_id;
28};
29
30struct sudmac_channel {
31 unsigned long offset;
32 unsigned long config;
33 unsigned long wait; /* The configuable range is 0 to 3 */
34 unsigned long dint_end_bit;
35};
36
37struct sudmac_pdata {
38 const struct sudmac_slave_config *slave;
39 int slave_num;
40 const struct sudmac_channel *channel;
41 int channel_num;
42};
43
44/* Definitions for the sudmac_channel.config */
45#define SUDMAC_TX_BUFFER_MODE BIT(0)
46#define SUDMAC_RX_END_MODE BIT(1)
47
48/* Definitions for the sudmac_channel.dint_end_bit */
49#define SUDMAC_DMA_BIT_CH0 BIT(0)
50#define SUDMAC_DMA_BIT_CH1 BIT(1)
51
52#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 58fda1c3c783..0dd00f4f6810 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -22,6 +22,8 @@
22/* size of the nodename buffer */ 22/* size of the nodename buffer */
23#define UNX_MAXNODENAME 32 23#define UNX_MAXNODENAME 32
24 24
25struct rpcsec_gss_info;
26
25/* Work around the lack of a VFS credential */ 27/* Work around the lack of a VFS credential */
26struct auth_cred { 28struct auth_cred {
27 kuid_t uid; 29 kuid_t uid;
@@ -103,6 +105,9 @@ struct rpc_authops {
103 int (*pipes_create)(struct rpc_auth *); 105 int (*pipes_create)(struct rpc_auth *);
104 void (*pipes_destroy)(struct rpc_auth *); 106 void (*pipes_destroy)(struct rpc_auth *);
105 int (*list_pseudoflavors)(rpc_authflavor_t *, int); 107 int (*list_pseudoflavors)(rpc_authflavor_t *, int);
108 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *);
109 int (*flavor2info)(rpc_authflavor_t,
110 struct rpcsec_gss_info *);
106}; 111};
107 112
108struct rpc_credops { 113struct rpc_credops {
@@ -137,6 +142,10 @@ int rpcauth_register(const struct rpc_authops *);
137int rpcauth_unregister(const struct rpc_authops *); 142int rpcauth_unregister(const struct rpc_authops *);
138struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 143struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
139void rpcauth_release(struct rpc_auth *); 144void rpcauth_release(struct rpc_auth *);
145rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t,
146 struct rpcsec_gss_info *);
147int rpcauth_get_gssinfo(rpc_authflavor_t,
148 struct rpcsec_gss_info *);
140int rpcauth_list_flavors(rpc_authflavor_t *, int); 149int rpcauth_list_flavors(rpc_authflavor_t *, int);
141struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); 150struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
142void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 151void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 2cf4ffaa3cd4..bfe11be81f6f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -124,6 +124,8 @@ struct rpc_create_args {
124#define RPC_CLNT_CREATE_NOPING (1UL << 4) 124#define RPC_CLNT_CREATE_NOPING (1UL << 4)
125#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5) 125#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)
126#define RPC_CLNT_CREATE_QUIET (1UL << 6) 126#define RPC_CLNT_CREATE_QUIET (1UL << 6)
127#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7)
128#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8)
127 129
128struct rpc_clnt *rpc_create(struct rpc_create_args *args); 130struct rpc_clnt *rpc_create(struct rpc_create_args *args);
129struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 131struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index a19e2547ae6a..161463e59624 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -25,10 +25,21 @@ struct gss_ctx {
25 25
26#define GSS_C_NO_BUFFER ((struct xdr_netobj) 0) 26#define GSS_C_NO_BUFFER ((struct xdr_netobj) 0)
27#define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0) 27#define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0)
28#define GSS_C_NULL_OID ((struct xdr_netobj) 0) 28#define GSS_C_QOP_DEFAULT (0)
29 29
30/*XXX arbitrary length - is this set somewhere? */ 30/*XXX arbitrary length - is this set somewhere? */
31#define GSS_OID_MAX_LEN 32 31#define GSS_OID_MAX_LEN 32
32struct rpcsec_gss_oid {
33 unsigned int len;
34 u8 data[GSS_OID_MAX_LEN];
35};
36
37/* From RFC 3530 */
38struct rpcsec_gss_info {
39 struct rpcsec_gss_oid oid;
40 u32 qop;
41 u32 service;
42};
32 43
33/* gss-api prototypes; note that these are somewhat simplified versions of 44/* gss-api prototypes; note that these are somewhat simplified versions of
34 * the prototypes specified in RFC 2744. */ 45 * the prototypes specified in RFC 2744. */
@@ -37,6 +48,7 @@ int gss_import_sec_context(
37 size_t bufsize, 48 size_t bufsize,
38 struct gss_api_mech *mech, 49 struct gss_api_mech *mech,
39 struct gss_ctx **ctx_id, 50 struct gss_ctx **ctx_id,
51 time_t *endtime,
40 gfp_t gfp_mask); 52 gfp_t gfp_mask);
41u32 gss_get_mic( 53u32 gss_get_mic(
42 struct gss_ctx *ctx_id, 54 struct gss_ctx *ctx_id,
@@ -58,12 +70,14 @@ u32 gss_unwrap(
58u32 gss_delete_sec_context( 70u32 gss_delete_sec_context(
59 struct gss_ctx **ctx_id); 71 struct gss_ctx **ctx_id);
60 72
61u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service); 73rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop,
74 u32 service);
62u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor); 75u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
63char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service); 76char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
64 77
65struct pf_desc { 78struct pf_desc {
66 u32 pseudoflavor; 79 u32 pseudoflavor;
80 u32 qop;
67 u32 service; 81 u32 service;
68 char *name; 82 char *name;
69 char *auth_domain_name; 83 char *auth_domain_name;
@@ -76,7 +90,7 @@ struct pf_desc {
76struct gss_api_mech { 90struct gss_api_mech {
77 struct list_head gm_list; 91 struct list_head gm_list;
78 struct module *gm_owner; 92 struct module *gm_owner;
79 struct xdr_netobj gm_oid; 93 struct rpcsec_gss_oid gm_oid;
80 char *gm_name; 94 char *gm_name;
81 const struct gss_api_ops *gm_ops; 95 const struct gss_api_ops *gm_ops;
82 /* pseudoflavors supported by this mechanism: */ 96 /* pseudoflavors supported by this mechanism: */
@@ -92,6 +106,7 @@ struct gss_api_ops {
92 const void *input_token, 106 const void *input_token,
93 size_t bufsize, 107 size_t bufsize,
94 struct gss_ctx *ctx_id, 108 struct gss_ctx *ctx_id,
109 time_t *endtime,
95 gfp_t gfp_mask); 110 gfp_t gfp_mask);
96 u32 (*gss_get_mic)( 111 u32 (*gss_get_mic)(
97 struct gss_ctx *ctx_id, 112 struct gss_ctx *ctx_id,
@@ -119,7 +134,13 @@ void gss_mech_unregister(struct gss_api_mech *);
119 134
120/* returns a mechanism descriptor given an OID, and increments the mechanism's 135/* returns a mechanism descriptor given an OID, and increments the mechanism's
121 * reference count. */ 136 * reference count. */
122struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *); 137struct gss_api_mech * gss_mech_get_by_OID(struct rpcsec_gss_oid *);
138
139/* Given a GSS security tuple, look up a pseudoflavor */
140rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *);
141
142/* Given a pseudoflavor, look up a GSS security tuple */
143int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);
123 144
124/* Returns a reference to a mechanism, given a name like "krb5" etc. */ 145/* Returns a reference to a mechanism, given a name like "krb5" etc. */
125struct gss_api_mech *gss_mech_get_by_name(const char *); 146struct gss_api_mech *gss_mech_get_by_name(const char *);
@@ -130,9 +151,6 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
130/* Fill in an array with a list of supported pseudoflavors */ 151/* Fill in an array with a list of supported pseudoflavors */
131int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); 152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
132 153
133/* Just increments the mechanism's reference count and returns its input: */
134struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
135
136/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a 154/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
137 * corresponding call to gss_mech_put. */ 155 * corresponding call to gss_mech_put. */
138void gss_mech_put(struct gss_api_mech *); 156void gss_mech_put(struct gss_api_mech *);
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index c68a147939a6..aadc6a04e1ac 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -138,6 +138,9 @@ typedef __be32 rpc_fraghdr;
138#define RPC_MAX_HEADER_WITH_AUTH \ 138#define RPC_MAX_HEADER_WITH_AUTH \
139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) 139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4))
140 140
141#define RPC_MAX_REPHEADER_WITH_AUTH \
142 (RPC_REPHDRSIZE + (2 + RPC_MAX_AUTH_SIZE/4))
143
141/* 144/*
142 * RFC1833/RFC3530 rpcbind (v3+) well-known netid's. 145 * RFC1833/RFC3530 rpcbind (v3+) well-known netid's.
143 */ 146 */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 30834be03011..cec7b9b5e1bf 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -255,6 +255,9 @@ static inline int bc_prealloc(struct rpc_rqst *req)
255} 255}
256#endif /* CONFIG_SUNRPC_BACKCHANNEL */ 256#endif /* CONFIG_SUNRPC_BACKCHANNEL */
257 257
258#define XPRT_CREATE_INFINITE_SLOTS (1U)
259#define XPRT_CREATE_NO_IDLE_TIMEOUT (1U << 1)
260
258struct xprt_create { 261struct xprt_create {
259 int ident; /* XPRT_TRANSPORT identifier */ 262 int ident; /* XPRT_TRANSPORT identifier */
260 struct net * net; 263 struct net * net;
@@ -263,6 +266,7 @@ struct xprt_create {
263 size_t addrlen; 266 size_t addrlen;
264 const char *servername; 267 const char *servername;
265 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ 268 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
269 unsigned int flags;
266}; 270};
267 271
268struct xprt_class { 272struct xprt_class {
@@ -279,6 +283,7 @@ struct xprt_class {
279struct rpc_xprt *xprt_create_transport(struct xprt_create *args); 283struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
280void xprt_connect(struct rpc_task *task); 284void xprt_connect(struct rpc_task *task);
281void xprt_reserve(struct rpc_task *task); 285void xprt_reserve(struct rpc_task *task);
286void xprt_retry_reserve(struct rpc_task *task);
282int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 287int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
283int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
284void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
@@ -334,6 +339,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable);
334#define XPRT_CLOSING (6) 339#define XPRT_CLOSING (6)
335#define XPRT_CONNECTION_ABORT (7) 340#define XPRT_CONNECTION_ABORT (7)
336#define XPRT_CONNECTION_CLOSE (8) 341#define XPRT_CONNECTION_CLOSE (8)
342#define XPRT_CONGESTED (9)
337 343
338static inline void xprt_set_connected(struct rpc_xprt *xprt) 344static inline void xprt_set_connected(struct rpc_xprt *xprt)
339{ 345{
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 2818a123f3ea..1701ce4be746 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -236,7 +236,7 @@ extern unsigned long nr_free_pagecache_pages(void);
236extern void __lru_cache_add(struct page *, enum lru_list lru); 236extern void __lru_cache_add(struct page *, enum lru_list lru);
237extern void lru_cache_add_lru(struct page *, enum lru_list lru); 237extern void lru_cache_add_lru(struct page *, enum lru_list lru);
238extern void lru_add_page_tail(struct page *page, struct page *page_tail, 238extern void lru_add_page_tail(struct page *page, struct page *page_tail,
239 struct lruvec *lruvec); 239 struct lruvec *lruvec, struct list_head *head);
240extern void activate_page(struct page *); 240extern void activate_page(struct page *);
241extern void mark_page_accessed(struct page *); 241extern void mark_page_accessed(struct page *);
242extern void lru_add_drain(void); 242extern void lru_add_drain(void);
@@ -330,6 +330,9 @@ static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
330/* linux/mm/page_io.c */ 330/* linux/mm/page_io.c */
331extern int swap_readpage(struct page *); 331extern int swap_readpage(struct page *);
332extern int swap_writepage(struct page *page, struct writeback_control *wbc); 332extern int swap_writepage(struct page *page, struct writeback_control *wbc);
333extern void end_swap_bio_write(struct bio *bio, int err);
334extern int __swap_writepage(struct page *page, struct writeback_control *wbc,
335 void (*end_write_func)(struct bio *, int));
333extern int swap_set_page_dirty(struct page *page); 336extern int swap_set_page_dirty(struct page *page);
334extern void end_swap_bio_read(struct bio *bio, int err); 337extern void end_swap_bio_read(struct bio *bio, int err);
335 338
@@ -343,8 +346,9 @@ extern struct address_space swapper_spaces[];
343#define swap_address_space(entry) (&swapper_spaces[swp_type(entry)]) 346#define swap_address_space(entry) (&swapper_spaces[swp_type(entry)])
344extern unsigned long total_swapcache_pages(void); 347extern unsigned long total_swapcache_pages(void);
345extern void show_swap_cache_info(void); 348extern void show_swap_cache_info(void);
346extern int add_to_swap(struct page *); 349extern int add_to_swap(struct page *, struct list_head *list);
347extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); 350extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
351extern int __add_to_swap_cache(struct page *page, swp_entry_t entry);
348extern void __delete_from_swap_cache(struct page *); 352extern void __delete_from_swap_cache(struct page *);
349extern void delete_from_swap_cache(struct page *); 353extern void delete_from_swap_cache(struct page *);
350extern void free_page_and_swap_cache(struct page *); 354extern void free_page_and_swap_cache(struct page *);
@@ -461,7 +465,7 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)
461 return NULL; 465 return NULL;
462} 466}
463 467
464static inline int add_to_swap(struct page *page) 468static inline int add_to_swap(struct page *page, struct list_head *list)
465{ 469{
466 return 0; 470 return 0;
467} 471}
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 313a8e0a6553..4147d700a293 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -78,49 +78,34 @@ struct sigaltstack;
78#include <linux/key.h> 78#include <linux/key.h>
79#include <trace/syscall.h> 79#include <trace/syscall.h>
80 80
81#define __SC_DECL1(t1, a1) t1 a1 81/*
82#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) 82 * __MAP - apply a macro to syscall arguments
83#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__) 83 * __MAP(n, m, t1, a1, t2, a2, ..., tn, an) will expand to
84#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__) 84 * m(t1, a1), m(t2, a2), ..., m(tn, an)
85#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) 85 * The first argument must be equal to the amount of type/name
86#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) 86 * pairs given. Note that this list of pairs (i.e. the arguments
87 87 * of __MAP starting at the third one) is in the same format as
88#define __SC_LONG1(t1, a1) long a1 88 * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n>
89#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__) 89 */
90#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__) 90#define __MAP0(m,...)
91#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) 91#define __MAP1(m,t,a) m(t,a)
92#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) 92#define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__)
93#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) 93#define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__)
94 94#define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
95#define __SC_CAST1(t1, a1) (t1) a1 95#define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
96#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) 96#define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__)
97#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__) 97#define __MAP(n,...) __MAP##n(__VA_ARGS__)
98#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__) 98
99#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__) 99#define __SC_DECL(t, a) t a
100#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__) 100#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL))
101 101#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
102#define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long)) 102#define __SC_CAST(t, a) (t) a
103#define __SC_TEST1(t1, a1) __SC_TEST(t1) 103#define __SC_ARGS(t, a) a
104#define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__) 104#define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))
105#define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__)
106#define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__)
107#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
108#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
109 105
110#ifdef CONFIG_FTRACE_SYSCALLS 106#ifdef CONFIG_FTRACE_SYSCALLS
111#define __SC_STR_ADECL1(t, a) #a 107#define __SC_STR_ADECL(t, a) #a
112#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 108#define __SC_STR_TDECL(t, a) #t
113#define __SC_STR_ADECL3(t, a, ...) #a, __SC_STR_ADECL2(__VA_ARGS__)
114#define __SC_STR_ADECL4(t, a, ...) #a, __SC_STR_ADECL3(__VA_ARGS__)
115#define __SC_STR_ADECL5(t, a, ...) #a, __SC_STR_ADECL4(__VA_ARGS__)
116#define __SC_STR_ADECL6(t, a, ...) #a, __SC_STR_ADECL5(__VA_ARGS__)
117
118#define __SC_STR_TDECL1(t, a) #t
119#define __SC_STR_TDECL2(t, a, ...) #t, __SC_STR_TDECL1(__VA_ARGS__)
120#define __SC_STR_TDECL3(t, a, ...) #t, __SC_STR_TDECL2(__VA_ARGS__)
121#define __SC_STR_TDECL4(t, a, ...) #t, __SC_STR_TDECL3(__VA_ARGS__)
122#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
123#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
124 109
125extern struct ftrace_event_class event_class_syscall_enter; 110extern struct ftrace_event_class event_class_syscall_enter;
126extern struct ftrace_event_class event_class_syscall_exit; 111extern struct ftrace_event_class event_class_syscall_exit;
@@ -155,7 +140,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;
155 __attribute__((section("_ftrace_events"))) \ 140 __attribute__((section("_ftrace_events"))) \
156 *__event_exit_##sname = &event_exit_##sname; 141 *__event_exit_##sname = &event_exit_##sname;
157 142
158#define SYSCALL_METADATA(sname, nb) \ 143#define SYSCALL_METADATA(sname, nb, ...) \
144 static const char *types_##sname[] = { \
145 __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \
146 }; \
147 static const char *args_##sname[] = { \
148 __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \
149 }; \
159 SYSCALL_TRACE_ENTER_EVENT(sname); \ 150 SYSCALL_TRACE_ENTER_EVENT(sname); \
160 SYSCALL_TRACE_EXIT_EVENT(sname); \ 151 SYSCALL_TRACE_EXIT_EVENT(sname); \
161 static struct syscall_metadata __used \ 152 static struct syscall_metadata __used \
@@ -163,8 +154,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
163 .name = "sys"#sname, \ 154 .name = "sys"#sname, \
164 .syscall_nr = -1, /* Filled in at boot */ \ 155 .syscall_nr = -1, /* Filled in at boot */ \
165 .nb_args = nb, \ 156 .nb_args = nb, \
166 .types = types_##sname, \ 157 .types = nb ? types_##sname : NULL, \
167 .args = args_##sname, \ 158 .args = nb ? args_##sname : NULL, \
168 .enter_event = &event_enter_##sname, \ 159 .enter_event = &event_enter_##sname, \
169 .exit_event = &event_exit_##sname, \ 160 .exit_event = &event_exit_##sname, \
170 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 161 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
@@ -172,26 +163,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;
172 static struct syscall_metadata __used \ 163 static struct syscall_metadata __used \
173 __attribute__((section("__syscalls_metadata"))) \ 164 __attribute__((section("__syscalls_metadata"))) \
174 *__p_syscall_meta_##sname = &__syscall_meta_##sname; 165 *__p_syscall_meta_##sname = &__syscall_meta_##sname;
166#else
167#define SYSCALL_METADATA(sname, nb, ...)
168#endif
175 169
176#define SYSCALL_DEFINE0(sname) \ 170#define SYSCALL_DEFINE0(sname) \
177 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 171 SYSCALL_METADATA(_##sname, 0); \
178 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
179 static struct syscall_metadata __used \
180 __syscall_meta__##sname = { \
181 .name = "sys_"#sname, \
182 .syscall_nr = -1, /* Filled in at boot */ \
183 .nb_args = 0, \
184 .enter_event = &event_enter__##sname, \
185 .exit_event = &event_exit__##sname, \
186 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
187 }; \
188 static struct syscall_metadata __used \
189 __attribute__((section("__syscalls_metadata"))) \
190 *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
191 asmlinkage long sys_##sname(void) 172 asmlinkage long sys_##sname(void)
192#else
193#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
194#endif
195 173
196#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 174#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
197#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) 175#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
@@ -200,57 +178,23 @@ extern struct trace_event_functions exit_syscall_print_funcs;
200#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) 178#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
201#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 179#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
202 180
203#ifdef CONFIG_PPC64
204#define SYSCALL_ALIAS(alias, name) \
205 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
206 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
207#else
208#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS)
209#define SYSCALL_ALIAS(alias, name) \
210 asm ( #alias " = " #name "\n\t.globl " #alias)
211#else
212#define SYSCALL_ALIAS(alias, name) \
213 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
214#endif
215#endif
216
217#ifdef CONFIG_FTRACE_SYSCALLS
218#define SYSCALL_DEFINEx(x, sname, ...) \ 181#define SYSCALL_DEFINEx(x, sname, ...) \
219 static const char *types_##sname[] = { \ 182 SYSCALL_METADATA(sname, x, __VA_ARGS__) \
220 __SC_STR_TDECL##x(__VA_ARGS__) \
221 }; \
222 static const char *args_##sname[] = { \
223 __SC_STR_ADECL##x(__VA_ARGS__) \
224 }; \
225 SYSCALL_METADATA(sname, x); \
226 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) 183 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
227#else
228#define SYSCALL_DEFINEx(x, sname, ...) \
229 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
230#endif
231
232#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
233
234#define SYSCALL_DEFINE(name) static inline long SYSC_##name
235 184
185#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
236#define __SYSCALL_DEFINEx(x, name, ...) \ 186#define __SYSCALL_DEFINEx(x, name, ...) \
237 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ 187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
238 static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ 188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
239 asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ 189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
240 { \ 190 { \
241 __SC_TEST##x(__VA_ARGS__); \ 191 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
242 return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__)); \ 192 __MAP(x,__SC_TEST,__VA_ARGS__); \
193 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
194 return ret; \
243 } \ 195 } \
244 SYSCALL_ALIAS(sys##name, SyS##name); \ 196 SYSCALL_ALIAS(sys##name, SyS##name); \
245 static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)) 197 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
246
247#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
248
249#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
250#define __SYSCALL_DEFINEx(x, name, ...) \
251 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
252
253#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
254 198
255asmlinkage long sys_time(time_t __user *tloc); 199asmlinkage long sys_time(time_t __user *tloc);
256asmlinkage long sys_stime(time_t __user *tptr); 200asmlinkage long sys_stime(time_t __user *tptr);
@@ -694,7 +638,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
694asmlinkage long sys_semget(key_t key, int nsems, int semflg); 638asmlinkage long sys_semget(key_t key, int nsems, int semflg);
695asmlinkage long sys_semop(int semid, struct sembuf __user *sops, 639asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
696 unsigned nsops); 640 unsigned nsops);
697asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg); 641asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
698asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, 642asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
699 unsigned nsops, 643 unsigned nsops,
700 const struct timespec __user *timeout); 644 const struct timespec __user *timeout);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index f28408c07dc2..5adbc33d1ab3 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -90,9 +90,6 @@ struct tcp_options_received {
90 sack_ok : 4, /* SACK seen on SYN packet */ 90 sack_ok : 4, /* SACK seen on SYN packet */
91 snd_wscale : 4, /* Window scaling received from sender */ 91 snd_wscale : 4, /* Window scaling received from sender */
92 rcv_wscale : 4; /* Window scaling to send to receiver */ 92 rcv_wscale : 4; /* Window scaling to send to receiver */
93 u8 cookie_plus:6, /* bytes in authenticator/cookie option */
94 cookie_out_never:1,
95 cookie_in_always:1;
96 u8 num_sacks; /* Number of SACK blocks */ 93 u8 num_sacks; /* Number of SACK blocks */
97 u16 user_mss; /* mss requested by user in ioctl */ 94 u16 user_mss; /* mss requested by user in ioctl */
98 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 95 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
@@ -102,7 +99,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
102{ 99{
103 rx_opt->tstamp_ok = rx_opt->sack_ok = 0; 100 rx_opt->tstamp_ok = rx_opt->sack_ok = 0;
104 rx_opt->wscale_ok = rx_opt->snd_wscale = 0; 101 rx_opt->wscale_ok = rx_opt->snd_wscale = 0;
105 rx_opt->cookie_plus = 0;
106} 102}
107 103
108/* This is the max number of SACKS that we'll generate and process. It's safe 104/* This is the max number of SACKS that we'll generate and process. It's safe
@@ -191,20 +187,19 @@ struct tcp_sock {
191 u32 window_clamp; /* Maximal window to advertise */ 187 u32 window_clamp; /* Maximal window to advertise */
192 u32 rcv_ssthresh; /* Current window clamp */ 188 u32 rcv_ssthresh; /* Current window clamp */
193 189
194 u32 frto_highmark; /* snd_nxt when RTO occurred */
195 u16 advmss; /* Advertised MSS */ 190 u16 advmss; /* Advertised MSS */
196 u8 frto_counter; /* Number of new acks after RTO */ 191 u8 unused;
197 u8 nonagle : 4,/* Disable Nagle algorithm? */ 192 u8 nonagle : 4,/* Disable Nagle algorithm? */
198 thin_lto : 1,/* Use linear timeouts for thin streams */ 193 thin_lto : 1,/* Use linear timeouts for thin streams */
199 thin_dupack : 1,/* Fast retransmit on first dupack */ 194 thin_dupack : 1,/* Fast retransmit on first dupack */
200 repair : 1, 195 repair : 1,
201 unused : 1; 196 frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */
202 u8 repair_queue; 197 u8 repair_queue;
203 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 198 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
204 early_retrans_delayed:1, /* Delayed ER timer installed */
205 syn_data:1, /* SYN includes data */ 199 syn_data:1, /* SYN includes data */
206 syn_fastopen:1, /* SYN includes Fast Open option */ 200 syn_fastopen:1, /* SYN includes Fast Open option */
207 syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ 201 syn_data_acked:1;/* data in SYN is acked by SYN-ACK */
202 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
208 203
209/* RTT measurement */ 204/* RTT measurement */
210 u32 srtt; /* smoothed round trip time << 3 */ 205 u32 srtt; /* smoothed round trip time << 3 */
@@ -320,12 +315,6 @@ struct tcp_sock {
320 struct tcp_md5sig_info __rcu *md5sig_info; 315 struct tcp_md5sig_info __rcu *md5sig_info;
321#endif 316#endif
322 317
323 /* When the cookie options are generated and exchanged, then this
324 * object holds a reference to them (cookie_values->kref). Also
325 * contains related tcp_cookie_transactions fields.
326 */
327 struct tcp_cookie_values *cookie_values;
328
329/* TCP fastopen related information */ 318/* TCP fastopen related information */
330 struct tcp_fastopen_request *fastopen_req; 319 struct tcp_fastopen_request *fastopen_req;
331 /* fastopen_rsk points to request_sock that resulted in this big 320 /* fastopen_rsk points to request_sock that resulted in this big
@@ -361,10 +350,6 @@ struct tcp_timewait_sock {
361#ifdef CONFIG_TCP_MD5SIG 350#ifdef CONFIG_TCP_MD5SIG
362 struct tcp_md5sig_key *tw_md5_key; 351 struct tcp_md5sig_key *tw_md5_key;
363#endif 352#endif
364 /* Few sockets in timewait have cookies; in that case, then this
365 * object holds a reference to them (tw_cookie_values->kref).
366 */
367 struct tcp_cookie_values *tw_cookie_values;
368}; 353};
369 354
370static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) 355static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h
new file mode 100644
index 000000000000..55c29a8d5015
--- /dev/null
+++ b/include/linux/tegra-powergate.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) 2010 Google, Inc
3 *
4 * Author:
5 * Colin Cross <ccross@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _MACH_TEGRA_POWERGATE_H_
19#define _MACH_TEGRA_POWERGATE_H_
20
21struct clk;
22
23#define TEGRA_POWERGATE_CPU 0
24#define TEGRA_POWERGATE_3D 1
25#define TEGRA_POWERGATE_VENC 2
26#define TEGRA_POWERGATE_PCIE 3
27#define TEGRA_POWERGATE_VDEC 4
28#define TEGRA_POWERGATE_L2 5
29#define TEGRA_POWERGATE_MPE 6
30#define TEGRA_POWERGATE_HEG 7
31#define TEGRA_POWERGATE_SATA 8
32#define TEGRA_POWERGATE_CPU1 9
33#define TEGRA_POWERGATE_CPU2 10
34#define TEGRA_POWERGATE_CPU3 11
35#define TEGRA_POWERGATE_CELP 12
36#define TEGRA_POWERGATE_3D1 13
37
38#define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU
39#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
40
41int tegra_powergate_is_powered(int id);
42int tegra_powergate_power_on(int id);
43int tegra_powergate_power_off(int id);
44int tegra_powergate_remove_clamping(int id);
45
46/* Must be called with clk disabled, and returns with clk enabled */
47int tegra_powergate_sequence_power_up(int id, struct clk *clk);
48
49#endif /* _MACH_TEGRA_POWERGATE_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e3c0ae9bb1fa..a386a1cbb6e1 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -33,8 +33,11 @@
33#define THERMAL_MAX_TRIPS 12 33#define THERMAL_MAX_TRIPS 12
34#define THERMAL_NAME_LENGTH 20 34#define THERMAL_NAME_LENGTH 20
35 35
36/* invalid cooling state */
37#define THERMAL_CSTATE_INVALID -1UL
38
36/* No upper/lower limit requirement */ 39/* No upper/lower limit requirement */
37#define THERMAL_NO_LIMIT -1UL 40#define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID
38 41
39/* Unit conversion macros */ 42/* Unit conversion macros */
40#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ 43#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
@@ -184,7 +187,6 @@ struct thermal_governor {
184 char name[THERMAL_NAME_LENGTH]; 187 char name[THERMAL_NAME_LENGTH];
185 int (*throttle)(struct thermal_zone_device *tz, int trip); 188 int (*throttle)(struct thermal_zone_device *tz, int trip);
186 struct list_head governor_list; 189 struct list_head governor_list;
187 struct module *owner;
188}; 190};
189 191
190/* Structure that holds binding parameters for a zone */ 192/* Structure that holds binding parameters for a zone */
@@ -237,21 +239,20 @@ void thermal_zone_device_update(struct thermal_zone_device *);
237struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 239struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
238 const struct thermal_cooling_device_ops *); 240 const struct thermal_cooling_device_ops *);
239void thermal_cooling_device_unregister(struct thermal_cooling_device *); 241void thermal_cooling_device_unregister(struct thermal_cooling_device *);
242struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
243int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp);
240 244
241int get_tz_trend(struct thermal_zone_device *, int); 245int get_tz_trend(struct thermal_zone_device *, int);
242struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, 246struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
243 struct thermal_cooling_device *, int); 247 struct thermal_cooling_device *, int);
244void thermal_cdev_update(struct thermal_cooling_device *); 248void thermal_cdev_update(struct thermal_cooling_device *);
245void notify_thermal_framework(struct thermal_zone_device *, int); 249void thermal_notify_framework(struct thermal_zone_device *, int);
246
247int thermal_register_governor(struct thermal_governor *);
248void thermal_unregister_governor(struct thermal_governor *);
249 250
250#ifdef CONFIG_NET 251#ifdef CONFIG_NET
251extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, 252extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
252 enum events event); 253 enum events event);
253#else 254#else
254static int thermal_generate_netlink_event(struct thermal_zone_device *tz, 255static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
255 enum events event) 256 enum events event)
256{ 257{
257 return 0; 258 return 0;
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 553272e6af55..9180f4b85e6d 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -82,7 +82,7 @@ extern int tick_program_event(ktime_t expires, int force);
82extern void tick_setup_sched_timer(void); 82extern void tick_setup_sched_timer(void);
83# endif 83# endif
84 84
85# if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS 85# if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
86extern void tick_cancel_sched_timer(int cpu); 86extern void tick_cancel_sched_timer(int cpu);
87# else 87# else
88static inline void tick_cancel_sched_timer(int cpu) { } 88static inline void tick_cancel_sched_timer(int cpu) { }
@@ -123,7 +123,7 @@ static inline void tick_check_idle(int cpu) { }
123static inline int tick_oneshot_mode_active(void) { return 0; } 123static inline int tick_oneshot_mode_active(void) { return 0; }
124#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 124#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
125 125
126# ifdef CONFIG_NO_HZ 126# ifdef CONFIG_NO_HZ_COMMON
127DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched); 127DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched);
128 128
129static inline int tick_nohz_tick_stopped(void) 129static inline int tick_nohz_tick_stopped(void)
@@ -138,7 +138,7 @@ extern ktime_t tick_nohz_get_sleep_length(void);
138extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 138extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
139extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 139extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
140 140
141# else /* !CONFIG_NO_HZ */ 141# else /* !CONFIG_NO_HZ_COMMON */
142static inline int tick_nohz_tick_stopped(void) 142static inline int tick_nohz_tick_stopped(void)
143{ 143{
144 return 0; 144 return 0;
@@ -155,7 +155,24 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
155} 155}
156static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 156static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
157static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } 157static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
158# endif /* !NO_HZ */ 158# endif /* !CONFIG_NO_HZ_COMMON */
159
160#ifdef CONFIG_NO_HZ_FULL
161extern void tick_nohz_init(void);
162extern int tick_nohz_full_cpu(int cpu);
163extern void tick_nohz_full_check(void);
164extern void tick_nohz_full_kick(void);
165extern void tick_nohz_full_kick_all(void);
166extern void tick_nohz_task_switch(struct task_struct *tsk);
167#else
168static inline void tick_nohz_init(void) { }
169static inline int tick_nohz_full_cpu(int cpu) { return 0; }
170static inline void tick_nohz_full_check(void) { }
171static inline void tick_nohz_full_kick(void) { }
172static inline void tick_nohz_full_kick_all(void) { }
173static inline void tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif
175
159 176
160# ifdef CONFIG_CPU_IDLE_GOV_MENU 177# ifdef CONFIG_CPU_IDLE_GOV_MENU
161extern void menu_hrtimer_cancel(void); 178extern void menu_hrtimer_cancel(void);
diff --git a/include/linux/time.h b/include/linux/time.h
index d4835dfdf25e..d5d229b2e5af 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -117,14 +117,10 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
117 117
118extern bool persistent_clock_exist; 118extern bool persistent_clock_exist;
119 119
120#ifdef ALWAYS_USE_PERSISTENT_CLOCK
121#define has_persistent_clock() true
122#else
123static inline bool has_persistent_clock(void) 120static inline bool has_persistent_clock(void)
124{ 121{
125 return persistent_clock_exist; 122 return persistent_clock_exist;
126} 123}
127#endif
128 124
129extern void read_persistent_clock(struct timespec *ts); 125extern void read_persistent_clock(struct timespec *ts);
130extern void read_boot_clock(struct timespec *ts); 126extern void read_boot_clock(struct timespec *ts);
@@ -181,6 +177,9 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
181extern int timekeeping_valid_for_hres(void); 177extern int timekeeping_valid_for_hres(void);
182extern u64 timekeeping_max_deferment(void); 178extern u64 timekeeping_max_deferment(void);
183extern int timekeeping_inject_offset(struct timespec *ts); 179extern int timekeeping_inject_offset(struct timespec *ts);
180extern s32 timekeeping_get_tai_offset(void);
181extern void timekeeping_set_tai_offset(s32 tai_offset);
182extern void timekeeping_clocktai(struct timespec *ts);
184 183
185struct tms; 184struct tms;
186extern void do_sys_times(struct tms *); 185extern void do_sys_times(struct tms *);
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index e1d558e237ec..c1825eb436ed 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -20,6 +20,8 @@ struct timekeeper {
20 u32 shift; 20 u32 shift;
21 /* Number of clock cycles in one NTP interval. */ 21 /* Number of clock cycles in one NTP interval. */
22 cycle_t cycle_interval; 22 cycle_t cycle_interval;
23 /* Last cycle value (also stored in clock->cycle_last) */
24 cycle_t cycle_last;
23 /* Number of clock shifted nano seconds in one NTP interval. */ 25 /* Number of clock shifted nano seconds in one NTP interval. */
24 u64 xtime_interval; 26 u64 xtime_interval;
25 /* shifted nano seconds left over when rounding cycle_interval */ 27 /* shifted nano seconds left over when rounding cycle_interval */
@@ -62,8 +64,11 @@ struct timekeeper {
62 ktime_t offs_boot; 64 ktime_t offs_boot;
63 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ 65 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
64 struct timespec raw_time; 66 struct timespec raw_time;
65 /* Seqlock for all timekeeper values */ 67 /* The current UTC to TAI offset in seconds */
66 seqlock_t lock; 68 s32 tai_offset;
69 /* Offset clock monotonic -> clock tai */
70 ktime_t offs_tai;
71
67}; 72};
68 73
69static inline struct timespec tk_xtime(struct timekeeper *tk) 74static inline struct timespec tk_xtime(struct timekeeper *tk)
diff --git a/include/linux/timeriomem-rng.h b/include/linux/timeriomem-rng.h
index 3e08a1c86830..46eb27ddbfab 100644
--- a/include/linux/timeriomem-rng.h
+++ b/include/linux/timeriomem-rng.h
@@ -8,12 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/completion.h>
12
13struct timeriomem_rng_data { 11struct timeriomem_rng_data {
14 struct completion completion;
15 unsigned int present:1;
16
17 void __iomem *address; 12 void __iomem *address;
18 13
19 /* measures in usecs */ 14 /* measures in usecs */
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 5ec87c60b97c..b3726e61368e 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -125,9 +125,6 @@
125extern unsigned long tick_usec; /* USER_HZ period (usec) */ 125extern unsigned long tick_usec; /* USER_HZ period (usec) */
126extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ 126extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */
127 127
128extern void ntp_init(void);
129extern void ntp_clear(void);
130
131/* Required to safely shift negative values */ 128/* Required to safely shift negative values */
132#define shift_right(x, s) ({ \ 129#define shift_right(x, s) ({ \
133 __typeof__(x) __x = (x); \ 130 __typeof__(x) __x = (x); \
@@ -140,10 +137,6 @@ extern void ntp_clear(void);
140#define NTP_INTERVAL_FREQ (HZ) 137#define NTP_INTERVAL_FREQ (HZ)
141#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 138#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
142 139
143/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
144extern u64 ntp_tick_length(void);
145
146extern int second_overflow(unsigned long secs);
147extern int do_adjtimex(struct timex *); 140extern int do_adjtimex(struct timex *);
148extern void hardpps(const struct timespec *, const struct timespec *); 141extern void hardpps(const struct timespec *, const struct timespec *);
149 142
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h
index d563f37e1a1d..1d7ca2739272 100644
--- a/include/linux/trace_clock.h
+++ b/include/linux/trace_clock.h
@@ -16,6 +16,7 @@
16 16
17extern u64 notrace trace_clock_local(void); 17extern u64 notrace trace_clock_local(void);
18extern u64 notrace trace_clock(void); 18extern u64 notrace trace_clock(void);
19extern u64 notrace trace_clock_jiffies(void);
19extern u64 notrace trace_clock_global(void); 20extern u64 notrace trace_clock_global(void);
20extern u64 notrace trace_clock_counter(void); 21extern u64 notrace trace_clock_counter(void);
21 22
diff --git a/include/linux/tty.h b/include/linux/tty.h
index c75d886b0307..8780bd2a272a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -255,9 +255,9 @@ struct tty_struct {
255 int count; 255 int count;
256 struct winsize winsize; /* termios mutex */ 256 struct winsize winsize; /* termios mutex */
257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
258 unsigned char warned:1;
259 unsigned char ctrl_status; /* ctrl_lock */ 258 unsigned char ctrl_status; /* ctrl_lock */
260 unsigned int receive_room; /* Bytes free for queue */ 259 unsigned int receive_room; /* Bytes free for queue */
260 int flow_change;
261 261
262 struct tty_struct *link; 262 struct tty_struct *link;
263 struct fasync_struct *fasync; 263 struct fasync_struct *fasync;
@@ -315,9 +315,25 @@ struct tty_file_private {
315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
316#define TTY_HUPPED 18 /* Post driver->hangup() */ 316#define TTY_HUPPED 18 /* Post driver->hangup() */
317#define TTY_HUPPING 21 /* ->hangup() in progress */ 317#define TTY_HUPPING 21 /* ->hangup() in progress */
318#define TTY_LDISC_HALTED 22 /* Line discipline is halted */
318 319
319#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 320#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
320 321
322/* Values for tty->flow_change */
323#define TTY_THROTTLE_SAFE 1
324#define TTY_UNTHROTTLE_SAFE 2
325
326static inline void __tty_set_flow_change(struct tty_struct *tty, int val)
327{
328 tty->flow_change = val;
329}
330
331static inline void tty_set_flow_change(struct tty_struct *tty, int val)
332{
333 tty->flow_change = val;
334 smp_mb();
335}
336
321#ifdef CONFIG_TTY 337#ifdef CONFIG_TTY
322extern void console_init(void); 338extern void console_init(void);
323extern void tty_kref_put(struct tty_struct *tty); 339extern void tty_kref_put(struct tty_struct *tty);
@@ -400,6 +416,8 @@ extern int tty_write_room(struct tty_struct *tty);
400extern void tty_driver_flush_buffer(struct tty_struct *tty); 416extern void tty_driver_flush_buffer(struct tty_struct *tty);
401extern void tty_throttle(struct tty_struct *tty); 417extern void tty_throttle(struct tty_struct *tty);
402extern void tty_unthrottle(struct tty_struct *tty); 418extern void tty_unthrottle(struct tty_struct *tty);
419extern int tty_throttle_safe(struct tty_struct *tty);
420extern int tty_unthrottle_safe(struct tty_struct *tty);
403extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); 421extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
404extern void tty_driver_remove_tty(struct tty_driver *driver, 422extern void tty_driver_remove_tty(struct tty_driver *driver,
405 struct tty_struct *tty); 423 struct tty_struct *tty);
@@ -419,13 +437,28 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty);
419extern void tty_buffer_free_all(struct tty_port *port); 437extern void tty_buffer_free_all(struct tty_port *port);
420extern void tty_buffer_flush(struct tty_struct *tty); 438extern void tty_buffer_flush(struct tty_struct *tty);
421extern void tty_buffer_init(struct tty_port *port); 439extern void tty_buffer_init(struct tty_port *port);
422extern speed_t tty_get_baud_rate(struct tty_struct *tty);
423extern speed_t tty_termios_baud_rate(struct ktermios *termios); 440extern speed_t tty_termios_baud_rate(struct ktermios *termios);
424extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 441extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
425extern void tty_termios_encode_baud_rate(struct ktermios *termios, 442extern void tty_termios_encode_baud_rate(struct ktermios *termios,
426 speed_t ibaud, speed_t obaud); 443 speed_t ibaud, speed_t obaud);
427extern void tty_encode_baud_rate(struct tty_struct *tty, 444extern void tty_encode_baud_rate(struct tty_struct *tty,
428 speed_t ibaud, speed_t obaud); 445 speed_t ibaud, speed_t obaud);
446
447/**
448 * tty_get_baud_rate - get tty bit rates
449 * @tty: tty to query
450 *
451 * Returns the baud rate as an integer for this terminal. The
452 * termios lock must be held by the caller and the terminal bit
453 * flags may be updated.
454 *
455 * Locking: none
456 */
457static inline speed_t tty_get_baud_rate(struct tty_struct *tty)
458{
459 return tty_termios_baud_rate(&tty->termios);
460}
461
429extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 462extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
430extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 463extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
431extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); 464extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
@@ -502,6 +535,8 @@ extern int tty_port_carrier_raised(struct tty_port *port);
502extern void tty_port_raise_dtr_rts(struct tty_port *port); 535extern void tty_port_raise_dtr_rts(struct tty_port *port);
503extern void tty_port_lower_dtr_rts(struct tty_port *port); 536extern void tty_port_lower_dtr_rts(struct tty_port *port);
504extern void tty_port_hangup(struct tty_port *port); 537extern void tty_port_hangup(struct tty_port *port);
538extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal);
539extern void tty_port_tty_wakeup(struct tty_port *port);
505extern int tty_port_block_til_ready(struct tty_port *port, 540extern int tty_port_block_til_ready(struct tty_port *port,
506 struct tty_struct *tty, struct file *filp); 541 struct tty_struct *tty, struct file *filp);
507extern int tty_port_close_start(struct tty_port *port, 542extern int tty_port_close_start(struct tty_port *port,
@@ -526,8 +561,6 @@ extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty);
526extern void tty_ldisc_init(struct tty_struct *tty); 561extern void tty_ldisc_init(struct tty_struct *tty);
527extern void tty_ldisc_deinit(struct tty_struct *tty); 562extern void tty_ldisc_deinit(struct tty_struct *tty);
528extern void tty_ldisc_begin(void); 563extern void tty_ldisc_begin(void);
529/* This last one is just for the tty layer internals and shouldn't be used elsewhere */
530extern void tty_ldisc_enable(struct tty_struct *tty);
531 564
532 565
533/* n_tty.c */ 566/* n_tty.c */
@@ -542,8 +575,7 @@ extern void tty_audit_exit(void);
542extern void tty_audit_fork(struct signal_struct *sig); 575extern void tty_audit_fork(struct signal_struct *sig);
543extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 576extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
544extern void tty_audit_push(struct tty_struct *tty); 577extern void tty_audit_push(struct tty_struct *tty);
545extern int tty_audit_push_task(struct task_struct *tsk, 578extern int tty_audit_push_current(void);
546 kuid_t loginuid, u32 sessionid);
547#else 579#else
548static inline void tty_audit_add_data(struct tty_struct *tty, 580static inline void tty_audit_add_data(struct tty_struct *tty,
549 unsigned char *data, size_t size, unsigned icanon) 581 unsigned char *data, size_t size, unsigned icanon)
@@ -561,8 +593,7 @@ static inline void tty_audit_fork(struct signal_struct *sig)
561static inline void tty_audit_push(struct tty_struct *tty) 593static inline void tty_audit_push(struct tty_struct *tty)
562{ 594{
563} 595}
564static inline int tty_audit_push_task(struct task_struct *tsk, 596static inline int tty_audit_push_current(void)
565 kuid_t loginuid, u32 sessionid)
566{ 597{
567 return 0; 598 return 0;
568} 599}
@@ -658,5 +689,12 @@ do { \
658 finish_wait(&wq, &__wait); \ 689 finish_wait(&wq, &__wait); \
659} while (0) 690} while (0)
660 691
692#ifdef CONFIG_PROC_FS
693extern void proc_tty_register_driver(struct tty_driver *);
694extern void proc_tty_unregister_driver(struct tty_driver *);
695#else
696static inline void proc_tty_register_driver(struct tty_driver *d) {}
697static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
698#endif
661 699
662#endif 700#endif
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 455a0d7bf220..58390c73df8b 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -9,89 +9,89 @@
9 * 9 *
10 * int (*open)(struct tty_struct *); 10 * int (*open)(struct tty_struct *);
11 * 11 *
12 * This function is called when the line discipline is associated 12 * This function is called when the line discipline is associated
13 * with the tty. The line discipline can use this as an 13 * with the tty. The line discipline can use this as an
14 * opportunity to initialize any state needed by the ldisc routines. 14 * opportunity to initialize any state needed by the ldisc routines.
15 * 15 *
16 * void (*close)(struct tty_struct *); 16 * void (*close)(struct tty_struct *);
17 * 17 *
18 * This function is called when the line discipline is being 18 * This function is called when the line discipline is being
19 * shutdown, either because the tty is being closed or because 19 * shutdown, either because the tty is being closed or because
20 * the tty is being changed to use a new line discipline 20 * the tty is being changed to use a new line discipline
21 * 21 *
22 * void (*flush_buffer)(struct tty_struct *tty); 22 * void (*flush_buffer)(struct tty_struct *tty);
23 * 23 *
24 * This function instructs the line discipline to clear its 24 * This function instructs the line discipline to clear its
25 * buffers of any input characters it may have queued to be 25 * buffers of any input characters it may have queued to be
26 * delivered to the user mode process. 26 * delivered to the user mode process.
27 * 27 *
28 * ssize_t (*chars_in_buffer)(struct tty_struct *tty); 28 * ssize_t (*chars_in_buffer)(struct tty_struct *tty);
29 * 29 *
30 * This function returns the number of input characters the line 30 * This function returns the number of input characters the line
31 * discipline may have queued up to be delivered to the user mode 31 * discipline may have queued up to be delivered to the user mode
32 * process. 32 * process.
33 * 33 *
34 * ssize_t (*read)(struct tty_struct * tty, struct file * file, 34 * ssize_t (*read)(struct tty_struct * tty, struct file * file,
35 * unsigned char * buf, size_t nr); 35 * unsigned char * buf, size_t nr);
36 * 36 *
37 * This function is called when the user requests to read from 37 * This function is called when the user requests to read from
38 * the tty. The line discipline will return whatever characters 38 * the tty. The line discipline will return whatever characters
39 * it has buffered up for the user. If this function is not 39 * it has buffered up for the user. If this function is not
40 * defined, the user will receive an EIO error. 40 * defined, the user will receive an EIO error.
41 * 41 *
42 * ssize_t (*write)(struct tty_struct * tty, struct file * file, 42 * ssize_t (*write)(struct tty_struct * tty, struct file * file,
43 * const unsigned char * buf, size_t nr); 43 * const unsigned char * buf, size_t nr);
44 * 44 *
45 * This function is called when the user requests to write to the 45 * This function is called when the user requests to write to the
46 * tty. The line discipline will deliver the characters to the 46 * tty. The line discipline will deliver the characters to the
47 * low-level tty device for transmission, optionally performing 47 * low-level tty device for transmission, optionally performing
48 * some processing on the characters first. If this function is 48 * some processing on the characters first. If this function is
49 * not defined, the user will receive an EIO error. 49 * not defined, the user will receive an EIO error.
50 * 50 *
51 * int (*ioctl)(struct tty_struct * tty, struct file * file, 51 * int (*ioctl)(struct tty_struct * tty, struct file * file,
52 * unsigned int cmd, unsigned long arg); 52 * unsigned int cmd, unsigned long arg);
53 * 53 *
54 * This function is called when the user requests an ioctl which 54 * This function is called when the user requests an ioctl which
55 * is not handled by the tty layer or the low-level tty driver. 55 * is not handled by the tty layer or the low-level tty driver.
56 * It is intended for ioctls which affect line discpline 56 * It is intended for ioctls which affect line discpline
57 * operation. Note that the search order for ioctls is (1) tty 57 * operation. Note that the search order for ioctls is (1) tty
58 * layer, (2) tty low-level driver, (3) line discpline. So a 58 * layer, (2) tty low-level driver, (3) line discpline. So a
59 * low-level driver can "grab" an ioctl request before the line 59 * low-level driver can "grab" an ioctl request before the line
60 * discpline has a chance to see it. 60 * discpline has a chance to see it.
61 * 61 *
62 * long (*compat_ioctl)(struct tty_struct * tty, struct file * file, 62 * long (*compat_ioctl)(struct tty_struct * tty, struct file * file,
63 * unsigned int cmd, unsigned long arg); 63 * unsigned int cmd, unsigned long arg);
64 * 64 *
65 * Process ioctl calls from 32-bit process on 64-bit system 65 * Process ioctl calls from 32-bit process on 64-bit system
66 * 66 *
67 * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 67 * void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
68 * 68 *
69 * This function notifies the line discpline that a change has 69 * This function notifies the line discpline that a change has
70 * been made to the termios structure. 70 * been made to the termios structure.
71 * 71 *
72 * int (*poll)(struct tty_struct * tty, struct file * file, 72 * int (*poll)(struct tty_struct * tty, struct file * file,
73 * poll_table *wait); 73 * poll_table *wait);
74 * 74 *
75 * This function is called when a user attempts to select/poll on a 75 * This function is called when a user attempts to select/poll on a
76 * tty device. It is solely the responsibility of the line 76 * tty device. It is solely the responsibility of the line
77 * discipline to handle poll requests. 77 * discipline to handle poll requests.
78 * 78 *
79 * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 79 * void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
80 * char *fp, int count); 80 * char *fp, int count);
81 * 81 *
82 * This function is called by the low-level tty driver to send 82 * This function is called by the low-level tty driver to send
83 * characters received by the hardware to the line discpline for 83 * characters received by the hardware to the line discpline for
84 * processing. <cp> is a pointer to the buffer of input 84 * processing. <cp> is a pointer to the buffer of input
85 * character received by the device. <fp> is a pointer to a 85 * character received by the device. <fp> is a pointer to a
86 * pointer of flag bytes which indicate whether a character was 86 * pointer of flag bytes which indicate whether a character was
87 * received with a parity error, etc. 87 * received with a parity error, etc.
88 * 88 *
89 * void (*write_wakeup)(struct tty_struct *); 89 * void (*write_wakeup)(struct tty_struct *);
90 * 90 *
91 * This function is called by the low-level tty driver to signal 91 * This function is called by the low-level tty driver to signal
92 * that line discpline should try to send more characters to the 92 * that line discpline should try to send more characters to the
93 * low-level driver for transmission. If the line discpline does 93 * low-level driver for transmission. If the line discpline does
94 * not have any more data to send, it can just return. 94 * not have any more data to send, it can just return.
95 * 95 *
96 * int (*hangup)(struct tty_struct *) 96 * int (*hangup)(struct tty_struct *)
97 * 97 *
@@ -115,7 +115,7 @@ struct tty_ldisc_ops {
115 char *name; 115 char *name;
116 int num; 116 int num;
117 int flags; 117 int flags;
118 118
119 /* 119 /*
120 * The following routines are called from above. 120 * The following routines are called from above.
121 */ 121 */
@@ -123,19 +123,19 @@ struct tty_ldisc_ops {
123 void (*close)(struct tty_struct *); 123 void (*close)(struct tty_struct *);
124 void (*flush_buffer)(struct tty_struct *tty); 124 void (*flush_buffer)(struct tty_struct *tty);
125 ssize_t (*chars_in_buffer)(struct tty_struct *tty); 125 ssize_t (*chars_in_buffer)(struct tty_struct *tty);
126 ssize_t (*read)(struct tty_struct * tty, struct file * file, 126 ssize_t (*read)(struct tty_struct *tty, struct file *file,
127 unsigned char __user * buf, size_t nr); 127 unsigned char __user *buf, size_t nr);
128 ssize_t (*write)(struct tty_struct * tty, struct file * file, 128 ssize_t (*write)(struct tty_struct *tty, struct file *file,
129 const unsigned char * buf, size_t nr); 129 const unsigned char *buf, size_t nr);
130 int (*ioctl)(struct tty_struct * tty, struct file * file, 130 int (*ioctl)(struct tty_struct *tty, struct file *file,
131 unsigned int cmd, unsigned long arg); 131 unsigned int cmd, unsigned long arg);
132 long (*compat_ioctl)(struct tty_struct * tty, struct file * file, 132 long (*compat_ioctl)(struct tty_struct *tty, struct file *file,
133 unsigned int cmd, unsigned long arg); 133 unsigned int cmd, unsigned long arg);
134 void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 134 void (*set_termios)(struct tty_struct *tty, struct ktermios *old);
135 unsigned int (*poll)(struct tty_struct *, struct file *, 135 unsigned int (*poll)(struct tty_struct *, struct file *,
136 struct poll_table_struct *); 136 struct poll_table_struct *);
137 int (*hangup)(struct tty_struct *tty); 137 int (*hangup)(struct tty_struct *tty);
138 138
139 /* 139 /*
140 * The following routines are called from below. 140 * The following routines are called from below.
141 */ 141 */
@@ -145,7 +145,7 @@ struct tty_ldisc_ops {
145 void (*dcd_change)(struct tty_struct *, unsigned int); 145 void (*dcd_change)(struct tty_struct *, unsigned int);
146 146
147 struct module *owner; 147 struct module *owner;
148 148
149 int refcount; 149 int refcount;
150}; 150};
151 151
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index d21b33c4c6ca..2e9ee4d1c676 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -83,15 +83,12 @@
83#define UCB_ID 0x7e 83#define UCB_ID 0x7e
84#define UCB_ID_1400 0x4304 84#define UCB_ID_1400 0x4304
85 85
86struct ucb1400_gpio_data {
87 int gpio_offset;
88 int (*gpio_setup)(struct device *dev, int ngpio);
89 int (*gpio_teardown)(struct device *dev, int ngpio);
90};
91
92struct ucb1400_gpio { 86struct ucb1400_gpio {
93 struct gpio_chip gc; 87 struct gpio_chip gc;
94 struct snd_ac97 *ac97; 88 struct snd_ac97 *ac97;
89 int gpio_offset;
90 int (*gpio_setup)(struct device *dev, int ngpio);
91 int (*gpio_teardown)(struct device *dev, int ngpio);
95}; 92};
96 93
97struct ucb1400_ts { 94struct ucb1400_ts {
@@ -110,6 +107,9 @@ struct ucb1400 {
110 107
111struct ucb1400_pdata { 108struct ucb1400_pdata {
112 int irq; 109 int irq;
110 int gpio_offset;
111 int (*gpio_setup)(struct device *dev, int ngpio);
112 int (*gpio_teardown)(struct device *dev, int ngpio);
113}; 113};
114 114
115static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) 115static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -162,10 +162,4 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
162unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, 162unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
163 int adcsync); 163 int adcsync);
164 164
165#ifdef CONFIG_GPIO_UCB1400
166void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
167#else
168static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
169#endif
170
171#endif 165#endif
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 629aaf51f30b..c55ce243cc09 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -35,4 +35,7 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
35} 35}
36 36
37unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); 37unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
38
39int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
40int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
38#endif 41#endif
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 02b83db8e2c5..06f28beed7c2 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -38,6 +38,8 @@ struct inode;
38#define UPROBE_HANDLER_REMOVE 1 38#define UPROBE_HANDLER_REMOVE 1
39#define UPROBE_HANDLER_MASK 1 39#define UPROBE_HANDLER_MASK 1
40 40
41#define MAX_URETPROBE_DEPTH 64
42
41enum uprobe_filter_ctx { 43enum uprobe_filter_ctx {
42 UPROBE_FILTER_REGISTER, 44 UPROBE_FILTER_REGISTER,
43 UPROBE_FILTER_UNREGISTER, 45 UPROBE_FILTER_UNREGISTER,
@@ -46,6 +48,9 @@ enum uprobe_filter_ctx {
46 48
47struct uprobe_consumer { 49struct uprobe_consumer {
48 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); 50 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
51 int (*ret_handler)(struct uprobe_consumer *self,
52 unsigned long func,
53 struct pt_regs *regs);
49 bool (*filter)(struct uprobe_consumer *self, 54 bool (*filter)(struct uprobe_consumer *self,
50 enum uprobe_filter_ctx ctx, 55 enum uprobe_filter_ctx ctx,
51 struct mm_struct *mm); 56 struct mm_struct *mm);
@@ -68,6 +73,8 @@ struct uprobe_task {
68 enum uprobe_task_state state; 73 enum uprobe_task_state state;
69 struct arch_uprobe_task autask; 74 struct arch_uprobe_task autask;
70 75
76 struct return_instance *return_instances;
77 unsigned int depth;
71 struct uprobe *active_uprobe; 78 struct uprobe *active_uprobe;
72 79
73 unsigned long xol_vaddr; 80 unsigned long xol_vaddr;
@@ -100,6 +107,7 @@ struct uprobes_state {
100extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 107extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
101extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 108extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
102extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 109extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
110extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
103extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 111extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
104extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 112extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
105extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 113extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 4d22d0f6167a..a0bee5a28d1a 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -469,14 +469,12 @@ struct usb3_lpm_parameters {
469 * @lpm_capable: device supports LPM 469 * @lpm_capable: device supports LPM
470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled
472 * @usb3_lpm_enabled: USB3 hardware LPM enabled
472 * @string_langid: language ID for strings 473 * @string_langid: language ID for strings
473 * @product: iProduct string, if present (static) 474 * @product: iProduct string, if present (static)
474 * @manufacturer: iManufacturer string, if present (static) 475 * @manufacturer: iManufacturer string, if present (static)
475 * @serial: iSerialNumber string, if present (static) 476 * @serial: iSerialNumber string, if present (static)
476 * @filelist: usbfs files that are open to this device 477 * @filelist: usbfs files that are open to this device
477 * @usb_classdev: USB class device that was created for usbfs device
478 * access from userspace
479 * @usbfs_dentry: usbfs dentry entry for the device
480 * @maxchild: number of ports if hub 478 * @maxchild: number of ports if hub
481 * @quirks: quirks of the whole device 479 * @quirks: quirks of the whole device
482 * @urbnum: number of URBs submitted for the whole device 480 * @urbnum: number of URBs submitted for the whole device
@@ -619,7 +617,7 @@ static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
619#endif 617#endif
620 618
621/* USB autosuspend and autoresume */ 619/* USB autosuspend and autoresume */
622#ifdef CONFIG_USB_SUSPEND 620#ifdef CONFIG_PM_RUNTIME
623extern void usb_enable_autosuspend(struct usb_device *udev); 621extern void usb_enable_autosuspend(struct usb_device *udev);
624extern void usb_disable_autosuspend(struct usb_device *udev); 622extern void usb_disable_autosuspend(struct usb_device *udev);
625 623
@@ -978,7 +976,12 @@ struct usbdrv_wrap {
978 * the "usbfs" filesystem. This lets devices provide ways to 976 * the "usbfs" filesystem. This lets devices provide ways to
979 * expose information to user space regardless of where they 977 * expose information to user space regardless of where they
980 * do (or don't) show up otherwise in the filesystem. 978 * do (or don't) show up otherwise in the filesystem.
981 * @suspend: Called when the device is going to be suspended by the system. 979 * @suspend: Called when the device is going to be suspended by the
980 * system either from system sleep or runtime suspend context. The
981 * return value will be ignored in system sleep context, so do NOT
982 * try to continue using the device if suspend fails in this case.
983 * Instead, let the resume or reset-resume routine recover from
984 * the failure.
982 * @resume: Called when the device is being resumed by the system. 985 * @resume: Called when the device is being resumed by the system.
983 * @reset_resume: Called when the suspended device has been reset instead 986 * @reset_resume: Called when the suspended device has been reset instead
984 * of being resumed. 987 * of being resumed.
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index ed13053153f4..c5f2158ab00e 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -170,6 +170,8 @@ struct uac2_as_header_descriptor {
170 __u8 iChannelNames; 170 __u8 iChannelNames;
171} __attribute__((packed)); 171} __attribute__((packed));
172 172
173#define UAC2_FORMAT_TYPE_I_RAW_DATA (1 << 31)
174
173/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ 175/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */
174 176
175struct uac2_iso_endpoint_descriptor { 177struct uac2_iso_endpoint_descriptor {
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h
index 719c332620fa..0b3f4295c025 100644
--- a/include/linux/usb/cdc-wdm.h
+++ b/include/linux/usb/cdc-wdm.h
@@ -11,6 +11,8 @@
11#ifndef __LINUX_USB_CDC_WDM_H 11#ifndef __LINUX_USB_CDC_WDM_H
12#define __LINUX_USB_CDC_WDM_H 12#define __LINUX_USB_CDC_WDM_H
13 13
14#include <uapi/linux/usb/cdc-wdm.h>
15
14extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf, 16extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,
15 struct usb_endpoint_descriptor *ep, 17 struct usb_endpoint_descriptor *ep,
16 int bufsize, 18 int bufsize,
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 9c210f2283df..27603bcbb9b9 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -43,4 +43,13 @@
43 */ 43 */
44extern const char *usb_speed_string(enum usb_device_speed speed); 44extern const char *usb_speed_string(enum usb_device_speed speed);
45 45
46
47/**
48 * usb_state_string - Returns human readable name for the state.
49 * @state: The state to return a human-readable name for. If it's not
50 * any of the states devices in usb_device_state_string enum,
51 * the string UNKNOWN will be returned.
52 */
53extern const char *usb_state_string(enum usb_device_state state);
54
46#endif /* __LINUX_USB_CH9_H */ 55#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 8860594d6364..5e61589fc166 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -39,6 +39,7 @@
39#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
40#include <linux/usb/gadget.h> 40#include <linux/usb/gadget.h>
41#include <linux/log2.h> 41#include <linux/log2.h>
42#include <linux/configfs.h>
42 43
43/* 44/*
44 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they 45 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
@@ -464,6 +465,8 @@ struct usb_function_driver {
464}; 465};
465 466
466struct usb_function_instance { 467struct usb_function_instance {
468 struct config_group group;
469 struct list_head cfs_list;
467 struct usb_function_driver *fd; 470 struct usb_function_driver *fd;
468 void (*free_func_inst)(struct usb_function_instance *inst); 471 void (*free_func_inst)(struct usb_function_instance *inst);
469}; 472};
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
index 51eae14477f7..5615f4d82724 100644
--- a/include/linux/usb/dwc3-omap.h
+++ b/include/linux/usb/dwc3-omap.h
@@ -19,11 +19,11 @@ enum omap_dwc3_vbus_id_status {
19}; 19};
20 20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) 21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); 22extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else 23#else
24static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) 24static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{ 25{
26 return; 26 return -ENODEV;
27} 27}
28#endif 28#endif
29 29
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 2e297e80d59a..f1b0dca60f12 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -482,6 +482,7 @@ struct usb_gadget_ops {
482 * @speed: Speed of current connection to USB host. 482 * @speed: Speed of current connection to USB host.
483 * @max_speed: Maximal speed the UDC can handle. UDC must support this 483 * @max_speed: Maximal speed the UDC can handle. UDC must support this
484 * and all slower speeds. 484 * and all slower speeds.
485 * @state: the state we are now (attached, suspended, configured, etc)
485 * @sg_supported: true if we can handle scatter-gather 486 * @sg_supported: true if we can handle scatter-gather
486 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 487 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
487 * gadget driver must provide a USB OTG descriptor. 488 * gadget driver must provide a USB OTG descriptor.
@@ -525,6 +526,7 @@ struct usb_gadget {
525 struct list_head ep_list; /* of usb_ep */ 526 struct list_head ep_list; /* of usb_ep */
526 enum usb_device_speed speed; 527 enum usb_device_speed speed;
527 enum usb_device_speed max_speed; 528 enum usb_device_speed max_speed;
529 enum usb_device_state state;
528 unsigned sg_supported:1; 530 unsigned sg_supported:1;
529 unsigned is_otg:1; 531 unsigned is_otg:1;
530 unsigned is_a_peripheral:1; 532 unsigned is_a_peripheral:1;
@@ -561,9 +563,8 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
561} 563}
562 564
563/** 565/**
564 * gadget_is_superspeed() - return true if the hardware handles 566 * gadget_is_superspeed() - return true if the hardware handles superspeed
565 * supperspeed 567 * @g: controller that might support superspeed
566 * @g: controller that might support supper speed
567 */ 568 */
568static inline int gadget_is_superspeed(struct usb_gadget *g) 569static inline int gadget_is_superspeed(struct usb_gadget *g)
569{ 570{
@@ -872,6 +873,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver);
872 */ 873 */
873int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 874int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
874 875
876extern int usb_add_gadget_udc_release(struct device *parent,
877 struct usb_gadget *gadget, void (*release)(struct device *dev));
875extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); 878extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
876extern void usb_del_gadget_udc(struct usb_gadget *gadget); 879extern void usb_del_gadget_udc(struct usb_gadget *gadget);
877extern int udc_attach_driver(const char *name, 880extern int udc_attach_driver(const char *name,
@@ -959,6 +962,13 @@ extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
959 962
960/*-------------------------------------------------------------------------*/ 963/*-------------------------------------------------------------------------*/
961 964
965/* utility to set gadget state properly */
966
967extern void usb_gadget_set_state(struct usb_gadget *gadget,
968 enum usb_device_state state);
969
970/*-------------------------------------------------------------------------*/
971
962/* utility wrapping a simple endpoint selection policy */ 972/* utility wrapping a simple endpoint selection policy */
963 973
964extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 974extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h
new file mode 100644
index 000000000000..d74c0ae989d5
--- /dev/null
+++ b/include/linux/usb/gadget_configfs.h
@@ -0,0 +1,110 @@
1#ifndef __GADGET_CONFIGFS__
2#define __GADGET_CONFIGFS__
3
4#include <linux/configfs.h>
5
6int check_user_usb_string(const char *name,
7 struct usb_gadget_strings *stringtab_dev);
8
9#define GS_STRINGS_W(__struct, __name) \
10 static ssize_t __struct##_##__name##_store(struct __struct *gs, \
11 const char *page, size_t len) \
12{ \
13 int ret; \
14 \
15 ret = usb_string_copy(page, &gs->__name); \
16 if (ret) \
17 return ret; \
18 return len; \
19}
20
21#define GS_STRINGS_R(__struct, __name) \
22 static ssize_t __struct##_##__name##_show(struct __struct *gs, \
23 char *page) \
24{ \
25 return sprintf(page, "%s\n", gs->__name ?: ""); \
26}
27
28#define GS_STRING_ITEM_ATTR(struct_name, name) \
29 static struct struct_name##_attribute struct_name##_##name = \
30 __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \
31 struct_name##_##name##_show, \
32 struct_name##_##name##_store)
33
34#define GS_STRINGS_RW(struct_name, _name) \
35 GS_STRINGS_R(struct_name, _name) \
36 GS_STRINGS_W(struct_name, _name) \
37 GS_STRING_ITEM_ATTR(struct_name, _name)
38
39#define USB_CONFIG_STRING_RW_OPS(struct_in) \
40 CONFIGFS_ATTR_OPS(struct_in); \
41 \
42static struct configfs_item_operations struct_in##_langid_item_ops = { \
43 .release = struct_in##_attr_release, \
44 .show_attribute = struct_in##_attr_show, \
45 .store_attribute = struct_in##_attr_store, \
46}; \
47 \
48static struct config_item_type struct_in##_langid_type = { \
49 .ct_item_ops = &struct_in##_langid_item_ops, \
50 .ct_attrs = struct_in##_langid_attrs, \
51 .ct_owner = THIS_MODULE, \
52}
53
54#define USB_CONFIG_STRINGS_LANG(struct_in, struct_member) \
55 static struct config_group *struct_in##_strings_make( \
56 struct config_group *group, \
57 const char *name) \
58 { \
59 struct struct_member *gi; \
60 struct struct_in *gs; \
61 struct struct_in *new; \
62 int langs = 0; \
63 int ret; \
64 \
65 new = kzalloc(sizeof(*new), GFP_KERNEL); \
66 if (!new) \
67 return ERR_PTR(-ENOMEM); \
68 \
69 ret = check_user_usb_string(name, &new->stringtab_dev); \
70 if (ret) \
71 goto err; \
72 config_group_init_type_name(&new->group, name, \
73 &struct_in##_langid_type); \
74 \
75 gi = container_of(group, struct struct_member, strings_group); \
76 ret = -EEXIST; \
77 list_for_each_entry(gs, &gi->string_list, list) { \
78 if (gs->stringtab_dev.language == new->stringtab_dev.language) \
79 goto err; \
80 langs++; \
81 } \
82 ret = -EOVERFLOW; \
83 if (langs >= MAX_USB_STRING_LANGS) \
84 goto err; \
85 \
86 list_add_tail(&new->list, &gi->string_list); \
87 return &new->group; \
88err: \
89 kfree(new); \
90 return ERR_PTR(ret); \
91} \
92 \
93static void struct_in##_strings_drop( \
94 struct config_group *group, \
95 struct config_item *item) \
96{ \
97 config_item_put(item); \
98} \
99 \
100static struct configfs_group_operations struct_in##_strings_ops = { \
101 .make_group = &struct_in##_strings_make, \
102 .drop_item = &struct_in##_strings_drop, \
103}; \
104 \
105static struct config_item_type struct_in##_strings_type = { \
106 .ct_group_ops = &struct_in##_strings_ops, \
107 .ct_owner = THIS_MODULE, \
108}
109
110#endif
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 59694b5e5e90..f5f5c7dfda90 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -84,7 +84,7 @@ struct usb_hcd {
84 84
85 struct timer_list rh_timer; /* drives root-hub polling */ 85 struct timer_list rh_timer; /* drives root-hub polling */
86 struct urb *status_urb; /* the current status urb */ 86 struct urb *status_urb; /* the current status urb */
87#ifdef CONFIG_USB_SUSPEND 87#ifdef CONFIG_PM_RUNTIME
88 struct work_struct wakeup_work; /* for remote wakeup */ 88 struct work_struct wakeup_work; /* for remote wakeup */
89#endif 89#endif
90 90
@@ -593,14 +593,14 @@ extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
593extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); 593extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
594#endif /* CONFIG_PM */ 594#endif /* CONFIG_PM */
595 595
596#ifdef CONFIG_USB_SUSPEND 596#ifdef CONFIG_PM_RUNTIME
597extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); 597extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
598#else 598#else
599static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) 599static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
600{ 600{
601 return; 601 return;
602} 602}
603#endif /* CONFIG_USB_SUSPEND */ 603#endif /* CONFIG_PM_RUNTIME */
604 604
605/*-------------------------------------------------------------------------*/ 605/*-------------------------------------------------------------------------*/
606 606
diff --git a/include/linux/irqchip/sunxi.h b/include/linux/usb/musb-ux500.h
index 1fe2c2260e2b..1e2c7130f6e1 100644
--- a/include/linux/irqchip/sunxi.h
+++ b/include/linux/usb/musb-ux500.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * Copyright 2012 Maxime Ripard 2 * Copyright (C) 2013 ST-Ericsson AB
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 * 3 *
6 * 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 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -14,14 +12,20 @@
14 * GNU General Public License for more details. 12 * GNU General Public License for more details.
15 */ 13 */
16 14
17#ifndef __LINUX_IRQCHIP_SUNXI_H 15#ifndef __MUSB_UX500_H__
18#define __LINUX_IRQCHIP_SUNXI_H 16#define __MUSB_UX500_H__
19
20#include <asm/exception.h>
21
22extern void sunxi_init_irq(void);
23 17
24extern asmlinkage void __exception_irq_entry sunxi_handle_irq( 18enum ux500_musb_vbus_id_status {
25 struct pt_regs *regs); 19 UX500_MUSB_NONE = 0,
20 UX500_MUSB_VBUS,
21 UX500_MUSB_ID,
22 UX500_MUSB_CHARGER,
23 UX500_MUSB_ENUMERATED,
24 UX500_MUSB_RIDA,
25 UX500_MUSB_RIDB,
26 UX500_MUSB_RIDC,
27 UX500_MUSB_PREPARE,
28 UX500_MUSB_CLEAN,
29};
26 30
27#endif 31#endif /* __MUSB_UX500_H__ */
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
index 28884c717411..148d35171aac 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -5,6 +5,11 @@
5 5
6struct nop_usb_xceiv_platform_data { 6struct nop_usb_xceiv_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate;
9
10 /* if set fails with -EPROBE_DEFER if can't get regulator */
11 unsigned int needs_vcc:1;
12 unsigned int needs_reset:1;
8}; 13};
9 14
10#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 15#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index e8a5fe87c6bd..291e01ba32e5 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -36,14 +36,7 @@ struct usb_otg {
36 36
37}; 37};
38 38
39#ifdef CONFIG_USB_OTG_UTILS 39extern const char *usb_otg_state_string(enum usb_otg_state state);
40extern const char *otg_state_string(enum usb_otg_state state);
41#else
42static inline const char *otg_state_string(enum usb_otg_state state)
43{
44 return NULL;
45}
46#endif
47 40
48/* Context: can sleep */ 41/* Context: can sleep */
49static inline int 42static inline int
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 15847cbdb512..6b5978f57633 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -91,6 +91,9 @@ struct usb_phy {
91 int (*init)(struct usb_phy *x); 91 int (*init)(struct usb_phy *x);
92 void (*shutdown)(struct usb_phy *x); 92 void (*shutdown)(struct usb_phy *x);
93 93
94 /* enable/disable VBUS */
95 int (*set_vbus)(struct usb_phy *x, int on);
96
94 /* effective for B devices, ignored for A-peripheral */ 97 /* effective for B devices, ignored for A-peripheral */
95 int (*set_power)(struct usb_phy *x, 98 int (*set_power)(struct usb_phy *x,
96 unsigned mA); 99 unsigned mA);
@@ -160,8 +163,26 @@ usb_phy_shutdown(struct usb_phy *x)
160 x->shutdown(x); 163 x->shutdown(x);
161} 164}
162 165
166static inline int
167usb_phy_vbus_on(struct usb_phy *x)
168{
169 if (!x->set_vbus)
170 return 0;
171
172 return x->set_vbus(x, true);
173}
174
175static inline int
176usb_phy_vbus_off(struct usb_phy *x)
177{
178 if (!x->set_vbus)
179 return 0;
180
181 return x->set_vbus(x, false);
182}
183
163/* for usb host and peripheral controller drivers */ 184/* for usb host and peripheral controller drivers */
164#ifdef CONFIG_USB_OTG_UTILS 185#if IS_ENABLED(CONFIG_USB_PHY)
165extern struct usb_phy *usb_get_phy(enum usb_phy_type type); 186extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
166extern struct usb_phy *devm_usb_get_phy(struct device *dev, 187extern struct usb_phy *devm_usb_get_phy(struct device *dev,
167 enum usb_phy_type type); 188 enum usb_phy_type type);
@@ -176,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index,
176#else 197#else
177static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) 198static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
178{ 199{
179 return NULL; 200 return ERR_PTR(-ENXIO);
180} 201}
181 202
182static inline struct usb_phy *devm_usb_get_phy(struct device *dev, 203static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
183 enum usb_phy_type type) 204 enum usb_phy_type type)
184{ 205{
185 return NULL; 206 return ERR_PTR(-ENXIO);
186} 207}
187 208
188static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) 209static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
189{ 210{
190 return NULL; 211 return ERR_PTR(-ENXIO);
191} 212}
192 213
193static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index) 214static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
194{ 215{
195 return NULL; 216 return ERR_PTR(-ENXIO);
196} 217}
197 218
198static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, 219static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
199 const char *phandle, u8 index) 220 const char *phandle, u8 index)
200{ 221{
201 return NULL; 222 return ERR_PTR(-ENXIO);
202} 223}
203 224
204static inline void usb_put_phy(struct usb_phy *x) 225static inline void usb_put_phy(struct usb_phy *x)
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index c5d36c65c33b..e452ba6ec6bd 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -62,14 +62,14 @@ struct renesas_usbhs_platform_callback {
62 * Hardware exit function for platform. 62 * Hardware exit function for platform.
63 * it is called when driver was removed 63 * it is called when driver was removed
64 */ 64 */
65 void (*hardware_exit)(struct platform_device *pdev); 65 int (*hardware_exit)(struct platform_device *pdev);
66 66
67 /* 67 /*
68 * option: 68 * option:
69 * 69 *
70 * for board specific clock control 70 * for board specific clock control
71 */ 71 */
72 void (*power_ctrl)(struct platform_device *pdev, 72 int (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable); 73 void __iomem *base, int enable);
74 74
75 /* 75 /*
@@ -77,7 +77,7 @@ struct renesas_usbhs_platform_callback {
77 * 77 *
78 * Phy reset for platform 78 * Phy reset for platform
79 */ 79 */
80 void (*phy_reset)(struct platform_device *pdev); 80 int (*phy_reset)(struct platform_device *pdev);
81 81
82 /* 82 /*
83 * get USB ID function 83 * get USB ID function
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 1819b59aab2a..302ddf55d2da 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/kref.h> 16#include <linux/kref.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/serial.h>
18#include <linux/sysrq.h> 19#include <linux/sysrq.h>
19#include <linux/kfifo.h> 20#include <linux/kfifo.h>
20 21
@@ -61,12 +62,12 @@
61 * @bulk_out_buffers: pointers to the bulk out buffers for this port 62 * @bulk_out_buffers: pointers to the bulk out buffers for this port
62 * @write_urbs: pointers to the bulk out urbs for this port 63 * @write_urbs: pointers to the bulk out urbs for this port
63 * @write_urbs_free: status bitmap the for bulk out urbs 64 * @write_urbs_free: status bitmap the for bulk out urbs
65 * @icount: interrupt counters
64 * @tx_bytes: number of bytes currently in host stack queues 66 * @tx_bytes: number of bytes currently in host stack queues
65 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 67 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
66 * port. 68 * port.
67 * @flags: usb serial port flags 69 * @flags: usb serial port flags
68 * @write_wait: a wait_queue_head_t used by the port. 70 * @write_wait: a wait_queue_head_t used by the port.
69 * @delta_msr_wait: modem-status-change wait queue
70 * @work: work queue entry for the line discipline waking up. 71 * @work: work queue entry for the line discipline waking up.
71 * @throttled: nonzero if the read urb is inactive to throttle the device 72 * @throttled: nonzero if the read urb is inactive to throttle the device
72 * @throttle_req: nonzero if the tty wants to throttle us 73 * @throttle_req: nonzero if the tty wants to throttle us
@@ -109,11 +110,11 @@ struct usb_serial_port {
109 unsigned long write_urbs_free; 110 unsigned long write_urbs_free;
110 __u8 bulk_out_endpointAddress; 111 __u8 bulk_out_endpointAddress;
111 112
113 struct async_icount icount;
112 int tx_bytes; 114 int tx_bytes;
113 115
114 unsigned long flags; 116 unsigned long flags;
115 wait_queue_head_t write_wait; 117 wait_queue_head_t write_wait;
116 wait_queue_head_t delta_msr_wait;
117 struct work_struct work; 118 struct work_struct work;
118 char throttled; 119 char throttled;
119 char throttle_req; 120 char throttle_req;
@@ -267,11 +268,14 @@ struct usb_serial_driver {
267 struct usb_serial_port *port, struct ktermios *old); 268 struct usb_serial_port *port, struct ktermios *old);
268 void (*break_ctl)(struct tty_struct *tty, int break_state); 269 void (*break_ctl)(struct tty_struct *tty, int break_state);
269 int (*chars_in_buffer)(struct tty_struct *tty); 270 int (*chars_in_buffer)(struct tty_struct *tty);
271 void (*wait_until_sent)(struct tty_struct *tty, long timeout);
272 bool (*tx_empty)(struct usb_serial_port *port);
270 void (*throttle)(struct tty_struct *tty); 273 void (*throttle)(struct tty_struct *tty);
271 void (*unthrottle)(struct tty_struct *tty); 274 void (*unthrottle)(struct tty_struct *tty);
272 int (*tiocmget)(struct tty_struct *tty); 275 int (*tiocmget)(struct tty_struct *tty);
273 int (*tiocmset)(struct tty_struct *tty, 276 int (*tiocmset)(struct tty_struct *tty,
274 unsigned int set, unsigned int clear); 277 unsigned int set, unsigned int clear);
278 int (*tiocmiwait)(struct tty_struct *tty, unsigned long arg);
275 int (*get_icount)(struct tty_struct *tty, 279 int (*get_icount)(struct tty_struct *tty,
276 struct serial_icounter_struct *icount); 280 struct serial_icounter_struct *icount);
277 /* Called by the tty layer for port level work. There may or may not 281 /* Called by the tty layer for port level work. There may or may not
@@ -325,12 +329,16 @@ extern void usb_serial_generic_close(struct usb_serial_port *port);
325extern int usb_serial_generic_resume(struct usb_serial *serial); 329extern int usb_serial_generic_resume(struct usb_serial *serial);
326extern int usb_serial_generic_write_room(struct tty_struct *tty); 330extern int usb_serial_generic_write_room(struct tty_struct *tty);
327extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); 331extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty);
332extern void usb_serial_generic_wait_until_sent(struct tty_struct *tty,
333 long timeout);
328extern void usb_serial_generic_read_bulk_callback(struct urb *urb); 334extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
329extern void usb_serial_generic_write_bulk_callback(struct urb *urb); 335extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
330extern void usb_serial_generic_throttle(struct tty_struct *tty); 336extern void usb_serial_generic_throttle(struct tty_struct *tty);
331extern void usb_serial_generic_unthrottle(struct tty_struct *tty); 337extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
332extern void usb_serial_generic_disconnect(struct usb_serial *serial); 338extern int usb_serial_generic_tiocmiwait(struct tty_struct *tty,
333extern void usb_serial_generic_release(struct usb_serial *serial); 339 unsigned long arg);
340extern int usb_serial_generic_get_icount(struct tty_struct *tty,
341 struct serial_icounter_struct *icount);
334extern int usb_serial_generic_register(void); 342extern int usb_serial_generic_register(void);
335extern void usb_serial_generic_deregister(void); 343extern void usb_serial_generic_deregister(void);
336extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, 344extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port,
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 9ebebe906925..1b7519a8c0bf 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -61,10 +61,14 @@ struct tegra_usb_phy {
61 struct device *dev; 61 struct device *dev;
62 bool is_legacy_phy; 62 bool is_legacy_phy;
63 bool is_ulpi_phy; 63 bool is_ulpi_phy;
64 void (*set_pts)(struct usb_phy *x, u8 pts_val);
65 void (*set_phcd)(struct usb_phy *x, bool enable);
64}; 66};
65 67
66struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, 68struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
67 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); 69 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode,
70 void (*set_pts)(struct usb_phy *x, u8 pts_val),
71 void (*set_phcd)(struct usb_phy *x, bool enable));
68 72
69void tegra_usb_phy_preresume(struct usb_phy *phy); 73void tegra_usb_phy_preresume(struct usb_phy *phy);
70 74
@@ -75,8 +79,4 @@ void tegra_ehci_phy_restore_start(struct usb_phy *phy,
75 79
76void tegra_ehci_phy_restore_end(struct usb_phy *phy); 80void tegra_ehci_phy_restore_end(struct usb_phy *phy);
77 81
78void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val);
79
80void tegra_ehci_set_phcd(struct usb_phy *x, bool enable);
81
82#endif /* __TEGRA_USB_PHY_H */ 82#endif /* __TEGRA_USB_PHY_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0e5ac93bab10..f18d64129f99 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -56,6 +56,8 @@ struct usbnet {
56 struct sk_buff_head done; 56 struct sk_buff_head done;
57 struct sk_buff_head rxq_pause; 57 struct sk_buff_head rxq_pause;
58 struct urb *interrupt; 58 struct urb *interrupt;
59 unsigned interrupt_count;
60 struct mutex interrupt_mutex;
59 struct usb_anchor deferred; 61 struct usb_anchor deferred;
60 struct tasklet_struct bh; 62 struct tasklet_struct bh;
61 63
@@ -72,6 +74,7 @@ struct usbnet {
72# define EVENT_DEVICE_REPORT_IDLE 8 74# define EVENT_DEVICE_REPORT_IDLE 8
73# define EVENT_NO_RUNTIME_PM 9 75# define EVENT_NO_RUNTIME_PM 9
74# define EVENT_RX_KILL 10 76# define EVENT_RX_KILL 10
77# define EVENT_LINK_CHANGE 11
75}; 78};
76 79
77static inline struct usb_driver *driver_of(struct usb_interface *intf) 80static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -245,5 +248,9 @@ extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
245extern int usbnet_nway_reset(struct net_device *net); 248extern int usbnet_nway_reset(struct net_device *net);
246 249
247extern int usbnet_manage_power(struct usbnet *, int); 250extern int usbnet_manage_power(struct usbnet *, int);
251extern void usbnet_link_change(struct usbnet *, bool, bool);
252
253extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
254extern void usbnet_status_stop(struct usbnet *dev);
248 255
249#endif /* __LINUX_USB_USBNET_H */ 256#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index 75818744ab59..ea7168a68081 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -115,9 +115,6 @@ unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
115void vexpress_sysreg_early_init(void __iomem *base); 115void vexpress_sysreg_early_init(void __iomem *base);
116void vexpress_sysreg_of_early_init(void); 116void vexpress_sysreg_of_early_init(void);
117 117
118void vexpress_power_off(void);
119void vexpress_restart(char str, const char *cmd);
120
121/* Clocks */ 118/* Clocks */
122 119
123struct clk *vexpress_osc_setup(struct device *dev); 120struct clk *vexpress_osc_setup(struct device *dev);
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index ab9e86224c54..ac8d488e4372 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -45,6 +45,9 @@ extern int vfio_add_group_dev(struct device *dev,
45 void *device_data); 45 void *device_data);
46 46
47extern void *vfio_del_group_dev(struct device *dev); 47extern void *vfio_del_group_dev(struct device *dev);
48extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
49extern void vfio_device_put(struct vfio_device *device);
50extern void *vfio_device_data(struct vfio_device *device);
48 51
49/** 52/**
50 * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks 53 * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index ff6714e6d0f5..9ff8645b7e0b 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -8,6 +8,7 @@
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/vringh.h>
11 12
12/** 13/**
13 * virtqueue - a queue to register buffers for sending or receiving. 14 * virtqueue - a queue to register buffers for sending or receiving.
@@ -40,6 +41,23 @@ int virtqueue_add_buf(struct virtqueue *vq,
40 void *data, 41 void *data,
41 gfp_t gfp); 42 gfp_t gfp);
42 43
44int virtqueue_add_outbuf(struct virtqueue *vq,
45 struct scatterlist sg[], unsigned int num,
46 void *data,
47 gfp_t gfp);
48
49int virtqueue_add_inbuf(struct virtqueue *vq,
50 struct scatterlist sg[], unsigned int num,
51 void *data,
52 gfp_t gfp);
53
54int virtqueue_add_sgs(struct virtqueue *vq,
55 struct scatterlist *sgs[],
56 unsigned int out_sgs,
57 unsigned int in_sgs,
58 void *data,
59 gfp_t gfp);
60
43void virtqueue_kick(struct virtqueue *vq); 61void virtqueue_kick(struct virtqueue *vq);
44 62
45bool virtqueue_kick_prepare(struct virtqueue *vq); 63bool virtqueue_kick_prepare(struct virtqueue *vq);
@@ -58,18 +76,13 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
58 76
59unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 77unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
60 78
61/* FIXME: Obsolete accessor, but required for virtio_net merge. */
62static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq)
63{
64 return vq->index;
65}
66
67/** 79/**
68 * virtio_device - representation of a device using virtio 80 * virtio_device - representation of a device using virtio
69 * @index: unique position on the virtio bus 81 * @index: unique position on the virtio bus
70 * @dev: underlying device. 82 * @dev: underlying device.
71 * @id: the device type identification (used to match it with a driver). 83 * @id: the device type identification (used to match it with a driver).
72 * @config: the configuration ops for this device. 84 * @config: the configuration ops for this device.
85 * @vringh_config: configuration ops for host vrings.
73 * @vqs: the list of virtqueues for this device. 86 * @vqs: the list of virtqueues for this device.
74 * @features: the features supported by both driver and device. 87 * @features: the features supported by both driver and device.
75 * @priv: private pointer for the driver's use. 88 * @priv: private pointer for the driver's use.
@@ -79,6 +92,7 @@ struct virtio_device {
79 struct device dev; 92 struct device dev;
80 struct virtio_device_id id; 93 struct virtio_device_id id;
81 const struct virtio_config_ops *config; 94 const struct virtio_config_ops *config;
95 const struct vringh_config_ops *vringh_config;
82 struct list_head vqs; 96 struct list_head vqs;
83 /* Note that this is a Linux set_bit-style bitmap. */ 97 /* Note that this is a Linux set_bit-style bitmap. */
84 unsigned long features[1]; 98 unsigned long features[1];
diff --git a/include/linux/virtio_caif.h b/include/linux/virtio_caif.h
new file mode 100644
index 000000000000..5d2d3124ca3d
--- /dev/null
+++ b/include/linux/virtio_caif.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2012
3 * Author: Sjur Brændeland <sjur.brandeland@stericsson.com>
4 *
5 * This header is BSD licensed so
6 * anyone can use the definitions to implement compatible remote processors
7 */
8
9#ifndef VIRTIO_CAIF_H
10#define VIRTIO_CAIF_H
11
12#include <linux/types.h>
13struct virtio_caif_transf_config {
14 u16 headroom;
15 u16 tailroom;
16 u32 mtu;
17 u8 reserved[4];
18};
19
20struct virtio_caif_config {
21 struct virtio_caif_transf_config uplink, downlink;
22 u8 reserved[8];
23};
24#endif
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 63c6ea199519..ca3ad41c2c82 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -4,6 +4,63 @@
4#include <linux/irqreturn.h> 4#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h> 5#include <uapi/linux/virtio_ring.h>
6 6
7/*
8 * Barriers in virtio are tricky. Non-SMP virtio guests can't assume
9 * they're not on an SMP host system, so they need to assume real
10 * barriers. Non-SMP virtio hosts could skip the barriers, but does
11 * anyone care?
12 *
13 * For virtio_pci on SMP, we don't need to order with respect to MMIO
14 * accesses through relaxed memory I/O windows, so smp_mb() et al are
15 * sufficient.
16 *
17 * For using virtio to talk to real devices (eg. other heterogeneous
18 * CPUs) we do need real barriers. In theory, we could be using both
19 * kinds of virtio, so it's a runtime decision, and the branch is
20 * actually quite cheap.
21 */
22
23#ifdef CONFIG_SMP
24static inline void virtio_mb(bool weak_barriers)
25{
26 if (weak_barriers)
27 smp_mb();
28 else
29 mb();
30}
31
32static inline void virtio_rmb(bool weak_barriers)
33{
34 if (weak_barriers)
35 smp_rmb();
36 else
37 rmb();
38}
39
40static inline void virtio_wmb(bool weak_barriers)
41{
42 if (weak_barriers)
43 smp_wmb();
44 else
45 wmb();
46}
47#else
48static inline void virtio_mb(bool weak_barriers)
49{
50 mb();
51}
52
53static inline void virtio_rmb(bool weak_barriers)
54{
55 rmb();
56}
57
58static inline void virtio_wmb(bool weak_barriers)
59{
60 wmb();
61}
62#endif
63
7struct virtio_device; 64struct virtio_device;
8struct virtqueue; 65struct virtqueue;
9 66
diff --git a/include/linux/vm_sockets.h b/include/linux/vm_sockets.h
new file mode 100644
index 000000000000..0805eecba8f7
--- /dev/null
+++ b/include/linux/vm_sockets.h
@@ -0,0 +1,23 @@
1/*
2 * VMware vSockets Driver
3 *
4 * Copyright (C) 2007-2013 VMware, Inc. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation version 2 and no later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef _VM_SOCKETS_H
17#define _VM_SOCKETS_H
18
19#include <uapi/linux/vm_sockets.h>
20
21int vm_sockets_get_local_cid(void);
22
23#endif /* _VM_SOCKETS_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 6071e911c7f4..7d5773a99f20 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -3,7 +3,9 @@
3 3
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/list.h>
6#include <asm/page.h> /* pgprot_t */ 7#include <asm/page.h> /* pgprot_t */
8#include <linux/rbtree.h>
7 9
8struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 10struct vm_area_struct; /* vma defining user mapping in mm_types.h */
9 11
@@ -35,6 +37,17 @@ struct vm_struct {
35 const void *caller; 37 const void *caller;
36}; 38};
37 39
40struct vmap_area {
41 unsigned long va_start;
42 unsigned long va_end;
43 unsigned long flags;
44 struct rb_node rb_node; /* address sorted rbtree */
45 struct list_head list; /* address sorted list */
46 struct list_head purge_list; /* "lazy purge" list */
47 struct vm_struct *vm;
48 struct rcu_head rcu_head;
49};
50
38/* 51/*
39 * Highlevel APIs for driver use 52 * Highlevel APIs for driver use
40 */ 53 */
@@ -130,8 +143,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
130/* 143/*
131 * Internals. Dont't use.. 144 * Internals. Dont't use..
132 */ 145 */
133extern rwlock_t vmlist_lock; 146extern struct list_head vmap_area_list;
134extern struct vm_struct *vmlist;
135extern __init void vm_area_add_early(struct vm_struct *vm); 147extern __init void vm_area_add_early(struct vm_struct *vm);
136extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 148extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
137 149
@@ -158,4 +170,22 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
158# endif 170# endif
159#endif 171#endif
160 172
173struct vmalloc_info {
174 unsigned long used;
175 unsigned long largest_chunk;
176};
177
178#ifdef CONFIG_MMU
179#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
180extern void get_vmalloc_info(struct vmalloc_info *vmi);
181#else
182
183#define VMALLOC_TOTAL 0UL
184#define get_vmalloc_info(vmi) \
185do { \
186 (vmi)->used = 0; \
187 (vmi)->largest_chunk = 0; \
188} while (0)
189#endif
190
161#endif /* _LINUX_VMALLOC_H */ 191#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
new file mode 100644
index 000000000000..76be077340ea
--- /dev/null
+++ b/include/linux/vmpressure.h
@@ -0,0 +1,47 @@
1#ifndef __LINUX_VMPRESSURE_H
2#define __LINUX_VMPRESSURE_H
3
4#include <linux/mutex.h>
5#include <linux/list.h>
6#include <linux/workqueue.h>
7#include <linux/gfp.h>
8#include <linux/types.h>
9#include <linux/cgroup.h>
10
11struct vmpressure {
12 unsigned long scanned;
13 unsigned long reclaimed;
14 /* The lock is used to keep the scanned/reclaimed above in sync. */
15 struct mutex sr_lock;
16
17 /* The list of vmpressure_event structs. */
18 struct list_head events;
19 /* Have to grab the lock on events traversal or modifications. */
20 struct mutex events_lock;
21
22 struct work_struct work;
23};
24
25struct mem_cgroup;
26
27#ifdef CONFIG_MEMCG
28extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
29 unsigned long scanned, unsigned long reclaimed);
30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
31
32extern void vmpressure_init(struct vmpressure *vmpr);
33extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
34extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
35extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
36extern int vmpressure_register_event(struct cgroup *cg, struct cftype *cft,
37 struct eventfd_ctx *eventfd,
38 const char *args);
39extern void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft,
40 struct eventfd_ctx *eventfd);
41#else
42static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
43 unsigned long scanned, unsigned long reclaimed) {}
44static inline void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg,
45 int prio) {}
46#endif /* CONFIG_MEMCG */
47#endif /* __LINUX_VMPRESSURE_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 5fd71a7d0dfd..c586679b6fef 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -48,13 +48,8 @@ static inline void count_vm_events(enum vm_event_item item, long delta)
48} 48}
49 49
50extern void all_vm_events(unsigned long *); 50extern void all_vm_events(unsigned long *);
51#ifdef CONFIG_HOTPLUG 51
52extern void vm_events_fold_cpu(int cpu); 52extern void vm_events_fold_cpu(int cpu);
53#else
54static inline void vm_events_fold_cpu(int cpu)
55{
56}
57#endif
58 53
59#else 54#else
60 55
diff --git a/include/linux/vringh.h b/include/linux/vringh.h
new file mode 100644
index 000000000000..749cde28728b
--- /dev/null
+++ b/include/linux/vringh.h
@@ -0,0 +1,225 @@
1/*
2 * Linux host-side vring helpers; for when the kernel needs to access
3 * someone else's vring.
4 *
5 * Copyright IBM Corporation, 2013.
6 * Parts taken from drivers/vhost/vhost.c Copyright 2009 Red Hat, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 * Written by: Rusty Russell <rusty@rustcorp.com.au>
23 */
24#ifndef _LINUX_VRINGH_H
25#define _LINUX_VRINGH_H
26#include <uapi/linux/virtio_ring.h>
27#include <linux/uio.h>
28#include <linux/slab.h>
29#include <asm/barrier.h>
30
31/* virtio_ring with information needed for host access. */
32struct vringh {
33 /* Guest publishes used event idx (note: we always do). */
34 bool event_indices;
35
36 /* Can we get away with weak barriers? */
37 bool weak_barriers;
38
39 /* Last available index we saw (ie. where we're up to). */
40 u16 last_avail_idx;
41
42 /* Last index we used. */
43 u16 last_used_idx;
44
45 /* How many descriptors we've completed since last need_notify(). */
46 u32 completed;
47
48 /* The vring (note: it may contain user pointers!) */
49 struct vring vring;
50
51 /* The function to call to notify the guest about added buffers */
52 void (*notify)(struct vringh *);
53};
54
55/**
56 * struct vringh_config_ops - ops for creating a host vring from a virtio driver
57 * @find_vrhs: find the host vrings and instantiate them
58 * vdev: the virtio_device
59 * nhvrs: the number of host vrings to find
60 * hvrs: on success, includes new host vrings
61 * callbacks: array of driver callbacks, for each host vring
62 * include a NULL entry for vqs that do not need a callback
63 * Returns 0 on success or error status
64 * @del_vrhs: free the host vrings found by find_vrhs().
65 */
66struct virtio_device;
67typedef void vrh_callback_t(struct virtio_device *, struct vringh *);
68struct vringh_config_ops {
69 int (*find_vrhs)(struct virtio_device *vdev, unsigned nhvrs,
70 struct vringh *vrhs[], vrh_callback_t *callbacks[]);
71 void (*del_vrhs)(struct virtio_device *vdev);
72};
73
74/* The memory the vring can access, and what offset to apply. */
75struct vringh_range {
76 u64 start, end_incl;
77 u64 offset;
78};
79
80/**
81 * struct vringh_iov - iovec mangler.
82 *
83 * Mangles iovec in place, and restores it.
84 * Remaining data is iov + i, of used - i elements.
85 */
86struct vringh_iov {
87 struct iovec *iov;
88 size_t consumed; /* Within iov[i] */
89 unsigned i, used, max_num;
90};
91
92/**
93 * struct vringh_iov - kvec mangler.
94 *
95 * Mangles kvec in place, and restores it.
96 * Remaining data is iov + i, of used - i elements.
97 */
98struct vringh_kiov {
99 struct kvec *iov;
100 size_t consumed; /* Within iov[i] */
101 unsigned i, used, max_num;
102};
103
104/* Flag on max_num to indicate we're kmalloced. */
105#define VRINGH_IOV_ALLOCATED 0x8000000
106
107/* Helpers for userspace vrings. */
108int vringh_init_user(struct vringh *vrh, u32 features,
109 unsigned int num, bool weak_barriers,
110 struct vring_desc __user *desc,
111 struct vring_avail __user *avail,
112 struct vring_used __user *used);
113
114static inline void vringh_iov_init(struct vringh_iov *iov,
115 struct iovec *iovec, unsigned num)
116{
117 iov->used = iov->i = 0;
118 iov->consumed = 0;
119 iov->max_num = num;
120 iov->iov = iovec;
121}
122
123static inline void vringh_iov_reset(struct vringh_iov *iov)
124{
125 iov->iov[iov->i].iov_len += iov->consumed;
126 iov->iov[iov->i].iov_base -= iov->consumed;
127 iov->consumed = 0;
128 iov->i = 0;
129}
130
131static inline void vringh_iov_cleanup(struct vringh_iov *iov)
132{
133 if (iov->max_num & VRINGH_IOV_ALLOCATED)
134 kfree(iov->iov);
135 iov->max_num = iov->used = iov->i = iov->consumed = 0;
136 iov->iov = NULL;
137}
138
139/* Convert a descriptor into iovecs. */
140int vringh_getdesc_user(struct vringh *vrh,
141 struct vringh_iov *riov,
142 struct vringh_iov *wiov,
143 bool (*getrange)(struct vringh *vrh,
144 u64 addr, struct vringh_range *r),
145 u16 *head);
146
147/* Copy bytes from readable vsg, consuming it (and incrementing wiov->i). */
148ssize_t vringh_iov_pull_user(struct vringh_iov *riov, void *dst, size_t len);
149
150/* Copy bytes into writable vsg, consuming it (and incrementing wiov->i). */
151ssize_t vringh_iov_push_user(struct vringh_iov *wiov,
152 const void *src, size_t len);
153
154/* Mark a descriptor as used. */
155int vringh_complete_user(struct vringh *vrh, u16 head, u32 len);
156int vringh_complete_multi_user(struct vringh *vrh,
157 const struct vring_used_elem used[],
158 unsigned num_used);
159
160/* Pretend we've never seen descriptor (for easy error handling). */
161void vringh_abandon_user(struct vringh *vrh, unsigned int num);
162
163/* Do we need to fire the eventfd to notify the other side? */
164int vringh_need_notify_user(struct vringh *vrh);
165
166bool vringh_notify_enable_user(struct vringh *vrh);
167void vringh_notify_disable_user(struct vringh *vrh);
168
169/* Helpers for kernelspace vrings. */
170int vringh_init_kern(struct vringh *vrh, u32 features,
171 unsigned int num, bool weak_barriers,
172 struct vring_desc *desc,
173 struct vring_avail *avail,
174 struct vring_used *used);
175
176static inline void vringh_kiov_init(struct vringh_kiov *kiov,
177 struct kvec *kvec, unsigned num)
178{
179 kiov->used = kiov->i = 0;
180 kiov->consumed = 0;
181 kiov->max_num = num;
182 kiov->iov = kvec;
183}
184
185static inline void vringh_kiov_reset(struct vringh_kiov *kiov)
186{
187 kiov->iov[kiov->i].iov_len += kiov->consumed;
188 kiov->iov[kiov->i].iov_base -= kiov->consumed;
189 kiov->consumed = 0;
190 kiov->i = 0;
191}
192
193static inline void vringh_kiov_cleanup(struct vringh_kiov *kiov)
194{
195 if (kiov->max_num & VRINGH_IOV_ALLOCATED)
196 kfree(kiov->iov);
197 kiov->max_num = kiov->used = kiov->i = kiov->consumed = 0;
198 kiov->iov = NULL;
199}
200
201int vringh_getdesc_kern(struct vringh *vrh,
202 struct vringh_kiov *riov,
203 struct vringh_kiov *wiov,
204 u16 *head,
205 gfp_t gfp);
206
207ssize_t vringh_iov_pull_kern(struct vringh_kiov *riov, void *dst, size_t len);
208ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
209 const void *src, size_t len);
210void vringh_abandon_kern(struct vringh *vrh, unsigned int num);
211int vringh_complete_kern(struct vringh *vrh, u16 head, u32 len);
212
213bool vringh_notify_enable_kern(struct vringh *vrh);
214void vringh_notify_disable_kern(struct vringh *vrh);
215
216int vringh_need_notify_kern(struct vringh *vrh);
217
218/* Notify the guest about buffers added to the used ring */
219static inline void vringh_notify(struct vringh *vrh)
220{
221 if (vrh->notify)
222 vrh->notify(vrh);
223}
224
225#endif /* _LINUX_VRINGH_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index e8d65718560b..0d33fca48774 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -36,7 +36,7 @@ extern int fg_console, last_console, want_console;
36int vc_allocate(unsigned int console); 36int vc_allocate(unsigned int console);
37int vc_cons_allocated(unsigned int console); 37int vc_cons_allocated(unsigned int console);
38int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); 38int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
39void vc_deallocate(unsigned int console); 39struct vc_data *vc_deallocate(unsigned int console);
40void reset_palette(struct vc_data *vc); 40void reset_palette(struct vc_data *vc);
41void do_blank_screen(int entering_gfx); 41void do_blank_screen(int entering_gfx);
42void do_unblank_screen(int leaving_gfx); 42void do_unblank_screen(int leaving_gfx);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 7cb64d4b499d..1133695eb067 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -217,6 +217,8 @@ do { \
217 if (!ret) \ 217 if (!ret) \
218 break; \ 218 break; \
219 } \ 219 } \
220 if (!ret && (condition)) \
221 ret = 1; \
220 finish_wait(&wq, &__wait); \ 222 finish_wait(&wq, &__wait); \
221} while (0) 223} while (0)
222 224
@@ -233,8 +235,9 @@ do { \
233 * wake_up() has to be called after changing any variable that could 235 * wake_up() has to be called after changing any variable that could
234 * change the result of the wait condition. 236 * change the result of the wait condition.
235 * 237 *
236 * The function returns 0 if the @timeout elapsed, and the remaining 238 * The function returns 0 if the @timeout elapsed, or the remaining
237 * jiffies if the condition evaluated to true before the timeout elapsed. 239 * jiffies (at least 1) if the @condition evaluated to %true before
240 * the @timeout elapsed.
238 */ 241 */
239#define wait_event_timeout(wq, condition, timeout) \ 242#define wait_event_timeout(wq, condition, timeout) \
240({ \ 243({ \
@@ -302,6 +305,8 @@ do { \
302 ret = -ERESTARTSYS; \ 305 ret = -ERESTARTSYS; \
303 break; \ 306 break; \
304 } \ 307 } \
308 if (!ret && (condition)) \
309 ret = 1; \
305 finish_wait(&wq, &__wait); \ 310 finish_wait(&wq, &__wait); \
306} while (0) 311} while (0)
307 312
@@ -318,9 +323,10 @@ do { \
318 * wake_up() has to be called after changing any variable that could 323 * wake_up() has to be called after changing any variable that could
319 * change the result of the wait condition. 324 * change the result of the wait condition.
320 * 325 *
321 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it 326 * Returns:
322 * was interrupted by a signal, and the remaining jiffies otherwise 327 * 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by
323 * if the condition evaluated to true before the timeout elapsed. 328 * a signal, or the remaining jiffies (at least 1) if the @condition
329 * evaluated to %true before the @timeout elapsed.
324 */ 330 */
325#define wait_event_interruptible_timeout(wq, condition, timeout) \ 331#define wait_event_interruptible_timeout(wq, condition, timeout) \
326({ \ 332({ \
@@ -330,6 +336,92 @@ do { \
330 __ret; \ 336 __ret; \
331}) 337})
332 338
339#define __wait_event_hrtimeout(wq, condition, timeout, state) \
340({ \
341 int __ret = 0; \
342 DEFINE_WAIT(__wait); \
343 struct hrtimer_sleeper __t; \
344 \
345 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \
346 HRTIMER_MODE_REL); \
347 hrtimer_init_sleeper(&__t, current); \
348 if ((timeout).tv64 != KTIME_MAX) \
349 hrtimer_start_range_ns(&__t.timer, timeout, \
350 current->timer_slack_ns, \
351 HRTIMER_MODE_REL); \
352 \
353 for (;;) { \
354 prepare_to_wait(&wq, &__wait, state); \
355 if (condition) \
356 break; \
357 if (state == TASK_INTERRUPTIBLE && \
358 signal_pending(current)) { \
359 __ret = -ERESTARTSYS; \
360 break; \
361 } \
362 if (!__t.task) { \
363 __ret = -ETIME; \
364 break; \
365 } \
366 schedule(); \
367 } \
368 \
369 hrtimer_cancel(&__t.timer); \
370 destroy_hrtimer_on_stack(&__t.timer); \
371 finish_wait(&wq, &__wait); \
372 __ret; \
373})
374
375/**
376 * wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
377 * @wq: the waitqueue to wait on
378 * @condition: a C expression for the event to wait for
379 * @timeout: timeout, as a ktime_t
380 *
381 * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
382 * @condition evaluates to true or a signal is received.
383 * The @condition is checked each time the waitqueue @wq is woken up.
384 *
385 * wake_up() has to be called after changing any variable that could
386 * change the result of the wait condition.
387 *
388 * The function returns 0 if @condition became true, or -ETIME if the timeout
389 * elapsed.
390 */
391#define wait_event_hrtimeout(wq, condition, timeout) \
392({ \
393 int __ret = 0; \
394 if (!(condition)) \
395 __ret = __wait_event_hrtimeout(wq, condition, timeout, \
396 TASK_UNINTERRUPTIBLE); \
397 __ret; \
398})
399
400/**
401 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
402 * @wq: the waitqueue to wait on
403 * @condition: a C expression for the event to wait for
404 * @timeout: timeout, as a ktime_t
405 *
406 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
407 * @condition evaluates to true or a signal is received.
408 * The @condition is checked each time the waitqueue @wq is woken up.
409 *
410 * wake_up() has to be called after changing any variable that could
411 * change the result of the wait condition.
412 *
413 * The function returns 0 if @condition became true, -ERESTARTSYS if it was
414 * interrupted by a signal, or -ETIME if the timeout elapsed.
415 */
416#define wait_event_interruptible_hrtimeout(wq, condition, timeout) \
417({ \
418 long __ret = 0; \
419 if (!(condition)) \
420 __ret = __wait_event_hrtimeout(wq, condition, timeout, \
421 TASK_INTERRUPTIBLE); \
422 __ret; \
423})
424
333#define __wait_event_interruptible_exclusive(wq, condition, ret) \ 425#define __wait_event_interruptible_exclusive(wq, condition, ret) \
334do { \ 426do { \
335 DEFINE_WAIT(__wait); \ 427 DEFINE_WAIT(__wait); \
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 8afab27cdbc2..623488fdc1f5 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -11,6 +11,7 @@
11#include <linux/lockdep.h> 11#include <linux/lockdep.h>
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <linux/cpumask.h>
14 15
15struct workqueue_struct; 16struct workqueue_struct;
16 17
@@ -68,7 +69,7 @@ enum {
68 WORK_STRUCT_COLOR_BITS, 69 WORK_STRUCT_COLOR_BITS,
69 70
70 /* data contains off-queue information when !WORK_STRUCT_PWQ */ 71 /* data contains off-queue information when !WORK_STRUCT_PWQ */
71 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS, 72 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT,
72 73
73 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), 74 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE),
74 75
@@ -91,6 +92,9 @@ enum {
91 /* bit mask for work_busy() return values */ 92 /* bit mask for work_busy() return values */
92 WORK_BUSY_PENDING = 1 << 0, 93 WORK_BUSY_PENDING = 1 << 0,
93 WORK_BUSY_RUNNING = 1 << 1, 94 WORK_BUSY_RUNNING = 1 << 1,
95
96 /* maximum string length for set_worker_desc() */
97 WORKER_DESC_LEN = 24,
94}; 98};
95 99
96struct work_struct { 100struct work_struct {
@@ -115,6 +119,20 @@ struct delayed_work {
115 int cpu; 119 int cpu;
116}; 120};
117 121
122/*
123 * A struct for workqueue attributes. This can be used to change
124 * attributes of an unbound workqueue.
125 *
126 * Unlike other fields, ->no_numa isn't a property of a worker_pool. It
127 * only modifies how apply_workqueue_attrs() select pools and thus doesn't
128 * participate in pool hash calculations or equality comparisons.
129 */
130struct workqueue_attrs {
131 int nice; /* nice level */
132 cpumask_var_t cpumask; /* allowed CPUs */
133 bool no_numa; /* disable NUMA affinity */
134};
135
118static inline struct delayed_work *to_delayed_work(struct work_struct *work) 136static inline struct delayed_work *to_delayed_work(struct work_struct *work)
119{ 137{
120 return container_of(work, struct delayed_work, work); 138 return container_of(work, struct delayed_work, work);
@@ -283,9 +301,10 @@ enum {
283 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 301 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
284 WQ_HIGHPRI = 1 << 4, /* high priority */ 302 WQ_HIGHPRI = 1 << 4, /* high priority */
285 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 303 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
304 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */
286 305
287 WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */ 306 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
288 WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */ 307 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */
289 308
290 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ 309 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
291 WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ 310 WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */
@@ -388,7 +407,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
388 * Pointer to the allocated workqueue on success, %NULL on failure. 407 * Pointer to the allocated workqueue on success, %NULL on failure.
389 */ 408 */
390#define alloc_ordered_workqueue(fmt, flags, args...) \ 409#define alloc_ordered_workqueue(fmt, flags, args...) \
391 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args) 410 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)
392 411
393#define create_workqueue(name) \ 412#define create_workqueue(name) \
394 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 413 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
@@ -399,30 +418,23 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
399 418
400extern void destroy_workqueue(struct workqueue_struct *wq); 419extern void destroy_workqueue(struct workqueue_struct *wq);
401 420
421struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask);
422void free_workqueue_attrs(struct workqueue_attrs *attrs);
423int apply_workqueue_attrs(struct workqueue_struct *wq,
424 const struct workqueue_attrs *attrs);
425
402extern bool queue_work_on(int cpu, struct workqueue_struct *wq, 426extern bool queue_work_on(int cpu, struct workqueue_struct *wq,
403 struct work_struct *work); 427 struct work_struct *work);
404extern bool queue_work(struct workqueue_struct *wq, struct work_struct *work);
405extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 428extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
406 struct delayed_work *work, unsigned long delay); 429 struct delayed_work *work, unsigned long delay);
407extern bool queue_delayed_work(struct workqueue_struct *wq,
408 struct delayed_work *work, unsigned long delay);
409extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, 430extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
410 struct delayed_work *dwork, unsigned long delay); 431 struct delayed_work *dwork, unsigned long delay);
411extern bool mod_delayed_work(struct workqueue_struct *wq,
412 struct delayed_work *dwork, unsigned long delay);
413 432
414extern void flush_workqueue(struct workqueue_struct *wq); 433extern void flush_workqueue(struct workqueue_struct *wq);
415extern void drain_workqueue(struct workqueue_struct *wq); 434extern void drain_workqueue(struct workqueue_struct *wq);
416extern void flush_scheduled_work(void); 435extern void flush_scheduled_work(void);
417 436
418extern bool schedule_work_on(int cpu, struct work_struct *work);
419extern bool schedule_work(struct work_struct *work);
420extern bool schedule_delayed_work_on(int cpu, struct delayed_work *work,
421 unsigned long delay);
422extern bool schedule_delayed_work(struct delayed_work *work,
423 unsigned long delay);
424extern int schedule_on_each_cpu(work_func_t func); 437extern int schedule_on_each_cpu(work_func_t func);
425extern int keventd_up(void);
426 438
427int execute_in_process_context(work_func_t fn, struct execute_work *); 439int execute_in_process_context(work_func_t fn, struct execute_work *);
428 440
@@ -435,8 +447,122 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork);
435 447
436extern void workqueue_set_max_active(struct workqueue_struct *wq, 448extern void workqueue_set_max_active(struct workqueue_struct *wq,
437 int max_active); 449 int max_active);
438extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); 450extern bool current_is_workqueue_rescuer(void);
451extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);
439extern unsigned int work_busy(struct work_struct *work); 452extern unsigned int work_busy(struct work_struct *work);
453extern __printf(1, 2) void set_worker_desc(const char *fmt, ...);
454extern void print_worker_info(const char *log_lvl, struct task_struct *task);
455
456/**
457 * queue_work - queue work on a workqueue
458 * @wq: workqueue to use
459 * @work: work to queue
460 *
461 * Returns %false if @work was already on a queue, %true otherwise.
462 *
463 * We queue the work to the CPU on which it was submitted, but if the CPU dies
464 * it can be processed by another CPU.
465 */
466static inline bool queue_work(struct workqueue_struct *wq,
467 struct work_struct *work)
468{
469 return queue_work_on(WORK_CPU_UNBOUND, wq, work);
470}
471
472/**
473 * queue_delayed_work - queue work on a workqueue after delay
474 * @wq: workqueue to use
475 * @dwork: delayable work to queue
476 * @delay: number of jiffies to wait before queueing
477 *
478 * Equivalent to queue_delayed_work_on() but tries to use the local CPU.
479 */
480static inline bool queue_delayed_work(struct workqueue_struct *wq,
481 struct delayed_work *dwork,
482 unsigned long delay)
483{
484 return queue_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay);
485}
486
487/**
488 * mod_delayed_work - modify delay of or queue a delayed work
489 * @wq: workqueue to use
490 * @dwork: work to queue
491 * @delay: number of jiffies to wait before queueing
492 *
493 * mod_delayed_work_on() on local CPU.
494 */
495static inline bool mod_delayed_work(struct workqueue_struct *wq,
496 struct delayed_work *dwork,
497 unsigned long delay)
498{
499 return mod_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay);
500}
501
502/**
503 * schedule_work_on - put work task on a specific cpu
504 * @cpu: cpu to put the work task on
505 * @work: job to be done
506 *
507 * This puts a job on a specific cpu
508 */
509static inline bool schedule_work_on(int cpu, struct work_struct *work)
510{
511 return queue_work_on(cpu, system_wq, work);
512}
513
514/**
515 * schedule_work - put work task in global workqueue
516 * @work: job to be done
517 *
518 * Returns %false if @work was already on the kernel-global workqueue and
519 * %true otherwise.
520 *
521 * This puts a job in the kernel-global workqueue if it was not already
522 * queued and leaves it in the same position on the kernel-global
523 * workqueue otherwise.
524 */
525static inline bool schedule_work(struct work_struct *work)
526{
527 return queue_work(system_wq, work);
528}
529
530/**
531 * schedule_delayed_work_on - queue work in global workqueue on CPU after delay
532 * @cpu: cpu to use
533 * @dwork: job to be done
534 * @delay: number of jiffies to wait
535 *
536 * After waiting for a given time this puts a job in the kernel-global
537 * workqueue on the specified CPU.
538 */
539static inline bool schedule_delayed_work_on(int cpu, struct delayed_work *dwork,
540 unsigned long delay)
541{
542 return queue_delayed_work_on(cpu, system_wq, dwork, delay);
543}
544
545/**
546 * schedule_delayed_work - put work task in global workqueue after delay
547 * @dwork: job to be done
548 * @delay: number of jiffies to wait or 0 for immediate execution
549 *
550 * After waiting for a given time this puts a job in the kernel-global
551 * workqueue.
552 */
553static inline bool schedule_delayed_work(struct delayed_work *dwork,
554 unsigned long delay)
555{
556 return queue_delayed_work(system_wq, dwork, delay);
557}
558
559/**
560 * keventd_up - is workqueue initialized yet?
561 */
562static inline bool keventd_up(void)
563{
564 return system_wq != NULL;
565}
440 566
441/* 567/*
442 * Like above, but uses del_timer() instead of del_timer_sync(). This means, 568 * Like above, but uses del_timer() instead of del_timer_sync(). This means,
@@ -466,12 +592,12 @@ static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwo
466} 592}
467 593
468#ifndef CONFIG_SMP 594#ifndef CONFIG_SMP
469static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) 595static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
470{ 596{
471 return fn(arg); 597 return fn(arg);
472} 598}
473#else 599#else
474long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); 600long work_on_cpu(int cpu, long (*fn)(void *), void *arg);
475#endif /* CONFIG_SMP */ 601#endif /* CONFIG_SMP */
476 602
477#ifdef CONFIG_FREEZER 603#ifdef CONFIG_FREEZER
@@ -480,4 +606,11 @@ extern bool freeze_workqueues_busy(void);
480extern void thaw_workqueues(void); 606extern void thaw_workqueues(void);
481#endif /* CONFIG_FREEZER */ 607#endif /* CONFIG_FREEZER */
482 608
609#ifdef CONFIG_SYSFS
610int workqueue_sysfs_register(struct workqueue_struct *wq);
611#else /* CONFIG_SYSFS */
612static inline int workqueue_sysfs_register(struct workqueue_struct *wq)
613{ return 0; }
614#endif /* CONFIG_SYSFS */
615
483#endif 616#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 9a9367c0c076..579a5007c696 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -5,6 +5,7 @@
5#define WRITEBACK_H 5#define WRITEBACK_H
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/workqueue.h>
8#include <linux/fs.h> 9#include <linux/fs.h>
9 10
10DECLARE_PER_CPU(int, dirty_throttle_leaks); 11DECLARE_PER_CPU(int, dirty_throttle_leaks);
diff --git a/include/media/davinci/dm355_ccdc.h b/include/media/davinci/dm355_ccdc.h
index adf2fe4bf0bb..c669a9fb75e5 100644
--- a/include/media/davinci/dm355_ccdc.h
+++ b/include/media/davinci/dm355_ccdc.h
@@ -38,7 +38,7 @@ enum ccdc_sample_line {
38 CCDC_SAMPLE_16LINES 38 CCDC_SAMPLE_16LINES
39}; 39};
40 40
41/* enum for Alaw gama width */ 41/* enum for Alaw gamma width */
42enum ccdc_gamma_width { 42enum ccdc_gamma_width {
43 CCDC_GAMMA_BITS_13_4, 43 CCDC_GAMMA_BITS_13_4,
44 CCDC_GAMMA_BITS_12_3, 44 CCDC_GAMMA_BITS_12_3,
@@ -97,8 +97,8 @@ enum ccdc_mfilt2 {
97struct ccdc_a_law { 97struct ccdc_a_law {
98 /* Enable/disable A-Law */ 98 /* Enable/disable A-Law */
99 unsigned char enable; 99 unsigned char enable;
100 /* Gama Width Input */ 100 /* Gamma Width Input */
101 enum ccdc_gamma_width gama_wd; 101 enum ccdc_gamma_width gamma_wd;
102}; 102};
103 103
104/* structure for Black Clamping */ 104/* structure for Black Clamping */
diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h
index 3e178eb52fb3..852e96c4bb46 100644
--- a/include/media/davinci/dm644x_ccdc.h
+++ b/include/media/davinci/dm644x_ccdc.h
@@ -38,17 +38,23 @@ enum ccdc_sample_line {
38 CCDC_SAMPLE_16LINES 38 CCDC_SAMPLE_16LINES
39}; 39};
40 40
41/* enum for Alaw gama width */ 41/* enum for Alaw gamma width */
42enum ccdc_gama_width { 42enum ccdc_gamma_width {
43 CCDC_GAMMA_BITS_15_6, 43 CCDC_GAMMA_BITS_15_6, /* use bits 15-6 for gamma */
44 CCDC_GAMMA_BITS_14_5, 44 CCDC_GAMMA_BITS_14_5,
45 CCDC_GAMMA_BITS_13_4, 45 CCDC_GAMMA_BITS_13_4,
46 CCDC_GAMMA_BITS_12_3, 46 CCDC_GAMMA_BITS_12_3,
47 CCDC_GAMMA_BITS_11_2, 47 CCDC_GAMMA_BITS_11_2,
48 CCDC_GAMMA_BITS_10_1, 48 CCDC_GAMMA_BITS_10_1,
49 CCDC_GAMMA_BITS_09_0 49 CCDC_GAMMA_BITS_09_0 /* use bits 9-0 for gamma */
50}; 50};
51 51
52/* returns the highest bit used for the gamma */
53static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
54{
55 return 15 - width;
56}
57
52enum ccdc_data_size { 58enum ccdc_data_size {
53 CCDC_DATA_16BITS, 59 CCDC_DATA_16BITS,
54 CCDC_DATA_15BITS, 60 CCDC_DATA_15BITS,
@@ -60,12 +66,18 @@ enum ccdc_data_size {
60 CCDC_DATA_8BITS 66 CCDC_DATA_8BITS
61}; 67};
62 68
69/* returns the highest bit used for this data size */
70static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
71{
72 return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
73}
74
63/* structure for ALaw */ 75/* structure for ALaw */
64struct ccdc_a_law { 76struct ccdc_a_law {
65 /* Enable/disable A-Law */ 77 /* Enable/disable A-Law */
66 unsigned char enable; 78 unsigned char enable;
67 /* Gama Width Input */ 79 /* Gamma Width Input */
68 enum ccdc_gama_width gama_wd; 80 enum ccdc_gamma_width gamma_wd;
69}; 81};
70 82
71/* structure for Black Clamping */ 83/* structure for Black Clamping */
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h
index a7ca4884c46c..57585c7004a4 100644
--- a/include/media/davinci/vpbe.h
+++ b/include/media/davinci/vpbe.h
@@ -132,7 +132,7 @@ struct vpbe_device_ops {
132 struct v4l2_enum_dv_timings *timings_info); 132 struct v4l2_enum_dv_timings *timings_info);
133 133
134 /* Set std at the output */ 134 /* Set std at the output */
135 int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); 135 int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id std_id);
136 136
137 /* Get the current std at the output */ 137 /* Get the current std at the output */
138 int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); 138 int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
diff --git a/include/media/davinci/vpbe_types.h b/include/media/davinci/vpbe_types.h
index 9b85396514be..05dbe0ba514c 100644
--- a/include/media/davinci/vpbe_types.h
+++ b/include/media/davinci/vpbe_types.h
@@ -26,8 +26,7 @@ enum vpbe_version {
26/* vpbe_timing_type - Timing types used in vpbe device */ 26/* vpbe_timing_type - Timing types used in vpbe device */
27enum vpbe_enc_timings_type { 27enum vpbe_enc_timings_type {
28 VPBE_ENC_STD = 0x1, 28 VPBE_ENC_STD = 0x1,
29 VPBE_ENC_DV_PRESET = 0x2, 29 VPBE_ENC_DV_TIMINGS = 0x4,
30 VPBE_ENC_CUSTOM_TIMINGS = 0x4,
31 /* Used when set timings through FB device interface */ 30 /* Used when set timings through FB device interface */
32 VPBE_ENC_TIMINGS_INVALID = 0x8, 31 VPBE_ENC_TIMINGS_INVALID = 0x8,
33}; 32};
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
index f6caafc874cb..3446af279fca 100644
--- a/include/media/media-devnode.h
+++ b/include/media/media-devnode.h
@@ -46,6 +46,7 @@ struct media_file_operations {
46 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 46 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
47 unsigned int (*poll) (struct file *, struct poll_table_struct *); 47 unsigned int (*poll) (struct file *, struct poll_table_struct *);
48 long (*ioctl) (struct file *, unsigned int, unsigned long); 48 long (*ioctl) (struct file *, unsigned int, unsigned long);
49 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
49 int (*open) (struct file *); 50 int (*open) (struct file *);
50 int (*release) (struct file *); 51 int (*release) (struct file *);
51}; 52};
diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h
index 0c97b19af293..b1e63f2b72bd 100644
--- a/include/media/mt9p031.h
+++ b/include/media/mt9p031.h
@@ -5,13 +5,11 @@ struct v4l2_subdev;
5 5
6/* 6/*
7 * struct mt9p031_platform_data - MT9P031 platform data 7 * struct mt9p031_platform_data - MT9P031 platform data
8 * @set_xclk: Clock frequency set callback
9 * @reset: Chip reset GPIO (set to -1 if not used) 8 * @reset: Chip reset GPIO (set to -1 if not used)
10 * @ext_freq: Input clock frequency 9 * @ext_freq: Input clock frequency
11 * @target_freq: Pixel clock frequency 10 * @target_freq: Pixel clock frequency
12 */ 11 */
13struct mt9p031_platform_data { 12struct mt9p031_platform_data {
14 int (*set_xclk)(struct v4l2_subdev *subdev, int hz);
15 int reset; 13 int reset;
16 int ext_freq; 14 int ext_freq;
17 int target_freq; 15 int target_freq;
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 95842696857f..c9d06d9f7e6e 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -29,10 +29,6 @@
29struct i2c_board_info; 29struct i2c_board_info;
30struct isp_device; 30struct isp_device;
31 31
32#define ISP_XCLK_NONE 0
33#define ISP_XCLK_A 1
34#define ISP_XCLK_B 2
35
36enum isp_interface_type { 32enum isp_interface_type {
37 ISP_INTERFACE_PARALLEL, 33 ISP_INTERFACE_PARALLEL,
38 ISP_INTERFACE_CSI2A_PHY2, 34 ISP_INTERFACE_CSI2A_PHY2,
@@ -153,7 +149,13 @@ struct isp_v4l2_subdevs_group {
153 } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */ 149 } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */
154}; 150};
155 151
152struct isp_platform_xclk {
153 const char *dev_id;
154 const char *con_id;
155};
156
156struct isp_platform_data { 157struct isp_platform_data {
158 struct isp_platform_xclk xclks[2];
157 struct isp_v4l2_subdevs_group *subdevs; 159 struct isp_v4l2_subdevs_group *subdevs;
158 void (*set_constraints)(struct isp_device *isp, bool enable); 160 void (*set_constraints)(struct isp_device *isp, bool enable);
159}; 161};
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index f03445f3c767..06a75deff553 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -51,6 +51,7 @@ enum rc_driver_type {
51 * @driver_type: specifies if protocol decoding is done in hardware or software 51 * @driver_type: specifies if protocol decoding is done in hardware or software
52 * @idle: used to keep track of RX state 52 * @idle: used to keep track of RX state
53 * @allowed_protos: bitmask with the supported RC_BIT_* protocols 53 * @allowed_protos: bitmask with the supported RC_BIT_* protocols
54 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
54 * @scanmask: some hardware decoders are not capable of providing the full 55 * @scanmask: some hardware decoders are not capable of providing the full
55 * scancode to the application. As this is a hardware limit, we can't do 56 * scancode to the application. As this is a hardware limit, we can't do
56 * anything with it. Yet, as the same keycode table can be used with other 57 * anything with it. Yet, as the same keycode table can be used with other
@@ -99,6 +100,7 @@ struct rc_dev {
99 enum rc_driver_type driver_type; 100 enum rc_driver_type driver_type;
100 bool idle; 101 bool idle;
101 u64 allowed_protos; 102 u64 allowed_protos;
103 u64 enabled_protocols;
102 u32 scanmask; 104 u32 scanmask;
103 void *priv; 105 void *priv;
104 spinlock_t keylock; 106 spinlock_t keylock;
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index f74ee6f89711..5d5d3a30f04a 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -172,6 +172,7 @@ void rc_map_init(void);
172#define RC_MAP_RC5_TV "rc-rc5-tv" 172#define RC_MAP_RC5_TV "rc-rc5-tv"
173#define RC_MAP_RC6_MCE "rc-rc6-mce" 173#define RC_MAP_RC6_MCE "rc-rc6-mce"
174#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 174#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
175#define RC_MAP_REDDO "rc-reddo"
175#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly" 176#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly"
176#define RC_MAP_STREAMZAP "rc-streamzap" 177#define RC_MAP_STREAMZAP "rc-streamzap"
177#define RC_MAP_TBS_NEC "rc-tbs-nec" 178#define RC_MAP_TBS_NEC "rc-tbs-nec"
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 28f3590aa031..f50969025ef3 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -13,6 +13,20 @@
13#define S5P_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15#include <media/media-entity.h> 15#include <media/media-entity.h>
16#include <media/v4l2-mediabus.h>
17
18/*
19 * Enumeration of data inputs to the camera subsystem.
20 */
21enum fimc_input {
22 FIMC_INPUT_PARALLEL_0 = 1,
23 FIMC_INPUT_PARALLEL_1,
24 FIMC_INPUT_MIPI_CSI2_0 = 3,
25 FIMC_INPUT_MIPI_CSI2_1,
26 FIMC_INPUT_WRITEBACK_A = 5,
27 FIMC_INPUT_WRITEBACK_B,
28 FIMC_INPUT_WRITEBACK_ISP = 5,
29};
16 30
17/* 31/*
18 * Enumeration of the FIMC data bus types. 32 * Enumeration of the FIMC data bus types.
@@ -32,6 +46,20 @@ enum fimc_bus_type {
32 FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B, 46 FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B,
33}; 47};
34 48
49#define fimc_input_is_parallel(x) ((x) == 1 || (x) == 2)
50#define fimc_input_is_mipi_csi(x) ((x) == 3 || (x) == 4)
51
52/*
53 * The subdevices' group IDs.
54 */
55#define GRP_ID_SENSOR (1 << 8)
56#define GRP_ID_FIMC_IS_SENSOR (1 << 9)
57#define GRP_ID_WRITEBACK (1 << 10)
58#define GRP_ID_CSIS (1 << 11)
59#define GRP_ID_FIMC (1 << 12)
60#define GRP_ID_FLITE (1 << 13)
61#define GRP_ID_FIMC_IS (1 << 14)
62
35struct i2c_board_info; 63struct i2c_board_info;
36 64
37/** 65/**
@@ -77,10 +105,46 @@ struct s5p_platform_fimc {
77 */ 105 */
78#define S5P_FIMC_TX_END_NOTIFY _IO('e', 0) 106#define S5P_FIMC_TX_END_NOTIFY _IO('e', 0)
79 107
108#define FIMC_MAX_PLANES 3
109
110/**
111 * struct fimc_fmt - color format data structure
112 * @mbus_code: media bus pixel code, -1 if not applicable
113 * @name: format description
114 * @fourcc: fourcc code for this format, 0 if not applicable
115 * @color: the driver's private color format id
116 * @memplanes: number of physically non-contiguous data planes
117 * @colplanes: number of physically contiguous data planes
118 * @depth: per plane driver's private 'number of bits per pixel'
119 * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no)
120 * @flags: flags indicating which operation mode format applies to
121 */
122struct fimc_fmt {
123 enum v4l2_mbus_pixelcode mbus_code;
124 char *name;
125 u32 fourcc;
126 u32 color;
127 u16 memplanes;
128 u16 colplanes;
129 u8 depth[FIMC_MAX_PLANES];
130 u16 mdataplanes;
131 u16 flags;
132#define FMT_FLAGS_CAM (1 << 0)
133#define FMT_FLAGS_M2M_IN (1 << 1)
134#define FMT_FLAGS_M2M_OUT (1 << 2)
135#define FMT_FLAGS_M2M (1 << 1 | 1 << 2)
136#define FMT_HAS_ALPHA (1 << 3)
137#define FMT_FLAGS_COMPRESSED (1 << 4)
138#define FMT_FLAGS_WRITEBACK (1 << 5)
139#define FMT_FLAGS_RAW_BAYER (1 << 6)
140#define FMT_FLAGS_YUV (1 << 7)
141};
142
80enum fimc_subdev_index { 143enum fimc_subdev_index {
81 IDX_SENSOR, 144 IDX_SENSOR,
82 IDX_CSIS, 145 IDX_CSIS,
83 IDX_FLITE, 146 IDX_FLITE,
147 IDX_IS_ISP,
84 IDX_FIMC, 148 IDX_FIMC,
85 IDX_MAX, 149 IDX_MAX,
86}; 150};
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index bab212719591..407918625c80 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -21,6 +21,8 @@
21#ifndef _SAA7115_H_ 21#ifndef _SAA7115_H_
22#define _SAA7115_H_ 22#define _SAA7115_H_
23 23
24/* s_routing inputs, outputs, and config */
25
24/* SAA7111/3/4/5 HW inputs */ 26/* SAA7111/3/4/5 HW inputs */
25#define SAA7115_COMPOSITE0 0 27#define SAA7115_COMPOSITE0 0
26#define SAA7115_COMPOSITE1 1 28#define SAA7115_COMPOSITE1 1
@@ -33,24 +35,34 @@
33#define SAA7115_SVIDEO2 8 35#define SAA7115_SVIDEO2 8
34#define SAA7115_SVIDEO3 9 36#define SAA7115_SVIDEO3 9
35 37
36/* SAA7115 v4l2_crystal_freq frequency values */ 38/* outputs */
37#define SAA7115_FREQ_32_11_MHZ 32110000 /* 32.11 MHz crystal, SAA7114/5 only */
38#define SAA7115_FREQ_24_576_MHZ 24576000 /* 24.576 MHz crystal */
39
40/* SAA7115 v4l2_crystal_freq audio clock control flags */
41#define SAA7115_FREQ_FL_UCGC (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */
42#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
43#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
44
45#define SAA7115_IPORT_ON 1 39#define SAA7115_IPORT_ON 1
46#define SAA7115_IPORT_OFF 0 40#define SAA7115_IPORT_OFF 0
47 41
48/* SAA7111 specific output flags */ 42/* SAA7111 specific outputs. */
49#define SAA7111_VBI_BYPASS 2 43#define SAA7111_VBI_BYPASS 2
50#define SAA7111_FMT_YUV422 0x00 44#define SAA7111_FMT_YUV422 0x00
51#define SAA7111_FMT_RGB 0x40 45#define SAA7111_FMT_RGB 0x40
52#define SAA7111_FMT_CCIR 0x80 46#define SAA7111_FMT_CCIR 0x80
53#define SAA7111_FMT_YUV411 0xc0 47#define SAA7111_FMT_YUV411 0xc0
54 48
49/* config flags */
50/* Register 0x85 should set bit 0 to 0 (it's 1 by default). This bit
51 * controls the IDQ signal polarity which is set to 'inverted' if the bit
52 * it 1 and to 'default' if it is 0. */
53#define SAA7115_IDQ_IS_DEFAULT (1 << 0)
54
55/* s_crystal_freq values and flags */
56
57/* SAA7115 v4l2_crystal_freq frequency values */
58#define SAA7115_FREQ_32_11_MHZ 32110000 /* 32.11 MHz crystal, SAA7114/5 only */
59#define SAA7115_FREQ_24_576_MHZ 24576000 /* 24.576 MHz crystal */
60
61/* SAA7115 v4l2_crystal_freq audio clock control flags */
62#define SAA7115_FREQ_FL_UCGC (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */
63#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
64#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
65#define SAA7115_FREQ_FL_DOUBLE_ASCLK (1 << 3) /* SA 39, LRDIV, SAA7114/5 only */
66
55#endif 67#endif
56 68
diff --git a/include/media/si476x.h b/include/media/si476x.h
new file mode 100644
index 000000000000..e02e241e2d22
--- /dev/null
+++ b/include/media/si476x.h
@@ -0,0 +1,37 @@
1/*
2 * include/media/si476x.h -- Common definitions for si476x driver
3 *
4 * Copyright (C) 2012 Innovative Converged Devices(ICD)
5 * Copyright (C) 2013 Andrey Smirnov
6 *
7 * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 */
19
20#ifndef SI476X_H
21#define SI476X_H
22
23#include <linux/types.h>
24#include <linux/videodev2.h>
25
26#include <linux/mfd/si476x-reports.h>
27
28enum si476x_ctrl_id {
29 V4L2_CID_SI476X_RSSI_THRESHOLD = (V4L2_CID_USER_SI476X_BASE + 1),
30 V4L2_CID_SI476X_SNR_THRESHOLD = (V4L2_CID_USER_SI476X_BASE + 2),
31 V4L2_CID_SI476X_MAX_TUNE_ERROR = (V4L2_CID_USER_SI476X_BASE + 3),
32 V4L2_CID_SI476X_HARMONICS_COUNT = (V4L2_CID_USER_SI476X_BASE + 4),
33 V4L2_CID_SI476X_DIVERSITY_MODE = (V4L2_CID_USER_SI476X_BASE + 5),
34 V4L2_CID_SI476X_INTERCHIP_LINK = (V4L2_CID_USER_SI476X_BASE + 6),
35};
36
37#endif /* SI476X_H*/
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 2cc70cf318bf..ff77d08c30fd 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -292,12 +292,17 @@ struct soc_camera_sense {
292#define SOCAM_DATAWIDTH_8 SOCAM_DATAWIDTH(8) 292#define SOCAM_DATAWIDTH_8 SOCAM_DATAWIDTH(8)
293#define SOCAM_DATAWIDTH_9 SOCAM_DATAWIDTH(9) 293#define SOCAM_DATAWIDTH_9 SOCAM_DATAWIDTH(9)
294#define SOCAM_DATAWIDTH_10 SOCAM_DATAWIDTH(10) 294#define SOCAM_DATAWIDTH_10 SOCAM_DATAWIDTH(10)
295#define SOCAM_DATAWIDTH_12 SOCAM_DATAWIDTH(12)
295#define SOCAM_DATAWIDTH_15 SOCAM_DATAWIDTH(15) 296#define SOCAM_DATAWIDTH_15 SOCAM_DATAWIDTH(15)
296#define SOCAM_DATAWIDTH_16 SOCAM_DATAWIDTH(16) 297#define SOCAM_DATAWIDTH_16 SOCAM_DATAWIDTH(16)
298#define SOCAM_DATAWIDTH_18 SOCAM_DATAWIDTH(18)
299#define SOCAM_DATAWIDTH_24 SOCAM_DATAWIDTH(24)
297 300
298#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \ 301#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
299 SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ 302 SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
300 SOCAM_DATAWIDTH_15 | SOCAM_DATAWIDTH_16) 303 SOCAM_DATAWIDTH_12 | SOCAM_DATAWIDTH_15 | \
304 SOCAM_DATAWIDTH_16 | SOCAM_DATAWIDTH_18 | \
305 SOCAM_DATAWIDTH_24)
301 306
302static inline void soc_camera_limit_side(int *start, int *length, 307static inline void soc_camera_limit_side(int *start, int *length,
303 unsigned int start_min, 308 unsigned int start_min,
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index 0dc6f4625b92..d33f6d059692 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -26,6 +26,8 @@
26 * @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing 26 * @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing
27 * @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4 27 * @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4
28 * pixels occupy 6 bytes in RAM 28 * pixels occupy 6 bytes in RAM
29 * @SOC_MBUS_PACKING_EXTEND32: sample width (e.g., 24 bits) has to be extended
30 * to 32 bits
29 */ 31 */
30enum soc_mbus_packing { 32enum soc_mbus_packing {
31 SOC_MBUS_PACKING_NONE, 33 SOC_MBUS_PACKING_NONE,
@@ -34,6 +36,7 @@ enum soc_mbus_packing {
34 SOC_MBUS_PACKING_EXTEND16, 36 SOC_MBUS_PACKING_EXTEND16,
35 SOC_MBUS_PACKING_VARIABLE, 37 SOC_MBUS_PACKING_VARIABLE,
36 SOC_MBUS_PACKING_1_5X8, 38 SOC_MBUS_PACKING_1_5X8,
39 SOC_MBUS_PACKING_EXTEND32,
37}; 40};
38 41
39/** 42/**
diff --git a/include/media/ths7303.h b/include/media/ths7303.h
new file mode 100644
index 000000000000..980ec51d574d
--- /dev/null
+++ b/include/media/ths7303.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2013 Texas Instruments Inc
3 *
4 * Copyright 2013 Cisco Systems, Inc. and/or its affiliates.
5 *
6 * Contributors:
7 * Hans Verkuil <hans.verkuil@cisco.com>
8 * Lad, Prabhakar <prabhakar.lad@ti.com>
9 * Martin Bugge <marbugge@cisco.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation version 2.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef THS7353_H
26#define THS7353_H
27
28/**
29 * struct ths7303_platform_data - Platform dependent data
30 * @ch_1: Bias value for channel one.
31 * @ch_2: Bias value for channel two.
32 * @ch_3: Bias value for channel three.
33 * @init_enable: initalize on init.
34 */
35struct ths7303_platform_data {
36 u8 ch_1;
37 u8 ch_2;
38 u8 ch_3;
39 u8 init_enable;
40};
41
42#endif
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 926aff9bdf65..b46ebb48fe74 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -138,6 +138,10 @@
138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */ 138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */
139#define TUNER_XC5000C 88 /* Xceive Silicon Tuner */ 139#define TUNER_XC5000C 88 /* Xceive Silicon Tuner */
140 140
141#define TUNER_SONY_BTF_PG472Z 89 /* PAL+SECAM */
142#define TUNER_SONY_BTF_PK467Z 90 /* NTSC_JP */
143#define TUNER_SONY_BTF_PB463Z 91 /* NTSC */
144
141/* tv card specific */ 145/* tv card specific */
142#define TDA9887_PRESENT (1<<0) 146#define TDA9887_PRESENT (1<<0)
143#define TDA9887_PORT1_INACTIVE (1<<1) 147#define TDA9887_PORT1_INACTIVE (1<<1)
@@ -188,7 +192,7 @@ struct tuner_setup {
188 unsigned short addr; /* I2C address */ 192 unsigned short addr; /* I2C address */
189 unsigned int type; /* Tuner type */ 193 unsigned int type; /* Tuner type */
190 unsigned int mode_mask; /* Allowed tuner modes */ 194 unsigned int mode_mask; /* Allowed tuner modes */
191 unsigned int config; /* configuraion for more complex tuners */ 195 void *config; /* configuraion for more complex tuners */
192 int (*tuner_callback) (void *dev, int component, int cmd, int arg); 196 int (*tuner_callback) (void *dev, int component, int cmd, int arg);
193}; 197};
194 198
diff --git a/include/media/uda1342.h b/include/media/uda1342.h
new file mode 100644
index 000000000000..cd156403a368
--- /dev/null
+++ b/include/media/uda1342.h
@@ -0,0 +1,29 @@
1/*
2 * uda1342.h - definition for uda1342 inputs
3 *
4 * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 *
6 * This program is free software; you may redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 *
19 */
20
21#ifndef _UDA1342_H_
22#define _UDA1342_H_
23
24/* The UDA1342 has 2 inputs */
25
26#define UDA1342_IN1 1
27#define UDA1342_IN2 2
28
29#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 4ee125bae719..c259b36bf1e9 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -96,12 +96,20 @@ enum {
96 /* module au0828 */ 96 /* module au0828 */
97 V4L2_IDENT_AU0828 = 828, 97 V4L2_IDENT_AU0828 = 828,
98 98
99 /* module bttv: ident 848 + 849 */
100 V4L2_IDENT_BT848 = 848,
101 V4L2_IDENT_BT849 = 849,
102
99 /* module bt856: just ident 856 */ 103 /* module bt856: just ident 856 */
100 V4L2_IDENT_BT856 = 856, 104 V4L2_IDENT_BT856 = 856,
101 105
102 /* module bt866: just ident 866 */ 106 /* module bt866: just ident 866 */
103 V4L2_IDENT_BT866 = 866, 107 V4L2_IDENT_BT866 = 866,
104 108
109 /* module bttv: ident 878 + 879 */
110 V4L2_IDENT_BT878 = 878,
111 V4L2_IDENT_BT879 = 879,
112
105 /* module ks0127: reserved range 1120-1129 */ 113 /* module ks0127: reserved range 1120-1129 */
106 V4L2_IDENT_KS0122S = 1122, 114 V4L2_IDENT_KS0122S = 1122,
107 V4L2_IDENT_KS0127 = 1127, 115 V4L2_IDENT_KS0127 = 1127,
@@ -180,6 +188,9 @@ enum {
180 /* module adv7343: just ident 7343 */ 188 /* module adv7343: just ident 7343 */
181 V4L2_IDENT_ADV7343 = 7343, 189 V4L2_IDENT_ADV7343 = 7343,
182 190
191 /* module ths7353: just ident 7353 */
192 V4L2_IDENT_THS7353 = 7353,
193
183 /* module adv7393: just ident 7393 */ 194 /* module adv7393: just ident 7393 */
184 V4L2_IDENT_ADV7393 = 7393, 195 V4L2_IDENT_ADV7393 = 7393,
185 196
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index ec7c9c00b256..1d93c48cb371 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -201,7 +201,6 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
201 unsigned int *h, unsigned int hmin, 201 unsigned int *h, unsigned int hmin,
202 unsigned int hmax, unsigned int halign, 202 unsigned int hmax, unsigned int halign,
203 unsigned int salign); 203 unsigned int salign);
204int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);
205 204
206struct v4l2_discrete_probe { 205struct v4l2_discrete_probe {
207 const struct v4l2_frmsize_discrete *sizes; 206 const struct v4l2_frmsize_discrete *sizes;
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index f00d42bc01a6..7343a27fe819 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -259,7 +259,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
259 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); 259 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags);
260 260
261 261
262/** v4l2_ctrl_handler_init() - Initialize the control handler. 262/** v4l2_ctrl_handler_init_class() - Initialize the control handler.
263 * @hdl: The control handler. 263 * @hdl: The control handler.
264 * @nr_of_controls_hint: A hint of how many controls this handler is 264 * @nr_of_controls_hint: A hint of how many controls this handler is
265 * expected to refer to. This is the total number, so including 265 * expected to refer to. This is the total number, so including
@@ -268,12 +268,35 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
268 * are allocated) or the control lookup becomes slower (not enough 268 * are allocated) or the control lookup becomes slower (not enough
269 * buckets are allocated, so there are more slow list lookups). 269 * buckets are allocated, so there are more slow list lookups).
270 * It will always work, though. 270 * It will always work, though.
271 * @key: Used by the lock validator if CONFIG_LOCKDEP is set.
272 * @name: Used by the lock validator if CONFIG_LOCKDEP is set.
271 * 273 *
272 * Returns an error if the buckets could not be allocated. This error will 274 * Returns an error if the buckets could not be allocated. This error will
273 * also be stored in @hdl->error. 275 * also be stored in @hdl->error.
276 *
277 * Never use this call directly, always use the v4l2_ctrl_handler_init
278 * macro that hides the @key and @name arguments.
274 */ 279 */
275int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl, 280int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
276 unsigned nr_of_controls_hint); 281 unsigned nr_of_controls_hint,
282 struct lock_class_key *key, const char *name);
283
284#ifdef CONFIG_LOCKDEP
285#define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \
286( \
287 ({ \
288 static struct lock_class_key _key; \
289 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, \
290 &_key, \
291 KBUILD_BASENAME ":" \
292 __stringify(__LINE__) ":" \
293 "(" #hdl ")->_lock"); \
294 }) \
295)
296#else
297#define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \
298 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL)
299#endif
277 300
278/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free 301/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
279 * the control list. 302 * the control list.
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index d61febfb1668..c9b1593923f6 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -190,4 +190,17 @@ v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);
190 ##args); \ 190 ##args); \
191}) 191})
192 192
193#define v4l2_device_has_op(v4l2_dev, o, f) \
194({ \
195 struct v4l2_subdev *__sd; \
196 bool __result = false; \
197 list_for_each_entry(__sd, &(v4l2_dev)->subdevs, list) { \
198 if (v4l2_subdev_has_op(__sd, o, f)) { \
199 __result = true; \
200 break; \
201 } \
202 } \
203 __result; \
204})
205
193#endif 206#endif
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 4118ad1324c9..931652f0e2af 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -132,7 +132,7 @@ struct v4l2_ioctl_ops {
132 ENUMSTD is handled by videodev.c 132 ENUMSTD is handled by videodev.c
133 */ 133 */
134 int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm); 134 int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
135 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm); 135 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id norm);
136 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a); 136 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
137 137
138 /* Input handling */ 138 /* Input handling */
@@ -219,11 +219,11 @@ struct v4l2_ioctl_ops {
219 int (*vidioc_g_tuner) (struct file *file, void *fh, 219 int (*vidioc_g_tuner) (struct file *file, void *fh,
220 struct v4l2_tuner *a); 220 struct v4l2_tuner *a);
221 int (*vidioc_s_tuner) (struct file *file, void *fh, 221 int (*vidioc_s_tuner) (struct file *file, void *fh,
222 struct v4l2_tuner *a); 222 const struct v4l2_tuner *a);
223 int (*vidioc_g_frequency) (struct file *file, void *fh, 223 int (*vidioc_g_frequency) (struct file *file, void *fh,
224 struct v4l2_frequency *a); 224 struct v4l2_frequency *a);
225 int (*vidioc_s_frequency) (struct file *file, void *fh, 225 int (*vidioc_s_frequency) (struct file *file, void *fh,
226 struct v4l2_frequency *a); 226 const struct v4l2_frequency *a);
227 int (*vidioc_enum_freq_bands) (struct file *file, void *fh, 227 int (*vidioc_enum_freq_bands) (struct file *file, void *fh,
228 struct v4l2_frequency_band *band); 228 struct v4l2_frequency_band *band);
229 229
@@ -242,7 +242,10 @@ struct v4l2_ioctl_ops {
242 int (*vidioc_g_register) (struct file *file, void *fh, 242 int (*vidioc_g_register) (struct file *file, void *fh,
243 struct v4l2_dbg_register *reg); 243 struct v4l2_dbg_register *reg);
244 int (*vidioc_s_register) (struct file *file, void *fh, 244 int (*vidioc_s_register) (struct file *file, void *fh,
245 struct v4l2_dbg_register *reg); 245 const struct v4l2_dbg_register *reg);
246
247 int (*vidioc_g_chip_info) (struct file *file, void *fh,
248 struct v4l2_dbg_chip_info *chip);
246#endif 249#endif
247 int (*vidioc_g_chip_ident) (struct file *file, void *fh, 250 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
248 struct v4l2_dbg_chip_ident *chip); 251 struct v4l2_dbg_chip_ident *chip);
@@ -254,15 +257,6 @@ struct v4l2_ioctl_ops {
254 struct v4l2_frmivalenum *fival); 257 struct v4l2_frmivalenum *fival);
255 258
256 /* DV Timings IOCTLs */ 259 /* DV Timings IOCTLs */
257 int (*vidioc_enum_dv_presets) (struct file *file, void *fh,
258 struct v4l2_dv_enum_preset *preset);
259
260 int (*vidioc_s_dv_preset) (struct file *file, void *fh,
261 struct v4l2_dv_preset *preset);
262 int (*vidioc_g_dv_preset) (struct file *file, void *fh,
263 struct v4l2_dv_preset *preset);
264 int (*vidioc_query_dv_preset) (struct file *file, void *fh,
265 struct v4l2_dv_preset *qpreset);
266 int (*vidioc_s_dv_timings) (struct file *file, void *fh, 260 int (*vidioc_s_dv_timings) (struct file *file, void *fh,
267 struct v4l2_dv_timings *timings); 261 struct v4l2_dv_timings *timings);
268 int (*vidioc_g_dv_timings) (struct file *file, void *fh, 262 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
@@ -281,7 +275,7 @@ struct v4l2_ioctl_ops {
281 275
282 /* For other private ioctls */ 276 /* For other private ioctls */
283 long (*vidioc_default) (struct file *file, void *fh, 277 long (*vidioc_default) (struct file *file, void *fh,
284 bool valid_prio, int cmd, void *arg); 278 bool valid_prio, unsigned int cmd, void *arg);
285}; 279};
286 280
287 281
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
new file mode 100644
index 000000000000..3a8a84124b44
--- /dev/null
+++ b/include/media/v4l2-of.h
@@ -0,0 +1,111 @@
1/*
2 * V4L2 OF binding parsing library
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 _V4L2_OF_H
15#define _V4L2_OF_H
16
17#include <linux/list.h>
18#include <linux/types.h>
19#include <linux/errno.h>
20
21#include <media/v4l2-mediabus.h>
22
23struct device_node;
24
25/**
26 * struct v4l2_of_bus_mipi_csi2 - MIPI CSI-2 bus data structure
27 * @flags: media bus (V4L2_MBUS_*) flags
28 * @data_lanes: an array of physical data lane indexes
29 * @clock_lane: physical lane index of the clock lane
30 * @num_data_lanes: number of data lanes
31 */
32struct v4l2_of_bus_mipi_csi2 {
33 unsigned int flags;
34 unsigned char data_lanes[4];
35 unsigned char clock_lane;
36 unsigned short num_data_lanes;
37};
38
39/**
40 * struct v4l2_of_bus_parallel - parallel data bus data structure
41 * @flags: media bus (V4L2_MBUS_*) flags
42 * @bus_width: bus width in bits
43 * @data_shift: data shift in bits
44 */
45struct v4l2_of_bus_parallel {
46 unsigned int flags;
47 unsigned char bus_width;
48 unsigned char data_shift;
49};
50
51/**
52 * struct v4l2_of_endpoint - the endpoint data structure
53 * @port: identifier (value of reg property) of a port this endpoint belongs to
54 * @id: identifier (value of reg property) of this endpoint
55 * @local_node: pointer to device_node of this endpoint
56 * @remote: phandle to remote endpoint node
57 * @bus_type: bus type
58 * @bus: bus configuration data structure
59 * @head: list head for this structure
60 */
61struct v4l2_of_endpoint {
62 unsigned int port;
63 unsigned int id;
64 const struct device_node *local_node;
65 const __be32 *remote;
66 enum v4l2_mbus_type bus_type;
67 union {
68 struct v4l2_of_bus_parallel parallel;
69 struct v4l2_of_bus_mipi_csi2 mipi_csi2;
70 } bus;
71 struct list_head head;
72};
73
74#ifdef CONFIG_OF
75void v4l2_of_parse_endpoint(const struct device_node *node,
76 struct v4l2_of_endpoint *link);
77struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
78 struct device_node *previous);
79struct device_node *v4l2_of_get_remote_port_parent(
80 const struct device_node *node);
81struct device_node *v4l2_of_get_remote_port(const struct device_node *node);
82#else /* CONFIG_OF */
83
84static inline int v4l2_of_parse_endpoint(const struct device_node *node,
85 struct v4l2_of_endpoint *link)
86{
87 return -ENOSYS;
88}
89
90static inline struct device_node *v4l2_of_get_next_endpoint(
91 const struct device_node *parent,
92 struct device_node *previous)
93{
94 return NULL;
95}
96
97static inline struct device_node *v4l2_of_get_remote_port_parent(
98 const struct device_node *node)
99{
100 return NULL;
101}
102
103static inline struct device_node *v4l2_of_get_remote_port(
104 const struct device_node *node)
105{
106 return NULL;
107}
108
109#endif /* CONFIG_OF */
110
111#endif /* _V4L2_OF_H */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index b137a5e1151a..5298d678d0f3 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -165,7 +165,7 @@ struct v4l2_subdev_core_ops {
165 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 165 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
166#ifdef CONFIG_VIDEO_ADV_DEBUG 166#ifdef CONFIG_VIDEO_ADV_DEBUG
167 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 167 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
168 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 168 int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
169#endif 169#endif
170 int (*s_power)(struct v4l2_subdev *sd, int on); 170 int (*s_power)(struct v4l2_subdev *sd, int on);
171 int (*interrupt_service_routine)(struct v4l2_subdev *sd, 171 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
@@ -191,10 +191,10 @@ struct v4l2_subdev_core_ops {
191 */ 191 */
192struct v4l2_subdev_tuner_ops { 192struct v4l2_subdev_tuner_ops {
193 int (*s_radio)(struct v4l2_subdev *sd); 193 int (*s_radio)(struct v4l2_subdev *sd);
194 int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 194 int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);
195 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 195 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
196 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 196 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
197 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 197 int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);
198 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 198 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
199 int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm); 199 int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm);
200 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 200 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
@@ -279,14 +279,6 @@ struct v4l2_mbus_frame_desc {
279 s_routing: see s_routing in audio_ops, except this version is for video 279 s_routing: see s_routing in audio_ops, except this version is for video
280 devices. 280 devices.
281 281
282 s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to
283 s_std()
284
285 g_dv_preset: get current dv (Digital Video) preset in the sub device.
286
287 query_dv_preset: query dv preset in the sub device. This is similar to
288 querystd()
289
290 s_dv_timings(): Set custom dv timings in the sub device. This is used 282 s_dv_timings(): Set custom dv timings in the sub device. This is used
291 when sub device is capable of setting detailed timing information 283 when sub device is capable of setting detailed timing information
292 in the hardware to generate/detect the video signal. 284 in the hardware to generate/detect the video signal.
@@ -331,14 +323,6 @@ struct v4l2_subdev_video_ops {
331 struct v4l2_subdev_frame_interval *interval); 323 struct v4l2_subdev_frame_interval *interval);
332 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 324 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
333 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 325 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
334 int (*enum_dv_presets) (struct v4l2_subdev *sd,
335 struct v4l2_dv_enum_preset *preset);
336 int (*s_dv_preset)(struct v4l2_subdev *sd,
337 struct v4l2_dv_preset *preset);
338 int (*g_dv_preset)(struct v4l2_subdev *sd,
339 struct v4l2_dv_preset *preset);
340 int (*query_dv_preset)(struct v4l2_subdev *sd,
341 struct v4l2_dv_preset *preset);
342 int (*s_dv_timings)(struct v4l2_subdev *sd, 326 int (*s_dv_timings)(struct v4l2_subdev *sd,
343 struct v4l2_dv_timings *timings); 327 struct v4l2_dv_timings *timings);
344 int (*g_dv_timings)(struct v4l2_subdev *sd, 328 int (*g_dv_timings)(struct v4l2_subdev *sd,
@@ -687,4 +671,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
687 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ 671 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
688 (sd)->v4l2_dev->notify((sd), (notification), (arg))) 672 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
689 673
674#define v4l2_subdev_has_op(sd, o, f) \
675 ((sd)->ops->o && (sd)->ops->o->f)
676
690#endif 677#endif
diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h
index f473aeb86d3f..f0ed82543d9f 100644
--- a/include/media/videobuf-dma-contig.h
+++ b/include/media/videobuf-dma-contig.h
@@ -26,16 +26,6 @@ void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
26 void *priv, 26 void *priv,
27 struct mutex *ext_lock); 27 struct mutex *ext_lock);
28 28
29void videobuf_queue_dma_contig_init_cached(struct videobuf_queue *q,
30 const struct videobuf_queue_ops *ops,
31 struct device *dev,
32 spinlock_t *irqlock,
33 enum v4l2_buf_type type,
34 enum v4l2_field field,
35 unsigned int msize,
36 void *priv,
37 struct mutex *ext_lock);
38
39dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf); 29dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);
40void videobuf_dma_contig_free(struct videobuf_queue *q, 30void videobuf_dma_contig_free(struct videobuf_queue *q,
41 struct videobuf_buffer *buf); 31 struct videobuf_buffer *buf);
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 9cfd4ee9e56f..d88a098d1aff 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -27,7 +27,9 @@ struct vb2_fileio_data;
27 * return NULL on failure or a pointer to allocator private, 27 * return NULL on failure or a pointer to allocator private,
28 * per-buffer data on success; the returned private structure 28 * per-buffer data on success; the returned private structure
29 * will then be passed as buf_priv argument to other ops in this 29 * will then be passed as buf_priv argument to other ops in this
30 * structure 30 * structure. Additional gfp_flags to use when allocating the
31 * are also passed to this operation. These flags are from the
32 * gfp_flags field of vb2_queue.
31 * @put: inform the allocator that the buffer will no longer be used; 33 * @put: inform the allocator that the buffer will no longer be used;
32 * usually will result in the allocator freeing the buffer (if 34 * usually will result in the allocator freeing the buffer (if
33 * no other users of this buffer are present); the buf_priv 35 * no other users of this buffer are present); the buf_priv
@@ -79,7 +81,7 @@ struct vb2_fileio_data;
79 * unmap_dmabuf. 81 * unmap_dmabuf.
80 */ 82 */
81struct vb2_mem_ops { 83struct vb2_mem_ops {
82 void *(*alloc)(void *alloc_ctx, unsigned long size); 84 void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags);
83 void (*put)(void *buf_priv); 85 void (*put)(void *buf_priv);
84 struct dma_buf *(*get_dmabuf)(void *buf_priv); 86 struct dma_buf *(*get_dmabuf)(void *buf_priv);
85 87
@@ -302,6 +304,9 @@ struct v4l2_fh;
302 * @buf_struct_size: size of the driver-specific buffer structure; 304 * @buf_struct_size: size of the driver-specific buffer structure;
303 * "0" indicates the driver doesn't want to use a custom buffer 305 * "0" indicates the driver doesn't want to use a custom buffer
304 * structure type, so sizeof(struct vb2_buffer) will is used 306 * structure type, so sizeof(struct vb2_buffer) will is used
307 * @gfp_flags: additional gfp flags used when allocating the buffers.
308 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
309 * to force the buffer allocation to a specific memory zone.
305 * 310 *
306 * @memory: current memory type used 311 * @memory: current memory type used
307 * @bufs: videobuf buffer structures 312 * @bufs: videobuf buffer structures
@@ -326,6 +331,8 @@ struct vb2_queue {
326 const struct vb2_mem_ops *mem_ops; 331 const struct vb2_mem_ops *mem_ops;
327 void *drv_priv; 332 void *drv_priv;
328 unsigned int buf_struct_size; 333 unsigned int buf_struct_size;
334 u32 timestamp_type;
335 gfp_t gfp_flags;
329 336
330/* private: internal use only */ 337/* private: internal use only */
331 enum v4l2_memory memory; 338 enum v4l2_memory memory;
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 0a996a3517ed..dbdfd2b0f3b3 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -29,7 +29,8 @@ struct unix_address {
29 29
30struct unix_skb_parms { 30struct unix_skb_parms {
31 struct pid *pid; /* Skb credentials */ 31 struct pid *pid; /* Skb credentials */
32 const struct cred *cred; 32 kuid_t uid;
33 kgid_t gid;
33 struct scm_fp_list *fp; /* Passed files */ 34 struct scm_fp_list *fp; /* Passed files */
34#ifdef CONFIG_SECURITY_NETWORK 35#ifdef CONFIG_SECURITY_NETWORK
35 u32 secid; /* Security ID */ 36 u32 secid; /* Security ID */
@@ -56,9 +57,10 @@ struct unix_sock {
56 struct list_head link; 57 struct list_head link;
57 atomic_long_t inflight; 58 atomic_long_t inflight;
58 spinlock_t lock; 59 spinlock_t lock;
59 unsigned int gc_candidate : 1;
60 unsigned int gc_maybe_cycle : 1;
61 unsigned char recursion_level; 60 unsigned char recursion_level;
61 unsigned long gc_flags;
62#define UNIX_GC_CANDIDATE 0
63#define UNIX_GC_MAYBE_CYCLE 1
62 struct socket_wq peer_wq; 64 struct socket_wq peer_wq;
63}; 65};
64#define unix_sk(__sk) ((struct unix_sock *)__sk) 66#define unix_sk(__sk) ((struct unix_sock *)__sk)
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 9531beee09b5..10eb9b389014 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -193,11 +193,11 @@ static inline bool bdaddr_type_is_le(__u8 type)
193#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) 193#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })
194 194
195/* Copy, swap, convert BD Address */ 195/* Copy, swap, convert BD Address */
196static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) 196static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
197{ 197{
198 return memcmp(ba1, ba2, sizeof(bdaddr_t)); 198 return memcmp(ba1, ba2, sizeof(bdaddr_t));
199} 199}
200static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) 200static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
201{ 201{
202 memcpy(dst, src, sizeof(bdaddr_t)); 202 memcpy(dst, src, sizeof(bdaddr_t));
203} 203}
@@ -226,13 +226,12 @@ struct bt_sock_list {
226 struct hlist_head head; 226 struct hlist_head head;
227 rwlock_t lock; 227 rwlock_t lock;
228#ifdef CONFIG_PROC_FS 228#ifdef CONFIG_PROC_FS
229 struct file_operations fops;
230 int (* custom_seq_show)(struct seq_file *, void *); 229 int (* custom_seq_show)(struct seq_file *, void *);
231#endif 230#endif
232}; 231};
233 232
234int bt_sock_register(int proto, const struct net_proto_family *ops); 233int bt_sock_register(int proto, const struct net_proto_family *ops);
235int bt_sock_unregister(int proto); 234void bt_sock_unregister(int proto);
236void bt_sock_link(struct bt_sock_list *l, struct sock *s); 235void bt_sock_link(struct bt_sock_list *l, struct sock *s);
237void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 236void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
238int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, 237int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
@@ -260,12 +259,23 @@ struct l2cap_ctrl {
260 __u8 retries; 259 __u8 retries;
261}; 260};
262 261
262struct hci_dev;
263
264typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status);
265
266struct hci_req_ctrl {
267 bool start;
268 u8 event;
269 hci_req_complete_t complete;
270};
271
263struct bt_skb_cb { 272struct bt_skb_cb {
264 __u8 pkt_type; 273 __u8 pkt_type;
265 __u8 incoming; 274 __u8 incoming;
266 __u16 expect; 275 __u16 expect;
267 __u8 force_active; 276 __u8 force_active;
268 struct l2cap_ctrl control; 277 struct l2cap_ctrl control;
278 struct hci_req_ctrl req;
269}; 279};
270#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 280#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
271 281
@@ -319,7 +329,7 @@ extern void hci_sock_cleanup(void);
319extern int bt_sysfs_init(void); 329extern int bt_sysfs_init(void);
320extern void bt_sysfs_cleanup(void); 330extern void bt_sysfs_cleanup(void);
321 331
322extern int bt_procfs_init(struct module* module, struct net *net, const char *name, 332extern int bt_procfs_init(struct net *net, const char *name,
323 struct bt_sock_list* sk_list, 333 struct bt_sock_list* sk_list,
324 int (* seq_show)(struct seq_file *, void *)); 334 int (* seq_show)(struct seq_file *, void *));
325extern void bt_procfs_cleanup(struct net *net, const char *name); 335extern void bt_procfs_cleanup(struct net *net, const char *name);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 7f12c25f1fca..e0512aaef4b8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -119,10 +119,16 @@ enum {
119 HCI_CONNECTABLE, 119 HCI_CONNECTABLE,
120 HCI_DISCOVERABLE, 120 HCI_DISCOVERABLE,
121 HCI_LINK_SECURITY, 121 HCI_LINK_SECURITY,
122 HCI_PENDING_CLASS,
123 HCI_PERIODIC_INQ, 122 HCI_PERIODIC_INQ,
123 HCI_FAST_CONNECTABLE,
124}; 124};
125 125
126/* A mask for the flags that are supposed to remain when a reset happens
127 * or the HCI device is closed.
128 */
129#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
130 BIT(HCI_FAST_CONNECTABLE))
131
126/* HCI ioctl defines */ 132/* HCI ioctl defines */
127#define HCIDEVUP _IOW('H', 201, int) 133#define HCIDEVUP _IOW('H', 201, int)
128#define HCIDEVDOWN _IOW('H', 202, int) 134#define HCIDEVDOWN _IOW('H', 202, int)
@@ -881,12 +887,25 @@ struct hci_rp_read_data_block_size {
881 __le16 num_blocks; 887 __le16 num_blocks;
882} __packed; 888} __packed;
883 889
890#define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b
891struct hci_rp_read_page_scan_activity {
892 __u8 status;
893 __le16 interval;
894 __le16 window;
895} __packed;
896
884#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 897#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
885struct hci_cp_write_page_scan_activity { 898struct hci_cp_write_page_scan_activity {
886 __le16 interval; 899 __le16 interval;
887 __le16 window; 900 __le16 window;
888} __packed; 901} __packed;
889 902
903#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46
904struct hci_rp_read_page_scan_type {
905 __u8 status;
906 __u8 type;
907} __packed;
908
890#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 909#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
891 #define PAGE_SCAN_TYPE_STANDARD 0x00 910 #define PAGE_SCAN_TYPE_STANDARD 0x00
892 #define PAGE_SCAN_TYPE_INTERLACED 0x01 911 #define PAGE_SCAN_TYPE_INTERLACED 0x01
@@ -965,6 +984,9 @@ struct hci_cp_le_set_adv_data {
965 984
966#define HCI_OP_LE_SET_ADV_ENABLE 0x200a 985#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
967 986
987#define LE_SCAN_PASSIVE 0x00
988#define LE_SCAN_ACTIVE 0x01
989
968#define HCI_OP_LE_SET_SCAN_PARAM 0x200b 990#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
969struct hci_cp_le_set_scan_param { 991struct hci_cp_le_set_scan_param {
970 __u8 type; 992 __u8 type;
@@ -974,8 +996,10 @@ struct hci_cp_le_set_scan_param {
974 __u8 filter_policy; 996 __u8 filter_policy;
975} __packed; 997} __packed;
976 998
977#define LE_SCANNING_DISABLED 0x00 999#define LE_SCAN_DISABLE 0x00
978#define LE_SCANNING_ENABLED 0x01 1000#define LE_SCAN_ENABLE 0x01
1001#define LE_SCAN_FILTER_DUP_DISABLE 0x00
1002#define LE_SCAN_FILTER_DUP_ENABLE 0x01
979 1003
980#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 1004#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
981struct hci_cp_le_set_scan_enable { 1005struct hci_cp_le_set_scan_enable {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 90cf75afcb02..35a57cd1704c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -134,6 +134,8 @@ struct amp_assoc {
134 __u8 data[HCI_MAX_AMP_ASSOC_SIZE]; 134 __u8 data[HCI_MAX_AMP_ASSOC_SIZE];
135}; 135};
136 136
137#define HCI_MAX_PAGES 3
138
137#define NUM_REASSEMBLY 4 139#define NUM_REASSEMBLY 4
138struct hci_dev { 140struct hci_dev {
139 struct list_head list; 141 struct list_head list;
@@ -151,8 +153,8 @@ struct hci_dev {
151 __u8 dev_class[3]; 153 __u8 dev_class[3];
152 __u8 major_class; 154 __u8 major_class;
153 __u8 minor_class; 155 __u8 minor_class;
154 __u8 features[8]; 156 __u8 max_page;
155 __u8 host_features[8]; 157 __u8 features[HCI_MAX_PAGES][8];
156 __u8 le_features[8]; 158 __u8 le_features[8];
157 __u8 le_white_list_size; 159 __u8 le_white_list_size;
158 __u8 le_states[8]; 160 __u8 le_states[8];
@@ -165,6 +167,10 @@ struct hci_dev {
165 __u16 voice_setting; 167 __u16 voice_setting;
166 __u8 io_capability; 168 __u8 io_capability;
167 __s8 inq_tx_power; 169 __s8 inq_tx_power;
170 __u16 page_scan_interval;
171 __u16 page_scan_window;
172 __u8 page_scan_type;
173
168 __u16 devid_source; 174 __u16 devid_source;
169 __u16 devid_vendor; 175 __u16 devid_vendor;
170 __u16 devid_product; 176 __u16 devid_product;
@@ -240,6 +246,7 @@ struct hci_dev {
240 struct sk_buff_head raw_q; 246 struct sk_buff_head raw_q;
241 struct sk_buff_head cmd_q; 247 struct sk_buff_head cmd_q;
242 248
249 struct sk_buff *recv_evt;
243 struct sk_buff *sent_cmd; 250 struct sk_buff *sent_cmd;
244 struct sk_buff *reassembly[NUM_REASSEMBLY]; 251 struct sk_buff *reassembly[NUM_REASSEMBLY];
245 252
@@ -248,8 +255,6 @@ struct hci_dev {
248 __u32 req_status; 255 __u32 req_status;
249 __u32 req_result; 256 __u32 req_result;
250 257
251 __u16 init_last_cmd;
252
253 struct list_head mgmt_pending; 258 struct list_head mgmt_pending;
254 259
255 struct discovery_state discovery; 260 struct discovery_state discovery;
@@ -266,8 +271,6 @@ struct hci_dev {
266 271
267 struct hci_dev_stats stat; 272 struct hci_dev_stats stat;
268 273
269 struct sk_buff_head driver_init;
270
271 atomic_t promisc; 274 atomic_t promisc;
272 275
273 struct dentry *debugfs; 276 struct dentry *debugfs;
@@ -290,6 +293,7 @@ struct hci_dev {
290 int (*open)(struct hci_dev *hdev); 293 int (*open)(struct hci_dev *hdev);
291 int (*close)(struct hci_dev *hdev); 294 int (*close)(struct hci_dev *hdev);
292 int (*flush)(struct hci_dev *hdev); 295 int (*flush)(struct hci_dev *hdev);
296 int (*setup)(struct hci_dev *hdev);
293 int (*send)(struct sk_buff *skb); 297 int (*send)(struct sk_buff *skb);
294 void (*notify)(struct hci_dev *hdev, unsigned int evt); 298 void (*notify)(struct hci_dev *hdev, unsigned int evt);
295 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 299 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
@@ -311,7 +315,7 @@ struct hci_conn {
311 bool out; 315 bool out;
312 __u8 attempt; 316 __u8 attempt;
313 __u8 dev_class[3]; 317 __u8 dev_class[3];
314 __u8 features[8]; 318 __u8 features[HCI_MAX_PAGES][8];
315 __u16 interval; 319 __u16 interval;
316 __u16 pkt_type; 320 __u16 pkt_type;
317 __u16 link_policy; 321 __u16 link_policy;
@@ -343,7 +347,6 @@ struct hci_conn {
343 struct timer_list auto_accept_timer; 347 struct timer_list auto_accept_timer;
344 348
345 struct device dev; 349 struct device dev;
346 atomic_t devref;
347 350
348 struct hci_dev *hdev; 351 struct hci_dev *hdev;
349 void *l2cap_data; 352 void *l2cap_data;
@@ -574,7 +577,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
574 return NULL; 577 return NULL;
575} 578}
576 579
577void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 580void hci_disconnect(struct hci_conn *conn, __u8 reason);
578void hci_setup_sync(struct hci_conn *conn, __u16 handle); 581void hci_setup_sync(struct hci_conn *conn, __u16 handle);
579void hci_sco_setup(struct hci_conn *conn, __u8 status); 582void hci_sco_setup(struct hci_conn *conn, __u8 status);
580 583
@@ -582,7 +585,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
582int hci_conn_del(struct hci_conn *conn); 585int hci_conn_del(struct hci_conn *conn);
583void hci_conn_hash_flush(struct hci_dev *hdev); 586void hci_conn_hash_flush(struct hci_dev *hdev);
584void hci_conn_check_pending(struct hci_dev *hdev); 587void hci_conn_check_pending(struct hci_dev *hdev);
585void hci_conn_accept(struct hci_conn *conn, int mask);
586 588
587struct hci_chan *hci_chan_create(struct hci_conn *conn); 589struct hci_chan *hci_chan_create(struct hci_conn *conn);
588void hci_chan_del(struct hci_chan *chan); 590void hci_chan_del(struct hci_chan *chan);
@@ -599,8 +601,36 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
599 601
600void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 602void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
601 603
602void hci_conn_hold_device(struct hci_conn *conn); 604/*
603void hci_conn_put_device(struct hci_conn *conn); 605 * hci_conn_get() and hci_conn_put() are used to control the life-time of an
606 * "hci_conn" object. They do not guarantee that the hci_conn object is running,
607 * working or anything else. They just guarantee that the object is available
608 * and can be dereferenced. So you can use its locks, local variables and any
609 * other constant data.
610 * Before accessing runtime data, you _must_ lock the object and then check that
611 * it is still running. As soon as you release the locks, the connection might
612 * get dropped, though.
613 *
614 * On the other hand, hci_conn_hold() and hci_conn_drop() are used to control
615 * how long the underlying connection is held. So every channel that runs on the
616 * hci_conn object calls this to prevent the connection from disappearing. As
617 * long as you hold a device, you must also guarantee that you have a valid
618 * reference to the device via hci_conn_get() (or the initial reference from
619 * hci_conn_add()).
620 * The hold()/drop() ref-count is known to drop below 0 sometimes, which doesn't
621 * break because nobody cares for that. But this means, we cannot use
622 * _get()/_drop() in it, but require the caller to have a valid ref (FIXME).
623 */
624
625static inline void hci_conn_get(struct hci_conn *conn)
626{
627 get_device(&conn->dev);
628}
629
630static inline void hci_conn_put(struct hci_conn *conn)
631{
632 put_device(&conn->dev);
633}
604 634
605static inline void hci_conn_hold(struct hci_conn *conn) 635static inline void hci_conn_hold(struct hci_conn *conn)
606{ 636{
@@ -610,7 +640,7 @@ static inline void hci_conn_hold(struct hci_conn *conn)
610 cancel_delayed_work(&conn->disc_work); 640 cancel_delayed_work(&conn->disc_work);
611} 641}
612 642
613static inline void hci_conn_put(struct hci_conn *conn) 643static inline void hci_conn_drop(struct hci_conn *conn)
614{ 644{
615 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt)); 645 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt));
616 646
@@ -742,8 +772,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
742 u8 *randomizer); 772 u8 *randomizer);
743int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 773int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
744 774
745int hci_update_ad(struct hci_dev *hdev);
746
747void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 775void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
748 776
749int hci_recv_frame(struct sk_buff *skb); 777int hci_recv_frame(struct sk_buff *skb);
@@ -760,29 +788,29 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
760#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) 788#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
761 789
762/* ----- LMP capabilities ----- */ 790/* ----- LMP capabilities ----- */
763#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) 791#define lmp_encrypt_capable(dev) ((dev)->features[0][0] & LMP_ENCRYPT)
764#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) 792#define lmp_rswitch_capable(dev) ((dev)->features[0][0] & LMP_RSWITCH)
765#define lmp_hold_capable(dev) ((dev)->features[0] & LMP_HOLD) 793#define lmp_hold_capable(dev) ((dev)->features[0][0] & LMP_HOLD)
766#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) 794#define lmp_sniff_capable(dev) ((dev)->features[0][0] & LMP_SNIFF)
767#define lmp_park_capable(dev) ((dev)->features[1] & LMP_PARK) 795#define lmp_park_capable(dev) ((dev)->features[0][1] & LMP_PARK)
768#define lmp_inq_rssi_capable(dev) ((dev)->features[3] & LMP_RSSI_INQ) 796#define lmp_inq_rssi_capable(dev) ((dev)->features[0][3] & LMP_RSSI_INQ)
769#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 797#define lmp_esco_capable(dev) ((dev)->features[0][3] & LMP_ESCO)
770#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) 798#define lmp_bredr_capable(dev) (!((dev)->features[0][4] & LMP_NO_BREDR))
771#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 799#define lmp_le_capable(dev) ((dev)->features[0][4] & LMP_LE)
772#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 800#define lmp_sniffsubr_capable(dev) ((dev)->features[0][5] & LMP_SNIFF_SUBR)
773#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC) 801#define lmp_pause_enc_capable(dev) ((dev)->features[0][5] & LMP_PAUSE_ENC)
774#define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ) 802#define lmp_ext_inq_capable(dev) ((dev)->features[0][6] & LMP_EXT_INQ)
775#define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR) 803#define lmp_le_br_capable(dev) (!!((dev)->features[0][6] & LMP_SIMUL_LE_BR))
776#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 804#define lmp_ssp_capable(dev) ((dev)->features[0][6] & LMP_SIMPLE_PAIR)
777#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 805#define lmp_no_flush_capable(dev) ((dev)->features[0][6] & LMP_NO_FLUSH)
778#define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO) 806#define lmp_lsto_capable(dev) ((dev)->features[0][7] & LMP_LSTO)
779#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[7] & LMP_INQ_TX_PWR) 807#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[0][7] & LMP_INQ_TX_PWR)
780#define lmp_ext_feat_capable(dev) ((dev)->features[7] & LMP_EXTFEATURES) 808#define lmp_ext_feat_capable(dev) ((dev)->features[0][7] & LMP_EXTFEATURES)
781 809
782/* ----- Extended LMP capabilities ----- */ 810/* ----- Extended LMP capabilities ----- */
783#define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP) 811#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP)
784#define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE) 812#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
785#define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR) 813#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
786 814
787/* returns true if at least one AMP active */ 815/* returns true if at least one AMP active */
788static inline bool hci_amp_capable(void) 816static inline bool hci_amp_capable(void)
@@ -1041,7 +1069,31 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
1041int hci_register_cb(struct hci_cb *hcb); 1069int hci_register_cb(struct hci_cb *hcb);
1042int hci_unregister_cb(struct hci_cb *hcb); 1070int hci_unregister_cb(struct hci_cb *hcb);
1043 1071
1044int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 1072struct hci_request {
1073 struct hci_dev *hdev;
1074 struct sk_buff_head cmd_q;
1075
1076 /* If something goes wrong when building the HCI request, the error
1077 * value is stored in this field.
1078 */
1079 int err;
1080};
1081
1082void hci_req_init(struct hci_request *req, struct hci_dev *hdev);
1083int hci_req_run(struct hci_request *req, hci_req_complete_t complete);
1084void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
1085 const void *param);
1086void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1087 const void *param, u8 event);
1088void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1089
1090struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1091 const void *param, u32 timeout);
1092struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
1093 const void *param, u8 event, u32 timeout);
1094
1095int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
1096 const void *param);
1045void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); 1097void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
1046void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 1098void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
1047 1099
@@ -1153,7 +1205,7 @@ struct hci_sec_filter {
1153#define hci_req_lock(d) mutex_lock(&d->req_lock) 1205#define hci_req_lock(d) mutex_lock(&d->req_lock)
1154#define hci_req_unlock(d) mutex_unlock(&d->req_lock) 1206#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1155 1207
1156void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); 1208void hci_update_ad(struct hci_request *req);
1157 1209
1158void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1210void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1159 u16 latency, u16 to_multiplier); 1211 u16 latency, u16 to_multiplier);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index cdd33021f831..fb94cf13c777 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -583,6 +583,14 @@ struct l2cap_conn {
583 583
584 struct list_head chan_l; 584 struct list_head chan_l;
585 struct mutex chan_lock; 585 struct mutex chan_lock;
586 struct kref ref;
587 struct list_head users;
588};
589
590struct l2cap_user {
591 struct list_head list;
592 int (*probe) (struct l2cap_conn *conn, struct l2cap_user *user);
593 void (*remove) (struct l2cap_conn *conn, struct l2cap_user *user);
586}; 594};
587 595
588#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 596#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
@@ -786,6 +794,7 @@ extern bool disable_ertm;
786 794
787int l2cap_init_sockets(void); 795int l2cap_init_sockets(void);
788void l2cap_cleanup_sockets(void); 796void l2cap_cleanup_sockets(void);
797bool l2cap_is_socket(struct socket *sock);
789 798
790void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); 799void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
791int __l2cap_wait_ack(struct sock *sk); 800int __l2cap_wait_ack(struct sock *sk);
@@ -812,4 +821,10 @@ void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
812 u8 status); 821 u8 status);
813void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); 822void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
814 823
824void l2cap_conn_get(struct l2cap_conn *conn);
825void l2cap_conn_put(struct l2cap_conn *conn);
826
827int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
828void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user);
829
815#endif /* __L2CAP_H */ 830#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index e2e3ecad1008..7afd4199d6b6 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -158,7 +158,6 @@ struct rfcomm_session {
158 struct timer_list timer; 158 struct timer_list timer;
159 unsigned long state; 159 unsigned long state;
160 unsigned long flags; 160 unsigned long flags;
161 atomic_t refcnt;
162 int initiator; 161 int initiator;
163 162
164 /* Default DLC parameters */ 163 /* Default DLC parameters */
@@ -276,11 +275,6 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)
276void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, 275void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src,
277 bdaddr_t *dst); 276 bdaddr_t *dst);
278 277
279static inline void rfcomm_session_hold(struct rfcomm_session *s)
280{
281 atomic_inc(&s->refcnt);
282}
283
284/* ---- RFCOMM sockets ---- */ 278/* ---- RFCOMM sockets ---- */
285struct sockaddr_rc { 279struct sockaddr_rc {
286 sa_family_t rc_family; 280 sa_family_t rc_family;
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index ef2dd9438bb1..028b754ae9b1 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h
index d02f044adb8a..d6e3c4267c81 100644
--- a/include/net/caif/caif_device.h
+++ b/include/net/caif/caif_device.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index bcb9cc3ce98b..4795e817afe5 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * Author: Daniel Martensson / daniel.martensson@stericsson.com 3 * Author: Daniel Martensson / daniel.martensson@stericsson.com
5 * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com 4 * Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com
6 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 0f3a39125f90..94e5ed64dc6d 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland / sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/caif_shm.h b/include/net/caif/caif_shm.h
deleted file mode 100644
index 5bcce55438cf..000000000000
--- a/include/net/caif/caif_shm.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * Author: Amarnath Revanna / amarnath.bangalore.revanna@stericsson.com
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef CAIF_SHM_H_
9#define CAIF_SHM_H_
10
11struct shmdev_layer {
12 u32 shm_base_addr;
13 u32 shm_total_sz;
14 u32 shm_id;
15 u32 shm_loopback;
16 void *hmbx;
17 int (*pshmdev_mbxsend) (u32 shm_id, u32 mbx_msg);
18 int (*pshmdev_mbxsetup) (void *pshmdrv_cb,
19 struct shmdev_layer *pshm_dev, void *pshm_drv);
20 struct net_device *pshm_netdev;
21};
22
23extern int caif_shmcore_probe(struct shmdev_layer *pshm_dev);
24extern void caif_shmcore_remove(struct net_device *pshm_netdev);
25
26#endif
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 90b4ff8bad83..70bfd017581f 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
index 9e5425b4a1d7..f2ae33d23baf 100644
--- a/include/net/caif/cfctrl.h
+++ b/include/net/caif/cfctrl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h
index afac1a48cce7..a06e33fbaa8b 100644
--- a/include/net/caif/cffrml.h
+++ b/include/net/caif/cffrml.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h
index 5847a196b8ad..752999572f21 100644
--- a/include/net/caif/cfmuxl.h
+++ b/include/net/caif/cfmuxl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
index 83a89ba3005b..1c1ad46250d5 100644
--- a/include/net/caif/cfpkt.h
+++ b/include/net/caif/cfpkt.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
index f121299a3427..b5b020f3c72e 100644
--- a/include/net/caif/cfserl.h
+++ b/include/net/caif/cfserl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index 0f5905241843..cd47705c2cc3 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d581c6de5d64..26b5b692c22b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -611,22 +611,10 @@ struct cfg80211_ap_settings {
611}; 611};
612 612
613/** 613/**
614 * enum plink_action - actions to perform in mesh peers
615 *
616 * @PLINK_ACTION_INVALID: action 0 is reserved
617 * @PLINK_ACTION_OPEN: start mesh peer link establishment
618 * @PLINK_ACTION_BLOCK: block traffic from this mesh peer
619 */
620enum plink_actions {
621 PLINK_ACTION_INVALID,
622 PLINK_ACTION_OPEN,
623 PLINK_ACTION_BLOCK,
624};
625
626/**
627 * enum station_parameters_apply_mask - station parameter values to apply 614 * enum station_parameters_apply_mask - station parameter values to apply
628 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) 615 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
629 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability 616 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
617 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
630 * 618 *
631 * Not all station parameters have in-band "no change" signalling, 619 * Not all station parameters have in-band "no change" signalling,
632 * for those that don't these flags will are used. 620 * for those that don't these flags will are used.
@@ -634,6 +622,7 @@ enum plink_actions {
634enum station_parameters_apply_mask { 622enum station_parameters_apply_mask {
635 STATION_PARAM_APPLY_UAPSD = BIT(0), 623 STATION_PARAM_APPLY_UAPSD = BIT(0),
636 STATION_PARAM_APPLY_CAPABILITY = BIT(1), 624 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
625 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
637}; 626};
638 627
639/** 628/**
@@ -669,7 +658,7 @@ enum station_parameters_apply_mask {
669 * @ext_capab_len: number of extended capabilities 658 * @ext_capab_len: number of extended capabilities
670 */ 659 */
671struct station_parameters { 660struct station_parameters {
672 u8 *supported_rates; 661 const u8 *supported_rates;
673 struct net_device *vlan; 662 struct net_device *vlan;
674 u32 sta_flags_mask, sta_flags_set; 663 u32 sta_flags_mask, sta_flags_set;
675 u32 sta_modify_mask; 664 u32 sta_modify_mask;
@@ -678,17 +667,60 @@ struct station_parameters {
678 u8 supported_rates_len; 667 u8 supported_rates_len;
679 u8 plink_action; 668 u8 plink_action;
680 u8 plink_state; 669 u8 plink_state;
681 struct ieee80211_ht_cap *ht_capa; 670 const struct ieee80211_ht_cap *ht_capa;
682 struct ieee80211_vht_cap *vht_capa; 671 const struct ieee80211_vht_cap *vht_capa;
683 u8 uapsd_queues; 672 u8 uapsd_queues;
684 u8 max_sp; 673 u8 max_sp;
685 enum nl80211_mesh_power_mode local_pm; 674 enum nl80211_mesh_power_mode local_pm;
686 u16 capability; 675 u16 capability;
687 u8 *ext_capab; 676 const u8 *ext_capab;
688 u8 ext_capab_len; 677 u8 ext_capab_len;
689}; 678};
690 679
691/** 680/**
681 * enum cfg80211_station_type - the type of station being modified
682 * @CFG80211_STA_AP_CLIENT: client of an AP interface
683 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
684 * the AP MLME in the device
685 * @CFG80211_STA_AP_STA: AP station on managed interface
686 * @CFG80211_STA_IBSS: IBSS station
687 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
688 * while TDLS setup is in progress, it moves out of this state when
689 * being marked authorized; use this only if TDLS with external setup is
690 * supported/used)
691 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
692 * entry that is operating, has been marked authorized by userspace)
693 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
694 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
695 */
696enum cfg80211_station_type {
697 CFG80211_STA_AP_CLIENT,
698 CFG80211_STA_AP_MLME_CLIENT,
699 CFG80211_STA_AP_STA,
700 CFG80211_STA_IBSS,
701 CFG80211_STA_TDLS_PEER_SETUP,
702 CFG80211_STA_TDLS_PEER_ACTIVE,
703 CFG80211_STA_MESH_PEER_KERNEL,
704 CFG80211_STA_MESH_PEER_USER,
705};
706
707/**
708 * cfg80211_check_station_change - validate parameter changes
709 * @wiphy: the wiphy this operates on
710 * @params: the new parameters for a station
711 * @statype: the type of station being modified
712 *
713 * Utility function for the @change_station driver method. Call this function
714 * with the appropriate station type looking up the station (and checking that
715 * it exists). It will verify whether the station change is acceptable, and if
716 * not will return an error code. Note that it may modify the parameters for
717 * backward compatibility reasons, so don't use them before calling this.
718 */
719int cfg80211_check_station_change(struct wiphy *wiphy,
720 struct station_parameters *params,
721 enum cfg80211_station_type statype);
722
723/**
692 * enum station_info_flags - station information flags 724 * enum station_info_flags - station information flags
693 * 725 *
694 * Used by the driver to indicate which info in &struct station_info 726 * Used by the driver to indicate which info in &struct station_info
@@ -1119,6 +1151,7 @@ struct mesh_config {
1119 * @ie_len: length of vendor information elements 1151 * @ie_len: length of vendor information elements
1120 * @is_authenticated: this mesh requires authentication 1152 * @is_authenticated: this mesh requires authentication
1121 * @is_secure: this mesh uses security 1153 * @is_secure: this mesh uses security
1154 * @user_mpm: userspace handles all MPM functions
1122 * @dtim_period: DTIM period to use 1155 * @dtim_period: DTIM period to use
1123 * @beacon_interval: beacon interval to use 1156 * @beacon_interval: beacon interval to use
1124 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1157 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
@@ -1136,6 +1169,7 @@ struct mesh_setup {
1136 u8 ie_len; 1169 u8 ie_len;
1137 bool is_authenticated; 1170 bool is_authenticated;
1138 bool is_secure; 1171 bool is_secure;
1172 bool user_mpm;
1139 u8 dtim_period; 1173 u8 dtim_period;
1140 u16 beacon_interval; 1174 u16 beacon_interval;
1141 int mcast_rate[IEEE80211_NUM_BANDS]; 1175 int mcast_rate[IEEE80211_NUM_BANDS];
@@ -1398,9 +1432,11 @@ struct cfg80211_auth_request {
1398 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. 1432 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
1399 * 1433 *
1400 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1434 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
1435 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
1401 */ 1436 */
1402enum cfg80211_assoc_req_flags { 1437enum cfg80211_assoc_req_flags {
1403 ASSOC_REQ_DISABLE_HT = BIT(0), 1438 ASSOC_REQ_DISABLE_HT = BIT(0),
1439 ASSOC_REQ_DISABLE_VHT = BIT(1),
1404}; 1440};
1405 1441
1406/** 1442/**
@@ -1422,6 +1458,8 @@ enum cfg80211_assoc_req_flags {
1422 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1458 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1423 * will be used in ht_capa. Un-supported values will be ignored. 1459 * will be used in ht_capa. Un-supported values will be ignored.
1424 * @ht_capa_mask: The bits of ht_capa which are to be used. 1460 * @ht_capa_mask: The bits of ht_capa which are to be used.
1461 * @vht_capa: VHT capability override
1462 * @vht_capa_mask: VHT capability mask indicating which fields to use
1425 */ 1463 */
1426struct cfg80211_assoc_request { 1464struct cfg80211_assoc_request {
1427 struct cfg80211_bss *bss; 1465 struct cfg80211_bss *bss;
@@ -1432,6 +1470,7 @@ struct cfg80211_assoc_request {
1432 u32 flags; 1470 u32 flags;
1433 struct ieee80211_ht_cap ht_capa; 1471 struct ieee80211_ht_cap ht_capa;
1434 struct ieee80211_ht_cap ht_capa_mask; 1472 struct ieee80211_ht_cap ht_capa_mask;
1473 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1435}; 1474};
1436 1475
1437/** 1476/**
@@ -1542,6 +1581,8 @@ struct cfg80211_ibss_params {
1542 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1581 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1543 * will be used in ht_capa. Un-supported values will be ignored. 1582 * will be used in ht_capa. Un-supported values will be ignored.
1544 * @ht_capa_mask: The bits of ht_capa which are to be used. 1583 * @ht_capa_mask: The bits of ht_capa which are to be used.
1584 * @vht_capa: VHT Capability overrides
1585 * @vht_capa_mask: The bits of vht_capa which are to be used.
1545 */ 1586 */
1546struct cfg80211_connect_params { 1587struct cfg80211_connect_params {
1547 struct ieee80211_channel *channel; 1588 struct ieee80211_channel *channel;
@@ -1560,6 +1601,8 @@ struct cfg80211_connect_params {
1560 int bg_scan_period; 1601 int bg_scan_period;
1561 struct ieee80211_ht_cap ht_capa; 1602 struct ieee80211_ht_cap ht_capa;
1562 struct ieee80211_ht_cap ht_capa_mask; 1603 struct ieee80211_ht_cap ht_capa_mask;
1604 struct ieee80211_vht_cap vht_capa;
1605 struct ieee80211_vht_cap vht_capa_mask;
1563}; 1606};
1564 1607
1565/** 1608/**
@@ -1722,6 +1765,21 @@ struct cfg80211_gtk_rekey_data {
1722}; 1765};
1723 1766
1724/** 1767/**
1768 * struct cfg80211_update_ft_ies_params - FT IE Information
1769 *
1770 * This structure provides information needed to update the fast transition IE
1771 *
1772 * @md: The Mobility Domain ID, 2 Octet value
1773 * @ie: Fast Transition IEs
1774 * @ie_len: Length of ft_ie in octets
1775 */
1776struct cfg80211_update_ft_ies_params {
1777 u16 md;
1778 const u8 *ie;
1779 size_t ie_len;
1780};
1781
1782/**
1725 * struct cfg80211_ops - backend description for wireless configuration 1783 * struct cfg80211_ops - backend description for wireless configuration
1726 * 1784 *
1727 * This struct is registered by fullmac card drivers and/or wireless stacks 1785 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -1781,9 +1839,8 @@ struct cfg80211_gtk_rekey_data {
1781 * @change_station: Modify a given station. Note that flags changes are not much 1839 * @change_station: Modify a given station. Note that flags changes are not much
1782 * validated in cfg80211, in particular the auth/assoc/authorized flags 1840 * validated in cfg80211, in particular the auth/assoc/authorized flags
1783 * might come to the driver in invalid combinations -- make sure to check 1841 * might come to the driver in invalid combinations -- make sure to check
1784 * them, also against the existing state! Also, supported_rates changes are 1842 * them, also against the existing state! Drivers must call
1785 * not checked in station mode -- drivers need to reject (or ignore) them 1843 * cfg80211_check_station_change() to validate the information.
1786 * for anything but TDLS peers.
1787 * @get_station: get station information for the station identified by @mac 1844 * @get_station: get station information for the station identified by @mac
1788 * @dump_station: dump station callback -- resume dump at index @idx 1845 * @dump_station: dump station callback -- resume dump at index @idx
1789 * 1846 *
@@ -1941,6 +1998,16 @@ struct cfg80211_gtk_rekey_data {
1941 * advertise the support for MAC based ACL have to implement this callback. 1998 * advertise the support for MAC based ACL have to implement this callback.
1942 * 1999 *
1943 * @start_radar_detection: Start radar detection in the driver. 2000 * @start_radar_detection: Start radar detection in the driver.
2001 *
2002 * @update_ft_ies: Provide updated Fast BSS Transition information to the
2003 * driver. If the SME is in the driver/firmware, this information can be
2004 * used in building Authentication and Reassociation Request frames.
2005 *
2006 * @crit_proto_start: Indicates a critical protocol needs more link reliability
2007 * for a given duration (milliseconds). The protocol is provided so the
2008 * driver can take the most appropriate actions.
2009 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
2010 * reliability. This operation can not fail.
1944 */ 2011 */
1945struct cfg80211_ops { 2012struct cfg80211_ops {
1946 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2013 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2168,6 +2235,14 @@ struct cfg80211_ops {
2168 int (*start_radar_detection)(struct wiphy *wiphy, 2235 int (*start_radar_detection)(struct wiphy *wiphy,
2169 struct net_device *dev, 2236 struct net_device *dev,
2170 struct cfg80211_chan_def *chandef); 2237 struct cfg80211_chan_def *chandef);
2238 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2239 struct cfg80211_update_ft_ies_params *ftie);
2240 int (*crit_proto_start)(struct wiphy *wiphy,
2241 struct wireless_dev *wdev,
2242 enum nl80211_crit_proto_id protocol,
2243 u16 duration);
2244 void (*crit_proto_stop)(struct wiphy *wiphy,
2245 struct wireless_dev *wdev);
2171}; 2246};
2172 2247
2173/* 2248/*
@@ -2485,6 +2560,8 @@ struct wiphy_wowlan_support {
2485 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 2560 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
2486 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 2561 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
2487 * If null, then none can be over-ridden. 2562 * If null, then none can be over-ridden.
2563 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
2564 * If null, then none can be over-ridden.
2488 * 2565 *
2489 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device 2566 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
2490 * supports for ACL. 2567 * supports for ACL.
@@ -2593,6 +2670,7 @@ struct wiphy {
2593 struct dentry *debugfsdir; 2670 struct dentry *debugfsdir;
2594 2671
2595 const struct ieee80211_ht_cap *ht_capa_mod_mask; 2672 const struct ieee80211_ht_cap *ht_capa_mod_mask;
2673 const struct ieee80211_vht_cap *vht_capa_mod_mask;
2596 2674
2597#ifdef CONFIG_NET_NS 2675#ifdef CONFIG_NET_NS
2598 /* the network namespace this phy lives in currently */ 2676 /* the network namespace this phy lives in currently */
@@ -3958,6 +4036,17 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3958void cfg80211_ch_switch_notify(struct net_device *dev, 4036void cfg80211_ch_switch_notify(struct net_device *dev,
3959 struct cfg80211_chan_def *chandef); 4037 struct cfg80211_chan_def *chandef);
3960 4038
4039/**
4040 * ieee80211_operating_class_to_band - convert operating class to band
4041 *
4042 * @operating_class: the operating class to convert
4043 * @band: band pointer to fill
4044 *
4045 * Returns %true if the conversion was successful, %false otherwise.
4046 */
4047bool ieee80211_operating_class_to_band(u8 operating_class,
4048 enum ieee80211_band *band);
4049
3961/* 4050/*
3962 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 4051 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
3963 * @dev: the device on which the operation is requested 4052 * @dev: the device on which the operation is requested
@@ -4002,6 +4091,30 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);
4002void cfg80211_unregister_wdev(struct wireless_dev *wdev); 4091void cfg80211_unregister_wdev(struct wireless_dev *wdev);
4003 4092
4004/** 4093/**
4094 * struct cfg80211_ft_event - FT Information Elements
4095 * @ies: FT IEs
4096 * @ies_len: length of the FT IE in bytes
4097 * @target_ap: target AP's MAC address
4098 * @ric_ies: RIC IE
4099 * @ric_ies_len: length of the RIC IE in bytes
4100 */
4101struct cfg80211_ft_event_params {
4102 const u8 *ies;
4103 size_t ies_len;
4104 const u8 *target_ap;
4105 const u8 *ric_ies;
4106 size_t ric_ies_len;
4107};
4108
4109/**
4110 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
4111 * @netdev: network device
4112 * @ft_event: IE information
4113 */
4114void cfg80211_ft_event(struct net_device *netdev,
4115 struct cfg80211_ft_event_params *ft_event);
4116
4117/**
4005 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer 4118 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
4006 * @ies: the input IE buffer 4119 * @ies: the input IE buffer
4007 * @len: the input length 4120 * @len: the input length
@@ -4036,6 +4149,17 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4036 struct cfg80211_wowlan_wakeup *wakeup, 4149 struct cfg80211_wowlan_wakeup *wakeup,
4037 gfp_t gfp); 4150 gfp_t gfp);
4038 4151
4152/**
4153 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
4154 *
4155 * @wdev: the wireless device for which critical protocol is stopped.
4156 *
4157 * This function can be called by the driver to indicate it has reverted
4158 * operation back to normal. One reason could be that the duration given
4159 * by .crit_proto_start() has expired.
4160 */
4161void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
4162
4039/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4163/* Logging, debugging and troubleshooting/diagnostic helpers. */
4040 4164
4041/* wiphy_printk helpers, similar to dev_printk */ 4165/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 2581638f4a3d..0fee0617fb7d 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,7 +24,7 @@ struct cgroup_cls_state
24 u32 classid; 24 u32 classid;
25}; 25};
26 26
27extern void sock_update_classid(struct sock *sk, struct task_struct *task); 27extern void sock_update_classid(struct sock *sk);
28 28
29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) 29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
30static inline u32 task_cls_classid(struct task_struct *p) 30static inline u32 task_cls_classid(struct task_struct *p)
@@ -61,7 +61,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
61} 61}
62#endif 62#endif
63#else /* !CGROUP_NET_CLS_CGROUP */ 63#else /* !CGROUP_NET_CLS_CGROUP */
64static inline void sock_update_classid(struct sock *sk, struct task_struct *task) 64static inline void sock_update_classid(struct sock *sk)
65{ 65{
66} 66}
67 67
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 1ee9d4bda30d..74004af31c48 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -1,24 +1,9 @@
1#ifndef _NET_DN_FIB_H 1#ifndef _NET_DN_FIB_H
2#define _NET_DN_FIB_H 2#define _NET_DN_FIB_H
3 3
4/* WARNING: The ordering of these elements must match ordering 4#include <linux/netlink.h>
5 * of RTA_* rtnetlink attribute numbers. 5
6 */ 6extern const struct nla_policy rtm_dn_policy[];
7struct dn_kern_rta {
8 void *rta_dst;
9 void *rta_src;
10 int *rta_iif;
11 int *rta_oif;
12 void *rta_gw;
13 u32 *rta_priority;
14 void *rta_prefsrc;
15 struct rtattr *rta_mx;
16 struct rtattr *rta_mp;
17 unsigned char *rta_protoinfo;
18 u32 *rta_flow;
19 struct rta_cacheinfo *rta_ci;
20 struct rta_session *rta_sess;
21};
22 7
23struct dn_fib_res { 8struct dn_fib_res {
24 struct fib_rule *r; 9 struct fib_rule *r;
@@ -93,10 +78,10 @@ struct dn_fib_table {
93 u32 n; 78 u32 n;
94 79
95 int (*insert)(struct dn_fib_table *t, struct rtmsg *r, 80 int (*insert)(struct dn_fib_table *t, struct rtmsg *r,
96 struct dn_kern_rta *rta, struct nlmsghdr *n, 81 struct nlattr *attrs[], struct nlmsghdr *n,
97 struct netlink_skb_parms *req); 82 struct netlink_skb_parms *req);
98 int (*delete)(struct dn_fib_table *t, struct rtmsg *r, 83 int (*delete)(struct dn_fib_table *t, struct rtmsg *r,
99 struct dn_kern_rta *rta, struct nlmsghdr *n, 84 struct nlattr *attrs[], struct nlmsghdr *n,
100 struct netlink_skb_parms *req); 85 struct netlink_skb_parms *req);
101 int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld, 86 int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld,
102 struct dn_fib_res *res); 87 struct dn_fib_res *res);
@@ -116,13 +101,12 @@ extern void dn_fib_cleanup(void);
116extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, 101extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd,
117 unsigned long arg); 102 unsigned long arg);
118extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, 103extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
119 struct dn_kern_rta *rta, 104 struct nlattr *attrs[],
120 const struct nlmsghdr *nlh, int *errp); 105 const struct nlmsghdr *nlh, int *errp);
121extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 106extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
122 const struct flowidn *fld, 107 const struct flowidn *fld,
123 struct dn_fib_res *res); 108 struct dn_fib_res *res);
124extern void dn_fib_release_info(struct dn_fib_info *fi); 109extern void dn_fib_release_info(struct dn_fib_info *fi);
125extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
126extern void dn_fib_flush(void); 110extern void dn_fib_flush(void);
127extern void dn_fib_select_multipath(const struct flowidn *fld, 111extern void dn_fib_select_multipath(const struct flowidn *fld,
128 struct dn_fib_res *res); 112 struct dn_fib_res *res);
diff --git a/include/net/firewire.h b/include/net/firewire.h
new file mode 100644
index 000000000000..31bcbfe7a220
--- /dev/null
+++ b/include/net/firewire.h
@@ -0,0 +1,25 @@
1#ifndef _NET_FIREWIRE_H
2#define _NET_FIREWIRE_H
3
4/* Pseudo L2 address */
5#define FWNET_ALEN 16
6union fwnet_hwaddr {
7 u8 u[FWNET_ALEN];
8 /* "Hardware address" defined in RFC2734/RF3146 */
9 struct {
10 __be64 uniq_id; /* EUI-64 */
11 u8 max_rec; /* max packet size */
12 u8 sspd; /* max speed */
13 __be16 fifo_hi; /* hi 16bits of FIFO addr */
14 __be32 fifo_lo; /* lo 32bits of FIFO addr */
15 } __packed uc;
16};
17
18/* Pseudo L2 Header */
19#define FWNET_HLEN 18
20struct fwnet_header {
21 u8 h_dest[FWNET_ALEN]; /* destination address */
22 __be16 h_proto; /* packet type ID field */
23} __packed;
24
25#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index bdfbe68c1c3b..93024a47e0e2 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -50,6 +50,7 @@ struct genl_family {
50 unsigned int version; 50 unsigned int version;
51 unsigned int maxattr; 51 unsigned int maxattr;
52 bool netnsok; 52 bool netnsok;
53 bool parallel_ops;
53 int (*pre_doit)(struct genl_ops *ops, 54 int (*pre_doit)(struct genl_ops *ops,
54 struct sk_buff *skb, 55 struct sk_buff *skb,
55 struct genl_info *info); 56 struct genl_info *info);
diff --git a/include/net/gre.h b/include/net/gre.h
index 82665474bcb7..9f03a390c826 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -2,6 +2,7 @@
2#define __LINUX_GRE_H 2#define __LINUX_GRE_H
3 3
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5#include <net/ip_tunnels.h>
5 6
6#define GREPROTO_CISCO 0 7#define GREPROTO_CISCO 0
7#define GREPROTO_PPTP 1 8#define GREPROTO_PPTP 1
@@ -12,7 +13,57 @@ struct gre_protocol {
12 void (*err_handler)(struct sk_buff *skb, u32 info); 13 void (*err_handler)(struct sk_buff *skb, u32 info);
13}; 14};
14 15
16struct gre_base_hdr {
17 __be16 flags;
18 __be16 protocol;
19};
20#define GRE_HEADER_SECTION 4
21
15int gre_add_protocol(const struct gre_protocol *proto, u8 version); 22int gre_add_protocol(const struct gre_protocol *proto, u8 version);
16int gre_del_protocol(const struct gre_protocol *proto, u8 version); 23int gre_del_protocol(const struct gre_protocol *proto, u8 version);
17 24
25static inline __be16 gre_flags_to_tnl_flags(__be16 flags)
26{
27 __be16 tflags = 0;
28
29 if (flags & GRE_CSUM)
30 tflags |= TUNNEL_CSUM;
31 if (flags & GRE_ROUTING)
32 tflags |= TUNNEL_ROUTING;
33 if (flags & GRE_KEY)
34 tflags |= TUNNEL_KEY;
35 if (flags & GRE_SEQ)
36 tflags |= TUNNEL_SEQ;
37 if (flags & GRE_STRICT)
38 tflags |= TUNNEL_STRICT;
39 if (flags & GRE_REC)
40 tflags |= TUNNEL_REC;
41 if (flags & GRE_VERSION)
42 tflags |= TUNNEL_VERSION;
43
44 return tflags;
45}
46
47static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
48{
49 __be16 flags = 0;
50
51 if (tflags & TUNNEL_CSUM)
52 flags |= GRE_CSUM;
53 if (tflags & TUNNEL_ROUTING)
54 flags |= GRE_ROUTING;
55 if (tflags & TUNNEL_KEY)
56 flags |= GRE_KEY;
57 if (tflags & TUNNEL_SEQ)
58 flags |= GRE_SEQ;
59 if (tflags & TUNNEL_STRICT)
60 flags |= GRE_STRICT;
61 if (tflags & TUNNEL_REC)
62 flags |= GRE_REC;
63 if (tflags & TUNNEL_VERSION)
64 flags |= GRE_VERSION;
65
66 return flags;
67}
68
18#endif 69#endif
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index d104c882fc29..8196d5d40359 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -85,6 +85,8 @@ struct wpan_phy;
85 * Use wpan_wpy_put to put that reference. 85 * Use wpan_wpy_put to put that reference.
86 */ 86 */
87struct ieee802154_mlme_ops { 87struct ieee802154_mlme_ops {
88 /* The following fields are optional (can be NULL). */
89
88 int (*assoc_req)(struct net_device *dev, 90 int (*assoc_req)(struct net_device *dev,
89 struct ieee802154_addr *addr, 91 struct ieee802154_addr *addr,
90 u8 channel, u8 page, u8 cap); 92 u8 channel, u8 page, u8 cap);
@@ -101,6 +103,8 @@ struct ieee802154_mlme_ops {
101 int (*scan_req)(struct net_device *dev, 103 int (*scan_req)(struct net_device *dev,
102 u8 type, u32 channels, u8 page, u8 duration); 104 u8 type, u32 channels, u8 page, u8 duration);
103 105
106 /* The fields below are required. */
107
104 struct wpan_phy *(*get_phy)(const struct net_device *dev); 108 struct wpan_phy *(*get_phy)(const struct net_device *dev);
105 109
106 /* 110 /*
@@ -110,7 +114,6 @@ struct ieee802154_mlme_ops {
110 u16 (*get_pan_id)(const struct net_device *dev); 114 u16 (*get_pan_id)(const struct net_device *dev);
111 u16 (*get_short_addr)(const struct net_device *dev); 115 u16 (*get_short_addr)(const struct net_device *dev);
112 u8 (*get_dsn)(const struct net_device *dev); 116 u8 (*get_dsn)(const struct net_device *dev);
113 u8 (*get_bsn)(const struct net_device *dev);
114}; 117};
115 118
116/* The IEEE 802.15.4 standard defines 2 type of the devices: 119/* The IEEE 802.15.4 standard defines 2 type of the devices:
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 93563221d29a..100fb8cec17c 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -71,6 +71,8 @@ struct inet6_ifaddr {
71 struct inet6_ifaddr *ifpub; 71 struct inet6_ifaddr *ifpub;
72 int regen_count; 72 int regen_count;
73#endif 73#endif
74 bool tokenized;
75
74 struct rcu_head rcu; 76 struct rcu_head rcu;
75}; 77};
76 78
@@ -187,6 +189,8 @@ struct inet6_dev {
187 struct list_head tempaddr_list; 189 struct list_head tempaddr_list;
188#endif 190#endif
189 191
192 struct in6_addr token;
193
190 struct neigh_parms *nd_parms; 194 struct neigh_parms *nd_parms;
191 struct inet6_dev *next; 195 struct inet6_dev *next;
192 struct ipv6_devconf cnf; 196 struct ipv6_devconf cnf;
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 183292722f6e..de2c78529afa 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -133,6 +133,8 @@ struct inet_connection_sock {
133#define ICSK_TIME_RETRANS 1 /* Retransmit timer */ 133#define ICSK_TIME_RETRANS 1 /* Retransmit timer */
134#define ICSK_TIME_DACK 2 /* Delayed ack timer */ 134#define ICSK_TIME_DACK 2 /* Delayed ack timer */
135#define ICSK_TIME_PROBE0 3 /* Zero window probe timer */ 135#define ICSK_TIME_PROBE0 3 /* Zero window probe timer */
136#define ICSK_TIME_EARLY_RETRANS 4 /* Early retransmit timer */
137#define ICSK_TIME_LOSS_PROBE 5 /* Tail loss probe timer */
136 138
137static inline struct inet_connection_sock *inet_csk(const struct sock *sk) 139static inline struct inet_connection_sock *inet_csk(const struct sock *sk)
138{ 140{
@@ -222,7 +224,8 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
222 when = max_when; 224 when = max_when;
223 } 225 }
224 226
225 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) { 227 if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0 ||
228 what == ICSK_TIME_EARLY_RETRANS || what == ICSK_TIME_LOSS_PROBE) {
226 icsk->icsk_pending = what; 229 icsk->icsk_pending = what;
227 icsk->icsk_timeout = jiffies + when; 230 icsk->icsk_timeout = jiffies + when;
228 sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout); 231 sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout);
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 0a1dcc2fa2f5..bfcbc0017950 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -41,7 +41,7 @@ struct inet_frag_queue {
41 struct netns_frags *net; 41 struct netns_frags *net;
42}; 42};
43 43
44#define INETFRAGS_HASHSZ 64 44#define INETFRAGS_HASHSZ 1024
45 45
46/* averaged: 46/* averaged:
47 * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / 47 * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ /
@@ -50,10 +50,16 @@ struct inet_frag_queue {
50 */ 50 */
51#define INETFRAGS_MAXDEPTH 128 51#define INETFRAGS_MAXDEPTH 128
52 52
53struct inet_frag_bucket {
54 struct hlist_head chain;
55 spinlock_t chain_lock;
56};
57
53struct inet_frags { 58struct inet_frags {
54 struct hlist_head hash[INETFRAGS_HASHSZ]; 59 struct inet_frag_bucket hash[INETFRAGS_HASHSZ];
55 /* This rwlock is a global lock (seperate per IPv4, IPv6 and 60 /* This rwlock is a global lock (seperate per IPv4, IPv6 and
56 * netfilter). Important to keep this on a seperate cacheline. 61 * netfilter). Important to keep this on a seperate cacheline.
62 * Its primarily a rebuild protection rwlock.
57 */ 63 */
58 rwlock_t lock ____cacheline_aligned_in_smp; 64 rwlock_t lock ____cacheline_aligned_in_smp;
59 int secret_interval; 65 int secret_interval;
@@ -135,14 +141,16 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf)
135static inline void inet_frag_lru_move(struct inet_frag_queue *q) 141static inline void inet_frag_lru_move(struct inet_frag_queue *q)
136{ 142{
137 spin_lock(&q->net->lru_lock); 143 spin_lock(&q->net->lru_lock);
138 list_move_tail(&q->lru_list, &q->net->lru_list); 144 if (!list_empty(&q->lru_list))
145 list_move_tail(&q->lru_list, &q->net->lru_list);
139 spin_unlock(&q->net->lru_lock); 146 spin_unlock(&q->net->lru_lock);
140} 147}
141 148
142static inline void inet_frag_lru_del(struct inet_frag_queue *q) 149static inline void inet_frag_lru_del(struct inet_frag_queue *q)
143{ 150{
144 spin_lock(&q->net->lru_lock); 151 spin_lock(&q->net->lru_lock);
145 list_del(&q->lru_list); 152 list_del_init(&q->lru_list);
153 q->net->nqueues--;
146 spin_unlock(&q->net->lru_lock); 154 spin_unlock(&q->net->lru_lock);
147} 155}
148 156
@@ -151,6 +159,19 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
151{ 159{
152 spin_lock(&nf->lru_lock); 160 spin_lock(&nf->lru_lock);
153 list_add_tail(&q->lru_list, &nf->lru_list); 161 list_add_tail(&q->lru_list, &nf->lru_list);
162 q->net->nqueues++;
154 spin_unlock(&nf->lru_lock); 163 spin_unlock(&nf->lru_lock);
155} 164}
165
166/* RFC 3168 support :
167 * We want to check ECN values of all fragments, do detect invalid combinations.
168 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
169 */
170#define IPFRAG_ECN_NOT_ECT 0x01 /* one frag had ECN_NOT_ECT */
171#define IPFRAG_ECN_ECT_1 0x02 /* one frag had ECN_ECT_1 */
172#define IPFRAG_ECN_ECT_0 0x04 /* one frag had ECN_ECT_0 */
173#define IPFRAG_ECN_CE 0x08 /* one frag had ECN_CE */
174
175extern const u8 ip_frag_ecn_table[16];
176
156#endif 177#endif
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index e03047f7090b..4da5de10d1d4 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/ipv6.h> 4#include <linux/ipv6.h>
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/if_tunnel.h>
6#include <linux/ip6_tunnel.h> 7#include <linux/ip6_tunnel.h>
7 8
8#define IP6TUNNEL_ERR_TIMEO (30*HZ) 9#define IP6TUNNEL_ERR_TIMEO (30*HZ)
@@ -68,4 +69,24 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
68__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, 69__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
69 const struct in6_addr *raddr); 70 const struct in6_addr *raddr);
70 71
72static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
73{
74 struct net_device_stats *stats = &dev->stats;
75 int pkt_len, err;
76
77 nf_reset(skb);
78 pkt_len = skb->len;
79 err = ip6_local_out(skb);
80
81 if (net_xmit_eval(err) == 0) {
82 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
83 u64_stats_update_begin(&tstats->syncp);
84 tstats->tx_bytes += pkt_len;
85 tstats->tx_packets++;
86 u64_stats_update_end(&tstats->syncp);
87 } else {
88 stats->tx_errors++;
89 stats->tx_aborted_errors++;
90 }
91}
71#endif 92#endif
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
new file mode 100644
index 000000000000..4b6f0b28f41f
--- /dev/null
+++ b/include/net/ip_tunnels.h
@@ -0,0 +1,177 @@
1#ifndef __NET_IP_TUNNELS_H
2#define __NET_IP_TUNNELS_H 1
3
4#include <linux/if_tunnel.h>
5#include <linux/netdevice.h>
6#include <linux/skbuff.h>
7#include <linux/types.h>
8#include <linux/u64_stats_sync.h>
9#include <net/dsfield.h>
10#include <net/gro_cells.h>
11#include <net/inet_ecn.h>
12#include <net/ip.h>
13#include <net/rtnetlink.h>
14
15#if IS_ENABLED(CONFIG_IPV6)
16#include <net/ipv6.h>
17#include <net/ip6_fib.h>
18#include <net/ip6_route.h>
19#endif
20
21/* Keep error state on tunnel for 30 sec */
22#define IPTUNNEL_ERR_TIMEO (30*HZ)
23
24/* 6rd prefix/relay information */
25#ifdef CONFIG_IPV6_SIT_6RD
26struct ip_tunnel_6rd_parm {
27 struct in6_addr prefix;
28 __be32 relay_prefix;
29 u16 prefixlen;
30 u16 relay_prefixlen;
31};
32#endif
33
34struct ip_tunnel_prl_entry {
35 struct ip_tunnel_prl_entry __rcu *next;
36 __be32 addr;
37 u16 flags;
38 struct rcu_head rcu_head;
39};
40
41struct ip_tunnel {
42 struct ip_tunnel __rcu *next;
43 struct hlist_node hash_node;
44 struct net_device *dev;
45
46 int err_count; /* Number of arrived ICMP errors */
47 unsigned long err_time; /* Time when the last ICMP error
48 * arrived */
49
50 /* These four fields used only by GRE */
51 __u32 i_seqno; /* The last seen seqno */
52 __u32 o_seqno; /* The last output seqno */
53 int hlen; /* Precalculated header length */
54 int mlink;
55
56 struct ip_tunnel_parm parms;
57
58 /* for SIT */
59#ifdef CONFIG_IPV6_SIT_6RD
60 struct ip_tunnel_6rd_parm ip6rd;
61#endif
62 struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
63 unsigned int prl_count; /* # of entries in PRL */
64 int ip_tnl_net_id;
65 struct gro_cells gro_cells;
66};
67
68#define TUNNEL_CSUM __cpu_to_be16(0x01)
69#define TUNNEL_ROUTING __cpu_to_be16(0x02)
70#define TUNNEL_KEY __cpu_to_be16(0x04)
71#define TUNNEL_SEQ __cpu_to_be16(0x08)
72#define TUNNEL_STRICT __cpu_to_be16(0x10)
73#define TUNNEL_REC __cpu_to_be16(0x20)
74#define TUNNEL_VERSION __cpu_to_be16(0x40)
75#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
76
77struct tnl_ptk_info {
78 __be16 flags;
79 __be16 proto;
80 __be32 key;
81 __be32 seq;
82};
83
84#define PACKET_RCVD 0
85#define PACKET_REJECT 1
86
87#define IP_TNL_HASH_BITS 10
88#define IP_TNL_HASH_SIZE (1 << IP_TNL_HASH_BITS)
89
90struct ip_tunnel_net {
91 struct hlist_head *tunnels;
92 struct net_device *fb_tunnel_dev;
93};
94
95int ip_tunnel_init(struct net_device *dev);
96void ip_tunnel_uninit(struct net_device *dev);
97void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
98int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
99 struct rtnl_link_ops *ops, char *devname);
100
101void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102
103void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104 const struct iphdr *tnl_params);
105int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
106int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
107
108struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
109 struct rtnl_link_stats64 *tot);
110struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
111 int link, __be16 flags,
112 __be32 remote, __be32 local,
113 __be32 key);
114
115int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
116 const struct tnl_ptk_info *tpi, bool log_ecn_error);
117int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
118 struct ip_tunnel_parm *p);
119int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
120 struct ip_tunnel_parm *p);
121void ip_tunnel_setup(struct net_device *dev, int net_id);
122
123/* Extract dsfield from inner protocol */
124static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
125 const struct sk_buff *skb)
126{
127 if (skb->protocol == htons(ETH_P_IP))
128 return iph->tos;
129 else if (skb->protocol == htons(ETH_P_IPV6))
130 return ipv6_get_dsfield((const struct ipv6hdr *)iph);
131 else
132 return 0;
133}
134
135/* Propogate ECN bits out */
136static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
137 const struct sk_buff *skb)
138{
139 u8 inner = ip_tunnel_get_dsfield(iph, skb);
140
141 return INET_ECN_encapsulate(tos, inner);
142}
143
144static inline void tunnel_ip_select_ident(struct sk_buff *skb,
145 const struct iphdr *old_iph,
146 struct dst_entry *dst)
147{
148 struct iphdr *iph = ip_hdr(skb);
149
150 /* Use inner packet iph-id if possible. */
151 if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
152 iph->id = old_iph->id;
153 else
154 __ip_select_ident(iph, dst,
155 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
156}
157
158static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
159{
160 int err;
161 int pkt_len = skb->len - skb_transport_offset(skb);
162 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
163
164 nf_reset(skb);
165
166 err = ip_local_out(skb);
167 if (likely(net_xmit_eval(err) == 0)) {
168 u64_stats_update_begin(&tstats->syncp);
169 tstats->tx_bytes += pkt_len;
170 tstats->tx_packets++;
171 u64_stats_update_end(&tstats->syncp);
172 } else {
173 dev->stats.tx_errors++;
174 dev->stats.tx_aborted_errors++;
175 }
176}
177#endif /* __NET_IP_TUNNELS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index fce8e6b66d55..4c062ccff9aa 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -233,6 +233,21 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
233 dst->ip = src->ip; 233 dst->ip = src->ip;
234} 234}
235 235
236static inline void ip_vs_addr_set(int af, union nf_inet_addr *dst,
237 const union nf_inet_addr *src)
238{
239#ifdef CONFIG_IP_VS_IPV6
240 if (af == AF_INET6) {
241 dst->in6 = src->in6;
242 return;
243 }
244#endif
245 dst->ip = src->ip;
246 dst->all[1] = 0;
247 dst->all[2] = 0;
248 dst->all[3] = 0;
249}
250
236static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, 251static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
237 const union nf_inet_addr *b) 252 const union nf_inet_addr *b)
238{ 253{
@@ -344,8 +359,6 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
344#define LeaveFunction(level) do {} while (0) 359#define LeaveFunction(level) do {} while (0)
345#endif 360#endif
346 361
347#define IP_VS_WAIT_WHILE(expr) while (expr) { cpu_relax(); }
348
349 362
350/* 363/*
351 * The port number of FTP service (in network order). 364 * The port number of FTP service (in network order).
@@ -459,7 +472,7 @@ struct ip_vs_estimator {
459struct ip_vs_stats { 472struct ip_vs_stats {
460 struct ip_vs_stats_user ustats; /* statistics */ 473 struct ip_vs_stats_user ustats; /* statistics */
461 struct ip_vs_estimator est; /* estimator */ 474 struct ip_vs_estimator est; /* estimator */
462 struct ip_vs_cpu_stats *cpustats; /* per cpu counters */ 475 struct ip_vs_cpu_stats __percpu *cpustats; /* per cpu counters */
463 spinlock_t lock; /* spin lock */ 476 spinlock_t lock; /* spin lock */
464 struct ip_vs_stats_user ustats0; /* reset values */ 477 struct ip_vs_stats_user ustats0; /* reset values */
465}; 478};
@@ -566,20 +579,19 @@ struct ip_vs_conn_param {
566 */ 579 */
567struct ip_vs_conn { 580struct ip_vs_conn {
568 struct hlist_node c_list; /* hashed list heads */ 581 struct hlist_node c_list; /* hashed list heads */
569#ifdef CONFIG_NET_NS
570 struct net *net; /* Name space */
571#endif
572 /* Protocol, addresses and port numbers */ 582 /* Protocol, addresses and port numbers */
573 u16 af; /* address family */
574 __be16 cport; 583 __be16 cport;
575 __be16 vport;
576 __be16 dport; 584 __be16 dport;
577 __u32 fwmark; /* Fire wall mark from skb */ 585 __be16 vport;
586 u16 af; /* address family */
578 union nf_inet_addr caddr; /* client address */ 587 union nf_inet_addr caddr; /* client address */
579 union nf_inet_addr vaddr; /* virtual address */ 588 union nf_inet_addr vaddr; /* virtual address */
580 union nf_inet_addr daddr; /* destination address */ 589 union nf_inet_addr daddr; /* destination address */
581 volatile __u32 flags; /* status flags */ 590 volatile __u32 flags; /* status flags */
582 __u16 protocol; /* Which protocol (TCP/UDP) */ 591 __u16 protocol; /* Which protocol (TCP/UDP) */
592#ifdef CONFIG_NET_NS
593 struct net *net; /* Name space */
594#endif
583 595
584 /* counter and timer */ 596 /* counter and timer */
585 atomic_t refcnt; /* reference count */ 597 atomic_t refcnt; /* reference count */
@@ -593,6 +605,7 @@ struct ip_vs_conn {
593 * state transition triggerd 605 * state transition triggerd
594 * synchronization 606 * synchronization
595 */ 607 */
608 __u32 fwmark; /* Fire wall mark from skb */
596 unsigned long sync_endtime; /* jiffies + sent_retries */ 609 unsigned long sync_endtime; /* jiffies + sent_retries */
597 610
598 /* Control members */ 611 /* Control members */
@@ -620,6 +633,8 @@ struct ip_vs_conn {
620 const struct ip_vs_pe *pe; 633 const struct ip_vs_pe *pe;
621 char *pe_data; 634 char *pe_data;
622 __u8 pe_data_len; 635 __u8 pe_data_len;
636
637 struct rcu_head rcu_head;
623}; 638};
624 639
625/* 640/*
@@ -663,7 +678,7 @@ struct ip_vs_service_user_kern {
663 u16 af; 678 u16 af;
664 u16 protocol; 679 u16 protocol;
665 union nf_inet_addr addr; /* virtual ip address */ 680 union nf_inet_addr addr; /* virtual ip address */
666 u16 port; 681 __be16 port;
667 u32 fwmark; /* firwall mark of service */ 682 u32 fwmark; /* firwall mark of service */
668 683
669 /* virtual service options */ 684 /* virtual service options */
@@ -671,14 +686,14 @@ struct ip_vs_service_user_kern {
671 char *pe_name; 686 char *pe_name;
672 unsigned int flags; /* virtual service flags */ 687 unsigned int flags; /* virtual service flags */
673 unsigned int timeout; /* persistent timeout in sec */ 688 unsigned int timeout; /* persistent timeout in sec */
674 u32 netmask; /* persistent netmask */ 689 __be32 netmask; /* persistent netmask or plen */
675}; 690};
676 691
677 692
678struct ip_vs_dest_user_kern { 693struct ip_vs_dest_user_kern {
679 /* destination server address */ 694 /* destination server address */
680 union nf_inet_addr addr; 695 union nf_inet_addr addr;
681 u16 port; 696 __be16 port;
682 697
683 /* real server options */ 698 /* real server options */
684 unsigned int conn_flags; /* connection flags */ 699 unsigned int conn_flags; /* connection flags */
@@ -695,10 +710,9 @@ struct ip_vs_dest_user_kern {
695 * and the forwarding entries 710 * and the forwarding entries
696 */ 711 */
697struct ip_vs_service { 712struct ip_vs_service {
698 struct list_head s_list; /* for normal service table */ 713 struct hlist_node s_list; /* for normal service table */
699 struct list_head f_list; /* for fwmark-based service table */ 714 struct hlist_node f_list; /* for fwmark-based service table */
700 atomic_t refcnt; /* reference counter */ 715 atomic_t refcnt; /* reference counter */
701 atomic_t usecnt; /* use counter */
702 716
703 u16 af; /* address family */ 717 u16 af; /* address family */
704 __u16 protocol; /* which protocol (TCP/UDP) */ 718 __u16 protocol; /* which protocol (TCP/UDP) */
@@ -707,31 +721,41 @@ struct ip_vs_service {
707 __u32 fwmark; /* firewall mark of the service */ 721 __u32 fwmark; /* firewall mark of the service */
708 unsigned int flags; /* service status flags */ 722 unsigned int flags; /* service status flags */
709 unsigned int timeout; /* persistent timeout in ticks */ 723 unsigned int timeout; /* persistent timeout in ticks */
710 __be32 netmask; /* grouping granularity */ 724 __be32 netmask; /* grouping granularity, mask/plen */
711 struct net *net; 725 struct net *net;
712 726
713 struct list_head destinations; /* real server d-linked list */ 727 struct list_head destinations; /* real server d-linked list */
714 __u32 num_dests; /* number of servers */ 728 __u32 num_dests; /* number of servers */
715 struct ip_vs_stats stats; /* statistics for the service */ 729 struct ip_vs_stats stats; /* statistics for the service */
716 struct ip_vs_app *inc; /* bind conns to this app inc */
717 730
718 /* for scheduling */ 731 /* for scheduling */
719 struct ip_vs_scheduler *scheduler; /* bound scheduler object */ 732 struct ip_vs_scheduler __rcu *scheduler; /* bound scheduler object */
720 rwlock_t sched_lock; /* lock sched_data */ 733 spinlock_t sched_lock; /* lock sched_data */
721 void *sched_data; /* scheduler application data */ 734 void *sched_data; /* scheduler application data */
722 735
723 /* alternate persistence engine */ 736 /* alternate persistence engine */
724 struct ip_vs_pe *pe; 737 struct ip_vs_pe __rcu *pe;
738
739 struct rcu_head rcu_head;
725}; 740};
726 741
742/* Information for cached dst */
743struct ip_vs_dest_dst {
744 struct dst_entry *dst_cache; /* destination cache entry */
745 u32 dst_cookie;
746 union nf_inet_addr dst_saddr;
747 struct rcu_head rcu_head;
748};
727 749
750/* In grace period after removing */
751#define IP_VS_DEST_STATE_REMOVING 0x01
728/* 752/*
729 * The real server destination forwarding entry 753 * The real server destination forwarding entry
730 * with ip address, port number, and so on. 754 * with ip address, port number, and so on.
731 */ 755 */
732struct ip_vs_dest { 756struct ip_vs_dest {
733 struct list_head n_list; /* for the dests in the service */ 757 struct list_head n_list; /* for the dests in the service */
734 struct list_head d_list; /* for table with all the dests */ 758 struct hlist_node d_list; /* for table with all the dests */
735 759
736 u16 af; /* address family */ 760 u16 af; /* address family */
737 __be16 port; /* port number of the server */ 761 __be16 port; /* port number of the server */
@@ -742,6 +766,7 @@ struct ip_vs_dest {
742 766
743 atomic_t refcnt; /* reference counter */ 767 atomic_t refcnt; /* reference counter */
744 struct ip_vs_stats stats; /* statistics */ 768 struct ip_vs_stats stats; /* statistics */
769 unsigned long state; /* state flags */
745 770
746 /* connection counters and thresholds */ 771 /* connection counters and thresholds */
747 atomic_t activeconns; /* active connections */ 772 atomic_t activeconns; /* active connections */
@@ -752,10 +777,7 @@ struct ip_vs_dest {
752 777
753 /* for destination cache */ 778 /* for destination cache */
754 spinlock_t dst_lock; /* lock of dst_cache */ 779 spinlock_t dst_lock; /* lock of dst_cache */
755 struct dst_entry *dst_cache; /* destination cache entry */ 780 struct ip_vs_dest_dst __rcu *dest_dst; /* cached dst info */
756 u32 dst_rtos; /* RT_TOS(tos) for dst */
757 u32 dst_cookie;
758 union nf_inet_addr dst_saddr;
759 781
760 /* for virtual service */ 782 /* for virtual service */
761 struct ip_vs_service *svc; /* service it belongs to */ 783 struct ip_vs_service *svc; /* service it belongs to */
@@ -763,6 +785,10 @@ struct ip_vs_dest {
763 __be16 vport; /* virtual port number */ 785 __be16 vport; /* virtual port number */
764 union nf_inet_addr vaddr; /* virtual IP address */ 786 union nf_inet_addr vaddr; /* virtual IP address */
765 __u32 vfwmark; /* firewall mark of service */ 787 __u32 vfwmark; /* firewall mark of service */
788
789 struct list_head t_list; /* in dest_trash */
790 struct rcu_head rcu_head;
791 unsigned int in_rs_table:1; /* we are in rs_table */
766}; 792};
767 793
768 794
@@ -778,9 +804,13 @@ struct ip_vs_scheduler {
778 /* scheduler initializing service */ 804 /* scheduler initializing service */
779 int (*init_service)(struct ip_vs_service *svc); 805 int (*init_service)(struct ip_vs_service *svc);
780 /* scheduling service finish */ 806 /* scheduling service finish */
781 int (*done_service)(struct ip_vs_service *svc); 807 void (*done_service)(struct ip_vs_service *svc);
782 /* scheduler updating service */ 808 /* dest is linked */
783 int (*update_service)(struct ip_vs_service *svc); 809 int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
810 /* dest is unlinked */
811 int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
812 /* dest is updated */
813 int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
784 814
785 /* selecting a server from the given service */ 815 /* selecting a server from the given service */
786 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, 816 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc,
@@ -819,6 +849,7 @@ struct ip_vs_app {
819 struct ip_vs_app *app; /* its real application */ 849 struct ip_vs_app *app; /* its real application */
820 __be16 port; /* port number in net order */ 850 __be16 port; /* port number in net order */
821 atomic_t usecnt; /* usage counter */ 851 atomic_t usecnt; /* usage counter */
852 struct rcu_head rcu_head;
822 853
823 /* 854 /*
824 * output hook: Process packet in inout direction, diff set for TCP. 855 * output hook: Process packet in inout direction, diff set for TCP.
@@ -881,6 +912,9 @@ struct ipvs_master_sync_state {
881 struct netns_ipvs *ipvs; 912 struct netns_ipvs *ipvs;
882}; 913};
883 914
915/* How much time to keep dests in trash */
916#define IP_VS_DEST_TRASH_PERIOD (120 * HZ)
917
884/* IPVS in network namespace */ 918/* IPVS in network namespace */
885struct netns_ipvs { 919struct netns_ipvs {
886 int gen; /* Generation */ 920 int gen; /* Generation */
@@ -892,7 +926,7 @@ struct netns_ipvs {
892 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) 926 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
893 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) 927 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
894 928
895 struct list_head rs_table[IP_VS_RTAB_SIZE]; 929 struct hlist_head rs_table[IP_VS_RTAB_SIZE];
896 /* ip_vs_app */ 930 /* ip_vs_app */
897 struct list_head app_list; 931 struct list_head app_list;
898 /* ip_vs_proto */ 932 /* ip_vs_proto */
@@ -904,7 +938,6 @@ struct netns_ipvs {
904 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS) 938 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
905 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1) 939 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
906 struct list_head tcp_apps[TCP_APP_TAB_SIZE]; 940 struct list_head tcp_apps[TCP_APP_TAB_SIZE];
907 spinlock_t tcp_app_lock;
908#endif 941#endif
909 /* ip_vs_proto_udp */ 942 /* ip_vs_proto_udp */
910#ifdef CONFIG_IP_VS_PROTO_UDP 943#ifdef CONFIG_IP_VS_PROTO_UDP
@@ -912,7 +945,6 @@ struct netns_ipvs {
912 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS) 945 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
913 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1) 946 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
914 struct list_head udp_apps[UDP_APP_TAB_SIZE]; 947 struct list_head udp_apps[UDP_APP_TAB_SIZE];
915 spinlock_t udp_app_lock;
916#endif 948#endif
917 /* ip_vs_proto_sctp */ 949 /* ip_vs_proto_sctp */
918#ifdef CONFIG_IP_VS_PROTO_SCTP 950#ifdef CONFIG_IP_VS_PROTO_SCTP
@@ -921,7 +953,6 @@ struct netns_ipvs {
921 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1) 953 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
922 /* Hash table for SCTP application incarnations */ 954 /* Hash table for SCTP application incarnations */
923 struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; 955 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
924 spinlock_t sctp_app_lock;
925#endif 956#endif
926 /* ip_vs_conn */ 957 /* ip_vs_conn */
927 atomic_t conn_count; /* connection counter */ 958 atomic_t conn_count; /* connection counter */
@@ -931,9 +962,10 @@ struct netns_ipvs {
931 962
932 int num_services; /* no of virtual services */ 963 int num_services; /* no of virtual services */
933 964
934 rwlock_t rs_lock; /* real services table */
935 /* Trash for destinations */ 965 /* Trash for destinations */
936 struct list_head dest_trash; 966 struct list_head dest_trash;
967 spinlock_t dest_trash_lock;
968 struct timer_list dest_trash_timer; /* expiration timer */
937 /* Service counters */ 969 /* Service counters */
938 atomic_t ftpsvc_counter; 970 atomic_t ftpsvc_counter;
939 atomic_t nullsvc_counter; 971 atomic_t nullsvc_counter;
@@ -1181,9 +1213,19 @@ struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
1181 const struct ip_vs_iphdr *iph, 1213 const struct ip_vs_iphdr *iph,
1182 int inverse); 1214 int inverse);
1183 1215
1216/* Get reference to gain full access to conn.
1217 * By default, RCU read-side critical sections have access only to
1218 * conn fields and its PE data, see ip_vs_conn_rcu_free() for reference.
1219 */
1220static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp)
1221{
1222 return atomic_inc_not_zero(&cp->refcnt);
1223}
1224
1184/* put back the conn without restarting its timer */ 1225/* put back the conn without restarting its timer */
1185static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 1226static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1186{ 1227{
1228 smp_mb__before_atomic_dec();
1187 atomic_dec(&cp->refcnt); 1229 atomic_dec(&cp->refcnt);
1188} 1230}
1189extern void ip_vs_conn_put(struct ip_vs_conn *cp); 1231extern void ip_vs_conn_put(struct ip_vs_conn *cp);
@@ -1298,8 +1340,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
1298extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1340extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1299extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); 1341extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1300 1342
1301void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe);
1302void ip_vs_unbind_pe(struct ip_vs_service *svc);
1303int register_ip_vs_pe(struct ip_vs_pe *pe); 1343int register_ip_vs_pe(struct ip_vs_pe *pe);
1304int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1344int unregister_ip_vs_pe(struct ip_vs_pe *pe);
1305struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); 1345struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
@@ -1346,7 +1386,8 @@ extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1346extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1386extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1347extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, 1387extern int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1348 struct ip_vs_scheduler *scheduler); 1388 struct ip_vs_scheduler *scheduler);
1349extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); 1389extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc,
1390 struct ip_vs_scheduler *sched);
1350extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); 1391extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1351extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1392extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1352extern struct ip_vs_conn * 1393extern struct ip_vs_conn *
@@ -1366,17 +1407,12 @@ extern struct ip_vs_stats ip_vs_stats;
1366extern int sysctl_ip_vs_sync_ver; 1407extern int sysctl_ip_vs_sync_ver;
1367 1408
1368extern struct ip_vs_service * 1409extern struct ip_vs_service *
1369ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, 1410ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol,
1370 const union nf_inet_addr *vaddr, __be16 vport); 1411 const union nf_inet_addr *vaddr, __be16 vport);
1371 1412
1372static inline void ip_vs_service_put(struct ip_vs_service *svc) 1413extern bool
1373{ 1414ip_vs_has_real_service(struct net *net, int af, __u16 protocol,
1374 atomic_dec(&svc->usecnt); 1415 const union nf_inet_addr *daddr, __be16 dport);
1375}
1376
1377extern struct ip_vs_dest *
1378ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
1379 const union nf_inet_addr *daddr, __be16 dport);
1380 1416
1381extern int ip_vs_use_count_inc(void); 1417extern int ip_vs_use_count_inc(void);
1382extern void ip_vs_use_count_dec(void); 1418extern void ip_vs_use_count_dec(void);
@@ -1388,8 +1424,18 @@ extern struct ip_vs_dest *
1388ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1424ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
1389 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1425 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1390 __u16 protocol, __u32 fwmark, __u32 flags); 1426 __u16 protocol, __u32 fwmark, __u32 flags);
1391extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1427extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1392 1428
1429static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1430{
1431 atomic_inc(&dest->refcnt);
1432}
1433
1434static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1435{
1436 smp_mb__before_atomic_dec();
1437 atomic_dec(&dest->refcnt);
1438}
1393 1439
1394/* 1440/*
1395 * IPVS sync daemon data and function prototypes 1441 * IPVS sync daemon data and function prototypes
@@ -1428,7 +1474,7 @@ extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1428extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1474extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1429 struct ip_vs_protocol *pp, int offset, 1475 struct ip_vs_protocol *pp, int offset,
1430 unsigned int hooknum, struct ip_vs_iphdr *iph); 1476 unsigned int hooknum, struct ip_vs_iphdr *iph);
1431extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 1477extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1432 1478
1433#ifdef CONFIG_IP_VS_IPV6 1479#ifdef CONFIG_IP_VS_IPV6
1434extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1480extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
diff --git a/include/net/ipip.h b/include/net/ipip.h
deleted file mode 100644
index 982141c15200..000000000000
--- a/include/net/ipip.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef __NET_IPIP_H
2#define __NET_IPIP_H 1
3
4#include <linux/if_tunnel.h>
5#include <net/gro_cells.h>
6#include <net/ip.h>
7
8/* Keep error state on tunnel for 30 sec */
9#define IPTUNNEL_ERR_TIMEO (30*HZ)
10
11/* 6rd prefix/relay information */
12struct ip_tunnel_6rd_parm {
13 struct in6_addr prefix;
14 __be32 relay_prefix;
15 u16 prefixlen;
16 u16 relay_prefixlen;
17};
18
19struct ip_tunnel {
20 struct ip_tunnel __rcu *next;
21 struct net_device *dev;
22
23 int err_count; /* Number of arrived ICMP errors */
24 unsigned long err_time; /* Time when the last ICMP error arrived */
25
26 /* These four fields used only by GRE */
27 __u32 i_seqno; /* The last seen seqno */
28 __u32 o_seqno; /* The last output seqno */
29 int hlen; /* Precalculated GRE header length */
30 int mlink;
31
32 struct ip_tunnel_parm parms;
33
34 /* for SIT */
35#ifdef CONFIG_IPV6_SIT_6RD
36 struct ip_tunnel_6rd_parm ip6rd;
37#endif
38 struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
39 unsigned int prl_count; /* # of entries in PRL */
40
41 struct gro_cells gro_cells;
42};
43
44struct ip_tunnel_prl_entry {
45 struct ip_tunnel_prl_entry __rcu *next;
46 __be32 addr;
47 u16 flags;
48 struct rcu_head rcu_head;
49};
50
51static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
52{
53 int err;
54 struct iphdr *iph = ip_hdr(skb);
55 int pkt_len = skb->len - skb_transport_offset(skb);
56 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
57
58 nf_reset(skb);
59 skb->ip_summed = CHECKSUM_NONE;
60 ip_select_ident(iph, skb_dst(skb), NULL);
61
62 err = ip_local_out(skb);
63 if (likely(net_xmit_eval(err) == 0)) {
64 u64_stats_update_begin(&tstats->syncp);
65 tstats->tx_bytes += pkt_len;
66 tstats->tx_packets++;
67 u64_stats_update_end(&tstats->syncp);
68 } else {
69 dev->stats.tx_errors++;
70 dev->stats.tx_aborted_errors++;
71 }
72}
73
74static inline void tunnel_ip_select_ident(struct sk_buff *skb,
75 const struct iphdr *old_iph,
76 struct dst_entry *dst)
77{
78 struct iphdr *iph = ip_hdr(skb);
79
80 /* Use inner packet iph-id if possible. */
81 if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
82 iph->id = old_iph->id;
83 else
84 __ip_select_ident(iph, dst,
85 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
86}
87#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 64d12e77719a..0810aa57c780 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -217,7 +217,7 @@ struct ipv6_txoptions {
217}; 217};
218 218
219struct ip6_flowlabel { 219struct ip6_flowlabel {
220 struct ip6_flowlabel *next; 220 struct ip6_flowlabel __rcu *next;
221 __be32 label; 221 __be32 label;
222 atomic_t users; 222 atomic_t users;
223 struct in6_addr dst; 223 struct in6_addr dst;
@@ -238,9 +238,9 @@ struct ip6_flowlabel {
238#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) 238#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
239 239
240struct ipv6_fl_socklist { 240struct ipv6_fl_socklist {
241 struct ipv6_fl_socklist *next; 241 struct ipv6_fl_socklist __rcu *next;
242 struct ip6_flowlabel *fl; 242 struct ip6_flowlabel *fl;
243 struct rcu_head rcu; 243 struct rcu_head rcu;
244}; 244};
245 245
246extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 246extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
@@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr)
320 return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); 320 return __ipv6_addr_src_scope(__ipv6_addr_type(addr));
321} 321}
322 322
323static inline bool __ipv6_addr_needs_scope_id(int type)
324{
325 return type & IPV6_ADDR_LINKLOCAL ||
326 (type & IPV6_ADDR_MULTICAST &&
327 (type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)));
328}
329
330static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface)
331{
332 return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0;
333}
334
323static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) 335static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
324{ 336{
325 return memcmp(a1, a2, sizeof(struct in6_addr)); 337 return memcmp(a1, a2, sizeof(struct in6_addr));
@@ -466,6 +478,7 @@ struct ip6_create_arg {
466 u32 user; 478 u32 user;
467 const struct in6_addr *src; 479 const struct in6_addr *src;
468 const struct in6_addr *dst; 480 const struct in6_addr *dst;
481 u8 ecn;
469}; 482};
470 483
471void ip6_frag_init(struct inet_frag_queue *q, void *a); 484void ip6_frag_init(struct inet_frag_queue *q, void *a);
@@ -485,6 +498,7 @@ struct frag_queue {
485 int iif; 498 int iif;
486 unsigned int csum; 499 unsigned int csum;
487 __u16 nhoffset; 500 __u16 nhoffset;
501 u8 ecn;
488}; 502};
489 503
490void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, 504void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index d178c26a5558..be95b9262801 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -30,6 +30,8 @@
30#include <linux/skbuff.h> 30#include <linux/skbuff.h>
31#include <linux/ieee80211.h> 31#include <linux/ieee80211.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/seq_file.h>
34
33/* print_ssid() is intended to be used in debug (and possibly error) 35/* print_ssid() is intended to be used in debug (and possibly error)
34 * messages. It should never be used for passing ssid to user space. */ 36 * messages. It should never be used for passing ssid to user space. */
35const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); 37const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
@@ -75,7 +77,7 @@ struct lib80211_crypto_ops {
75 77
76 /* procfs handler for printing out key information and possible 78 /* procfs handler for printing out key information and possible
77 * statistics */ 79 * statistics */
78 char *(*print_stats) (char *p, void *priv); 80 void (*print_stats) (struct seq_file *m, void *priv);
79 81
80 /* Crypto specific flag get/set for configuration settings */ 82 /* Crypto specific flag get/set for configuration settings */
81 unsigned long (*get_flags) (void *priv); 83 unsigned long (*get_flags) (void *priv);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f7eba1300d82..885898a40d13 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -93,9 +93,11 @@ struct device;
93 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
94 * 94 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set
96 */ 97 */
97enum ieee80211_max_queues { 98enum ieee80211_max_queues {
98 IEEE80211_MAX_QUEUES = 16, 99 IEEE80211_MAX_QUEUES = 16,
100 IEEE80211_MAX_QUEUE_MAP = BIT(IEEE80211_MAX_QUEUES) - 1,
99}; 101};
100 102
101#define IEEE80211_INVAL_HW_QUEUE 0xff 103#define IEEE80211_INVAL_HW_QUEUE 0xff
@@ -126,6 +128,7 @@ enum ieee80211_ac_numbers {
126 * 2^n-1 in the range 1..32767] 128 * 2^n-1 in the range 1..32767]
127 * @cw_max: maximum contention window [like @cw_min] 129 * @cw_max: maximum contention window [like @cw_min]
128 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled 130 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
131 * @acm: is mandatory admission control required for the access category
129 * @uapsd: is U-APSD mode enabled for the queue 132 * @uapsd: is U-APSD mode enabled for the queue
130 */ 133 */
131struct ieee80211_tx_queue_params { 134struct ieee80211_tx_queue_params {
@@ -133,6 +136,7 @@ struct ieee80211_tx_queue_params {
133 u16 cw_min; 136 u16 cw_min;
134 u16 cw_max; 137 u16 cw_max;
135 u8 aifs; 138 u8 aifs;
139 bool acm;
136 bool uapsd; 140 bool uapsd;
137}; 141};
138 142
@@ -207,7 +211,7 @@ struct ieee80211_chanctx_conf {
207 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note 211 * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
208 * that it is only ever disabled for station mode. 212 * that it is only ever disabled for station mode.
209 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. 213 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
210 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 214 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
211 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) 215 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
212 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) 216 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
213 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface 217 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
@@ -324,12 +328,11 @@ enum ieee80211_rssi_event {
324 * your driver/device needs to do. 328 * your driver/device needs to do.
325 * @ps: power-save mode (STA only). This flag is NOT affected by 329 * @ps: power-save mode (STA only). This flag is NOT affected by
326 * offchannel/dynamic_ps operations. 330 * offchannel/dynamic_ps operations.
327 * @ssid: The SSID of the current vif. Only valid in AP-mode. 331 * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
328 * @ssid_len: Length of SSID given in @ssid. 332 * @ssid_len: Length of SSID given in @ssid.
329 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. 333 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
330 * @txpower: TX power in dBm 334 * @txpower: TX power in dBm
331 * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces 335 * @p2p_noa_attr: P2P NoA attribute for P2P powersave
332 * @p2p_oppps: P2P opportunistic PS is enabled
333 */ 336 */
334struct ieee80211_bss_conf { 337struct ieee80211_bss_conf {
335 const u8 *bssid; 338 const u8 *bssid;
@@ -363,8 +366,7 @@ struct ieee80211_bss_conf {
363 size_t ssid_len; 366 size_t ssid_len;
364 bool hidden_ssid; 367 bool hidden_ssid;
365 int txpower; 368 int txpower;
366 u8 p2p_ctwindow; 369 struct ieee80211_p2p_noa_attr p2p_noa_attr;
367 bool p2p_oppps;
368}; 370};
369 371
370/** 372/**
@@ -561,6 +563,9 @@ enum mac80211_rate_control_flags {
561/* maximum number of rate stages */ 563/* maximum number of rate stages */
562#define IEEE80211_TX_MAX_RATES 4 564#define IEEE80211_TX_MAX_RATES 4
563 565
566/* maximum number of rate table entries */
567#define IEEE80211_TX_RATE_TABLE_SIZE 4
568
564/** 569/**
565 * struct ieee80211_tx_rate - rate selection/status 570 * struct ieee80211_tx_rate - rate selection/status
566 * 571 *
@@ -601,8 +606,8 @@ static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
601 u8 mcs, u8 nss) 606 u8 mcs, u8 nss)
602{ 607{
603 WARN_ON(mcs & ~0xF); 608 WARN_ON(mcs & ~0xF);
604 WARN_ON(nss & ~0x7); 609 WARN_ON((nss - 1) & ~0x7);
605 rate->idx = (nss << 4) | mcs; 610 rate->idx = ((nss - 1) << 4) | mcs;
606} 611}
607 612
608static inline u8 613static inline u8
@@ -614,7 +619,7 @@ ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
614static inline u8 619static inline u8
615ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate) 620ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
616{ 621{
617 return rate->idx >> 4; 622 return (rate->idx >> 4) + 1;
618} 623}
619 624
620/** 625/**
@@ -655,7 +660,11 @@ struct ieee80211_tx_info {
655 struct ieee80211_tx_rate rates[ 660 struct ieee80211_tx_rate rates[
656 IEEE80211_TX_MAX_RATES]; 661 IEEE80211_TX_MAX_RATES];
657 s8 rts_cts_rate_idx; 662 s8 rts_cts_rate_idx;
658 /* 3 bytes free */ 663 u8 use_rts:1;
664 u8 use_cts_prot:1;
665 u8 short_preamble:1;
666 u8 skip_table:1;
667 /* 2 bytes free */
659 }; 668 };
660 /* only needed before rate control */ 669 /* only needed before rate control */
661 unsigned long jiffies; 670 unsigned long jiffies;
@@ -676,6 +685,8 @@ struct ieee80211_tx_info {
676 struct { 685 struct {
677 struct ieee80211_tx_rate driver_rates[ 686 struct ieee80211_tx_rate driver_rates[
678 IEEE80211_TX_MAX_RATES]; 687 IEEE80211_TX_MAX_RATES];
688 u8 pad[4];
689
679 void *rate_driver_data[ 690 void *rate_driver_data[
680 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; 691 IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
681 }; 692 };
@@ -974,8 +985,7 @@ enum ieee80211_smps_mode {
974 * @power_level: requested transmit power (in dBm), backward compatibility 985 * @power_level: requested transmit power (in dBm), backward compatibility
975 * value only that is set to the minimum of all interfaces 986 * value only that is set to the minimum of all interfaces
976 * 987 *
977 * @channel: the channel to tune to 988 * @chandef: the channel definition to tune to
978 * @channel_type: the channel (HT) type
979 * @radar_enabled: whether radar detection is enabled 989 * @radar_enabled: whether radar detection is enabled
980 * 990 *
981 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 991 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
@@ -1001,8 +1011,7 @@ struct ieee80211_conf {
1001 1011
1002 u8 long_frame_max_tx_count, short_frame_max_tx_count; 1012 u8 long_frame_max_tx_count, short_frame_max_tx_count;
1003 1013
1004 struct ieee80211_channel *channel; 1014 struct cfg80211_chan_def chandef;
1005 enum nl80211_channel_type channel_type;
1006 bool radar_enabled; 1015 bool radar_enabled;
1007 enum ieee80211_smps_mode smps_mode; 1016 enum ieee80211_smps_mode smps_mode;
1008}; 1017};
@@ -1019,13 +1028,13 @@ struct ieee80211_conf {
1019 * the driver passed into mac80211. 1028 * the driver passed into mac80211.
1020 * @block_tx: Indicates whether transmission must be blocked before the 1029 * @block_tx: Indicates whether transmission must be blocked before the
1021 * scheduled channel switch, as indicated by the AP. 1030 * scheduled channel switch, as indicated by the AP.
1022 * @channel: the new channel to switch to 1031 * @chandef: the new channel to switch to
1023 * @count: the number of TBTT's until the channel switch event 1032 * @count: the number of TBTT's until the channel switch event
1024 */ 1033 */
1025struct ieee80211_channel_switch { 1034struct ieee80211_channel_switch {
1026 u64 timestamp; 1035 u64 timestamp;
1027 bool block_tx; 1036 bool block_tx;
1028 struct ieee80211_channel *channel; 1037 struct cfg80211_chan_def chandef;
1029 u8 count; 1038 u8 count;
1030}; 1039};
1031 1040
@@ -1067,6 +1076,9 @@ enum ieee80211_vif_flags {
1067 * path needing to access it; even though the netdev carrier will always 1076 * path needing to access it; even though the netdev carrier will always
1068 * be off when it is %NULL there can still be races and packets could be 1077 * be off when it is %NULL there can still be races and packets could be
1069 * processed after it switches back to %NULL. 1078 * processed after it switches back to %NULL.
1079 * @debugfs_dir: debugfs dentry, can be used by drivers to create own per
1080 * interface debug files. Note that it will be NULL for the virtual
1081 * monitor interface (if that is requested.)
1070 * @drv_priv: data area for driver use, will always be aligned to 1082 * @drv_priv: data area for driver use, will always be aligned to
1071 * sizeof(void *). 1083 * sizeof(void *).
1072 */ 1084 */
@@ -1083,6 +1095,10 @@ struct ieee80211_vif {
1083 1095
1084 u32 driver_flags; 1096 u32 driver_flags;
1085 1097
1098#ifdef CONFIG_MAC80211_DEBUGFS
1099 struct dentry *debugfs_dir;
1100#endif
1101
1086 /* must be last */ 1102 /* must be last */
1087 u8 drv_priv[0] __aligned(sizeof(void *)); 1103 u8 drv_priv[0] __aligned(sizeof(void *));
1088}; 1104};
@@ -1101,8 +1117,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1101 * These flags are used for communication about keys between the driver 1117 * These flags are used for communication about keys between the driver
1102 * and mac80211, with the @flags parameter of &struct ieee80211_key_conf. 1118 * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.
1103 * 1119 *
1104 * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates
1105 * that the STA this key will be used with could be using QoS.
1106 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the 1120 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
1107 * driver to indicate that it requires IV generation for this 1121 * driver to indicate that it requires IV generation for this
1108 * particular key. 1122 * particular key.
@@ -1127,7 +1141,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1127 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. 1141 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
1128 */ 1142 */
1129enum ieee80211_key_flags { 1143enum ieee80211_key_flags {
1130 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
1131 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 1144 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
1132 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 1145 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
1133 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 1146 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
@@ -1219,6 +1232,24 @@ enum ieee80211_sta_rx_bandwidth {
1219}; 1232};
1220 1233
1221/** 1234/**
1235 * struct ieee80211_sta_rates - station rate selection table
1236 *
1237 * @rcu_head: RCU head used for freeing the table on update
1238 * @rates: transmit rates/flags to be used by default.
1239 * Overriding entries per-packet is possible by using cb tx control.
1240 */
1241struct ieee80211_sta_rates {
1242 struct rcu_head rcu_head;
1243 struct {
1244 s8 idx;
1245 u8 count;
1246 u8 count_cts;
1247 u8 count_rts;
1248 u16 flags;
1249 } rate[IEEE80211_TX_RATE_TABLE_SIZE];
1250};
1251
1252/**
1222 * struct ieee80211_sta - station table entry 1253 * struct ieee80211_sta - station table entry
1223 * 1254 *
1224 * A station table entry represents a station we are possibly 1255 * A station table entry represents a station we are possibly
@@ -1231,9 +1262,8 @@ enum ieee80211_sta_rx_bandwidth {
1231 * @addr: MAC address 1262 * @addr: MAC address
1232 * @aid: AID we assigned to the station if we're an AP 1263 * @aid: AID we assigned to the station if we're an AP
1233 * @supp_rates: Bitmap of supported rates (per band) 1264 * @supp_rates: Bitmap of supported rates (per band)
1234 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities 1265 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
1235 * @vht_cap: VHT capabilities of this STA; Not restricting any capabilities 1266 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
1236 * of remote STA. Taking as is.
1237 * @wme: indicates whether the STA supports WME. Only valid during AP-mode. 1267 * @wme: indicates whether the STA supports WME. Only valid during AP-mode.
1238 * @drv_priv: data area for driver use, will always be aligned to 1268 * @drv_priv: data area for driver use, will always be aligned to
1239 * sizeof(void *), size is determined in hw information. 1269 * sizeof(void *), size is determined in hw information.
@@ -1246,6 +1276,7 @@ enum ieee80211_sta_rx_bandwidth {
1246 * notifications and capabilities. The value is only valid after 1276 * notifications and capabilities. The value is only valid after
1247 * the station moves to associated state. 1277 * the station moves to associated state.
1248 * @smps_mode: current SMPS mode (off, static or dynamic) 1278 * @smps_mode: current SMPS mode (off, static or dynamic)
1279 * @tx_rates: rate control selection table
1249 */ 1280 */
1250struct ieee80211_sta { 1281struct ieee80211_sta {
1251 u32 supp_rates[IEEE80211_NUM_BANDS]; 1282 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1259,6 +1290,7 @@ struct ieee80211_sta {
1259 u8 rx_nss; 1290 u8 rx_nss;
1260 enum ieee80211_sta_rx_bandwidth bandwidth; 1291 enum ieee80211_sta_rx_bandwidth bandwidth;
1261 enum ieee80211_smps_mode smps_mode; 1292 enum ieee80211_smps_mode smps_mode;
1293 struct ieee80211_sta_rates __rcu *rates;
1262 1294
1263 /* must be last */ 1295 /* must be last */
1264 u8 drv_priv[0] __aligned(sizeof(void *)); 1296 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1414,6 +1446,9 @@ struct ieee80211_tx_control {
1414 * for different virtual interfaces. See the doc section on HW queue 1446 * for different virtual interfaces. See the doc section on HW queue
1415 * control for more details. 1447 * control for more details.
1416 * 1448 *
1449 * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
1450 * selection table provided by the rate control algorithm.
1451 *
1417 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any 1452 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1418 * P2P Interface. This will be honoured even if more than one interface 1453 * P2P Interface. This will be honoured even if more than one interface
1419 * is supported. 1454 * is supported.
@@ -1446,6 +1481,7 @@ enum ieee80211_hw_flags {
1446 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1481 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1447 IEEE80211_HW_AP_LINK_PS = 1<<22, 1482 IEEE80211_HW_AP_LINK_PS = 1<<22,
1448 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1483 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1484 IEEE80211_HW_SUPPORTS_RC_TABLE = 1<<24,
1449 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1485 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1450 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1486 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1451}; 1487};
@@ -1531,6 +1567,17 @@ enum ieee80211_hw_flags {
1531 * @netdev_features: netdev features to be set in each netdev created 1567 * @netdev_features: netdev features to be set in each netdev created
1532 * from this HW. Note only HW checksum features are currently 1568 * from this HW. Note only HW checksum features are currently
1533 * compatible with mac80211. Other feature bits will be rejected. 1569 * compatible with mac80211. Other feature bits will be rejected.
1570 *
1571 * @uapsd_queues: This bitmap is included in (re)association frame to indicate
1572 * for each access category if it is uAPSD trigger-enabled and delivery-
1573 * enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
1574 * Each bit corresponds to different AC. Value '1' in specific bit means
1575 * that corresponding AC is both trigger- and delivery-enabled. '0' means
1576 * neither enabled.
1577 *
1578 * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
1579 * deliver to a WMM STA during any Service Period triggered by the WMM STA.
1580 * Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
1534 */ 1581 */
1535struct ieee80211_hw { 1582struct ieee80211_hw {
1536 struct ieee80211_conf conf; 1583 struct ieee80211_conf conf;
@@ -1556,6 +1603,8 @@ struct ieee80211_hw {
1556 u8 radiotap_mcs_details; 1603 u8 radiotap_mcs_details;
1557 u16 radiotap_vht_details; 1604 u16 radiotap_vht_details;
1558 netdev_features_t netdev_features; 1605 netdev_features_t netdev_features;
1606 u8 uapsd_queues;
1607 u8 uapsd_max_sp_len;
1559}; 1608};
1560 1609
1561/** 1610/**
@@ -1950,14 +1999,14 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1950 * filter those response frames except in the case of frames that 1999 * filter those response frames except in the case of frames that
1951 * are buffered in the driver -- those must remain buffered to avoid 2000 * are buffered in the driver -- those must remain buffered to avoid
1952 * reordering. Because it is possible that no frames are released 2001 * reordering. Because it is possible that no frames are released
1953 * in this case, the driver must call ieee80211_sta_eosp_irqsafe() 2002 * in this case, the driver must call ieee80211_sta_eosp()
1954 * to indicate to mac80211 that the service period ended anyway. 2003 * to indicate to mac80211 that the service period ended anyway.
1955 * 2004 *
1956 * Finally, if frames from multiple TIDs are released from mac80211 2005 * Finally, if frames from multiple TIDs are released from mac80211
1957 * but the driver might reorder them, it must clear & set the flags 2006 * but the driver might reorder them, it must clear & set the flags
1958 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP) 2007 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)
1959 * and also take care of the EOSP and MORE_DATA bits in the frame. 2008 * and also take care of the EOSP and MORE_DATA bits in the frame.
1960 * The driver may also use ieee80211_sta_eosp_irqsafe() in this case. 2009 * The driver may also use ieee80211_sta_eosp() in this case.
1961 */ 2010 */
1962 2011
1963/** 2012/**
@@ -2135,6 +2184,24 @@ enum ieee80211_rate_control_changed {
2135}; 2184};
2136 2185
2137/** 2186/**
2187 * enum ieee80211_roc_type - remain on channel type
2188 *
2189 * With the support for multi channel contexts and multi channel operations,
2190 * remain on channel operations might be limited/deferred/aborted by other
2191 * flows/operations which have higher priority (and vise versa).
2192 * Specifying the ROC type can be used by devices to prioritize the ROC
2193 * operations compared to other operations/flows.
2194 *
2195 * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC.
2196 * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required
2197 * for sending managment frames offchannel.
2198 */
2199enum ieee80211_roc_type {
2200 IEEE80211_ROC_TYPE_NORMAL = 0,
2201 IEEE80211_ROC_TYPE_MGMT_TX,
2202};
2203
2204/**
2138 * struct ieee80211_ops - callbacks from mac80211 to the driver 2205 * struct ieee80211_ops - callbacks from mac80211 to the driver
2139 * 2206 *
2140 * This structure contains various callbacks that the driver may 2207 * This structure contains various callbacks that the driver may
@@ -2212,18 +2279,6 @@ enum ieee80211_rate_control_changed {
2212 * MAC address of the device going away. 2279 * MAC address of the device going away.
2213 * Hence, this callback must be implemented. It can sleep. 2280 * Hence, this callback must be implemented. It can sleep.
2214 * 2281 *
2215 * @add_interface_debugfs: Drivers can use this callback to add debugfs files
2216 * when a vif is added to mac80211. This callback and
2217 * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS
2218 * conditional. @remove_interface_debugfs must be provided for cleanup.
2219 * This callback can sleep.
2220 *
2221 * @remove_interface_debugfs: Remove the debugfs files which were added using
2222 * @add_interface_debugfs. This callback must remove all debugfs entries
2223 * that were added because mac80211 only removes interface debugfs when the
2224 * interface is destroyed, not when it is removed from the driver.
2225 * This callback can sleep.
2226 *
2227 * @config: Handler for configuration requests. IEEE 802.11 code calls this 2282 * @config: Handler for configuration requests. IEEE 802.11 code calls this
2228 * function to change hardware configuration, e.g., channel. 2283 * function to change hardware configuration, e.g., channel.
2229 * This function should never fail but returns a negative error code 2284 * This function should never fail but returns a negative error code
@@ -2245,6 +2300,9 @@ enum ieee80211_rate_control_changed {
2245 * See the section "Frame filtering" for more information. 2300 * See the section "Frame filtering" for more information.
2246 * This callback must be implemented and can sleep. 2301 * This callback must be implemented and can sleep.
2247 * 2302 *
2303 * @set_multicast_list: Configure the device's interface specific RX multicast
2304 * filter. This callback is optional. This callback must be atomic.
2305 *
2248 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 2306 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
2249 * must be set or cleared for a given STA. Must be atomic. 2307 * must be set or cleared for a given STA. Must be atomic.
2250 * 2308 *
@@ -2426,8 +2484,11 @@ enum ieee80211_rate_control_changed {
2426 * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. 2484 * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.
2427 * 2485 *
2428 * @flush: Flush all pending frames from the hardware queue, making sure 2486 * @flush: Flush all pending frames from the hardware queue, making sure
2429 * that the hardware queues are empty. If the parameter @drop is set 2487 * that the hardware queues are empty. The @queues parameter is a bitmap
2430 * to %true, pending frames may be dropped. The callback can sleep. 2488 * of queues to flush, which is useful if different virtual interfaces
2489 * use different hardware queues; it may also indicate all queues.
2490 * If the parameter @drop is set to %true, pending frames may be dropped.
2491 * The callback can sleep.
2431 * 2492 *
2432 * @channel_switch: Drivers that need (or want) to offload the channel 2493 * @channel_switch: Drivers that need (or want) to offload the channel
2433 * switch operation for CSAs received from the AP may implement this 2494 * switch operation for CSAs received from the AP may implement this
@@ -2492,7 +2553,7 @@ enum ieee80211_rate_control_changed {
2492 * setting the EOSP flag in the QoS header of the frames. Also, when the 2553 * setting the EOSP flag in the QoS header of the frames. Also, when the
2493 * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP 2554 * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP
2494 * on the last frame in the SP. Alternatively, it may call the function 2555 * on the last frame in the SP. Alternatively, it may call the function
2495 * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. 2556 * ieee80211_sta_eosp() to inform mac80211 of the end of the SP.
2496 * This callback must be atomic. 2557 * This callback must be atomic.
2497 * @allow_buffered_frames: Prepare device to allow the given number of frames 2558 * @allow_buffered_frames: Prepare device to allow the given number of frames
2498 * to go out to the given station. The frames will be sent by mac80211 2559 * to go out to the given station. The frames will be sent by mac80211
@@ -2503,7 +2564,7 @@ enum ieee80211_rate_control_changed {
2503 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2564 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
2504 * on the last frame and clear it on all others and also handle the EOSP 2565 * on the last frame and clear it on all others and also handle the EOSP
2505 * bit in the QoS header correctly. Alternatively, it can also call the 2566 * bit in the QoS header correctly. Alternatively, it can also call the
2506 * ieee80211_sta_eosp_irqsafe() function. 2567 * ieee80211_sta_eosp() function.
2507 * The @tids parameter is a bitmap and tells the driver which TIDs the 2568 * The @tids parameter is a bitmap and tells the driver which TIDs the
2508 * frames will be on; it will at most have two bits set. 2569 * frames will be on; it will at most have two bits set.
2509 * This callback must be atomic. 2570 * This callback must be atomic.
@@ -2591,6 +2652,10 @@ struct ieee80211_ops {
2591 unsigned int changed_flags, 2652 unsigned int changed_flags,
2592 unsigned int *total_flags, 2653 unsigned int *total_flags,
2593 u64 multicast); 2654 u64 multicast);
2655 void (*set_multicast_list)(struct ieee80211_hw *hw,
2656 struct ieee80211_vif *vif, bool allmulti,
2657 struct netdev_hw_addr_list *mc_list);
2658
2594 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 2659 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2595 bool set); 2660 bool set);
2596 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 2661 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
@@ -2637,12 +2702,6 @@ struct ieee80211_ops {
2637 struct ieee80211_vif *vif, 2702 struct ieee80211_vif *vif,
2638 struct ieee80211_sta *sta, 2703 struct ieee80211_sta *sta,
2639 struct dentry *dir); 2704 struct dentry *dir);
2640 void (*add_interface_debugfs)(struct ieee80211_hw *hw,
2641 struct ieee80211_vif *vif,
2642 struct dentry *dir);
2643 void (*remove_interface_debugfs)(struct ieee80211_hw *hw,
2644 struct ieee80211_vif *vif,
2645 struct dentry *dir);
2646#endif 2705#endif
2647 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2706 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2648 enum sta_notify_cmd, struct ieee80211_sta *sta); 2707 enum sta_notify_cmd, struct ieee80211_sta *sta);
@@ -2677,7 +2736,7 @@ struct ieee80211_ops {
2677 struct netlink_callback *cb, 2736 struct netlink_callback *cb,
2678 void *data, int len); 2737 void *data, int len);
2679#endif 2738#endif
2680 void (*flush)(struct ieee80211_hw *hw, bool drop); 2739 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
2681 void (*channel_switch)(struct ieee80211_hw *hw, 2740 void (*channel_switch)(struct ieee80211_hw *hw,
2682 struct ieee80211_channel_switch *ch_switch); 2741 struct ieee80211_channel_switch *ch_switch);
2683 int (*napi_poll)(struct ieee80211_hw *hw, int budget); 2742 int (*napi_poll)(struct ieee80211_hw *hw, int budget);
@@ -2687,7 +2746,8 @@ struct ieee80211_ops {
2687 int (*remain_on_channel)(struct ieee80211_hw *hw, 2746 int (*remain_on_channel)(struct ieee80211_hw *hw,
2688 struct ieee80211_vif *vif, 2747 struct ieee80211_vif *vif,
2689 struct ieee80211_channel *chan, 2748 struct ieee80211_channel *chan,
2690 int duration); 2749 int duration,
2750 enum ieee80211_roc_type type);
2691 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); 2751 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
2692 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); 2752 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
2693 void (*get_ringparam)(struct ieee80211_hw *hw, 2753 void (*get_ringparam)(struct ieee80211_hw *hw,
@@ -2983,7 +3043,8 @@ void ieee80211_napi_complete(struct ieee80211_hw *hw);
2983 * This function may not be called in IRQ context. Calls to this function 3043 * This function may not be called in IRQ context. Calls to this function
2984 * for a single hardware must be synchronized against each other. Calls to 3044 * for a single hardware must be synchronized against each other. Calls to
2985 * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be 3045 * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
2986 * mixed for a single hardware. 3046 * mixed for a single hardware. Must not run concurrently with
3047 * ieee80211_tx_status() or ieee80211_tx_status_ni().
2987 * 3048 *
2988 * In process context use instead ieee80211_rx_ni(). 3049 * In process context use instead ieee80211_rx_ni().
2989 * 3050 *
@@ -2999,7 +3060,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
2999 * (internally defers to a tasklet.) 3060 * (internally defers to a tasklet.)
3000 * 3061 *
3001 * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not 3062 * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
3002 * be mixed for a single hardware. 3063 * be mixed for a single hardware.Must not run concurrently with
3064 * ieee80211_tx_status() or ieee80211_tx_status_ni().
3003 * 3065 *
3004 * @hw: the hardware this frame came in on 3066 * @hw: the hardware this frame came in on
3005 * @skb: the buffer to receive, owned by mac80211 after this call 3067 * @skb: the buffer to receive, owned by mac80211 after this call
@@ -3013,7 +3075,8 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
3013 * (internally disables bottom halves). 3075 * (internally disables bottom halves).
3014 * 3076 *
3015 * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may 3077 * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
3016 * not be mixed for a single hardware. 3078 * not be mixed for a single hardware. Must not run concurrently with
3079 * ieee80211_tx_status() or ieee80211_tx_status_ni().
3017 * 3080 *
3018 * @hw: the hardware this frame came in on 3081 * @hw: the hardware this frame came in on
3019 * @skb: the buffer to receive, owned by mac80211 after this call 3082 * @skb: the buffer to receive, owned by mac80211 after this call
@@ -3108,6 +3171,25 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
3108 u8 tid, bool buffered); 3171 u8 tid, bool buffered);
3109 3172
3110/** 3173/**
3174 * ieee80211_get_tx_rates - get the selected transmit rates for a packet
3175 *
3176 * Call this function in a driver with per-packet rate selection support
3177 * to combine the rate info in the packet tx info with the most recent
3178 * rate selection table for the station entry.
3179 *
3180 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3181 * @sta: the receiver station to which this packet is sent.
3182 * @skb: the frame to be transmitted.
3183 * @dest: buffer for extracted rate/retry information
3184 * @max_rates: maximum number of rates to fetch
3185 */
3186void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
3187 struct ieee80211_sta *sta,
3188 struct sk_buff *skb,
3189 struct ieee80211_tx_rate *dest,
3190 int max_rates);
3191
3192/**
3111 * ieee80211_tx_status - transmit status callback 3193 * ieee80211_tx_status - transmit status callback
3112 * 3194 *
3113 * Call this function for all transmitted frames after they have been 3195 * Call this function for all transmitted frames after they have been
@@ -3117,7 +3199,8 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
3117 * This function may not be called in IRQ context. Calls to this function 3199 * This function may not be called in IRQ context. Calls to this function
3118 * for a single hardware must be synchronized against each other. Calls 3200 * for a single hardware must be synchronized against each other. Calls
3119 * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe() 3201 * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
3120 * may not be mixed for a single hardware. 3202 * may not be mixed for a single hardware. Must not run concurrently with
3203 * ieee80211_rx() or ieee80211_rx_ni().
3121 * 3204 *
3122 * @hw: the hardware the frame was transmitted by 3205 * @hw: the hardware the frame was transmitted by
3123 * @skb: the frame that was transmitted, owned by mac80211 after this call 3206 * @skb: the frame that was transmitted, owned by mac80211 after this call
@@ -3842,14 +3925,17 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
3842 * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. 3925 * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.
3843 * This applies for PS-Poll as well as uAPSD. 3926 * This applies for PS-Poll as well as uAPSD.
3844 * 3927 *
3845 * Note that there is no non-_irqsafe version right now as 3928 * Note that just like with _tx_status() and _rx() drivers must
3846 * it wasn't needed, but just like _tx_status() and _rx() 3929 * not mix calls to irqsafe/non-irqsafe versions, this function
3847 * must not be mixed in irqsafe/non-irqsafe versions, this 3930 * must not be mixed with those either. Use the all irqsafe, or
3848 * function must not be mixed with those either. Use the 3931 * all non-irqsafe, don't mix!
3849 * all irqsafe, or all non-irqsafe, don't mix! If you need 3932 *
3850 * the non-irqsafe version of this, you need to add it. 3933 * NB: the _irqsafe version of this function doesn't exist, no
3934 * driver needs it right now. Don't call this function if
3935 * you'd need the _irqsafe version, look at the git history
3936 * and restore the _irqsafe version!
3851 */ 3937 */
3852void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); 3938void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);
3853 3939
3854/** 3940/**
3855 * ieee80211_iter_keys - iterate keys programmed into the device 3941 * ieee80211_iter_keys - iterate keys programmed into the device
@@ -4079,7 +4165,7 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
4079 * (deprecated; this will be removed once drivers get updated to use 4165 * (deprecated; this will be removed once drivers get updated to use
4080 * rate_idx_mask) 4166 * rate_idx_mask)
4081 * @rate_idx_mask: user-requested (legacy) rate mask 4167 * @rate_idx_mask: user-requested (legacy) rate mask
4082 * @rate_idx_mcs_mask: user-requested MCS rate mask 4168 * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)
4083 * @bss: whether this frame is sent out in AP or IBSS mode 4169 * @bss: whether this frame is sent out in AP or IBSS mode
4084 */ 4170 */
4085struct ieee80211_tx_rate_control { 4171struct ieee80211_tx_rate_control {
@@ -4091,7 +4177,7 @@ struct ieee80211_tx_rate_control {
4091 bool rts, short_preamble; 4177 bool rts, short_preamble;
4092 u8 max_rate_idx; 4178 u8 max_rate_idx;
4093 u32 rate_idx_mask; 4179 u32 rate_idx_mask;
4094 u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; 4180 u8 *rate_idx_mcs_mask;
4095 bool bss; 4181 bool bss;
4096}; 4182};
4097 4183
@@ -4180,37 +4266,55 @@ bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
4180 return false; 4266 return false;
4181} 4267}
4182 4268
4269/**
4270 * rate_control_set_rates - pass the sta rate selection to mac80211/driver
4271 *
4272 * When not doing a rate control probe to test rates, rate control should pass
4273 * its rate selection to mac80211. If the driver supports receiving a station
4274 * rate table, it will use it to ensure that frames are always sent based on
4275 * the most recent rate control module decision.
4276 *
4277 * @hw: pointer as obtained from ieee80211_alloc_hw()
4278 * @pubsta: &struct ieee80211_sta pointer to the target destination.
4279 * @rates: new tx rate set to be used for this station.
4280 */
4281int rate_control_set_rates(struct ieee80211_hw *hw,
4282 struct ieee80211_sta *pubsta,
4283 struct ieee80211_sta_rates *rates);
4284
4183int ieee80211_rate_control_register(struct rate_control_ops *ops); 4285int ieee80211_rate_control_register(struct rate_control_ops *ops);
4184void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 4286void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
4185 4287
4186static inline bool 4288static inline bool
4187conf_is_ht20(struct ieee80211_conf *conf) 4289conf_is_ht20(struct ieee80211_conf *conf)
4188{ 4290{
4189 return conf->channel_type == NL80211_CHAN_HT20; 4291 return conf->chandef.width == NL80211_CHAN_WIDTH_20;
4190} 4292}
4191 4293
4192static inline bool 4294static inline bool
4193conf_is_ht40_minus(struct ieee80211_conf *conf) 4295conf_is_ht40_minus(struct ieee80211_conf *conf)
4194{ 4296{
4195 return conf->channel_type == NL80211_CHAN_HT40MINUS; 4297 return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
4298 conf->chandef.center_freq1 < conf->chandef.chan->center_freq;
4196} 4299}
4197 4300
4198static inline bool 4301static inline bool
4199conf_is_ht40_plus(struct ieee80211_conf *conf) 4302conf_is_ht40_plus(struct ieee80211_conf *conf)
4200{ 4303{
4201 return conf->channel_type == NL80211_CHAN_HT40PLUS; 4304 return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
4305 conf->chandef.center_freq1 > conf->chandef.chan->center_freq;
4202} 4306}
4203 4307
4204static inline bool 4308static inline bool
4205conf_is_ht40(struct ieee80211_conf *conf) 4309conf_is_ht40(struct ieee80211_conf *conf)
4206{ 4310{
4207 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); 4311 return conf->chandef.width == NL80211_CHAN_WIDTH_40;
4208} 4312}
4209 4313
4210static inline bool 4314static inline bool
4211conf_is_ht(struct ieee80211_conf *conf) 4315conf_is_ht(struct ieee80211_conf *conf)
4212{ 4316{
4213 return conf->channel_type != NL80211_CHAN_NO_HT; 4317 return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT;
4214} 4318}
4215 4319
4216static inline enum nl80211_iftype 4320static inline enum nl80211_iftype
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index de644bcd8613..b17697827482 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -17,6 +17,7 @@
17#include <net/netns/ipv6.h> 17#include <net/netns/ipv6.h>
18#include <net/netns/sctp.h> 18#include <net/netns/sctp.h>
19#include <net/netns/dccp.h> 19#include <net/netns/dccp.h>
20#include <net/netns/netfilter.h>
20#include <net/netns/x_tables.h> 21#include <net/netns/x_tables.h>
21#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
22#include <net/netns/conntrack.h> 23#include <net/netns/conntrack.h>
@@ -94,6 +95,7 @@ struct net {
94 struct netns_dccp dccp; 95 struct netns_dccp dccp;
95#endif 96#endif
96#ifdef CONFIG_NETFILTER 97#ifdef CONFIG_NETFILTER
98 struct netns_nf nf;
97 struct netns_xt xt; 99 struct netns_xt xt;
98#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 100#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
99 struct netns_ct ct; 101 struct netns_ct ct;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index caca0c4d6b4b..644d9c223d24 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -184,7 +184,7 @@ extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184extern void nf_ct_delete_from_lists(struct nf_conn *ct); 184extern void nf_ct_delete_from_lists(struct nf_conn *ct);
185extern void nf_ct_dying_timeout(struct nf_conn *ct); 185extern void nf_ct_dying_timeout(struct nf_conn *ct);
186 186
187extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); 187extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
188 188
189extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 189extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
190 unsigned int nhoff, u_int16_t l3num, 190 unsigned int nhoff, u_int16_t l3num,
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 930275fa2ea6..fb2b6234e937 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -27,6 +27,7 @@ extern unsigned int nf_conntrack_in(struct net *net,
27 27
28extern int nf_conntrack_init_net(struct net *net); 28extern int nf_conntrack_init_net(struct net *net);
29extern void nf_conntrack_cleanup_net(struct net *net); 29extern void nf_conntrack_cleanup_net(struct net *net);
30extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
30 31
31extern int nf_conntrack_proto_pernet_init(struct net *net); 32extern int nf_conntrack_proto_pernet_init(struct net *net);
32extern void nf_conntrack_proto_pernet_fini(struct net *net); 33extern void nf_conntrack_proto_pernet_fini(struct net *net);
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index cbbae7621e22..3f3aecbc8632 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -88,7 +88,7 @@ nf_ct_find_expectation(struct net *net, u16 zone,
88 const struct nf_conntrack_tuple *tuple); 88 const struct nf_conntrack_tuple *tuple);
89 89
90void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, 90void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
91 u32 pid, int report); 91 u32 portid, int report);
92static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp) 92static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
93{ 93{
94 nf_ct_unlink_expect_report(exp, 0, 0); 94 nf_ct_unlink_expect_report(exp, 0, 0);
@@ -106,7 +106,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
106 u_int8_t, const __be16 *, const __be16 *); 106 u_int8_t, const __be16 *, const __be16 *);
107void nf_ct_expect_put(struct nf_conntrack_expect *exp); 107void nf_ct_expect_put(struct nf_conntrack_expect *exp);
108int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, 108int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
109 u32 pid, int report); 109 u32 portid, int report);
110static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect) 110static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
111{ 111{
112 return nf_ct_expect_related_report(expect, 0, 0); 112 return nf_ct_expect_related_report(expect, 0, 0);
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index e991bd0a27af..99eac12d040b 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -30,7 +30,8 @@ struct nf_loginfo {
30 } u; 30 } u;
31}; 31};
32 32
33typedef void nf_logfn(u_int8_t pf, 33typedef void nf_logfn(struct net *net,
34 u_int8_t pf,
34 unsigned int hooknum, 35 unsigned int hooknum,
35 const struct sk_buff *skb, 36 const struct sk_buff *skb,
36 const struct net_device *in, 37 const struct net_device *in,
@@ -49,12 +50,18 @@ struct nf_logger {
49int nf_log_register(u_int8_t pf, struct nf_logger *logger); 50int nf_log_register(u_int8_t pf, struct nf_logger *logger);
50void nf_log_unregister(struct nf_logger *logger); 51void nf_log_unregister(struct nf_logger *logger);
51 52
52int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger); 53void nf_log_set(struct net *net, u_int8_t pf,
53void nf_log_unbind_pf(u_int8_t pf); 54 const struct nf_logger *logger);
55void nf_log_unset(struct net *net, const struct nf_logger *logger);
56
57int nf_log_bind_pf(struct net *net, u_int8_t pf,
58 const struct nf_logger *logger);
59void nf_log_unbind_pf(struct net *net, u_int8_t pf);
54 60
55/* Calls the registered backend logging function */ 61/* Calls the registered backend logging function */
56__printf(7, 8) 62__printf(8, 9)
57void nf_log_packet(u_int8_t pf, 63void nf_log_packet(struct net *net,
64 u_int8_t pf,
58 unsigned int hooknum, 65 unsigned int hooknum,
59 const struct sk_buff *skb, 66 const struct sk_buff *skb,
60 const struct net_device *in, 67 const struct net_device *in,
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index fb1c0be38b6d..aaba4bbcdda0 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -9,10 +9,13 @@ struct nf_queue_entry {
9 9
10 struct nf_hook_ops *elem; 10 struct nf_hook_ops *elem;
11 u_int8_t pf; 11 u_int8_t pf;
12 u16 size; /* sizeof(entry) + saved route keys */
12 unsigned int hook; 13 unsigned int hook;
13 struct net_device *indev; 14 struct net_device *indev;
14 struct net_device *outdev; 15 struct net_device *outdev;
15 int (*okfn)(struct sk_buff *); 16 int (*okfn)(struct sk_buff *);
17
18 /* extra space to store route keys */
16}; 19};
17 20
18#define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) 21#define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry))
@@ -27,4 +30,7 @@ void nf_register_queue_handler(const struct nf_queue_handler *qh);
27void nf_unregister_queue_handler(void); 30void nf_unregister_queue_handler(void);
28extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 31extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
29 32
33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry);
34void nf_queue_entry_release_refs(struct nf_queue_entry *entry);
35
30#endif /* _NF_QUEUE_H */ 36#endif /* _NF_QUEUE_H */
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
index e2dec42c2db2..5ca3f14f0998 100644
--- a/include/net/netfilter/nfnetlink_log.h
+++ b/include/net/netfilter/nfnetlink_log.h
@@ -2,7 +2,8 @@
2#define _KER_NFNETLINK_LOG_H 2#define _KER_NFNETLINK_LOG_H
3 3
4void 4void
5nfulnl_log_packet(u_int8_t pf, 5nfulnl_log_packet(struct net *net,
6 u_int8_t pf,
6 unsigned int hooknum, 7 unsigned int hooknum,
7 const struct sk_buff *skb, 8 const struct sk_buff *skb,
8 const struct net_device *in, 9 const struct net_device *in,
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 1242f371718b..005e2c2e39a9 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -71,6 +71,7 @@ struct netns_ipv6 {
71 struct fib_rules_ops *mr6_rules_ops; 71 struct fib_rules_ops *mr6_rules_ops;
72#endif 72#endif
73#endif 73#endif
74 atomic_t dev_addr_genid;
74}; 75};
75 76
76#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 77#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h
new file mode 100644
index 000000000000..88740024ccf3
--- /dev/null
+++ b/include/net/netns/netfilter.h
@@ -0,0 +1,18 @@
1#ifndef __NETNS_NETFILTER_H
2#define __NETNS_NETFILTER_H
3
4#include <linux/proc_fs.h>
5#include <linux/netfilter.h>
6
7struct nf_logger;
8
9struct netns_nf {
10#if defined CONFIG_PROC_FS
11 struct proc_dir_entry *proc_netfilter;
12#endif
13 const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO];
14#ifdef CONFIG_SYSCTL
15 struct ctl_table_header *nf_log_dir_header;
16#endif
17};
18#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 1d04b6f0fbd4..50ab8c26ab59 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -29,7 +29,7 @@ struct cgroup_netprio_state {
29 struct cgroup_subsys_state css; 29 struct cgroup_subsys_state css;
30}; 30};
31 31
32extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); 32extern void sock_update_netprioidx(struct sock *sk);
33 33
34#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) 34#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
35 35
@@ -68,7 +68,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
68 return 0; 68 return 0;
69} 69}
70 70
71#define sock_update_netprioidx(sk, task) 71#define sock_update_netprioidx(sk)
72 72
73#endif /* CONFIG_NETPRIO_CGROUP */ 73#endif /* CONFIG_NETPRIO_CGROUP */
74 74
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 87a6417fc934..5eb80bb3cbb2 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -122,6 +122,8 @@ struct nfc_dev {
122 122
123 bool shutting_down; 123 bool shutting_down;
124 124
125 struct rfkill *rfkill;
126
125 struct nfc_ops *ops; 127 struct nfc_ops *ops;
126}; 128};
127#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) 129#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index a51dbd17c2de..59795e42c8b6 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -27,19 +27,13 @@ struct sk_buff;
27struct dst_entry; 27struct dst_entry;
28struct proto; 28struct proto;
29 29
30/* empty to "strongly type" an otherwise void parameter.
31 */
32struct request_values {
33};
34
35struct request_sock_ops { 30struct request_sock_ops {
36 int family; 31 int family;
37 int obj_size; 32 int obj_size;
38 struct kmem_cache *slab; 33 struct kmem_cache *slab;
39 char *slab_name; 34 char *slab_name;
40 int (*rtx_syn_ack)(struct sock *sk, 35 int (*rtx_syn_ack)(struct sock *sk,
41 struct request_sock *req, 36 struct request_sock *req);
42 struct request_values *rvp);
43 void (*send_ack)(struct sock *sk, struct sk_buff *skb, 37 void (*send_ack)(struct sock *sk, struct sk_buff *skb,
44 struct request_sock *req); 38 struct request_sock *req);
45 void (*send_reset)(struct sock *sk, 39 void (*send_reset)(struct sock *sk,
@@ -54,7 +48,7 @@ extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
54/* struct request_sock - mini sock to represent a connection request 48/* struct request_sock - mini sock to represent a connection request
55 */ 49 */
56struct request_sock { 50struct request_sock {
57 struct request_sock *dl_next; /* Must be first member! */ 51 struct request_sock *dl_next;
58 u16 mss; 52 u16 mss;
59 u8 num_retrans; /* number of retransmits */ 53 u8 num_retrans; /* number of retransmits */
60 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ 54 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 5a15fabd6a75..702664833a53 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -4,7 +4,7 @@
4#include <linux/rtnetlink.h> 4#include <linux/rtnetlink.h>
5#include <net/netlink.h> 5#include <net/netlink.h>
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
diff --git a/include/net/scm.h b/include/net/scm.h
index b11708105681..8de2d37d2077 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -26,7 +26,6 @@ struct scm_fp_list {
26 26
27struct scm_cookie { 27struct scm_cookie {
28 struct pid *pid; /* Skb credentials */ 28 struct pid *pid; /* Skb credentials */
29 const struct cred *cred;
30 struct scm_fp_list *fp; /* Passed files */ 29 struct scm_fp_list *fp; /* Passed files */
31 struct scm_creds creds; /* Skb credentials */ 30 struct scm_creds creds; /* Skb credentials */
32#ifdef CONFIG_SECURITY_NETWORK 31#ifdef CONFIG_SECURITY_NETWORK
@@ -51,23 +50,18 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co
51#endif /* CONFIG_SECURITY_NETWORK */ 50#endif /* CONFIG_SECURITY_NETWORK */
52 51
53static __inline__ void scm_set_cred(struct scm_cookie *scm, 52static __inline__ void scm_set_cred(struct scm_cookie *scm,
54 struct pid *pid, const struct cred *cred) 53 struct pid *pid, kuid_t uid, kgid_t gid)
55{ 54{
56 scm->pid = get_pid(pid); 55 scm->pid = get_pid(pid);
57 scm->cred = cred ? get_cred(cred) : NULL;
58 scm->creds.pid = pid_vnr(pid); 56 scm->creds.pid = pid_vnr(pid);
59 scm->creds.uid = cred ? cred->uid : INVALID_UID; 57 scm->creds.uid = uid;
60 scm->creds.gid = cred ? cred->gid : INVALID_GID; 58 scm->creds.gid = gid;
61} 59}
62 60
63static __inline__ void scm_destroy_cred(struct scm_cookie *scm) 61static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
64{ 62{
65 put_pid(scm->pid); 63 put_pid(scm->pid);
66 scm->pid = NULL; 64 scm->pid = NULL;
67
68 if (scm->cred)
69 put_cred(scm->cred);
70 scm->cred = NULL;
71} 65}
72 66
73static __inline__ void scm_destroy(struct scm_cookie *scm) 67static __inline__ void scm_destroy(struct scm_cookie *scm)
@@ -81,8 +75,10 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
81 struct scm_cookie *scm, bool forcecreds) 75 struct scm_cookie *scm, bool forcecreds)
82{ 76{
83 memset(scm, 0, sizeof(*scm)); 77 memset(scm, 0, sizeof(*scm));
78 scm->creds.uid = INVALID_UID;
79 scm->creds.gid = INVALID_GID;
84 if (forcecreds) 80 if (forcecreds)
85 scm_set_cred(scm, task_tgid(current), current_cred()); 81 scm_set_cred(scm, task_tgid(current), current_uid(), current_gid());
86 unix_get_peersec_dgram(sock, scm); 82 unix_get_peersec_dgram(sock, scm);
87 if (msg->msg_controllen <= 0) 83 if (msg->msg_controllen <= 0)
88 return 0; 84 return 0;
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index befc8d2a1b9f..5a2110d3176d 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
77 return sctp_crc32c(crc32, buffer, length); 77 return sctp_crc32c(crc32, buffer, length);
78} 78}
79 79
80static inline __le32 sctp_end_cksum(__be32 crc32) 80static inline __le32 sctp_end_cksum(__u32 crc32)
81{ 81{
82 return cpu_to_le32(~crc32); 82 return cpu_to_le32(~crc32);
83} 83}
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index a7dd5c50df79..ca50e0751e47 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -49,7 +49,6 @@
49 49
50#include <linux/sctp.h> 50#include <linux/sctp.h>
51#include <linux/ipv6.h> /* For ipv6hdr. */ 51#include <linux/ipv6.h> /* For ipv6hdr. */
52#include <net/sctp/user.h>
53#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */ 52#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */
54 53
55/* Value used for stream negotiation. */ 54/* Value used for stream negotiation. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index df85a0c0f2d5..cd89510eab2a 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -576,7 +576,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
576#define WORD_ROUND(s) (((s)+3)&~3) 576#define WORD_ROUND(s) (((s)+3)&~3)
577 577
578/* Make a new instance of type. */ 578/* Make a new instance of type. */
579#define t_new(type, flags) (type *)kzalloc(sizeof(type), flags) 579#define t_new(type, flags) kzalloc(sizeof(type), flags)
580 580
581/* Compare two timevals. */ 581/* Compare two timevals. */
582#define tv_lt(s, t) \ 582#define tv_lt(s, t) \
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0e0f9d2322e3..1bd4c4144fe8 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -399,7 +399,6 @@ struct sctp_stream {
399struct sctp_ssnmap { 399struct sctp_ssnmap {
400 struct sctp_stream in; 400 struct sctp_stream in;
401 struct sctp_stream out; 401 struct sctp_stream out;
402 int malloced;
403}; 402};
404 403
405struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, 404struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
@@ -715,8 +714,7 @@ struct sctp_packet {
715 has_sack:1, /* This packet contains a SACK chunk. */ 714 has_sack:1, /* This packet contains a SACK chunk. */
716 has_auth:1, /* This packet contains an AUTH chunk */ 715 has_auth:1, /* This packet contains an AUTH chunk */
717 has_data:1, /* This packet contains at least 1 DATA chunk */ 716 has_data:1, /* This packet contains at least 1 DATA chunk */
718 ipfragok:1, /* So let ip fragment this packet */ 717 ipfragok:1; /* So let ip fragment this packet */
719 malloced:1; /* Is it malloced? */
720}; 718};
721 719
722struct sctp_packet *sctp_packet_init(struct sctp_packet *, 720struct sctp_packet *sctp_packet_init(struct sctp_packet *,
@@ -780,10 +778,7 @@ struct sctp_transport {
780 hb_sent:1, 778 hb_sent:1,
781 779
782 /* Is the Path MTU update pending on this tranport */ 780 /* Is the Path MTU update pending on this tranport */
783 pmtu_pending:1, 781 pmtu_pending:1;
784
785 /* Is this structure kfree()able? */
786 malloced:1;
787 782
788 /* Has this transport moved the ctsn since we last sacked */ 783 /* Has this transport moved the ctsn since we last sacked */
789 __u32 sack_generation; 784 __u32 sack_generation;
@@ -992,8 +987,6 @@ struct sctp_inq {
992 * messages. 987 * messages.
993 */ 988 */
994 struct work_struct immediate; 989 struct work_struct immediate;
995
996 int malloced; /* Is this structure kfree()able? */
997}; 990};
998 991
999void sctp_inq_init(struct sctp_inq *); 992void sctp_inq_init(struct sctp_inq *);
@@ -1062,9 +1055,6 @@ struct sctp_outq {
1062 1055
1063 /* Is this structure empty? */ 1056 /* Is this structure empty? */
1064 char empty; 1057 char empty;
1065
1066 /* Are we kfree()able? */
1067 char malloced;
1068}; 1058};
1069 1059
1070void sctp_outq_init(struct sctp_association *, struct sctp_outq *); 1060void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
@@ -1102,8 +1092,6 @@ struct sctp_bind_addr {
1102 * peer(s) in INIT and INIT ACK chunks. 1092 * peer(s) in INIT and INIT ACK chunks.
1103 */ 1093 */
1104 struct list_head address_list; 1094 struct list_head address_list;
1105
1106 int malloced; /* Are we kfree()able? */
1107}; 1095};
1108 1096
1109void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); 1097void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
@@ -1174,11 +1162,9 @@ struct sctp_ep_common {
1174 /* Some fields to help us manage this object. 1162 /* Some fields to help us manage this object.
1175 * refcnt - Reference count access to this object. 1163 * refcnt - Reference count access to this object.
1176 * dead - Do not attempt to use this object. 1164 * dead - Do not attempt to use this object.
1177 * malloced - Do we need to kfree this object?
1178 */ 1165 */
1179 atomic_t refcnt; 1166 atomic_t refcnt;
1180 char dead; 1167 bool dead;
1181 char malloced;
1182 1168
1183 /* What socket does this endpoint belong to? */ 1169 /* What socket does this endpoint belong to? */
1184 struct sock *sk; 1170 struct sock *sk;
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index ff1b8ba73ab1..00e50ba3f24b 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -49,7 +49,6 @@
49 49
50/* A structure to carry information to the ULP (e.g. Sockets API) */ 50/* A structure to carry information to the ULP (e.g. Sockets API) */
51struct sctp_ulpq { 51struct sctp_ulpq {
52 char malloced;
53 char pd_mode; 52 char pd_mode;
54 struct sctp_association *asoc; 53 struct sctp_association *asoc;
55 struct sk_buff_head reasm; 54 struct sk_buff_head reasm;
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
index c2e542b27a5a..6ca975bebd37 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern void net_secret_init(void);
6extern __u32 secure_ip_id(__be32 daddr); 7extern __u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ipv6_id(const __be32 daddr[4]); 8extern __u32 secure_ipv6_id(const __be32 daddr[4]);
8extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 9extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
diff --git a/include/net/sock.h b/include/net/sock.h
index 14f6e9d19dc7..66772cf8c3c5 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -667,6 +667,7 @@ enum sock_flags {
667 * user-space instead. 667 * user-space instead.
668 */ 668 */
669 SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */ 669 SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */
670 SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */
670}; 671};
671 672
672static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 673static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -865,6 +866,18 @@ struct inet_hashinfo;
865struct raw_hashinfo; 866struct raw_hashinfo;
866struct module; 867struct module;
867 868
869/*
870 * caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes
871 * un-modified. Special care is taken when initializing object to zero.
872 */
873static inline void sk_prot_clear_nulls(struct sock *sk, int size)
874{
875 if (offsetof(struct sock, sk_node.next) != 0)
876 memset(sk, 0, offsetof(struct sock, sk_node.next));
877 memset(&sk->sk_node.pprev, 0,
878 size - offsetof(struct sock, sk_node.pprev));
879}
880
868/* Networking protocol blocks we attach to sockets. 881/* Networking protocol blocks we attach to sockets.
869 * socket layer -> transport layer interface 882 * socket layer -> transport layer interface
870 * transport -> network interface is defined by struct inet_proto 883 * transport -> network interface is defined by struct inet_proto
@@ -2158,10 +2171,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2158 * @sk: socket sending this packet 2171 * @sk: socket sending this packet
2159 * @tx_flags: filled with instructions for time stamping 2172 * @tx_flags: filled with instructions for time stamping
2160 * 2173 *
2161 * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if 2174 * Currently only depends on SOCK_TIMESTAMPING* flags.
2162 * parameters are invalid.
2163 */ 2175 */
2164extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2176extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2165 2177
2166/** 2178/**
2167 * sk_eat_skb - Release a skb if it is no longer needed 2179 * sk_eat_skb - Release a skb if it is no longer needed
diff --git a/include/net/tcp.h b/include/net/tcp.h
index cf0694d4ad60..5bba80fbd1d9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -179,7 +179,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
179#define TCPOPT_SACK 5 /* SACK Block */ 179#define TCPOPT_SACK 5 /* SACK Block */
180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
182#define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */
183#define TCPOPT_EXP 254 /* Experimental */ 182#define TCPOPT_EXP 254 /* Experimental */
184/* Magic number to be after the option value for sharing TCP 183/* Magic number to be after the option value for sharing TCP
185 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt 184 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt
@@ -273,7 +272,6 @@ extern int sysctl_tcp_app_win;
273extern int sysctl_tcp_adv_win_scale; 272extern int sysctl_tcp_adv_win_scale;
274extern int sysctl_tcp_tw_reuse; 273extern int sysctl_tcp_tw_reuse;
275extern int sysctl_tcp_frto; 274extern int sysctl_tcp_frto;
276extern int sysctl_tcp_frto_response;
277extern int sysctl_tcp_low_latency; 275extern int sysctl_tcp_low_latency;
278extern int sysctl_tcp_dma_copybreak; 276extern int sysctl_tcp_dma_copybreak;
279extern int sysctl_tcp_nometrics_save; 277extern int sysctl_tcp_nometrics_save;
@@ -284,7 +282,6 @@ extern int sysctl_tcp_base_mss;
284extern int sysctl_tcp_workaround_signed_windows; 282extern int sysctl_tcp_workaround_signed_windows;
285extern int sysctl_tcp_slow_start_after_idle; 283extern int sysctl_tcp_slow_start_after_idle;
286extern int sysctl_tcp_max_ssthresh; 284extern int sysctl_tcp_max_ssthresh;
287extern int sysctl_tcp_cookie_size;
288extern int sysctl_tcp_thin_linear_timeouts; 285extern int sysctl_tcp_thin_linear_timeouts;
289extern int sysctl_tcp_thin_dupack; 286extern int sysctl_tcp_thin_dupack;
290extern int sysctl_tcp_early_retrans; 287extern int sysctl_tcp_early_retrans;
@@ -373,6 +370,7 @@ extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
373extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 370extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,
374 size_t size, int flags); 371 size_t size, int flags);
375extern void tcp_release_cb(struct sock *sk); 372extern void tcp_release_cb(struct sock *sk);
373extern void tcp_wfree(struct sk_buff *skb);
376extern void tcp_write_timer_handler(struct sock *sk); 374extern void tcp_write_timer_handler(struct sock *sk);
377extern void tcp_delack_timer_handler(struct sock *sk); 375extern void tcp_delack_timer_handler(struct sock *sk);
378extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 376extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
@@ -425,8 +423,6 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
425 bool fastopen); 423 bool fastopen);
426extern int tcp_child_process(struct sock *parent, struct sock *child, 424extern int tcp_child_process(struct sock *parent, struct sock *child,
427 struct sk_buff *skb); 425 struct sk_buff *skb);
428extern bool tcp_use_frto(struct sock *sk);
429extern void tcp_enter_frto(struct sock *sk);
430extern void tcp_enter_loss(struct sock *sk, int how); 426extern void tcp_enter_loss(struct sock *sk, int how);
431extern void tcp_clear_retrans(struct tcp_sock *tp); 427extern void tcp_clear_retrans(struct tcp_sock *tp);
432extern void tcp_update_metrics(struct sock *sk); 428extern void tcp_update_metrics(struct sock *sk);
@@ -454,7 +450,7 @@ extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
454extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 450extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
455 size_t len, int nonblock, int flags, int *addr_len); 451 size_t len, int nonblock, int flags, int *addr_len);
456extern void tcp_parse_options(const struct sk_buff *skb, 452extern void tcp_parse_options(const struct sk_buff *skb,
457 struct tcp_options_received *opt_rx, const u8 **hvpp, 453 struct tcp_options_received *opt_rx,
458 int estab, struct tcp_fastopen_cookie *foc); 454 int estab, struct tcp_fastopen_cookie *foc);
459extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); 455extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
460 456
@@ -476,7 +472,6 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
476extern int tcp_connect(struct sock *sk); 472extern int tcp_connect(struct sock *sk);
477extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 473extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
478 struct request_sock *req, 474 struct request_sock *req,
479 struct request_values *rvp,
480 struct tcp_fastopen_cookie *foc); 475 struct tcp_fastopen_cookie *foc);
481extern int tcp_disconnect(struct sock *sk, int flags); 476extern int tcp_disconnect(struct sock *sk, int flags);
482 477
@@ -543,6 +538,8 @@ extern bool tcp_syn_flood_action(struct sock *sk,
543extern void tcp_push_one(struct sock *, unsigned int mss_now); 538extern void tcp_push_one(struct sock *, unsigned int mss_now);
544extern void tcp_send_ack(struct sock *sk); 539extern void tcp_send_ack(struct sock *sk);
545extern void tcp_send_delayed_ack(struct sock *sk); 540extern void tcp_send_delayed_ack(struct sock *sk);
541extern void tcp_send_loss_probe(struct sock *sk);
542extern bool tcp_schedule_loss_probe(struct sock *sk);
546 543
547/* tcp_input.c */ 544/* tcp_input.c */
548extern void tcp_cwnd_application_limited(struct sock *sk); 545extern void tcp_cwnd_application_limited(struct sock *sk);
@@ -756,7 +753,6 @@ enum tcp_ca_event {
756 CA_EVENT_TX_START, /* first transmit when no packets in flight */ 753 CA_EVENT_TX_START, /* first transmit when no packets in flight */
757 CA_EVENT_CWND_RESTART, /* congestion window restart */ 754 CA_EVENT_CWND_RESTART, /* congestion window restart */
758 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ 755 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */
759 CA_EVENT_FRTO, /* fast recovery timeout */
760 CA_EVENT_LOSS, /* loss timeout */ 756 CA_EVENT_LOSS, /* loss timeout */
761 CA_EVENT_FAST_ACK, /* in sequence ack */ 757 CA_EVENT_FAST_ACK, /* in sequence ack */
762 CA_EVENT_SLOW_ACK, /* other ack */ 758 CA_EVENT_SLOW_ACK, /* other ack */
@@ -873,8 +869,8 @@ static inline void tcp_enable_fack(struct tcp_sock *tp)
873static inline void tcp_enable_early_retrans(struct tcp_sock *tp) 869static inline void tcp_enable_early_retrans(struct tcp_sock *tp)
874{ 870{
875 tp->do_early_retrans = sysctl_tcp_early_retrans && 871 tp->do_early_retrans = sysctl_tcp_early_retrans &&
876 !sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3; 872 sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack &&
877 tp->early_retrans_delayed = 0; 873 sysctl_tcp_reordering == 3;
878} 874}
879 875
880static inline void tcp_disable_early_retrans(struct tcp_sock *tp) 876static inline void tcp_disable_early_retrans(struct tcp_sock *tp)
@@ -1030,50 +1026,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1030#endif 1026#endif
1031} 1027}
1032 1028
1033/* Packet is added to VJ-style prequeue for processing in process 1029extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
1034 * context, if a reader task is waiting. Apparently, this exciting
1035 * idea (VJ's mail "Re: query about TCP header on tcp-ip" of 07 Sep 93)
1036 * failed somewhere. Latency? Burstiness? Well, at least now we will
1037 * see, why it failed. 8)8) --ANK
1038 *
1039 * NOTE: is this not too big to inline?
1040 */
1041static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
1042{
1043 struct tcp_sock *tp = tcp_sk(sk);
1044
1045 if (sysctl_tcp_low_latency || !tp->ucopy.task)
1046 return false;
1047
1048 if (skb->len <= tcp_hdrlen(skb) &&
1049 skb_queue_len(&tp->ucopy.prequeue) == 0)
1050 return false;
1051
1052 __skb_queue_tail(&tp->ucopy.prequeue, skb);
1053 tp->ucopy.memory += skb->truesize;
1054 if (tp->ucopy.memory > sk->sk_rcvbuf) {
1055 struct sk_buff *skb1;
1056
1057 BUG_ON(sock_owned_by_user(sk));
1058
1059 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
1060 sk_backlog_rcv(sk, skb1);
1061 NET_INC_STATS_BH(sock_net(sk),
1062 LINUX_MIB_TCPPREQUEUEDROPPED);
1063 }
1064
1065 tp->ucopy.memory = 0;
1066 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
1067 wake_up_interruptible_sync_poll(sk_sleep(sk),
1068 POLLIN | POLLRDNORM | POLLRDBAND);
1069 if (!inet_csk_ack_scheduled(sk))
1070 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
1071 (3 * tcp_rto_min(sk)) / 4,
1072 TCP_RTO_MAX);
1073 }
1074 return true;
1075}
1076
1077 1030
1078#undef STATE_TRACE 1031#undef STATE_TRACE
1079 1032
@@ -1630,91 +1583,6 @@ struct tcp_request_sock_ops {
1630#endif 1583#endif
1631}; 1584};
1632 1585
1633/* Using SHA1 for now, define some constants.
1634 */
1635#define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS)
1636#define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4)
1637#define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS)
1638
1639extern int tcp_cookie_generator(u32 *bakery);
1640
1641/**
1642 * struct tcp_cookie_values - each socket needs extra space for the
1643 * cookies, together with (optional) space for any SYN data.
1644 *
1645 * A tcp_sock contains a pointer to the current value, and this is
1646 * cloned to the tcp_timewait_sock.
1647 *
1648 * @cookie_pair: variable data from the option exchange.
1649 *
1650 * @cookie_desired: user specified tcpct_cookie_desired. Zero
1651 * indicates default (sysctl_tcp_cookie_size).
1652 * After cookie sent, remembers size of cookie.
1653 * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX.
1654 *
1655 * @s_data_desired: user specified tcpct_s_data_desired. When the
1656 * constant payload is specified (@s_data_constant),
1657 * holds its length instead.
1658 * Range 0 to TCP_MSS_DESIRED.
1659 *
1660 * @s_data_payload: constant data that is to be included in the
1661 * payload of SYN or SYNACK segments when the
1662 * cookie option is present.
1663 */
1664struct tcp_cookie_values {
1665 struct kref kref;
1666 u8 cookie_pair[TCP_COOKIE_PAIR_SIZE];
1667 u8 cookie_pair_size;
1668 u8 cookie_desired;
1669 u16 s_data_desired:11,
1670 s_data_constant:1,
1671 s_data_in:1,
1672 s_data_out:1,
1673 s_data_unused:2;
1674 u8 s_data_payload[0];
1675};
1676
1677static inline void tcp_cookie_values_release(struct kref *kref)
1678{
1679 kfree(container_of(kref, struct tcp_cookie_values, kref));
1680}
1681
1682/* The length of constant payload data. Note that s_data_desired is
1683 * overloaded, depending on s_data_constant: either the length of constant
1684 * data (returned here) or the limit on variable data.
1685 */
1686static inline int tcp_s_data_size(const struct tcp_sock *tp)
1687{
1688 return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant)
1689 ? tp->cookie_values->s_data_desired
1690 : 0;
1691}
1692
1693/**
1694 * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace.
1695 *
1696 * As tcp_request_sock has already been extended in other places, the
1697 * only remaining method is to pass stack values along as function
1698 * parameters. These parameters are not needed after sending SYNACK.
1699 *
1700 * @cookie_bakery: cryptographic secret and message workspace.
1701 *
1702 * @cookie_plus: bytes in authenticator/cookie option, copied from
1703 * struct tcp_options_received (above).
1704 */
1705struct tcp_extend_values {
1706 struct request_values rv;
1707 u32 cookie_bakery[COOKIE_WORKSPACE_WORDS];
1708 u8 cookie_plus:6,
1709 cookie_out_never:1,
1710 cookie_in_always:1;
1711};
1712
1713static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp)
1714{
1715 return (struct tcp_extend_values *)rvp;
1716}
1717
1718extern void tcp_v4_init(void); 1586extern void tcp_v4_init(void);
1719extern void tcp_init(void); 1587extern void tcp_init(void);
1720 1588
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 24c8886fd969..ae16531d0d35 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -162,6 +162,7 @@ struct xfrm_state {
162 xfrm_address_t saddr; 162 xfrm_address_t saddr;
163 int header_len; 163 int header_len;
164 int trailer_len; 164 int trailer_len;
165 u32 extra_flags;
165 } props; 166 } props;
166 167
167 struct xfrm_lifetime_cfg lft; 168 struct xfrm_lifetime_cfg lft;
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 3bbbd78e1439..2d56e428506c 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -65,6 +65,18 @@ struct pcmcia_driver {
65int pcmcia_register_driver(struct pcmcia_driver *driver); 65int pcmcia_register_driver(struct pcmcia_driver *driver);
66void pcmcia_unregister_driver(struct pcmcia_driver *driver); 66void pcmcia_unregister_driver(struct pcmcia_driver *driver);
67 67
68/**
69 * module_pcmcia_driver() - Helper macro for registering a pcmcia driver
70 * @__pcmcia_driver: pcmcia_driver struct
71 *
72 * Helper macro for pcmcia drivers which do not do anything special in module
73 * init/exit. This eliminates a lot of boilerplate. Each module may only use
74 * this macro once, and calling it replaces module_init() and module_exit().
75 */
76#define module_pcmcia_driver(__pcmcia_driver) \
77 module_driver(__pcmcia_driver, pcmcia_register_driver, \
78 pcmcia_unregister_driver)
79
68/* for struct resource * array embedded in struct pcmcia_device */ 80/* for struct resource * array embedded in struct pcmcia_device */
69enum { 81enum {
70 PCMCIA_IOPORT_0, 82 PCMCIA_IOPORT_0,
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
deleted file mode 100644
index 562ff9d591b8..000000000000
--- a/include/scsi/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += fc/
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 917741bb8e11..fe7f06c86f68 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -63,6 +63,12 @@ enum iscsi_uevent_e {
63 ISCSI_UEVENT_PING = UEVENT_BASE + 22, 63 ISCSI_UEVENT_PING = UEVENT_BASE + 22,
64 ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23, 64 ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23,
65 ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24, 65 ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24,
66 ISCSI_UEVENT_SET_FLASHNODE_PARAMS = UEVENT_BASE + 25,
67 ISCSI_UEVENT_NEW_FLASHNODE = UEVENT_BASE + 26,
68 ISCSI_UEVENT_DEL_FLASHNODE = UEVENT_BASE + 27,
69 ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28,
70 ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29,
71 ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30,
66 72
67 /* up events */ 73 /* up events */
68 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 74 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -210,6 +216,31 @@ struct iscsi_uevent {
210 uint32_t host_no; 216 uint32_t host_no;
211 uint16_t chap_tbl_idx; 217 uint16_t chap_tbl_idx;
212 } delete_chap; 218 } delete_chap;
219 struct msg_set_flashnode_param {
220 uint32_t host_no;
221 uint32_t flashnode_idx;
222 uint32_t count;
223 } set_flashnode;
224 struct msg_new_flashnode {
225 uint32_t host_no;
226 uint32_t len;
227 } new_flashnode;
228 struct msg_del_flashnode {
229 uint32_t host_no;
230 uint32_t flashnode_idx;
231 } del_flashnode;
232 struct msg_login_flashnode {
233 uint32_t host_no;
234 uint32_t flashnode_idx;
235 } login_flashnode;
236 struct msg_logout_flashnode {
237 uint32_t host_no;
238 uint32_t flashnode_idx;
239 } logout_flashnode;
240 struct msg_logout_flashnode_sid {
241 uint32_t host_no;
242 uint32_t sid;
243 } logout_flashnode_sid;
213 } u; 244 } u;
214 union { 245 union {
215 /* messages k -> u */ 246 /* messages k -> u */
@@ -267,6 +298,9 @@ struct iscsi_uevent {
267 with each ping request */ 298 with each ping request */
268 uint32_t data_size; 299 uint32_t data_size;
269 } ping_comp; 300 } ping_comp;
301 struct msg_new_flashnode_ret {
302 uint32_t flashnode_idx;
303 } new_flashnode_ret;
270 } r; 304 } r;
271} __attribute__ ((aligned (sizeof(uint64_t)))); 305} __attribute__ ((aligned (sizeof(uint64_t))));
272 306
@@ -274,6 +308,7 @@ enum iscsi_param_type {
274 ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */ 308 ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */
275 ISCSI_HOST_PARAM, /* iscsi_host_param */ 309 ISCSI_HOST_PARAM, /* iscsi_host_param */
276 ISCSI_NET_PARAM, /* iscsi_net_param */ 310 ISCSI_NET_PARAM, /* iscsi_net_param */
311 ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */
277}; 312};
278 313
279struct iscsi_iface_param_info { 314struct iscsi_iface_param_info {
@@ -469,6 +504,88 @@ enum iscsi_host_param {
469 ISCSI_HOST_PARAM_MAX, 504 ISCSI_HOST_PARAM_MAX,
470}; 505};
471 506
507/* portal type */
508#define PORTAL_TYPE_IPV4 "ipv4"
509#define PORTAL_TYPE_IPV6 "ipv6"
510
511/* iSCSI Flash Target params */
512enum iscsi_flashnode_param {
513 ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6,
514 ISCSI_FLASHNODE_PORTAL_TYPE,
515 ISCSI_FLASHNODE_AUTO_SND_TGT_DISABLE,
516 ISCSI_FLASHNODE_DISCOVERY_SESS,
517 ISCSI_FLASHNODE_ENTRY_EN,
518 ISCSI_FLASHNODE_HDR_DGST_EN,
519 ISCSI_FLASHNODE_DATA_DGST_EN,
520 ISCSI_FLASHNODE_IMM_DATA_EN,
521 ISCSI_FLASHNODE_INITIAL_R2T_EN,
522 ISCSI_FLASHNODE_DATASEQ_INORDER,
523 ISCSI_FLASHNODE_PDU_INORDER,
524 ISCSI_FLASHNODE_CHAP_AUTH_EN,
525 ISCSI_FLASHNODE_SNACK_REQ_EN,
526 ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN,
527 ISCSI_FLASHNODE_BIDI_CHAP_EN,
528 /* make authentication for discovery sessions optional */
529 ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL,
530 ISCSI_FLASHNODE_ERL,
531 ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT,
532 ISCSI_FLASHNODE_TCP_NAGLE_DISABLE,
533 ISCSI_FLASHNODE_TCP_WSF_DISABLE,
534 ISCSI_FLASHNODE_TCP_TIMER_SCALE,
535 ISCSI_FLASHNODE_TCP_TIMESTAMP_EN,
536 ISCSI_FLASHNODE_IP_FRAG_DISABLE,
537 ISCSI_FLASHNODE_MAX_RECV_DLENGTH,
538 ISCSI_FLASHNODE_MAX_XMIT_DLENGTH,
539 ISCSI_FLASHNODE_FIRST_BURST,
540 ISCSI_FLASHNODE_DEF_TIME2WAIT,
541 ISCSI_FLASHNODE_DEF_TIME2RETAIN,
542 ISCSI_FLASHNODE_MAX_R2T,
543 ISCSI_FLASHNODE_KEEPALIVE_TMO,
544 ISCSI_FLASHNODE_ISID,
545 ISCSI_FLASHNODE_TSID,
546 ISCSI_FLASHNODE_PORT,
547 ISCSI_FLASHNODE_MAX_BURST,
548 ISCSI_FLASHNODE_DEF_TASKMGMT_TMO,
549 ISCSI_FLASHNODE_IPADDR,
550 ISCSI_FLASHNODE_ALIAS,
551 ISCSI_FLASHNODE_REDIRECT_IPADDR,
552 ISCSI_FLASHNODE_MAX_SEGMENT_SIZE,
553 ISCSI_FLASHNODE_LOCAL_PORT,
554 ISCSI_FLASHNODE_IPV4_TOS,
555 ISCSI_FLASHNODE_IPV6_TC,
556 ISCSI_FLASHNODE_IPV6_FLOW_LABEL,
557 ISCSI_FLASHNODE_NAME,
558 ISCSI_FLASHNODE_TPGT,
559 ISCSI_FLASHNODE_LINK_LOCAL_IPV6,
560 ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX,
561 ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE,
562 ISCSI_FLASHNODE_TCP_XMIT_WSF,
563 ISCSI_FLASHNODE_TCP_RECV_WSF,
564 ISCSI_FLASHNODE_CHAP_IN_IDX,
565 ISCSI_FLASHNODE_CHAP_OUT_IDX,
566 ISCSI_FLASHNODE_USERNAME,
567 ISCSI_FLASHNODE_USERNAME_IN,
568 ISCSI_FLASHNODE_PASSWORD,
569 ISCSI_FLASHNODE_PASSWORD_IN,
570 ISCSI_FLASHNODE_STATSN,
571 ISCSI_FLASHNODE_EXP_STATSN,
572 ISCSI_FLASHNODE_IS_BOOT_TGT,
573
574 ISCSI_FLASHNODE_MAX,
575};
576
577struct iscsi_flashnode_param_info {
578 uint32_t len; /* Actual length of the param */
579 uint16_t param; /* iscsi param value */
580 uint8_t value[0]; /* length sized value follows */
581} __packed;
582
583enum iscsi_discovery_parent_type {
584 ISCSI_DISC_PARENT_UNKNOWN = 0x1,
585 ISCSI_DISC_PARENT_SENDTGT = 0x2,
586 ISCSI_DISC_PARENT_ISNS = 0x3,
587};
588
472/* iSCSI port Speed */ 589/* iSCSI port Speed */
473enum iscsi_port_speed { 590enum iscsi_port_speed {
474 ISCSI_PORT_SPEED_UNKNOWN = 0x1, 591 ISCSI_PORT_SPEED_UNKNOWN = 0x1,
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 6e33386a3898..09c041e6c35f 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -427,6 +427,7 @@ extern void iscsi_complete_scsi_task(struct iscsi_task *task,
427 */ 427 */
428extern void iscsi_pool_free(struct iscsi_pool *); 428extern void iscsi_pool_free(struct iscsi_pool *);
429extern int iscsi_pool_init(struct iscsi_pool *, int, void ***, int); 429extern int iscsi_pool_init(struct iscsi_pool *, int, void ***, int);
430extern int iscsi_switch_str_param(char **, char *);
430 431
431/* 432/*
432 * inline functions to deal with padding. 433 * inline functions to deal with padding.
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index ef937b56f9b5..e2c1e66d58ae 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -118,7 +118,7 @@ struct ex_phy {
118 118
119 enum ex_phy_state phy_state; 119 enum ex_phy_state phy_state;
120 120
121 enum sas_dev_type attached_dev_type; 121 enum sas_device_type attached_dev_type;
122 enum sas_linkrate linkrate; 122 enum sas_linkrate linkrate;
123 123
124 u8 attached_sata_host:1; 124 u8 attached_sata_host:1;
@@ -195,7 +195,7 @@ enum {
195 195
196struct domain_device { 196struct domain_device {
197 spinlock_t done_lock; 197 spinlock_t done_lock;
198 enum sas_dev_type dev_type; 198 enum sas_device_type dev_type;
199 199
200 enum sas_linkrate linkrate; 200 enum sas_linkrate linkrate;
201 enum sas_linkrate min_linkrate; 201 enum sas_linkrate min_linkrate;
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index a6026da25f3e..25ac6283b9c7 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -107,7 +107,7 @@ enum osd_attributes_mode {
107 * int exponent: 04; 107 * int exponent: 04;
108 * } 108 * }
109 */ 109 */
110typedef __be32 __bitwise osd_cdb_offset; 110typedef __be32 osd_cdb_offset;
111 111
112enum { 112enum {
113 OSD_OFFSET_UNUSED = 0xFFFFFFFF, 113 OSD_OFFSET_UNUSED = 0xFFFFFFFF,
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index be3eb0bf1ac0..0d2607d12387 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -90,16 +90,18 @@ enum sas_oob_mode {
90}; 90};
91 91
92/* See sas_discover.c if you plan on changing these */ 92/* See sas_discover.c if you plan on changing these */
93enum sas_dev_type { 93enum sas_device_type {
94 NO_DEVICE = 0, /* protocol */ 94 /* these are SAS protocol defined (attached device type field) */
95 SAS_END_DEV = 1, /* protocol */ 95 SAS_PHY_UNUSED = 0,
96 EDGE_DEV = 2, /* protocol */ 96 SAS_END_DEVICE = 1,
97 FANOUT_DEV = 3, /* protocol */ 97 SAS_EDGE_EXPANDER_DEVICE = 2,
98 SAS_HA = 4, 98 SAS_FANOUT_EXPANDER_DEVICE = 3,
99 SATA_DEV = 5, 99 /* these are internal to libsas */
100 SATA_PM = 7, 100 SAS_HA = 4,
101 SATA_PM_PORT= 8, 101 SAS_SATA_DEV = 5,
102 SATA_PENDING = 9, 102 SAS_SATA_PM = 7,
103 SAS_SATA_PM_PORT = 8,
104 SAS_SATA_PENDING = 9,
103}; 105};
104 106
105enum sas_protocol { 107enum sas_protocol {
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index ff71a5654684..00f41aeeecf5 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -32,8 +32,8 @@
32 32
33static inline int dev_is_sata(struct domain_device *dev) 33static inline int dev_is_sata(struct domain_device *dev)
34{ 34{
35 return dev->dev_type == SATA_DEV || dev->dev_type == SATA_PM || 35 return dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM ||
36 dev->dev_type == SATA_PM_PORT || dev->dev_type == SATA_PENDING; 36 dev->dev_type == SAS_SATA_PM_PORT || dev->dev_type == SAS_SATA_PENDING;
37} 37}
38 38
39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); 39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index a7f9cba275e9..cc645876d147 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -394,10 +394,18 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
394 int data_direction, void *buffer, unsigned bufflen, 394 int data_direction, void *buffer, unsigned bufflen,
395 unsigned char *sense, int timeout, int retries, 395 unsigned char *sense, int timeout, int retries,
396 int flag, int *resid); 396 int flag, int *resid);
397extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, 397extern int scsi_execute_req_flags(struct scsi_device *sdev,
398 int data_direction, void *buffer, unsigned bufflen, 398 const unsigned char *cmd, int data_direction, void *buffer,
399 struct scsi_sense_hdr *, int timeout, int retries, 399 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,
400 int *resid); 400 int retries, int *resid, int flags);
401static inline int scsi_execute_req(struct scsi_device *sdev,
402 const unsigned char *cmd, int data_direction, void *buffer,
403 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,
404 int retries, int *resid)
405{
406 return scsi_execute_req_flags(sdev, cmd, data_direction, buffer,
407 bufflen, sshdr, timeout, retries, resid, 0);
408}
401extern void sdev_disable_disk_events(struct scsi_device *sdev); 409extern void sdev_disable_disk_events(struct scsi_device *sdev);
402extern void sdev_enable_disk_events(struct scsi_device *sdev); 410extern void sdev_enable_disk_events(struct scsi_device *sdev);
403 411
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 2b6956e9853d..755243572219 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -6,6 +6,7 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/mutex.h> 8#include <linux/mutex.h>
9#include <linux/seq_file.h>
9#include <scsi/scsi.h> 10#include <scsi/scsi.h>
10 11
11struct request_queue; 12struct request_queue;
@@ -340,7 +341,8 @@ struct scsi_host_template {
340 * 341 *
341 * Status: OBSOLETE 342 * Status: OBSOLETE
342 */ 343 */
343 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); 344 int (*show_info)(struct seq_file *, struct Scsi_Host *);
345 int (*write_info)(struct Scsi_Host *, char *, int);
344 346
345 /* 347 /*
346 * This is an optional routine that allows the transport to become 348 * This is an optional routine that allows the transport to become
@@ -375,7 +377,7 @@ struct scsi_host_template {
375 377
376 /* 378 /*
377 * Used to store the procfs directory if a driver implements the 379 * Used to store the procfs directory if a driver implements the
378 * proc_info method. 380 * show_info method.
379 */ 381 */
380 struct proc_dir_entry *proc_dir; 382 struct proc_dir_entry *proc_dir;
381 383
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 53f0b361d668..d0f1602985e7 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -39,6 +39,8 @@ struct iscsi_task;
39struct sockaddr; 39struct sockaddr;
40struct iscsi_iface; 40struct iscsi_iface;
41struct bsg_job; 41struct bsg_job;
42struct iscsi_bus_flash_session;
43struct iscsi_bus_flash_conn;
42 44
43/** 45/**
44 * struct iscsi_transport - iSCSI Transport template 46 * struct iscsi_transport - iSCSI Transport template
@@ -150,6 +152,19 @@ struct iscsi_transport {
150 int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx, 152 int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx,
151 uint32_t *num_entries, char *buf); 153 uint32_t *num_entries, char *buf);
152 int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx); 154 int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx);
155 int (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess,
156 int param, char *buf);
157 int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess,
158 struct iscsi_bus_flash_conn *fnode_conn,
159 void *data, int len);
160 int (*new_flashnode) (struct Scsi_Host *shost, const char *buf,
161 int len);
162 int (*del_flashnode) (struct iscsi_bus_flash_session *fnode_sess);
163 int (*login_flashnode) (struct iscsi_bus_flash_session *fnode_sess,
164 struct iscsi_bus_flash_conn *fnode_conn);
165 int (*logout_flashnode) (struct iscsi_bus_flash_session *fnode_sess,
166 struct iscsi_bus_flash_conn *fnode_conn);
167 int (*logout_flashnode_sid) (struct iscsi_cls_session *cls_sess);
153}; 168};
154 169
155/* 170/*
@@ -286,6 +301,112 @@ struct iscsi_iface {
286#define iscsi_iface_to_shost(_iface) \ 301#define iscsi_iface_to_shost(_iface) \
287 dev_to_shost(_iface->dev.parent) 302 dev_to_shost(_iface->dev.parent)
288 303
304
305struct iscsi_bus_flash_conn {
306 struct list_head conn_list; /* item in connlist */
307 void *dd_data; /* LLD private data */
308 struct iscsi_transport *transport;
309 struct device dev; /* sysfs transport/container device */
310 /* iscsi connection parameters */
311 uint32_t exp_statsn;
312 uint32_t statsn;
313 unsigned max_recv_dlength; /* initiator_max_recv_dsl*/
314 unsigned max_xmit_dlength; /* target_max_recv_dsl */
315 unsigned max_segment_size;
316 unsigned tcp_xmit_wsf;
317 unsigned tcp_recv_wsf;
318 int hdrdgst_en;
319 int datadgst_en;
320 int port;
321 char *ipaddress;
322 char *link_local_ipv6_addr;
323 char *redirect_ipaddr;
324 uint16_t keepalive_timeout;
325 uint16_t local_port;
326 uint8_t snack_req_en;
327 /* tcp timestamp negotiation status */
328 uint8_t tcp_timestamp_stat;
329 uint8_t tcp_nagle_disable;
330 /* tcp window scale factor */
331 uint8_t tcp_wsf_disable;
332 uint8_t tcp_timer_scale;
333 uint8_t tcp_timestamp_en;
334 uint8_t ipv4_tos;
335 uint8_t ipv6_traffic_class;
336 uint8_t ipv6_flow_label;
337 uint8_t fragment_disable;
338 /* Link local IPv6 address is assigned by firmware or driver */
339 uint8_t is_fw_assigned_ipv6;
340};
341
342#define iscsi_dev_to_flash_conn(_dev) \
343 container_of(_dev, struct iscsi_bus_flash_conn, dev)
344
345#define iscsi_flash_conn_to_flash_session(_conn) \
346 iscsi_dev_to_flash_session(_conn->dev.parent)
347
348#define ISID_SIZE 6
349
350struct iscsi_bus_flash_session {
351 struct list_head sess_list; /* item in session_list */
352 struct iscsi_transport *transport;
353 unsigned int target_id;
354 int flash_state; /* persistent or non-persistent */
355 void *dd_data; /* LLD private data */
356 struct device dev; /* sysfs transport/container device */
357 /* iscsi session parameters */
358 unsigned first_burst;
359 unsigned max_burst;
360 unsigned short max_r2t;
361 int default_taskmgmt_timeout;
362 int initial_r2t_en;
363 int imm_data_en;
364 int time2wait;
365 int time2retain;
366 int pdu_inorder_en;
367 int dataseq_inorder_en;
368 int erl;
369 int tpgt;
370 char *username;
371 char *username_in;
372 char *password;
373 char *password_in;
374 char *targetname;
375 char *targetalias;
376 char *portal_type;
377 uint16_t tsid;
378 uint16_t chap_in_idx;
379 uint16_t chap_out_idx;
380 /* index of iSCSI discovery session if the entry is
381 * discovered by iSCSI discovery session
382 */
383 uint16_t discovery_parent_idx;
384 /* indicates if discovery was done through iSNS discovery service
385 * or through sendTarget */
386 uint16_t discovery_parent_type;
387 /* Firmware auto sendtarget discovery disable */
388 uint8_t auto_snd_tgt_disable;
389 uint8_t discovery_sess;
390 /* indicates if this flashnode entry is enabled or disabled */
391 uint8_t entry_state;
392 uint8_t chap_auth_en;
393 /* enables firmware to auto logout the discovery session on discovery
394 * completion
395 */
396 uint8_t discovery_logout_en;
397 uint8_t bidi_chap_en;
398 /* makes authentication for discovery session optional */
399 uint8_t discovery_auth_optional;
400 uint8_t isid[ISID_SIZE];
401 uint8_t is_boot_target;
402};
403
404#define iscsi_dev_to_flash_session(_dev) \
405 container_of(_dev, struct iscsi_bus_flash_session, dev)
406
407#define iscsi_flash_session_to_shost(_session) \
408 dev_to_shost(_session->dev.parent)
409
289/* 410/*
290 * session and connection functions that can be used by HW iSCSI LLDs 411 * session and connection functions that can be used by HW iSCSI LLDs
291 */ 412 */
@@ -330,4 +451,30 @@ extern char *iscsi_get_port_speed_name(struct Scsi_Host *shost);
330extern char *iscsi_get_port_state_name(struct Scsi_Host *shost); 451extern char *iscsi_get_port_state_name(struct Scsi_Host *shost);
331extern int iscsi_is_session_dev(const struct device *dev); 452extern int iscsi_is_session_dev(const struct device *dev);
332 453
454extern char *iscsi_get_discovery_parent_name(int parent_type);
455extern struct device *
456iscsi_find_flashnode(struct Scsi_Host *shost, void *data,
457 int (*fn)(struct device *dev, void *data));
458
459extern struct iscsi_bus_flash_session *
460iscsi_create_flashnode_sess(struct Scsi_Host *shost, int index,
461 struct iscsi_transport *transport, int dd_size);
462
463extern struct iscsi_bus_flash_conn *
464iscsi_create_flashnode_conn(struct Scsi_Host *shost,
465 struct iscsi_bus_flash_session *fnode_sess,
466 struct iscsi_transport *transport, int dd_size);
467
468extern void
469iscsi_destroy_flashnode_sess(struct iscsi_bus_flash_session *fnode_sess);
470
471extern void iscsi_destroy_all_flashnode(struct Scsi_Host *shost);
472extern int iscsi_flashnode_bus_match(struct device *dev,
473 struct device_driver *drv);
474extern struct device *
475iscsi_find_flashnode_sess(struct Scsi_Host *shost, void *data,
476 int (*fn)(struct device *dev, void *data));
477extern struct device *
478iscsi_find_flashnode_conn(struct iscsi_bus_flash_session *fnode_sess);
479
333#endif 480#endif
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 9b8e08879cfc..0bd71e2702e3 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -10,13 +10,6 @@ struct scsi_transport_template;
10struct sas_rphy; 10struct sas_rphy;
11struct request; 11struct request;
12 12
13enum sas_device_type {
14 SAS_PHY_UNUSED = 0,
15 SAS_END_DEVICE = 1,
16 SAS_EDGE_EXPANDER_DEVICE = 2,
17 SAS_FANOUT_EXPANDER_DEVICE = 3,
18};
19
20static inline int sas_protocol_ata(enum sas_protocol proto) 13static inline int sas_protocol_ata(enum sas_protocol proto)
21{ 14{
22 return ((proto & SAS_PROTOCOL_SATA) || 15 return ((proto & SAS_PROTOCOL_SATA) ||
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index ff6c74153fa1..9031a26249b5 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -56,8 +56,6 @@ struct snd_compr_runtime {
56 u64 buffer_size; 56 u64 buffer_size;
57 u32 fragment_size; 57 u32 fragment_size;
58 u32 fragments; 58 u32 fragments;
59 u64 hw_pointer;
60 u64 app_pointer;
61 u64 total_bytes_available; 59 u64 total_bytes_available;
62 u64 total_bytes_transferred; 60 u64 total_bytes_transferred;
63 wait_queue_head_t sleep; 61 wait_queue_head_t sleep;
@@ -121,7 +119,7 @@ struct snd_compr_ops {
121 int (*trigger)(struct snd_compr_stream *stream, int cmd); 119 int (*trigger)(struct snd_compr_stream *stream, int cmd);
122 int (*pointer)(struct snd_compr_stream *stream, 120 int (*pointer)(struct snd_compr_stream *stream,
123 struct snd_compr_tstamp *tstamp); 121 struct snd_compr_tstamp *tstamp);
124 int (*copy)(struct snd_compr_stream *stream, const char __user *buf, 122 int (*copy)(struct snd_compr_stream *stream, char __user *buf,
125 size_t count); 123 size_t count);
126 int (*mmap)(struct snd_compr_stream *stream, 124 int (*mmap)(struct snd_compr_stream *stream,
127 struct vm_area_struct *vma); 125 struct vm_area_struct *vma);
diff --git a/include/sound/control.h b/include/sound/control.h
index 8332e865c759..34bc93d80d55 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -189,7 +189,6 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
189 * 189 *
190 * Add a virtual slave control to the given master element created via 190 * Add a virtual slave control to the given master element created via
191 * snd_ctl_create_virtual_master() beforehand. 191 * snd_ctl_create_virtual_master() beforehand.
192 * Returns zero if successful or a negative error code.
193 * 192 *
194 * All slaves must be the same type (returning the same information 193 * All slaves must be the same type (returning the same information
195 * via info callback). The function doesn't check it, so it's your 194 * via info callback). The function doesn't check it, so it's your
@@ -199,6 +198,8 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
199 * at most two channels, 198 * at most two channels,
200 * logarithmic volume control (dB level) thus no linear volume, 199 * logarithmic volume control (dB level) thus no linear volume,
201 * master can only attenuate the volume without gain 200 * master can only attenuate the volume without gain
201 *
202 * Return: Zero if successful or a negative error code.
202 */ 203 */
203static inline int 204static inline int
204snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) 205snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
@@ -219,6 +220,8 @@ snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
219 * When the control peeks the hardware values directly and the value 220 * When the control peeks the hardware values directly and the value
220 * can be changed by other means than the put callback of the element, 221 * can be changed by other means than the put callback of the element,
221 * this function should be used to keep the value always up-to-date. 222 * this function should be used to keep the value always up-to-date.
223 *
224 * Return: Zero if successful or a negative error code.
222 */ 225 */
223static inline int 226static inline int
224snd_ctl_add_slave_uncached(struct snd_kcontrol *master, 227snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
diff --git a/include/sound/core.h b/include/sound/core.h
index 7cede2d6aa86..5bfe5136441c 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -229,7 +229,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card,
229 * This function uses the card's device pointer to link to the 229 * This function uses the card's device pointer to link to the
230 * correct &struct device. 230 * correct &struct device.
231 * 231 *
232 * Returns zero if successful, or a negative error code on failure. 232 * Return: Zero if successful, or a negative error code on failure.
233 */ 233 */
234static inline int snd_register_device(int type, struct snd_card *card, int dev, 234static inline int snd_register_device(int type, struct snd_card *card, int dev,
235 const struct file_operations *f_ops, 235 const struct file_operations *f_ops,
@@ -379,18 +379,10 @@ void __snd_printk(unsigned int level, const char *file, int line,
379 * snd_BUG_ON - debugging check macro 379 * snd_BUG_ON - debugging check macro
380 * @cond: condition to evaluate 380 * @cond: condition to evaluate
381 * 381 *
382 * When CONFIG_SND_DEBUG is set, this macro evaluates the given condition, 382 * Has the same behavior as WARN_ON when CONFIG_SND_DEBUG is set,
383 * and call WARN() and returns the value if it's non-zero. 383 * otherwise just evaluates the conditional and returns the value.
384 *
385 * When CONFIG_SND_DEBUG is not set, this just returns zero, and the given
386 * condition is ignored.
387 *
388 * NOTE: the argument won't be evaluated at all when CONFIG_SND_DEBUG=n.
389 * Thus, don't put any statement that influences on the code behavior,
390 * such as pre/post increment, to the argument of this macro.
391 * If you want to evaluate and give a warning, use standard WARN_ON().
392 */ 384 */
393#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond)) 385#define snd_BUG_ON(cond) WARN_ON((cond))
394 386
395#else /* !CONFIG_SND_DEBUG */ 387#else /* !CONFIG_SND_DEBUG */
396 388
@@ -400,11 +392,11 @@ __printf(2, 3)
400static inline void _snd_printd(int level, const char *format, ...) {} 392static inline void _snd_printd(int level, const char *format, ...) {}
401 393
402#define snd_BUG() do { } while (0) 394#define snd_BUG() do { } while (0)
403static inline int __snd_bug_on(int cond) 395
404{ 396#define snd_BUG_ON(condition) ({ \
405 return 0; 397 int __ret_warn_on = !!(condition); \
406} 398 unlikely(__ret_warn_on); \
407#define snd_BUG_ON(cond) __snd_bug_on(0 && (cond)) /* always false */ 399})
408 400
409#endif /* CONFIG_SND_DEBUG */ 401#endif /* CONFIG_SND_DEBUG */
410 402
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index b877334bbb0f..f11c35cd5532 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -16,6 +16,7 @@
16#define __SOUND_DMAENGINE_PCM_H__ 16#define __SOUND_DMAENGINE_PCM_H__
17 17
18#include <sound/pcm.h> 18#include <sound/pcm.h>
19#include <sound/soc.h>
19#include <linux/dmaengine.h> 20#include <linux/dmaengine.h>
20 21
21/** 22/**
@@ -32,9 +33,6 @@ snd_pcm_substream_to_dma_direction(const struct snd_pcm_substream *substream)
32 return DMA_DEV_TO_MEM; 33 return DMA_DEV_TO_MEM;
33} 34}
34 35
35void snd_dmaengine_pcm_set_data(struct snd_pcm_substream *substream, void *data);
36void *snd_dmaengine_pcm_get_data(struct snd_pcm_substream *substream);
37
38int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream, 36int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream,
39 const struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config); 37 const struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config);
40int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd); 38int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
@@ -42,9 +40,100 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream)
42snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream *substream); 40snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream *substream);
43 41
44int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream, 42int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
45 dma_filter_fn filter_fn, void *filter_data); 43 struct dma_chan *chan);
46int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream); 44int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
47 45
46int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
47 dma_filter_fn filter_fn, void *filter_data);
48int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream);
49
50struct dma_chan *snd_dmaengine_pcm_request_channel(dma_filter_fn filter_fn,
51 void *filter_data);
48struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream); 52struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream);
49 53
54/**
55 * struct snd_dmaengine_dai_dma_data - DAI DMA configuration data
56 * @addr: Address of the DAI data source or destination register.
57 * @addr_width: Width of the DAI data source or destination register.
58 * @maxburst: Maximum number of words(note: words, as in units of the
59 * src_addr_width member, not bytes) that can be send to or received from the
60 * DAI in one burst.
61 * @slave_id: Slave requester id for the DMA channel.
62 * @filter_data: Custom DMA channel filter data, this will usually be used when
63 * requesting the DMA channel.
64 */
65struct snd_dmaengine_dai_dma_data {
66 dma_addr_t addr;
67 enum dma_slave_buswidth addr_width;
68 u32 maxburst;
69 unsigned int slave_id;
70 void *filter_data;
71};
72
73void snd_dmaengine_pcm_set_config_from_dai_data(
74 const struct snd_pcm_substream *substream,
75 const struct snd_dmaengine_dai_dma_data *dma_data,
76 struct dma_slave_config *config);
77
78
79/*
80 * Try to request the DMA channel using compat_request_channel or
81 * compat_filter_fn if it couldn't be requested through devicetree.
82 */
83#define SND_DMAENGINE_PCM_FLAG_COMPAT BIT(0)
84/*
85 * Don't try to request the DMA channels through devicetree. This flag only
86 * makes sense if SND_DMAENGINE_PCM_FLAG_COMPAT is set as well.
87 */
88#define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1)
89/*
90 * The platforms dmaengine driver does not support reporting the amount of
91 * bytes that are still left to transfer.
92 */
93#define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(2)
94/*
95 * The PCM is half duplex and the DMA channel is shared between capture and
96 * playback.
97 */
98#define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3)
99
100/**
101 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM
102 * @prepare_slave_config: Callback used to fill in the DMA slave_config for a
103 * PCM substream. Will be called from the PCM drivers hwparams callback.
104 * @compat_request_channel: Callback to request a DMA channel for platforms
105 * which do not use devicetree.
106 * @compat_filter_fn: Will be used as the filter function when requesting a
107 * channel for platforms which do not use devicetree. The filter parameter
108 * will be the DAI's DMA data.
109 * @pcm_hardware: snd_pcm_hardware struct to be used for the PCM.
110 * @prealloc_buffer_size: Size of the preallocated audio buffer.
111 *
112 * Note: If both compat_request_channel and compat_filter_fn are set
113 * compat_request_channel will be used to request the channel and
114 * compat_filter_fn will be ignored. Otherwise the channel will be requested
115 * using dma_request_channel with compat_filter_fn as the filter function.
116 */
117struct snd_dmaengine_pcm_config {
118 int (*prepare_slave_config)(struct snd_pcm_substream *substream,
119 struct snd_pcm_hw_params *params,
120 struct dma_slave_config *slave_config);
121 struct dma_chan *(*compat_request_channel)(
122 struct snd_soc_pcm_runtime *rtd,
123 struct snd_pcm_substream *substream);
124 dma_filter_fn compat_filter_fn;
125
126 const struct snd_pcm_hardware *pcm_hardware;
127 unsigned int prealloc_buffer_size;
128};
129
130int snd_dmaengine_pcm_register(struct device *dev,
131 const struct snd_dmaengine_pcm_config *config,
132 unsigned int flags);
133void snd_dmaengine_pcm_unregister(struct device *dev);
134
135int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
136 struct snd_pcm_hw_params *params,
137 struct dma_slave_config *slave_config);
138
50#endif 139#endif
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index f841ba4bacb8..dfb42ca6d043 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1787,6 +1787,7 @@ struct snd_emu10k1 {
1787 unsigned int next_free_voice; 1787 unsigned int next_free_voice;
1788 1788
1789 const struct firmware *firmware; 1789 const struct firmware *firmware;
1790 const struct firmware *dock_fw;
1790 1791
1791#ifdef CONFIG_PM_SLEEP 1792#ifdef CONFIG_PM_SLEEP
1792 unsigned int *saved_ptr; 1793 unsigned int *saved_ptr;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 45c1981c9ca2..b48792fe386b 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -181,6 +181,8 @@ struct snd_pcm_ops {
181#define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B) 181#define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B)
182#define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40) 182#define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40)
183#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) 183#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
184 186
185#ifdef SNDRV_LITTLE_ENDIAN 187#ifdef SNDRV_LITTLE_ENDIAN
186#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 188#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -659,7 +661,7 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime
659 * 661 *
660 * Checks whether enough free space is available on the playback buffer. 662 * Checks whether enough free space is available on the playback buffer.
661 * 663 *
662 * Returns non-zero if available, or zero if not. 664 * Return: Non-zero if available, or zero if not.
663 */ 665 */
664static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream) 666static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
665{ 667{
@@ -673,7 +675,7 @@ static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
673 * 675 *
674 * Checks whether enough capture data is available on the capture buffer. 676 * Checks whether enough capture data is available on the capture buffer.
675 * 677 *
676 * Returns non-zero if available, or zero if not. 678 * Return: Non-zero if available, or zero if not.
677 */ 679 */
678static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream) 680static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
679{ 681{
@@ -685,10 +687,10 @@ static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
685 * snd_pcm_playback_data - check whether any data exists on the playback buffer 687 * snd_pcm_playback_data - check whether any data exists on the playback buffer
686 * @substream: the pcm substream instance 688 * @substream: the pcm substream instance
687 * 689 *
688 * Checks whether any data exists on the playback buffer. If stop_threshold 690 * Checks whether any data exists on the playback buffer.
689 * is bigger or equal to boundary, then this function returns always non-zero.
690 * 691 *
691 * Returns non-zero if exists, or zero if not. 692 * Return: Non-zero if any data exists, or zero if not. If stop_threshold
693 * is bigger or equal to boundary, then this function returns always non-zero.
692 */ 694 */
693static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream) 695static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
694{ 696{
@@ -705,7 +707,7 @@ static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
705 * 707 *
706 * Checks whether the playback buffer is empty. 708 * Checks whether the playback buffer is empty.
707 * 709 *
708 * Returns non-zero if empty, or zero if not. 710 * Return: Non-zero if empty, or zero if not.
709 */ 711 */
710static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream) 712static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
711{ 713{
@@ -719,7 +721,7 @@ static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
719 * 721 *
720 * Checks whether the capture buffer is empty. 722 * Checks whether the capture buffer is empty.
721 * 723 *
722 * Returns non-zero if empty, or zero if not. 724 * Return: Non-zero if empty, or zero if not.
723 */ 725 */
724static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) 726static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
725{ 727{
@@ -852,7 +854,7 @@ int snd_pcm_format_big_endian(snd_pcm_format_t format);
852 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian 854 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
853 * @format: the format to check 855 * @format: the format to check
854 * 856 *
855 * Returns 1 if the given PCM format is CPU-endian, 0 if 857 * Return: 1 if the given PCM format is CPU-endian, 0 if
856 * opposite, or a negative error code if endian not specified. 858 * opposite, or a negative error code if endian not specified.
857 */ 859 */
858int snd_pcm_format_cpu_endian(snd_pcm_format_t format); 860int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
@@ -867,7 +869,7 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
867ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); 869ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
868const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); 870const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);
869int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames);
870snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian);
871 873
872void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); 874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
873void snd_pcm_set_sync(struct snd_pcm_substream *substream); 875void snd_pcm_set_sync(struct snd_pcm_substream *substream);
@@ -963,7 +965,7 @@ struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
963 * contiguous in kernel virtual space, but not in physical memory. Use this 965 * contiguous in kernel virtual space, but not in physical memory. Use this
964 * if the buffer is accessed by kernel code but not by device DMA. 966 * if the buffer is accessed by kernel code but not by device DMA.
965 * 967 *
966 * Returns 1 if the buffer was changed, 0 if not changed, or a negative error 968 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error
967 * code. 969 * code.
968 */ 970 */
969static int snd_pcm_lib_alloc_vmalloc_buffer 971static int snd_pcm_lib_alloc_vmalloc_buffer
@@ -975,6 +977,9 @@ static int snd_pcm_lib_alloc_vmalloc_buffer
975 * 977 *
976 * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses 978 * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses
977 * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. 979 * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory.
980 *
981 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error
982 * code.
978 */ 983 */
979static int snd_pcm_lib_alloc_vmalloc_32_buffer 984static int snd_pcm_lib_alloc_vmalloc_32_buffer
980 (struct snd_pcm_substream *substream, size_t size); 985 (struct snd_pcm_substream *substream, size_t size);
@@ -1070,6 +1075,8 @@ const char *snd_pcm_format_name(snd_pcm_format_t format);
1070/** 1075/**
1071 * snd_pcm_stream_str - Get a string naming the direction of a stream 1076 * snd_pcm_stream_str - Get a string naming the direction of a stream
1072 * @substream: the pcm substream instance 1077 * @substream: the pcm substream instance
1078 *
1079 * Return: A string naming the direction of the stream.
1073 */ 1080 */
1074static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream) 1081static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
1075{ 1082{
@@ -1126,4 +1133,10 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
1126 unsigned long private_value, 1133 unsigned long private_value,
1127 struct snd_pcm_chmap **info_ret); 1134 struct snd_pcm_chmap **info_ret);
1128 1135
1136/* Strong-typed conversion of pcm_format to bitwise */
1137static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
1138{
1139 return 1ULL << (__force int) pcm_format;
1140}
1141
1129#endif /* __SOUND_PCM_H */ 1142#endif /* __SOUND_PCM_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 3d84808952b9..ae9a227d35d3 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -95,14 +95,6 @@ struct snd_soc_dai_driver;
95struct snd_soc_dai; 95struct snd_soc_dai;
96struct snd_ac97_bus_ops; 96struct snd_ac97_bus_ops;
97 97
98/* Digital Audio Interface registration */
99int snd_soc_register_dai(struct device *dev,
100 struct snd_soc_dai_driver *dai_drv);
101void snd_soc_unregister_dai(struct device *dev);
102int snd_soc_register_dais(struct device *dev,
103 struct snd_soc_dai_driver *dai_drv, size_t count);
104void snd_soc_unregister_dais(struct device *dev, size_t count);
105
106/* Digital Audio Interface clocking API.*/ 98/* Digital Audio Interface clocking API.*/
107int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, 99int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
108 unsigned int freq, int dir); 100 unsigned int freq, int dir);
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 44a30b108683..d4609029f014 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -566,7 +566,6 @@ struct snd_soc_dapm_update {
566 566
567/* DAPM context */ 567/* DAPM context */
568struct snd_soc_dapm_context { 568struct snd_soc_dapm_context {
569 int n_widgets; /* number of widgets in this context */
570 enum snd_soc_bias_level bias_level; 569 enum snd_soc_bias_level bias_level;
571 enum snd_soc_bias_level suspend_bias_level; 570 enum snd_soc_bias_level suspend_bias_level;
572 struct delayed_work delayed_work; 571 struct delayed_work delayed_work;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a6a059ca3874..85c15226103b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -324,6 +324,8 @@ struct snd_soc_dai_link;
324struct snd_soc_platform_driver; 324struct snd_soc_platform_driver;
325struct snd_soc_codec; 325struct snd_soc_codec;
326struct snd_soc_codec_driver; 326struct snd_soc_codec_driver;
327struct snd_soc_component;
328struct snd_soc_component_driver;
327struct soc_enum; 329struct soc_enum;
328struct snd_soc_jack; 330struct snd_soc_jack;
329struct snd_soc_jack_zone; 331struct snd_soc_jack_zone;
@@ -371,12 +373,20 @@ int snd_soc_suspend(struct device *dev);
371int snd_soc_resume(struct device *dev); 373int snd_soc_resume(struct device *dev);
372int snd_soc_poweroff(struct device *dev); 374int snd_soc_poweroff(struct device *dev);
373int snd_soc_register_platform(struct device *dev, 375int snd_soc_register_platform(struct device *dev,
374 struct snd_soc_platform_driver *platform_drv); 376 const struct snd_soc_platform_driver *platform_drv);
375void snd_soc_unregister_platform(struct device *dev); 377void snd_soc_unregister_platform(struct device *dev);
378int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
379 const struct snd_soc_platform_driver *platform_drv);
380void snd_soc_remove_platform(struct snd_soc_platform *platform);
381struct snd_soc_platform *snd_soc_lookup_platform(struct device *dev);
376int snd_soc_register_codec(struct device *dev, 382int snd_soc_register_codec(struct device *dev,
377 const struct snd_soc_codec_driver *codec_drv, 383 const struct snd_soc_codec_driver *codec_drv,
378 struct snd_soc_dai_driver *dai_drv, int num_dai); 384 struct snd_soc_dai_driver *dai_drv, int num_dai);
379void snd_soc_unregister_codec(struct device *dev); 385void snd_soc_unregister_codec(struct device *dev);
386int snd_soc_register_component(struct device *dev,
387 const struct snd_soc_component_driver *cmpnt_drv,
388 struct snd_soc_dai_driver *dai_drv, int num_dai);
389void snd_soc_unregister_component(struct device *dev);
380int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, 390int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
381 unsigned int reg); 391 unsigned int reg);
382int snd_soc_codec_readable_register(struct snd_soc_codec *codec, 392int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
@@ -801,10 +811,10 @@ struct snd_soc_platform_driver {
801 struct snd_soc_dai *); 811 struct snd_soc_dai *);
802 812
803 /* platform stream pcm ops */ 813 /* platform stream pcm ops */
804 struct snd_pcm_ops *ops; 814 const struct snd_pcm_ops *ops;
805 815
806 /* platform stream compress ops */ 816 /* platform stream compress ops */
807 struct snd_compr_ops *compr_ops; 817 const struct snd_compr_ops *compr_ops;
808 818
809 /* platform stream completion event */ 819 /* platform stream completion event */
810 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); 820 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
@@ -823,7 +833,7 @@ struct snd_soc_platform {
823 const char *name; 833 const char *name;
824 int id; 834 int id;
825 struct device *dev; 835 struct device *dev;
826 struct snd_soc_platform_driver *driver; 836 const struct snd_soc_platform_driver *driver;
827 struct mutex mutex; 837 struct mutex mutex;
828 838
829 unsigned int suspended:1; /* platform is suspended */ 839 unsigned int suspended:1; /* platform is suspended */
@@ -841,6 +851,20 @@ struct snd_soc_platform {
841#endif 851#endif
842}; 852};
843 853
854struct snd_soc_component_driver {
855 const char *name;
856};
857
858struct snd_soc_component {
859 const char *name;
860 int id;
861 int num_dai;
862 struct device *dev;
863 struct list_head list;
864
865 const struct snd_soc_component_driver *driver;
866};
867
844struct snd_soc_dai_link { 868struct snd_soc_dai_link {
845 /* config - must be set by machine driver */ 869 /* config - must be set by machine driver */
846 const char *name; /* Codec name */ 870 const char *name; /* Codec name */
@@ -1086,7 +1110,6 @@ struct soc_enum {
1086 unsigned int mask; 1110 unsigned int mask;
1087 const char * const *texts; 1111 const char * const *texts;
1088 const unsigned int *values; 1112 const unsigned int *values;
1089 void *dapm;
1090}; 1113};
1091 1114
1092/* codec IO */ 1115/* codec IO */
diff --git a/include/sound/tas5086.h b/include/sound/tas5086.h
new file mode 100644
index 000000000000..aac481b7db8f
--- /dev/null
+++ b/include/sound/tas5086.h
@@ -0,0 +1,7 @@
1#ifndef _SND_SOC_CODEC_TAS5086_H_
2#define _SND_SOC_CODEC_TAS5086_H_
3
4#define TAS5086_CLK_IDX_MCLK 0
5#define TAS5086_CLK_IDX_SCLK 1
6
7#endif /* _SND_SOC_CODEC_TAS5086_H_ */
diff --git a/include/sound/tegra_wm8903.h b/include/sound/tegra_wm8903.h
deleted file mode 100644
index 57b202ee97c3..000000000000
--- a/include/sound/tegra_wm8903.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright 2011 NVIDIA, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef __SOUND_TEGRA_WM38903_H
16#define __SOUND_TEGRA_WM38903_H
17
18struct tegra_wm8903_platform_data {
19 int gpio_spkr_en;
20 int gpio_hp_det;
21 int gpio_hp_mute;
22 int gpio_int_mic_en;
23 int gpio_ext_mic_en;
24};
25
26#endif
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
index 28c65e1ada21..e11e179420a1 100644
--- a/include/sound/tlv.h
+++ b/include/sound/tlv.h
@@ -74,7 +74,11 @@
74#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \ 74#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \
75 unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) } 75 unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) }
76 76
77/* dB range container */ 77/* dB range container:
78 * Items in dB range container must be ordered by their values and by their
79 * dB values. This implies that larger values must correspond with larger
80 * dB values (which is also required for all other mixer controls).
81 */
78/* Each item is: <min> <max> <TLV> */ 82/* Each item is: <min> <max> <TLV> */
79#define TLV_DB_RANGE_ITEM(...) \ 83#define TLV_DB_RANGE_ITEM(...) \
80 TLV_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) 84 TLV_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
new file mode 100644
index 000000000000..23a87d0cd72c
--- /dev/null
+++ b/include/target/iscsi/iscsi_transport.h
@@ -0,0 +1,83 @@
1#include <linux/module.h>
2#include <linux/list.h>
3#include "../../../drivers/target/iscsi/iscsi_target_core.h"
4
5struct iscsit_transport {
6#define ISCSIT_TRANSPORT_NAME 16
7 char name[ISCSIT_TRANSPORT_NAME];
8 int transport_type;
9 struct module *owner;
10 struct list_head t_node;
11 int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *);
12 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *);
13 void (*iscsit_free_np)(struct iscsi_np *);
14 void (*iscsit_free_conn)(struct iscsi_conn *);
15 struct iscsi_cmd *(*iscsit_alloc_cmd)(struct iscsi_conn *, gfp_t);
16 int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *);
17 int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32);
18 int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
19 int (*iscsit_response_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
20 int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool);
21 int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *);
22 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *);
23};
24
25/*
26 * From iscsi_target_transport.c
27 */
28
29extern int iscsit_register_transport(struct iscsit_transport *);
30extern void iscsit_unregister_transport(struct iscsit_transport *);
31extern struct iscsit_transport *iscsit_get_transport(int);
32extern void iscsit_put_transport(struct iscsit_transport *);
33
34/*
35 * From iscsi_target.c
36 */
37extern int iscsit_add_reject_from_cmd(u8, int, int, unsigned char *,
38 struct iscsi_cmd *);
39extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
40 unsigned char *);
41extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
42extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
43 struct iscsi_scsi_req *);
44extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
45 struct iscsi_cmd **);
46extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
47 bool);
48extern int iscsit_handle_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 unsigned char *);
50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
51 unsigned char *);
52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
53 unsigned char *);
54extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
55 bool, struct iscsi_scsi_rsp *);
56extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
57 struct iscsi_nopin *, bool);
58extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
59 struct iscsi_tm_rsp *);
60extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
61 struct iscsi_reject *);
62extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
63 struct iscsi_logout_rsp *);
64extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
65/*
66 * From iscsi_target_device.c
67 */
68extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
69/*
70 * From iscsi_target_erl1.c
71 */
72extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
73
74/*
75 * From iscsi_target_tmr.c
76 */
77extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
78
79/*
80 * From iscsi_target_util.c
81 */
82extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t);
83extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, __be32);
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index b128c20770bc..ffa2696d64dc 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -60,6 +60,10 @@ sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
60u32 sbc_get_device_rev(struct se_device *dev); 60u32 sbc_get_device_rev(struct se_device *dev);
61u32 sbc_get_device_type(struct se_device *dev); 61u32 sbc_get_device_type(struct se_device *dev);
62sector_t sbc_get_write_same_sectors(struct se_cmd *cmd); 62sector_t sbc_get_write_same_sectors(struct se_cmd *cmd);
63sense_reason_t sbc_execute_unmap(struct se_cmd *cmd,
64 sense_reason_t (*do_unmap_fn)(struct se_cmd *cmd, void *priv,
65 sector_t lba, sector_t nolb),
66 void *priv);
63 67
64void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 68void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
65int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 69int 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 c4af592f7057..e773dfa5f98f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -463,7 +463,6 @@ struct se_cmd {
463#define CMD_T_ABORTED (1 << 0) 463#define CMD_T_ABORTED (1 << 0)
464#define CMD_T_ACTIVE (1 << 1) 464#define CMD_T_ACTIVE (1 << 1)
465#define CMD_T_COMPLETE (1 << 2) 465#define CMD_T_COMPLETE (1 << 2)
466#define CMD_T_QUEUED (1 << 3)
467#define CMD_T_SENT (1 << 4) 466#define CMD_T_SENT (1 << 4)
468#define CMD_T_STOP (1 << 5) 467#define CMD_T_STOP (1 << 5)
469#define CMD_T_FAILED (1 << 6) 468#define CMD_T_FAILED (1 << 6)
@@ -572,12 +571,8 @@ struct se_dev_entry {
572 bool def_pr_registered; 571 bool def_pr_registered;
573 /* See transport_lunflags_table */ 572 /* See transport_lunflags_table */
574 u32 lun_flags; 573 u32 lun_flags;
575 u32 deve_cmds;
576 u32 mapped_lun; 574 u32 mapped_lun;
577 u32 average_bytes;
578 u32 last_byte_count;
579 u32 total_cmds; 575 u32 total_cmds;
580 u32 total_bytes;
581 u64 pr_res_key; 576 u64 pr_res_key;
582 u64 creation_time; 577 u64 creation_time;
583 u32 attach_count; 578 u32 attach_count;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index aaa1ee6ab391..ba3471b73c07 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -120,7 +120,7 @@ bool transport_wait_for_tasks(struct se_cmd *);
120int transport_check_aborted_status(struct se_cmd *, int); 120int transport_check_aborted_status(struct se_cmd *, int);
121int transport_send_check_condition_and_sense(struct se_cmd *, 121int transport_send_check_condition_and_sense(struct se_cmd *,
122 sense_reason_t, int); 122 sense_reason_t, int);
123 123int target_get_sess_cmd(struct se_session *, struct se_cmd *, bool);
124int target_put_sess_cmd(struct se_session *, struct se_cmd *); 124int target_put_sess_cmd(struct se_session *, struct se_cmd *);
125void target_sess_cmd_list_set_waiting(struct se_session *); 125void target_sess_cmd_list_set_waiting(struct se_session *);
126void target_wait_for_sess_cmds(struct se_session *, int); 126void target_wait_for_sess_cmds(struct se_session *, int);
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
new file mode 100644
index 000000000000..3cc5a0b278c3
--- /dev/null
+++ b/include/trace/events/bcache.h
@@ -0,0 +1,271 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM bcache
3
4#if !defined(_TRACE_BCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_BCACHE_H
6
7#include <linux/tracepoint.h>
8
9struct search;
10
11DECLARE_EVENT_CLASS(bcache_request,
12
13 TP_PROTO(struct search *s, struct bio *bio),
14
15 TP_ARGS(s, bio),
16
17 TP_STRUCT__entry(
18 __field(dev_t, dev )
19 __field(unsigned int, orig_major )
20 __field(unsigned int, orig_minor )
21 __field(sector_t, sector )
22 __field(dev_t, orig_sector )
23 __field(unsigned int, nr_sector )
24 __array(char, rwbs, 6 )
25 __array(char, comm, TASK_COMM_LEN )
26 ),
27
28 TP_fast_assign(
29 __entry->dev = bio->bi_bdev->bd_dev;
30 __entry->orig_major = s->d->disk->major;
31 __entry->orig_minor = s->d->disk->first_minor;
32 __entry->sector = bio->bi_sector;
33 __entry->orig_sector = bio->bi_sector - 16;
34 __entry->nr_sector = bio->bi_size >> 9;
35 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
36 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
37 ),
38
39 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d @ %llu)",
40 MAJOR(__entry->dev), MINOR(__entry->dev),
41 __entry->rwbs,
42 (unsigned long long)__entry->sector,
43 __entry->nr_sector, __entry->comm,
44 __entry->orig_major, __entry->orig_minor,
45 (unsigned long long)__entry->orig_sector)
46);
47
48DEFINE_EVENT(bcache_request, bcache_request_start,
49
50 TP_PROTO(struct search *s, struct bio *bio),
51
52 TP_ARGS(s, bio)
53);
54
55DEFINE_EVENT(bcache_request, bcache_request_end,
56
57 TP_PROTO(struct search *s, struct bio *bio),
58
59 TP_ARGS(s, bio)
60);
61
62DECLARE_EVENT_CLASS(bcache_bio,
63
64 TP_PROTO(struct bio *bio),
65
66 TP_ARGS(bio),
67
68 TP_STRUCT__entry(
69 __field(dev_t, dev )
70 __field(sector_t, sector )
71 __field(unsigned int, nr_sector )
72 __array(char, rwbs, 6 )
73 __array(char, comm, TASK_COMM_LEN )
74 ),
75
76 TP_fast_assign(
77 __entry->dev = bio->bi_bdev->bd_dev;
78 __entry->sector = bio->bi_sector;
79 __entry->nr_sector = bio->bi_size >> 9;
80 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
81 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
82 ),
83
84 TP_printk("%d,%d %s %llu + %u [%s]",
85 MAJOR(__entry->dev), MINOR(__entry->dev),
86 __entry->rwbs,
87 (unsigned long long)__entry->sector,
88 __entry->nr_sector, __entry->comm)
89);
90
91
92DEFINE_EVENT(bcache_bio, bcache_passthrough,
93
94 TP_PROTO(struct bio *bio),
95
96 TP_ARGS(bio)
97);
98
99DEFINE_EVENT(bcache_bio, bcache_cache_hit,
100
101 TP_PROTO(struct bio *bio),
102
103 TP_ARGS(bio)
104);
105
106DEFINE_EVENT(bcache_bio, bcache_cache_miss,
107
108 TP_PROTO(struct bio *bio),
109
110 TP_ARGS(bio)
111);
112
113DEFINE_EVENT(bcache_bio, bcache_read_retry,
114
115 TP_PROTO(struct bio *bio),
116
117 TP_ARGS(bio)
118);
119
120DEFINE_EVENT(bcache_bio, bcache_writethrough,
121
122 TP_PROTO(struct bio *bio),
123
124 TP_ARGS(bio)
125);
126
127DEFINE_EVENT(bcache_bio, bcache_writeback,
128
129 TP_PROTO(struct bio *bio),
130
131 TP_ARGS(bio)
132);
133
134DEFINE_EVENT(bcache_bio, bcache_write_skip,
135
136 TP_PROTO(struct bio *bio),
137
138 TP_ARGS(bio)
139);
140
141DEFINE_EVENT(bcache_bio, bcache_btree_read,
142
143 TP_PROTO(struct bio *bio),
144
145 TP_ARGS(bio)
146);
147
148DEFINE_EVENT(bcache_bio, bcache_btree_write,
149
150 TP_PROTO(struct bio *bio),
151
152 TP_ARGS(bio)
153);
154
155DEFINE_EVENT(bcache_bio, bcache_write_dirty,
156
157 TP_PROTO(struct bio *bio),
158
159 TP_ARGS(bio)
160);
161
162DEFINE_EVENT(bcache_bio, bcache_read_dirty,
163
164 TP_PROTO(struct bio *bio),
165
166 TP_ARGS(bio)
167);
168
169DEFINE_EVENT(bcache_bio, bcache_write_moving,
170
171 TP_PROTO(struct bio *bio),
172
173 TP_ARGS(bio)
174);
175
176DEFINE_EVENT(bcache_bio, bcache_read_moving,
177
178 TP_PROTO(struct bio *bio),
179
180 TP_ARGS(bio)
181);
182
183DEFINE_EVENT(bcache_bio, bcache_journal_write,
184
185 TP_PROTO(struct bio *bio),
186
187 TP_ARGS(bio)
188);
189
190DECLARE_EVENT_CLASS(bcache_cache_bio,
191
192 TP_PROTO(struct bio *bio,
193 sector_t orig_sector,
194 struct block_device* orig_bdev),
195
196 TP_ARGS(bio, orig_sector, orig_bdev),
197
198 TP_STRUCT__entry(
199 __field(dev_t, dev )
200 __field(dev_t, orig_dev )
201 __field(sector_t, sector )
202 __field(sector_t, orig_sector )
203 __field(unsigned int, nr_sector )
204 __array(char, rwbs, 6 )
205 __array(char, comm, TASK_COMM_LEN )
206 ),
207
208 TP_fast_assign(
209 __entry->dev = bio->bi_bdev->bd_dev;
210 __entry->orig_dev = orig_bdev->bd_dev;
211 __entry->sector = bio->bi_sector;
212 __entry->orig_sector = orig_sector;
213 __entry->nr_sector = bio->bi_size >> 9;
214 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
215 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
216 ),
217
218 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d %llu)",
219 MAJOR(__entry->dev), MINOR(__entry->dev),
220 __entry->rwbs,
221 (unsigned long long)__entry->sector,
222 __entry->nr_sector, __entry->comm,
223 MAJOR(__entry->orig_dev), MINOR(__entry->orig_dev),
224 (unsigned long long)__entry->orig_sector)
225);
226
227DEFINE_EVENT(bcache_cache_bio, bcache_cache_insert,
228
229 TP_PROTO(struct bio *bio,
230 sector_t orig_sector,
231 struct block_device *orig_bdev),
232
233 TP_ARGS(bio, orig_sector, orig_bdev)
234);
235
236DECLARE_EVENT_CLASS(bcache_gc,
237
238 TP_PROTO(uint8_t *uuid),
239
240 TP_ARGS(uuid),
241
242 TP_STRUCT__entry(
243 __field(uint8_t *, uuid)
244 ),
245
246 TP_fast_assign(
247 __entry->uuid = uuid;
248 ),
249
250 TP_printk("%pU", __entry->uuid)
251);
252
253
254DEFINE_EVENT(bcache_gc, bcache_gc_start,
255
256 TP_PROTO(uint8_t *uuid),
257
258 TP_ARGS(uuid)
259);
260
261DEFINE_EVENT(bcache_gc, bcache_gc_end,
262
263 TP_PROTO(uint8_t *uuid),
264
265 TP_ARGS(uuid)
266);
267
268#endif /* _TRACE_BCACHE_H */
269
270/* This part must be outside protection */
271#include <trace/define_trace.h>
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 9c1467357b03..60ae7c3db912 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -244,7 +244,7 @@ TRACE_EVENT(block_bio_bounce,
244 __entry->dev = bio->bi_bdev ? 244 __entry->dev = bio->bi_bdev ?
245 bio->bi_bdev->bd_dev : 0; 245 bio->bi_bdev->bd_dev : 0;
246 __entry->sector = bio->bi_sector; 246 __entry->sector = bio->bi_sector;
247 __entry->nr_sector = bio->bi_size >> 9; 247 __entry->nr_sector = bio_sectors(bio);
248 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 248 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
249 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 249 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
250 ), 250 ),
@@ -281,7 +281,7 @@ TRACE_EVENT(block_bio_complete,
281 TP_fast_assign( 281 TP_fast_assign(
282 __entry->dev = bio->bi_bdev->bd_dev; 282 __entry->dev = bio->bi_bdev->bd_dev;
283 __entry->sector = bio->bi_sector; 283 __entry->sector = bio->bi_sector;
284 __entry->nr_sector = bio->bi_size >> 9; 284 __entry->nr_sector = bio_sectors(bio);
285 __entry->error = error; 285 __entry->error = error;
286 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 286 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
287 ), 287 ),
@@ -309,7 +309,7 @@ DECLARE_EVENT_CLASS(block_bio_merge,
309 TP_fast_assign( 309 TP_fast_assign(
310 __entry->dev = bio->bi_bdev->bd_dev; 310 __entry->dev = bio->bi_bdev->bd_dev;
311 __entry->sector = bio->bi_sector; 311 __entry->sector = bio->bi_sector;
312 __entry->nr_sector = bio->bi_size >> 9; 312 __entry->nr_sector = bio_sectors(bio);
313 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 313 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
314 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 314 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
315 ), 315 ),
@@ -376,7 +376,7 @@ TRACE_EVENT(block_bio_queue,
376 TP_fast_assign( 376 TP_fast_assign(
377 __entry->dev = bio->bi_bdev->bd_dev; 377 __entry->dev = bio->bi_bdev->bd_dev;
378 __entry->sector = bio->bi_sector; 378 __entry->sector = bio->bi_sector;
379 __entry->nr_sector = bio->bi_size >> 9; 379 __entry->nr_sector = bio_sectors(bio);
380 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 380 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
381 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 381 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
382 ), 382 ),
@@ -404,7 +404,7 @@ DECLARE_EVENT_CLASS(block_get_rq,
404 TP_fast_assign( 404 TP_fast_assign(
405 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0; 405 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
406 __entry->sector = bio ? bio->bi_sector : 0; 406 __entry->sector = bio ? bio->bi_sector : 0;
407 __entry->nr_sector = bio ? bio->bi_size >> 9 : 0; 407 __entry->nr_sector = bio ? bio_sectors(bio) : 0;
408 blk_fill_rwbs(__entry->rwbs, 408 blk_fill_rwbs(__entry->rwbs,
409 bio ? bio->bi_rw : 0, __entry->nr_sector); 409 bio ? bio->bi_rw : 0, __entry->nr_sector);
410 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 410 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
@@ -580,7 +580,7 @@ TRACE_EVENT(block_bio_remap,
580 TP_fast_assign( 580 TP_fast_assign(
581 __entry->dev = bio->bi_bdev->bd_dev; 581 __entry->dev = bio->bi_bdev->bd_dev;
582 __entry->sector = bio->bi_sector; 582 __entry->sector = bio->bi_sector;
583 __entry->nr_sector = bio->bi_size >> 9; 583 __entry->nr_sector = bio_sectors(bio);
584 __entry->old_dev = dev; 584 __entry->old_dev = dev;
585 __entry->old_sector = from; 585 __entry->old_sector = from;
586 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 586 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 4ee471003859..8ee15b97cd38 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -257,15 +257,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
257 __entry->pos, __entry->len, __entry->copied) 257 __entry->pos, __entry->len, __entry->copied)
258); 258);
259 259
260DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end, 260DEFINE_EVENT(ext4__write_end, ext4_write_end,
261
262 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
263 unsigned int copied),
264
265 TP_ARGS(inode, pos, len, copied)
266);
267
268DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
269 261
270 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 262 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
271 unsigned int copied), 263 unsigned int copied),
@@ -1956,7 +1948,7 @@ TRACE_EVENT(ext4_remove_blocks,
1956 __entry->to = to; 1948 __entry->to = to;
1957 __entry->partial = partial_cluster; 1949 __entry->partial = partial_cluster;
1958 __entry->ee_pblk = ext4_ext_pblock(ex); 1950 __entry->ee_pblk = ext4_ext_pblock(ex);
1959 __entry->ee_lblk = cpu_to_le32(ex->ee_block); 1951 __entry->ee_lblk = le32_to_cpu(ex->ee_block);
1960 __entry->ee_len = ext4_ext_get_actual_len(ex); 1952 __entry->ee_len = ext4_ext_get_actual_len(ex);
1961 ), 1953 ),
1962 1954
@@ -2060,7 +2052,7 @@ TRACE_EVENT(ext4_ext_remove_space,
2060 2052
2061TRACE_EVENT(ext4_ext_remove_space_done, 2053TRACE_EVENT(ext4_ext_remove_space_done,
2062 TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth, 2054 TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth,
2063 ext4_lblk_t partial, unsigned short eh_entries), 2055 ext4_lblk_t partial, __le16 eh_entries),
2064 2056
2065 TP_ARGS(inode, start, depth, partial, eh_entries), 2057 TP_ARGS(inode, start, depth, partial, eh_entries),
2066 2058
@@ -2079,7 +2071,7 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2079 __entry->start = start; 2071 __entry->start = start;
2080 __entry->depth = depth; 2072 __entry->depth = depth;
2081 __entry->partial = partial; 2073 __entry->partial = partial;
2082 __entry->eh_entries = eh_entries; 2074 __entry->eh_entries = le16_to_cpu(eh_entries);
2083 ), 2075 ),
2084 2076
2085 TP_printk("dev %d,%d ino %lu since %u depth %d partial %u " 2077 TP_printk("dev %d,%d ino %lu since %u depth %d partial %u "
@@ -2147,7 +2139,7 @@ TRACE_EVENT(ext4_es_remove_extent,
2147 __entry->lblk, __entry->len) 2139 __entry->lblk, __entry->len)
2148); 2140);
2149 2141
2150TRACE_EVENT(ext4_es_find_delayed_extent_enter, 2142TRACE_EVENT(ext4_es_find_delayed_extent_range_enter,
2151 TP_PROTO(struct inode *inode, ext4_lblk_t lblk), 2143 TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2152 2144
2153 TP_ARGS(inode, lblk), 2145 TP_ARGS(inode, lblk),
@@ -2169,7 +2161,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_enter,
2169 (unsigned long) __entry->ino, __entry->lblk) 2161 (unsigned long) __entry->ino, __entry->lblk)
2170); 2162);
2171 2163
2172TRACE_EVENT(ext4_es_find_delayed_extent_exit, 2164TRACE_EVENT(ext4_es_find_delayed_extent_range_exit,
2173 TP_PROTO(struct inode *inode, struct extent_status *es), 2165 TP_PROTO(struct inode *inode, struct extent_status *es),
2174 2166
2175 TP_ARGS(inode, es), 2167 TP_ARGS(inode, es),
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
new file mode 100644
index 000000000000..52ae54828eda
--- /dev/null
+++ b/include/trace/events/f2fs.h
@@ -0,0 +1,682 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM f2fs
3
4#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_F2FS_H
6
7#include <linux/tracepoint.h>
8
9#define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev)
10#define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino
11
12#define show_block_type(type) \
13 __print_symbolic(type, \
14 { NODE, "NODE" }, \
15 { DATA, "DATA" }, \
16 { META, "META" }, \
17 { META_FLUSH, "META_FLUSH" })
18
19#define show_bio_type(type) \
20 __print_symbolic(type, \
21 { READ, "READ" }, \
22 { READA, "READAHEAD" }, \
23 { READ_SYNC, "READ_SYNC" }, \
24 { WRITE, "WRITE" }, \
25 { WRITE_SYNC, "WRITE_SYNC" }, \
26 { WRITE_FLUSH, "WRITE_FLUSH" }, \
27 { WRITE_FUA, "WRITE_FUA" })
28
29#define show_data_type(type) \
30 __print_symbolic(type, \
31 { CURSEG_HOT_DATA, "Hot DATA" }, \
32 { CURSEG_WARM_DATA, "Warm DATA" }, \
33 { CURSEG_COLD_DATA, "Cold DATA" }, \
34 { CURSEG_HOT_NODE, "Hot NODE" }, \
35 { CURSEG_WARM_NODE, "Warm NODE" }, \
36 { CURSEG_COLD_NODE, "Cold NODE" }, \
37 { NO_CHECK_TYPE, "No TYPE" })
38
39#define show_gc_type(type) \
40 __print_symbolic(type, \
41 { FG_GC, "Foreground GC" }, \
42 { BG_GC, "Background GC" })
43
44#define show_alloc_mode(type) \
45 __print_symbolic(type, \
46 { LFS, "LFS-mode" }, \
47 { SSR, "SSR-mode" })
48
49#define show_victim_policy(type) \
50 __print_symbolic(type, \
51 { GC_GREEDY, "Greedy" }, \
52 { GC_CB, "Cost-Benefit" })
53
54struct victim_sel_policy;
55
56DECLARE_EVENT_CLASS(f2fs__inode,
57
58 TP_PROTO(struct inode *inode),
59
60 TP_ARGS(inode),
61
62 TP_STRUCT__entry(
63 __field(dev_t, dev)
64 __field(ino_t, ino)
65 __field(ino_t, pino)
66 __field(umode_t, mode)
67 __field(loff_t, size)
68 __field(unsigned int, nlink)
69 __field(blkcnt_t, blocks)
70 __field(__u8, advise)
71 ),
72
73 TP_fast_assign(
74 __entry->dev = inode->i_sb->s_dev;
75 __entry->ino = inode->i_ino;
76 __entry->pino = F2FS_I(inode)->i_pino;
77 __entry->mode = inode->i_mode;
78 __entry->nlink = inode->i_nlink;
79 __entry->size = inode->i_size;
80 __entry->blocks = inode->i_blocks;
81 __entry->advise = F2FS_I(inode)->i_advise;
82 ),
83
84 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
85 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
86 show_dev_ino(__entry),
87 (unsigned long)__entry->pino,
88 __entry->mode,
89 __entry->size,
90 (unsigned int)__entry->nlink,
91 (unsigned long long)__entry->blocks,
92 (unsigned char)__entry->advise)
93);
94
95DECLARE_EVENT_CLASS(f2fs__inode_exit,
96
97 TP_PROTO(struct inode *inode, int ret),
98
99 TP_ARGS(inode, ret),
100
101 TP_STRUCT__entry(
102 __field(dev_t, dev)
103 __field(ino_t, ino)
104 __field(int, ret)
105 ),
106
107 TP_fast_assign(
108 __entry->dev = inode->i_sb->s_dev;
109 __entry->ino = inode->i_ino;
110 __entry->ret = ret;
111 ),
112
113 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
114 show_dev_ino(__entry),
115 __entry->ret)
116);
117
118DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
119
120 TP_PROTO(struct inode *inode),
121
122 TP_ARGS(inode)
123);
124
125TRACE_EVENT(f2fs_sync_file_exit,
126
127 TP_PROTO(struct inode *inode, bool need_cp, int datasync, int ret),
128
129 TP_ARGS(inode, need_cp, datasync, ret),
130
131 TP_STRUCT__entry(
132 __field(dev_t, dev)
133 __field(ino_t, ino)
134 __field(bool, need_cp)
135 __field(int, datasync)
136 __field(int, ret)
137 ),
138
139 TP_fast_assign(
140 __entry->dev = inode->i_sb->s_dev;
141 __entry->ino = inode->i_ino;
142 __entry->need_cp = need_cp;
143 __entry->datasync = datasync;
144 __entry->ret = ret;
145 ),
146
147 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
148 "datasync = %d, ret = %d",
149 show_dev_ino(__entry),
150 __entry->need_cp ? "needed" : "not needed",
151 __entry->datasync,
152 __entry->ret)
153);
154
155TRACE_EVENT(f2fs_sync_fs,
156
157 TP_PROTO(struct super_block *sb, int wait),
158
159 TP_ARGS(sb, wait),
160
161 TP_STRUCT__entry(
162 __field(dev_t, dev)
163 __field(int, dirty)
164 __field(int, wait)
165 ),
166
167 TP_fast_assign(
168 __entry->dev = sb->s_dev;
169 __entry->dirty = F2FS_SB(sb)->s_dirty;
170 __entry->wait = wait;
171 ),
172
173 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
174 show_dev(__entry),
175 __entry->dirty ? "dirty" : "not dirty",
176 __entry->wait)
177);
178
179DEFINE_EVENT(f2fs__inode, f2fs_iget,
180
181 TP_PROTO(struct inode *inode),
182
183 TP_ARGS(inode)
184);
185
186DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
187
188 TP_PROTO(struct inode *inode, int ret),
189
190 TP_ARGS(inode, ret)
191);
192
193DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
194
195 TP_PROTO(struct inode *inode),
196
197 TP_ARGS(inode)
198);
199
200DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
201
202 TP_PROTO(struct inode *inode, int ret),
203
204 TP_ARGS(inode, ret)
205);
206
207TRACE_EVENT(f2fs_unlink_enter,
208
209 TP_PROTO(struct inode *dir, struct dentry *dentry),
210
211 TP_ARGS(dir, dentry),
212
213 TP_STRUCT__entry(
214 __field(dev_t, dev)
215 __field(ino_t, ino)
216 __field(loff_t, size)
217 __field(blkcnt_t, blocks)
218 __field(const char *, name)
219 ),
220
221 TP_fast_assign(
222 __entry->dev = dir->i_sb->s_dev;
223 __entry->ino = dir->i_ino;
224 __entry->size = dir->i_size;
225 __entry->blocks = dir->i_blocks;
226 __entry->name = dentry->d_name.name;
227 ),
228
229 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
230 "i_blocks = %llu, name = %s",
231 show_dev_ino(__entry),
232 __entry->size,
233 (unsigned long long)__entry->blocks,
234 __entry->name)
235);
236
237DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
238
239 TP_PROTO(struct inode *inode, int ret),
240
241 TP_ARGS(inode, ret)
242);
243
244DEFINE_EVENT(f2fs__inode, f2fs_truncate,
245
246 TP_PROTO(struct inode *inode),
247
248 TP_ARGS(inode)
249);
250
251TRACE_EVENT(f2fs_truncate_data_blocks_range,
252
253 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
254
255 TP_ARGS(inode, nid, ofs, free),
256
257 TP_STRUCT__entry(
258 __field(dev_t, dev)
259 __field(ino_t, ino)
260 __field(nid_t, nid)
261 __field(unsigned int, ofs)
262 __field(int, free)
263 ),
264
265 TP_fast_assign(
266 __entry->dev = inode->i_sb->s_dev;
267 __entry->ino = inode->i_ino;
268 __entry->nid = nid;
269 __entry->ofs = ofs;
270 __entry->free = free;
271 ),
272
273 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
274 show_dev_ino(__entry),
275 (unsigned int)__entry->nid,
276 __entry->ofs,
277 __entry->free)
278);
279
280DECLARE_EVENT_CLASS(f2fs__truncate_op,
281
282 TP_PROTO(struct inode *inode, u64 from),
283
284 TP_ARGS(inode, from),
285
286 TP_STRUCT__entry(
287 __field(dev_t, dev)
288 __field(ino_t, ino)
289 __field(loff_t, size)
290 __field(blkcnt_t, blocks)
291 __field(u64, from)
292 ),
293
294 TP_fast_assign(
295 __entry->dev = inode->i_sb->s_dev;
296 __entry->ino = inode->i_ino;
297 __entry->size = inode->i_size;
298 __entry->blocks = inode->i_blocks;
299 __entry->from = from;
300 ),
301
302 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
303 "start file offset = %llu",
304 show_dev_ino(__entry),
305 __entry->size,
306 (unsigned long long)__entry->blocks,
307 (unsigned long long)__entry->from)
308);
309
310DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
311
312 TP_PROTO(struct inode *inode, u64 from),
313
314 TP_ARGS(inode, from)
315);
316
317DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
318
319 TP_PROTO(struct inode *inode, int ret),
320
321 TP_ARGS(inode, ret)
322);
323
324DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
325
326 TP_PROTO(struct inode *inode, u64 from),
327
328 TP_ARGS(inode, from)
329);
330
331DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
332
333 TP_PROTO(struct inode *inode, int ret),
334
335 TP_ARGS(inode, ret)
336);
337
338DECLARE_EVENT_CLASS(f2fs__truncate_node,
339
340 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
341
342 TP_ARGS(inode, nid, blk_addr),
343
344 TP_STRUCT__entry(
345 __field(dev_t, dev)
346 __field(ino_t, ino)
347 __field(nid_t, nid)
348 __field(block_t, blk_addr)
349 ),
350
351 TP_fast_assign(
352 __entry->dev = inode->i_sb->s_dev;
353 __entry->ino = inode->i_ino;
354 __entry->nid = nid;
355 __entry->blk_addr = blk_addr;
356 ),
357
358 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
359 show_dev_ino(__entry),
360 (unsigned int)__entry->nid,
361 (unsigned long long)__entry->blk_addr)
362);
363
364DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
365
366 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
367
368 TP_ARGS(inode, nid, blk_addr)
369);
370
371DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
372
373 TP_PROTO(struct inode *inode, int ret),
374
375 TP_ARGS(inode, ret)
376);
377
378DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
379
380 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
381
382 TP_ARGS(inode, nid, blk_addr)
383);
384
385TRACE_EVENT(f2fs_truncate_partial_nodes,
386
387 TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err),
388
389 TP_ARGS(inode, nid, depth, err),
390
391 TP_STRUCT__entry(
392 __field(dev_t, dev)
393 __field(ino_t, ino)
394 __field(nid_t, nid[3])
395 __field(int, depth)
396 __field(int, err)
397 ),
398
399 TP_fast_assign(
400 __entry->dev = inode->i_sb->s_dev;
401 __entry->ino = inode->i_ino;
402 __entry->nid[0] = nid[0];
403 __entry->nid[1] = nid[1];
404 __entry->nid[2] = nid[2];
405 __entry->depth = depth;
406 __entry->err = err;
407 ),
408
409 TP_printk("dev = (%d,%d), ino = %lu, "
410 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
411 show_dev_ino(__entry),
412 (unsigned int)__entry->nid[0],
413 (unsigned int)__entry->nid[1],
414 (unsigned int)__entry->nid[2],
415 __entry->depth,
416 __entry->err)
417);
418
419TRACE_EVENT_CONDITION(f2fs_readpage,
420
421 TP_PROTO(struct page *page, sector_t blkaddr, int type),
422
423 TP_ARGS(page, blkaddr, type),
424
425 TP_CONDITION(page->mapping),
426
427 TP_STRUCT__entry(
428 __field(dev_t, dev)
429 __field(ino_t, ino)
430 __field(pgoff_t, index)
431 __field(sector_t, blkaddr)
432 __field(int, type)
433 ),
434
435 TP_fast_assign(
436 __entry->dev = page->mapping->host->i_sb->s_dev;
437 __entry->ino = page->mapping->host->i_ino;
438 __entry->index = page->index;
439 __entry->blkaddr = blkaddr;
440 __entry->type = type;
441 ),
442
443 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
444 "blkaddr = 0x%llx, bio_type = %s",
445 show_dev_ino(__entry),
446 (unsigned long)__entry->index,
447 (unsigned long long)__entry->blkaddr,
448 show_bio_type(__entry->type))
449);
450
451TRACE_EVENT(f2fs_get_data_block,
452 TP_PROTO(struct inode *inode, sector_t iblock,
453 struct buffer_head *bh, int ret),
454
455 TP_ARGS(inode, iblock, bh, ret),
456
457 TP_STRUCT__entry(
458 __field(dev_t, dev)
459 __field(ino_t, ino)
460 __field(sector_t, iblock)
461 __field(sector_t, bh_start)
462 __field(size_t, bh_size)
463 __field(int, ret)
464 ),
465
466 TP_fast_assign(
467 __entry->dev = inode->i_sb->s_dev;
468 __entry->ino = inode->i_ino;
469 __entry->iblock = iblock;
470 __entry->bh_start = bh->b_blocknr;
471 __entry->bh_size = bh->b_size;
472 __entry->ret = ret;
473 ),
474
475 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
476 "start blkaddr = 0x%llx, len = 0x%llx bytes, err = %d",
477 show_dev_ino(__entry),
478 (unsigned long long)__entry->iblock,
479 (unsigned long long)__entry->bh_start,
480 (unsigned long long)__entry->bh_size,
481 __entry->ret)
482);
483
484TRACE_EVENT(f2fs_get_victim,
485
486 TP_PROTO(struct super_block *sb, int type, int gc_type,
487 struct victim_sel_policy *p, unsigned int pre_victim,
488 unsigned int prefree, unsigned int free),
489
490 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
491
492 TP_STRUCT__entry(
493 __field(dev_t, dev)
494 __field(int, type)
495 __field(int, gc_type)
496 __field(int, alloc_mode)
497 __field(int, gc_mode)
498 __field(unsigned int, victim)
499 __field(unsigned int, ofs_unit)
500 __field(unsigned int, pre_victim)
501 __field(unsigned int, prefree)
502 __field(unsigned int, free)
503 ),
504
505 TP_fast_assign(
506 __entry->dev = sb->s_dev;
507 __entry->type = type;
508 __entry->gc_type = gc_type;
509 __entry->alloc_mode = p->alloc_mode;
510 __entry->gc_mode = p->gc_mode;
511 __entry->victim = p->min_segno;
512 __entry->ofs_unit = p->ofs_unit;
513 __entry->pre_victim = pre_victim;
514 __entry->prefree = prefree;
515 __entry->free = free;
516 ),
517
518 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u "
519 "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u",
520 show_dev(__entry),
521 show_data_type(__entry->type),
522 show_gc_type(__entry->gc_type),
523 show_alloc_mode(__entry->alloc_mode),
524 show_victim_policy(__entry->gc_mode),
525 __entry->victim,
526 __entry->ofs_unit,
527 (int)__entry->pre_victim,
528 __entry->prefree,
529 __entry->free)
530);
531
532TRACE_EVENT(f2fs_fallocate,
533
534 TP_PROTO(struct inode *inode, int mode,
535 loff_t offset, loff_t len, int ret),
536
537 TP_ARGS(inode, mode, offset, len, ret),
538
539 TP_STRUCT__entry(
540 __field(dev_t, dev)
541 __field(ino_t, ino)
542 __field(int, mode)
543 __field(loff_t, offset)
544 __field(loff_t, len)
545 __field(loff_t, size)
546 __field(blkcnt_t, blocks)
547 __field(int, ret)
548 ),
549
550 TP_fast_assign(
551 __entry->dev = inode->i_sb->s_dev;
552 __entry->ino = inode->i_ino;
553 __entry->mode = mode;
554 __entry->offset = offset;
555 __entry->len = len;
556 __entry->size = inode->i_size;
557 __entry->blocks = inode->i_blocks;
558 __entry->ret = ret;
559 ),
560
561 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
562 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
563 show_dev_ino(__entry),
564 __entry->mode,
565 (unsigned long long)__entry->offset,
566 (unsigned long long)__entry->len,
567 (unsigned long long)__entry->size,
568 (unsigned long long)__entry->blocks,
569 __entry->ret)
570);
571
572TRACE_EVENT(f2fs_reserve_new_block,
573
574 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node),
575
576 TP_ARGS(inode, nid, ofs_in_node),
577
578 TP_STRUCT__entry(
579 __field(dev_t, dev)
580 __field(nid_t, nid)
581 __field(unsigned int, ofs_in_node)
582 ),
583
584 TP_fast_assign(
585 __entry->dev = inode->i_sb->s_dev;
586 __entry->nid = nid;
587 __entry->ofs_in_node = ofs_in_node;
588 ),
589
590 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u",
591 show_dev(__entry),
592 (unsigned int)__entry->nid,
593 __entry->ofs_in_node)
594);
595
596TRACE_EVENT(f2fs_do_submit_bio,
597
598 TP_PROTO(struct super_block *sb, int btype, bool sync, struct bio *bio),
599
600 TP_ARGS(sb, btype, sync, bio),
601
602 TP_STRUCT__entry(
603 __field(dev_t, dev)
604 __field(int, btype)
605 __field(bool, sync)
606 __field(sector_t, sector)
607 __field(unsigned int, size)
608 ),
609
610 TP_fast_assign(
611 __entry->dev = sb->s_dev;
612 __entry->btype = btype;
613 __entry->sync = sync;
614 __entry->sector = bio->bi_sector;
615 __entry->size = bio->bi_size;
616 ),
617
618 TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %u",
619 show_dev(__entry),
620 show_block_type(__entry->btype),
621 __entry->sync ? "sync" : "no sync",
622 (unsigned long long)__entry->sector,
623 __entry->size)
624);
625
626TRACE_EVENT(f2fs_submit_write_page,
627
628 TP_PROTO(struct page *page, block_t blk_addr, int type),
629
630 TP_ARGS(page, blk_addr, type),
631
632 TP_STRUCT__entry(
633 __field(dev_t, dev)
634 __field(ino_t, ino)
635 __field(int, type)
636 __field(pgoff_t, index)
637 __field(block_t, block)
638 ),
639
640 TP_fast_assign(
641 __entry->dev = page->mapping->host->i_sb->s_dev;
642 __entry->ino = page->mapping->host->i_ino;
643 __entry->type = type;
644 __entry->index = page->index;
645 __entry->block = blk_addr;
646 ),
647
648 TP_printk("dev = (%d,%d), ino = %lu, %s, index = %lu, blkaddr = 0x%llx",
649 show_dev_ino(__entry),
650 show_block_type(__entry->type),
651 (unsigned long)__entry->index,
652 (unsigned long long)__entry->block)
653);
654
655TRACE_EVENT(f2fs_write_checkpoint,
656
657 TP_PROTO(struct super_block *sb, bool is_umount, char *msg),
658
659 TP_ARGS(sb, is_umount, msg),
660
661 TP_STRUCT__entry(
662 __field(dev_t, dev)
663 __field(bool, is_umount)
664 __field(char *, msg)
665 ),
666
667 TP_fast_assign(
668 __entry->dev = sb->s_dev;
669 __entry->is_umount = is_umount;
670 __entry->msg = msg;
671 ),
672
673 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
674 show_dev(__entry),
675 __entry->is_umount ? "clean umount" : "consistency",
676 __entry->msg)
677);
678
679#endif /* _TRACE_F2FS_H */
680
681 /* This part must be outside protection */
682#include <trace/define_trace.h>
diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h
new file mode 100644
index 000000000000..0421f49a20f7
--- /dev/null
+++ b/include/trace/events/filemap.h
@@ -0,0 +1,58 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM filemap
3
4#if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_FILEMAP_H
6
7#include <linux/types.h>
8#include <linux/tracepoint.h>
9#include <linux/mm.h>
10#include <linux/memcontrol.h>
11#include <linux/device.h>
12#include <linux/kdev_t.h>
13
14DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
15
16 TP_PROTO(struct page *page),
17
18 TP_ARGS(page),
19
20 TP_STRUCT__entry(
21 __field(struct page *, page)
22 __field(unsigned long, i_ino)
23 __field(unsigned long, index)
24 __field(dev_t, s_dev)
25 ),
26
27 TP_fast_assign(
28 __entry->page = page;
29 __entry->i_ino = page->mapping->host->i_ino;
30 __entry->index = page->index;
31 if (page->mapping->host->i_sb)
32 __entry->s_dev = page->mapping->host->i_sb->s_dev;
33 else
34 __entry->s_dev = page->mapping->host->i_rdev;
35 ),
36
37 TP_printk("dev %d:%d ino %lx page=%p pfn=%lu ofs=%lu",
38 MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
39 __entry->i_ino,
40 __entry->page,
41 page_to_pfn(__entry->page),
42 __entry->index << PAGE_SHIFT)
43);
44
45DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache,
46 TP_PROTO(struct page *page),
47 TP_ARGS(page)
48 );
49
50DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache,
51 TP_PROTO(struct page *page),
52 TP_ARGS(page)
53 );
54
55#endif /* _TRACE_FILEMAP_H */
56
57/* This part must be outside protection */
58#include <trace/define_trace.h>
diff --git a/include/trace/events/host1x.h b/include/trace/events/host1x.h
new file mode 100644
index 000000000000..94db6a2c3540
--- /dev/null
+++ b/include/trace/events/host1x.h
@@ -0,0 +1,253 @@
1/*
2 * include/trace/events/host1x.h
3 *
4 * host1x event logging to ftrace.
5 *
6 * Copyright (c) 2010-2013, NVIDIA Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#undef TRACE_SYSTEM
24#define TRACE_SYSTEM host1x
25
26#if !defined(_TRACE_HOST1X_H) || defined(TRACE_HEADER_MULTI_READ)
27#define _TRACE_HOST1X_H
28
29#include <linux/ktime.h>
30#include <linux/tracepoint.h>
31
32DECLARE_EVENT_CLASS(host1x,
33 TP_PROTO(const char *name),
34 TP_ARGS(name),
35 TP_STRUCT__entry(__field(const char *, name)),
36 TP_fast_assign(__entry->name = name;),
37 TP_printk("name=%s", __entry->name)
38);
39
40DEFINE_EVENT(host1x, host1x_channel_open,
41 TP_PROTO(const char *name),
42 TP_ARGS(name)
43);
44
45DEFINE_EVENT(host1x, host1x_channel_release,
46 TP_PROTO(const char *name),
47 TP_ARGS(name)
48);
49
50DEFINE_EVENT(host1x, host1x_cdma_begin,
51 TP_PROTO(const char *name),
52 TP_ARGS(name)
53);
54
55DEFINE_EVENT(host1x, host1x_cdma_end,
56 TP_PROTO(const char *name),
57 TP_ARGS(name)
58);
59
60TRACE_EVENT(host1x_cdma_push,
61 TP_PROTO(const char *name, u32 op1, u32 op2),
62
63 TP_ARGS(name, op1, op2),
64
65 TP_STRUCT__entry(
66 __field(const char *, name)
67 __field(u32, op1)
68 __field(u32, op2)
69 ),
70
71 TP_fast_assign(
72 __entry->name = name;
73 __entry->op1 = op1;
74 __entry->op2 = op2;
75 ),
76
77 TP_printk("name=%s, op1=%08x, op2=%08x",
78 __entry->name, __entry->op1, __entry->op2)
79);
80
81TRACE_EVENT(host1x_cdma_push_gather,
82 TP_PROTO(const char *name, u32 mem_id,
83 u32 words, u32 offset, void *cmdbuf),
84
85 TP_ARGS(name, mem_id, words, offset, cmdbuf),
86
87 TP_STRUCT__entry(
88 __field(const char *, name)
89 __field(u32, mem_id)
90 __field(u32, words)
91 __field(u32, offset)
92 __field(bool, cmdbuf)
93 __dynamic_array(u32, cmdbuf, words)
94 ),
95
96 TP_fast_assign(
97 if (cmdbuf) {
98 memcpy(__get_dynamic_array(cmdbuf), cmdbuf+offset,
99 words * sizeof(u32));
100 }
101 __entry->cmdbuf = cmdbuf;
102 __entry->name = name;
103 __entry->mem_id = mem_id;
104 __entry->words = words;
105 __entry->offset = offset;
106 ),
107
108 TP_printk("name=%s, mem_id=%08x, words=%u, offset=%d, contents=[%s]",
109 __entry->name, __entry->mem_id,
110 __entry->words, __entry->offset,
111 __print_hex(__get_dynamic_array(cmdbuf),
112 __entry->cmdbuf ? __entry->words * 4 : 0))
113);
114
115TRACE_EVENT(host1x_channel_submit,
116 TP_PROTO(const char *name, u32 cmdbufs, u32 relocs, u32 waitchks,
117 u32 syncpt_id, u32 syncpt_incrs),
118
119 TP_ARGS(name, cmdbufs, relocs, waitchks, syncpt_id, syncpt_incrs),
120
121 TP_STRUCT__entry(
122 __field(const char *, name)
123 __field(u32, cmdbufs)
124 __field(u32, relocs)
125 __field(u32, waitchks)
126 __field(u32, syncpt_id)
127 __field(u32, syncpt_incrs)
128 ),
129
130 TP_fast_assign(
131 __entry->name = name;
132 __entry->cmdbufs = cmdbufs;
133 __entry->relocs = relocs;
134 __entry->waitchks = waitchks;
135 __entry->syncpt_id = syncpt_id;
136 __entry->syncpt_incrs = syncpt_incrs;
137 ),
138
139 TP_printk("name=%s, cmdbufs=%u, relocs=%u, waitchks=%d,"
140 "syncpt_id=%u, syncpt_incrs=%u",
141 __entry->name, __entry->cmdbufs, __entry->relocs, __entry->waitchks,
142 __entry->syncpt_id, __entry->syncpt_incrs)
143);
144
145TRACE_EVENT(host1x_channel_submitted,
146 TP_PROTO(const char *name, u32 syncpt_base, u32 syncpt_max),
147
148 TP_ARGS(name, syncpt_base, syncpt_max),
149
150 TP_STRUCT__entry(
151 __field(const char *, name)
152 __field(u32, syncpt_base)
153 __field(u32, syncpt_max)
154 ),
155
156 TP_fast_assign(
157 __entry->name = name;
158 __entry->syncpt_base = syncpt_base;
159 __entry->syncpt_max = syncpt_max;
160 ),
161
162 TP_printk("name=%s, syncpt_base=%d, syncpt_max=%d",
163 __entry->name, __entry->syncpt_base, __entry->syncpt_max)
164);
165
166TRACE_EVENT(host1x_channel_submit_complete,
167 TP_PROTO(const char *name, int count, u32 thresh),
168
169 TP_ARGS(name, count, thresh),
170
171 TP_STRUCT__entry(
172 __field(const char *, name)
173 __field(int, count)
174 __field(u32, thresh)
175 ),
176
177 TP_fast_assign(
178 __entry->name = name;
179 __entry->count = count;
180 __entry->thresh = thresh;
181 ),
182
183 TP_printk("name=%s, count=%d, thresh=%d",
184 __entry->name, __entry->count, __entry->thresh)
185);
186
187TRACE_EVENT(host1x_wait_cdma,
188 TP_PROTO(const char *name, u32 eventid),
189
190 TP_ARGS(name, eventid),
191
192 TP_STRUCT__entry(
193 __field(const char *, name)
194 __field(u32, eventid)
195 ),
196
197 TP_fast_assign(
198 __entry->name = name;
199 __entry->eventid = eventid;
200 ),
201
202 TP_printk("name=%s, event=%d", __entry->name, __entry->eventid)
203);
204
205TRACE_EVENT(host1x_syncpt_load_min,
206 TP_PROTO(u32 id, u32 val),
207
208 TP_ARGS(id, val),
209
210 TP_STRUCT__entry(
211 __field(u32, id)
212 __field(u32, val)
213 ),
214
215 TP_fast_assign(
216 __entry->id = id;
217 __entry->val = val;
218 ),
219
220 TP_printk("id=%d, val=%d", __entry->id, __entry->val)
221);
222
223TRACE_EVENT(host1x_syncpt_wait_check,
224 TP_PROTO(void *mem_id, u32 offset, u32 syncpt_id, u32 thresh, u32 min),
225
226 TP_ARGS(mem_id, offset, syncpt_id, thresh, min),
227
228 TP_STRUCT__entry(
229 __field(void *, mem_id)
230 __field(u32, offset)
231 __field(u32, syncpt_id)
232 __field(u32, thresh)
233 __field(u32, min)
234 ),
235
236 TP_fast_assign(
237 __entry->mem_id = mem_id;
238 __entry->offset = offset;
239 __entry->syncpt_id = syncpt_id;
240 __entry->thresh = thresh;
241 __entry->min = min;
242 ),
243
244 TP_printk("mem_id=%p, offset=%05x, id=%d, thresh=%d, current=%d",
245 __entry->mem_id, __entry->offset,
246 __entry->syncpt_id, __entry->thresh,
247 __entry->min)
248);
249
250#endif /* _TRACE_HOST1X_H */
251
252/* This part must be outside protection */
253#include <trace/define_trace.h>
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 070df49e4a1d..c1d1f3eb242d 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -358,6 +358,27 @@ TRACE_EVENT(jbd2_write_superblock,
358 MINOR(__entry->dev), __entry->write_op) 358 MINOR(__entry->dev), __entry->write_op)
359); 359);
360 360
361TRACE_EVENT(jbd2_lock_buffer_stall,
362
363 TP_PROTO(dev_t dev, unsigned long stall_ms),
364
365 TP_ARGS(dev, stall_ms),
366
367 TP_STRUCT__entry(
368 __field( dev_t, dev )
369 __field(unsigned long, stall_ms )
370 ),
371
372 TP_fast_assign(
373 __entry->dev = dev;
374 __entry->stall_ms = stall_ms;
375 ),
376
377 TP_printk("dev %d,%d stall_ms %lu",
378 MAJOR(__entry->dev), MINOR(__entry->dev),
379 __entry->stall_ms)
380);
381
361#endif /* _TRACE_JBD2_H */ 382#endif /* _TRACE_JBD2_H */
362 383
363/* This part must be outside protection */ 384/* This part must be outside protection */
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 19911dddaeb7..7005d1109ec9 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -37,7 +37,7 @@ TRACE_EVENT(kvm_userspace_exit,
37 __entry->errno < 0 ? -__entry->errno : __entry->reason) 37 __entry->errno < 0 ? -__entry->errno : __entry->reason)
38); 38);
39 39
40#if defined(__KVM_HAVE_IRQ_LINE) 40#if defined(CONFIG_HAVE_KVM_IRQCHIP)
41TRACE_EVENT(kvm_set_irq, 41TRACE_EVENT(kvm_set_irq,
42 TP_PROTO(unsigned int gsi, int level, int irq_source_id), 42 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
43 TP_ARGS(gsi, level, irq_source_id), 43 TP_ARGS(gsi, level, irq_source_id),
@@ -122,6 +122,10 @@ TRACE_EVENT(kvm_msi_set_irq,
122 {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \ 122 {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \
123 {KVM_IRQCHIP_IOAPIC, "IOAPIC"} 123 {KVM_IRQCHIP_IOAPIC, "IOAPIC"}
124 124
125#endif /* defined(__KVM_HAVE_IOAPIC) */
126
127#if defined(CONFIG_HAVE_KVM_IRQCHIP)
128
125TRACE_EVENT(kvm_ack_irq, 129TRACE_EVENT(kvm_ack_irq,
126 TP_PROTO(unsigned int irqchip, unsigned int pin), 130 TP_PROTO(unsigned int irqchip, unsigned int pin),
127 TP_ARGS(irqchip, pin), 131 TP_ARGS(irqchip, pin),
@@ -136,14 +140,18 @@ TRACE_EVENT(kvm_ack_irq,
136 __entry->pin = pin; 140 __entry->pin = pin;
137 ), 141 ),
138 142
143#ifdef kvm_irqchips
139 TP_printk("irqchip %s pin %u", 144 TP_printk("irqchip %s pin %u",
140 __print_symbolic(__entry->irqchip, kvm_irqchips), 145 __print_symbolic(__entry->irqchip, kvm_irqchips),
141 __entry->pin) 146 __entry->pin)
147#else
148 TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin)
149#endif
142); 150);
143 151
152#endif /* defined(CONFIG_HAVE_KVM_IRQCHIP) */
144 153
145 154
146#endif /* defined(__KVM_HAVE_IOAPIC) */
147 155
148#define KVM_TRACE_MMIO_READ_UNSATISFIED 0 156#define KVM_TRACE_MMIO_READ_UNSATISFIED 0
149#define KVM_TRACE_MMIO_READ 1 157#define KVM_TRACE_MMIO_READ 1
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h
index 94ec79cc011a..c008bc99f9fa 100644
--- a/include/trace/events/printk.h
+++ b/include/trace/events/printk.h
@@ -6,31 +6,18 @@
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8 8
9TRACE_EVENT_CONDITION(console, 9TRACE_EVENT(console,
10 TP_PROTO(const char *log_buf, unsigned start, unsigned end, 10 TP_PROTO(const char *text, size_t len),
11 unsigned log_buf_len),
12 11
13 TP_ARGS(log_buf, start, end, log_buf_len), 12 TP_ARGS(text, len),
14
15 TP_CONDITION(start != end),
16 13
17 TP_STRUCT__entry( 14 TP_STRUCT__entry(
18 __dynamic_array(char, msg, end - start + 1) 15 __dynamic_array(char, msg, len + 1)
19 ), 16 ),
20 17
21 TP_fast_assign( 18 TP_fast_assign(
22 if ((start & (log_buf_len - 1)) > (end & (log_buf_len - 1))) { 19 memcpy(__get_dynamic_array(msg), text, len);
23 memcpy(__get_dynamic_array(msg), 20 ((char *)__get_dynamic_array(msg))[len] = 0;
24 log_buf + (start & (log_buf_len - 1)),
25 log_buf_len - (start & (log_buf_len - 1)));
26 memcpy((char *)__get_dynamic_array(msg) +
27 log_buf_len - (start & (log_buf_len - 1)),
28 log_buf, end & (log_buf_len - 1));
29 } else
30 memcpy(__get_dynamic_array(msg),
31 log_buf + (start & (log_buf_len - 1)),
32 end - start);
33 ((char *)__get_dynamic_array(msg))[end - start] = 0;
34 ), 21 ),
35 22
36 TP_printk("%s", __get_str(msg)) 23 TP_printk("%s", __get_str(msg))
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 1918e832da4f..59ebcc89f148 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -72,6 +72,58 @@ TRACE_EVENT(rcu_grace_period,
72); 72);
73 73
74/* 74/*
75 * Tracepoint for future grace-period events, including those for no-callbacks
76 * CPUs. The caller should pull the data from the rcu_node structure,
77 * other than rcuname, which comes from the rcu_state structure, and event,
78 * which is one of the following:
79 *
80 * "Startleaf": Request a nocb grace period based on leaf-node data.
81 * "Startedleaf": Leaf-node start proved sufficient.
82 * "Startedleafroot": Leaf-node start proved sufficient after checking root.
83 * "Startedroot": Requested a nocb grace period based on root-node data.
84 * "StartWait": Start waiting for the requested grace period.
85 * "ResumeWait": Resume waiting after signal.
86 * "EndWait": Complete wait.
87 * "Cleanup": Clean up rcu_node structure after previous GP.
88 * "CleanupMore": Clean up, and another no-CB GP is needed.
89 */
90TRACE_EVENT(rcu_future_grace_period,
91
92 TP_PROTO(char *rcuname, unsigned long gpnum, unsigned long completed,
93 unsigned long c, u8 level, int grplo, int grphi,
94 char *gpevent),
95
96 TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent),
97
98 TP_STRUCT__entry(
99 __field(char *, rcuname)
100 __field(unsigned long, gpnum)
101 __field(unsigned long, completed)
102 __field(unsigned long, c)
103 __field(u8, level)
104 __field(int, grplo)
105 __field(int, grphi)
106 __field(char *, gpevent)
107 ),
108
109 TP_fast_assign(
110 __entry->rcuname = rcuname;
111 __entry->gpnum = gpnum;
112 __entry->completed = completed;
113 __entry->c = c;
114 __entry->level = level;
115 __entry->grplo = grplo;
116 __entry->grphi = grphi;
117 __entry->gpevent = gpevent;
118 ),
119
120 TP_printk("%s %lu %lu %lu %u %d %d %s",
121 __entry->rcuname, __entry->gpnum, __entry->completed,
122 __entry->c, __entry->level, __entry->grplo, __entry->grphi,
123 __entry->gpevent)
124);
125
126/*
75 * Tracepoint for grace-period-initialization events. These are 127 * Tracepoint for grace-period-initialization events. These are
76 * distinguished by the type of RCU, the new grace-period number, the 128 * distinguished by the type of RCU, the new grace-period number, the
77 * rcu_node structure level, the starting and ending CPU covered by the 129 * rcu_node structure level, the starting and ending CPU covered by the
@@ -601,6 +653,9 @@ TRACE_EVENT(rcu_barrier,
601#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0) 653#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
602#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \ 654#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
603 qsmask) do { } while (0) 655 qsmask) do { } while (0)
656#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
657 level, grplo, grphi, event) \
658 do { } while (0)
604#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) 659#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
605#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) 660#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
606#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ 661#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index 41a7dbd570e2..a43a2f67bd8e 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -175,6 +175,54 @@ DEFINE_EVENT(regmap_bool, regmap_cache_bypass,
175 175
176); 176);
177 177
178DECLARE_EVENT_CLASS(regmap_async,
179
180 TP_PROTO(struct device *dev),
181
182 TP_ARGS(dev),
183
184 TP_STRUCT__entry(
185 __string( name, dev_name(dev) )
186 ),
187
188 TP_fast_assign(
189 __assign_str(name, dev_name(dev));
190 ),
191
192 TP_printk("%s", __get_str(name))
193);
194
195DEFINE_EVENT(regmap_block, regmap_async_write_start,
196
197 TP_PROTO(struct device *dev, unsigned int reg, int count),
198
199 TP_ARGS(dev, reg, count)
200);
201
202DEFINE_EVENT(regmap_async, regmap_async_io_complete,
203
204 TP_PROTO(struct device *dev),
205
206 TP_ARGS(dev)
207
208);
209
210DEFINE_EVENT(regmap_async, regmap_async_complete_start,
211
212 TP_PROTO(struct device *dev),
213
214 TP_ARGS(dev)
215
216);
217
218DEFINE_EVENT(regmap_async, regmap_async_complete_done,
219
220 TP_PROTO(struct device *dev),
221
222 TP_ARGS(dev)
223
224);
225
178#endif /* _TRACE_REGMAP_H */ 226#endif /* _TRACE_REGMAP_H */
179 227
180/* This part must be outside protection */ 228/* This part must be outside protection */
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 425bcfe56c62..68c2c2000f02 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -123,7 +123,7 @@ DEFINE_EVENT(timer_class, timer_cancel,
123 123
124/** 124/**
125 * hrtimer_init - called when the hrtimer is initialized 125 * hrtimer_init - called when the hrtimer is initialized
126 * @timer: pointer to struct hrtimer 126 * @hrtimer: pointer to struct hrtimer
127 * @clockid: the hrtimers clock 127 * @clockid: the hrtimers clock
128 * @mode: the hrtimers mode 128 * @mode: the hrtimers mode
129 */ 129 */
@@ -155,7 +155,7 @@ TRACE_EVENT(hrtimer_init,
155 155
156/** 156/**
157 * hrtimer_start - called when the hrtimer is started 157 * hrtimer_start - called when the hrtimer is started
158 * @timer: pointer to struct hrtimer 158 * @hrtimer: pointer to struct hrtimer
159 */ 159 */
160TRACE_EVENT(hrtimer_start, 160TRACE_EVENT(hrtimer_start,
161 161
@@ -186,8 +186,8 @@ TRACE_EVENT(hrtimer_start,
186); 186);
187 187
188/** 188/**
189 * htimmer_expire_entry - called immediately before the hrtimer callback 189 * hrtimer_expire_entry - called immediately before the hrtimer callback
190 * @timer: pointer to struct hrtimer 190 * @hrtimer: pointer to struct hrtimer
191 * @now: pointer to variable which contains current time of the 191 * @now: pointer to variable which contains current time of the
192 * timers base. 192 * timers base.
193 * 193 *
@@ -234,7 +234,7 @@ DECLARE_EVENT_CLASS(hrtimer_class,
234 234
235/** 235/**
236 * hrtimer_expire_exit - called immediately after the hrtimer callback returns 236 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
237 * @timer: pointer to struct hrtimer 237 * @hrtimer: pointer to struct hrtimer
238 * 238 *
239 * When used in combination with the hrtimer_expire_entry tracepoint we can 239 * When used in combination with the hrtimer_expire_entry tracepoint we can
240 * determine the runtime of the callback function. 240 * determine the runtime of the callback function.
@@ -323,6 +323,27 @@ TRACE_EVENT(itimer_expire,
323 (int) __entry->pid, (unsigned long long)__entry->now) 323 (int) __entry->pid, (unsigned long long)__entry->now)
324); 324);
325 325
326#ifdef CONFIG_NO_HZ_COMMON
327TRACE_EVENT(tick_stop,
328
329 TP_PROTO(int success, char *error_msg),
330
331 TP_ARGS(success, error_msg),
332
333 TP_STRUCT__entry(
334 __field( int , success )
335 __string( msg, error_msg )
336 ),
337
338 TP_fast_assign(
339 __entry->success = success;
340 __assign_str(msg, error_msg);
341 ),
342
343 TP_printk("success=%s msg=%s", __entry->success ? "yes" : "no", __get_str(msg))
344);
345#endif
346
326#endif /* _TRACE_TIMER_H */ 347#endif /* _TRACE_TIMER_H */
327 348
328/* This part must be outside protection */ 349/* This part must be outside protection */
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 6a16fd2e70ed..464ea82e10db 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -183,7 +183,6 @@ DECLARE_EVENT_CLASS(writeback_work_class,
183DEFINE_EVENT(writeback_work_class, name, \ 183DEFINE_EVENT(writeback_work_class, name, \
184 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ 184 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
185 TP_ARGS(bdi, work)) 185 TP_ARGS(bdi, work))
186DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
187DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); 186DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
188DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); 187DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
189DEFINE_WRITEBACK_WORK_EVENT(writeback_start); 188DEFINE_WRITEBACK_WORK_EVENT(writeback_start);
@@ -222,12 +221,8 @@ DEFINE_EVENT(writeback_class, name, \
222 221
223DEFINE_WRITEBACK_EVENT(writeback_nowork); 222DEFINE_WRITEBACK_EVENT(writeback_nowork);
224DEFINE_WRITEBACK_EVENT(writeback_wake_background); 223DEFINE_WRITEBACK_EVENT(writeback_wake_background);
225DEFINE_WRITEBACK_EVENT(writeback_wake_thread);
226DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread);
227DEFINE_WRITEBACK_EVENT(writeback_bdi_register); 224DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
228DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); 225DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
229DEFINE_WRITEBACK_EVENT(writeback_thread_start);
230DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
231 226
232DECLARE_EVENT_CLASS(wbc_class, 227DECLARE_EVENT_CLASS(wbc_class,
233 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), 228 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 40dc5e8fe340..19edd7facaa1 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -227,29 +227,18 @@ static notrace enum print_line_t \
227ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \ 227ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
228 struct trace_event *trace_event) \ 228 struct trace_event *trace_event) \
229{ \ 229{ \
230 struct ftrace_event_call *event; \
231 struct trace_seq *s = &iter->seq; \ 230 struct trace_seq *s = &iter->seq; \
231 struct trace_seq __maybe_unused *p = &iter->tmp_seq; \
232 struct ftrace_raw_##call *field; \ 232 struct ftrace_raw_##call *field; \
233 struct trace_entry *entry; \
234 struct trace_seq *p = &iter->tmp_seq; \
235 int ret; \ 233 int ret; \
236 \ 234 \
237 event = container_of(trace_event, struct ftrace_event_call, \ 235 field = (typeof(field))iter->ent; \
238 event); \
239 \
240 entry = iter->ent; \
241 \
242 if (entry->type != event->event.type) { \
243 WARN_ON_ONCE(1); \
244 return TRACE_TYPE_UNHANDLED; \
245 } \
246 \
247 field = (typeof(field))entry; \
248 \ 236 \
249 trace_seq_init(p); \ 237 ret = ftrace_raw_output_prep(iter, trace_event); \
250 ret = trace_seq_printf(s, "%s: ", event->name); \
251 if (ret) \ 238 if (ret) \
252 ret = trace_seq_printf(s, print); \ 239 return ret; \
240 \
241 ret = trace_seq_printf(s, print); \
253 if (!ret) \ 242 if (!ret) \
254 return TRACE_TYPE_PARTIAL_LINE; \ 243 return TRACE_TYPE_PARTIAL_LINE; \
255 \ 244 \
@@ -335,7 +324,7 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
335 324
336#undef DECLARE_EVENT_CLASS 325#undef DECLARE_EVENT_CLASS
337#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ 326#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
338static int notrace \ 327static int notrace __init \
339ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ 328ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
340{ \ 329{ \
341 struct ftrace_raw_##call field; \ 330 struct ftrace_raw_##call field; \
@@ -414,7 +403,8 @@ static inline notrace int ftrace_get_offsets_##call( \
414 * 403 *
415 * static void ftrace_raw_event_<call>(void *__data, proto) 404 * static void ftrace_raw_event_<call>(void *__data, proto)
416 * { 405 * {
417 * struct ftrace_event_call *event_call = __data; 406 * struct ftrace_event_file *ftrace_file = __data;
407 * struct ftrace_event_call *event_call = ftrace_file->event_call;
418 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; 408 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
419 * struct ring_buffer_event *event; 409 * struct ring_buffer_event *event;
420 * struct ftrace_raw_<call> *entry; <-- defined in stage 1 410 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
@@ -423,12 +413,16 @@ static inline notrace int ftrace_get_offsets_##call( \
423 * int __data_size; 413 * int __data_size;
424 * int pc; 414 * int pc;
425 * 415 *
416 * if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
417 * &ftrace_file->flags))
418 * return;
419 *
426 * local_save_flags(irq_flags); 420 * local_save_flags(irq_flags);
427 * pc = preempt_count(); 421 * pc = preempt_count();
428 * 422 *
429 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); 423 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
430 * 424 *
431 * event = trace_current_buffer_lock_reserve(&buffer, 425 * event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,
432 * event_<call>->event.type, 426 * event_<call>->event.type,
433 * sizeof(*entry) + __data_size, 427 * sizeof(*entry) + __data_size,
434 * irq_flags, pc); 428 * irq_flags, pc);
@@ -440,7 +434,7 @@ static inline notrace int ftrace_get_offsets_##call( \
440 * __array macros. 434 * __array macros.
441 * 435 *
442 * if (!filter_current_check_discard(buffer, event_call, entry, event)) 436 * if (!filter_current_check_discard(buffer, event_call, entry, event))
443 * trace_current_buffer_unlock_commit(buffer, 437 * trace_nowake_buffer_unlock_commit(buffer,
444 * event, irq_flags, pc); 438 * event, irq_flags, pc);
445 * } 439 * }
446 * 440 *
@@ -518,7 +512,8 @@ static inline notrace int ftrace_get_offsets_##call( \
518static notrace void \ 512static notrace void \
519ftrace_raw_event_##call(void *__data, proto) \ 513ftrace_raw_event_##call(void *__data, proto) \
520{ \ 514{ \
521 struct ftrace_event_call *event_call = __data; \ 515 struct ftrace_event_file *ftrace_file = __data; \
516 struct ftrace_event_call *event_call = ftrace_file->event_call; \
522 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 517 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
523 struct ring_buffer_event *event; \ 518 struct ring_buffer_event *event; \
524 struct ftrace_raw_##call *entry; \ 519 struct ftrace_raw_##call *entry; \
@@ -527,12 +522,16 @@ ftrace_raw_event_##call(void *__data, proto) \
527 int __data_size; \ 522 int __data_size; \
528 int pc; \ 523 int pc; \
529 \ 524 \
525 if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, \
526 &ftrace_file->flags)) \
527 return; \
528 \
530 local_save_flags(irq_flags); \ 529 local_save_flags(irq_flags); \
531 pc = preempt_count(); \ 530 pc = preempt_count(); \
532 \ 531 \
533 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 532 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
534 \ 533 \
535 event = trace_current_buffer_lock_reserve(&buffer, \ 534 event = trace_event_buffer_lock_reserve(&buffer, ftrace_file, \
536 event_call->event.type, \ 535 event_call->event.type, \
537 sizeof(*entry) + __data_size, \ 536 sizeof(*entry) + __data_size, \
538 irq_flags, pc); \ 537 irq_flags, pc); \
@@ -581,7 +580,7 @@ static inline void ftrace_test_probe_##call(void) \
581#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 580#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
582_TRACE_PERF_PROTO(call, PARAMS(proto)); \ 581_TRACE_PERF_PROTO(call, PARAMS(proto)); \
583static const char print_fmt_##call[] = print; \ 582static const char print_fmt_##call[] = print; \
584static struct ftrace_event_class __used event_class_##call = { \ 583static struct ftrace_event_class __used __refdata event_class_##call = { \
585 .system = __stringify(TRACE_SYSTEM), \ 584 .system = __stringify(TRACE_SYSTEM), \
586 .define_fields = ftrace_define_fields_##call, \ 585 .define_fields = ftrace_define_fields_##call, \
587 .fields = LIST_HEAD_INIT(event_class_##call.fields),\ 586 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
@@ -705,5 +704,3 @@ static inline void perf_test_probe_##call(void) \
705#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 704#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
706#endif /* CONFIG_PERF_EVENTS */ 705#endif /* CONFIG_PERF_EVENTS */
707 706
708#undef _TRACE_PROFILE_INIT
709
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 4ef3acbba5da..c5d2e3a1cf68 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -74,4 +74,6 @@
74 74
75#define SO_LOCK_FILTER 44 75#define SO_LOCK_FILTER 44
76 76
77#define SO_SELECT_ERR_QUEUE 45
78
77#endif /* __ASM_GENERIC_SOCKET_H */ 79#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild
index ba99ce3f7372..119487e05e65 100644
--- a/include/uapi/drm/Kbuild
+++ b/include/uapi/drm/Kbuild
@@ -8,9 +8,11 @@ header-y += i810_drm.h
8header-y += i915_drm.h 8header-y += i915_drm.h
9header-y += mga_drm.h 9header-y += mga_drm.h
10header-y += nouveau_drm.h 10header-y += nouveau_drm.h
11header-y += qxl_drm.h
11header-y += r128_drm.h 12header-y += r128_drm.h
12header-y += radeon_drm.h 13header-y += radeon_drm.h
13header-y += savage_drm.h 14header-y += savage_drm.h
14header-y += sis_drm.h 15header-y += sis_drm.h
16header-y += tegra_drm.h
15header-y += via_drm.h 17header-y += via_drm.h
16header-y += vmwgfx_drm.h 18header-y += vmwgfx_drm.h
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 8d1e2bbee83a..5a57be68bab7 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -36,7 +36,7 @@
36#ifndef _DRM_H_ 36#ifndef _DRM_H_
37#define _DRM_H_ 37#define _DRM_H_
38 38
39#if defined(__linux__) 39#if defined(__KERNEL__) || defined(__linux__)
40 40
41#include <linux/types.h> 41#include <linux/types.h>
42#include <asm/ioctl.h> 42#include <asm/ioctl.h>
@@ -711,8 +711,8 @@ struct drm_prime_handle {
711#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) 711#define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
712#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) 712#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder)
713#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) 713#define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector)
714#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) 714#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */
715#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) 715#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */
716 716
717#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) 717#define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property)
718#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) 718#define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 3d6301b6ec16..090e5331ab7e 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -367,13 +367,13 @@ struct drm_mode_mode_cmd {
367 * depending on the value in flags different members are used. 367 * depending on the value in flags different members are used.
368 * 368 *
369 * CURSOR_BO uses 369 * CURSOR_BO uses
370 * crtc 370 * crtc_id
371 * width 371 * width
372 * height 372 * height
373 * handle - if 0 turns the cursor of 373 * handle - if 0 turns the cursor off
374 * 374 *
375 * CURSOR_MOVE uses 375 * CURSOR_MOVE uses
376 * crtc 376 * crtc_id
377 * x 377 * x
378 * y 378 * y
379 */ 379 */
diff --git a/include/uapi/drm/qxl_drm.h b/include/uapi/drm/qxl_drm.h
new file mode 100644
index 000000000000..ebebd36c4117
--- /dev/null
+++ b/include/uapi/drm/qxl_drm.h
@@ -0,0 +1,152 @@
1/*
2 * Copyright 2013 Red Hat
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef QXL_DRM_H
25#define QXL_DRM_H
26
27#include <stddef.h>
28#include "drm/drm.h"
29
30/* Please note that modifications to all structs defined here are
31 * subject to backwards-compatibility constraints.
32 *
33 * Do not use pointers, use uint64_t instead for 32 bit / 64 bit user/kernel
34 * compatibility Keep fields aligned to their size
35 */
36
37#define QXL_GEM_DOMAIN_CPU 0
38#define QXL_GEM_DOMAIN_VRAM 1
39#define QXL_GEM_DOMAIN_SURFACE 2
40
41#define DRM_QXL_ALLOC 0x00
42#define DRM_QXL_MAP 0x01
43#define DRM_QXL_EXECBUFFER 0x02
44#define DRM_QXL_UPDATE_AREA 0x03
45#define DRM_QXL_GETPARAM 0x04
46#define DRM_QXL_CLIENTCAP 0x05
47
48#define DRM_QXL_ALLOC_SURF 0x06
49
50struct drm_qxl_alloc {
51 uint32_t size;
52 uint32_t handle; /* 0 is an invalid handle */
53};
54
55struct drm_qxl_map {
56 uint64_t offset; /* use for mmap system call */
57 uint32_t handle;
58 uint32_t pad;
59};
60
61/*
62 * dest is the bo we are writing the relocation into
63 * src is bo we are relocating.
64 * *(dest_handle.base_addr + dest_offset) = physical_address(src_handle.addr +
65 * src_offset)
66 */
67#define QXL_RELOC_TYPE_BO 1
68#define QXL_RELOC_TYPE_SURF 2
69
70struct drm_qxl_reloc {
71 uint64_t src_offset; /* offset into src_handle or src buffer */
72 uint64_t dst_offset; /* offset in dest handle */
73 uint32_t src_handle; /* dest handle to compute address from */
74 uint32_t dst_handle; /* 0 if to command buffer */
75 uint32_t reloc_type;
76 uint32_t pad;
77};
78
79struct drm_qxl_command {
80 uint64_t __user command; /* void* */
81 uint64_t __user relocs; /* struct drm_qxl_reloc* */
82 uint32_t type;
83 uint32_t command_size;
84 uint32_t relocs_num;
85 uint32_t pad;
86};
87
88/* XXX: call it drm_qxl_commands? */
89struct drm_qxl_execbuffer {
90 uint32_t flags; /* for future use */
91 uint32_t commands_num;
92 uint64_t __user commands; /* struct drm_qxl_command* */
93};
94
95struct drm_qxl_update_area {
96 uint32_t handle;
97 uint32_t top;
98 uint32_t left;
99 uint32_t bottom;
100 uint32_t right;
101 uint32_t pad;
102};
103
104#define QXL_PARAM_NUM_SURFACES 1 /* rom->n_surfaces */
105#define QXL_PARAM_MAX_RELOCS 2
106struct drm_qxl_getparam {
107 uint64_t param;
108 uint64_t value;
109};
110
111/* these are one bit values */
112struct drm_qxl_clientcap {
113 uint32_t index;
114 uint32_t pad;
115};
116
117struct drm_qxl_alloc_surf {
118 uint32_t format;
119 uint32_t width;
120 uint32_t height;
121 int32_t stride;
122 uint32_t handle;
123 uint32_t pad;
124};
125
126#define DRM_IOCTL_QXL_ALLOC \
127 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC, struct drm_qxl_alloc)
128
129#define DRM_IOCTL_QXL_MAP \
130 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_MAP, struct drm_qxl_map)
131
132#define DRM_IOCTL_QXL_EXECBUFFER \
133 DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_EXECBUFFER,\
134 struct drm_qxl_execbuffer)
135
136#define DRM_IOCTL_QXL_UPDATE_AREA \
137 DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_UPDATE_AREA,\
138 struct drm_qxl_update_area)
139
140#define DRM_IOCTL_QXL_GETPARAM \
141 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_GETPARAM,\
142 struct drm_qxl_getparam)
143
144#define DRM_IOCTL_QXL_CLIENTCAP \
145 DRM_IOW(DRM_COMMAND_BASE + DRM_QXL_CLIENTCAP,\
146 struct drm_qxl_clientcap)
147
148#define DRM_IOCTL_QXL_ALLOC_SURF \
149 DRM_IOWR(DRM_COMMAND_BASE + DRM_QXL_ALLOC_SURF,\
150 struct drm_qxl_alloc_surf)
151
152#endif
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index eeda91774c8a..321d4ac5c512 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -918,6 +918,7 @@ struct drm_radeon_gem_va {
918#define RADEON_CS_RING_GFX 0 918#define RADEON_CS_RING_GFX 0
919#define RADEON_CS_RING_COMPUTE 1 919#define RADEON_CS_RING_COMPUTE 1
920#define RADEON_CS_RING_DMA 2 920#define RADEON_CS_RING_DMA 2
921#define RADEON_CS_RING_UVD 3
921/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ 922/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
922/* 0 = normal, + = higher priority, - = lower priority */ 923/* 0 = normal, + = higher priority, - = lower priority */
923 924
@@ -972,6 +973,13 @@ struct drm_radeon_cs {
972#define RADEON_INFO_MAX_SE 0x12 973#define RADEON_INFO_MAX_SE 0x12
973/* max SH per SE */ 974/* max SH per SE */
974#define RADEON_INFO_MAX_SH_PER_SE 0x13 975#define RADEON_INFO_MAX_SH_PER_SE 0x13
976/* fast fb access is enabled */
977#define RADEON_INFO_FASTFB_WORKING 0x14
978/* query if a RADEON_CS_RING_* submission is supported */
979#define RADEON_INFO_RING_WORKING 0x15
980/* SI tile mode array */
981#define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16
982
975 983
976struct drm_radeon_info { 984struct drm_radeon_info {
977 uint32_t request; 985 uint32_t request;
@@ -979,4 +987,22 @@ struct drm_radeon_info {
979 uint64_t value; 987 uint64_t value;
980}; 988};
981 989
990/* Those correspond to the tile index to use, this is to explicitly state
991 * the API that is implicitly defined by the tile mode array.
992 */
993#define SI_TILE_MODE_COLOR_LINEAR_ALIGNED 8
994#define SI_TILE_MODE_COLOR_1D 13
995#define SI_TILE_MODE_COLOR_1D_SCANOUT 9
996#define SI_TILE_MODE_COLOR_2D_8BPP 14
997#define SI_TILE_MODE_COLOR_2D_16BPP 15
998#define SI_TILE_MODE_COLOR_2D_32BPP 16
999#define SI_TILE_MODE_COLOR_2D_64BPP 17
1000#define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP 11
1001#define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP 12
1002#define SI_TILE_MODE_DEPTH_STENCIL_1D 4
1003#define SI_TILE_MODE_DEPTH_STENCIL_2D 0
1004#define SI_TILE_MODE_DEPTH_STENCIL_2D_2AA 3
1005#define SI_TILE_MODE_DEPTH_STENCIL_2D_4AA 3
1006#define SI_TILE_MODE_DEPTH_STENCIL_2D_8AA 2
1007
982#endif 1008#endif
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
new file mode 100644
index 000000000000..6e132a2f7420
--- /dev/null
+++ b/include/uapi/drm/tegra_drm.h
@@ -0,0 +1,136 @@
1/*
2 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _UAPI_TEGRA_DRM_H_
18#define _UAPI_TEGRA_DRM_H_
19
20struct drm_tegra_gem_create {
21 __u64 size;
22 __u32 flags;
23 __u32 handle;
24};
25
26struct drm_tegra_gem_mmap {
27 __u32 handle;
28 __u32 offset;
29};
30
31struct drm_tegra_syncpt_read {
32 __u32 id;
33 __u32 value;
34};
35
36struct drm_tegra_syncpt_incr {
37 __u32 id;
38 __u32 pad;
39};
40
41struct drm_tegra_syncpt_wait {
42 __u32 id;
43 __u32 thresh;
44 __u32 timeout;
45 __u32 value;
46};
47
48#define DRM_TEGRA_NO_TIMEOUT (0xffffffff)
49
50struct drm_tegra_open_channel {
51 __u32 client;
52 __u32 pad;
53 __u64 context;
54};
55
56struct drm_tegra_close_channel {
57 __u64 context;
58};
59
60struct drm_tegra_get_syncpt {
61 __u64 context;
62 __u32 index;
63 __u32 id;
64};
65
66struct drm_tegra_syncpt {
67 __u32 id;
68 __u32 incrs;
69};
70
71struct drm_tegra_cmdbuf {
72 __u32 handle;
73 __u32 offset;
74 __u32 words;
75 __u32 pad;
76};
77
78struct drm_tegra_reloc {
79 struct {
80 __u32 handle;
81 __u32 offset;
82 } cmdbuf;
83 struct {
84 __u32 handle;
85 __u32 offset;
86 } target;
87 __u32 shift;
88 __u32 pad;
89};
90
91struct drm_tegra_waitchk {
92 __u32 handle;
93 __u32 offset;
94 __u32 syncpt;
95 __u32 thresh;
96};
97
98struct drm_tegra_submit {
99 __u64 context;
100 __u32 num_syncpts;
101 __u32 num_cmdbufs;
102 __u32 num_relocs;
103 __u32 num_waitchks;
104 __u32 waitchk_mask;
105 __u32 timeout;
106 __u32 pad;
107 __u64 syncpts;
108 __u64 cmdbufs;
109 __u64 relocs;
110 __u64 waitchks;
111 __u32 fence; /* Return value */
112
113 __u32 reserved[5]; /* future expansion */
114};
115
116#define DRM_TEGRA_GEM_CREATE 0x00
117#define DRM_TEGRA_GEM_MMAP 0x01
118#define DRM_TEGRA_SYNCPT_READ 0x02
119#define DRM_TEGRA_SYNCPT_INCR 0x03
120#define DRM_TEGRA_SYNCPT_WAIT 0x04
121#define DRM_TEGRA_OPEN_CHANNEL 0x05
122#define DRM_TEGRA_CLOSE_CHANNEL 0x06
123#define DRM_TEGRA_GET_SYNCPT 0x07
124#define DRM_TEGRA_SUBMIT 0x08
125
126#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
127#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
128#define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
129#define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
130#define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
131#define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
132#define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel)
133#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
134#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
135
136#endif
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 5c8a1d25e21c..ab5d4992e568 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -285,6 +285,7 @@ header-y += nvram.h
285header-y += omap3isp.h 285header-y += omap3isp.h
286header-y += omapfb.h 286header-y += omapfb.h
287header-y += oom.h 287header-y += oom.h
288header-y += openvswitch.h
288header-y += packet_diag.h 289header-y += packet_diag.h
289header-y += param.h 290header-y += param.h
290header-y += parport.h 291header-y += parport.h
@@ -331,6 +332,7 @@ header-y += rtnetlink.h
331header-y += scc.h 332header-y += scc.h
332header-y += sched.h 333header-y += sched.h
333header-y += screen_info.h 334header-y += screen_info.h
335header-y += sctp.h
334header-y += sdla.h 336header-y += sdla.h
335header-y += seccomp.h 337header-y += seccomp.h
336header-y += securebits.h 338header-y += securebits.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 9f096f1c0907..75cef3fd97ad 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -246,6 +246,7 @@
246#define AUDIT_OBJ_TYPE 21 246#define AUDIT_OBJ_TYPE 21
247#define AUDIT_OBJ_LEV_LOW 22 247#define AUDIT_OBJ_LEV_LOW 22
248#define AUDIT_OBJ_LEV_HIGH 23 248#define AUDIT_OBJ_LEV_HIGH 23
249#define AUDIT_LOGINUID_SET 24
249 250
250 /* These are ONLY useful when checking 251 /* These are ONLY useful when checking
251 * at syscall exit time (AUDIT_AT_EXIT). */ 252 * at syscall exit time (AUDIT_AT_EXIT). */
@@ -369,7 +370,8 @@ struct audit_status {
369}; 370};
370 371
371struct audit_tty_status { 372struct audit_tty_status {
372 __u32 enabled; /* 1 = enabled, 0 = disabled */ 373 __u32 enabled; /* 1 = enabled, 0 = disabled */
374 __u32 log_passwd; /* 1 = enabled, 0 = disabled */
373}; 375};
374 376
375/* audit_rule_data supports filter rules with both integer and string 377/* audit_rule_data supports filter rules with both integer and string
diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
index 61594d598e7b..835c065cc7e1 100644
--- a/include/uapi/linux/auxvec.h
+++ b/include/uapi/linux/auxvec.h
@@ -28,6 +28,7 @@
28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may 28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
29 * differ from AT_PLATFORM. */ 29 * differ from AT_PLATFORM. */
30#define AT_RANDOM 25 /* address of 16 random bytes */ 30#define AT_RANDOM 25 /* address of 16 random bytes */
31#define AT_HWCAP2 26 /* extension of AT_HWCAP */
31 32
32#define AT_EXECFN 31 /* filename of program */ 33#define AT_EXECFN 31 /* filename of program */
33 34
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index fa3a5f9338fc..5ef0df545a2a 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -376,12 +376,18 @@ struct btrfs_ioctl_get_dev_stats {
376 376
377#define BTRFS_QUOTA_CTL_ENABLE 1 377#define BTRFS_QUOTA_CTL_ENABLE 1
378#define BTRFS_QUOTA_CTL_DISABLE 2 378#define BTRFS_QUOTA_CTL_DISABLE 2
379#define BTRFS_QUOTA_CTL_RESCAN 3 379#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
380struct btrfs_ioctl_quota_ctl_args { 380struct btrfs_ioctl_quota_ctl_args {
381 __u64 cmd; 381 __u64 cmd;
382 __u64 status; 382 __u64 status;
383}; 383};
384 384
385struct btrfs_ioctl_quota_rescan_args {
386 __u64 flags;
387 __u64 progress;
388 __u64 reserved[6];
389};
390
385struct btrfs_ioctl_qgroup_assign_args { 391struct btrfs_ioctl_qgroup_assign_args {
386 __u64 assign; 392 __u64 assign;
387 __u64 src; 393 __u64 src;
@@ -412,7 +418,25 @@ struct btrfs_ioctl_received_subvol_args {
412 * search of clone sources doesn't find an extent. UPDATE_EXTENT 418 * search of clone sources doesn't find an extent. UPDATE_EXTENT
413 * commands will be sent instead of WRITE commands. 419 * commands will be sent instead of WRITE commands.
414 */ 420 */
415#define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1 421#define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
422
423/*
424 * Do not add the leading stream header. Used when multiple snapshots
425 * are sent back to back.
426 */
427#define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
428
429/*
430 * Omit the command at the end of the stream that indicated the end
431 * of the stream. This option is used when multiple snapshots are
432 * sent back to back.
433 */
434#define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
435
436#define BTRFS_SEND_FLAG_MASK \
437 (BTRFS_SEND_FLAG_NO_FILE_DATA | \
438 BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
439 BTRFS_SEND_FLAG_OMIT_END_CMD)
416 440
417struct btrfs_ioctl_send_args { 441struct btrfs_ioctl_send_args {
418 __s64 send_fd; /* in */ 442 __s64 send_fd; /* in */
@@ -502,6 +526,10 @@ struct btrfs_ioctl_send_args {
502 struct btrfs_ioctl_qgroup_create_args) 526 struct btrfs_ioctl_qgroup_create_args)
503#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \ 527#define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
504 struct btrfs_ioctl_qgroup_limit_args) 528 struct btrfs_ioctl_qgroup_limit_args)
529#define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
530 struct btrfs_ioctl_quota_rescan_args)
531#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
532 struct btrfs_ioctl_quota_rescan_args)
505#define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \ 533#define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \
506 char[BTRFS_LABEL_SIZE]) 534 char[BTRFS_LABEL_SIZE])
507#define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \ 535#define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \
diff --git a/include/uapi/linux/caif/caif_socket.h b/include/uapi/linux/caif/caif_socket.h
index 3f3bac6af7bc..586e9f98184f 100644
--- a/include/uapi/linux/caif/caif_socket.h
+++ b/include/uapi/linux/caif/caif_socket.h
@@ -1,7 +1,7 @@
1/* linux/caif_socket.h 1/* linux/caif_socket.h
2 * CAIF Definitions for CAIF socket and network layer 2 * CAIF Definitions for CAIF socket and network layer
3 * Copyright (C) ST-Ericsson AB 2010 3 * Copyright (C) ST-Ericsson AB 2010
4 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com 4 * Author: Sjur Brendeland
5 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
6 */ 6 */
7 7
diff --git a/include/uapi/linux/caif/if_caif.h b/include/uapi/linux/caif/if_caif.h
index 5e7eed4edf51..7618aabe8c6b 100644
--- a/include/uapi/linux/caif/if_caif.h
+++ b/include/uapi/linux/caif/if_caif.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) ST-Ericsson AB 2010 2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com 3 * Author: Sjur Brendeland
4 * License terms: GNU General Public License (GPL) version 2 4 * License terms: GNU General Public License (GPL) version 2
5 */ 5 */
6 6
diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h
index 0d7b49973bb3..f6c271035bbd 100644
--- a/include/uapi/linux/cn_proc.h
+++ b/include/uapi/linux/cn_proc.h
@@ -56,7 +56,9 @@ struct proc_event {
56 PROC_EVENT_PTRACE = 0x00000100, 56 PROC_EVENT_PTRACE = 0x00000100,
57 PROC_EVENT_COMM = 0x00000200, 57 PROC_EVENT_COMM = 0x00000200,
58 /* "next" should be 0x00000400 */ 58 /* "next" should be 0x00000400 */
59 /* "last" is the last process event: exit */ 59 /* "last" is the last process event: exit,
60 * while "next to last" is coredumping event */
61 PROC_EVENT_COREDUMP = 0x40000000,
60 PROC_EVENT_EXIT = 0x80000000 62 PROC_EVENT_EXIT = 0x80000000
61 } what; 63 } what;
62 __u32 cpu; 64 __u32 cpu;
@@ -110,11 +112,17 @@ struct proc_event {
110 char comm[16]; 112 char comm[16];
111 } comm; 113 } comm;
112 114
115 struct coredump_proc_event {
116 __kernel_pid_t process_pid;
117 __kernel_pid_t process_tgid;
118 } coredump;
119
113 struct exit_proc_event { 120 struct exit_proc_event {
114 __kernel_pid_t process_pid; 121 __kernel_pid_t process_pid;
115 __kernel_pid_t process_tgid; 122 __kernel_pid_t process_tgid;
116 __u32 exit_code, exit_signal; 123 __u32 exit_code, exit_signal;
117 } exit; 124 } exit;
125
118 } event_data; 126 } event_data;
119}; 127};
120 128
diff --git a/include/uapi/linux/connector.h b/include/uapi/linux/connector.h
index 8761a0349c74..4cb283505e45 100644
--- a/include/uapi/linux/connector.h
+++ b/include/uapi/linux/connector.h
@@ -44,8 +44,11 @@
44#define CN_VAL_DRBD 0x1 44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */ 45#define CN_KVP_IDX 0x9 /* HyperV KVP */
46#define CN_KVP_VAL 0x1 /* queries from the kernel */ 46#define CN_KVP_VAL 0x1 /* queries from the kernel */
47#define CN_VSS_IDX 0xA /* HyperV VSS */
48#define CN_VSS_VAL 0x1 /* queries from the kernel */
47 49
48#define CN_NETLINK_USERS 10 /* Highest index + 1 */ 50
51#define CN_NETLINK_USERS 11 /* Highest index + 1 */
49 52
50/* 53/*
51 * Maximum connector's message size. 54 * Maximum connector's message size.
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index b2a9ad8cafdc..b4fb650d9d4f 100644
--- a/include/uapi/linux/dvb/dmx.h
+++ b/include/uapi/linux/dvb/dmx.h
@@ -51,7 +51,7 @@ typedef enum
51} dmx_input_t; 51} dmx_input_t;
52 52
53 53
54typedef enum 54typedef enum dmx_ts_pes
55{ 55{
56 DMX_PES_AUDIO0, 56 DMX_PES_AUDIO0,
57 DMX_PES_VIDEO0, 57 DMX_PES_VIDEO0,
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index 8072d352b98f..ef6103bf1f9b 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -397,6 +397,7 @@ typedef struct elf64_shdr {
397#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ 397#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
398#define NT_METAG_CBUF 0x500 /* Metag catch buffer registers */ 398#define NT_METAG_CBUF 0x500 /* Metag catch buffer registers */
399#define NT_METAG_RPIPE 0x501 /* Metag read pipeline state */ 399#define NT_METAG_RPIPE 0x501 /* Metag read pipeline state */
400#define NT_METAG_TLS 0x502 /* Metag TLS pointer */
400 401
401 402
402/* Note header in a PT_NOTE section */ 403/* Note header in a PT_NOTE section */
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 9cfde6941099..8eb9ccaa5b48 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -129,7 +129,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
129#define SKF_AD_ALU_XOR_X 40 129#define SKF_AD_ALU_XOR_X 40
130#define SKF_AD_VLAN_TAG 44 130#define SKF_AD_VLAN_TAG 44
131#define SKF_AD_VLAN_TAG_PRESENT 48 131#define SKF_AD_VLAN_TAG_PRESENT 48
132#define SKF_AD_MAX 52 132#define SKF_AD_PAY_OFFSET 52
133#define SKF_AD_MAX 56
133#define SKF_NET_OFF (-0x100000) 134#define SKF_NET_OFF (-0x100000)
134#define SKF_LL_OFF (-0x200000) 135#define SKF_LL_OFF (-0x200000)
135 136
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index c7fc1e6517c3..a4ed56cf0eac 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -88,7 +88,6 @@ struct inodes_stat_t {
88#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 88#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
89 89
90/* These sb flags are internal to the kernel */ 90/* These sb flags are internal to the kernel */
91#define MS_SNAP_STABLE (1<<27) /* Snapshot pages during writeback, if needed */
92#define MS_NOSEC (1<<28) 91#define MS_NOSEC (1<<28)
93#define MS_BORN (1<<29) 92#define MS_BORN (1<<29)
94#define MS_ACTIVE (1<<30) 93#define MS_ACTIVE (1<<30)
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 706d035fa748..60bb2f9f7b74 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -90,6 +90,9 @@
90 * 7.21 90 * 7.21
91 * - add FUSE_READDIRPLUS 91 * - add FUSE_READDIRPLUS
92 * - send the requested events in POLL request 92 * - send the requested events in POLL request
93 *
94 * 7.22
95 * - add FUSE_ASYNC_DIO
93 */ 96 */
94 97
95#ifndef _LINUX_FUSE_H 98#ifndef _LINUX_FUSE_H
@@ -125,7 +128,7 @@
125#define FUSE_KERNEL_VERSION 7 128#define FUSE_KERNEL_VERSION 7
126 129
127/** Minor version number of this interface */ 130/** Minor version number of this interface */
128#define FUSE_KERNEL_MINOR_VERSION 21 131#define FUSE_KERNEL_MINOR_VERSION 22
129 132
130/** The node ID of the root inode */ 133/** The node ID of the root inode */
131#define FUSE_ROOT_ID 1 134#define FUSE_ROOT_ID 1
@@ -215,6 +218,7 @@ struct fuse_file_lock {
215 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages 218 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
216 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 219 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
217 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 220 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
221 * FUSE_ASYNC_DIO: asynchronous direct I/O submission
218 */ 222 */
219#define FUSE_ASYNC_READ (1 << 0) 223#define FUSE_ASYNC_READ (1 << 0)
220#define FUSE_POSIX_LOCKS (1 << 1) 224#define FUSE_POSIX_LOCKS (1 << 1)
@@ -231,6 +235,7 @@ struct fuse_file_lock {
231#define FUSE_AUTO_INVAL_DATA (1 << 12) 235#define FUSE_AUTO_INVAL_DATA (1 << 12)
232#define FUSE_DO_READDIRPLUS (1 << 13) 236#define FUSE_DO_READDIRPLUS (1 << 13)
233#define FUSE_READDIRPLUS_AUTO (1 << 14) 237#define FUSE_READDIRPLUS_AUTO (1 << 14)
238#define FUSE_ASYNC_DIO (1 << 15)
234 239
235/** 240/**
236 * CUSE INIT request/reply flags 241 * CUSE INIT request/reply flags
diff --git a/include/uapi/linux/if_cablemodem.h b/include/uapi/linux/if_cablemodem.h
index 9ca1007edd93..ee6b3c442baf 100644
--- a/include/uapi/linux/if_cablemodem.h
+++ b/include/uapi/linux/if_cablemodem.h
@@ -12,11 +12,11 @@
12 */ 12 */
13 13
14/* some useful defines for sb1000.c e cmconfig.c - fv */ 14/* some useful defines for sb1000.c e cmconfig.c - fv */
15#define SIOCGCMSTATS SIOCDEVPRIVATE+0 /* get cable modem stats */ 15#define SIOCGCMSTATS (SIOCDEVPRIVATE+0) /* get cable modem stats */
16#define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1 /* get cm firmware version */ 16#define SIOCGCMFIRMWARE (SIOCDEVPRIVATE+1) /* get cm firmware version */
17#define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2 /* get cable modem frequency */ 17#define SIOCGCMFREQUENCY (SIOCDEVPRIVATE+2) /* get cable modem frequency */
18#define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3 /* set cable modem frequency */ 18#define SIOCSCMFREQUENCY (SIOCDEVPRIVATE+3) /* set cable modem frequency */
19#define SIOCGCMPIDS SIOCDEVPRIVATE+4 /* get cable modem PIDs */ 19#define SIOCGCMPIDS (SIOCDEVPRIVATE+4) /* get cable modem PIDs */
20#define SIOCSCMPIDS SIOCDEVPRIVATE+5 /* set cable modem PIDs */ 20#define SIOCSCMPIDS (SIOCDEVPRIVATE+5) /* set cable modem PIDs */
21 21
22#endif 22#endif
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 798032d01112..ade07f1c491a 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -94,6 +94,9 @@
94#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ 94#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
95#define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ 95#define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
96 96
97#define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value
98 * then the frame is Ethernet II. Else it is 802.3 */
99
97/* 100/*
98 * Non DIX types. Won't clash for 1500 types. 101 * Non DIX types. Won't clash for 1500 types.
99 */ 102 */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index c4edfe11f1f7..b05823cae784 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -201,6 +201,7 @@ enum {
201 IFLA_INET6_MCAST, /* MC things. What of them? */ 201 IFLA_INET6_MCAST, /* MC things. What of them? */
202 IFLA_INET6_CACHEINFO, /* time values and max reasm size */ 202 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
203 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ 203 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
204 IFLA_INET6_TOKEN, /* device token */
204 __IFLA_INET6_MAX 205 __IFLA_INET6_MAX
205}; 206};
206 207
@@ -249,6 +250,7 @@ enum {
249 IFLA_VLAN_FLAGS, 250 IFLA_VLAN_FLAGS,
250 IFLA_VLAN_EGRESS_QOS, 251 IFLA_VLAN_EGRESS_QOS,
251 IFLA_VLAN_INGRESS_QOS, 252 IFLA_VLAN_INGRESS_QOS,
253 IFLA_VLAN_PROTOCOL,
252 __IFLA_VLAN_MAX, 254 __IFLA_VLAN_MAX,
253}; 255};
254 256
@@ -295,7 +297,7 @@ enum macvlan_mode {
295enum { 297enum {
296 IFLA_VXLAN_UNSPEC, 298 IFLA_VXLAN_UNSPEC,
297 IFLA_VXLAN_ID, 299 IFLA_VXLAN_ID,
298 IFLA_VXLAN_GROUP, 300 IFLA_VXLAN_GROUP, /* group or remote address */
299 IFLA_VXLAN_LINK, 301 IFLA_VXLAN_LINK,
300 IFLA_VXLAN_LOCAL, 302 IFLA_VXLAN_LOCAL,
301 IFLA_VXLAN_TTL, 303 IFLA_VXLAN_TTL,
@@ -303,11 +305,12 @@ enum {
303 IFLA_VXLAN_LEARNING, 305 IFLA_VXLAN_LEARNING,
304 IFLA_VXLAN_AGEING, 306 IFLA_VXLAN_AGEING,
305 IFLA_VXLAN_LIMIT, 307 IFLA_VXLAN_LIMIT,
306 IFLA_VXLAN_PORT_RANGE, 308 IFLA_VXLAN_PORT_RANGE, /* source port */
307 IFLA_VXLAN_PROXY, 309 IFLA_VXLAN_PROXY,
308 IFLA_VXLAN_RSC, 310 IFLA_VXLAN_RSC,
309 IFLA_VXLAN_L2MISS, 311 IFLA_VXLAN_L2MISS,
310 IFLA_VXLAN_L3MISS, 312 IFLA_VXLAN_L3MISS,
313 IFLA_VXLAN_PORT, /* destination port */
311 __IFLA_VXLAN_MAX 314 __IFLA_VXLAN_MAX
312}; 315};
313#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 316#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
index f9a60375f0d0..b950c02030c0 100644
--- a/include/uapi/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
@@ -55,6 +55,8 @@ struct sockaddr_ll {
55#define PACKET_FANOUT_HASH 0 55#define PACKET_FANOUT_HASH 0
56#define PACKET_FANOUT_LB 1 56#define PACKET_FANOUT_LB 1
57#define PACKET_FANOUT_CPU 2 57#define PACKET_FANOUT_CPU 2
58#define PACKET_FANOUT_ROLLOVER 3
59#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
58#define PACKET_FANOUT_FLAG_DEFRAG 0x8000 60#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
59 61
60struct tpacket_stats { 62struct tpacket_stats {
@@ -84,19 +86,24 @@ struct tpacket_auxdata {
84}; 86};
85 87
86/* Rx ring - header status */ 88/* Rx ring - header status */
87#define TP_STATUS_KERNEL 0x0 89#define TP_STATUS_KERNEL 0
88#define TP_STATUS_USER 0x1 90#define TP_STATUS_USER (1 << 0)
89#define TP_STATUS_COPY 0x2 91#define TP_STATUS_COPY (1 << 1)
90#define TP_STATUS_LOSING 0x4 92#define TP_STATUS_LOSING (1 << 2)
91#define TP_STATUS_CSUMNOTREADY 0x8 93#define TP_STATUS_CSUMNOTREADY (1 << 3)
92#define TP_STATUS_VLAN_VALID 0x10 /* auxdata has valid tp_vlan_tci */ 94#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */
93#define TP_STATUS_BLK_TMO 0x20 95#define TP_STATUS_BLK_TMO (1 << 5)
94 96
95/* Tx ring - header status */ 97/* Tx ring - header status */
96#define TP_STATUS_AVAILABLE 0x0 98#define TP_STATUS_AVAILABLE 0
97#define TP_STATUS_SEND_REQUEST 0x1 99#define TP_STATUS_SEND_REQUEST (1 << 0)
98#define TP_STATUS_SENDING 0x2 100#define TP_STATUS_SENDING (1 << 1)
99#define TP_STATUS_WRONG_FORMAT 0x4 101#define TP_STATUS_WRONG_FORMAT (1 << 2)
102
103/* Rx and Tx ring - header status */
104#define TP_STATUS_TS_SOFTWARE (1 << 29)
105#define TP_STATUS_TS_SYS_HARDWARE (1 << 30)
106#define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
100 107
101/* Rx ring - feature request bits */ 108/* Rx ring - feature request bits */
102#define TP_FT_REQ_FILL_RXHASH 0x1 109#define TP_FT_REQ_FILL_RXHASH 0x1
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 935119c698ac..4649ee35b605 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -702,6 +702,11 @@ struct input_keymap_entry {
702#define KEY_CAMERA_LEFT 0x219 702#define KEY_CAMERA_LEFT 0x219
703#define KEY_CAMERA_RIGHT 0x21a 703#define KEY_CAMERA_RIGHT 0x21a
704 704
705#define KEY_ATTENDANT_ON 0x21b
706#define KEY_ATTENDANT_OFF 0x21c
707#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
708#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
709
705#define BTN_TRIGGER_HAPPY 0x2c0 710#define BTN_TRIGGER_HAPPY 0x2c0
706#define BTN_TRIGGER_HAPPY1 0x2c0 711#define BTN_TRIGGER_HAPPY1 0x2c0
707#define BTN_TRIGGER_HAPPY2 0x2c1 712#define BTN_TRIGGER_HAPPY2 0x2c1
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index 8a2d438dc499..a24537725e80 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -280,8 +280,8 @@ struct ip_vs_daemon_user {
280#define IPVS_GENL_VERSION 0x1 280#define IPVS_GENL_VERSION 0x1
281 281
282struct ip_vs_flags { 282struct ip_vs_flags {
283 __be32 flags; 283 __u32 flags;
284 __be32 mask; 284 __u32 mask;
285}; 285};
286 286
287/* Generic Netlink command attributes */ 287/* Generic Netlink command attributes */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 3c56ba3d80c1..a5c86fc34a37 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -449,12 +449,15 @@ enum {
449 kvm_ioeventfd_flag_nr_datamatch, 449 kvm_ioeventfd_flag_nr_datamatch,
450 kvm_ioeventfd_flag_nr_pio, 450 kvm_ioeventfd_flag_nr_pio,
451 kvm_ioeventfd_flag_nr_deassign, 451 kvm_ioeventfd_flag_nr_deassign,
452 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
452 kvm_ioeventfd_flag_nr_max, 453 kvm_ioeventfd_flag_nr_max,
453}; 454};
454 455
455#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) 456#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
456#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) 457#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
457#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) 458#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
459#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \
460 (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
458 461
459#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) 462#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
460 463
@@ -558,9 +561,7 @@ struct kvm_ppc_smmu_info {
558#define KVM_CAP_MP_STATE 14 561#define KVM_CAP_MP_STATE 14
559#define KVM_CAP_COALESCED_MMIO 15 562#define KVM_CAP_COALESCED_MMIO 15
560#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 563#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
561#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
562#define KVM_CAP_DEVICE_ASSIGNMENT 17 564#define KVM_CAP_DEVICE_ASSIGNMENT 17
563#endif
564#define KVM_CAP_IOMMU 18 565#define KVM_CAP_IOMMU 18
565#ifdef __KVM_HAVE_MSI 566#ifdef __KVM_HAVE_MSI
566#define KVM_CAP_DEVICE_MSI 20 567#define KVM_CAP_DEVICE_MSI 20
@@ -576,13 +577,9 @@ struct kvm_ppc_smmu_info {
576#ifdef __KVM_HAVE_PIT 577#ifdef __KVM_HAVE_PIT
577#define KVM_CAP_REINJECT_CONTROL 24 578#define KVM_CAP_REINJECT_CONTROL 24
578#endif 579#endif
579#ifdef __KVM_HAVE_IOAPIC
580#define KVM_CAP_IRQ_ROUTING 25 580#define KVM_CAP_IRQ_ROUTING 25
581#endif
582#define KVM_CAP_IRQ_INJECT_STATUS 26 581#define KVM_CAP_IRQ_INJECT_STATUS 26
583#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
584#define KVM_CAP_DEVICE_DEASSIGNMENT 27 582#define KVM_CAP_DEVICE_DEASSIGNMENT 27
585#endif
586#ifdef __KVM_HAVE_MSIX 583#ifdef __KVM_HAVE_MSIX
587#define KVM_CAP_DEVICE_MSIX 28 584#define KVM_CAP_DEVICE_MSIX 28
588#endif 585#endif
@@ -665,6 +662,10 @@ struct kvm_ppc_smmu_info {
665#define KVM_CAP_PPC_EPR 86 662#define KVM_CAP_PPC_EPR 86
666#define KVM_CAP_ARM_PSCI 87 663#define KVM_CAP_ARM_PSCI 87
667#define KVM_CAP_ARM_SET_DEVICE_ADDR 88 664#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
665#define KVM_CAP_DEVICE_CTRL 89
666#define KVM_CAP_IRQ_MPIC 90
667#define KVM_CAP_PPC_RTAS 91
668#define KVM_CAP_IRQ_XICS 92
668 669
669#ifdef KVM_CAP_IRQ_ROUTING 670#ifdef KVM_CAP_IRQ_ROUTING
670 671
@@ -818,6 +819,28 @@ struct kvm_arm_device_addr {
818}; 819};
819 820
820/* 821/*
822 * Device control API, available with KVM_CAP_DEVICE_CTRL
823 */
824#define KVM_CREATE_DEVICE_TEST 1
825
826struct kvm_create_device {
827 __u32 type; /* in: KVM_DEV_TYPE_xxx */
828 __u32 fd; /* out: device handle */
829 __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */
830};
831
832struct kvm_device_attr {
833 __u32 flags; /* no flags currently defined */
834 __u32 group; /* device-defined */
835 __u64 attr; /* group-defined */
836 __u64 addr; /* userspace address of attr data */
837};
838
839#define KVM_DEV_TYPE_FSL_MPIC_20 1
840#define KVM_DEV_TYPE_FSL_MPIC_42 2
841#define KVM_DEV_TYPE_XICS 3
842
843/*
821 * ioctls for VM fds 844 * ioctls for VM fds
822 */ 845 */
823#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 846#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
@@ -904,6 +927,16 @@ struct kvm_s390_ucas_mapping {
904#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) 927#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
905/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */ 928/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */
906#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr) 929#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
930/* Available with KVM_CAP_PPC_RTAS */
931#define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args)
932
933/* ioctl for vm fd */
934#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
935
936/* ioctls for fds returned by KVM_CREATE_DEVICE */
937#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
938#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
939#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
907 940
908/* 941/*
909 * ioctls for vcpu fds 942 * ioctls for vcpu fds
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index 873e086ce3a1..2944278a8ba7 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -11,6 +11,7 @@
11#define DEBUGFS_MAGIC 0x64626720 11#define DEBUGFS_MAGIC 0x64626720
12#define SECURITYFS_MAGIC 0x73636673 12#define SECURITYFS_MAGIC 0x73636673
13#define SELINUX_MAGIC 0xf97cff8c 13#define SELINUX_MAGIC 0xf97cff8c
14#define SMACK_MAGIC 0x43415d53 /* "SMAC" */
14#define RAMFS_MAGIC 0x858458f6 /* some random number */ 15#define RAMFS_MAGIC 0x858458f6 /* some random number */
15#define TMPFS_MAGIC 0x01021994 16#define TMPFS_MAGIC 0x01021994
16#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ 17#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
@@ -29,6 +30,7 @@
29#define JFFS2_SUPER_MAGIC 0x72b6 30#define JFFS2_SUPER_MAGIC 0x72b6
30#define PSTOREFS_MAGIC 0x6165676C 31#define PSTOREFS_MAGIC 0x6165676C
31#define EFIVARFS_MAGIC 0xde5e81e4 32#define EFIVARFS_MAGIC 0xde5e81e4
33#define HOSTFS_SUPER_MAGIC 0x00c0ffee
32 34
33#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ 35#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */
34#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */ 36#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 0ef883327de2..ed49574ad757 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -56,6 +56,8 @@ struct media_device_info {
56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) 56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
57#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) 57#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
58#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) 58#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
59/* A converter of analogue video to its digital representation. */
60#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4)
59 61
60#define MEDIA_ENT_FL_DEFAULT (1 << 0) 62#define MEDIA_ENT_FL_DEFAULT (1 << 0)
61 63
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index adb068c53c4e..f175212420ab 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -21,6 +21,9 @@ enum {
21 NDA_CACHEINFO, 21 NDA_CACHEINFO,
22 NDA_PROBES, 22 NDA_PROBES,
23 NDA_VLAN, 23 NDA_VLAN,
24 NDA_PORT,
25 NDA_VNI,
26 NDA_IFINDEX,
24 __NDA_MAX 27 __NDA_MAX
25}; 28};
26 29
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index fbee42807a11..8024cdf13b70 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -108,6 +108,8 @@ enum {
108 IPSET_ATTR_CIDR2, 108 IPSET_ATTR_CIDR2,
109 IPSET_ATTR_IP2_TO, 109 IPSET_ATTR_IP2_TO,
110 IPSET_ATTR_IFACE, 110 IPSET_ATTR_IFACE,
111 IPSET_ATTR_BYTES,
112 IPSET_ATTR_PACKETS,
111 __IPSET_ATTR_ADT_MAX, 113 __IPSET_ATTR_ADT_MAX,
112}; 114};
113#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) 115#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
@@ -137,12 +139,13 @@ enum ipset_errno {
137 IPSET_ERR_REFERENCED, 139 IPSET_ERR_REFERENCED,
138 IPSET_ERR_IPADDR_IPV4, 140 IPSET_ERR_IPADDR_IPV4,
139 IPSET_ERR_IPADDR_IPV6, 141 IPSET_ERR_IPADDR_IPV6,
142 IPSET_ERR_COUNTER,
140 143
141 /* Type specific error codes */ 144 /* Type specific error codes */
142 IPSET_ERR_TYPE_SPECIFIC = 4352, 145 IPSET_ERR_TYPE_SPECIFIC = 4352,
143}; 146};
144 147
145/* Flags at command level */ 148/* Flags at command level or match/target flags, lower half of cmdattrs*/
146enum ipset_cmd_flags { 149enum ipset_cmd_flags {
147 IPSET_FLAG_BIT_EXIST = 0, 150 IPSET_FLAG_BIT_EXIST = 0,
148 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), 151 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
@@ -150,10 +153,20 @@ enum ipset_cmd_flags {
150 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), 153 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
151 IPSET_FLAG_BIT_LIST_HEADER = 2, 154 IPSET_FLAG_BIT_LIST_HEADER = 2,
152 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), 155 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER),
153 IPSET_FLAG_CMD_MAX = 15, /* Lower half */ 156 IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3,
157 IPSET_FLAG_SKIP_COUNTER_UPDATE =
158 (1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE),
159 IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4,
160 IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE =
161 (1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE),
162 IPSET_FLAG_BIT_MATCH_COUNTERS = 5,
163 IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS),
164 IPSET_FLAG_BIT_RETURN_NOMATCH = 7,
165 IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH),
166 IPSET_FLAG_CMD_MAX = 15,
154}; 167};
155 168
156/* Flags at CADT attribute level */ 169/* Flags at CADT attribute level, upper half of cmdattrs */
157enum ipset_cadt_flags { 170enum ipset_cadt_flags {
158 IPSET_FLAG_BIT_BEFORE = 0, 171 IPSET_FLAG_BIT_BEFORE = 0,
159 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), 172 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
@@ -161,7 +174,9 @@ enum ipset_cadt_flags {
161 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), 174 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV),
162 IPSET_FLAG_BIT_NOMATCH = 2, 175 IPSET_FLAG_BIT_NOMATCH = 2,
163 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), 176 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
164 IPSET_FLAG_CADT_MAX = 15, /* Upper half */ 177 IPSET_FLAG_BIT_WITH_COUNTERS = 3,
178 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS),
179 IPSET_FLAG_CADT_MAX = 15,
165}; 180};
166 181
167/* Commands with settype-specific attributes */ 182/* Commands with settype-specific attributes */
@@ -190,6 +205,7 @@ enum ip_set_dim {
190 * If changed, new revision of iptables match/target is required. 205 * If changed, new revision of iptables match/target is required.
191 */ 206 */
192 IPSET_DIM_MAX = 6, 207 IPSET_DIM_MAX = 6,
208 /* Backward compatibility: set match revision 2 */
193 IPSET_BIT_RETURN_NOMATCH = 7, 209 IPSET_BIT_RETURN_NOMATCH = 7,
194}; 210};
195 211
@@ -202,6 +218,18 @@ enum ip_set_kopt {
202 IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), 218 IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH),
203}; 219};
204 220
221enum {
222 IPSET_COUNTER_NONE = 0,
223 IPSET_COUNTER_EQ,
224 IPSET_COUNTER_NE,
225 IPSET_COUNTER_LT,
226 IPSET_COUNTER_GT,
227};
228
229struct ip_set_counter_match {
230 __u8 op;
231 __u64 value;
232};
205 233
206/* Interface to iptables/ip6tables */ 234/* Interface to iptables/ip6tables */
207 235
diff --git a/include/uapi/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h
index 70ec8c2bc11a..a2308ae5a73d 100644
--- a/include/uapi/linux/netfilter/nfnetlink_queue.h
+++ b/include/uapi/linux/netfilter/nfnetlink_queue.h
@@ -45,6 +45,7 @@ enum nfqnl_attr_type {
45 NFQA_CT, /* nf_conntrack_netlink.h */ 45 NFQA_CT, /* nf_conntrack_netlink.h */
46 NFQA_CT_INFO, /* enum ip_conntrack_info */ 46 NFQA_CT_INFO, /* enum ip_conntrack_info */
47 NFQA_CAP_LEN, /* __u32 length of captured packet */ 47 NFQA_CAP_LEN, /* __u32 length of captured packet */
48 NFQA_SKB_INFO, /* __u32 skb meta information */
48 49
49 __NFQA_MAX 50 __NFQA_MAX
50}; 51};
@@ -96,6 +97,13 @@ enum nfqnl_attr_config {
96/* Flags for NFQA_CFG_FLAGS */ 97/* Flags for NFQA_CFG_FLAGS */
97#define NFQA_CFG_F_FAIL_OPEN (1 << 0) 98#define NFQA_CFG_F_FAIL_OPEN (1 << 0)
98#define NFQA_CFG_F_CONNTRACK (1 << 1) 99#define NFQA_CFG_F_CONNTRACK (1 << 1)
99#define NFQA_CFG_F_MAX (1 << 2) 100#define NFQA_CFG_F_GSO (1 << 2)
101#define NFQA_CFG_F_MAX (1 << 3)
102
103/* flags for NFQA_SKB_INFO */
104/* packet appears to have wrong checksums, but they are ok */
105#define NFQA_SKB_CSUMNOTREADY (1 << 0)
106/* packet is GSO (i.e., exceeds device mtu) */
107#define NFQA_SKB_GSO (1 << 1)
100 108
101#endif /* _NFNETLINK_QUEUE_H */ 109#endif /* _NFNETLINK_QUEUE_H */
diff --git a/include/uapi/linux/netfilter/xt_NFQUEUE.h b/include/uapi/linux/netfilter/xt_NFQUEUE.h
index 9eafdbbb401c..8bb5fe657d34 100644
--- a/include/uapi/linux/netfilter/xt_NFQUEUE.h
+++ b/include/uapi/linux/netfilter/xt_NFQUEUE.h
@@ -26,4 +26,13 @@ struct xt_NFQ_info_v2 {
26 __u16 bypass; 26 __u16 bypass;
27}; 27};
28 28
29struct xt_NFQ_info_v3 {
30 __u16 queuenum;
31 __u16 queues_total;
32 __u16 flags;
33#define NFQ_FLAG_BYPASS 0x01 /* for compatibility with v2 */
34#define NFQ_FLAG_CPU_FANOUT 0x02 /* use current CPU (no hashing) */
35#define NFQ_FLAG_MASK 0x03
36};
37
29#endif /* _XT_NFQ_TARGET_H */ 38#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h
index e3a9978f259f..964d3d42f874 100644
--- a/include/uapi/linux/netfilter/xt_set.h
+++ b/include/uapi/linux/netfilter/xt_set.h
@@ -62,4 +62,13 @@ struct xt_set_info_target_v2 {
62 __u32 timeout; 62 __u32 timeout;
63}; 63};
64 64
65/* Revision 3 match */
66
67struct xt_set_info_match_v3 {
68 struct xt_set_info match_set;
69 struct ip_set_counter_match packets;
70 struct ip_set_counter_match bytes;
71 __u32 flags;
72};
73
65#endif /*_XT_SET_H*/ 74#endif /*_XT_SET_H*/
diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h
index b47f61b9e082..dfd8bc2268cf 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h
@@ -4,9 +4,9 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct ip6t_frag { 6struct ip6t_frag {
7 __u32 ids[2]; /* Security Parameter Index */ 7 __u32 ids[2]; /* Identification range */
8 __u32 hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
9 __u8 flags; /* */ 9 __u8 flags; /* Flags */
10 __u8 invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
11}; 11};
12 12
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index 78d5b8a546d6..1a85940f8ab7 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -1,6 +1,7 @@
1#ifndef _UAPI__LINUX_NETLINK_H 1#ifndef _UAPI__LINUX_NETLINK_H
2#define _UAPI__LINUX_NETLINK_H 2#define _UAPI__LINUX_NETLINK_H
3 3
4#include <linux/kernel.h>
4#include <linux/socket.h> /* for __kernel_sa_family_t */ 5#include <linux/socket.h> /* for __kernel_sa_family_t */
5#include <linux/types.h> 6#include <linux/types.h>
6 7
@@ -78,7 +79,7 @@ struct nlmsghdr {
78#define NLMSG_ALIGNTO 4U 79#define NLMSG_ALIGNTO 4U
79#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) 80#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
80#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) 81#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
81#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) 82#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
82#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) 83#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
83#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) 84#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
84#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ 85#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
@@ -105,11 +106,42 @@ struct nlmsgerr {
105#define NETLINK_PKTINFO 3 106#define NETLINK_PKTINFO 3
106#define NETLINK_BROADCAST_ERROR 4 107#define NETLINK_BROADCAST_ERROR 4
107#define NETLINK_NO_ENOBUFS 5 108#define NETLINK_NO_ENOBUFS 5
109#define NETLINK_RX_RING 6
110#define NETLINK_TX_RING 7
108 111
109struct nl_pktinfo { 112struct nl_pktinfo {
110 __u32 group; 113 __u32 group;
111}; 114};
112 115
116struct nl_mmap_req {
117 unsigned int nm_block_size;
118 unsigned int nm_block_nr;
119 unsigned int nm_frame_size;
120 unsigned int nm_frame_nr;
121};
122
123struct nl_mmap_hdr {
124 unsigned int nm_status;
125 unsigned int nm_len;
126 __u32 nm_group;
127 /* credentials */
128 __u32 nm_pid;
129 __u32 nm_uid;
130 __u32 nm_gid;
131};
132
133enum nl_mmap_status {
134 NL_MMAP_STATUS_UNUSED,
135 NL_MMAP_STATUS_RESERVED,
136 NL_MMAP_STATUS_VALID,
137 NL_MMAP_STATUS_COPY,
138 NL_MMAP_STATUS_SKIP,
139};
140
141#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
142#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
143#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
144
113#define NET_MAJOR 36 /* Major 36 is reserved for networking */ 145#define NET_MAJOR 36 /* Major 36 is reserved for networking */
114 146
115enum { 147enum {
diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h
new file mode 100644
index 000000000000..4e31db4eea41
--- /dev/null
+++ b/include/uapi/linux/netlink_diag.h
@@ -0,0 +1,52 @@
1#ifndef __NETLINK_DIAG_H__
2#define __NETLINK_DIAG_H__
3
4#include <linux/types.h>
5
6struct netlink_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 ndiag_ino;
11 __u32 ndiag_show;
12 __u32 ndiag_cookie[2];
13};
14
15struct netlink_diag_msg {
16 __u8 ndiag_family;
17 __u8 ndiag_type;
18 __u8 ndiag_protocol;
19 __u8 ndiag_state;
20
21 __u32 ndiag_portid;
22 __u32 ndiag_dst_portid;
23 __u32 ndiag_dst_group;
24 __u32 ndiag_ino;
25 __u32 ndiag_cookie[2];
26};
27
28struct netlink_diag_ring {
29 __u32 ndr_block_size;
30 __u32 ndr_block_nr;
31 __u32 ndr_frame_size;
32 __u32 ndr_frame_nr;
33};
34
35enum {
36 NETLINK_DIAG_MEMINFO,
37 NETLINK_DIAG_GROUPS,
38 NETLINK_DIAG_RX_RING,
39 NETLINK_DIAG_TX_RING,
40
41 __NETLINK_DIAG_MAX,
42};
43
44#define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1)
45
46#define NDIAG_PROTO_ALL ((__u8) ~0)
47
48#define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */
49#define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */
50#define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */
51
52#endif
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 7969f46f1bb3..7c6f627a717d 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -90,6 +90,8 @@ enum nfc_commands {
90 NFC_CMD_LLC_SET_PARAMS, 90 NFC_CMD_LLC_SET_PARAMS,
91 NFC_CMD_ENABLE_SE, 91 NFC_CMD_ENABLE_SE,
92 NFC_CMD_DISABLE_SE, 92 NFC_CMD_DISABLE_SE,
93 NFC_CMD_LLC_SDREQ,
94 NFC_EVENT_LLC_SDRES,
93/* private: internal use only */ 95/* private: internal use only */
94 __NFC_CMD_AFTER_LAST 96 __NFC_CMD_AFTER_LAST
95}; 97};
@@ -140,11 +142,21 @@ enum nfc_attrs {
140 NFC_ATTR_LLC_PARAM_RW, 142 NFC_ATTR_LLC_PARAM_RW,
141 NFC_ATTR_LLC_PARAM_MIUX, 143 NFC_ATTR_LLC_PARAM_MIUX,
142 NFC_ATTR_SE, 144 NFC_ATTR_SE,
145 NFC_ATTR_LLC_SDP,
143/* private: internal use only */ 146/* private: internal use only */
144 __NFC_ATTR_AFTER_LAST 147 __NFC_ATTR_AFTER_LAST
145}; 148};
146#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) 149#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1)
147 150
151enum nfc_sdp_attr {
152 NFC_SDP_ATTR_UNSPEC,
153 NFC_SDP_ATTR_URI,
154 NFC_SDP_ATTR_SAP,
155/* private: internal use only */
156 __NFC_SDP_ATTR_AFTER_LAST
157};
158#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1)
159
148#define NFC_DEVICE_NAME_MAXSIZE 8 160#define NFC_DEVICE_NAME_MAXSIZE 8
149#define NFC_NFCID1_MAXSIZE 10 161#define NFC_NFCID1_MAXSIZE 10
150#define NFC_SENSB_RES_MAXSIZE 12 162#define NFC_SENSB_RES_MAXSIZE 12
@@ -220,4 +232,11 @@ struct sockaddr_nfc_llcp {
220#define NFC_LLCP_DIRECTION_RX 0x00 232#define NFC_LLCP_DIRECTION_RX 0x00
221#define NFC_LLCP_DIRECTION_TX 0x01 233#define NFC_LLCP_DIRECTION_TX 0x01
222 234
235/* socket option names */
236#define NFC_LLCP_RW 0
237#define NFC_LLCP_MIUX 1
238#define NFC_LLCP_REMOTE_MIU 2
239#define NFC_LLCP_REMOTE_LTO 3
240#define NFC_LLCP_REMOTE_RW 4
241
223#endif /*__LINUX_NFC_H */ 242#endif /*__LINUX_NFC_H */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index c46bb016f4e4..d1e48b5e348f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -36,7 +36,21 @@
36 * The station is still assumed to belong to the AP interface it was added 36 * The station is still assumed to belong to the AP interface it was added
37 * to. 37 * to.
38 * 38 *
39 * TODO: need more info? 39 * Station handling varies per interface type and depending on the driver's
40 * capabilities.
41 *
42 * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS
43 * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows:
44 * - a setup station entry is added, not yet authorized, without any rate
45 * or capability information, this just exists to avoid race conditions
46 * - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid
47 * to add rate and capability information to the station and at the same
48 * time mark it authorized.
49 * - %NL80211_TDLS_ENABLE_LINK is then used
50 * - after this, the only valid operation is to remove it by tearing down
51 * the TDLS link (%NL80211_TDLS_DISABLE_LINK)
52 *
53 * TODO: need more info for other interface types
40 */ 54 */
41 55
42/** 56/**
@@ -499,9 +513,11 @@
499 * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a 513 * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a
500 * beacon or probe response from a compatible mesh peer. This is only 514 * beacon or probe response from a compatible mesh peer. This is only
501 * sent while no station information (sta_info) exists for the new peer 515 * sent while no station information (sta_info) exists for the new peer
502 * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set. On 516 * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH,
503 * reception of this notification, userspace may decide to create a new 517 * @NL80211_MESH_SETUP_USERSPACE_AMPE, or
504 * station (@NL80211_CMD_NEW_STATION). To stop this notification from 518 * @NL80211_MESH_SETUP_USERSPACE_MPM is set. On reception of this
519 * notification, userspace may decide to create a new station
520 * (@NL80211_CMD_NEW_STATION). To stop this notification from
505 * reoccurring, the userspace authentication daemon may want to create the 521 * reoccurring, the userspace authentication daemon may want to create the
506 * new station with the AUTHENTICATED flag unset and maybe change it later 522 * new station with the AUTHENTICATED flag unset and maybe change it later
507 * depending on the authentication result. 523 * depending on the authentication result.
@@ -611,6 +627,25 @@
611 * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the 627 * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the
612 * event. 628 * event.
613 * 629 *
630 * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features,
631 * i.e. features for the nl80211 protocol rather than device features.
632 * Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap.
633 *
634 * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition
635 * Information Element to the WLAN driver
636 *
637 * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver
638 * to the supplicant. This will carry the target AP's MAC address along
639 * with the relevant Information Elements. This event is used to report
640 * received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE).
641 *
642 * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running
643 * a critical protocol that needs more reliability in the connection to
644 * complete.
645 *
646 * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can
647 * return back to normal.
648 *
614 * @NL80211_CMD_MAX: highest used command number 649 * @NL80211_CMD_MAX: highest used command number
615 * @__NL80211_CMD_AFTER_LAST: internal use 650 * @__NL80211_CMD_AFTER_LAST: internal use
616 */ 651 */
@@ -765,6 +800,14 @@ enum nl80211_commands {
765 800
766 NL80211_CMD_RADAR_DETECT, 801 NL80211_CMD_RADAR_DETECT,
767 802
803 NL80211_CMD_GET_PROTOCOL_FEATURES,
804
805 NL80211_CMD_UPDATE_FT_IES,
806 NL80211_CMD_FT_EVENT,
807
808 NL80211_CMD_CRIT_PROTOCOL_START,
809 NL80211_CMD_CRIT_PROTOCOL_STOP,
810
768 /* add new commands above here */ 811 /* add new commands above here */
769 812
770 /* used to define NL80211_CMD_MAX below */ 813 /* used to define NL80211_CMD_MAX below */
@@ -884,7 +927,8 @@ enum nl80211_commands {
884 * consisting of a nested array. 927 * consisting of a nested array.
885 * 928 *
886 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). 929 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
887 * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. 930 * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link
931 * (see &enum nl80211_plink_action).
888 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. 932 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
889 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path 933 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
890 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at 934 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
@@ -1167,10 +1211,10 @@ enum nl80211_commands {
1167 * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver 1211 * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver
1168 * allows auth frames in a mesh to be passed to userspace for processing via 1212 * allows auth frames in a mesh to be passed to userspace for processing via
1169 * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. 1213 * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag.
1170 * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as 1214 * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as defined in
1171 * defined in &enum nl80211_plink_state. Used when userspace is 1215 * &enum nl80211_plink_state. Used when userspace is driving the peer link
1172 * driving the peer link management state machine. 1216 * management state machine. @NL80211_MESH_SETUP_USERSPACE_AMPE or
1173 * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. 1217 * @NL80211_MESH_SETUP_USERSPACE_MPM must be enabled.
1174 * 1218 *
1175 * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy 1219 * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy
1176 * capabilities, the supported WoWLAN triggers 1220 * capabilities, the supported WoWLAN triggers
@@ -1368,6 +1412,23 @@ enum nl80211_commands {
1368 * advertised to the driver, e.g., to enable TDLS off channel operations 1412 * advertised to the driver, e.g., to enable TDLS off channel operations
1369 * and PU-APSD. 1413 * and PU-APSD.
1370 * 1414 *
1415 * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see
1416 * &enum nl80211_protocol_features, the attribute is a u32.
1417 *
1418 * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports
1419 * receiving the data for a single wiphy split across multiple
1420 * messages, given with wiphy dump message
1421 *
1422 * @NL80211_ATTR_MDID: Mobility Domain Identifier
1423 *
1424 * @NL80211_ATTR_IE_RIC: Resource Information Container Information
1425 * Element
1426 *
1427 * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased
1428 * reliability, see &enum nl80211_crit_proto_id (u16).
1429 * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which
1430 * the connection should have increased reliability (u16).
1431 *
1371 * @NL80211_ATTR_MAX: highest attribute number currently defined 1432 * @NL80211_ATTR_MAX: highest attribute number currently defined
1372 * @__NL80211_ATTR_AFTER_LAST: internal use 1433 * @__NL80211_ATTR_AFTER_LAST: internal use
1373 */ 1434 */
@@ -1654,6 +1715,18 @@ enum nl80211_attrs {
1654 NL80211_ATTR_STA_CAPABILITY, 1715 NL80211_ATTR_STA_CAPABILITY,
1655 NL80211_ATTR_STA_EXT_CAPABILITY, 1716 NL80211_ATTR_STA_EXT_CAPABILITY,
1656 1717
1718 NL80211_ATTR_PROTOCOL_FEATURES,
1719 NL80211_ATTR_SPLIT_WIPHY_DUMP,
1720
1721 NL80211_ATTR_DISABLE_VHT,
1722 NL80211_ATTR_VHT_CAPABILITY_MASK,
1723
1724 NL80211_ATTR_MDID,
1725 NL80211_ATTR_IE_RIC,
1726
1727 NL80211_ATTR_CRIT_PROT_ID,
1728 NL80211_ATTR_MAX_CRIT_PROT_DURATION,
1729
1657 /* add attributes here, update the policy in nl80211.c */ 1730 /* add attributes here, update the policy in nl80211.c */
1658 1731
1659 __NL80211_ATTR_AFTER_LAST, 1732 __NL80211_ATTR_AFTER_LAST,
@@ -2412,8 +2485,10 @@ enum nl80211_mesh_power_mode {
2412 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh 2485 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
2413 * point. 2486 * point.
2414 * 2487 *
2415 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically 2488 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open
2416 * open peer links when we detect compatible mesh peers. 2489 * peer links when we detect compatible mesh peers. Disabled if
2490 * @NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are
2491 * set.
2417 * 2492 *
2418 * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames 2493 * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
2419 * containing a PREQ that an MP can send to a particular destination (path 2494 * containing a PREQ that an MP can send to a particular destination (path
@@ -2559,6 +2634,9 @@ enum nl80211_meshconf_params {
2559 * vendor specific synchronization method or disable it to use the default 2634 * vendor specific synchronization method or disable it to use the default
2560 * neighbor offset synchronization 2635 * neighbor offset synchronization
2561 * 2636 *
2637 * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will
2638 * implement an MPM which handles peer allocation and state.
2639 *
2562 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 2640 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
2563 * 2641 *
2564 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 2642 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
@@ -2571,6 +2649,7 @@ enum nl80211_mesh_setup_params {
2571 NL80211_MESH_SETUP_USERSPACE_AUTH, 2649 NL80211_MESH_SETUP_USERSPACE_AUTH,
2572 NL80211_MESH_SETUP_USERSPACE_AMPE, 2650 NL80211_MESH_SETUP_USERSPACE_AMPE,
2573 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, 2651 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
2652 NL80211_MESH_SETUP_USERSPACE_MPM,
2574 2653
2575 /* keep last */ 2654 /* keep last */
2576 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 2655 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -3307,6 +3386,23 @@ enum nl80211_plink_state {
3307 MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 3386 MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
3308}; 3387};
3309 3388
3389/**
3390 * enum nl80211_plink_action - actions to perform in mesh peers
3391 *
3392 * @NL80211_PLINK_ACTION_NO_ACTION: perform no action
3393 * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment
3394 * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer
3395 * @NUM_NL80211_PLINK_ACTIONS: number of possible actions
3396 */
3397enum plink_actions {
3398 NL80211_PLINK_ACTION_NO_ACTION,
3399 NL80211_PLINK_ACTION_OPEN,
3400 NL80211_PLINK_ACTION_BLOCK,
3401
3402 NUM_NL80211_PLINK_ACTIONS,
3403};
3404
3405
3310#define NL80211_KCK_LEN 16 3406#define NL80211_KCK_LEN 16
3311#define NL80211_KEK_LEN 16 3407#define NL80211_KEK_LEN 16
3312#define NL80211_REPLAY_CTR_LEN 8 3408#define NL80211_REPLAY_CTR_LEN 8
@@ -3456,6 +3552,10 @@ enum nl80211_ap_sme_features {
3456 * stations the authenticated/associated bits have to be set in the mask. 3552 * stations the authenticated/associated bits have to be set in the mask.
3457 * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits 3553 * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits
3458 * (HT40, VHT 80/160 MHz) if this flag is set 3554 * (HT40, VHT 80/160 MHz) if this flag is set
3555 * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh
3556 * Peering Management entity which may be implemented by registering for
3557 * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is
3558 * still generated by the driver.
3459 */ 3559 */
3460enum nl80211_feature_flags { 3560enum nl80211_feature_flags {
3461 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3561 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3474,6 +3574,7 @@ enum nl80211_feature_flags {
3474 /* bit 13 is reserved */ 3574 /* bit 13 is reserved */
3475 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, 3575 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14,
3476 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, 3576 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
3577 NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
3477}; 3578};
3478 3579
3479/** 3580/**
@@ -3587,4 +3688,37 @@ enum nl80211_dfs_state {
3587 NL80211_DFS_AVAILABLE, 3688 NL80211_DFS_AVAILABLE,
3588}; 3689};
3589 3690
3691/**
3692 * enum enum nl80211_protocol_features - nl80211 protocol features
3693 * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting
3694 * wiphy dumps (if requested by the application with the attribute
3695 * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the
3696 * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or
3697 * %NL80211_ATTR_WDEV.
3698 */
3699enum nl80211_protocol_features {
3700 NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP = 1 << 0,
3701};
3702
3703/**
3704 * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers
3705 *
3706 * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified.
3707 * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol.
3708 * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol.
3709 * @NL80211_CRIT_PROTO_APIPA: APIPA protocol.
3710 * @NUM_NL80211_CRIT_PROTO: must be kept last.
3711 */
3712enum nl80211_crit_proto_id {
3713 NL80211_CRIT_PROTO_UNSPEC,
3714 NL80211_CRIT_PROTO_DHCP,
3715 NL80211_CRIT_PROTO_EAPOL,
3716 NL80211_CRIT_PROTO_APIPA,
3717 /* add other protocols before this one */
3718 NUM_NL80211_CRIT_PROTO
3719};
3720
3721/* maximum duration for critical protocol measures */
3722#define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */
3723
3590#endif /* __LINUX_NL80211_H */ 3724#endif /* __LINUX_NL80211_H */
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
new file mode 100644
index 000000000000..405918dd7b3f
--- /dev/null
+++ b/include/uapi/linux/openvswitch.h
@@ -0,0 +1,456 @@
1
2/*
3 * Copyright (c) 2007-2011 Nicira Networks.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License 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
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA
18 */
19
20#ifndef _UAPI__LINUX_OPENVSWITCH_H
21#define _UAPI__LINUX_OPENVSWITCH_H 1
22
23#include <linux/types.h>
24#include <linux/if_ether.h>
25
26/**
27 * struct ovs_header - header for OVS Generic Netlink messages.
28 * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
29 * specific to a datapath).
30 *
31 * Attributes following the header are specific to a particular OVS Generic
32 * Netlink family, but all of the OVS families use this header.
33 */
34
35struct ovs_header {
36 int dp_ifindex;
37};
38
39/* Datapaths. */
40
41#define OVS_DATAPATH_FAMILY "ovs_datapath"
42#define OVS_DATAPATH_MCGROUP "ovs_datapath"
43#define OVS_DATAPATH_VERSION 0x1
44
45enum ovs_datapath_cmd {
46 OVS_DP_CMD_UNSPEC,
47 OVS_DP_CMD_NEW,
48 OVS_DP_CMD_DEL,
49 OVS_DP_CMD_GET,
50 OVS_DP_CMD_SET
51};
52
53/**
54 * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
55 * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
56 * port". This is the name of the network device whose dp_ifindex is given in
57 * the &struct ovs_header. Always present in notifications. Required in
58 * %OVS_DP_NEW requests. May be used as an alternative to specifying
59 * dp_ifindex in other requests (with a dp_ifindex of 0).
60 * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
61 * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
62 * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
63 * not be sent.
64 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
65 * datapath. Always present in notifications.
66 *
67 * These attributes follow the &struct ovs_header within the Generic Netlink
68 * payload for %OVS_DP_* commands.
69 */
70enum ovs_datapath_attr {
71 OVS_DP_ATTR_UNSPEC,
72 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
73 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
74 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
75 __OVS_DP_ATTR_MAX
76};
77
78#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
79
80struct ovs_dp_stats {
81 __u64 n_hit; /* Number of flow table matches. */
82 __u64 n_missed; /* Number of flow table misses. */
83 __u64 n_lost; /* Number of misses not sent to userspace. */
84 __u64 n_flows; /* Number of flows present */
85};
86
87struct ovs_vport_stats {
88 __u64 rx_packets; /* total packets received */
89 __u64 tx_packets; /* total packets transmitted */
90 __u64 rx_bytes; /* total bytes received */
91 __u64 tx_bytes; /* total bytes transmitted */
92 __u64 rx_errors; /* bad packets received */
93 __u64 tx_errors; /* packet transmit problems */
94 __u64 rx_dropped; /* no space in linux buffers */
95 __u64 tx_dropped; /* no space available in linux */
96};
97
98/* Fixed logical ports. */
99#define OVSP_LOCAL ((__u32)0)
100
101/* Packet transfer. */
102
103#define OVS_PACKET_FAMILY "ovs_packet"
104#define OVS_PACKET_VERSION 0x1
105
106enum ovs_packet_cmd {
107 OVS_PACKET_CMD_UNSPEC,
108
109 /* Kernel-to-user notifications. */
110 OVS_PACKET_CMD_MISS, /* Flow table miss. */
111 OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
112
113 /* Userspace commands. */
114 OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
115};
116
117/**
118 * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
119 * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
120 * packet as received, from the start of the Ethernet header onward. For
121 * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
122 * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
123 * the flow key extracted from the packet as originally received.
124 * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
125 * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
126 * userspace to adapt its flow setup strategy by comparing its notion of the
127 * flow key against the kernel's.
128 * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
129 * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
130 * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
131 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
132 * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content
133 * specified there.
134 *
135 * These attributes follow the &struct ovs_header within the Generic Netlink
136 * payload for %OVS_PACKET_* commands.
137 */
138enum ovs_packet_attr {
139 OVS_PACKET_ATTR_UNSPEC,
140 OVS_PACKET_ATTR_PACKET, /* Packet data. */
141 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
142 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
143 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */
144 __OVS_PACKET_ATTR_MAX
145};
146
147#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
148
149/* Virtual ports. */
150
151#define OVS_VPORT_FAMILY "ovs_vport"
152#define OVS_VPORT_MCGROUP "ovs_vport"
153#define OVS_VPORT_VERSION 0x1
154
155enum ovs_vport_cmd {
156 OVS_VPORT_CMD_UNSPEC,
157 OVS_VPORT_CMD_NEW,
158 OVS_VPORT_CMD_DEL,
159 OVS_VPORT_CMD_GET,
160 OVS_VPORT_CMD_SET
161};
162
163enum ovs_vport_type {
164 OVS_VPORT_TYPE_UNSPEC,
165 OVS_VPORT_TYPE_NETDEV, /* network device */
166 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
167 __OVS_VPORT_TYPE_MAX
168};
169
170#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
171
172/**
173 * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
174 * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
175 * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
176 * of vport.
177 * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
178 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
179 * plus a null terminator.
180 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
181 * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
182 * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
183 * this port. A value of zero indicates that upcalls should not be sent.
184 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
185 * packets sent or received through the vport.
186 *
187 * These attributes follow the &struct ovs_header within the Generic Netlink
188 * payload for %OVS_VPORT_* commands.
189 *
190 * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
191 * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
192 * optional; if not specified a free port number is automatically selected.
193 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
194 * of vport.
195 * and other attributes are ignored.
196 *
197 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
198 * look up the vport to operate on; otherwise dp_idx from the &struct
199 * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
200 */
201enum ovs_vport_attr {
202 OVS_VPORT_ATTR_UNSPEC,
203 OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
204 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
205 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
206 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
207 OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
208 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
209 __OVS_VPORT_ATTR_MAX
210};
211
212#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
213
214/* Flows. */
215
216#define OVS_FLOW_FAMILY "ovs_flow"
217#define OVS_FLOW_MCGROUP "ovs_flow"
218#define OVS_FLOW_VERSION 0x1
219
220enum ovs_flow_cmd {
221 OVS_FLOW_CMD_UNSPEC,
222 OVS_FLOW_CMD_NEW,
223 OVS_FLOW_CMD_DEL,
224 OVS_FLOW_CMD_GET,
225 OVS_FLOW_CMD_SET
226};
227
228struct ovs_flow_stats {
229 __u64 n_packets; /* Number of matched packets. */
230 __u64 n_bytes; /* Number of matched bytes. */
231};
232
233enum ovs_key_attr {
234 OVS_KEY_ATTR_UNSPEC,
235 OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
236 OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
237 OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
238 OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
239 OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
240 OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
241 OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
242 OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
243 OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
244 OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
245 OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
246 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
247 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
248 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
249 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
250 __OVS_KEY_ATTR_MAX
251};
252
253#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
254
255/**
256 * enum ovs_frag_type - IPv4 and IPv6 fragment type
257 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
258 * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
259 * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
260 *
261 * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
262 * ovs_key_ipv6.
263 */
264enum ovs_frag_type {
265 OVS_FRAG_TYPE_NONE,
266 OVS_FRAG_TYPE_FIRST,
267 OVS_FRAG_TYPE_LATER,
268 __OVS_FRAG_TYPE_MAX
269};
270
271#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
272
273struct ovs_key_ethernet {
274 __u8 eth_src[ETH_ALEN];
275 __u8 eth_dst[ETH_ALEN];
276};
277
278struct ovs_key_ipv4 {
279 __be32 ipv4_src;
280 __be32 ipv4_dst;
281 __u8 ipv4_proto;
282 __u8 ipv4_tos;
283 __u8 ipv4_ttl;
284 __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
285};
286
287struct ovs_key_ipv6 {
288 __be32 ipv6_src[4];
289 __be32 ipv6_dst[4];
290 __be32 ipv6_label; /* 20-bits in least-significant bits. */
291 __u8 ipv6_proto;
292 __u8 ipv6_tclass;
293 __u8 ipv6_hlimit;
294 __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
295};
296
297struct ovs_key_tcp {
298 __be16 tcp_src;
299 __be16 tcp_dst;
300};
301
302struct ovs_key_udp {
303 __be16 udp_src;
304 __be16 udp_dst;
305};
306
307struct ovs_key_icmp {
308 __u8 icmp_type;
309 __u8 icmp_code;
310};
311
312struct ovs_key_icmpv6 {
313 __u8 icmpv6_type;
314 __u8 icmpv6_code;
315};
316
317struct ovs_key_arp {
318 __be32 arp_sip;
319 __be32 arp_tip;
320 __be16 arp_op;
321 __u8 arp_sha[ETH_ALEN];
322 __u8 arp_tha[ETH_ALEN];
323};
324
325struct ovs_key_nd {
326 __u32 nd_target[4];
327 __u8 nd_sll[ETH_ALEN];
328 __u8 nd_tll[ETH_ALEN];
329};
330
331/**
332 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
333 * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
334 * key. Always present in notifications. Required for all requests (except
335 * dumps).
336 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
337 * the actions to take for packets that match the key. Always present in
338 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
339 * %OVS_FLOW_CMD_SET requests.
340 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
341 * flow. Present in notifications if the stats would be nonzero. Ignored in
342 * requests.
343 * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
344 * TCP flags seen on packets in this flow. Only present in notifications for
345 * TCP flows, and only if it would be nonzero. Ignored in requests.
346 * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
347 * the system monotonic clock, at which a packet was last processed for this
348 * flow. Only present in notifications if a packet has been processed for this
349 * flow. Ignored in requests.
350 * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
351 * last-used time, accumulated TCP flags, and statistics for this flow.
352 * Otherwise ignored in requests. Never present in notifications.
353 *
354 * These attributes follow the &struct ovs_header within the Generic Netlink
355 * payload for %OVS_FLOW_* commands.
356 */
357enum ovs_flow_attr {
358 OVS_FLOW_ATTR_UNSPEC,
359 OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
360 OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
361 OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
362 OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
363 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
364 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
365 __OVS_FLOW_ATTR_MAX
366};
367
368#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
369
370/**
371 * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
372 * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
373 * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
374 * %UINT32_MAX samples all packets and intermediate values sample intermediate
375 * fractions of packets.
376 * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
377 * Actions are passed as nested attributes.
378 *
379 * Executes the specified actions with the given probability on a per-packet
380 * basis.
381 */
382enum ovs_sample_attr {
383 OVS_SAMPLE_ATTR_UNSPEC,
384 OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
385 OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
386 __OVS_SAMPLE_ATTR_MAX,
387};
388
389#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
390
391/**
392 * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
393 * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
394 * message should be sent. Required.
395 * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is
396 * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA.
397 */
398enum ovs_userspace_attr {
399 OVS_USERSPACE_ATTR_UNSPEC,
400 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
401 OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */
402 __OVS_USERSPACE_ATTR_MAX
403};
404
405#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
406
407/**
408 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
409 * @vlan_tpid: Tag protocol identifier (TPID) to push.
410 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
411 * (but it will not be set in the 802.1Q header that is pushed).
412 *
413 * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID
414 * values are those that the kernel module also parses as 802.1Q headers, to
415 * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN
416 * from having surprising results.
417 */
418struct ovs_action_push_vlan {
419 __be16 vlan_tpid; /* 802.1Q TPID. */
420 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
421};
422
423/**
424 * enum ovs_action_attr - Action types.
425 *
426 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
427 * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
428 * %OVS_USERSPACE_ATTR_* attributes.
429 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
430 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
431 * value.
432 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
433 * packet.
434 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
435 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
436 * the nested %OVS_SAMPLE_ATTR_* attributes.
437 *
438 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
439 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
440 * type may not be changed.
441 */
442
443enum ovs_action_attr {
444 OVS_ACTION_ATTR_UNSPEC,
445 OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
446 OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
447 OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
448 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
449 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
450 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
451 __OVS_ACTION_ATTR_MAX
452};
453
454#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
455
456#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h
index afafd703ad92..b2cc0cd9c4d9 100644
--- a/include/uapi/linux/packet_diag.h
+++ b/include/uapi/linux/packet_diag.h
@@ -16,6 +16,8 @@ struct packet_diag_req {
16#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ 16#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */
17#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ 17#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */
18#define PACKET_SHOW_FANOUT 0x00000008 18#define PACKET_SHOW_FANOUT 0x00000008
19#define PACKET_SHOW_MEMINFO 0x00000010
20#define PACKET_SHOW_FILTER 0x00000020
19 21
20struct packet_diag_msg { 22struct packet_diag_msg {
21 __u8 pdiag_family; 23 __u8 pdiag_family;
@@ -32,6 +34,9 @@ enum {
32 PACKET_DIAG_RX_RING, 34 PACKET_DIAG_RX_RING,
33 PACKET_DIAG_TX_RING, 35 PACKET_DIAG_TX_RING,
34 PACKET_DIAG_FANOUT, 36 PACKET_DIAG_FANOUT,
37 PACKET_DIAG_UID,
38 PACKET_DIAG_MEMINFO,
39 PACKET_DIAG_FILTER,
35 40
36 __PACKET_DIAG_MAX, 41 __PACKET_DIAG_MAX,
37}; 42};
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index ebfadc56d1b4..864e324da80d 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -292,12 +292,12 @@
292 292
293/* Message Signalled Interrupts registers */ 293/* Message Signalled Interrupts registers */
294 294
295#define PCI_MSI_FLAGS 2 /* Various flags */ 295#define PCI_MSI_FLAGS 2 /* Message Control */
296#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ 296#define PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */
297#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ 297#define PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available */
298#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ 298#define PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured */
299#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ 299#define PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */
300#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ 300#define PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking capable */
301#define PCI_MSI_RFU 3 /* Rest of capability flags */ 301#define PCI_MSI_RFU 3 /* Rest of capability flags */
302#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ 302#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
303#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ 303#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
@@ -309,13 +309,17 @@
309#define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ 309#define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */
310 310
311/* MSI-X registers */ 311/* MSI-X registers */
312#define PCI_MSIX_FLAGS 2 312#define PCI_MSIX_FLAGS 2 /* Message Control */
313#define PCI_MSIX_FLAGS_QSIZE 0x7FF 313#define PCI_MSIX_FLAGS_QSIZE 0x07FF /* Table size */
314#define PCI_MSIX_FLAGS_ENABLE (1 << 15) 314#define PCI_MSIX_FLAGS_MASKALL 0x4000 /* Mask all vectors for this function */
315#define PCI_MSIX_FLAGS_MASKALL (1 << 14) 315#define PCI_MSIX_FLAGS_ENABLE 0x8000 /* MSI-X enable */
316#define PCI_MSIX_TABLE 4 316#define PCI_MSIX_TABLE 4 /* Table offset */
317#define PCI_MSIX_PBA 8 317#define PCI_MSIX_TABLE_BIR 0x00000007 /* BAR index */
318#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 318#define PCI_MSIX_TABLE_OFFSET 0xfffffff8 /* Offset into specified BAR */
319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */
320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */
321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */
322#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) /* deprecated */
319#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ 323#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */
320 324
321/* MSI-X entry's format */ 325/* MSI-X entry's format */
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 9fa9c622a7f4..fb104e51496e 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -132,8 +132,10 @@ enum perf_event_sample_format {
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11, 132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
133 PERF_SAMPLE_REGS_USER = 1U << 12, 133 PERF_SAMPLE_REGS_USER = 1U << 12,
134 PERF_SAMPLE_STACK_USER = 1U << 13, 134 PERF_SAMPLE_STACK_USER = 1U << 13,
135 PERF_SAMPLE_WEIGHT = 1U << 14,
136 PERF_SAMPLE_DATA_SRC = 1U << 15,
135 137
136 PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */ 138 PERF_SAMPLE_MAX = 1U << 16, /* non-ABI */
137}; 139};
138 140
139/* 141/*
@@ -443,6 +445,7 @@ struct perf_event_mmap_page {
443#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) 445#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
444#define PERF_RECORD_MISC_GUEST_USER (5 << 0) 446#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
445 447
448#define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
446/* 449/*
447 * Indicates that the content of PERF_SAMPLE_IP points to 450 * Indicates that the content of PERF_SAMPLE_IP points to
448 * the actual instruction that triggered the event. See also 451 * the actual instruction that triggered the event. See also
@@ -588,6 +591,9 @@ enum perf_event_type {
588 * { u64 size; 591 * { u64 size;
589 * char data[size]; 592 * char data[size];
590 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER 593 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
594 *
595 * { u64 weight; } && PERF_SAMPLE_WEIGHT
596 * { u64 data_src; } && PERF_SAMPLE_DATA_SRC
591 * }; 597 * };
592 */ 598 */
593 PERF_RECORD_SAMPLE = 9, 599 PERF_RECORD_SAMPLE = 9,
@@ -613,4 +619,67 @@ enum perf_callchain_context {
613#define PERF_FLAG_FD_OUTPUT (1U << 1) 619#define PERF_FLAG_FD_OUTPUT (1U << 1)
614#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */ 620#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
615 621
622union perf_mem_data_src {
623 __u64 val;
624 struct {
625 __u64 mem_op:5, /* type of opcode */
626 mem_lvl:14, /* memory hierarchy level */
627 mem_snoop:5, /* snoop mode */
628 mem_lock:2, /* lock instr */
629 mem_dtlb:7, /* tlb access */
630 mem_rsvd:31;
631 };
632};
633
634/* type of opcode (load/store/prefetch,code) */
635#define PERF_MEM_OP_NA 0x01 /* not available */
636#define PERF_MEM_OP_LOAD 0x02 /* load instruction */
637#define PERF_MEM_OP_STORE 0x04 /* store instruction */
638#define PERF_MEM_OP_PFETCH 0x08 /* prefetch */
639#define PERF_MEM_OP_EXEC 0x10 /* code (execution) */
640#define PERF_MEM_OP_SHIFT 0
641
642/* memory hierarchy (memory level, hit or miss) */
643#define PERF_MEM_LVL_NA 0x01 /* not available */
644#define PERF_MEM_LVL_HIT 0x02 /* hit level */
645#define PERF_MEM_LVL_MISS 0x04 /* miss level */
646#define PERF_MEM_LVL_L1 0x08 /* L1 */
647#define PERF_MEM_LVL_LFB 0x10 /* Line Fill Buffer */
648#define PERF_MEM_LVL_L2 0x20 /* L2 */
649#define PERF_MEM_LVL_L3 0x40 /* L3 */
650#define PERF_MEM_LVL_LOC_RAM 0x80 /* Local DRAM */
651#define PERF_MEM_LVL_REM_RAM1 0x100 /* Remote DRAM (1 hop) */
652#define PERF_MEM_LVL_REM_RAM2 0x200 /* Remote DRAM (2 hops) */
653#define PERF_MEM_LVL_REM_CCE1 0x400 /* Remote Cache (1 hop) */
654#define PERF_MEM_LVL_REM_CCE2 0x800 /* Remote Cache (2 hops) */
655#define PERF_MEM_LVL_IO 0x1000 /* I/O memory */
656#define PERF_MEM_LVL_UNC 0x2000 /* Uncached memory */
657#define PERF_MEM_LVL_SHIFT 5
658
659/* snoop mode */
660#define PERF_MEM_SNOOP_NA 0x01 /* not available */
661#define PERF_MEM_SNOOP_NONE 0x02 /* no snoop */
662#define PERF_MEM_SNOOP_HIT 0x04 /* snoop hit */
663#define PERF_MEM_SNOOP_MISS 0x08 /* snoop miss */
664#define PERF_MEM_SNOOP_HITM 0x10 /* snoop hit modified */
665#define PERF_MEM_SNOOP_SHIFT 19
666
667/* locked instruction */
668#define PERF_MEM_LOCK_NA 0x01 /* not available */
669#define PERF_MEM_LOCK_LOCKED 0x02 /* locked transaction */
670#define PERF_MEM_LOCK_SHIFT 24
671
672/* TLB access */
673#define PERF_MEM_TLB_NA 0x01 /* not available */
674#define PERF_MEM_TLB_HIT 0x02 /* hit level */
675#define PERF_MEM_TLB_MISS 0x04 /* miss level */
676#define PERF_MEM_TLB_L1 0x08 /* L1 */
677#define PERF_MEM_TLB_L2 0x10 /* L2 */
678#define PERF_MEM_TLB_WK 0x20 /* Hardware Walker*/
679#define PERF_MEM_TLB_OS 0x40 /* OS fault handler */
680#define PERF_MEM_TLB_SHIFT 26
681
682#define PERF_MEM_S(a, s) \
683 (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
684
616#endif /* _UAPI_LINUX_PERF_EVENT_H */ 685#endif /* _UAPI_LINUX_PERF_EVENT_H */
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 32aef0a439ef..dbd71b0c7d8c 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -348,6 +348,7 @@ enum {
348 TCA_HTB_INIT, 348 TCA_HTB_INIT,
349 TCA_HTB_CTAB, 349 TCA_HTB_CTAB,
350 TCA_HTB_RTAB, 350 TCA_HTB_RTAB,
351 TCA_HTB_DIRECT_QLEN,
351 __TCA_HTB_MAX, 352 __TCA_HTB_MAX,
352}; 353};
353 354
diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
index 022ab186a812..52ebcc89f306 100644
--- a/include/uapi/linux/ptrace.h
+++ b/include/uapi/linux/ptrace.h
@@ -5,6 +5,7 @@
5 5
6/* has the defines to get at the registers. */ 6/* has the defines to get at the registers. */
7 7
8#include <linux/types.h>
8 9
9#define PTRACE_TRACEME 0 10#define PTRACE_TRACEME 0
10#define PTRACE_PEEKTEXT 1 11#define PTRACE_PEEKTEXT 1
@@ -52,6 +53,17 @@
52#define PTRACE_INTERRUPT 0x4207 53#define PTRACE_INTERRUPT 0x4207
53#define PTRACE_LISTEN 0x4208 54#define PTRACE_LISTEN 0x4208
54 55
56#define PTRACE_PEEKSIGINFO 0x4209
57
58struct ptrace_peeksiginfo_args {
59 __u64 off; /* from which siginfo to start */
60 __u32 flags;
61 __s32 nr; /* how may siginfos to take */
62};
63
64/* Read signals from a shared (process wide) queue */
65#define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
66
55/* Wait extended result codes for the above trace options. */ 67/* Wait extended result codes for the above trace options. */
56#define PTRACE_EVENT_FORK 1 68#define PTRACE_EVENT_FORK 1
57#define PTRACE_EVENT_VFORK 2 69#define PTRACE_EVENT_VFORK 2
diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h
index 2753c6cc9740..058757f7a733 100644
--- a/include/uapi/linux/rfkill.h
+++ b/include/uapi/linux/rfkill.h
@@ -37,6 +37,7 @@
37 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. 37 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
38 * @RFKILL_TYPE_GPS: switch is on a GPS device. 38 * @RFKILL_TYPE_GPS: switch is on a GPS device.
39 * @RFKILL_TYPE_FM: switch is on a FM radio device. 39 * @RFKILL_TYPE_FM: switch is on a FM radio device.
40 * @RFKILL_TYPE_NFC: switch is on an NFC device.
40 * @NUM_RFKILL_TYPES: number of defined rfkill types 41 * @NUM_RFKILL_TYPES: number of defined rfkill types
41 */ 42 */
42enum rfkill_type { 43enum rfkill_type {
@@ -48,6 +49,7 @@ enum rfkill_type {
48 RFKILL_TYPE_WWAN, 49 RFKILL_TYPE_WWAN,
49 RFKILL_TYPE_GPS, 50 RFKILL_TYPE_GPS,
50 RFKILL_TYPE_FM, 51 RFKILL_TYPE_FM,
52 RFKILL_TYPE_NFC,
51 NUM_RFKILL_TYPES, 53 NUM_RFKILL_TYPES,
52}; 54};
53 55
diff --git a/include/net/sctp/user.h b/include/uapi/linux/sctp.h
index 9a0ae091366d..66b466e4ca08 100644
--- a/include/net/sctp/user.h
+++ b/include/uapi/linux/sctp.h
@@ -42,15 +42,17 @@
42 * Jon Grimm <jgrimm@us.ibm.com> 42 * Jon Grimm <jgrimm@us.ibm.com>
43 * Daisy Chang <daisyc@us.ibm.com> 43 * Daisy Chang <daisyc@us.ibm.com>
44 * Ryan Layer <rmlayer@us.ibm.com> 44 * Ryan Layer <rmlayer@us.ibm.com>
45 * Ardelle Fan <ardelle.fan@intel.com> 45 * Ardelle Fan <ardelle.fan@intel.com>
46 * Sridhar Samudrala <sri@us.ibm.com> 46 * Sridhar Samudrala <sri@us.ibm.com>
47 * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com>
48 * Vlad Yasevich <vladislav.yasevich@hp.com>
47 * 49 *
48 * Any bugs reported given to us we will try to fix... any fixes shared will 50 * Any bugs reported given to us we will try to fix... any fixes shared will
49 * be incorporated into the next SCTP release. 51 * be incorporated into the next SCTP release.
50 */ 52 */
51 53
52#ifndef __net_sctp_user_h__ 54#ifndef _UAPI_SCTP_H
53#define __net_sctp_user_h__ 55#define _UAPI_SCTP_H
54 56
55#include <linux/types.h> 57#include <linux/types.h>
56#include <linux/socket.h> 58#include <linux/socket.h>
@@ -165,17 +167,23 @@ enum sctp_sinfo_flags {
165 SCTP_ADDR_OVER = 2, /* Override the primary destination. */ 167 SCTP_ADDR_OVER = 2, /* Override the primary destination. */
166 SCTP_ABORT=4, /* Send an ABORT message to the peer. */ 168 SCTP_ABORT=4, /* Send an ABORT message to the peer. */
167 SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */ 169 SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
168 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ 170 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
169}; 171};
170 172
173typedef union {
174 __u8 raw;
175 struct sctp_initmsg init;
176 struct sctp_sndrcvinfo sndrcv;
177} sctp_cmsg_data_t;
171 178
172/* These are cmsg_types. */ 179/* These are cmsg_types. */
173typedef enum sctp_cmsg_type { 180typedef enum sctp_cmsg_type {
174 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ 181 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
182#define SCTP_INIT SCTP_INIT
175 SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ 183 SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
184#define SCTP_SNDRCV SCTP_SNDRCV
176} sctp_cmsg_t; 185} sctp_cmsg_t;
177 186
178
179/* 187/*
180 * 5.3.1.1 SCTP_ASSOC_CHANGE 188 * 5.3.1.1 SCTP_ASSOC_CHANGE
181 * 189 *
@@ -345,6 +353,12 @@ struct sctp_pdapi_event {
345 353
346enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; 354enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
347 355
356/*
357 * 5.3.1.8. SCTP_AUTHENTICATION_EVENT
358 *
359 * When a receiver is using authentication this message will provide
360 * notifications regarding new keys being made active as well as errors.
361 */
348struct sctp_authkey_event { 362struct sctp_authkey_event {
349 __u16 auth_type; 363 __u16 auth_type;
350 __u16 auth_flags; 364 __u16 auth_flags;
@@ -421,15 +435,23 @@ union sctp_notification {
421enum sctp_sn_type { 435enum sctp_sn_type {
422 SCTP_SN_TYPE_BASE = (1<<15), 436 SCTP_SN_TYPE_BASE = (1<<15),
423 SCTP_ASSOC_CHANGE, 437 SCTP_ASSOC_CHANGE,
438#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE
424 SCTP_PEER_ADDR_CHANGE, 439 SCTP_PEER_ADDR_CHANGE,
440#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE
425 SCTP_SEND_FAILED, 441 SCTP_SEND_FAILED,
442#define SCTP_SEND_FAILED SCTP_SEND_FAILED
426 SCTP_REMOTE_ERROR, 443 SCTP_REMOTE_ERROR,
444#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR
427 SCTP_SHUTDOWN_EVENT, 445 SCTP_SHUTDOWN_EVENT,
446#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT
428 SCTP_PARTIAL_DELIVERY_EVENT, 447 SCTP_PARTIAL_DELIVERY_EVENT,
448#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT
429 SCTP_ADAPTATION_INDICATION, 449 SCTP_ADAPTATION_INDICATION,
450#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION
430 SCTP_AUTHENTICATION_EVENT, 451 SCTP_AUTHENTICATION_EVENT,
431#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT 452#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT
432 SCTP_SENDER_DRY_EVENT, 453 SCTP_SENDER_DRY_EVENT,
454#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
433}; 455};
434 456
435/* Notification error codes used to fill up the error fields in some 457/* Notification error codes used to fill up the error fields in some
@@ -454,7 +476,7 @@ typedef enum sctp_sn_error {
454 * 476 *
455 * The protocol parameters used to initialize and bound retransmission 477 * The protocol parameters used to initialize and bound retransmission
456 * timeout (RTO) are tunable. See [SCTP] for more information on how 478 * timeout (RTO) are tunable. See [SCTP] for more information on how
457 * these parameters are used in RTO calculation. 479 * these parameters are used in RTO calculation.
458 */ 480 */
459struct sctp_rtoinfo { 481struct sctp_rtoinfo {
460 sctp_assoc_t srto_assoc_id; 482 sctp_assoc_t srto_assoc_id;
@@ -504,6 +526,9 @@ struct sctp_prim {
504 struct sockaddr_storage ssp_addr; 526 struct sockaddr_storage ssp_addr;
505} __attribute__((packed, aligned(4))); 527} __attribute__((packed, aligned(4)));
506 528
529/* For backward compatibility use, define the old name too */
530#define sctp_setprim sctp_prim
531
507/* 532/*
508 * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) 533 * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
509 * 534 *
@@ -564,12 +589,27 @@ struct sctp_authchunk {
564 * 589 *
565 * This option gets or sets the list of HMAC algorithms that the local 590 * This option gets or sets the list of HMAC algorithms that the local
566 * endpoint requires the peer to use. 591 * endpoint requires the peer to use.
567*/ 592 */
593#ifndef __KERNEL__
594/* This here is only used by user space as is. It might not be a good idea
595 * to export/reveal the whole structure with reserved fields etc.
596 */
597enum {
598 SCTP_AUTH_HMAC_ID_SHA1 = 1,
599 SCTP_AUTH_HMAC_ID_SHA256 = 3,
600};
601#endif
602
568struct sctp_hmacalgo { 603struct sctp_hmacalgo {
569 __u32 shmac_num_idents; 604 __u32 shmac_num_idents;
570 __u16 shmac_idents[]; 605 __u16 shmac_idents[];
571}; 606};
572 607
608/* Sadly, user and kernel space have different names for
609 * this structure member, so this is to not break anything.
610 */
611#define shmac_number_of_idents shmac_num_idents
612
573/* 613/*
574 * 7.1.20. Set a shared key (SCTP_AUTH_KEY) 614 * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
575 * 615 *
@@ -691,6 +731,24 @@ struct sctp_authchunks {
691 uint8_t gauth_chunks[]; 731 uint8_t gauth_chunks[];
692}; 732};
693 733
734/* The broken spelling has been released already in lksctp-tools header,
735 * so don't break anyone, now that it's fixed.
736 */
737#define guth_number_of_chunks gauth_number_of_chunks
738
739/* Association states. */
740enum sctp_sstat_state {
741 SCTP_EMPTY = 0,
742 SCTP_CLOSED = 1,
743 SCTP_COOKIE_WAIT = 2,
744 SCTP_COOKIE_ECHOED = 3,
745 SCTP_ESTABLISHED = 4,
746 SCTP_SHUTDOWN_PENDING = 5,
747 SCTP_SHUTDOWN_SENT = 6,
748 SCTP_SHUTDOWN_RECEIVED = 7,
749 SCTP_SHUTDOWN_ACK_SENT = 8,
750};
751
694/* 752/*
695 * 8.2.6. Get the Current Identifiers of Associations 753 * 8.2.6. Get the Current Identifiers of Associations
696 * (SCTP_GET_ASSOC_ID_LIST) 754 * (SCTP_GET_ASSOC_ID_LIST)
@@ -705,15 +763,20 @@ struct sctp_assoc_ids {
705 763
706/* 764/*
707 * 8.3, 8.5 get all peer/local addresses in an association. 765 * 8.3, 8.5 get all peer/local addresses in an association.
708 * This parameter struct is used by SCTP_GET_PEER_ADDRS and 766 * This parameter struct is used by SCTP_GET_PEER_ADDRS and
709 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement 767 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
710 * sctp_getpaddrs() and sctp_getladdrs() API. 768 * sctp_getpaddrs() and sctp_getladdrs() API.
711 */ 769 */
712struct sctp_getaddrs_old { 770struct sctp_getaddrs_old {
713 sctp_assoc_t assoc_id; 771 sctp_assoc_t assoc_id;
714 int addr_num; 772 int addr_num;
773#ifdef __KERNEL__
715 struct sockaddr __user *addrs; 774 struct sockaddr __user *addrs;
775#else
776 struct sockaddr *addrs;
777#endif
716}; 778};
779
717struct sctp_getaddrs { 780struct sctp_getaddrs {
718 sctp_assoc_t assoc_id; /*input*/ 781 sctp_assoc_t assoc_id; /*input*/
719 __u32 addr_num; /*output*/ 782 __u32 addr_num; /*output*/
@@ -779,4 +842,5 @@ struct sctp_paddrthlds {
779 __u16 spt_pathmaxrxt; 842 __u16 spt_pathmaxrxt;
780 __u16 spt_pathpfthld; 843 __u16 spt_pathpfthld;
781}; 844};
782#endif /* __net_sctp_user_h__ */ 845
846#endif /* _UAPI_SCTP_H */
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index b49eab89c9fd..df2e8b4f9c03 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -50,6 +50,7 @@ enum
50 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ 50 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
51 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ 51 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
52 IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */ 52 IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */
53 IPSTATS_MIB_CSUMERRORS, /* InCsumErrors */
53 __IPSTATS_MIB_MAX 54 __IPSTATS_MIB_MAX
54}; 55};
55 56
@@ -87,6 +88,7 @@ enum
87 ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */ 88 ICMP_MIB_OUTTIMESTAMPREPS, /* OutTimestampReps */
88 ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */ 89 ICMP_MIB_OUTADDRMASKS, /* OutAddrMasks */
89 ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */ 90 ICMP_MIB_OUTADDRMASKREPS, /* OutAddrMaskReps */
91 ICMP_MIB_CSUMERRORS, /* InCsumErrors */
90 __ICMP_MIB_MAX 92 __ICMP_MIB_MAX
91}; 93};
92 94
@@ -103,6 +105,7 @@ enum
103 ICMP6_MIB_INERRORS, /* InErrors */ 105 ICMP6_MIB_INERRORS, /* InErrors */
104 ICMP6_MIB_OUTMSGS, /* OutMsgs */ 106 ICMP6_MIB_OUTMSGS, /* OutMsgs */
105 ICMP6_MIB_OUTERRORS, /* OutErrors */ 107 ICMP6_MIB_OUTERRORS, /* OutErrors */
108 ICMP6_MIB_CSUMERRORS, /* InCsumErrors */
106 __ICMP6_MIB_MAX 109 __ICMP6_MIB_MAX
107}; 110};
108 111
@@ -130,6 +133,7 @@ enum
130 TCP_MIB_RETRANSSEGS, /* RetransSegs */ 133 TCP_MIB_RETRANSSEGS, /* RetransSegs */
131 TCP_MIB_INERRS, /* InErrs */ 134 TCP_MIB_INERRS, /* InErrs */
132 TCP_MIB_OUTRSTS, /* OutRsts */ 135 TCP_MIB_OUTRSTS, /* OutRsts */
136 TCP_MIB_CSUMERRORS, /* InCsumErrors */
133 __TCP_MIB_MAX 137 __TCP_MIB_MAX
134}; 138};
135 139
@@ -147,6 +151,7 @@ enum
147 UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ 151 UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */
148 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ 152 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */
149 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ 153 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */
154 UDP_MIB_CSUMERRORS, /* InCsumErrors */
150 __UDP_MIB_MAX 155 __UDP_MIB_MAX
151}; 156};
152 157
@@ -202,6 +207,8 @@ enum
202 LINUX_MIB_TCPFORWARDRETRANS, /* TCPForwardRetrans */ 207 LINUX_MIB_TCPFORWARDRETRANS, /* TCPForwardRetrans */
203 LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */ 208 LINUX_MIB_TCPSLOWSTARTRETRANS, /* TCPSlowStartRetrans */
204 LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */ 209 LINUX_MIB_TCPTIMEOUTS, /* TCPTimeouts */
210 LINUX_MIB_TCPLOSSPROBES, /* TCPLossProbes */
211 LINUX_MIB_TCPLOSSPROBERECOVERY, /* TCPLossProbeRecovery */
205 LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */ 212 LINUX_MIB_TCPRENORECOVERYFAIL, /* TCPRenoRecoveryFail */
206 LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */ 213 LINUX_MIB_TCPSACKRECOVERYFAIL, /* TCPSackRecoveryFail */
207 LINUX_MIB_TCPSCHEDULERFAILED, /* TCPSchedulerFailed */ 214 LINUX_MIB_TCPSCHEDULERFAILED, /* TCPSchedulerFailed */
@@ -245,6 +252,7 @@ enum
245 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ 252 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */
246 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
247 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ 254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
248 __LINUX_MIB_MAX 256 __LINUX_MIB_MAX
249}; 257};
250 258
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 6b1ead0b0c9d..8d776ebc4829 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -102,7 +102,6 @@ enum {
102#define TCP_QUICKACK 12 /* Block/reenable quick acks */ 102#define TCP_QUICKACK 12 /* Block/reenable quick acks */
103#define TCP_CONGESTION 13 /* Congestion control algorithm */ 103#define TCP_CONGESTION 13 /* Congestion control algorithm */
104#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ 104#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
105#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ 105#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ 106#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ 107#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
@@ -199,29 +198,4 @@ struct tcp_md5sig {
199 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ 198 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */
200}; 199};
201 200
202/* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */
203#define TCP_COOKIE_MIN 8 /* 64-bits */
204#define TCP_COOKIE_MAX 16 /* 128-bits */
205#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX)
206
207/* Flags for both getsockopt and setsockopt */
208#define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */
209#define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies,
210 * supercedes everything. */
211
212/* Flags for getsockopt */
213#define TCP_S_DATA_IN (1 << 2) /* Was data received? */
214#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */
215
216/* TCP_COOKIE_TRANSACTIONS data */
217struct tcp_cookie_transactions {
218 __u16 tcpct_flags; /* see above */
219 __u8 __tcpct_pad1; /* zero */
220 __u8 tcpct_cookie_desired; /* bytes */
221 __u16 tcpct_s_data_desired; /* bytes of variable data */
222 __u16 tcpct_used; /* bytes in value */
223 __u8 tcpct_value[TCP_MSS_DEFAULT];
224};
225
226
227#endif /* _UAPI_LINUX_TCP_H */ 201#endif /* _UAPI_LINUX_TCP_H */
diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h
index 0d3c0edc3eda..e75e1b6ff27f 100644
--- a/include/uapi/linux/time.h
+++ b/include/uapi/linux/time.h
@@ -54,11 +54,9 @@ struct itimerval {
54#define CLOCK_BOOTTIME 7 54#define CLOCK_BOOTTIME 7
55#define CLOCK_REALTIME_ALARM 8 55#define CLOCK_REALTIME_ALARM 8
56#define CLOCK_BOOTTIME_ALARM 9 56#define CLOCK_BOOTTIME_ALARM 9
57#define CLOCK_SGI_CYCLE 10 /* Hardware specific */
58#define CLOCK_TAI 11
57 59
58/*
59 * The IDs of various hardware clocks:
60 */
61#define CLOCK_SGI_CYCLE 10
62#define MAX_CLOCKS 16 60#define MAX_CLOCKS 16
63#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) 61#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
64#define CLOCKS_MONO CLOCK_MONOTONIC 62#define CLOCKS_MONO CLOCK_MONOTONIC
diff --git a/include/uapi/linux/usb/cdc-wdm.h b/include/uapi/linux/usb/cdc-wdm.h
new file mode 100644
index 000000000000..f03134feebd6
--- /dev/null
+++ b/include/uapi/linux/usb/cdc-wdm.h
@@ -0,0 +1,21 @@
1/*
2 * USB CDC Device Management userspace API definitions
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * version 2 as published by the Free Software Foundation.
7 */
8
9#ifndef _UAPI__LINUX_USB_CDC_WDM_H
10#define _UAPI__LINUX_USB_CDC_WDM_H
11
12/*
13 * This IOCTL is used to retrieve the wMaxCommand for the device,
14 * defining the message limit for both reading and writing.
15 *
16 * For CDC WDM functions this will be the wMaxCommand field of the
17 * Device Management Functional Descriptor.
18 */
19#define IOCTL_WDM_MAX_COMMAND _IOR('H', 0xA0, __u16)
20
21#endif /* _UAPI__LINUX_USB_CDC_WDM_H */
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index f738e25377ff..aa33fd1b2d4f 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -138,7 +138,7 @@
138 138
139/* 139/*
140 * New Feature Selectors as added by USB 3.0 140 * New Feature Selectors as added by USB 3.0
141 * See USB 3.0 spec Table 9-6 141 * See USB 3.0 spec Table 9-7
142 */ 142 */
143#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */ 143#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
144#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */ 144#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
@@ -147,7 +147,7 @@
147 147
148#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00 148#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
149/* 149/*
150 * Suspend Options, Table 9-7 USB 3.0 spec 150 * Suspend Options, Table 9-8 USB 3.0 spec
151 */ 151 */
152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0)) 152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1)) 153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index dcd63745e83a..69bd5bb0d5af 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -59,6 +59,7 @@
59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */ 59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
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 /* Digital Video controls */
62 63
63/* User-class control IDs */ 64/* User-class control IDs */
64 65
@@ -146,6 +147,19 @@ enum v4l2_colorfx {
146 * of controls. We reserve 16 controls for this driver. */ 147 * of controls. We reserve 16 controls for this driver. */
147#define V4L2_CID_USER_MEYE_BASE (V4L2_CID_USER_BASE + 0x1000) 148#define V4L2_CID_USER_MEYE_BASE (V4L2_CID_USER_BASE + 0x1000)
148 149
150/* The base for the bttv driver controls.
151 * We reserve 32 controls for this driver. */
152#define V4L2_CID_USER_BTTV_BASE (V4L2_CID_USER_BASE + 0x1010)
153
154
155/* The base for the s2255 driver controls.
156 * We reserve 16 controls for this driver. */
157#define V4L2_CID_USER_S2255_BASE (V4L2_CID_USER_BASE + 0x1030)
158
159/* The base for the si476x driver controls. See include/media/si476x.h for the list
160 * of controls. Total of 16 controls is reserved for this driver */
161#define V4L2_CID_USER_SI476X_BASE (V4L2_CID_USER_BASE + 0x1040)
162
149/* MPEG-class control IDs */ 163/* MPEG-class control IDs */
150 164
151#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 165#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -351,6 +365,7 @@ enum v4l2_mpeg_video_multi_slice_mode {
351#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) 365#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
352#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) 366#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
353#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225) 367#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225)
368#define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226)
354 369
355#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 370#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
356#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 371#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
@@ -643,6 +658,7 @@ enum v4l2_exposure_metering {
643 V4L2_EXPOSURE_METERING_AVERAGE = 0, 658 V4L2_EXPOSURE_METERING_AVERAGE = 0,
644 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1, 659 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
645 V4L2_EXPOSURE_METERING_SPOT = 2, 660 V4L2_EXPOSURE_METERING_SPOT = 2,
661 V4L2_EXPOSURE_METERING_MATRIX = 3,
646}; 662};
647 663
648#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26) 664#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
@@ -825,4 +841,16 @@ enum v4l2_dv_rgb_range {
825#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100) 841#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)
826#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101) 842#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101)
827 843
844#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
845#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1)
846
847#define V4L2_CID_TUNE_DEEMPHASIS (V4L2_CID_FM_RX_CLASS_BASE + 1)
848enum v4l2_deemphasis {
849 V4L2_DEEMPHASIS_DISABLED = V4L2_PREEMPHASIS_DISABLED,
850 V4L2_DEEMPHASIS_50_uS = V4L2_PREEMPHASIS_50_uS,
851 V4L2_DEEMPHASIS_75_uS = V4L2_PREEMPHASIS_75_uS,
852};
853
854#define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2)
855
828#endif 856#endif
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h
index 9ef8172e5ed0..4e0c58d25ff0 100644
--- a/include/uapi/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
@@ -42,6 +42,15 @@
42 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0) \ 42 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0) \
43} 43}
44 44
45/* Note: these are the nominal timings, for HDMI links this format is typically
46 * double-clocked to meet the minimum pixelclock requirements. */
47#define V4L2_DV_BT_CEA_720X480I59_94 { \
48 .type = V4L2_DV_BT_656_1120, \
49 V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, \
50 13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, \
51 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \
52}
53
45#define V4L2_DV_BT_CEA_720X480P59_94 { \ 54#define V4L2_DV_BT_CEA_720X480P59_94 { \
46 .type = V4L2_DV_BT_656_1120, \ 55 .type = V4L2_DV_BT_656_1120, \
47 V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \ 56 V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \
@@ -49,6 +58,15 @@
49 V4L2_DV_BT_STD_CEA861, 0) \ 58 V4L2_DV_BT_STD_CEA861, 0) \
50} 59}
51 60
61/* Note: these are the nominal timings, for HDMI links this format is typically
62 * double-clocked to meet the minimum pixelclock requirements. */
63#define V4L2_DV_BT_CEA_720X576I50 { \
64 .type = V4L2_DV_BT_656_1120, \
65 V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, \
66 13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, \
67 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \
68}
69
52#define V4L2_DV_BT_CEA_720X576P50 { \ 70#define V4L2_DV_BT_CEA_720X576P50 { \
53 .type = V4L2_DV_BT_656_1120, \ 71 .type = V4L2_DV_BT_656_1120, \
54 V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \ 72 V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \
diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h
index b9b7bea04537..6ee63d09b32d 100644
--- a/include/uapi/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -37,7 +37,7 @@
37enum v4l2_mbus_pixelcode { 37enum v4l2_mbus_pixelcode {
38 V4L2_MBUS_FMT_FIXED = 0x0001, 38 V4L2_MBUS_FMT_FIXED = 0x0001,
39 39
40 /* RGB - next is 0x1009 */ 40 /* RGB - next is 0x100d */
41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001, 41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002, 42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003, 43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
@@ -46,6 +46,10 @@ enum v4l2_mbus_pixelcode {
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006, 46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, 47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, 48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49 V4L2_MBUS_FMT_RGB666_1X18 = 0x1009,
50 V4L2_MBUS_FMT_RGB888_1X24 = 0x100a,
51 V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b,
52 V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,
49 53
50 /* YUV (including grey) - next is 0x2017 */ 54 /* YUV (including grey) - next is 0x2017 */
51 V4L2_MBUS_FMT_Y8_1X8 = 0x2001, 55 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 4f41f309911e..284ff2436829 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -319,6 +319,7 @@ enum {
319 VFIO_PCI_INTX_IRQ_INDEX, 319 VFIO_PCI_INTX_IRQ_INDEX,
320 VFIO_PCI_MSI_IRQ_INDEX, 320 VFIO_PCI_MSI_IRQ_INDEX,
321 VFIO_PCI_MSIX_IRQ_INDEX, 321 VFIO_PCI_MSIX_IRQ_INDEX,
322 VFIO_PCI_ERR_IRQ_INDEX,
322 VFIO_PCI_NUM_IRQS 323 VFIO_PCI_NUM_IRQS
323}; 324};
324 325
diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
index e847f1e30756..bb6a5b4cb3c5 100644
--- a/include/uapi/linux/vhost.h
+++ b/include/uapi/linux/vhost.h
@@ -127,4 +127,32 @@ struct vhost_memory {
127/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */ 127/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
128#define VHOST_NET_F_VIRTIO_NET_HDR 27 128#define VHOST_NET_F_VIRTIO_NET_HDR 27
129 129
130/* VHOST_SCSI specific definitions */
131
132/*
133 * Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
134 *
135 * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
136 * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
137 * ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target.
138 * All the targets under vhost_wwpn can be seen and used by guset.
139 */
140
141#define VHOST_SCSI_ABI_VERSION 1
142
143struct vhost_scsi_target {
144 int abi_version;
145 char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */
146 unsigned short vhost_tpgt;
147 unsigned short reserved;
148};
149
150#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
151#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
152/* Changing this breaks userspace. */
153#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
154/* Set and get the events missed flag */
155#define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32)
156#define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)
157
130#endif 158#endif
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 234d1d870914..f40b41c7e108 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -72,27 +72,6 @@
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73#define VIDEO_MAX_PLANES 8 73#define VIDEO_MAX_PLANES 8
74 74
75#ifndef __KERNEL__
76
77/* These defines are V4L1 specific and should not be used with the V4L2 API!
78 They will be removed from this header in the future. */
79
80#define VID_TYPE_CAPTURE 1 /* Can capture */
81#define VID_TYPE_TUNER 2 /* Can tune */
82#define VID_TYPE_TELETEXT 4 /* Does teletext */
83#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
84#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
85#define VID_TYPE_CLIPPING 32 /* Can clip */
86#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
87#define VID_TYPE_SCALES 128 /* Scalable */
88#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
89#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
90#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
91#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
92#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
93#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
94#endif
95
96/* 75/*
97 * M I S C E L L A N E O U S 76 * M I S C E L L A N E O U S
98 */ 77 */
@@ -705,6 +684,7 @@ struct v4l2_buffer {
705#define V4L2_BUF_FLAG_TIMESTAMP_MASK 0xe000 684#define V4L2_BUF_FLAG_TIMESTAMP_MASK 0xe000
706#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x0000 685#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x0000
707#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x2000 686#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x2000
687#define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x4000
708 688
709/** 689/**
710 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor 690 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
@@ -980,52 +960,6 @@ struct v4l2_standard {
980 __u32 reserved[4]; 960 __u32 reserved[4];
981}; 961};
982 962
983/* The DV Preset API is deprecated in favor of the DV Timings API.
984 New drivers shouldn't use this anymore! */
985
986/*
987 * V I D E O T I M I N G S D V P R E S E T
988 */
989struct v4l2_dv_preset {
990 __u32 preset;
991 __u32 reserved[4];
992};
993
994/*
995 * D V P R E S E T S E N U M E R A T I O N
996 */
997struct v4l2_dv_enum_preset {
998 __u32 index;
999 __u32 preset;
1000 __u8 name[32]; /* Name of the preset timing */
1001 __u32 width;
1002 __u32 height;
1003 __u32 reserved[4];
1004};
1005
1006/*
1007 * D V P R E S E T V A L U E S
1008 */
1009#define V4L2_DV_INVALID 0
1010#define V4L2_DV_480P59_94 1 /* BT.1362 */
1011#define V4L2_DV_576P50 2 /* BT.1362 */
1012#define V4L2_DV_720P24 3 /* SMPTE 296M */
1013#define V4L2_DV_720P25 4 /* SMPTE 296M */
1014#define V4L2_DV_720P30 5 /* SMPTE 296M */
1015#define V4L2_DV_720P50 6 /* SMPTE 296M */
1016#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
1017#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
1018#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
1019#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
1020#define V4L2_DV_1080I25 11 /* BT.1120 */
1021#define V4L2_DV_1080I50 12 /* SMPTE 296M */
1022#define V4L2_DV_1080I60 13 /* SMPTE 296M */
1023#define V4L2_DV_1080P24 14 /* SMPTE 296M */
1024#define V4L2_DV_1080P25 15 /* SMPTE 296M */
1025#define V4L2_DV_1080P30 16 /* SMPTE 296M */
1026#define V4L2_DV_1080P50 17 /* BT.1120 */
1027#define V4L2_DV_1080P60 18 /* BT.1120 */
1028
1029/* 963/*
1030 * D V B T T I M I N G S 964 * D V B T T I M I N G S
1031 */ 965 */
@@ -1119,7 +1053,7 @@ struct v4l2_bt_timings {
1119 longer and field 2 is really one half-line shorter, so each field has 1053 longer and field 2 is really one half-line shorter, so each field has
1120 exactly the same number of half-lines. Whether half-lines can be detected 1054 exactly the same number of half-lines. Whether half-lines can be detected
1121 or used depends on the hardware. */ 1055 or used depends on the hardware. */
1122#define V4L2_DV_FL_HALF_LINE (1 << 0) 1056#define V4L2_DV_FL_HALF_LINE (1 << 3)
1123 1057
1124 1058
1125/** struct v4l2_dv_timings - DV timings 1059/** struct v4l2_dv_timings - DV timings
@@ -1239,7 +1173,6 @@ struct v4l2_input {
1239#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ 1173#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
1240 1174
1241/* capabilities flags */ 1175/* capabilities flags */
1242#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1243#define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ 1176#define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1244#define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */ 1177#define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
1245#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ 1178#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
@@ -1263,7 +1196,6 @@ struct v4l2_output {
1263#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 1196#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
1264 1197
1265/* capabilities flags */ 1198/* capabilities flags */
1266#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1267#define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ 1199#define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1268#define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */ 1200#define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
1269#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ 1201#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
@@ -1854,10 +1786,12 @@ struct v4l2_event_subscription {
1854 1786
1855/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1787/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1856 1788
1857#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ 1789#define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */
1858#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ 1790#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE
1859#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1791#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
1860#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ 1792#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1793#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
1794#define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */
1861 1795
1862struct v4l2_dbg_match { 1796struct v4l2_dbg_match {
1863 __u32 type; /* Match type */ 1797 __u32 type; /* Match type */
@@ -1881,6 +1815,17 @@ struct v4l2_dbg_chip_ident {
1881 __u32 revision; /* chip revision, chip specific */ 1815 __u32 revision; /* chip revision, chip specific */
1882} __attribute__ ((packed)); 1816} __attribute__ ((packed));
1883 1817
1818#define V4L2_CHIP_FL_READABLE (1 << 0)
1819#define V4L2_CHIP_FL_WRITABLE (1 << 1)
1820
1821/* VIDIOC_DBG_G_CHIP_INFO */
1822struct v4l2_dbg_chip_info {
1823 struct v4l2_dbg_match match;
1824 char name[32];
1825 __u32 flags;
1826 __u32 reserved[32];
1827} __attribute__ ((packed));
1828
1884/** 1829/**
1885 * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument 1830 * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument
1886 * @index: on return, index of the first created buffer 1831 * @index: on return, index of the first created buffer
@@ -1958,15 +1903,12 @@ struct v4l2_create_buffers {
1958#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) 1903#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
1959#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) 1904#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
1960#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) 1905#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
1961#if 1
1962#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) 1906#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
1963#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) 1907#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
1964#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) 1908#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
1965#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) 1909#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
1966#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) 1910#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
1967#endif
1968 1911
1969#if 1
1970/* Experimental, meant for debugging, testing and internal use. 1912/* Experimental, meant for debugging, testing and internal use.
1971 Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. 1913 Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
1972 You must be root to use these ioctls. Never use these in applications! */ 1914 You must be root to use these ioctls. Never use these in applications! */
@@ -1974,18 +1916,13 @@ struct v4l2_create_buffers {
1974#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) 1916#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
1975 1917
1976/* Experimental, meant for debugging, testing and internal use. 1918/* Experimental, meant for debugging, testing and internal use.
1977 Never use this ioctl in applications! */ 1919 Never use this ioctl in applications!
1920 Note: this ioctl is deprecated in favor of VIDIOC_DBG_G_CHIP_INFO and
1921 will go away in the future. */
1978#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) 1922#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1979#endif
1980 1923
1981#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1924#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1982 1925
1983/* These four DV Preset ioctls are deprecated in favor of the DV Timings
1984 ioctls. */
1985#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
1986#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
1987#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
1988#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1989#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1926#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1990#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) 1927#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1991#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) 1928#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
@@ -2016,6 +1953,10 @@ struct v4l2_create_buffers {
2016 versions. */ 1953 versions. */
2017#define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band) 1954#define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band)
2018 1955
1956/* Experimental, meant for debugging, testing and internal use.
1957 Never use these in applications! */
1958#define VIDIOC_DBG_G_CHIP_INFO _IOWR('V', 102, struct v4l2_dbg_chip_info)
1959
2019/* Reminder: when adding new ioctls please add support for them to 1960/* Reminder: when adding new ioctls please add support for them to
2020 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1961 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2021 1962
diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
index 652dc8bea921..5e26f61b5df5 100644
--- a/include/uapi/linux/virtio_balloon.h
+++ b/include/uapi/linux/virtio_balloon.h
@@ -52,8 +52,8 @@ struct virtio_balloon_config
52#define VIRTIO_BALLOON_S_NR 6 52#define VIRTIO_BALLOON_S_NR 6
53 53
54struct virtio_balloon_stat { 54struct virtio_balloon_stat {
55 u16 tag; 55 __u16 tag;
56 u64 val; 56 __u64 val;
57} __attribute__((packed)); 57} __attribute__((packed));
58 58
59#endif /* _LINUX_VIRTIO_BALLOON_H */ 59#endif /* _LINUX_VIRTIO_BALLOON_H */
diff --git a/include/uapi/linux/virtio_console.h b/include/uapi/linux/virtio_console.h
index ee13ab6c3614..c312f16bc4e7 100644
--- a/include/uapi/linux/virtio_console.h
+++ b/include/uapi/linux/virtio_console.h
@@ -39,7 +39,7 @@
39#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 39#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
40#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ 40#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
41 41
42#define VIRTIO_CONSOLE_BAD_ID (~(u32)0) 42#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0)
43 43
44struct virtio_console_config { 44struct virtio_console_config {
45 /* colums of the screens */ 45 /* colums of the screens */
diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
index a7630d04029f..284fc3a05f7b 100644
--- a/include/uapi/linux/virtio_ids.h
+++ b/include/uapi/linux/virtio_ids.h
@@ -38,5 +38,6 @@
38#define VIRTIO_ID_SCSI 8 /* virtio scsi */ 38#define VIRTIO_ID_SCSI 8 /* virtio scsi */
39#define VIRTIO_ID_9P 9 /* 9p virtio console */ 39#define VIRTIO_ID_9P 9 /* 9p virtio console */
40#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ 40#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
41#define VIRTIO_ID_CAIF 12 /* Virtio caif */
41 42
42#endif /* _LINUX_VIRTIO_IDS_H */ 43#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index a5a8c88753b9..c520203fac2f 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -191,7 +191,7 @@ struct virtio_net_ctrl_mac {
191 * specified. 191 * specified.
192 */ 192 */
193struct virtio_net_ctrl_mq { 193struct virtio_net_ctrl_mq {
194 u16 virtqueue_pairs; 194 __u16 virtqueue_pairs;
195}; 195};
196 196
197#define VIRTIO_NET_CTRL_MQ 4 197#define VIRTIO_NET_CTRL_MQ 4
diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h
index df91301847ec..b4ed5d895699 100644
--- a/include/uapi/linux/vm_sockets.h
+++ b/include/uapi/linux/vm_sockets.h
@@ -13,12 +13,10 @@
13 * more details. 13 * more details.
14 */ 14 */
15 15
16#ifndef _VM_SOCKETS_H_ 16#ifndef _UAPI_VM_SOCKETS_H
17#define _VM_SOCKETS_H_ 17#define _UAPI_VM_SOCKETS_H
18 18
19#if !defined(__KERNEL__) 19#include <linux/socket.h>
20#include <sys/socket.h>
21#endif
22 20
23/* Option name for STREAM socket buffer size. Use as the option name in 21/* Option name for STREAM socket buffer size. Use as the option name in
24 * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that 22 * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that
@@ -137,14 +135,13 @@
137#define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF)) 135#define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF))
138 136
139/* Address structure for vSockets. The address family should be set to 137/* Address structure for vSockets. The address family should be set to
140 * whatever vmci_sock_get_af_value_fd() returns. The structure members should 138 * AF_VSOCK. The structure members should all align on their natural
141 * all align on their natural boundaries without resorting to compiler packing 139 * boundaries without resorting to compiler packing directives. The total size
142 * directives. The total size of this structure should be exactly the same as 140 * of this structure should be exactly the same as that of struct sockaddr.
143 * that of struct sockaddr.
144 */ 141 */
145 142
146struct sockaddr_vm { 143struct sockaddr_vm {
147 sa_family_t svm_family; 144 __kernel_sa_family_t svm_family;
148 unsigned short svm_reserved1; 145 unsigned short svm_reserved1;
149 unsigned int svm_port; 146 unsigned int svm_port;
150 unsigned int svm_cid; 147 unsigned int svm_cid;
@@ -156,8 +153,4 @@ struct sockaddr_vm {
156 153
157#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9) 154#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
158 155
159#if defined(__KERNEL__) 156#endif /* _UAPI_VM_SOCKETS_H */
160int vm_sockets_get_local_cid(void);
161#endif
162
163#endif
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 28e493b5b94c..a8cd6a4a2970 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -297,6 +297,7 @@ enum xfrm_attr_type_t {
297 XFRMA_MARK, /* struct xfrm_mark */ 297 XFRMA_MARK, /* struct xfrm_mark */
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_MAX 301 __XFRMA_MAX
301 302
302#define XFRMA_MAX (__XFRMA_MAX - 1) 303#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -367,6 +368,8 @@ struct xfrm_usersa_info {
367#define XFRM_STATE_ESN 128 368#define XFRM_STATE_ESN 128
368}; 369};
369 370
371#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1
372
370struct xfrm_usersa_id { 373struct xfrm_usersa_id {
371 xfrm_address_t daddr; 374 xfrm_address_t daddr;
372 __be32 spi; 375 __be32 spi;
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 1774a5c3ef10..e3983d508272 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -214,7 +214,9 @@ typedef int __bitwise snd_pcm_format_t;
214#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ 214#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
215#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ 215#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
216#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ 216#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
217#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B 217#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
218#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
219#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U16_LE
218 220
219#ifdef SNDRV_LITTLE_ENDIAN 221#ifdef SNDRV_LITTLE_ENDIAN
220#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE 222#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 8deb22672ada..0f5a2fc69af9 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -31,6 +31,7 @@
31#define ATMEL_LCDC_WIRING_BGR 0 31#define ATMEL_LCDC_WIRING_BGR 0
32#define ATMEL_LCDC_WIRING_RGB 1 32#define ATMEL_LCDC_WIRING_RGB 1
33 33
34struct atmel_lcdfb_config;
34 35
35 /* LCD Controller info data structure, stored in device platform_data */ 36 /* LCD Controller info data structure, stored in device platform_data */
36struct atmel_lcdfb_info { 37struct atmel_lcdfb_info {
@@ -61,7 +62,8 @@ struct atmel_lcdfb_info {
61 void (*atmel_lcdfb_power_control)(int on); 62 void (*atmel_lcdfb_power_control)(int on);
62 struct fb_monspecs *default_monspecs; 63 struct fb_monspecs *default_monspecs;
63 u32 pseudo_palette[16]; 64 u32 pseudo_palette[16];
64 bool have_intensity_bit; 65
66 struct atmel_lcdfb_config *config;
65}; 67};
66 68
67#define ATMEL_LCDC_DMABADDR1 0x00 69#define ATMEL_LCDC_DMABADDR1 0x00
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h
new file mode 100644
index 000000000000..0c3b46d3daf3
--- /dev/null
+++ b/include/video/omap-panel-data.h
@@ -0,0 +1,150 @@
1/*
2 * Header containing platform_data structs for omap panels
3 *
4 * Copyright (C) 2013 Texas Instruments
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 * Archit Taneja <archit@ti.com>
7 *
8 * Copyright (C) 2011 Texas Instruments
9 * Author: Mayuresh Janorkar <mayur@ti.com>
10 *
11 * Copyright (C) 2010 Canonical Ltd.
12 * Author: Bryan Wu <bryan.wu@canonical.com>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License version 2 as published by
16 * the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 * more details.
22 *
23 * You should have received a copy of the GNU General Public License along with
24 * this program. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27#ifndef __OMAP_PANEL_DATA_H
28#define __OMAP_PANEL_DATA_H
29
30struct omap_dss_device;
31
32/**
33 * struct panel_generic_dpi_data - panel driver configuration data
34 * @name: panel name
35 * @platform_enable: platform specific panel enable function
36 * @platform_disable: platform specific panel disable function
37 * @num_gpios: number of gpios connected to panel
38 * @gpios: gpio numbers on the platform
39 * @gpio_invert: configure gpio as active high or low
40 */
41struct panel_generic_dpi_data {
42 const char *name;
43 int (*platform_enable)(struct omap_dss_device *dssdev);
44 void (*platform_disable)(struct omap_dss_device *dssdev);
45
46 int num_gpios;
47 int gpios[10];
48 bool gpio_invert[10];
49};
50
51/**
52 * struct panel_n8x0_data - N800 panel driver configuration data
53 */
54struct panel_n8x0_data {
55 int (*platform_enable)(struct omap_dss_device *dssdev);
56 void (*platform_disable)(struct omap_dss_device *dssdev);
57 int panel_reset;
58 int ctrl_pwrdown;
59};
60
61/**
62 * struct nokia_dsi_panel_data - Nokia DSI panel driver configuration data
63 * @name: panel name
64 * @use_ext_te: use external TE
65 * @ext_te_gpio: external TE GPIO
66 * @esd_interval: interval of ESD checks, 0 = disabled (ms)
67 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
68 * @use_dsi_backlight: true if panel uses DSI command to control backlight
69 * @pin_config: DSI pin configuration
70 */
71
72struct nokia_dsi_panel_data {
73 const char *name;
74
75 int reset_gpio;
76
77 bool use_ext_te;
78 int ext_te_gpio;
79
80 unsigned esd_interval;
81 unsigned ulps_timeout;
82
83 bool use_dsi_backlight;
84
85 struct omap_dsi_pin_config pin_config;
86};
87
88/**
89 * struct picodlp_panel_data - picodlp panel driver configuration data
90 * @picodlp_adapter_id: i2c_adapter number for picodlp
91 */
92struct picodlp_panel_data {
93 int picodlp_adapter_id;
94 int emu_done_gpio;
95 int pwrgood_gpio;
96};
97
98/**
99 * struct tfp410_platform_data - tfp410 panel driver configuration data
100 * @i2c_bus_num: i2c bus id for the panel
101 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
102 */
103struct tfp410_platform_data {
104 int i2c_bus_num;
105 int power_down_gpio;
106};
107
108/**
109 * sharp ls panel driver configuration data
110 * @resb_gpio: reset signal
111 * @ini_gpio: power on control
112 * @mo_gpio: selection for resolution(VGA/QVGA)
113 * @lr_gpio: selection for horizontal scanning direction
114 * @ud_gpio: selection for vertical scanning direction
115 */
116struct panel_sharp_ls037v7dw01_data {
117 int resb_gpio;
118 int ini_gpio;
119 int mo_gpio;
120 int lr_gpio;
121 int ud_gpio;
122};
123
124/**
125 * acx565akm panel driver configuration data
126 * @reset_gpio: reset signal
127 */
128struct panel_acx565akm_data {
129 int reset_gpio;
130};
131
132/**
133 * nec nl8048 panel driver configuration data
134 * @res_gpio: reset signal
135 * @qvga_gpio: selection for resolution(QVGA/WVGA)
136 */
137struct panel_nec_nl8048_data {
138 int res_gpio;
139 int qvga_gpio;
140};
141
142/**
143 * tpo td043 panel driver configuration data
144 * @nreset_gpio: reset signal
145 */
146struct panel_tpo_td043_data {
147 int nreset_gpio;
148};
149
150#endif /* __OMAP_PANEL_DATA_H */
diff --git a/include/video/omap-panel-generic-dpi.h b/include/video/omap-panel-generic-dpi.h
deleted file mode 100644
index 127e3f20328e..000000000000
--- a/include/video/omap-panel-generic-dpi.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Header for generic DPI panel driver
3 *
4 * Copyright (C) 2010 Canonical Ltd.
5 * Author: Bryan Wu <bryan.wu@canonical.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 version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __OMAP_PANEL_GENERIC_DPI_H
21#define __OMAP_PANEL_GENERIC_DPI_H
22
23struct omap_dss_device;
24
25/**
26 * struct panel_generic_dpi_data - panel driver configuration data
27 * @name: panel name
28 * @platform_enable: platform specific panel enable function
29 * @platform_disable: platform specific panel disable function
30 */
31struct panel_generic_dpi_data {
32 const char *name;
33 int (*platform_enable)(struct omap_dss_device *dssdev);
34 void (*platform_disable)(struct omap_dss_device *dssdev);
35};
36
37#endif /* __OMAP_PANEL_GENERIC_DPI_H */
diff --git a/include/video/omap-panel-n8x0.h b/include/video/omap-panel-n8x0.h
deleted file mode 100644
index 50a1302e2cfd..000000000000
--- a/include/video/omap-panel-n8x0.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef __OMAP_PANEL_N8X0_H
2#define __OMAP_PANEL_N8X0_H
3
4struct omap_dss_device;
5
6struct panel_n8x0_data {
7 int (*platform_enable)(struct omap_dss_device *dssdev);
8 void (*platform_disable)(struct omap_dss_device *dssdev);
9 int panel_reset;
10 int ctrl_pwrdown;
11
12 int (*set_backlight)(struct omap_dss_device *dssdev, int level);
13};
14
15#endif
diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h
deleted file mode 100644
index 04219a295539..000000000000
--- a/include/video/omap-panel-nokia-dsi.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef __OMAP_NOKIA_DSI_PANEL_H
2#define __OMAP_NOKIA_DSI_PANEL_H
3
4struct omap_dss_device;
5
6/**
7 * struct nokia_dsi_panel_data - Nokia DSI panel driver configuration
8 * @name: panel name
9 * @use_ext_te: use external TE
10 * @ext_te_gpio: external TE GPIO
11 * @esd_interval: interval of ESD checks, 0 = disabled (ms)
12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
13 * @use_dsi_backlight: true if panel uses DSI command to control backlight
14 * @pin_config: DSI pin configuration
15 */
16struct nokia_dsi_panel_data {
17 const char *name;
18
19 int reset_gpio;
20
21 bool use_ext_te;
22 int ext_te_gpio;
23
24 unsigned esd_interval;
25 unsigned ulps_timeout;
26
27 bool use_dsi_backlight;
28
29 struct omap_dsi_pin_config pin_config;
30};
31
32#endif /* __OMAP_NOKIA_DSI_PANEL_H */
diff --git a/include/video/omap-panel-picodlp.h b/include/video/omap-panel-picodlp.h
deleted file mode 100644
index 1c342ef6f3a1..000000000000
--- a/include/video/omap-panel-picodlp.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * panel data for picodlp panel
3 *
4 * Copyright (C) 2011 Texas Instruments
5 *
6 * Author: Mayuresh Janorkar <mayur@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __PANEL_PICODLP_H
13#define __PANEL_PICODLP_H
14/**
15 * struct : picodlp panel data
16 * picodlp_adapter_id: i2c_adapter number for picodlp
17 */
18struct picodlp_panel_data {
19 int picodlp_adapter_id;
20 int emu_done_gpio;
21 int pwrgood_gpio;
22};
23#endif /* __PANEL_PICODLP_H */
diff --git a/include/video/omap-panel-tfp410.h b/include/video/omap-panel-tfp410.h
deleted file mode 100644
index aef35e48bc7e..000000000000
--- a/include/video/omap-panel-tfp410.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Header for TFP410 chip driver
3 *
4 * Copyright (C) 2011 Texas Instruments Inc
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.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 version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __OMAP_PANEL_TFP410_H
21#define __OMAP_PANEL_TFP410_H
22
23struct omap_dss_device;
24
25/**
26 * struct tfp410_platform_data - panel driver configuration data
27 * @i2c_bus_num: i2c bus id for the panel
28 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
29 */
30struct tfp410_platform_data {
31 int i2c_bus_num;
32 int power_down_gpio;
33};
34
35#endif /* __OMAP_PANEL_TFP410_H */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 9b52340ec3ff..aeb4e9a0c5d1 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -257,10 +257,31 @@ void rfbi_bus_unlock(void);
257 257
258/* DSI */ 258/* DSI */
259 259
260enum omap_dss_dsi_trans_mode {
261 /* Sync Pulses: both sync start and end packets sent */
262 OMAP_DSS_DSI_PULSE_MODE,
263 /* Sync Events: only sync start packets sent */
264 OMAP_DSS_DSI_EVENT_MODE,
265 /* Burst: only sync start packets sent, pixels are time compressed */
266 OMAP_DSS_DSI_BURST_MODE,
267};
268
260struct omap_dss_dsi_videomode_timings { 269struct omap_dss_dsi_videomode_timings {
270 unsigned long hsclk;
271
272 unsigned ndl;
273 unsigned bitspp;
274
275 /* pixels */
276 u16 hact;
277 /* lines */
278 u16 vact;
279
261 /* DSI video mode blanking data */ 280 /* DSI video mode blanking data */
262 /* Unit: byte clock cycles */ 281 /* Unit: byte clock cycles */
282 u16 hss;
263 u16 hsa; 283 u16 hsa;
284 u16 hse;
264 u16 hfp; 285 u16 hfp;
265 u16 hbp; 286 u16 hbp;
266 /* Unit: line clocks */ 287 /* Unit: line clocks */
@@ -274,14 +295,24 @@ struct omap_dss_dsi_videomode_timings {
274 int hbp_blanking_mode; 295 int hbp_blanking_mode;
275 int hfp_blanking_mode; 296 int hfp_blanking_mode;
276 297
277 /* Video port sync events */ 298 enum omap_dss_dsi_trans_mode trans_mode;
278 bool vp_vsync_end;
279 bool vp_hsync_end;
280 299
281 bool ddr_clk_always_on; 300 bool ddr_clk_always_on;
282 int window_sync; 301 int window_sync;
283}; 302};
284 303
304struct omap_dss_dsi_config {
305 enum omap_dss_dsi_mode mode;
306 enum omap_dss_dsi_pixel_format pixel_format;
307 const struct omap_video_timings *timings;
308
309 unsigned long hs_clk_min, hs_clk_max;
310 unsigned long lp_clk_min, lp_clk_max;
311
312 bool ddr_clk_always_on;
313 enum omap_dss_dsi_trans_mode trans_mode;
314};
315
285void dsi_bus_lock(struct omap_dss_device *dssdev); 316void dsi_bus_lock(struct omap_dss_device *dssdev);
286void dsi_bus_unlock(struct omap_dss_device *dssdev); 317void dsi_bus_unlock(struct omap_dss_device *dssdev);
287int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, 318int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
@@ -541,9 +572,14 @@ struct omap_dss_writeback_info {
541struct omap_dss_output { 572struct omap_dss_output {
542 struct list_head list; 573 struct list_head list;
543 574
575 const char *name;
576
544 /* display type supported by the output */ 577 /* display type supported by the output */
545 enum omap_display_type type; 578 enum omap_display_type type;
546 579
580 /* DISPC channel for this output */
581 enum omap_channel dispc_channel;
582
547 /* output instance */ 583 /* output instance */
548 enum omap_dss_output_id id; 584 enum omap_dss_output_id id;
549 585
@@ -561,6 +597,7 @@ struct omap_dss_device {
561 597
562 enum omap_display_type type; 598 enum omap_display_type type;
563 599
600 /* obsolete, to be removed */
564 enum omap_channel channel; 601 enum omap_channel channel;
565 602
566 union { 603 union {
@@ -591,40 +628,10 @@ struct omap_dss_device {
591 } phy; 628 } phy;
592 629
593 struct { 630 struct {
594 struct {
595 struct {
596 u16 lck_div;
597 u16 pck_div;
598 enum omap_dss_clk_source lcd_clk_src;
599 } channel;
600
601 enum omap_dss_clk_source dispc_fclk_src;
602 } dispc;
603
604 struct {
605 /* regn is one greater than TRM's REGN value */
606 u16 regn;
607 u16 regm;
608 u16 regm_dispc;
609 u16 regm_dsi;
610
611 u16 lp_clk_div;
612 enum omap_dss_clk_source dsi_fclk_src;
613 } dsi;
614
615 struct {
616 /* regn is one greater than TRM's REGN value */
617 u16 regn;
618 u16 regm2;
619 } hdmi;
620 } clocks;
621
622 struct {
623 struct omap_video_timings timings; 631 struct omap_video_timings timings;
624 632
625 enum omap_dss_dsi_pixel_format dsi_pix_fmt; 633 enum omap_dss_dsi_pixel_format dsi_pix_fmt;
626 enum omap_dss_dsi_mode dsi_mode; 634 enum omap_dss_dsi_mode dsi_mode;
627 struct omap_dss_dsi_videomode_timings dsi_vm_timings;
628 } panel; 635 } panel;
629 636
630 struct { 637 struct {
@@ -830,15 +837,8 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
830void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 837void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
831 bool enable); 838 bool enable);
832int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); 839int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
833void omapdss_dsi_set_timings(struct omap_dss_device *dssdev, 840int omapdss_dsi_set_config(struct omap_dss_device *dssdev,
834 struct omap_video_timings *timings); 841 const struct omap_dss_dsi_config *config);
835void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
836void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev,
837 enum omap_dss_dsi_pixel_format fmt);
838void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
839 enum omap_dss_dsi_mode mode);
840void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
841 struct omap_dss_dsi_videomode_timings *timings);
842 842
843int omap_dsi_update(struct omap_dss_device *dssdev, int channel, 843int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
844 void (*callback)(int, void *), void *data); 844 void (*callback)(int, void *), void *data);
@@ -847,8 +847,6 @@ int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
847void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); 847void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
848int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, 848int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
849 const struct omap_dsi_pin_config *pin_cfg); 849 const struct omap_dsi_pin_config *pin_cfg);
850int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
851 unsigned long ddr_clk, unsigned long lp_clk);
852 850
853int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); 851int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
854void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 852void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
diff --git a/include/video/platform_lcd.h b/include/video/platform_lcd.h
index ad3bdfe743b2..23864b284147 100644
--- a/include/video/platform_lcd.h
+++ b/include/video/platform_lcd.h
@@ -15,6 +15,7 @@ struct plat_lcd_data;
15struct fb_info; 15struct fb_info;
16 16
17struct plat_lcd_data { 17struct plat_lcd_data {
18 int (*probe)(struct plat_lcd_data *);
18 void (*set_power)(struct plat_lcd_data *, unsigned int power); 19 void (*set_power)(struct plat_lcd_data *, unsigned int power);
19 int (*match_fb)(struct plat_lcd_data *, struct fb_info *); 20 int (*match_fb)(struct plat_lcd_data *, struct fb_info *);
20}; 21};
diff --git a/include/xen/events.h b/include/xen/events.h
index c6bfe01acf6b..b2b27c6a0f7b 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -90,8 +90,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi,
90int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc); 90int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
91/* Bind an PSI pirq to an irq. */ 91/* Bind an PSI pirq to an irq. */
92int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, 92int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
93 int pirq, int vector, const char *name, 93 int pirq, const char *name, domid_t domid);
94 domid_t domid);
95#endif 94#endif
96 95
97/* De-allocates the above mentioned physical interrupt. */ 96/* De-allocates the above mentioned physical interrupt. */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 9dfc12000980..3ef3fe05ee99 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -13,6 +13,24 @@
13#include <xen/interface/grant_table.h> 13#include <xen/interface/grant_table.h>
14 14
15/* 15/*
16 * Older implementation of Xen network frontend / backend has an
17 * implicit dependency on the MAX_SKB_FRAGS as the maximum number of
18 * ring slots a skb can use. Netfront / netback may not work as
19 * expected when frontend and backend have different MAX_SKB_FRAGS.
20 *
21 * A better approach is to add mechanism for netfront / netback to
22 * negotiate this value. However we cannot fix all possible
23 * frontends, so we need to define a value which states the minimum
24 * slots backend must support.
25 *
26 * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS
27 * (18), which is proved to work with most frontends. Any new backend
28 * which doesn't negotiate with frontend should expect frontend to
29 * send a valid packet using slots up to this value.
30 */
31#define XEN_NETIF_NR_SLOTS_MIN 18
32
33/*
16 * Notifications after enqueuing any type of message should be conditional on 34 * Notifications after enqueuing any type of message should be conditional on
17 * the appropriate req_event or rsp_event field in the shared ring. 35 * the appropriate req_event or rsp_event field in the shared ring.
18 * If the client sends notification for rx requests then it should specify 36 * If the client sends notification for rx requests then it should specify
@@ -47,6 +65,7 @@
47#define _XEN_NETTXF_extra_info (3) 65#define _XEN_NETTXF_extra_info (3)
48#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info) 66#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info)
49 67
68#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
50struct xen_netif_tx_request { 69struct xen_netif_tx_request {
51 grant_ref_t gref; /* Reference to buffer page */ 70 grant_ref_t gref; /* Reference to buffer page */
52 uint16_t offset; /* Offset within buffer page */ 71 uint16_t offset; /* Offset within buffer page */
diff --git a/include/xen/tmem.h b/include/xen/tmem.h
index 591550a22ac7..3930a90045ff 100644
--- a/include/xen/tmem.h
+++ b/include/xen/tmem.h
@@ -3,7 +3,15 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef CONFIG_XEN_TMEM_MODULE
7#define tmem_enabled true
8#else
6/* defined in drivers/xen/tmem.c */ 9/* defined in drivers/xen/tmem.c */
7extern bool tmem_enabled; 10extern bool tmem_enabled;
11#endif
12
13#ifdef CONFIG_XEN_SELFBALLOONING
14extern int xen_selfballoon_init(bool, bool);
15#endif
8 16
9#endif /* _XEN_TMEM_H */ 17#endif /* _XEN_TMEM_H */