aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h18
-rw-r--r--include/acpi/acnames.h1
-rw-r--r--include/acpi/acpi_bus.h42
-rw-r--r--include/acpi/acpiosxf.h31
-rw-r--r--include/acpi/acpixf.h54
-rw-r--r--include/acpi/actbl.h12
-rw-r--r--include/acpi/actbl1.h58
-rw-r--r--include/acpi/actbl2.h14
-rw-r--r--include/acpi/actbl3.h118
-rw-r--r--include/acpi/actypes.h19
-rw-r--r--include/acpi/apei.h4
-rw-r--r--include/acpi/ghes.h2
-rw-r--r--include/acpi/platform/acenv.h53
-rw-r--r--include/acpi/platform/aclinux.h12
-rw-r--r--include/acpi/platform/aclinuxex.h22
-rw-r--r--include/asm-generic/gpio.h3
-rw-r--r--include/asm-generic/io-64-nonatomic-hi-lo.h14
-rw-r--r--include/asm-generic/io-64-nonatomic-lo-hi.h14
-rw-r--r--include/asm-generic/pci-dma-compat.h8
-rw-r--r--include/asm-generic/percpu.h410
-rw-r--r--include/asm-generic/vmlinux.lds.h3
-rw-r--r--include/clocksource/pxa.h18
-rw-r--r--include/crypto/aead.h4
-rw-r--r--include/crypto/algapi.h6
-rw-r--r--include/crypto/des.h3
-rw-r--r--include/crypto/drbg.h290
-rw-r--r--include/crypto/hash.h4
-rw-r--r--include/crypto/internal/skcipher.h3
-rw-r--r--include/crypto/pkcs7.h36
-rw-r--r--include/crypto/public_key.h4
-rw-r--r--include/crypto/scatterwalk.h6
-rw-r--r--include/crypto/skcipher.h4
-rw-r--r--include/drm/drmP.h92
-rw-r--r--include/drm/drm_crtc.h36
-rw-r--r--include/drm/drm_dp_mst_helper.h509
-rw-r--r--include/drm/drm_fb_helper.h8
-rw-r--r--include/drm/drm_mipi_dsi.h21
-rw-r--r--include/drm/drm_of.h18
-rw-r--r--include/drm/drm_panel.h58
-rw-r--r--include/drm/drm_rect.h6
-rw-r--r--include/drm/ttm/ttm_bo_driver.h16
-rw-r--r--include/dt-bindings/clock/clps711x-clock.h27
-rw-r--r--include/dt-bindings/clock/exynos4.h25
-rw-r--r--include/dt-bindings/clock/exynos5250.h2
-rw-r--r--include/dt-bindings/clock/exynos5420.h2
-rw-r--r--include/dt-bindings/clock/exynos5440.h2
-rw-r--r--include/dt-bindings/clock/imx1-clock.h40
-rw-r--r--include/dt-bindings/clock/imx21-clock.h80
-rw-r--r--include/dt-bindings/clock/imx27-clock.h108
-rw-r--r--include/dt-bindings/clock/imx6qdl-clock.h224
-rw-r--r--include/dt-bindings/clock/qcom,gcc-apq8084.h351
-rw-r--r--include/dt-bindings/clock/qcom,gcc-ipq806x.h293
-rw-r--r--include/dt-bindings/clock/qcom,gcc-msm8960.h11
-rw-r--r--include/dt-bindings/clock/qcom,mmcc-apq8084.h183
-rw-r--r--include/dt-bindings/clock/qcom,mmcc-msm8960.h8
-rw-r--r--include/dt-bindings/clock/r8a7790-clock.h27
-rw-r--r--include/dt-bindings/clock/r8a7791-clock.h27
-rw-r--r--include/dt-bindings/clock/rk3066a-cru.h35
-rw-r--r--include/dt-bindings/clock/rk3188-cru-common.h249
-rw-r--r--include/dt-bindings/clock/rk3188-cru.h51
-rw-r--r--include/dt-bindings/clock/rk3288-cru.h278
-rw-r--r--include/dt-bindings/clock/s5pv210-audss.h34
-rw-r--r--include/dt-bindings/clock/s5pv210.h239
-rw-r--r--include/dt-bindings/clock/vf610-clock.h4
-rw-r--r--include/dt-bindings/dma/nbpfaxi.h20
-rw-r--r--include/dt-bindings/mfd/as3722.h2
-rw-r--r--include/dt-bindings/mfd/palmas.h18
-rw-r--r--include/dt-bindings/phy/phy-miphy365x.h14
-rw-r--r--include/dt-bindings/pinctrl/dra.h7
-rw-r--r--include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h7
-rw-r--r--include/dt-bindings/reset/qcom,gcc-apq8084.h109
-rw-r--r--include/dt-bindings/reset/qcom,gcc-ipq806x.h132
-rw-r--r--include/dt-bindings/reset/qcom,gcc-msm8960.h16
-rw-r--r--include/dt-bindings/reset/qcom,mmcc-apq8084.h64
-rw-r--r--include/dt-bindings/reset/qcom,mmcc-msm8960.h8
-rw-r--r--include/keys/big_key-type.h3
-rw-r--r--include/keys/system_keyring.h10
-rw-r--r--include/keys/user-type.h3
-rw-r--r--include/kvm/arm_arch_timer.h14
-rw-r--r--include/kvm/arm_vgic.h115
-rw-r--r--include/linux/acct.h4
-rw-r--r--include/linux/acpi.h17
-rw-r--r--include/linux/aer.h2
-rw-r--r--include/linux/ahci_platform.h5
-rw-r--r--include/linux/amd-iommu.h7
-rw-r--r--include/linux/arcdevice.h10
-rw-r--r--include/linux/atmel-pwm-bl.h43
-rw-r--r--include/linux/atmel-ssc.h13
-rw-r--r--include/linux/atmel_pwm.h70
-rw-r--r--include/linux/bcma/bcma.h27
-rw-r--r--include/linux/bcma/bcma_driver_pcie2.h158
-rw-r--r--include/linux/bio.h1
-rw-r--r--include/linux/bitmap.h62
-rw-r--r--include/linux/blkdev.h4
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/capability.h5
-rw-r--r--include/linux/ceph/messenger.h14
-rw-r--r--include/linux/ceph/osd_client.h18
-rw-r--r--include/linux/cgroup.h165
-rw-r--r--include/linux/clk-provider.h5
-rw-r--r--include/linux/clk/clk-conf.h20
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cma.h27
-rw-r--r--include/linux/component.h7
-rw-r--r--include/linux/cper.h32
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/crc32.h20
-rw-r--r--include/linux/cred.h9
-rw-r--r--include/linux/crypto.h8
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/decompress/bunzip2.h8
-rw-r--r--include/linux/decompress/generic.h10
-rw-r--r--include/linux/decompress/inflate.h8
-rw-r--r--include/linux/decompress/unlz4.h8
-rw-r--r--include/linux/decompress/unlzma.h8
-rw-r--r--include/linux/decompress/unlzo.h8
-rw-r--r--include/linux/decompress/unxz.h8
-rw-r--r--include/linux/device.h8
-rw-r--r--include/linux/dma-buf.h21
-rw-r--r--include/linux/dma-contiguous.h11
-rw-r--r--include/linux/dmaengine.h6
-rw-r--r--include/linux/dmar.h50
-rw-r--r--include/linux/drbd.h4
-rw-r--r--include/linux/drbd_genl.h4
-rw-r--r--include/linux/drbd_limits.h6
-rw-r--r--include/linux/edac.h5
-rw-r--r--include/linux/efi.h82
-rw-r--r--include/linux/extcon/sm5502.h287
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fence.h360
-rw-r--r--include/linux/filter.h112
-rw-r--r--include/linux/firmware.h15
-rw-r--r--include/linux/fs.h35
-rw-r--r--include/linux/fs_pin.h17
-rw-r--r--include/linux/fsnotify_backend.h14
-rw-r--r--include/linux/ftrace.h68
-rw-r--r--include/linux/ftrace_event.h37
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/glob.h9
-rw-r--r--include/linux/gpio/consumer.h81
-rw-r--r--include/linux/gpio/driver.h66
-rw-r--r--include/linux/gpio/machine.h61
-rw-r--r--include/linux/hid.h6
-rw-r--r--include/linux/highmem.h2
-rw-r--r--include/linux/host1x.h15
-rw-r--r--include/linux/hrtimer.h16
-rw-r--r--include/linux/huge_mm.h4
-rw-r--r--include/linux/hugetlb.h2
-rw-r--r--include/linux/hw_random.h5
-rw-r--r--include/linux/i2c.h12
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h3
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/ieee80211.h23
-rw-r--r--include/linux/if_bridge.h20
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/iio/accel/kxcjk_1013.h (renamed from include/linux/tegra-soc.h)16
-rw-r--r--include/linux/iio/common/st_sensors.h12
-rw-r--r--include/linux/iio/common/st_sensors_i2c.h11
-rw-r--r--include/linux/iio/iio.h9
-rw-r--r--include/linux/iio/imu/adis.h33
-rw-r--r--include/linux/iio/trigger.h5
-rw-r--r--include/linux/iio/types.h5
-rw-r--r--include/linux/ima.h6
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/input/mt.h1
-rw-r--r--include/linux/input/pixcir_ts.h12
-rw-r--r--include/linux/intel-iommu.h3
-rw-r--r--include/linux/io.h2
-rw-r--r--include/linux/iommu.h32
-rw-r--r--include/linux/ioport.h6
-rw-r--r--include/linux/iova.h5
-rw-r--r--include/linux/ipv6.h24
-rw-r--r--include/linux/irq.h2
-rw-r--r--include/linux/irq_work.h5
-rw-r--r--include/linux/irqchip/arm-gic-v3.h200
-rw-r--r--include/linux/irqchip/spear-shirq.h64
-rw-r--r--include/linux/irqdomain.h2
-rw-r--r--include/linux/isdn_ppp.h4
-rw-r--r--include/linux/kernel.h10
-rw-r--r--include/linux/kexec.h104
-rw-r--r--include/linux/key-type.h5
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kthread.h13
-rw-r--r--include/linux/ktime.h228
-rw-r--r--include/linux/kvm_host.h47
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/memblock.h4
-rw-r--r--include/linux/memcontrol.h98
-rw-r--r--include/linux/memory_hotplug.h10
-rw-r--r--include/linux/mfd/abx500/ab8500.h1
-rw-r--r--include/linux/mfd/arizona/core.h41
-rw-r--r--include/linux/mfd/arizona/pdata.h3
-rw-r--r--include/linux/mfd/arizona/registers.h785
-rw-r--r--include/linux/mfd/cros_ec.h110
-rw-r--r--include/linux/mfd/da9063/core.h3
-rw-r--r--include/linux/mfd/da9063/registers.h129
-rw-r--r--include/linux/mfd/intel_soc_pmic.h30
-rw-r--r--include/linux/mfd/max77686-private.h239
-rw-r--r--include/linux/mfd/max77686.h59
-rw-r--r--include/linux/mfd/max77693-private.h54
-rw-r--r--include/linux/mfd/mc13783.h1
-rw-r--r--include/linux/mfd/mc13xxx.h23
-rw-r--r--include/linux/mfd/palmas.h837
-rw-r--r--include/linux/mfd/rtsx_pci.h6
-rw-r--r--include/linux/mfd/samsung/core.h1
-rw-r--r--include/linux/mfd/samsung/irq.h24
-rw-r--r--include/linux/mfd/samsung/s2mpu02.h201
-rw-r--r--include/linux/mfd/tps65910.h2
-rw-r--r--include/linux/mic_bus.h110
-rw-r--r--include/linux/mlx4/cmd.h7
-rw-r--r--include/linux/mlx4/device.h35
-rw-r--r--include/linux/mlx5/device.h4
-rw-r--r--include/linux/mlx5/driver.h31
-rw-r--r--include/linux/mm.h17
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/dw_mmc.h2
-rw-r--r--include/linux/mmc/sdhci.h3
-rw-r--r--include/linux/mmdebug.h2
-rw-r--r--include/linux/mmu_notifier.h6
-rw-r--r--include/linux/mmzone.h219
-rw-r--r--include/linux/module.h11
-rw-r--r--include/linux/moduleloader.h6
-rw-r--r--include/linux/mount.h13
-rw-r--r--include/linux/msi.h3
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/mtd/nand.h53
-rw-r--r--include/linux/mtd/spi-nor.h4
-rw-r--r--include/linux/mutex.h8
-rw-r--r--include/linux/mvebu-pmsu.h20
-rw-r--r--include/linux/netdev_features.h8
-rw-r--r--include/linux/netdevice.h421
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_page.h19
-rw-r--r--include/linux/nfs_xdr.h34
-rw-r--r--include/linux/nmi.h4
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nsproxy.h16
-rw-r--r--include/linux/of.h87
-rw-r--r--include/linux/of_address.h11
-rw-r--r--include/linux/of_dma.h4
-rw-r--r--include/linux/of_fdt.h3
-rw-r--r--include/linux/of_platform.h7
-rw-r--r--include/linux/of_reserved_mem.h7
-rw-r--r--include/linux/oid_registry.h8
-rw-r--r--include/linux/omap-dma.h1
-rw-r--r--include/linux/omap-iommu.h37
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/osq_lock.h27
-rw-r--r--include/linux/page-flags.h21
-rw-r--r--include/linux/page_cgroup.h70
-rw-r--r--include/linux/pagemap.h15
-rw-r--r--include/linux/pci-acpi.h13
-rw-r--r--include/linux/pci.h16
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/pe.h448
-rw-r--r--include/linux/percpu-defs.h380
-rw-r--r--include/linux/percpu-refcount.h64
-rw-r--r--include/linux/percpu.h673
-rw-r--r--include/linux/phy.h18
-rw-r--r--include/linux/phy/omap_control_phy.h10
-rw-r--r--include/linux/phy/phy.h17
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/pinmux.h2
-rw-r--r--include/linux/platform_data/ad7291.h12
-rw-r--r--include/linux/platform_data/asoc-s3c.h9
-rw-r--r--include/linux/platform_data/ata-samsung_cf.h1
-rw-r--r--include/linux/platform_data/camera-mx1.h35
-rw-r--r--include/linux/platform_data/dma-imx.h2
-rw-r--r--include/linux/platform_data/dsp-omap.h34
-rw-r--r--include/linux/platform_data/edma.h2
-rw-r--r--include/linux/platform_data/iommu-omap.h6
-rw-r--r--include/linux/platform_data/mmc-omap.h1
-rw-r--r--include/linux/platform_data/ntc_thermistor.h1
-rw-r--r--include/linux/platform_data/st21nfcb.h32
-rw-r--r--include/linux/platform_data/usb-ehci-mxc.h46
-rw-r--r--include/linux/platform_data/usb-imx_udc.h23
-rw-r--r--include/linux/platform_data/video-clcd-versatile.h27
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm_runtime.h11
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/printk.h5
-rw-r--r--include/linux/ptp_classify.h5
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/ras.h14
-rw-r--r--include/linux/rculist.h8
-rw-r--r--include/linux/rcupdate.h91
-rw-r--r--include/linux/regmap.h7
-rw-r--r--include/linux/regulator/ab8500.h14
-rw-r--r--include/linux/regulator/act8865.h23
-rw-r--r--include/linux/regulator/consumer.h26
-rw-r--r--include/linux/regulator/da9211.h32
-rw-r--r--include/linux/reservation.h82
-rw-r--r--include/linux/rhashtable.h208
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rndis.h1
-rw-r--r--include/linux/rtmutex.h6
-rw-r--r--include/linux/rtnetlink.h1
-rw-r--r--include/linux/rwsem-spinlock.h8
-rw-r--r--include/linux/rwsem.h34
-rw-r--r--include/linux/scatterlist.h2
-rw-r--r--include/linux/sched.h62
-rw-r--r--include/linux/seccomp.h8
-rw-r--r--include/linux/security.h17
-rw-r--r--include/linux/seqlock.h29
-rw-r--r--include/linux/seqno-fence.h116
-rw-r--r--include/linux/serial_8250.h7
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/sfi_acpi.h3
-rw-r--r--include/linux/sh_dma.h24
-rw-r--r--include/linux/sh_timer.h5
-rw-r--r--include/linux/shm.h18
-rw-r--r--include/linux/shmem_fs.h17
-rw-r--r--include/linux/signal.h15
-rw-r--r--include/linux/skbuff.h45
-rw-r--r--include/linux/spi/cc2520.h26
-rw-r--r--include/linux/spi/sh_msiof.h2
-rw-r--r--include/linux/ssb/ssb_regs.h37
-rw-r--r--include/linux/stmmac.h2
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/auth_gss.h3
-rw-r--r--include/linux/sunrpc/gss_krb5.h4
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/svc.h4
-rw-r--r--include/linux/sunrpc/svc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h2
-rw-r--r--include/linux/sunrpc/xprtrdma.h2
-rw-r--r--include/linux/swap.h16
-rw-r--r--include/linux/syscalls.h10
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/tcp.h3
-rw-r--r--include/linux/thermal.h46
-rw-r--r--include/linux/tick.h29
-rw-r--r--include/linux/time.h65
-rw-r--r--include/linux/time64.h190
-rw-r--r--include/linux/timekeeper_internal.h150
-rw-r--r--include/linux/timekeeping.h209
-rw-r--r--include/linux/timerfd.h5
-rw-r--r--include/linux/tpm.h3
-rw-r--r--include/linux/trace_seq.h36
-rw-r--r--include/linux/tracehook.h8
-rw-r--r--include/linux/tracepoint.h44
-rw-r--r--include/linux/tty.h4
-rw-r--r--include/linux/tty_driver.h8
-rw-r--r--include/linux/uio.h2
-rw-r--r--include/linux/usb/composite.h15
-rw-r--r--include/linux/usb/quirks.h11
-rw-r--r--include/linux/usb/renesas_usbhs.h6
-rw-r--r--include/linux/usb/usb338x.h199
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/usb/xhci_pdriver.h27
-rw-r--r--include/linux/user_namespace.h6
-rw-r--r--include/linux/verify_pefile.h18
-rw-r--r--include/linux/vfio.h23
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--include/linux/wait.h125
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/zbud.h2
-rw-r--r--include/linux/zlib.h122
-rw-r--r--include/linux/zpool.h106
-rw-r--r--include/media/atmel-isi.h4
-rw-r--r--include/media/blackfin/ppi.h4
-rw-r--r--include/media/ir-kbd-i2c.h6
-rw-r--r--include/media/rc-core.h71
-rw-r--r--include/media/rc-map.h16
-rw-r--r--include/media/v4l2-ctrls.h222
-rw-r--r--include/media/v4l2-dev.h2
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-mem2mem.h2
-rw-r--r--include/media/videobuf-dma-sg.h3
-rw-r--r--include/media/videobuf2-core.h19
-rw-r--r--include/net/6lowpan.h50
-rw-r--r--include/net/bluetooth/bluetooth.h18
-rw-r--r--include/net/bluetooth/hci.h297
-rw-r--r--include/net/bluetooth/hci_core.h187
-rw-r--r--include/net/bluetooth/hci_sock.h175
-rw-r--r--include/net/bluetooth/l2cap.h46
-rw-r--r--include/net/bluetooth/mgmt.h103
-rw-r--r--include/net/bluetooth/sco.h30
-rw-r--r--include/net/cfg80211.h38
-rw-r--r--include/net/dcbnl.h4
-rw-r--r--include/net/flow_keys.h15
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet_connection_sock.h1
-rw-r--r--include/net/inet_frag.h118
-rw-r--r--include/net/inet_sock.h6
-rw-r--r--include/net/inet_timewait_sock.h3
-rw-r--r--include/net/ip.h32
-rw-r--r--include/net/ip_tunnels.h1
-rw-r--r--include/net/ipv6.h71
-rw-r--r--include/net/mac80211.h105
-rw-r--r--include/net/mac802154.h19
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h26
-rw-r--r--include/net/netfilter/nf_log.h42
-rw-r--r--include/net/netfilter/nf_tables.h6
-rw-r--r--include/net/netfilter/xt_log.h54
-rw-r--r--include/net/netlabel.h94
-rw-r--r--include/net/netlink.h6
-rw-r--r--include/net/netns/conntrack.h6
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/netns/nftables.h2
-rw-r--r--include/net/netns/x_tables.h6
-rw-r--r--include/net/nfc/digital.h13
-rw-r--r--include/net/nfc/hci.h1
-rw-r--r--include/net/rtnetlink.h1
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--include/net/sctp/command.h39
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/sctp.h24
-rw-r--r--include/net/sctp/structs.h15
-rw-r--r--include/net/sctp/ulpevent.h14
-rw-r--r--include/net/sock.h77
-rw-r--r--include/net/tcp.h70
-rw-r--r--include/net/udp.h29
-rw-r--r--include/net/udp_tunnel.h32
-rw-r--r--include/net/vxlan.h2
-rw-r--r--include/ras/ras_event.h128
-rw-r--r--include/rdma/ib_mad.h18
-rw-r--r--include/rdma/ib_verbs.h10
-rw-r--r--include/scsi/scsi.h2
-rw-r--r--include/scsi/sg.h4
-rw-r--r--include/soc/tegra/ahb.h (renamed from include/linux/tegra-ahb.h)6
-rw-r--r--include/soc/tegra/common.h14
-rw-r--r--include/soc/tegra/cpuidle.h (renamed from include/linux/tegra-cpuidle.h)6
-rw-r--r--include/soc/tegra/fuse.h65
-rw-r--r--include/soc/tegra/pm.h38
-rw-r--r--include/soc/tegra/pmc.h (renamed from include/linux/tegra-powergate.h)31
-rw-r--r--include/sound/control.h7
-rw-r--r--include/sound/pcm.h11
-rw-r--r--include/sound/rcar_snd.h1
-rw-r--r--include/sound/rt286.h19
-rw-r--r--include/sound/rt5670.h27
-rw-r--r--include/sound/soc-dai.h5
-rw-r--r--include/sound/soc-dapm.h8
-rw-r--r--include/sound/soc.h94
-rw-r--r--include/sound/tas2552-plat.h25
-rw-r--r--include/sound/wm8962.h1
-rw-r--r--include/trace/events/asoc.h6
-rw-r--r--include/trace/events/bcache.h21
-rw-r--r--include/trace/events/f2fs.h87
-rw-r--r--include/trace/events/fence.h128
-rw-r--r--include/trace/events/ipi.h89
-rw-r--r--include/trace/events/kvm.h8
-rw-r--r--include/trace/events/migrate.h1
-rw-r--r--include/trace/events/pagemap.h16
-rw-r--r--include/trace/events/ras.h77
-rw-r--r--include/trace/events/thp.h88
-rw-r--r--include/trace/events/tlb.h40
-rw-r--r--include/uapi/asm-generic/unistd.h6
-rw-r--r--include/uapi/drm/drm.h2
-rw-r--r--include/uapi/drm/drm_mode.h5
-rw-r--r--include/uapi/drm/nouveau_drm.h11
-rw-r--r--include/uapi/drm/radeon_drm.h4
-rw-r--r--include/uapi/drm/tegra_drm.h46
-rw-r--r--include/uapi/linux/audit.h1
-rw-r--r--include/uapi/linux/bsg.h11
-rw-r--r--include/uapi/linux/can/netlink.h3
-rw-r--r--include/uapi/linux/dcbnl.h3
-rw-r--r--include/uapi/linux/errqueue.h20
-rw-r--r--include/uapi/linux/fcntl.h15
-rw-r--r--include/uapi/linux/fuse.h3
-rw-r--r--include/uapi/linux/genwqe/genwqe_card.h1
-rw-r--r--include/uapi/linux/i8k.h3
-rw-r--r--include/uapi/linux/if_link.h6
-rw-r--r--include/uapi/linux/if_packet.h2
-rw-r--r--include/uapi/linux/in6.h1
-rw-r--r--include/uapi/linux/ipv6.h1
-rw-r--r--include/uapi/linux/kexec.h11
-rw-r--r--include/uapi/linux/kvm.h13
-rw-r--r--include/uapi/linux/memfd.h8
-rw-r--r--include/uapi/linux/net_tstamp.h10
-rw-r--r--include/uapi/linux/netdevice.h6
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h4
-rw-r--r--include/uapi/linux/netfilter/xt_bpf.h4
-rw-r--r--include/uapi/linux/netfilter_bridge/Kbuild1
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_ulog.h38
-rw-r--r--include/uapi/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ULOG.h49
-rw-r--r--include/uapi/linux/nl80211.h5
-rw-r--r--include/uapi/linux/openvswitch.h13
-rw-r--r--include/uapi/linux/random.h9
-rw-r--r--include/uapi/linux/sctp.h102
-rw-r--r--include/uapi/linux/seccomp.h7
-rw-r--r--include/uapi/linux/serial_reg.h5
-rw-r--r--include/uapi/linux/serio.h1
-rw-r--r--include/uapi/linux/sysctl.h1
-rw-r--r--include/uapi/linux/tipc_config.h2
-rw-r--r--include/uapi/linux/uinput.h9
-rw-r--r--include/uapi/linux/usb/functionfs.h82
-rw-r--r--include/uapi/linux/v4l2-controls.h32
-rw-r--r--include/uapi/linux/vfio.h34
-rw-r--r--include/uapi/linux/videodev2.h101
-rw-r--r--include/uapi/linux/virtio_blk.h5
-rw-r--r--include/uapi/rdma/ib_user_mad.h42
-rw-r--r--include/uapi/rdma/ib_user_verbs.h16
-rw-r--r--include/uapi/rdma/rdma_user_cm.h1
-rw-r--r--include/uapi/sound/asound.h9
-rw-r--r--include/video/omapdss.h9
-rw-r--r--include/video/samsung_fimd.h5
-rw-r--r--include/xen/grant_table.h29
-rw-r--r--include/xen/interface/platform.h123
-rw-r--r--include/xen/xen-ops.h11
505 files changed, 16330 insertions, 4498 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 932a60d6ed82..5a0a3e5daf85 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -219,6 +219,24 @@
219 219
220/****************************************************************************** 220/******************************************************************************
221 * 221 *
222 * Miscellaneous constants
223 *
224 *****************************************************************************/
225
226/* UUID constants */
227
228#define UUID_BUFFER_LENGTH 16 /* Length of UUID in memory */
229#define UUID_STRING_LENGTH 36 /* Total length of a UUID string */
230
231/* Positions for required hyphens (dashes) in UUID strings */
232
233#define UUID_HYPHEN1_OFFSET 8
234#define UUID_HYPHEN2_OFFSET 13
235#define UUID_HYPHEN3_OFFSET 18
236#define UUID_HYPHEN4_OFFSET 23
237
238/******************************************************************************
239 *
222 * ACPI AML Debugger 240 * ACPI AML Debugger
223 * 241 *
224 *****************************************************************************/ 242 *****************************************************************************/
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 3dd6e838dc30..c728113374f5 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -55,6 +55,7 @@
55#define METHOD_NAME__HID "_HID" 55#define METHOD_NAME__HID "_HID"
56#define METHOD_NAME__INI "_INI" 56#define METHOD_NAME__INI "_INI"
57#define METHOD_NAME__PLD "_PLD" 57#define METHOD_NAME__PLD "_PLD"
58#define METHOD_NAME__DSD "_DSD"
58#define METHOD_NAME__PRS "_PRS" 59#define METHOD_NAME__PRS "_PRS"
59#define METHOD_NAME__PRT "_PRT" 60#define METHOD_NAME__PRT "_PRT"
60#define METHOD_NAME__PRW "_PRW" 61#define METHOD_NAME__PRW "_PRW"
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index b5714580801a..bcfd808b1098 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -315,12 +315,19 @@ struct acpi_device_wakeup_flags {
315 u8 notifier_present:1; /* Wake-up notify handler has been installed */ 315 u8 notifier_present:1; /* Wake-up notify handler has been installed */
316}; 316};
317 317
318struct acpi_device_wakeup_context {
319 struct work_struct work;
320 struct device *dev;
321};
322
318struct acpi_device_wakeup { 323struct acpi_device_wakeup {
319 acpi_handle gpe_device; 324 acpi_handle gpe_device;
320 u64 gpe_number; 325 u64 gpe_number;
321 u64 sleep_state; 326 u64 sleep_state;
322 struct list_head resources; 327 struct list_head resources;
323 struct acpi_device_wakeup_flags flags; 328 struct acpi_device_wakeup_flags flags;
329 struct acpi_device_wakeup_context context;
330 struct wakeup_source *ws;
324 int prepare_count; 331 int prepare_count;
325}; 332};
326 333
@@ -372,15 +379,9 @@ static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta)
372} 379}
373 380
374static inline void acpi_set_hp_context(struct acpi_device *adev, 381static inline void acpi_set_hp_context(struct acpi_device *adev,
375 struct acpi_hotplug_context *hp, 382 struct acpi_hotplug_context *hp)
376 int (*notify)(struct acpi_device *, u32),
377 void (*uevent)(struct acpi_device *, u32),
378 void (*fixup)(struct acpi_device *))
379{ 383{
380 hp->self = adev; 384 hp->self = adev;
381 hp->notify = notify;
382 hp->uevent = uevent;
383 hp->fixup = fixup;
384 adev->hp = hp; 385 adev->hp = hp;
385} 386}
386 387
@@ -487,6 +488,8 @@ struct acpi_bus_type {
487}; 488};
488int register_acpi_bus_type(struct acpi_bus_type *); 489int register_acpi_bus_type(struct acpi_bus_type *);
489int unregister_acpi_bus_type(struct acpi_bus_type *); 490int unregister_acpi_bus_type(struct acpi_bus_type *);
491int acpi_bind_one(struct device *dev, struct acpi_device *adev);
492int acpi_unbind_one(struct device *dev);
490 493
491struct acpi_pci_root { 494struct acpi_pci_root {
492 struct acpi_device * device; 495 struct acpi_device * device;
@@ -510,20 +513,18 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
510int acpi_disable_wakeup_device_power(struct acpi_device *dev); 513int acpi_disable_wakeup_device_power(struct acpi_device *dev);
511 514
512#ifdef CONFIG_PM 515#ifdef CONFIG_PM
513acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 516acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev,
514 acpi_notify_handler handler, void *context); 517 void (*work_func)(struct work_struct *work));
515acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 518acpi_status acpi_remove_pm_notifier(struct acpi_device *adev);
516 acpi_notify_handler handler);
517int acpi_pm_device_sleep_state(struct device *, int *, int); 519int acpi_pm_device_sleep_state(struct device *, int *, int);
518#else 520#else
519static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 521static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
520 acpi_notify_handler handler, 522 struct device *dev,
521 void *context) 523 void (*work_func)(struct work_struct *work))
522{ 524{
523 return AE_SUPPORT; 525 return AE_SUPPORT;
524} 526}
525static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 527static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev)
526 acpi_notify_handler handler)
527{ 528{
528 return AE_SUPPORT; 529 return AE_SUPPORT;
529} 530}
@@ -538,13 +539,8 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
538#endif 539#endif
539 540
540#ifdef CONFIG_PM_RUNTIME 541#ifdef CONFIG_PM_RUNTIME
541int __acpi_device_run_wake(struct acpi_device *, bool);
542int acpi_pm_device_run_wake(struct device *, bool); 542int acpi_pm_device_run_wake(struct device *, bool);
543#else 543#else
544static inline int __acpi_device_run_wake(struct acpi_device *adev, bool en)
545{
546 return -ENODEV;
547}
548static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) 544static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
549{ 545{
550 return -ENODEV; 546 return -ENODEV;
@@ -552,14 +548,8 @@ static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
552#endif 548#endif
553 549
554#ifdef CONFIG_PM_SLEEP 550#ifdef CONFIG_PM_SLEEP
555int __acpi_device_sleep_wake(struct acpi_device *, u32, bool);
556int acpi_pm_device_sleep_wake(struct device *, bool); 551int acpi_pm_device_sleep_wake(struct device *, bool);
557#else 552#else
558static inline int __acpi_device_sleep_wake(struct acpi_device *adev,
559 u32 target_state, bool enable)
560{
561 return -ENODEV;
562}
563static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) 553static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
564{ 554{
565 return -ENODEV; 555 return -ENODEV;
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index f6f5f8af2112..03b3e6d405ff 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -399,4 +399,35 @@ char *acpi_os_get_next_filename(void *dir_handle);
399void acpi_os_close_directory(void *dir_handle); 399void acpi_os_close_directory(void *dir_handle);
400#endif 400#endif
401 401
402/*
403 * File I/O and related support
404 */
405#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_file
406ACPI_FILE acpi_os_open_file(const char *path, u8 modes);
407#endif
408
409#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_file
410void acpi_os_close_file(ACPI_FILE file);
411#endif
412
413#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_file
414int
415acpi_os_read_file(ACPI_FILE file,
416 void *buffer, acpi_size size, acpi_size count);
417#endif
418
419#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_file
420int
421acpi_os_write_file(ACPI_FILE file,
422 void *buffer, acpi_size size, acpi_size count);
423#endif
424
425#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_file_offset
426long acpi_os_get_file_offset(ACPI_FILE file);
427#endif
428
429#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_set_file_offset
430acpi_status acpi_os_set_file_offset(ACPI_FILE file, long offset, u8 from);
431#endif
432
402#endif /* __ACPIOSXF_H__ */ 433#endif /* __ACPIOSXF_H__ */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 35b525c19711..b7c89d47efbe 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,15 +46,13 @@
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 0x20140424 49#define ACPI_CA_VERSION 0x20140724
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
53#include <acpi/actbl.h> 53#include <acpi/actbl.h>
54#include <acpi/acbuffer.h> 54#include <acpi/acbuffer.h>
55 55
56extern u8 acpi_gbl_permanent_mmap;
57
58/***************************************************************************** 56/*****************************************************************************
59 * 57 *
60 * Macros used for ACPICA globals and configuration 58 * Macros used for ACPICA globals and configuration
@@ -335,6 +333,23 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running);
335 333
336#endif /* ACPI_DEBUG_OUTPUT */ 334#endif /* ACPI_DEBUG_OUTPUT */
337 335
336/*
337 * Application prototypes
338 *
339 * All interfaces used by application will be configured
340 * out of the ACPICA build unless the ACPI_APPLICATION
341 * flag is defined.
342 */
343#ifdef ACPI_APPLICATION
344#define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \
345 prototype;
346
347#else
348#define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \
349 static ACPI_INLINE prototype {return;}
350
351#endif /* ACPI_APPLICATION */
352
338/***************************************************************************** 353/*****************************************************************************
339 * 354 *
340 * ACPICA public interface prototypes 355 * ACPICA public interface prototypes
@@ -658,6 +673,10 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
658 u32 gpe_number)) 673 u32 gpe_number))
659 674
660ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 675ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
676 acpi_mark_gpe_for_wake(acpi_handle gpe_device,
677 u32 gpe_number))
678
679ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
661 acpi_setup_gpe_for_wake(acpi_handle 680 acpi_setup_gpe_for_wake(acpi_handle
662 parent_device, 681 parent_device,
663 acpi_handle gpe_device, 682 acpi_handle gpe_device,
@@ -861,21 +880,32 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
861 const char *module_name, 880 const char *module_name,
862 u32 component_id, 881 u32 component_id,
863 const char *format, ...)) 882 const char *format, ...))
883ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
884 void ACPI_INTERNAL_VAR_XFACE
885 acpi_log_error(const char *format, ...))
864 886
865/* 887/*
866 * Divergences 888 * Divergences
867 */ 889 */
868acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); 890ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap);
869 891
870acpi_status acpi_unload_table_id(acpi_owner_id id); 892ACPI_EXTERNAL_RETURN_STATUS(acpi_status
893 acpi_get_id(acpi_handle object,
894 acpi_owner_id * out_type))
871 895
872acpi_status 896ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_unload_table_id(acpi_owner_id id))
873acpi_get_table_with_size(acpi_string signature,
874 u32 instance, struct acpi_table_header **out_table,
875 acpi_size *tbl_size);
876 897
877acpi_status 898ACPI_EXTERNAL_RETURN_STATUS(acpi_status
878acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, 899 acpi_get_table_with_size(acpi_string signature,
879 void (*callback)(void *)); 900 u32 instance,
901 struct acpi_table_header
902 **out_table,
903 acpi_size *tbl_size))
904
905ACPI_EXTERNAL_RETURN_STATUS(acpi_status
906 acpi_get_data_full(acpi_handle object,
907 acpi_object_handler handler,
908 void **data,
909 void (*callback)(void *)))
880 910
881#endif /* __ACXFACE_H__ */ 911#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 1cc7ef13c01a..bee19d8170c5 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -270,7 +270,8 @@ struct acpi_table_fadt {
270 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */ 270 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */
271 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */ 271 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */
272 u8 reset_value; /* Value to write to the reset_register port to reset the system */ 272 u8 reset_value; /* Value to write to the reset_register port to reset the system */
273 u8 reserved4[3]; /* Reserved, must be zero */ 273 u16 arm_boot_flags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */
274 u8 minor_revision; /* FADT Minor Revision (ACPI 5.1) */
274 u64 Xfacs; /* 64-bit physical address of FACS */ 275 u64 Xfacs; /* 64-bit physical address of FACS */
275 u64 Xdsdt; /* 64-bit physical address of DSDT */ 276 u64 Xdsdt; /* 64-bit physical address of DSDT */
276 struct acpi_generic_address xpm1a_event_block; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ 277 struct acpi_generic_address xpm1a_event_block; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
@@ -285,7 +286,7 @@ struct acpi_table_fadt {
285 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */ 286 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */
286}; 287};
287 288
288/* Masks for FADT Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ 289/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */
289 290
290#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ 291#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
291#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ 292#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
@@ -296,6 +297,11 @@ struct acpi_table_fadt {
296 297
297#define FADT2_REVISION_ID 3 298#define FADT2_REVISION_ID 3
298 299
300/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */
301
302#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */
303#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */
304
299/* Masks for FADT flags */ 305/* Masks for FADT flags */
300 306
301#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ 307#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */
@@ -399,7 +405,7 @@ struct acpi_table_desc {
399 * FADT V5 size: 0x10C 405 * FADT V5 size: 0x10C
400 */ 406 */
401#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4) 407#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
402#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3) 408#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (minor_revision) + 1)
403#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control)) 409#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control))
404#define ACPI_FADT_V5_SIZE (u32) (sizeof (struct acpi_table_fadt)) 410#define ACPI_FADT_V5_SIZE (u32) (sizeof (struct acpi_table_fadt))
405 411
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 4ad7da805180..7626bfeac2cb 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -604,7 +604,7 @@ struct acpi_hest_generic {
604 604
605/* Generic Error Status block */ 605/* Generic Error Status block */
606 606
607struct acpi_generic_status { 607struct acpi_hest_generic_status {
608 u32 block_status; 608 u32 block_status;
609 u32 raw_data_offset; 609 u32 raw_data_offset;
610 u32 raw_data_length; 610 u32 raw_data_length;
@@ -614,15 +614,15 @@ struct acpi_generic_status {
614 614
615/* Values for block_status flags above */ 615/* Values for block_status flags above */
616 616
617#define ACPI_GEN_ERR_UC BIT(0) 617#define ACPI_HEST_UNCORRECTABLE (1)
618#define ACPI_GEN_ERR_CE BIT(1) 618#define ACPI_HEST_CORRECTABLE (1<<1)
619#define ACPI_GEN_ERR_MULTI_UC BIT(2) 619#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2)
620#define ACPI_GEN_ERR_MULTI_CE BIT(3) 620#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3)
621#define ACPI_GEN_ERR_COUNT_SHIFT (0xFF<<4) /* 8 bits, error count */ 621#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */
622 622
623/* Generic Error Data entry */ 623/* Generic Error Data entry */
624 624
625struct acpi_generic_data { 625struct acpi_hest_generic_data {
626 u8 section_type[16]; 626 u8 section_type[16];
627 u32 error_severity; 627 u32 error_severity;
628 u16 revision; 628 u16 revision;
@@ -671,7 +671,9 @@ enum acpi_madt_type {
671 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, 671 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
672 ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, 672 ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
673 ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, 673 ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
674 ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */ 674 ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
675 ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
676 ACPI_MADT_TYPE_RESERVED = 15 /* 15 and greater are reserved */
675}; 677};
676 678
677/* 679/*
@@ -797,15 +799,26 @@ struct acpi_madt_local_x2apic_nmi {
797struct acpi_madt_generic_interrupt { 799struct acpi_madt_generic_interrupt {
798 struct acpi_subtable_header header; 800 struct acpi_subtable_header header;
799 u16 reserved; /* reserved - must be zero */ 801 u16 reserved; /* reserved - must be zero */
800 u32 gic_id; 802 u32 cpu_interface_number;
801 u32 uid; 803 u32 uid;
802 u32 flags; 804 u32 flags;
803 u32 parking_version; 805 u32 parking_version;
804 u32 performance_interrupt; 806 u32 performance_interrupt;
805 u64 parked_address; 807 u64 parked_address;
806 u64 base_address; 808 u64 base_address;
809 u64 gicv_base_address;
810 u64 gich_base_address;
811 u32 vgic_interrupt;
812 u64 gicr_base_address;
813 u64 arm_mpidr;
807}; 814};
808 815
816/* Masks for Flags field above */
817
818/* ACPI_MADT_ENABLED (1) Processor is usable if set */
819#define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */
820#define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */
821
809/* 12: Generic Distributor (ACPI 5.0) */ 822/* 12: Generic Distributor (ACPI 5.0) */
810 823
811struct acpi_madt_generic_distributor { 824struct acpi_madt_generic_distributor {
@@ -817,11 +830,36 @@ struct acpi_madt_generic_distributor {
817 u32 reserved2; /* reserved - must be zero */ 830 u32 reserved2; /* reserved - must be zero */
818}; 831};
819 832
833/* 13: Generic MSI Frame (ACPI 5.1) */
834
835struct acpi_madt_generic_msi_frame {
836 struct acpi_subtable_header header;
837 u16 reserved; /* reserved - must be zero */
838 u32 msi_frame_id;
839 u64 base_address;
840 u32 flags;
841 u16 spi_count;
842 u16 spi_base;
843};
844
845/* Masks for Flags field above */
846
847#define ACPI_MADT_OVERRIDE_SPI_VALUES (1)
848
849/* 14: Generic Redistributor (ACPI 5.1) */
850
851struct acpi_madt_generic_redistributor {
852 struct acpi_subtable_header header;
853 u16 reserved; /* reserved - must be zero */
854 u64 base_address;
855 u32 length;
856};
857
820/* 858/*
821 * Common flags fields for MADT subtables 859 * Common flags fields for MADT subtables
822 */ 860 */
823 861
824/* MADT Local APIC flags (lapic_flags) and GIC flags */ 862/* MADT Local APIC flags */
825 863
826#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ 864#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
827 865
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 860e5c883eb3..ecff62405f17 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -396,7 +396,7 @@ struct acpi_table_dbgp {
396 * Version 1 396 * Version 1
397 * 397 *
398 * Conforms to "Intel Virtualization Technology for Directed I/O", 398 * Conforms to "Intel Virtualization Technology for Directed I/O",
399 * Version 1.2, Sept. 2008 399 * Version 2.2, Sept. 2013
400 * 400 *
401 ******************************************************************************/ 401 ******************************************************************************/
402 402
@@ -423,9 +423,9 @@ struct acpi_dmar_header {
423enum acpi_dmar_type { 423enum acpi_dmar_type {
424 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, 424 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
425 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, 425 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
426 ACPI_DMAR_TYPE_ATSR = 2, 426 ACPI_DMAR_TYPE_ROOT_ATS = 2,
427 ACPI_DMAR_HARDWARE_AFFINITY = 3, 427 ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3,
428 ACPI_DMAR_TYPE_ANDD = 4, 428 ACPI_DMAR_TYPE_NAMESPACE = 4,
429 ACPI_DMAR_TYPE_RESERVED = 5 /* 5 and greater are reserved */ 429 ACPI_DMAR_TYPE_RESERVED = 5 /* 5 and greater are reserved */
430}; 430};
431 431
@@ -439,7 +439,7 @@ struct acpi_dmar_device_scope {
439 u8 bus; 439 u8 bus;
440}; 440};
441 441
442/* Values for entry_type in struct acpi_dmar_device_scope */ 442/* Values for entry_type in struct acpi_dmar_device_scope - device types */
443 443
444enum acpi_dmar_scope_type { 444enum acpi_dmar_scope_type {
445 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, 445 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
@@ -447,7 +447,7 @@ enum acpi_dmar_scope_type {
447 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, 447 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
448 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, 448 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3,
449 ACPI_DMAR_SCOPE_TYPE_HPET = 4, 449 ACPI_DMAR_SCOPE_TYPE_HPET = 4,
450 ACPI_DMAR_SCOPE_TYPE_ACPI = 5, 450 ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5,
451 ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ 451 ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */
452}; 452};
453 453
@@ -516,7 +516,7 @@ struct acpi_dmar_andd {
516 struct acpi_dmar_header header; 516 struct acpi_dmar_header header;
517 u8 reserved[3]; 517 u8 reserved[3];
518 u8 device_number; 518 u8 device_number;
519 u8 object_name[]; 519 char device_name[1];
520}; 520};
521 521
522/******************************************************************************* 522/*******************************************************************************
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index c2295cc4a5c0..787bcc814463 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -241,33 +241,96 @@ struct acpi_s3pt_suspend {
241 241
242/******************************************************************************* 242/*******************************************************************************
243 * 243 *
244 * GTDT - Generic Timer Description Table (ACPI 5.0) 244 * GTDT - Generic Timer Description Table (ACPI 5.1)
245 * Version 1 245 * Version 2
246 * 246 *
247 ******************************************************************************/ 247 ******************************************************************************/
248 248
249struct acpi_table_gtdt { 249struct acpi_table_gtdt {
250 struct acpi_table_header header; /* Common ACPI table header */ 250 struct acpi_table_header header; /* Common ACPI table header */
251 u64 address; 251 u64 counter_block_addresss;
252 u32 flags; 252 u32 reserved;
253 u32 secure_pl1_interrupt; 253 u32 secure_el1_interrupt;
254 u32 secure_pl1_flags; 254 u32 secure_el1_flags;
255 u32 non_secure_pl1_interrupt; 255 u32 non_secure_el1_interrupt;
256 u32 non_secure_pl1_flags; 256 u32 non_secure_el1_flags;
257 u32 virtual_timer_interrupt; 257 u32 virtual_timer_interrupt;
258 u32 virtual_timer_flags; 258 u32 virtual_timer_flags;
259 u32 non_secure_pl2_interrupt; 259 u32 non_secure_el2_interrupt;
260 u32 non_secure_pl2_flags; 260 u32 non_secure_el2_flags;
261 u64 counter_read_block_address;
262 u32 platform_timer_count;
263 u32 platform_timer_offset;
261}; 264};
262 265
263/* Values for Flags field above */ 266/* Flag Definitions: Timer Block Physical Timers and Virtual timers */
267
268#define ACPI_GTDT_INTERRUPT_MODE (1)
269#define ACPI_GTDT_INTERRUPT_POLARITY (1<<1)
270#define ACPI_GTDT_ALWAYS_ON (1<<2)
271
272/* Common GTDT subtable header */
273
274struct acpi_gtdt_header {
275 u8 type;
276 u16 length;
277};
264 278
265#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1 279/* Values for GTDT subtable type above */
266 280
267/* Values for all "TimerFlags" fields above */ 281enum acpi_gtdt_type {
282 ACPI_GTDT_TYPE_TIMER_BLOCK = 0,
283 ACPI_GTDT_TYPE_WATCHDOG = 1,
284 ACPI_GTDT_TYPE_RESERVED = 2 /* 2 and greater are reserved */
285};
286
287/* GTDT Subtables, correspond to Type in struct acpi_gtdt_header */
288
289/* 0: Generic Timer Block */
290
291struct acpi_gtdt_timer_block {
292 struct acpi_gtdt_header header;
293 u8 reserved;
294 u64 block_address;
295 u32 timer_count;
296 u32 timer_offset;
297};
298
299/* Timer Sub-Structure, one per timer */
300
301struct acpi_gtdt_timer_entry {
302 u8 frame_number;
303 u8 reserved[3];
304 u64 base_address;
305 u64 el0_base_address;
306 u32 timer_interrupt;
307 u32 timer_flags;
308 u32 virtual_timer_interrupt;
309 u32 virtual_timer_flags;
310 u32 common_flags;
311};
268 312
269#define ACPI_GTDT_INTERRUPT_MODE 1 313/* Flag Definitions: common_flags above */
270#define ACPI_GTDT_INTERRUPT_POLARITY 2 314
315#define ACPI_GTDT_GT_IS_SECURE_TIMER (1)
316#define ACPI_GTDT_GT_ALWAYS_ON (1<<1)
317
318/* 1: SBSA Generic Watchdog Structure */
319
320struct acpi_gtdt_watchdog {
321 struct acpi_gtdt_header header;
322 u8 reserved;
323 u64 refresh_frame_address;
324 u64 control_frame_address;
325 u32 timer_interrupt;
326 u32 timer_flags;
327};
328
329/* Flag Definitions: timer_flags above */
330
331#define ACPI_GTDT_WATCHDOG_IRQ_MODE (1)
332#define ACPI_GTDT_WATCHDOG_IRQ_POLARITY (1<<1)
333#define ACPI_GTDT_WATCHDOG_SECURE (1<<2)
271 334
272/******************************************************************************* 335/*******************************************************************************
273 * 336 *
@@ -385,7 +448,8 @@ struct acpi_table_pcct {
385 448
386enum acpi_pcct_type { 449enum acpi_pcct_type {
387 ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, 450 ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
388 ACPI_PCCT_TYPE_RESERVED = 1 /* 1 and greater are reserved */ 451 ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
452 ACPI_PCCT_TYPE_RESERVED = 2 /* 2 and greater are reserved */
389}; 453};
390 454
391/* 455/*
@@ -407,6 +471,28 @@ struct acpi_pcct_subspace {
407 u16 min_turnaround_time; 471 u16 min_turnaround_time;
408}; 472};
409 473
474/* 1: HW-reduced Communications Subspace (ACPI 5.1) */
475
476struct acpi_pcct_hw_reduced {
477 struct acpi_subtable_header header;
478 u32 doorbell_interrupt;
479 u8 flags;
480 u8 reserved;
481 u64 base_address;
482 u64 length;
483 struct acpi_generic_address doorbell_register;
484 u64 preserve_mask;
485 u64 write_mask;
486 u32 latency;
487 u32 max_access_rate;
488 u16 min_turnaround_time;
489};
490
491/* Values for doorbell flags above */
492
493#define ACPI_PCCT_INTERRUPT_POLARITY (1)
494#define ACPI_PCCT_INTERRUPT_MODE (1<<1)
495
410/* 496/*
411 * PCC memory structures (not part of the ACPI table) 497 * PCC memory structures (not part of the ACPI table)
412 */ 498 */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 19b26bb69a70..ac03ec81d342 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -126,6 +126,7 @@
126typedef unsigned char u8; 126typedef unsigned char u8;
127typedef unsigned char u8; 127typedef unsigned char u8;
128typedef unsigned short u16; 128typedef unsigned short u16;
129typedef short s16;
129typedef COMPILER_DEPENDENT_UINT64 u64; 130typedef COMPILER_DEPENDENT_UINT64 u64;
130typedef COMPILER_DEPENDENT_INT64 s64; 131typedef COMPILER_DEPENDENT_INT64 s64;
131 132
@@ -516,7 +517,7 @@ typedef u64 acpi_integer;
516 517
517#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i) 518#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i)
518#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) 519#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
519#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) 520#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL)
520#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 521#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
521#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 522#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
522 523
@@ -611,8 +612,9 @@ typedef u64 acpi_integer;
611#define ACPI_NOTIFY_RESERVED (u8) 0x0A 612#define ACPI_NOTIFY_RESERVED (u8) 0x0A
612#define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B 613#define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B
613#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C 614#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C
615#define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D
614 616
615#define ACPI_NOTIFY_MAX 0x0C 617#define ACPI_NOTIFY_MAX 0x0D
616 618
617/* 619/*
618 * Types associated with ACPI names and objects. The first group of 620 * Types associated with ACPI names and objects. The first group of
@@ -1244,4 +1246,17 @@ struct acpi_memory_list {
1244#define ACPI_OSI_WIN_7 0x0B 1246#define ACPI_OSI_WIN_7 0x0B
1245#define ACPI_OSI_WIN_8 0x0C 1247#define ACPI_OSI_WIN_8 0x0C
1246 1248
1249/* Definitions of file IO */
1250
1251#define ACPI_FILE_READING 0x01
1252#define ACPI_FILE_WRITING 0x02
1253#define ACPI_FILE_BINARY 0x04
1254
1255#define ACPI_FILE_BEGIN 0x01
1256#define ACPI_FILE_END 0x02
1257
1258/* Definitions of getopt */
1259
1260#define ACPI_OPT_END -1
1261
1247#endif /* __ACTYPES_H__ */ 1262#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
index 04f349d8da73..76284bb560a6 100644
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -42,5 +42,9 @@ ssize_t erst_read(u64 record_id, struct cper_record_header *record,
42 size_t buflen); 42 size_t buflen);
43int erst_clear(u64 record_id); 43int erst_clear(u64 record_id);
44 44
45int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data);
46void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err);
47void arch_apei_flush_tlb_one(unsigned long addr);
48
45#endif 49#endif
46#endif 50#endif
diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h
index dfd60d0bfd27..720446cb243e 100644
--- a/include/acpi/ghes.h
+++ b/include/acpi/ghes.h
@@ -14,7 +14,7 @@
14 14
15struct ghes { 15struct ghes {
16 struct acpi_hest_generic *generic; 16 struct acpi_hest_generic *generic;
17 struct acpi_generic_status *estatus; 17 struct acpi_hest_generic_status *estatus;
18 u64 buffer_paddr; 18 u64 buffer_paddr;
19 unsigned long flags; 19 unsigned long flags;
20 union { 20 union {
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index e863dd5c4e04..5f8cc1fa3278 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -87,20 +87,14 @@
87#define ACPI_DBG_TRACK_ALLOCATIONS 87#define ACPI_DBG_TRACK_ALLOCATIONS
88#endif 88#endif
89 89
90/* acpi_names configuration. Single threaded with debugger output enabled. */
91
92#ifdef ACPI_NAMES_APP
93#define ACPI_DEBUGGER
94#define ACPI_APPLICATION
95#define ACPI_SINGLE_THREADED
96#endif
97
98/* 90/*
99 * acpi_bin/acpi_dump/acpi_src/acpi_xtract/Example configuration. All single 91 * acpi_bin/acpi_dump/acpi_help/acpi_names/acpi_src/acpi_xtract/Example configuration.
100 * threaded, with no debug output. 92 * All single threaded.
101 */ 93 */
102#if (defined ACPI_BIN_APP) || \ 94#if (defined ACPI_BIN_APP) || \
103 (defined ACPI_DUMP_APP) || \ 95 (defined ACPI_DUMP_APP) || \
96 (defined ACPI_HELP_APP) || \
97 (defined ACPI_NAMES_APP) || \
104 (defined ACPI_SRC_APP) || \ 98 (defined ACPI_SRC_APP) || \
105 (defined ACPI_XTRACT_APP) || \ 99 (defined ACPI_XTRACT_APP) || \
106 (defined ACPI_EXAMPLE_APP) 100 (defined ACPI_EXAMPLE_APP)
@@ -108,12 +102,40 @@
108#define ACPI_SINGLE_THREADED 102#define ACPI_SINGLE_THREADED
109#endif 103#endif
110 104
105/* acpi_help configuration. Error messages disabled. */
106
111#ifdef ACPI_HELP_APP 107#ifdef ACPI_HELP_APP
112#define ACPI_APPLICATION
113#define ACPI_SINGLE_THREADED
114#define ACPI_NO_ERROR_MESSAGES 108#define ACPI_NO_ERROR_MESSAGES
115#endif 109#endif
116 110
111/* acpi_names configuration. Debug output enabled. */
112
113#ifdef ACPI_NAMES_APP
114#define ACPI_DEBUG_OUTPUT
115#endif
116
117/* acpi_exec/acpi_names/Example configuration. Native RSDP used. */
118
119#if (defined ACPI_EXEC_APP) || \
120 (defined ACPI_EXAMPLE_APP) || \
121 (defined ACPI_NAMES_APP)
122#define ACPI_USE_NATIVE_RSDP_POINTER
123#endif
124
125/* acpi_dump configuration. Native mapping used if provied by OSPMs */
126
127#ifdef ACPI_DUMP_APP
128#define ACPI_USE_NATIVE_MEMORY_MAPPING
129#define USE_NATIVE_ALLOCATE_ZEROED
130#endif
131
132/* acpi_names/Example configuration. Hardware disabled */
133
134#if (defined ACPI_EXAMPLE_APP) || \
135 (defined ACPI_NAMES_APP)
136#define ACPI_REDUCED_HARDWARE 1
137#endif
138
117/* Linkable ACPICA library */ 139/* Linkable ACPICA library */
118 140
119#ifdef ACPI_LIBRARY 141#ifdef ACPI_LIBRARY
@@ -185,6 +207,9 @@
185#elif defined(_AED_EFI) 207#elif defined(_AED_EFI)
186#include "acefi.h" 208#include "acefi.h"
187 209
210#elif defined(_GNU_EFI)
211#include "acefi.h"
212
188#elif defined(__HAIKU__) 213#elif defined(__HAIKU__)
189#include "achaiku.h" 214#include "achaiku.h"
190 215
@@ -399,8 +424,12 @@ typedef char *va_list;
399#ifdef ACPI_APPLICATION 424#ifdef ACPI_APPLICATION
400#include <stdio.h> 425#include <stdio.h>
401#define ACPI_FILE FILE * 426#define ACPI_FILE FILE *
427#define ACPI_FILE_OUT stdout
428#define ACPI_FILE_ERR stderr
402#else 429#else
403#define ACPI_FILE void * 430#define ACPI_FILE void *
431#define ACPI_FILE_OUT NULL
432#define ACPI_FILE_ERR NULL
404#endif /* ACPI_APPLICATION */ 433#endif /* ACPI_APPLICATION */
405#endif /* ACPI_FILE */ 434#endif /* ACPI_FILE */
406 435
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index cd1f052d55bb..1ba7c190c2cc 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -44,6 +44,16 @@
44#ifndef __ACLINUX_H__ 44#ifndef __ACLINUX_H__
45#define __ACLINUX_H__ 45#define __ACLINUX_H__
46 46
47#ifdef __KERNEL__
48
49/* ACPICA external files should not include ACPICA headers directly. */
50
51#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H)
52#error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead."
53#endif
54
55#endif
56
47/* Common (in-kernel/user-space) ACPICA configuration */ 57/* Common (in-kernel/user-space) ACPICA configuration */
48 58
49#define ACPI_USE_SYSTEM_CLIBRARY 59#define ACPI_USE_SYSTEM_CLIBRARY
@@ -70,7 +80,9 @@
70#ifdef EXPORT_ACPI_INTERFACES 80#ifdef EXPORT_ACPI_INTERFACES
71#include <linux/export.h> 81#include <linux/export.h>
72#endif 82#endif
83#ifdef CONFIG_ACPI
73#include <asm/acenv.h> 84#include <asm/acenv.h>
85#endif
74 86
75#ifndef CONFIG_ACPI 87#ifndef CONFIG_ACPI
76 88
diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
index 191e741cfa0e..568d4b886712 100644
--- a/include/acpi/platform/aclinuxex.h
+++ b/include/acpi/platform/aclinuxex.h
@@ -46,6 +46,28 @@
46 46
47#ifdef __KERNEL__ 47#ifdef __KERNEL__
48 48
49#ifndef ACPI_USE_NATIVE_DIVIDE
50
51#ifndef ACPI_DIV_64_BY_32
52#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
53 do { \
54 u64 (__n) = ((u64) n_hi) << 32 | (n_lo); \
55 (r32) = do_div ((__n), (d32)); \
56 (q32) = (u32) (__n); \
57 } while (0)
58#endif
59
60#ifndef ACPI_SHIFT_RIGHT_64
61#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
62 do { \
63 (n_lo) >>= 1; \
64 (n_lo) |= (((n_hi) & 1) << 31); \
65 (n_hi) >>= 1; \
66 } while (0)
67#endif
68
69#endif
70
49/* 71/*
50 * Overrides for in-kernel ACPICA 72 * Overrides for in-kernel ACPICA
51 */ 73 */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 23e364538ab5..c1d4105e1c1d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -110,9 +110,6 @@ static inline int __gpio_to_irq(unsigned gpio)
110 return gpiod_to_irq(gpio_to_desc(gpio)); 110 return gpiod_to_irq(gpio_to_desc(gpio));
111} 111}
112 112
113extern int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
114extern void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
115
116extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); 113extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
117extern int gpio_request_array(const struct gpio *array, size_t num); 114extern int gpio_request_array(const struct gpio *array, size_t num);
118extern void gpio_free_array(const struct gpio *array, size_t num); 115extern void gpio_free_array(const struct gpio *array, size_t num);
diff --git a/include/asm-generic/io-64-nonatomic-hi-lo.h b/include/asm-generic/io-64-nonatomic-hi-lo.h
index a6806a94250d..2e29d13fc154 100644
--- a/include/asm-generic/io-64-nonatomic-hi-lo.h
+++ b/include/asm-generic/io-64-nonatomic-hi-lo.h
@@ -4,8 +4,7 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <asm-generic/int-ll64.h> 5#include <asm-generic/int-ll64.h>
6 6
7#ifndef readq 7static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
8static inline __u64 readq(const volatile void __iomem *addr)
9{ 8{
10 const volatile u32 __iomem *p = addr; 9 const volatile u32 __iomem *p = addr;
11 u32 low, high; 10 u32 low, high;
@@ -15,14 +14,19 @@ static inline __u64 readq(const volatile void __iomem *addr)
15 14
16 return low + ((u64)high << 32); 15 return low + ((u64)high << 32);
17} 16}
18#endif
19 17
20#ifndef writeq 18static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{ 19{
23 writel(val >> 32, addr + 4); 20 writel(val >> 32, addr + 4);
24 writel(val, addr); 21 writel(val, addr);
25} 22}
23
24#ifndef readq
25#define readq hi_lo_readq
26#endif
27
28#ifndef writeq
29#define writeq hi_lo_writeq
26#endif 30#endif
27 31
28#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */ 32#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */
diff --git a/include/asm-generic/io-64-nonatomic-lo-hi.h b/include/asm-generic/io-64-nonatomic-lo-hi.h
index ca546b1ff8b5..0efacff0a1ce 100644
--- a/include/asm-generic/io-64-nonatomic-lo-hi.h
+++ b/include/asm-generic/io-64-nonatomic-lo-hi.h
@@ -4,8 +4,7 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <asm-generic/int-ll64.h> 5#include <asm-generic/int-ll64.h>
6 6
7#ifndef readq 7static inline __u64 lo_hi_readq(const volatile void __iomem *addr)
8static inline __u64 readq(const volatile void __iomem *addr)
9{ 8{
10 const volatile u32 __iomem *p = addr; 9 const volatile u32 __iomem *p = addr;
11 u32 low, high; 10 u32 low, high;
@@ -15,14 +14,19 @@ static inline __u64 readq(const volatile void __iomem *addr)
15 14
16 return low + ((u64)high << 32); 15 return low + ((u64)high << 32);
17} 16}
18#endif
19 17
20#ifndef writeq 18static inline void lo_hi_writeq(__u64 val, volatile void __iomem *addr)
21static inline void writeq(__u64 val, volatile void __iomem *addr)
22{ 19{
23 writel(val, addr); 20 writel(val, addr);
24 writel(val >> 32, addr + 4); 21 writel(val >> 32, addr + 4);
25} 22}
23
24#ifndef readq
25#define readq lo_hi_readq
26#endif
27
28#ifndef writeq
29#define writeq lo_hi_writeq
26#endif 30#endif
27 31
28#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */ 32#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index 1437b7da09b2..c110843fc53b 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -19,6 +19,14 @@ pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
19 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); 19 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
20} 20}
21 21
22static inline void *
23pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
24 dma_addr_t *dma_handle)
25{
26 return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev,
27 size, dma_handle, GFP_ATOMIC);
28}
29
22static inline void 30static inline void
23pci_free_consistent(struct pci_dev *hwdev, size_t size, 31pci_free_consistent(struct pci_dev *hwdev, size_t size,
24 void *vaddr, dma_addr_t dma_handle) 32 void *vaddr, dma_addr_t dma_handle)
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 0703aa75b5e8..4d9f233c4ba8 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -36,93 +36,385 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
36#endif 36#endif
37 37
38/* 38/*
39 * Add a offset to a pointer but keep the pointer as is. 39 * Arch may define arch_raw_cpu_ptr() to provide more efficient address
40 * 40 * translations for raw_cpu_ptr().
41 * Only S390 provides its own means of moving the pointer.
42 */ 41 */
43#ifndef SHIFT_PERCPU_PTR 42#ifndef arch_raw_cpu_ptr
44/* Weird cast keeps both GCC and sparse happy. */ 43#define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
45#define SHIFT_PERCPU_PTR(__p, __offset) ({ \
46 __verify_pcpu_ptr((__p)); \
47 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \
48})
49#endif 44#endif
50 45
51/* 46#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
52 * A percpu variable may point to a discarded regions. The following are 47extern void setup_per_cpu_areas(void);
53 * established ways to produce a usable pointer from the percpu variable
54 * offset.
55 */
56#define per_cpu(var, cpu) \
57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
58
59#ifndef raw_cpu_ptr
60#define raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
61#endif 48#endif
62#ifdef CONFIG_DEBUG_PREEMPT 49
63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) 50#endif /* SMP */
51
52#ifndef PER_CPU_BASE_SECTION
53#ifdef CONFIG_SMP
54#define PER_CPU_BASE_SECTION ".data..percpu"
64#else 55#else
65#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) 56#define PER_CPU_BASE_SECTION ".data"
57#endif
66#endif 58#endif
67 59
68#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) 60#ifndef PER_CPU_ATTRIBUTES
69#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) 61#define PER_CPU_ATTRIBUTES
62#endif
70 63
71#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 64#ifndef PER_CPU_DEF_ATTRIBUTES
72extern void setup_per_cpu_areas(void); 65#define PER_CPU_DEF_ATTRIBUTES
73#endif 66#endif
74 67
75#else /* ! SMP */ 68#define raw_cpu_generic_to_op(pcp, val, op) \
69do { \
70 *raw_cpu_ptr(&(pcp)) op val; \
71} while (0)
76 72
77#define VERIFY_PERCPU_PTR(__p) ({ \ 73#define raw_cpu_generic_add_return(pcp, val) \
78 __verify_pcpu_ptr((__p)); \ 74({ \
79 (typeof(*(__p)) __kernel __force *)(__p); \ 75 raw_cpu_add(pcp, val); \
76 raw_cpu_read(pcp); \
80}) 77})
81 78
82#define per_cpu(var, cpu) (*((void)(cpu), VERIFY_PERCPU_PTR(&(var)))) 79#define raw_cpu_generic_xchg(pcp, nval) \
83#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) 80({ \
84#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) 81 typeof(pcp) __ret; \
85#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) 82 __ret = raw_cpu_read(pcp); \
86#define raw_cpu_ptr(ptr) this_cpu_ptr(ptr) 83 raw_cpu_write(pcp, nval); \
84 __ret; \
85})
87 86
88#endif /* SMP */ 87#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
88({ \
89 typeof(pcp) __ret; \
90 __ret = raw_cpu_read(pcp); \
91 if (__ret == (oval)) \
92 raw_cpu_write(pcp, nval); \
93 __ret; \
94})
89 95
90#ifndef PER_CPU_BASE_SECTION 96#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
91#ifdef CONFIG_SMP 97({ \
92#define PER_CPU_BASE_SECTION ".data..percpu" 98 int __ret = 0; \
93#else 99 if (raw_cpu_read(pcp1) == (oval1) && \
94#define PER_CPU_BASE_SECTION ".data" 100 raw_cpu_read(pcp2) == (oval2)) { \
101 raw_cpu_write(pcp1, nval1); \
102 raw_cpu_write(pcp2, nval2); \
103 __ret = 1; \
104 } \
105 (__ret); \
106})
107
108#define this_cpu_generic_read(pcp) \
109({ \
110 typeof(pcp) __ret; \
111 preempt_disable(); \
112 __ret = *this_cpu_ptr(&(pcp)); \
113 preempt_enable(); \
114 __ret; \
115})
116
117#define this_cpu_generic_to_op(pcp, val, op) \
118do { \
119 unsigned long __flags; \
120 raw_local_irq_save(__flags); \
121 *raw_cpu_ptr(&(pcp)) op val; \
122 raw_local_irq_restore(__flags); \
123} while (0)
124
125#define this_cpu_generic_add_return(pcp, val) \
126({ \
127 typeof(pcp) __ret; \
128 unsigned long __flags; \
129 raw_local_irq_save(__flags); \
130 raw_cpu_add(pcp, val); \
131 __ret = raw_cpu_read(pcp); \
132 raw_local_irq_restore(__flags); \
133 __ret; \
134})
135
136#define this_cpu_generic_xchg(pcp, nval) \
137({ \
138 typeof(pcp) __ret; \
139 unsigned long __flags; \
140 raw_local_irq_save(__flags); \
141 __ret = raw_cpu_read(pcp); \
142 raw_cpu_write(pcp, nval); \
143 raw_local_irq_restore(__flags); \
144 __ret; \
145})
146
147#define this_cpu_generic_cmpxchg(pcp, oval, nval) \
148({ \
149 typeof(pcp) __ret; \
150 unsigned long __flags; \
151 raw_local_irq_save(__flags); \
152 __ret = raw_cpu_read(pcp); \
153 if (__ret == (oval)) \
154 raw_cpu_write(pcp, nval); \
155 raw_local_irq_restore(__flags); \
156 __ret; \
157})
158
159#define this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
160({ \
161 int __ret; \
162 unsigned long __flags; \
163 raw_local_irq_save(__flags); \
164 __ret = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
165 oval1, oval2, nval1, nval2); \
166 raw_local_irq_restore(__flags); \
167 __ret; \
168})
169
170#ifndef raw_cpu_read_1
171#define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
95#endif 172#endif
173#ifndef raw_cpu_read_2
174#define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
175#endif
176#ifndef raw_cpu_read_4
177#define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
178#endif
179#ifndef raw_cpu_read_8
180#define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
96#endif 181#endif
97 182
98#ifdef CONFIG_SMP 183#ifndef raw_cpu_write_1
184#define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
185#endif
186#ifndef raw_cpu_write_2
187#define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
188#endif
189#ifndef raw_cpu_write_4
190#define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
191#endif
192#ifndef raw_cpu_write_8
193#define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
194#endif
99 195
100#ifdef MODULE 196#ifndef raw_cpu_add_1
101#define PER_CPU_SHARED_ALIGNED_SECTION "" 197#define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
102#define PER_CPU_ALIGNED_SECTION "" 198#endif
103#else 199#ifndef raw_cpu_add_2
104#define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned" 200#define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
105#define PER_CPU_ALIGNED_SECTION "..shared_aligned" 201#endif
202#ifndef raw_cpu_add_4
203#define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
204#endif
205#ifndef raw_cpu_add_8
206#define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
106#endif 207#endif
107#define PER_CPU_FIRST_SECTION "..first"
108 208
109#else 209#ifndef raw_cpu_and_1
210#define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
211#endif
212#ifndef raw_cpu_and_2
213#define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
214#endif
215#ifndef raw_cpu_and_4
216#define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
217#endif
218#ifndef raw_cpu_and_8
219#define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
220#endif
221
222#ifndef raw_cpu_or_1
223#define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
224#endif
225#ifndef raw_cpu_or_2
226#define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
227#endif
228#ifndef raw_cpu_or_4
229#define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
230#endif
231#ifndef raw_cpu_or_8
232#define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
233#endif
110 234
111#define PER_CPU_SHARED_ALIGNED_SECTION "" 235#ifndef raw_cpu_add_return_1
112#define PER_CPU_ALIGNED_SECTION "..shared_aligned" 236#define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
113#define PER_CPU_FIRST_SECTION "" 237#endif
238#ifndef raw_cpu_add_return_2
239#define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
240#endif
241#ifndef raw_cpu_add_return_4
242#define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
243#endif
244#ifndef raw_cpu_add_return_8
245#define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
246#endif
114 247
248#ifndef raw_cpu_xchg_1
249#define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
250#endif
251#ifndef raw_cpu_xchg_2
252#define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
253#endif
254#ifndef raw_cpu_xchg_4
255#define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
256#endif
257#ifndef raw_cpu_xchg_8
258#define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
115#endif 259#endif
116 260
117#ifndef PER_CPU_ATTRIBUTES 261#ifndef raw_cpu_cmpxchg_1
118#define PER_CPU_ATTRIBUTES 262#define raw_cpu_cmpxchg_1(pcp, oval, nval) \
263 raw_cpu_generic_cmpxchg(pcp, oval, nval)
264#endif
265#ifndef raw_cpu_cmpxchg_2
266#define raw_cpu_cmpxchg_2(pcp, oval, nval) \
267 raw_cpu_generic_cmpxchg(pcp, oval, nval)
268#endif
269#ifndef raw_cpu_cmpxchg_4
270#define raw_cpu_cmpxchg_4(pcp, oval, nval) \
271 raw_cpu_generic_cmpxchg(pcp, oval, nval)
272#endif
273#ifndef raw_cpu_cmpxchg_8
274#define raw_cpu_cmpxchg_8(pcp, oval, nval) \
275 raw_cpu_generic_cmpxchg(pcp, oval, nval)
119#endif 276#endif
120 277
121#ifndef PER_CPU_DEF_ATTRIBUTES 278#ifndef raw_cpu_cmpxchg_double_1
122#define PER_CPU_DEF_ATTRIBUTES 279#define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
280 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
281#endif
282#ifndef raw_cpu_cmpxchg_double_2
283#define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
284 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
285#endif
286#ifndef raw_cpu_cmpxchg_double_4
287#define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
288 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
289#endif
290#ifndef raw_cpu_cmpxchg_double_8
291#define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
292 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
293#endif
294
295#ifndef this_cpu_read_1
296#define this_cpu_read_1(pcp) this_cpu_generic_read(pcp)
297#endif
298#ifndef this_cpu_read_2
299#define this_cpu_read_2(pcp) this_cpu_generic_read(pcp)
300#endif
301#ifndef this_cpu_read_4
302#define this_cpu_read_4(pcp) this_cpu_generic_read(pcp)
303#endif
304#ifndef this_cpu_read_8
305#define this_cpu_read_8(pcp) this_cpu_generic_read(pcp)
123#endif 306#endif
124 307
125/* Keep until we have removed all uses of __this_cpu_ptr */ 308#ifndef this_cpu_write_1
126#define __this_cpu_ptr raw_cpu_ptr 309#define this_cpu_write_1(pcp, val) this_cpu_generic_to_op(pcp, val, =)
310#endif
311#ifndef this_cpu_write_2
312#define this_cpu_write_2(pcp, val) this_cpu_generic_to_op(pcp, val, =)
313#endif
314#ifndef this_cpu_write_4
315#define this_cpu_write_4(pcp, val) this_cpu_generic_to_op(pcp, val, =)
316#endif
317#ifndef this_cpu_write_8
318#define this_cpu_write_8(pcp, val) this_cpu_generic_to_op(pcp, val, =)
319#endif
320
321#ifndef this_cpu_add_1
322#define this_cpu_add_1(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
323#endif
324#ifndef this_cpu_add_2
325#define this_cpu_add_2(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
326#endif
327#ifndef this_cpu_add_4
328#define this_cpu_add_4(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
329#endif
330#ifndef this_cpu_add_8
331#define this_cpu_add_8(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
332#endif
333
334#ifndef this_cpu_and_1
335#define this_cpu_and_1(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
336#endif
337#ifndef this_cpu_and_2
338#define this_cpu_and_2(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
339#endif
340#ifndef this_cpu_and_4
341#define this_cpu_and_4(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
342#endif
343#ifndef this_cpu_and_8
344#define this_cpu_and_8(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
345#endif
346
347#ifndef this_cpu_or_1
348#define this_cpu_or_1(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
349#endif
350#ifndef this_cpu_or_2
351#define this_cpu_or_2(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
352#endif
353#ifndef this_cpu_or_4
354#define this_cpu_or_4(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
355#endif
356#ifndef this_cpu_or_8
357#define this_cpu_or_8(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
358#endif
359
360#ifndef this_cpu_add_return_1
361#define this_cpu_add_return_1(pcp, val) this_cpu_generic_add_return(pcp, val)
362#endif
363#ifndef this_cpu_add_return_2
364#define this_cpu_add_return_2(pcp, val) this_cpu_generic_add_return(pcp, val)
365#endif
366#ifndef this_cpu_add_return_4
367#define this_cpu_add_return_4(pcp, val) this_cpu_generic_add_return(pcp, val)
368#endif
369#ifndef this_cpu_add_return_8
370#define this_cpu_add_return_8(pcp, val) this_cpu_generic_add_return(pcp, val)
371#endif
372
373#ifndef this_cpu_xchg_1
374#define this_cpu_xchg_1(pcp, nval) this_cpu_generic_xchg(pcp, nval)
375#endif
376#ifndef this_cpu_xchg_2
377#define this_cpu_xchg_2(pcp, nval) this_cpu_generic_xchg(pcp, nval)
378#endif
379#ifndef this_cpu_xchg_4
380#define this_cpu_xchg_4(pcp, nval) this_cpu_generic_xchg(pcp, nval)
381#endif
382#ifndef this_cpu_xchg_8
383#define this_cpu_xchg_8(pcp, nval) this_cpu_generic_xchg(pcp, nval)
384#endif
385
386#ifndef this_cpu_cmpxchg_1
387#define this_cpu_cmpxchg_1(pcp, oval, nval) \
388 this_cpu_generic_cmpxchg(pcp, oval, nval)
389#endif
390#ifndef this_cpu_cmpxchg_2
391#define this_cpu_cmpxchg_2(pcp, oval, nval) \
392 this_cpu_generic_cmpxchg(pcp, oval, nval)
393#endif
394#ifndef this_cpu_cmpxchg_4
395#define this_cpu_cmpxchg_4(pcp, oval, nval) \
396 this_cpu_generic_cmpxchg(pcp, oval, nval)
397#endif
398#ifndef this_cpu_cmpxchg_8
399#define this_cpu_cmpxchg_8(pcp, oval, nval) \
400 this_cpu_generic_cmpxchg(pcp, oval, nval)
401#endif
402
403#ifndef this_cpu_cmpxchg_double_1
404#define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
405 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
406#endif
407#ifndef this_cpu_cmpxchg_double_2
408#define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
409 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
410#endif
411#ifndef this_cpu_cmpxchg_double_4
412#define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
413 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
414#endif
415#ifndef this_cpu_cmpxchg_double_8
416#define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
417 this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
418#endif
127 419
128#endif /* _ASM_GENERIC_PERCPU_H_ */ 420#endif /* _ASM_GENERIC_PERCPU_H_ */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index c1c0b0cf39b4..5ba0360663a7 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -268,6 +268,9 @@
268 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \ 268 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
269 *(.pci_fixup_suspend) \ 269 *(.pci_fixup_suspend) \
270 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \ 270 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
271 VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \
272 *(.pci_fixup_suspend_late) \
273 VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
271 } \ 274 } \
272 \ 275 \
273 /* Built-in firmware blobs */ \ 276 /* Built-in firmware blobs */ \
diff --git a/include/clocksource/pxa.h b/include/clocksource/pxa.h
new file mode 100644
index 000000000000..1efbe5a66958
--- /dev/null
+++ b/include/clocksource/pxa.h
@@ -0,0 +1,18 @@
1/*
2 * PXA clocksource, clockevents, and OST interrupt handlers.
3 *
4 * Copyright (C) 2014 Robert Jarzmik
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; version 2 of the License.
9 *
10 */
11
12#ifndef _CLOCKSOURCE_PXA_H
13#define _CLOCKSOURCE_PXA_H
14
15extern void pxa_timer_nodt_init(int irq, void __iomem *base,
16 unsigned long clock_tick_rate);
17
18#endif
diff --git a/include/crypto/aead.h b/include/crypto/aead.h
index 0edf949f6369..94b19be67574 100644
--- a/include/crypto/aead.h
+++ b/include/crypto/aead.h
@@ -75,9 +75,9 @@ static inline void aead_givcrypt_free(struct aead_givcrypt_request *req)
75 75
76static inline void aead_givcrypt_set_callback( 76static inline void aead_givcrypt_set_callback(
77 struct aead_givcrypt_request *req, u32 flags, 77 struct aead_givcrypt_request *req, u32 flags,
78 crypto_completion_t complete, void *data) 78 crypto_completion_t compl, void *data)
79{ 79{
80 aead_request_set_callback(&req->areq, flags, complete, data); 80 aead_request_set_callback(&req->areq, flags, compl, data);
81} 81}
82 82
83static inline void aead_givcrypt_set_crypt(struct aead_givcrypt_request *req, 83static inline void aead_givcrypt_set_crypt(struct aead_givcrypt_request *req,
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 016c2f110f63..623a59c1ff5a 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -410,4 +410,10 @@ static inline int crypto_memneq(const void *a, const void *b, size_t size)
410 return __crypto_memneq(a, b, size) != 0UL ? 1 : 0; 410 return __crypto_memneq(a, b, size) != 0UL ? 1 : 0;
411} 411}
412 412
413static inline void crypto_yield(u32 flags)
414{
415 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
416 cond_resched();
417}
418
413#endif /* _CRYPTO_ALGAPI_H */ 419#endif /* _CRYPTO_ALGAPI_H */
diff --git a/include/crypto/des.h b/include/crypto/des.h
index 2971c6304ade..fc6274c6bb26 100644
--- a/include/crypto/des.h
+++ b/include/crypto/des.h
@@ -16,4 +16,7 @@
16 16
17extern unsigned long des_ekey(u32 *pe, const u8 *k); 17extern unsigned long des_ekey(u32 *pe, const u8 *k);
18 18
19extern int __des3_ede_setkey(u32 *expkey, u32 *flags, const u8 *key,
20 unsigned int keylen);
21
19#endif /* __CRYPTO_DES_H */ 22#endif /* __CRYPTO_DES_H */
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
new file mode 100644
index 000000000000..831d786976c5
--- /dev/null
+++ b/include/crypto/drbg.h
@@ -0,0 +1,290 @@
1/*
2 * DRBG based on NIST SP800-90A
3 *
4 * Copyright Stephan Mueller <smueller@chronox.de>, 2014
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, and the entire permission notice in its entirety,
11 * including the disclaimer of warranties.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote
16 * products derived from this software without specific prior
17 * written permission.
18 *
19 * ALTERNATIVELY, this product may be distributed under the terms of
20 * the GNU General Public License, in which case the provisions of the GPL are
21 * required INSTEAD OF the above restrictions. (This clause is
22 * necessary due to a potential bad interaction between the GPL and
23 * the restrictions contained in a BSD-style copyright.)
24 *
25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
28 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
31 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
35 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
36 * DAMAGE.
37 */
38
39#ifndef _DRBG_H
40#define _DRBG_H
41
42
43#include <linux/random.h>
44#include <linux/scatterlist.h>
45#include <crypto/hash.h>
46#include <linux/module.h>
47#include <linux/crypto.h>
48#include <linux/slab.h>
49#include <crypto/internal/rng.h>
50#include <crypto/rng.h>
51#include <linux/fips.h>
52#include <linux/spinlock.h>
53#include <linux/list.h>
54
55/*
56 * Concatenation Helper and string operation helper
57 *
58 * SP800-90A requires the concatenation of different data. To avoid copying
59 * buffers around or allocate additional memory, the following data structure
60 * is used to point to the original memory with its size. In addition, it
61 * is used to build a linked list. The linked list defines the concatenation
62 * of individual buffers. The order of memory block referenced in that
63 * linked list determines the order of concatenation.
64 */
65struct drbg_string {
66 const unsigned char *buf;
67 size_t len;
68 struct list_head list;
69};
70
71static inline void drbg_string_fill(struct drbg_string *string,
72 const unsigned char *buf, size_t len)
73{
74 string->buf = buf;
75 string->len = len;
76 INIT_LIST_HEAD(&string->list);
77}
78
79struct drbg_state;
80typedef uint32_t drbg_flag_t;
81
82struct drbg_core {
83 drbg_flag_t flags; /* flags for the cipher */
84 __u8 statelen; /* maximum state length */
85 /*
86 * maximum length of personalization string or additional input
87 * string -- exponent for base 2
88 */
89 __u8 max_addtllen;
90 /* maximum bits per RNG request -- exponent for base 2*/
91 __u8 max_bits;
92 /* maximum number of requests -- exponent for base 2 */
93 __u8 max_req;
94 __u8 blocklen_bytes; /* block size of output in bytes */
95 char cra_name[CRYPTO_MAX_ALG_NAME]; /* mapping to kernel crypto API */
96 /* kernel crypto API backend cipher name */
97 char backend_cra_name[CRYPTO_MAX_ALG_NAME];
98};
99
100struct drbg_state_ops {
101 int (*update)(struct drbg_state *drbg, struct list_head *seed,
102 int reseed);
103 int (*generate)(struct drbg_state *drbg,
104 unsigned char *buf, unsigned int buflen,
105 struct list_head *addtl);
106 int (*crypto_init)(struct drbg_state *drbg);
107 int (*crypto_fini)(struct drbg_state *drbg);
108
109};
110
111struct drbg_test_data {
112 struct drbg_string *testentropy; /* TEST PARAMETER: test entropy */
113};
114
115struct drbg_state {
116 spinlock_t drbg_lock; /* lock around DRBG */
117 unsigned char *V; /* internal state 10.1.1.1 1a) */
118 /* hash: static value 10.1.1.1 1b) hmac / ctr: key */
119 unsigned char *C;
120 /* Number of RNG requests since last reseed -- 10.1.1.1 1c) */
121 size_t reseed_ctr;
122 /* some memory the DRBG can use for its operation */
123 unsigned char *scratchpad;
124 void *priv_data; /* Cipher handle */
125 bool seeded; /* DRBG fully seeded? */
126 bool pr; /* Prediction resistance enabled? */
127#ifdef CONFIG_CRYPTO_FIPS
128 bool fips_primed; /* Continuous test primed? */
129 unsigned char *prev; /* FIPS 140-2 continuous test value */
130#endif
131 const struct drbg_state_ops *d_ops;
132 const struct drbg_core *core;
133 struct drbg_test_data *test_data;
134};
135
136static inline __u8 drbg_statelen(struct drbg_state *drbg)
137{
138 if (drbg && drbg->core)
139 return drbg->core->statelen;
140 return 0;
141}
142
143static inline __u8 drbg_blocklen(struct drbg_state *drbg)
144{
145 if (drbg && drbg->core)
146 return drbg->core->blocklen_bytes;
147 return 0;
148}
149
150static inline __u8 drbg_keylen(struct drbg_state *drbg)
151{
152 if (drbg && drbg->core)
153 return (drbg->core->statelen - drbg->core->blocklen_bytes);
154 return 0;
155}
156
157static inline size_t drbg_max_request_bytes(struct drbg_state *drbg)
158{
159 /* max_bits is in bits, but buflen is in bytes */
160 return (1 << (drbg->core->max_bits - 3));
161}
162
163static inline size_t drbg_max_addtl(struct drbg_state *drbg)
164{
165 return (1UL<<(drbg->core->max_addtllen));
166}
167
168static inline size_t drbg_max_requests(struct drbg_state *drbg)
169{
170 return (1UL<<(drbg->core->max_req));
171}
172
173/*
174 * kernel crypto API input data structure for DRBG generate in case dlen
175 * is set to 0
176 */
177struct drbg_gen {
178 unsigned char *outbuf; /* output buffer for random numbers */
179 unsigned int outlen; /* size of output buffer */
180 struct drbg_string *addtl; /* additional information string */
181 struct drbg_test_data *test_data; /* test data */
182};
183
184/*
185 * This is a wrapper to the kernel crypto API function of
186 * crypto_rng_get_bytes() to allow the caller to provide additional data.
187 *
188 * @drng DRBG handle -- see crypto_rng_get_bytes
189 * @outbuf output buffer -- see crypto_rng_get_bytes
190 * @outlen length of output buffer -- see crypto_rng_get_bytes
191 * @addtl_input additional information string input buffer
192 * @addtllen length of additional information string buffer
193 *
194 * return
195 * see crypto_rng_get_bytes
196 */
197static inline int crypto_drbg_get_bytes_addtl(struct crypto_rng *drng,
198 unsigned char *outbuf, unsigned int outlen,
199 struct drbg_string *addtl)
200{
201 int ret;
202 struct drbg_gen genbuf;
203 genbuf.outbuf = outbuf;
204 genbuf.outlen = outlen;
205 genbuf.addtl = addtl;
206 genbuf.test_data = NULL;
207 ret = crypto_rng_get_bytes(drng, (u8 *)&genbuf, 0);
208 return ret;
209}
210
211/*
212 * TEST code
213 *
214 * This is a wrapper to the kernel crypto API function of
215 * crypto_rng_get_bytes() to allow the caller to provide additional data and
216 * allow furnishing of test_data
217 *
218 * @drng DRBG handle -- see crypto_rng_get_bytes
219 * @outbuf output buffer -- see crypto_rng_get_bytes
220 * @outlen length of output buffer -- see crypto_rng_get_bytes
221 * @addtl_input additional information string input buffer
222 * @addtllen length of additional information string buffer
223 * @test_data filled test data
224 *
225 * return
226 * see crypto_rng_get_bytes
227 */
228static inline int crypto_drbg_get_bytes_addtl_test(struct crypto_rng *drng,
229 unsigned char *outbuf, unsigned int outlen,
230 struct drbg_string *addtl,
231 struct drbg_test_data *test_data)
232{
233 int ret;
234 struct drbg_gen genbuf;
235 genbuf.outbuf = outbuf;
236 genbuf.outlen = outlen;
237 genbuf.addtl = addtl;
238 genbuf.test_data = test_data;
239 ret = crypto_rng_get_bytes(drng, (u8 *)&genbuf, 0);
240 return ret;
241}
242
243/*
244 * TEST code
245 *
246 * This is a wrapper to the kernel crypto API function of
247 * crypto_rng_reset() to allow the caller to provide test_data
248 *
249 * @drng DRBG handle -- see crypto_rng_reset
250 * @pers personalization string input buffer
251 * @perslen length of additional information string buffer
252 * @test_data filled test data
253 *
254 * return
255 * see crypto_rng_reset
256 */
257static inline int crypto_drbg_reset_test(struct crypto_rng *drng,
258 struct drbg_string *pers,
259 struct drbg_test_data *test_data)
260{
261 int ret;
262 struct drbg_gen genbuf;
263 genbuf.outbuf = NULL;
264 genbuf.outlen = 0;
265 genbuf.addtl = pers;
266 genbuf.test_data = test_data;
267 ret = crypto_rng_reset(drng, (u8 *)&genbuf, 0);
268 return ret;
269}
270
271/* DRBG type flags */
272#define DRBG_CTR ((drbg_flag_t)1<<0)
273#define DRBG_HMAC ((drbg_flag_t)1<<1)
274#define DRBG_HASH ((drbg_flag_t)1<<2)
275#define DRBG_TYPE_MASK (DRBG_CTR | DRBG_HMAC | DRBG_HASH)
276/* DRBG strength flags */
277#define DRBG_STRENGTH128 ((drbg_flag_t)1<<3)
278#define DRBG_STRENGTH192 ((drbg_flag_t)1<<4)
279#define DRBG_STRENGTH256 ((drbg_flag_t)1<<5)
280#define DRBG_STRENGTH_MASK (DRBG_STRENGTH128 | DRBG_STRENGTH192 | \
281 DRBG_STRENGTH256)
282
283enum drbg_prefixes {
284 DRBG_PREFIX0 = 0x00,
285 DRBG_PREFIX1,
286 DRBG_PREFIX2,
287 DRBG_PREFIX3
288};
289
290#endif /* _DRBG_H */
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 26cb1eb16f4c..a39195539601 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -238,10 +238,10 @@ static inline struct ahash_request *ahash_request_cast(
238 238
239static inline void ahash_request_set_callback(struct ahash_request *req, 239static inline void ahash_request_set_callback(struct ahash_request *req,
240 u32 flags, 240 u32 flags,
241 crypto_completion_t complete, 241 crypto_completion_t compl,
242 void *data) 242 void *data)
243{ 243{
244 req->base.complete = complete; 244 req->base.complete = compl;
245 req->base.data = data; 245 req->base.data = data;
246 req->base.flags = flags; 246 req->base.flags = flags;
247} 247}
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index 06e8b32d541c..b3a46c515d1b 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -81,8 +81,7 @@ static inline int skcipher_enqueue_givcrypt(
81static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( 81static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt(
82 struct crypto_queue *queue) 82 struct crypto_queue *queue)
83{ 83{
84 return __crypto_dequeue_request( 84 return skcipher_givcrypt_cast(crypto_dequeue_request(queue));
85 queue, offsetof(struct skcipher_givcrypt_request, creq.base));
86} 85}
87 86
88static inline void *skcipher_givcrypt_reqctx( 87static inline void *skcipher_givcrypt_reqctx(
diff --git a/include/crypto/pkcs7.h b/include/crypto/pkcs7.h
new file mode 100644
index 000000000000..691c79172a26
--- /dev/null
+++ b/include/crypto/pkcs7.h
@@ -0,0 +1,36 @@
1/* PKCS#7 crypto data parser
2 *
3 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12struct key;
13struct pkcs7_message;
14
15/*
16 * pkcs7_parser.c
17 */
18extern struct pkcs7_message *pkcs7_parse_message(const void *data,
19 size_t datalen);
20extern void pkcs7_free_message(struct pkcs7_message *pkcs7);
21
22extern int pkcs7_get_content_data(const struct pkcs7_message *pkcs7,
23 const void **_data, size_t *_datalen,
24 bool want_wrapper);
25
26/*
27 * pkcs7_trust.c
28 */
29extern int pkcs7_validate_trust(struct pkcs7_message *pkcs7,
30 struct key *trust_keyring,
31 bool *_trusted);
32
33/*
34 * pkcs7_verify.c
35 */
36extern int pkcs7_verify(struct pkcs7_message *pkcs7);
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
index fc09732613ad..0d164c6af539 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -98,4 +98,8 @@ struct key;
98extern int verify_signature(const struct key *key, 98extern int verify_signature(const struct key *key,
99 const struct public_key_signature *sig); 99 const struct public_key_signature *sig);
100 100
101extern struct key *x509_request_asymmetric_key(struct key *keyring,
102 const char *issuer,
103 const char *key_id);
104
101#endif /* _LINUX_PUBLIC_KEY_H */ 105#endif /* _LINUX_PUBLIC_KEY_H */
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 6a626a507b8c..7ef512f8631c 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -25,12 +25,6 @@
25#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27 27
28static inline void crypto_yield(u32 flags)
29{
30 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
31 cond_resched();
32}
33
34static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, 28static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
35 struct scatterlist *sg2) 29 struct scatterlist *sg2)
36{ 30{
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 25fd6126522d..07d245f073d1 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -86,9 +86,9 @@ static inline void skcipher_givcrypt_free(struct skcipher_givcrypt_request *req)
86 86
87static inline void skcipher_givcrypt_set_callback( 87static inline void skcipher_givcrypt_set_callback(
88 struct skcipher_givcrypt_request *req, u32 flags, 88 struct skcipher_givcrypt_request *req, u32 flags,
89 crypto_completion_t complete, void *data) 89 crypto_completion_t compl, void *data)
90{ 90{
91 ablkcipher_request_set_callback(&req->creq, flags, complete, data); 91 ablkcipher_request_set_callback(&req->creq, flags, compl, data);
92} 92}
93 93
94static inline void skcipher_givcrypt_set_crypt( 94static inline void skcipher_givcrypt_set_crypt(
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8af71a8e2c00..196890735367 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -83,6 +83,7 @@ struct drm_device;
83 83
84struct device_node; 84struct device_node;
85struct videomode; 85struct videomode;
86struct reservation_object;
86 87
87#include <drm/drm_os_linux.h> 88#include <drm/drm_os_linux.h>
88#include <drm/drm_hashtab.h> 89#include <drm/drm_hashtab.h>
@@ -151,8 +152,6 @@ int drm_err(const char *func, const char *format, ...);
151 also include looping detection. */ 152 also include looping detection. */
152 153
153#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ 154#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
154#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
155#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
156 155
157#define DRM_MAP_HASH_OFFSET 0x10000000 156#define DRM_MAP_HASH_OFFSET 0x10000000
158 157
@@ -346,18 +345,6 @@ struct drm_waitlist {
346 spinlock_t write_lock; 345 spinlock_t write_lock;
347}; 346};
348 347
349struct drm_freelist {
350 int initialized; /**< Freelist in use */
351 atomic_t count; /**< Number of free buffers */
352 struct drm_buf *next; /**< End pointer */
353
354 wait_queue_head_t waiting; /**< Processes waiting on free bufs */
355 int low_mark; /**< Low water mark */
356 int high_mark; /**< High water mark */
357 atomic_t wfh; /**< If waiting for high mark */
358 spinlock_t lock;
359};
360
361typedef struct drm_dma_handle { 348typedef struct drm_dma_handle {
362 dma_addr_t busaddr; 349 dma_addr_t busaddr;
363 void *vaddr; 350 void *vaddr;
@@ -375,7 +362,8 @@ struct drm_buf_entry {
375 int page_order; 362 int page_order;
376 struct drm_dma_handle **seglist; 363 struct drm_dma_handle **seglist;
377 364
378 struct drm_freelist freelist; 365 int low_mark; /**< Low water mark */
366 int high_mark; /**< High water mark */
379}; 367};
380 368
381/* Event queued up for userspace to read */ 369/* Event queued up for userspace to read */
@@ -396,7 +384,6 @@ struct drm_prime_file_private {
396 384
397/** File private data */ 385/** File private data */
398struct drm_file { 386struct drm_file {
399 unsigned always_authenticated :1;
400 unsigned authenticated :1; 387 unsigned authenticated :1;
401 /* Whether we're master for a minor. Protected by master_mutex */ 388 /* Whether we're master for a minor. Protected by master_mutex */
402 unsigned is_master :1; 389 unsigned is_master :1;
@@ -441,23 +428,6 @@ struct drm_file {
441 struct drm_prime_file_private prime; 428 struct drm_prime_file_private prime;
442}; 429};
443 430
444/** Wait queue */
445struct drm_queue {
446 atomic_t use_count; /**< Outstanding uses (+1) */
447 atomic_t finalization; /**< Finalization in progress */
448 atomic_t block_count; /**< Count of processes waiting */
449 atomic_t block_read; /**< Queue blocked for reads */
450 wait_queue_head_t read_queue; /**< Processes waiting on block_read */
451 atomic_t block_write; /**< Queue blocked for writes */
452 wait_queue_head_t write_queue; /**< Processes waiting on block_write */
453 atomic_t total_queued; /**< Total queued statistic */
454 atomic_t total_flushed; /**< Total flushes statistic */
455 atomic_t total_locks; /**< Total locks statistics */
456 enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
457 struct drm_waitlist waitlist; /**< Pending buffers */
458 wait_queue_head_t flush_queue; /**< Processes waiting until flush */
459};
460
461/** 431/**
462 * Lock data. 432 * Lock data.
463 */ 433 */
@@ -566,15 +536,6 @@ struct drm_map_list {
566 struct drm_master *master; 536 struct drm_master *master;
567}; 537};
568 538
569/**
570 * Context handle list
571 */
572struct drm_ctx_list {
573 struct list_head head; /**< list head */
574 drm_context_t handle; /**< context handle */
575 struct drm_file *tag; /**< associated fd private data */
576};
577
578/* location of GART table */ 539/* location of GART table */
579#define DRM_ATI_GART_MAIN 1 540#define DRM_ATI_GART_MAIN 1
580#define DRM_ATI_GART_FB 2 541#define DRM_ATI_GART_FB 2
@@ -923,6 +884,8 @@ struct drm_driver {
923 /* low-level interface used by drm_gem_prime_{import,export} */ 884 /* low-level interface used by drm_gem_prime_{import,export} */
924 int (*gem_prime_pin)(struct drm_gem_object *obj); 885 int (*gem_prime_pin)(struct drm_gem_object *obj);
925 void (*gem_prime_unpin)(struct drm_gem_object *obj); 886 void (*gem_prime_unpin)(struct drm_gem_object *obj);
887 struct reservation_object * (*gem_prime_res_obj)(
888 struct drm_gem_object *obj);
926 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); 889 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
927 struct drm_gem_object *(*gem_prime_import_sg_table)( 890 struct drm_gem_object *(*gem_prime_import_sg_table)(
928 struct drm_device *dev, size_t size, 891 struct drm_device *dev, size_t size,
@@ -1215,7 +1178,6 @@ extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
1215 /* Device support (drm_fops.h) */ 1178 /* Device support (drm_fops.h) */
1216extern struct mutex drm_global_mutex; 1179extern struct mutex drm_global_mutex;
1217extern int drm_open(struct inode *inode, struct file *filp); 1180extern int drm_open(struct inode *inode, struct file *filp);
1218extern int drm_stub_open(struct inode *inode, struct file *filp);
1219extern ssize_t drm_read(struct file *filp, char __user *buffer, 1181extern ssize_t drm_read(struct file *filp, char __user *buffer,
1220 size_t count, loff_t *offset); 1182 size_t count, loff_t *offset);
1221extern int drm_release(struct inode *inode, struct file *filp); 1183extern int drm_release(struct inode *inode, struct file *filp);
@@ -1253,29 +1215,6 @@ extern int drm_setversion(struct drm_device *dev, void *data,
1253extern int drm_noop(struct drm_device *dev, void *data, 1215extern int drm_noop(struct drm_device *dev, void *data,
1254 struct drm_file *file_priv); 1216 struct drm_file *file_priv);
1255 1217
1256 /* Context IOCTL support (drm_context.h) */
1257extern int drm_resctx(struct drm_device *dev, void *data,
1258 struct drm_file *file_priv);
1259extern int drm_addctx(struct drm_device *dev, void *data,
1260 struct drm_file *file_priv);
1261extern int drm_getctx(struct drm_device *dev, void *data,
1262 struct drm_file *file_priv);
1263extern int drm_switchctx(struct drm_device *dev, void *data,
1264 struct drm_file *file_priv);
1265extern int drm_newctx(struct drm_device *dev, void *data,
1266 struct drm_file *file_priv);
1267extern int drm_rmctx(struct drm_device *dev, void *data,
1268 struct drm_file *file_priv);
1269
1270extern int drm_ctxbitmap_init(struct drm_device *dev);
1271extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
1272extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
1273
1274extern int drm_setsareactx(struct drm_device *dev, void *data,
1275 struct drm_file *file_priv);
1276extern int drm_getsareactx(struct drm_device *dev, void *data,
1277 struct drm_file *file_priv);
1278
1279 /* Authentication IOCTL support (drm_auth.h) */ 1218 /* Authentication IOCTL support (drm_auth.h) */
1280extern int drm_getmagic(struct drm_device *dev, void *data, 1219extern int drm_getmagic(struct drm_device *dev, void *data,
1281 struct drm_file *file_priv); 1220 struct drm_file *file_priv);
@@ -1395,17 +1334,12 @@ extern void drm_master_put(struct drm_master **master);
1395extern void drm_put_dev(struct drm_device *dev); 1334extern void drm_put_dev(struct drm_device *dev);
1396extern void drm_unplug_dev(struct drm_device *dev); 1335extern void drm_unplug_dev(struct drm_device *dev);
1397extern unsigned int drm_debug; 1336extern unsigned int drm_debug;
1398extern unsigned int drm_rnodes;
1399extern unsigned int drm_universal_planes;
1400 1337
1401extern unsigned int drm_vblank_offdelay; 1338extern unsigned int drm_vblank_offdelay;
1402extern unsigned int drm_timestamp_precision; 1339extern unsigned int drm_timestamp_precision;
1403extern unsigned int drm_timestamp_monotonic; 1340extern unsigned int drm_timestamp_monotonic;
1404 1341
1405extern struct class *drm_class; 1342extern struct class *drm_class;
1406extern struct dentry *drm_debugfs_root;
1407
1408extern struct idr drm_minors_idr;
1409 1343
1410extern struct drm_local_map *drm_getsarea(struct drm_device *dev); 1344extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1411 1345
@@ -1419,6 +1353,8 @@ extern int drm_debugfs_create_files(const struct drm_info_list *files,
1419extern int drm_debugfs_remove_files(const struct drm_info_list *files, 1353extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1420 int count, struct drm_minor *minor); 1354 int count, struct drm_minor *minor);
1421extern int drm_debugfs_cleanup(struct drm_minor *minor); 1355extern int drm_debugfs_cleanup(struct drm_minor *minor);
1356extern int drm_debugfs_connector_add(struct drm_connector *connector);
1357extern void drm_debugfs_connector_remove(struct drm_connector *connector);
1422#else 1358#else
1423static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, 1359static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1424 struct dentry *root) 1360 struct dentry *root)
@@ -1443,6 +1379,15 @@ static inline int drm_debugfs_cleanup(struct drm_minor *minor)
1443{ 1379{
1444 return 0; 1380 return 0;
1445} 1381}
1382
1383static inline int drm_debugfs_connector_add(struct drm_connector *connector)
1384{
1385 return 0;
1386}
1387static inline void drm_debugfs_connector_remove(struct drm_connector *connector)
1388{
1389}
1390
1446#endif 1391#endif
1447 1392
1448 /* Info file support */ 1393 /* Info file support */
@@ -1512,9 +1457,8 @@ extern int drm_pci_set_unique(struct drm_device *dev,
1512struct drm_sysfs_class; 1457struct drm_sysfs_class;
1513extern struct class *drm_sysfs_create(struct module *owner, char *name); 1458extern struct class *drm_sysfs_create(struct module *owner, char *name);
1514extern void drm_sysfs_destroy(void); 1459extern void drm_sysfs_destroy(void);
1515extern int drm_sysfs_device_add(struct drm_minor *minor); 1460extern struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
1516extern void drm_sysfs_hotplug_event(struct drm_device *dev); 1461extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1517extern void drm_sysfs_device_remove(struct drm_minor *minor);
1518extern int drm_sysfs_connector_add(struct drm_connector *connector); 1462extern int drm_sysfs_connector_add(struct drm_connector *connector);
1519extern void drm_sysfs_connector_remove(struct drm_connector *connector); 1463extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1520 1464
@@ -1574,7 +1518,7 @@ void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
1574int drm_gem_create_mmap_offset(struct drm_gem_object *obj); 1518int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
1575int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size); 1519int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size);
1576 1520
1577struct page **drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); 1521struct page **drm_gem_get_pages(struct drm_gem_object *obj);
1578void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, 1522void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
1579 bool dirty, bool accessed); 1523 bool dirty, bool accessed);
1580 1524
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 251b75e6bf7a..f1105d0da059 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -41,6 +41,7 @@ struct drm_framebuffer;
41struct drm_object_properties; 41struct drm_object_properties;
42struct drm_file; 42struct drm_file;
43struct drm_clip_rect; 43struct drm_clip_rect;
44struct device_node;
44 45
45#define DRM_MODE_OBJECT_CRTC 0xcccccccc 46#define DRM_MODE_OBJECT_CRTC 0xcccccccc
46#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 47#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -75,6 +76,14 @@ static inline uint64_t I642U64(int64_t val)
75 return (uint64_t)*((uint64_t *)&val); 76 return (uint64_t)*((uint64_t *)&val);
76} 77}
77 78
79/* rotation property bits */
80#define DRM_ROTATE_0 0
81#define DRM_ROTATE_90 1
82#define DRM_ROTATE_180 2
83#define DRM_ROTATE_270 3
84#define DRM_REFLECT_X 4
85#define DRM_REFLECT_Y 5
86
78enum drm_connector_force { 87enum drm_connector_force {
79 DRM_FORCE_UNSPECIFIED, 88 DRM_FORCE_UNSPECIFIED,
80 DRM_FORCE_OFF, 89 DRM_FORCE_OFF,
@@ -314,6 +323,7 @@ struct drm_crtc_funcs {
314 */ 323 */
315struct drm_crtc { 324struct drm_crtc {
316 struct drm_device *dev; 325 struct drm_device *dev;
326 struct device_node *port;
317 struct list_head head; 327 struct list_head head;
318 328
319 /** 329 /**
@@ -331,6 +341,10 @@ struct drm_crtc {
331 struct drm_plane *primary; 341 struct drm_plane *primary;
332 struct drm_plane *cursor; 342 struct drm_plane *cursor;
333 343
344 /* position of cursor plane on crtc */
345 int cursor_x;
346 int cursor_y;
347
334 /* Temporary tracking of the old fb while a modeset is ongoing. Used 348 /* Temporary tracking of the old fb while a modeset is ongoing. Used
335 * by drm_mode_set_config_internal to implement correct refcounting. */ 349 * by drm_mode_set_config_internal to implement correct refcounting. */
336 struct drm_framebuffer *old_fb; 350 struct drm_framebuffer *old_fb;
@@ -524,6 +538,8 @@ struct drm_connector {
524 struct drm_property_blob *edid_blob_ptr; 538 struct drm_property_blob *edid_blob_ptr;
525 struct drm_object_properties properties; 539 struct drm_object_properties properties;
526 540
541 struct drm_property_blob *path_blob_ptr;
542
527 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 543 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
528 544
529 /* requested DPMS state */ 545 /* requested DPMS state */
@@ -533,6 +549,7 @@ struct drm_connector {
533 549
534 /* forced on connector */ 550 /* forced on connector */
535 enum drm_connector_force force; 551 enum drm_connector_force force;
552 bool override_edid;
536 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 553 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
537 struct drm_encoder *encoder; /* currently active encoder */ 554 struct drm_encoder *encoder; /* currently active encoder */
538 555
@@ -545,6 +562,8 @@ struct drm_connector {
545 int audio_latency[2]; 562 int audio_latency[2];
546 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ 563 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
547 unsigned bad_edid_counter; 564 unsigned bad_edid_counter;
565
566 struct dentry *debugfs_entry;
548}; 567};
549 568
550/** 569/**
@@ -800,6 +819,7 @@ struct drm_mode_config {
800 struct list_head property_blob_list; 819 struct list_head property_blob_list;
801 struct drm_property *edid_property; 820 struct drm_property *edid_property;
802 struct drm_property *dpms_property; 821 struct drm_property *dpms_property;
822 struct drm_property *path_property;
803 struct drm_property *plane_type_property; 823 struct drm_property *plane_type_property;
804 824
805 /* DVI-I properties */ 825 /* DVI-I properties */
@@ -823,6 +843,7 @@ struct drm_mode_config {
823 843
824 /* Optional properties */ 844 /* Optional properties */
825 struct drm_property *scaling_mode_property; 845 struct drm_property *scaling_mode_property;
846 struct drm_property *aspect_ratio_property;
826 struct drm_property *dirty_info_property; 847 struct drm_property *dirty_info_property;
827 848
828 /* dumb ioctl parameters */ 849 /* dumb ioctl parameters */
@@ -852,7 +873,7 @@ struct drm_prop_enum_list {
852extern int drm_crtc_init_with_planes(struct drm_device *dev, 873extern int drm_crtc_init_with_planes(struct drm_device *dev,
853 struct drm_crtc *crtc, 874 struct drm_crtc *crtc,
854 struct drm_plane *primary, 875 struct drm_plane *primary,
855 void *cursor, 876 struct drm_plane *cursor,
856 const struct drm_crtc_funcs *funcs); 877 const struct drm_crtc_funcs *funcs);
857extern int drm_crtc_init(struct drm_device *dev, 878extern int drm_crtc_init(struct drm_device *dev,
858 struct drm_crtc *crtc, 879 struct drm_crtc *crtc,
@@ -878,6 +899,8 @@ extern int drm_connector_init(struct drm_device *dev,
878 struct drm_connector *connector, 899 struct drm_connector *connector,
879 const struct drm_connector_funcs *funcs, 900 const struct drm_connector_funcs *funcs,
880 int connector_type); 901 int connector_type);
902int drm_connector_register(struct drm_connector *connector);
903void drm_connector_unregister(struct drm_connector *connector);
881 904
882extern void drm_connector_cleanup(struct drm_connector *connector); 905extern void drm_connector_cleanup(struct drm_connector *connector);
883/* helper to unplug all connectors from sysfs for device */ 906/* helper to unplug all connectors from sysfs for device */
@@ -937,6 +960,7 @@ extern const char *drm_get_tv_select_name(int val);
937extern void drm_fb_release(struct drm_file *file_priv); 960extern void drm_fb_release(struct drm_file *file_priv);
938extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 961extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
939extern void drm_mode_group_destroy(struct drm_mode_group *group); 962extern void drm_mode_group_destroy(struct drm_mode_group *group);
963extern void drm_reinit_primary_mode_group(struct drm_device *dev);
940extern bool drm_probe_ddc(struct i2c_adapter *adapter); 964extern bool drm_probe_ddc(struct i2c_adapter *adapter);
941extern struct edid *drm_get_edid(struct drm_connector *connector, 965extern struct edid *drm_get_edid(struct drm_connector *connector,
942 struct i2c_adapter *adapter); 966 struct i2c_adapter *adapter);
@@ -946,6 +970,8 @@ extern void drm_mode_config_init(struct drm_device *dev);
946extern void drm_mode_config_reset(struct drm_device *dev); 970extern void drm_mode_config_reset(struct drm_device *dev);
947extern void drm_mode_config_cleanup(struct drm_device *dev); 971extern void drm_mode_config_cleanup(struct drm_device *dev);
948 972
973extern int drm_mode_connector_set_path_property(struct drm_connector *connector,
974 char *path);
949extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 975extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
950 struct edid *edid); 976 struct edid *edid);
951 977
@@ -994,7 +1020,8 @@ extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int
994struct drm_property *drm_property_create_bitmask(struct drm_device *dev, 1020struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
995 int flags, const char *name, 1021 int flags, const char *name,
996 const struct drm_prop_enum_list *props, 1022 const struct drm_prop_enum_list *props,
997 int num_values); 1023 int num_props,
1024 uint64_t supported_bits);
998struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 1025struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
999 const char *name, 1026 const char *name,
1000 uint64_t min, uint64_t max); 1027 uint64_t min, uint64_t max);
@@ -1010,6 +1037,7 @@ extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1010extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, 1037extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
1011 char *formats[]); 1038 char *formats[]);
1012extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1039extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1040extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1013extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1041extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1014 1042
1015extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1043extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
@@ -1100,6 +1128,10 @@ extern int drm_format_plane_cpp(uint32_t format, int plane);
1100extern int drm_format_horz_chroma_subsampling(uint32_t format); 1128extern int drm_format_horz_chroma_subsampling(uint32_t format);
1101extern int drm_format_vert_chroma_subsampling(uint32_t format); 1129extern int drm_format_vert_chroma_subsampling(uint32_t format);
1102extern const char *drm_get_format_name(uint32_t format); 1130extern const char *drm_get_format_name(uint32_t format);
1131extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
1132 unsigned int supported_rotations);
1133extern unsigned int drm_rotation_simplify(unsigned int rotation,
1134 unsigned int supported_rotations);
1103 1135
1104/* Helpers */ 1136/* Helpers */
1105 1137
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
new file mode 100644
index 000000000000..9b446ada2532
--- /dev/null
+++ b/include/drm/drm_dp_mst_helper.h
@@ -0,0 +1,509 @@
1/*
2 * Copyright © 2014 Red Hat.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22#ifndef _DRM_DP_MST_HELPER_H_
23#define _DRM_DP_MST_HELPER_H_
24
25#include <linux/types.h>
26#include <drm/drm_dp_helper.h>
27
28struct drm_dp_mst_branch;
29
30/**
31 * struct drm_dp_vcpi - Virtual Channel Payload Identifer
32 * @vcpi: Virtual channel ID.
33 * @pbn: Payload Bandwidth Number for this channel
34 * @aligned_pbn: PBN aligned with slot size
35 * @num_slots: number of slots for this PBN
36 */
37struct drm_dp_vcpi {
38 int vcpi;
39 int pbn;
40 int aligned_pbn;
41 int num_slots;
42};
43
44/**
45 * struct drm_dp_mst_port - MST port
46 * @kref: reference count for this port.
47 * @guid_valid: for DP 1.2 devices if we have validated the GUID.
48 * @guid: guid for DP 1.2 device on this port.
49 * @port_num: port number
50 * @input: if this port is an input port.
51 * @mcs: message capability status - DP 1.2 spec.
52 * @ddps: DisplayPort Device Plug Status - DP 1.2
53 * @pdt: Peer Device Type
54 * @ldps: Legacy Device Plug Status
55 * @dpcd_rev: DPCD revision of device on this port
56 * @num_sdp_streams: Number of simultaneous streams
57 * @num_sdp_stream_sinks: Number of stream sinks
58 * @available_pbn: Available bandwidth for this port.
59 * @next: link to next port on this branch device
60 * @mstb: branch device attach below this port
61 * @aux: i2c aux transport to talk to device connected to this port.
62 * @parent: branch device parent of this port
63 * @vcpi: Virtual Channel Payload info for this port.
64 * @connector: DRM connector this port is connected to.
65 * @mgr: topology manager this port lives under.
66 *
67 * This structure represents an MST port endpoint on a device somewhere
68 * in the MST topology.
69 */
70struct drm_dp_mst_port {
71 struct kref kref;
72
73 /* if dpcd 1.2 device is on this port - its GUID info */
74 bool guid_valid;
75 u8 guid[16];
76
77 u8 port_num;
78 bool input;
79 bool mcs;
80 bool ddps;
81 u8 pdt;
82 bool ldps;
83 u8 dpcd_rev;
84 u8 num_sdp_streams;
85 u8 num_sdp_stream_sinks;
86 uint16_t available_pbn;
87 struct list_head next;
88 struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */
89 struct drm_dp_aux aux; /* i2c bus for this port? */
90 struct drm_dp_mst_branch *parent;
91
92 struct drm_dp_vcpi vcpi;
93 struct drm_connector *connector;
94 struct drm_dp_mst_topology_mgr *mgr;
95};
96
97/**
98 * struct drm_dp_mst_branch - MST branch device.
99 * @kref: reference count for this port.
100 * @rad: Relative Address to talk to this branch device.
101 * @lct: Link count total to talk to this branch device.
102 * @num_ports: number of ports on the branch.
103 * @msg_slots: one bit per transmitted msg slot.
104 * @ports: linked list of ports on this branch.
105 * @port_parent: pointer to the port parent, NULL if toplevel.
106 * @mgr: topology manager for this branch device.
107 * @tx_slots: transmission slots for this device.
108 * @last_seqno: last sequence number used to talk to this.
109 * @link_address_sent: if a link address message has been sent to this device yet.
110 *
111 * This structure represents an MST branch device, there is one
112 * primary branch device at the root, along with any others connected
113 * to downstream ports
114 */
115struct drm_dp_mst_branch {
116 struct kref kref;
117 u8 rad[8];
118 u8 lct;
119 int num_ports;
120
121 int msg_slots;
122 struct list_head ports;
123
124 /* list of tx ops queue for this port */
125 struct drm_dp_mst_port *port_parent;
126 struct drm_dp_mst_topology_mgr *mgr;
127
128 /* slots are protected by mstb->mgr->qlock */
129 struct drm_dp_sideband_msg_tx *tx_slots[2];
130 int last_seqno;
131 bool link_address_sent;
132};
133
134
135/* sideband msg header - not bit struct */
136struct drm_dp_sideband_msg_hdr {
137 u8 lct;
138 u8 lcr;
139 u8 rad[8];
140 bool broadcast;
141 bool path_msg;
142 u8 msg_len;
143 bool somt;
144 bool eomt;
145 bool seqno;
146};
147
148struct drm_dp_nak_reply {
149 u8 guid[16];
150 u8 reason;
151 u8 nak_data;
152};
153
154struct drm_dp_link_address_ack_reply {
155 u8 guid[16];
156 u8 nports;
157 struct drm_dp_link_addr_reply_port {
158 bool input_port;
159 u8 peer_device_type;
160 u8 port_number;
161 bool mcs;
162 bool ddps;
163 bool legacy_device_plug_status;
164 u8 dpcd_revision;
165 u8 peer_guid[16];
166 u8 num_sdp_streams;
167 u8 num_sdp_stream_sinks;
168 } ports[16];
169};
170
171struct drm_dp_remote_dpcd_read_ack_reply {
172 u8 port_number;
173 u8 num_bytes;
174 u8 bytes[255];
175};
176
177struct drm_dp_remote_dpcd_write_ack_reply {
178 u8 port_number;
179};
180
181struct drm_dp_remote_dpcd_write_nak_reply {
182 u8 port_number;
183 u8 reason;
184 u8 bytes_written_before_failure;
185};
186
187struct drm_dp_remote_i2c_read_ack_reply {
188 u8 port_number;
189 u8 num_bytes;
190 u8 bytes[255];
191};
192
193struct drm_dp_remote_i2c_read_nak_reply {
194 u8 port_number;
195 u8 nak_reason;
196 u8 i2c_nak_transaction;
197};
198
199struct drm_dp_remote_i2c_write_ack_reply {
200 u8 port_number;
201};
202
203
204struct drm_dp_sideband_msg_rx {
205 u8 chunk[48];
206 u8 msg[256];
207 u8 curchunk_len;
208 u8 curchunk_idx; /* chunk we are parsing now */
209 u8 curchunk_hdrlen;
210 u8 curlen; /* total length of the msg */
211 bool have_somt;
212 bool have_eomt;
213 struct drm_dp_sideband_msg_hdr initial_hdr;
214};
215
216
217struct drm_dp_allocate_payload {
218 u8 port_number;
219 u8 number_sdp_streams;
220 u8 vcpi;
221 u16 pbn;
222 u8 sdp_stream_sink[8];
223};
224
225struct drm_dp_allocate_payload_ack_reply {
226 u8 port_number;
227 u8 vcpi;
228 u16 allocated_pbn;
229};
230
231struct drm_dp_connection_status_notify {
232 u8 guid[16];
233 u8 port_number;
234 bool legacy_device_plug_status;
235 bool displayport_device_plug_status;
236 bool message_capability_status;
237 bool input_port;
238 u8 peer_device_type;
239};
240
241struct drm_dp_remote_dpcd_read {
242 u8 port_number;
243 u32 dpcd_address;
244 u8 num_bytes;
245};
246
247struct drm_dp_remote_dpcd_write {
248 u8 port_number;
249 u32 dpcd_address;
250 u8 num_bytes;
251 u8 *bytes;
252};
253
254struct drm_dp_remote_i2c_read {
255 u8 num_transactions;
256 u8 port_number;
257 struct {
258 u8 i2c_dev_id;
259 u8 num_bytes;
260 u8 *bytes;
261 u8 no_stop_bit;
262 u8 i2c_transaction_delay;
263 } transactions[4];
264 u8 read_i2c_device_id;
265 u8 num_bytes_read;
266};
267
268struct drm_dp_remote_i2c_write {
269 u8 port_number;
270 u8 write_i2c_device_id;
271 u8 num_bytes;
272 u8 *bytes;
273};
274
275/* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */
276struct drm_dp_port_number_req {
277 u8 port_number;
278};
279
280struct drm_dp_enum_path_resources_ack_reply {
281 u8 port_number;
282 u16 full_payload_bw_number;
283 u16 avail_payload_bw_number;
284};
285
286/* covers POWER_DOWN_PHY, POWER_UP_PHY */
287struct drm_dp_port_number_rep {
288 u8 port_number;
289};
290
291struct drm_dp_query_payload {
292 u8 port_number;
293 u8 vcpi;
294};
295
296struct drm_dp_resource_status_notify {
297 u8 port_number;
298 u8 guid[16];
299 u16 available_pbn;
300};
301
302struct drm_dp_query_payload_ack_reply {
303 u8 port_number;
304 u8 allocated_pbn;
305};
306
307struct drm_dp_sideband_msg_req_body {
308 u8 req_type;
309 union ack_req {
310 struct drm_dp_connection_status_notify conn_stat;
311 struct drm_dp_port_number_req port_num;
312 struct drm_dp_resource_status_notify resource_stat;
313
314 struct drm_dp_query_payload query_payload;
315 struct drm_dp_allocate_payload allocate_payload;
316
317 struct drm_dp_remote_dpcd_read dpcd_read;
318 struct drm_dp_remote_dpcd_write dpcd_write;
319
320 struct drm_dp_remote_i2c_read i2c_read;
321 struct drm_dp_remote_i2c_write i2c_write;
322 } u;
323};
324
325struct drm_dp_sideband_msg_reply_body {
326 u8 reply_type;
327 u8 req_type;
328 union ack_replies {
329 struct drm_dp_nak_reply nak;
330 struct drm_dp_link_address_ack_reply link_addr;
331 struct drm_dp_port_number_rep port_number;
332
333 struct drm_dp_enum_path_resources_ack_reply path_resources;
334 struct drm_dp_allocate_payload_ack_reply allocate_payload;
335 struct drm_dp_query_payload_ack_reply query_payload;
336
337 struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack;
338 struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack;
339 struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack;
340
341 struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack;
342 struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack;
343 struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack;
344 } u;
345};
346
347/* msg is queued to be put into a slot */
348#define DRM_DP_SIDEBAND_TX_QUEUED 0
349/* msg has started transmitting on a slot - still on msgq */
350#define DRM_DP_SIDEBAND_TX_START_SEND 1
351/* msg has finished transmitting on a slot - removed from msgq only in slot */
352#define DRM_DP_SIDEBAND_TX_SENT 2
353/* msg has received a response - removed from slot */
354#define DRM_DP_SIDEBAND_TX_RX 3
355#define DRM_DP_SIDEBAND_TX_TIMEOUT 4
356
357struct drm_dp_sideband_msg_tx {
358 u8 msg[256];
359 u8 chunk[48];
360 u8 cur_offset;
361 u8 cur_len;
362 struct drm_dp_mst_branch *dst;
363 struct list_head next;
364 int seqno;
365 int state;
366 bool path_msg;
367 struct drm_dp_sideband_msg_reply_body reply;
368};
369
370/* sideband msg handler */
371struct drm_dp_mst_topology_mgr;
372struct drm_dp_mst_topology_cbs {
373 /* create a connector for a port */
374 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, char *path);
375 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
376 struct drm_connector *connector);
377 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr);
378
379};
380
381#define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8)
382
383#define DP_PAYLOAD_LOCAL 1
384#define DP_PAYLOAD_REMOTE 2
385#define DP_PAYLOAD_DELETE_LOCAL 3
386
387struct drm_dp_payload {
388 int payload_state;
389 int start_slot;
390 int num_slots;
391};
392
393/**
394 * struct drm_dp_mst_topology_mgr - DisplayPort MST manager
395 * @dev: device pointer for adding i2c devices etc.
396 * @cbs: callbacks for connector addition and destruction.
397 * @max_dpcd_transaction_bytes - maximum number of bytes to read/write in one go.
398 * @aux: aux channel for the DP connector.
399 * @max_payloads: maximum number of payloads the GPU can generate.
400 * @conn_base_id: DRM connector ID this mgr is connected to.
401 * @down_rep_recv: msg receiver state for down replies.
402 * @up_req_recv: msg receiver state for up requests.
403 * @lock: protects mst state, primary, guid, dpcd.
404 * @mst_state: if this manager is enabled for an MST capable port.
405 * @mst_primary: pointer to the primary branch device.
406 * @guid_valid: GUID valid for the primary branch device.
407 * @guid: GUID for primary port.
408 * @dpcd: cache of DPCD for primary port.
409 * @pbn_div: PBN to slots divisor.
410 *
411 * This struct represents the toplevel displayport MST topology manager.
412 * There should be one instance of this for every MST capable DP connector
413 * on the GPU.
414 */
415struct drm_dp_mst_topology_mgr {
416
417 struct device *dev;
418 struct drm_dp_mst_topology_cbs *cbs;
419 int max_dpcd_transaction_bytes;
420 struct drm_dp_aux *aux; /* auxch for this topology mgr to use */
421 int max_payloads;
422 int conn_base_id;
423
424 /* only ever accessed from the workqueue - which should be serialised */
425 struct drm_dp_sideband_msg_rx down_rep_recv;
426 struct drm_dp_sideband_msg_rx up_req_recv;
427
428 /* pointer to info about the initial MST device */
429 struct mutex lock; /* protects mst_state + primary + guid + dpcd */
430
431 bool mst_state;
432 struct drm_dp_mst_branch *mst_primary;
433 /* primary MST device GUID */
434 bool guid_valid;
435 u8 guid[16];
436 u8 dpcd[DP_RECEIVER_CAP_SIZE];
437 u8 sink_count;
438 int pbn_div;
439 int total_slots;
440 int avail_slots;
441 int total_pbn;
442
443 /* messages to be transmitted */
444 /* qlock protects the upq/downq and in_progress,
445 the mstb tx_slots and txmsg->state once they are queued */
446 struct mutex qlock;
447 struct list_head tx_msg_downq;
448 struct list_head tx_msg_upq;
449 bool tx_down_in_progress;
450 bool tx_up_in_progress;
451
452 /* payload info + lock for it */
453 struct mutex payload_lock;
454 struct drm_dp_vcpi **proposed_vcpis;
455 struct drm_dp_payload *payloads;
456 unsigned long payload_mask;
457
458 wait_queue_head_t tx_waitq;
459 struct work_struct work;
460
461 struct work_struct tx_work;
462};
463
464int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id);
465
466void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr);
467
468
469int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state);
470
471
472int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled);
473
474
475enum drm_connector_status drm_dp_mst_detect_port(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
476
477struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
478
479
480int drm_dp_calc_pbn_mode(int clock, int bpp);
481
482
483bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);
484
485
486void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
487
488
489void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
490 struct drm_dp_mst_port *port);
491
492
493int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
494 int pbn);
495
496
497int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
498
499
500int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr);
501
502int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr);
503
504void drm_dp_mst_dump_topology(struct seq_file *m,
505 struct drm_dp_mst_topology_mgr *mgr);
506
507void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
508int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
509#endif
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 7997246d4039..bfd329d613c4 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -86,8 +86,9 @@ struct drm_fb_helper {
86 int crtc_count; 86 int crtc_count;
87 struct drm_fb_helper_crtc *crtc_info; 87 struct drm_fb_helper_crtc *crtc_info;
88 int connector_count; 88 int connector_count;
89 int connector_info_alloc_count;
89 struct drm_fb_helper_connector **connector_info; 90 struct drm_fb_helper_connector **connector_info;
90 struct drm_fb_helper_funcs *funcs; 91 const struct drm_fb_helper_funcs *funcs;
91 struct fb_info *fbdev; 92 struct fb_info *fbdev;
92 u32 pseudo_palette[17]; 93 u32 pseudo_palette[17];
93 struct list_head kernel_fb_list; 94 struct list_head kernel_fb_list;
@@ -97,6 +98,8 @@ struct drm_fb_helper {
97 bool delayed_hotplug; 98 bool delayed_hotplug;
98}; 99};
99 100
101void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
102 const struct drm_fb_helper_funcs *funcs);
100int drm_fb_helper_init(struct drm_device *dev, 103int drm_fb_helper_init(struct drm_device *dev,
101 struct drm_fb_helper *helper, int crtc_count, 104 struct drm_fb_helper *helper, int crtc_count,
102 int max_conn); 105 int max_conn);
@@ -128,4 +131,7 @@ struct drm_display_mode *
128drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, 131drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
129 int width, int height); 132 int width, int height);
130 133
134int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector);
135int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
136 struct drm_connector *connector);
131#endif 137#endif
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 944f33f8ba38..2bb55b8b9031 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -94,6 +94,8 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
94#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8) 94#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
95/* disable EoT packets in HS mode */ 95/* disable EoT packets in HS mode */
96#define MIPI_DSI_MODE_EOT_PACKET BIT(9) 96#define MIPI_DSI_MODE_EOT_PACKET BIT(9)
97/* device supports non-continuous clock behavior (DSI spec 5.6.1) */
98#define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10)
97 99
98enum mipi_dsi_pixel_format { 100enum mipi_dsi_pixel_format {
99 MIPI_DSI_FMT_RGB888, 101 MIPI_DSI_FMT_RGB888,
@@ -121,14 +123,17 @@ struct mipi_dsi_device {
121 unsigned long mode_flags; 123 unsigned long mode_flags;
122}; 124};
123 125
124#define to_mipi_dsi_device(d) container_of(d, struct mipi_dsi_device, dev) 126static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
127{
128 return container_of(dev, struct mipi_dsi_device, dev);
129}
125 130
126int mipi_dsi_attach(struct mipi_dsi_device *dsi); 131int mipi_dsi_attach(struct mipi_dsi_device *dsi);
127int mipi_dsi_detach(struct mipi_dsi_device *dsi); 132int mipi_dsi_detach(struct mipi_dsi_device *dsi);
128int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel, 133ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
129 const void *data, size_t len); 134 size_t len);
130ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel, 135ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
131 u8 cmd, void *data, size_t len); 136 size_t len);
132 137
133/** 138/**
134 * struct mipi_dsi_driver - DSI driver 139 * struct mipi_dsi_driver - DSI driver
@@ -144,7 +149,11 @@ struct mipi_dsi_driver {
144 void (*shutdown)(struct mipi_dsi_device *dsi); 149 void (*shutdown)(struct mipi_dsi_device *dsi);
145}; 150};
146 151
147#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 152static inline struct mipi_dsi_driver *
153to_mipi_dsi_driver(struct device_driver *driver)
154{
155 return container_of(driver, struct mipi_dsi_driver, driver);
156}
148 157
149static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi) 158static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi)
150{ 159{
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
new file mode 100644
index 000000000000..2441f7112074
--- /dev/null
+++ b/include/drm/drm_of.h
@@ -0,0 +1,18 @@
1#ifndef __DRM_OF_H__
2#define __DRM_OF_H__
3
4struct drm_device;
5struct device_node;
6
7#ifdef CONFIG_OF
8extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
9 struct device_node *port);
10#else
11static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
12 struct device_node *port)
13{
14 return 0;
15}
16#endif
17
18#endif /* __DRM_OF_H__ */
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index c2ab77add67c..1fbcc96063a7 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -30,8 +30,42 @@ struct drm_connector;
30struct drm_device; 30struct drm_device;
31struct drm_panel; 31struct drm_panel;
32 32
33/**
34 * struct drm_panel_funcs - perform operations on a given panel
35 * @disable: disable panel (turn off back light, etc.)
36 * @unprepare: turn off panel
37 * @prepare: turn on panel and perform set up
38 * @enable: enable panel (turn on back light, etc.)
39 * @get_modes: add modes to the connector that the panel is attached to and
40 * return the number of modes added
41 *
42 * The .prepare() function is typically called before the display controller
43 * starts to transmit video data. Panel drivers can use this to turn the panel
44 * on and wait for it to become ready. If additional configuration is required
45 * (via a control bus such as I2C, SPI or DSI for example) this is a good time
46 * to do that.
47 *
48 * After the display controller has started transmitting video data, it's safe
49 * to call the .enable() function. This will typically enable the backlight to
50 * make the image on screen visible. Some panels require a certain amount of
51 * time or frames before the image is displayed. This function is responsible
52 * for taking this into account before enabling the backlight to avoid visual
53 * glitches.
54 *
55 * Before stopping video transmission from the display controller it can be
56 * necessary to turn off the panel to avoid visual glitches. This is done in
57 * the .disable() function. Analogously to .enable() this typically involves
58 * turning off the backlight and waiting for some time to make sure no image
59 * is visible on the panel. It is then safe for the display controller to
60 * cease transmission of video data.
61 *
62 * To save power when no video data is transmitted, a driver can power down
63 * the panel. This is the job of the .unprepare() function.
64 */
33struct drm_panel_funcs { 65struct drm_panel_funcs {
34 int (*disable)(struct drm_panel *panel); 66 int (*disable)(struct drm_panel *panel);
67 int (*unprepare)(struct drm_panel *panel);
68 int (*prepare)(struct drm_panel *panel);
35 int (*enable)(struct drm_panel *panel); 69 int (*enable)(struct drm_panel *panel);
36 int (*get_modes)(struct drm_panel *panel); 70 int (*get_modes)(struct drm_panel *panel);
37}; 71};
@@ -46,6 +80,14 @@ struct drm_panel {
46 struct list_head list; 80 struct list_head list;
47}; 81};
48 82
83static inline int drm_panel_unprepare(struct drm_panel *panel)
84{
85 if (panel && panel->funcs && panel->funcs->unprepare)
86 return panel->funcs->unprepare(panel);
87
88 return panel ? -ENOSYS : -EINVAL;
89}
90
49static inline int drm_panel_disable(struct drm_panel *panel) 91static inline int drm_panel_disable(struct drm_panel *panel)
50{ 92{
51 if (panel && panel->funcs && panel->funcs->disable) 93 if (panel && panel->funcs && panel->funcs->disable)
@@ -54,6 +96,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)
54 return panel ? -ENOSYS : -EINVAL; 96 return panel ? -ENOSYS : -EINVAL;
55} 97}
56 98
99static inline int drm_panel_prepare(struct drm_panel *panel)
100{
101 if (panel && panel->funcs && panel->funcs->prepare)
102 return panel->funcs->prepare(panel);
103
104 return panel ? -ENOSYS : -EINVAL;
105}
106
57static inline int drm_panel_enable(struct drm_panel *panel) 107static inline int drm_panel_enable(struct drm_panel *panel)
58{ 108{
59 if (panel && panel->funcs && panel->funcs->enable) 109 if (panel && panel->funcs && panel->funcs->enable)
@@ -62,6 +112,14 @@ static inline int drm_panel_enable(struct drm_panel *panel)
62 return panel ? -ENOSYS : -EINVAL; 112 return panel ? -ENOSYS : -EINVAL;
63} 113}
64 114
115static inline int drm_panel_get_modes(struct drm_panel *panel)
116{
117 if (panel && panel->funcs && panel->funcs->get_modes)
118 return panel->funcs->get_modes(panel);
119
120 return panel ? -ENOSYS : -EINVAL;
121}
122
65void drm_panel_init(struct drm_panel *panel); 123void drm_panel_init(struct drm_panel *panel);
66 124
67int drm_panel_add(struct drm_panel *panel); 125int drm_panel_add(struct drm_panel *panel);
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index d1286297567b..26bb55e9e8b6 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -163,5 +163,11 @@ int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
163 struct drm_rect *dst, 163 struct drm_rect *dst,
164 int min_vscale, int max_vscale); 164 int min_vscale, int max_vscale);
165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); 165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point);
166void drm_rect_rotate(struct drm_rect *r,
167 int width, int height,
168 unsigned int rotation);
169void drm_rect_rotate_inv(struct drm_rect *r,
170 int width, int height,
171 unsigned int rotation);
166 172
167#endif 173#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index a5183da3ef92..1d9f0f1ff52d 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -133,6 +133,7 @@ struct ttm_tt {
133 * struct ttm_dma_tt 133 * struct ttm_dma_tt
134 * 134 *
135 * @ttm: Base ttm_tt struct. 135 * @ttm: Base ttm_tt struct.
136 * @cpu_address: The CPU address of the pages
136 * @dma_address: The DMA (bus) addresses of the pages 137 * @dma_address: The DMA (bus) addresses of the pages
137 * @pages_list: used by some page allocation backend 138 * @pages_list: used by some page allocation backend
138 * 139 *
@@ -142,6 +143,7 @@ struct ttm_tt {
142 */ 143 */
143struct ttm_dma_tt { 144struct ttm_dma_tt {
144 struct ttm_tt ttm; 145 struct ttm_tt ttm;
146 void **cpu_address;
145 dma_addr_t *dma_address; 147 dma_addr_t *dma_address;
146 struct list_head pages_list; 148 struct list_head pages_list;
147}; 149};
@@ -182,6 +184,7 @@ struct ttm_mem_type_manager_func {
182 * @man: Pointer to a memory type manager. 184 * @man: Pointer to a memory type manager.
183 * @bo: Pointer to the buffer object we're allocating space for. 185 * @bo: Pointer to the buffer object we're allocating space for.
184 * @placement: Placement details. 186 * @placement: Placement details.
187 * @flags: Additional placement flags.
185 * @mem: Pointer to a struct ttm_mem_reg to be filled in. 188 * @mem: Pointer to a struct ttm_mem_reg to be filled in.
186 * 189 *
187 * This function should allocate space in the memory type managed 190 * This function should allocate space in the memory type managed
@@ -206,6 +209,7 @@ struct ttm_mem_type_manager_func {
206 int (*get_node)(struct ttm_mem_type_manager *man, 209 int (*get_node)(struct ttm_mem_type_manager *man,
207 struct ttm_buffer_object *bo, 210 struct ttm_buffer_object *bo,
208 struct ttm_placement *placement, 211 struct ttm_placement *placement,
212 uint32_t flags,
209 struct ttm_mem_reg *mem); 213 struct ttm_mem_reg *mem);
210 214
211 /** 215 /**
@@ -653,18 +657,6 @@ extern void ttm_tt_unbind(struct ttm_tt *ttm);
653extern int ttm_tt_swapin(struct ttm_tt *ttm); 657extern int ttm_tt_swapin(struct ttm_tt *ttm);
654 658
655/** 659/**
656 * ttm_tt_cache_flush:
657 *
658 * @pages: An array of pointers to struct page:s to flush.
659 * @num_pages: Number of pages to flush.
660 *
661 * Flush the data of the indicated pages from the cpu caches.
662 * This is used when changing caching attributes of the pages from
663 * cache-coherent.
664 */
665extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
666
667/**
668 * ttm_tt_set_placement_caching: 660 * ttm_tt_set_placement_caching:
669 * 661 *
670 * @ttm A struct ttm_tt the backing pages of which will change caching policy. 662 * @ttm A struct ttm_tt the backing pages of which will change caching policy.
diff --git a/include/dt-bindings/clock/clps711x-clock.h b/include/dt-bindings/clock/clps711x-clock.h
new file mode 100644
index 000000000000..0c4c80b63242
--- /dev/null
+++ b/include/dt-bindings/clock/clps711x-clock.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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
10#ifndef __DT_BINDINGS_CLOCK_CLPS711X_H
11#define __DT_BINDINGS_CLOCK_CLPS711X_H
12
13#define CLPS711X_CLK_DUMMY 0
14#define CLPS711X_CLK_CPU 1
15#define CLPS711X_CLK_BUS 2
16#define CLPS711X_CLK_PLL 3
17#define CLPS711X_CLK_TIMERREF 4
18#define CLPS711X_CLK_TIMER1 5
19#define CLPS711X_CLK_TIMER2 6
20#define CLPS711X_CLK_PWM 7
21#define CLPS711X_CLK_SPIREF 8
22#define CLPS711X_CLK_SPI 9
23#define CLPS711X_CLK_UART 10
24#define CLPS711X_CLK_TICK 11
25#define CLPS711X_CLK_MAX 12
26
27#endif
diff --git a/include/dt-bindings/clock/exynos4.h b/include/dt-bindings/clock/exynos4.h
index 1106ca540a96..459bd2bd411f 100644
--- a/include/dt-bindings/clock/exynos4.h
+++ b/include/dt-bindings/clock/exynos4.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda@samsung.com> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
@@ -34,6 +34,11 @@
34#define CLK_MOUT_CORE 19 34#define CLK_MOUT_CORE 19
35#define CLK_MOUT_APLL 20 35#define CLK_MOUT_APLL 20
36#define CLK_SCLK_HDMIPHY 22 36#define CLK_SCLK_HDMIPHY 22
37#define CLK_OUT_DMC 23
38#define CLK_OUT_TOP 24
39#define CLK_OUT_LEFTBUS 25
40#define CLK_OUT_RIGHTBUS 26
41#define CLK_OUT_CPU 27
37 42
38/* gate for special clocks (sclk) */ 43/* gate for special clocks (sclk) */
39#define CLK_SCLK_FIMC0 128 44#define CLK_SCLK_FIMC0 128
@@ -230,6 +235,24 @@
230#define CLK_MOUT_G3D 394 235#define CLK_MOUT_G3D 394
231#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */ 236#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */
232 237
238/* gate clocks - ppmu */
239#define CLK_PPMULEFT 400
240#define CLK_PPMURIGHT 401
241#define CLK_PPMUCAMIF 402
242#define CLK_PPMUTV 403
243#define CLK_PPMUMFC_L 404
244#define CLK_PPMUMFC_R 405
245#define CLK_PPMUG3D 406
246#define CLK_PPMUIMAGE 407
247#define CLK_PPMULCD0 408
248#define CLK_PPMULCD1 409 /* Exynos4210 only */
249#define CLK_PPMUFILE 410
250#define CLK_PPMUGPS 411
251#define CLK_PPMUDMC0 412
252#define CLK_PPMUDMC1 413
253#define CLK_PPMUCPU 414
254#define CLK_PPMUACP 415
255
233/* div clocks */ 256/* div clocks */
234#define CLK_DIV_ISP0 450 /* Exynos4x12 only */ 257#define CLK_DIV_ISP0 450 /* Exynos4x12 only */
235#define CLK_DIV_ISP1 451 /* Exynos4x12 only */ 258#define CLK_DIV_ISP1 451 /* Exynos4x12 only */
diff --git a/include/dt-bindings/clock/exynos5250.h b/include/dt-bindings/clock/exynos5250.h
index be6e97c54f54..4273891dc78e 100644
--- a/include/dt-bindings/clock/exynos5250.h
+++ b/include/dt-bindings/clock/exynos5250.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda@samsung.com> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/dt-bindings/clock/exynos5420.h b/include/dt-bindings/clock/exynos5420.h
index 21d51ae1d242..8dc0913f1775 100644
--- a/include/dt-bindings/clock/exynos5420.h
+++ b/include/dt-bindings/clock/exynos5420.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda@samsung.com> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/dt-bindings/clock/exynos5440.h b/include/dt-bindings/clock/exynos5440.h
index 70cd85077fa9..c66fc405a79a 100644
--- a/include/dt-bindings/clock/exynos5440.h
+++ b/include/dt-bindings/clock/exynos5440.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Andrzej Haja <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 3 * Author: Andrzej Hajda <a.hajda@samsung.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/dt-bindings/clock/imx1-clock.h b/include/dt-bindings/clock/imx1-clock.h
new file mode 100644
index 000000000000..607bf01a31dd
--- /dev/null
+++ b/include/dt-bindings/clock/imx1-clock.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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
10#ifndef __DT_BINDINGS_CLOCK_IMX1_H
11#define __DT_BINDINGS_CLOCK_IMX1_H
12
13#define IMX1_CLK_DUMMY 0
14#define IMX1_CLK_CLK32 1
15#define IMX1_CLK_CLK16M_EXT 2
16#define IMX1_CLK_CLK16M 3
17#define IMX1_CLK_CLK32_PREMULT 4
18#define IMX1_CLK_PREM 5
19#define IMX1_CLK_MPLL 6
20#define IMX1_CLK_MPLL_GATE 7
21#define IMX1_CLK_SPLL 8
22#define IMX1_CLK_SPLL_GATE 9
23#define IMX1_CLK_MCU 10
24#define IMX1_CLK_FCLK 11
25#define IMX1_CLK_HCLK 12
26#define IMX1_CLK_CLK48M 13
27#define IMX1_CLK_PER1 14
28#define IMX1_CLK_PER2 15
29#define IMX1_CLK_PER3 16
30#define IMX1_CLK_CLKO 17
31#define IMX1_CLK_UART3_GATE 18
32#define IMX1_CLK_SSI2_GATE 19
33#define IMX1_CLK_BROM_GATE 20
34#define IMX1_CLK_DMA_GATE 21
35#define IMX1_CLK_CSI_GATE 22
36#define IMX1_CLK_MMA_GATE 23
37#define IMX1_CLK_USBD_GATE 24
38#define IMX1_CLK_MAX 25
39
40#endif
diff --git a/include/dt-bindings/clock/imx21-clock.h b/include/dt-bindings/clock/imx21-clock.h
new file mode 100644
index 000000000000..b13596cf51b2
--- /dev/null
+++ b/include/dt-bindings/clock/imx21-clock.h
@@ -0,0 +1,80 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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
10#ifndef __DT_BINDINGS_CLOCK_IMX21_H
11#define __DT_BINDINGS_CLOCK_IMX21_H
12
13#define IMX21_CLK_DUMMY 0
14#define IMX21_CLK_CKIL 1
15#define IMX21_CLK_CKIH 2
16#define IMX21_CLK_FPM 3
17#define IMX21_CLK_CKIH_DIV1P5 4
18#define IMX21_CLK_MPLL_GATE 5
19#define IMX21_CLK_SPLL_GATE 6
20#define IMX21_CLK_FPM_GATE 7
21#define IMX21_CLK_CKIH_GATE 8
22#define IMX21_CLK_MPLL_OSC_SEL 9
23#define IMX21_CLK_IPG 10
24#define IMX21_CLK_HCLK 11
25#define IMX21_CLK_MPLL_SEL 12
26#define IMX21_CLK_SPLL_SEL 13
27#define IMX21_CLK_SSI1_SEL 14
28#define IMX21_CLK_SSI2_SEL 15
29#define IMX21_CLK_USB_DIV 16
30#define IMX21_CLK_FCLK 17
31#define IMX21_CLK_MPLL 18
32#define IMX21_CLK_SPLL 19
33#define IMX21_CLK_NFC_DIV 20
34#define IMX21_CLK_SSI1_DIV 21
35#define IMX21_CLK_SSI2_DIV 22
36#define IMX21_CLK_PER1 23
37#define IMX21_CLK_PER2 24
38#define IMX21_CLK_PER3 25
39#define IMX21_CLK_PER4 26
40#define IMX21_CLK_UART1_IPG_GATE 27
41#define IMX21_CLK_UART2_IPG_GATE 28
42#define IMX21_CLK_UART3_IPG_GATE 29
43#define IMX21_CLK_UART4_IPG_GATE 30
44#define IMX21_CLK_CSPI1_IPG_GATE 31
45#define IMX21_CLK_CSPI2_IPG_GATE 32
46#define IMX21_CLK_SSI1_GATE 33
47#define IMX21_CLK_SSI2_GATE 34
48#define IMX21_CLK_SDHC1_IPG_GATE 35
49#define IMX21_CLK_SDHC2_IPG_GATE 36
50#define IMX21_CLK_GPIO_GATE 37
51#define IMX21_CLK_I2C_GATE 38
52#define IMX21_CLK_DMA_GATE 39
53#define IMX21_CLK_USB_GATE 40
54#define IMX21_CLK_EMMA_GATE 41
55#define IMX21_CLK_SSI2_BAUD_GATE 42
56#define IMX21_CLK_SSI1_BAUD_GATE 43
57#define IMX21_CLK_LCDC_IPG_GATE 44
58#define IMX21_CLK_NFC_GATE 45
59#define IMX21_CLK_LCDC_HCLK_GATE 46
60#define IMX21_CLK_PER4_GATE 47
61#define IMX21_CLK_BMI_GATE 48
62#define IMX21_CLK_USB_HCLK_GATE 49
63#define IMX21_CLK_SLCDC_GATE 50
64#define IMX21_CLK_SLCDC_HCLK_GATE 51
65#define IMX21_CLK_EMMA_HCLK_GATE 52
66#define IMX21_CLK_BROM_GATE 53
67#define IMX21_CLK_DMA_HCLK_GATE 54
68#define IMX21_CLK_CSI_HCLK_GATE 55
69#define IMX21_CLK_CSPI3_IPG_GATE 56
70#define IMX21_CLK_WDOG_GATE 57
71#define IMX21_CLK_GPT1_IPG_GATE 58
72#define IMX21_CLK_GPT2_IPG_GATE 59
73#define IMX21_CLK_GPT3_IPG_GATE 60
74#define IMX21_CLK_PWM_IPG_GATE 61
75#define IMX21_CLK_RTC_GATE 62
76#define IMX21_CLK_KPP_GATE 63
77#define IMX21_CLK_OWIRE_GATE 64
78#define IMX21_CLK_MAX 65
79
80#endif
diff --git a/include/dt-bindings/clock/imx27-clock.h b/include/dt-bindings/clock/imx27-clock.h
new file mode 100644
index 000000000000..148b053e54ec
--- /dev/null
+++ b/include/dt-bindings/clock/imx27-clock.h
@@ -0,0 +1,108 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
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
10#ifndef __DT_BINDINGS_CLOCK_IMX27_H
11#define __DT_BINDINGS_CLOCK_IMX27_H
12
13#define IMX27_CLK_DUMMY 0
14#define IMX27_CLK_CKIH 1
15#define IMX27_CLK_CKIL 2
16#define IMX27_CLK_MPLL 3
17#define IMX27_CLK_SPLL 4
18#define IMX27_CLK_MPLL_MAIN2 5
19#define IMX27_CLK_AHB 6
20#define IMX27_CLK_IPG 7
21#define IMX27_CLK_NFC_DIV 8
22#define IMX27_CLK_PER1_DIV 9
23#define IMX27_CLK_PER2_DIV 10
24#define IMX27_CLK_PER3_DIV 11
25#define IMX27_CLK_PER4_DIV 12
26#define IMX27_CLK_VPU_SEL 13
27#define IMX27_CLK_VPU_DIV 14
28#define IMX27_CLK_USB_DIV 15
29#define IMX27_CLK_CPU_SEL 16
30#define IMX27_CLK_CLKO_SEL 17
31#define IMX27_CLK_CPU_DIV 18
32#define IMX27_CLK_CLKO_DIV 19
33#define IMX27_CLK_SSI1_SEL 20
34#define IMX27_CLK_SSI2_SEL 21
35#define IMX27_CLK_SSI1_DIV 22
36#define IMX27_CLK_SSI2_DIV 23
37#define IMX27_CLK_CLKO_EN 24
38#define IMX27_CLK_SSI2_IPG_GATE 25
39#define IMX27_CLK_SSI1_IPG_GATE 26
40#define IMX27_CLK_SLCDC_IPG_GATE 27
41#define IMX27_CLK_SDHC3_IPG_GATE 28
42#define IMX27_CLK_SDHC2_IPG_GATE 29
43#define IMX27_CLK_SDHC1_IPG_GATE 30
44#define IMX27_CLK_SCC_IPG_GATE 31
45#define IMX27_CLK_SAHARA_IPG_GATE 32
46#define IMX27_CLK_RTC_IPG_GATE 33
47#define IMX27_CLK_PWM_IPG_GATE 34
48#define IMX27_CLK_OWIRE_IPG_GATE 35
49#define IMX27_CLK_LCDC_IPG_GATE 36
50#define IMX27_CLK_KPP_IPG_GATE 37
51#define IMX27_CLK_IIM_IPG_GATE 38
52#define IMX27_CLK_I2C2_IPG_GATE 39
53#define IMX27_CLK_I2C1_IPG_GATE 40
54#define IMX27_CLK_GPT6_IPG_GATE 41
55#define IMX27_CLK_GPT5_IPG_GATE 42
56#define IMX27_CLK_GPT4_IPG_GATE 43
57#define IMX27_CLK_GPT3_IPG_GATE 44
58#define IMX27_CLK_GPT2_IPG_GATE 45
59#define IMX27_CLK_GPT1_IPG_GATE 46
60#define IMX27_CLK_GPIO_IPG_GATE 47
61#define IMX27_CLK_FEC_IPG_GATE 48
62#define IMX27_CLK_EMMA_IPG_GATE 49
63#define IMX27_CLK_DMA_IPG_GATE 50
64#define IMX27_CLK_CSPI3_IPG_GATE 51
65#define IMX27_CLK_CSPI2_IPG_GATE 52
66#define IMX27_CLK_CSPI1_IPG_GATE 53
67#define IMX27_CLK_NFC_BAUD_GATE 54
68#define IMX27_CLK_SSI2_BAUD_GATE 55
69#define IMX27_CLK_SSI1_BAUD_GATE 56
70#define IMX27_CLK_VPU_BAUD_GATE 57
71#define IMX27_CLK_PER4_GATE 58
72#define IMX27_CLK_PER3_GATE 59
73#define IMX27_CLK_PER2_GATE 60
74#define IMX27_CLK_PER1_GATE 61
75#define IMX27_CLK_USB_AHB_GATE 62
76#define IMX27_CLK_SLCDC_AHB_GATE 63
77#define IMX27_CLK_SAHARA_AHB_GATE 64
78#define IMX27_CLK_LCDC_AHB_GATE 65
79#define IMX27_CLK_VPU_AHB_GATE 66
80#define IMX27_CLK_FEC_AHB_GATE 67
81#define IMX27_CLK_EMMA_AHB_GATE 68
82#define IMX27_CLK_EMI_AHB_GATE 69
83#define IMX27_CLK_DMA_AHB_GATE 70
84#define IMX27_CLK_CSI_AHB_GATE 71
85#define IMX27_CLK_BROM_AHB_GATE 72
86#define IMX27_CLK_ATA_AHB_GATE 73
87#define IMX27_CLK_WDOG_IPG_GATE 74
88#define IMX27_CLK_USB_IPG_GATE 75
89#define IMX27_CLK_UART6_IPG_GATE 76
90#define IMX27_CLK_UART5_IPG_GATE 77
91#define IMX27_CLK_UART4_IPG_GATE 78
92#define IMX27_CLK_UART3_IPG_GATE 79
93#define IMX27_CLK_UART2_IPG_GATE 80
94#define IMX27_CLK_UART1_IPG_GATE 81
95#define IMX27_CLK_CKIH_DIV1P5 82
96#define IMX27_CLK_FPM 83
97#define IMX27_CLK_MPLL_OSC_SEL 84
98#define IMX27_CLK_MPLL_SEL 85
99#define IMX27_CLK_SPLL_GATE 86
100#define IMX27_CLK_MSHC_DIV 87
101#define IMX27_CLK_RTIC_IPG_GATE 88
102#define IMX27_CLK_MSHC_IPG_GATE 89
103#define IMX27_CLK_RTIC_AHB_GATE 90
104#define IMX27_CLK_MSHC_BAUD_GATE 91
105#define IMX27_CLK_CKIH_GATE 92
106#define IMX27_CLK_MAX 93
107
108#endif
diff --git a/include/dt-bindings/clock/imx6qdl-clock.h b/include/dt-bindings/clock/imx6qdl-clock.h
new file mode 100644
index 000000000000..654151e24288
--- /dev/null
+++ b/include/dt-bindings/clock/imx6qdl-clock.h
@@ -0,0 +1,224 @@
1/*
2 * Copyright 2014 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 __DT_BINDINGS_CLOCK_IMX6QDL_H
10#define __DT_BINDINGS_CLOCK_IMX6QDL_H
11
12#define IMX6QDL_CLK_DUMMY 0
13#define IMX6QDL_CLK_CKIL 1
14#define IMX6QDL_CLK_CKIH 2
15#define IMX6QDL_CLK_OSC 3
16#define IMX6QDL_CLK_PLL2_PFD0_352M 4
17#define IMX6QDL_CLK_PLL2_PFD1_594M 5
18#define IMX6QDL_CLK_PLL2_PFD2_396M 6
19#define IMX6QDL_CLK_PLL3_PFD0_720M 7
20#define IMX6QDL_CLK_PLL3_PFD1_540M 8
21#define IMX6QDL_CLK_PLL3_PFD2_508M 9
22#define IMX6QDL_CLK_PLL3_PFD3_454M 10
23#define IMX6QDL_CLK_PLL2_198M 11
24#define IMX6QDL_CLK_PLL3_120M 12
25#define IMX6QDL_CLK_PLL3_80M 13
26#define IMX6QDL_CLK_PLL3_60M 14
27#define IMX6QDL_CLK_TWD 15
28#define IMX6QDL_CLK_STEP 16
29#define IMX6QDL_CLK_PLL1_SW 17
30#define IMX6QDL_CLK_PERIPH_PRE 18
31#define IMX6QDL_CLK_PERIPH2_PRE 19
32#define IMX6QDL_CLK_PERIPH_CLK2_SEL 20
33#define IMX6QDL_CLK_PERIPH2_CLK2_SEL 21
34#define IMX6QDL_CLK_AXI_SEL 22
35#define IMX6QDL_CLK_ESAI_SEL 23
36#define IMX6QDL_CLK_ASRC_SEL 24
37#define IMX6QDL_CLK_SPDIF_SEL 25
38#define IMX6QDL_CLK_GPU2D_AXI 26
39#define IMX6QDL_CLK_GPU3D_AXI 27
40#define IMX6QDL_CLK_GPU2D_CORE_SEL 28
41#define IMX6QDL_CLK_GPU3D_CORE_SEL 29
42#define IMX6QDL_CLK_GPU3D_SHADER_SEL 30
43#define IMX6QDL_CLK_IPU1_SEL 31
44#define IMX6QDL_CLK_IPU2_SEL 32
45#define IMX6QDL_CLK_LDB_DI0_SEL 33
46#define IMX6QDL_CLK_LDB_DI1_SEL 34
47#define IMX6QDL_CLK_IPU1_DI0_PRE_SEL 35
48#define IMX6QDL_CLK_IPU1_DI1_PRE_SEL 36
49#define IMX6QDL_CLK_IPU2_DI0_PRE_SEL 37
50#define IMX6QDL_CLK_IPU2_DI1_PRE_SEL 38
51#define IMX6QDL_CLK_IPU1_DI0_SEL 39
52#define IMX6QDL_CLK_IPU1_DI1_SEL 40
53#define IMX6QDL_CLK_IPU2_DI0_SEL 41
54#define IMX6QDL_CLK_IPU2_DI1_SEL 42
55#define IMX6QDL_CLK_HSI_TX_SEL 43
56#define IMX6QDL_CLK_PCIE_AXI_SEL 44
57#define IMX6QDL_CLK_SSI1_SEL 45
58#define IMX6QDL_CLK_SSI2_SEL 46
59#define IMX6QDL_CLK_SSI3_SEL 47
60#define IMX6QDL_CLK_USDHC1_SEL 48
61#define IMX6QDL_CLK_USDHC2_SEL 49
62#define IMX6QDL_CLK_USDHC3_SEL 50
63#define IMX6QDL_CLK_USDHC4_SEL 51
64#define IMX6QDL_CLK_ENFC_SEL 52
65#define IMX6QDL_CLK_EMI_SEL 53
66#define IMX6QDL_CLK_EMI_SLOW_SEL 54
67#define IMX6QDL_CLK_VDO_AXI_SEL 55
68#define IMX6QDL_CLK_VPU_AXI_SEL 56
69#define IMX6QDL_CLK_CKO1_SEL 57
70#define IMX6QDL_CLK_PERIPH 58
71#define IMX6QDL_CLK_PERIPH2 59
72#define IMX6QDL_CLK_PERIPH_CLK2 60
73#define IMX6QDL_CLK_PERIPH2_CLK2 61
74#define IMX6QDL_CLK_IPG 62
75#define IMX6QDL_CLK_IPG_PER 63
76#define IMX6QDL_CLK_ESAI_PRED 64
77#define IMX6QDL_CLK_ESAI_PODF 65
78#define IMX6QDL_CLK_ASRC_PRED 66
79#define IMX6QDL_CLK_ASRC_PODF 67
80#define IMX6QDL_CLK_SPDIF_PRED 68
81#define IMX6QDL_CLK_SPDIF_PODF 69
82#define IMX6QDL_CLK_CAN_ROOT 70
83#define IMX6QDL_CLK_ECSPI_ROOT 71
84#define IMX6QDL_CLK_GPU2D_CORE_PODF 72
85#define IMX6QDL_CLK_GPU3D_CORE_PODF 73
86#define IMX6QDL_CLK_GPU3D_SHADER 74
87#define IMX6QDL_CLK_IPU1_PODF 75
88#define IMX6QDL_CLK_IPU2_PODF 76
89#define IMX6QDL_CLK_LDB_DI0_PODF 77
90#define IMX6QDL_CLK_LDB_DI1_PODF 78
91#define IMX6QDL_CLK_IPU1_DI0_PRE 79
92#define IMX6QDL_CLK_IPU1_DI1_PRE 80
93#define IMX6QDL_CLK_IPU2_DI0_PRE 81
94#define IMX6QDL_CLK_IPU2_DI1_PRE 82
95#define IMX6QDL_CLK_HSI_TX_PODF 83
96#define IMX6QDL_CLK_SSI1_PRED 84
97#define IMX6QDL_CLK_SSI1_PODF 85
98#define IMX6QDL_CLK_SSI2_PRED 86
99#define IMX6QDL_CLK_SSI2_PODF 87
100#define IMX6QDL_CLK_SSI3_PRED 88
101#define IMX6QDL_CLK_SSI3_PODF 89
102#define IMX6QDL_CLK_UART_SERIAL_PODF 90
103#define IMX6QDL_CLK_USDHC1_PODF 91
104#define IMX6QDL_CLK_USDHC2_PODF 92
105#define IMX6QDL_CLK_USDHC3_PODF 93
106#define IMX6QDL_CLK_USDHC4_PODF 94
107#define IMX6QDL_CLK_ENFC_PRED 95
108#define IMX6QDL_CLK_ENFC_PODF 96
109#define IMX6QDL_CLK_EMI_PODF 97
110#define IMX6QDL_CLK_EMI_SLOW_PODF 98
111#define IMX6QDL_CLK_VPU_AXI_PODF 99
112#define IMX6QDL_CLK_CKO1_PODF 100
113#define IMX6QDL_CLK_AXI 101
114#define IMX6QDL_CLK_MMDC_CH0_AXI_PODF 102
115#define IMX6QDL_CLK_MMDC_CH1_AXI_PODF 103
116#define IMX6QDL_CLK_ARM 104
117#define IMX6QDL_CLK_AHB 105
118#define IMX6QDL_CLK_APBH_DMA 106
119#define IMX6QDL_CLK_ASRC 107
120#define IMX6QDL_CLK_CAN1_IPG 108
121#define IMX6QDL_CLK_CAN1_SERIAL 109
122#define IMX6QDL_CLK_CAN2_IPG 110
123#define IMX6QDL_CLK_CAN2_SERIAL 111
124#define IMX6QDL_CLK_ECSPI1 112
125#define IMX6QDL_CLK_ECSPI2 113
126#define IMX6QDL_CLK_ECSPI3 114
127#define IMX6QDL_CLK_ECSPI4 115
128#define IMX6Q_CLK_ECSPI5 116
129#define IMX6DL_CLK_I2C4 116
130#define IMX6QDL_CLK_ENET 117
131#define IMX6QDL_CLK_ESAI 118
132#define IMX6QDL_CLK_GPT_IPG 119
133#define IMX6QDL_CLK_GPT_IPG_PER 120
134#define IMX6QDL_CLK_GPU2D_CORE 121
135#define IMX6QDL_CLK_GPU3D_CORE 122
136#define IMX6QDL_CLK_HDMI_IAHB 123
137#define IMX6QDL_CLK_HDMI_ISFR 124
138#define IMX6QDL_CLK_I2C1 125
139#define IMX6QDL_CLK_I2C2 126
140#define IMX6QDL_CLK_I2C3 127
141#define IMX6QDL_CLK_IIM 128
142#define IMX6QDL_CLK_ENFC 129
143#define IMX6QDL_CLK_IPU1 130
144#define IMX6QDL_CLK_IPU1_DI0 131
145#define IMX6QDL_CLK_IPU1_DI1 132
146#define IMX6QDL_CLK_IPU2 133
147#define IMX6QDL_CLK_IPU2_DI0 134
148#define IMX6QDL_CLK_LDB_DI0 135
149#define IMX6QDL_CLK_LDB_DI1 136
150#define IMX6QDL_CLK_IPU2_DI1 137
151#define IMX6QDL_CLK_HSI_TX 138
152#define IMX6QDL_CLK_MLB 139
153#define IMX6QDL_CLK_MMDC_CH0_AXI 140
154#define IMX6QDL_CLK_MMDC_CH1_AXI 141
155#define IMX6QDL_CLK_OCRAM 142
156#define IMX6QDL_CLK_OPENVG_AXI 143
157#define IMX6QDL_CLK_PCIE_AXI 144
158#define IMX6QDL_CLK_PWM1 145
159#define IMX6QDL_CLK_PWM2 146
160#define IMX6QDL_CLK_PWM3 147
161#define IMX6QDL_CLK_PWM4 148
162#define IMX6QDL_CLK_PER1_BCH 149
163#define IMX6QDL_CLK_GPMI_BCH_APB 150
164#define IMX6QDL_CLK_GPMI_BCH 151
165#define IMX6QDL_CLK_GPMI_IO 152
166#define IMX6QDL_CLK_GPMI_APB 153
167#define IMX6QDL_CLK_SATA 154
168#define IMX6QDL_CLK_SDMA 155
169#define IMX6QDL_CLK_SPBA 156
170#define IMX6QDL_CLK_SSI1 157
171#define IMX6QDL_CLK_SSI2 158
172#define IMX6QDL_CLK_SSI3 159
173#define IMX6QDL_CLK_UART_IPG 160
174#define IMX6QDL_CLK_UART_SERIAL 161
175#define IMX6QDL_CLK_USBOH3 162
176#define IMX6QDL_CLK_USDHC1 163
177#define IMX6QDL_CLK_USDHC2 164
178#define IMX6QDL_CLK_USDHC3 165
179#define IMX6QDL_CLK_USDHC4 166
180#define IMX6QDL_CLK_VDO_AXI 167
181#define IMX6QDL_CLK_VPU_AXI 168
182#define IMX6QDL_CLK_CKO1 169
183#define IMX6QDL_CLK_PLL1_SYS 170
184#define IMX6QDL_CLK_PLL2_BUS 171
185#define IMX6QDL_CLK_PLL3_USB_OTG 172
186#define IMX6QDL_CLK_PLL4_AUDIO 173
187#define IMX6QDL_CLK_PLL5_VIDEO 174
188#define IMX6QDL_CLK_PLL8_MLB 175
189#define IMX6QDL_CLK_PLL7_USB_HOST 176
190#define IMX6QDL_CLK_PLL6_ENET 177
191#define IMX6QDL_CLK_SSI1_IPG 178
192#define IMX6QDL_CLK_SSI2_IPG 179
193#define IMX6QDL_CLK_SSI3_IPG 180
194#define IMX6QDL_CLK_ROM 181
195#define IMX6QDL_CLK_USBPHY1 182
196#define IMX6QDL_CLK_USBPHY2 183
197#define IMX6QDL_CLK_LDB_DI0_DIV_3_5 184
198#define IMX6QDL_CLK_LDB_DI1_DIV_3_5 185
199#define IMX6QDL_CLK_SATA_REF 186
200#define IMX6QDL_CLK_SATA_REF_100M 187
201#define IMX6QDL_CLK_PCIE_REF 188
202#define IMX6QDL_CLK_PCIE_REF_125M 189
203#define IMX6QDL_CLK_ENET_REF 190
204#define IMX6QDL_CLK_USBPHY1_GATE 191
205#define IMX6QDL_CLK_USBPHY2_GATE 192
206#define IMX6QDL_CLK_PLL4_POST_DIV 193
207#define IMX6QDL_CLK_PLL5_POST_DIV 194
208#define IMX6QDL_CLK_PLL5_VIDEO_DIV 195
209#define IMX6QDL_CLK_EIM_SLOW 196
210#define IMX6QDL_CLK_SPDIF 197
211#define IMX6QDL_CLK_CKO2_SEL 198
212#define IMX6QDL_CLK_CKO2_PODF 199
213#define IMX6QDL_CLK_CKO2 200
214#define IMX6QDL_CLK_CKO 201
215#define IMX6QDL_CLK_VDOA 202
216#define IMX6QDL_CLK_PLL4_AUDIO_DIV 203
217#define IMX6QDL_CLK_LVDS1_SEL 204
218#define IMX6QDL_CLK_LVDS2_SEL 205
219#define IMX6QDL_CLK_LVDS1_GATE 206
220#define IMX6QDL_CLK_LVDS2_GATE 207
221#define IMX6QDL_CLK_ESAI_AHB 208
222#define IMX6QDL_CLK_END 209
223
224#endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */
diff --git a/include/dt-bindings/clock/qcom,gcc-apq8084.h b/include/dt-bindings/clock/qcom,gcc-apq8084.h
new file mode 100644
index 000000000000..2c0da566c46a
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,gcc-apq8084.h
@@ -0,0 +1,351 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_CLK_APQ_GCC_8084_H
15#define _DT_BINDINGS_CLK_APQ_GCC_8084_H
16
17#define GPLL0 0
18#define GPLL0_VOTE 1
19#define GPLL1 2
20#define GPLL1_VOTE 3
21#define GPLL2 4
22#define GPLL2_VOTE 5
23#define GPLL3 6
24#define GPLL3_VOTE 7
25#define GPLL4 8
26#define GPLL4_VOTE 9
27#define CONFIG_NOC_CLK_SRC 10
28#define PERIPH_NOC_CLK_SRC 11
29#define SYSTEM_NOC_CLK_SRC 12
30#define BLSP_UART_SIM_CLK_SRC 13
31#define QDSS_TSCTR_CLK_SRC 14
32#define UFS_AXI_CLK_SRC 15
33#define RPM_CLK_SRC 16
34#define KPSS_AHB_CLK_SRC 17
35#define QDSS_AT_CLK_SRC 18
36#define BIMC_DDR_CLK_SRC 19
37#define USB30_MASTER_CLK_SRC 20
38#define USB30_SEC_MASTER_CLK_SRC 21
39#define USB_HSIC_AHB_CLK_SRC 22
40#define MMSS_BIMC_GFX_CLK_SRC 23
41#define QDSS_STM_CLK_SRC 24
42#define ACC_CLK_SRC 25
43#define SEC_CTRL_CLK_SRC 26
44#define BLSP1_QUP1_I2C_APPS_CLK_SRC 27
45#define BLSP1_QUP1_SPI_APPS_CLK_SRC 28
46#define BLSP1_QUP2_I2C_APPS_CLK_SRC 29
47#define BLSP1_QUP2_SPI_APPS_CLK_SRC 30
48#define BLSP1_QUP3_I2C_APPS_CLK_SRC 31
49#define BLSP1_QUP3_SPI_APPS_CLK_SRC 32
50#define BLSP1_QUP4_I2C_APPS_CLK_SRC 33
51#define BLSP1_QUP4_SPI_APPS_CLK_SRC 34
52#define BLSP1_QUP5_I2C_APPS_CLK_SRC 35
53#define BLSP1_QUP5_SPI_APPS_CLK_SRC 36
54#define BLSP1_QUP6_I2C_APPS_CLK_SRC 37
55#define BLSP1_QUP6_SPI_APPS_CLK_SRC 38
56#define BLSP1_UART1_APPS_CLK_SRC 39
57#define BLSP1_UART2_APPS_CLK_SRC 40
58#define BLSP1_UART3_APPS_CLK_SRC 41
59#define BLSP1_UART4_APPS_CLK_SRC 42
60#define BLSP1_UART5_APPS_CLK_SRC 43
61#define BLSP1_UART6_APPS_CLK_SRC 44
62#define BLSP2_QUP1_I2C_APPS_CLK_SRC 45
63#define BLSP2_QUP1_SPI_APPS_CLK_SRC 46
64#define BLSP2_QUP2_I2C_APPS_CLK_SRC 47
65#define BLSP2_QUP2_SPI_APPS_CLK_SRC 48
66#define BLSP2_QUP3_I2C_APPS_CLK_SRC 49
67#define BLSP2_QUP3_SPI_APPS_CLK_SRC 50
68#define BLSP2_QUP4_I2C_APPS_CLK_SRC 51
69#define BLSP2_QUP4_SPI_APPS_CLK_SRC 52
70#define BLSP2_QUP5_I2C_APPS_CLK_SRC 53
71#define BLSP2_QUP5_SPI_APPS_CLK_SRC 54
72#define BLSP2_QUP6_I2C_APPS_CLK_SRC 55
73#define BLSP2_QUP6_SPI_APPS_CLK_SRC 56
74#define BLSP2_UART1_APPS_CLK_SRC 57
75#define BLSP2_UART2_APPS_CLK_SRC 58
76#define BLSP2_UART3_APPS_CLK_SRC 59
77#define BLSP2_UART4_APPS_CLK_SRC 60
78#define BLSP2_UART5_APPS_CLK_SRC 61
79#define BLSP2_UART6_APPS_CLK_SRC 62
80#define CE1_CLK_SRC 63
81#define CE2_CLK_SRC 64
82#define CE3_CLK_SRC 65
83#define GP1_CLK_SRC 66
84#define GP2_CLK_SRC 67
85#define GP3_CLK_SRC 68
86#define PDM2_CLK_SRC 69
87#define QDSS_TRACECLKIN_CLK_SRC 70
88#define RBCPR_CLK_SRC 71
89#define SATA_ASIC0_CLK_SRC 72
90#define SATA_PMALIVE_CLK_SRC 73
91#define SATA_RX_CLK_SRC 74
92#define SATA_RX_OOB_CLK_SRC 75
93#define SDCC1_APPS_CLK_SRC 76
94#define SDCC2_APPS_CLK_SRC 77
95#define SDCC3_APPS_CLK_SRC 78
96#define SDCC4_APPS_CLK_SRC 79
97#define GCC_SNOC_BUS_TIMEOUT0_AHB_CLK 80
98#define SPMI_AHB_CLK_SRC 81
99#define SPMI_SER_CLK_SRC 82
100#define TSIF_REF_CLK_SRC 83
101#define USB30_MOCK_UTMI_CLK_SRC 84
102#define USB30_SEC_MOCK_UTMI_CLK_SRC 85
103#define USB_HS_SYSTEM_CLK_SRC 86
104#define USB_HSIC_CLK_SRC 87
105#define USB_HSIC_IO_CAL_CLK_SRC 88
106#define USB_HSIC_MOCK_UTMI_CLK_SRC 89
107#define USB_HSIC_SYSTEM_CLK_SRC 90
108#define GCC_BAM_DMA_AHB_CLK 91
109#define GCC_BAM_DMA_INACTIVITY_TIMERS_CLK 92
110#define DDR_CLK_SRC 93
111#define GCC_BIMC_CFG_AHB_CLK 94
112#define GCC_BIMC_CLK 95
113#define GCC_BIMC_KPSS_AXI_CLK 96
114#define GCC_BIMC_SLEEP_CLK 97
115#define GCC_BIMC_SYSNOC_AXI_CLK 98
116#define GCC_BIMC_XO_CLK 99
117#define GCC_BLSP1_AHB_CLK 100
118#define GCC_BLSP1_SLEEP_CLK 101
119#define GCC_BLSP1_QUP1_I2C_APPS_CLK 102
120#define GCC_BLSP1_QUP1_SPI_APPS_CLK 103
121#define GCC_BLSP1_QUP2_I2C_APPS_CLK 104
122#define GCC_BLSP1_QUP2_SPI_APPS_CLK 105
123#define GCC_BLSP1_QUP3_I2C_APPS_CLK 106
124#define GCC_BLSP1_QUP3_SPI_APPS_CLK 107
125#define GCC_BLSP1_QUP4_I2C_APPS_CLK 108
126#define GCC_BLSP1_QUP4_SPI_APPS_CLK 109
127#define GCC_BLSP1_QUP5_I2C_APPS_CLK 110
128#define GCC_BLSP1_QUP5_SPI_APPS_CLK 111
129#define GCC_BLSP1_QUP6_I2C_APPS_CLK 112
130#define GCC_BLSP1_QUP6_SPI_APPS_CLK 113
131#define GCC_BLSP1_UART1_APPS_CLK 114
132#define GCC_BLSP1_UART1_SIM_CLK 115
133#define GCC_BLSP1_UART2_APPS_CLK 116
134#define GCC_BLSP1_UART2_SIM_CLK 117
135#define GCC_BLSP1_UART3_APPS_CLK 118
136#define GCC_BLSP1_UART3_SIM_CLK 119
137#define GCC_BLSP1_UART4_APPS_CLK 120
138#define GCC_BLSP1_UART4_SIM_CLK 121
139#define GCC_BLSP1_UART5_APPS_CLK 122
140#define GCC_BLSP1_UART5_SIM_CLK 123
141#define GCC_BLSP1_UART6_APPS_CLK 124
142#define GCC_BLSP1_UART6_SIM_CLK 125
143#define GCC_BLSP2_AHB_CLK 126
144#define GCC_BLSP2_SLEEP_CLK 127
145#define GCC_BLSP2_QUP1_I2C_APPS_CLK 128
146#define GCC_BLSP2_QUP1_SPI_APPS_CLK 129
147#define GCC_BLSP2_QUP2_I2C_APPS_CLK 130
148#define GCC_BLSP2_QUP2_SPI_APPS_CLK 131
149#define GCC_BLSP2_QUP3_I2C_APPS_CLK 132
150#define GCC_BLSP2_QUP3_SPI_APPS_CLK 133
151#define GCC_BLSP2_QUP4_I2C_APPS_CLK 134
152#define GCC_BLSP2_QUP4_SPI_APPS_CLK 135
153#define GCC_BLSP2_QUP5_I2C_APPS_CLK 136
154#define GCC_BLSP2_QUP5_SPI_APPS_CLK 137
155#define GCC_BLSP2_QUP6_I2C_APPS_CLK 138
156#define GCC_BLSP2_QUP6_SPI_APPS_CLK 139
157#define GCC_BLSP2_UART1_APPS_CLK 140
158#define GCC_BLSP2_UART1_SIM_CLK 141
159#define GCC_BLSP2_UART2_APPS_CLK 142
160#define GCC_BLSP2_UART2_SIM_CLK 143
161#define GCC_BLSP2_UART3_APPS_CLK 144
162#define GCC_BLSP2_UART3_SIM_CLK 145
163#define GCC_BLSP2_UART4_APPS_CLK 146
164#define GCC_BLSP2_UART4_SIM_CLK 147
165#define GCC_BLSP2_UART5_APPS_CLK 148
166#define GCC_BLSP2_UART5_SIM_CLK 149
167#define GCC_BLSP2_UART6_APPS_CLK 150
168#define GCC_BLSP2_UART6_SIM_CLK 151
169#define GCC_BOOT_ROM_AHB_CLK 152
170#define GCC_CE1_AHB_CLK 153
171#define GCC_CE1_AXI_CLK 154
172#define GCC_CE1_CLK 155
173#define GCC_CE2_AHB_CLK 156
174#define GCC_CE2_AXI_CLK 157
175#define GCC_CE2_CLK 158
176#define GCC_CE3_AHB_CLK 159
177#define GCC_CE3_AXI_CLK 160
178#define GCC_CE3_CLK 161
179#define GCC_CNOC_BUS_TIMEOUT0_AHB_CLK 162
180#define GCC_CNOC_BUS_TIMEOUT1_AHB_CLK 163
181#define GCC_CNOC_BUS_TIMEOUT2_AHB_CLK 164
182#define GCC_CNOC_BUS_TIMEOUT3_AHB_CLK 165
183#define GCC_CNOC_BUS_TIMEOUT4_AHB_CLK 166
184#define GCC_CNOC_BUS_TIMEOUT5_AHB_CLK 167
185#define GCC_CNOC_BUS_TIMEOUT6_AHB_CLK 168
186#define GCC_CNOC_BUS_TIMEOUT7_AHB_CLK 169
187#define GCC_CFG_NOC_AHB_CLK 170
188#define GCC_CFG_NOC_DDR_CFG_CLK 171
189#define GCC_CFG_NOC_RPM_AHB_CLK 172
190#define GCC_COPSS_SMMU_AHB_CLK 173
191#define GCC_COPSS_SMMU_AXI_CLK 174
192#define GCC_DCD_XO_CLK 175
193#define GCC_BIMC_DDR_CH0_CLK 176
194#define GCC_BIMC_DDR_CH1_CLK 177
195#define GCC_BIMC_DDR_CPLL0_CLK 178
196#define GCC_BIMC_DDR_CPLL1_CLK 179
197#define GCC_BIMC_GFX_CLK 180
198#define GCC_DDR_DIM_CFG_CLK 181
199#define GCC_DDR_DIM_SLEEP_CLK 182
200#define GCC_DEHR_CLK 183
201#define GCC_AHB_CLK 184
202#define GCC_IM_SLEEP_CLK 185
203#define GCC_XO_CLK 186
204#define GCC_XO_DIV4_CLK 187
205#define GCC_GP1_CLK 188
206#define GCC_GP2_CLK 189
207#define GCC_GP3_CLK 190
208#define GCC_IMEM_AXI_CLK 191
209#define GCC_IMEM_CFG_AHB_CLK 192
210#define GCC_KPSS_AHB_CLK 193
211#define GCC_KPSS_AXI_CLK 194
212#define GCC_LPASS_MPORT_AXI_CLK 195
213#define GCC_LPASS_Q6_AXI_CLK 196
214#define GCC_LPASS_SWAY_CLK 197
215#define GCC_MMSS_BIMC_GFX_CLK 198
216#define GCC_MMSS_NOC_AT_CLK 199
217#define GCC_MMSS_NOC_CFG_AHB_CLK 200
218#define GCC_MMSS_VPU_MAPLE_SYS_NOC_AXI_CLK 201
219#define GCC_OCMEM_NOC_CFG_AHB_CLK 202
220#define GCC_OCMEM_SYS_NOC_AXI_CLK 203
221#define GCC_MPM_AHB_CLK 204
222#define GCC_MSG_RAM_AHB_CLK 205
223#define GCC_NOC_CONF_XPU_AHB_CLK 206
224#define GCC_PDM2_CLK 207
225#define GCC_PDM_AHB_CLK 208
226#define GCC_PDM_XO4_CLK 209
227#define GCC_PERIPH_NOC_AHB_CLK 210
228#define GCC_PERIPH_NOC_AT_CLK 211
229#define GCC_PERIPH_NOC_CFG_AHB_CLK 212
230#define GCC_PERIPH_NOC_USB_HSIC_AHB_CLK 213
231#define GCC_PERIPH_NOC_MPU_CFG_AHB_CLK 214
232#define GCC_PERIPH_XPU_AHB_CLK 215
233#define GCC_PNOC_BUS_TIMEOUT0_AHB_CLK 216
234#define GCC_PNOC_BUS_TIMEOUT1_AHB_CLK 217
235#define GCC_PNOC_BUS_TIMEOUT2_AHB_CLK 218
236#define GCC_PNOC_BUS_TIMEOUT3_AHB_CLK 219
237#define GCC_PNOC_BUS_TIMEOUT4_AHB_CLK 220
238#define GCC_PRNG_AHB_CLK 221
239#define GCC_QDSS_AT_CLK 222
240#define GCC_QDSS_CFG_AHB_CLK 223
241#define GCC_QDSS_DAP_AHB_CLK 224
242#define GCC_QDSS_DAP_CLK 225
243#define GCC_QDSS_ETR_USB_CLK 226
244#define GCC_QDSS_STM_CLK 227
245#define GCC_QDSS_TRACECLKIN_CLK 228
246#define GCC_QDSS_TSCTR_DIV16_CLK 229
247#define GCC_QDSS_TSCTR_DIV2_CLK 230
248#define GCC_QDSS_TSCTR_DIV3_CLK 231
249#define GCC_QDSS_TSCTR_DIV4_CLK 232
250#define GCC_QDSS_TSCTR_DIV8_CLK 233
251#define GCC_QDSS_RBCPR_XPU_AHB_CLK 234
252#define GCC_RBCPR_AHB_CLK 235
253#define GCC_RBCPR_CLK 236
254#define GCC_RPM_BUS_AHB_CLK 237
255#define GCC_RPM_PROC_HCLK 238
256#define GCC_RPM_SLEEP_CLK 239
257#define GCC_RPM_TIMER_CLK 240
258#define GCC_SATA_ASIC0_CLK 241
259#define GCC_SATA_AXI_CLK 242
260#define GCC_SATA_CFG_AHB_CLK 243
261#define GCC_SATA_PMALIVE_CLK 244
262#define GCC_SATA_RX_CLK 245
263#define GCC_SATA_RX_OOB_CLK 246
264#define GCC_SDCC1_AHB_CLK 247
265#define GCC_SDCC1_APPS_CLK 248
266#define GCC_SDCC1_CDCCAL_FF_CLK 249
267#define GCC_SDCC1_CDCCAL_SLEEP_CLK 250
268#define GCC_SDCC2_AHB_CLK 251
269#define GCC_SDCC2_APPS_CLK 252
270#define GCC_SDCC2_INACTIVITY_TIMERS_CLK 253
271#define GCC_SDCC3_AHB_CLK 254
272#define GCC_SDCC3_APPS_CLK 255
273#define GCC_SDCC3_INACTIVITY_TIMERS_CLK 256
274#define GCC_SDCC4_AHB_CLK 257
275#define GCC_SDCC4_APPS_CLK 258
276#define GCC_SDCC4_INACTIVITY_TIMERS_CLK 259
277#define GCC_SEC_CTRL_ACC_CLK 260
278#define GCC_SEC_CTRL_AHB_CLK 261
279#define GCC_SEC_CTRL_BOOT_ROM_PATCH_CLK 262
280#define GCC_SEC_CTRL_CLK 263
281#define GCC_SEC_CTRL_SENSE_CLK 264
282#define GCC_SNOC_BUS_TIMEOUT2_AHB_CLK 265
283#define GCC_SNOC_BUS_TIMEOUT3_AHB_CLK 266
284#define GCC_SPDM_BIMC_CY_CLK 267
285#define GCC_SPDM_CFG_AHB_CLK 268
286#define GCC_SPDM_DEBUG_CY_CLK 269
287#define GCC_SPDM_FF_CLK 270
288#define GCC_SPDM_MSTR_AHB_CLK 271
289#define GCC_SPDM_PNOC_CY_CLK 272
290#define GCC_SPDM_RPM_CY_CLK 273
291#define GCC_SPDM_SNOC_CY_CLK 274
292#define GCC_SPMI_AHB_CLK 275
293#define GCC_SPMI_CNOC_AHB_CLK 276
294#define GCC_SPMI_SER_CLK 277
295#define GCC_SPSS_AHB_CLK 278
296#define GCC_SNOC_CNOC_AHB_CLK 279
297#define GCC_SNOC_PNOC_AHB_CLK 280
298#define GCC_SYS_NOC_AT_CLK 281
299#define GCC_SYS_NOC_AXI_CLK 282
300#define GCC_SYS_NOC_KPSS_AHB_CLK 283
301#define GCC_SYS_NOC_QDSS_STM_AXI_CLK 284
302#define GCC_SYS_NOC_UFS_AXI_CLK 285
303#define GCC_SYS_NOC_USB3_AXI_CLK 286
304#define GCC_SYS_NOC_USB3_SEC_AXI_CLK 287
305#define GCC_TCSR_AHB_CLK 288
306#define GCC_TLMM_AHB_CLK 289
307#define GCC_TLMM_CLK 290
308#define GCC_TSIF_AHB_CLK 291
309#define GCC_TSIF_INACTIVITY_TIMERS_CLK 292
310#define GCC_TSIF_REF_CLK 293
311#define GCC_UFS_AHB_CLK 294
312#define GCC_UFS_AXI_CLK 295
313#define GCC_UFS_RX_CFG_CLK 296
314#define GCC_UFS_RX_SYMBOL_0_CLK 297
315#define GCC_UFS_RX_SYMBOL_1_CLK 298
316#define GCC_UFS_TX_CFG_CLK 299
317#define GCC_UFS_TX_SYMBOL_0_CLK 300
318#define GCC_UFS_TX_SYMBOL_1_CLK 301
319#define GCC_USB2A_PHY_SLEEP_CLK 302
320#define GCC_USB2B_PHY_SLEEP_CLK 303
321#define GCC_USB30_MASTER_CLK 304
322#define GCC_USB30_MOCK_UTMI_CLK 305
323#define GCC_USB30_SLEEP_CLK 306
324#define GCC_USB30_SEC_MASTER_CLK 307
325#define GCC_USB30_SEC_MOCK_UTMI_CLK 308
326#define GCC_USB30_SEC_SLEEP_CLK 309
327#define GCC_USB_HS_AHB_CLK 310
328#define GCC_USB_HS_INACTIVITY_TIMERS_CLK 311
329#define GCC_USB_HS_SYSTEM_CLK 312
330#define GCC_USB_HSIC_AHB_CLK 313
331#define GCC_USB_HSIC_CLK 314
332#define GCC_USB_HSIC_IO_CAL_CLK 315
333#define GCC_USB_HSIC_IO_CAL_SLEEP_CLK 316
334#define GCC_USB_HSIC_MOCK_UTMI_CLK 317
335#define GCC_USB_HSIC_SYSTEM_CLK 318
336#define PCIE_0_AUX_CLK_SRC 319
337#define PCIE_0_PIPE_CLK_SRC 320
338#define PCIE_1_AUX_CLK_SRC 321
339#define PCIE_1_PIPE_CLK_SRC 322
340#define GCC_PCIE_0_AUX_CLK 323
341#define GCC_PCIE_0_CFG_AHB_CLK 324
342#define GCC_PCIE_0_MSTR_AXI_CLK 325
343#define GCC_PCIE_0_PIPE_CLK 326
344#define GCC_PCIE_0_SLV_AXI_CLK 327
345#define GCC_PCIE_1_AUX_CLK 328
346#define GCC_PCIE_1_CFG_AHB_CLK 329
347#define GCC_PCIE_1_MSTR_AXI_CLK 330
348#define GCC_PCIE_1_PIPE_CLK 331
349#define GCC_PCIE_1_SLV_AXI_CLK 332
350
351#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-ipq806x.h b/include/dt-bindings/clock/qcom,gcc-ipq806x.h
new file mode 100644
index 000000000000..b857cadb0bd4
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,gcc-ipq806x.h
@@ -0,0 +1,293 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_CLK_GCC_IPQ806X_H
15#define _DT_BINDINGS_CLK_GCC_IPQ806X_H
16
17#define AFAB_CLK_SRC 0
18#define QDSS_STM_CLK 1
19#define SCSS_A_CLK 2
20#define SCSS_H_CLK 3
21#define AFAB_CORE_CLK 4
22#define SCSS_XO_SRC_CLK 5
23#define AFAB_EBI1_CH0_A_CLK 6
24#define AFAB_EBI1_CH1_A_CLK 7
25#define AFAB_AXI_S0_FCLK 8
26#define AFAB_AXI_S1_FCLK 9
27#define AFAB_AXI_S2_FCLK 10
28#define AFAB_AXI_S3_FCLK 11
29#define AFAB_AXI_S4_FCLK 12
30#define SFAB_CORE_CLK 13
31#define SFAB_AXI_S0_FCLK 14
32#define SFAB_AXI_S1_FCLK 15
33#define SFAB_AXI_S2_FCLK 16
34#define SFAB_AXI_S3_FCLK 17
35#define SFAB_AXI_S4_FCLK 18
36#define SFAB_AXI_S5_FCLK 19
37#define SFAB_AHB_S0_FCLK 20
38#define SFAB_AHB_S1_FCLK 21
39#define SFAB_AHB_S2_FCLK 22
40#define SFAB_AHB_S3_FCLK 23
41#define SFAB_AHB_S4_FCLK 24
42#define SFAB_AHB_S5_FCLK 25
43#define SFAB_AHB_S6_FCLK 26
44#define SFAB_AHB_S7_FCLK 27
45#define QDSS_AT_CLK_SRC 28
46#define QDSS_AT_CLK 29
47#define QDSS_TRACECLKIN_CLK_SRC 30
48#define QDSS_TRACECLKIN_CLK 31
49#define QDSS_TSCTR_CLK_SRC 32
50#define QDSS_TSCTR_CLK 33
51#define SFAB_ADM0_M0_A_CLK 34
52#define SFAB_ADM0_M1_A_CLK 35
53#define SFAB_ADM0_M2_H_CLK 36
54#define ADM0_CLK 37
55#define ADM0_PBUS_CLK 38
56#define IMEM0_A_CLK 39
57#define QDSS_H_CLK 40
58#define PCIE_A_CLK 41
59#define PCIE_AUX_CLK 42
60#define PCIE_H_CLK 43
61#define PCIE_PHY_CLK 44
62#define SFAB_CLK_SRC 45
63#define SFAB_LPASS_Q6_A_CLK 46
64#define SFAB_AFAB_M_A_CLK 47
65#define AFAB_SFAB_M0_A_CLK 48
66#define AFAB_SFAB_M1_A_CLK 49
67#define SFAB_SATA_S_H_CLK 50
68#define DFAB_CLK_SRC 51
69#define DFAB_CLK 52
70#define SFAB_DFAB_M_A_CLK 53
71#define DFAB_SFAB_M_A_CLK 54
72#define DFAB_SWAY0_H_CLK 55
73#define DFAB_SWAY1_H_CLK 56
74#define DFAB_ARB0_H_CLK 57
75#define DFAB_ARB1_H_CLK 58
76#define PPSS_H_CLK 59
77#define PPSS_PROC_CLK 60
78#define PPSS_TIMER0_CLK 61
79#define PPSS_TIMER1_CLK 62
80#define PMEM_A_CLK 63
81#define DMA_BAM_H_CLK 64
82#define SIC_H_CLK 65
83#define SPS_TIC_H_CLK 66
84#define CFPB_2X_CLK_SRC 67
85#define CFPB_CLK 68
86#define CFPB0_H_CLK 69
87#define CFPB1_H_CLK 70
88#define CFPB2_H_CLK 71
89#define SFAB_CFPB_M_H_CLK 72
90#define CFPB_MASTER_H_CLK 73
91#define SFAB_CFPB_S_H_CLK 74
92#define CFPB_SPLITTER_H_CLK 75
93#define TSIF_H_CLK 76
94#define TSIF_INACTIVITY_TIMERS_CLK 77
95#define TSIF_REF_SRC 78
96#define TSIF_REF_CLK 79
97#define CE1_H_CLK 80
98#define CE1_CORE_CLK 81
99#define CE1_SLEEP_CLK 82
100#define CE2_H_CLK 83
101#define CE2_CORE_CLK 84
102#define SFPB_H_CLK_SRC 85
103#define SFPB_H_CLK 86
104#define SFAB_SFPB_M_H_CLK 87
105#define SFAB_SFPB_S_H_CLK 88
106#define RPM_PROC_CLK 89
107#define RPM_BUS_H_CLK 90
108#define RPM_SLEEP_CLK 91
109#define RPM_TIMER_CLK 92
110#define RPM_MSG_RAM_H_CLK 93
111#define PMIC_ARB0_H_CLK 94
112#define PMIC_ARB1_H_CLK 95
113#define PMIC_SSBI2_SRC 96
114#define PMIC_SSBI2_CLK 97
115#define SDC1_H_CLK 98
116#define SDC2_H_CLK 99
117#define SDC3_H_CLK 100
118#define SDC4_H_CLK 101
119#define SDC1_SRC 102
120#define SDC1_CLK 103
121#define SDC2_SRC 104
122#define SDC2_CLK 105
123#define SDC3_SRC 106
124#define SDC3_CLK 107
125#define SDC4_SRC 108
126#define SDC4_CLK 109
127#define USB_HS1_H_CLK 110
128#define USB_HS1_XCVR_SRC 111
129#define USB_HS1_XCVR_CLK 112
130#define USB_HSIC_H_CLK 113
131#define USB_HSIC_XCVR_SRC 114
132#define USB_HSIC_XCVR_CLK 115
133#define USB_HSIC_SYSTEM_CLK_SRC 116
134#define USB_HSIC_SYSTEM_CLK 117
135#define CFPB0_C0_H_CLK 118
136#define CFPB0_D0_H_CLK 119
137#define CFPB0_C1_H_CLK 120
138#define CFPB0_D1_H_CLK 121
139#define USB_FS1_H_CLK 122
140#define USB_FS1_XCVR_SRC 123
141#define USB_FS1_XCVR_CLK 124
142#define USB_FS1_SYSTEM_CLK 125
143#define GSBI_COMMON_SIM_SRC 126
144#define GSBI1_H_CLK 127
145#define GSBI2_H_CLK 128
146#define GSBI3_H_CLK 129
147#define GSBI4_H_CLK 130
148#define GSBI5_H_CLK 131
149#define GSBI6_H_CLK 132
150#define GSBI7_H_CLK 133
151#define GSBI1_QUP_SRC 134
152#define GSBI1_QUP_CLK 135
153#define GSBI2_QUP_SRC 136
154#define GSBI2_QUP_CLK 137
155#define GSBI3_QUP_SRC 138
156#define GSBI3_QUP_CLK 139
157#define GSBI4_QUP_SRC 140
158#define GSBI4_QUP_CLK 141
159#define GSBI5_QUP_SRC 142
160#define GSBI5_QUP_CLK 143
161#define GSBI6_QUP_SRC 144
162#define GSBI6_QUP_CLK 145
163#define GSBI7_QUP_SRC 146
164#define GSBI7_QUP_CLK 147
165#define GSBI1_UART_SRC 148
166#define GSBI1_UART_CLK 149
167#define GSBI2_UART_SRC 150
168#define GSBI2_UART_CLK 151
169#define GSBI3_UART_SRC 152
170#define GSBI3_UART_CLK 153
171#define GSBI4_UART_SRC 154
172#define GSBI4_UART_CLK 155
173#define GSBI5_UART_SRC 156
174#define GSBI5_UART_CLK 157
175#define GSBI6_UART_SRC 158
176#define GSBI6_UART_CLK 159
177#define GSBI7_UART_SRC 160
178#define GSBI7_UART_CLK 161
179#define GSBI1_SIM_CLK 162
180#define GSBI2_SIM_CLK 163
181#define GSBI3_SIM_CLK 164
182#define GSBI4_SIM_CLK 165
183#define GSBI5_SIM_CLK 166
184#define GSBI6_SIM_CLK 167
185#define GSBI7_SIM_CLK 168
186#define USB_HSIC_HSIC_CLK_SRC 169
187#define USB_HSIC_HSIC_CLK 170
188#define USB_HSIC_HSIO_CAL_CLK 171
189#define SPDM_CFG_H_CLK 172
190#define SPDM_MSTR_H_CLK 173
191#define SPDM_FF_CLK_SRC 174
192#define SPDM_FF_CLK 175
193#define SEC_CTRL_CLK 176
194#define SEC_CTRL_ACC_CLK_SRC 177
195#define SEC_CTRL_ACC_CLK 178
196#define TLMM_H_CLK 179
197#define TLMM_CLK 180
198#define SATA_H_CLK 181
199#define SATA_CLK_SRC 182
200#define SATA_RXOOB_CLK 183
201#define SATA_PMALIVE_CLK 184
202#define SATA_PHY_REF_CLK 185
203#define SATA_A_CLK 186
204#define SATA_PHY_CFG_CLK 187
205#define TSSC_CLK_SRC 188
206#define TSSC_CLK 189
207#define PDM_SRC 190
208#define PDM_CLK 191
209#define GP0_SRC 192
210#define GP0_CLK 193
211#define GP1_SRC 194
212#define GP1_CLK 195
213#define GP2_SRC 196
214#define GP2_CLK 197
215#define MPM_CLK 198
216#define EBI1_CLK_SRC 199
217#define EBI1_CH0_CLK 200
218#define EBI1_CH1_CLK 201
219#define EBI1_2X_CLK 202
220#define EBI1_CH0_DQ_CLK 203
221#define EBI1_CH1_DQ_CLK 204
222#define EBI1_CH0_CA_CLK 205
223#define EBI1_CH1_CA_CLK 206
224#define EBI1_XO_CLK 207
225#define SFAB_SMPSS_S_H_CLK 208
226#define PRNG_SRC 209
227#define PRNG_CLK 210
228#define PXO_SRC 211
229#define SPDM_CY_PORT0_CLK 212
230#define SPDM_CY_PORT1_CLK 213
231#define SPDM_CY_PORT2_CLK 214
232#define SPDM_CY_PORT3_CLK 215
233#define SPDM_CY_PORT4_CLK 216
234#define SPDM_CY_PORT5_CLK 217
235#define SPDM_CY_PORT6_CLK 218
236#define SPDM_CY_PORT7_CLK 219
237#define PLL0 220
238#define PLL0_VOTE 221
239#define PLL3 222
240#define PLL3_VOTE 223
241#define PLL4 224
242#define PLL4_VOTE 225
243#define PLL8 226
244#define PLL8_VOTE 227
245#define PLL9 228
246#define PLL10 229
247#define PLL11 230
248#define PLL12 231
249#define PLL14 232
250#define PLL14_VOTE 233
251#define PLL18 234
252#define CE5_SRC 235
253#define CE5_H_CLK 236
254#define CE5_CORE_CLK 237
255#define CE3_SLEEP_CLK 238
256#define SFAB_AHB_S8_FCLK 239
257#define SPDM_CY_PORT8_CLK 246
258#define PCIE_ALT_REF_SRC 247
259#define PCIE_ALT_REF_CLK 248
260#define PCIE_1_A_CLK 249
261#define PCIE_1_AUX_CLK 250
262#define PCIE_1_H_CLK 251
263#define PCIE_1_PHY_CLK 252
264#define PCIE_1_ALT_REF_SRC 253
265#define PCIE_1_ALT_REF_CLK 254
266#define PCIE_2_A_CLK 255
267#define PCIE_2_AUX_CLK 256
268#define PCIE_2_H_CLK 257
269#define PCIE_2_PHY_CLK 258
270#define PCIE_2_ALT_REF_SRC 259
271#define PCIE_2_ALT_REF_CLK 260
272#define EBI2_CLK 261
273#define USB30_SLEEP_CLK 262
274#define USB30_UTMI_SRC 263
275#define USB30_0_UTMI_CLK 264
276#define USB30_1_UTMI_CLK 265
277#define USB30_MASTER_SRC 266
278#define USB30_0_MASTER_CLK 267
279#define USB30_1_MASTER_CLK 268
280#define GMAC_CORE1_CLK_SRC 269
281#define GMAC_CORE2_CLK_SRC 270
282#define GMAC_CORE3_CLK_SRC 271
283#define GMAC_CORE4_CLK_SRC 272
284#define GMAC_CORE1_CLK 273
285#define GMAC_CORE2_CLK 274
286#define GMAC_CORE3_CLK 275
287#define GMAC_CORE4_CLK 276
288#define UBI32_CORE1_CLK_SRC 277
289#define UBI32_CORE2_CLK_SRC 278
290#define UBI32_CORE1_CLK 279
291#define UBI32_CORE2_CLK 280
292
293#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8960.h b/include/dt-bindings/clock/qcom,gcc-msm8960.h
index f9f547146a15..7d20eedfee98 100644
--- a/include/dt-bindings/clock/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/clock/qcom,gcc-msm8960.h
@@ -308,5 +308,16 @@
308#define PLL13 292 308#define PLL13 292
309#define PLL14 293 309#define PLL14 293
310#define PLL14_VOTE 294 310#define PLL14_VOTE 294
311#define USB_HS3_H_CLK 295
312#define USB_HS3_XCVR_SRC 296
313#define USB_HS3_XCVR_CLK 297
314#define USB_HS4_H_CLK 298
315#define USB_HS4_XCVR_SRC 299
316#define USB_HS4_XCVR_CLK 300
317#define SATA_PHY_CFG_CLK 301
318#define SATA_A_CLK 302
319#define CE3_SRC 303
320#define CE3_CORE_CLK 304
321#define CE3_H_CLK 305
311 322
312#endif 323#endif
diff --git a/include/dt-bindings/clock/qcom,mmcc-apq8084.h b/include/dt-bindings/clock/qcom,mmcc-apq8084.h
new file mode 100644
index 000000000000..a929f86d0ddd
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,mmcc-apq8084.h
@@ -0,0 +1,183 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_CLK_APQ_MMCC_8084_H
15#define _DT_BINDINGS_CLK_APQ_MMCC_8084_H
16
17#define MMSS_AHB_CLK_SRC 0
18#define MMSS_AXI_CLK_SRC 1
19#define MMPLL0 2
20#define MMPLL0_VOTE 3
21#define MMPLL1 4
22#define MMPLL1_VOTE 5
23#define MMPLL2 6
24#define MMPLL3 7
25#define MMPLL4 8
26#define CSI0_CLK_SRC 9
27#define CSI1_CLK_SRC 10
28#define CSI2_CLK_SRC 11
29#define CSI3_CLK_SRC 12
30#define VCODEC0_CLK_SRC 13
31#define VFE0_CLK_SRC 14
32#define VFE1_CLK_SRC 15
33#define MDP_CLK_SRC 16
34#define PCLK0_CLK_SRC 17
35#define PCLK1_CLK_SRC 18
36#define OCMEMNOC_CLK_SRC 19
37#define GFX3D_CLK_SRC 20
38#define JPEG0_CLK_SRC 21
39#define JPEG1_CLK_SRC 22
40#define JPEG2_CLK_SRC 23
41#define EDPPIXEL_CLK_SRC 24
42#define EXTPCLK_CLK_SRC 25
43#define VP_CLK_SRC 26
44#define CCI_CLK_SRC 27
45#define CAMSS_GP0_CLK_SRC 28
46#define CAMSS_GP1_CLK_SRC 29
47#define MCLK0_CLK_SRC 30
48#define MCLK1_CLK_SRC 31
49#define MCLK2_CLK_SRC 32
50#define MCLK3_CLK_SRC 33
51#define CSI0PHYTIMER_CLK_SRC 34
52#define CSI1PHYTIMER_CLK_SRC 35
53#define CSI2PHYTIMER_CLK_SRC 36
54#define CPP_CLK_SRC 37
55#define BYTE0_CLK_SRC 38
56#define BYTE1_CLK_SRC 39
57#define EDPAUX_CLK_SRC 40
58#define EDPLINK_CLK_SRC 41
59#define ESC0_CLK_SRC 42
60#define ESC1_CLK_SRC 43
61#define HDMI_CLK_SRC 44
62#define VSYNC_CLK_SRC 45
63#define RBCPR_CLK_SRC 46
64#define RBBMTIMER_CLK_SRC 47
65#define MAPLE_CLK_SRC 48
66#define VDP_CLK_SRC 49
67#define VPU_BUS_CLK_SRC 50
68#define MMSS_CXO_CLK 51
69#define MMSS_SLEEPCLK_CLK 52
70#define AVSYNC_AHB_CLK 53
71#define AVSYNC_EDPPIXEL_CLK 54
72#define AVSYNC_EXTPCLK_CLK 55
73#define AVSYNC_PCLK0_CLK 56
74#define AVSYNC_PCLK1_CLK 57
75#define AVSYNC_VP_CLK 58
76#define CAMSS_AHB_CLK 59
77#define CAMSS_CCI_CCI_AHB_CLK 60
78#define CAMSS_CCI_CCI_CLK 61
79#define CAMSS_CSI0_AHB_CLK 62
80#define CAMSS_CSI0_CLK 63
81#define CAMSS_CSI0PHY_CLK 64
82#define CAMSS_CSI0PIX_CLK 65
83#define CAMSS_CSI0RDI_CLK 66
84#define CAMSS_CSI1_AHB_CLK 67
85#define CAMSS_CSI1_CLK 68
86#define CAMSS_CSI1PHY_CLK 69
87#define CAMSS_CSI1PIX_CLK 70
88#define CAMSS_CSI1RDI_CLK 71
89#define CAMSS_CSI2_AHB_CLK 72
90#define CAMSS_CSI2_CLK 73
91#define CAMSS_CSI2PHY_CLK 74
92#define CAMSS_CSI2PIX_CLK 75
93#define CAMSS_CSI2RDI_CLK 76
94#define CAMSS_CSI3_AHB_CLK 77
95#define CAMSS_CSI3_CLK 78
96#define CAMSS_CSI3PHY_CLK 79
97#define CAMSS_CSI3PIX_CLK 80
98#define CAMSS_CSI3RDI_CLK 81
99#define CAMSS_CSI_VFE0_CLK 82
100#define CAMSS_CSI_VFE1_CLK 83
101#define CAMSS_GP0_CLK 84
102#define CAMSS_GP1_CLK 85
103#define CAMSS_ISPIF_AHB_CLK 86
104#define CAMSS_JPEG_JPEG0_CLK 87
105#define CAMSS_JPEG_JPEG1_CLK 88
106#define CAMSS_JPEG_JPEG2_CLK 89
107#define CAMSS_JPEG_JPEG_AHB_CLK 90
108#define CAMSS_JPEG_JPEG_AXI_CLK 91
109#define CAMSS_MCLK0_CLK 92
110#define CAMSS_MCLK1_CLK 93
111#define CAMSS_MCLK2_CLK 94
112#define CAMSS_MCLK3_CLK 95
113#define CAMSS_MICRO_AHB_CLK 96
114#define CAMSS_PHY0_CSI0PHYTIMER_CLK 97
115#define CAMSS_PHY1_CSI1PHYTIMER_CLK 98
116#define CAMSS_PHY2_CSI2PHYTIMER_CLK 99
117#define CAMSS_TOP_AHB_CLK 100
118#define CAMSS_VFE_CPP_AHB_CLK 101
119#define CAMSS_VFE_CPP_CLK 102
120#define CAMSS_VFE_VFE0_CLK 103
121#define CAMSS_VFE_VFE1_CLK 104
122#define CAMSS_VFE_VFE_AHB_CLK 105
123#define CAMSS_VFE_VFE_AXI_CLK 106
124#define MDSS_AHB_CLK 107
125#define MDSS_AXI_CLK 108
126#define MDSS_BYTE0_CLK 109
127#define MDSS_BYTE1_CLK 110
128#define MDSS_EDPAUX_CLK 111
129#define MDSS_EDPLINK_CLK 112
130#define MDSS_EDPPIXEL_CLK 113
131#define MDSS_ESC0_CLK 114
132#define MDSS_ESC1_CLK 115
133#define MDSS_EXTPCLK_CLK 116
134#define MDSS_HDMI_AHB_CLK 117
135#define MDSS_HDMI_CLK 118
136#define MDSS_MDP_CLK 119
137#define MDSS_MDP_LUT_CLK 120
138#define MDSS_PCLK0_CLK 121
139#define MDSS_PCLK1_CLK 122
140#define MDSS_VSYNC_CLK 123
141#define MMSS_RBCPR_AHB_CLK 124
142#define MMSS_RBCPR_CLK 125
143#define MMSS_SPDM_AHB_CLK 126
144#define MMSS_SPDM_AXI_CLK 127
145#define MMSS_SPDM_CSI0_CLK 128
146#define MMSS_SPDM_GFX3D_CLK 129
147#define MMSS_SPDM_JPEG0_CLK 130
148#define MMSS_SPDM_JPEG1_CLK 131
149#define MMSS_SPDM_JPEG2_CLK 132
150#define MMSS_SPDM_MDP_CLK 133
151#define MMSS_SPDM_PCLK0_CLK 134
152#define MMSS_SPDM_PCLK1_CLK 135
153#define MMSS_SPDM_VCODEC0_CLK 136
154#define MMSS_SPDM_VFE0_CLK 137
155#define MMSS_SPDM_VFE1_CLK 138
156#define MMSS_SPDM_RM_AXI_CLK 139
157#define MMSS_SPDM_RM_OCMEMNOC_CLK 140
158#define MMSS_MISC_AHB_CLK 141
159#define MMSS_MMSSNOC_AHB_CLK 142
160#define MMSS_MMSSNOC_BTO_AHB_CLK 143
161#define MMSS_MMSSNOC_AXI_CLK 144
162#define MMSS_S0_AXI_CLK 145
163#define OCMEMCX_AHB_CLK 146
164#define OCMEMCX_OCMEMNOC_CLK 147
165#define OXILI_OCMEMGX_CLK 148
166#define OXILI_GFX3D_CLK 149
167#define OXILI_RBBMTIMER_CLK 150
168#define OXILICX_AHB_CLK 151
169#define VENUS0_AHB_CLK 152
170#define VENUS0_AXI_CLK 153
171#define VENUS0_CORE0_VCODEC_CLK 154
172#define VENUS0_CORE1_VCODEC_CLK 155
173#define VENUS0_OCMEMNOC_CLK 156
174#define VENUS0_VCODEC0_CLK 157
175#define VPU_AHB_CLK 158
176#define VPU_AXI_CLK 159
177#define VPU_BUS_CLK 160
178#define VPU_CXO_CLK 161
179#define VPU_MAPLE_CLK 162
180#define VPU_SLEEP_CLK 163
181#define VPU_VDP_CLK 164
182
183#endif
diff --git a/include/dt-bindings/clock/qcom,mmcc-msm8960.h b/include/dt-bindings/clock/qcom,mmcc-msm8960.h
index 5868ef14a777..85041b28f97f 100644
--- a/include/dt-bindings/clock/qcom,mmcc-msm8960.h
+++ b/include/dt-bindings/clock/qcom,mmcc-msm8960.h
@@ -133,5 +133,13 @@
133#define CSIPHY0_TIMER_CLK 116 133#define CSIPHY0_TIMER_CLK 116
134#define PLL1 117 134#define PLL1 117
135#define PLL2 118 135#define PLL2 118
136#define RGB_TV_CLK 119
137#define NPL_TV_CLK 120
138#define VCAP_AHB_CLK 121
139#define VCAP_AXI_CLK 122
140#define VCAP_SRC 123
141#define VCAP_CLK 124
142#define VCAP_NPL_CLK 125
143#define PLL15 126
136 144
137#endif 145#endif
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index 1118f7a4bca6..f929a79e6998 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -59,6 +59,7 @@
59#define R8A7790_CLK_SDHI0 14 59#define R8A7790_CLK_SDHI0 14
60#define R8A7790_CLK_MMCIF0 15 60#define R8A7790_CLK_MMCIF0 15
61#define R8A7790_CLK_IIC0 18 61#define R8A7790_CLK_IIC0 18
62#define R8A7790_CLK_PCIEC 19
62#define R8A7790_CLK_IIC1 23 63#define R8A7790_CLK_IIC1 23
63#define R8A7790_CLK_SSUSB 28 64#define R8A7790_CLK_SSUSB 28
64#define R8A7790_CLK_CMT1 29 65#define R8A7790_CLK_CMT1 29
@@ -107,4 +108,30 @@
107#define R8A7790_CLK_I2C1 30 108#define R8A7790_CLK_I2C1 30
108#define R8A7790_CLK_I2C0 31 109#define R8A7790_CLK_I2C0 31
109 110
111/* MSTP10 */
112#define R8A7790_CLK_SSI_ALL 5
113#define R8A7790_CLK_SSI9 6
114#define R8A7790_CLK_SSI8 7
115#define R8A7790_CLK_SSI7 8
116#define R8A7790_CLK_SSI6 9
117#define R8A7790_CLK_SSI5 10
118#define R8A7790_CLK_SSI4 11
119#define R8A7790_CLK_SSI3 12
120#define R8A7790_CLK_SSI2 13
121#define R8A7790_CLK_SSI1 14
122#define R8A7790_CLK_SSI0 15
123#define R8A7790_CLK_SCU_ALL 17
124#define R8A7790_CLK_SCU_DVC1 18
125#define R8A7790_CLK_SCU_DVC0 19
126#define R8A7790_CLK_SCU_SRC9 22
127#define R8A7790_CLK_SCU_SRC8 23
128#define R8A7790_CLK_SCU_SRC7 24
129#define R8A7790_CLK_SCU_SRC6 25
130#define R8A7790_CLK_SCU_SRC5 26
131#define R8A7790_CLK_SCU_SRC4 27
132#define R8A7790_CLK_SCU_SRC3 28
133#define R8A7790_CLK_SCU_SRC2 29
134#define R8A7790_CLK_SCU_SRC1 30
135#define R8A7790_CLK_SCU_SRC0 31
136
110#endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */ 137#endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index b050d18437ce..f0d4d1049162 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -53,6 +53,7 @@
53#define R8A7791_CLK_SDHI0 14 53#define R8A7791_CLK_SDHI0 14
54#define R8A7791_CLK_MMCIF0 15 54#define R8A7791_CLK_MMCIF0 15
55#define R8A7791_CLK_IIC0 18 55#define R8A7791_CLK_IIC0 18
56#define R8A7791_CLK_PCIEC 19
56#define R8A7791_CLK_IIC1 23 57#define R8A7791_CLK_IIC1 23
57#define R8A7791_CLK_SSUSB 28 58#define R8A7791_CLK_SSUSB 28
58#define R8A7791_CLK_CMT1 29 59#define R8A7791_CLK_CMT1 29
@@ -107,6 +108,32 @@
107#define R8A7791_CLK_I2C1 30 108#define R8A7791_CLK_I2C1 30
108#define R8A7791_CLK_I2C0 31 109#define R8A7791_CLK_I2C0 31
109 110
111/* MSTP10 */
112#define R8A7791_CLK_SSI_ALL 5
113#define R8A7791_CLK_SSI9 6
114#define R8A7791_CLK_SSI8 7
115#define R8A7791_CLK_SSI7 8
116#define R8A7791_CLK_SSI6 9
117#define R8A7791_CLK_SSI5 10
118#define R8A7791_CLK_SSI4 11
119#define R8A7791_CLK_SSI3 12
120#define R8A7791_CLK_SSI2 13
121#define R8A7791_CLK_SSI1 14
122#define R8A7791_CLK_SSI0 15
123#define R8A7791_CLK_SCU_ALL 17
124#define R8A7791_CLK_SCU_DVC1 18
125#define R8A7791_CLK_SCU_DVC0 19
126#define R8A7791_CLK_SCU_SRC9 22
127#define R8A7791_CLK_SCU_SRC8 23
128#define R8A7791_CLK_SCU_SRC7 24
129#define R8A7791_CLK_SCU_SRC6 25
130#define R8A7791_CLK_SCU_SRC5 26
131#define R8A7791_CLK_SCU_SRC4 27
132#define R8A7791_CLK_SCU_SRC3 28
133#define R8A7791_CLK_SCU_SRC2 29
134#define R8A7791_CLK_SCU_SRC1 30
135#define R8A7791_CLK_SCU_SRC0 31
136
110/* MSTP11 */ 137/* MSTP11 */
111#define R8A7791_CLK_SCIFA3 6 138#define R8A7791_CLK_SCIFA3 6
112#define R8A7791_CLK_SCIFA4 7 139#define R8A7791_CLK_SCIFA4 7
diff --git a/include/dt-bindings/clock/rk3066a-cru.h b/include/dt-bindings/clock/rk3066a-cru.h
new file mode 100644
index 000000000000..bc1ed1dbd855
--- /dev/null
+++ b/include/dt-bindings/clock/rk3066a-cru.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <dt-bindings/clock/rk3188-cru-common.h>
17
18/* soft-reset indices */
19#define SRST_SRST1 0
20#define SRST_SRST2 1
21
22#define SRST_L2MEM 18
23#define SRST_I2S0 23
24#define SRST_I2S1 24
25#define SRST_I2S2 25
26#define SRST_TIMER2 29
27
28#define SRST_GPIO4 36
29#define SRST_GPIO6 38
30
31#define SRST_TSADC 92
32
33#define SRST_HDMI 96
34#define SRST_HDMI_APB 97
35#define SRST_CIF1 111
diff --git a/include/dt-bindings/clock/rk3188-cru-common.h b/include/dt-bindings/clock/rk3188-cru-common.h
new file mode 100644
index 000000000000..750ee60e75fb
--- /dev/null
+++ b/include/dt-bindings/clock/rk3188-cru-common.h
@@ -0,0 +1,249 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16/* core clocks from */
17#define PLL_APLL 1
18#define PLL_DPLL 2
19#define PLL_CPLL 3
20#define PLL_GPLL 4
21#define CORE_PERI 5
22#define CORE_L2C 6
23
24/* sclk gates (special clocks) */
25#define SCLK_UART0 64
26#define SCLK_UART1 65
27#define SCLK_UART2 66
28#define SCLK_UART3 67
29#define SCLK_MAC 68
30#define SCLK_SPI0 69
31#define SCLK_SPI1 70
32#define SCLK_SARADC 71
33#define SCLK_SDMMC 72
34#define SCLK_SDIO 73
35#define SCLK_EMMC 74
36#define SCLK_I2S0 75
37#define SCLK_I2S1 76
38#define SCLK_I2S2 77
39#define SCLK_SPDIF 78
40#define SCLK_CIF0 79
41#define SCLK_CIF1 80
42#define SCLK_OTGPHY0 81
43#define SCLK_OTGPHY1 82
44#define SCLK_HSADC 83
45#define SCLK_TIMER0 84
46#define SCLK_TIMER1 85
47#define SCLK_TIMER2 86
48#define SCLK_TIMER3 87
49#define SCLK_TIMER4 88
50#define SCLK_TIMER5 89
51#define SCLK_TIMER6 90
52#define SCLK_JTAG 91
53#define SCLK_SMC 92
54
55#define DCLK_LCDC0 190
56#define DCLK_LCDC1 191
57
58/* aclk gates */
59#define ACLK_DMA1 192
60#define ACLK_DMA2 193
61#define ACLK_GPS 194
62#define ACLK_LCDC0 195
63#define ACLK_LCDC1 196
64#define ACLK_GPU 197
65#define ACLK_SMC 198
66#define ACLK_CIF 199
67#define ACLK_IPP 200
68#define ACLK_RGA 201
69#define ACLK_CIF0 202
70
71/* pclk gates */
72#define PCLK_GRF 320
73#define PCLK_PMU 321
74#define PCLK_TIMER0 322
75#define PCLK_TIMER1 323
76#define PCLK_TIMER2 324
77#define PCLK_TIMER3 325
78#define PCLK_PWM01 326
79#define PCLK_PWM23 327
80#define PCLK_SPI0 328
81#define PCLK_SPI1 329
82#define PCLK_SARADC 330
83#define PCLK_WDT 331
84#define PCLK_UART0 332
85#define PCLK_UART1 333
86#define PCLK_UART2 334
87#define PCLK_UART3 335
88#define PCLK_I2C0 336
89#define PCLK_I2C1 337
90#define PCLK_I2C2 338
91#define PCLK_I2C3 339
92#define PCLK_I2C4 340
93#define PCLK_GPIO0 341
94#define PCLK_GPIO1 342
95#define PCLK_GPIO2 343
96#define PCLK_GPIO3 344
97#define PCLK_GPIO4 345
98#define PCLK_GPIO6 346
99#define PCLK_EFUSE 347
100#define PCLK_TZPC 348
101#define PCLK_TSADC 349
102
103/* hclk gates */
104#define HCLK_SDMMC 448
105#define HCLK_SDIO 449
106#define HCLK_EMMC 450
107#define HCLK_OTG0 451
108#define HCLK_EMAC 452
109#define HCLK_SPDIF 453
110#define HCLK_I2S0 454
111#define HCLK_I2S1 455
112#define HCLK_I2S2 456
113#define HCLK_OTG1 457
114#define HCLK_HSIC 458
115#define HCLK_HSADC 459
116#define HCLK_PIDF 460
117#define HCLK_LCDC0 461
118#define HCLK_LCDC1 462
119#define HCLK_ROM 463
120#define HCLK_CIF0 464
121#define HCLK_IPP 465
122#define HCLK_RGA 466
123#define HCLK_NANDC0 467
124
125#define CLK_NR_CLKS (HCLK_NANDC0 + 1)
126
127/* soft-reset indices */
128#define SRST_MCORE 2
129#define SRST_CORE0 3
130#define SRST_CORE1 4
131#define SRST_MCORE_DBG 7
132#define SRST_CORE0_DBG 8
133#define SRST_CORE1_DBG 9
134#define SRST_CORE0_WDT 12
135#define SRST_CORE1_WDT 13
136#define SRST_STRC_SYS 14
137#define SRST_L2C 15
138
139#define SRST_CPU_AHB 17
140#define SRST_AHB2APB 19
141#define SRST_DMA1 20
142#define SRST_INTMEM 21
143#define SRST_ROM 22
144#define SRST_SPDIF 26
145#define SRST_TIMER0 27
146#define SRST_TIMER1 28
147#define SRST_EFUSE 30
148
149#define SRST_GPIO0 32
150#define SRST_GPIO1 33
151#define SRST_GPIO2 34
152#define SRST_GPIO3 35
153
154#define SRST_UART0 39
155#define SRST_UART1 40
156#define SRST_UART2 41
157#define SRST_UART3 42
158#define SRST_I2C0 43
159#define SRST_I2C1 44
160#define SRST_I2C2 45
161#define SRST_I2C3 46
162#define SRST_I2C4 47
163
164#define SRST_PWM0 48
165#define SRST_PWM1 49
166#define SRST_DAP_PO 50
167#define SRST_DAP 51
168#define SRST_DAP_SYS 52
169#define SRST_TPIU_ATB 53
170#define SRST_PMU_APB 54
171#define SRST_GRF 55
172#define SRST_PMU 56
173#define SRST_PERI_AXI 57
174#define SRST_PERI_AHB 58
175#define SRST_PERI_APB 59
176#define SRST_PERI_NIU 60
177#define SRST_CPU_PERI 61
178#define SRST_EMEM_PERI 62
179#define SRST_USB_PERI 63
180
181#define SRST_DMA2 64
182#define SRST_SMC 65
183#define SRST_MAC 66
184#define SRST_NANC0 68
185#define SRST_USBOTG0 69
186#define SRST_USBPHY0 70
187#define SRST_OTGC0 71
188#define SRST_USBOTG1 72
189#define SRST_USBPHY1 73
190#define SRST_OTGC1 74
191#define SRST_HSADC 76
192#define SRST_PIDFILTER 77
193#define SRST_DDR_MSCH 79
194
195#define SRST_TZPC 80
196#define SRST_SDMMC 81
197#define SRST_SDIO 82
198#define SRST_EMMC 83
199#define SRST_SPI0 84
200#define SRST_SPI1 85
201#define SRST_WDT 86
202#define SRST_SARADC 87
203#define SRST_DDRPHY 88
204#define SRST_DDRPHY_APB 89
205#define SRST_DDRCTL 90
206#define SRST_DDRCTL_APB 91
207#define SRST_DDRPUB 93
208
209#define SRST_VIO0_AXI 98
210#define SRST_VIO0_AHB 99
211#define SRST_LCDC0_AXI 100
212#define SRST_LCDC0_AHB 101
213#define SRST_LCDC0_DCLK 102
214#define SRST_LCDC1_AXI 103
215#define SRST_LCDC1_AHB 104
216#define SRST_LCDC1_DCLK 105
217#define SRST_IPP_AXI 106
218#define SRST_IPP_AHB 107
219#define SRST_RGA_AXI 108
220#define SRST_RGA_AHB 109
221#define SRST_CIF0 110
222
223#define SRST_VCODEC_AXI 112
224#define SRST_VCODEC_AHB 113
225#define SRST_VIO1_AXI 114
226#define SRST_VCODEC_CPU 115
227#define SRST_VCODEC_NIU 116
228#define SRST_GPU 120
229#define SRST_GPU_NIU 122
230#define SRST_TFUN_ATB 125
231#define SRST_TFUN_APB 126
232#define SRST_CTI4_APB 127
233
234#define SRST_TPIU_APB 128
235#define SRST_TRACE 129
236#define SRST_CORE_DBG 130
237#define SRST_DBG_APB 131
238#define SRST_CTI0 132
239#define SRST_CTI0_APB 133
240#define SRST_CTI1 134
241#define SRST_CTI1_APB 135
242#define SRST_PTM_CORE0 136
243#define SRST_PTM_CORE1 137
244#define SRST_PTM0 138
245#define SRST_PTM0_ATB 139
246#define SRST_PTM1 140
247#define SRST_PTM1_ATB 141
248#define SRST_CTM 142
249#define SRST_TS 143
diff --git a/include/dt-bindings/clock/rk3188-cru.h b/include/dt-bindings/clock/rk3188-cru.h
new file mode 100644
index 000000000000..9fac8edd3f9d
--- /dev/null
+++ b/include/dt-bindings/clock/rk3188-cru.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <dt-bindings/clock/rk3188-cru-common.h>
17
18/* soft-reset indices */
19#define SRST_PTM_CORE2 0
20#define SRST_PTM_CORE3 1
21#define SRST_CORE2 5
22#define SRST_CORE3 6
23#define SRST_CORE2_DBG 10
24#define SRST_CORE3_DBG 11
25
26#define SRST_TIMER2 16
27#define SRST_TIMER4 23
28#define SRST_I2S0 24
29#define SRST_TIMER5 25
30#define SRST_TIMER3 29
31#define SRST_TIMER6 31
32
33#define SRST_PTM3 36
34#define SRST_PTM3_ATB 37
35
36#define SRST_GPS 67
37#define SRST_HSICPHY 75
38#define SRST_TIMER 78
39
40#define SRST_PTM2 92
41#define SRST_CORE2_WDT 94
42#define SRST_CORE3_WDT 95
43
44#define SRST_PTM2_ATB 111
45
46#define SRST_HSIC 117
47#define SRST_CTI2 118
48#define SRST_CTI2_APB 119
49#define SRST_GPU_BRIDGE 121
50#define SRST_CTI3 123
51#define SRST_CTI3_APB 124
diff --git a/include/dt-bindings/clock/rk3288-cru.h b/include/dt-bindings/clock/rk3288-cru.h
new file mode 100644
index 000000000000..ebcb460ea4ad
--- /dev/null
+++ b/include/dt-bindings/clock/rk3288-cru.h
@@ -0,0 +1,278 @@
1/*
2 * Copyright (c) 2014 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16/* core clocks */
17#define PLL_APLL 1
18#define PLL_DPLL 2
19#define PLL_CPLL 3
20#define PLL_GPLL 4
21#define PLL_NPLL 5
22
23/* sclk gates (special clocks) */
24#define SCLK_GPU 64
25#define SCLK_SPI0 65
26#define SCLK_SPI1 66
27#define SCLK_SPI2 67
28#define SCLK_SDMMC 68
29#define SCLK_SDIO0 69
30#define SCLK_SDIO1 70
31#define SCLK_EMMC 71
32#define SCLK_TSADC 72
33#define SCLK_SARADC 73
34#define SCLK_PS2C 74
35#define SCLK_NANDC0 75
36#define SCLK_NANDC1 76
37#define SCLK_UART0 77
38#define SCLK_UART1 78
39#define SCLK_UART2 79
40#define SCLK_UART3 80
41#define SCLK_UART4 81
42#define SCLK_I2S0 82
43#define SCLK_SPDIF 83
44#define SCLK_SPDIF8CH 84
45#define SCLK_TIMER0 85
46#define SCLK_TIMER1 86
47#define SCLK_TIMER2 87
48#define SCLK_TIMER3 88
49#define SCLK_TIMER4 89
50#define SCLK_TIMER5 90
51#define SCLK_TIMER6 91
52#define SCLK_HSADC 92
53#define SCLK_OTGPHY0 93
54#define SCLK_OTGPHY1 94
55#define SCLK_OTGPHY2 95
56#define SCLK_OTG_ADP 96
57#define SCLK_HSICPHY480M 97
58#define SCLK_HSICPHY12M 98
59#define SCLK_MACREF 99
60#define SCLK_LCDC_PWM0 100
61#define SCLK_LCDC_PWM1 101
62#define SCLK_MAC_RX 102
63#define SCLK_MAC_TX 103
64
65#define DCLK_VOP0 190
66#define DCLK_VOP1 191
67
68/* aclk gates */
69#define ACLK_GPU 192
70#define ACLK_DMAC1 193
71#define ACLK_DMAC2 194
72#define ACLK_MMU 195
73#define ACLK_GMAC 196
74#define ACLK_VOP0 197
75#define ACLK_VOP1 198
76#define ACLK_CRYPTO 199
77#define ACLK_RGA 200
78
79/* pclk gates */
80#define PCLK_GPIO0 320
81#define PCLK_GPIO1 321
82#define PCLK_GPIO2 322
83#define PCLK_GPIO3 323
84#define PCLK_GPIO4 324
85#define PCLK_GPIO5 325
86#define PCLK_GPIO6 326
87#define PCLK_GPIO7 327
88#define PCLK_GPIO8 328
89#define PCLK_GRF 329
90#define PCLK_SGRF 330
91#define PCLK_PMU 331
92#define PCLK_I2C0 332
93#define PCLK_I2C1 333
94#define PCLK_I2C2 334
95#define PCLK_I2C3 335
96#define PCLK_I2C4 336
97#define PCLK_I2C5 337
98#define PCLK_SPI0 338
99#define PCLK_SPI1 339
100#define PCLK_SPI2 340
101#define PCLK_UART0 341
102#define PCLK_UART1 342
103#define PCLK_UART2 343
104#define PCLK_UART3 344
105#define PCLK_UART4 345
106#define PCLK_TSADC 346
107#define PCLK_SARADC 347
108#define PCLK_SIM 348
109#define PCLK_GMAC 349
110#define PCLK_PWM 350
111#define PCLK_RKPWM 351
112#define PCLK_PS2C 352
113#define PCLK_TIMER 353
114#define PCLK_TZPC 354
115
116/* hclk gates */
117#define HCLK_GPS 448
118#define HCLK_OTG0 449
119#define HCLK_USBHOST0 450
120#define HCLK_USBHOST1 451
121#define HCLK_HSIC 452
122#define HCLK_NANDC0 453
123#define HCLK_NANDC1 454
124#define HCLK_TSP 455
125#define HCLK_SDMMC 456
126#define HCLK_SDIO0 457
127#define HCLK_SDIO1 458
128#define HCLK_EMMC 459
129#define HCLK_HSADC 460
130#define HCLK_CRYPTO 461
131#define HCLK_I2S0 462
132#define HCLK_SPDIF 463
133#define HCLK_SPDIF8CH 464
134#define HCLK_VOP0 465
135#define HCLK_VOP1 466
136#define HCLK_ROM 467
137#define HCLK_IEP 468
138#define HCLK_ISP 469
139#define HCLK_RGA 470
140
141#define CLK_NR_CLKS (HCLK_RGA + 1)
142
143/* soft-reset indices */
144#define SRST_CORE0 0
145#define SRST_CORE1 1
146#define SRST_CORE2 2
147#define SRST_CORE3 3
148#define SRST_CORE0_PO 4
149#define SRST_CORE1_PO 5
150#define SRST_CORE2_PO 6
151#define SRST_CORE3_PO 7
152#define SRST_PDCORE_STRSYS 8
153#define SRST_PDBUS_STRSYS 9
154#define SRST_L2C 10
155#define SRST_TOPDBG 11
156#define SRST_CORE0_DBG 12
157#define SRST_CORE1_DBG 13
158#define SRST_CORE2_DBG 14
159#define SRST_CORE3_DBG 15
160
161#define SRST_PDBUG_AHB_ARBITOR 16
162#define SRST_EFUSE256 17
163#define SRST_DMAC1 18
164#define SRST_INTMEM 19
165#define SRST_ROM 20
166#define SRST_SPDIF8CH 21
167#define SRST_TIMER 22
168#define SRST_I2S0 23
169#define SRST_SPDIF 24
170#define SRST_TIMER0 25
171#define SRST_TIMER1 26
172#define SRST_TIMER2 27
173#define SRST_TIMER3 28
174#define SRST_TIMER4 29
175#define SRST_TIMER5 30
176#define SRST_EFUSE 31
177
178#define SRST_GPIO0 32
179#define SRST_GPIO1 33
180#define SRST_GPIO2 34
181#define SRST_GPIO3 35
182#define SRST_GPIO4 36
183#define SRST_GPIO5 37
184#define SRST_GPIO6 38
185#define SRST_GPIO7 39
186#define SRST_GPIO8 40
187#define SRST_I2C0 42
188#define SRST_I2C1 43
189#define SRST_I2C2 44
190#define SRST_I2C3 45
191#define SRST_I2C4 46
192#define SRST_I2C5 47
193
194#define SRST_DWPWM 48
195#define SRST_MMC_PERI 49
196#define SRST_PERIPH_MMU 50
197#define SRST_DAP 51
198#define SRST_DAP_SYS 52
199#define SRST_TPIU 53
200#define SRST_PMU_APB 54
201#define SRST_GRF 55
202#define SRST_PMU 56
203#define SRST_PERIPH_AXI 57
204#define SRST_PERIPH_AHB 58
205#define SRST_PERIPH_APB 59
206#define SRST_PERIPH_NIU 60
207#define SRST_PDPERI_AHB_ARBI 61
208#define SRST_EMEM 62
209#define SRST_USB_PERI 63
210
211#define SRST_DMAC2 64
212#define SRST_MAC 66
213#define SRST_GPS 67
214#define SRST_RKPWM 69
215#define SRST_CCP 71
216#define SRST_USBHOST0 72
217#define SRST_HSIC 73
218#define SRST_HSIC_AUX 74
219#define SRST_HSIC_PHY 75
220#define SRST_HSADC 76
221#define SRST_NANDC0 77
222#define SRST_NANDC1 78
223
224#define SRST_TZPC 80
225#define SRST_SPI0 83
226#define SRST_SPI1 84
227#define SRST_SPI2 85
228#define SRST_SARADC 87
229#define SRST_PDALIVE_NIU 88
230#define SRST_PDPMU_INTMEM 89
231#define SRST_PDPMU_NIU 90
232#define SRST_SGRF 91
233
234#define SRST_VIO_ARBI 96
235#define SRST_RGA_NIU 97
236#define SRST_VIO0_NIU_AXI 98
237#define SRST_VIO_NIU_AHB 99
238#define SRST_LCDC0_AXI 100
239#define SRST_LCDC0_AHB 101
240#define SRST_LCDC0_DCLK 102
241#define SRST_VIO1_NIU_AXI 103
242#define SRST_VIP 104
243#define SRST_RGA_CORE 105
244#define SRST_IEP_AXI 106
245#define SRST_IEP_AHB 107
246#define SRST_RGA_AXI 108
247#define SRST_RGA_AHB 109
248#define SRST_ISP 110
249#define SRST_EDP 111
250
251#define SRST_VCODEC_AXI 112
252#define SRST_VCODEC_AHB 113
253#define SRST_VIO_H2P 114
254#define SRST_MIPIDSI0 115
255#define SRST_MIPIDSI1 116
256#define SRST_MIPICSI 117
257#define SRST_LVDS_PHY 118
258#define SRST_LVDS_CON 119
259#define SRST_GPU 120
260#define SRST_HDMI 121
261#define SRST_CORE_PVTM 124
262#define SRST_GPU_PVTM 125
263
264#define SRST_MMC0 128
265#define SRST_SDIO0 129
266#define SRST_SDIO1 130
267#define SRST_EMMC 131
268#define SRST_USBOTG_AHB 132
269#define SRST_USBOTG_PHY 133
270#define SRST_USBOTG_CON 134
271#define SRST_USBHOST0_AHB 135
272#define SRST_USBHOST0_PHY 136
273#define SRST_USBHOST0_CON 137
274#define SRST_USBHOST1_AHB 138
275#define SRST_USBHOST1_PHY 139
276#define SRST_USBHOST1_CON 140
277#define SRST_USB_ADP 141
278#define SRST_ACC_EFUSE 142
diff --git a/include/dt-bindings/clock/s5pv210-audss.h b/include/dt-bindings/clock/s5pv210-audss.h
new file mode 100644
index 000000000000..fe57406e24de
--- /dev/null
+++ b/include/dt-bindings/clock/s5pv210-audss.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (c) 2014 Tomasz Figa <tomasz.figa@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This header provides constants for Samsung audio subsystem
9 * clock controller.
10 *
11 * The constants defined in this header are being used in dts
12 * and s5pv210 audss driver.
13 */
14
15#ifndef _DT_BINDINGS_CLOCK_S5PV210_AUDSS_H
16#define _DT_BINDINGS_CLOCK_S5PV210_AUDSS_H
17
18#define CLK_MOUT_AUDSS 0
19#define CLK_MOUT_I2S_A 1
20
21#define CLK_DOUT_AUD_BUS 2
22#define CLK_DOUT_I2S_A 3
23
24#define CLK_I2S 4
25#define CLK_HCLK_I2S 5
26#define CLK_HCLK_UART 6
27#define CLK_HCLK_HWA 7
28#define CLK_HCLK_DMA 8
29#define CLK_HCLK_BUF 9
30#define CLK_HCLK_RP 10
31
32#define AUDSS_MAX_CLKS 11
33
34#endif
diff --git a/include/dt-bindings/clock/s5pv210.h b/include/dt-bindings/clock/s5pv210.h
new file mode 100644
index 000000000000..e88986b7c677
--- /dev/null
+++ b/include/dt-bindings/clock/s5pv210.h
@@ -0,0 +1,239 @@
1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Mateusz Krawczuk <m.krawczuk@partner.samsung.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 as
7 * published by the Free Software Foundation.
8 *
9 * Device Tree binding constants for Samsung S5PV210 clock controller.
10 */
11
12#ifndef _DT_BINDINGS_CLOCK_S5PV210_H
13#define _DT_BINDINGS_CLOCK_S5PV210_H
14
15/* Core clocks. */
16#define FIN_PLL 1
17#define FOUT_APLL 2
18#define FOUT_MPLL 3
19#define FOUT_EPLL 4
20#define FOUT_VPLL 5
21
22/* Muxes. */
23#define MOUT_FLASH 6
24#define MOUT_PSYS 7
25#define MOUT_DSYS 8
26#define MOUT_MSYS 9
27#define MOUT_VPLL 10
28#define MOUT_EPLL 11
29#define MOUT_MPLL 12
30#define MOUT_APLL 13
31#define MOUT_VPLLSRC 14
32#define MOUT_CSIS 15
33#define MOUT_FIMD 16
34#define MOUT_CAM1 17
35#define MOUT_CAM0 18
36#define MOUT_DAC 19
37#define MOUT_MIXER 20
38#define MOUT_HDMI 21
39#define MOUT_G2D 22
40#define MOUT_MFC 23
41#define MOUT_G3D 24
42#define MOUT_FIMC2 25
43#define MOUT_FIMC1 26
44#define MOUT_FIMC0 27
45#define MOUT_UART3 28
46#define MOUT_UART2 29
47#define MOUT_UART1 30
48#define MOUT_UART0 31
49#define MOUT_MMC3 32
50#define MOUT_MMC2 33
51#define MOUT_MMC1 34
52#define MOUT_MMC0 35
53#define MOUT_PWM 36
54#define MOUT_SPI0 37
55#define MOUT_SPI1 38
56#define MOUT_DMC0 39
57#define MOUT_PWI 40
58#define MOUT_HPM 41
59#define MOUT_SPDIF 42
60#define MOUT_AUDIO2 43
61#define MOUT_AUDIO1 44
62#define MOUT_AUDIO0 45
63
64/* Dividers. */
65#define DOUT_PCLKP 46
66#define DOUT_HCLKP 47
67#define DOUT_PCLKD 48
68#define DOUT_HCLKD 49
69#define DOUT_PCLKM 50
70#define DOUT_HCLKM 51
71#define DOUT_A2M 52
72#define DOUT_APLL 53
73#define DOUT_CSIS 54
74#define DOUT_FIMD 55
75#define DOUT_CAM1 56
76#define DOUT_CAM0 57
77#define DOUT_TBLK 58
78#define DOUT_G2D 59
79#define DOUT_MFC 60
80#define DOUT_G3D 61
81#define DOUT_FIMC2 62
82#define DOUT_FIMC1 63
83#define DOUT_FIMC0 64
84#define DOUT_UART3 65
85#define DOUT_UART2 66
86#define DOUT_UART1 67
87#define DOUT_UART0 68
88#define DOUT_MMC3 69
89#define DOUT_MMC2 70
90#define DOUT_MMC1 71
91#define DOUT_MMC0 72
92#define DOUT_PWM 73
93#define DOUT_SPI1 74
94#define DOUT_SPI0 75
95#define DOUT_DMC0 76
96#define DOUT_PWI 77
97#define DOUT_HPM 78
98#define DOUT_COPY 79
99#define DOUT_FLASH 80
100#define DOUT_AUDIO2 81
101#define DOUT_AUDIO1 82
102#define DOUT_AUDIO0 83
103#define DOUT_DPM 84
104#define DOUT_DVSEM 85
105
106/* Gates */
107#define SCLK_FIMC 86
108#define CLK_CSIS 87
109#define CLK_ROTATOR 88
110#define CLK_FIMC2 89
111#define CLK_FIMC1 90
112#define CLK_FIMC0 91
113#define CLK_MFC 92
114#define CLK_G2D 93
115#define CLK_G3D 94
116#define CLK_IMEM 95
117#define CLK_PDMA1 96
118#define CLK_PDMA0 97
119#define CLK_MDMA 98
120#define CLK_DMC1 99
121#define CLK_DMC0 100
122#define CLK_NFCON 101
123#define CLK_SROMC 102
124#define CLK_CFCON 103
125#define CLK_NANDXL 104
126#define CLK_USB_HOST 105
127#define CLK_USB_OTG 106
128#define CLK_HDMI 107
129#define CLK_TVENC 108
130#define CLK_MIXER 109
131#define CLK_VP 110
132#define CLK_DSIM 111
133#define CLK_FIMD 112
134#define CLK_TZIC3 113
135#define CLK_TZIC2 114
136#define CLK_TZIC1 115
137#define CLK_TZIC0 116
138#define CLK_VIC3 117
139#define CLK_VIC2 118
140#define CLK_VIC1 119
141#define CLK_VIC0 120
142#define CLK_TSI 121
143#define CLK_HSMMC3 122
144#define CLK_HSMMC2 123
145#define CLK_HSMMC1 124
146#define CLK_HSMMC0 125
147#define CLK_JTAG 126
148#define CLK_MODEMIF 127
149#define CLK_CORESIGHT 128
150#define CLK_SDM 129
151#define CLK_SECSS 130
152#define CLK_PCM2 131
153#define CLK_PCM1 132
154#define CLK_PCM0 133
155#define CLK_SYSCON 134
156#define CLK_GPIO 135
157#define CLK_TSADC 136
158#define CLK_PWM 137
159#define CLK_WDT 138
160#define CLK_KEYIF 139
161#define CLK_UART3 140
162#define CLK_UART2 141
163#define CLK_UART1 142
164#define CLK_UART0 143
165#define CLK_SYSTIMER 144
166#define CLK_RTC 145
167#define CLK_SPI1 146
168#define CLK_SPI0 147
169#define CLK_I2C_HDMI_PHY 148
170#define CLK_I2C1 149
171#define CLK_I2C2 150
172#define CLK_I2C0 151
173#define CLK_I2S1 152
174#define CLK_I2S2 153
175#define CLK_I2S0 154
176#define CLK_AC97 155
177#define CLK_SPDIF 156
178#define CLK_TZPC3 157
179#define CLK_TZPC2 158
180#define CLK_TZPC1 159
181#define CLK_TZPC0 160
182#define CLK_SECKEY 161
183#define CLK_IEM_APC 162
184#define CLK_IEM_IEC 163
185#define CLK_CHIPID 164
186#define CLK_JPEG 163
187
188/* Special clocks*/
189#define SCLK_PWI 164
190#define SCLK_SPDIF 165
191#define SCLK_AUDIO2 166
192#define SCLK_AUDIO1 167
193#define SCLK_AUDIO0 168
194#define SCLK_PWM 169
195#define SCLK_SPI1 170
196#define SCLK_SPI0 171
197#define SCLK_UART3 172
198#define SCLK_UART2 173
199#define SCLK_UART1 174
200#define SCLK_UART0 175
201#define SCLK_MMC3 176
202#define SCLK_MMC2 177
203#define SCLK_MMC1 178
204#define SCLK_MMC0 179
205#define SCLK_FINVPLL 180
206#define SCLK_CSIS 181
207#define SCLK_FIMD 182
208#define SCLK_CAM1 183
209#define SCLK_CAM0 184
210#define SCLK_DAC 185
211#define SCLK_MIXER 186
212#define SCLK_HDMI 187
213#define SCLK_FIMC2 188
214#define SCLK_FIMC1 189
215#define SCLK_FIMC0 190
216#define SCLK_HDMI27M 191
217#define SCLK_HDMIPHY 192
218#define SCLK_USBPHY0 193
219#define SCLK_USBPHY1 194
220
221/* S5P6442-specific clocks */
222#define MOUT_D0SYNC 195
223#define MOUT_D1SYNC 196
224#define DOUT_MIXER 197
225#define CLK_ETB 198
226#define CLK_ETM 199
227
228/* CLKOUT */
229#define FOUT_APLL_CLKOUT 200
230#define FOUT_MPLL_CLKOUT 201
231#define DOUT_APLL_CLKOUT 202
232#define MOUT_CLKSEL 203
233#define DOUT_CLKOUT 204
234#define MOUT_CLKOUT 205
235
236/* Total number of clocks. */
237#define NR_CLKS 206
238
239#endif /* _DT_BINDINGS_CLOCK_S5PV210_H */
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index a91602951d3d..00953d9484cb 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -164,6 +164,8 @@
164#define VF610_CLK_DMAMUX1 151 164#define VF610_CLK_DMAMUX1 151
165#define VF610_CLK_DMAMUX2 152 165#define VF610_CLK_DMAMUX2 152
166#define VF610_CLK_DMAMUX3 153 166#define VF610_CLK_DMAMUX3 153
167#define VF610_CLK_END 154 167#define VF610_CLK_FLEXCAN0_EN 154
168#define VF610_CLK_FLEXCAN1_EN 155
169#define VF610_CLK_END 156
168 170
169#endif /* __DT_BINDINGS_CLOCK_VF610_H */ 171#endif /* __DT_BINDINGS_CLOCK_VF610_H */
diff --git a/include/dt-bindings/dma/nbpfaxi.h b/include/dt-bindings/dma/nbpfaxi.h
new file mode 100644
index 000000000000..c1a5b9e0d6a4
--- /dev/null
+++ b/include/dt-bindings/dma/nbpfaxi.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2013-2014 Renesas Electronics Europe Ltd.
3 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef DT_BINDINGS_NBPFAXI_H
11#define DT_BINDINGS_NBPFAXI_H
12
13/**
14 * Use "#dma-cells = <2>;" with the second integer defining slave DMA flags:
15 */
16#define NBPF_SLAVE_RQ_HIGH 1
17#define NBPF_SLAVE_RQ_LOW 2
18#define NBPF_SLAVE_RQ_LEVEL 4
19
20#endif
diff --git a/include/dt-bindings/mfd/as3722.h b/include/dt-bindings/mfd/as3722.h
index 0e692562d77b..e66c0898c58e 100644
--- a/include/dt-bindings/mfd/as3722.h
+++ b/include/dt-bindings/mfd/as3722.h
@@ -13,7 +13,7 @@
13/* External control pins */ 13/* External control pins */
14#define AS3722_EXT_CONTROL_PIN_ENABLE1 1 14#define AS3722_EXT_CONTROL_PIN_ENABLE1 1
15#define AS3722_EXT_CONTROL_PIN_ENABLE2 2 15#define AS3722_EXT_CONTROL_PIN_ENABLE2 2
16#define AS3722_EXT_CONTROL_PIN_ENABLE2 3 16#define AS3722_EXT_CONTROL_PIN_ENABLE3 3
17 17
18/* Interrupt numbers for AS3722 */ 18/* Interrupt numbers for AS3722 */
19#define AS3722_IRQ_LID 0 19#define AS3722_IRQ_LID 0
diff --git a/include/dt-bindings/mfd/palmas.h b/include/dt-bindings/mfd/palmas.h
new file mode 100644
index 000000000000..2c8ac4841385
--- /dev/null
+++ b/include/dt-bindings/mfd/palmas.h
@@ -0,0 +1,18 @@
1/*
2 * This header provides macros for Palmas device bindings.
3 *
4 * Copyright (c) 2013, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 */
9
10#ifndef __DT_BINDINGS_PALMAS_H__
11#define __DT_BINDINGS_PALMAS_H
12
13/* External control pins */
14#define PALMAS_EXT_CONTROL_PIN_ENABLE1 1
15#define PALMAS_EXT_CONTROL_PIN_ENABLE2 2
16#define PALMAS_EXT_CONTROL_PIN_NSLEEP 3
17
18#endif /* __DT_BINDINGS_PALMAS_H */
diff --git a/include/dt-bindings/phy/phy-miphy365x.h b/include/dt-bindings/phy/phy-miphy365x.h
new file mode 100644
index 000000000000..8ef8aba6edd6
--- /dev/null
+++ b/include/dt-bindings/phy/phy-miphy365x.h
@@ -0,0 +1,14 @@
1/*
2 * This header provides constants for the phy framework
3 * based on the STMicroelectronics MiPHY365x.
4 *
5 * Author: Lee Jones <lee.jones@linaro.org>
6 */
7#ifndef _DT_BINDINGS_PHY_MIPHY
8#define _DT_BINDINGS_PHY_MIPHY
9
10#define MIPHY_TYPE_SATA 1
11#define MIPHY_TYPE_PCIE 2
12#define MIPHY_TYPE_USB 3
13
14#endif /* _DT_BINDINGS_PHY_MIPHY */
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
index 002a2855c046..3d33794e4f3e 100644
--- a/include/dt-bindings/pinctrl/dra.h
+++ b/include/dt-bindings/pinctrl/dra.h
@@ -30,7 +30,8 @@
30#define MUX_MODE14 0xe 30#define MUX_MODE14 0xe
31#define MUX_MODE15 0xf 31#define MUX_MODE15 0xf
32 32
33#define PULL_ENA (1 << 16) 33#define PULL_ENA (0 << 16)
34#define PULL_DIS (1 << 16)
34#define PULL_UP (1 << 17) 35#define PULL_UP (1 << 17)
35#define INPUT_EN (1 << 18) 36#define INPUT_EN (1 << 18)
36#define SLEWCONTROL (1 << 19) 37#define SLEWCONTROL (1 << 19)
@@ -38,10 +39,10 @@
38#define WAKEUP_EVENT (1 << 25) 39#define WAKEUP_EVENT (1 << 25)
39 40
40/* Active pin states */ 41/* Active pin states */
41#define PIN_OUTPUT 0 42#define PIN_OUTPUT (0 | PULL_DIS)
42#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) 43#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
43#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) 44#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
44#define PIN_INPUT INPUT_EN 45#define PIN_INPUT (INPUT_EN | PULL_DIS)
45#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) 46#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
46#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) 47#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
47#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN) 48#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
diff --git a/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h b/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h
new file mode 100644
index 000000000000..914d56da9324
--- /dev/null
+++ b/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h
@@ -0,0 +1,7 @@
1#ifndef _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H
2#define _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H 1
3
4#define TEGRA_XUSB_PADCTL_PCIE 0
5#define TEGRA_XUSB_PADCTL_SATA 1
6
7#endif /* _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H */
diff --git a/include/dt-bindings/reset/qcom,gcc-apq8084.h b/include/dt-bindings/reset/qcom,gcc-apq8084.h
new file mode 100644
index 000000000000..527caaf48e3d
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,gcc-apq8084.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_RESET_APQ_GCC_8084_H
15#define _DT_BINDINGS_RESET_APQ_GCC_8084_H
16
17#define GCC_SYSTEM_NOC_BCR 0
18#define GCC_CONFIG_NOC_BCR 1
19#define GCC_PERIPH_NOC_BCR 2
20#define GCC_IMEM_BCR 3
21#define GCC_MMSS_BCR 4
22#define GCC_QDSS_BCR 5
23#define GCC_USB_30_BCR 6
24#define GCC_USB3_PHY_BCR 7
25#define GCC_USB_HS_HSIC_BCR 8
26#define GCC_USB_HS_BCR 9
27#define GCC_USB2A_PHY_BCR 10
28#define GCC_USB2B_PHY_BCR 11
29#define GCC_SDCC1_BCR 12
30#define GCC_SDCC2_BCR 13
31#define GCC_SDCC3_BCR 14
32#define GCC_SDCC4_BCR 15
33#define GCC_BLSP1_BCR 16
34#define GCC_BLSP1_QUP1_BCR 17
35#define GCC_BLSP1_UART1_BCR 18
36#define GCC_BLSP1_QUP2_BCR 19
37#define GCC_BLSP1_UART2_BCR 20
38#define GCC_BLSP1_QUP3_BCR 21
39#define GCC_BLSP1_UART3_BCR 22
40#define GCC_BLSP1_QUP4_BCR 23
41#define GCC_BLSP1_UART4_BCR 24
42#define GCC_BLSP1_QUP5_BCR 25
43#define GCC_BLSP1_UART5_BCR 26
44#define GCC_BLSP1_QUP6_BCR 27
45#define GCC_BLSP1_UART6_BCR 28
46#define GCC_BLSP2_BCR 29
47#define GCC_BLSP2_QUP1_BCR 30
48#define GCC_BLSP2_UART1_BCR 31
49#define GCC_BLSP2_QUP2_BCR 32
50#define GCC_BLSP2_UART2_BCR 33
51#define GCC_BLSP2_QUP3_BCR 34
52#define GCC_BLSP2_UART3_BCR 35
53#define GCC_BLSP2_QUP4_BCR 36
54#define GCC_BLSP2_UART4_BCR 37
55#define GCC_BLSP2_QUP5_BCR 38
56#define GCC_BLSP2_UART5_BCR 39
57#define GCC_BLSP2_QUP6_BCR 40
58#define GCC_BLSP2_UART6_BCR 41
59#define GCC_PDM_BCR 42
60#define GCC_PRNG_BCR 43
61#define GCC_BAM_DMA_BCR 44
62#define GCC_TSIF_BCR 45
63#define GCC_TCSR_BCR 46
64#define GCC_BOOT_ROM_BCR 47
65#define GCC_MSG_RAM_BCR 48
66#define GCC_TLMM_BCR 49
67#define GCC_MPM_BCR 50
68#define GCC_MPM_AHB_RESET 51
69#define GCC_MPM_NON_AHB_RESET 52
70#define GCC_SEC_CTRL_BCR 53
71#define GCC_SPMI_BCR 54
72#define GCC_SPDM_BCR 55
73#define GCC_CE1_BCR 56
74#define GCC_CE2_BCR 57
75#define GCC_BIMC_BCR 58
76#define GCC_SNOC_BUS_TIMEOUT0_BCR 59
77#define GCC_SNOC_BUS_TIMEOUT2_BCR 60
78#define GCC_PNOC_BUS_TIMEOUT0_BCR 61
79#define GCC_PNOC_BUS_TIMEOUT1_BCR 62
80#define GCC_PNOC_BUS_TIMEOUT2_BCR 63
81#define GCC_PNOC_BUS_TIMEOUT3_BCR 64
82#define GCC_PNOC_BUS_TIMEOUT4_BCR 65
83#define GCC_CNOC_BUS_TIMEOUT0_BCR 66
84#define GCC_CNOC_BUS_TIMEOUT1_BCR 67
85#define GCC_CNOC_BUS_TIMEOUT2_BCR 68
86#define GCC_CNOC_BUS_TIMEOUT3_BCR 69
87#define GCC_CNOC_BUS_TIMEOUT4_BCR 70
88#define GCC_CNOC_BUS_TIMEOUT5_BCR 71
89#define GCC_CNOC_BUS_TIMEOUT6_BCR 72
90#define GCC_DEHR_BCR 73
91#define GCC_RBCPR_BCR 74
92#define GCC_MSS_RESTART 75
93#define GCC_LPASS_RESTART 76
94#define GCC_WCSS_RESTART 77
95#define GCC_VENUS_RESTART 78
96#define GCC_COPSS_SMMU_BCR 79
97#define GCC_SPSS_BCR 80
98#define GCC_PCIE_0_BCR 81
99#define GCC_PCIE_0_PHY_BCR 82
100#define GCC_PCIE_1_BCR 83
101#define GCC_PCIE_1_PHY_BCR 84
102#define GCC_USB_30_SEC_BCR 85
103#define GCC_USB3_SEC_PHY_BCR 86
104#define GCC_SATA_BCR 87
105#define GCC_CE3_BCR 88
106#define GCC_UFS_BCR 89
107#define GCC_USB30_PHY_COM_BCR 90
108
109#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-ipq806x.h b/include/dt-bindings/reset/qcom,gcc-ipq806x.h
new file mode 100644
index 000000000000..0ad5ef930b5d
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,gcc-ipq806x.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_RESET_IPQ_806X_H
15#define _DT_BINDINGS_RESET_IPQ_806X_H
16
17#define QDSS_STM_RESET 0
18#define AFAB_SMPSS_S_RESET 1
19#define AFAB_SMPSS_M1_RESET 2
20#define AFAB_SMPSS_M0_RESET 3
21#define AFAB_EBI1_CH0_RESET 4
22#define AFAB_EBI1_CH1_RESET 5
23#define SFAB_ADM0_M0_RESET 6
24#define SFAB_ADM0_M1_RESET 7
25#define SFAB_ADM0_M2_RESET 8
26#define ADM0_C2_RESET 9
27#define ADM0_C1_RESET 10
28#define ADM0_C0_RESET 11
29#define ADM0_PBUS_RESET 12
30#define ADM0_RESET 13
31#define QDSS_CLKS_SW_RESET 14
32#define QDSS_POR_RESET 15
33#define QDSS_TSCTR_RESET 16
34#define QDSS_HRESET_RESET 17
35#define QDSS_AXI_RESET 18
36#define QDSS_DBG_RESET 19
37#define SFAB_PCIE_M_RESET 20
38#define SFAB_PCIE_S_RESET 21
39#define PCIE_EXT_RESET 22
40#define PCIE_PHY_RESET 23
41#define PCIE_PCI_RESET 24
42#define PCIE_POR_RESET 25
43#define PCIE_HCLK_RESET 26
44#define PCIE_ACLK_RESET 27
45#define SFAB_LPASS_RESET 28
46#define SFAB_AFAB_M_RESET 29
47#define AFAB_SFAB_M0_RESET 30
48#define AFAB_SFAB_M1_RESET 31
49#define SFAB_SATA_S_RESET 32
50#define SFAB_DFAB_M_RESET 33
51#define DFAB_SFAB_M_RESET 34
52#define DFAB_SWAY0_RESET 35
53#define DFAB_SWAY1_RESET 36
54#define DFAB_ARB0_RESET 37
55#define DFAB_ARB1_RESET 38
56#define PPSS_PROC_RESET 39
57#define PPSS_RESET 40
58#define DMA_BAM_RESET 41
59#define SPS_TIC_H_RESET 42
60#define SFAB_CFPB_M_RESET 43
61#define SFAB_CFPB_S_RESET 44
62#define TSIF_H_RESET 45
63#define CE1_H_RESET 46
64#define CE1_CORE_RESET 47
65#define CE1_SLEEP_RESET 48
66#define CE2_H_RESET 49
67#define CE2_CORE_RESET 50
68#define SFAB_SFPB_M_RESET 51
69#define SFAB_SFPB_S_RESET 52
70#define RPM_PROC_RESET 53
71#define PMIC_SSBI2_RESET 54
72#define SDC1_RESET 55
73#define SDC2_RESET 56
74#define SDC3_RESET 57
75#define SDC4_RESET 58
76#define USB_HS1_RESET 59
77#define USB_HSIC_RESET 60
78#define USB_FS1_XCVR_RESET 61
79#define USB_FS1_RESET 62
80#define GSBI1_RESET 63
81#define GSBI2_RESET 64
82#define GSBI3_RESET 65
83#define GSBI4_RESET 66
84#define GSBI5_RESET 67
85#define GSBI6_RESET 68
86#define GSBI7_RESET 69
87#define SPDM_RESET 70
88#define SEC_CTRL_RESET 71
89#define TLMM_H_RESET 72
90#define SFAB_SATA_M_RESET 73
91#define SATA_RESET 74
92#define TSSC_RESET 75
93#define PDM_RESET 76
94#define MPM_H_RESET 77
95#define MPM_RESET 78
96#define SFAB_SMPSS_S_RESET 79
97#define PRNG_RESET 80
98#define SFAB_CE3_M_RESET 81
99#define SFAB_CE3_S_RESET 82
100#define CE3_SLEEP_RESET 83
101#define PCIE_1_M_RESET 84
102#define PCIE_1_S_RESET 85
103#define PCIE_1_EXT_RESET 86
104#define PCIE_1_PHY_RESET 87
105#define PCIE_1_PCI_RESET 88
106#define PCIE_1_POR_RESET 89
107#define PCIE_1_HCLK_RESET 90
108#define PCIE_1_ACLK_RESET 91
109#define PCIE_2_M_RESET 92
110#define PCIE_2_S_RESET 93
111#define PCIE_2_EXT_RESET 94
112#define PCIE_2_PHY_RESET 95
113#define PCIE_2_PCI_RESET 96
114#define PCIE_2_POR_RESET 97
115#define PCIE_2_HCLK_RESET 98
116#define PCIE_2_ACLK_RESET 99
117#define SFAB_USB30_S_RESET 100
118#define SFAB_USB30_M_RESET 101
119#define USB30_0_PORT2_HS_PHY_RESET 102
120#define USB30_0_MASTER_RESET 103
121#define USB30_0_SLEEP_RESET 104
122#define USB30_0_UTMI_PHY_RESET 105
123#define USB30_0_POWERON_RESET 106
124#define USB30_0_PHY_RESET 107
125#define USB30_1_MASTER_RESET 108
126#define USB30_1_SLEEP_RESET 109
127#define USB30_1_UTMI_PHY_RESET 110
128#define USB30_1_POWERON_RESET 111
129#define USB30_1_PHY_RESET 112
130#define NSSFB0_RESET 113
131#define NSSFB1_RESET 114
132#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8960.h b/include/dt-bindings/reset/qcom,gcc-msm8960.h
index 07edd0e65eed..47c8686955da 100644
--- a/include/dt-bindings/reset/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/reset/qcom,gcc-msm8960.h
@@ -114,5 +114,21 @@
114#define SFAB_SMPSS_S_RESET 97 114#define SFAB_SMPSS_S_RESET 97
115#define PRNG_RESET 98 115#define PRNG_RESET 98
116#define RIVA_RESET 99 116#define RIVA_RESET 99
117#define USB_HS3_RESET 100
118#define USB_HS4_RESET 101
119#define CE3_RESET 102
120#define PCIE_EXT_PCI_RESET 103
121#define PCIE_PHY_RESET 104
122#define PCIE_PCI_RESET 105
123#define PCIE_POR_RESET 106
124#define PCIE_HCLK_RESET 107
125#define PCIE_ACLK_RESET 108
126#define CE3_H_RESET 109
127#define SFAB_CE3_M_RESET 110
128#define SFAB_CE3_S_RESET 111
129#define SATA_RESET 112
130#define CE3_SLEEP_RESET 113
131#define GSS_SLP_RESET 114
132#define GSS_RESET 115
117 133
118#endif 134#endif
diff --git a/include/dt-bindings/reset/qcom,mmcc-apq8084.h b/include/dt-bindings/reset/qcom,mmcc-apq8084.h
new file mode 100644
index 000000000000..c1671396531d
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,mmcc-apq8084.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_RESET_APQ_MMCC_8084_H
15#define _DT_BINDINGS_RESET_APQ_MMCC_8084_H
16
17#define MMSS_SPDM_RESET 0
18#define MMSS_SPDM_RM_RESET 1
19#define VENUS0_RESET 2
20#define VPU_RESET 3
21#define MDSS_RESET 4
22#define AVSYNC_RESET 5
23#define CAMSS_PHY0_RESET 6
24#define CAMSS_PHY1_RESET 7
25#define CAMSS_PHY2_RESET 8
26#define CAMSS_CSI0_RESET 9
27#define CAMSS_CSI0PHY_RESET 10
28#define CAMSS_CSI0RDI_RESET 11
29#define CAMSS_CSI0PIX_RESET 12
30#define CAMSS_CSI1_RESET 13
31#define CAMSS_CSI1PHY_RESET 14
32#define CAMSS_CSI1RDI_RESET 15
33#define CAMSS_CSI1PIX_RESET 16
34#define CAMSS_CSI2_RESET 17
35#define CAMSS_CSI2PHY_RESET 18
36#define CAMSS_CSI2RDI_RESET 19
37#define CAMSS_CSI2PIX_RESET 20
38#define CAMSS_CSI3_RESET 21
39#define CAMSS_CSI3PHY_RESET 22
40#define CAMSS_CSI3RDI_RESET 23
41#define CAMSS_CSI3PIX_RESET 24
42#define CAMSS_ISPIF_RESET 25
43#define CAMSS_CCI_RESET 26
44#define CAMSS_MCLK0_RESET 27
45#define CAMSS_MCLK1_RESET 28
46#define CAMSS_MCLK2_RESET 29
47#define CAMSS_MCLK3_RESET 30
48#define CAMSS_GP0_RESET 31
49#define CAMSS_GP1_RESET 32
50#define CAMSS_TOP_RESET 33
51#define CAMSS_AHB_RESET 34
52#define CAMSS_MICRO_RESET 35
53#define CAMSS_JPEG_RESET 36
54#define CAMSS_VFE_RESET 37
55#define CAMSS_CSI_VFE0_RESET 38
56#define CAMSS_CSI_VFE1_RESET 39
57#define OXILI_RESET 40
58#define OXILICX_RESET 41
59#define OCMEMCX_RESET 42
60#define MMSS_RBCRP_RESET 43
61#define MMSSNOCAHB_RESET 44
62#define MMSSNOCAXI_RESET 45
63
64#endif
diff --git a/include/dt-bindings/reset/qcom,mmcc-msm8960.h b/include/dt-bindings/reset/qcom,mmcc-msm8960.h
index ba36ec680118..11741113a841 100644
--- a/include/dt-bindings/reset/qcom,mmcc-msm8960.h
+++ b/include/dt-bindings/reset/qcom,mmcc-msm8960.h
@@ -89,5 +89,13 @@
89#define CSI2_RESET 72 89#define CSI2_RESET 72
90#define CSI_RDI1_RESET 73 90#define CSI_RDI1_RESET 73
91#define CSI_RDI2_RESET 74 91#define CSI_RDI2_RESET 74
92#define GFX3D_AXI_RESET 75
93#define VCAP_AXI_RESET 76
94#define SMMU_VCAP_AHB_RESET 77
95#define VCAP_AHB_RESET 78
96#define CSI_RDI_RESET 79
97#define CSI_PIX_RESET 80
98#define VCAP_NPL_RESET 81
99#define VCAP_RESET 82
92 100
93#endif 101#endif
diff --git a/include/keys/big_key-type.h b/include/keys/big_key-type.h
index d69bc8af3292..e0970a578188 100644
--- a/include/keys/big_key-type.h
+++ b/include/keys/big_key-type.h
@@ -16,7 +16,8 @@
16 16
17extern struct key_type key_type_big_key; 17extern struct key_type key_type_big_key;
18 18
19extern int big_key_instantiate(struct key *key, struct key_preparsed_payload *prep); 19extern int big_key_preparse(struct key_preparsed_payload *prep);
20extern void big_key_free_preparse(struct key_preparsed_payload *prep);
20extern void big_key_revoke(struct key *key); 21extern void big_key_revoke(struct key *key);
21extern void big_key_destroy(struct key *key); 22extern void big_key_destroy(struct key *key);
22extern void big_key_describe(const struct key *big_key, struct seq_file *m); 23extern void big_key_describe(const struct key *big_key, struct seq_file *m);
diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
index 8dabc399bd1d..72665eb80692 100644
--- a/include/keys/system_keyring.h
+++ b/include/keys/system_keyring.h
@@ -17,7 +17,15 @@
17#include <linux/key.h> 17#include <linux/key.h>
18 18
19extern struct key *system_trusted_keyring; 19extern struct key *system_trusted_keyring;
20 20static inline struct key *get_system_trusted_keyring(void)
21{
22 return system_trusted_keyring;
23}
24#else
25static inline struct key *get_system_trusted_keyring(void)
26{
27 return NULL;
28}
21#endif 29#endif
22 30
23#endif /* _KEYS_SYSTEM_KEYRING_H */ 31#endif /* _KEYS_SYSTEM_KEYRING_H */
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index 5e452c84f1e6..3ab1873a4bfa 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -37,7 +37,8 @@ extern struct key_type key_type_logon;
37 37
38struct key_preparsed_payload; 38struct key_preparsed_payload;
39 39
40extern int user_instantiate(struct key *key, struct key_preparsed_payload *prep); 40extern int user_preparse(struct key_preparsed_payload *prep);
41extern void user_free_preparse(struct key_preparsed_payload *prep);
41extern int user_update(struct key *key, struct key_preparsed_payload *prep); 42extern int user_update(struct key *key, struct key_preparsed_payload *prep);
42extern int user_match(const struct key *key, const void *criterion); 43extern int user_match(const struct key *key, const void *criterion);
43extern void user_revoke(struct key *key); 44extern void user_revoke(struct key *key);
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index 6d9aeddc09bf..ad9db6045b2f 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -67,6 +67,10 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
67void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); 67void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);
68void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); 68void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);
69void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu); 69void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
70
71u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
72int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
73
70#else 74#else
71static inline int kvm_timer_hyp_init(void) 75static inline int kvm_timer_hyp_init(void)
72{ 76{
@@ -84,6 +88,16 @@ static inline void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) {}
84static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {} 88static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {}
85static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {} 89static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {}
86static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {} 90static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {}
91
92static inline int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
93{
94 return 0;
95}
96
97static inline u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
98{
99 return 0;
100}
87#endif 101#endif
88 102
89#endif 103#endif
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index f27000f55a83..35b0c121bb65 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -24,7 +24,6 @@
24#include <linux/irqreturn.h> 24#include <linux/irqreturn.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/irqchip/arm-gic.h>
28 27
29#define VGIC_NR_IRQS 256 28#define VGIC_NR_IRQS 256
30#define VGIC_NR_SGIS 16 29#define VGIC_NR_SGIS 16
@@ -32,7 +31,9 @@
32#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS) 31#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS)
33#define VGIC_NR_SHARED_IRQS (VGIC_NR_IRQS - VGIC_NR_PRIVATE_IRQS) 32#define VGIC_NR_SHARED_IRQS (VGIC_NR_IRQS - VGIC_NR_PRIVATE_IRQS)
34#define VGIC_MAX_CPUS KVM_MAX_VCPUS 33#define VGIC_MAX_CPUS KVM_MAX_VCPUS
35#define VGIC_MAX_LRS (1 << 6) 34
35#define VGIC_V2_MAX_LRS (1 << 6)
36#define VGIC_V3_MAX_LRS 16
36 37
37/* Sanity checks... */ 38/* Sanity checks... */
38#if (VGIC_MAX_CPUS > 8) 39#if (VGIC_MAX_CPUS > 8)
@@ -68,9 +69,62 @@ struct vgic_bytemap {
68 u32 shared[VGIC_NR_SHARED_IRQS / 4]; 69 u32 shared[VGIC_NR_SHARED_IRQS / 4];
69}; 70};
70 71
72struct kvm_vcpu;
73
74enum vgic_type {
75 VGIC_V2, /* Good ol' GICv2 */
76 VGIC_V3, /* New fancy GICv3 */
77};
78
79#define LR_STATE_PENDING (1 << 0)
80#define LR_STATE_ACTIVE (1 << 1)
81#define LR_STATE_MASK (3 << 0)
82#define LR_EOI_INT (1 << 2)
83
84struct vgic_lr {
85 u16 irq;
86 u8 source;
87 u8 state;
88};
89
90struct vgic_vmcr {
91 u32 ctlr;
92 u32 abpr;
93 u32 bpr;
94 u32 pmr;
95};
96
97struct vgic_ops {
98 struct vgic_lr (*get_lr)(const struct kvm_vcpu *, int);
99 void (*set_lr)(struct kvm_vcpu *, int, struct vgic_lr);
100 void (*sync_lr_elrsr)(struct kvm_vcpu *, int, struct vgic_lr);
101 u64 (*get_elrsr)(const struct kvm_vcpu *vcpu);
102 u64 (*get_eisr)(const struct kvm_vcpu *vcpu);
103 u32 (*get_interrupt_status)(const struct kvm_vcpu *vcpu);
104 void (*enable_underflow)(struct kvm_vcpu *vcpu);
105 void (*disable_underflow)(struct kvm_vcpu *vcpu);
106 void (*get_vmcr)(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr);
107 void (*set_vmcr)(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr);
108 void (*enable)(struct kvm_vcpu *vcpu);
109};
110
111struct vgic_params {
112 /* vgic type */
113 enum vgic_type type;
114 /* Physical address of vgic virtual cpu interface */
115 phys_addr_t vcpu_base;
116 /* Number of list registers */
117 u32 nr_lr;
118 /* Interrupt number */
119 unsigned int maint_irq;
120 /* Virtual control interface base address */
121 void __iomem *vctrl_base;
122};
123
71struct vgic_dist { 124struct vgic_dist {
72#ifdef CONFIG_KVM_ARM_VGIC 125#ifdef CONFIG_KVM_ARM_VGIC
73 spinlock_t lock; 126 spinlock_t lock;
127 bool in_kernel;
74 bool ready; 128 bool ready;
75 129
76 /* Virtual control interface mapping */ 130 /* Virtual control interface mapping */
@@ -110,6 +164,29 @@ struct vgic_dist {
110#endif 164#endif
111}; 165};
112 166
167struct vgic_v2_cpu_if {
168 u32 vgic_hcr;
169 u32 vgic_vmcr;
170 u32 vgic_misr; /* Saved only */
171 u32 vgic_eisr[2]; /* Saved only */
172 u32 vgic_elrsr[2]; /* Saved only */
173 u32 vgic_apr;
174 u32 vgic_lr[VGIC_V2_MAX_LRS];
175};
176
177struct vgic_v3_cpu_if {
178#ifdef CONFIG_ARM_GIC_V3
179 u32 vgic_hcr;
180 u32 vgic_vmcr;
181 u32 vgic_misr; /* Saved only */
182 u32 vgic_eisr; /* Saved only */
183 u32 vgic_elrsr; /* Saved only */
184 u32 vgic_ap0r[4];
185 u32 vgic_ap1r[4];
186 u64 vgic_lr[VGIC_V3_MAX_LRS];
187#endif
188};
189
113struct vgic_cpu { 190struct vgic_cpu {
114#ifdef CONFIG_KVM_ARM_VGIC 191#ifdef CONFIG_KVM_ARM_VGIC
115 /* per IRQ to LR mapping */ 192 /* per IRQ to LR mapping */
@@ -120,24 +197,24 @@ struct vgic_cpu {
120 DECLARE_BITMAP( pending_shared, VGIC_NR_SHARED_IRQS); 197 DECLARE_BITMAP( pending_shared, VGIC_NR_SHARED_IRQS);
121 198
122 /* Bitmap of used/free list registers */ 199 /* Bitmap of used/free list registers */
123 DECLARE_BITMAP( lr_used, VGIC_MAX_LRS); 200 DECLARE_BITMAP( lr_used, VGIC_V2_MAX_LRS);
124 201
125 /* Number of list registers on this CPU */ 202 /* Number of list registers on this CPU */
126 int nr_lr; 203 int nr_lr;
127 204
128 /* CPU vif control registers for world switch */ 205 /* CPU vif control registers for world switch */
129 u32 vgic_hcr; 206 union {
130 u32 vgic_vmcr; 207 struct vgic_v2_cpu_if vgic_v2;
131 u32 vgic_misr; /* Saved only */ 208 struct vgic_v3_cpu_if vgic_v3;
132 u32 vgic_eisr[2]; /* Saved only */ 209 };
133 u32 vgic_elrsr[2]; /* Saved only */
134 u32 vgic_apr;
135 u32 vgic_lr[VGIC_MAX_LRS];
136#endif 210#endif
137}; 211};
138 212
139#define LR_EMPTY 0xff 213#define LR_EMPTY 0xff
140 214
215#define INT_STATUS_EOI (1 << 0)
216#define INT_STATUS_UNDERFLOW (1 << 1)
217
141struct kvm; 218struct kvm;
142struct kvm_vcpu; 219struct kvm_vcpu;
143struct kvm_run; 220struct kvm_run;
@@ -157,9 +234,25 @@ int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
157bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run, 234bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
158 struct kvm_exit_mmio *mmio); 235 struct kvm_exit_mmio *mmio);
159 236
160#define irqchip_in_kernel(k) (!!((k)->arch.vgic.vctrl_base)) 237#define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel))
161#define vgic_initialized(k) ((k)->arch.vgic.ready) 238#define vgic_initialized(k) ((k)->arch.vgic.ready)
162 239
240int vgic_v2_probe(struct device_node *vgic_node,
241 const struct vgic_ops **ops,
242 const struct vgic_params **params);
243#ifdef CONFIG_ARM_GIC_V3
244int vgic_v3_probe(struct device_node *vgic_node,
245 const struct vgic_ops **ops,
246 const struct vgic_params **params);
247#else
248static inline int vgic_v3_probe(struct device_node *vgic_node,
249 const struct vgic_ops **ops,
250 const struct vgic_params **params)
251{
252 return -ENODEV;
253}
254#endif
255
163#else 256#else
164static inline int kvm_vgic_hyp_init(void) 257static inline int kvm_vgic_hyp_init(void)
165{ 258{
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 4a5b7cb56079..dccc2d4fe7de 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -24,14 +24,10 @@ struct super_block;
24struct pacct_struct; 24struct pacct_struct;
25struct pid_namespace; 25struct pid_namespace;
26extern int acct_parm[]; /* for sysctl */ 26extern int acct_parm[]; /* for sysctl */
27extern void acct_auto_close_mnt(struct vfsmount *m);
28extern void acct_auto_close(struct super_block *sb);
29extern void acct_collect(long exitcode, int group_dead); 27extern void acct_collect(long exitcode, int group_dead);
30extern void acct_process(void); 28extern void acct_process(void);
31extern void acct_exit_ns(struct pid_namespace *); 29extern void acct_exit_ns(struct pid_namespace *);
32#else 30#else
33#define acct_auto_close_mnt(x) do { } while (0)
34#define acct_auto_close(x) do { } while (0)
35#define acct_collect(x,y) do { } while (0) 31#define acct_collect(x,y) do { } while (0)
36#define acct_process() do { } while (0) 32#define acct_process() do { } while (0)
37#define acct_exit_ns(ns) do { } while (0) 33#define acct_exit_ns(ns) do { } while (0)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 358c01b971db..807cbc46d73e 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -29,17 +29,17 @@
29#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h> 30#include <linux/device.h>
31 31
32#ifdef CONFIG_ACPI
33
34#ifndef _LINUX 32#ifndef _LINUX
35#define _LINUX 33#define _LINUX
36#endif 34#endif
35#include <acpi/acpi.h>
36
37#ifdef CONFIG_ACPI
37 38
38#include <linux/list.h> 39#include <linux/list.h>
39#include <linux/mod_devicetable.h> 40#include <linux/mod_devicetable.h>
40#include <linux/dynamic_debug.h> 41#include <linux/dynamic_debug.h>
41 42
42#include <acpi/acpi.h>
43#include <acpi/acpi_bus.h> 43#include <acpi/acpi_bus.h>
44#include <acpi/acpi_drivers.h> 44#include <acpi/acpi_drivers.h>
45#include <acpi/acpi_numa.h> 45#include <acpi/acpi_numa.h>
@@ -364,6 +364,17 @@ extern bool osc_sb_apei_support_acked;
364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
365#define OSC_PCI_CONTROL_MASKS 0x0000001f 365#define OSC_PCI_CONTROL_MASKS 0x0000001f
366 366
367#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
368#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
369#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
370#define ACPI_GSB_ACCESS_ATTRIB_WORD 0x00000008
371#define ACPI_GSB_ACCESS_ATTRIB_BLOCK 0x0000000A
372#define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE 0x0000000B
373#define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL 0x0000000C
374#define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL 0x0000000D
375#define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E
376#define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F
377
367extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 378extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
368 u32 *mask, u32 req); 379 u32 *mask, u32 req);
369 380
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 4dbaa7081530..c826d1c28f9c 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -11,6 +11,8 @@
11#define AER_FATAL 1 11#define AER_FATAL 1
12#define AER_CORRECTABLE 2 12#define AER_CORRECTABLE 2
13 13
14struct pci_dev;
15
14struct aer_header_log_regs { 16struct aer_header_log_regs {
15 unsigned int dw0; 17 unsigned int dw0;
16 unsigned int dw1; 18 unsigned int dw1;
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 6dfd51a04d77..09a947e8bc87 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -43,10 +43,7 @@ struct ahci_host_priv *ahci_platform_get_resources(
43 struct platform_device *pdev); 43 struct platform_device *pdev);
44int ahci_platform_init_host(struct platform_device *pdev, 44int ahci_platform_init_host(struct platform_device *pdev,
45 struct ahci_host_priv *hpriv, 45 struct ahci_host_priv *hpriv,
46 const struct ata_port_info *pi_template, 46 const struct ata_port_info *pi_template);
47 unsigned long host_flags,
48 unsigned int force_port_map,
49 unsigned int mask_port_map);
50 47
51int ahci_platform_suspend_host(struct device *dev); 48int ahci_platform_suspend_host(struct device *dev);
52int ahci_platform_resume_host(struct device *dev); 49int ahci_platform_resume_host(struct device *dev);
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index 15f6b9edd0b1..2b08e79f5100 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -119,6 +119,13 @@ typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev,
119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev, 119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev,
120 amd_iommu_invalid_ppr_cb cb); 120 amd_iommu_invalid_ppr_cb cb);
121 121
122#define PPR_FAULT_EXEC (1 << 1)
123#define PPR_FAULT_READ (1 << 2)
124#define PPR_FAULT_WRITE (1 << 5)
125#define PPR_FAULT_USER (1 << 6)
126#define PPR_FAULT_RSVD (1 << 7)
127#define PPR_FAULT_GN (1 << 8)
128
122/** 129/**
123 * amd_iommu_device_info() - Get information about IOMMUv2 support of a 130 * amd_iommu_device_info() - Get information about IOMMUv2 support of a
124 * PCI device 131 * PCI device
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7216b0daf544..df0356220730 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -22,10 +22,6 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23#include <linux/irqreturn.h> 23#include <linux/irqreturn.h>
24 24
25#ifndef bool
26#define bool int
27#endif
28
29/* 25/*
30 * RECON_THRESHOLD is the maximum number of RECON messages to receive 26 * RECON_THRESHOLD is the maximum number of RECON messages to receive
31 * within one minute before printing a "cabling problem" warning. The 27 * within one minute before printing a "cabling problem" warning. The
@@ -285,9 +281,9 @@ struct arcnet_local {
285 unsigned long first_recon; /* time of "first" RECON message to count */ 281 unsigned long first_recon; /* time of "first" RECON message to count */
286 unsigned long last_recon; /* time of most recent RECON */ 282 unsigned long last_recon; /* time of most recent RECON */
287 int num_recons; /* number of RECONs between first and last. */ 283 int num_recons; /* number of RECONs between first and last. */
288 bool network_down; /* do we think the network is down? */ 284 int network_down; /* do we think the network is down? */
289 285
290 bool excnak_pending; /* We just got an excesive nak interrupt */ 286 int excnak_pending; /* We just got an excesive nak interrupt */
291 287
292 struct { 288 struct {
293 uint16_t sequence; /* sequence number (incs with each packet) */ 289 uint16_t sequence; /* sequence number (incs with each packet) */
@@ -305,7 +301,7 @@ struct arcnet_local {
305 void (*command) (struct net_device * dev, int cmd); 301 void (*command) (struct net_device * dev, int cmd);
306 int (*status) (struct net_device * dev); 302 int (*status) (struct net_device * dev);
307 void (*intmask) (struct net_device * dev, int mask); 303 void (*intmask) (struct net_device * dev, int mask);
308 bool (*reset) (struct net_device * dev, bool really_reset); 304 int (*reset) (struct net_device * dev, int really_reset);
309 void (*open) (struct net_device * dev); 305 void (*open) (struct net_device * dev);
310 void (*close) (struct net_device * dev); 306 void (*close) (struct net_device * dev);
311 307
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h
deleted file mode 100644
index 0153a47806c2..000000000000
--- a/include/linux/atmel-pwm-bl.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * Driver for the AT32AP700X PS/2 controller (PSIF).
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 version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef __INCLUDE_ATMEL_PWM_BL_H
12#define __INCLUDE_ATMEL_PWM_BL_H
13
14/**
15 * struct atmel_pwm_bl_platform_data
16 * @pwm_channel: which PWM channel in the PWM module to use.
17 * @pwm_frequency: PWM frequency to generate, the driver will try to be as
18 * close as the prescaler allows.
19 * @pwm_compare_max: value to use in the PWM channel compare register.
20 * @pwm_duty_max: maximum duty cycle value, must be less than or equal to
21 * pwm_compare_max.
22 * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max.
23 * @pwm_active_low: set to one if the low part of the PWM signal increases the
24 * brightness of the backlight.
25 * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used.
26 * @on_active_low: set to one if the on/off signal is on when GPIO is low.
27 *
28 * This struct must be added to the platform device in the board code. It is
29 * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the
30 * PWM device.
31 */
32struct atmel_pwm_bl_platform_data {
33 unsigned int pwm_channel;
34 unsigned int pwm_frequency;
35 unsigned int pwm_compare_max;
36 unsigned int pwm_duty_max;
37 unsigned int pwm_duty_min;
38 unsigned int pwm_active_low;
39 int gpio_on;
40 unsigned int on_active_low;
41};
42
43#endif /* __INCLUDE_ATMEL_PWM_BL_H */
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 571a12ebb018..7c0f6549898b 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -7,6 +7,7 @@
7 7
8struct atmel_ssc_platform_data { 8struct atmel_ssc_platform_data {
9 int use_dma; 9 int use_dma;
10 int has_fslen_ext;
10}; 11};
11 12
12struct ssc_device { 13struct ssc_device {
@@ -71,6 +72,12 @@ void ssc_free(struct ssc_device *ssc);
71#define SSC_RFMR_DATNB_OFFSET 8 72#define SSC_RFMR_DATNB_OFFSET 8
72#define SSC_RFMR_FSEDGE_SIZE 1 73#define SSC_RFMR_FSEDGE_SIZE 1
73#define SSC_RFMR_FSEDGE_OFFSET 24 74#define SSC_RFMR_FSEDGE_OFFSET 24
75/*
76 * The FSLEN_EXT exist on at91sam9rl, at91sam9g10,
77 * at91sam9g20, and at91sam9g45 and newer SoCs
78 */
79#define SSC_RFMR_FSLEN_EXT_SIZE 4
80#define SSC_RFMR_FSLEN_EXT_OFFSET 28
74#define SSC_RFMR_FSLEN_SIZE 4 81#define SSC_RFMR_FSLEN_SIZE 4
75#define SSC_RFMR_FSLEN_OFFSET 16 82#define SSC_RFMR_FSLEN_OFFSET 16
76#define SSC_RFMR_FSOS_SIZE 4 83#define SSC_RFMR_FSOS_SIZE 4
@@ -109,6 +116,12 @@ void ssc_free(struct ssc_device *ssc);
109#define SSC_TFMR_FSDEN_OFFSET 23 116#define SSC_TFMR_FSDEN_OFFSET 23
110#define SSC_TFMR_FSEDGE_SIZE 1 117#define SSC_TFMR_FSEDGE_SIZE 1
111#define SSC_TFMR_FSEDGE_OFFSET 24 118#define SSC_TFMR_FSEDGE_OFFSET 24
119/*
120 * The FSLEN_EXT exist on at91sam9rl, at91sam9g10,
121 * at91sam9g20, and at91sam9g45 and newer SoCs
122 */
123#define SSC_TFMR_FSLEN_EXT_SIZE 4
124#define SSC_TFMR_FSLEN_EXT_OFFSET 28
112#define SSC_TFMR_FSLEN_SIZE 4 125#define SSC_TFMR_FSLEN_SIZE 4
113#define SSC_TFMR_FSLEN_OFFSET 16 126#define SSC_TFMR_FSLEN_OFFSET 16
114#define SSC_TFMR_FSOS_SIZE 3 127#define SSC_TFMR_FSOS_SIZE 3
diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h
deleted file mode 100644
index ea04abb3db8e..000000000000
--- a/include/linux/atmel_pwm.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef __LINUX_ATMEL_PWM_H
2#define __LINUX_ATMEL_PWM_H
3
4/**
5 * struct pwm_channel - driver handle to a PWM channel
6 * @regs: base of this channel's registers
7 * @index: number of this channel (0..31)
8 * @mck: base clock rate, which can be prescaled and maybe subdivided
9 *
10 * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
11 * Then they configure its clock rate (derived from MCK), alignment,
12 * polarity, and duty cycle by writing directly to the channel registers,
13 * before enabling the channel by calling pwm_channel_enable().
14 *
15 * After emitting a PWM signal for the desired length of time, drivers
16 * may then pwm_channel_disable() or pwm_channel_free(). Both of these
17 * disable the channel, but when it's freed the IRQ is deconfigured and
18 * the channel must later be re-allocated and reconfigured.
19 *
20 * Note that if the period or duty cycle need to be changed while the
21 * PWM channel is operating, drivers must use the PWM_CUPD double buffer
22 * mechanism, either polling until they change or getting implicitly
23 * notified through a once-per-period interrupt handler.
24 */
25struct pwm_channel {
26 void __iomem *regs;
27 unsigned index;
28 unsigned long mck;
29};
30
31extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
32extern int pwm_channel_free(struct pwm_channel *ch);
33
34extern int pwm_clk_alloc(unsigned prescale, unsigned div);
35extern void pwm_clk_free(unsigned clk);
36
37extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
38
39#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
40#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
41
42/* periodic interrupts, mostly for CUPD changes to period or cycle */
43extern int pwm_channel_handler(struct pwm_channel *ch,
44 void (*handler)(struct pwm_channel *ch));
45
46/* per-channel registers (banked at pwm_channel->regs) */
47#define PWM_CMR 0x00 /* mode register */
48#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
49#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
50#define PWM_CPR_CALG (1 << 8) /* set: center align */
51#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
52#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
53#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
54#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
55#define PWM_CPRD 0x08 /* period (count up from zero) */
56#define PWM_CCNT 0x0c /* counter (20 bits?) */
57#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
58
59static inline void
60pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
61{
62 __raw_writel(val, pwmc->regs + offset);
63}
64
65static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
66{
67 return __raw_readl(pwmc->regs + offset);
68}
69
70#endif /* __LINUX_ATMEL_PWM_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 0b3bb16c705a..0272e49135d0 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/bcma/bcma_driver_chipcommon.h> 7#include <linux/bcma/bcma_driver_chipcommon.h>
8#include <linux/bcma/bcma_driver_pci.h> 8#include <linux/bcma/bcma_driver_pci.h>
9#include <linux/bcma/bcma_driver_pcie2.h>
9#include <linux/bcma/bcma_driver_mips.h> 10#include <linux/bcma/bcma_driver_mips.h>
10#include <linux/bcma/bcma_driver_gmac_cmn.h> 11#include <linux/bcma/bcma_driver_gmac_cmn.h>
11#include <linux/ssb/ssb.h> /* SPROM sharing */ 12#include <linux/ssb/ssb.h> /* SPROM sharing */
@@ -72,17 +73,17 @@ struct bcma_host_ops {
72/* Core-ID values. */ 73/* Core-ID values. */
73#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ 74#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
74#define BCMA_CORE_4706_CHIPCOMMON 0x500 75#define BCMA_CORE_4706_CHIPCOMMON 0x500
75#define BCMA_CORE_PCIEG2 0x501 76#define BCMA_CORE_NS_PCIEG2 0x501
76#define BCMA_CORE_DMA 0x502 77#define BCMA_CORE_NS_DMA 0x502
77#define BCMA_CORE_SDIO3 0x503 78#define BCMA_CORE_NS_SDIO3 0x503
78#define BCMA_CORE_USB20 0x504 79#define BCMA_CORE_NS_USB20 0x504
79#define BCMA_CORE_USB30 0x505 80#define BCMA_CORE_NS_USB30 0x505
80#define BCMA_CORE_A9JTAG 0x506 81#define BCMA_CORE_NS_A9JTAG 0x506
81#define BCMA_CORE_DDR23 0x507 82#define BCMA_CORE_NS_DDR23 0x507
82#define BCMA_CORE_ROM 0x508 83#define BCMA_CORE_NS_ROM 0x508
83#define BCMA_CORE_NAND 0x509 84#define BCMA_CORE_NS_NAND 0x509
84#define BCMA_CORE_QSPI 0x50A 85#define BCMA_CORE_NS_QSPI 0x50A
85#define BCMA_CORE_CHIPCOMMON_B 0x50B 86#define BCMA_CORE_NS_CHIPCOMMON_B 0x50B
86#define BCMA_CORE_4706_SOC_RAM 0x50E 87#define BCMA_CORE_4706_SOC_RAM 0x50E
87#define BCMA_CORE_ARMCA9 0x510 88#define BCMA_CORE_ARMCA9 0x510
88#define BCMA_CORE_4706_MAC_GBIT 0x52D 89#define BCMA_CORE_4706_MAC_GBIT 0x52D
@@ -157,6 +158,9 @@ struct bcma_host_ops {
157/* Chip IDs of PCIe devices */ 158/* Chip IDs of PCIe devices */
158#define BCMA_CHIP_ID_BCM4313 0x4313 159#define BCMA_CHIP_ID_BCM4313 0x4313
159#define BCMA_CHIP_ID_BCM43142 43142 160#define BCMA_CHIP_ID_BCM43142 43142
161#define BCMA_CHIP_ID_BCM43131 43131
162#define BCMA_CHIP_ID_BCM43217 43217
163#define BCMA_CHIP_ID_BCM43222 43222
160#define BCMA_CHIP_ID_BCM43224 43224 164#define BCMA_CHIP_ID_BCM43224 43224
161#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 165#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
162#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa 166#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
@@ -333,6 +337,7 @@ struct bcma_bus {
333 337
334 struct bcma_drv_cc drv_cc; 338 struct bcma_drv_cc drv_cc;
335 struct bcma_drv_pci drv_pci[2]; 339 struct bcma_drv_pci drv_pci[2];
340 struct bcma_drv_pcie2 drv_pcie2;
336 struct bcma_drv_mips drv_mips; 341 struct bcma_drv_mips drv_mips;
337 struct bcma_drv_gmac_cmn drv_gmac_cmn; 342 struct bcma_drv_gmac_cmn drv_gmac_cmn;
338 343
diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h
new file mode 100644
index 000000000000..5988b05781c3
--- /dev/null
+++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -0,0 +1,158 @@
1#ifndef LINUX_BCMA_DRIVER_PCIE2_H_
2#define LINUX_BCMA_DRIVER_PCIE2_H_
3
4#define BCMA_CORE_PCIE2_CLK_CONTROL 0x0000
5#define PCIE2_CLKC_RST_OE 0x0001 /* When set, drives PCI_RESET out to pin */
6#define PCIE2_CLKC_RST 0x0002 /* Value driven out to pin */
7#define PCIE2_CLKC_SPERST 0x0004 /* SurvivePeRst */
8#define PCIE2_CLKC_DISABLE_L1CLK_GATING 0x0010
9#define PCIE2_CLKC_DLYPERST 0x0100 /* Delay PeRst to CoE Core */
10#define PCIE2_CLKC_DISSPROMLD 0x0200 /* DisableSpromLoadOnPerst */
11#define PCIE2_CLKC_WAKE_MODE_L2 0x1000 /* Wake on L2 */
12#define BCMA_CORE_PCIE2_RC_PM_CONTROL 0x0004
13#define BCMA_CORE_PCIE2_RC_PM_STATUS 0x0008
14#define BCMA_CORE_PCIE2_EP_PM_CONTROL 0x000C
15#define BCMA_CORE_PCIE2_EP_PM_STATUS 0x0010
16#define BCMA_CORE_PCIE2_EP_LTR_CONTROL 0x0014
17#define BCMA_CORE_PCIE2_EP_LTR_STATUS 0x0018
18#define BCMA_CORE_PCIE2_EP_OBFF_STATUS 0x001C
19#define BCMA_CORE_PCIE2_PCIE_ERR_STATUS 0x0020
20#define BCMA_CORE_PCIE2_RC_AXI_CONFIG 0x0100
21#define BCMA_CORE_PCIE2_EP_AXI_CONFIG 0x0104
22#define BCMA_CORE_PCIE2_RXDEBUG_STATUS0 0x0108
23#define BCMA_CORE_PCIE2_RXDEBUG_CONTROL0 0x010C
24#define BCMA_CORE_PCIE2_CONFIGINDADDR 0x0120
25#define BCMA_CORE_PCIE2_CONFIGINDDATA 0x0124
26#define BCMA_CORE_PCIE2_MDIOCONTROL 0x0128
27#define BCMA_CORE_PCIE2_MDIOWRDATA 0x012C
28#define BCMA_CORE_PCIE2_MDIORDDATA 0x0130
29#define BCMA_CORE_PCIE2_DATAINTF 0x0180
30#define BCMA_CORE_PCIE2_D2H_INTRLAZY_0 0x0188
31#define BCMA_CORE_PCIE2_H2D_INTRLAZY_0 0x018c
32#define BCMA_CORE_PCIE2_H2D_INTSTAT_0 0x0190
33#define BCMA_CORE_PCIE2_H2D_INTMASK_0 0x0194
34#define BCMA_CORE_PCIE2_D2H_INTSTAT_0 0x0198
35#define BCMA_CORE_PCIE2_D2H_INTMASK_0 0x019c
36#define BCMA_CORE_PCIE2_LTR_STATE 0x01A0 /* Latency Tolerance Reporting */
37#define PCIE2_LTR_ACTIVE 2
38#define PCIE2_LTR_ACTIVE_IDLE 1
39#define PCIE2_LTR_SLEEP 0
40#define PCIE2_LTR_FINAL_MASK 0x300
41#define PCIE2_LTR_FINAL_SHIFT 8
42#define BCMA_CORE_PCIE2_PWR_INT_STATUS 0x01A4
43#define BCMA_CORE_PCIE2_PWR_INT_MASK 0x01A8
44#define BCMA_CORE_PCIE2_CFG_ADDR 0x01F8
45#define BCMA_CORE_PCIE2_CFG_DATA 0x01FC
46#define BCMA_CORE_PCIE2_SYS_EQ_PAGE 0x0200
47#define BCMA_CORE_PCIE2_SYS_MSI_PAGE 0x0204
48#define BCMA_CORE_PCIE2_SYS_MSI_INTREN 0x0208
49#define BCMA_CORE_PCIE2_SYS_MSI_CTRL0 0x0210
50#define BCMA_CORE_PCIE2_SYS_MSI_CTRL1 0x0214
51#define BCMA_CORE_PCIE2_SYS_MSI_CTRL2 0x0218
52#define BCMA_CORE_PCIE2_SYS_MSI_CTRL3 0x021C
53#define BCMA_CORE_PCIE2_SYS_MSI_CTRL4 0x0220
54#define BCMA_CORE_PCIE2_SYS_MSI_CTRL5 0x0224
55#define BCMA_CORE_PCIE2_SYS_EQ_HEAD0 0x0250
56#define BCMA_CORE_PCIE2_SYS_EQ_TAIL0 0x0254
57#define BCMA_CORE_PCIE2_SYS_EQ_HEAD1 0x0258
58#define BCMA_CORE_PCIE2_SYS_EQ_TAIL1 0x025C
59#define BCMA_CORE_PCIE2_SYS_EQ_HEAD2 0x0260
60#define BCMA_CORE_PCIE2_SYS_EQ_TAIL2 0x0264
61#define BCMA_CORE_PCIE2_SYS_EQ_HEAD3 0x0268
62#define BCMA_CORE_PCIE2_SYS_EQ_TAIL3 0x026C
63#define BCMA_CORE_PCIE2_SYS_EQ_HEAD4 0x0270
64#define BCMA_CORE_PCIE2_SYS_EQ_TAIL4 0x0274
65#define BCMA_CORE_PCIE2_SYS_EQ_HEAD5 0x0278
66#define BCMA_CORE_PCIE2_SYS_EQ_TAIL5 0x027C
67#define BCMA_CORE_PCIE2_SYS_RC_INTX_EN 0x0330
68#define BCMA_CORE_PCIE2_SYS_RC_INTX_CSR 0x0334
69#define BCMA_CORE_PCIE2_SYS_MSI_REQ 0x0340
70#define BCMA_CORE_PCIE2_SYS_HOST_INTR_EN 0x0344
71#define BCMA_CORE_PCIE2_SYS_HOST_INTR_CSR 0x0348
72#define BCMA_CORE_PCIE2_SYS_HOST_INTR0 0x0350
73#define BCMA_CORE_PCIE2_SYS_HOST_INTR1 0x0354
74#define BCMA_CORE_PCIE2_SYS_HOST_INTR2 0x0358
75#define BCMA_CORE_PCIE2_SYS_HOST_INTR3 0x035C
76#define BCMA_CORE_PCIE2_SYS_EP_INT_EN0 0x0360
77#define BCMA_CORE_PCIE2_SYS_EP_INT_EN1 0x0364
78#define BCMA_CORE_PCIE2_SYS_EP_INT_CSR0 0x0370
79#define BCMA_CORE_PCIE2_SYS_EP_INT_CSR1 0x0374
80#define BCMA_CORE_PCIE2_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2))
81#define BCMA_CORE_PCIE2_FUNC0_IMAP0_0 0x0C00
82#define BCMA_CORE_PCIE2_FUNC0_IMAP0_1 0x0C04
83#define BCMA_CORE_PCIE2_FUNC0_IMAP0_2 0x0C08
84#define BCMA_CORE_PCIE2_FUNC0_IMAP0_3 0x0C0C
85#define BCMA_CORE_PCIE2_FUNC0_IMAP0_4 0x0C10
86#define BCMA_CORE_PCIE2_FUNC0_IMAP0_5 0x0C14
87#define BCMA_CORE_PCIE2_FUNC0_IMAP0_6 0x0C18
88#define BCMA_CORE_PCIE2_FUNC0_IMAP0_7 0x0C1C
89#define BCMA_CORE_PCIE2_FUNC1_IMAP0_0 0x0C20
90#define BCMA_CORE_PCIE2_FUNC1_IMAP0_1 0x0C24
91#define BCMA_CORE_PCIE2_FUNC1_IMAP0_2 0x0C28
92#define BCMA_CORE_PCIE2_FUNC1_IMAP0_3 0x0C2C
93#define BCMA_CORE_PCIE2_FUNC1_IMAP0_4 0x0C30
94#define BCMA_CORE_PCIE2_FUNC1_IMAP0_5 0x0C34
95#define BCMA_CORE_PCIE2_FUNC1_IMAP0_6 0x0C38
96#define BCMA_CORE_PCIE2_FUNC1_IMAP0_7 0x0C3C
97#define BCMA_CORE_PCIE2_FUNC0_IMAP1 0x0C80
98#define BCMA_CORE_PCIE2_FUNC1_IMAP1 0x0C88
99#define BCMA_CORE_PCIE2_FUNC0_IMAP2 0x0CC0
100#define BCMA_CORE_PCIE2_FUNC1_IMAP2 0x0CC8
101#define BCMA_CORE_PCIE2_IARR0_LOWER 0x0D00
102#define BCMA_CORE_PCIE2_IARR0_UPPER 0x0D04
103#define BCMA_CORE_PCIE2_IARR1_LOWER 0x0D08
104#define BCMA_CORE_PCIE2_IARR1_UPPER 0x0D0C
105#define BCMA_CORE_PCIE2_IARR2_LOWER 0x0D10
106#define BCMA_CORE_PCIE2_IARR2_UPPER 0x0D14
107#define BCMA_CORE_PCIE2_OARR0 0x0D20
108#define BCMA_CORE_PCIE2_OARR1 0x0D28
109#define BCMA_CORE_PCIE2_OARR2 0x0D30
110#define BCMA_CORE_PCIE2_OMAP0_LOWER 0x0D40
111#define BCMA_CORE_PCIE2_OMAP0_UPPER 0x0D44
112#define BCMA_CORE_PCIE2_OMAP1_LOWER 0x0D48
113#define BCMA_CORE_PCIE2_OMAP1_UPPER 0x0D4C
114#define BCMA_CORE_PCIE2_OMAP2_LOWER 0x0D50
115#define BCMA_CORE_PCIE2_OMAP2_UPPER 0x0D54
116#define BCMA_CORE_PCIE2_FUNC1_IARR1_SIZE 0x0D58
117#define BCMA_CORE_PCIE2_FUNC1_IARR2_SIZE 0x0D5C
118#define BCMA_CORE_PCIE2_MEM_CONTROL 0x0F00
119#define BCMA_CORE_PCIE2_MEM_ECC_ERRLOG0 0x0F04
120#define BCMA_CORE_PCIE2_MEM_ECC_ERRLOG1 0x0F08
121#define BCMA_CORE_PCIE2_LINK_STATUS 0x0F0C
122#define BCMA_CORE_PCIE2_STRAP_STATUS 0x0F10
123#define BCMA_CORE_PCIE2_RESET_STATUS 0x0F14
124#define BCMA_CORE_PCIE2_RESETEN_IN_LINKDOWN 0x0F18
125#define BCMA_CORE_PCIE2_MISC_INTR_EN 0x0F1C
126#define BCMA_CORE_PCIE2_TX_DEBUG_CFG 0x0F20
127#define BCMA_CORE_PCIE2_MISC_CONFIG 0x0F24
128#define BCMA_CORE_PCIE2_MISC_STATUS 0x0F28
129#define BCMA_CORE_PCIE2_INTR_EN 0x0F30
130#define BCMA_CORE_PCIE2_INTR_CLEAR 0x0F34
131#define BCMA_CORE_PCIE2_INTR_STATUS 0x0F38
132
133/* PCIE gen2 config regs */
134#define PCIE2_INTSTATUS 0x090
135#define PCIE2_INTMASK 0x094
136#define PCIE2_SBMBX 0x098
137
138#define PCIE2_PMCR_REFUP 0x1814 /* Trefup time */
139
140#define PCIE2_CAP_DEVSTSCTRL2_OFFSET 0xD4
141#define PCIE2_CAP_DEVSTSCTRL2_LTRENAB 0x400
142#define PCIE2_PVT_REG_PM_CLK_PERIOD 0x184c
143
144struct bcma_drv_pcie2 {
145 struct bcma_device *core;
146};
147
148#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
149#define pcie2_read32(pcie2, offset) bcma_read32((pcie2)->core, offset)
150#define pcie2_write16(pcie2, offset, val) bcma_write16((pcie2)->core, offset, val)
151#define pcie2_write32(pcie2, offset, val) bcma_write32((pcie2)->core, offset, val)
152
153#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set)
154#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask)
155
156void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
157
158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d2633ee099d9..b39e5000ff58 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -308,6 +308,7 @@ struct bio_integrity_payload {
308 308
309 unsigned short bip_slab; /* slab the bip came from */ 309 unsigned short bip_slab; /* slab the bip came from */
310 unsigned short bip_vcnt; /* # of integrity bio_vecs */ 310 unsigned short bip_vcnt; /* # of integrity bio_vecs */
311 unsigned short bip_max_vcnt; /* integrity bio_vec slots */
311 unsigned bip_owns_buf:1; /* should free bip_buf */ 312 unsigned bip_owns_buf:1; /* should free bip_buf */
312 313
313 struct work_struct bip_work; /* I/O completion */ 314 struct work_struct bip_work; /* I/O completion */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7ad634501e48..e1c8d080c427 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -88,32 +88,32 @@
88 * lib/bitmap.c provides these functions: 88 * lib/bitmap.c provides these functions:
89 */ 89 */
90 90
91extern int __bitmap_empty(const unsigned long *bitmap, int bits); 91extern int __bitmap_empty(const unsigned long *bitmap, unsigned int nbits);
92extern int __bitmap_full(const unsigned long *bitmap, int bits); 92extern int __bitmap_full(const unsigned long *bitmap, unsigned int nbits);
93extern int __bitmap_equal(const unsigned long *bitmap1, 93extern int __bitmap_equal(const unsigned long *bitmap1,
94 const unsigned long *bitmap2, int bits); 94 const unsigned long *bitmap2, unsigned int nbits);
95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, 95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
96 int bits); 96 unsigned int nbits);
97extern void __bitmap_shift_right(unsigned long *dst, 97extern void __bitmap_shift_right(unsigned long *dst,
98 const unsigned long *src, int shift, int bits); 98 const unsigned long *src, int shift, int bits);
99extern void __bitmap_shift_left(unsigned long *dst, 99extern void __bitmap_shift_left(unsigned long *dst,
100 const unsigned long *src, int shift, int bits); 100 const unsigned long *src, int shift, int bits);
101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, unsigned int nbits);
103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, unsigned int nbits);
105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, unsigned int nbits);
107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
108 const unsigned long *bitmap2, int bits); 108 const unsigned long *bitmap2, unsigned int nbits);
109extern int __bitmap_intersects(const unsigned long *bitmap1, 109extern int __bitmap_intersects(const unsigned long *bitmap1,
110 const unsigned long *bitmap2, int bits); 110 const unsigned long *bitmap2, unsigned int nbits);
111extern int __bitmap_subset(const unsigned long *bitmap1, 111extern int __bitmap_subset(const unsigned long *bitmap1,
112 const unsigned long *bitmap2, int bits); 112 const unsigned long *bitmap2, unsigned int nbits);
113extern int __bitmap_weight(const unsigned long *bitmap, int bits); 113extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
114 114
115extern void bitmap_set(unsigned long *map, int i, int len); 115extern void bitmap_set(unsigned long *map, unsigned int start, int len);
116extern void bitmap_clear(unsigned long *map, int start, int nr); 116extern void bitmap_clear(unsigned long *map, unsigned int start, int len);
117extern unsigned long bitmap_find_next_zero_area(unsigned long *map, 117extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
118 unsigned long size, 118 unsigned long size,
119 unsigned long start, 119 unsigned long start,
@@ -140,9 +140,9 @@ extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
140 const unsigned long *relmap, int bits); 140 const unsigned long *relmap, int bits);
141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, 141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
142 int sz, int bits); 142 int sz, int bits);
143extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 143extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
144extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 144extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
145extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 145extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); 147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
148 148
@@ -188,15 +188,15 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
188} 188}
189 189
190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, 190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
191 const unsigned long *src2, int nbits) 191 const unsigned long *src2, unsigned int nbits)
192{ 192{
193 if (small_const_nbits(nbits)) 193 if (small_const_nbits(nbits))
194 return (*dst = *src1 & *src2) != 0; 194 return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0;
195 return __bitmap_and(dst, src1, src2, nbits); 195 return __bitmap_and(dst, src1, src2, nbits);
196} 196}
197 197
198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 199 const unsigned long *src2, unsigned int nbits)
200{ 200{
201 if (small_const_nbits(nbits)) 201 if (small_const_nbits(nbits))
202 *dst = *src1 | *src2; 202 *dst = *src1 | *src2;
@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
205} 205}
206 206
207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
208 const unsigned long *src2, int nbits) 208 const unsigned long *src2, unsigned int nbits)
209{ 209{
210 if (small_const_nbits(nbits)) 210 if (small_const_nbits(nbits))
211 *dst = *src1 ^ *src2; 211 *dst = *src1 ^ *src2;
@@ -214,24 +214,24 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
214} 214}
215 215
216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, 216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
217 const unsigned long *src2, int nbits) 217 const unsigned long *src2, unsigned int nbits)
218{ 218{
219 if (small_const_nbits(nbits)) 219 if (small_const_nbits(nbits))
220 return (*dst = *src1 & ~(*src2)) != 0; 220 return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
221 return __bitmap_andnot(dst, src1, src2, nbits); 221 return __bitmap_andnot(dst, src1, src2, nbits);
222} 222}
223 223
224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
225 int nbits) 225 unsigned int nbits)
226{ 226{
227 if (small_const_nbits(nbits)) 227 if (small_const_nbits(nbits))
228 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); 228 *dst = ~(*src);
229 else 229 else
230 __bitmap_complement(dst, src, nbits); 230 __bitmap_complement(dst, src, nbits);
231} 231}
232 232
233static inline int bitmap_equal(const unsigned long *src1, 233static inline int bitmap_equal(const unsigned long *src1,
234 const unsigned long *src2, int nbits) 234 const unsigned long *src2, unsigned int nbits)
235{ 235{
236 if (small_const_nbits(nbits)) 236 if (small_const_nbits(nbits))
237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); 237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
@@ -240,7 +240,7 @@ static inline int bitmap_equal(const unsigned long *src1,
240} 240}
241 241
242static inline int bitmap_intersects(const unsigned long *src1, 242static inline int bitmap_intersects(const unsigned long *src1,
243 const unsigned long *src2, int nbits) 243 const unsigned long *src2, unsigned int nbits)
244{ 244{
245 if (small_const_nbits(nbits)) 245 if (small_const_nbits(nbits))
246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; 246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
@@ -249,7 +249,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
249} 249}
250 250
251static inline int bitmap_subset(const unsigned long *src1, 251static inline int bitmap_subset(const unsigned long *src1,
252 const unsigned long *src2, int nbits) 252 const unsigned long *src2, unsigned int nbits)
253{ 253{
254 if (small_const_nbits(nbits)) 254 if (small_const_nbits(nbits))
255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); 255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
@@ -257,7 +257,7 @@ static inline int bitmap_subset(const unsigned long *src1,
257 return __bitmap_subset(src1, src2, nbits); 257 return __bitmap_subset(src1, src2, nbits);
258} 258}
259 259
260static inline int bitmap_empty(const unsigned long *src, int nbits) 260static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
261{ 261{
262 if (small_const_nbits(nbits)) 262 if (small_const_nbits(nbits))
263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -265,7 +265,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
265 return __bitmap_empty(src, nbits); 265 return __bitmap_empty(src, nbits);
266} 266}
267 267
268static inline int bitmap_full(const unsigned long *src, int nbits) 268static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
269{ 269{
270 if (small_const_nbits(nbits)) 270 if (small_const_nbits(nbits))
271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
@@ -273,7 +273,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
273 return __bitmap_full(src, nbits); 273 return __bitmap_full(src, nbits);
274} 274}
275 275
276static inline int bitmap_weight(const unsigned long *src, int nbits) 276static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
277{ 277{
278 if (small_const_nbits(nbits)) 278 if (small_const_nbits(nbits))
279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); 279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -284,7 +284,7 @@ static inline void bitmap_shift_right(unsigned long *dst,
284 const unsigned long *src, int n, int nbits) 284 const unsigned long *src, int n, int nbits)
285{ 285{
286 if (small_const_nbits(nbits)) 286 if (small_const_nbits(nbits))
287 *dst = *src >> n; 287 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n;
288 else 288 else
289 __bitmap_shift_right(dst, src, n, nbits); 289 __bitmap_shift_right(dst, src, n, nbits);
290} 290}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8699bcf5f099..518b46555b80 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -21,6 +21,7 @@
21#include <linux/bsg.h> 21#include <linux/bsg.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/rcupdate.h> 23#include <linux/rcupdate.h>
24#include <linux/percpu-refcount.h>
24 25
25#include <asm/scatterlist.h> 26#include <asm/scatterlist.h>
26 27
@@ -470,6 +471,7 @@ struct request_queue {
470 struct mutex sysfs_lock; 471 struct mutex sysfs_lock;
471 472
472 int bypass_depth; 473 int bypass_depth;
474 int mq_freeze_depth;
473 475
474#if defined(CONFIG_BLK_DEV_BSG) 476#if defined(CONFIG_BLK_DEV_BSG)
475 bsg_job_fn *bsg_job_fn; 477 bsg_job_fn *bsg_job_fn;
@@ -483,7 +485,7 @@ struct request_queue {
483#endif 485#endif
484 struct rcu_head rcu_head; 486 struct rcu_head rcu_head;
485 wait_queue_head_t mq_freeze_wq; 487 wait_queue_head_t mq_freeze_wq;
486 struct percpu_counter mq_usage_counter; 488 struct percpu_ref mq_usage_counter;
487 struct list_head all_q_node; 489 struct list_head all_q_node;
488 490
489 struct blk_mq_tag_set *tag_set; 491 struct blk_mq_tag_set *tag_set;
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 0846e6b931ce..89f67c1c3160 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -2,7 +2,7 @@
2#define _LINUX_BYTEORDER_GENERIC_H 2#define _LINUX_BYTEORDER_GENERIC_H
3 3
4/* 4/*
5 * linux/byteorder_generic.h 5 * linux/byteorder/generic.h
6 * Generic Byte-reordering support 6 * Generic Byte-reordering support
7 * 7 *
8 * The "... p" macros, like le64_to_cpup, can be used with pointers 8 * The "... p" macros, like le64_to_cpup, can be used with pointers
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 84b13ad67c1c..aa93e5ef594c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -78,8 +78,11 @@ extern const kernel_cap_t __cap_init_eff_set;
78# error Fix up hand-coded capability macro initializers 78# error Fix up hand-coded capability macro initializers
79#else /* HAND-CODED capability initializers */ 79#else /* HAND-CODED capability initializers */
80 80
81#define CAP_LAST_U32 ((_KERNEL_CAPABILITY_U32S) - 1)
82#define CAP_LAST_U32_VALID_MASK (CAP_TO_MASK(CAP_LAST_CAP + 1) -1)
83
81# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) 84# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})
82# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) 85# define CAP_FULL_SET ((kernel_cap_t){{ ~0, CAP_LAST_U32_VALID_MASK }})
83# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ 86# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
84 | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \ 87 | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \
85 CAP_FS_MASK_B1 } }) 88 CAP_FS_MASK_B1 } })
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index d21f2dba0731..40ae58e3e9db 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -285,19 +285,9 @@ extern void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio,
285 285
286extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 286extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
287 bool can_fail); 287 bool can_fail);
288extern void ceph_msg_kfree(struct ceph_msg *m);
289 288
290 289extern struct ceph_msg *ceph_msg_get(struct ceph_msg *msg);
291static inline struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) 290extern void ceph_msg_put(struct ceph_msg *msg);
292{
293 kref_get(&msg->kref);
294 return msg;
295}
296extern void ceph_msg_last_put(struct kref *kref);
297static inline void ceph_msg_put(struct ceph_msg *msg)
298{
299 kref_put(&msg->kref, ceph_msg_last_put);
300}
301 291
302extern void ceph_msg_dump(struct ceph_msg *msg); 292extern void ceph_msg_dump(struct ceph_msg *msg);
303 293
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 94ec69672164..03aeb27fcc69 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -117,7 +117,7 @@ struct ceph_osd_request {
117 struct list_head r_req_lru_item; 117 struct list_head r_req_lru_item;
118 struct list_head r_osd_item; 118 struct list_head r_osd_item;
119 struct list_head r_linger_item; 119 struct list_head r_linger_item;
120 struct list_head r_linger_osd; 120 struct list_head r_linger_osd_item;
121 struct ceph_osd *r_osd; 121 struct ceph_osd *r_osd;
122 struct ceph_pg r_pgid; 122 struct ceph_pg r_pgid;
123 int r_pg_osds[CEPH_PG_MAX_SIZE]; 123 int r_pg_osds[CEPH_PG_MAX_SIZE];
@@ -325,22 +325,14 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
325 325
326extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, 326extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
327 struct ceph_osd_request *req); 327 struct ceph_osd_request *req);
328extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, 328
329 struct ceph_osd_request *req); 329extern void ceph_osdc_get_request(struct ceph_osd_request *req);
330 330extern void ceph_osdc_put_request(struct ceph_osd_request *req);
331static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
332{
333 kref_get(&req->r_kref);
334}
335extern void ceph_osdc_release_request(struct kref *kref);
336static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
337{
338 kref_put(&req->r_kref, ceph_osdc_release_request);
339}
340 331
341extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, 332extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
342 struct ceph_osd_request *req, 333 struct ceph_osd_request *req,
343 bool nofail); 334 bool nofail);
335extern void ceph_osdc_cancel_request(struct ceph_osd_request *req);
344extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc, 336extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
345 struct ceph_osd_request *req); 337 struct ceph_osd_request *req);
346extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 338extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 8a111dd42d7a..b5223c570eba 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -203,7 +203,15 @@ struct cgroup {
203 struct kernfs_node *kn; /* cgroup kernfs entry */ 203 struct kernfs_node *kn; /* cgroup kernfs entry */
204 struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */ 204 struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */
205 205
206 /* the bitmask of subsystems enabled on the child cgroups */ 206 /*
207 * The bitmask of subsystems enabled on the child cgroups.
208 * ->subtree_control is the one configured through
209 * "cgroup.subtree_control" while ->child_subsys_mask is the
210 * effective one which may have more subsystems enabled.
211 * Controller knobs are made available iff it's enabled in
212 * ->subtree_control.
213 */
214 unsigned int subtree_control;
207 unsigned int child_subsys_mask; 215 unsigned int child_subsys_mask;
208 216
209 /* Private pointers for each registered subsystem */ 217 /* Private pointers for each registered subsystem */
@@ -248,73 +256,9 @@ struct cgroup {
248 256
249/* cgroup_root->flags */ 257/* cgroup_root->flags */
250enum { 258enum {
251 /* 259 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), /* __DEVEL__sane_behavior specified */
252 * Unfortunately, cgroup core and various controllers are riddled
253 * with idiosyncrasies and pointless options. The following flag,
254 * when set, will force sane behavior - some options are forced on,
255 * others are disallowed, and some controllers will change their
256 * hierarchical or other behaviors.
257 *
258 * The set of behaviors affected by this flag are still being
259 * determined and developed and the mount option for this flag is
260 * prefixed with __DEVEL__. The prefix will be dropped once we
261 * reach the point where all behaviors are compatible with the
262 * planned unified hierarchy, which will automatically turn on this
263 * flag.
264 *
265 * The followings are the behaviors currently affected this flag.
266 *
267 * - Mount options "noprefix", "xattr", "clone_children",
268 * "release_agent" and "name" are disallowed.
269 *
270 * - When mounting an existing superblock, mount options should
271 * match.
272 *
273 * - Remount is disallowed.
274 *
275 * - rename(2) is disallowed.
276 *
277 * - "tasks" is removed. Everything should be at process
278 * granularity. Use "cgroup.procs" instead.
279 *
280 * - "cgroup.procs" is not sorted. pids will be unique unless they
281 * got recycled inbetween reads.
282 *
283 * - "release_agent" and "notify_on_release" are removed.
284 * Replacement notification mechanism will be implemented.
285 *
286 * - "cgroup.clone_children" is removed.
287 *
288 * - "cgroup.subtree_populated" is available. Its value is 0 if
289 * the cgroup and its descendants contain no task; otherwise, 1.
290 * The file also generates kernfs notification which can be
291 * monitored through poll and [di]notify when the value of the
292 * file changes.
293 *
294 * - If mount is requested with sane_behavior but without any
295 * subsystem, the default unified hierarchy is mounted.
296 *
297 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
298 * and take masks of ancestors with non-empty cpus/mems, instead of
299 * being moved to an ancestor.
300 *
301 * - cpuset: a task can be moved into an empty cpuset, and again it
302 * takes masks of ancestors.
303 *
304 * - memcg: use_hierarchy is on by default and the cgroup file for
305 * the flag is not created.
306 *
307 * - blkcg: blk-throttle becomes properly hierarchical.
308 *
309 * - debug: disallowed on the default hierarchy.
310 */
311 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
312
313 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ 260 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
314 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ 261 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
315
316 /* mount options live below bit 16 */
317 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
318}; 262};
319 263
320/* 264/*
@@ -440,9 +384,11 @@ struct css_set {
440enum { 384enum {
441 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */ 385 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
442 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ 386 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
443 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
444 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ 387 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
445 CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */ 388
389 /* internal flags, do not use outside cgroup core proper */
390 __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
391 __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */
446}; 392};
447 393
448#define MAX_CFTYPE_NAME 64 394#define MAX_CFTYPE_NAME 64
@@ -526,20 +472,64 @@ struct cftype {
526extern struct cgroup_root cgrp_dfl_root; 472extern struct cgroup_root cgrp_dfl_root;
527extern struct css_set init_css_set; 473extern struct css_set init_css_set;
528 474
475/**
476 * cgroup_on_dfl - test whether a cgroup is on the default hierarchy
477 * @cgrp: the cgroup of interest
478 *
479 * The default hierarchy is the v2 interface of cgroup and this function
480 * can be used to test whether a cgroup is on the default hierarchy for
481 * cases where a subsystem should behave differnetly depending on the
482 * interface version.
483 *
484 * The set of behaviors which change on the default hierarchy are still
485 * being determined and the mount option is prefixed with __DEVEL__.
486 *
487 * List of changed behaviors:
488 *
489 * - Mount options "noprefix", "xattr", "clone_children", "release_agent"
490 * and "name" are disallowed.
491 *
492 * - When mounting an existing superblock, mount options should match.
493 *
494 * - Remount is disallowed.
495 *
496 * - rename(2) is disallowed.
497 *
498 * - "tasks" is removed. Everything should be at process granularity. Use
499 * "cgroup.procs" instead.
500 *
501 * - "cgroup.procs" is not sorted. pids will be unique unless they got
502 * recycled inbetween reads.
503 *
504 * - "release_agent" and "notify_on_release" are removed. Replacement
505 * notification mechanism will be implemented.
506 *
507 * - "cgroup.clone_children" is removed.
508 *
509 * - "cgroup.subtree_populated" is available. Its value is 0 if the cgroup
510 * and its descendants contain no task; otherwise, 1. The file also
511 * generates kernfs notification which can be monitored through poll and
512 * [di]notify when the value of the file changes.
513 *
514 * - cpuset: tasks will be kept in empty cpusets when hotplug happens and
515 * take masks of ancestors with non-empty cpus/mems, instead of being
516 * moved to an ancestor.
517 *
518 * - cpuset: a task can be moved into an empty cpuset, and again it takes
519 * masks of ancestors.
520 *
521 * - memcg: use_hierarchy is on by default and the cgroup file for the flag
522 * is not created.
523 *
524 * - blkcg: blk-throttle becomes properly hierarchical.
525 *
526 * - debug: disallowed on the default hierarchy.
527 */
529static inline bool cgroup_on_dfl(const struct cgroup *cgrp) 528static inline bool cgroup_on_dfl(const struct cgroup *cgrp)
530{ 529{
531 return cgrp->root == &cgrp_dfl_root; 530 return cgrp->root == &cgrp_dfl_root;
532} 531}
533 532
534/*
535 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
536 * function can be called as long as @cgrp is accessible.
537 */
538static inline bool cgroup_sane_behavior(const struct cgroup *cgrp)
539{
540 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR;
541}
542
543/* no synchronization, the result can only be used as a hint */ 533/* no synchronization, the result can only be used as a hint */
544static inline bool cgroup_has_tasks(struct cgroup *cgrp) 534static inline bool cgroup_has_tasks(struct cgroup *cgrp)
545{ 535{
@@ -602,7 +592,8 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
602 592
603char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); 593char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
604 594
605int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 595int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
596int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
606int cgroup_rm_cftypes(struct cftype *cfts); 597int cgroup_rm_cftypes(struct cftype *cfts);
607 598
608bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 599bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
@@ -634,6 +625,7 @@ struct cgroup_subsys {
634 int (*css_online)(struct cgroup_subsys_state *css); 625 int (*css_online)(struct cgroup_subsys_state *css);
635 void (*css_offline)(struct cgroup_subsys_state *css); 626 void (*css_offline)(struct cgroup_subsys_state *css);
636 void (*css_free)(struct cgroup_subsys_state *css); 627 void (*css_free)(struct cgroup_subsys_state *css);
628 void (*css_reset)(struct cgroup_subsys_state *css);
637 629
638 int (*can_attach)(struct cgroup_subsys_state *css, 630 int (*can_attach)(struct cgroup_subsys_state *css,
639 struct cgroup_taskset *tset); 631 struct cgroup_taskset *tset);
@@ -682,8 +674,21 @@ struct cgroup_subsys {
682 */ 674 */
683 struct list_head cfts; 675 struct list_head cfts;
684 676
685 /* base cftypes, automatically registered with subsys itself */ 677 /*
686 struct cftype *base_cftypes; 678 * Base cftypes which are automatically registered. The two can
679 * point to the same array.
680 */
681 struct cftype *dfl_cftypes; /* for the default hierarchy */
682 struct cftype *legacy_cftypes; /* for the legacy hierarchies */
683
684 /*
685 * A subsystem may depend on other subsystems. When such subsystem
686 * is enabled on a cgroup, the depended-upon subsystems are enabled
687 * together if available. Subsystems enabled due to dependency are
688 * not visible to userland until explicitly enabled. The following
689 * specifies the mask of subsystems that this one depends on.
690 */
691 unsigned int depends_on;
687}; 692};
688 693
689#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys; 694#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 0c287dbbb144..411dd7eb2653 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -619,5 +619,10 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
619 619
620#endif /* platform dependent I/O accessors */ 620#endif /* platform dependent I/O accessors */
621 621
622#ifdef CONFIG_DEBUG_FS
623struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
624 void *data, const struct file_operations *fops);
625#endif
626
622#endif /* CONFIG_COMMON_CLK */ 627#endif /* CONFIG_COMMON_CLK */
623#endif /* CLK_PROVIDER_H */ 628#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/clk-conf.h b/include/linux/clk/clk-conf.h
new file mode 100644
index 000000000000..f3050e15f833
--- /dev/null
+++ b/include/linux/clk/clk-conf.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2014 Samsung Electronics Co., Ltd.
3 * Sylwester Nawrocki <s.nawrocki@samsung.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 as
7 * published by the Free Software Foundation.
8 */
9
10struct device_node;
11
12#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
13int of_clk_set_defaults(struct device_node *node, bool clk_supplier);
14#else
15static inline int of_clk_set_defaults(struct device_node *node,
16 bool clk_supplier)
17{
18 return 0;
19}
20#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index a16b497d5159..653f0e2b6ca9 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -162,7 +162,6 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
162 * @archdata: arch-specific data 162 * @archdata: arch-specific data
163 * @suspend: suspend function for the clocksource, if necessary 163 * @suspend: suspend function for the clocksource, if necessary
164 * @resume: resume function for the clocksource, if necessary 164 * @resume: resume function for the clocksource, if necessary
165 * @cycle_last: most recent cycle counter value seen by ::read()
166 * @owner: module reference, must be set by clocksource in modules 165 * @owner: module reference, must be set by clocksource in modules
167 */ 166 */
168struct clocksource { 167struct clocksource {
@@ -171,7 +170,6 @@ struct clocksource {
171 * clocksource itself is cacheline aligned. 170 * clocksource itself is cacheline aligned.
172 */ 171 */
173 cycle_t (*read)(struct clocksource *cs); 172 cycle_t (*read)(struct clocksource *cs);
174 cycle_t cycle_last;
175 cycle_t mask; 173 cycle_t mask;
176 u32 mult; 174 u32 mult;
177 u32 shift; 175 u32 shift;
diff --git a/include/linux/cma.h b/include/linux/cma.h
new file mode 100644
index 000000000000..371b93042520
--- /dev/null
+++ b/include/linux/cma.h
@@ -0,0 +1,27 @@
1#ifndef __CMA_H__
2#define __CMA_H__
3
4/*
5 * There is always at least global CMA area and a few optional
6 * areas configured in kernel .config.
7 */
8#ifdef CONFIG_CMA_AREAS
9#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
10
11#else
12#define MAX_CMA_AREAS (0)
13
14#endif
15
16struct cma;
17
18extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma);
20
21extern int __init cma_declare_contiguous(phys_addr_t size,
22 phys_addr_t base, phys_addr_t limit,
23 phys_addr_t alignment, unsigned int order_per_bit,
24 bool fixed, struct cma **res_cma);
25extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
26extern bool cma_release(struct cma *cma, struct page *pages, int count);
27#endif
diff --git a/include/linux/component.h b/include/linux/component.h
index 68870182ca1e..c00dcc302611 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -29,4 +29,11 @@ void component_master_del(struct device *,
29int component_master_add_child(struct master *master, 29int component_master_add_child(struct master *master,
30 int (*compare)(struct device *, void *), void *compare_data); 30 int (*compare)(struct device *, void *), void *compare_data);
31 31
32struct component_match;
33
34int component_master_add_with_match(struct device *,
35 const struct component_master_ops *, struct component_match *);
36void component_match_add(struct device *, struct component_match **,
37 int (*compare)(struct device *, void *), void *compare_data);
38
32#endif 39#endif
diff --git a/include/linux/cper.h b/include/linux/cper.h
index 2fc0ec3d89cc..76abba4b238e 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -22,6 +22,7 @@
22#define LINUX_CPER_H 22#define LINUX_CPER_H
23 23
24#include <linux/uuid.h> 24#include <linux/uuid.h>
25#include <linux/trace_seq.h>
25 26
26/* CPER record signature and the size */ 27/* CPER record signature and the size */
27#define CPER_SIG_RECORD "CPER" 28#define CPER_SIG_RECORD "CPER"
@@ -36,6 +37,13 @@
36#define CPER_RECORD_REV 0x0100 37#define CPER_RECORD_REV 0x0100
37 38
38/* 39/*
40 * CPER record length contains the CPER fields which are relevant for further
41 * handling of a memory error in userspace (we don't carry all the fields
42 * defined in the UEFI spec because some of them don't make any sense.)
43 * Currently, a length of 256 should be more than enough.
44 */
45#define CPER_REC_LEN 256
46/*
39 * Severity difinition for error_severity in struct cper_record_header 47 * Severity difinition for error_severity in struct cper_record_header
40 * and section_severity in struct cper_section_descriptor 48 * and section_severity in struct cper_section_descriptor
41 */ 49 */
@@ -356,6 +364,24 @@ struct cper_sec_mem_err {
356 __u16 mem_dev_handle; /* module handle in UEFI 2.4 */ 364 __u16 mem_dev_handle; /* module handle in UEFI 2.4 */
357}; 365};
358 366
367struct cper_mem_err_compact {
368 __u64 validation_bits;
369 __u16 node;
370 __u16 card;
371 __u16 module;
372 __u16 bank;
373 __u16 device;
374 __u16 row;
375 __u16 column;
376 __u16 bit_pos;
377 __u64 requestor_id;
378 __u64 responder_id;
379 __u64 target_id;
380 __u16 rank;
381 __u16 mem_array_handle;
382 __u16 mem_dev_handle;
383};
384
359struct cper_sec_pcie { 385struct cper_sec_pcie {
360 __u64 validation_bits; 386 __u64 validation_bits;
361 __u32 port_type; 387 __u32 port_type;
@@ -395,7 +421,13 @@ struct cper_sec_pcie {
395#pragma pack() 421#pragma pack()
396 422
397u64 cper_next_record_id(void); 423u64 cper_next_record_id(void);
424const char *cper_severity_str(unsigned int);
425const char *cper_mem_err_type_str(unsigned int);
398void cper_print_bits(const char *prefix, unsigned int bits, 426void cper_print_bits(const char *prefix, unsigned int bits,
399 const char * const strs[], unsigned int strs_size); 427 const char * const strs[], unsigned int strs_size);
428void cper_mem_err_pack(const struct cper_sec_mem_err *,
429 struct cper_mem_err_compact *);
430const char *cper_mem_err_unpack(struct trace_seq *,
431 struct cper_mem_err_compact *);
400 432
401#endif 433#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index ec4112d257bc..7d1955afa62c 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -176,6 +176,7 @@ static inline void disable_cpufreq(void) { }
176 176
177#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ 177#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
178#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ 178#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
179#define CPUFREQ_RELATION_C 2 /* closest frequency to target */
179 180
180struct freq_attr { 181struct freq_attr {
181 struct attribute attr; 182 struct attribute attr;
@@ -482,8 +483,8 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
482 *********************************************************************/ 483 *********************************************************************/
483 484
484/* Special Values of .frequency field */ 485/* Special Values of .frequency field */
485#define CPUFREQ_ENTRY_INVALID ~0 486#define CPUFREQ_ENTRY_INVALID ~0u
486#define CPUFREQ_TABLE_END ~1 487#define CPUFREQ_TABLE_END ~1u
487/* Special Values of .flags field */ 488/* Special Values of .flags field */
488#define CPUFREQ_BOOST_FREQ (1 << 0) 489#define CPUFREQ_BOOST_FREQ (1 << 0)
489 490
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index 7d275c4fc011..9e8a032c1788 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -8,8 +8,8 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/bitrev.h> 9#include <linux/bitrev.h>
10 10
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14/** 14/**
15 * crc32_le_combine - Combine two crc32 check values into one. For two 15 * crc32_le_combine - Combine two crc32 check values into one. For two
@@ -29,9 +29,14 @@ extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
29 * with the same initializer as crc1, and crc2 seed was 0. See 29 * with the same initializer as crc1, and crc2 seed was 0. See
30 * also crc32_combine_test(). 30 * also crc32_combine_test().
31 */ 31 */
32extern u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2); 32u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len);
33 33
34extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); 34static inline u32 crc32_le_combine(u32 crc1, u32 crc2, size_t len2)
35{
36 return crc32_le_shift(crc1, len2) ^ crc2;
37}
38
39u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len);
35 40
36/** 41/**
37 * __crc32c_le_combine - Combine two crc32c check values into one. For two 42 * __crc32c_le_combine - Combine two crc32c check values into one. For two
@@ -51,7 +56,12 @@ extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len);
51 * seeded with the same initializer as crc1, and crc2 seed 56 * seeded with the same initializer as crc1, and crc2 seed
52 * was 0. See also crc32c_combine_test(). 57 * was 0. See also crc32c_combine_test().
53 */ 58 */
54extern u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2); 59u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len);
60
61static inline u32 __crc32c_le_combine(u32 crc1, u32 crc2, size_t len2)
62{
63 return __crc32c_le_shift(crc1, len2) ^ crc2;
64}
55 65
56#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 66#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
57 67
diff --git a/include/linux/cred.h b/include/linux/cred.h
index f61d6c8f5ef3..b2d0820837c4 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -259,6 +259,15 @@ static inline void put_cred(const struct cred *_cred)
259 rcu_dereference_protected(current->cred, 1) 259 rcu_dereference_protected(current->cred, 1)
260 260
261/** 261/**
262 * current_real_cred - Access the current task's objective credentials
263 *
264 * Access the objective credentials of the current task. RCU-safe,
265 * since nobody else can modify it.
266 */
267#define current_real_cred() \
268 rcu_dereference_protected(current->real_cred, 1)
269
270/**
262 * __task_cred - Access a task's objective credentials 271 * __task_cred - Access a task's objective credentials
263 * @task: The task to query 272 * @task: The task to query
264 * 273 *
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index b92eadf92d72..d45e949699ea 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -710,9 +710,9 @@ static inline void ablkcipher_request_free(struct ablkcipher_request *req)
710 710
711static inline void ablkcipher_request_set_callback( 711static inline void ablkcipher_request_set_callback(
712 struct ablkcipher_request *req, 712 struct ablkcipher_request *req,
713 u32 flags, crypto_completion_t complete, void *data) 713 u32 flags, crypto_completion_t compl, void *data)
714{ 714{
715 req->base.complete = complete; 715 req->base.complete = compl;
716 req->base.data = data; 716 req->base.data = data;
717 req->base.flags = flags; 717 req->base.flags = flags;
718} 718}
@@ -841,10 +841,10 @@ static inline void aead_request_free(struct aead_request *req)
841 841
842static inline void aead_request_set_callback(struct aead_request *req, 842static inline void aead_request_set_callback(struct aead_request *req,
843 u32 flags, 843 u32 flags,
844 crypto_completion_t complete, 844 crypto_completion_t compl,
845 void *data) 845 void *data)
846{ 846{
847 req->base.complete = complete; 847 req->base.complete = compl;
848 req->base.data = data; 848 req->base.data = data;
849 req->base.flags = flags; 849 req->base.flags = flags;
850} 850}
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3c7ec327ebd2..e4ae2ad48d07 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -249,6 +249,7 @@ extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
249extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 249extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
250extern struct dentry *d_find_any_alias(struct inode *inode); 250extern struct dentry *d_find_any_alias(struct inode *inode);
251extern struct dentry * d_obtain_alias(struct inode *); 251extern struct dentry * d_obtain_alias(struct inode *);
252extern struct dentry * d_obtain_root(struct inode *);
252extern void shrink_dcache_sb(struct super_block *); 253extern void shrink_dcache_sb(struct super_block *);
253extern void shrink_dcache_parent(struct dentry *); 254extern void shrink_dcache_parent(struct dentry *);
254extern void shrink_dcache_for_umount(struct super_block *); 255extern void shrink_dcache_for_umount(struct super_block *);
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h
index 115272137a9c..4d683df898e6 100644
--- a/include/linux/decompress/bunzip2.h
+++ b/include/linux/decompress/bunzip2.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_BUNZIP2_H 1#ifndef DECOMPRESS_BUNZIP2_H
2#define DECOMPRESS_BUNZIP2_H 2#define DECOMPRESS_BUNZIP2_H
3 3
4int bunzip2(unsigned char *inbuf, int len, 4int bunzip2(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h
index 0c7111a55a1a..1fcfd64b5076 100644
--- a/include/linux/decompress/generic.h
+++ b/include/linux/decompress/generic.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_GENERIC_H 1#ifndef DECOMPRESS_GENERIC_H
2#define DECOMPRESS_GENERIC_H 2#define DECOMPRESS_GENERIC_H
3 3
4typedef int (*decompress_fn) (unsigned char *inbuf, int len, 4typedef int (*decompress_fn) (unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *outbuf, 7 unsigned char *outbuf,
8 int *posp, 8 long *posp,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10 10
11/* inbuf - input buffer 11/* inbuf - input buffer
@@ -33,7 +33,7 @@ typedef int (*decompress_fn) (unsigned char *inbuf, int len,
33 33
34 34
35/* Utility routine to detect the decompression method */ 35/* Utility routine to detect the decompression method */
36decompress_fn decompress_method(const unsigned char *inbuf, int len, 36decompress_fn decompress_method(const unsigned char *inbuf, long len,
37 const char **name); 37 const char **name);
38 38
39#endif 39#endif
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 1d0aedef9822..e4f411fdbd24 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,10 +1,10 @@
1#ifndef LINUX_DECOMPRESS_INFLATE_H 1#ifndef LINUX_DECOMPRESS_INFLATE_H
2#define LINUX_DECOMPRESS_INFLATE_H 2#define LINUX_DECOMPRESS_INFLATE_H
3 3
4int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error_fn)(char *x)); 9 void(*error_fn)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
index d5b68bf3ec92..3273c2f36496 100644
--- a/include/linux/decompress/unlz4.h
+++ b/include/linux/decompress/unlz4.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H 1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H 2#define DECOMPRESS_UNLZ4_H
3 3
4int unlz4(unsigned char *inbuf, int len, 4int unlz4(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h
index 7796538f1bf4..8a891a193840 100644
--- a/include/linux/decompress/unlzma.h
+++ b/include/linux/decompress/unlzma.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_UNLZMA_H 1#ifndef DECOMPRESS_UNLZMA_H
2#define DECOMPRESS_UNLZMA_H 2#define DECOMPRESS_UNLZMA_H
3 3
4int unlzma(unsigned char *, int, 4int unlzma(unsigned char *, long,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *posp, 8 long *posp,
9 void(*error)(char *x) 9 void(*error)(char *x)
10 ); 10 );
11 11
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h
index 987229752519..af18f95d6570 100644
--- a/include/linux/decompress/unlzo.h
+++ b/include/linux/decompress/unlzo.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZO_H 1#ifndef DECOMPRESS_UNLZO_H
2#define DECOMPRESS_UNLZO_H 2#define DECOMPRESS_UNLZO_H
3 3
4int unlzo(unsigned char *inbuf, int len, 4int unlzo(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unxz.h b/include/linux/decompress/unxz.h
index 41728fc6c8a1..f764e2a7201e 100644
--- a/include/linux/decompress/unxz.h
+++ b/include/linux/decompress/unxz.h
@@ -10,10 +10,10 @@
10#ifndef DECOMPRESS_UNXZ_H 10#ifndef DECOMPRESS_UNXZ_H
11#define DECOMPRESS_UNXZ_H 11#define DECOMPRESS_UNXZ_H
12 12
13int unxz(unsigned char *in, int in_size, 13int unxz(unsigned char *in, long in_size,
14 int (*fill)(void *dest, unsigned int size), 14 long (*fill)(void *dest, unsigned long size),
15 int (*flush)(void *src, unsigned int size), 15 long (*flush)(void *src, unsigned long size),
16 unsigned char *out, int *in_used, 16 unsigned char *out, long *in_used,
17 void (*error)(char *x)); 17 void (*error)(char *x));
18 18
19#endif 19#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index af424acd393d..43d183aeb25b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -124,7 +124,7 @@ struct bus_type {
124 124
125 const struct dev_pm_ops *pm; 125 const struct dev_pm_ops *pm;
126 126
127 struct iommu_ops *iommu_ops; 127 const struct iommu_ops *iommu_ops;
128 128
129 struct subsys_private *p; 129 struct subsys_private *p;
130 struct lock_class_key lock_key; 130 struct lock_class_key lock_key;
@@ -605,6 +605,10 @@ extern int devres_release_group(struct device *dev, void *id);
605 605
606/* managed devm_k.alloc/kfree for device drivers */ 606/* managed devm_k.alloc/kfree for device drivers */
607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
608extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
609 va_list ap);
610extern char *devm_kasprintf(struct device *dev, gfp_t gfp,
611 const char *fmt, ...);
608static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
609{ 613{
610 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
@@ -631,8 +635,6 @@ extern unsigned long devm_get_free_pages(struct device *dev,
631extern void devm_free_pages(struct device *dev, unsigned long addr); 635extern void devm_free_pages(struct device *dev, unsigned long addr);
632 636
633void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 637void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
634void __iomem *devm_request_and_ioremap(struct device *dev,
635 struct resource *res);
636 638
637/* allows to add/remove a custom action to devres stack */ 639/* allows to add/remove a custom action to devres stack */
638int devm_add_action(struct device *dev, void (*action)(void *), void *data); 640int devm_add_action(struct device *dev, void (*action)(void *), void *data);
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index f886985a28b2..694e1fe1c4b4 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -30,6 +30,8 @@
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/fence.h>
34#include <linux/wait.h>
33 35
34struct device; 36struct device;
35struct dma_buf; 37struct dma_buf;
@@ -115,6 +117,7 @@ struct dma_buf_ops {
115 * @exp_name: name of the exporter; useful for debugging. 117 * @exp_name: name of the exporter; useful for debugging.
116 * @list_node: node for dma_buf accounting and debugging. 118 * @list_node: node for dma_buf accounting and debugging.
117 * @priv: exporter specific private data for this buffer object. 119 * @priv: exporter specific private data for this buffer object.
120 * @resv: reservation object linked to this dma-buf
118 */ 121 */
119struct dma_buf { 122struct dma_buf {
120 size_t size; 123 size_t size;
@@ -128,6 +131,17 @@ struct dma_buf {
128 const char *exp_name; 131 const char *exp_name;
129 struct list_head list_node; 132 struct list_head list_node;
130 void *priv; 133 void *priv;
134 struct reservation_object *resv;
135
136 /* poll support */
137 wait_queue_head_t poll;
138
139 struct dma_buf_poll_cb_t {
140 struct fence_cb cb;
141 wait_queue_head_t *poll;
142
143 unsigned long active;
144 } cb_excl, cb_shared;
131}; 145};
132 146
133/** 147/**
@@ -168,10 +182,11 @@ void dma_buf_detach(struct dma_buf *dmabuf,
168 struct dma_buf_attachment *dmabuf_attach); 182 struct dma_buf_attachment *dmabuf_attach);
169 183
170struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, 184struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops,
171 size_t size, int flags, const char *); 185 size_t size, int flags, const char *,
186 struct reservation_object *);
172 187
173#define dma_buf_export(priv, ops, size, flags) \ 188#define dma_buf_export(priv, ops, size, flags, resv) \
174 dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME) 189 dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv)
175 190
176int dma_buf_fd(struct dma_buf *dmabuf, int flags); 191int dma_buf_fd(struct dma_buf *dmabuf, int flags);
177struct dma_buf *dma_buf_get(int fd); 192struct dma_buf *dma_buf_get(int fd);
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 772eab5d524a..569bbd039896 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -53,18 +53,13 @@
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#include <linux/device.h>
57
56struct cma; 58struct cma;
57struct page; 59struct page;
58struct device;
59 60
60#ifdef CONFIG_DMA_CMA 61#ifdef CONFIG_DMA_CMA
61 62
62/*
63 * There is always at least global CMA area and a few optional device
64 * private areas configured in kernel .config.
65 */
66#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
67
68extern struct cma *dma_contiguous_default_area; 63extern struct cma *dma_contiguous_default_area;
69 64
70static inline struct cma *dev_get_cma_area(struct device *dev) 65static inline struct cma *dev_get_cma_area(struct device *dev)
@@ -123,8 +118,6 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
123 118
124#else 119#else
125 120
126#define MAX_CMA_AREAS (0)
127
128static inline struct cma *dev_get_cma_area(struct device *dev) 121static inline struct cma *dev_get_cma_area(struct device *dev)
129{ 122{
130 return NULL; 123 return NULL;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d2c5cc7c583c..1f9e642c66ad 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -37,7 +37,6 @@
37 */ 37 */
38typedef s32 dma_cookie_t; 38typedef s32 dma_cookie_t;
39#define DMA_MIN_COOKIE 1 39#define DMA_MIN_COOKIE 1
40#define DMA_MAX_COOKIE INT_MAX
41 40
42static inline int dma_submit_error(dma_cookie_t cookie) 41static inline int dma_submit_error(dma_cookie_t cookie)
43{ 42{
@@ -299,6 +298,7 @@ enum dma_slave_buswidth {
299 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, 298 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
300 DMA_SLAVE_BUSWIDTH_1_BYTE = 1, 299 DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
301 DMA_SLAVE_BUSWIDTH_2_BYTES = 2, 300 DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
301 DMA_SLAVE_BUSWIDTH_3_BYTES = 3,
302 DMA_SLAVE_BUSWIDTH_4_BYTES = 4, 302 DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
303 DMA_SLAVE_BUSWIDTH_8_BYTES = 8, 303 DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
304}; 304};
@@ -670,7 +670,7 @@ struct dma_device {
670 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 670 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
671 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 671 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
672 size_t period_len, enum dma_transfer_direction direction, 672 size_t period_len, enum dma_transfer_direction direction,
673 unsigned long flags, void *context); 673 unsigned long flags);
674 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 674 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
675 struct dma_chan *chan, struct dma_interleaved_template *xt, 675 struct dma_chan *chan, struct dma_interleaved_template *xt,
676 unsigned long flags); 676 unsigned long flags);
@@ -745,7 +745,7 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
745 unsigned long flags) 745 unsigned long flags)
746{ 746{
747 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, 747 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
748 period_len, dir, flags, NULL); 748 period_len, dir, flags);
749} 749}
750 750
751static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma( 751static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 23c8db129560..1deece46a0ca 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -114,22 +114,30 @@ extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
114/* Intel IOMMU detection */ 114/* Intel IOMMU detection */
115extern int detect_intel_iommu(void); 115extern int detect_intel_iommu(void);
116extern int enable_drhd_fault_handling(void); 116extern int enable_drhd_fault_handling(void);
117#else 117
118struct dmar_pci_notify_info; 118#ifdef CONFIG_INTEL_IOMMU
119static inline int detect_intel_iommu(void) 119extern int iommu_detected, no_iommu;
120extern int intel_iommu_init(void);
121extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header);
122extern int dmar_parse_one_atsr(struct acpi_dmar_header *header);
123extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info);
124#else /* !CONFIG_INTEL_IOMMU: */
125static inline int intel_iommu_init(void) { return -ENODEV; }
126static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header)
120{ 127{
121 return -ENODEV; 128 return 0;
122} 129}
123 130static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
124static inline int dmar_table_init(void)
125{ 131{
126 return -ENODEV; 132 return 0;
127} 133}
128static inline int enable_drhd_fault_handling(void) 134static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
129{ 135{
130 return -1; 136 return 0;
131} 137}
132#endif /* !CONFIG_DMAR_TABLE */ 138#endif /* CONFIG_INTEL_IOMMU */
139
140#endif /* CONFIG_DMAR_TABLE */
133 141
134struct irte { 142struct irte {
135 union { 143 union {
@@ -177,26 +185,4 @@ extern int dmar_set_interrupt(struct intel_iommu *iommu);
177extern irqreturn_t dmar_fault(int irq, void *dev_id); 185extern irqreturn_t dmar_fault(int irq, void *dev_id);
178extern int arch_setup_dmar_msi(unsigned int irq); 186extern int arch_setup_dmar_msi(unsigned int irq);
179 187
180#ifdef CONFIG_INTEL_IOMMU
181extern int iommu_detected, no_iommu;
182extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header);
183extern int dmar_parse_one_atsr(struct acpi_dmar_header *header);
184extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info);
185extern int intel_iommu_init(void);
186#else /* !CONFIG_INTEL_IOMMU: */
187static inline int intel_iommu_init(void) { return -ENODEV; }
188static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header)
189{
190 return 0;
191}
192static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
193{
194 return 0;
195}
196static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
197{
198 return 0;
199}
200#endif /* CONFIG_INTEL_IOMMU */
201
202#endif /* __DMAR_H__ */ 188#endif /* __DMAR_H__ */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 3dbe9bd57a09..debb70d40547 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.3" 55#define REL_VERSION "8.4.5"
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
@@ -245,7 +245,7 @@ enum drbd_disk_state {
245 D_DISKLESS, 245 D_DISKLESS,
246 D_ATTACHING, /* In the process of reading the meta-data */ 246 D_ATTACHING, /* In the process of reading the meta-data */
247 D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */ 247 D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */
248 /* when >= D_FAILED it is legal to access mdev->bc */ 248 /* when >= D_FAILED it is legal to access mdev->ldev */
249 D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */ 249 D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */
250 D_INCONSISTENT, 250 D_INCONSISTENT,
251 D_OUTDATED, 251 D_OUTDATED,
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 4193f5f2636c..7b131ed8f9c6 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -171,6 +171,10 @@ GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative) 171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative)
172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF) 172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */ 173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */
174 /* 9: __str_field_def(31, DRBD_GENLA_F_MANDATORY, name, SHARED_SECRET_MAX) */
175 /* 9: __u32_field(32, DRBD_F_REQUIRED | DRBD_F_INVARIANT, peer_node_id) */
176 __flg_field_def(33, 0 /* OPTIONAL */, csums_after_crash_only, DRBD_CSUMS_AFTER_CRASH_ONLY_DEF)
177 __u32_field_def(34, 0 /* OPTIONAL */, sock_check_timeo, DRBD_SOCKET_CHECK_TIMEO_DEF)
174) 178)
175 179
176GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms, 180GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 17e50bb00521..8ac8c5d9a3ad 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -214,6 +214,7 @@
214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0 214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
215#define DRBD_ALWAYS_ASBP_DEF 0 215#define DRBD_ALWAYS_ASBP_DEF 0
216#define DRBD_USE_RLE_DEF 1 216#define DRBD_USE_RLE_DEF 1
217#define DRBD_CSUMS_AFTER_CRASH_ONLY_DEF 0
217 218
218#define DRBD_AL_STRIPES_MIN 1 219#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024 220#define DRBD_AL_STRIPES_MAX 1024
@@ -224,4 +225,9 @@
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216 225#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32 226#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */ 227#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
228
229#define DRBD_SOCKET_CHECK_TIMEO_MIN 0
230#define DRBD_SOCKET_CHECK_TIMEO_MAX DRBD_PING_TIMEO_MAX
231#define DRBD_SOCKET_CHECK_TIMEO_DEF 0
232#define DRBD_SOCKET_CHECK_TIMEO_SCALE '1'
227#endif 233#endif
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 8e6c20af11a2..e1e68da6f35c 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -194,6 +194,9 @@ static inline char *mc_event_error_type(const unsigned int err_type)
194 * @MEM_DDR3: DDR3 RAM 194 * @MEM_DDR3: DDR3 RAM
195 * @MEM_RDDR3: Registered DDR3 RAM 195 * @MEM_RDDR3: Registered DDR3 RAM
196 * This is a variant of the DDR3 memories. 196 * This is a variant of the DDR3 memories.
197 * @MEM_DDR4: DDR4 RAM
198 * @MEM_RDDR4: Registered DDR4 RAM
199 * This is a variant of the DDR4 memories.
197 */ 200 */
198enum mem_type { 201enum mem_type {
199 MEM_EMPTY = 0, 202 MEM_EMPTY = 0,
@@ -213,6 +216,8 @@ enum mem_type {
213 MEM_XDR, 216 MEM_XDR,
214 MEM_DDR3, 217 MEM_DDR3,
215 MEM_RDDR3, 218 MEM_RDDR3,
219 MEM_DDR4,
220 MEM_RDDR4,
216}; 221};
217 222
218#define MEM_FLAG_EMPTY BIT(MEM_EMPTY) 223#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 41bbf8ba4ba8..45cb4ffdea62 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -20,6 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/pfn.h> 21#include <linux/pfn.h>
22#include <linux/pstore.h> 22#include <linux/pstore.h>
23#include <linux/reboot.h>
23 24
24#include <asm/page.h> 25#include <asm/page.h>
25 26
@@ -521,6 +522,8 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
521 int *reset_type); 522 int *reset_type);
522typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size); 523typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size);
523 524
525void efi_native_runtime_setup(void);
526
524/* 527/*
525 * EFI Configuration Table and GUID definitions 528 * EFI Configuration Table and GUID definitions
526 */ 529 */
@@ -870,11 +873,13 @@ extern int __init efi_uart_console_only (void);
870extern void efi_initialize_iomem_resources(struct resource *code_resource, 873extern void efi_initialize_iomem_resources(struct resource *code_resource,
871 struct resource *data_resource, struct resource *bss_resource); 874 struct resource *data_resource, struct resource *bss_resource);
872extern void efi_get_time(struct timespec *now); 875extern void efi_get_time(struct timespec *now);
873extern int efi_set_rtc_mmss(const struct timespec *now);
874extern void efi_reserve_boot_services(void); 876extern void efi_reserve_boot_services(void);
875extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose); 877extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose);
876extern struct efi_memory_map memmap; 878extern struct efi_memory_map memmap;
877 879
880extern int efi_reboot_quirk_mode;
881extern bool efi_poweroff_required(void);
882
878/* Iterate through an efi_memory_map */ 883/* Iterate through an efi_memory_map */
879#define for_each_efi_memory_desc(m, md) \ 884#define for_each_efi_memory_desc(m, md) \
880 for ((md) = (m)->map; \ 885 for ((md) = (m)->map; \
@@ -916,7 +921,8 @@ extern int __init efi_setup_pcdp_console(char *);
916#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ 921#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
917#define EFI_MEMMAP 4 /* Can we use EFI memory map? */ 922#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
918#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 923#define EFI_64BIT 5 /* Is the firmware 64-bit? */
919#define EFI_ARCH_1 6 /* First arch-specific bit */ 924#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
925#define EFI_ARCH_1 7 /* First arch-specific bit */
920 926
921#ifdef CONFIG_EFI 927#ifdef CONFIG_EFI
922/* 928/*
@@ -926,11 +932,14 @@ static inline bool efi_enabled(int feature)
926{ 932{
927 return test_bit(feature, &efi.flags) != 0; 933 return test_bit(feature, &efi.flags) != 0;
928} 934}
935extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
929#else 936#else
930static inline bool efi_enabled(int feature) 937static inline bool efi_enabled(int feature)
931{ 938{
932 return false; 939 return false;
933} 940}
941static inline void
942efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
934#endif 943#endif
935 944
936/* 945/*
@@ -1031,12 +1040,8 @@ struct efivar_operations {
1031struct efivars { 1040struct efivars {
1032 /* 1041 /*
1033 * ->lock protects two things: 1042 * ->lock protects two things:
1034 * 1) ->list - adds, removals, reads, writes 1043 * 1) efivarfs_list and efivars_sysfs_list
1035 * 2) ops.[gs]et_variable() calls. 1044 * 2) ->ops calls
1036 * It must not be held when creating sysfs entries or calling kmalloc.
1037 * ops.get_next_variable() is only called from register_efivars()
1038 * or efivar_update_sysfs_entries(),
1039 * which is protected by the BKL, so that path is safe.
1040 */ 1045 */
1041 spinlock_t lock; 1046 spinlock_t lock;
1042 struct kset *kset; 1047 struct kset *kset;
@@ -1151,6 +1156,9 @@ int efivars_sysfs_init(void);
1151#ifdef CONFIG_EFI_RUNTIME_MAP 1156#ifdef CONFIG_EFI_RUNTIME_MAP
1152int efi_runtime_map_init(struct kobject *); 1157int efi_runtime_map_init(struct kobject *);
1153void efi_runtime_map_setup(void *, int, u32); 1158void efi_runtime_map_setup(void *, int, u32);
1159int efi_get_runtime_map_size(void);
1160int efi_get_runtime_map_desc_size(void);
1161int efi_runtime_map_copy(void *buf, size_t bufsz);
1154#else 1162#else
1155static inline int efi_runtime_map_init(struct kobject *kobj) 1163static inline int efi_runtime_map_init(struct kobject *kobj)
1156{ 1164{
@@ -1159,6 +1167,64 @@ static inline int efi_runtime_map_init(struct kobject *kobj)
1159 1167
1160static inline void 1168static inline void
1161efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} 1169efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {}
1170
1171static inline int efi_get_runtime_map_size(void)
1172{
1173 return 0;
1174}
1175
1176static inline int efi_get_runtime_map_desc_size(void)
1177{
1178 return 0;
1179}
1180
1181static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
1182{
1183 return 0;
1184}
1185
1162#endif 1186#endif
1163 1187
1188/* prototypes shared between arch specific and generic stub code */
1189
1190#define pr_efi(sys_table, msg) efi_printk(sys_table, "EFI stub: "msg)
1191#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
1192
1193void efi_printk(efi_system_table_t *sys_table_arg, char *str);
1194
1195void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
1196 unsigned long addr);
1197
1198char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
1199 efi_loaded_image_t *image, int *cmd_line_len);
1200
1201efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
1202 efi_memory_desc_t **map,
1203 unsigned long *map_size,
1204 unsigned long *desc_size,
1205 u32 *desc_ver,
1206 unsigned long *key_ptr);
1207
1208efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
1209 unsigned long size, unsigned long align,
1210 unsigned long *addr);
1211
1212efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
1213 unsigned long size, unsigned long align,
1214 unsigned long *addr, unsigned long max);
1215
1216efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
1217 unsigned long *image_addr,
1218 unsigned long image_size,
1219 unsigned long alloc_size,
1220 unsigned long preferred_addr,
1221 unsigned long alignment);
1222
1223efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1224 efi_loaded_image_t *image,
1225 char *cmd_line, char *option_string,
1226 unsigned long max_addr,
1227 unsigned long *load_addr,
1228 unsigned long *load_size);
1229
1164#endif /* _LINUX_EFI_H */ 1230#endif /* _LINUX_EFI_H */
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h
new file mode 100644
index 000000000000..030526bf8d79
--- /dev/null
+++ b/include/linux/extcon/sm5502.h
@@ -0,0 +1,287 @@
1/*
2 * sm5502.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_EXTCON_SM5502_H
18#define __LINUX_EXTCON_SM5502_H
19
20enum sm5502_types {
21 TYPE_SM5502,
22};
23
24/* SM5502 registers */
25enum sm5502_reg {
26 SM5502_REG_DEVICE_ID = 0x01,
27 SM5502_REG_CONTROL,
28 SM5502_REG_INT1,
29 SM5502_REG_INT2,
30 SM5502_REG_INTMASK1,
31 SM5502_REG_INTMASK2,
32 SM5502_REG_ADC,
33 SM5502_REG_TIMING_SET1,
34 SM5502_REG_TIMING_SET2,
35 SM5502_REG_DEV_TYPE1,
36 SM5502_REG_DEV_TYPE2,
37 SM5502_REG_BUTTON1,
38 SM5502_REG_BUTTON2,
39 SM5502_REG_CAR_KIT_STATUS,
40 SM5502_REG_RSVD1,
41 SM5502_REG_RSVD2,
42 SM5502_REG_RSVD3,
43 SM5502_REG_RSVD4,
44 SM5502_REG_MANUAL_SW1,
45 SM5502_REG_MANUAL_SW2,
46 SM5502_REG_DEV_TYPE3,
47 SM5502_REG_RSVD5,
48 SM5502_REG_RSVD6,
49 SM5502_REG_RSVD7,
50 SM5502_REG_RSVD8,
51 SM5502_REG_RSVD9,
52 SM5502_REG_RESET,
53 SM5502_REG_RSVD10,
54 SM5502_REG_RESERVED_ID1,
55 SM5502_REG_RSVD11,
56 SM5502_REG_RSVD12,
57 SM5502_REG_RESERVED_ID2,
58 SM5502_REG_RSVD13,
59 SM5502_REG_OCP,
60 SM5502_REG_RSVD14,
61 SM5502_REG_RSVD15,
62 SM5502_REG_RSVD16,
63 SM5502_REG_RSVD17,
64 SM5502_REG_RSVD18,
65 SM5502_REG_RSVD19,
66 SM5502_REG_RSVD20,
67 SM5502_REG_RSVD21,
68 SM5502_REG_RSVD22,
69 SM5502_REG_RSVD23,
70 SM5502_REG_RSVD24,
71 SM5502_REG_RSVD25,
72 SM5502_REG_RSVD26,
73 SM5502_REG_RSVD27,
74 SM5502_REG_RSVD28,
75 SM5502_REG_RSVD29,
76 SM5502_REG_RSVD30,
77 SM5502_REG_RSVD31,
78 SM5502_REG_RSVD32,
79 SM5502_REG_RSVD33,
80 SM5502_REG_RSVD34,
81 SM5502_REG_RSVD35,
82 SM5502_REG_RSVD36,
83 SM5502_REG_RESERVED_ID3,
84
85 SM5502_REG_END,
86};
87
88/* Define SM5502 MASK/SHIFT constant */
89#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT 0
90#define SM5502_REG_DEVICE_ID_VERSION_SHIFT 3
91#define SM5502_REG_DEVICE_ID_VENDOR_MASK (0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
92#define SM5502_REG_DEVICE_ID_VERSION_MASK (0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
93
94#define SM5502_REG_CONTROL_MASK_INT_SHIFT 0
95#define SM5502_REG_CONTROL_WAIT_SHIFT 1
96#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT 2
97#define SM5502_REG_CONTROL_RAW_DATA_SHIFT 3
98#define SM5502_REG_CONTROL_SW_OPEN_SHIFT 4
99#define SM5502_REG_CONTROL_MASK_INT_MASK (0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
100#define SM5502_REG_CONTROL_WAIT_MASK (0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
101#define SM5502_REG_CONTROL_MANUAL_SW_MASK (0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
102#define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
103#define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
104
105#define SM5502_REG_INTM1_ATTACH_SHIFT 0
106#define SM5502_REG_INTM1_DETACH_SHIFT 1
107#define SM5502_REG_INTM1_KP_SHIFT 2
108#define SM5502_REG_INTM1_LKP_SHIFT 3
109#define SM5502_REG_INTM1_LKR_SHIFT 4
110#define SM5502_REG_INTM1_OVP_EVENT_SHIFT 5
111#define SM5502_REG_INTM1_OCP_EVENT_SHIFT 6
112#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT 7
113#define SM5502_REG_INTM1_ATTACH_MASK (0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
114#define SM5502_REG_INTM1_DETACH_MASK (0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
115#define SM5502_REG_INTM1_KP_MASK (0x1 << SM5502_REG_INTM1_KP_SHIFT)
116#define SM5502_REG_INTM1_LKP_MASK (0x1 << SM5502_REG_INTM1_LKP_SHIFT)
117#define SM5502_REG_INTM1_LKR_MASK (0x1 << SM5502_REG_INTM1_LKR_SHIFT)
118#define SM5502_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
119#define SM5502_REG_INTM1_OCP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
120#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK (0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
121
122#define SM5502_REG_INTM2_VBUS_DET_SHIFT 0
123#define SM5502_REG_INTM2_REV_ACCE_SHIFT 1
124#define SM5502_REG_INTM2_ADC_CHG_SHIFT 2
125#define SM5502_REG_INTM2_STUCK_KEY_SHIFT 3
126#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT 4
127#define SM5502_REG_INTM2_MHL_SHIFT 5
128#define SM5502_REG_INTM2_VBUS_DET_MASK (0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
129#define SM5502_REG_INTM2_REV_ACCE_MASK (0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
130#define SM5502_REG_INTM2_ADC_CHG_MASK (0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
131#define SM5502_REG_INTM2_STUCK_KEY_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
132#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
133#define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT)
134
135#define SM5502_REG_ADC_SHIFT 0
136#define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT)
137
138#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT 4
139#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK (0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
140#define TIMING_KEY_PRESS_100MS 0x0
141#define TIMING_KEY_PRESS_200MS 0x1
142#define TIMING_KEY_PRESS_300MS 0x2
143#define TIMING_KEY_PRESS_400MS 0x3
144#define TIMING_KEY_PRESS_500MS 0x4
145#define TIMING_KEY_PRESS_600MS 0x5
146#define TIMING_KEY_PRESS_700MS 0x6
147#define TIMING_KEY_PRESS_800MS 0x7
148#define TIMING_KEY_PRESS_900MS 0x8
149#define TIMING_KEY_PRESS_1000MS 0x9
150#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT 0
151#define SM5502_REG_TIMING_SET1_ADC_DET_MASK (0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
152#define TIMING_ADC_DET_50MS 0x0
153#define TIMING_ADC_DET_100MS 0x1
154#define TIMING_ADC_DET_150MS 0x2
155#define TIMING_ADC_DET_200MS 0x3
156#define TIMING_ADC_DET_300MS 0x4
157#define TIMING_ADC_DET_400MS 0x5
158#define TIMING_ADC_DET_500MS 0x6
159#define TIMING_ADC_DET_600MS 0x7
160#define TIMING_ADC_DET_700MS 0x8
161#define TIMING_ADC_DET_800MS 0x9
162#define TIMING_ADC_DET_900MS 0xA
163#define TIMING_ADC_DET_1000MS 0xB
164
165#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT 4
166#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK (0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
167#define TIMING_SW_WAIT_10MS 0x0
168#define TIMING_SW_WAIT_30MS 0x1
169#define TIMING_SW_WAIT_50MS 0x2
170#define TIMING_SW_WAIT_70MS 0x3
171#define TIMING_SW_WAIT_90MS 0x4
172#define TIMING_SW_WAIT_110MS 0x5
173#define TIMING_SW_WAIT_130MS 0x6
174#define TIMING_SW_WAIT_150MS 0x7
175#define TIMING_SW_WAIT_170MS 0x8
176#define TIMING_SW_WAIT_190MS 0x9
177#define TIMING_SW_WAIT_210MS 0xA
178#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT 0
179#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK (0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
180#define TIMING_LONG_KEY_300MS 0x0
181#define TIMING_LONG_KEY_400MS 0x1
182#define TIMING_LONG_KEY_500MS 0x2
183#define TIMING_LONG_KEY_600MS 0x3
184#define TIMING_LONG_KEY_700MS 0x4
185#define TIMING_LONG_KEY_800MS 0x5
186#define TIMING_LONG_KEY_900MS 0x6
187#define TIMING_LONG_KEY_1000MS 0x7
188#define TIMING_LONG_KEY_1100MS 0x8
189#define TIMING_LONG_KEY_1200MS 0x9
190#define TIMING_LONG_KEY_1300MS 0xA
191#define TIMING_LONG_KEY_1400MS 0xB
192#define TIMING_LONG_KEY_1500MS 0xC
193
194#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT 0
195#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT 1
196#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT 2
197#define SM5502_REG_DEV_TYPE1_UART_SHIFT 3
198#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT 4
199#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT 5
200#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT 6
201#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT 7
202#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
203#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
204#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
205#define SM5502_REG_DEV_TYPE1_UART_MASK (0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
206#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK (0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
207#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
208#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
209#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
210
211#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0
212#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1
213#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2
214#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT 3
215#define SM5502_REG_DEV_TYPE2_PPD_SHIFT 4
216#define SM5502_REG_DEV_TYPE2_TTY_SHIFT 5
217#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT 6
218#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
219#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
220#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
221#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
222#define SM5502_REG_DEV_TYPE2_PPD_MASK (0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
223#define SM5502_REG_DEV_TYPE2_TTY_MASK (0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
224#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK (0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
225
226#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT 0
227#define SM5502_REG_MANUAL_SW1_DP_SHIFT 2
228#define SM5502_REG_MANUAL_SW1_DM_SHIFT 5
229#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK (0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
230#define SM5502_REG_MANUAL_SW1_DP_MASK (0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
231#define SM5502_REG_MANUAL_SW1_DM_MASK (0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
232#define VBUSIN_SWITCH_OPEN 0x0
233#define VBUSIN_SWITCH_VBUSOUT 0x1
234#define VBUSIN_SWITCH_MIC 0x2
235#define VBUSIN_SWITCH_VBUSOUT_WITH_USB 0x3
236#define DM_DP_CON_SWITCH_OPEN 0x0
237#define DM_DP_CON_SWITCH_USB 0x1
238#define DM_DP_CON_SWITCH_AUDIO 0x2
239#define DM_DP_CON_SWITCH_UART 0x3
240#define DM_DP_SWITCH_OPEN ((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
241 | (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
242#define DM_DP_SWITCH_USB ((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
243 | (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
244#define DM_DP_SWITCH_AUDIO ((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
245 | (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
246#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
247 | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
248
249/* SM5502 Interrupts */
250enum sm5502_irq {
251 /* INT1 */
252 SM5502_IRQ_INT1_ATTACH,
253 SM5502_IRQ_INT1_DETACH,
254 SM5502_IRQ_INT1_KP,
255 SM5502_IRQ_INT1_LKP,
256 SM5502_IRQ_INT1_LKR,
257 SM5502_IRQ_INT1_OVP_EVENT,
258 SM5502_IRQ_INT1_OCP_EVENT,
259 SM5502_IRQ_INT1_OVP_OCP_DIS,
260
261 /* INT2 */
262 SM5502_IRQ_INT2_VBUS_DET,
263 SM5502_IRQ_INT2_REV_ACCE,
264 SM5502_IRQ_INT2_ADC_CHG,
265 SM5502_IRQ_INT2_STUCK_KEY,
266 SM5502_IRQ_INT2_STUCK_KEY_RCV,
267 SM5502_IRQ_INT2_MHL,
268
269 SM5502_IRQ_NUM,
270};
271
272#define SM5502_IRQ_INT1_ATTACH_MASK BIT(0)
273#define SM5502_IRQ_INT1_DETACH_MASK BIT(1)
274#define SM5502_IRQ_INT1_KP_MASK BIT(2)
275#define SM5502_IRQ_INT1_LKP_MASK BIT(3)
276#define SM5502_IRQ_INT1_LKR_MASK BIT(4)
277#define SM5502_IRQ_INT1_OVP_EVENT_MASK BIT(5)
278#define SM5502_IRQ_INT1_OCP_EVENT_MASK BIT(6)
279#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK BIT(7)
280#define SM5502_IRQ_INT2_VBUS_DET_MASK BIT(0)
281#define SM5502_IRQ_INT2_REV_ACCE_MASK BIT(1)
282#define SM5502_IRQ_INT2_ADC_CHG_MASK BIT(2)
283#define SM5502_IRQ_INT2_STUCK_KEY_MASK BIT(3)
284#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4)
285#define SM5502_IRQ_INT2_MHL_MASK BIT(5)
286
287#endif /* __LINUX_EXTCON_SM5502_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index b6bfda99add3..09bb7a18d287 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -553,7 +553,7 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
553#define fb_memcpy_fromfb sbus_memcpy_fromio 553#define fb_memcpy_fromfb sbus_memcpy_fromio
554#define fb_memcpy_tofb sbus_memcpy_toio 554#define fb_memcpy_tofb sbus_memcpy_toio
555 555
556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) 556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) || defined(__arm__)
557 557
558#define fb_readb __raw_readb 558#define fb_readb __raw_readb
559#define fb_readw __raw_readw 559#define fb_readw __raw_readw
diff --git a/include/linux/fence.h b/include/linux/fence.h
new file mode 100644
index 000000000000..d174585b874b
--- /dev/null
+++ b/include/linux/fence.h
@@ -0,0 +1,360 @@
1/*
2 * Fence mechanism for dma-buf to allow for asynchronous dma access
3 *
4 * Copyright (C) 2012 Canonical Ltd
5 * Copyright (C) 2012 Texas Instruments
6 *
7 * Authors:
8 * Rob Clark <robdclark@gmail.com>
9 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published by
13 * the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 */
20
21#ifndef __LINUX_FENCE_H
22#define __LINUX_FENCE_H
23
24#include <linux/err.h>
25#include <linux/wait.h>
26#include <linux/list.h>
27#include <linux/bitops.h>
28#include <linux/kref.h>
29#include <linux/sched.h>
30#include <linux/printk.h>
31#include <linux/rcupdate.h>
32
33struct fence;
34struct fence_ops;
35struct fence_cb;
36
37/**
38 * struct fence - software synchronization primitive
39 * @refcount: refcount for this fence
40 * @ops: fence_ops associated with this fence
41 * @rcu: used for releasing fence with kfree_rcu
42 * @cb_list: list of all callbacks to call
43 * @lock: spin_lock_irqsave used for locking
44 * @context: execution context this fence belongs to, returned by
45 * fence_context_alloc()
46 * @seqno: the sequence number of this fence inside the execution context,
47 * can be compared to decide which fence would be signaled later.
48 * @flags: A mask of FENCE_FLAG_* defined below
49 * @timestamp: Timestamp when the fence was signaled.
50 * @status: Optional, only valid if < 0, must be set before calling
51 * fence_signal, indicates that the fence has completed with an error.
52 *
53 * the flags member must be manipulated and read using the appropriate
54 * atomic ops (bit_*), so taking the spinlock will not be needed most
55 * of the time.
56 *
57 * FENCE_FLAG_SIGNALED_BIT - fence is already signaled
58 * FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called*
59 * FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
60 * implementer of the fence for its own purposes. Can be used in different
61 * ways by different fence implementers, so do not rely on this.
62 *
63 * *) Since atomic bitops are used, this is not guaranteed to be the case.
64 * Particularly, if the bit was set, but fence_signal was called right
65 * before this bit was set, it would have been able to set the
66 * FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called.
67 * Adding a check for FENCE_FLAG_SIGNALED_BIT after setting
68 * FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that
69 * after fence_signal was called, any enable_signaling call will have either
70 * been completed, or never called at all.
71 */
72struct fence {
73 struct kref refcount;
74 const struct fence_ops *ops;
75 struct rcu_head rcu;
76 struct list_head cb_list;
77 spinlock_t *lock;
78 unsigned context, seqno;
79 unsigned long flags;
80 ktime_t timestamp;
81 int status;
82};
83
84enum fence_flag_bits {
85 FENCE_FLAG_SIGNALED_BIT,
86 FENCE_FLAG_ENABLE_SIGNAL_BIT,
87 FENCE_FLAG_USER_BITS, /* must always be last member */
88};
89
90typedef void (*fence_func_t)(struct fence *fence, struct fence_cb *cb);
91
92/**
93 * struct fence_cb - callback for fence_add_callback
94 * @node: used by fence_add_callback to append this struct to fence::cb_list
95 * @func: fence_func_t to call
96 *
97 * This struct will be initialized by fence_add_callback, additional
98 * data can be passed along by embedding fence_cb in another struct.
99 */
100struct fence_cb {
101 struct list_head node;
102 fence_func_t func;
103};
104
105/**
106 * struct fence_ops - operations implemented for fence
107 * @get_driver_name: returns the driver name.
108 * @get_timeline_name: return the name of the context this fence belongs to.
109 * @enable_signaling: enable software signaling of fence.
110 * @signaled: [optional] peek whether the fence is signaled, can be null.
111 * @wait: custom wait implementation, or fence_default_wait.
112 * @release: [optional] called on destruction of fence, can be null
113 * @fill_driver_data: [optional] callback to fill in free-form debug info
114 * Returns amount of bytes filled, or -errno.
115 * @fence_value_str: [optional] fills in the value of the fence as a string
116 * @timeline_value_str: [optional] fills in the current value of the timeline
117 * as a string
118 *
119 * Notes on enable_signaling:
120 * For fence implementations that have the capability for hw->hw
121 * signaling, they can implement this op to enable the necessary
122 * irqs, or insert commands into cmdstream, etc. This is called
123 * in the first wait() or add_callback() path to let the fence
124 * implementation know that there is another driver waiting on
125 * the signal (ie. hw->sw case).
126 *
127 * This function can be called called from atomic context, but not
128 * from irq context, so normal spinlocks can be used.
129 *
130 * A return value of false indicates the fence already passed,
131 * or some failure occured that made it impossible to enable
132 * signaling. True indicates succesful enabling.
133 *
134 * fence->status may be set in enable_signaling, but only when false is
135 * returned.
136 *
137 * Calling fence_signal before enable_signaling is called allows
138 * for a tiny race window in which enable_signaling is called during,
139 * before, or after fence_signal. To fight this, it is recommended
140 * that before enable_signaling returns true an extra reference is
141 * taken on the fence, to be released when the fence is signaled.
142 * This will mean fence_signal will still be called twice, but
143 * the second time will be a noop since it was already signaled.
144 *
145 * Notes on signaled:
146 * May set fence->status if returning true.
147 *
148 * Notes on wait:
149 * Must not be NULL, set to fence_default_wait for default implementation.
150 * the fence_default_wait implementation should work for any fence, as long
151 * as enable_signaling works correctly.
152 *
153 * Must return -ERESTARTSYS if the wait is intr = true and the wait was
154 * interrupted, and remaining jiffies if fence has signaled, or 0 if wait
155 * timed out. Can also return other error values on custom implementations,
156 * which should be treated as if the fence is signaled. For example a hardware
157 * lockup could be reported like that.
158 *
159 * Notes on release:
160 * Can be NULL, this function allows additional commands to run on
161 * destruction of the fence. Can be called from irq context.
162 * If pointer is set to NULL, kfree will get called instead.
163 */
164
165struct fence_ops {
166 const char * (*get_driver_name)(struct fence *fence);
167 const char * (*get_timeline_name)(struct fence *fence);
168 bool (*enable_signaling)(struct fence *fence);
169 bool (*signaled)(struct fence *fence);
170 signed long (*wait)(struct fence *fence, bool intr, signed long timeout);
171 void (*release)(struct fence *fence);
172
173 int (*fill_driver_data)(struct fence *fence, void *data, int size);
174 void (*fence_value_str)(struct fence *fence, char *str, int size);
175 void (*timeline_value_str)(struct fence *fence, char *str, int size);
176};
177
178void fence_init(struct fence *fence, const struct fence_ops *ops,
179 spinlock_t *lock, unsigned context, unsigned seqno);
180
181void fence_release(struct kref *kref);
182void fence_free(struct fence *fence);
183
184/**
185 * fence_get - increases refcount of the fence
186 * @fence: [in] fence to increase refcount of
187 *
188 * Returns the same fence, with refcount increased by 1.
189 */
190static inline struct fence *fence_get(struct fence *fence)
191{
192 if (fence)
193 kref_get(&fence->refcount);
194 return fence;
195}
196
197/**
198 * fence_get_rcu - get a fence from a reservation_object_list with rcu read lock
199 * @fence: [in] fence to increase refcount of
200 *
201 * Function returns NULL if no refcount could be obtained, or the fence.
202 */
203static inline struct fence *fence_get_rcu(struct fence *fence)
204{
205 if (kref_get_unless_zero(&fence->refcount))
206 return fence;
207 else
208 return NULL;
209}
210
211/**
212 * fence_put - decreases refcount of the fence
213 * @fence: [in] fence to reduce refcount of
214 */
215static inline void fence_put(struct fence *fence)
216{
217 if (fence)
218 kref_put(&fence->refcount, fence_release);
219}
220
221int fence_signal(struct fence *fence);
222int fence_signal_locked(struct fence *fence);
223signed long fence_default_wait(struct fence *fence, bool intr, signed long timeout);
224int fence_add_callback(struct fence *fence, struct fence_cb *cb,
225 fence_func_t func);
226bool fence_remove_callback(struct fence *fence, struct fence_cb *cb);
227void fence_enable_sw_signaling(struct fence *fence);
228
229/**
230 * fence_is_signaled_locked - Return an indication if the fence is signaled yet.
231 * @fence: [in] the fence to check
232 *
233 * Returns true if the fence was already signaled, false if not. Since this
234 * function doesn't enable signaling, it is not guaranteed to ever return
235 * true if fence_add_callback, fence_wait or fence_enable_sw_signaling
236 * haven't been called before.
237 *
238 * This function requires fence->lock to be held.
239 */
240static inline bool
241fence_is_signaled_locked(struct fence *fence)
242{
243 if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags))
244 return true;
245
246 if (fence->ops->signaled && fence->ops->signaled(fence)) {
247 fence_signal_locked(fence);
248 return true;
249 }
250
251 return false;
252}
253
254/**
255 * fence_is_signaled - Return an indication if the fence is signaled yet.
256 * @fence: [in] the fence to check
257 *
258 * Returns true if the fence was already signaled, false if not. Since this
259 * function doesn't enable signaling, it is not guaranteed to ever return
260 * true if fence_add_callback, fence_wait or fence_enable_sw_signaling
261 * haven't been called before.
262 *
263 * It's recommended for seqno fences to call fence_signal when the
264 * operation is complete, it makes it possible to prevent issues from
265 * wraparound between time of issue and time of use by checking the return
266 * value of this function before calling hardware-specific wait instructions.
267 */
268static inline bool
269fence_is_signaled(struct fence *fence)
270{
271 if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags))
272 return true;
273
274 if (fence->ops->signaled && fence->ops->signaled(fence)) {
275 fence_signal(fence);
276 return true;
277 }
278
279 return false;
280}
281
282/**
283 * fence_later - return the chronologically later fence
284 * @f1: [in] the first fence from the same context
285 * @f2: [in] the second fence from the same context
286 *
287 * Returns NULL if both fences are signaled, otherwise the fence that would be
288 * signaled last. Both fences must be from the same context, since a seqno is
289 * not re-used across contexts.
290 */
291static inline struct fence *fence_later(struct fence *f1, struct fence *f2)
292{
293 if (WARN_ON(f1->context != f2->context))
294 return NULL;
295
296 /*
297 * can't check just FENCE_FLAG_SIGNALED_BIT here, it may never have been
298 * set if enable_signaling wasn't called, and enabling that here is
299 * overkill.
300 */
301 if (f2->seqno - f1->seqno <= INT_MAX)
302 return fence_is_signaled(f2) ? NULL : f2;
303 else
304 return fence_is_signaled(f1) ? NULL : f1;
305}
306
307signed long fence_wait_timeout(struct fence *, bool intr, signed long timeout);
308
309
310/**
311 * fence_wait - sleep until the fence gets signaled
312 * @fence: [in] the fence to wait on
313 * @intr: [in] if true, do an interruptible wait
314 *
315 * This function will return -ERESTARTSYS if interrupted by a signal,
316 * or 0 if the fence was signaled. Other error values may be
317 * returned on custom implementations.
318 *
319 * Performs a synchronous wait on this fence. It is assumed the caller
320 * directly or indirectly holds a reference to the fence, otherwise the
321 * fence might be freed before return, resulting in undefined behavior.
322 */
323static inline signed long fence_wait(struct fence *fence, bool intr)
324{
325 signed long ret;
326
327 /* Since fence_wait_timeout cannot timeout with
328 * MAX_SCHEDULE_TIMEOUT, only valid return values are
329 * -ERESTARTSYS and MAX_SCHEDULE_TIMEOUT.
330 */
331 ret = fence_wait_timeout(fence, intr, MAX_SCHEDULE_TIMEOUT);
332
333 return ret < 0 ? ret : 0;
334}
335
336unsigned fence_context_alloc(unsigned num);
337
338#define FENCE_TRACE(f, fmt, args...) \
339 do { \
340 struct fence *__ff = (f); \
341 if (config_enabled(CONFIG_FENCE_TRACE)) \
342 pr_info("f %u#%u: " fmt, \
343 __ff->context, __ff->seqno, ##args); \
344 } while (0)
345
346#define FENCE_WARN(f, fmt, args...) \
347 do { \
348 struct fence *__ff = (f); \
349 pr_warn("f %u#%u: " fmt, __ff->context, __ff->seqno, \
350 ##args); \
351 } while (0)
352
353#define FENCE_ERR(f, fmt, args...) \
354 do { \
355 struct fence *__ff = (f); \
356 pr_err("f %u#%u: " fmt, __ff->context, __ff->seqno, \
357 ##args); \
358 } while (0)
359
360#endif /* __LINUX_FENCE_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a7e3c48d73a7..a5227ab8ccb1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/atomic.h> 7#include <linux/atomic.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/skbuff.h>
9#include <linux/workqueue.h> 10#include <linux/workqueue.h>
10#include <uapi/linux/filter.h> 11#include <uapi/linux/filter.h>
11 12
@@ -81,7 +82,7 @@ enum {
81/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ 82/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
82 83
83#define BPF_ALU64_REG(OP, DST, SRC) \ 84#define BPF_ALU64_REG(OP, DST, SRC) \
84 ((struct sock_filter_int) { \ 85 ((struct bpf_insn) { \
85 .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ 86 .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \
86 .dst_reg = DST, \ 87 .dst_reg = DST, \
87 .src_reg = SRC, \ 88 .src_reg = SRC, \
@@ -89,7 +90,7 @@ enum {
89 .imm = 0 }) 90 .imm = 0 })
90 91
91#define BPF_ALU32_REG(OP, DST, SRC) \ 92#define BPF_ALU32_REG(OP, DST, SRC) \
92 ((struct sock_filter_int) { \ 93 ((struct bpf_insn) { \
93 .code = BPF_ALU | BPF_OP(OP) | BPF_X, \ 94 .code = BPF_ALU | BPF_OP(OP) | BPF_X, \
94 .dst_reg = DST, \ 95 .dst_reg = DST, \
95 .src_reg = SRC, \ 96 .src_reg = SRC, \
@@ -99,7 +100,7 @@ enum {
99/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */ 100/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */
100 101
101#define BPF_ALU64_IMM(OP, DST, IMM) \ 102#define BPF_ALU64_IMM(OP, DST, IMM) \
102 ((struct sock_filter_int) { \ 103 ((struct bpf_insn) { \
103 .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ 104 .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
104 .dst_reg = DST, \ 105 .dst_reg = DST, \
105 .src_reg = 0, \ 106 .src_reg = 0, \
@@ -107,7 +108,7 @@ enum {
107 .imm = IMM }) 108 .imm = IMM })
108 109
109#define BPF_ALU32_IMM(OP, DST, IMM) \ 110#define BPF_ALU32_IMM(OP, DST, IMM) \
110 ((struct sock_filter_int) { \ 111 ((struct bpf_insn) { \
111 .code = BPF_ALU | BPF_OP(OP) | BPF_K, \ 112 .code = BPF_ALU | BPF_OP(OP) | BPF_K, \
112 .dst_reg = DST, \ 113 .dst_reg = DST, \
113 .src_reg = 0, \ 114 .src_reg = 0, \
@@ -117,7 +118,7 @@ enum {
117/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */ 118/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */
118 119
119#define BPF_ENDIAN(TYPE, DST, LEN) \ 120#define BPF_ENDIAN(TYPE, DST, LEN) \
120 ((struct sock_filter_int) { \ 121 ((struct bpf_insn) { \
121 .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \ 122 .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \
122 .dst_reg = DST, \ 123 .dst_reg = DST, \
123 .src_reg = 0, \ 124 .src_reg = 0, \
@@ -127,7 +128,7 @@ enum {
127/* Short form of mov, dst_reg = src_reg */ 128/* Short form of mov, dst_reg = src_reg */
128 129
129#define BPF_MOV64_REG(DST, SRC) \ 130#define BPF_MOV64_REG(DST, SRC) \
130 ((struct sock_filter_int) { \ 131 ((struct bpf_insn) { \
131 .code = BPF_ALU64 | BPF_MOV | BPF_X, \ 132 .code = BPF_ALU64 | BPF_MOV | BPF_X, \
132 .dst_reg = DST, \ 133 .dst_reg = DST, \
133 .src_reg = SRC, \ 134 .src_reg = SRC, \
@@ -135,7 +136,7 @@ enum {
135 .imm = 0 }) 136 .imm = 0 })
136 137
137#define BPF_MOV32_REG(DST, SRC) \ 138#define BPF_MOV32_REG(DST, SRC) \
138 ((struct sock_filter_int) { \ 139 ((struct bpf_insn) { \
139 .code = BPF_ALU | BPF_MOV | BPF_X, \ 140 .code = BPF_ALU | BPF_MOV | BPF_X, \
140 .dst_reg = DST, \ 141 .dst_reg = DST, \
141 .src_reg = SRC, \ 142 .src_reg = SRC, \
@@ -145,7 +146,7 @@ enum {
145/* Short form of mov, dst_reg = imm32 */ 146/* Short form of mov, dst_reg = imm32 */
146 147
147#define BPF_MOV64_IMM(DST, IMM) \ 148#define BPF_MOV64_IMM(DST, IMM) \
148 ((struct sock_filter_int) { \ 149 ((struct bpf_insn) { \
149 .code = BPF_ALU64 | BPF_MOV | BPF_K, \ 150 .code = BPF_ALU64 | BPF_MOV | BPF_K, \
150 .dst_reg = DST, \ 151 .dst_reg = DST, \
151 .src_reg = 0, \ 152 .src_reg = 0, \
@@ -153,7 +154,7 @@ enum {
153 .imm = IMM }) 154 .imm = IMM })
154 155
155#define BPF_MOV32_IMM(DST, IMM) \ 156#define BPF_MOV32_IMM(DST, IMM) \
156 ((struct sock_filter_int) { \ 157 ((struct bpf_insn) { \
157 .code = BPF_ALU | BPF_MOV | BPF_K, \ 158 .code = BPF_ALU | BPF_MOV | BPF_K, \
158 .dst_reg = DST, \ 159 .dst_reg = DST, \
159 .src_reg = 0, \ 160 .src_reg = 0, \
@@ -163,7 +164,7 @@ enum {
163/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ 164/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
164 165
165#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ 166#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
166 ((struct sock_filter_int) { \ 167 ((struct bpf_insn) { \
167 .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \ 168 .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \
168 .dst_reg = DST, \ 169 .dst_reg = DST, \
169 .src_reg = SRC, \ 170 .src_reg = SRC, \
@@ -171,7 +172,7 @@ enum {
171 .imm = IMM }) 172 .imm = IMM })
172 173
173#define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \ 174#define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \
174 ((struct sock_filter_int) { \ 175 ((struct bpf_insn) { \
175 .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \ 176 .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \
176 .dst_reg = DST, \ 177 .dst_reg = DST, \
177 .src_reg = SRC, \ 178 .src_reg = SRC, \
@@ -181,7 +182,7 @@ enum {
181/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */ 182/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */
182 183
183#define BPF_LD_ABS(SIZE, IMM) \ 184#define BPF_LD_ABS(SIZE, IMM) \
184 ((struct sock_filter_int) { \ 185 ((struct bpf_insn) { \
185 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \ 186 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \
186 .dst_reg = 0, \ 187 .dst_reg = 0, \
187 .src_reg = 0, \ 188 .src_reg = 0, \
@@ -191,7 +192,7 @@ enum {
191/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */ 192/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */
192 193
193#define BPF_LD_IND(SIZE, SRC, IMM) \ 194#define BPF_LD_IND(SIZE, SRC, IMM) \
194 ((struct sock_filter_int) { \ 195 ((struct bpf_insn) { \
195 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \ 196 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \
196 .dst_reg = 0, \ 197 .dst_reg = 0, \
197 .src_reg = SRC, \ 198 .src_reg = SRC, \
@@ -201,7 +202,7 @@ enum {
201/* Memory load, dst_reg = *(uint *) (src_reg + off16) */ 202/* Memory load, dst_reg = *(uint *) (src_reg + off16) */
202 203
203#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ 204#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \
204 ((struct sock_filter_int) { \ 205 ((struct bpf_insn) { \
205 .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ 206 .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \
206 .dst_reg = DST, \ 207 .dst_reg = DST, \
207 .src_reg = SRC, \ 208 .src_reg = SRC, \
@@ -211,7 +212,7 @@ enum {
211/* Memory store, *(uint *) (dst_reg + off16) = src_reg */ 212/* Memory store, *(uint *) (dst_reg + off16) = src_reg */
212 213
213#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \ 214#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \
214 ((struct sock_filter_int) { \ 215 ((struct bpf_insn) { \
215 .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ 216 .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \
216 .dst_reg = DST, \ 217 .dst_reg = DST, \
217 .src_reg = SRC, \ 218 .src_reg = SRC, \
@@ -221,7 +222,7 @@ enum {
221/* Memory store, *(uint *) (dst_reg + off16) = imm32 */ 222/* Memory store, *(uint *) (dst_reg + off16) = imm32 */
222 223
223#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ 224#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \
224 ((struct sock_filter_int) { \ 225 ((struct bpf_insn) { \
225 .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ 226 .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \
226 .dst_reg = DST, \ 227 .dst_reg = DST, \
227 .src_reg = 0, \ 228 .src_reg = 0, \
@@ -231,7 +232,7 @@ enum {
231/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */ 232/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */
232 233
233#define BPF_JMP_REG(OP, DST, SRC, OFF) \ 234#define BPF_JMP_REG(OP, DST, SRC, OFF) \
234 ((struct sock_filter_int) { \ 235 ((struct bpf_insn) { \
235 .code = BPF_JMP | BPF_OP(OP) | BPF_X, \ 236 .code = BPF_JMP | BPF_OP(OP) | BPF_X, \
236 .dst_reg = DST, \ 237 .dst_reg = DST, \
237 .src_reg = SRC, \ 238 .src_reg = SRC, \
@@ -241,7 +242,7 @@ enum {
241/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */ 242/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */
242 243
243#define BPF_JMP_IMM(OP, DST, IMM, OFF) \ 244#define BPF_JMP_IMM(OP, DST, IMM, OFF) \
244 ((struct sock_filter_int) { \ 245 ((struct bpf_insn) { \
245 .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ 246 .code = BPF_JMP | BPF_OP(OP) | BPF_K, \
246 .dst_reg = DST, \ 247 .dst_reg = DST, \
247 .src_reg = 0, \ 248 .src_reg = 0, \
@@ -251,7 +252,7 @@ enum {
251/* Function call */ 252/* Function call */
252 253
253#define BPF_EMIT_CALL(FUNC) \ 254#define BPF_EMIT_CALL(FUNC) \
254 ((struct sock_filter_int) { \ 255 ((struct bpf_insn) { \
255 .code = BPF_JMP | BPF_CALL, \ 256 .code = BPF_JMP | BPF_CALL, \
256 .dst_reg = 0, \ 257 .dst_reg = 0, \
257 .src_reg = 0, \ 258 .src_reg = 0, \
@@ -261,7 +262,7 @@ enum {
261/* Raw code statement block */ 262/* Raw code statement block */
262 263
263#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \ 264#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \
264 ((struct sock_filter_int) { \ 265 ((struct bpf_insn) { \
265 .code = CODE, \ 266 .code = CODE, \
266 .dst_reg = DST, \ 267 .dst_reg = DST, \
267 .src_reg = SRC, \ 268 .src_reg = SRC, \
@@ -271,7 +272,7 @@ enum {
271/* Program exit */ 272/* Program exit */
272 273
273#define BPF_EXIT_INSN() \ 274#define BPF_EXIT_INSN() \
274 ((struct sock_filter_int) { \ 275 ((struct bpf_insn) { \
275 .code = BPF_JMP | BPF_EXIT, \ 276 .code = BPF_JMP | BPF_EXIT, \
276 .dst_reg = 0, \ 277 .dst_reg = 0, \
277 .src_reg = 0, \ 278 .src_reg = 0, \
@@ -295,9 +296,10 @@ enum {
295}) 296})
296 297
297/* Macro to invoke filter function. */ 298/* Macro to invoke filter function. */
298#define SK_RUN_FILTER(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi) 299#define SK_RUN_FILTER(filter, ctx) \
300 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
299 301
300struct sock_filter_int { 302struct bpf_insn {
301 __u8 code; /* opcode */ 303 __u8 code; /* opcode */
302 __u8 dst_reg:4; /* dest register */ 304 __u8 dst_reg:4; /* dest register */
303 __u8 src_reg:4; /* source register */ 305 __u8 src_reg:4; /* source register */
@@ -322,54 +324,58 @@ struct sk_buff;
322struct sock; 324struct sock;
323struct seccomp_data; 325struct seccomp_data;
324 326
325struct sk_filter { 327struct bpf_prog {
326 atomic_t refcnt;
327 u32 jited:1, /* Is our filter JIT'ed? */ 328 u32 jited:1, /* Is our filter JIT'ed? */
328 len:31; /* Number of filter blocks */ 329 len:31; /* Number of filter blocks */
329 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 330 struct sock_fprog_kern *orig_prog; /* Original BPF program */
330 struct rcu_head rcu;
331 unsigned int (*bpf_func)(const struct sk_buff *skb, 331 unsigned int (*bpf_func)(const struct sk_buff *skb,
332 const struct sock_filter_int *filter); 332 const struct bpf_insn *filter);
333 union { 333 union {
334 struct sock_filter insns[0]; 334 struct sock_filter insns[0];
335 struct sock_filter_int insnsi[0]; 335 struct bpf_insn insnsi[0];
336 struct work_struct work; 336 struct work_struct work;
337 }; 337 };
338}; 338};
339 339
340static inline unsigned int sk_filter_size(unsigned int proglen) 340struct sk_filter {
341 atomic_t refcnt;
342 struct rcu_head rcu;
343 struct bpf_prog *prog;
344};
345
346#define BPF_PROG_RUN(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi)
347
348static inline unsigned int bpf_prog_size(unsigned int proglen)
341{ 349{
342 return max(sizeof(struct sk_filter), 350 return max(sizeof(struct bpf_prog),
343 offsetof(struct sk_filter, insns[proglen])); 351 offsetof(struct bpf_prog, insns[proglen]));
344} 352}
345 353
346#define sk_filter_proglen(fprog) \ 354#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
347 (fprog->len * sizeof(fprog->filter[0]))
348 355
349int sk_filter(struct sock *sk, struct sk_buff *skb); 356int sk_filter(struct sock *sk, struct sk_buff *skb);
350 357
351void sk_filter_select_runtime(struct sk_filter *fp); 358void bpf_prog_select_runtime(struct bpf_prog *fp);
352void sk_filter_free(struct sk_filter *fp); 359void bpf_prog_free(struct bpf_prog *fp);
353 360
354int sk_convert_filter(struct sock_filter *prog, int len, 361int bpf_convert_filter(struct sock_filter *prog, int len,
355 struct sock_filter_int *new_prog, int *new_len); 362 struct bpf_insn *new_prog, int *new_len);
356 363
357int sk_unattached_filter_create(struct sk_filter **pfp, 364int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
358 struct sock_fprog_kern *fprog); 365void bpf_prog_destroy(struct bpf_prog *fp);
359void sk_unattached_filter_destroy(struct sk_filter *fp);
360 366
361int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 367int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
362int sk_detach_filter(struct sock *sk); 368int sk_detach_filter(struct sock *sk);
363 369
364int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 370int bpf_check_classic(const struct sock_filter *filter, unsigned int flen);
365int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 371int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
366 unsigned int len); 372 unsigned int len);
367 373
368void sk_filter_charge(struct sock *sk, struct sk_filter *fp); 374bool sk_filter_charge(struct sock *sk, struct sk_filter *fp);
369void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); 375void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
370 376
371u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 377u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
372void bpf_int_jit_compile(struct sk_filter *fp); 378void bpf_int_jit_compile(struct bpf_prog *fp);
373 379
374#define BPF_ANC BIT(15) 380#define BPF_ANC BIT(15)
375 381
@@ -406,13 +412,25 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
406 } 412 }
407} 413}
408 414
415void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb,
416 int k, unsigned int size);
417
418static inline void *bpf_load_pointer(const struct sk_buff *skb, int k,
419 unsigned int size, void *buffer)
420{
421 if (k >= 0)
422 return skb_header_pointer(skb, k, size, buffer);
423
424 return bpf_internal_load_pointer_neg_helper(skb, k, size);
425}
426
409#ifdef CONFIG_BPF_JIT 427#ifdef CONFIG_BPF_JIT
410#include <stdarg.h> 428#include <stdarg.h>
411#include <linux/linkage.h> 429#include <linux/linkage.h>
412#include <linux/printk.h> 430#include <linux/printk.h>
413 431
414void bpf_jit_compile(struct sk_filter *fp); 432void bpf_jit_compile(struct bpf_prog *fp);
415void bpf_jit_free(struct sk_filter *fp); 433void bpf_jit_free(struct bpf_prog *fp);
416 434
417static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 435static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
418 u32 pass, void *image) 436 u32 pass, void *image)
@@ -426,11 +444,11 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
426#else 444#else
427#include <linux/slab.h> 445#include <linux/slab.h>
428 446
429static inline void bpf_jit_compile(struct sk_filter *fp) 447static inline void bpf_jit_compile(struct bpf_prog *fp)
430{ 448{
431} 449}
432 450
433static inline void bpf_jit_free(struct sk_filter *fp) 451static inline void bpf_jit_free(struct bpf_prog *fp)
434{ 452{
435 kfree(fp); 453 kfree(fp);
436} 454}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 59529330efd6..5c41c5e75b5c 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -45,6 +45,8 @@ int request_firmware_nowait(
45 struct module *module, bool uevent, 45 struct module *module, bool uevent,
46 const char *name, struct device *device, gfp_t gfp, void *context, 46 const char *name, struct device *device, gfp_t gfp, void *context,
47 void (*cont)(const struct firmware *fw, void *context)); 47 void (*cont)(const struct firmware *fw, void *context));
48int request_firmware_direct(const struct firmware **fw, const char *name,
49 struct device *device);
48 50
49void release_firmware(const struct firmware *fw); 51void release_firmware(const struct firmware *fw);
50#else 52#else
@@ -66,13 +68,12 @@ static inline void release_firmware(const struct firmware *fw)
66{ 68{
67} 69}
68 70
69#endif 71static inline int request_firmware_direct(const struct firmware **fw,
72 const char *name,
73 struct device *device)
74{
75 return -EINVAL;
76}
70 77
71#ifdef CONFIG_FW_LOADER_USER_HELPER
72int request_firmware_direct(const struct firmware **fw, const char *name,
73 struct device *device);
74#else
75#define request_firmware_direct request_firmware
76#endif 78#endif
77
78#endif 79#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e11d60cc867b..94187721ad41 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -387,7 +387,7 @@ struct address_space {
387 struct inode *host; /* owner: inode, block_device */ 387 struct inode *host; /* owner: inode, block_device */
388 struct radix_tree_root page_tree; /* radix tree of all pages */ 388 struct radix_tree_root page_tree; /* radix tree of all pages */
389 spinlock_t tree_lock; /* and lock protecting it */ 389 spinlock_t tree_lock; /* and lock protecting it */
390 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 390 atomic_t i_mmap_writable;/* count VM_SHARED mappings */
391 struct rb_root i_mmap; /* tree of private and shared mappings */ 391 struct rb_root i_mmap; /* tree of private and shared mappings */
392 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 392 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
393 struct mutex i_mmap_mutex; /* protect tree, count, list */ 393 struct mutex i_mmap_mutex; /* protect tree, count, list */
@@ -470,10 +470,35 @@ static inline int mapping_mapped(struct address_space *mapping)
470 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff 470 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
471 * marks vma as VM_SHARED if it is shared, and the file was opened for 471 * marks vma as VM_SHARED if it is shared, and the file was opened for
472 * writing i.e. vma may be mprotected writable even if now readonly. 472 * writing i.e. vma may be mprotected writable even if now readonly.
473 *
474 * If i_mmap_writable is negative, no new writable mappings are allowed. You
475 * can only deny writable mappings, if none exists right now.
473 */ 476 */
474static inline int mapping_writably_mapped(struct address_space *mapping) 477static inline int mapping_writably_mapped(struct address_space *mapping)
475{ 478{
476 return mapping->i_mmap_writable != 0; 479 return atomic_read(&mapping->i_mmap_writable) > 0;
480}
481
482static inline int mapping_map_writable(struct address_space *mapping)
483{
484 return atomic_inc_unless_negative(&mapping->i_mmap_writable) ?
485 0 : -EPERM;
486}
487
488static inline void mapping_unmap_writable(struct address_space *mapping)
489{
490 atomic_dec(&mapping->i_mmap_writable);
491}
492
493static inline int mapping_deny_writable(struct address_space *mapping)
494{
495 return atomic_dec_unless_positive(&mapping->i_mmap_writable) ?
496 0 : -EBUSY;
497}
498
499static inline void mapping_allow_writable(struct address_space *mapping)
500{
501 atomic_inc(&mapping->i_mmap_writable);
477} 502}
478 503
479/* 504/*
@@ -833,7 +858,7 @@ static inline struct file *get_file(struct file *f)
833 * 858 *
834 * Lockd stuffs a "host" pointer into this. 859 * Lockd stuffs a "host" pointer into this.
835 */ 860 */
836typedef struct files_struct *fl_owner_t; 861typedef void *fl_owner_t;
837 862
838struct file_lock_operations { 863struct file_lock_operations {
839 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 864 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
@@ -1250,6 +1275,7 @@ struct super_block {
1250 1275
1251 /* AIO completions deferred from interrupt context */ 1276 /* AIO completions deferred from interrupt context */
1252 struct workqueue_struct *s_dio_done_wq; 1277 struct workqueue_struct *s_dio_done_wq;
1278 struct hlist_head s_pins;
1253 1279
1254 /* 1280 /*
1255 * Keep the lru lists last in the structure so they always sit on their 1281 * Keep the lru lists last in the structure so they always sit on their
@@ -2335,6 +2361,7 @@ extern int do_pipe_flags(int *, int);
2335 2361
2336extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2362extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2337extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); 2363extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
2364extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
2338extern struct file * open_exec(const char *); 2365extern struct file * open_exec(const char *);
2339 2366
2340/* fs/dcache.c -- generic fs support functions */ 2367/* fs/dcache.c -- generic fs support functions */
@@ -2688,7 +2715,7 @@ static const struct file_operations __fops = { \
2688 .read = simple_attr_read, \ 2715 .read = simple_attr_read, \
2689 .write = simple_attr_write, \ 2716 .write = simple_attr_write, \
2690 .llseek = generic_file_llseek, \ 2717 .llseek = generic_file_llseek, \
2691}; 2718}
2692 2719
2693static inline __printf(1, 2) 2720static inline __printf(1, 2)
2694void __simple_attr_check_format(const char *fmt, ...) 2721void __simple_attr_check_format(const char *fmt, ...)
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
new file mode 100644
index 000000000000..f66525e72ccf
--- /dev/null
+++ b/include/linux/fs_pin.h
@@ -0,0 +1,17 @@
1#include <linux/fs.h>
2
3struct fs_pin {
4 atomic_long_t count;
5 union {
6 struct {
7 struct hlist_node s_list;
8 struct hlist_node m_list;
9 };
10 struct rcu_head rcu;
11 };
12 void (*kill)(struct fs_pin *);
13};
14
15void pin_put(struct fs_pin *);
16void pin_remove(struct fs_pin *);
17void pin_insert(struct fs_pin *, struct vfsmount *);
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index fc7718c6bd3e..ca060d7c4fa6 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -322,16 +322,18 @@ extern int fsnotify_fasync(int fd, struct file *file, int on);
322extern void fsnotify_destroy_event(struct fsnotify_group *group, 322extern void fsnotify_destroy_event(struct fsnotify_group *group,
323 struct fsnotify_event *event); 323 struct fsnotify_event *event);
324/* attach the event to the group notification queue */ 324/* attach the event to the group notification queue */
325extern int fsnotify_add_notify_event(struct fsnotify_group *group, 325extern int fsnotify_add_event(struct fsnotify_group *group,
326 struct fsnotify_event *event, 326 struct fsnotify_event *event,
327 int (*merge)(struct list_head *, 327 int (*merge)(struct list_head *,
328 struct fsnotify_event *)); 328 struct fsnotify_event *));
329/* Remove passed event from groups notification queue */
330extern void fsnotify_remove_event(struct fsnotify_group *group, struct fsnotify_event *event);
329/* true if the group notification queue is empty */ 331/* true if the group notification queue is empty */
330extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 332extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
331/* return, but do not dequeue the first event on the notification queue */ 333/* return, but do not dequeue the first event on the notification queue */
332extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group); 334extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
333/* return AND dequeue the first event on the notification queue */ 335/* return AND dequeue the first event on the notification queue */
334extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group); 336extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
335 337
336/* functions used to manipulate the marks attached to inodes */ 338/* functions used to manipulate the marks attached to inodes */
337 339
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 404a686a3644..6bb5e3f2a3b4 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -33,8 +33,7 @@
33 * features, then it must call an indirect function that 33 * features, then it must call an indirect function that
34 * does. Or at least does enough to prevent any unwelcomed side effects. 34 * does. Or at least does enough to prevent any unwelcomed side effects.
35 */ 35 */
36#if !defined(CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST) || \ 36#if !ARCH_SUPPORTS_FTRACE_OPS
37 !ARCH_SUPPORTS_FTRACE_OPS
38# define FTRACE_FORCE_LIST_FUNC 1 37# define FTRACE_FORCE_LIST_FUNC 1
39#else 38#else
40# define FTRACE_FORCE_LIST_FUNC 0 39# define FTRACE_FORCE_LIST_FUNC 0
@@ -118,17 +117,18 @@ struct ftrace_ops {
118 ftrace_func_t func; 117 ftrace_func_t func;
119 struct ftrace_ops *next; 118 struct ftrace_ops *next;
120 unsigned long flags; 119 unsigned long flags;
121 int __percpu *disabled;
122 void *private; 120 void *private;
121 int __percpu *disabled;
123#ifdef CONFIG_DYNAMIC_FTRACE 122#ifdef CONFIG_DYNAMIC_FTRACE
123 int nr_trampolines;
124 struct ftrace_hash *notrace_hash; 124 struct ftrace_hash *notrace_hash;
125 struct ftrace_hash *filter_hash; 125 struct ftrace_hash *filter_hash;
126 struct ftrace_hash *tramp_hash;
126 struct mutex regex_lock; 127 struct mutex regex_lock;
128 unsigned long trampoline;
127#endif 129#endif
128}; 130};
129 131
130extern int function_trace_stop;
131
132/* 132/*
133 * Type of the current tracing. 133 * Type of the current tracing.
134 */ 134 */
@@ -140,32 +140,6 @@ enum ftrace_tracing_type_t {
140/* Current tracing type, default is FTRACE_TYPE_ENTER */ 140/* Current tracing type, default is FTRACE_TYPE_ENTER */
141extern enum ftrace_tracing_type_t ftrace_tracing_type; 141extern enum ftrace_tracing_type_t ftrace_tracing_type;
142 142
143/**
144 * ftrace_stop - stop function tracer.
145 *
146 * A quick way to stop the function tracer. Note this an on off switch,
147 * it is not something that is recursive like preempt_disable.
148 * This does not disable the calling of mcount, it only stops the
149 * calling of functions from mcount.
150 */
151static inline void ftrace_stop(void)
152{
153 function_trace_stop = 1;
154}
155
156/**
157 * ftrace_start - start the function tracer.
158 *
159 * This function is the inverse of ftrace_stop. This does not enable
160 * the function tracing if the function tracer is disabled. This only
161 * sets the function tracer flag to continue calling the functions
162 * from mcount.
163 */
164static inline void ftrace_start(void)
165{
166 function_trace_stop = 0;
167}
168
169/* 143/*
170 * The ftrace_ops must be a static and should also 144 * The ftrace_ops must be a static and should also
171 * be read_mostly. These functions do modify read_mostly variables 145 * be read_mostly. These functions do modify read_mostly variables
@@ -242,8 +216,6 @@ static inline int ftrace_nr_registered_ops(void)
242} 216}
243static inline void clear_ftrace_function(void) { } 217static inline void clear_ftrace_function(void) { }
244static inline void ftrace_kill(void) { } 218static inline void ftrace_kill(void) { }
245static inline void ftrace_stop(void) { }
246static inline void ftrace_start(void) { }
247#endif /* CONFIG_FUNCTION_TRACER */ 219#endif /* CONFIG_FUNCTION_TRACER */
248 220
249#ifdef CONFIG_STACK_TRACER 221#ifdef CONFIG_STACK_TRACER
@@ -317,13 +289,20 @@ extern int ftrace_nr_registered_ops(void);
317 * from tracing that function. 289 * from tracing that function.
318 */ 290 */
319enum { 291enum {
320 FTRACE_FL_ENABLED = (1UL << 29), 292 FTRACE_FL_ENABLED = (1UL << 31),
321 FTRACE_FL_REGS = (1UL << 30), 293 FTRACE_FL_REGS = (1UL << 30),
322 FTRACE_FL_REGS_EN = (1UL << 31) 294 FTRACE_FL_REGS_EN = (1UL << 29),
295 FTRACE_FL_TRAMP = (1UL << 28),
296 FTRACE_FL_TRAMP_EN = (1UL << 27),
323}; 297};
324 298
325#define FTRACE_FL_MASK (0x7UL << 29) 299#define FTRACE_REF_MAX_SHIFT 27
326#define FTRACE_REF_MAX ((1UL << 29) - 1) 300#define FTRACE_FL_BITS 5
301#define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1)
302#define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT)
303#define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1)
304
305#define ftrace_rec_count(rec) ((rec)->flags & ~FTRACE_FL_MASK)
327 306
328struct dyn_ftrace { 307struct dyn_ftrace {
329 unsigned long ip; /* address of mcount call-site */ 308 unsigned long ip; /* address of mcount call-site */
@@ -431,6 +410,10 @@ void ftrace_modify_all_code(int command);
431#define FTRACE_ADDR ((unsigned long)ftrace_caller) 410#define FTRACE_ADDR ((unsigned long)ftrace_caller)
432#endif 411#endif
433 412
413#ifndef FTRACE_GRAPH_ADDR
414#define FTRACE_GRAPH_ADDR ((unsigned long)ftrace_graph_caller)
415#endif
416
434#ifndef FTRACE_REGS_ADDR 417#ifndef FTRACE_REGS_ADDR
435#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS 418#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
436# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) 419# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
@@ -439,6 +422,16 @@ void ftrace_modify_all_code(int command);
439#endif 422#endif
440#endif 423#endif
441 424
425/*
426 * If an arch would like functions that are only traced
427 * by the function graph tracer to jump directly to its own
428 * trampoline, then they can define FTRACE_GRAPH_TRAMP_ADDR
429 * to be that address to jump to.
430 */
431#ifndef FTRACE_GRAPH_TRAMP_ADDR
432#define FTRACE_GRAPH_TRAMP_ADDR ((unsigned long) 0)
433#endif
434
442#ifdef CONFIG_FUNCTION_GRAPH_TRACER 435#ifdef CONFIG_FUNCTION_GRAPH_TRACER
443extern void ftrace_graph_caller(void); 436extern void ftrace_graph_caller(void);
444extern int ftrace_enable_ftrace_graph_caller(void); 437extern int ftrace_enable_ftrace_graph_caller(void);
@@ -736,6 +729,7 @@ extern char __irqentry_text_end[];
736extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 729extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
737 trace_func_graph_ent_t entryfunc); 730 trace_func_graph_ent_t entryfunc);
738 731
732extern bool ftrace_graph_is_dead(void);
739extern void ftrace_graph_stop(void); 733extern void ftrace_graph_stop(void);
740 734
741/* The current handlers in use */ 735/* The current handlers in use */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index cff3106ffe2c..28672e87e910 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -272,7 +272,6 @@ struct ftrace_event_call {
272 struct trace_event event; 272 struct trace_event event;
273 const char *print_fmt; 273 const char *print_fmt;
274 struct event_filter *filter; 274 struct event_filter *filter;
275 struct list_head *files;
276 void *mod; 275 void *mod;
277 void *data; 276 void *data;
278 /* 277 /*
@@ -404,8 +403,6 @@ enum event_trigger_type {
404 ETT_EVENT_ENABLE = (1 << 3), 403 ETT_EVENT_ENABLE = (1 << 3),
405}; 404};
406 405
407extern void destroy_preds(struct ftrace_event_file *file);
408extern void destroy_call_preds(struct ftrace_event_call *call);
409extern int filter_match_preds(struct event_filter *filter, void *rec); 406extern int filter_match_preds(struct event_filter *filter, void *rec);
410 407
411extern int filter_check_discard(struct ftrace_event_file *file, void *rec, 408extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
@@ -574,40 +571,6 @@ do { \
574 __trace_printk(ip, fmt, ##args); \ 571 __trace_printk(ip, fmt, ##args); \
575} while (0) 572} while (0)
576 573
577/**
578 * tracepoint_string - register constant persistent string to trace system
579 * @str - a constant persistent string that will be referenced in tracepoints
580 *
581 * If constant strings are being used in tracepoints, it is faster and
582 * more efficient to just save the pointer to the string and reference
583 * that with a printf "%s" instead of saving the string in the ring buffer
584 * and wasting space and time.
585 *
586 * The problem with the above approach is that userspace tools that read
587 * the binary output of the trace buffers do not have access to the string.
588 * Instead they just show the address of the string which is not very
589 * useful to users.
590 *
591 * With tracepoint_string(), the string will be registered to the tracing
592 * system and exported to userspace via the debugfs/tracing/printk_formats
593 * file that maps the string address to the string text. This way userspace
594 * tools that read the binary buffers have a way to map the pointers to
595 * the ASCII strings they represent.
596 *
597 * The @str used must be a constant string and persistent as it would not
598 * make sense to show a string that no longer exists. But it is still fine
599 * to be used with modules, because when modules are unloaded, if they
600 * had tracepoints, the ring buffers are cleared too. As long as the string
601 * does not change during the life of the module, it is fine to use
602 * tracepoint_string() within a module.
603 */
604#define tracepoint_string(str) \
605 ({ \
606 static const char *___tp_str __tracepoint_string = str; \
607 ___tp_str; \
608 })
609#define __tracepoint_string __attribute__((section("__tracepoint_str")))
610
611#ifdef CONFIG_PERF_EVENTS 574#ifdef CONFIG_PERF_EVENTS
612struct perf_event; 575struct perf_event;
613 576
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 6eb1fb37de9a..5e7219dc0fae 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -360,7 +360,7 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask);
360void *alloc_pages_exact(size_t size, gfp_t gfp_mask); 360void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
361void free_pages_exact(void *virt, size_t size); 361void free_pages_exact(void *virt, size_t size);
362/* This is different from alloc_pages_exact_node !!! */ 362/* This is different from alloc_pages_exact_node !!! */
363void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); 363void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
364 364
365#define __get_free_page(gfp_mask) \ 365#define __get_free_page(gfp_mask) \
366 __get_free_pages((gfp_mask), 0) 366 __get_free_pages((gfp_mask), 0)
diff --git a/include/linux/glob.h b/include/linux/glob.h
new file mode 100644
index 000000000000..861d8347d08e
--- /dev/null
+++ b/include/linux/glob.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_GLOB_H
2#define _LINUX_GLOB_H
3
4#include <linux/types.h> /* For bool */
5#include <linux/compiler.h> /* For __pure */
6
7bool __pure glob_match(char const *pat, char const *str);
8
9#endif /* _LINUX_GLOB_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 05e53ccb708b..b7ce0c64c6f3 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -18,30 +18,79 @@ struct gpio_desc;
18 18
19#ifdef CONFIG_GPIOLIB 19#ifdef CONFIG_GPIOLIB
20 20
21#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
22#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
23#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
24
25/**
26 * Optional flags that can be passed to one of gpiod_* to configure direction
27 * and output value. These values cannot be OR'd.
28 */
29enum gpiod_flags {
30 GPIOD_ASIS = 0,
31 GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET,
32 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
33 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
34 GPIOD_FLAGS_BIT_DIR_VAL,
35};
36
21/* Acquire and dispose GPIOs */ 37/* Acquire and dispose GPIOs */
22struct gpio_desc *__must_check gpiod_get(struct device *dev, 38struct gpio_desc *__must_check __gpiod_get(struct device *dev,
23 const char *con_id); 39 const char *con_id,
24struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 40 enum gpiod_flags flags);
41#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags)
42#define gpiod_get(varargs...) __gpiod_get(varargs, 0)
43struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
25 const char *con_id, 44 const char *con_id,
26 unsigned int idx); 45 unsigned int idx,
27struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, 46 enum gpiod_flags flags);
28 const char *con_id); 47#define __gpiod_get_index(dev, con_id, index, flags, ...) \
29struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, 48 __gpiod_get_index(dev, con_id, index, flags)
49#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0)
50struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev,
51 const char *con_id,
52 enum gpiod_flags flags);
53#define __gpiod_get_optional(dev, con_id, flags, ...) \
54 __gpiod_get_optional(dev, con_id, flags)
55#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0)
56struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
30 const char *con_id, 57 const char *con_id,
31 unsigned int index); 58 unsigned int index,
59 enum gpiod_flags flags);
60#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \
61 __gpiod_get_index_optional(dev, con_id, index, flags)
62#define gpiod_get_index_optional(varargs...) \
63 __gpiod_get_index_optional(varargs, 0)
32 64
33void gpiod_put(struct gpio_desc *desc); 65void gpiod_put(struct gpio_desc *desc);
34 66
35struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 67struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
36 const char *con_id); 68 const char *con_id,
37struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 69 enum gpiod_flags flags);
70#define __devm_gpiod_get(dev, con_id, flags, ...) \
71 __devm_gpiod_get(dev, con_id, flags)
72#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0)
73struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
38 const char *con_id, 74 const char *con_id,
39 unsigned int idx); 75 unsigned int idx,
40struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, 76 enum gpiod_flags flags);
41 const char *con_id); 77#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \
78 __devm_gpiod_get_index(dev, con_id, index, flags)
79#define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0)
80struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
81 const char *con_id,
82 enum gpiod_flags flags);
83#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \
84 __devm_gpiod_get_optional(dev, con_id, flags)
85#define devm_gpiod_get_optional(varargs...) \
86 __devm_gpiod_get_optional(varargs, 0)
42struct gpio_desc *__must_check 87struct gpio_desc *__must_check
43devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 88__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
44 unsigned int index); 89 unsigned int index, enum gpiod_flags flags);
90#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \
91 __devm_gpiod_get_index_optional(dev, con_id, index, flags)
92#define devm_gpiod_get_index_optional(varargs...) \
93 __devm_gpiod_get_index_optional(varargs, 0)
45 94
46void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 95void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
47 96
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 573e4f3243d0..e78a2373e374 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -141,73 +141,16 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
141 141
142/* add/remove chips */ 142/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 143extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 144extern int gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 145extern struct gpio_chip *gpiochip_find(void *data,
146 int (*match)(struct gpio_chip *chip, void *data)); 146 int (*match)(struct gpio_chip *chip, void *data));
147 147
148/* lock/unlock as IRQ */ 148/* lock/unlock as IRQ */
149int gpiod_lock_as_irq(struct gpio_desc *desc); 149int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
150void gpiod_unlock_as_irq(struct gpio_desc *desc); 150void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
151 151
152struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); 152struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
153 153
154struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
155 u16 hwnum);
156
157enum gpio_lookup_flags {
158 GPIO_ACTIVE_HIGH = (0 << 0),
159 GPIO_ACTIVE_LOW = (1 << 0),
160 GPIO_OPEN_DRAIN = (1 << 1),
161 GPIO_OPEN_SOURCE = (1 << 2),
162};
163
164/**
165 * struct gpiod_lookup - lookup table
166 * @chip_label: name of the chip the GPIO belongs to
167 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
168 * @con_id: name of the GPIO from the device's point of view
169 * @idx: index of the GPIO in case several GPIOs share the same name
170 * @flags: mask of GPIO_* values
171 *
172 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
173 * functions using platform data.
174 */
175struct gpiod_lookup {
176 const char *chip_label;
177 u16 chip_hwnum;
178 const char *con_id;
179 unsigned int idx;
180 enum gpio_lookup_flags flags;
181};
182
183struct gpiod_lookup_table {
184 struct list_head list;
185 const char *dev_id;
186 struct gpiod_lookup table[];
187};
188
189/*
190 * Simple definition of a single GPIO under a con_id
191 */
192#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
193 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
194
195/*
196 * Use this macro if you need to have several GPIOs under the same con_id.
197 * Each GPIO needs to use a different index and can be accessed using
198 * gpiod_get_index()
199 */
200#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
201{ \
202 .chip_label = _chip_label, \
203 .chip_hwnum = _chip_hwnum, \
204 .con_id = _con_id, \
205 .idx = _idx, \
206 .flags = _flags, \
207}
208
209void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
210
211#ifdef CONFIG_GPIOLIB_IRQCHIP 154#ifdef CONFIG_GPIOLIB_IRQCHIP
212 155
213void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, 156void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
@@ -223,6 +166,9 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
223 166
224#endif /* CONFIG_GPIO_IRQCHIP */ 167#endif /* CONFIG_GPIO_IRQCHIP */
225 168
169int gpiochip_request_own_desc(struct gpio_desc *desc, const char *label);
170void gpiochip_free_own_desc(struct gpio_desc *desc);
171
226#else /* CONFIG_GPIOLIB */ 172#else /* CONFIG_GPIOLIB */
227 173
228static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) 174static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h
new file mode 100644
index 000000000000..e2706140eaff
--- /dev/null
+++ b/include/linux/gpio/machine.h
@@ -0,0 +1,61 @@
1#ifndef __LINUX_GPIO_MACHINE_H
2#define __LINUX_GPIO_MACHINE_H
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7enum gpio_lookup_flags {
8 GPIO_ACTIVE_HIGH = (0 << 0),
9 GPIO_ACTIVE_LOW = (1 << 0),
10 GPIO_OPEN_DRAIN = (1 << 1),
11 GPIO_OPEN_SOURCE = (1 << 2),
12};
13
14/**
15 * struct gpiod_lookup - lookup table
16 * @chip_label: name of the chip the GPIO belongs to
17 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
18 * @con_id: name of the GPIO from the device's point of view
19 * @idx: index of the GPIO in case several GPIOs share the same name
20 * @flags: mask of GPIO_* values
21 *
22 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
23 * functions using platform data.
24 */
25struct gpiod_lookup {
26 const char *chip_label;
27 u16 chip_hwnum;
28 const char *con_id;
29 unsigned int idx;
30 enum gpio_lookup_flags flags;
31};
32
33struct gpiod_lookup_table {
34 struct list_head list;
35 const char *dev_id;
36 struct gpiod_lookup table[];
37};
38
39/*
40 * Simple definition of a single GPIO under a con_id
41 */
42#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
43 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
44
45/*
46 * Use this macro if you need to have several GPIOs under the same con_id.
47 * Each GPIO needs to use a different index and can be accessed using
48 * gpiod_get_index()
49 */
50#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
51{ \
52 .chip_label = _chip_label, \
53 .chip_hwnum = _chip_hwnum, \
54 .con_id = _con_id, \
55 .idx = _idx, \
56 .flags = _flags, \
57}
58
59void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
60
61#endif /* __LINUX_GPIO_MACHINE_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 77632cf159c0..f53c4a9cca1d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -167,6 +167,7 @@ struct hid_item {
167#define HID_UP_MSVENDOR 0xff000000 167#define HID_UP_MSVENDOR 0xff000000
168#define HID_UP_CUSTOM 0x00ff0000 168#define HID_UP_CUSTOM 0x00ff0000
169#define HID_UP_LOGIVENDOR 0xffbc0000 169#define HID_UP_LOGIVENDOR 0xffbc0000
170#define HID_UP_LNVENDOR 0xffa00000
170#define HID_UP_SENSOR 0x00200000 171#define HID_UP_SENSOR 0x00200000
171 172
172#define HID_USAGE 0x0000ffff 173#define HID_USAGE 0x0000ffff
@@ -311,6 +312,11 @@ struct hid_item {
311#define HID_GROUP_RMI 0x0100 312#define HID_GROUP_RMI 0x0100
312 313
313/* 314/*
315 * Vendor specific HID device groups
316 */
317#define HID_GROUP_WACOM 0x0101
318
319/*
314 * This is the global environment of the parser. This information is 320 * This is the global environment of the parser. This information is
315 * persistent for main-items. The global environment can be saved and 321 * persistent for main-items. The global environment can be saved and
316 * restored with PUSH/POP statements. 322 * restored with PUSH/POP statements.
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 7fb31da45d03..9286a46b7d69 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -93,7 +93,7 @@ static inline int kmap_atomic_idx_push(void)
93 93
94#ifdef CONFIG_DEBUG_HIGHMEM 94#ifdef CONFIG_DEBUG_HIGHMEM
95 WARN_ON_ONCE(in_irq() && !irqs_disabled()); 95 WARN_ON_ONCE(in_irq() && !irqs_disabled());
96 BUG_ON(idx > KM_TYPE_NR); 96 BUG_ON(idx >= KM_TYPE_NR);
97#endif 97#endif
98 return idx; 98 return idx;
99} 99}
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index d2b52999e771..bb9840fd1e18 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -164,12 +164,15 @@ int host1x_job_submit(struct host1x_job *job);
164 */ 164 */
165 165
166struct host1x_reloc { 166struct host1x_reloc {
167 struct host1x_bo *cmdbuf; 167 struct {
168 u32 cmdbuf_offset; 168 struct host1x_bo *bo;
169 struct host1x_bo *target; 169 unsigned long offset;
170 u32 target_offset; 170 } cmdbuf;
171 u32 shift; 171 struct {
172 u32 pad; 172 struct host1x_bo *bo;
173 unsigned long offset;
174 } target;
175 unsigned long shift;
173}; 176};
174 177
175struct host1x_job { 178struct host1x_job {
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index e7a8d3fa91d5..a036d058a249 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -165,6 +165,7 @@ enum hrtimer_base_type {
165 * struct hrtimer_cpu_base - the per cpu clock bases 165 * struct hrtimer_cpu_base - the per cpu clock bases
166 * @lock: lock protecting the base and associated clock bases 166 * @lock: lock protecting the base and associated clock bases
167 * and timers 167 * and timers
168 * @cpu: cpu number
168 * @active_bases: Bitfield to mark bases with active timers 169 * @active_bases: Bitfield to mark bases with active timers
169 * @clock_was_set: Indicates that clock was set from irq context. 170 * @clock_was_set: Indicates that clock was set from irq context.
170 * @expires_next: absolute time of the next event which was scheduled 171 * @expires_next: absolute time of the next event which was scheduled
@@ -179,6 +180,7 @@ enum hrtimer_base_type {
179 */ 180 */
180struct hrtimer_cpu_base { 181struct hrtimer_cpu_base {
181 raw_spinlock_t lock; 182 raw_spinlock_t lock;
183 unsigned int cpu;
182 unsigned int active_bases; 184 unsigned int active_bases;
183 unsigned int clock_was_set; 185 unsigned int clock_was_set;
184#ifdef CONFIG_HIGH_RES_TIMERS 186#ifdef CONFIG_HIGH_RES_TIMERS
@@ -324,14 +326,6 @@ static inline void timerfd_clock_was_set(void) { }
324#endif 326#endif
325extern void hrtimers_resume(void); 327extern void hrtimers_resume(void);
326 328
327extern ktime_t ktime_get(void);
328extern ktime_t ktime_get_real(void);
329extern ktime_t ktime_get_boottime(void);
330extern ktime_t ktime_get_monotonic_offset(void);
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);
334
335DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 329DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
336 330
337 331
@@ -452,12 +446,6 @@ extern void hrtimer_run_pending(void);
452/* Bootup initialization: */ 446/* Bootup initialization: */
453extern void __init hrtimers_init(void); 447extern void __init hrtimers_init(void);
454 448
455#if BITS_PER_LONG < 64
456extern u64 ktime_divns(const ktime_t kt, s64 div);
457#else /* BITS_PER_LONG < 64 */
458# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
459#endif
460
461/* Show pending timers: */ 449/* Show pending timers: */
462extern void sysrq_timer_list_show(void); 450extern void sysrq_timer_list_show(void);
463 451
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b826239bdce0..63579cb8d3dc 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -93,10 +93,6 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
93#endif /* CONFIG_DEBUG_VM */ 93#endif /* CONFIG_DEBUG_VM */
94 94
95extern unsigned long transparent_hugepage_flags; 95extern unsigned long transparent_hugepage_flags;
96extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
97 pmd_t *dst_pmd, pmd_t *src_pmd,
98 struct vm_area_struct *vma,
99 unsigned long addr, unsigned long end);
100extern int split_huge_page_to_list(struct page *page, struct list_head *list); 96extern int split_huge_page_to_list(struct page *page, struct list_head *list);
101static inline int split_huge_page(struct page *page) 97static inline int split_huge_page(struct page *page)
102{ 98{
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 255cd5cc0754..6e6d338641fe 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -80,13 +80,13 @@ int dequeue_hwpoisoned_huge_page(struct page *page);
80bool isolate_huge_page(struct page *page, struct list_head *list); 80bool isolate_huge_page(struct page *page, struct list_head *list);
81void putback_active_hugepage(struct page *page); 81void putback_active_hugepage(struct page *page);
82bool is_hugepage_active(struct page *page); 82bool is_hugepage_active(struct page *page);
83void free_huge_page(struct page *page);
83 84
84#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 85#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
85pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); 86pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
86#endif 87#endif
87 88
88extern unsigned long hugepages_treat_as_movable; 89extern unsigned long hugepages_treat_as_movable;
89extern const unsigned long hugetlb_zero, hugetlb_infinity;
90extern int sysctl_hugetlb_shm_group; 90extern int sysctl_hugetlb_shm_group;
91extern struct list_head huge_boot_pages; 91extern struct list_head huge_boot_pages;
92 92
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index b4b0eef5fddf..914bb08cd738 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -29,6 +29,8 @@
29 * @read: New API. drivers can fill up to max bytes of data 29 * @read: New API. drivers can fill up to max bytes of data
30 * into the buffer. The buffer is aligned for any type. 30 * into the buffer. The buffer is aligned for any type.
31 * @priv: Private data, for use by the RNG driver. 31 * @priv: Private data, for use by the RNG driver.
32 * @quality: Estimation of true entropy in RNG's bitstream
33 * (per mill).
32 */ 34 */
33struct hwrng { 35struct hwrng {
34 const char *name; 36 const char *name;
@@ -38,6 +40,7 @@ struct hwrng {
38 int (*data_read)(struct hwrng *rng, u32 *data); 40 int (*data_read)(struct hwrng *rng, u32 *data);
39 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); 41 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait);
40 unsigned long priv; 42 unsigned long priv;
43 unsigned short quality;
41 44
42 /* internal. */ 45 /* internal. */
43 struct list_head list; 46 struct list_head list;
@@ -47,5 +50,7 @@ struct hwrng {
47extern int hwrng_register(struct hwrng *rng); 50extern int hwrng_register(struct hwrng *rng);
48/** Unregister a Hardware Random Number Generator driver. */ 51/** Unregister a Hardware Random Number Generator driver. */
49extern void hwrng_unregister(struct hwrng *rng); 52extern void hwrng_unregister(struct hwrng *rng);
53/** Feed random bits into the pool. */
54extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy);
50 55
51#endif /* LINUX_HWRANDOM_H_ */ 56#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index b556e0ab946f..ea507665896c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -577,4 +577,16 @@ static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node
577} 577}
578#endif /* CONFIG_OF */ 578#endif /* CONFIG_OF */
579 579
580#ifdef CONFIG_I2C_ACPI
581int acpi_i2c_install_space_handler(struct i2c_adapter *adapter);
582void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter);
583void acpi_i2c_register_devices(struct i2c_adapter *adap);
584#else
585static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { }
586static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
587{ }
588static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
589{ return 0; }
590#endif
591
580#endif /* _LINUX_I2C_H */ 592#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index 3891dc1de21c..02bf6ea31701 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -17,9 +17,6 @@
17 17
18/* The platform data for the Atmel maXTouch touchscreen driver */ 18/* The platform data for the Atmel maXTouch touchscreen driver */
19struct mxt_platform_data { 19struct mxt_platform_data {
20 const u8 *config;
21 size_t config_length;
22 u32 config_crc;
23 unsigned long irqflags; 20 unsigned long irqflags;
24 u8 t19_num_keys; 21 u8 t19_num_keys;
25 const unsigned int *t19_keymap; 22 const unsigned int *t19_keymap;
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h
deleted file mode 100644
index d9b34bfdae76..000000000000
--- a/include/linux/i2c/s6000.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __LINUX_I2C_S6000_H
2#define __LINUX_I2C_S6000_H
3
4struct s6_i2c_platform_data {
5 const char *clock; /* the clock to use */
6 int bus_num; /* the bus number to register */
7};
8
9#endif
10
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 6bff13f74050..63ab3873c5ed 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1001,6 +1001,26 @@ struct ieee80211_vendor_ie {
1001 u8 oui_type; 1001 u8 oui_type;
1002} __packed; 1002} __packed;
1003 1003
1004struct ieee80211_wmm_ac_param {
1005 u8 aci_aifsn; /* AIFSN, ACM, ACI */
1006 u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
1007 __le16 txop_limit;
1008} __packed;
1009
1010struct ieee80211_wmm_param_ie {
1011 u8 element_id; /* Element ID: 221 (0xdd); */
1012 u8 len; /* Length: 24 */
1013 /* required fields for WMM version 1 */
1014 u8 oui[3]; /* 00:50:f2 */
1015 u8 oui_type; /* 2 */
1016 u8 oui_subtype; /* 1 */
1017 u8 version; /* 1 for WMM version 1.0 */
1018 u8 qos_info; /* AP/STA specific QoS info */
1019 u8 reserved; /* 0 */
1020 /* AC_BE, AC_BK, AC_VI, AC_VO */
1021 struct ieee80211_wmm_ac_param ac[4];
1022} __packed;
1023
1004/* Control frames */ 1024/* Control frames */
1005struct ieee80211_rts { 1025struct ieee80211_rts {
1006 __le16 frame_control; 1026 __le16 frame_control;
@@ -1621,6 +1641,9 @@ enum ieee80211_reasoncode {
1621 WLAN_REASON_INVALID_RSN_IE_CAP = 22, 1641 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
1622 WLAN_REASON_IEEE8021X_FAILED = 23, 1642 WLAN_REASON_IEEE8021X_FAILED = 23,
1623 WLAN_REASON_CIPHER_SUITE_REJECTED = 24, 1643 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
1644 /* TDLS (802.11z) */
1645 WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25,
1646 WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26,
1624 /* 802.11e */ 1647 /* 802.11e */
1625 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, 1648 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
1626 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, 1649 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index fd22789d7b2e..808dcb8cc04f 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -36,8 +36,28 @@ extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __use
36 36
37typedef int br_should_route_hook_t(struct sk_buff *skb); 37typedef int br_should_route_hook_t(struct sk_buff *skb);
38extern br_should_route_hook_t __rcu *br_should_route_hook; 38extern br_should_route_hook_t __rcu *br_should_route_hook;
39
40#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
39int br_multicast_list_adjacent(struct net_device *dev, 41int br_multicast_list_adjacent(struct net_device *dev,
40 struct list_head *br_ip_list); 42 struct list_head *br_ip_list);
43bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto);
41bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto); 44bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);
45#else
46static inline int br_multicast_list_adjacent(struct net_device *dev,
47 struct list_head *br_ip_list)
48{
49 return 0;
50}
51static inline bool br_multicast_has_querier_anywhere(struct net_device *dev,
52 int proto)
53{
54 return false;
55}
56static inline bool br_multicast_has_querier_adjacent(struct net_device *dev,
57 int proto)
58{
59 return false;
60}
61#endif
42 62
43#endif 63#endif
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 4967916fe4ac..d69f0577a319 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -187,7 +187,6 @@ vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio)
187} 187}
188 188
189extern bool vlan_do_receive(struct sk_buff **skb); 189extern bool vlan_do_receive(struct sk_buff **skb);
190extern struct sk_buff *vlan_untag(struct sk_buff *skb);
191 190
192extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); 191extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid);
193extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); 192extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid);
@@ -241,11 +240,6 @@ static inline bool vlan_do_receive(struct sk_buff **skb)
241 return false; 240 return false;
242} 241}
243 242
244static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
245{
246 return skb;
247}
248
249static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) 243static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid)
250{ 244{
251 return 0; 245 return 0;
diff --git a/include/linux/tegra-soc.h b/include/linux/iio/accel/kxcjk_1013.h
index 95f611d78f3a..fd1d540ea62d 100644
--- a/include/linux/tegra-soc.h
+++ b/include/linux/iio/accel/kxcjk_1013.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 2 * KXCJK-1013 3-axis accelerometer Interface
3 * Copyright (c) 2014, Intel Corporation.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * 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 * under the terms and conditions of the GNU General Public License,
@@ -9,14 +10,13 @@
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details. 12 * 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 */ 13 */
16 14
17#ifndef __LINUX_TEGRA_SOC_H_ 15#ifndef __IIO_KXCJK_1013_H__
18#define __LINUX_TEGRA_SOC_H_ 16#define __IIO_KXCJK_1013_H__
19 17
20u32 tegra_read_chipid(void); 18struct kxcjk_1013_platform_data {
19 bool active_high_intr;
20};
21 21
22#endif /* __LINUX_TEGRA_SOC_H_ */ 22#endif
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 96f51f0e0096..d8257ab60bac 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -47,6 +47,7 @@
47 .type = device_type, \ 47 .type = device_type, \
48 .modified = mod, \ 48 .modified = mod, \
49 .info_mask_separate = mask, \ 49 .info_mask_separate = mask, \
50 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
50 .scan_index = index, \ 51 .scan_index = index, \
51 .channel2 = ch2, \ 52 .channel2 = ch2, \
52 .address = addr, \ 53 .address = addr, \
@@ -59,11 +60,6 @@
59 }, \ 60 }, \
60} 61}
61 62
62#define ST_SENSOR_DEV_ATTR_SAMP_FREQ() \
63 IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, \
64 st_sensors_sysfs_get_sampling_frequency, \
65 st_sensors_sysfs_set_sampling_frequency)
66
67#define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \ 63#define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \
68 IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \ 64 IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
69 st_sensors_sysfs_sampling_frequency_avail) 65 st_sensors_sysfs_sampling_frequency_avail)
@@ -285,12 +281,6 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
285int st_sensors_check_device_support(struct iio_dev *indio_dev, 281int st_sensors_check_device_support(struct iio_dev *indio_dev,
286 int num_sensors_list, const struct st_sensors *sensors); 282 int num_sensors_list, const struct st_sensors *sensors);
287 283
288ssize_t st_sensors_sysfs_get_sampling_frequency(struct device *dev,
289 struct device_attribute *attr, char *buf);
290
291ssize_t st_sensors_sysfs_set_sampling_frequency(struct device *dev,
292 struct device_attribute *attr, const char *buf, size_t size);
293
294ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, 284ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
295 struct device_attribute *attr, char *buf); 285 struct device_attribute *attr, char *buf);
296 286
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
index 67d845385ae2..1796af093368 100644
--- a/include/linux/iio/common/st_sensors_i2c.h
+++ b/include/linux/iio/common/st_sensors_i2c.h
@@ -13,8 +13,19 @@
13 13
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/iio/common/st_sensors.h> 15#include <linux/iio/common/st_sensors.h>
16#include <linux/of.h>
16 17
17void st_sensors_i2c_configure(struct iio_dev *indio_dev, 18void st_sensors_i2c_configure(struct iio_dev *indio_dev,
18 struct i2c_client *client, struct st_sensor_data *sdata); 19 struct i2c_client *client, struct st_sensor_data *sdata);
19 20
21#ifdef CONFIG_OF
22void st_sensors_of_i2c_probe(struct i2c_client *client,
23 const struct of_device_id *match);
24#else
25static inline void st_sensors_of_i2c_probe(struct i2c_client *client,
26 const struct of_device_id *match)
27{
28}
29#endif
30
20#endif /* ST_SENSORS_I2C_H */ 31#endif /* ST_SENSORS_I2C_H */
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index ccde91725f98..15dc6bc2bdd2 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -277,14 +277,7 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
277 **/ 277 **/
278static inline s64 iio_get_time_ns(void) 278static inline s64 iio_get_time_ns(void)
279{ 279{
280 struct timespec ts; 280 return ktime_get_real_ns();
281 /*
282 * calls getnstimeofday.
283 * If hrtimers then up to ns accurate, if not microsecond.
284 */
285 ktime_get_real_ts(&ts);
286
287 return timespec_to_ns(&ts);
288} 281}
289 282
290/* Device operating modes */ 283/* Device operating modes */
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index b665dc7f017b..fa2d01ef8f55 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -157,13 +157,14 @@ int adis_single_conversion(struct iio_dev *indio_dev,
157 const struct iio_chan_spec *chan, unsigned int error_mask, 157 const struct iio_chan_spec *chan, unsigned int error_mask,
158 int *val); 158 int *val);
159 159
160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \ 160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \
161 .type = IIO_VOLTAGE, \ 161 .type = IIO_VOLTAGE, \
162 .indexed = 1, \ 162 .indexed = 1, \
163 .channel = (chan), \ 163 .channel = (chan), \
164 .extend_name = name, \ 164 .extend_name = name, \
165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
166 BIT(IIO_CHAN_INFO_SCALE), \ 166 BIT(IIO_CHAN_INFO_SCALE), \
167 .info_mask_shared_by_all = info_all, \
167 .address = (addr), \ 168 .address = (addr), \
168 .scan_index = (si), \ 169 .scan_index = (si), \
169 .scan_type = { \ 170 .scan_type = { \
@@ -174,19 +175,20 @@ int adis_single_conversion(struct iio_dev *indio_dev,
174 }, \ 175 }, \
175} 176}
176 177
177#define ADIS_SUPPLY_CHAN(addr, si, bits) \ 178#define ADIS_SUPPLY_CHAN(addr, si, info_all, bits) \
178 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits) 179 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", info_all, bits)
179 180
180#define ADIS_AUX_ADC_CHAN(addr, si, bits) \ 181#define ADIS_AUX_ADC_CHAN(addr, si, info_all, bits) \
181 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits) 182 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, info_all, bits)
182 183
183#define ADIS_TEMP_CHAN(addr, si, bits) { \ 184#define ADIS_TEMP_CHAN(addr, si, info_all, bits) { \
184 .type = IIO_TEMP, \ 185 .type = IIO_TEMP, \
185 .indexed = 1, \ 186 .indexed = 1, \
186 .channel = 0, \ 187 .channel = 0, \
187 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 188 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
188 BIT(IIO_CHAN_INFO_SCALE) | \ 189 BIT(IIO_CHAN_INFO_SCALE) | \
189 BIT(IIO_CHAN_INFO_OFFSET), \ 190 BIT(IIO_CHAN_INFO_OFFSET), \
191 .info_mask_shared_by_all = info_all, \
190 .address = (addr), \ 192 .address = (addr), \
191 .scan_index = (si), \ 193 .scan_index = (si), \
192 .scan_type = { \ 194 .scan_type = { \
@@ -197,13 +199,14 @@ int adis_single_conversion(struct iio_dev *indio_dev,
197 }, \ 199 }, \
198} 200}
199 201
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \ 202#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, info_all, bits) { \
201 .type = (_type), \ 203 .type = (_type), \
202 .modified = 1, \ 204 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \ 205 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 206 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
205 info_sep, \ 207 info_sep, \
206 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ 208 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
209 .info_mask_shared_by_all = info_all, \
207 .address = (addr), \ 210 .address = (addr), \
208 .scan_index = (si), \ 211 .scan_index = (si), \
209 .scan_type = { \ 212 .scan_type = { \
@@ -214,17 +217,17 @@ int adis_single_conversion(struct iio_dev *indio_dev,
214 }, \ 217 }, \
215} 218}
216 219
217#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \ 220#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, info_all, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits) 221 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, info_all, bits)
219 222
220#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \ 223#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, info_all, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits) 224 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, info_all, bits)
222 225
223#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \ 226#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, info_all, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits) 227 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, info_all, bits)
225 228
226#define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \ 229#define ADIS_ROT_CHAN(mod, addr, si, info_sep, info_all, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits) 230 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, info_all, bits)
228 231
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER 232#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230 233
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 369cf2cd5144..4b79ffe7b188 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -129,12 +129,11 @@ void iio_trigger_unregister(struct iio_trigger *trig_info);
129/** 129/**
130 * iio_trigger_poll() - called on a trigger occurring 130 * iio_trigger_poll() - called on a trigger occurring
131 * @trig: trigger which occurred 131 * @trig: trigger which occurred
132 * @time: timestamp when trigger occurred
133 * 132 *
134 * Typically called in relevant hardware interrupt handler. 133 * Typically called in relevant hardware interrupt handler.
135 **/ 134 **/
136void iio_trigger_poll(struct iio_trigger *trig, s64 time); 135void iio_trigger_poll(struct iio_trigger *trig);
137void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time); 136void iio_trigger_poll_chained(struct iio_trigger *trig);
138 137
139irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); 138irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
140 139
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index d480631eabc2..4a2af8adf874 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -56,6 +56,10 @@ enum iio_modifier {
56 IIO_MOD_QUATERNION, 56 IIO_MOD_QUATERNION,
57 IIO_MOD_TEMP_AMBIENT, 57 IIO_MOD_TEMP_AMBIENT,
58 IIO_MOD_TEMP_OBJECT, 58 IIO_MOD_TEMP_OBJECT,
59 IIO_MOD_NORTH_MAGN,
60 IIO_MOD_NORTH_TRUE,
61 IIO_MOD_NORTH_MAGN_TILT_COMP,
62 IIO_MOD_NORTH_TRUE_TILT_COMP
59}; 63};
60 64
61enum iio_event_type { 65enum iio_event_type {
@@ -70,6 +74,7 @@ enum iio_event_info {
70 IIO_EV_INFO_ENABLE, 74 IIO_EV_INFO_ENABLE,
71 IIO_EV_INFO_VALUE, 75 IIO_EV_INFO_VALUE,
72 IIO_EV_INFO_HYSTERESIS, 76 IIO_EV_INFO_HYSTERESIS,
77 IIO_EV_INFO_PERIOD,
73}; 78};
74 79
75enum iio_event_direction { 80enum iio_event_direction {
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 1b7f268cddce..7cf5e9b32550 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -19,6 +19,7 @@ extern int ima_file_check(struct file *file, int mask);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file); 21extern int ima_module_check(struct file *file);
22extern int ima_fw_from_file(struct file *file, char *buf, size_t size);
22 23
23#else 24#else
24static inline int ima_bprm_check(struct linux_binprm *bprm) 25static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -46,6 +47,11 @@ static inline int ima_module_check(struct file *file)
46 return 0; 47 return 0;
47} 48}
48 49
50static inline int ima_fw_from_file(struct file *file, char *buf, size_t size)
51{
52 return 0;
53}
54
49#endif /* CONFIG_IMA */ 55#endif /* CONFIG_IMA */
50 56
51#ifdef CONFIG_IMA_APPRAISE 57#ifdef CONFIG_IMA_APPRAISE
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6df7f9fe0d01..2bb4c4f3531a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -102,12 +102,6 @@ extern struct group_info init_groups;
102#define INIT_IDS 102#define INIT_IDS
103#endif 103#endif
104 104
105#ifdef CONFIG_RCU_BOOST
106#define INIT_TASK_RCU_BOOST() \
107 .rcu_boost_mutex = NULL,
108#else
109#define INIT_TASK_RCU_BOOST()
110#endif
111#ifdef CONFIG_TREE_PREEMPT_RCU 105#ifdef CONFIG_TREE_PREEMPT_RCU
112#define INIT_TASK_RCU_TREE_PREEMPT() \ 106#define INIT_TASK_RCU_TREE_PREEMPT() \
113 .rcu_blocked_node = NULL, 107 .rcu_blocked_node = NULL,
@@ -119,8 +113,7 @@ extern struct group_info init_groups;
119 .rcu_read_lock_nesting = 0, \ 113 .rcu_read_lock_nesting = 0, \
120 .rcu_read_unlock_special = 0, \ 114 .rcu_read_unlock_special = 0, \
121 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
122 INIT_TASK_RCU_TREE_PREEMPT() \ 116 INIT_TASK_RCU_TREE_PREEMPT()
123 INIT_TASK_RCU_BOOST()
124#else 117#else
125#define INIT_TASK_RCU_PREEMPT(tsk) 118#define INIT_TASK_RCU_PREEMPT(tsk)
126#endif 119#endif
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 1b1dfa80d9ff..f583ff639776 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -105,6 +105,7 @@ void input_mt_report_slot_state(struct input_dev *dev,
105 105
106void input_mt_report_finger_count(struct input_dev *dev, int count); 106void input_mt_report_finger_count(struct input_dev *dev, int count);
107void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); 107void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
108void input_mt_drop_unused(struct input_dev *dev);
108 109
109void input_mt_sync_frame(struct input_dev *dev); 110void input_mt_sync_frame(struct input_dev *dev);
110 111
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 160cf353aa39..7bae83b7c396 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,22 @@ enum pixcir_int_mode {
43#define PIXCIR_INT_ENABLE (1UL << 3) 43#define PIXCIR_INT_ENABLE (1UL << 3)
44#define PIXCIR_INT_POL_HIGH (1UL << 2) 44#define PIXCIR_INT_POL_HIGH (1UL << 2)
45 45
46/**
47 * struct pixcir_irc_chip_data - chip related data
48 * @max_fingers: Max number of fingers reported simultaneously by h/w
49 * @has_hw_ids: Hardware supports finger tracking IDs
50 *
51 */
52struct pixcir_i2c_chip_data {
53 u8 max_fingers;
54 bool has_hw_ids;
55};
56
46struct pixcir_ts_platform_data { 57struct pixcir_ts_platform_data {
47 int x_max; 58 int x_max;
48 int y_max; 59 int y_max;
49 int gpio_attb; /* GPIO connected to ATTB line */ 60 int gpio_attb; /* GPIO connected to ATTB line */
61 struct pixcir_i2c_chip_data chip;
50}; 62};
51 63
52#endif 64#endif
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 0a2da5188217..a65208a8fe18 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -336,6 +336,7 @@ struct intel_iommu {
336#ifdef CONFIG_IRQ_REMAP 336#ifdef CONFIG_IRQ_REMAP
337 struct ir_table *ir_table; /* Interrupt remapping info */ 337 struct ir_table *ir_table; /* Interrupt remapping info */
338#endif 338#endif
339 struct device *iommu_dev; /* IOMMU-sysfs device */
339 int node; 340 int node;
340}; 341};
341 342
@@ -365,4 +366,6 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
365 366
366extern int dmar_ir_support(void); 367extern int dmar_ir_support(void);
367 368
369extern const struct attribute_group *intel_iommu_groups[];
370
368#endif 371#endif
diff --git a/include/linux/io.h b/include/linux/io.h
index b76e6e545806..d5fc9b8d8b03 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -58,6 +58,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
58} 58}
59#endif 59#endif
60 60
61#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
62
61void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, 63void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
62 unsigned long size); 64 unsigned long size);
63void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, 65void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index b96a5b2136e4..20f9a527922a 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -50,7 +50,7 @@ struct iommu_domain_geometry {
50}; 50};
51 51
52struct iommu_domain { 52struct iommu_domain {
53 struct iommu_ops *ops; 53 const struct iommu_ops *ops;
54 void *priv; 54 void *priv;
55 iommu_fault_handler_t handler; 55 iommu_fault_handler_t handler;
56 void *handler_token; 56 void *handler_token;
@@ -140,7 +140,7 @@ struct iommu_ops {
140#define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ 140#define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */
141#define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ 141#define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */
142 142
143extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); 143extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
144extern bool iommu_present(struct bus_type *bus); 144extern bool iommu_present(struct bus_type *bus);
145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
146extern struct iommu_group *iommu_group_get_by_id(int id); 146extern struct iommu_group *iommu_group_get_by_id(int id);
@@ -181,11 +181,18 @@ extern int iommu_group_register_notifier(struct iommu_group *group,
181extern int iommu_group_unregister_notifier(struct iommu_group *group, 181extern int iommu_group_unregister_notifier(struct iommu_group *group,
182 struct notifier_block *nb); 182 struct notifier_block *nb);
183extern int iommu_group_id(struct iommu_group *group); 183extern int iommu_group_id(struct iommu_group *group);
184extern struct iommu_group *iommu_group_get_for_dev(struct device *dev);
184 185
185extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, 186extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
186 void *data); 187 void *data);
187extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, 188extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
188 void *data); 189 void *data);
190struct device *iommu_device_create(struct device *parent, void *drvdata,
191 const struct attribute_group **groups,
192 const char *fmt, ...);
193void iommu_device_destroy(struct device *dev);
194int iommu_device_link(struct device *dev, struct device *link);
195void iommu_device_unlink(struct device *dev, struct device *link);
189 196
190/* Window handling function prototypes */ 197/* Window handling function prototypes */
191extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, 198extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
@@ -396,6 +403,27 @@ static inline int iommu_domain_set_attr(struct iommu_domain *domain,
396 return -EINVAL; 403 return -EINVAL;
397} 404}
398 405
406static inline struct device *iommu_device_create(struct device *parent,
407 void *drvdata,
408 const struct attribute_group **groups,
409 const char *fmt, ...)
410{
411 return ERR_PTR(-ENODEV);
412}
413
414static inline void iommu_device_destroy(struct device *dev)
415{
416}
417
418static inline int iommu_device_link(struct device *dev, struct device *link)
419{
420 return -EINVAL;
421}
422
423static inline void iommu_device_unlink(struct device *dev, struct device *link)
424{
425}
426
399#endif /* CONFIG_IOMMU_API */ 427#endif /* CONFIG_IOMMU_API */
400 428
401#endif /* __LINUX_IOMMU_H */ 429#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 5e3a906cc089..142ec544167c 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -237,6 +237,12 @@ extern int iomem_is_exclusive(u64 addr);
237extern int 237extern int
238walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 238walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
239 void *arg, int (*func)(unsigned long, unsigned long, void *)); 239 void *arg, int (*func)(unsigned long, unsigned long, void *));
240extern int
241walk_system_ram_res(u64 start, u64 end, void *arg,
242 int (*func)(u64, u64, void *));
243extern int
244walk_iomem_res(char *name, unsigned long flags, u64 start, u64 end, void *arg,
245 int (*func)(u64, u64, void *));
240 246
241/* True if any part of r1 overlaps r2 */ 247/* True if any part of r1 overlaps r2 */
242static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 248static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 3277f4711349..19e81d5ccb6d 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -34,6 +34,11 @@ struct iova_domain {
34 unsigned long dma_32bit_pfn; 34 unsigned long dma_32bit_pfn;
35}; 35};
36 36
37static inline unsigned long iova_size(struct iova *iova)
38{
39 return iova->pfn_hi - iova->pfn_lo + 1;
40}
41
37struct iova *alloc_iova_mem(void); 42struct iova *alloc_iova_mem(void);
38void free_iova_mem(struct iova *iova); 43void free_iova_mem(struct iova *iova);
39void free_iova(struct iova_domain *iovad, unsigned long pfn); 44void free_iova(struct iova_domain *iovad, unsigned long pfn);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 2faef339d8f2..ff560537dd61 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -39,6 +39,7 @@ struct ipv6_devconf {
39#endif 39#endif
40 __s32 proxy_ndp; 40 __s32 proxy_ndp;
41 __s32 accept_source_route; 41 __s32 accept_source_route;
42 __s32 accept_ra_from_local;
42#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 43#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
43 __s32 optimistic_dad; 44 __s32 optimistic_dad;
44#endif 45#endif
@@ -193,12 +194,13 @@ struct ipv6_pinfo {
193 sndflow:1, 194 sndflow:1,
194 repflow:1, 195 repflow:1,
195 pmtudisc:3, 196 pmtudisc:3,
196 ipv6only:1, 197 padding:1, /* 1 bit hole */
197 srcprefs:3, /* 001: prefer temporary address 198 srcprefs:3, /* 001: prefer temporary address
198 * 010: prefer public address 199 * 010: prefer public address
199 * 100: prefer care-of address 200 * 100: prefer care-of address
200 */ 201 */
201 dontfrag:1; 202 dontfrag:1,
203 autoflowlabel:1;
202 __u8 min_hopcount; 204 __u8 min_hopcount;
203 __u8 tclass; 205 __u8 tclass;
204 __be32 rcv_flowinfo; 206 __be32 rcv_flowinfo;
@@ -256,16 +258,6 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
256 return inet_sk(__sk)->pinet6; 258 return inet_sk(__sk)->pinet6;
257} 259}
258 260
259static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
260{
261 struct request_sock *req = reqsk_alloc(ops);
262
263 if (req)
264 inet_rsk(req)->pktopts = NULL;
265
266 return req;
267}
268
269static inline struct raw6_sock *raw6_sk(const struct sock *sk) 261static inline struct raw6_sock *raw6_sk(const struct sock *sk)
270{ 262{
271 return (struct raw6_sock *)sk; 263 return (struct raw6_sock *)sk;
@@ -282,8 +274,8 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
282 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); 274 __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
283} 275}
284 276
285#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 277#define __ipv6_only_sock(sk) (sk->sk_ipv6only)
286#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 278#define ipv6_only_sock(sk) (__ipv6_only_sock(sk))
287#define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \ 279#define ipv6_sk_rxinfo(sk) ((sk)->sk_family == PF_INET6 && \
288 inet6_sk(sk)->rxopt.bits.rxinfo) 280 inet6_sk(sk)->rxopt.bits.rxinfo)
289 281
@@ -296,8 +288,8 @@ static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
296 288
297static inline int inet_v6_ipv6only(const struct sock *sk) 289static inline int inet_v6_ipv6only(const struct sock *sk)
298{ 290{
299 return likely(sk->sk_state != TCP_TIME_WAIT) ? 291 /* ipv6only field is at same position for timewait and other sockets */
300 ipv6_only_sock(sk) : inet_twsk(sk)->tw_ipv6only; 292 return ipv6_only_sock(sk);
301} 293}
302#else 294#else
303#define __ipv6_only_sock(sk) 0 295#define __ipv6_only_sock(sk) 0
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 0d998d8b01d8..62af59242ddc 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -771,6 +771,8 @@ void irq_gc_eoi(struct irq_data *d);
771int irq_gc_set_wake(struct irq_data *d, unsigned int on); 771int irq_gc_set_wake(struct irq_data *d, unsigned int on);
772 772
773/* Setup functions for irq_chip_generic */ 773/* Setup functions for irq_chip_generic */
774int irq_map_generic_chip(struct irq_domain *d, unsigned int virq,
775 irq_hw_number_t hw_irq);
774struct irq_chip_generic * 776struct irq_chip_generic *
775irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base, 777irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base,
776 void __iomem *reg_base, irq_flow_handler_t handler); 778 void __iomem *reg_base, irq_flow_handler_t handler);
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 19ae05d4b8ec..bf9422c3aefe 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -33,6 +33,11 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
33#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), } 33#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }
34 34
35bool irq_work_queue(struct irq_work *work); 35bool irq_work_queue(struct irq_work *work);
36
37#ifdef CONFIG_SMP
38bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif
40
36void irq_work_run(void); 41void irq_work_run(void);
37void irq_work_sync(struct irq_work *work); 42void irq_work_sync(struct irq_work *work);
38 43
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
new file mode 100644
index 000000000000..03a4ea37ba86
--- /dev/null
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -0,0 +1,200 @@
1/*
2 * Copyright (C) 2013, 2014 ARM Limited, All Rights Reserved.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * 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 __LINUX_IRQCHIP_ARM_GIC_V3_H
19#define __LINUX_IRQCHIP_ARM_GIC_V3_H
20
21#include <asm/sysreg.h>
22
23/*
24 * Distributor registers. We assume we're running non-secure, with ARE
25 * being set. Secure-only and non-ARE registers are not described.
26 */
27#define GICD_CTLR 0x0000
28#define GICD_TYPER 0x0004
29#define GICD_IIDR 0x0008
30#define GICD_STATUSR 0x0010
31#define GICD_SETSPI_NSR 0x0040
32#define GICD_CLRSPI_NSR 0x0048
33#define GICD_SETSPI_SR 0x0050
34#define GICD_CLRSPI_SR 0x0058
35#define GICD_SEIR 0x0068
36#define GICD_ISENABLER 0x0100
37#define GICD_ICENABLER 0x0180
38#define GICD_ISPENDR 0x0200
39#define GICD_ICPENDR 0x0280
40#define GICD_ISACTIVER 0x0300
41#define GICD_ICACTIVER 0x0380
42#define GICD_IPRIORITYR 0x0400
43#define GICD_ICFGR 0x0C00
44#define GICD_IROUTER 0x6000
45#define GICD_PIDR2 0xFFE8
46
47#define GICD_CTLR_RWP (1U << 31)
48#define GICD_CTLR_ARE_NS (1U << 4)
49#define GICD_CTLR_ENABLE_G1A (1U << 1)
50#define GICD_CTLR_ENABLE_G1 (1U << 0)
51
52#define GICD_IROUTER_SPI_MODE_ONE (0U << 31)
53#define GICD_IROUTER_SPI_MODE_ANY (1U << 31)
54
55#define GIC_PIDR2_ARCH_MASK 0xf0
56#define GIC_PIDR2_ARCH_GICv3 0x30
57#define GIC_PIDR2_ARCH_GICv4 0x40
58
59/*
60 * Re-Distributor registers, offsets from RD_base
61 */
62#define GICR_CTLR GICD_CTLR
63#define GICR_IIDR 0x0004
64#define GICR_TYPER 0x0008
65#define GICR_STATUSR GICD_STATUSR
66#define GICR_WAKER 0x0014
67#define GICR_SETLPIR 0x0040
68#define GICR_CLRLPIR 0x0048
69#define GICR_SEIR GICD_SEIR
70#define GICR_PROPBASER 0x0070
71#define GICR_PENDBASER 0x0078
72#define GICR_INVLPIR 0x00A0
73#define GICR_INVALLR 0x00B0
74#define GICR_SYNCR 0x00C0
75#define GICR_MOVLPIR 0x0100
76#define GICR_MOVALLR 0x0110
77#define GICR_PIDR2 GICD_PIDR2
78
79#define GICR_WAKER_ProcessorSleep (1U << 1)
80#define GICR_WAKER_ChildrenAsleep (1U << 2)
81
82/*
83 * Re-Distributor registers, offsets from SGI_base
84 */
85#define GICR_ISENABLER0 GICD_ISENABLER
86#define GICR_ICENABLER0 GICD_ICENABLER
87#define GICR_ISPENDR0 GICD_ISPENDR
88#define GICR_ICPENDR0 GICD_ICPENDR
89#define GICR_ISACTIVER0 GICD_ISACTIVER
90#define GICR_ICACTIVER0 GICD_ICACTIVER
91#define GICR_IPRIORITYR0 GICD_IPRIORITYR
92#define GICR_ICFGR0 GICD_ICFGR
93
94#define GICR_TYPER_VLPIS (1U << 1)
95#define GICR_TYPER_LAST (1U << 4)
96
97/*
98 * CPU interface registers
99 */
100#define ICC_CTLR_EL1_EOImode_drop_dir (0U << 1)
101#define ICC_CTLR_EL1_EOImode_drop (1U << 1)
102#define ICC_SRE_EL1_SRE (1U << 0)
103
104/*
105 * Hypervisor interface registers (SRE only)
106 */
107#define ICH_LR_VIRTUAL_ID_MASK ((1UL << 32) - 1)
108
109#define ICH_LR_EOI (1UL << 41)
110#define ICH_LR_GROUP (1UL << 60)
111#define ICH_LR_STATE (3UL << 62)
112#define ICH_LR_PENDING_BIT (1UL << 62)
113#define ICH_LR_ACTIVE_BIT (1UL << 63)
114
115#define ICH_MISR_EOI (1 << 0)
116#define ICH_MISR_U (1 << 1)
117
118#define ICH_HCR_EN (1 << 0)
119#define ICH_HCR_UIE (1 << 1)
120
121#define ICH_VMCR_CTLR_SHIFT 0
122#define ICH_VMCR_CTLR_MASK (0x21f << ICH_VMCR_CTLR_SHIFT)
123#define ICH_VMCR_BPR1_SHIFT 18
124#define ICH_VMCR_BPR1_MASK (7 << ICH_VMCR_BPR1_SHIFT)
125#define ICH_VMCR_BPR0_SHIFT 21
126#define ICH_VMCR_BPR0_MASK (7 << ICH_VMCR_BPR0_SHIFT)
127#define ICH_VMCR_PMR_SHIFT 24
128#define ICH_VMCR_PMR_MASK (0xffUL << ICH_VMCR_PMR_SHIFT)
129
130#define ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1)
131#define ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0)
132#define ICC_SGI1R_EL1 sys_reg(3, 0, 12, 11, 5)
133#define ICC_PMR_EL1 sys_reg(3, 0, 4, 6, 0)
134#define ICC_CTLR_EL1 sys_reg(3, 0, 12, 12, 4)
135#define ICC_SRE_EL1 sys_reg(3, 0, 12, 12, 5)
136#define ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7)
137
138#define ICC_IAR1_EL1_SPURIOUS 0x3ff
139
140#define ICC_SRE_EL2 sys_reg(3, 4, 12, 9, 5)
141
142#define ICC_SRE_EL2_SRE (1 << 0)
143#define ICC_SRE_EL2_ENABLE (1 << 3)
144
145/*
146 * System register definitions
147 */
148#define ICH_VSEIR_EL2 sys_reg(3, 4, 12, 9, 4)
149#define ICH_HCR_EL2 sys_reg(3, 4, 12, 11, 0)
150#define ICH_VTR_EL2 sys_reg(3, 4, 12, 11, 1)
151#define ICH_MISR_EL2 sys_reg(3, 4, 12, 11, 2)
152#define ICH_EISR_EL2 sys_reg(3, 4, 12, 11, 3)
153#define ICH_ELSR_EL2 sys_reg(3, 4, 12, 11, 5)
154#define ICH_VMCR_EL2 sys_reg(3, 4, 12, 11, 7)
155
156#define __LR0_EL2(x) sys_reg(3, 4, 12, 12, x)
157#define __LR8_EL2(x) sys_reg(3, 4, 12, 13, x)
158
159#define ICH_LR0_EL2 __LR0_EL2(0)
160#define ICH_LR1_EL2 __LR0_EL2(1)
161#define ICH_LR2_EL2 __LR0_EL2(2)
162#define ICH_LR3_EL2 __LR0_EL2(3)
163#define ICH_LR4_EL2 __LR0_EL2(4)
164#define ICH_LR5_EL2 __LR0_EL2(5)
165#define ICH_LR6_EL2 __LR0_EL2(6)
166#define ICH_LR7_EL2 __LR0_EL2(7)
167#define ICH_LR8_EL2 __LR8_EL2(0)
168#define ICH_LR9_EL2 __LR8_EL2(1)
169#define ICH_LR10_EL2 __LR8_EL2(2)
170#define ICH_LR11_EL2 __LR8_EL2(3)
171#define ICH_LR12_EL2 __LR8_EL2(4)
172#define ICH_LR13_EL2 __LR8_EL2(5)
173#define ICH_LR14_EL2 __LR8_EL2(6)
174#define ICH_LR15_EL2 __LR8_EL2(7)
175
176#define __AP0Rx_EL2(x) sys_reg(3, 4, 12, 8, x)
177#define ICH_AP0R0_EL2 __AP0Rx_EL2(0)
178#define ICH_AP0R1_EL2 __AP0Rx_EL2(1)
179#define ICH_AP0R2_EL2 __AP0Rx_EL2(2)
180#define ICH_AP0R3_EL2 __AP0Rx_EL2(3)
181
182#define __AP1Rx_EL2(x) sys_reg(3, 4, 12, 9, x)
183#define ICH_AP1R0_EL2 __AP1Rx_EL2(0)
184#define ICH_AP1R1_EL2 __AP1Rx_EL2(1)
185#define ICH_AP1R2_EL2 __AP1Rx_EL2(2)
186#define ICH_AP1R3_EL2 __AP1Rx_EL2(3)
187
188#ifndef __ASSEMBLY__
189
190#include <linux/stringify.h>
191
192static inline void gic_write_eoir(u64 irq)
193{
194 asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq));
195 isb();
196}
197
198#endif
199
200#endif
diff --git a/include/linux/irqchip/spear-shirq.h b/include/linux/irqchip/spear-shirq.h
deleted file mode 100644
index c8be16d213a3..000000000000
--- a/include/linux/irqchip/spear-shirq.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * SPEAr platform shared irq layer header file
3 *
4 * Copyright (C) 2009-2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __SPEAR_SHIRQ_H
13#define __SPEAR_SHIRQ_H
14
15#include <linux/irq.h>
16#include <linux/types.h>
17
18/*
19 * struct shirq_regs: shared irq register configuration
20 *
21 * enb_reg: enable register offset
22 * reset_to_enb: val 1 indicates, we need to clear bit for enabling interrupt
23 * status_reg: status register offset
24 * status_reg_mask: status register valid mask
25 * clear_reg: clear register offset
26 * reset_to_clear: val 1 indicates, we need to clear bit for clearing interrupt
27 */
28struct shirq_regs {
29 u32 enb_reg;
30 u32 reset_to_enb;
31 u32 status_reg;
32 u32 clear_reg;
33 u32 reset_to_clear;
34};
35
36/*
37 * struct spear_shirq: shared irq structure
38 *
39 * irq: hardware irq number
40 * irq_base: base irq in linux domain
41 * irq_nr: no. of shared interrupts in a particular block
42 * irq_bit_off: starting bit offset in the status register
43 * invalid_irq: irq group is currently disabled
44 * base: base address of shared irq register
45 * regs: register configuration for shared irq block
46 */
47struct spear_shirq {
48 u32 irq;
49 u32 irq_base;
50 u32 irq_nr;
51 u32 irq_bit_off;
52 int invalid_irq;
53 void __iomem *base;
54 struct shirq_regs regs;
55};
56
57int __init spear300_shirq_of_init(struct device_node *np,
58 struct device_node *parent);
59int __init spear310_shirq_of_init(struct device_node *np,
60 struct device_node *parent);
61int __init spear320_shirq_of_init(struct device_node *np,
62 struct device_node *parent);
63
64#endif /* __SPEAR_SHIRQ_H */
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index c983ed18c332..b0f9d16e48f6 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -172,6 +172,8 @@ extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
172extern void irq_domain_associate_many(struct irq_domain *domain, 172extern void irq_domain_associate_many(struct irq_domain *domain,
173 unsigned int irq_base, 173 unsigned int irq_base,
174 irq_hw_number_t hwirq_base, int count); 174 irq_hw_number_t hwirq_base, int count);
175extern void irq_domain_disassociate(struct irq_domain *domain,
176 unsigned int irq);
175 177
176extern unsigned int irq_create_mapping(struct irq_domain *host, 178extern unsigned int irq_create_mapping(struct irq_domain *host,
177 irq_hw_number_t hwirq); 179 irq_hw_number_t hwirq);
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 8e10f57f109f..a0070c6dfaf8 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -180,8 +180,8 @@ struct ippp_struct {
180 struct slcompress *slcomp; 180 struct slcompress *slcomp;
181#endif 181#endif
182#ifdef CONFIG_IPPP_FILTER 182#ifdef CONFIG_IPPP_FILTER
183 struct sk_filter *pass_filter; /* filter for packets to pass */ 183 struct bpf_prog *pass_filter; /* filter for packets to pass */
184 struct sk_filter *active_filter; /* filter for pkts to reset idle */ 184 struct bpf_prog *active_filter; /* filter for pkts to reset idle */
185#endif 185#endif
186 unsigned long debug; 186 unsigned long debug;
187 struct isdn_ppp_compressor *compressor,*decompressor; 187 struct isdn_ppp_compressor *compressor,*decompressor;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4c52907a6d8b..95624bed87ef 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -470,6 +470,7 @@ extern enum system_states {
470#define TAINT_FIRMWARE_WORKAROUND 11 470#define TAINT_FIRMWARE_WORKAROUND 11
471#define TAINT_OOT_MODULE 12 471#define TAINT_OOT_MODULE 12
472#define TAINT_UNSIGNED_MODULE 13 472#define TAINT_UNSIGNED_MODULE 13
473#define TAINT_SOFTLOCKUP 14
473 474
474extern const char hex_asc[]; 475extern const char hex_asc[];
475#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 476#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -493,15 +494,10 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
493 return buf; 494 return buf;
494} 495}
495 496
496static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
497{
498 return hex_byte_pack(buf, byte);
499}
500
501extern int hex_to_bin(char ch); 497extern int hex_to_bin(char ch);
502extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 498extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
503 499
504int mac_pton(const char *s, u8 *mac); 500bool mac_pton(const char *s, u8 *mac);
505 501
506/* 502/*
507 * General tracing related utility functions - trace_printk(), 503 * General tracing related utility functions - trace_printk(),
@@ -849,5 +845,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
849 /* User perms >= group perms >= other perms */ \ 845 /* User perms >= group perms >= other perms */ \
850 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \ 846 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \
851 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \ 847 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \
848 /* Other writable? Generally considered a bad idea. */ \
849 BUILD_BUG_ON_ZERO((perms) & 2) + \
852 (perms)) 850 (perms))
853#endif 851#endif
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index a75641930049..4b2a0e11cc5b 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -10,6 +10,7 @@
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/elfcore.h> 11#include <linux/elfcore.h>
12#include <linux/elf.h> 12#include <linux/elf.h>
13#include <linux/module.h>
13#include <asm/kexec.h> 14#include <asm/kexec.h>
14 15
15/* Verify architecture specific macros are defined */ 16/* Verify architecture specific macros are defined */
@@ -69,7 +70,18 @@ typedef unsigned long kimage_entry_t;
69#define IND_SOURCE 0x8 70#define IND_SOURCE 0x8
70 71
71struct kexec_segment { 72struct kexec_segment {
72 void __user *buf; 73 /*
74 * This pointer can point to user memory if kexec_load() system
75 * call is used or will point to kernel memory if
76 * kexec_file_load() system call is used.
77 *
78 * Use ->buf when expecting to deal with user memory and use ->kbuf
79 * when expecting to deal with kernel memory.
80 */
81 union {
82 void __user *buf;
83 void *kbuf;
84 };
73 size_t bufsz; 85 size_t bufsz;
74 unsigned long mem; 86 unsigned long mem;
75 size_t memsz; 87 size_t memsz;
@@ -84,6 +96,27 @@ struct compat_kexec_segment {
84}; 96};
85#endif 97#endif
86 98
99struct kexec_sha_region {
100 unsigned long start;
101 unsigned long len;
102};
103
104struct purgatory_info {
105 /* Pointer to elf header of read only purgatory */
106 Elf_Ehdr *ehdr;
107
108 /* Pointer to purgatory sechdrs which are modifiable */
109 Elf_Shdr *sechdrs;
110 /*
111 * Temporary buffer location where purgatory is loaded and relocated
112 * This memory can be freed post image load
113 */
114 void *purgatory_buf;
115
116 /* Address where purgatory is finally loaded and is executed from */
117 unsigned long purgatory_load_addr;
118};
119
87struct kimage { 120struct kimage {
88 kimage_entry_t head; 121 kimage_entry_t head;
89 kimage_entry_t *entry; 122 kimage_entry_t *entry;
@@ -100,7 +133,7 @@ struct kimage {
100 133
101 struct list_head control_pages; 134 struct list_head control_pages;
102 struct list_head dest_pages; 135 struct list_head dest_pages;
103 struct list_head unuseable_pages; 136 struct list_head unusable_pages;
104 137
105 /* Address of next control page to allocate for crash kernels. */ 138 /* Address of next control page to allocate for crash kernels. */
106 unsigned long control_page; 139 unsigned long control_page;
@@ -110,13 +143,63 @@ struct kimage {
110#define KEXEC_TYPE_DEFAULT 0 143#define KEXEC_TYPE_DEFAULT 0
111#define KEXEC_TYPE_CRASH 1 144#define KEXEC_TYPE_CRASH 1
112 unsigned int preserve_context : 1; 145 unsigned int preserve_context : 1;
146 /* If set, we are using file mode kexec syscall */
147 unsigned int file_mode:1;
113 148
114#ifdef ARCH_HAS_KIMAGE_ARCH 149#ifdef ARCH_HAS_KIMAGE_ARCH
115 struct kimage_arch arch; 150 struct kimage_arch arch;
116#endif 151#endif
152
153 /* Additional fields for file based kexec syscall */
154 void *kernel_buf;
155 unsigned long kernel_buf_len;
156
157 void *initrd_buf;
158 unsigned long initrd_buf_len;
159
160 char *cmdline_buf;
161 unsigned long cmdline_buf_len;
162
163 /* File operations provided by image loader */
164 struct kexec_file_ops *fops;
165
166 /* Image loader handling the kernel can store a pointer here */
167 void *image_loader_data;
168
169 /* Information for loading purgatory */
170 struct purgatory_info purgatory_info;
117}; 171};
118 172
173/*
174 * Keeps track of buffer parameters as provided by caller for requesting
175 * memory placement of buffer.
176 */
177struct kexec_buf {
178 struct kimage *image;
179 char *buffer;
180 unsigned long bufsz;
181 unsigned long memsz;
182 unsigned long buf_align;
183 unsigned long buf_min;
184 unsigned long buf_max;
185 bool top_down; /* allocate from top of memory hole */
186};
119 187
188typedef int (kexec_probe_t)(const char *kernel_buf, unsigned long kernel_size);
189typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
190 unsigned long kernel_len, char *initrd,
191 unsigned long initrd_len, char *cmdline,
192 unsigned long cmdline_len);
193typedef int (kexec_cleanup_t)(void *loader_data);
194typedef int (kexec_verify_sig_t)(const char *kernel_buf,
195 unsigned long kernel_len);
196
197struct kexec_file_ops {
198 kexec_probe_t *probe;
199 kexec_load_t *load;
200 kexec_cleanup_t *cleanup;
201 kexec_verify_sig_t *verify_sig;
202};
120 203
121/* kexec interface functions */ 204/* kexec interface functions */
122extern void machine_kexec(struct kimage *image); 205extern void machine_kexec(struct kimage *image);
@@ -127,8 +210,21 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
127 struct kexec_segment __user *segments, 210 struct kexec_segment __user *segments,
128 unsigned long flags); 211 unsigned long flags);
129extern int kernel_kexec(void); 212extern int kernel_kexec(void);
213extern int kexec_add_buffer(struct kimage *image, char *buffer,
214 unsigned long bufsz, unsigned long memsz,
215 unsigned long buf_align, unsigned long buf_min,
216 unsigned long buf_max, bool top_down,
217 unsigned long *load_addr);
130extern struct page *kimage_alloc_control_pages(struct kimage *image, 218extern struct page *kimage_alloc_control_pages(struct kimage *image,
131 unsigned int order); 219 unsigned int order);
220extern int kexec_load_purgatory(struct kimage *image, unsigned long min,
221 unsigned long max, int top_down,
222 unsigned long *load_addr);
223extern int kexec_purgatory_get_set_symbol(struct kimage *image,
224 const char *name, void *buf,
225 unsigned int size, bool get_value);
226extern void *kexec_purgatory_get_symbol_addr(struct kimage *image,
227 const char *name);
132extern void crash_kexec(struct pt_regs *); 228extern void crash_kexec(struct pt_regs *);
133int kexec_should_crash(struct task_struct *); 229int kexec_should_crash(struct task_struct *);
134void crash_save_cpu(struct pt_regs *regs, int cpu); 230void crash_save_cpu(struct pt_regs *regs, int cpu);
@@ -177,6 +273,10 @@ extern int kexec_load_disabled;
177#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT) 273#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
178#endif 274#endif
179 275
276/* List of defined/legal kexec file flags */
277#define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \
278 KEXEC_FILE_NO_INITRAMFS)
279
180#define VMCOREINFO_BYTES (4096) 280#define VMCOREINFO_BYTES (4096)
181#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 281#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
182#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4) 282#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index a74c3a84dfdd..44792ee649de 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -41,10 +41,11 @@ struct key_construction {
41struct key_preparsed_payload { 41struct key_preparsed_payload {
42 char *description; /* Proposed key description (or NULL) */ 42 char *description; /* Proposed key description (or NULL) */
43 void *type_data[2]; /* Private key-type data */ 43 void *type_data[2]; /* Private key-type data */
44 void *payload; /* Proposed payload */ 44 void *payload[2]; /* Proposed payload */
45 const void *data; /* Raw data */ 45 const void *data; /* Raw data */
46 size_t datalen; /* Raw datalen */ 46 size_t datalen; /* Raw datalen */
47 size_t quotalen; /* Quota length for proposed payload */ 47 size_t quotalen; /* Quota length for proposed payload */
48 time_t expiry; /* Expiry time of key */
48 bool trusted; /* True if key is trusted */ 49 bool trusted; /* True if key is trusted */
49}; 50};
50 51
@@ -159,5 +160,7 @@ static inline int key_negate_and_link(struct key *key,
159 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); 160 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey);
160} 161}
161 162
163extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep);
164
162#endif /* CONFIG_KEYS */ 165#endif /* CONFIG_KEYS */
163#endif /* _LINUX_KEY_TYPE_H */ 166#endif /* _LINUX_KEY_TYPE_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 017b0826642f..e1d4715f3222 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -170,6 +170,8 @@ struct key {
170#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ 170#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
171#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */ 171#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */
172#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */ 172#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */
173#define KEY_FLAG_BUILTIN 10 /* set if key is builtin */
174#define KEY_FLAG_ROOT_CAN_INVAL 11 /* set if key can be invalidated by root without permission */
173 175
174 /* the key type and key description string 176 /* the key type and key description string
175 * - the desc is used to match a key against search criteria 177 * - the desc is used to match a key against search criteria
diff --git a/include/linux/klist.h b/include/linux/klist.h
index a370ce57cf1d..61e5b723ae73 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -44,7 +44,7 @@ struct klist_node {
44 44
45extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
46extern void klist_add_head(struct klist_node *n, struct klist *k); 46extern void klist_add_head(struct klist_node *n, struct klist *k);
47extern void klist_add_after(struct klist_node *n, struct klist_node *pos); 47extern void klist_add_behind(struct klist_node *n, struct klist_node *pos);
48extern void klist_add_before(struct klist_node *n, struct klist_node *pos); 48extern void klist_add_before(struct klist_node *n, struct klist_node *pos);
49 49
50extern void klist_del(struct klist_node *n); 50extern void klist_del(struct klist_node *n);
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 7dcef3317689..13d55206ccf6 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -73,7 +73,6 @@ struct kthread_worker {
73struct kthread_work { 73struct kthread_work {
74 struct list_head node; 74 struct list_head node;
75 kthread_work_func_t func; 75 kthread_work_func_t func;
76 wait_queue_head_t done;
77 struct kthread_worker *worker; 76 struct kthread_worker *worker;
78}; 77};
79 78
@@ -85,7 +84,6 @@ struct kthread_work {
85#define KTHREAD_WORK_INIT(work, fn) { \ 84#define KTHREAD_WORK_INIT(work, fn) { \
86 .node = LIST_HEAD_INIT((work).node), \ 85 .node = LIST_HEAD_INIT((work).node), \
87 .func = (fn), \ 86 .func = (fn), \
88 .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \
89 } 87 }
90 88
91#define DEFINE_KTHREAD_WORKER(worker) \ 89#define DEFINE_KTHREAD_WORKER(worker) \
@@ -95,22 +93,16 @@ struct kthread_work {
95 struct kthread_work work = KTHREAD_WORK_INIT(work, fn) 93 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
96 94
97/* 95/*
98 * kthread_worker.lock and kthread_work.done need their own lockdep class 96 * kthread_worker.lock needs its own lockdep class key when defined on
99 * keys if they are defined on stack with lockdep enabled. Use the 97 * stack with lockdep enabled. Use the following macros in such cases.
100 * following macros when defining them on stack.
101 */ 98 */
102#ifdef CONFIG_LOCKDEP 99#ifdef CONFIG_LOCKDEP
103# define KTHREAD_WORKER_INIT_ONSTACK(worker) \ 100# define KTHREAD_WORKER_INIT_ONSTACK(worker) \
104 ({ init_kthread_worker(&worker); worker; }) 101 ({ init_kthread_worker(&worker); worker; })
105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ 102# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \
106 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) 103 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker)
107# define KTHREAD_WORK_INIT_ONSTACK(work, fn) \
108 ({ init_kthread_work((&work), fn); work; })
109# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) \
110 struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn)
111#else 104#else
112# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) 105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker)
113# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn)
114#endif 106#endif
115 107
116extern void __init_kthread_worker(struct kthread_worker *worker, 108extern void __init_kthread_worker(struct kthread_worker *worker,
@@ -127,7 +119,6 @@ extern void __init_kthread_worker(struct kthread_worker *worker,
127 memset((work), 0, sizeof(struct kthread_work)); \ 119 memset((work), 0, sizeof(struct kthread_work)); \
128 INIT_LIST_HEAD(&(work)->node); \ 120 INIT_LIST_HEAD(&(work)->node); \
129 (work)->func = (fn); \ 121 (work)->func = (fn); \
130 init_waitqueue_head(&(work)->done); \
131 } while (0) 122 } while (0)
132 123
133int kthread_worker_fn(void *worker_ptr); 124int kthread_worker_fn(void *worker_ptr);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index de9e46e6bcc9..c9d645ad98ff 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -27,43 +27,19 @@
27/* 27/*
28 * ktime_t: 28 * ktime_t:
29 * 29 *
30 * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers 30 * A single 64-bit variable is used to store the hrtimers
31 * internal representation of time values in scalar nanoseconds. The 31 * internal representation of time values in scalar nanoseconds. The
32 * design plays out best on 64-bit CPUs, where most conversions are 32 * design plays out best on 64-bit CPUs, where most conversions are
33 * NOPs and most arithmetic ktime_t operations are plain arithmetic 33 * NOPs and most arithmetic ktime_t operations are plain arithmetic
34 * operations. 34 * operations.
35 * 35 *
36 * On 32-bit CPUs an optimized representation of the timespec structure
37 * is used to avoid expensive conversions from and to timespecs. The
38 * endian-aware order of the tv struct members is chosen to allow
39 * mathematical operations on the tv64 member of the union too, which
40 * for certain operations produces better code.
41 *
42 * For architectures with efficient support for 64/32-bit conversions the
43 * plain scalar nanosecond based representation can be selected by the
44 * config switch CONFIG_KTIME_SCALAR.
45 */ 36 */
46union ktime { 37union ktime {
47 s64 tv64; 38 s64 tv64;
48#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
49 struct {
50# ifdef __BIG_ENDIAN
51 s32 sec, nsec;
52# else
53 s32 nsec, sec;
54# endif
55 } tv;
56#endif
57}; 39};
58 40
59typedef union ktime ktime_t; /* Kill this */ 41typedef union ktime ktime_t; /* Kill this */
60 42
61/*
62 * ktime_t definitions when using the 64-bit scalar representation:
63 */
64
65#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
66
67/** 43/**
68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 44 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
69 * @secs: seconds to set 45 * @secs: seconds to set
@@ -71,13 +47,12 @@ typedef union ktime ktime_t; /* Kill this */
71 * 47 *
72 * Return: The ktime_t representation of the value. 48 * Return: The ktime_t representation of the value.
73 */ 49 */
74static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 50static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs)
75{ 51{
76#if (BITS_PER_LONG == 64)
77 if (unlikely(secs >= KTIME_SEC_MAX)) 52 if (unlikely(secs >= KTIME_SEC_MAX))
78 return (ktime_t){ .tv64 = KTIME_MAX }; 53 return (ktime_t){ .tv64 = KTIME_MAX };
79#endif 54
80 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; 55 return (ktime_t) { .tv64 = secs * NSEC_PER_SEC + (s64)nsecs };
81} 56}
82 57
83/* Subtract two ktime_t variables. rem = lhs -rhs: */ 58/* Subtract two ktime_t variables. rem = lhs -rhs: */
@@ -108,6 +83,12 @@ static inline ktime_t timespec_to_ktime(struct timespec ts)
108 return ktime_set(ts.tv_sec, ts.tv_nsec); 83 return ktime_set(ts.tv_sec, ts.tv_nsec);
109} 84}
110 85
86/* convert a timespec64 to ktime_t format: */
87static inline ktime_t timespec64_to_ktime(struct timespec64 ts)
88{
89 return ktime_set(ts.tv_sec, ts.tv_nsec);
90}
91
111/* convert a timeval to ktime_t format: */ 92/* convert a timeval to ktime_t format: */
112static inline ktime_t timeval_to_ktime(struct timeval tv) 93static inline ktime_t timeval_to_ktime(struct timeval tv)
113{ 94{
@@ -117,159 +98,15 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
117/* Map the ktime_t to timespec conversion to ns_to_timespec function */ 98/* Map the ktime_t to timespec conversion to ns_to_timespec function */
118#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) 99#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
119 100
101/* Map the ktime_t to timespec conversion to ns_to_timespec function */
102#define ktime_to_timespec64(kt) ns_to_timespec64((kt).tv64)
103
120/* Map the ktime_t to timeval conversion to ns_to_timeval function */ 104/* Map the ktime_t to timeval conversion to ns_to_timeval function */
121#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) 105#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
122 106
123/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 107/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
124#define ktime_to_ns(kt) ((kt).tv64) 108#define ktime_to_ns(kt) ((kt).tv64)
125 109
126#else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
127
128/*
129 * Helper macros/inlines to get the ktime_t math right in the timespec
130 * representation. The macros are sometimes ugly - their actual use is
131 * pretty okay-ish, given the circumstances. We do all this for
132 * performance reasons. The pure scalar nsec_t based code was nice and
133 * simple, but created too many 64-bit / 32-bit conversions and divisions.
134 *
135 * Be especially aware that negative values are represented in a way
136 * that the tv.sec field is negative and the tv.nsec field is greater
137 * or equal to zero but less than nanoseconds per second. This is the
138 * same representation which is used by timespecs.
139 *
140 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
141 */
142
143/* Set a ktime_t variable to a value in sec/nsec representation: */
144static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
145{
146 return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
147}
148
149/**
150 * ktime_sub - subtract two ktime_t variables
151 * @lhs: minuend
152 * @rhs: subtrahend
153 *
154 * Return: The remainder of the subtraction.
155 */
156static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157{
158 ktime_t res;
159
160 res.tv64 = lhs.tv64 - rhs.tv64;
161 if (res.tv.nsec < 0)
162 res.tv.nsec += NSEC_PER_SEC;
163
164 return res;
165}
166
167/**
168 * ktime_add - add two ktime_t variables
169 * @add1: addend1
170 * @add2: addend2
171 *
172 * Return: The sum of @add1 and @add2.
173 */
174static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
175{
176 ktime_t res;
177
178 res.tv64 = add1.tv64 + add2.tv64;
179 /*
180 * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx
181 * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit.
182 *
183 * it's equivalent to:
184 * tv.nsec -= NSEC_PER_SEC
185 * tv.sec ++;
186 */
187 if (res.tv.nsec >= NSEC_PER_SEC)
188 res.tv64 += (u32)-NSEC_PER_SEC;
189
190 return res;
191}
192
193/**
194 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
195 * @kt: addend
196 * @nsec: the scalar nsec value to add
197 *
198 * Return: The sum of @kt and @nsec in ktime_t format.
199 */
200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
201
202/**
203 * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable
204 * @kt: minuend
205 * @nsec: the scalar nsec value to subtract
206 *
207 * Return: The subtraction of @nsec from @kt in ktime_t format.
208 */
209extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
210
211/**
212 * timespec_to_ktime - convert a timespec to ktime_t format
213 * @ts: the timespec variable to convert
214 *
215 * Return: A ktime_t variable with the converted timespec value.
216 */
217static inline ktime_t timespec_to_ktime(const struct timespec ts)
218{
219 return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
220 .nsec = (s32)ts.tv_nsec } };
221}
222
223/**
224 * timeval_to_ktime - convert a timeval to ktime_t format
225 * @tv: the timeval variable to convert
226 *
227 * Return: A ktime_t variable with the converted timeval value.
228 */
229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{
231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
232 .nsec = (s32)(tv.tv_usec *
233 NSEC_PER_USEC) } };
234}
235
236/**
237 * ktime_to_timespec - convert a ktime_t variable to timespec format
238 * @kt: the ktime_t variable to convert
239 *
240 * Return: The timespec representation of the ktime value.
241 */
242static inline struct timespec ktime_to_timespec(const ktime_t kt)
243{
244 return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
245 .tv_nsec = (long) kt.tv.nsec };
246}
247
248/**
249 * ktime_to_timeval - convert a ktime_t variable to timeval format
250 * @kt: the ktime_t variable to convert
251 *
252 * Return: The timeval representation of the ktime value.
253 */
254static inline struct timeval ktime_to_timeval(const ktime_t kt)
255{
256 return (struct timeval) {
257 .tv_sec = (time_t) kt.tv.sec,
258 .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) };
259}
260
261/**
262 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
263 * @kt: the ktime_t variable to convert
264 *
265 * Return: The scalar nanoseconds representation of @kt.
266 */
267static inline s64 ktime_to_ns(const ktime_t kt)
268{
269 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
270}
271
272#endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
273 110
274/** 111/**
275 * ktime_equal - Compares two ktime_t variables to see if they are equal 112 * ktime_equal - Compares two ktime_t variables to see if they are equal
@@ -328,16 +165,20 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2)
328 return ktime_compare(cmp1, cmp2) < 0; 165 return ktime_compare(cmp1, cmp2) < 0;
329} 166}
330 167
168#if BITS_PER_LONG < 64
169extern u64 ktime_divns(const ktime_t kt, s64 div);
170#else /* BITS_PER_LONG < 64 */
171# define ktime_divns(kt, div) (u64)((kt).tv64 / (div))
172#endif
173
331static inline s64 ktime_to_us(const ktime_t kt) 174static inline s64 ktime_to_us(const ktime_t kt)
332{ 175{
333 struct timeval tv = ktime_to_timeval(kt); 176 return ktime_divns(kt, NSEC_PER_USEC);
334 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
335} 177}
336 178
337static inline s64 ktime_to_ms(const ktime_t kt) 179static inline s64 ktime_to_ms(const ktime_t kt)
338{ 180{
339 struct timeval tv = ktime_to_timeval(kt); 181 return ktime_divns(kt, NSEC_PER_MSEC);
340 return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
341} 182}
342 183
343static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) 184static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
@@ -381,6 +222,25 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
381 } 222 }
382} 223}
383 224
225/**
226 * ktime_to_timespec64_cond - convert a ktime_t variable to timespec64
227 * format only if the variable contains data
228 * @kt: the ktime_t variable to convert
229 * @ts: the timespec variable to store the result in
230 *
231 * Return: %true if there was a successful conversion, %false if kt was 0.
232 */
233static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt,
234 struct timespec64 *ts)
235{
236 if (kt.tv64) {
237 *ts = ktime_to_timespec64(kt);
238 return true;
239 } else {
240 return false;
241 }
242}
243
384/* 244/*
385 * The resolution of the clocks. The resolution value is returned in 245 * The resolution of the clocks. The resolution value is returned in
386 * the clock_getres() system call to give application programmers an 246 * the clock_getres() system call to give application programmers an
@@ -390,12 +250,6 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
390#define LOW_RES_NSEC TICK_NSEC 250#define LOW_RES_NSEC TICK_NSEC
391#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC } 251#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC }
392 252
393/* Get the monotonic time in timespec format: */
394extern void ktime_get_ts(struct timespec *ts);
395
396/* Get the real (wall-) time in timespec format: */
397#define ktime_get_real_ts(ts) getnstimeofday(ts)
398
399static inline ktime_t ns_to_ktime(u64 ns) 253static inline ktime_t ns_to_ktime(u64 ns)
400{ 254{
401 static const ktime_t ktime_zero = { .tv64 = 0 }; 255 static const ktime_t ktime_zero = { .tv64 = 0 };
@@ -410,4 +264,6 @@ static inline ktime_t ms_to_ktime(u64 ms)
410 return ktime_add_ms(ktime_zero, ms); 264 return ktime_add_ms(ktime_zero, ms);
411} 265}
412 266
267# include <linux/timekeeping.h>
268
413#endif 269#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ec4e3bd83d47..a4c33b34fe3f 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -325,24 +325,7 @@ struct kvm_kernel_irq_routing_entry {
325 struct hlist_node link; 325 struct hlist_node link;
326}; 326};
327 327
328#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 328struct kvm_irq_routing_table;
329
330struct kvm_irq_routing_table {
331 int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
332 struct kvm_kernel_irq_routing_entry *rt_entries;
333 u32 nr_rt_entries;
334 /*
335 * Array indexed by gsi. Each entry contains list of irq chips
336 * the gsi is connected to.
337 */
338 struct hlist_head map[0];
339};
340
341#else
342
343struct kvm_irq_routing_table {};
344
345#endif
346 329
347#ifndef KVM_PRIVATE_MEM_SLOTS 330#ifndef KVM_PRIVATE_MEM_SLOTS
348#define KVM_PRIVATE_MEM_SLOTS 0 331#define KVM_PRIVATE_MEM_SLOTS 0
@@ -401,11 +384,12 @@ struct kvm {
401 struct mutex irq_lock; 384 struct mutex irq_lock;
402#ifdef CONFIG_HAVE_KVM_IRQCHIP 385#ifdef CONFIG_HAVE_KVM_IRQCHIP
403 /* 386 /*
404 * Update side is protected by irq_lock and, 387 * Update side is protected by irq_lock.
405 * if configured, irqfds.lock.
406 */ 388 */
407 struct kvm_irq_routing_table __rcu *irq_routing; 389 struct kvm_irq_routing_table __rcu *irq_routing;
408 struct hlist_head mask_notifier_list; 390 struct hlist_head mask_notifier_list;
391#endif
392#ifdef CONFIG_HAVE_KVM_IRQFD
409 struct hlist_head irq_ack_notifier_list; 393 struct hlist_head irq_ack_notifier_list;
410#endif 394#endif
411 395
@@ -455,7 +439,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
455int __must_check vcpu_load(struct kvm_vcpu *vcpu); 439int __must_check vcpu_load(struct kvm_vcpu *vcpu);
456void vcpu_put(struct kvm_vcpu *vcpu); 440void vcpu_put(struct kvm_vcpu *vcpu);
457 441
458#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 442#ifdef CONFIG_HAVE_KVM_IRQFD
459int kvm_irqfd_init(void); 443int kvm_irqfd_init(void);
460void kvm_irqfd_exit(void); 444void kvm_irqfd_exit(void);
461#else 445#else
@@ -602,7 +586,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
602 unsigned int ioctl, unsigned long arg); 586 unsigned int ioctl, unsigned long arg);
603int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); 587int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
604 588
605int kvm_dev_ioctl_check_extension(long ext); 589int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
606 590
607int kvm_get_dirty_log(struct kvm *kvm, 591int kvm_get_dirty_log(struct kvm *kvm,
608 struct kvm_dirty_log *log, int *is_dirty); 592 struct kvm_dirty_log *log, int *is_dirty);
@@ -752,6 +736,10 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
752void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, 736void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
753 bool mask); 737 bool mask);
754 738
739int kvm_irq_map_gsi(struct kvm *kvm,
740 struct kvm_kernel_irq_routing_entry *entries, int gsi);
741int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin);
742
755int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, 743int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
756 bool line_status); 744 bool line_status);
757int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); 745int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
@@ -942,28 +930,27 @@ int kvm_set_irq_routing(struct kvm *kvm,
942 const struct kvm_irq_routing_entry *entries, 930 const struct kvm_irq_routing_entry *entries,
943 unsigned nr, 931 unsigned nr,
944 unsigned flags); 932 unsigned flags);
945int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, 933int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
946 struct kvm_kernel_irq_routing_entry *e,
947 const struct kvm_irq_routing_entry *ue); 934 const struct kvm_irq_routing_entry *ue);
948void kvm_free_irq_routing(struct kvm *kvm); 935void kvm_free_irq_routing(struct kvm *kvm);
949 936
950int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
951
952#else 937#else
953 938
954static inline void kvm_free_irq_routing(struct kvm *kvm) {} 939static inline void kvm_free_irq_routing(struct kvm *kvm) {}
955 940
956#endif 941#endif
957 942
943int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
944
958#ifdef CONFIG_HAVE_KVM_EVENTFD 945#ifdef CONFIG_HAVE_KVM_EVENTFD
959 946
960void kvm_eventfd_init(struct kvm *kvm); 947void kvm_eventfd_init(struct kvm *kvm);
961int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 948int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
962 949
963#ifdef CONFIG_HAVE_KVM_IRQCHIP 950#ifdef CONFIG_HAVE_KVM_IRQFD
964int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 951int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
965void kvm_irqfd_release(struct kvm *kvm); 952void kvm_irqfd_release(struct kvm *kvm);
966void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 953void kvm_irq_routing_update(struct kvm *);
967#else 954#else
968static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) 955static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
969{ 956{
@@ -985,10 +972,8 @@ static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
985static inline void kvm_irqfd_release(struct kvm *kvm) {} 972static inline void kvm_irqfd_release(struct kvm *kvm) {}
986 973
987#ifdef CONFIG_HAVE_KVM_IRQCHIP 974#ifdef CONFIG_HAVE_KVM_IRQCHIP
988static inline void kvm_irq_routing_update(struct kvm *kvm, 975static inline void kvm_irq_routing_update(struct kvm *kvm)
989 struct kvm_irq_routing_table *irq_rt)
990{ 976{
991 rcu_assign_pointer(kvm->irq_routing, irq_rt);
992} 977}
993#endif 978#endif
994 979
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0287ab296689..6a599dce7f9d 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -15,7 +15,6 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/timer.h>
19#include <linux/workqueue.h> 18#include <linux/workqueue.h>
20 19
21struct device; 20struct device;
@@ -63,11 +62,13 @@ struct led_classdev {
63 unsigned long *delay_off); 62 unsigned long *delay_off);
64 63
65 struct device *dev; 64 struct device *dev;
65 const struct attribute_group **groups;
66
66 struct list_head node; /* LED Device list */ 67 struct list_head node; /* LED Device list */
67 const char *default_trigger; /* Trigger to use */ 68 const char *default_trigger; /* Trigger to use */
68 69
69 unsigned long blink_delay_on, blink_delay_off; 70 unsigned long blink_delay_on, blink_delay_off;
70 struct timer_list blink_timer; 71 struct delayed_work blink_work;
71 int blink_brightness; 72 int blink_brightness;
72 73
73 struct work_struct set_brightness_work; 74 struct work_struct set_brightness_work;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5ab4e3a76721..92abb497ab14 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -593,6 +593,7 @@ struct ata_host {
593 struct device *dev; 593 struct device *dev;
594 void __iomem * const *iomap; 594 void __iomem * const *iomap;
595 unsigned int n_ports; 595 unsigned int n_ports;
596 unsigned int n_tags; /* nr of NCQ tags */
596 void *private_data; 597 void *private_data;
597 struct ata_port_operations *ops; 598 struct ata_port_operations *ops;
598 unsigned long flags; 599 unsigned long flags;
diff --git a/include/linux/list.h b/include/linux/list.h
index ef9594171062..cbbb96fcead9 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -654,15 +654,15 @@ static inline void hlist_add_before(struct hlist_node *n,
654 *(n->pprev) = n; 654 *(n->pprev) = n;
655} 655}
656 656
657static inline void hlist_add_after(struct hlist_node *n, 657static inline void hlist_add_behind(struct hlist_node *n,
658 struct hlist_node *next) 658 struct hlist_node *prev)
659{ 659{
660 next->next = n->next; 660 n->next = prev->next;
661 n->next = next; 661 prev->next = n;
662 next->pprev = &n->next; 662 n->pprev = &prev->next;
663 663
664 if(next->next) 664 if (n->next)
665 next->next->pprev = &next->next; 665 n->next->pprev = &n->next;
666} 666}
667 667
668/* after that we'll appear to be on some hlist and hlist_del will work */ 668/* after that we'll appear to be on some hlist and hlist_del will work */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index b660e05b63d4..e8cc45307f8f 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -249,7 +249,7 @@ phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
249/* 249/*
250 * Set the allocation direction to bottom-up or top-down. 250 * Set the allocation direction to bottom-up or top-down.
251 */ 251 */
252static inline void memblock_set_bottom_up(bool enable) 252static inline void __init memblock_set_bottom_up(bool enable)
253{ 253{
254 memblock.bottom_up = enable; 254 memblock.bottom_up = enable;
255} 255}
@@ -264,7 +264,7 @@ static inline bool memblock_bottom_up(void)
264 return memblock.bottom_up; 264 return memblock.bottom_up;
265} 265}
266#else 266#else
267static inline void memblock_set_bottom_up(bool enable) {} 267static inline void __init memblock_set_bottom_up(bool enable) {}
268static inline bool memblock_bottom_up(void) { return false; } 268static inline bool memblock_bottom_up(void) { return false; }
269#endif 269#endif
270 270
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index eb65d29516ca..e0752d204d9e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -54,39 +54,20 @@ struct mem_cgroup_reclaim_cookie {
54}; 54};
55 55
56#ifdef CONFIG_MEMCG 56#ifdef CONFIG_MEMCG
57/* 57int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
58 * All "charge" functions with gfp_mask should use GFP_KERNEL or 58 gfp_t gfp_mask, struct mem_cgroup **memcgp);
59 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't 59void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg,
60 * alloc memory but reclaims memory from all available zones. So, "where I want 60 bool lrucare);
61 * memory from" bits of gfp_mask has no meaning. So any bits of that field is 61void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg);
62 * available but adding a rule is better. charge functions' gfp_mask should 62void mem_cgroup_uncharge(struct page *page);
63 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous 63void mem_cgroup_uncharge_list(struct list_head *page_list);
64 * codes.
65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
66 */
67 64
68extern int mem_cgroup_charge_anon(struct page *page, struct mm_struct *mm, 65void mem_cgroup_migrate(struct page *oldpage, struct page *newpage,
69 gfp_t gfp_mask); 66 bool lrucare);
70/* for swap handling */
71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
72 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
73extern void mem_cgroup_commit_charge_swapin(struct page *page,
74 struct mem_cgroup *memcg);
75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
76
77extern int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm,
78 gfp_t gfp_mask);
79 67
80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 68struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
81struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *); 69struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *);
82 70
83/* For coalescing uncharge for reducing memcg' overhead*/
84extern void mem_cgroup_uncharge_start(void);
85extern void mem_cgroup_uncharge_end(void);
86
87extern void mem_cgroup_uncharge_page(struct page *page);
88extern void mem_cgroup_uncharge_cache_page(struct page *page);
89
90bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 71bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
91 struct mem_cgroup *memcg); 72 struct mem_cgroup *memcg);
92bool task_in_mem_cgroup(struct task_struct *task, 73bool task_in_mem_cgroup(struct task_struct *task,
@@ -113,12 +94,6 @@ bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
113 94
114extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg); 95extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
115 96
116extern void
117mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
118 struct mem_cgroup **memcgp);
119extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
120 struct page *oldpage, struct page *newpage, bool migration_ok);
121
122struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *, 97struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
123 struct mem_cgroup *, 98 struct mem_cgroup *,
124 struct mem_cgroup_reclaim_cookie *); 99 struct mem_cgroup_reclaim_cookie *);
@@ -133,8 +108,6 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
133void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int); 108void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
134extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 109extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
135 struct task_struct *p); 110 struct task_struct *p);
136extern void mem_cgroup_replace_page_cache(struct page *oldpage,
137 struct page *newpage);
138 111
139static inline void mem_cgroup_oom_enable(void) 112static inline void mem_cgroup_oom_enable(void)
140{ 113{
@@ -233,46 +206,36 @@ void mem_cgroup_print_bad_page(struct page *page);
233#else /* CONFIG_MEMCG */ 206#else /* CONFIG_MEMCG */
234struct mem_cgroup; 207struct mem_cgroup;
235 208
236static inline int mem_cgroup_charge_anon(struct page *page, 209static inline int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
237 struct mm_struct *mm, gfp_t gfp_mask) 210 gfp_t gfp_mask,
238{ 211 struct mem_cgroup **memcgp)
239 return 0;
240}
241
242static inline int mem_cgroup_charge_file(struct page *page,
243 struct mm_struct *mm, gfp_t gfp_mask)
244{
245 return 0;
246}
247
248static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
249 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp)
250{ 212{
213 *memcgp = NULL;
251 return 0; 214 return 0;
252} 215}
253 216
254static inline void mem_cgroup_commit_charge_swapin(struct page *page, 217static inline void mem_cgroup_commit_charge(struct page *page,
255 struct mem_cgroup *memcg) 218 struct mem_cgroup *memcg,
256{ 219 bool lrucare)
257}
258
259static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
260{ 220{
261} 221}
262 222
263static inline void mem_cgroup_uncharge_start(void) 223static inline void mem_cgroup_cancel_charge(struct page *page,
224 struct mem_cgroup *memcg)
264{ 225{
265} 226}
266 227
267static inline void mem_cgroup_uncharge_end(void) 228static inline void mem_cgroup_uncharge(struct page *page)
268{ 229{
269} 230}
270 231
271static inline void mem_cgroup_uncharge_page(struct page *page) 232static inline void mem_cgroup_uncharge_list(struct list_head *page_list)
272{ 233{
273} 234}
274 235
275static inline void mem_cgroup_uncharge_cache_page(struct page *page) 236static inline void mem_cgroup_migrate(struct page *oldpage,
237 struct page *newpage,
238 bool lrucare)
276{ 239{
277} 240}
278 241
@@ -311,17 +274,6 @@ static inline struct cgroup_subsys_state
311 return NULL; 274 return NULL;
312} 275}
313 276
314static inline void
315mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
316 struct mem_cgroup **memcgp)
317{
318}
319
320static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
321 struct page *oldpage, struct page *newpage, bool migration_ok)
322{
323}
324
325static inline struct mem_cgroup * 277static inline struct mem_cgroup *
326mem_cgroup_iter(struct mem_cgroup *root, 278mem_cgroup_iter(struct mem_cgroup *root,
327 struct mem_cgroup *prev, 279 struct mem_cgroup *prev,
@@ -417,10 +369,6 @@ static inline
417void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 369void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
418{ 370{
419} 371}
420static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
421 struct page *newpage)
422{
423}
424#endif /* CONFIG_MEMCG */ 372#endif /* CONFIG_MEMCG */
425 373
426#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM) 374#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 010d125bffbf..d9524c49d767 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -26,11 +26,12 @@ enum {
26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO, 26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
27}; 27};
28 28
29/* Types for control the zone type of onlined memory */ 29/* Types for control the zone type of onlined and offlined memory */
30enum { 30enum {
31 ONLINE_KEEP, 31 MMOP_OFFLINE = -1,
32 ONLINE_KERNEL, 32 MMOP_ONLINE_KEEP,
33 ONLINE_MOVABLE, 33 MMOP_ONLINE_KERNEL,
34 MMOP_ONLINE_MOVABLE,
34}; 35};
35 36
36/* 37/*
@@ -258,6 +259,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
258extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 259extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
259 void *arg, int (*func)(struct memory_block *, void *)); 260 void *arg, int (*func)(struct memory_block *, void *));
260extern int add_memory(int nid, u64 start, u64 size); 261extern int add_memory(int nid, u64 start, u64 size);
262extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
261extern int arch_add_memory(int nid, u64 start, u64 size); 263extern int arch_add_memory(int nid, u64 start, u64 size);
262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 264extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
263extern bool is_memblock_offlined(struct memory_block *mem); 265extern bool is_memblock_offlined(struct memory_block *mem);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 4e7fe7417fc9..9475fee2bfc5 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -505,6 +505,7 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
505void ab8500_override_turn_on_stat(u8 mask, u8 set); 505void ab8500_override_turn_on_stat(u8 mask, u8 set);
506 506
507#ifdef CONFIG_AB8500_DEBUG 507#ifdef CONFIG_AB8500_DEBUG
508extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
508void ab8500_dump_all_banks(struct device *dev); 509void ab8500_dump_all_banks(struct device *dev);
509void ab8500_debug_register_interrupt(int line); 510void ab8500_debug_register_interrupt(int line);
510#else 511#else
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 6d9371f88875..f34723f7663c 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -18,7 +18,7 @@
18#include <linux/regulator/consumer.h> 18#include <linux/regulator/consumer.h>
19#include <linux/mfd/arizona/pdata.h> 19#include <linux/mfd/arizona/pdata.h>
20 20
21#define ARIZONA_MAX_CORE_SUPPLIES 3 21#define ARIZONA_MAX_CORE_SUPPLIES 2
22 22
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
@@ -46,8 +46,8 @@ enum arizona_type {
46#define ARIZONA_IRQ_DSP_IRQ6 17 46#define ARIZONA_IRQ_DSP_IRQ6 17
47#define ARIZONA_IRQ_DSP_IRQ7 18 47#define ARIZONA_IRQ_DSP_IRQ7 18
48#define ARIZONA_IRQ_DSP_IRQ8 19 48#define ARIZONA_IRQ_DSP_IRQ8 19
49#define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 20 49#define ARIZONA_IRQ_SPK_OVERHEAT_WARN 20
50#define ARIZONA_IRQ_SPK_SHUTDOWN 21 50#define ARIZONA_IRQ_SPK_OVERHEAT 21
51#define ARIZONA_IRQ_MICDET 22 51#define ARIZONA_IRQ_MICDET 22
52#define ARIZONA_IRQ_HPDET 23 52#define ARIZONA_IRQ_HPDET 23
53#define ARIZONA_IRQ_WSEQ_DONE 24 53#define ARIZONA_IRQ_WSEQ_DONE 24
@@ -78,8 +78,31 @@ enum arizona_type {
78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49 78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50 79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50
80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51 80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51
81 81#define ARIZONA_IRQ_HP3R_DONE 52
82#define ARIZONA_NUM_IRQ 52 82#define ARIZONA_IRQ_HP3L_DONE 53
83#define ARIZONA_IRQ_HP2R_DONE 54
84#define ARIZONA_IRQ_HP2L_DONE 55
85#define ARIZONA_IRQ_HP1R_DONE 56
86#define ARIZONA_IRQ_HP1L_DONE 57
87#define ARIZONA_IRQ_ISRC3_CFG_ERR 58
88#define ARIZONA_IRQ_DSP_SHARED_WR_COLL 59
89#define ARIZONA_IRQ_SPK_SHUTDOWN 60
90#define ARIZONA_IRQ_SPK1R_SHORT 61
91#define ARIZONA_IRQ_SPK1L_SHORT 62
92#define ARIZONA_IRQ_HP3R_SC_NEG 63
93#define ARIZONA_IRQ_HP3R_SC_POS 64
94#define ARIZONA_IRQ_HP3L_SC_NEG 65
95#define ARIZONA_IRQ_HP3L_SC_POS 66
96#define ARIZONA_IRQ_HP2R_SC_NEG 67
97#define ARIZONA_IRQ_HP2R_SC_POS 68
98#define ARIZONA_IRQ_HP2L_SC_NEG 69
99#define ARIZONA_IRQ_HP2L_SC_POS 70
100#define ARIZONA_IRQ_HP1R_SC_NEG 71
101#define ARIZONA_IRQ_HP1R_SC_POS 72
102#define ARIZONA_IRQ_HP1L_SC_NEG 73
103#define ARIZONA_IRQ_HP1L_SC_POS 74
104
105#define ARIZONA_NUM_IRQ 75
83 106
84struct snd_soc_dapm_context; 107struct snd_soc_dapm_context;
85 108
@@ -109,7 +132,15 @@ struct arizona {
109 struct mutex clk_lock; 132 struct mutex clk_lock;
110 int clk32k_ref; 133 int clk32k_ref;
111 134
135 bool ctrlif_error;
136
112 struct snd_soc_dapm_context *dapm; 137 struct snd_soc_dapm_context *dapm;
138
139 int tdm_width[ARIZONA_MAX_AIF];
140 int tdm_slots[ARIZONA_MAX_AIF];
141
142 uint16_t dac_comp_coeff;
143 uint8_t dac_comp_enabled;
113}; 144};
114 145
115int arizona_clk32k_enable(struct arizona *arizona); 146int arizona_clk32k_enable(struct arizona *arizona);
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 12a5c135c746..4578c72c9b86 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -127,6 +127,9 @@ struct arizona_pdata {
127 /** Internal pull on GPIO5 is disabled when used for jack detection */ 127 /** Internal pull on GPIO5 is disabled when used for jack detection */
128 bool jd_gpio5_nopull; 128 bool jd_gpio5_nopull;
129 129
130 /** set to true if jackdet contact opens on insert */
131 bool jd_invert;
132
130 /** Use the headphone detect circuit to identify the accessory */ 133 /** Use the headphone detect circuit to identify the accessory */
131 bool hpdet_acc_id; 134 bool hpdet_acc_id;
132 135
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7204d8138b24..dbd23c36de21 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -878,22 +878,26 @@
878#define ARIZONA_INTERRUPT_STATUS_3 0xD02 878#define ARIZONA_INTERRUPT_STATUS_3 0xD02
879#define ARIZONA_INTERRUPT_STATUS_4 0xD03 879#define ARIZONA_INTERRUPT_STATUS_4 0xD03
880#define ARIZONA_INTERRUPT_STATUS_5 0xD04 880#define ARIZONA_INTERRUPT_STATUS_5 0xD04
881#define ARIZONA_INTERRUPT_STATUS_6 0xD05
881#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08 882#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08
882#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09 883#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09
883#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A 884#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A
884#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B 885#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B
885#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C 886#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C
887#define ARIZONA_INTERRUPT_STATUS_6_MASK 0xD0D
886#define ARIZONA_INTERRUPT_CONTROL 0xD0F 888#define ARIZONA_INTERRUPT_CONTROL 0xD0F
887#define ARIZONA_IRQ2_STATUS_1 0xD10 889#define ARIZONA_IRQ2_STATUS_1 0xD10
888#define ARIZONA_IRQ2_STATUS_2 0xD11 890#define ARIZONA_IRQ2_STATUS_2 0xD11
889#define ARIZONA_IRQ2_STATUS_3 0xD12 891#define ARIZONA_IRQ2_STATUS_3 0xD12
890#define ARIZONA_IRQ2_STATUS_4 0xD13 892#define ARIZONA_IRQ2_STATUS_4 0xD13
891#define ARIZONA_IRQ2_STATUS_5 0xD14 893#define ARIZONA_IRQ2_STATUS_5 0xD14
894#define ARIZONA_IRQ2_STATUS_6 0xD15
892#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18 895#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18
893#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19 896#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19
894#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A 897#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A
895#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B 898#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B
896#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C 899#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C
900#define ARIZONA_IRQ2_STATUS_6_MASK 0xD1D
897#define ARIZONA_IRQ2_CONTROL 0xD1F 901#define ARIZONA_IRQ2_CONTROL 0xD1F
898#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20 902#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20
899#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21 903#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21
@@ -902,6 +906,7 @@
902#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24 906#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24
903#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25 907#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25
904#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26 908#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26
909#define ARIZONA_INTERRUPT_RAW_STATUS_9 0xD28
905#define ARIZONA_IRQ_PIN_STATUS 0xD40 910#define ARIZONA_IRQ_PIN_STATUS 0xD40
906#define ARIZONA_ADSP2_IRQ0 0xD41 911#define ARIZONA_ADSP2_IRQ0 0xD41
907#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50 912#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50
@@ -4691,14 +4696,14 @@
4691/* 4696/*
4692 * R3330 (0xD02) - Interrupt Status 3 4697 * R3330 (0xD02) - Interrupt Status 3
4693 */ 4698 */
4694#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4699#define ARIZONA_SPK_OVERHEAT_WARN_EINT1 0x8000 /* SPK_OVERHEAT_WARN_EINT1 */
4695#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4700#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* SPK_OVERHEAD_WARN_EINT1 */
4696#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT1 */ 4701#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT1 */
4697#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT1 */ 4702#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT1 */
4698#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4703#define ARIZONA_SPK_OVERHEAT_EINT1 0x4000 /* SPK_OVERHEAT_EINT1 */
4699#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4704#define ARIZONA_SPK_OVERHEAT_EINT1_MASK 0x4000 /* SPK_OVERHEAT_EINT1 */
4700#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */ 4705#define ARIZONA_SPK_OVERHEAT_EINT1_SHIFT 14 /* SPK_OVERHEAT_EINT1 */
4701#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */ 4706#define ARIZONA_SPK_OVERHEAT_EINT1_WIDTH 1 /* SPK_OVERHEAT_EINT1 */
4702#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */ 4707#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */
4703#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */ 4708#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */
4704#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */ 4709#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */
@@ -4795,6 +4800,77 @@
4795#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */ 4800#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */
4796#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */ 4801#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */
4797#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */ 4802#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4803#define ARIZONA_HP3R_DONE_EINT1 0x0020 /* HP3R_DONE_EINT1 */
4804#define ARIZONA_HP3R_DONE_EINT1_MASK 0x0020 /* HP3R_DONE_EINT1 */
4805#define ARIZONA_HP3R_DONE_EINT1_SHIFT 5 /* HP3R_DONE_EINT1 */
4806#define ARIZONA_HP3R_DONE_EINT1_WIDTH 1 /* HP3R_DONE_EINT1 */
4807#define ARIZONA_HP3L_DONE_EINT1 0x0010 /* HP3L_DONE_EINT1 */
4808#define ARIZONA_HP3L_DONE_EINT1_MASK 0x0010 /* HP3L_DONE_EINT1 */
4809#define ARIZONA_HP3L_DONE_EINT1_SHIFT 4 /* HP3L_DONE_EINT1 */
4810#define ARIZONA_HP3L_DONE_EINT1_WIDTH 1 /* HP3L_DONE_EINT1 */
4811#define ARIZONA_HP2R_DONE_EINT1 0x0008 /* HP2R_DONE_EINT1 */
4812#define ARIZONA_HP2R_DONE_EINT1_MASK 0x0008 /* HP2R_DONE_EINT1 */
4813#define ARIZONA_HP2R_DONE_EINT1_SHIFT 3 /* HP2R_DONE_EINT1 */
4814#define ARIZONA_HP2R_DONE_EINT1_WIDTH 1 /* HP2R_DONE_EINT1 */
4815#define ARIZONA_HP2L_DONE_EINT1 0x0004 /* HP2L_DONE_EINT1 */
4816#define ARIZONA_HP2L_DONE_EINT1_MASK 0x0004 /* HP2L_DONE_EINT1 */
4817#define ARIZONA_HP2L_DONE_EINT1_SHIFT 2 /* HP2L_DONE_EINT1 */
4818#define ARIZONA_HP2L_DONE_EINT1_WIDTH 1 /* HP2L_DONE_EINT1 */
4819#define ARIZONA_HP1R_DONE_EINT1 0x0002 /* HP1R_DONE_EINT1 */
4820#define ARIZONA_HP1R_DONE_EINT1_MASK 0x0002 /* HP1R_DONE_EINT1 */
4821#define ARIZONA_HP1R_DONE_EINT1_SHIFT 1 /* HP1R_DONE_EINT1 */
4822#define ARIZONA_HP1R_DONE_EINT1_WIDTH 1 /* HP1R_DONE_EINT1 */
4823#define ARIZONA_HP1L_DONE_EINT1 0x0001 /* HP1L_DONE_EINT1 */
4824#define ARIZONA_HP1L_DONE_EINT1_MASK 0x0001 /* HP1L_DONE_EINT1 */
4825#define ARIZONA_HP1L_DONE_EINT1_SHIFT 0 /* HP1L_DONE_EINT1 */
4826#define ARIZONA_HP1L_DONE_EINT1_WIDTH 1 /* HP1L_DONE_EINT1 */
4827
4828/*
4829 * R3331 (0xD03) - Interrupt Status 4 (Alternate layout)
4830 *
4831 * Alternate layout used on later devices, note only fields that have moved
4832 * are specified
4833 */
4834#define ARIZONA_V2_AIF3_ERR_EINT1 0x8000 /* AIF3_ERR_EINT1 */
4835#define ARIZONA_V2_AIF3_ERR_EINT1_MASK 0x8000 /* AIF3_ERR_EINT1 */
4836#define ARIZONA_V2_AIF3_ERR_EINT1_SHIFT 15 /* AIF3_ERR_EINT1 */
4837#define ARIZONA_V2_AIF3_ERR_EINT1_WIDTH 1 /* AIF3_ERR_EINT1 */
4838#define ARIZONA_V2_AIF2_ERR_EINT1 0x4000 /* AIF2_ERR_EINT1 */
4839#define ARIZONA_V2_AIF2_ERR_EINT1_MASK 0x4000 /* AIF2_ERR_EINT1 */
4840#define ARIZONA_V2_AIF2_ERR_EINT1_SHIFT 14 /* AIF2_ERR_EINT1 */
4841#define ARIZONA_V2_AIF2_ERR_EINT1_WIDTH 1 /* AIF2_ERR_EINT1 */
4842#define ARIZONA_V2_AIF1_ERR_EINT1 0x2000 /* AIF1_ERR_EINT1 */
4843#define ARIZONA_V2_AIF1_ERR_EINT1_MASK 0x2000 /* AIF1_ERR_EINT1 */
4844#define ARIZONA_V2_AIF1_ERR_EINT1_SHIFT 13 /* AIF1_ERR_EINT1 */
4845#define ARIZONA_V2_AIF1_ERR_EINT1_WIDTH 1 /* AIF1_ERR_EINT1 */
4846#define ARIZONA_V2_CTRLIF_ERR_EINT1 0x1000 /* CTRLIF_ERR_EINT1 */
4847#define ARIZONA_V2_CTRLIF_ERR_EINT1_MASK 0x1000 /* CTRLIF_ERR_EINT1 */
4848#define ARIZONA_V2_CTRLIF_ERR_EINT1_SHIFT 12 /* CTRLIF_ERR_EINT1 */
4849#define ARIZONA_V2_CTRLIF_ERR_EINT1_WIDTH 1 /* CTRLIF_ERR_EINT1 */
4850#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4851#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4852#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT1 */
4853#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT1 */
4854#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4855#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4856#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT1 */
4857#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT1 */
4858#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4859#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4860#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* SYSCLK_ENA_LOW_EINT1 */
4861#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* SYSCLK_ENA_LOW_EINT1 */
4862#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4863#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4864#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* ISRC1_CFG_ERR_EINT1 */
4865#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* ISRC1_CFG_ERR_EINT1 */
4866#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4867#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4868#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* ISRC2_CFG_ERR_EINT1 */
4869#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4870#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4871#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4872#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* ISRC3_CFG_ERR_EINT1 */
4873#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* ISRC3_CFG_ERR_EINT1 */
4798 4874
4799/* 4875/*
4800 * R3332 (0xD04) - Interrupt Status 5 4876 * R3332 (0xD04) - Interrupt Status 5
@@ -4821,6 +4897,85 @@
4821#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */ 4897#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */
4822 4898
4823/* 4899/*
4900 * R3332 (0xD05) - Interrupt Status 5 (Alternate layout)
4901 *
4902 * Alternate layout used on later devices, note only fields that have moved
4903 * are specified
4904 */
4905#define ARIZONA_V2_ASRC_CFG_ERR_EINT1 0x0008 /* ASRC_CFG_ERR_EINT1 */
4906#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* ASRC_CFG_ERR_EINT1 */
4907#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_SHIFT 3 /* ASRC_CFG_ERR_EINT1 */
4908#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_WIDTH 1 /* ASRC_CFG_ERR_EINT1 */
4909
4910/*
4911 * R3333 (0xD05) - Interrupt Status 6
4912 */
4913#define ARIZONA_DSP_SHARED_WR_COLL_EINT1 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4914#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4915#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT1 */
4916#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT1 */
4917#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */
4918#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */
4919#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */
4920#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */
4921#define ARIZONA_SPK1R_SHORT_EINT1 0x2000 /* SPK1R_SHORT_EINT1 */
4922#define ARIZONA_SPK1R_SHORT_EINT1_MASK 0x2000 /* SPK1R_SHORT_EINT1 */
4923#define ARIZONA_SPK1R_SHORT_EINT1_SHIFT 13 /* SPK1R_SHORT_EINT1 */
4924#define ARIZONA_SPK1R_SHORT_EINT1_WIDTH 1 /* SPK1R_SHORT_EINT1 */
4925#define ARIZONA_SPK1L_SHORT_EINT1 0x1000 /* SPK1L_SHORT_EINT1 */
4926#define ARIZONA_SPK1L_SHORT_EINT1_MASK 0x1000 /* SPK1L_SHORT_EINT1 */
4927#define ARIZONA_SPK1L_SHORT_EINT1_SHIFT 12 /* SPK1L_SHORT_EINT1 */
4928#define ARIZONA_SPK1L_SHORT_EINT1_WIDTH 1 /* SPK1L_SHORT_EINT1 */
4929#define ARIZONA_HP3R_SC_NEG_EINT1 0x0800 /* HP3R_SC_NEG_EINT1 */
4930#define ARIZONA_HP3R_SC_NEG_EINT1_MASK 0x0800 /* HP3R_SC_NEG_EINT1 */
4931#define ARIZONA_HP3R_SC_NEG_EINT1_SHIFT 11 /* HP3R_SC_NEG_EINT1 */
4932#define ARIZONA_HP3R_SC_NEG_EINT1_WIDTH 1 /* HP3R_SC_NEG_EINT1 */
4933#define ARIZONA_HP3R_SC_POS_EINT1 0x0400 /* HP3R_SC_POS_EINT1 */
4934#define ARIZONA_HP3R_SC_POS_EINT1_MASK 0x0400 /* HP3R_SC_POS_EINT1 */
4935#define ARIZONA_HP3R_SC_POS_EINT1_SHIFT 10 /* HP3R_SC_POS_EINT1 */
4936#define ARIZONA_HP3R_SC_POS_EINT1_WIDTH 1 /* HP3R_SC_POS_EINT1 */
4937#define ARIZONA_HP3L_SC_NEG_EINT1 0x0200 /* HP3L_SC_NEG_EINT1 */
4938#define ARIZONA_HP3L_SC_NEG_EINT1_MASK 0x0200 /* HP3L_SC_NEG_EINT1 */
4939#define ARIZONA_HP3L_SC_NEG_EINT1_SHIFT 9 /* HP3L_SC_NEG_EINT1 */
4940#define ARIZONA_HP3L_SC_NEG_EINT1_WIDTH 1 /* HP3L_SC_NEG_EINT1 */
4941#define ARIZONA_HP3L_SC_POS_EINT1 0x0100 /* HP3L_SC_POS_EINT1 */
4942#define ARIZONA_HP3L_SC_POS_EINT1_MASK 0x0100 /* HP3L_SC_POS_EINT1 */
4943#define ARIZONA_HP3L_SC_POS_EINT1_SHIFT 8 /* HP3L_SC_POS_EINT1 */
4944#define ARIZONA_HP3L_SC_POS_EINT1_WIDTH 1 /* HP3L_SC_POS_EINT1 */
4945#define ARIZONA_HP2R_SC_NEG_EINT1 0x0080 /* HP2R_SC_NEG_EINT1 */
4946#define ARIZONA_HP2R_SC_NEG_EINT1_MASK 0x0080 /* HP2R_SC_NEG_EINT1 */
4947#define ARIZONA_HP2R_SC_NEG_EINT1_SHIFT 7 /* HP2R_SC_NEG_EINT1 */
4948#define ARIZONA_HP2R_SC_NEG_EINT1_WIDTH 1 /* HP2R_SC_NEG_EINT1 */
4949#define ARIZONA_HP2R_SC_POS_EINT1 0x0040 /* HP2R_SC_POS_EINT1 */
4950#define ARIZONA_HP2R_SC_POS_EINT1_MASK 0x0040 /* HP2R_SC_POS_EINT1 */
4951#define ARIZONA_HP2R_SC_POS_EINT1_SHIFT 6 /* HP2R_SC_POS_EINT1 */
4952#define ARIZONA_HP2R_SC_POS_EINT1_WIDTH 1 /* HP2R_SC_POS_EINT1 */
4953#define ARIZONA_HP2L_SC_NEG_EINT1 0x0020 /* HP2L_SC_NEG_EINT1 */
4954#define ARIZONA_HP2L_SC_NEG_EINT1_MASK 0x0020 /* HP2L_SC_NEG_EINT1 */
4955#define ARIZONA_HP2L_SC_NEG_EINT1_SHIFT 5 /* HP2L_SC_NEG_EINT1 */
4956#define ARIZONA_HP2L_SC_NEG_EINT1_WIDTH 1 /* HP2L_SC_NEG_EINT1 */
4957#define ARIZONA_HP2L_SC_POS_EINT1 0x0010 /* HP2L_SC_POS_EINT1 */
4958#define ARIZONA_HP2L_SC_POS_EINT1_MASK 0x0010 /* HP2L_SC_POS_EINT1 */
4959#define ARIZONA_HP2L_SC_POS_EINT1_SHIFT 4 /* HP2L_SC_POS_EINT1 */
4960#define ARIZONA_HP2L_SC_POS_EINT1_WIDTH 1 /* HP2L_SC_POS_EINT1 */
4961#define ARIZONA_HP1R_SC_NEG_EINT1 0x0008 /* HP1R_SC_NEG_EINT1 */
4962#define ARIZONA_HP1R_SC_NEG_EINT1_MASK 0x0008 /* HP1R_SC_NEG_EINT1 */
4963#define ARIZONA_HP1R_SC_NEG_EINT1_SHIFT 3 /* HP1R_SC_NEG_EINT1 */
4964#define ARIZONA_HP1R_SC_NEG_EINT1_WIDTH 1 /* HP1R_SC_NEG_EINT1 */
4965#define ARIZONA_HP1R_SC_POS_EINT1 0x0004 /* HP1R_SC_POS_EINT1 */
4966#define ARIZONA_HP1R_SC_POS_EINT1_MASK 0x0004 /* HP1R_SC_POS_EINT1 */
4967#define ARIZONA_HP1R_SC_POS_EINT1_SHIFT 2 /* HP1R_SC_POS_EINT1 */
4968#define ARIZONA_HP1R_SC_POS_EINT1_WIDTH 1 /* HP1R_SC_POS_EINT1 */
4969#define ARIZONA_HP1L_SC_NEG_EINT1 0x0002 /* HP1L_SC_NEG_EINT1 */
4970#define ARIZONA_HP1L_SC_NEG_EINT1_MASK 0x0002 /* HP1L_SC_NEG_EINT1 */
4971#define ARIZONA_HP1L_SC_NEG_EINT1_SHIFT 1 /* HP1L_SC_NEG_EINT1 */
4972#define ARIZONA_HP1L_SC_NEG_EINT1_WIDTH 1 /* HP1L_SC_NEG_EINT1 */
4973#define ARIZONA_HP1L_SC_POS_EINT1 0x0001 /* HP1L_SC_POS_EINT1 */
4974#define ARIZONA_HP1L_SC_POS_EINT1_MASK 0x0001 /* HP1L_SC_POS_EINT1 */
4975#define ARIZONA_HP1L_SC_POS_EINT1_SHIFT 0 /* HP1L_SC_POS_EINT1 */
4976#define ARIZONA_HP1L_SC_POS_EINT1_WIDTH 1 /* HP1L_SC_POS_EINT1 */
4977
4978/*
4824 * R3336 (0xD08) - Interrupt Status 1 Mask 4979 * R3336 (0xD08) - Interrupt Status 1 Mask
4825 */ 4980 */
4826#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */ 4981#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */
@@ -4859,14 +5014,14 @@
4859/* 5014/*
4860 * R3338 (0xD0A) - Interrupt Status 3 Mask 5015 * R3338 (0xD0A) - Interrupt Status 3 Mask
4861 */ 5016 */
4862#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5017#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4863#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5018#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4864#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5019#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4865#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5020#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4866#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5021#define ARIZONA_IM_SPK_OVERHEAT_EINT1 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4867#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5022#define ARIZONA_IM_SPK_OVERHEAT_EINT1_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4868#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */ 5023#define ARIZONA_IM_SPK_OVERHEAT_EINT1_SHIFT 14 /* IM_SPK_OVERHEAT_EINT1 */
4869#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */ 5024#define ARIZONA_IM_SPK_OVERHEAT_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_EINT1 */
4870#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */ 5025#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */
4871#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */ 5026#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */
4872#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */ 5027#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */
@@ -4963,6 +5118,77 @@
4963#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */ 5118#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */
4964#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */ 5119#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */
4965#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */ 5120#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5121#define ARIZONA_IM_HP3R_DONE_EINT1 0x0020 /* IM_HP3R_DONE_EINT1 */
5122#define ARIZONA_IM_HP3R_DONE_EINT1_MASK 0x0020 /* IM_HP3R_DONE_EINT1 */
5123#define ARIZONA_IM_HP3R_DONE_EINT1_SHIFT 5 /* IM_HP3R_DONE_EINT1 */
5124#define ARIZONA_IM_HP3R_DONE_EINT1_WIDTH 1 /* IM_HP3R_DONE_EINT1 */
5125#define ARIZONA_IM_HP3L_DONE_EINT1 0x0010 /* IM_HP3L_DONE_EINT1 */
5126#define ARIZONA_IM_HP3L_DONE_EINT1_MASK 0x0010 /* IM_HP3L_DONE_EINT1 */
5127#define ARIZONA_IM_HP3L_DONE_EINT1_SHIFT 4 /* IM_HP3L_DONE_EINT1 */
5128#define ARIZONA_IM_HP3L_DONE_EINT1_WIDTH 1 /* IM_HP3L_DONE_EINT1 */
5129#define ARIZONA_IM_HP2R_DONE_EINT1 0x0008 /* IM_HP2R_DONE_EINT1 */
5130#define ARIZONA_IM_HP2R_DONE_EINT1_MASK 0x0008 /* IM_HP2R_DONE_EINT1 */
5131#define ARIZONA_IM_HP2R_DONE_EINT1_SHIFT 3 /* IM_HP2R_DONE_EINT1 */
5132#define ARIZONA_IM_HP2R_DONE_EINT1_WIDTH 1 /* IM_HP2R_DONE_EINT1 */
5133#define ARIZONA_IM_HP2L_DONE_EINT1 0x0004 /* IM_HP2L_DONE_EINT1 */
5134#define ARIZONA_IM_HP2L_DONE_EINT1_MASK 0x0004 /* IM_HP2L_DONE_EINT1 */
5135#define ARIZONA_IM_HP2L_DONE_EINT1_SHIFT 2 /* IM_HP2L_DONE_EINT1 */
5136#define ARIZONA_IM_HP2L_DONE_EINT1_WIDTH 1 /* IM_HP2L_DONE_EINT1 */
5137#define ARIZONA_IM_HP1R_DONE_EINT1 0x0002 /* IM_HP1R_DONE_EINT1 */
5138#define ARIZONA_IM_HP1R_DONE_EINT1_MASK 0x0002 /* IM_HP1R_DONE_EINT1 */
5139#define ARIZONA_IM_HP1R_DONE_EINT1_SHIFT 1 /* IM_HP1R_DONE_EINT1 */
5140#define ARIZONA_IM_HP1R_DONE_EINT1_WIDTH 1 /* IM_HP1R_DONE_EINT1 */
5141#define ARIZONA_IM_HP1L_DONE_EINT1 0x0001 /* IM_HP1L_DONE_EINT1 */
5142#define ARIZONA_IM_HP1L_DONE_EINT1_MASK 0x0001 /* IM_HP1L_DONE_EINT1 */
5143#define ARIZONA_IM_HP1L_DONE_EINT1_SHIFT 0 /* IM_HP1L_DONE_EINT1 */
5144#define ARIZONA_IM_HP1L_DONE_EINT1_WIDTH 1 /* IM_HP1L_DONE_EINT1 */
5145
5146/*
5147 * R3339 (0xD0B) - Interrupt Status 4 Mask (Alternate layout)
5148 *
5149 * Alternate layout used on later devices, note only fields that have moved
5150 * are specified
5151 */
5152#define ARIZONA_V2_IM_AIF3_ERR_EINT1 0x8000 /* IM_AIF3_ERR_EINT1 */
5153#define ARIZONA_V2_IM_AIF3_ERR_EINT1_MASK 0x8000 /* IM_AIF3_ERR_EINT1 */
5154#define ARIZONA_V2_IM_AIF3_ERR_EINT1_SHIFT 15 /* IM_AIF3_ERR_EINT1 */
5155#define ARIZONA_V2_IM_AIF3_ERR_EINT1_WIDTH 1 /* IM_AIF3_ERR_EINT1 */
5156#define ARIZONA_V2_IM_AIF2_ERR_EINT1 0x4000 /* IM_AIF2_ERR_EINT1 */
5157#define ARIZONA_V2_IM_AIF2_ERR_EINT1_MASK 0x4000 /* IM_AIF2_ERR_EINT1 */
5158#define ARIZONA_V2_IM_AIF2_ERR_EINT1_SHIFT 14 /* IM_AIF2_ERR_EINT1 */
5159#define ARIZONA_V2_IM_AIF2_ERR_EINT1_WIDTH 1 /* IM_AIF2_ERR_EINT1 */
5160#define ARIZONA_V2_IM_AIF1_ERR_EINT1 0x2000 /* IM_AIF1_ERR_EINT1 */
5161#define ARIZONA_V2_IM_AIF1_ERR_EINT1_MASK 0x2000 /* IM_AIF1_ERR_EINT1 */
5162#define ARIZONA_V2_IM_AIF1_ERR_EINT1_SHIFT 13 /* IM_AIF1_ERR_EINT1 */
5163#define ARIZONA_V2_IM_AIF1_ERR_EINT1_WIDTH 1 /* IM_AIF1_ERR_EINT1 */
5164#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5165#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_MASK 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5166#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_SHIFT 12 /* IM_CTRLIF_ERR_EINT1 */
5167#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_WIDTH 1 /* IM_CTRLIF_ERR_EINT1 */
5168#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5169#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5170#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5171#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5172#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5173#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5174#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5175#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5176#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5177#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5178#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT1 */
5179#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT1 */
5180#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5181#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5182#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT1 */
5183#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT1 */
5184#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5185#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5186#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT1 */
5187#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5188#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5189#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5190#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT1 */
5191#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT1 */
4966 5192
4967/* 5193/*
4968 * R3340 (0xD0C) - Interrupt Status 5 Mask 5194 * R3340 (0xD0C) - Interrupt Status 5 Mask
@@ -4989,6 +5215,85 @@
4989#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */ 5215#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */
4990 5216
4991/* 5217/*
5218 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5219 *
5220 * Alternate layout used on later devices, note only fields that have moved
5221 * are specified
5222 */
5223#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5224#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5225#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT1 */
5226#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT1 */
5227
5228/*
5229 * R3341 (0xD0D) - Interrupt Status 6 Mask
5230 */
5231#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5232#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5233#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5234#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5235#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5236#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5237#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */
5238#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */
5239#define ARIZONA_IM_SPK1R_SHORT_EINT1 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5240#define ARIZONA_IM_SPK1R_SHORT_EINT1_MASK 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5241#define ARIZONA_IM_SPK1R_SHORT_EINT1_SHIFT 13 /* IM_SPK1R_SHORT_EINT1 */
5242#define ARIZONA_IM_SPK1R_SHORT_EINT1_WIDTH 1 /* IM_SPK1R_SHORT_EINT1 */
5243#define ARIZONA_IM_SPK1L_SHORT_EINT1 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5244#define ARIZONA_IM_SPK1L_SHORT_EINT1_MASK 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5245#define ARIZONA_IM_SPK1L_SHORT_EINT1_SHIFT 12 /* IM_SPK1L_SHORT_EINT1 */
5246#define ARIZONA_IM_SPK1L_SHORT_EINT1_WIDTH 1 /* IM_SPK1L_SHORT_EINT1 */
5247#define ARIZONA_IM_HP3R_SC_NEG_EINT1 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5248#define ARIZONA_IM_HP3R_SC_NEG_EINT1_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5249#define ARIZONA_IM_HP3R_SC_NEG_EINT1_SHIFT 11 /* IM_HP3R_SC_NEG_EINT1 */
5250#define ARIZONA_IM_HP3R_SC_NEG_EINT1_WIDTH 1 /* IM_HP3R_SC_NEG_EINT1 */
5251#define ARIZONA_IM_HP3R_SC_POS_EINT1 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5252#define ARIZONA_IM_HP3R_SC_POS_EINT1_MASK 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5253#define ARIZONA_IM_HP3R_SC_POS_EINT1_SHIFT 10 /* IM_HP3R_SC_POS_EINT1 */
5254#define ARIZONA_IM_HP3R_SC_POS_EINT1_WIDTH 1 /* IM_HP3R_SC_POS_EINT1 */
5255#define ARIZONA_IM_HP3L_SC_NEG_EINT1 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5256#define ARIZONA_IM_HP3L_SC_NEG_EINT1_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5257#define ARIZONA_IM_HP3L_SC_NEG_EINT1_SHIFT 9 /* IM_HP3L_SC_NEG_EINT1 */
5258#define ARIZONA_IM_HP3L_SC_NEG_EINT1_WIDTH 1 /* IM_HP3L_SC_NEG_EINT1 */
5259#define ARIZONA_IM_HP3L_SC_POS_EINT1 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5260#define ARIZONA_IM_HP3L_SC_POS_EINT1_MASK 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5261#define ARIZONA_IM_HP3L_SC_POS_EINT1_SHIFT 8 /* IM_HP3L_SC_POS_EINT1 */
5262#define ARIZONA_IM_HP3L_SC_POS_EINT1_WIDTH 1 /* IM_HP3L_SC_POS_EINT1 */
5263#define ARIZONA_IM_HP2R_SC_NEG_EINT1 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5264#define ARIZONA_IM_HP2R_SC_NEG_EINT1_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5265#define ARIZONA_IM_HP2R_SC_NEG_EINT1_SHIFT 7 /* IM_HP2R_SC_NEG_EINT1 */
5266#define ARIZONA_IM_HP2R_SC_NEG_EINT1_WIDTH 1 /* IM_HP2R_SC_NEG_EINT1 */
5267#define ARIZONA_IM_HP2R_SC_POS_EINT1 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5268#define ARIZONA_IM_HP2R_SC_POS_EINT1_MASK 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5269#define ARIZONA_IM_HP2R_SC_POS_EINT1_SHIFT 6 /* IM_HP2R_SC_POS_EINT1 */
5270#define ARIZONA_IM_HP2R_SC_POS_EINT1_WIDTH 1 /* IM_HP2R_SC_POS_EINT1 */
5271#define ARIZONA_IM_HP2L_SC_NEG_EINT1 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5272#define ARIZONA_IM_HP2L_SC_NEG_EINT1_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5273#define ARIZONA_IM_HP2L_SC_NEG_EINT1_SHIFT 5 /* IM_HP2L_SC_NEG_EINT1 */
5274#define ARIZONA_IM_HP2L_SC_NEG_EINT1_WIDTH 1 /* IM_HP2L_SC_NEG_EINT1 */
5275#define ARIZONA_IM_HP2L_SC_POS_EINT1 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5276#define ARIZONA_IM_HP2L_SC_POS_EINT1_MASK 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5277#define ARIZONA_IM_HP2L_SC_POS_EINT1_SHIFT 4 /* IM_HP2L_SC_POS_EINT1 */
5278#define ARIZONA_IM_HP2L_SC_POS_EINT1_WIDTH 1 /* IM_HP2L_SC_POS_EINT1 */
5279#define ARIZONA_IM_HP1R_SC_NEG_EINT1 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5280#define ARIZONA_IM_HP1R_SC_NEG_EINT1_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5281#define ARIZONA_IM_HP1R_SC_NEG_EINT1_SHIFT 3 /* IM_HP1R_SC_NEG_EINT1 */
5282#define ARIZONA_IM_HP1R_SC_NEG_EINT1_WIDTH 1 /* IM_HP1R_SC_NEG_EINT1 */
5283#define ARIZONA_IM_HP1R_SC_POS_EINT1 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5284#define ARIZONA_IM_HP1R_SC_POS_EINT1_MASK 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5285#define ARIZONA_IM_HP1R_SC_POS_EINT1_SHIFT 2 /* IM_HP1R_SC_POS_EINT1 */
5286#define ARIZONA_IM_HP1R_SC_POS_EINT1_WIDTH 1 /* IM_HP1R_SC_POS_EINT1 */
5287#define ARIZONA_IM_HP1L_SC_NEG_EINT1 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5288#define ARIZONA_IM_HP1L_SC_NEG_EINT1_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5289#define ARIZONA_IM_HP1L_SC_NEG_EINT1_SHIFT 1 /* IM_HP1L_SC_NEG_EINT1 */
5290#define ARIZONA_IM_HP1L_SC_NEG_EINT1_WIDTH 1 /* IM_HP1L_SC_NEG_EINT1 */
5291#define ARIZONA_IM_HP1L_SC_POS_EINT1 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5292#define ARIZONA_IM_HP1L_SC_POS_EINT1_MASK 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5293#define ARIZONA_IM_HP1L_SC_POS_EINT1_SHIFT 0 /* IM_HP1L_SC_POS_EINT1 */
5294#define ARIZONA_IM_HP1L_SC_POS_EINT1_WIDTH 1 /* IM_HP1L_SC_POS_EINT1 */
5295
5296/*
4992 * R3343 (0xD0F) - Interrupt Control 5297 * R3343 (0xD0F) - Interrupt Control
4993 */ 5298 */
4994#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */ 5299#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */
@@ -5035,14 +5340,14 @@
5035/* 5340/*
5036 * R3346 (0xD12) - IRQ2 Status 3 5341 * R3346 (0xD12) - IRQ2 Status 3
5037 */ 5342 */
5038#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5343#define ARIZONA_SPK_OVERHEAT_WARN_EINT2 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5039#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5344#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5040#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT2 */ 5345#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT2 */
5041#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT2 */ 5346#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT2 */
5042#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5347#define ARIZONA_SPK_OVERHEAT_EINT2 0x4000 /* SPK_OVERHEAT_EINT2 */
5043#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5348#define ARIZONA_SPK_OVERHEAT_EINT2_MASK 0x4000 /* SPK_OVERHEAT_EINT2 */
5044#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */ 5349#define ARIZONA_SPK_OVERHEAT_EINT2_SHIFT 14 /* SPK_OVERHEAT_EINT2 */
5045#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */ 5350#define ARIZONA_SPK_OVERHEAT_EINT2_WIDTH 1 /* SPK_OVERHEAT_EINT2 */
5046#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */ 5351#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */
5047#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */ 5352#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */
5048#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */ 5353#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */
@@ -5139,6 +5444,77 @@
5139#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */ 5444#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */
5140#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */ 5445#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */
5141#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */ 5446#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5447#define ARIZONA_HP3R_DONE_EINT2 0x0020 /* HP3R_DONE_EINT2 */
5448#define ARIZONA_HP3R_DONE_EINT2_MASK 0x0020 /* HP3R_DONE_EINT2 */
5449#define ARIZONA_HP3R_DONE_EINT2_SHIFT 5 /* HP3R_DONE_EINT2 */
5450#define ARIZONA_HP3R_DONE_EINT2_WIDTH 1 /* HP3R_DONE_EINT2 */
5451#define ARIZONA_HP3L_DONE_EINT2 0x0010 /* HP3L_DONE_EINT2 */
5452#define ARIZONA_HP3L_DONE_EINT2_MASK 0x0010 /* HP3L_DONE_EINT2 */
5453#define ARIZONA_HP3L_DONE_EINT2_SHIFT 4 /* HP3L_DONE_EINT2 */
5454#define ARIZONA_HP3L_DONE_EINT2_WIDTH 1 /* HP3L_DONE_EINT2 */
5455#define ARIZONA_HP2R_DONE_EINT2 0x0008 /* HP2R_DONE_EINT2 */
5456#define ARIZONA_HP2R_DONE_EINT2_MASK 0x0008 /* HP2R_DONE_EINT2 */
5457#define ARIZONA_HP2R_DONE_EINT2_SHIFT 3 /* HP2R_DONE_EINT2 */
5458#define ARIZONA_HP2R_DONE_EINT2_WIDTH 1 /* HP2R_DONE_EINT2 */
5459#define ARIZONA_HP2L_DONE_EINT2 0x0004 /* HP2L_DONE_EINT2 */
5460#define ARIZONA_HP2L_DONE_EINT2_MASK 0x0004 /* HP2L_DONE_EINT2 */
5461#define ARIZONA_HP2L_DONE_EINT2_SHIFT 2 /* HP2L_DONE_EINT2 */
5462#define ARIZONA_HP2L_DONE_EINT2_WIDTH 1 /* HP2L_DONE_EINT2 */
5463#define ARIZONA_HP1R_DONE_EINT2 0x0002 /* HP1R_DONE_EINT2 */
5464#define ARIZONA_HP1R_DONE_EINT2_MASK 0x0002 /* HP1R_DONE_EINT2 */
5465#define ARIZONA_HP1R_DONE_EINT2_SHIFT 1 /* HP1R_DONE_EINT2 */
5466#define ARIZONA_HP1R_DONE_EINT2_WIDTH 1 /* HP1R_DONE_EINT2 */
5467#define ARIZONA_HP1L_DONE_EINT2 0x0001 /* HP1L_DONE_EINT2 */
5468#define ARIZONA_HP1L_DONE_EINT2_MASK 0x0001 /* HP1L_DONE_EINT2 */
5469#define ARIZONA_HP1L_DONE_EINT2_SHIFT 0 /* HP1L_DONE_EINT2 */
5470#define ARIZONA_HP1L_DONE_EINT2_WIDTH 1 /* HP1L_DONE_EINT2 */
5471
5472/*
5473 * R3347 (0xD13) - IRQ2 Status 4 (Alternate layout)
5474 *
5475 * Alternate layout used on later devices, note only fields that have moved
5476 * are specified
5477 */
5478#define ARIZONA_V2_AIF3_ERR_EINT2 0x8000 /* AIF3_ERR_EINT2 */
5479#define ARIZONA_V2_AIF3_ERR_EINT2_MASK 0x8000 /* AIF3_ERR_EINT2 */
5480#define ARIZONA_V2_AIF3_ERR_EINT2_SHIFT 15 /* AIF3_ERR_EINT2 */
5481#define ARIZONA_V2_AIF3_ERR_EINT2_WIDTH 1 /* AIF3_ERR_EINT2 */
5482#define ARIZONA_V2_AIF2_ERR_EINT2 0x4000 /* AIF2_ERR_EINT2 */
5483#define ARIZONA_V2_AIF2_ERR_EINT2_MASK 0x4000 /* AIF2_ERR_EINT2 */
5484#define ARIZONA_V2_AIF2_ERR_EINT2_SHIFT 14 /* AIF2_ERR_EINT2 */
5485#define ARIZONA_V2_AIF2_ERR_EINT2_WIDTH 1 /* AIF2_ERR_EINT2 */
5486#define ARIZONA_V2_AIF1_ERR_EINT2 0x2000 /* AIF1_ERR_EINT2 */
5487#define ARIZONA_V2_AIF1_ERR_EINT2_MASK 0x2000 /* AIF1_ERR_EINT2 */
5488#define ARIZONA_V2_AIF1_ERR_EINT2_SHIFT 13 /* AIF1_ERR_EINT2 */
5489#define ARIZONA_V2_AIF1_ERR_EINT2_WIDTH 1 /* AIF1_ERR_EINT2 */
5490#define ARIZONA_V2_CTRLIF_ERR_EINT2 0x1000 /* CTRLIF_ERR_EINT2 */
5491#define ARIZONA_V2_CTRLIF_ERR_EINT2_MASK 0x1000 /* CTRLIF_ERR_EINT2 */
5492#define ARIZONA_V2_CTRLIF_ERR_EINT2_SHIFT 12 /* CTRLIF_ERR_EINT2 */
5493#define ARIZONA_V2_CTRLIF_ERR_EINT2_WIDTH 1 /* CTRLIF_ERR_EINT2 */
5494#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5495#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5496#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT2 */
5497#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT2 */
5498#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5499#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5500#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT2 */
5501#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT2 */
5502#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5503#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5504#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* SYSCLK_ENA_LOW_EINT2 */
5505#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* SYSCLK_ENA_LOW_EINT2 */
5506#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5507#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5508#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* ISRC1_CFG_ERR_EINT2 */
5509#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* ISRC1_CFG_ERR_EINT2 */
5510#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5511#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5512#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* ISRC2_CFG_ERR_EINT2 */
5513#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5514#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5515#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5516#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* ISRC3_CFG_ERR_EINT2 */
5517#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* ISRC3_CFG_ERR_EINT2 */
5142 5518
5143/* 5519/*
5144 * R3348 (0xD14) - IRQ2 Status 5 5520 * R3348 (0xD14) - IRQ2 Status 5
@@ -5165,6 +5541,85 @@
5165#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */ 5541#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */
5166 5542
5167/* 5543/*
5544 * R3348 (0xD14) - IRQ2 Status 5 (Alternate layout)
5545 *
5546 * Alternate layout used on later devices, note only fields that have moved
5547 * are specified
5548 */
5549#define ARIZONA_V2_ASRC_CFG_ERR_EINT2 0x0008 /* ASRC_CFG_ERR_EINT2 */
5550#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* ASRC_CFG_ERR_EINT2 */
5551#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_SHIFT 3 /* ASRC_CFG_ERR_EINT2 */
5552#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_WIDTH 1 /* ASRC_CFG_ERR_EINT2 */
5553
5554/*
5555 * R3349 (0xD15) - IRQ2 Status 6
5556 */
5557#define ARIZONA_DSP_SHARED_WR_COLL_EINT2 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5558#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5559#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT2 */
5560#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT2 */
5561#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */
5562#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */
5563#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */
5564#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */
5565#define ARIZONA_SPK1R_SHORT_EINT2 0x2000 /* SPK1R_SHORT_EINT2 */
5566#define ARIZONA_SPK1R_SHORT_EINT2_MASK 0x2000 /* SPK1R_SHORT_EINT2 */
5567#define ARIZONA_SPK1R_SHORT_EINT2_SHIFT 13 /* SPK1R_SHORT_EINT2 */
5568#define ARIZONA_SPK1R_SHORT_EINT2_WIDTH 1 /* SPK1R_SHORT_EINT2 */
5569#define ARIZONA_SPK1L_SHORT_EINT2 0x1000 /* SPK1L_SHORT_EINT2 */
5570#define ARIZONA_SPK1L_SHORT_EINT2_MASK 0x1000 /* SPK1L_SHORT_EINT2 */
5571#define ARIZONA_SPK1L_SHORT_EINT2_SHIFT 12 /* SPK1L_SHORT_EINT2 */
5572#define ARIZONA_SPK1L_SHORT_EINT2_WIDTH 1 /* SPK1L_SHORT_EINT2 */
5573#define ARIZONA_HP3R_SC_NEG_EINT2 0x0800 /* HP3R_SC_NEG_EINT2 */
5574#define ARIZONA_HP3R_SC_NEG_EINT2_MASK 0x0800 /* HP3R_SC_NEG_EINT2 */
5575#define ARIZONA_HP3R_SC_NEG_EINT2_SHIFT 11 /* HP3R_SC_NEG_EINT2 */
5576#define ARIZONA_HP3R_SC_NEG_EINT2_WIDTH 1 /* HP3R_SC_NEG_EINT2 */
5577#define ARIZONA_HP3R_SC_POS_EINT2 0x0400 /* HP3R_SC_POS_EINT2 */
5578#define ARIZONA_HP3R_SC_POS_EINT2_MASK 0x0400 /* HP3R_SC_POS_EINT2 */
5579#define ARIZONA_HP3R_SC_POS_EINT2_SHIFT 10 /* HP3R_SC_POS_EINT2 */
5580#define ARIZONA_HP3R_SC_POS_EINT2_WIDTH 1 /* HP3R_SC_POS_EINT2 */
5581#define ARIZONA_HP3L_SC_NEG_EINT2 0x0200 /* HP3L_SC_NEG_EINT2 */
5582#define ARIZONA_HP3L_SC_NEG_EINT2_MASK 0x0200 /* HP3L_SC_NEG_EINT2 */
5583#define ARIZONA_HP3L_SC_NEG_EINT2_SHIFT 9 /* HP3L_SC_NEG_EINT2 */
5584#define ARIZONA_HP3L_SC_NEG_EINT2_WIDTH 1 /* HP3L_SC_NEG_EINT2 */
5585#define ARIZONA_HP3L_SC_POS_EINT2 0x0100 /* HP3L_SC_POS_EINT2 */
5586#define ARIZONA_HP3L_SC_POS_EINT2_MASK 0x0100 /* HP3L_SC_POS_EINT2 */
5587#define ARIZONA_HP3L_SC_POS_EINT2_SHIFT 8 /* HP3L_SC_POS_EINT2 */
5588#define ARIZONA_HP3L_SC_POS_EINT2_WIDTH 1 /* HP3L_SC_POS_EINT2 */
5589#define ARIZONA_HP2R_SC_NEG_EINT2 0x0080 /* HP2R_SC_NEG_EINT2 */
5590#define ARIZONA_HP2R_SC_NEG_EINT2_MASK 0x0080 /* HP2R_SC_NEG_EINT2 */
5591#define ARIZONA_HP2R_SC_NEG_EINT2_SHIFT 7 /* HP2R_SC_NEG_EINT2 */
5592#define ARIZONA_HP2R_SC_NEG_EINT2_WIDTH 1 /* HP2R_SC_NEG_EINT2 */
5593#define ARIZONA_HP2R_SC_POS_EINT2 0x0040 /* HP2R_SC_POS_EINT2 */
5594#define ARIZONA_HP2R_SC_POS_EINT2_MASK 0x0040 /* HP2R_SC_POS_EINT2 */
5595#define ARIZONA_HP2R_SC_POS_EINT2_SHIFT 6 /* HP2R_SC_POS_EINT2 */
5596#define ARIZONA_HP2R_SC_POS_EINT2_WIDTH 1 /* HP2R_SC_POS_EINT2 */
5597#define ARIZONA_HP2L_SC_NEG_EINT2 0x0020 /* HP2L_SC_NEG_EINT2 */
5598#define ARIZONA_HP2L_SC_NEG_EINT2_MASK 0x0020 /* HP2L_SC_NEG_EINT2 */
5599#define ARIZONA_HP2L_SC_NEG_EINT2_SHIFT 5 /* HP2L_SC_NEG_EINT2 */
5600#define ARIZONA_HP2L_SC_NEG_EINT2_WIDTH 1 /* HP2L_SC_NEG_EINT2 */
5601#define ARIZONA_HP2L_SC_POS_EINT2 0x0010 /* HP2L_SC_POS_EINT2 */
5602#define ARIZONA_HP2L_SC_POS_EINT2_MASK 0x0010 /* HP2L_SC_POS_EINT2 */
5603#define ARIZONA_HP2L_SC_POS_EINT2_SHIFT 4 /* HP2L_SC_POS_EINT2 */
5604#define ARIZONA_HP2L_SC_POS_EINT2_WIDTH 1 /* HP2L_SC_POS_EINT2 */
5605#define ARIZONA_HP1R_SC_NEG_EINT2 0x0008 /* HP1R_SC_NEG_EINT2 */
5606#define ARIZONA_HP1R_SC_NEG_EINT2_MASK 0x0008 /* HP1R_SC_NEG_EINT2 */
5607#define ARIZONA_HP1R_SC_NEG_EINT2_SHIFT 3 /* HP1R_SC_NEG_EINT2 */
5608#define ARIZONA_HP1R_SC_NEG_EINT2_WIDTH 1 /* HP1R_SC_NEG_EINT2 */
5609#define ARIZONA_HP1R_SC_POS_EINT2 0x0004 /* HP1R_SC_POS_EINT2 */
5610#define ARIZONA_HP1R_SC_POS_EINT2_MASK 0x0004 /* HP1R_SC_POS_EINT2 */
5611#define ARIZONA_HP1R_SC_POS_EINT2_SHIFT 2 /* HP1R_SC_POS_EINT2 */
5612#define ARIZONA_HP1R_SC_POS_EINT2_WIDTH 1 /* HP1R_SC_POS_EINT2 */
5613#define ARIZONA_HP1L_SC_NEG_EINT2 0x0002 /* HP1L_SC_NEG_EINT2 */
5614#define ARIZONA_HP1L_SC_NEG_EINT2_MASK 0x0002 /* HP1L_SC_NEG_EINT2 */
5615#define ARIZONA_HP1L_SC_NEG_EINT2_SHIFT 1 /* HP1L_SC_NEG_EINT2 */
5616#define ARIZONA_HP1L_SC_NEG_EINT2_WIDTH 1 /* HP1L_SC_NEG_EINT2 */
5617#define ARIZONA_HP1L_SC_POS_EINT2 0x0001 /* HP1L_SC_POS_EINT2 */
5618#define ARIZONA_HP1L_SC_POS_EINT2_MASK 0x0001 /* HP1L_SC_POS_EINT2 */
5619#define ARIZONA_HP1L_SC_POS_EINT2_SHIFT 0 /* HP1L_SC_POS_EINT2 */
5620#define ARIZONA_HP1L_SC_POS_EINT2_WIDTH 1 /* HP1L_SC_POS_EINT2 */
5621
5622/*
5168 * R3352 (0xD18) - IRQ2 Status 1 Mask 5623 * R3352 (0xD18) - IRQ2 Status 1 Mask
5169 */ 5624 */
5170#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */ 5625#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */
@@ -5203,14 +5658,14 @@
5203/* 5658/*
5204 * R3354 (0xD1A) - IRQ2 Status 3 Mask 5659 * R3354 (0xD1A) - IRQ2 Status 3 Mask
5205 */ 5660 */
5206#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5661#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5207#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5662#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5208#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5663#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5209#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5664#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5210#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5665#define ARIZONA_IM_SPK_OVERHEAT_EINT2 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5211#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5666#define ARIZONA_IM_SPK_OVERHEAT_EINT2_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5212#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */ 5667#define ARIZONA_IM_SPK_OVERHEAT_EINT2_SHIFT 14 /* IM_SPK_OVERHEAT_EINT2 */
5213#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */ 5668#define ARIZONA_IM_SPK_OVERHEAT_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_EINT2 */
5214#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */ 5669#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */
5215#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */ 5670#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */
5216#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */ 5671#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */
@@ -5307,6 +5762,77 @@
5307#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */ 5762#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */
5308#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */ 5763#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */
5309#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */ 5764#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5765#define ARIZONA_IM_HP3R_DONE_EINT2 0x0020 /* IM_HP3R_DONE_EINT2 */
5766#define ARIZONA_IM_HP3R_DONE_EINT2_MASK 0x0020 /* IM_HP3R_DONE_EINT2 */
5767#define ARIZONA_IM_HP3R_DONE_EINT2_SHIFT 5 /* IM_HP3R_DONE_EINT2 */
5768#define ARIZONA_IM_HP3R_DONE_EINT2_WIDTH 1 /* IM_HP3R_DONE_EINT2 */
5769#define ARIZONA_IM_HP3L_DONE_EINT2 0x0010 /* IM_HP3L_DONE_EINT2 */
5770#define ARIZONA_IM_HP3L_DONE_EINT2_MASK 0x0010 /* IM_HP3L_DONE_EINT2 */
5771#define ARIZONA_IM_HP3L_DONE_EINT2_SHIFT 4 /* IM_HP3L_DONE_EINT2 */
5772#define ARIZONA_IM_HP3L_DONE_EINT2_WIDTH 1 /* IM_HP3L_DONE_EINT2 */
5773#define ARIZONA_IM_HP2R_DONE_EINT2 0x0008 /* IM_HP2R_DONE_EINT2 */
5774#define ARIZONA_IM_HP2R_DONE_EINT2_MASK 0x0008 /* IM_HP2R_DONE_EINT2 */
5775#define ARIZONA_IM_HP2R_DONE_EINT2_SHIFT 3 /* IM_HP2R_DONE_EINT2 */
5776#define ARIZONA_IM_HP2R_DONE_EINT2_WIDTH 1 /* IM_HP2R_DONE_EINT2 */
5777#define ARIZONA_IM_HP2L_DONE_EINT2 0x0004 /* IM_HP2L_DONE_EINT2 */
5778#define ARIZONA_IM_HP2L_DONE_EINT2_MASK 0x0004 /* IM_HP2L_DONE_EINT2 */
5779#define ARIZONA_IM_HP2L_DONE_EINT2_SHIFT 2 /* IM_HP2L_DONE_EINT2 */
5780#define ARIZONA_IM_HP2L_DONE_EINT2_WIDTH 1 /* IM_HP2L_DONE_EINT2 */
5781#define ARIZONA_IM_HP1R_DONE_EINT2 0x0002 /* IM_HP1R_DONE_EINT2 */
5782#define ARIZONA_IM_HP1R_DONE_EINT2_MASK 0x0002 /* IM_HP1R_DONE_EINT2 */
5783#define ARIZONA_IM_HP1R_DONE_EINT2_SHIFT 1 /* IM_HP1R_DONE_EINT2 */
5784#define ARIZONA_IM_HP1R_DONE_EINT2_WIDTH 1 /* IM_HP1R_DONE_EINT2 */
5785#define ARIZONA_IM_HP1L_DONE_EINT2 0x0001 /* IM_HP1L_DONE_EINT2 */
5786#define ARIZONA_IM_HP1L_DONE_EINT2_MASK 0x0001 /* IM_HP1L_DONE_EINT2 */
5787#define ARIZONA_IM_HP1L_DONE_EINT2_SHIFT 0 /* IM_HP1L_DONE_EINT2 */
5788#define ARIZONA_IM_HP1L_DONE_EINT2_WIDTH 1 /* IM_HP1L_DONE_EINT2 */
5789
5790/*
5791 * R3355 (0xD1B) - IRQ2 Status 4 Mask (Alternate layout)
5792 *
5793 * Alternate layout used on later devices, note only fields that have moved
5794 * are specified
5795 */
5796#define ARIZONA_V2_IM_AIF3_ERR_EINT2 0x8000 /* IM_AIF3_ERR_EINT2 */
5797#define ARIZONA_V2_IM_AIF3_ERR_EINT2_MASK 0x8000 /* IM_AIF3_ERR_EINT2 */
5798#define ARIZONA_V2_IM_AIF3_ERR_EINT2_SHIFT 15 /* IM_AIF3_ERR_EINT2 */
5799#define ARIZONA_V2_IM_AIF3_ERR_EINT2_WIDTH 1 /* IM_AIF3_ERR_EINT2 */
5800#define ARIZONA_V2_IM_AIF2_ERR_EINT2 0x4000 /* IM_AIF2_ERR_EINT2 */
5801#define ARIZONA_V2_IM_AIF2_ERR_EINT2_MASK 0x4000 /* IM_AIF2_ERR_EINT2 */
5802#define ARIZONA_V2_IM_AIF2_ERR_EINT2_SHIFT 14 /* IM_AIF2_ERR_EINT2 */
5803#define ARIZONA_V2_IM_AIF2_ERR_EINT2_WIDTH 1 /* IM_AIF2_ERR_EINT2 */
5804#define ARIZONA_V2_IM_AIF1_ERR_EINT2 0x2000 /* IM_AIF1_ERR_EINT2 */
5805#define ARIZONA_V2_IM_AIF1_ERR_EINT2_MASK 0x2000 /* IM_AIF1_ERR_EINT2 */
5806#define ARIZONA_V2_IM_AIF1_ERR_EINT2_SHIFT 13 /* IM_AIF1_ERR_EINT2 */
5807#define ARIZONA_V2_IM_AIF1_ERR_EINT2_WIDTH 1 /* IM_AIF1_ERR_EINT2 */
5808#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5809#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_MASK 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5810#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_SHIFT 12 /* IM_CTRLIF_ERR_EINT2 */
5811#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_WIDTH 1 /* IM_CTRLIF_ERR_EINT2 */
5812#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5813#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5814#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5815#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5816#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5817#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5818#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5819#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5820#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5821#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5822#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT2 */
5823#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT2 */
5824#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5825#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5826#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT2 */
5827#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT2 */
5828#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5829#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5830#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT2 */
5831#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5832#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5833#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5834#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT2 */
5835#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT2 */
5310 5836
5311/* 5837/*
5312 * R3356 (0xD1C) - IRQ2 Status 5 Mask 5838 * R3356 (0xD1C) - IRQ2 Status 5 Mask
@@ -5334,6 +5860,85 @@
5334#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */ 5860#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */
5335 5861
5336/* 5862/*
5863 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5864 *
5865 * Alternate layout used on later devices, note only fields that have moved
5866 * are specified
5867 */
5868#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5869#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5870#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT2 */
5871#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT2 */
5872
5873/*
5874 * R3357 (0xD1D) - IRQ2 Status 6 Mask
5875 */
5876#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5877#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5878#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5879#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5880#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5881#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5882#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */
5883#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */
5884#define ARIZONA_IM_SPK1R_SHORT_EINT2 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5885#define ARIZONA_IM_SPK1R_SHORT_EINT2_MASK 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5886#define ARIZONA_IM_SPK1R_SHORT_EINT2_SHIFT 13 /* IM_SPK1R_SHORT_EINT2 */
5887#define ARIZONA_IM_SPK1R_SHORT_EINT2_WIDTH 1 /* IM_SPK1R_SHORT_EINT2 */
5888#define ARIZONA_IM_SPK1L_SHORT_EINT2 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5889#define ARIZONA_IM_SPK1L_SHORT_EINT2_MASK 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5890#define ARIZONA_IM_SPK1L_SHORT_EINT2_SHIFT 12 /* IM_SPK1L_SHORT_EINT2 */
5891#define ARIZONA_IM_SPK1L_SHORT_EINT2_WIDTH 1 /* IM_SPK1L_SHORT_EINT2 */
5892#define ARIZONA_IM_HP3R_SC_NEG_EINT2 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5893#define ARIZONA_IM_HP3R_SC_NEG_EINT2_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5894#define ARIZONA_IM_HP3R_SC_NEG_EINT2_SHIFT 11 /* IM_HP3R_SC_NEG_EINT2 */
5895#define ARIZONA_IM_HP3R_SC_NEG_EINT2_WIDTH 1 /* IM_HP3R_SC_NEG_EINT2 */
5896#define ARIZONA_IM_HP3R_SC_POS_EINT2 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5897#define ARIZONA_IM_HP3R_SC_POS_EINT2_MASK 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5898#define ARIZONA_IM_HP3R_SC_POS_EINT2_SHIFT 10 /* IM_HP3R_SC_POS_EINT2 */
5899#define ARIZONA_IM_HP3R_SC_POS_EINT2_WIDTH 1 /* IM_HP3R_SC_POS_EINT2 */
5900#define ARIZONA_IM_HP3L_SC_NEG_EINT2 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5901#define ARIZONA_IM_HP3L_SC_NEG_EINT2_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5902#define ARIZONA_IM_HP3L_SC_NEG_EINT2_SHIFT 9 /* IM_HP3L_SC_NEG_EINT2 */
5903#define ARIZONA_IM_HP3L_SC_NEG_EINT2_WIDTH 1 /* IM_HP3L_SC_NEG_EINT2 */
5904#define ARIZONA_IM_HP3L_SC_POS_EINT2 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5905#define ARIZONA_IM_HP3L_SC_POS_EINT2_MASK 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5906#define ARIZONA_IM_HP3L_SC_POS_EINT2_SHIFT 8 /* IM_HP3L_SC_POS_EINT2 */
5907#define ARIZONA_IM_HP3L_SC_POS_EINT2_WIDTH 1 /* IM_HP3L_SC_POS_EINT2 */
5908#define ARIZONA_IM_HP2R_SC_NEG_EINT2 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5909#define ARIZONA_IM_HP2R_SC_NEG_EINT2_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5910#define ARIZONA_IM_HP2R_SC_NEG_EINT2_SHIFT 7 /* IM_HP2R_SC_NEG_EINT2 */
5911#define ARIZONA_IM_HP2R_SC_NEG_EINT2_WIDTH 1 /* IM_HP2R_SC_NEG_EINT2 */
5912#define ARIZONA_IM_HP2R_SC_POS_EINT2 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5913#define ARIZONA_IM_HP2R_SC_POS_EINT2_MASK 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5914#define ARIZONA_IM_HP2R_SC_POS_EINT2_SHIFT 6 /* IM_HP2R_SC_POS_EINT2 */
5915#define ARIZONA_IM_HP2R_SC_POS_EINT2_WIDTH 1 /* IM_HP2R_SC_POS_EINT2 */
5916#define ARIZONA_IM_HP2L_SC_NEG_EINT2 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5917#define ARIZONA_IM_HP2L_SC_NEG_EINT2_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5918#define ARIZONA_IM_HP2L_SC_NEG_EINT2_SHIFT 5 /* IM_HP2L_SC_NEG_EINT2 */
5919#define ARIZONA_IM_HP2L_SC_NEG_EINT2_WIDTH 1 /* IM_HP2L_SC_NEG_EINT2 */
5920#define ARIZONA_IM_HP2L_SC_POS_EINT2 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5921#define ARIZONA_IM_HP2L_SC_POS_EINT2_MASK 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5922#define ARIZONA_IM_HP2L_SC_POS_EINT2_SHIFT 4 /* IM_HP2L_SC_POS_EINT2 */
5923#define ARIZONA_IM_HP2L_SC_POS_EINT2_WIDTH 1 /* IM_HP2L_SC_POS_EINT2 */
5924#define ARIZONA_IM_HP1R_SC_NEG_EINT2 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5925#define ARIZONA_IM_HP1R_SC_NEG_EINT2_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5926#define ARIZONA_IM_HP1R_SC_NEG_EINT2_SHIFT 3 /* IM_HP1R_SC_NEG_EINT2 */
5927#define ARIZONA_IM_HP1R_SC_NEG_EINT2_WIDTH 1 /* IM_HP1R_SC_NEG_EINT2 */
5928#define ARIZONA_IM_HP1R_SC_POS_EINT2 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5929#define ARIZONA_IM_HP1R_SC_POS_EINT2_MASK 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5930#define ARIZONA_IM_HP1R_SC_POS_EINT2_SHIFT 2 /* IM_HP1R_SC_POS_EINT2 */
5931#define ARIZONA_IM_HP1R_SC_POS_EINT2_WIDTH 1 /* IM_HP1R_SC_POS_EINT2 */
5932#define ARIZONA_IM_HP1L_SC_NEG_EINT2 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5933#define ARIZONA_IM_HP1L_SC_NEG_EINT2_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5934#define ARIZONA_IM_HP1L_SC_NEG_EINT2_SHIFT 1 /* IM_HP1L_SC_NEG_EINT2 */
5935#define ARIZONA_IM_HP1L_SC_NEG_EINT2_WIDTH 1 /* IM_HP1L_SC_NEG_EINT2 */
5936#define ARIZONA_IM_HP1L_SC_POS_EINT2 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5937#define ARIZONA_IM_HP1L_SC_POS_EINT2_MASK 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5938#define ARIZONA_IM_HP1L_SC_POS_EINT2_SHIFT 0 /* IM_HP1L_SC_POS_EINT2 */
5939#define ARIZONA_IM_HP1L_SC_POS_EINT2_WIDTH 1 /* IM_HP1L_SC_POS_EINT2 */
5940
5941/*
5337 * R3359 (0xD1F) - IRQ2 Control 5942 * R3359 (0xD1F) - IRQ2 Control
5338 */ 5943 */
5339#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */ 5944#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */
@@ -5360,14 +5965,14 @@
5360/* 5965/*
5361 * R3361 (0xD21) - Interrupt Raw Status 3 5966 * R3361 (0xD21) - Interrupt Raw Status 3
5362 */ 5967 */
5363#define ARIZONA_SPK_SHUTDOWN_WARN_STS 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5968#define ARIZONA_SPK_OVERHEAT_WARN_STS 0x8000 /* SPK_OVERHEAT_WARN_STS */
5364#define ARIZONA_SPK_SHUTDOWN_WARN_STS_MASK 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5969#define ARIZONA_SPK_OVERHEAT_WARN_STS_MASK 0x8000 /* SPK_OVERHEAT_WARN_STS */
5365#define ARIZONA_SPK_SHUTDOWN_WARN_STS_SHIFT 15 /* SPK_SHUTDOWN_WARN_STS */ 5970#define ARIZONA_SPK_OVERHEAT_WARN_STS_SHIFT 15 /* SPK_OVERHEAT_WARN_STS */
5366#define ARIZONA_SPK_SHUTDOWN_WARN_STS_WIDTH 1 /* SPK_SHUTDOWN_WARN_STS */ 5971#define ARIZONA_SPK_OVERHEAT_WARN_STS_WIDTH 1 /* SPK_OVERHEAT_WARN_STS */
5367#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */ 5972#define ARIZONA_SPK_OVERHEAT_STS 0x4000 /* SPK_OVERHEAT_STS */
5368#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */ 5973#define ARIZONA_SPK_OVERHEAT_STS_MASK 0x4000 /* SPK_OVERHEAT_STS */
5369#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */ 5974#define ARIZONA_SPK_OVERHEAT_STS_SHIFT 14 /* SPK_OVERHEAT_STS */
5370#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */ 5975#define ARIZONA_SPK_OVERHEAT_STS_WIDTH 1 /* SPK_OVERHEAT_STS */
5371#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */ 5976#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */
5372#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */ 5977#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */
5373#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */ 5978#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */
@@ -5464,6 +6069,30 @@
5464#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */ 6069#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */
5465#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */ 6070#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */
5466#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */ 6071#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */
6072#define ARIZONA_HP3R_DONE_STS 0x0020 /* HP3R_DONE_STS */
6073#define ARIZONA_HP3R_DONE_STS_MASK 0x0020 /* HP3R_DONE_STS */
6074#define ARIZONA_HP3R_DONE_STS_SHIFT 5 /* HP3R_DONE_STS */
6075#define ARIZONA_HP3R_DONE_STS_WIDTH 1 /* HP3R_DONE_STS */
6076#define ARIZONA_HP3L_DONE_STS 0x0010 /* HP3L_DONE_STS */
6077#define ARIZONA_HP3L_DONE_STS_MASK 0x0010 /* HP3L_DONE_STS */
6078#define ARIZONA_HP3L_DONE_STS_SHIFT 4 /* HP3L_DONE_STS */
6079#define ARIZONA_HP3L_DONE_STS_WIDTH 1 /* HP3L_DONE_STS */
6080#define ARIZONA_HP2R_DONE_STS 0x0008 /* HP2R_DONE_STS */
6081#define ARIZONA_HP2R_DONE_STS_MASK 0x0008 /* HP2R_DONE_STS */
6082#define ARIZONA_HP2R_DONE_STS_SHIFT 3 /* HP2R_DONE_STS */
6083#define ARIZONA_HP2R_DONE_STS_WIDTH 1 /* HP2R_DONE_STS */
6084#define ARIZONA_HP2L_DONE_STS 0x0004 /* HP2L_DONE_STS */
6085#define ARIZONA_HP2L_DONE_STS_MASK 0x0004 /* HP2L_DONE_STS */
6086#define ARIZONA_HP2L_DONE_STS_SHIFT 2 /* HP2L_DONE_STS */
6087#define ARIZONA_HP2L_DONE_STS_WIDTH 1 /* HP2L_DONE_STS */
6088#define ARIZONA_HP1R_DONE_STS 0x0002 /* HP1R_DONE_STS */
6089#define ARIZONA_HP1R_DONE_STS_MASK 0x0002 /* HP1R_DONE_STS */
6090#define ARIZONA_HP1R_DONE_STS_SHIFT 1 /* HP1R_DONE_STS */
6091#define ARIZONA_HP1R_DONE_STS_WIDTH 1 /* HP1R_DONE_STS */
6092#define ARIZONA_HP1L_DONE_STS 0x0001 /* HP1L_DONE_STS */
6093#define ARIZONA_HP1L_DONE_STS_MASK 0x0001 /* HP1L_DONE_STS */
6094#define ARIZONA_HP1L_DONE_STS_SHIFT 0 /* HP1L_DONE_STS */
6095#define ARIZONA_HP1L_DONE_STS_WIDTH 1 /* HP1L_DONE_STS */
5467 6096
5468/* 6097/*
5469 * R3363 (0xD23) - Interrupt Raw Status 5 6098 * R3363 (0xD23) - Interrupt Raw Status 5
@@ -5580,6 +6209,10 @@
5580#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */ 6209#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */
5581#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */ 6210#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */
5582#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */ 6211#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */
6212#define ARIZONA_ISRC3_OVERCLOCKED_STS 0x0004 /* ISRC3_OVERCLOCKED_STS */
6213#define ARIZONA_ISRC3_OVERCLOCKED_STS_MASK 0x0004 /* ISRC3_OVERCLOCKED_STS */
6214#define ARIZONA_ISRC3_OVERCLOCKED_STS_SHIFT 2 /* ISRC3_OVERCLOCKED_STS */
6215#define ARIZONA_ISRC3_OVERCLOCKED_STS_WIDTH 1 /* ISRC3_OVERCLOCKED_STS */
5583#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6216#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */
5584#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6217#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */
5585#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */ 6218#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */
@@ -5604,6 +6237,10 @@
5604#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */ 6237#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */
5605#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */ 6238#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */
5606#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */ 6239#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */
6240#define ARIZONA_ISRC3_UNDERCLOCKED_STS 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6241#define ARIZONA_ISRC3_UNDERCLOCKED_STS_MASK 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6242#define ARIZONA_ISRC3_UNDERCLOCKED_STS_SHIFT 7 /* ISRC3_UNDERCLOCKED_STS */
6243#define ARIZONA_ISRC3_UNDERCLOCKED_STS_WIDTH 1 /* ISRC3_UNDERCLOCKED_STS */
5607#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6244#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5608#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6245#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5609#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */ 6246#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */
@@ -5634,6 +6271,74 @@
5634#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */ 6271#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */
5635 6272
5636/* 6273/*
6274 * R3368 (0xD28) - Interrupt Raw Status 9
6275 */
6276#define ARIZONA_DSP_SHARED_WR_COLL_STS 0x8000 /* DSP_SHARED_WR_COLL_STS */
6277#define ARIZONA_DSP_SHARED_WR_COLL_STS_MASK 0x8000 /* DSP_SHARED_WR_COLL_STS */
6278#define ARIZONA_DSP_SHARED_WR_COLL_STS_SHIFT 15 /* DSP_SHARED_WR_COLL_STS */
6279#define ARIZONA_DSP_SHARED_WR_COLL_STS_WIDTH 1 /* DSP_SHARED_WR_COLL_STS */
6280#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */
6281#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */
6282#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */
6283#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */
6284#define ARIZONA_SPK1R_SHORT_STS 0x2000 /* SPK1R_SHORT_STS */
6285#define ARIZONA_SPK1R_SHORT_STS_MASK 0x2000 /* SPK1R_SHORT_STS */
6286#define ARIZONA_SPK1R_SHORT_STS_SHIFT 13 /* SPK1R_SHORT_STS */
6287#define ARIZONA_SPK1R_SHORT_STS_WIDTH 1 /* SPK1R_SHORT_STS */
6288#define ARIZONA_SPK1L_SHORT_STS 0x1000 /* SPK1L_SHORT_STS */
6289#define ARIZONA_SPK1L_SHORT_STS_MASK 0x1000 /* SPK1L_SHORT_STS */
6290#define ARIZONA_SPK1L_SHORT_STS_SHIFT 12 /* SPK1L_SHORT_STS */
6291#define ARIZONA_SPK1L_SHORT_STS_WIDTH 1 /* SPK1L_SHORT_STS */
6292#define ARIZONA_HP3R_SC_NEG_STS 0x0800 /* HP3R_SC_NEG_STS */
6293#define ARIZONA_HP3R_SC_NEG_STS_MASK 0x0800 /* HP3R_SC_NEG_STS */
6294#define ARIZONA_HP3R_SC_NEG_STS_SHIFT 11 /* HP3R_SC_NEG_STS */
6295#define ARIZONA_HP3R_SC_NEG_STS_WIDTH 1 /* HP3R_SC_NEG_STS */
6296#define ARIZONA_HP3R_SC_POS_STS 0x0400 /* HP3R_SC_POS_STS */
6297#define ARIZONA_HP3R_SC_POS_STS_MASK 0x0400 /* HP3R_SC_POS_STS */
6298#define ARIZONA_HP3R_SC_POS_STS_SHIFT 10 /* HP3R_SC_POS_STS */
6299#define ARIZONA_HP3R_SC_POS_STS_WIDTH 1 /* HP3R_SC_POS_STS */
6300#define ARIZONA_HP3L_SC_NEG_STS 0x0200 /* HP3L_SC_NEG_STS */
6301#define ARIZONA_HP3L_SC_NEG_STS_MASK 0x0200 /* HP3L_SC_NEG_STS */
6302#define ARIZONA_HP3L_SC_NEG_STS_SHIFT 9 /* HP3L_SC_NEG_STS */
6303#define ARIZONA_HP3L_SC_NEG_STS_WIDTH 1 /* HP3L_SC_NEG_STS */
6304#define ARIZONA_HP3L_SC_POS_STS 0x0100 /* HP3L_SC_POS_STS */
6305#define ARIZONA_HP3L_SC_POS_STS_MASK 0x0100 /* HP3L_SC_POS_STS */
6306#define ARIZONA_HP3L_SC_POS_STS_SHIFT 8 /* HP3L_SC_POS_STS */
6307#define ARIZONA_HP3L_SC_POS_STS_WIDTH 1 /* HP3L_SC_POS_STS */
6308#define ARIZONA_HP2R_SC_NEG_STS 0x0080 /* HP2R_SC_NEG_STS */
6309#define ARIZONA_HP2R_SC_NEG_STS_MASK 0x0080 /* HP2R_SC_NEG_STS */
6310#define ARIZONA_HP2R_SC_NEG_STS_SHIFT 7 /* HP2R_SC_NEG_STS */
6311#define ARIZONA_HP2R_SC_NEG_STS_WIDTH 1 /* HP2R_SC_NEG_STS */
6312#define ARIZONA_HP2R_SC_POS_STS 0x0040 /* HP2R_SC_POS_STS */
6313#define ARIZONA_HP2R_SC_POS_STS_MASK 0x0040 /* HP2R_SC_POS_STS */
6314#define ARIZONA_HP2R_SC_POS_STS_SHIFT 6 /* HP2R_SC_POS_STS */
6315#define ARIZONA_HP2R_SC_POS_STS_WIDTH 1 /* HP2R_SC_POS_STS */
6316#define ARIZONA_HP2L_SC_NEG_STS 0x0020 /* HP2L_SC_NEG_STS */
6317#define ARIZONA_HP2L_SC_NEG_STS_MASK 0x0020 /* HP2L_SC_NEG_STS */
6318#define ARIZONA_HP2L_SC_NEG_STS_SHIFT 5 /* HP2L_SC_NEG_STS */
6319#define ARIZONA_HP2L_SC_NEG_STS_WIDTH 1 /* HP2L_SC_NEG_STS */
6320#define ARIZONA_HP2L_SC_POS_STS 0x0010 /* HP2L_SC_POS_STS */
6321#define ARIZONA_HP2L_SC_POS_STS_MASK 0x0010 /* HP2L_SC_POS_STS */
6322#define ARIZONA_HP2L_SC_POS_STS_SHIFT 4 /* HP2L_SC_POS_STS */
6323#define ARIZONA_HP2L_SC_POS_STS_WIDTH 1 /* HP2L_SC_POS_STS */
6324#define ARIZONA_HP1R_SC_NEG_STS 0x0008 /* HP1R_SC_NEG_STS */
6325#define ARIZONA_HP1R_SC_NEG_STS_MASK 0x0008 /* HP1R_SC_NEG_STS */
6326#define ARIZONA_HP1R_SC_NEG_STS_SHIFT 3 /* HP1R_SC_NEG_STS */
6327#define ARIZONA_HP1R_SC_NEG_STS_WIDTH 1 /* HP1R_SC_NEG_STS */
6328#define ARIZONA_HP1R_SC_POS_STS 0x0004 /* HP1R_SC_POS_STS */
6329#define ARIZONA_HP1R_SC_POS_STS_MASK 0x0004 /* HP1R_SC_POS_STS */
6330#define ARIZONA_HP1R_SC_POS_STS_SHIFT 2 /* HP1R_SC_POS_STS */
6331#define ARIZONA_HP1R_SC_POS_STS_WIDTH 1 /* HP1R_SC_POS_STS */
6332#define ARIZONA_HP1L_SC_NEG_STS 0x0002 /* HP1L_SC_NEG_STS */
6333#define ARIZONA_HP1L_SC_NEG_STS_MASK 0x0002 /* HP1L_SC_NEG_STS */
6334#define ARIZONA_HP1L_SC_NEG_STS_SHIFT 1 /* HP1L_SC_NEG_STS */
6335#define ARIZONA_HP1L_SC_NEG_STS_WIDTH 1 /* HP1L_SC_NEG_STS */
6336#define ARIZONA_HP1L_SC_POS_STS 0x0001 /* HP1L_SC_POS_STS */
6337#define ARIZONA_HP1L_SC_POS_STS_MASK 0x0001 /* HP1L_SC_POS_STS */
6338#define ARIZONA_HP1L_SC_POS_STS_SHIFT 0 /* HP1L_SC_POS_STS */
6339#define ARIZONA_HP1L_SC_POS_STS_WIDTH 1 /* HP1L_SC_POS_STS */
6340
6341/*
5637 * R3392 (0xD40) - IRQ Pin Status 6342 * R3392 (0xD40) - IRQ Pin Status
5638 */ 6343 */
5639#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */ 6344#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 887ef4f7bef7..fcbe9d129a9d 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -16,7 +16,9 @@
16#ifndef __LINUX_MFD_CROS_EC_H 16#ifndef __LINUX_MFD_CROS_EC_H
17#define __LINUX_MFD_CROS_EC_H 17#define __LINUX_MFD_CROS_EC_H
18 18
19#include <linux/notifier.h>
19#include <linux/mfd/cros_ec_commands.h> 20#include <linux/mfd/cros_ec_commands.h>
21#include <linux/mutex.h>
20 22
21/* 23/*
22 * Command interface between EC and AP, for LPC, I2C and SPI interfaces. 24 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
@@ -33,83 +35,76 @@ enum {
33 EC_MSG_TX_PROTO_BYTES, 35 EC_MSG_TX_PROTO_BYTES,
34}; 36};
35 37
36/** 38/*
37 * struct cros_ec_msg - A message sent to the EC, and its reply
38 *
39 * @version: Command version number (often 0) 39 * @version: Command version number (often 0)
40 * @cmd: Command to send (EC_CMD_...) 40 * @command: Command to send (EC_CMD_...)
41 * @out_buf: Outgoing payload (to EC) 41 * @outdata: Outgoing data to EC
42 * @outlen: Outgoing length 42 * @outsize: Outgoing length in bytes
43 * @in_buf: Incoming payload (from EC) 43 * @indata: Where to put the incoming data from EC
44 * @in_len: Incoming length 44 * @insize: Max number of bytes to accept from EC
45 * @result: EC's response to the command (separate from communication failure)
45 */ 46 */
46struct cros_ec_msg { 47struct cros_ec_command {
47 u8 version; 48 uint32_t version;
48 u8 cmd; 49 uint32_t command;
49 uint8_t *out_buf; 50 uint8_t *outdata;
50 int out_len; 51 uint32_t outsize;
51 uint8_t *in_buf; 52 uint8_t *indata;
52 int in_len; 53 uint32_t insize;
54 uint32_t result;
53}; 55};
54 56
55/** 57/**
56 * struct cros_ec_device - Information about a ChromeOS EC device 58 * struct cros_ec_device - Information about a ChromeOS EC device
57 * 59 *
58 * @name: Name of this EC interface 60 * @ec_name: name of EC device (e.g. 'chromeos-ec')
61 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
62 * @dev: Device pointer
63 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend
65 * @cmd_xfer: send command to EC and get response
66 * Returns the number of bytes received if the communication succeeded, but
67 * that doesn't mean the EC was happy with the command. The caller
68 * should check msg.result for the EC's result code.
69 *
59 * @priv: Private data 70 * @priv: Private data
60 * @irq: Interrupt to use 71 * @irq: Interrupt to use
61 * @din: input buffer (from EC) 72 * @din: input buffer (for data from EC)
62 * @dout: output buffer (to EC) 73 * @dout: output buffer (for data to EC)
63 * \note 74 * \note
64 * These two buffers will always be dword-aligned and include enough 75 * 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 76 * 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). 77 * 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 78 * We use this alignment to keep ARM and x86 happy. Probably word
69 * alignment would be OK, there might be a small performance advantage 79 * alignment would be OK, there might be a small performance advantage
70 * to using dword. 80 * to using dword.
71 * @din_size: size of din buffer 81 * @din_size: size of din buffer to allocate (zero to use static din)
72 * @dout_size: size of dout buffer 82 * @dout_size: size of dout buffer to allocate (zero to use static dout)
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) 83 * @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 84 * @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 85 * @lock: one transaction at a time
82 * sleep at the last suspend
83 * @event_notifier: interrupt event notifier for transport devices
84 */ 86 */
85struct cros_ec_device { 87struct cros_ec_device {
86 const char *name; 88
89 /* These are used by other drivers that want to talk to the EC */
90 const char *ec_name;
91 const char *phys_name;
92 struct device *dev;
93 bool was_wake_device;
94 struct class *cros_class;
95 int (*cmd_xfer)(struct cros_ec_device *ec,
96 struct cros_ec_command *msg);
97
98 /* These are used to implement the platform-specific interface */
87 void *priv; 99 void *priv;
88 int irq; 100 int irq;
89 uint8_t *din; 101 uint8_t *din;
90 uint8_t *dout; 102 uint8_t *dout;
91 int din_size; 103 int din_size;
92 int dout_size; 104 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; 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; 106 bool wake_enabled;
111 bool was_wake_device; 107 struct mutex lock;
112 struct blocking_notifier_head event_notifier;
113}; 108};
114 109
115/** 110/**
@@ -143,13 +138,24 @@ int cros_ec_resume(struct cros_ec_device *ec_dev);
143 * @msg: Message to write 138 * @msg: Message to write
144 */ 139 */
145int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, 140int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
146 struct cros_ec_msg *msg); 141 struct cros_ec_command *msg);
142
143/**
144 * cros_ec_check_result - Check ec_msg->result
145 *
146 * This is used by ChromeOS EC drivers to check the ec_msg->result for
147 * errors and to warn about them.
148 *
149 * @ec_dev: EC device
150 * @msg: Message to check
151 */
152int cros_ec_check_result(struct cros_ec_device *ec_dev,
153 struct cros_ec_command *msg);
147 154
148/** 155/**
149 * cros_ec_remove - Remove a ChromeOS EC 156 * cros_ec_remove - Remove a ChromeOS EC
150 * 157 *
151 * Call this to deregister a ChromeOS EC. After this you should call 158 * Call this to deregister a ChromeOS EC, then clean up any private data.
152 * cros_ec_free().
153 * 159 *
154 * @ec_dev: Device to register 160 * @ec_dev: Device to register
155 * @return 0 if ok, -ve on error 161 * @return 0 if ok, -ve on error
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 00a9aac5d1e8..b92a3262f8f6 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -34,7 +34,8 @@ enum da9063_models {
34}; 34};
35 35
36enum da9063_variant_codes { 36enum da9063_variant_codes {
37 PMIC_DA9063_BB = 0x5 37 PMIC_DA9063_AD = 0x3,
38 PMIC_DA9063_BB = 0x5,
38}; 39};
39 40
40/* Interrupts */ 41/* Interrupts */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
index 09a85c699da1..2e0ba6d5fbc3 100644
--- a/include/linux/mfd/da9063/registers.h
+++ b/include/linux/mfd/da9063/registers.h
@@ -104,16 +104,27 @@
104#define DA9063_REG_COUNT_D 0x43 104#define DA9063_REG_COUNT_D 0x43
105#define DA9063_REG_COUNT_MO 0x44 105#define DA9063_REG_COUNT_MO 0x44
106#define DA9063_REG_COUNT_Y 0x45 106#define DA9063_REG_COUNT_Y 0x45
107#define DA9063_REG_ALARM_S 0x46 107
108#define DA9063_REG_ALARM_MI 0x47 108#define DA9063_AD_REG_ALARM_MI 0x46
109#define DA9063_REG_ALARM_H 0x48 109#define DA9063_AD_REG_ALARM_H 0x47
110#define DA9063_REG_ALARM_D 0x49 110#define DA9063_AD_REG_ALARM_D 0x48
111#define DA9063_REG_ALARM_MO 0x4A 111#define DA9063_AD_REG_ALARM_MO 0x49
112#define DA9063_REG_ALARM_Y 0x4B 112#define DA9063_AD_REG_ALARM_Y 0x4A
113#define DA9063_REG_SECOND_A 0x4C 113#define DA9063_AD_REG_SECOND_A 0x4B
114#define DA9063_REG_SECOND_B 0x4D 114#define DA9063_AD_REG_SECOND_B 0x4C
115#define DA9063_REG_SECOND_C 0x4E 115#define DA9063_AD_REG_SECOND_C 0x4D
116#define DA9063_REG_SECOND_D 0x4F 116#define DA9063_AD_REG_SECOND_D 0x4E
117
118#define DA9063_BB_REG_ALARM_S 0x46
119#define DA9063_BB_REG_ALARM_MI 0x47
120#define DA9063_BB_REG_ALARM_H 0x48
121#define DA9063_BB_REG_ALARM_D 0x49
122#define DA9063_BB_REG_ALARM_MO 0x4A
123#define DA9063_BB_REG_ALARM_Y 0x4B
124#define DA9063_BB_REG_SECOND_A 0x4C
125#define DA9063_BB_REG_SECOND_B 0x4D
126#define DA9063_BB_REG_SECOND_C 0x4E
127#define DA9063_BB_REG_SECOND_D 0x4F
117 128
118/* Sequencer Control Registers */ 129/* Sequencer Control Registers */
119#define DA9063_REG_SEQ 0x81 130#define DA9063_REG_SEQ 0x81
@@ -223,37 +234,67 @@
223#define DA9063_REG_CONFIG_J 0x10F 234#define DA9063_REG_CONFIG_J 0x10F
224#define DA9063_REG_CONFIG_K 0x110 235#define DA9063_REG_CONFIG_K 0x110
225#define DA9063_REG_CONFIG_L 0x111 236#define DA9063_REG_CONFIG_L 0x111
226#define DA9063_REG_CONFIG_M 0x112 237
227#define DA9063_REG_CONFIG_N 0x113 238#define DA9063_AD_REG_MON_REG_1 0x112
228 239#define DA9063_AD_REG_MON_REG_2 0x113
229#define DA9063_REG_MON_REG_1 0x114 240#define DA9063_AD_REG_MON_REG_3 0x114
230#define DA9063_REG_MON_REG_2 0x115 241#define DA9063_AD_REG_MON_REG_4 0x115
231#define DA9063_REG_MON_REG_3 0x116 242#define DA9063_AD_REG_MON_REG_5 0x116
232#define DA9063_REG_MON_REG_4 0x117 243#define DA9063_AD_REG_MON_REG_6 0x117
233#define DA9063_REG_MON_REG_5 0x11E 244#define DA9063_AD_REG_TRIM_CLDR 0x118
234#define DA9063_REG_MON_REG_6 0x11F 245
235#define DA9063_REG_TRIM_CLDR 0x120 246#define DA9063_AD_REG_GP_ID_0 0x119
247#define DA9063_AD_REG_GP_ID_1 0x11A
248#define DA9063_AD_REG_GP_ID_2 0x11B
249#define DA9063_AD_REG_GP_ID_3 0x11C
250#define DA9063_AD_REG_GP_ID_4 0x11D
251#define DA9063_AD_REG_GP_ID_5 0x11E
252#define DA9063_AD_REG_GP_ID_6 0x11F
253#define DA9063_AD_REG_GP_ID_7 0x120
254#define DA9063_AD_REG_GP_ID_8 0x121
255#define DA9063_AD_REG_GP_ID_9 0x122
256#define DA9063_AD_REG_GP_ID_10 0x123
257#define DA9063_AD_REG_GP_ID_11 0x124
258#define DA9063_AD_REG_GP_ID_12 0x125
259#define DA9063_AD_REG_GP_ID_13 0x126
260#define DA9063_AD_REG_GP_ID_14 0x127
261#define DA9063_AD_REG_GP_ID_15 0x128
262#define DA9063_AD_REG_GP_ID_16 0x129
263#define DA9063_AD_REG_GP_ID_17 0x12A
264#define DA9063_AD_REG_GP_ID_18 0x12B
265#define DA9063_AD_REG_GP_ID_19 0x12C
266
267#define DA9063_BB_REG_CONFIG_M 0x112
268#define DA9063_BB_REG_CONFIG_N 0x113
269
270#define DA9063_BB_REG_MON_REG_1 0x114
271#define DA9063_BB_REG_MON_REG_2 0x115
272#define DA9063_BB_REG_MON_REG_3 0x116
273#define DA9063_BB_REG_MON_REG_4 0x117
274#define DA9063_BB_REG_MON_REG_5 0x11E
275#define DA9063_BB_REG_MON_REG_6 0x11F
276#define DA9063_BB_REG_TRIM_CLDR 0x120
236/* General Purpose Registers */ 277/* General Purpose Registers */
237#define DA9063_REG_GP_ID_0 0x121 278#define DA9063_BB_REG_GP_ID_0 0x121
238#define DA9063_REG_GP_ID_1 0x122 279#define DA9063_BB_REG_GP_ID_1 0x122
239#define DA9063_REG_GP_ID_2 0x123 280#define DA9063_BB_REG_GP_ID_2 0x123
240#define DA9063_REG_GP_ID_3 0x124 281#define DA9063_BB_REG_GP_ID_3 0x124
241#define DA9063_REG_GP_ID_4 0x125 282#define DA9063_BB_REG_GP_ID_4 0x125
242#define DA9063_REG_GP_ID_5 0x126 283#define DA9063_BB_REG_GP_ID_5 0x126
243#define DA9063_REG_GP_ID_6 0x127 284#define DA9063_BB_REG_GP_ID_6 0x127
244#define DA9063_REG_GP_ID_7 0x128 285#define DA9063_BB_REG_GP_ID_7 0x128
245#define DA9063_REG_GP_ID_8 0x129 286#define DA9063_BB_REG_GP_ID_8 0x129
246#define DA9063_REG_GP_ID_9 0x12A 287#define DA9063_BB_REG_GP_ID_9 0x12A
247#define DA9063_REG_GP_ID_10 0x12B 288#define DA9063_BB_REG_GP_ID_10 0x12B
248#define DA9063_REG_GP_ID_11 0x12C 289#define DA9063_BB_REG_GP_ID_11 0x12C
249#define DA9063_REG_GP_ID_12 0x12D 290#define DA9063_BB_REG_GP_ID_12 0x12D
250#define DA9063_REG_GP_ID_13 0x12E 291#define DA9063_BB_REG_GP_ID_13 0x12E
251#define DA9063_REG_GP_ID_14 0x12F 292#define DA9063_BB_REG_GP_ID_14 0x12F
252#define DA9063_REG_GP_ID_15 0x130 293#define DA9063_BB_REG_GP_ID_15 0x130
253#define DA9063_REG_GP_ID_16 0x131 294#define DA9063_BB_REG_GP_ID_16 0x131
254#define DA9063_REG_GP_ID_17 0x132 295#define DA9063_BB_REG_GP_ID_17 0x132
255#define DA9063_REG_GP_ID_18 0x133 296#define DA9063_BB_REG_GP_ID_18 0x133
256#define DA9063_REG_GP_ID_19 0x134 297#define DA9063_BB_REG_GP_ID_19 0x134
257 298
258/* Chip ID and variant */ 299/* Chip ID and variant */
259#define DA9063_REG_CHIP_ID 0x181 300#define DA9063_REG_CHIP_ID 0x181
@@ -404,10 +445,10 @@
404/* DA9063_REG_CONTROL_B (addr=0x0F) */ 445/* DA9063_REG_CONTROL_B (addr=0x0F) */
405#define DA9063_CHG_SEL 0x01 446#define DA9063_CHG_SEL 0x01
406#define DA9063_WATCHDOG_PD 0x02 447#define DA9063_WATCHDOG_PD 0x02
407#define DA9063_RESET_BLINKING 0x04 448#define DA9063_BB_RESET_BLINKING 0x04
408#define DA9063_NRES_MODE 0x08 449#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10 450#define DA9063_NONKEY_LOCK 0x10
410#define DA9063_BUCK_SLOWSTART 0x80 451#define DA9063_BB_BUCK_SLOWSTART 0x80
411 452
412/* DA9063_REG_CONTROL_C (addr=0x10) */ 453/* DA9063_REG_CONTROL_C (addr=0x10) */
413#define DA9063_DEBOUNCING_MASK 0x07 454#define DA9063_DEBOUNCING_MASK 0x07
@@ -467,7 +508,7 @@
467#define DA9063_GPADC_PAUSE 0x02 508#define DA9063_GPADC_PAUSE 0x02
468#define DA9063_PMIF_DIS 0x04 509#define DA9063_PMIF_DIS 0x04
469#define DA9063_HS2WIRE_DIS 0x08 510#define DA9063_HS2WIRE_DIS 0x08
470#define DA9063_CLDR_PAUSE 0x10 511#define DA9063_BB_CLDR_PAUSE 0x10
471#define DA9063_BBAT_DIS 0x20 512#define DA9063_BBAT_DIS 0x20
472#define DA9063_OUT_32K_PAUSE 0x40 513#define DA9063_OUT_32K_PAUSE 0x40
473#define DA9063_PMCONT_DIS 0x80 514#define DA9063_PMCONT_DIS 0x80
@@ -844,7 +885,7 @@
844#define DA9063_MONITOR 0x40 885#define DA9063_MONITOR 0x40
845 886
846/* DA9063_REG_ALARM_S (addr=0x46) */ 887/* DA9063_REG_ALARM_S (addr=0x46) */
847#define DA9063_ALARM_S_MASK 0x3F 888#define DA9063_BB_ALARM_S_MASK 0x3F
848#define DA9063_ALARM_STATUS_ALARM 0x80 889#define DA9063_ALARM_STATUS_ALARM 0x80
849#define DA9063_ALARM_STATUS_TICK 0x40 890#define DA9063_ALARM_STATUS_TICK 0x40
850/* DA9063_REG_ALARM_MI (addr=0x47) */ 891/* DA9063_REG_ALARM_MI (addr=0x47) */
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
new file mode 100644
index 000000000000..abcbfcf32d10
--- /dev/null
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -0,0 +1,30 @@
1/*
2 * intel_soc_pmic.h - Intel SoC PMIC Driver
3 *
4 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Author: Yang, Bin <bin.yang@intel.com>
16 * Author: Zhu, Lejun <lejun.zhu@linux.intel.com>
17 */
18
19#ifndef __INTEL_SOC_PMIC_H__
20#define __INTEL_SOC_PMIC_H__
21
22#include <linux/regmap.h>
23
24struct intel_soc_pmic {
25 int irq;
26 struct regmap *regmap;
27 struct regmap_irq_chip_data *irq_chip_data;
28};
29
30#endif /* __INTEL_SOC_PMIC_H__ */
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h
index 8c75a9c8dfab..960b92ad450d 100644
--- a/include/linux/mfd/max77686-private.h
+++ b/include/linux/mfd/max77686-private.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686-private.h - Voltage regulator driver for the Maxim 77686 2 * max77686-private.h - Voltage regulator driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -28,6 +28,7 @@
28 28
29#define MAX77686_REG_INVALID (0xff) 29#define MAX77686_REG_INVALID (0xff)
30 30
31/* MAX77686 PMIC registers */
31enum max77686_pmic_reg { 32enum max77686_pmic_reg {
32 MAX77686_REG_DEVICE_ID = 0x00, 33 MAX77686_REG_DEVICE_ID = 0x00,
33 MAX77686_REG_INTSRC = 0x01, 34 MAX77686_REG_INTSRC = 0x01,
@@ -181,8 +182,209 @@ enum max77686_rtc_reg {
181 MAX77686_ALARM2_DATE = 0x1B, 182 MAX77686_ALARM2_DATE = 0x1B,
182}; 183};
183 184
184#define MAX77686_IRQSRC_PMIC (0) 185/* MAX77802 PMIC registers */
185#define MAX77686_IRQSRC_RTC (1 << 0) 186enum max77802_pmic_reg {
187 MAX77802_REG_DEVICE_ID = 0x00,
188 MAX77802_REG_INTSRC = 0x01,
189 MAX77802_REG_INT1 = 0x02,
190 MAX77802_REG_INT2 = 0x03,
191
192 MAX77802_REG_INT1MSK = 0x04,
193 MAX77802_REG_INT2MSK = 0x05,
194
195 MAX77802_REG_STATUS1 = 0x06,
196 MAX77802_REG_STATUS2 = 0x07,
197
198 MAX77802_REG_PWRON = 0x08,
199 /* Reserved: 0x09 */
200 MAX77802_REG_MRSTB = 0x0A,
201 MAX77802_REG_EPWRHOLD = 0x0B,
202 /* Reserved: 0x0C-0x0D */
203 MAX77802_REG_BOOSTCTRL = 0x0E,
204 MAX77802_REG_BOOSTOUT = 0x0F,
205
206 MAX77802_REG_BUCK1CTRL = 0x10,
207 MAX77802_REG_BUCK1DVS1 = 0x11,
208 MAX77802_REG_BUCK1DVS2 = 0x12,
209 MAX77802_REG_BUCK1DVS3 = 0x13,
210 MAX77802_REG_BUCK1DVS4 = 0x14,
211 MAX77802_REG_BUCK1DVS5 = 0x15,
212 MAX77802_REG_BUCK1DVS6 = 0x16,
213 MAX77802_REG_BUCK1DVS7 = 0x17,
214 MAX77802_REG_BUCK1DVS8 = 0x18,
215 /* Reserved: 0x19 */
216 MAX77802_REG_BUCK2CTRL1 = 0x1A,
217 MAX77802_REG_BUCK2CTRL2 = 0x1B,
218 MAX77802_REG_BUCK2PHTRAN = 0x1C,
219 MAX77802_REG_BUCK2DVS1 = 0x1D,
220 MAX77802_REG_BUCK2DVS2 = 0x1E,
221 MAX77802_REG_BUCK2DVS3 = 0x1F,
222 MAX77802_REG_BUCK2DVS4 = 0x20,
223 MAX77802_REG_BUCK2DVS5 = 0x21,
224 MAX77802_REG_BUCK2DVS6 = 0x22,
225 MAX77802_REG_BUCK2DVS7 = 0x23,
226 MAX77802_REG_BUCK2DVS8 = 0x24,
227 /* Reserved: 0x25-0x26 */
228 MAX77802_REG_BUCK3CTRL1 = 0x27,
229 MAX77802_REG_BUCK3DVS1 = 0x28,
230 MAX77802_REG_BUCK3DVS2 = 0x29,
231 MAX77802_REG_BUCK3DVS3 = 0x2A,
232 MAX77802_REG_BUCK3DVS4 = 0x2B,
233 MAX77802_REG_BUCK3DVS5 = 0x2C,
234 MAX77802_REG_BUCK3DVS6 = 0x2D,
235 MAX77802_REG_BUCK3DVS7 = 0x2E,
236 MAX77802_REG_BUCK3DVS8 = 0x2F,
237 /* Reserved: 0x30-0x36 */
238 MAX77802_REG_BUCK4CTRL1 = 0x37,
239 MAX77802_REG_BUCK4DVS1 = 0x38,
240 MAX77802_REG_BUCK4DVS2 = 0x39,
241 MAX77802_REG_BUCK4DVS3 = 0x3A,
242 MAX77802_REG_BUCK4DVS4 = 0x3B,
243 MAX77802_REG_BUCK4DVS5 = 0x3C,
244 MAX77802_REG_BUCK4DVS6 = 0x3D,
245 MAX77802_REG_BUCK4DVS7 = 0x3E,
246 MAX77802_REG_BUCK4DVS8 = 0x3F,
247 /* Reserved: 0x40 */
248 MAX77802_REG_BUCK5CTRL = 0x41,
249 MAX77802_REG_BUCK5OUT = 0x42,
250 /* Reserved: 0x43 */
251 MAX77802_REG_BUCK6CTRL = 0x44,
252 MAX77802_REG_BUCK6DVS1 = 0x45,
253 MAX77802_REG_BUCK6DVS2 = 0x46,
254 MAX77802_REG_BUCK6DVS3 = 0x47,
255 MAX77802_REG_BUCK6DVS4 = 0x48,
256 MAX77802_REG_BUCK6DVS5 = 0x49,
257 MAX77802_REG_BUCK6DVS6 = 0x4A,
258 MAX77802_REG_BUCK6DVS7 = 0x4B,
259 MAX77802_REG_BUCK6DVS8 = 0x4C,
260 /* Reserved: 0x4D */
261 MAX77802_REG_BUCK7CTRL = 0x4E,
262 MAX77802_REG_BUCK7OUT = 0x4F,
263 /* Reserved: 0x50 */
264 MAX77802_REG_BUCK8CTRL = 0x51,
265 MAX77802_REG_BUCK8OUT = 0x52,
266 /* Reserved: 0x53 */
267 MAX77802_REG_BUCK9CTRL = 0x54,
268 MAX77802_REG_BUCK9OUT = 0x55,
269 /* Reserved: 0x56 */
270 MAX77802_REG_BUCK10CTRL = 0x57,
271 MAX77802_REG_BUCK10OUT = 0x58,
272
273 /* Reserved: 0x59-0x5F */
274
275 MAX77802_REG_LDO1CTRL1 = 0x60,
276 MAX77802_REG_LDO2CTRL1 = 0x61,
277 MAX77802_REG_LDO3CTRL1 = 0x62,
278 MAX77802_REG_LDO4CTRL1 = 0x63,
279 MAX77802_REG_LDO5CTRL1 = 0x64,
280 MAX77802_REG_LDO6CTRL1 = 0x65,
281 MAX77802_REG_LDO7CTRL1 = 0x66,
282 MAX77802_REG_LDO8CTRL1 = 0x67,
283 MAX77802_REG_LDO9CTRL1 = 0x68,
284 MAX77802_REG_LDO10CTRL1 = 0x69,
285 MAX77802_REG_LDO11CTRL1 = 0x6A,
286 MAX77802_REG_LDO12CTRL1 = 0x6B,
287 MAX77802_REG_LDO13CTRL1 = 0x6C,
288 MAX77802_REG_LDO14CTRL1 = 0x6D,
289 MAX77802_REG_LDO15CTRL1 = 0x6E,
290 /* Reserved: 0x6F */
291 MAX77802_REG_LDO17CTRL1 = 0x70,
292 MAX77802_REG_LDO18CTRL1 = 0x71,
293 MAX77802_REG_LDO19CTRL1 = 0x72,
294 MAX77802_REG_LDO20CTRL1 = 0x73,
295 MAX77802_REG_LDO21CTRL1 = 0x74,
296 MAX77802_REG_LDO22CTRL1 = 0x75,
297 MAX77802_REG_LDO23CTRL1 = 0x76,
298 MAX77802_REG_LDO24CTRL1 = 0x77,
299 MAX77802_REG_LDO25CTRL1 = 0x78,
300 MAX77802_REG_LDO26CTRL1 = 0x79,
301 MAX77802_REG_LDO27CTRL1 = 0x7A,
302 MAX77802_REG_LDO28CTRL1 = 0x7B,
303 MAX77802_REG_LDO29CTRL1 = 0x7C,
304 MAX77802_REG_LDO30CTRL1 = 0x7D,
305 /* Reserved: 0x7E */
306 MAX77802_REG_LDO32CTRL1 = 0x7F,
307 MAX77802_REG_LDO33CTRL1 = 0x80,
308 MAX77802_REG_LDO34CTRL1 = 0x81,
309 MAX77802_REG_LDO35CTRL1 = 0x82,
310 /* Reserved: 0x83-0x8F */
311 MAX77802_REG_LDO1CTRL2 = 0x90,
312 MAX77802_REG_LDO2CTRL2 = 0x91,
313 MAX77802_REG_LDO3CTRL2 = 0x92,
314 MAX77802_REG_LDO4CTRL2 = 0x93,
315 MAX77802_REG_LDO5CTRL2 = 0x94,
316 MAX77802_REG_LDO6CTRL2 = 0x95,
317 MAX77802_REG_LDO7CTRL2 = 0x96,
318 MAX77802_REG_LDO8CTRL2 = 0x97,
319 MAX77802_REG_LDO9CTRL2 = 0x98,
320 MAX77802_REG_LDO10CTRL2 = 0x99,
321 MAX77802_REG_LDO11CTRL2 = 0x9A,
322 MAX77802_REG_LDO12CTRL2 = 0x9B,
323 MAX77802_REG_LDO13CTRL2 = 0x9C,
324 MAX77802_REG_LDO14CTRL2 = 0x9D,
325 MAX77802_REG_LDO15CTRL2 = 0x9E,
326 /* Reserved: 0x9F */
327 MAX77802_REG_LDO17CTRL2 = 0xA0,
328 MAX77802_REG_LDO18CTRL2 = 0xA1,
329 MAX77802_REG_LDO19CTRL2 = 0xA2,
330 MAX77802_REG_LDO20CTRL2 = 0xA3,
331 MAX77802_REG_LDO21CTRL2 = 0xA4,
332 MAX77802_REG_LDO22CTRL2 = 0xA5,
333 MAX77802_REG_LDO23CTRL2 = 0xA6,
334 MAX77802_REG_LDO24CTRL2 = 0xA7,
335 MAX77802_REG_LDO25CTRL2 = 0xA8,
336 MAX77802_REG_LDO26CTRL2 = 0xA9,
337 MAX77802_REG_LDO27CTRL2 = 0xAA,
338 MAX77802_REG_LDO28CTRL2 = 0xAB,
339 MAX77802_REG_LDO29CTRL2 = 0xAC,
340 MAX77802_REG_LDO30CTRL2 = 0xAD,
341 /* Reserved: 0xAE */
342 MAX77802_REG_LDO32CTRL2 = 0xAF,
343 MAX77802_REG_LDO33CTRL2 = 0xB0,
344 MAX77802_REG_LDO34CTRL2 = 0xB1,
345 MAX77802_REG_LDO35CTRL2 = 0xB2,
346 /* Reserved: 0xB3 */
347
348 MAX77802_REG_BBAT_CHG = 0xB4,
349 MAX77802_REG_32KHZ = 0xB5,
350
351 MAX77802_REG_PMIC_END = 0xB6,
352};
353
354enum max77802_rtc_reg {
355 MAX77802_RTC_INT = 0xC0,
356 MAX77802_RTC_INTM = 0xC1,
357 MAX77802_RTC_CONTROLM = 0xC2,
358 MAX77802_RTC_CONTROL = 0xC3,
359 MAX77802_RTC_UPDATE0 = 0xC4,
360 MAX77802_RTC_UPDATE1 = 0xC5,
361 MAX77802_WTSR_SMPL_CNTL = 0xC6,
362 MAX77802_RTC_SEC = 0xC7,
363 MAX77802_RTC_MIN = 0xC8,
364 MAX77802_RTC_HOUR = 0xC9,
365 MAX77802_RTC_WEEKDAY = 0xCA,
366 MAX77802_RTC_MONTH = 0xCB,
367 MAX77802_RTC_YEAR = 0xCC,
368 MAX77802_RTC_DATE = 0xCD,
369 MAX77802_RTC_AE1 = 0xCE,
370 MAX77802_ALARM1_SEC = 0xCF,
371 MAX77802_ALARM1_MIN = 0xD0,
372 MAX77802_ALARM1_HOUR = 0xD1,
373 MAX77802_ALARM1_WEEKDAY = 0xD2,
374 MAX77802_ALARM1_MONTH = 0xD3,
375 MAX77802_ALARM1_YEAR = 0xD4,
376 MAX77802_ALARM1_DATE = 0xD5,
377 MAX77802_RTC_AE2 = 0xD6,
378 MAX77802_ALARM2_SEC = 0xD7,
379 MAX77802_ALARM2_MIN = 0xD8,
380 MAX77802_ALARM2_HOUR = 0xD9,
381 MAX77802_ALARM2_WEEKDAY = 0xDA,
382 MAX77802_ALARM2_MONTH = 0xDB,
383 MAX77802_ALARM2_YEAR = 0xDC,
384 MAX77802_ALARM2_DATE = 0xDD,
385
386 MAX77802_RTC_END = 0xDF,
387};
186 388
187enum max77686_irq_source { 389enum max77686_irq_source {
188 PMIC_INT1 = 0, 390 PMIC_INT1 = 0,
@@ -205,30 +407,46 @@ enum max77686_irq {
205 MAX77686_PMICIRQ_140C, 407 MAX77686_PMICIRQ_140C,
206 MAX77686_PMICIRQ_120C, 408 MAX77686_PMICIRQ_120C,
207 409
208 MAX77686_RTCIRQ_RTC60S, 410 MAX77686_RTCIRQ_RTC60S = 0,
209 MAX77686_RTCIRQ_RTCA1, 411 MAX77686_RTCIRQ_RTCA1,
210 MAX77686_RTCIRQ_RTCA2, 412 MAX77686_RTCIRQ_RTCA2,
211 MAX77686_RTCIRQ_SMPL, 413 MAX77686_RTCIRQ_SMPL,
212 MAX77686_RTCIRQ_RTC1S, 414 MAX77686_RTCIRQ_RTC1S,
213 MAX77686_RTCIRQ_WTSR, 415 MAX77686_RTCIRQ_WTSR,
214
215 MAX77686_IRQ_NR,
216}; 416};
217 417
418#define MAX77686_INT1_PWRONF_MSK BIT(0)
419#define MAX77686_INT1_PWRONR_MSK BIT(1)
420#define MAX77686_INT1_JIGONBF_MSK BIT(2)
421#define MAX77686_INT1_JIGONBR_MSK BIT(3)
422#define MAX77686_INT1_ACOKBF_MSK BIT(4)
423#define MAX77686_INT1_ACOKBR_MSK BIT(5)
424#define MAX77686_INT1_ONKEY1S_MSK BIT(6)
425#define MAX77686_INT1_MRSTB_MSK BIT(7)
426
427#define MAX77686_INT2_140C_MSK BIT(0)
428#define MAX77686_INT2_120C_MSK BIT(1)
429
430#define MAX77686_RTCINT_RTC60S_MSK BIT(0)
431#define MAX77686_RTCINT_RTCA1_MSK BIT(1)
432#define MAX77686_RTCINT_RTCA2_MSK BIT(2)
433#define MAX77686_RTCINT_SMPL_MSK BIT(3)
434#define MAX77686_RTCINT_RTC1S_MSK BIT(4)
435#define MAX77686_RTCINT_WTSR_MSK BIT(5)
436
218struct max77686_dev { 437struct max77686_dev {
219 struct device *dev; 438 struct device *dev;
220 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 439 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
221 struct i2c_client *rtc; /* slave addr 0x0c */ 440 struct i2c_client *rtc; /* slave addr 0x0c */
222 441
223 int type; 442 unsigned long type;
224 443
225 struct regmap *regmap; /* regmap for mfd */ 444 struct regmap *regmap; /* regmap for mfd */
226 struct regmap *rtc_regmap; /* regmap for rtc */ 445 struct regmap *rtc_regmap; /* regmap for rtc */
227 446 struct regmap_irq_chip_data *irq_data;
228 struct irq_domain *irq_domain; 447 struct regmap_irq_chip_data *rtc_irq_data;
229 448
230 int irq; 449 int irq;
231 int irq_gpio;
232 bool wakeup; 450 bool wakeup;
233 struct mutex irqlock; 451 struct mutex irqlock;
234 int irq_masks_cur[MAX77686_IRQ_GROUP_NR]; 452 int irq_masks_cur[MAX77686_IRQ_GROUP_NR];
@@ -237,6 +455,7 @@ struct max77686_dev {
237 455
238enum max77686_types { 456enum max77686_types {
239 TYPE_MAX77686, 457 TYPE_MAX77686,
458 TYPE_MAX77802,
240}; 459};
241 460
242extern int max77686_irq_init(struct max77686_dev *max77686); 461extern int max77686_irq_init(struct max77686_dev *max77686);
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 46c0f320ed76..7e6dc4b2b795 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686.h - Driver for the Maxim 77686 2 * max77686.h - Driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -71,6 +71,54 @@ enum max77686_regulators {
71 MAX77686_REG_MAX, 71 MAX77686_REG_MAX,
72}; 72};
73 73
74/* MAX77802 regulator IDs */
75enum max77802_regulators {
76 MAX77802_BUCK1 = 0,
77 MAX77802_BUCK2,
78 MAX77802_BUCK3,
79 MAX77802_BUCK4,
80 MAX77802_BUCK5,
81 MAX77802_BUCK6,
82 MAX77802_BUCK7,
83 MAX77802_BUCK8,
84 MAX77802_BUCK9,
85 MAX77802_BUCK10,
86 MAX77802_LDO1,
87 MAX77802_LDO2,
88 MAX77802_LDO3,
89 MAX77802_LDO4,
90 MAX77802_LDO5,
91 MAX77802_LDO6,
92 MAX77802_LDO7,
93 MAX77802_LDO8,
94 MAX77802_LDO9,
95 MAX77802_LDO10,
96 MAX77802_LDO11,
97 MAX77802_LDO12,
98 MAX77802_LDO13,
99 MAX77802_LDO14,
100 MAX77802_LDO15,
101 MAX77802_LDO17,
102 MAX77802_LDO18,
103 MAX77802_LDO19,
104 MAX77802_LDO20,
105 MAX77802_LDO21,
106 MAX77802_LDO23,
107 MAX77802_LDO24,
108 MAX77802_LDO25,
109 MAX77802_LDO26,
110 MAX77802_LDO27,
111 MAX77802_LDO28,
112 MAX77802_LDO29,
113 MAX77802_LDO30,
114 MAX77802_LDO32,
115 MAX77802_LDO33,
116 MAX77802_LDO34,
117 MAX77802_LDO35,
118
119 MAX77802_REG_MAX,
120};
121
74struct max77686_regulator_data { 122struct max77686_regulator_data {
75 int id; 123 int id;
76 struct regulator_init_data *initdata; 124 struct regulator_init_data *initdata;
@@ -83,14 +131,19 @@ enum max77686_opmode {
83 MAX77686_OPMODE_STANDBY, 131 MAX77686_OPMODE_STANDBY,
84}; 132};
85 133
134enum max77802_opmode {
135 MAX77802_OPMODE_OFF,
136 MAX77802_OPMODE_STANDBY,
137 MAX77802_OPMODE_LP,
138 MAX77802_OPMODE_NORMAL,
139};
140
86struct max77686_opmode_data { 141struct max77686_opmode_data {
87 int id; 142 int id;
88 int mode; 143 int mode;
89}; 144};
90 145
91struct max77686_platform_data { 146struct max77686_platform_data {
92 /* IRQ */
93 int irq_gpio;
94 int ono; 147 int ono;
95 int wakeup; 148 int wakeup;
96 149
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 3e050b933dd0..c466ff3e16b8 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -262,6 +262,41 @@ enum max77693_irq_source {
262 MAX77693_IRQ_GROUP_NR, 262 MAX77693_IRQ_GROUP_NR,
263}; 263};
264 264
265#define LED_IRQ_FLED2_OPEN BIT(0)
266#define LED_IRQ_FLED2_SHORT BIT(1)
267#define LED_IRQ_FLED1_OPEN BIT(2)
268#define LED_IRQ_FLED1_SHORT BIT(3)
269#define LED_IRQ_MAX_FLASH BIT(4)
270
271#define TOPSYS_IRQ_T120C_INT BIT(0)
272#define TOPSYS_IRQ_T140C_INT BIT(1)
273#define TOPSYS_IRQ_LOWSYS_INT BIT(3)
274
275#define CHG_IRQ_BYP_I BIT(0)
276#define CHG_IRQ_THM_I BIT(2)
277#define CHG_IRQ_BAT_I BIT(3)
278#define CHG_IRQ_CHG_I BIT(4)
279#define CHG_IRQ_CHGIN_I BIT(6)
280
281#define MUIC_IRQ_INT1_ADC BIT(0)
282#define MUIC_IRQ_INT1_ADC_LOW BIT(1)
283#define MUIC_IRQ_INT1_ADC_ERR BIT(2)
284#define MUIC_IRQ_INT1_ADC1K BIT(3)
285
286#define MUIC_IRQ_INT2_CHGTYP BIT(0)
287#define MUIC_IRQ_INT2_CHGDETREUN BIT(1)
288#define MUIC_IRQ_INT2_DCDTMR BIT(2)
289#define MUIC_IRQ_INT2_DXOVP BIT(3)
290#define MUIC_IRQ_INT2_VBVOLT BIT(4)
291#define MUIC_IRQ_INT2_VIDRM BIT(5)
292
293#define MUIC_IRQ_INT3_EOC BIT(0)
294#define MUIC_IRQ_INT3_CGMBC BIT(1)
295#define MUIC_IRQ_INT3_OVP BIT(2)
296#define MUIC_IRQ_INT3_MBCCHG_ERR BIT(3)
297#define MUIC_IRQ_INT3_CHG_ENABLED BIT(4)
298#define MUIC_IRQ_INT3_BAT_DET BIT(5)
299
265enum max77693_irq { 300enum max77693_irq {
266 /* PMIC - FLASH */ 301 /* PMIC - FLASH */
267 MAX77693_LED_IRQ_FLED2_OPEN, 302 MAX77693_LED_IRQ_FLED2_OPEN,
@@ -282,6 +317,10 @@ enum max77693_irq {
282 MAX77693_CHG_IRQ_CHG_I, 317 MAX77693_CHG_IRQ_CHG_I,
283 MAX77693_CHG_IRQ_CHGIN_I, 318 MAX77693_CHG_IRQ_CHGIN_I,
284 319
320 MAX77693_IRQ_NR,
321};
322
323enum max77693_irq_muic {
285 /* MUIC INT1 */ 324 /* MUIC INT1 */
286 MAX77693_MUIC_IRQ_INT1_ADC, 325 MAX77693_MUIC_IRQ_INT1_ADC,
287 MAX77693_MUIC_IRQ_INT1_ADC_LOW, 326 MAX77693_MUIC_IRQ_INT1_ADC_LOW,
@@ -304,7 +343,7 @@ enum max77693_irq {
304 MAX77693_MUIC_IRQ_INT3_CHG_ENABLED, 343 MAX77693_MUIC_IRQ_INT3_CHG_ENABLED,
305 MAX77693_MUIC_IRQ_INT3_BAT_DET, 344 MAX77693_MUIC_IRQ_INT3_BAT_DET,
306 345
307 MAX77693_IRQ_NR, 346 MAX77693_MUIC_IRQ_NR,
308}; 347};
309 348
310struct max77693_dev { 349struct max77693_dev {
@@ -319,7 +358,10 @@ struct max77693_dev {
319 struct regmap *regmap_muic; 358 struct regmap *regmap_muic;
320 struct regmap *regmap_haptic; 359 struct regmap *regmap_haptic;
321 360
322 struct irq_domain *irq_domain; 361 struct regmap_irq_chip_data *irq_data_led;
362 struct regmap_irq_chip_data *irq_data_topsys;
363 struct regmap_irq_chip_data *irq_data_charger;
364 struct regmap_irq_chip_data *irq_data_muic;
323 365
324 int irq; 366 int irq;
325 int irq_gpio; 367 int irq_gpio;
@@ -332,14 +374,6 @@ enum max77693_types {
332 TYPE_MAX77693, 374 TYPE_MAX77693,
333}; 375};
334 376
335extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest);
336extern int max77693_bulk_read(struct regmap *map, u8 reg, int count,
337 u8 *buf);
338extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value);
339extern int max77693_bulk_write(struct regmap *map, u8 reg, int count,
340 u8 *buf);
341extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask);
342
343extern int max77693_irq_init(struct max77693_dev *max77686); 377extern int max77693_irq_init(struct max77693_dev *max77686);
344extern void max77693_irq_exit(struct max77693_dev *max77686); 378extern void max77693_irq_exit(struct max77693_dev *max77686);
345extern int max77693_irq_resume(struct max77693_dev *max77686); 379extern int max77693_irq_resume(struct max77693_dev *max77686);
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index a8eeda773a7b..4ff6137d8d67 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -86,6 +86,5 @@
86#define MC13783_IRQ_HSL 43 86#define MC13783_IRQ_HSL 43
87#define MC13783_IRQ_ALSPTH 44 87#define MC13783_IRQ_ALSPTH 44
88#define MC13783_IRQ_AHSSHORT 45 88#define MC13783_IRQ_AHSSHORT 45
89#define MC13783_NUM_IRQ MC13XXX_NUM_IRQ
90 89
91#endif /* ifndef __LINUX_MFD_MC13783_H */ 90#endif /* ifndef __LINUX_MFD_MC13783_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index d63b1d309106..638222e43e48 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -23,15 +23,10 @@ int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
23 23
24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq, 24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
25 irq_handler_t handler, const char *name, void *dev); 25 irq_handler_t handler, const char *name, void *dev);
26int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
27 irq_handler_t handler, const char *name, void *dev);
28int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev); 26int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev);
29 27
30int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
31int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
32int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq, 28int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq,
33 int *enabled, int *pending); 29 int *enabled, int *pending);
34int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
35 30
36int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 31int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
37 32
@@ -39,6 +34,22 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
39 unsigned int mode, unsigned int channel, 34 unsigned int mode, unsigned int channel,
40 u8 ato, bool atox, unsigned int *sample); 35 u8 ato, bool atox, unsigned int *sample);
41 36
37/* Deprecated calls */
38static inline int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq)
39{
40 return 0;
41}
42
43static inline int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
44 irq_handler_t handler,
45 const char *name, void *dev)
46{
47 return mc13xxx_irq_request(mc13xxx, irq, handler, name, dev);
48}
49
50int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
51int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
52
42#define MC13783_AUDIO_RX0 36 53#define MC13783_AUDIO_RX0 36
43#define MC13783_AUDIO_RX1 37 54#define MC13783_AUDIO_RX1 37
44#define MC13783_AUDIO_TX 38 55#define MC13783_AUDIO_TX 38
@@ -68,8 +79,6 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
68#define MC13XXX_IRQ_THWARNH 37 79#define MC13XXX_IRQ_THWARNH 37
69#define MC13XXX_IRQ_CLK 38 80#define MC13XXX_IRQ_CLK 38
70 81
71#define MC13XXX_NUM_IRQ 46
72
73struct regulator_init_data; 82struct regulator_init_data;
74 83
75struct mc13xxx_regulator_init_data { 84struct mc13xxx_regulator_init_data {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 3420e09e2e20..fb0390a1a498 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -30,6 +30,8 @@
30#define PALMAS_CHIP_ID 0xC035 30#define PALMAS_CHIP_ID 0xC035
31#define PALMAS_CHIP_CHARGER_ID 0xC036 31#define PALMAS_CHIP_CHARGER_ID 0xC036
32 32
33#define TPS65917_RESERVED -1
34
33#define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \ 35#define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \
34 ((a) == PALMAS_CHIP_ID)) 36 ((a) == PALMAS_CHIP_ID))
35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) 37#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
@@ -51,6 +53,8 @@ struct palmas_pmic;
51struct palmas_gpadc; 53struct palmas_gpadc;
52struct palmas_resource; 54struct palmas_resource;
53struct palmas_usb; 55struct palmas_usb;
56struct palmas_pmic_driver_data;
57struct palmas_pmic_platform_data;
54 58
55enum palmas_usb_state { 59enum palmas_usb_state {
56 PALMAS_USB_STATE_DISCONNECT, 60 PALMAS_USB_STATE_DISCONNECT,
@@ -74,6 +78,8 @@ struct palmas {
74 struct mutex irq_lock; 78 struct mutex irq_lock;
75 struct regmap_irq_chip_data *irq_data; 79 struct regmap_irq_chip_data *irq_data;
76 80
81 struct palmas_pmic_driver_data *pmic_ddata;
82
77 /* Child Devices */ 83 /* Child Devices */
78 struct palmas_pmic *pmic; 84 struct palmas_pmic *pmic;
79 struct palmas_gpadc *gpadc; 85 struct palmas_gpadc *gpadc;
@@ -86,6 +92,46 @@ struct palmas {
86 u8 pwm_muxed; 92 u8 pwm_muxed;
87}; 93};
88 94
95#define PALMAS_EXT_REQ (PALMAS_EXT_CONTROL_ENABLE1 | \
96 PALMAS_EXT_CONTROL_ENABLE2 | \
97 PALMAS_EXT_CONTROL_NSLEEP)
98
99struct palmas_sleep_requestor_info {
100 int id;
101 int reg_offset;
102 int bit_pos;
103};
104
105struct palmas_regs_info {
106 char *name;
107 char *sname;
108 u8 vsel_addr;
109 u8 ctrl_addr;
110 u8 tstep_addr;
111 int sleep_id;
112};
113
114struct palmas_pmic_driver_data {
115 int smps_start;
116 int smps_end;
117 int ldo_begin;
118 int ldo_end;
119 int max_reg;
120 struct palmas_regs_info *palmas_regs_info;
121 struct of_regulator_match *palmas_matches;
122 struct palmas_sleep_requestor_info *sleep_req_info;
123 int (*smps_register)(struct palmas_pmic *pmic,
124 struct palmas_pmic_driver_data *ddata,
125 struct palmas_pmic_platform_data *pdata,
126 const char *pdev_name,
127 struct regulator_config config);
128 int (*ldo_register)(struct palmas_pmic *pmic,
129 struct palmas_pmic_driver_data *ddata,
130 struct palmas_pmic_platform_data *pdata,
131 const char *pdev_name,
132 struct regulator_config config);
133};
134
89struct palmas_gpadc_platform_data { 135struct palmas_gpadc_platform_data {
90 /* Channel 3 current source is only enabled during conversion */ 136 /* Channel 3 current source is only enabled during conversion */
91 int ch3_current; 137 int ch3_current;
@@ -184,6 +230,27 @@ enum palmas_regulators {
184 PALMAS_NUM_REGS, 230 PALMAS_NUM_REGS,
185}; 231};
186 232
233enum tps65917_regulators {
234 /* SMPS regulators */
235 TPS65917_REG_SMPS1,
236 TPS65917_REG_SMPS2,
237 TPS65917_REG_SMPS3,
238 TPS65917_REG_SMPS4,
239 TPS65917_REG_SMPS5,
240 /* LDO regulators */
241 TPS65917_REG_LDO1,
242 TPS65917_REG_LDO2,
243 TPS65917_REG_LDO3,
244 TPS65917_REG_LDO4,
245 TPS65917_REG_LDO5,
246 TPS65917_REG_REGEN1,
247 TPS65917_REG_REGEN2,
248 TPS65917_REG_REGEN3,
249
250 /* Total number of regulators */
251 TPS65917_NUM_REGS,
252};
253
187/* External controll signal name */ 254/* External controll signal name */
188enum { 255enum {
189 PALMAS_EXT_CONTROL_ENABLE1 = 0x1, 256 PALMAS_EXT_CONTROL_ENABLE1 = 0x1,
@@ -228,6 +295,24 @@ enum palmas_external_requestor_id {
228 PALMAS_EXTERNAL_REQSTR_ID_MAX, 295 PALMAS_EXTERNAL_REQSTR_ID_MAX,
229}; 296};
230 297
298enum tps65917_external_requestor_id {
299 TPS65917_EXTERNAL_REQSTR_ID_REGEN1,
300 TPS65917_EXTERNAL_REQSTR_ID_REGEN2,
301 TPS65917_EXTERNAL_REQSTR_ID_REGEN3,
302 TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
303 TPS65917_EXTERNAL_REQSTR_ID_SMPS2,
304 TPS65917_EXTERNAL_REQSTR_ID_SMPS3,
305 TPS65917_EXTERNAL_REQSTR_ID_SMPS4,
306 TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
307 TPS65917_EXTERNAL_REQSTR_ID_LDO1,
308 TPS65917_EXTERNAL_REQSTR_ID_LDO2,
309 TPS65917_EXTERNAL_REQSTR_ID_LDO3,
310 TPS65917_EXTERNAL_REQSTR_ID_LDO4,
311 TPS65917_EXTERNAL_REQSTR_ID_LDO5,
312 /* Last entry */
313 TPS65917_EXTERNAL_REQSTR_ID_MAX,
314};
315
231struct palmas_pmic_platform_data { 316struct palmas_pmic_platform_data {
232 /* An array of pointers to regulator init data indexed by regulator 317 /* An array of pointers to regulator init data indexed by regulator
233 * ID 318 * ID
@@ -349,6 +434,48 @@ struct palmas_gpadc_result {
349 434
350#define PALMAS_MAX_CHANNELS 16 435#define PALMAS_MAX_CHANNELS 16
351 436
437/* Define the tps65917 IRQ numbers */
438enum tps65917_irqs {
439 /* INT1 registers */
440 TPS65917_RESERVED1,
441 TPS65917_PWRON_IRQ,
442 TPS65917_LONG_PRESS_KEY_IRQ,
443 TPS65917_RESERVED2,
444 TPS65917_PWRDOWN_IRQ,
445 TPS65917_HOTDIE_IRQ,
446 TPS65917_VSYS_MON_IRQ,
447 TPS65917_RESERVED3,
448 /* INT2 registers */
449 TPS65917_RESERVED4,
450 TPS65917_OTP_ERROR_IRQ,
451 TPS65917_WDT_IRQ,
452 TPS65917_RESERVED5,
453 TPS65917_RESET_IN_IRQ,
454 TPS65917_FSD_IRQ,
455 TPS65917_SHORT_IRQ,
456 TPS65917_RESERVED6,
457 /* INT3 registers */
458 TPS65917_GPADC_AUTO_0_IRQ,
459 TPS65917_GPADC_AUTO_1_IRQ,
460 TPS65917_GPADC_EOC_SW_IRQ,
461 TPS65917_RESREVED6,
462 TPS65917_RESERVED7,
463 TPS65917_RESERVED8,
464 TPS65917_RESERVED9,
465 TPS65917_VBUS_IRQ,
466 /* INT4 registers */
467 TPS65917_GPIO_0_IRQ,
468 TPS65917_GPIO_1_IRQ,
469 TPS65917_GPIO_2_IRQ,
470 TPS65917_GPIO_3_IRQ,
471 TPS65917_GPIO_4_IRQ,
472 TPS65917_GPIO_5_IRQ,
473 TPS65917_GPIO_6_IRQ,
474 TPS65917_RESERVED10,
475 /* Total Number IRQs */
476 TPS65917_NUM_IRQ,
477};
478
352/* Define the palmas IRQ numbers */ 479/* Define the palmas IRQ numbers */
353enum palmas_irqs { 480enum palmas_irqs {
354 /* INT1 registers */ 481 /* INT1 registers */
@@ -400,6 +527,7 @@ struct palmas_pmic {
400 527
401 int smps123; 528 int smps123;
402 int smps457; 529 int smps457;
530 int smps12;
403 531
404 int range[PALMAS_REG_SMPS10_OUT1]; 532 int range[PALMAS_REG_SMPS10_OUT1];
405 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1]; 533 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1];
@@ -2871,6 +2999,715 @@ enum usb_irq_events {
2871#define PALMAS_GPADC_TRIM15 0x0E 2999#define PALMAS_GPADC_TRIM15 0x0E
2872#define PALMAS_GPADC_TRIM16 0x0F 3000#define PALMAS_GPADC_TRIM16 0x0F
2873 3001
3002/* TPS65917 Interrupt registers */
3003
3004/* Registers for function INTERRUPT */
3005#define TPS65917_INT1_STATUS 0x00
3006#define TPS65917_INT1_MASK 0x01
3007#define TPS65917_INT1_LINE_STATE 0x02
3008#define TPS65917_INT2_STATUS 0x05
3009#define TPS65917_INT2_MASK 0x06
3010#define TPS65917_INT2_LINE_STATE 0x07
3011#define TPS65917_INT3_STATUS 0x0A
3012#define TPS65917_INT3_MASK 0x0B
3013#define TPS65917_INT3_LINE_STATE 0x0C
3014#define TPS65917_INT4_STATUS 0x0F
3015#define TPS65917_INT4_MASK 0x10
3016#define TPS65917_INT4_LINE_STATE 0x11
3017#define TPS65917_INT4_EDGE_DETECT1 0x12
3018#define TPS65917_INT4_EDGE_DETECT2 0x13
3019#define TPS65917_INT_CTRL 0x14
3020
3021/* Bit definitions for INT1_STATUS */
3022#define TPS65917_INT1_STATUS_VSYS_MON 0x40
3023#define TPS65917_INT1_STATUS_VSYS_MON_SHIFT 0x06
3024#define TPS65917_INT1_STATUS_HOTDIE 0x20
3025#define TPS65917_INT1_STATUS_HOTDIE_SHIFT 0x05
3026#define TPS65917_INT1_STATUS_PWRDOWN 0x10
3027#define TPS65917_INT1_STATUS_PWRDOWN_SHIFT 0x04
3028#define TPS65917_INT1_STATUS_LONG_PRESS_KEY 0x04
3029#define TPS65917_INT1_STATUS_LONG_PRESS_KEY_SHIFT 0x02
3030#define TPS65917_INT1_STATUS_PWRON 0x02
3031#define TPS65917_INT1_STATUS_PWRON_SHIFT 0x01
3032
3033/* Bit definitions for INT1_MASK */
3034#define TPS65917_INT1_MASK_VSYS_MON 0x40
3035#define TPS65917_INT1_MASK_VSYS_MON_SHIFT 0x06
3036#define TPS65917_INT1_MASK_HOTDIE 0x20
3037#define TPS65917_INT1_MASK_HOTDIE_SHIFT 0x05
3038#define TPS65917_INT1_MASK_PWRDOWN 0x10
3039#define TPS65917_INT1_MASK_PWRDOWN_SHIFT 0x04
3040#define TPS65917_INT1_MASK_LONG_PRESS_KEY 0x04
3041#define TPS65917_INT1_MASK_LONG_PRESS_KEY_SHIFT 0x02
3042#define TPS65917_INT1_MASK_PWRON 0x02
3043#define TPS65917_INT1_MASK_PWRON_SHIFT 0x01
3044
3045/* Bit definitions for INT1_LINE_STATE */
3046#define TPS65917_INT1_LINE_STATE_VSYS_MON 0x40
3047#define TPS65917_INT1_LINE_STATE_VSYS_MON_SHIFT 0x06
3048#define TPS65917_INT1_LINE_STATE_HOTDIE 0x20
3049#define TPS65917_INT1_LINE_STATE_HOTDIE_SHIFT 0x05
3050#define TPS65917_INT1_LINE_STATE_PWRDOWN 0x10
3051#define TPS65917_INT1_LINE_STATE_PWRDOWN_SHIFT 0x04
3052#define TPS65917_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
3053#define TPS65917_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 0x02
3054#define TPS65917_INT1_LINE_STATE_PWRON 0x02
3055#define TPS65917_INT1_LINE_STATE_PWRON_SHIFT 0x01
3056
3057/* Bit definitions for INT2_STATUS */
3058#define TPS65917_INT2_STATUS_SHORT 0x40
3059#define TPS65917_INT2_STATUS_SHORT_SHIFT 0x06
3060#define TPS65917_INT2_STATUS_FSD 0x20
3061#define TPS65917_INT2_STATUS_FSD_SHIFT 0x05
3062#define TPS65917_INT2_STATUS_RESET_IN 0x10
3063#define TPS65917_INT2_STATUS_RESET_IN_SHIFT 0x04
3064#define TPS65917_INT2_STATUS_WDT 0x04
3065#define TPS65917_INT2_STATUS_WDT_SHIFT 0x02
3066#define TPS65917_INT2_STATUS_OTP_ERROR 0x02
3067#define TPS65917_INT2_STATUS_OTP_ERROR_SHIFT 0x01
3068
3069/* Bit definitions for INT2_MASK */
3070#define TPS65917_INT2_MASK_SHORT 0x40
3071#define TPS65917_INT2_MASK_SHORT_SHIFT 0x06
3072#define TPS65917_INT2_MASK_FSD 0x20
3073#define TPS65917_INT2_MASK_FSD_SHIFT 0x05
3074#define TPS65917_INT2_MASK_RESET_IN 0x10
3075#define TPS65917_INT2_MASK_RESET_IN_SHIFT 0x04
3076#define TPS65917_INT2_MASK_WDT 0x04
3077#define TPS65917_INT2_MASK_WDT_SHIFT 0x02
3078#define TPS65917_INT2_MASK_OTP_ERROR_TIMER 0x02
3079#define TPS65917_INT2_MASK_OTP_ERROR_SHIFT 0x01
3080
3081/* Bit definitions for INT2_LINE_STATE */
3082#define TPS65917_INT2_LINE_STATE_SHORT 0x40
3083#define TPS65917_INT2_LINE_STATE_SHORT_SHIFT 0x06
3084#define TPS65917_INT2_LINE_STATE_FSD 0x20
3085#define TPS65917_INT2_LINE_STATE_FSD_SHIFT 0x05
3086#define TPS65917_INT2_LINE_STATE_RESET_IN 0x10
3087#define TPS65917_INT2_LINE_STATE_RESET_IN_SHIFT 0x04
3088#define TPS65917_INT2_LINE_STATE_WDT 0x04
3089#define TPS65917_INT2_LINE_STATE_WDT_SHIFT 0x02
3090#define TPS65917_INT2_LINE_STATE_OTP_ERROR 0x02
3091#define TPS65917_INT2_LINE_STATE_OTP_ERROR_SHIFT 0x01
3092
3093/* Bit definitions for INT3_STATUS */
3094#define TPS65917_INT3_STATUS_VBUS 0x80
3095#define TPS65917_INT3_STATUS_VBUS_SHIFT 0x07
3096#define TPS65917_INT3_STATUS_GPADC_EOC_SW 0x04
3097#define TPS65917_INT3_STATUS_GPADC_EOC_SW_SHIFT 0x02
3098#define TPS65917_INT3_STATUS_GPADC_AUTO_1 0x02
3099#define TPS65917_INT3_STATUS_GPADC_AUTO_1_SHIFT 0x01
3100#define TPS65917_INT3_STATUS_GPADC_AUTO_0 0x01
3101#define TPS65917_INT3_STATUS_GPADC_AUTO_0_SHIFT 0x00
3102
3103/* Bit definitions for INT3_MASK */
3104#define TPS65917_INT3_MASK_VBUS 0x80
3105#define TPS65917_INT3_MASK_VBUS_SHIFT 0x07
3106#define TPS65917_INT3_MASK_GPADC_EOC_SW 0x04
3107#define TPS65917_INT3_MASK_GPADC_EOC_SW_SHIFT 0x02
3108#define TPS65917_INT3_MASK_GPADC_AUTO_1 0x02
3109#define TPS65917_INT3_MASK_GPADC_AUTO_1_SHIFT 0x01
3110#define TPS65917_INT3_MASK_GPADC_AUTO_0 0x01
3111#define TPS65917_INT3_MASK_GPADC_AUTO_0_SHIFT 0x00
3112
3113/* Bit definitions for INT3_LINE_STATE */
3114#define TPS65917_INT3_LINE_STATE_VBUS 0x80
3115#define TPS65917_INT3_LINE_STATE_VBUS_SHIFT 0x07
3116#define TPS65917_INT3_LINE_STATE_GPADC_EOC_SW 0x04
3117#define TPS65917_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 0x02
3118#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_1 0x02
3119#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 0x01
3120#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_0 0x01
3121#define TPS65917_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0x00
3122
3123/* Bit definitions for INT4_STATUS */
3124#define TPS65917_INT4_STATUS_GPIO_6 0x40
3125#define TPS65917_INT4_STATUS_GPIO_6_SHIFT 0x06
3126#define TPS65917_INT4_STATUS_GPIO_5 0x20
3127#define TPS65917_INT4_STATUS_GPIO_5_SHIFT 0x05
3128#define TPS65917_INT4_STATUS_GPIO_4 0x10
3129#define TPS65917_INT4_STATUS_GPIO_4_SHIFT 0x04
3130#define TPS65917_INT4_STATUS_GPIO_3 0x08
3131#define TPS65917_INT4_STATUS_GPIO_3_SHIFT 0x03
3132#define TPS65917_INT4_STATUS_GPIO_2 0x04
3133#define TPS65917_INT4_STATUS_GPIO_2_SHIFT 0x02
3134#define TPS65917_INT4_STATUS_GPIO_1 0x02
3135#define TPS65917_INT4_STATUS_GPIO_1_SHIFT 0x01
3136#define TPS65917_INT4_STATUS_GPIO_0 0x01
3137#define TPS65917_INT4_STATUS_GPIO_0_SHIFT 0x00
3138
3139/* Bit definitions for INT4_MASK */
3140#define TPS65917_INT4_MASK_GPIO_6 0x40
3141#define TPS65917_INT4_MASK_GPIO_6_SHIFT 0x06
3142#define TPS65917_INT4_MASK_GPIO_5 0x20
3143#define TPS65917_INT4_MASK_GPIO_5_SHIFT 0x05
3144#define TPS65917_INT4_MASK_GPIO_4 0x10
3145#define TPS65917_INT4_MASK_GPIO_4_SHIFT 0x04
3146#define TPS65917_INT4_MASK_GPIO_3 0x08
3147#define TPS65917_INT4_MASK_GPIO_3_SHIFT 0x03
3148#define TPS65917_INT4_MASK_GPIO_2 0x04
3149#define TPS65917_INT4_MASK_GPIO_2_SHIFT 0x02
3150#define TPS65917_INT4_MASK_GPIO_1 0x02
3151#define TPS65917_INT4_MASK_GPIO_1_SHIFT 0x01
3152#define TPS65917_INT4_MASK_GPIO_0 0x01
3153#define TPS65917_INT4_MASK_GPIO_0_SHIFT 0x00
3154
3155/* Bit definitions for INT4_LINE_STATE */
3156#define TPS65917_INT4_LINE_STATE_GPIO_6 0x40
3157#define TPS65917_INT4_LINE_STATE_GPIO_6_SHIFT 0x06
3158#define TPS65917_INT4_LINE_STATE_GPIO_5 0x20
3159#define TPS65917_INT4_LINE_STATE_GPIO_5_SHIFT 0x05
3160#define TPS65917_INT4_LINE_STATE_GPIO_4 0x10
3161#define TPS65917_INT4_LINE_STATE_GPIO_4_SHIFT 0x04
3162#define TPS65917_INT4_LINE_STATE_GPIO_3 0x08
3163#define TPS65917_INT4_LINE_STATE_GPIO_3_SHIFT 0x03
3164#define TPS65917_INT4_LINE_STATE_GPIO_2 0x04
3165#define TPS65917_INT4_LINE_STATE_GPIO_2_SHIFT 0x02
3166#define TPS65917_INT4_LINE_STATE_GPIO_1 0x02
3167#define TPS65917_INT4_LINE_STATE_GPIO_1_SHIFT 0x01
3168#define TPS65917_INT4_LINE_STATE_GPIO_0 0x01
3169#define TPS65917_INT4_LINE_STATE_GPIO_0_SHIFT 0x00
3170
3171/* Bit definitions for INT4_EDGE_DETECT1 */
3172#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
3173#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 0x07
3174#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
3175#define TPS65917_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 0x06
3176#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
3177#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 0x05
3178#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
3179#define TPS65917_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 0x04
3180#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
3181#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 0x03
3182#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
3183#define TPS65917_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 0x02
3184#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
3185#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 0x01
3186#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
3187#define TPS65917_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0x00
3188
3189/* Bit definitions for INT4_EDGE_DETECT2 */
3190#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
3191#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 0x05
3192#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
3193#define TPS65917_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 0x04
3194#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
3195#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 0x03
3196#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
3197#define TPS65917_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 0x02
3198#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
3199#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 0x01
3200#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
3201#define TPS65917_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0x00
3202
3203/* Bit definitions for INT_CTRL */
3204#define TPS65917_INT_CTRL_INT_PENDING 0x04
3205#define TPS65917_INT_CTRL_INT_PENDING_SHIFT 0x02
3206#define TPS65917_INT_CTRL_INT_CLEAR 0x01
3207#define TPS65917_INT_CTRL_INT_CLEAR_SHIFT 0x00
3208
3209/* TPS65917 SMPS Registers */
3210
3211/* Registers for function SMPS */
3212#define TPS65917_SMPS1_CTRL 0x00
3213#define TPS65917_SMPS1_FORCE 0x02
3214#define TPS65917_SMPS1_VOLTAGE 0x03
3215#define TPS65917_SMPS2_CTRL 0x04
3216#define TPS65917_SMPS2_FORCE 0x06
3217#define TPS65917_SMPS2_VOLTAGE 0x07
3218#define TPS65917_SMPS3_CTRL 0x0C
3219#define TPS65917_SMPS3_FORCE 0x0E
3220#define TPS65917_SMPS3_VOLTAGE 0x0F
3221#define TPS65917_SMPS4_CTRL 0x10
3222#define TPS65917_SMPS4_VOLTAGE 0x13
3223#define TPS65917_SMPS5_CTRL 0x18
3224#define TPS65917_SMPS5_VOLTAGE 0x1B
3225#define TPS65917_SMPS_CTRL 0x24
3226#define TPS65917_SMPS_PD_CTRL 0x25
3227#define TPS65917_SMPS_THERMAL_EN 0x27
3228#define TPS65917_SMPS_THERMAL_STATUS 0x28
3229#define TPS65917_SMPS_SHORT_STATUS 0x29
3230#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN 0x2A
3231#define TPS65917_SMPS_POWERGOOD_MASK1 0x2B
3232#define TPS65917_SMPS_POWERGOOD_MASK2 0x2C
3233
3234/* Bit definitions for SMPS1_CTRL */
3235#define TPS65917_SMPS1_CTRL_WR_S 0x80
3236#define TPS65917_SMPS1_CTRL_WR_S_SHIFT 0x07
3237#define TPS65917_SMPS1_CTRL_ROOF_FLOOR_EN 0x40
3238#define TPS65917_SMPS1_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3239#define TPS65917_SMPS1_CTRL_STATUS_MASK 0x30
3240#define TPS65917_SMPS1_CTRL_STATUS_SHIFT 0x04
3241#define TPS65917_SMPS1_CTRL_MODE_SLEEP_MASK 0x0C
3242#define TPS65917_SMPS1_CTRL_MODE_SLEEP_SHIFT 0x02
3243#define TPS65917_SMPS1_CTRL_MODE_ACTIVE_MASK 0x03
3244#define TPS65917_SMPS1_CTRL_MODE_ACTIVE_SHIFT 0x00
3245
3246/* Bit definitions for SMPS1_FORCE */
3247#define TPS65917_SMPS1_FORCE_CMD 0x80
3248#define TPS65917_SMPS1_FORCE_CMD_SHIFT 0x07
3249#define TPS65917_SMPS1_FORCE_VSEL_MASK 0x7F
3250#define TPS65917_SMPS1_FORCE_VSEL_SHIFT 0x00
3251
3252/* Bit definitions for SMPS1_VOLTAGE */
3253#define TPS65917_SMPS1_VOLTAGE_RANGE 0x80
3254#define TPS65917_SMPS1_VOLTAGE_RANGE_SHIFT 0x07
3255#define TPS65917_SMPS1_VOLTAGE_VSEL_MASK 0x7F
3256#define TPS65917_SMPS1_VOLTAGE_VSEL_SHIFT 0x00
3257
3258/* Bit definitions for SMPS2_CTRL */
3259#define TPS65917_SMPS2_CTRL_WR_S 0x80
3260#define TPS65917_SMPS2_CTRL_WR_S_SHIFT 0x07
3261#define TPS65917_SMPS2_CTRL_ROOF_FLOOR_EN 0x40
3262#define TPS65917_SMPS2_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3263#define TPS65917_SMPS2_CTRL_STATUS_MASK 0x30
3264#define TPS65917_SMPS2_CTRL_STATUS_SHIFT 0x04
3265#define TPS65917_SMPS2_CTRL_MODE_SLEEP_MASK 0x0C
3266#define TPS65917_SMPS2_CTRL_MODE_SLEEP_SHIFT 0x02
3267#define TPS65917_SMPS2_CTRL_MODE_ACTIVE_MASK 0x03
3268#define TPS65917_SMPS2_CTRL_MODE_ACTIVE_SHIFT 0x00
3269
3270/* Bit definitions for SMPS2_FORCE */
3271#define TPS65917_SMPS2_FORCE_CMD 0x80
3272#define TPS65917_SMPS2_FORCE_CMD_SHIFT 0x07
3273#define TPS65917_SMPS2_FORCE_VSEL_MASK 0x7F
3274#define TPS65917_SMPS2_FORCE_VSEL_SHIFT 0x00
3275
3276/* Bit definitions for SMPS2_VOLTAGE */
3277#define TPS65917_SMPS2_VOLTAGE_RANGE 0x80
3278#define TPS65917_SMPS2_VOLTAGE_RANGE_SHIFT 0x07
3279#define TPS65917_SMPS2_VOLTAGE_VSEL_MASK 0x7F
3280#define TPS65917_SMPS2_VOLTAGE_VSEL_SHIFT 0x00
3281
3282/* Bit definitions for SMPS3_CTRL */
3283#define TPS65917_SMPS3_CTRL_WR_S 0x80
3284#define TPS65917_SMPS3_CTRL_WR_S_SHIFT 0x07
3285#define TPS65917_SMPS3_CTRL_ROOF_FLOOR_EN 0x40
3286#define TPS65917_SMPS3_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3287#define TPS65917_SMPS3_CTRL_STATUS_MASK 0x30
3288#define TPS65917_SMPS3_CTRL_STATUS_SHIFT 0x04
3289#define TPS65917_SMPS3_CTRL_MODE_SLEEP_MASK 0x0C
3290#define TPS65917_SMPS3_CTRL_MODE_SLEEP_SHIFT 0x02
3291#define TPS65917_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
3292#define TPS65917_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0x00
3293
3294/* Bit definitions for SMPS3_FORCE */
3295#define TPS65917_SMPS3_FORCE_CMD 0x80
3296#define TPS65917_SMPS3_FORCE_CMD_SHIFT 0x07
3297#define TPS65917_SMPS3_FORCE_VSEL_MASK 0x7F
3298#define TPS65917_SMPS3_FORCE_VSEL_SHIFT 0x00
3299
3300/* Bit definitions for SMPS3_VOLTAGE */
3301#define TPS65917_SMPS3_VOLTAGE_RANGE 0x80
3302#define TPS65917_SMPS3_VOLTAGE_RANGE_SHIFT 0x07
3303#define TPS65917_SMPS3_VOLTAGE_VSEL_MASK 0x7F
3304#define TPS65917_SMPS3_VOLTAGE_VSEL_SHIFT 0x00
3305
3306/* Bit definitions for SMPS4_CTRL */
3307#define TPS65917_SMPS4_CTRL_WR_S 0x80
3308#define TPS65917_SMPS4_CTRL_WR_S_SHIFT 0x07
3309#define TPS65917_SMPS4_CTRL_ROOF_FLOOR_EN 0x40
3310#define TPS65917_SMPS4_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3311#define TPS65917_SMPS4_CTRL_STATUS_MASK 0x30
3312#define TPS65917_SMPS4_CTRL_STATUS_SHIFT 0x04
3313#define TPS65917_SMPS4_CTRL_MODE_SLEEP_MASK 0x0C
3314#define TPS65917_SMPS4_CTRL_MODE_SLEEP_SHIFT 0x02
3315#define TPS65917_SMPS4_CTRL_MODE_ACTIVE_MASK 0x03
3316#define TPS65917_SMPS4_CTRL_MODE_ACTIVE_SHIFT 0x00
3317
3318/* Bit definitions for SMPS4_VOLTAGE */
3319#define TPS65917_SMPS4_VOLTAGE_RANGE 0x80
3320#define TPS65917_SMPS4_VOLTAGE_RANGE_SHIFT 0x07
3321#define TPS65917_SMPS4_VOLTAGE_VSEL_MASK 0x7F
3322#define TPS65917_SMPS4_VOLTAGE_VSEL_SHIFT 0x00
3323
3324/* Bit definitions for SMPS5_CTRL */
3325#define TPS65917_SMPS5_CTRL_WR_S 0x80
3326#define TPS65917_SMPS5_CTRL_WR_S_SHIFT 0x07
3327#define TPS65917_SMPS5_CTRL_ROOF_FLOOR_EN 0x40
3328#define TPS65917_SMPS5_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
3329#define TPS65917_SMPS5_CTRL_STATUS_MASK 0x30
3330#define TPS65917_SMPS5_CTRL_STATUS_SHIFT 0x04
3331#define TPS65917_SMPS5_CTRL_MODE_SLEEP_MASK 0x0C
3332#define TPS65917_SMPS5_CTRL_MODE_SLEEP_SHIFT 0x02
3333#define TPS65917_SMPS5_CTRL_MODE_ACTIVE_MASK 0x03
3334#define TPS65917_SMPS5_CTRL_MODE_ACTIVE_SHIFT 0x00
3335
3336/* Bit definitions for SMPS5_VOLTAGE */
3337#define TPS65917_SMPS5_VOLTAGE_RANGE 0x80
3338#define TPS65917_SMPS5_VOLTAGE_RANGE_SHIFT 0x07
3339#define TPS65917_SMPS5_VOLTAGE_VSEL_MASK 0x7F
3340#define TPS65917_SMPS5_VOLTAGE_VSEL_SHIFT 0x00
3341
3342/* Bit definitions for SMPS_CTRL */
3343#define TPS65917_SMPS_CTRL_SMPS1_SMPS12_EN 0x10
3344#define TPS65917_SMPS_CTRL_SMPS1_SMPS12_EN_SHIFT 0x04
3345#define TPS65917_SMPS_CTRL_SMPS12_PHASE_CTRL 0x03
3346#define TPS65917_SMPS_CTRL_SMPS12_PHASE_CTRL_SHIFT 0x00
3347
3348/* Bit definitions for SMPS_PD_CTRL */
3349#define TPS65917_SMPS_PD_CTRL_SMPS5 0x40
3350#define TPS65917_SMPS_PD_CTRL_SMPS5_SHIFT 0x06
3351#define TPS65917_SMPS_PD_CTRL_SMPS4 0x10
3352#define TPS65917_SMPS_PD_CTRL_SMPS4_SHIFT 0x04
3353#define TPS65917_SMPS_PD_CTRL_SMPS3 0x08
3354#define TPS65917_SMPS_PD_CTRL_SMPS3_SHIFT 0x03
3355#define TPS65917_SMPS_PD_CTRL_SMPS2 0x02
3356#define TPS65917_SMPS_PD_CTRL_SMPS2_SHIFT 0x01
3357#define TPS65917_SMPS_PD_CTRL_SMPS1 0x01
3358#define TPS65917_SMPS_PD_CTRL_SMPS1_SHIFT 0x00
3359
3360/* Bit definitions for SMPS_THERMAL_EN */
3361#define TPS65917_SMPS_THERMAL_EN_SMPS5 0x40
3362#define TPS65917_SMPS_THERMAL_EN_SMPS5_SHIFT 0x06
3363#define TPS65917_SMPS_THERMAL_EN_SMPS3 0x08
3364#define TPS65917_SMPS_THERMAL_EN_SMPS3_SHIFT 0x03
3365#define TPS65917_SMPS_THERMAL_EN_SMPS12 0x01
3366#define TPS65917_SMPS_THERMAL_EN_SMPS12_SHIFT 0x00
3367
3368/* Bit definitions for SMPS_THERMAL_STATUS */
3369#define TPS65917_SMPS_THERMAL_STATUS_SMPS5 0x40
3370#define TPS65917_SMPS_THERMAL_STATUS_SMPS5_SHIFT 0x06
3371#define TPS65917_SMPS_THERMAL_STATUS_SMPS3 0x08
3372#define TPS65917_SMPS_THERMAL_STATUS_SMPS3_SHIFT 0x03
3373#define TPS65917_SMPS_THERMAL_STATUS_SMPS12 0x01
3374#define TPS65917_SMPS_THERMAL_STATUS_SMPS12_SHIFT 0x00
3375
3376/* Bit definitions for SMPS_SHORT_STATUS */
3377#define TPS65917_SMPS_SHORT_STATUS_SMPS5 0x40
3378#define TPS65917_SMPS_SHORT_STATUS_SMPS5_SHIFT 0x06
3379#define TPS65917_SMPS_SHORT_STATUS_SMPS4 0x10
3380#define TPS65917_SMPS_SHORT_STATUS_SMPS4_SHIFT 0x04
3381#define TPS65917_SMPS_SHORT_STATUS_SMPS3 0x08
3382#define TPS65917_SMPS_SHORT_STATUS_SMPS3_SHIFT 0x03
3383#define TPS65917_SMPS_SHORT_STATUS_SMPS2 0x02
3384#define TPS65917_SMPS_SHORT_STATUS_SMPS2_SHIFT 0x01
3385#define TPS65917_SMPS_SHORT_STATUS_SMPS1 0x01
3386#define TPS65917_SMPS_SHORT_STATUS_SMPS1_SHIFT 0x00
3387
3388/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
3389#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS5 0x40
3390#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS5_SHIFT 0x06
3391#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS4 0x10
3392#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS4_SHIFT 0x04
3393#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x08
3394#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 0x03
3395#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS2 0x02
3396#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS2_SHIFT 0x01
3397#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS1 0x01
3398#define TPS65917_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS1_SHIFT 0x00
3399
3400/* Bit definitions for SMPS_POWERGOOD_MASK1 */
3401#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS5 0x40
3402#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS5_SHIFT 0x06
3403#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS4 0x10
3404#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS4_SHIFT 0x04
3405#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS3 0x08
3406#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 0x03
3407#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS2 0x02
3408#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS2_SHIFT 0x01
3409#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS1 0x01
3410#define TPS65917_SMPS_POWERGOOD_MASK1_SMPS1_SHIFT 0x00
3411
3412/* Bit definitions for SMPS_POWERGOOD_MASK2 */
3413#define TPS65917_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
3414#define TPS65917_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 0x07
3415#define TPS65917_SMPS_POWERGOOD_MASK2_OVC_ALARM_SHIFT 0x10
3416#define TPS65917_SMPS_POWERGOOD_MASK2_OVC_ALARM 0x04
3417
3418/* Bit definitions for SMPS_PLL_CTRL */
3419
3420#define TPS65917_SMPS_PLL_CTRL_PLL_EN_PLL_BYPASS_SHIFT 0x08
3421#define TPS65917_SMPS_PLL_CTRL_PLL_PLL_EN_BYPASS 0x03
3422#define TPS65917_SMPS_PLL_CTRL_PLL_PLL_BYPASS_CLK_SHIFT 0x04
3423#define TPS65917_SMPS_PLL_CTRL_PLL_PLL_BYPASS_CLK 0x02
3424
3425/* Registers for function LDO */
3426#define TPS65917_LDO1_CTRL 0x00
3427#define TPS65917_LDO1_VOLTAGE 0x01
3428#define TPS65917_LDO2_CTRL 0x02
3429#define TPS65917_LDO2_VOLTAGE 0x03
3430#define TPS65917_LDO3_CTRL 0x04
3431#define TPS65917_LDO3_VOLTAGE 0x05
3432#define TPS65917_LDO4_CTRL 0x0E
3433#define TPS65917_LDO4_VOLTAGE 0x0F
3434#define TPS65917_LDO5_CTRL 0x12
3435#define TPS65917_LDO5_VOLTAGE 0x13
3436#define TPS65917_LDO_PD_CTRL1 0x1B
3437#define TPS65917_LDO_PD_CTRL2 0x1C
3438#define TPS65917_LDO_SHORT_STATUS1 0x1D
3439#define TPS65917_LDO_SHORT_STATUS2 0x1E
3440#define TPS65917_LDO_PD_CTRL3 0x2D
3441#define TPS65917_LDO_SHORT_STATUS3 0x2E
3442
3443/* Bit definitions for LDO1_CTRL */
3444#define TPS65917_LDO1_CTRL_WR_S 0x80
3445#define TPS65917_LDO1_CTRL_WR_S_SHIFT 0x07
3446#define TPS65917_LDO1_CTRL_BYPASS_EN 0x40
3447#define TPS65917_LDO1_CTRL_BYPASS_EN_SHIFT 0x06
3448#define TPS65917_LDO1_CTRL_STATUS 0x10
3449#define TPS65917_LDO1_CTRL_STATUS_SHIFT 0x04
3450#define TPS65917_LDO1_CTRL_MODE_SLEEP 0x04
3451#define TPS65917_LDO1_CTRL_MODE_SLEEP_SHIFT 0x02
3452#define TPS65917_LDO1_CTRL_MODE_ACTIVE 0x01
3453#define TPS65917_LDO1_CTRL_MODE_ACTIVE_SHIFT 0x00
3454
3455/* Bit definitions for LDO1_VOLTAGE */
3456#define TPS65917_LDO1_VOLTAGE_VSEL_MASK 0x2F
3457#define TPS65917_LDO1_VOLTAGE_VSEL_SHIFT 0x00
3458
3459/* Bit definitions for LDO2_CTRL */
3460#define TPS65917_LDO2_CTRL_WR_S 0x80
3461#define TPS65917_LDO2_CTRL_WR_S_SHIFT 0x07
3462#define TPS65917_LDO2_CTRL_BYPASS_EN 0x40
3463#define TPS65917_LDO2_CTRL_BYPASS_EN_SHIFT 0x06
3464#define TPS65917_LDO2_CTRL_STATUS 0x10
3465#define TPS65917_LDO2_CTRL_STATUS_SHIFT 0x04
3466#define TPS65917_LDO2_CTRL_MODE_SLEEP 0x04
3467#define TPS65917_LDO2_CTRL_MODE_SLEEP_SHIFT 0x02
3468#define TPS65917_LDO2_CTRL_MODE_ACTIVE 0x01
3469#define TPS65917_LDO2_CTRL_MODE_ACTIVE_SHIFT 0x00
3470
3471/* Bit definitions for LDO2_VOLTAGE */
3472#define TPS65917_LDO2_VOLTAGE_VSEL_MASK 0x2F
3473#define TPS65917_LDO2_VOLTAGE_VSEL_SHIFT 0x00
3474
3475/* Bit definitions for LDO3_CTRL */
3476#define TPS65917_LDO3_CTRL_WR_S 0x80
3477#define TPS65917_LDO3_CTRL_WR_S_SHIFT 0x07
3478#define TPS65917_LDO3_CTRL_STATUS 0x10
3479#define TPS65917_LDO3_CTRL_STATUS_SHIFT 0x04
3480#define TPS65917_LDO3_CTRL_MODE_SLEEP 0x04
3481#define TPS65917_LDO3_CTRL_MODE_SLEEP_SHIFT 0x02
3482#define TPS65917_LDO3_CTRL_MODE_ACTIVE 0x01
3483#define TPS65917_LDO3_CTRL_MODE_ACTIVE_SHIFT 0x00
3484
3485/* Bit definitions for LDO3_VOLTAGE */
3486#define TPS65917_LDO3_VOLTAGE_VSEL_MASK 0x2F
3487#define TPS65917_LDO3_VOLTAGE_VSEL_SHIFT 0x00
3488
3489/* Bit definitions for LDO4_CTRL */
3490#define TPS65917_LDO4_CTRL_WR_S 0x80
3491#define TPS65917_LDO4_CTRL_WR_S_SHIFT 0x07
3492#define TPS65917_LDO4_CTRL_STATUS 0x10
3493#define TPS65917_LDO4_CTRL_STATUS_SHIFT 0x04
3494#define TPS65917_LDO4_CTRL_MODE_SLEEP 0x04
3495#define TPS65917_LDO4_CTRL_MODE_SLEEP_SHIFT 0x02
3496#define TPS65917_LDO4_CTRL_MODE_ACTIVE 0x01
3497#define TPS65917_LDO4_CTRL_MODE_ACTIVE_SHIFT 0x00
3498
3499/* Bit definitions for LDO4_VOLTAGE */
3500#define TPS65917_LDO4_VOLTAGE_VSEL_MASK 0x2F
3501#define TPS65917_LDO4_VOLTAGE_VSEL_SHIFT 0x00
3502
3503/* Bit definitions for LDO5_CTRL */
3504#define TPS65917_LDO5_CTRL_WR_S 0x80
3505#define TPS65917_LDO5_CTRL_WR_S_SHIFT 0x07
3506#define TPS65917_LDO5_CTRL_STATUS 0x10
3507#define TPS65917_LDO5_CTRL_STATUS_SHIFT 0x04
3508#define TPS65917_LDO5_CTRL_MODE_SLEEP 0x04
3509#define TPS65917_LDO5_CTRL_MODE_SLEEP_SHIFT 0x02
3510#define TPS65917_LDO5_CTRL_MODE_ACTIVE 0x01
3511#define TPS65917_LDO5_CTRL_MODE_ACTIVE_SHIFT 0x00
3512
3513/* Bit definitions for LDO5_VOLTAGE */
3514#define TPS65917_LDO5_VOLTAGE_VSEL_MASK 0x2F
3515#define TPS65917_LDO5_VOLTAGE_VSEL_SHIFT 0x00
3516
3517/* Bit definitions for LDO_PD_CTRL1 */
3518#define TPS65917_LDO_PD_CTRL1_LDO4 0x80
3519#define TPS65917_LDO_PD_CTRL1_LDO4_SHIFT 0x07
3520#define TPS65917_LDO_PD_CTRL1_LDO2 0x02
3521#define TPS65917_LDO_PD_CTRL1_LDO2_SHIFT 0x01
3522#define TPS65917_LDO_PD_CTRL1_LDO1 0x01
3523#define TPS65917_LDO_PD_CTRL1_LDO1_SHIFT 0x00
3524
3525/* Bit definitions for LDO_PD_CTRL2 */
3526#define TPS65917_LDO_PD_CTRL2_LDO3 0x04
3527#define TPS65917_LDO_PD_CTRL2_LDO3_SHIFT 0x02
3528#define TPS65917_LDO_PD_CTRL2_LDO5 0x02
3529#define TPS65917_LDO_PD_CTRL2_LDO5_SHIFT 0x01
3530
3531/* Bit definitions for LDO_PD_CTRL3 */
3532#define TPS65917_LDO_PD_CTRL2_LDOVANA 0x80
3533#define TPS65917_LDO_PD_CTRL2_LDOVANA_SHIFT 0x07
3534
3535/* Bit definitions for LDO_SHORT_STATUS1 */
3536#define TPS65917_LDO_SHORT_STATUS1_LDO4 0x80
3537#define TPS65917_LDO_SHORT_STATUS1_LDO4_SHIFT 0x07
3538#define TPS65917_LDO_SHORT_STATUS1_LDO2 0x02
3539#define TPS65917_LDO_SHORT_STATUS1_LDO2_SHIFT 0x01
3540#define TPS65917_LDO_SHORT_STATUS1_LDO1 0x01
3541#define TPS65917_LDO_SHORT_STATUS1_LDO1_SHIFT 0x00
3542
3543/* Bit definitions for LDO_SHORT_STATUS2 */
3544#define TPS65917_LDO_SHORT_STATUS2_LDO3 0x04
3545#define TPS65917_LDO_SHORT_STATUS2_LDO3_SHIFT 0x02
3546#define TPS65917_LDO_SHORT_STATUS2_LDO5 0x02
3547#define TPS65917_LDO_SHORT_STATUS2_LDO5_SHIFT 0x01
3548
3549/* Bit definitions for LDO_SHORT_STATUS2 */
3550#define TPS65917_LDO_SHORT_STATUS2_LDOVANA 0x80
3551#define TPS65917_LDO_SHORT_STATUS2_LDOVANA_SHIFT 0x07
3552
3553/* Bit definitions for REGEN1_CTRL */
3554#define TPS65917_REGEN1_CTRL_STATUS 0x10
3555#define TPS65917_REGEN1_CTRL_STATUS_SHIFT 0x04
3556#define TPS65917_REGEN1_CTRL_MODE_SLEEP 0x04
3557#define TPS65917_REGEN1_CTRL_MODE_SLEEP_SHIFT 0x02
3558#define TPS65917_REGEN1_CTRL_MODE_ACTIVE 0x01
3559#define TPS65917_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0x00
3560
3561/* Bit definitions for PLLEN_CTRL */
3562#define TPS65917_PLLEN_CTRL_STATUS 0x10
3563#define TPS65917_PLLEN_CTRL_STATUS_SHIFT 0x04
3564#define TPS65917_PLLEN_CTRL_MODE_SLEEP 0x04
3565#define TPS65917_PLLEN_CTRL_MODE_SLEEP_SHIFT 0x02
3566#define TPS65917_PLLEN_CTRL_MODE_ACTIVE 0x01
3567#define TPS65917_PLLEN_CTRL_MODE_ACTIVE_SHIFT 0x00
3568
3569/* Bit definitions for REGEN2_CTRL */
3570#define TPS65917_REGEN2_CTRL_STATUS 0x10
3571#define TPS65917_REGEN2_CTRL_STATUS_SHIFT 0x04
3572#define TPS65917_REGEN2_CTRL_MODE_SLEEP 0x04
3573#define TPS65917_REGEN2_CTRL_MODE_SLEEP_SHIFT 0x02
3574#define TPS65917_REGEN2_CTRL_MODE_ACTIVE 0x01
3575#define TPS65917_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0x00
3576
3577/* Bit definitions for NSLEEP_RES_ASSIGN */
3578#define TPS65917_NSLEEP_RES_ASSIGN_PLL_EN 0x08
3579#define TPS65917_NSLEEP_RES_ASSIGN_PLL_EN_SHIFT 0x03
3580#define TPS65917_NSLEEP_RES_ASSIGN_REGEN3 0x04
3581#define TPS65917_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 0x02
3582#define TPS65917_NSLEEP_RES_ASSIGN_REGEN2 0x02
3583#define TPS65917_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 0x01
3584#define TPS65917_NSLEEP_RES_ASSIGN_REGEN1 0x01
3585#define TPS65917_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0x00
3586
3587/* Bit definitions for NSLEEP_SMPS_ASSIGN */
3588#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS5 0x40
3589#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS5_SHIFT 0x06
3590#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS4 0x10
3591#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS4_SHIFT 0x04
3592#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS3 0x08
3593#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 0x03
3594#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS2 0x02
3595#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS2_SHIFT 0x01
3596#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS1 0x01
3597#define TPS65917_NSLEEP_SMPS_ASSIGN_SMPS1_SHIFT 0x00
3598
3599/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
3600#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO4 0x80
3601#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 0x07
3602#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO2 0x02
3603#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 0x01
3604#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO1 0x01
3605#define TPS65917_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0x00
3606
3607/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
3608#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO3 0x04
3609#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO3_SHIFT 0x02
3610#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO5 0x02
3611#define TPS65917_NSLEEP_LDO_ASSIGN2_LDO5_SHIFT 0x01
3612
3613/* Bit definitions for ENABLE1_RES_ASSIGN */
3614#define TPS65917_ENABLE1_RES_ASSIGN_PLLEN 0x08
3615#define TPS65917_ENABLE1_RES_ASSIGN_PLLEN_SHIFT 0x03
3616#define TPS65917_ENABLE1_RES_ASSIGN_REGEN3 0x04
3617#define TPS65917_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 0x02
3618#define TPS65917_ENABLE1_RES_ASSIGN_REGEN2 0x02
3619#define TPS65917_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 0x01
3620#define TPS65917_ENABLE1_RES_ASSIGN_REGEN1 0x01
3621#define TPS65917_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0x00
3622
3623/* Bit definitions for ENABLE1_SMPS_ASSIGN */
3624#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS5 0x40
3625#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS5_SHIFT 0x06
3626#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS4 0x10
3627#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS4_SHIFT 0x04
3628#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS3 0x08
3629#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 0x03
3630#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS2 0x02
3631#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS2_SHIFT 0x01
3632#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS1 0x01
3633#define TPS65917_ENABLE1_SMPS_ASSIGN_SMPS1_SHIFT 0x00
3634
3635/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
3636#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO4 0x80
3637#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 0x07
3638#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO2 0x02
3639#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 0x01
3640#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO1 0x01
3641#define TPS65917_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0x00
3642
3643/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
3644#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO3 0x04
3645#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO3_SHIFT 0x02
3646#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO5 0x02
3647#define TPS65917_ENABLE1_LDO_ASSIGN2_LDO5_SHIFT 0x01
3648
3649/* Bit definitions for ENABLE2_RES_ASSIGN */
3650#define TPS65917_ENABLE2_RES_ASSIGN_PLLEN 0x08
3651#define TPS65917_ENABLE2_RES_ASSIGN_PLLEN_SHIFT 0x03
3652#define TPS65917_ENABLE2_RES_ASSIGN_REGEN3 0x04
3653#define TPS65917_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 0x02
3654#define TPS65917_ENABLE2_RES_ASSIGN_REGEN2 0x02
3655#define TPS65917_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 0x01
3656#define TPS65917_ENABLE2_RES_ASSIGN_REGEN1 0x01
3657#define TPS65917_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0x00
3658
3659/* Bit definitions for ENABLE2_SMPS_ASSIGN */
3660#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS5 0x40
3661#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS5_SHIFT 0x06
3662#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS4 0x10
3663#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS4_SHIFT 0x04
3664#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS3 0x08
3665#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 0x03
3666#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS2 0x02
3667#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS2_SHIFT 0x01
3668#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS1 0x01
3669#define TPS65917_ENABLE2_SMPS_ASSIGN_SMPS1_SHIFT 0x00
3670
3671/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
3672#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO4 0x80
3673#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 0x07
3674#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO2 0x02
3675#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 0x01
3676#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO1 0x01
3677#define TPS65917_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0x00
3678
3679/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
3680#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO3 0x04
3681#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO3_SHIFT 0x02
3682#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO5 0x02
3683#define TPS65917_ENABLE2_LDO_ASSIGN2_LDO5_SHIFT 0x01
3684
3685/* Bit definitions for REGEN3_CTRL */
3686#define TPS65917_REGEN3_CTRL_STATUS 0x10
3687#define TPS65917_REGEN3_CTRL_STATUS_SHIFT 0x04
3688#define TPS65917_REGEN3_CTRL_MODE_SLEEP 0x04
3689#define TPS65917_REGEN3_CTRL_MODE_SLEEP_SHIFT 0x02
3690#define TPS65917_REGEN3_CTRL_MODE_ACTIVE 0x01
3691#define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00
3692
3693/* Registers for function RESOURCE */
3694#define TPS65917_REGEN1_CTRL 0x2
3695#define TPS65917_PLLEN_CTRL 0x3
3696#define TPS65917_NSLEEP_RES_ASSIGN 0x6
3697#define TPS65917_NSLEEP_SMPS_ASSIGN 0x7
3698#define TPS65917_NSLEEP_LDO_ASSIGN1 0x8
3699#define TPS65917_NSLEEP_LDO_ASSIGN2 0x9
3700#define TPS65917_ENABLE1_RES_ASSIGN 0xA
3701#define TPS65917_ENABLE1_SMPS_ASSIGN 0xB
3702#define TPS65917_ENABLE1_LDO_ASSIGN1 0xC
3703#define TPS65917_ENABLE1_LDO_ASSIGN2 0xD
3704#define TPS65917_ENABLE2_RES_ASSIGN 0xE
3705#define TPS65917_ENABLE2_SMPS_ASSIGN 0xF
3706#define TPS65917_ENABLE2_LDO_ASSIGN1 0x10
3707#define TPS65917_ENABLE2_LDO_ASSIGN2 0x11
3708#define TPS65917_REGEN2_CTRL 0x12
3709#define TPS65917_REGEN3_CTRL 0x13
3710
2874static inline int palmas_read(struct palmas *palmas, unsigned int base, 3711static inline int palmas_read(struct palmas *palmas, unsigned int base,
2875 unsigned int reg, unsigned int *val) 3712 unsigned int reg, unsigned int *val)
2876{ 3713{
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a3835976f7c6..74346d5e7899 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -943,6 +943,12 @@ void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout); 943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist, 944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
945 int num_sg, bool read, int timeout); 945 int num_sg, bool read, int timeout);
946int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
947 int num_sg, bool read);
948void rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
949 int num_sg, bool read);
950int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
951 int count, bool read, int timeout);
946int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 952int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
947int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 953int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
948int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card); 954int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 47d84242940b..b5f73de81aad 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -21,6 +21,7 @@ enum sec_device_type {
21 S2MPA01, 21 S2MPA01,
22 S2MPS11X, 22 S2MPS11X,
23 S2MPS14X, 23 S2MPS14X,
24 S2MPU02,
24}; 25};
25 26
26/** 27/**
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index 1224f447356b..f35af7361b60 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -129,6 +129,30 @@ enum s2mps14_irq {
129 S2MPS14_IRQ_NR, 129 S2MPS14_IRQ_NR,
130}; 130};
131 131
132enum s2mpu02_irq {
133 S2MPU02_IRQ_PWRONF,
134 S2MPU02_IRQ_PWRONR,
135 S2MPU02_IRQ_JIGONBF,
136 S2MPU02_IRQ_JIGONBR,
137 S2MPU02_IRQ_ACOKBF,
138 S2MPU02_IRQ_ACOKBR,
139 S2MPU02_IRQ_PWRON1S,
140 S2MPU02_IRQ_MRB,
141
142 S2MPU02_IRQ_RTC60S,
143 S2MPU02_IRQ_RTCA1,
144 S2MPU02_IRQ_RTCA0,
145 S2MPU02_IRQ_SMPL,
146 S2MPU02_IRQ_RTC1S,
147 S2MPU02_IRQ_WTSR,
148
149 S2MPU02_IRQ_INT120C,
150 S2MPU02_IRQ_INT140C,
151 S2MPU02_IRQ_TSD,
152
153 S2MPU02_IRQ_NR,
154};
155
132/* Masks for interrupts are the same as in s2mps11 */ 156/* Masks for interrupts are the same as in s2mps11 */
133#define S2MPS14_IRQ_TSD_MASK (1 << 2) 157#define S2MPS14_IRQ_TSD_MASK (1 << 2)
134 158
diff --git a/include/linux/mfd/samsung/s2mpu02.h b/include/linux/mfd/samsung/s2mpu02.h
new file mode 100644
index 000000000000..47ae9bc583a7
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpu02.h
@@ -0,0 +1,201 @@
1/*
2 * s2mpu02.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __LINUX_MFD_S2MPU02_H
20#define __LINUX_MFD_S2MPU02_H
21
22/* S2MPU02 registers */
23enum S2MPU02_reg {
24 S2MPU02_REG_ID,
25 S2MPU02_REG_INT1,
26 S2MPU02_REG_INT2,
27 S2MPU02_REG_INT3,
28 S2MPU02_REG_INT1M,
29 S2MPU02_REG_INT2M,
30 S2MPU02_REG_INT3M,
31 S2MPU02_REG_ST1,
32 S2MPU02_REG_ST2,
33 S2MPU02_REG_PWRONSRC,
34 S2MPU02_REG_OFFSRC,
35 S2MPU02_REG_BU_CHG,
36 S2MPU02_REG_RTCCTRL,
37 S2MPU02_REG_PMCTRL1,
38 S2MPU02_REG_RSVD1,
39 S2MPU02_REG_RSVD2,
40 S2MPU02_REG_RSVD3,
41 S2MPU02_REG_RSVD4,
42 S2MPU02_REG_RSVD5,
43 S2MPU02_REG_RSVD6,
44 S2MPU02_REG_RSVD7,
45 S2MPU02_REG_WRSTEN,
46 S2MPU02_REG_RSVD8,
47 S2MPU02_REG_RSVD9,
48 S2MPU02_REG_RSVD10,
49 S2MPU02_REG_B1CTRL1,
50 S2MPU02_REG_B1CTRL2,
51 S2MPU02_REG_B2CTRL1,
52 S2MPU02_REG_B2CTRL2,
53 S2MPU02_REG_B3CTRL1,
54 S2MPU02_REG_B3CTRL2,
55 S2MPU02_REG_B4CTRL1,
56 S2MPU02_REG_B4CTRL2,
57 S2MPU02_REG_B5CTRL1,
58 S2MPU02_REG_B5CTRL2,
59 S2MPU02_REG_B5CTRL3,
60 S2MPU02_REG_B5CTRL4,
61 S2MPU02_REG_B5CTRL5,
62 S2MPU02_REG_B6CTRL1,
63 S2MPU02_REG_B6CTRL2,
64 S2MPU02_REG_B7CTRL1,
65 S2MPU02_REG_B7CTRL2,
66 S2MPU02_REG_RAMP1,
67 S2MPU02_REG_RAMP2,
68 S2MPU02_REG_L1CTRL,
69 S2MPU02_REG_L2CTRL1,
70 S2MPU02_REG_L2CTRL2,
71 S2MPU02_REG_L2CTRL3,
72 S2MPU02_REG_L2CTRL4,
73 S2MPU02_REG_L3CTRL,
74 S2MPU02_REG_L4CTRL,
75 S2MPU02_REG_L5CTRL,
76 S2MPU02_REG_L6CTRL,
77 S2MPU02_REG_L7CTRL,
78 S2MPU02_REG_L8CTRL,
79 S2MPU02_REG_L9CTRL,
80 S2MPU02_REG_L10CTRL,
81 S2MPU02_REG_L11CTRL,
82 S2MPU02_REG_L12CTRL,
83 S2MPU02_REG_L13CTRL,
84 S2MPU02_REG_L14CTRL,
85 S2MPU02_REG_L15CTRL,
86 S2MPU02_REG_L16CTRL,
87 S2MPU02_REG_L17CTRL,
88 S2MPU02_REG_L18CTRL,
89 S2MPU02_REG_L19CTRL,
90 S2MPU02_REG_L20CTRL,
91 S2MPU02_REG_L21CTRL,
92 S2MPU02_REG_L22CTRL,
93 S2MPU02_REG_L23CTRL,
94 S2MPU02_REG_L24CTRL,
95 S2MPU02_REG_L25CTRL,
96 S2MPU02_REG_L26CTRL,
97 S2MPU02_REG_L27CTRL,
98 S2MPU02_REG_L28CTRL,
99 S2MPU02_REG_LDODSCH1,
100 S2MPU02_REG_LDODSCH2,
101 S2MPU02_REG_LDODSCH3,
102 S2MPU02_REG_LDODSCH4,
103 S2MPU02_REG_SELMIF,
104 S2MPU02_REG_RSVD11,
105 S2MPU02_REG_RSVD12,
106 S2MPU02_REG_RSVD13,
107 S2MPU02_REG_DVSSEL,
108 S2MPU02_REG_DVSPTR,
109 S2MPU02_REG_DVSDATA,
110};
111
112/* S2MPU02 regulator ids */
113enum S2MPU02_regulators {
114 S2MPU02_LDO1,
115 S2MPU02_LDO2,
116 S2MPU02_LDO3,
117 S2MPU02_LDO4,
118 S2MPU02_LDO5,
119 S2MPU02_LDO6,
120 S2MPU02_LDO7,
121 S2MPU02_LDO8,
122 S2MPU02_LDO9,
123 S2MPU02_LDO10,
124 S2MPU02_LDO11,
125 S2MPU02_LDO12,
126 S2MPU02_LDO13,
127 S2MPU02_LDO14,
128 S2MPU02_LDO15,
129 S2MPU02_LDO16,
130 S2MPU02_LDO17,
131 S2MPU02_LDO18,
132 S2MPU02_LDO19,
133 S2MPU02_LDO20,
134 S2MPU02_LDO21,
135 S2MPU02_LDO22,
136 S2MPU02_LDO23,
137 S2MPU02_LDO24,
138 S2MPU02_LDO25,
139 S2MPU02_LDO26,
140 S2MPU02_LDO27,
141 S2MPU02_LDO28,
142 S2MPU02_BUCK1,
143 S2MPU02_BUCK2,
144 S2MPU02_BUCK3,
145 S2MPU02_BUCK4,
146 S2MPU02_BUCK5,
147 S2MPU02_BUCK6,
148 S2MPU02_BUCK7,
149
150 S2MPU02_REGULATOR_MAX,
151};
152
153/* Regulator constraints for BUCKx */
154#define S2MPU02_BUCK1234_MIN_600MV 600000
155#define S2MPU02_BUCK5_MIN_1081_25MV 1081250
156#define S2MPU02_BUCK6_MIN_1700MV 1700000
157#define S2MPU02_BUCK7_MIN_900MV 900000
158
159#define S2MPU02_BUCK1234_STEP_6_25MV 6250
160#define S2MPU02_BUCK5_STEP_6_25MV 6250
161#define S2MPU02_BUCK6_STEP_2_50MV 2500
162#define S2MPU02_BUCK7_STEP_6_25MV 6250
163
164#define S2MPU02_BUCK1234_START_SEL 0x00
165#define S2MPU02_BUCK5_START_SEL 0x4D
166#define S2MPU02_BUCK6_START_SEL 0x28
167#define S2MPU02_BUCK7_START_SEL 0x30
168
169#define S2MPU02_BUCK_RAMP_DELAY 12500
170
171/* Regulator constraints for different types of LDOx */
172#define S2MPU02_LDO_MIN_900MV 900000
173#define S2MPU02_LDO_MIN_1050MV 1050000
174#define S2MPU02_LDO_MIN_1600MV 1600000
175#define S2MPU02_LDO_STEP_12_5MV 12500
176#define S2MPU02_LDO_STEP_25MV 25000
177#define S2MPU02_LDO_STEP_50MV 50000
178
179#define S2MPU02_LDO_GROUP1_START_SEL 0x8
180#define S2MPU02_LDO_GROUP2_START_SEL 0xA
181#define S2MPU02_LDO_GROUP3_START_SEL 0x10
182
183#define S2MPU02_LDO_VSEL_MASK 0x3F
184#define S2MPU02_BUCK_VSEL_MASK 0xFF
185#define S2MPU02_ENABLE_MASK (0x03 << S2MPU02_ENABLE_SHIFT)
186#define S2MPU02_ENABLE_SHIFT 6
187
188/* On/Off controlled by PWREN */
189#define S2MPU02_ENABLE_SUSPEND (0x01 << S2MPU02_ENABLE_SHIFT)
190#define S2MPU02_DISABLE_SUSPEND (0x11 << S2MPU02_ENABLE_SHIFT)
191#define S2MPU02_LDO_N_VOLTAGES (S2MPU02_LDO_VSEL_MASK + 1)
192#define S2MPU02_BUCK_N_VOLTAGES (S2MPU02_BUCK_VSEL_MASK + 1)
193
194/* RAMP delay for BUCK1234*/
195#define S2MPU02_BUCK1_RAMP_SHIFT 6
196#define S2MPU02_BUCK2_RAMP_SHIFT 4
197#define S2MPU02_BUCK3_RAMP_SHIFT 2
198#define S2MPU02_BUCK4_RAMP_SHIFT 0
199#define S2MPU02_BUCK1234_RAMP_MASK 0x3
200
201#endif /* __LINUX_MFD_S2MPU02_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 16c2335c2856..6483a6fdce59 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -892,7 +892,7 @@ struct tps65910 {
892 struct device *dev; 892 struct device *dev;
893 struct i2c_client *i2c_client; 893 struct i2c_client *i2c_client;
894 struct regmap *regmap; 894 struct regmap *regmap;
895 unsigned int id; 895 unsigned long id;
896 896
897 /* Client devices */ 897 /* Client devices */
898 struct tps65910_pmic *pmic; 898 struct tps65910_pmic *pmic;
diff --git a/include/linux/mic_bus.h b/include/linux/mic_bus.h
new file mode 100644
index 000000000000..d5b5f76d57ef
--- /dev/null
+++ b/include/linux/mic_bus.h
@@ -0,0 +1,110 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2014 Intel 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, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC Bus driver.
19 *
20 * This implementation is very similar to the the virtio bus driver
21 * implementation @ include/linux/virtio.h.
22 */
23#ifndef _MIC_BUS_H_
24#define _MIC_BUS_H_
25/*
26 * Everything a mbus driver needs to work with any particular mbus
27 * implementation.
28 */
29#include <linux/interrupt.h>
30#include <linux/dma-mapping.h>
31
32struct mbus_device_id {
33 __u32 device;
34 __u32 vendor;
35};
36
37#define MBUS_DEV_DMA_HOST 2
38#define MBUS_DEV_DMA_MIC 3
39#define MBUS_DEV_ANY_ID 0xffffffff
40
41/**
42 * mbus_device - representation of a device using mbus
43 * @mmio_va: virtual address of mmio space
44 * @hw_ops: the hardware ops supported by this device.
45 * @id: the device type identification (used to match it with a driver).
46 * @dev: underlying device.
47 * be used to communicate with.
48 * @index: unique position on the mbus bus
49 */
50struct mbus_device {
51 void __iomem *mmio_va;
52 struct mbus_hw_ops *hw_ops;
53 struct mbus_device_id id;
54 struct device dev;
55 int index;
56};
57
58/**
59 * mbus_driver - operations for a mbus I/O driver
60 * @driver: underlying device driver (populate name and owner).
61 * @id_table: the ids serviced by this driver.
62 * @probe: the function to call when a device is found. Returns 0 or -errno.
63 * @remove: the function to call when a device is removed.
64 */
65struct mbus_driver {
66 struct device_driver driver;
67 const struct mbus_device_id *id_table;
68 int (*probe)(struct mbus_device *dev);
69 void (*scan)(struct mbus_device *dev);
70 void (*remove)(struct mbus_device *dev);
71};
72
73/**
74 * struct mic_irq - opaque pointer used as cookie
75 */
76struct mic_irq;
77
78/**
79 * mbus_hw_ops - Hardware operations for accessing a MIC device on the MIC bus.
80 */
81struct mbus_hw_ops {
82 struct mic_irq* (*request_threaded_irq)(struct mbus_device *mbdev,
83 irq_handler_t handler,
84 irq_handler_t thread_fn,
85 const char *name, void *data,
86 int intr_src);
87 void (*free_irq)(struct mbus_device *mbdev,
88 struct mic_irq *cookie, void *data);
89 void (*ack_interrupt)(struct mbus_device *mbdev, int num);
90};
91
92struct mbus_device *
93mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
94 struct mbus_hw_ops *hw_ops, void __iomem *mmio_va);
95void mbus_unregister_device(struct mbus_device *mbdev);
96
97int mbus_register_driver(struct mbus_driver *drv);
98void mbus_unregister_driver(struct mbus_driver *drv);
99
100static inline struct mbus_device *dev_to_mbus(struct device *_dev)
101{
102 return container_of(_dev, struct mbus_device, dev);
103}
104
105static inline struct mbus_driver *drv_to_mbus(struct device_driver *drv)
106{
107 return container_of(drv, struct mbus_driver, driver);
108}
109
110#endif /* _MIC_BUS_H */
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index c8450366c130..379c02648ab3 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -116,6 +116,7 @@ enum {
116 /* special QP and management commands */ 116 /* special QP and management commands */
117 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 117 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
118 MLX4_CMD_MAD_IFC = 0x24, 118 MLX4_CMD_MAD_IFC = 0x24,
119 MLX4_CMD_MAD_DEMUX = 0x203,
119 120
120 /* multicast commands */ 121 /* multicast commands */
121 MLX4_CMD_READ_MCG = 0x25, 122 MLX4_CMD_READ_MCG = 0x25,
@@ -186,6 +187,12 @@ enum {
186}; 187};
187 188
188enum { 189enum {
190 MLX4_CMD_MAD_DEMUX_CONFIG = 0,
191 MLX4_CMD_MAD_DEMUX_QUERY_STATE = 1,
192 MLX4_CMD_MAD_DEMUX_QUERY_RESTR = 2, /* Query mad demux restrictions */
193};
194
195enum {
189 MLX4_CMD_WRAPPED, 196 MLX4_CMD_WRAPPED,
190 MLX4_CMD_NATIVE 197 MLX4_CMD_NATIVE
191}; 198};
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 35b51e7af886..071f6b234604 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -48,6 +48,17 @@
48#define MSIX_LEGACY_SZ 4 48#define MSIX_LEGACY_SZ 4
49#define MIN_MSIX_P_PORT 5 49#define MIN_MSIX_P_PORT 5
50 50
51#define MLX4_NUM_UP 8
52#define MLX4_NUM_TC 8
53#define MLX4_MAX_100M_UNITS_VAL 255 /*
54 * work around: can't set values
55 * greater then this value when
56 * using 100 Mbps units.
57 */
58#define MLX4_RATELIMIT_100M_UNITS 3 /* 100 Mbps */
59#define MLX4_RATELIMIT_1G_UNITS 4 /* 1 Gbps */
60#define MLX4_RATELIMIT_DEFAULT 0x00ff
61
51#define MLX4_ROCE_MAX_GIDS 128 62#define MLX4_ROCE_MAX_GIDS 128
52#define MLX4_ROCE_PF_GIDS 16 63#define MLX4_ROCE_PF_GIDS 16
53 64
@@ -172,6 +183,7 @@ enum {
172 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8, 183 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8,
173 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9, 184 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9,
174 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 185 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
186 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
175}; 187};
176 188
177enum { 189enum {
@@ -262,6 +274,7 @@ enum {
262 MLX4_PERM_REMOTE_WRITE = 1 << 13, 274 MLX4_PERM_REMOTE_WRITE = 1 << 13,
263 MLX4_PERM_ATOMIC = 1 << 14, 275 MLX4_PERM_ATOMIC = 1 << 14,
264 MLX4_PERM_BIND_MW = 1 << 15, 276 MLX4_PERM_BIND_MW = 1 << 15,
277 MLX4_PERM_MASK = 0xFC00
265}; 278};
266 279
267enum { 280enum {
@@ -1243,4 +1256,26 @@ int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
1243int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); 1256int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
1244int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, 1257int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
1245 int enable); 1258 int enable);
1259int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
1260 struct mlx4_mpt_entry ***mpt_entry);
1261int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
1262 struct mlx4_mpt_entry **mpt_entry);
1263int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry,
1264 u32 pdn);
1265int mlx4_mr_hw_change_access(struct mlx4_dev *dev,
1266 struct mlx4_mpt_entry *mpt_entry,
1267 u32 access);
1268void mlx4_mr_hw_put_mpt(struct mlx4_dev *dev,
1269 struct mlx4_mpt_entry **mpt_entry);
1270void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr);
1271int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1272 u64 iova, u64 size, int npages,
1273 int page_shift, struct mlx4_mpt_entry *mpt_entry);
1274
1275/* Returns true if running in low memory profile (kdump kernel) */
1276static inline bool mlx4_low_memory_profile(void)
1277{
1278 return reset_devices;
1279}
1280
1246#endif /* MLX4_DEVICE_H */ 1281#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 3406cfb1267a..334947151dfc 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -456,9 +456,6 @@ struct mlx5_eqe_cq_err {
456 u8 syndrome; 456 u8 syndrome;
457}; 457};
458 458
459struct mlx5_eqe_dropped_packet {
460};
461
462struct mlx5_eqe_port_state { 459struct mlx5_eqe_port_state {
463 u8 reserved0[8]; 460 u8 reserved0[8];
464 u8 port; 461 u8 port;
@@ -498,7 +495,6 @@ union ev_data {
498 struct mlx5_eqe_comp comp; 495 struct mlx5_eqe_comp comp;
499 struct mlx5_eqe_qp_srq qp_srq; 496 struct mlx5_eqe_qp_srq qp_srq;
500 struct mlx5_eqe_cq_err cq_err; 497 struct mlx5_eqe_cq_err cq_err;
501 struct mlx5_eqe_dropped_packet dp;
502 struct mlx5_eqe_port_state port; 498 struct mlx5_eqe_port_state port;
503 struct mlx5_eqe_gpio gpio; 499 struct mlx5_eqe_gpio gpio;
504 struct mlx5_eqe_congestion cong; 500 struct mlx5_eqe_congestion cong;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 2bce4aad2570..b88e9b46d957 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -381,8 +381,8 @@ struct mlx5_buf {
381 struct mlx5_buf_list *page_list; 381 struct mlx5_buf_list *page_list;
382 int nbufs; 382 int nbufs;
383 int npages; 383 int npages;
384 int page_shift;
385 int size; 384 int size;
385 u8 page_shift;
386}; 386};
387 387
388struct mlx5_eq { 388struct mlx5_eq {
@@ -543,6 +543,10 @@ struct mlx5_priv {
543 /* protect mkey key part */ 543 /* protect mkey key part */
544 spinlock_t mkey_lock; 544 spinlock_t mkey_lock;
545 u8 mkey_key; 545 u8 mkey_key;
546
547 struct list_head dev_list;
548 struct list_head ctx_list;
549 spinlock_t ctx_lock;
546}; 550};
547 551
548struct mlx5_core_dev { 552struct mlx5_core_dev {
@@ -555,7 +559,7 @@ struct mlx5_core_dev {
555 struct mlx5_init_seg __iomem *iseg; 559 struct mlx5_init_seg __iomem *iseg;
556 void (*event) (struct mlx5_core_dev *dev, 560 void (*event) (struct mlx5_core_dev *dev,
557 enum mlx5_dev_event event, 561 enum mlx5_dev_event event,
558 void *data); 562 unsigned long param);
559 struct mlx5_priv priv; 563 struct mlx5_priv priv;
560 struct mlx5_profile *profile; 564 struct mlx5_profile *profile;
561 atomic_t num_qps; 565 atomic_t num_qps;
@@ -604,8 +608,8 @@ struct mlx5_cmd_work_ent {
604 int page_queue; 608 int page_queue;
605 u8 status; 609 u8 status;
606 u8 token; 610 u8 token;
607 struct timespec ts1; 611 u64 ts1;
608 struct timespec ts2; 612 u64 ts2;
609 u16 op; 613 u16 op;
610}; 614};
611 615
@@ -686,8 +690,6 @@ static inline u32 mlx5_base_mkey(const u32 key)
686 return key & 0xffffff00u; 690 return key & 0xffffff00u;
687} 691}
688 692
689int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
690void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
691int mlx5_cmd_init(struct mlx5_core_dev *dev); 693int mlx5_cmd_init(struct mlx5_core_dev *dev);
692void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); 694void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
693void mlx5_cmd_use_events(struct mlx5_core_dev *dev); 695void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
@@ -734,7 +736,7 @@ int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
734int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); 736int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
735int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); 737int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
736int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, 738int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
737 u16 opmod, int port); 739 u16 opmod, u8 port);
738void mlx5_pagealloc_init(struct mlx5_core_dev *dev); 740void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
739void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); 741void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
740int mlx5_pagealloc_start(struct mlx5_core_dev *dev); 742int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
@@ -767,7 +769,7 @@ void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
767int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in, 769int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
768 int size_in, void *data_out, int size_out, 770 int size_in, void *data_out, int size_out,
769 u16 reg_num, int arg, int write); 771 u16 reg_num, int arg, int write);
770int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps); 772int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
771 773
772int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 774int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
773void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 775void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
@@ -811,9 +813,20 @@ enum {
811 MAX_MR_CACHE_ENTRIES = 16, 813 MAX_MR_CACHE_ENTRIES = 16,
812}; 814};
813 815
816struct mlx5_interface {
817 void * (*add)(struct mlx5_core_dev *dev);
818 void (*remove)(struct mlx5_core_dev *dev, void *context);
819 void (*event)(struct mlx5_core_dev *dev, void *context,
820 enum mlx5_dev_event event, unsigned long param);
821 struct list_head list;
822};
823
824int mlx5_register_interface(struct mlx5_interface *intf);
825void mlx5_unregister_interface(struct mlx5_interface *intf);
826
814struct mlx5_profile { 827struct mlx5_profile {
815 u64 mask; 828 u64 mask;
816 u32 log_max_qp; 829 u8 log_max_qp;
817 struct { 830 struct {
818 int size; 831 int size;
819 int limit; 832 int limit;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e03dd29145a0..8981cc882ed2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2014,13 +2014,20 @@ static inline bool kernel_page_present(struct page *page) { return true; }
2014#endif /* CONFIG_HIBERNATION */ 2014#endif /* CONFIG_HIBERNATION */
2015#endif 2015#endif
2016 2016
2017#ifdef __HAVE_ARCH_GATE_AREA
2017extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm); 2018extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
2018#ifdef __HAVE_ARCH_GATE_AREA 2019extern int in_gate_area_no_mm(unsigned long addr);
2019int in_gate_area_no_mm(unsigned long addr); 2020extern int in_gate_area(struct mm_struct *mm, unsigned long addr);
2020int in_gate_area(struct mm_struct *mm, unsigned long addr);
2021#else 2021#else
2022int in_gate_area_no_mm(unsigned long addr); 2022static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
2023#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) 2023{
2024 return NULL;
2025}
2026static inline int in_gate_area_no_mm(unsigned long addr) { return 0; }
2027static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
2028{
2029 return 0;
2030}
2024#endif /* __HAVE_ARCH_GATE_AREA */ 2031#endif /* __HAVE_ARCH_GATE_AREA */
2025 2032
2026#ifdef CONFIG_SYSCTL 2033#ifdef CONFIG_SYSCTL
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 96c5750e3110..6e0b286649f1 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -461,6 +461,7 @@ static inline void mm_init_cpumask(struct mm_struct *mm)
461#ifdef CONFIG_CPUMASK_OFFSTACK 461#ifdef CONFIG_CPUMASK_OFFSTACK
462 mm->cpu_vm_mask_var = &mm->cpumask_allocation; 462 mm->cpu_vm_mask_var = &mm->cpumask_allocation;
463#endif 463#endif
464 cpumask_clear(mm->cpu_vm_mask_var);
464} 465}
465 466
466/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 467/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
@@ -516,4 +517,12 @@ struct vm_special_mapping
516 struct page **pages; 517 struct page **pages;
517}; 518};
518 519
520enum tlb_flush_reason {
521 TLB_FLUSH_ON_TASK_SWITCH,
522 TLB_REMOTE_SHOOTDOWN,
523 TLB_LOCAL_SHOOTDOWN,
524 TLB_LOCAL_MM_SHOOTDOWN,
525 NR_TLB_FLUSH_REASONS,
526};
527
519#endif /* _LINUX_MM_TYPES_H */ 528#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index babaea93bca6..29ce014ab421 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -213,6 +213,8 @@ struct dw_mci_dma_ops {
213#define DW_MCI_QUIRK_HIGHSPEED BIT(2) 213#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
214/* Unreliable card detection */ 214/* Unreliable card detection */
215#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 215#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
216/* No write protect */
217#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4)
216 218
217/* Slot level quirks */ 219/* Slot level quirks */
218/* This slot has no write protect */ 220/* This slot has no write protect */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 08abe9941884..09ebe57d5ce9 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -104,9 +104,6 @@ struct sdhci_host {
104 104
105 const struct sdhci_ops *ops; /* Low level hw interface */ 105 const struct sdhci_ops *ops; /* Low level hw interface */
106 106
107 struct regulator *vmmc; /* Power regulator (vmmc) */
108 struct regulator *vqmmc; /* Signaling regulator (vccq) */
109
110 /* Internal data */ 107 /* Internal data */
111 struct mmc_host *mmc; /* MMC structure */ 108 struct mmc_host *mmc; /* MMC structure */
112 u64 dma_mask; /* custom DMA mask */ 109 u64 dma_mask; /* custom DMA mask */
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index edd82a105220..2f348d02f640 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -20,11 +20,13 @@ extern void dump_page_badflags(struct page *page, const char *reason,
20 } while (0) 20 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond) 21#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) 22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
23#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
23#else 24#else
24#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 25#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
25#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 26#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
26#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) 27#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
27#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) 28#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
29#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
28#endif 30#endif
29 31
30#ifdef CONFIG_DEBUG_VIRTUAL 32#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index deca87452528..27288692241e 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -170,6 +170,8 @@ extern int __mmu_notifier_register(struct mmu_notifier *mn,
170 struct mm_struct *mm); 170 struct mm_struct *mm);
171extern void mmu_notifier_unregister(struct mmu_notifier *mn, 171extern void mmu_notifier_unregister(struct mmu_notifier *mn,
172 struct mm_struct *mm); 172 struct mm_struct *mm);
173extern void mmu_notifier_unregister_no_release(struct mmu_notifier *mn,
174 struct mm_struct *mm);
173extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); 175extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
174extern void __mmu_notifier_release(struct mm_struct *mm); 176extern void __mmu_notifier_release(struct mm_struct *mm);
175extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 177extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
@@ -288,6 +290,10 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
288 set_pte_at(___mm, ___address, __ptep, ___pte); \ 290 set_pte_at(___mm, ___address, __ptep, ___pte); \
289}) 291})
290 292
293extern void mmu_notifier_call_srcu(struct rcu_head *rcu,
294 void (*func)(struct rcu_head *rcu));
295extern void mmu_notifier_synchronize(void);
296
291#else /* CONFIG_MMU_NOTIFIER */ 297#else /* CONFIG_MMU_NOTIFIER */
292 298
293static inline void mmu_notifier_release(struct mm_struct *mm) 299static inline void mmu_notifier_release(struct mm_struct *mm)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6cbd1b6c3d20..318df7051850 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -143,6 +143,7 @@ enum zone_stat_item {
143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */ 143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
144 NR_DIRTIED, /* page dirtyings since bootup */ 144 NR_DIRTIED, /* page dirtyings since bootup */
145 NR_WRITTEN, /* page writings since bootup */ 145 NR_WRITTEN, /* page writings since bootup */
146 NR_PAGES_SCANNED, /* pages scanned since last reclaim */
146#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
147 NUMA_HIT, /* allocated in intended node */ 148 NUMA_HIT, /* allocated in intended node */
148 NUMA_MISS, /* allocated in non intended node */ 149 NUMA_MISS, /* allocated in non intended node */
@@ -324,19 +325,12 @@ enum zone_type {
324#ifndef __GENERATING_BOUNDS_H 325#ifndef __GENERATING_BOUNDS_H
325 326
326struct zone { 327struct zone {
327 /* Fields commonly accessed by the page allocator */ 328 /* Read-mostly fields */
328 329
329 /* zone watermarks, access with *_wmark_pages(zone) macros */ 330 /* zone watermarks, access with *_wmark_pages(zone) macros */
330 unsigned long watermark[NR_WMARK]; 331 unsigned long watermark[NR_WMARK];
331 332
332 /* 333 /*
333 * When free pages are below this point, additional steps are taken
334 * when reading the number of free pages to avoid per-cpu counter
335 * drift allowing watermarks to be breached
336 */
337 unsigned long percpu_drift_mark;
338
339 /*
340 * We don't know if the memory that we're going to allocate will be freeable 334 * We don't know if the memory that we're going to allocate will be freeable
341 * or/and it will be released eventually, so to avoid totally wasting several 335 * or/and it will be released eventually, so to avoid totally wasting several
342 * GB of ram we must reserve some of the lower zone memory (otherwise we risk 336 * GB of ram we must reserve some of the lower zone memory (otherwise we risk
@@ -344,41 +338,26 @@ struct zone {
344 * on the higher zones). This array is recalculated at runtime if the 338 * on the higher zones). This array is recalculated at runtime if the
345 * sysctl_lowmem_reserve_ratio sysctl changes. 339 * sysctl_lowmem_reserve_ratio sysctl changes.
346 */ 340 */
347 unsigned long lowmem_reserve[MAX_NR_ZONES]; 341 long lowmem_reserve[MAX_NR_ZONES];
348
349 /*
350 * This is a per-zone reserve of pages that should not be
351 * considered dirtyable memory.
352 */
353 unsigned long dirty_balance_reserve;
354 342
355#ifdef CONFIG_NUMA 343#ifdef CONFIG_NUMA
356 int node; 344 int node;
345#endif
346
357 /* 347 /*
358 * zone reclaim becomes active if more unmapped pages exist. 348 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
349 * this zone's LRU. Maintained by the pageout code.
359 */ 350 */
360 unsigned long min_unmapped_pages; 351 unsigned int inactive_ratio;
361 unsigned long min_slab_pages; 352
362#endif 353 struct pglist_data *zone_pgdat;
363 struct per_cpu_pageset __percpu *pageset; 354 struct per_cpu_pageset __percpu *pageset;
355
364 /* 356 /*
365 * free areas of different sizes 357 * This is a per-zone reserve of pages that should not be
358 * considered dirtyable memory.
366 */ 359 */
367 spinlock_t lock; 360 unsigned long dirty_balance_reserve;
368#if defined CONFIG_COMPACTION || defined CONFIG_CMA
369 /* Set to true when the PG_migrate_skip bits should be cleared */
370 bool compact_blockskip_flush;
371
372 /* pfn where compaction free scanner should start */
373 unsigned long compact_cached_free_pfn;
374 /* pfn where async and sync compaction migration scanner should start */
375 unsigned long compact_cached_migrate_pfn[2];
376#endif
377#ifdef CONFIG_MEMORY_HOTPLUG
378 /* see spanned/present_pages for more description */
379 seqlock_t span_seqlock;
380#endif
381 struct free_area free_area[MAX_ORDER];
382 361
383#ifndef CONFIG_SPARSEMEM 362#ifndef CONFIG_SPARSEMEM
384 /* 363 /*
@@ -388,74 +367,14 @@ struct zone {
388 unsigned long *pageblock_flags; 367 unsigned long *pageblock_flags;
389#endif /* CONFIG_SPARSEMEM */ 368#endif /* CONFIG_SPARSEMEM */
390 369
391#ifdef CONFIG_COMPACTION 370#ifdef CONFIG_NUMA
392 /*
393 * On compaction failure, 1<<compact_defer_shift compactions
394 * are skipped before trying again. The number attempted since
395 * last failure is tracked with compact_considered.
396 */
397 unsigned int compact_considered;
398 unsigned int compact_defer_shift;
399 int compact_order_failed;
400#endif
401
402 ZONE_PADDING(_pad1_)
403
404 /* Fields commonly accessed by the page reclaim scanner */
405 spinlock_t lru_lock;
406 struct lruvec lruvec;
407
408 /* Evictions & activations on the inactive file list */
409 atomic_long_t inactive_age;
410
411 unsigned long pages_scanned; /* since last reclaim */
412 unsigned long flags; /* zone flags, see below */
413
414 /* Zone statistics */
415 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
416
417 /*
418 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
419 * this zone's LRU. Maintained by the pageout code.
420 */
421 unsigned int inactive_ratio;
422
423
424 ZONE_PADDING(_pad2_)
425 /* Rarely used or read-mostly fields */
426
427 /* 371 /*
428 * wait_table -- the array holding the hash table 372 * zone reclaim becomes active if more unmapped pages exist.
429 * wait_table_hash_nr_entries -- the size of the hash table array
430 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
431 *
432 * The purpose of all these is to keep track of the people
433 * waiting for a page to become available and make them
434 * runnable again when possible. The trouble is that this
435 * consumes a lot of space, especially when so few things
436 * wait on pages at a given time. So instead of using
437 * per-page waitqueues, we use a waitqueue hash table.
438 *
439 * The bucket discipline is to sleep on the same queue when
440 * colliding and wake all in that wait queue when removing.
441 * When something wakes, it must check to be sure its page is
442 * truly available, a la thundering herd. The cost of a
443 * collision is great, but given the expected load of the
444 * table, they should be so rare as to be outweighed by the
445 * benefits from the saved space.
446 *
447 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
448 * primary users of these fields, and in mm/page_alloc.c
449 * free_area_init_core() performs the initialization of them.
450 */ 373 */
451 wait_queue_head_t * wait_table; 374 unsigned long min_unmapped_pages;
452 unsigned long wait_table_hash_nr_entries; 375 unsigned long min_slab_pages;
453 unsigned long wait_table_bits; 376#endif /* CONFIG_NUMA */
454 377
455 /*
456 * Discontig memory support fields.
457 */
458 struct pglist_data *zone_pgdat;
459 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 378 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
460 unsigned long zone_start_pfn; 379 unsigned long zone_start_pfn;
461 380
@@ -500,9 +419,11 @@ struct zone {
500 * adjust_managed_page_count() should be used instead of directly 419 * adjust_managed_page_count() should be used instead of directly
501 * touching zone->managed_pages and totalram_pages. 420 * touching zone->managed_pages and totalram_pages.
502 */ 421 */
422 unsigned long managed_pages;
503 unsigned long spanned_pages; 423 unsigned long spanned_pages;
504 unsigned long present_pages; 424 unsigned long present_pages;
505 unsigned long managed_pages; 425
426 const char *name;
506 427
507 /* 428 /*
508 * Number of MIGRATE_RESEVE page block. To maintain for just 429 * Number of MIGRATE_RESEVE page block. To maintain for just
@@ -510,10 +431,94 @@ struct zone {
510 */ 431 */
511 int nr_migrate_reserve_block; 432 int nr_migrate_reserve_block;
512 433
434#ifdef CONFIG_MEMORY_HOTPLUG
435 /* see spanned/present_pages for more description */
436 seqlock_t span_seqlock;
437#endif
438
513 /* 439 /*
514 * rarely used fields: 440 * wait_table -- the array holding the hash table
441 * wait_table_hash_nr_entries -- the size of the hash table array
442 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
443 *
444 * The purpose of all these is to keep track of the people
445 * waiting for a page to become available and make them
446 * runnable again when possible. The trouble is that this
447 * consumes a lot of space, especially when so few things
448 * wait on pages at a given time. So instead of using
449 * per-page waitqueues, we use a waitqueue hash table.
450 *
451 * The bucket discipline is to sleep on the same queue when
452 * colliding and wake all in that wait queue when removing.
453 * When something wakes, it must check to be sure its page is
454 * truly available, a la thundering herd. The cost of a
455 * collision is great, but given the expected load of the
456 * table, they should be so rare as to be outweighed by the
457 * benefits from the saved space.
458 *
459 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
460 * primary users of these fields, and in mm/page_alloc.c
461 * free_area_init_core() performs the initialization of them.
515 */ 462 */
516 const char *name; 463 wait_queue_head_t *wait_table;
464 unsigned long wait_table_hash_nr_entries;
465 unsigned long wait_table_bits;
466
467 ZONE_PADDING(_pad1_)
468
469 /* Write-intensive fields used from the page allocator */
470 spinlock_t lock;
471
472 /* free areas of different sizes */
473 struct free_area free_area[MAX_ORDER];
474
475 /* zone flags, see below */
476 unsigned long flags;
477
478 ZONE_PADDING(_pad2_)
479
480 /* Write-intensive fields used by page reclaim */
481
482 /* Fields commonly accessed by the page reclaim scanner */
483 spinlock_t lru_lock;
484 struct lruvec lruvec;
485
486 /* Evictions & activations on the inactive file list */
487 atomic_long_t inactive_age;
488
489 /*
490 * When free pages are below this point, additional steps are taken
491 * when reading the number of free pages to avoid per-cpu counter
492 * drift allowing watermarks to be breached
493 */
494 unsigned long percpu_drift_mark;
495
496#if defined CONFIG_COMPACTION || defined CONFIG_CMA
497 /* pfn where compaction free scanner should start */
498 unsigned long compact_cached_free_pfn;
499 /* pfn where async and sync compaction migration scanner should start */
500 unsigned long compact_cached_migrate_pfn[2];
501#endif
502
503#ifdef CONFIG_COMPACTION
504 /*
505 * On compaction failure, 1<<compact_defer_shift compactions
506 * are skipped before trying again. The number attempted since
507 * last failure is tracked with compact_considered.
508 */
509 unsigned int compact_considered;
510 unsigned int compact_defer_shift;
511 int compact_order_failed;
512#endif
513
514#if defined CONFIG_COMPACTION || defined CONFIG_CMA
515 /* Set to true when the PG_migrate_skip bits should be cleared */
516 bool compact_blockskip_flush;
517#endif
518
519 ZONE_PADDING(_pad3_)
520 /* Zone statistics */
521 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
517} ____cacheline_internodealigned_in_smp; 522} ____cacheline_internodealigned_in_smp;
518 523
519typedef enum { 524typedef enum {
@@ -529,6 +534,7 @@ typedef enum {
529 ZONE_WRITEBACK, /* reclaim scanning has recently found 534 ZONE_WRITEBACK, /* reclaim scanning has recently found
530 * many pages under writeback 535 * many pages under writeback
531 */ 536 */
537 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */
532} zone_flags_t; 538} zone_flags_t;
533 539
534static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) 540static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
@@ -566,6 +572,11 @@ static inline int zone_is_reclaim_locked(const struct zone *zone)
566 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 572 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
567} 573}
568 574
575static inline int zone_is_fair_depleted(const struct zone *zone)
576{
577 return test_bit(ZONE_FAIR_DEPLETED, &zone->flags);
578}
579
569static inline int zone_is_oom_locked(const struct zone *zone) 580static inline int zone_is_oom_locked(const struct zone *zone)
570{ 581{
571 return test_bit(ZONE_OOM_LOCKED, &zone->flags); 582 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
@@ -872,6 +883,8 @@ static inline int zone_movable_is_highmem(void)
872{ 883{
873#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 884#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
874 return movable_zone == ZONE_HIGHMEM; 885 return movable_zone == ZONE_HIGHMEM;
886#elif defined(CONFIG_HIGHMEM)
887 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
875#else 888#else
876 return 0; 889 return 0;
877#endif 890#endif
diff --git a/include/linux/module.h b/include/linux/module.h
index f520a767c86c..71f282a4e307 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -396,18 +396,25 @@ bool is_module_address(unsigned long addr);
396bool is_module_percpu_address(unsigned long addr); 396bool is_module_percpu_address(unsigned long addr);
397bool is_module_text_address(unsigned long addr); 397bool is_module_text_address(unsigned long addr);
398 398
399static inline int within_module_core(unsigned long addr, const struct module *mod) 399static inline bool within_module_core(unsigned long addr,
400 const struct module *mod)
400{ 401{
401 return (unsigned long)mod->module_core <= addr && 402 return (unsigned long)mod->module_core <= addr &&
402 addr < (unsigned long)mod->module_core + mod->core_size; 403 addr < (unsigned long)mod->module_core + mod->core_size;
403} 404}
404 405
405static inline int within_module_init(unsigned long addr, const struct module *mod) 406static inline bool within_module_init(unsigned long addr,
407 const struct module *mod)
406{ 408{
407 return (unsigned long)mod->module_init <= addr && 409 return (unsigned long)mod->module_init <= addr &&
408 addr < (unsigned long)mod->module_init + mod->init_size; 410 addr < (unsigned long)mod->module_init + mod->init_size;
409} 411}
410 412
413static inline bool within_module(unsigned long addr, const struct module *mod)
414{
415 return within_module_init(addr, mod) || within_module_core(addr, mod);
416}
417
411/* Search for module by name: must hold module_mutex. */ 418/* Search for module by name: must hold module_mutex. */
412struct module *find_module(const char *name); 419struct module *find_module(const char *name);
413 420
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 560ca53a75fa..7eeb9bbfb816 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
45 unsigned int relsec, 45 unsigned int relsec,
46 struct module *me) 46 struct module *me)
47{ 47{
48 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); 48 printk(KERN_ERR "module %s: REL relocation unsupported\n",
49 module_name(me));
49 return -ENOEXEC; 50 return -ENOEXEC;
50} 51}
51#endif 52#endif
@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
67 unsigned int relsec, 68 unsigned int relsec,
68 struct module *me) 69 struct module *me)
69{ 70{
70 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); 71 printk(KERN_ERR "module %s: REL relocation unsupported\n",
72 module_name(me));
71 return -ENOEXEC; 73 return -ENOEXEC;
72} 74}
73#endif 75#endif
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 839bac270904..9262e4bf0cc3 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -42,13 +42,20 @@ struct mnt_namespace;
42 * flag, consider how it interacts with shared mounts. 42 * flag, consider how it interacts with shared mounts.
43 */ 43 */
44#define MNT_SHARED_MASK (MNT_UNBINDABLE) 44#define MNT_SHARED_MASK (MNT_UNBINDABLE)
45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) 45#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
46 | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
47 | MNT_READONLY)
48#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
46 49
47#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \ 50#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
48 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED) 51 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
49 52
50#define MNT_INTERNAL 0x4000 53#define MNT_INTERNAL 0x4000
51 54
55#define MNT_LOCK_ATIME 0x040000
56#define MNT_LOCK_NOEXEC 0x080000
57#define MNT_LOCK_NOSUID 0x100000
58#define MNT_LOCK_NODEV 0x200000
52#define MNT_LOCK_READONLY 0x400000 59#define MNT_LOCK_READONLY 0x400000
53#define MNT_LOCKED 0x800000 60#define MNT_LOCKED 0x800000
54#define MNT_DOOMED 0x1000000 61#define MNT_DOOMED 0x1000000
@@ -62,6 +69,7 @@ struct vfsmount {
62}; 69};
63 70
64struct file; /* forward dec */ 71struct file; /* forward dec */
72struct path;
65 73
66extern int mnt_want_write(struct vfsmount *mnt); 74extern int mnt_want_write(struct vfsmount *mnt);
67extern int mnt_want_write_file(struct file *file); 75extern int mnt_want_write_file(struct file *file);
@@ -70,8 +78,7 @@ extern void mnt_drop_write(struct vfsmount *mnt);
70extern void mnt_drop_write_file(struct file *file); 78extern void mnt_drop_write_file(struct file *file);
71extern void mntput(struct vfsmount *mnt); 79extern void mntput(struct vfsmount *mnt);
72extern struct vfsmount *mntget(struct vfsmount *mnt); 80extern struct vfsmount *mntget(struct vfsmount *mnt);
73extern void mnt_pin(struct vfsmount *mnt); 81extern struct vfsmount *mnt_clone_internal(struct path *path);
74extern void mnt_unpin(struct vfsmount *mnt);
75extern int __mnt_is_readonly(struct vfsmount *mnt); 82extern int __mnt_is_readonly(struct vfsmount *mnt);
76 83
77struct file_system_type; 84struct file_system_type;
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 92a2f991262a..8103f32f6d87 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -25,7 +25,8 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg);
25struct msi_desc { 25struct msi_desc {
26 struct { 26 struct {
27 __u8 is_msix : 1; 27 __u8 is_msix : 1;
28 __u8 multiple: 3; /* log2 number of messages */ 28 __u8 multiple: 3; /* log2 num of messages allocated */
29 __u8 multi_cap : 3; /* log2 num of messages supported */
29 __u8 maskbit : 1; /* mask-pending bit supported ? */ 30 __u8 maskbit : 1; /* mask-pending bit supported ? */
30 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
31 __u8 pos; /* Location of the msi capability */ 32 __u8 pos; /* Location of the msi capability */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a1b0b4c8fd79..031ff3a9a0bd 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -222,6 +222,7 @@ struct mtd_info {
222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
225 int (*_block_isreserved) (struct mtd_info *mtd, loff_t ofs);
225 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); 226 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
226 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); 227 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
227 int (*_suspend) (struct mtd_info *mtd); 228 int (*_suspend) (struct mtd_info *mtd);
@@ -302,6 +303,7 @@ static inline void mtd_sync(struct mtd_info *mtd)
302int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 303int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
303int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 304int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
304int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len); 305int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len);
306int mtd_block_isreserved(struct mtd_info *mtd, loff_t ofs);
305int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs); 307int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs);
306int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); 308int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs);
307 309
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2f0af2891f0f..3083c53e0270 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -810,6 +810,7 @@ extern struct nand_manufacturers nand_manuf_ids[];
810extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 810extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
811extern int nand_default_bbt(struct mtd_info *mtd); 811extern int nand_default_bbt(struct mtd_info *mtd);
812extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); 812extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
813extern int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs);
813extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 814extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
814extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 815extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
815 int allowbbt); 816 int allowbbt);
@@ -947,4 +948,56 @@ static inline int jedec_feature(struct nand_chip *chip)
947 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features) 948 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
948 : 0; 949 : 0;
949} 950}
951
952/**
953 * struct nand_sdr_timings - SDR NAND chip timings
954 *
955 * This struct defines the timing requirements of a SDR NAND chip.
956 * These informations can be found in every NAND datasheets and the timings
957 * meaning are described in the ONFI specifications:
958 * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
959 * Parameters)
960 *
961 * All these timings are expressed in picoseconds.
962 */
963
964struct nand_sdr_timings {
965 u32 tALH_min;
966 u32 tADL_min;
967 u32 tALS_min;
968 u32 tAR_min;
969 u32 tCEA_max;
970 u32 tCEH_min;
971 u32 tCH_min;
972 u32 tCHZ_max;
973 u32 tCLH_min;
974 u32 tCLR_min;
975 u32 tCLS_min;
976 u32 tCOH_min;
977 u32 tCS_min;
978 u32 tDH_min;
979 u32 tDS_min;
980 u32 tFEAT_max;
981 u32 tIR_min;
982 u32 tITC_max;
983 u32 tRC_min;
984 u32 tREA_max;
985 u32 tREH_min;
986 u32 tRHOH_min;
987 u32 tRHW_min;
988 u32 tRHZ_max;
989 u32 tRLOH_min;
990 u32 tRP_min;
991 u32 tRR_min;
992 u64 tRST_max;
993 u32 tWB_max;
994 u32 tWC_min;
995 u32 tWH_min;
996 u32 tWHR_min;
997 u32 tWP_min;
998 u32 tWW_min;
999};
1000
1001/* get timing characteristics from ONFI timing mode. */
1002const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
950#endif /* __LINUX_MTD_NAND_H */ 1003#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 53241842a7ab..9e6294f32ba8 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -34,6 +34,7 @@
34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */ 34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */
35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */ 35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */
36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */ 36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */
37#define SPINOR_OP_RDFSR 0x70 /* Read flag status register */
37 38
38/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ 39/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
39#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */ 40#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
@@ -66,6 +67,9 @@
66 67
67#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ 68#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
68 69
70/* Flag Status Register bits */
71#define FSR_READY 0x80
72
69/* Configuration Register bits. */ 73/* Configuration Register bits. */
70#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ 74#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */
71 75
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 11692dea18aa..8d5535c58cc2 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -17,6 +17,7 @@
17#include <linux/lockdep.h> 17#include <linux/lockdep.h>
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <asm/processor.h> 19#include <asm/processor.h>
20#include <linux/osq_lock.h>
20 21
21/* 22/*
22 * Simple, straightforward mutexes with strict semantics: 23 * Simple, straightforward mutexes with strict semantics:
@@ -46,7 +47,6 @@
46 * - detects multi-task circular deadlocks and prints out all affected 47 * - detects multi-task circular deadlocks and prints out all affected
47 * locks and tasks (and only those tasks) 48 * locks and tasks (and only those tasks)
48 */ 49 */
49struct optimistic_spin_queue;
50struct mutex { 50struct mutex {
51 /* 1: unlocked, 0: locked, negative: locked, possible waiters */ 51 /* 1: unlocked, 0: locked, negative: locked, possible waiters */
52 atomic_t count; 52 atomic_t count;
@@ -56,7 +56,7 @@ struct mutex {
56 struct task_struct *owner; 56 struct task_struct *owner;
57#endif 57#endif
58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER 58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
59 struct optimistic_spin_queue *osq; /* Spinner MCS lock */ 59 struct optimistic_spin_queue osq; /* Spinner MCS lock */
60#endif 60#endif
61#ifdef CONFIG_DEBUG_MUTEXES 61#ifdef CONFIG_DEBUG_MUTEXES
62 const char *name; 62 const char *name;
@@ -176,8 +176,4 @@ extern void mutex_unlock(struct mutex *lock);
176 176
177extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 177extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
178 178
179#ifndef arch_mutex_cpu_relax
180# define arch_mutex_cpu_relax() cpu_relax()
181#endif
182
183#endif /* __LINUX_MUTEX_H */ 179#endif /* __LINUX_MUTEX_H */
diff --git a/include/linux/mvebu-pmsu.h b/include/linux/mvebu-pmsu.h
new file mode 100644
index 000000000000..b918d07efe23
--- /dev/null
+++ b/include/linux/mvebu-pmsu.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2012 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MVEBU_PMSU_H__
12#define __MVEBU_PMSU_H__
13
14#ifdef CONFIG_MACH_MVEBU_V7
15int mvebu_pmsu_dfs_request(int cpu);
16#else
17static inline int mvebu_pmsu_dfs_request(int cpu) { return -ENODEV; }
18#endif
19
20#endif /* __MVEBU_PMSU_H__ */
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index d99800cbdcf3..dcfdecbfa0b7 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -176,4 +176,12 @@ enum {
176 NETIF_F_HW_VLAN_STAG_RX | \ 176 NETIF_F_HW_VLAN_STAG_RX | \
177 NETIF_F_HW_VLAN_STAG_TX) 177 NETIF_F_HW_VLAN_STAG_TX)
178 178
179#define NETIF_F_GSO_ENCAP_ALL (NETIF_F_GSO_GRE | \
180 NETIF_F_GSO_GRE_CSUM | \
181 NETIF_F_GSO_IPIP | \
182 NETIF_F_GSO_SIT | \
183 NETIF_F_GSO_UDP_TUNNEL | \
184 NETIF_F_GSO_UDP_TUNNEL_CSUM | \
185 NETIF_F_GSO_MPLS)
186
179#endif /* _LINUX_NETDEV_FEATURES_H */ 187#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 66f9a04ec270..38377392d082 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -943,7 +943,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
943 * const unsigned char *addr) 943 * const unsigned char *addr)
944 * Deletes the FDB entry from dev coresponding to addr. 944 * Deletes the FDB entry from dev coresponding to addr.
945 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 945 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
946 * struct net_device *dev, int idx) 946 * struct net_device *dev, struct net_device *filter_dev,
947 * int idx)
947 * Used to add FDB entries to dump requests. Implementers should add 948 * Used to add FDB entries to dump requests. Implementers should add
948 * entries to skb and update idx with the number of entries. 949 * entries to skb and update idx with the number of entries.
949 * 950 *
@@ -1114,6 +1115,7 @@ struct net_device_ops {
1114 int (*ndo_fdb_dump)(struct sk_buff *skb, 1115 int (*ndo_fdb_dump)(struct sk_buff *skb,
1115 struct netlink_callback *cb, 1116 struct netlink_callback *cb,
1116 struct net_device *dev, 1117 struct net_device *dev,
1118 struct net_device *filter_dev,
1117 int idx); 1119 int idx);
1118 1120
1119 int (*ndo_bridge_setlink)(struct net_device *dev, 1121 int (*ndo_bridge_setlink)(struct net_device *dev,
@@ -1229,42 +1231,228 @@ enum netdev_priv_flags {
1229#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1231#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1230#define IFF_MACVLAN IFF_MACVLAN 1232#define IFF_MACVLAN IFF_MACVLAN
1231 1233
1232/* 1234/**
1233 * The DEVICE structure. 1235 * struct net_device - The DEVICE structure.
1234 * Actually, this whole structure is a big mistake. It mixes I/O 1236 * Actually, this whole structure is a big mistake. It mixes I/O
1235 * data with strictly "high-level" data, and it has to know about 1237 * data with strictly "high-level" data, and it has to know about
1236 * almost every data structure used in the INET module. 1238 * almost every data structure used in the INET module.
1239 *
1240 * @name: This is the first field of the "visible" part of this structure
1241 * (i.e. as seen by users in the "Space.c" file). It is the name
1242 * of the interface.
1243 *
1244 * @name_hlist: Device name hash chain, please keep it close to name[]
1245 * @ifalias: SNMP alias
1246 * @mem_end: Shared memory end
1247 * @mem_start: Shared memory start
1248 * @base_addr: Device I/O address
1249 * @irq: Device IRQ number
1250 *
1251 * @state: Generic network queuing layer state, see netdev_state_t
1252 * @dev_list: The global list of network devices
1253 * @napi_list: List entry, that is used for polling napi devices
1254 * @unreg_list: List entry, that is used, when we are unregistering the
1255 * device, see the function unregister_netdev
1256 * @close_list: List entry, that is used, when we are closing the device
1257 *
1258 * @adj_list: Directly linked devices, like slaves for bonding
1259 * @all_adj_list: All linked devices, *including* neighbours
1260 * @features: Currently active device features
1261 * @hw_features: User-changeable features
1262 *
1263 * @wanted_features: User-requested features
1264 * @vlan_features: Mask of features inheritable by VLAN devices
1265 *
1266 * @hw_enc_features: Mask of features inherited by encapsulating devices
1267 * This field indicates what encapsulation
1268 * offloads the hardware is capable of doing,
1269 * and drivers will need to set them appropriately.
1270 *
1271 * @mpls_features: Mask of features inheritable by MPLS
1272 *
1273 * @ifindex: interface index
1274 * @iflink: unique device identifier
1275 *
1276 * @stats: Statistics struct, which was left as a legacy, use
1277 * rtnl_link_stats64 instead
1278 *
1279 * @rx_dropped: Dropped packets by core network,
1280 * do not use this in drivers
1281 * @tx_dropped: Dropped packets by core network,
1282 * do not use this in drivers
1283 *
1284 * @carrier_changes: Stats to monitor carrier on<->off transitions
1285 *
1286 * @wireless_handlers: List of functions to handle Wireless Extensions,
1287 * instead of ioctl,
1288 * see <net/iw_handler.h> for details.
1289 * @wireless_data: Instance data managed by the core of wireless extensions
1290 *
1291 * @netdev_ops: Includes several pointers to callbacks,
1292 * if one wants to override the ndo_*() functions
1293 * @ethtool_ops: Management operations
1294 * @fwd_ops: Management operations
1295 * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc
1296 * of Layer 2 headers.
1297 *
1298 * @flags: Interface flags (a la BSD)
1299 * @priv_flags: Like 'flags' but invisible to userspace,
1300 * see if.h for the definitions
1301 * @gflags: Global flags ( kept as legacy )
1302 * @padded: How much padding added by alloc_netdev()
1303 * @operstate: RFC2863 operstate
1304 * @link_mode: Mapping policy to operstate
1305 * @if_port: Selectable AUI, TP, ...
1306 * @dma: DMA channel
1307 * @mtu: Interface MTU value
1308 * @type: Interface hardware type
1309 * @hard_header_len: Hardware header length
1310 *
1311 * @needed_headroom: Extra headroom the hardware may need, but not in all
1312 * cases can this be guaranteed
1313 * @needed_tailroom: Extra tailroom the hardware may need, but not in all
1314 * cases can this be guaranteed. Some cases also use
1315 * LL_MAX_HEADER instead to allocate the skb
1316 *
1317 * interface address info:
1318 *
1319 * @perm_addr: Permanent hw address
1320 * @addr_assign_type: Hw address assignment type
1321 * @addr_len: Hardware address length
1322 * @neigh_priv_len; Used in neigh_alloc(),
1323 * initialized only in atm/clip.c
1324 * @dev_id: Used to differentiate devices that share
1325 * the same link layer address
1326 * @dev_port: Used to differentiate devices that share
1327 * the same function
1328 * @addr_list_lock: XXX: need comments on this one
1329 * @uc: unicast mac addresses
1330 * @mc: multicast mac addresses
1331 * @dev_addrs: list of device hw addresses
1332 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1333 * @uc_promisc: Counter, that indicates, that promiscuous mode
1334 * has been enabled due to the need to listen to
1335 * additional unicast addresses in a device that
1336 * does not implement ndo_set_rx_mode()
1337 * @promiscuity: Number of times, the NIC is told to work in
1338 * Promiscuous mode, if it becomes 0 the NIC will
1339 * exit from working in Promiscuous mode
1340 * @allmulti: Counter, enables or disables allmulticast mode
1341 *
1342 * @vlan_info: VLAN info
1343 * @dsa_ptr: dsa specific data
1344 * @tipc_ptr: TIPC specific data
1345 * @atalk_ptr: AppleTalk link
1346 * @ip_ptr: IPv4 specific data
1347 * @dn_ptr: DECnet specific data
1348 * @ip6_ptr: IPv6 specific data
1349 * @ax25_ptr: AX.25 specific data
1350 * @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
1351 *
1352 * @last_rx: Time of last Rx
1353 * @dev_addr: Hw address (before bcast,
1354 * because most packets are unicast)
1355 *
1356 * @_rx: Array of RX queues
1357 * @num_rx_queues: Number of RX queues
1358 * allocated at register_netdev() time
1359 * @real_num_rx_queues: Number of RX queues currently active in device
1360 *
1361 * @rx_handler: handler for received packets
1362 * @rx_handler_data: XXX: need comments on this one
1363 * @ingress_queue: XXX: need comments on this one
1364 * @broadcast: hw bcast address
1365 *
1366 * @_tx: Array of TX queues
1367 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time
1368 * @real_num_tx_queues: Number of TX queues currently active in device
1369 * @qdisc: Root qdisc from userspace point of view
1370 * @tx_queue_len: Max frames per queue allowed
1371 * @tx_global_lock: XXX: need comments on this one
1372 *
1373 * @xps_maps: XXX: need comments on this one
1374 *
1375 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1376 * indexed by RX queue number. Assigned by driver.
1377 * This must only be set if the ndo_rx_flow_steer
1378 * operation is defined
1379 *
1380 * @trans_start: Time (in jiffies) of last Tx
1381 * @watchdog_timeo: Represents the timeout that is used by
1382 * the watchdog ( see dev_watchdog() )
1383 * @watchdog_timer: List of timers
1384 *
1385 * @pcpu_refcnt: Number of references to this device
1386 * @todo_list: Delayed register/unregister
1387 * @index_hlist: Device index hash chain
1388 * @link_watch_list: XXX: need comments on this one
1389 *
1390 * @reg_state: Register/unregister state machine
1391 * @dismantle: Device is going to be freed
1392 * @rtnl_link_state: This enum represents the phases of creating
1393 * a new link
1394 *
1395 * @destructor: Called from unregister,
1396 * can be used to call free_netdev
1397 * @npinfo: XXX: need comments on this one
1398 * @nd_net: Network namespace this network device is inside
1399 *
1400 * @ml_priv: Mid-layer private
1401 * @lstats: Loopback statistics
1402 * @tstats: Tunnel statistics
1403 * @dstats: Dummy statistics
1404 * @vstats: Virtual ethernet statistics
1405 *
1406 * @garp_port: GARP
1407 * @mrp_port: MRP
1408 *
1409 * @dev: Class/net/name entry
1410 * @sysfs_groups: Space for optional device, statistics and wireless
1411 * sysfs groups
1412 *
1413 * @sysfs_rx_queue_group: Space for optional per-rx queue attributes
1414 * @rtnl_link_ops: Rtnl_link_ops
1415 *
1416 * @gso_max_size: Maximum size of generic segmentation offload
1417 * @gso_max_segs: Maximum number of segments that can be passed to the
1418 * NIC for GSO
1419 *
1420 * @dcbnl_ops: Data Center Bridging netlink ops
1421 * @num_tc: Number of traffic classes in the net device
1422 * @tc_to_txq: XXX: need comments on this one
1423 * @prio_tc_map XXX: need comments on this one
1424 *
1425 * @fcoe_ddp_xid: Max exchange id for FCoE LRO by ddp
1426 *
1427 * @priomap: XXX: need comments on this one
1428 * @phydev: Physical device may attach itself
1429 * for hardware timestamping
1430 *
1431 * @qdisc_tx_busylock: XXX: need comments on this one
1432 *
1433 * @group: The group, that the device belongs to
1434 * @pm_qos_req: Power Management QoS object
1237 * 1435 *
1238 * FIXME: cleanup struct net_device such that network protocol info 1436 * FIXME: cleanup struct net_device such that network protocol info
1239 * moves out. 1437 * moves out.
1240 */ 1438 */
1241 1439
1242struct net_device { 1440struct net_device {
1243
1244 /*
1245 * This is the first field of the "visible" part of this structure
1246 * (i.e. as seen by users in the "Space.c" file). It is the name
1247 * of the interface.
1248 */
1249 char name[IFNAMSIZ]; 1441 char name[IFNAMSIZ];
1250
1251 /* device name hash chain, please keep it close to name[] */
1252 struct hlist_node name_hlist; 1442 struct hlist_node name_hlist;
1253
1254 /* snmp alias */
1255 char *ifalias; 1443 char *ifalias;
1256
1257 /* 1444 /*
1258 * I/O specific fields 1445 * I/O specific fields
1259 * FIXME: Merge these and struct ifmap into one 1446 * FIXME: Merge these and struct ifmap into one
1260 */ 1447 */
1261 unsigned long mem_end; /* shared mem end */ 1448 unsigned long mem_end;
1262 unsigned long mem_start; /* shared mem start */ 1449 unsigned long mem_start;
1263 unsigned long base_addr; /* device I/O address */ 1450 unsigned long base_addr;
1264 int irq; /* device IRQ number */ 1451 int irq;
1265 1452
1266 /* 1453 /*
1267 * Some hardware also needs these fields, but they are not 1454 * Some hardware also needs these fields (state,dev_list,
1455 * napi_list,unreg_list,close_list) but they are not
1268 * part of the usual set specified in Space.c. 1456 * part of the usual set specified in Space.c.
1269 */ 1457 */
1270 1458
@@ -1275,110 +1463,80 @@ struct net_device {
1275 struct list_head unreg_list; 1463 struct list_head unreg_list;
1276 struct list_head close_list; 1464 struct list_head close_list;
1277 1465
1278 /* directly linked devices, like slaves for bonding */
1279 struct { 1466 struct {
1280 struct list_head upper; 1467 struct list_head upper;
1281 struct list_head lower; 1468 struct list_head lower;
1282 } adj_list; 1469 } adj_list;
1283 1470
1284 /* all linked devices, *including* neighbours */
1285 struct { 1471 struct {
1286 struct list_head upper; 1472 struct list_head upper;
1287 struct list_head lower; 1473 struct list_head lower;
1288 } all_adj_list; 1474 } all_adj_list;
1289 1475
1290
1291 /* currently active device features */
1292 netdev_features_t features; 1476 netdev_features_t features;
1293 /* user-changeable features */
1294 netdev_features_t hw_features; 1477 netdev_features_t hw_features;
1295 /* user-requested features */
1296 netdev_features_t wanted_features; 1478 netdev_features_t wanted_features;
1297 /* mask of features inheritable by VLAN devices */
1298 netdev_features_t vlan_features; 1479 netdev_features_t vlan_features;
1299 /* mask of features inherited by encapsulating devices
1300 * This field indicates what encapsulation offloads
1301 * the hardware is capable of doing, and drivers will
1302 * need to set them appropriately.
1303 */
1304 netdev_features_t hw_enc_features; 1480 netdev_features_t hw_enc_features;
1305 /* mask of fetures inheritable by MPLS */
1306 netdev_features_t mpls_features; 1481 netdev_features_t mpls_features;
1307 1482
1308 /* Interface index. Unique device identifier */
1309 int ifindex; 1483 int ifindex;
1310 int iflink; 1484 int iflink;
1311 1485
1312 struct net_device_stats stats; 1486 struct net_device_stats stats;
1313 1487
1314 /* dropped packets by core network, Do not use this in drivers */
1315 atomic_long_t rx_dropped; 1488 atomic_long_t rx_dropped;
1316 atomic_long_t tx_dropped; 1489 atomic_long_t tx_dropped;
1317 1490
1318 /* Stats to monitor carrier on<->off transitions */
1319 atomic_t carrier_changes; 1491 atomic_t carrier_changes;
1320 1492
1321#ifdef CONFIG_WIRELESS_EXT 1493#ifdef CONFIG_WIRELESS_EXT
1322 /* List of functions to handle Wireless Extensions (instead of ioctl).
1323 * See <net/iw_handler.h> for details. Jean II */
1324 const struct iw_handler_def * wireless_handlers; 1494 const struct iw_handler_def * wireless_handlers;
1325 /* Instance data managed by the core of Wireless Extensions. */
1326 struct iw_public_data * wireless_data; 1495 struct iw_public_data * wireless_data;
1327#endif 1496#endif
1328 /* Management operations */
1329 const struct net_device_ops *netdev_ops; 1497 const struct net_device_ops *netdev_ops;
1330 const struct ethtool_ops *ethtool_ops; 1498 const struct ethtool_ops *ethtool_ops;
1331 const struct forwarding_accel_ops *fwd_ops; 1499 const struct forwarding_accel_ops *fwd_ops;
1332 1500
1333 /* Hardware header description */
1334 const struct header_ops *header_ops; 1501 const struct header_ops *header_ops;
1335 1502
1336 unsigned int flags; /* interface flags (a la BSD) */ 1503 unsigned int flags;
1337 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. 1504 unsigned int priv_flags;
1338 * See if.h for definitions. */ 1505
1339 unsigned short gflags; 1506 unsigned short gflags;
1340 unsigned short padded; /* How much padding added by alloc_netdev() */ 1507 unsigned short padded;
1341 1508
1342 unsigned char operstate; /* RFC2863 operstate */ 1509 unsigned char operstate;
1343 unsigned char link_mode; /* mapping policy to operstate */ 1510 unsigned char link_mode;
1344 1511
1345 unsigned char if_port; /* Selectable AUI, TP,..*/ 1512 unsigned char if_port;
1346 unsigned char dma; /* DMA channel */ 1513 unsigned char dma;
1347 1514
1348 unsigned int mtu; /* interface MTU value */ 1515 unsigned int mtu;
1349 unsigned short type; /* interface hardware type */ 1516 unsigned short type;
1350 unsigned short hard_header_len; /* hardware hdr length */ 1517 unsigned short hard_header_len;
1351 1518
1352 /* extra head- and tailroom the hardware may need, but not in all cases
1353 * can this be guaranteed, especially tailroom. Some cases also use
1354 * LL_MAX_HEADER instead to allocate the skb.
1355 */
1356 unsigned short needed_headroom; 1519 unsigned short needed_headroom;
1357 unsigned short needed_tailroom; 1520 unsigned short needed_tailroom;
1358 1521
1359 /* Interface address info. */ 1522 /* Interface address info. */
1360 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1523 unsigned char perm_addr[MAX_ADDR_LEN];
1361 unsigned char addr_assign_type; /* hw address assignment type */ 1524 unsigned char addr_assign_type;
1362 unsigned char addr_len; /* hardware address length */ 1525 unsigned char addr_len;
1363 unsigned short neigh_priv_len; 1526 unsigned short neigh_priv_len;
1364 unsigned short dev_id; /* Used to differentiate devices 1527 unsigned short dev_id;
1365 * that share the same link 1528 unsigned short dev_port;
1366 * layer address
1367 */
1368 unsigned short dev_port; /* Used to differentiate
1369 * devices that share the same
1370 * function
1371 */
1372 spinlock_t addr_list_lock; 1529 spinlock_t addr_list_lock;
1373 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1530 struct netdev_hw_addr_list uc;
1374 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1531 struct netdev_hw_addr_list mc;
1375 struct netdev_hw_addr_list dev_addrs; /* list of device 1532 struct netdev_hw_addr_list dev_addrs;
1376 * hw addresses 1533
1377 */
1378#ifdef CONFIG_SYSFS 1534#ifdef CONFIG_SYSFS
1379 struct kset *queues_kset; 1535 struct kset *queues_kset;
1380#endif 1536#endif
1381 1537
1538 unsigned char name_assign_type;
1539
1382 bool uc_promisc; 1540 bool uc_promisc;
1383 unsigned int promiscuity; 1541 unsigned int promiscuity;
1384 unsigned int allmulti; 1542 unsigned int allmulti;
@@ -1387,40 +1545,34 @@ struct net_device {
1387 /* Protocol specific pointers */ 1545 /* Protocol specific pointers */
1388 1546
1389#if IS_ENABLED(CONFIG_VLAN_8021Q) 1547#if IS_ENABLED(CONFIG_VLAN_8021Q)
1390 struct vlan_info __rcu *vlan_info; /* VLAN info */ 1548 struct vlan_info __rcu *vlan_info;
1391#endif 1549#endif
1392#if IS_ENABLED(CONFIG_NET_DSA) 1550#if IS_ENABLED(CONFIG_NET_DSA)
1393 struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ 1551 struct dsa_switch_tree *dsa_ptr;
1394#endif 1552#endif
1395#if IS_ENABLED(CONFIG_TIPC) 1553#if IS_ENABLED(CONFIG_TIPC)
1396 struct tipc_bearer __rcu *tipc_ptr; /* TIPC specific data */ 1554 struct tipc_bearer __rcu *tipc_ptr;
1397#endif 1555#endif
1398 void *atalk_ptr; /* AppleTalk link */ 1556 void *atalk_ptr;
1399 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1557 struct in_device __rcu *ip_ptr;
1400 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1558 struct dn_dev __rcu *dn_ptr;
1401 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1559 struct inet6_dev __rcu *ip6_ptr;
1402 void *ax25_ptr; /* AX.25 specific data */ 1560 void *ax25_ptr;
1403 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1561 struct wireless_dev *ieee80211_ptr;
1404 assign before registering */
1405 1562
1406/* 1563/*
1407 * Cache lines mostly used on receive path (including eth_type_trans()) 1564 * Cache lines mostly used on receive path (including eth_type_trans())
1408 */ 1565 */
1409 unsigned long last_rx; /* Time of last Rx */ 1566 unsigned long last_rx;
1410 1567
1411 /* Interface address info used in eth_type_trans() */ 1568 /* Interface address info used in eth_type_trans() */
1412 unsigned char *dev_addr; /* hw address, (before bcast 1569 unsigned char *dev_addr;
1413 because most packets are
1414 unicast) */
1415 1570
1416 1571
1417#ifdef CONFIG_SYSFS 1572#ifdef CONFIG_SYSFS
1418 struct netdev_rx_queue *_rx; 1573 struct netdev_rx_queue *_rx;
1419 1574
1420 /* Number of RX queues allocated at register_netdev() time */
1421 unsigned int num_rx_queues; 1575 unsigned int num_rx_queues;
1422
1423 /* Number of RX queues currently active in device */
1424 unsigned int real_num_rx_queues; 1576 unsigned int real_num_rx_queues;
1425 1577
1426#endif 1578#endif
@@ -1429,33 +1581,23 @@ struct net_device {
1429 void __rcu *rx_handler_data; 1581 void __rcu *rx_handler_data;
1430 1582
1431 struct netdev_queue __rcu *ingress_queue; 1583 struct netdev_queue __rcu *ingress_queue;
1432 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1584 unsigned char broadcast[MAX_ADDR_LEN];
1433 1585
1434 1586
1435/* 1587/*
1436 * Cache lines mostly used on transmit path 1588 * Cache lines mostly used on transmit path
1437 */ 1589 */
1438 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 1590 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
1439
1440 /* Number of TX queues allocated at alloc_netdev_mq() time */
1441 unsigned int num_tx_queues; 1591 unsigned int num_tx_queues;
1442
1443 /* Number of TX queues currently active in device */
1444 unsigned int real_num_tx_queues; 1592 unsigned int real_num_tx_queues;
1445
1446 /* root qdisc from userspace point of view */
1447 struct Qdisc *qdisc; 1593 struct Qdisc *qdisc;
1448 1594 unsigned long tx_queue_len;
1449 unsigned long tx_queue_len; /* Max frames per queue allowed */
1450 spinlock_t tx_global_lock; 1595 spinlock_t tx_global_lock;
1451 1596
1452#ifdef CONFIG_XPS 1597#ifdef CONFIG_XPS
1453 struct xps_dev_maps __rcu *xps_maps; 1598 struct xps_dev_maps __rcu *xps_maps;
1454#endif 1599#endif
1455#ifdef CONFIG_RFS_ACCEL 1600#ifdef CONFIG_RFS_ACCEL
1456 /* CPU reverse-mapping for RX completion interrupts, indexed
1457 * by RX queue number. Assigned by driver. This must only be
1458 * set if the ndo_rx_flow_steer operation is defined. */
1459 struct cpu_rmap *rx_cpu_rmap; 1601 struct cpu_rmap *rx_cpu_rmap;
1460#endif 1602#endif
1461 1603
@@ -1465,22 +1607,17 @@ struct net_device {
1465 * trans_start here is expensive for high speed devices on SMP, 1607 * trans_start here is expensive for high speed devices on SMP,
1466 * please use netdev_queue->trans_start instead. 1608 * please use netdev_queue->trans_start instead.
1467 */ 1609 */
1468 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 1610 unsigned long trans_start;
1469 1611
1470 int watchdog_timeo; /* used by dev_watchdog() */ 1612 int watchdog_timeo;
1471 struct timer_list watchdog_timer; 1613 struct timer_list watchdog_timer;
1472 1614
1473 /* Number of references to this device */
1474 int __percpu *pcpu_refcnt; 1615 int __percpu *pcpu_refcnt;
1475
1476 /* delayed register/unregister */
1477 struct list_head todo_list; 1616 struct list_head todo_list;
1478 /* device index hash chain */
1479 struct hlist_node index_hlist;
1480 1617
1618 struct hlist_node index_hlist;
1481 struct list_head link_watch_list; 1619 struct list_head link_watch_list;
1482 1620
1483 /* register/unregister state machine */
1484 enum { NETREG_UNINITIALIZED=0, 1621 enum { NETREG_UNINITIALIZED=0,
1485 NETREG_REGISTERED, /* completed register_netdevice */ 1622 NETREG_REGISTERED, /* completed register_netdevice */
1486 NETREG_UNREGISTERING, /* called unregister_netdevice */ 1623 NETREG_UNREGISTERING, /* called unregister_netdevice */
@@ -1489,14 +1626,13 @@ struct net_device {
1489 NETREG_DUMMY, /* dummy device for NAPI poll */ 1626 NETREG_DUMMY, /* dummy device for NAPI poll */
1490 } reg_state:8; 1627 } reg_state:8;
1491 1628
1492 bool dismantle; /* device is going do be freed */ 1629 bool dismantle;
1493 1630
1494 enum { 1631 enum {
1495 RTNL_LINK_INITIALIZED, 1632 RTNL_LINK_INITIALIZED,
1496 RTNL_LINK_INITIALIZING, 1633 RTNL_LINK_INITIALIZING,
1497 } rtnl_link_state:16; 1634 } rtnl_link_state:16;
1498 1635
1499 /* Called from unregister, can be used to call free_netdev */
1500 void (*destructor)(struct net_device *dev); 1636 void (*destructor)(struct net_device *dev);
1501 1637
1502#ifdef CONFIG_NETPOLL 1638#ifdef CONFIG_NETPOLL
@@ -1504,31 +1640,25 @@ struct net_device {
1504#endif 1640#endif
1505 1641
1506#ifdef CONFIG_NET_NS 1642#ifdef CONFIG_NET_NS
1507 /* Network namespace this network device is inside */
1508 struct net *nd_net; 1643 struct net *nd_net;
1509#endif 1644#endif
1510 1645
1511 /* mid-layer private */ 1646 /* mid-layer private */
1512 union { 1647 union {
1513 void *ml_priv; 1648 void *ml_priv;
1514 struct pcpu_lstats __percpu *lstats; /* loopback stats */ 1649 struct pcpu_lstats __percpu *lstats;
1515 struct pcpu_sw_netstats __percpu *tstats; 1650 struct pcpu_sw_netstats __percpu *tstats;
1516 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1651 struct pcpu_dstats __percpu *dstats;
1517 struct pcpu_vstats __percpu *vstats; /* veth stats */ 1652 struct pcpu_vstats __percpu *vstats;
1518 }; 1653 };
1519 /* GARP */ 1654
1520 struct garp_port __rcu *garp_port; 1655 struct garp_port __rcu *garp_port;
1521 /* MRP */
1522 struct mrp_port __rcu *mrp_port; 1656 struct mrp_port __rcu *mrp_port;
1523 1657
1524 /* class/net/name entry */ 1658 struct device dev;
1525 struct device dev;
1526 /* space for optional device, statistics, and wireless sysfs groups */
1527 const struct attribute_group *sysfs_groups[4]; 1659 const struct attribute_group *sysfs_groups[4];
1528 /* space for optional per-rx queue attributes */
1529 const struct attribute_group *sysfs_rx_queue_group; 1660 const struct attribute_group *sysfs_rx_queue_group;
1530 1661
1531 /* rtnetlink link ops */
1532 const struct rtnl_link_ops *rtnl_link_ops; 1662 const struct rtnl_link_ops *rtnl_link_ops;
1533 1663
1534 /* for setting kernel sock attribute on TCP connection setup */ 1664 /* for setting kernel sock attribute on TCP connection setup */
@@ -1538,7 +1668,6 @@ struct net_device {
1538 u16 gso_max_segs; 1668 u16 gso_max_segs;
1539 1669
1540#ifdef CONFIG_DCB 1670#ifdef CONFIG_DCB
1541 /* Data Center Bridging netlink ops */
1542 const struct dcbnl_rtnl_ops *dcbnl_ops; 1671 const struct dcbnl_rtnl_ops *dcbnl_ops;
1543#endif 1672#endif
1544 u8 num_tc; 1673 u8 num_tc;
@@ -1546,20 +1675,14 @@ struct net_device {
1546 u8 prio_tc_map[TC_BITMASK + 1]; 1675 u8 prio_tc_map[TC_BITMASK + 1];
1547 1676
1548#if IS_ENABLED(CONFIG_FCOE) 1677#if IS_ENABLED(CONFIG_FCOE)
1549 /* max exchange id for FCoE LRO by ddp */
1550 unsigned int fcoe_ddp_xid; 1678 unsigned int fcoe_ddp_xid;
1551#endif 1679#endif
1552#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) 1680#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
1553 struct netprio_map __rcu *priomap; 1681 struct netprio_map __rcu *priomap;
1554#endif 1682#endif
1555 /* phy device may attach itself for hardware timestamping */
1556 struct phy_device *phydev; 1683 struct phy_device *phydev;
1557
1558 struct lock_class_key *qdisc_tx_busylock; 1684 struct lock_class_key *qdisc_tx_busylock;
1559
1560 /* group the device belongs to */
1561 int group; 1685 int group;
1562
1563 struct pm_qos_request pm_qos_req; 1686 struct pm_qos_request pm_qos_req;
1564}; 1687};
1565#define to_net_dev(d) container_of(d, struct net_device, dev) 1688#define to_net_dev(d) container_of(d, struct net_device, dev)
@@ -2486,7 +2609,7 @@ static inline int netif_set_xps_queue(struct net_device *dev,
2486 * as a distribution range limit for the returned value. 2609 * as a distribution range limit for the returned value.
2487 */ 2610 */
2488static inline u16 skb_tx_hash(const struct net_device *dev, 2611static inline u16 skb_tx_hash(const struct net_device *dev,
2489 const struct sk_buff *skb) 2612 struct sk_buff *skb)
2490{ 2613{
2491 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); 2614 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues);
2492} 2615}
@@ -2987,13 +3110,15 @@ void ether_setup(struct net_device *dev);
2987 3110
2988/* Support for loadable net-drivers */ 3111/* Support for loadable net-drivers */
2989struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 3112struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
3113 unsigned char name_assign_type,
2990 void (*setup)(struct net_device *), 3114 void (*setup)(struct net_device *),
2991 unsigned int txqs, unsigned int rxqs); 3115 unsigned int txqs, unsigned int rxqs);
2992#define alloc_netdev(sizeof_priv, name, setup) \ 3116#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
2993 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 3117 alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
2994 3118
2995#define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 3119#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \
2996 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 3120 alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \
3121 count)
2997 3122
2998int register_netdev(struct net_device *dev); 3123int register_netdev(struct net_device *dev);
2999void unregister_netdev(struct net_device *dev); 3124void unregister_netdev(struct net_device *dev);
@@ -3377,11 +3502,26 @@ extern struct pernet_operations __net_initdata loopback_net_ops;
3377 3502
3378static inline const char *netdev_name(const struct net_device *dev) 3503static inline const char *netdev_name(const struct net_device *dev)
3379{ 3504{
3380 if (dev->reg_state != NETREG_REGISTERED) 3505 if (!dev->name[0] || strchr(dev->name, '%'))
3381 return "(unregistered net_device)"; 3506 return "(unnamed net_device)";
3382 return dev->name; 3507 return dev->name;
3383} 3508}
3384 3509
3510static inline const char *netdev_reg_state(const struct net_device *dev)
3511{
3512 switch (dev->reg_state) {
3513 case NETREG_UNINITIALIZED: return " (uninitialized)";
3514 case NETREG_REGISTERED: return "";
3515 case NETREG_UNREGISTERING: return " (unregistering)";
3516 case NETREG_UNREGISTERED: return " (unregistered)";
3517 case NETREG_RELEASED: return " (released)";
3518 case NETREG_DUMMY: return " (dummy)";
3519 }
3520
3521 WARN_ONCE(1, "%s: unknown reg_state %d\n", dev->name, dev->reg_state);
3522 return " (unknown)";
3523}
3524
3385__printf(3, 4) 3525__printf(3, 4)
3386int netdev_printk(const char *level, const struct net_device *dev, 3526int netdev_printk(const char *level, const struct net_device *dev,
3387 const char *format, ...); 3527 const char *format, ...);
@@ -3438,7 +3578,8 @@ do { \
3438 * file/line information and a backtrace. 3578 * file/line information and a backtrace.
3439 */ 3579 */
3440#define netdev_WARN(dev, format, args...) \ 3580#define netdev_WARN(dev, format, args...) \
3441 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args) 3581 WARN(1, "netdevice: %s%s\n" format, netdev_name(dev), \
3582 netdev_reg_state(dev), ##args)
3442 3583
3443/* netif printk helpers, similar to netdev_printk */ 3584/* netif printk helpers, similar to netdev_printk */
3444 3585
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e30f6059ecd6..5180a7ededec 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -52,6 +52,7 @@ struct nfs_access_entry {
52 unsigned long jiffies; 52 unsigned long jiffies;
53 struct rpc_cred * cred; 53 struct rpc_cred * cred;
54 int mask; 54 int mask;
55 struct rcu_head rcu_head;
55}; 56};
56 57
57struct nfs_lockowner { 58struct nfs_lockowner {
@@ -352,6 +353,7 @@ extern int nfs_release(struct inode *, struct file *);
352extern int nfs_attribute_timeout(struct inode *inode); 353extern int nfs_attribute_timeout(struct inode *inode);
353extern int nfs_attribute_cache_expired(struct inode *inode); 354extern int nfs_attribute_cache_expired(struct inode *inode);
354extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 355extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
356extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode);
355extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 357extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
356extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 358extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
357extern int nfs_setattr(struct dentry *, struct iattr *); 359extern int nfs_setattr(struct dentry *, struct iattr *);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 1150ea41b626..922be2e050f5 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -45,6 +45,7 @@ struct nfs_client {
45 struct sockaddr_storage cl_addr; /* server identifier */ 45 struct sockaddr_storage cl_addr; /* server identifier */
46 size_t cl_addrlen; 46 size_t cl_addrlen;
47 char * cl_hostname; /* hostname of server */ 47 char * cl_hostname; /* hostname of server */
48 char * cl_acceptor; /* GSSAPI acceptor name */
48 struct list_head cl_share_link; /* link in global client list */ 49 struct list_head cl_share_link; /* link in global client list */
49 struct list_head cl_superblocks; /* List of nfs_server structs */ 50 struct list_head cl_superblocks; /* List of nfs_server structs */
50 51
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 7d9096d95d4a..6ad2bbcad405 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -26,7 +26,7 @@ enum {
26 PG_MAPPED, /* page private set for buffered io */ 26 PG_MAPPED, /* page private set for buffered io */
27 PG_CLEAN, /* write succeeded */ 27 PG_CLEAN, /* write succeeded */
28 PG_COMMIT_TO_DS, /* used by pnfs layouts */ 28 PG_COMMIT_TO_DS, /* used by pnfs layouts */
29 PG_INODE_REF, /* extra ref held by inode (head req only) */ 29 PG_INODE_REF, /* extra ref held by inode when in writeback */
30 PG_HEADLOCK, /* page group lock of wb_head */ 30 PG_HEADLOCK, /* page group lock of wb_head */
31 PG_TEARDOWN, /* page group sync for destroy */ 31 PG_TEARDOWN, /* page group sync for destroy */
32 PG_UNLOCKPAGE, /* page group sync bit in read path */ 32 PG_UNLOCKPAGE, /* page group sync bit in read path */
@@ -62,12 +62,13 @@ struct nfs_pageio_ops {
62 62
63struct nfs_rw_ops { 63struct nfs_rw_ops {
64 const fmode_t rw_mode; 64 const fmode_t rw_mode;
65 struct nfs_rw_header *(*rw_alloc_header)(void); 65 struct nfs_pgio_header *(*rw_alloc_header)(void);
66 void (*rw_free_header)(struct nfs_rw_header *); 66 void (*rw_free_header)(struct nfs_pgio_header *);
67 void (*rw_release)(struct nfs_pgio_data *); 67 void (*rw_release)(struct nfs_pgio_header *);
68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_data *, struct inode *); 68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *,
69 void (*rw_result)(struct rpc_task *, struct nfs_pgio_data *); 69 struct inode *);
70 void (*rw_initiate)(struct nfs_pgio_data *, struct rpc_message *, 70 void (*rw_result)(struct rpc_task *, struct nfs_pgio_header *);
71 void (*rw_initiate)(struct nfs_pgio_header *, struct rpc_message *,
71 struct rpc_task_setup *, int); 72 struct rpc_task_setup *, int);
72}; 73};
73 74
@@ -111,6 +112,8 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
111 int how); 112 int how);
112extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 113extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
113 struct nfs_page *); 114 struct nfs_page *);
115extern int nfs_pageio_resend(struct nfs_pageio_descriptor *,
116 struct nfs_pgio_header *);
114extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); 117extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
115extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 118extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
116extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, 119extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
@@ -119,7 +122,7 @@ extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
119extern int nfs_wait_on_request(struct nfs_page *); 122extern int nfs_wait_on_request(struct nfs_page *);
120extern void nfs_unlock_request(struct nfs_page *req); 123extern void nfs_unlock_request(struct nfs_page *req);
121extern void nfs_unlock_and_release_request(struct nfs_page *); 124extern void nfs_unlock_and_release_request(struct nfs_page *);
122extern void nfs_page_group_lock(struct nfs_page *); 125extern int nfs_page_group_lock(struct nfs_page *, bool);
123extern void nfs_page_group_unlock(struct nfs_page *); 126extern void nfs_page_group_unlock(struct nfs_page *);
124extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); 127extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
125 128
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9a1396e70310..0040629894df 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -993,6 +993,7 @@ struct nfs4_setclientid {
993 unsigned int sc_uaddr_len; 993 unsigned int sc_uaddr_len;
994 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1]; 994 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
995 u32 sc_cb_ident; 995 u32 sc_cb_ident;
996 struct rpc_cred *sc_cred;
996}; 997};
997 998
998struct nfs4_setclientid_res { 999struct nfs4_setclientid_res {
@@ -1253,18 +1254,12 @@ enum {
1253 NFS_IOHDR_ERROR = 0, 1254 NFS_IOHDR_ERROR = 0,
1254 NFS_IOHDR_EOF, 1255 NFS_IOHDR_EOF,
1255 NFS_IOHDR_REDO, 1256 NFS_IOHDR_REDO,
1256 NFS_IOHDR_NEED_COMMIT,
1257 NFS_IOHDR_NEED_RESCHED,
1258}; 1257};
1259 1258
1260struct nfs_pgio_data;
1261
1262struct nfs_pgio_header { 1259struct nfs_pgio_header {
1263 struct inode *inode; 1260 struct inode *inode;
1264 struct rpc_cred *cred; 1261 struct rpc_cred *cred;
1265 struct list_head pages; 1262 struct list_head pages;
1266 struct nfs_pgio_data *data;
1267 atomic_t refcnt;
1268 struct nfs_page *req; 1263 struct nfs_page *req;
1269 struct nfs_writeverf verf; /* Used for writes */ 1264 struct nfs_writeverf verf; /* Used for writes */
1270 struct pnfs_layout_segment *lseg; 1265 struct pnfs_layout_segment *lseg;
@@ -1281,28 +1276,22 @@ struct nfs_pgio_header {
1281 int error; /* merge with pnfs_error */ 1276 int error; /* merge with pnfs_error */
1282 unsigned long good_bytes; /* boundary of good data */ 1277 unsigned long good_bytes; /* boundary of good data */
1283 unsigned long flags; 1278 unsigned long flags;
1284};
1285 1279
1286struct nfs_pgio_data { 1280 /*
1287 struct nfs_pgio_header *header; 1281 * rpc data
1282 */
1288 struct rpc_task task; 1283 struct rpc_task task;
1289 struct nfs_fattr fattr; 1284 struct nfs_fattr fattr;
1290 struct nfs_writeverf verf; /* Used for writes */
1291 struct nfs_pgio_args args; /* argument struct */ 1285 struct nfs_pgio_args args; /* argument struct */
1292 struct nfs_pgio_res res; /* result struct */ 1286 struct nfs_pgio_res res; /* result struct */
1293 unsigned long timestamp; /* For lease renewal */ 1287 unsigned long timestamp; /* For lease renewal */
1294 int (*pgio_done_cb) (struct rpc_task *task, struct nfs_pgio_data *data); 1288 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1295 __u64 mds_offset; /* Filelayout dense stripe */ 1289 __u64 mds_offset; /* Filelayout dense stripe */
1296 struct nfs_page_array pages; 1290 struct nfs_page_array page_array;
1297 struct nfs_client *ds_clp; /* pNFS data server */ 1291 struct nfs_client *ds_clp; /* pNFS data server */
1298 int ds_idx; /* ds index if ds_clp is set */ 1292 int ds_idx; /* ds index if ds_clp is set */
1299}; 1293};
1300 1294
1301struct nfs_rw_header {
1302 struct nfs_pgio_header header;
1303 struct nfs_pgio_data rpc_data;
1304};
1305
1306struct nfs_mds_commit_info { 1295struct nfs_mds_commit_info {
1307 atomic_t rpcs_out; 1296 atomic_t rpcs_out;
1308 unsigned long ncommit; 1297 unsigned long ncommit;
@@ -1432,11 +1421,12 @@ struct nfs_rpc_ops {
1432 struct nfs_pathconf *); 1421 struct nfs_pathconf *);
1433 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1422 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1434 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1423 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1435 int (*pgio_rpc_prepare)(struct rpc_task *, struct nfs_pgio_data *); 1424 int (*pgio_rpc_prepare)(struct rpc_task *,
1436 void (*read_setup) (struct nfs_pgio_data *, struct rpc_message *); 1425 struct nfs_pgio_header *);
1437 int (*read_done) (struct rpc_task *, struct nfs_pgio_data *); 1426 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1438 void (*write_setup) (struct nfs_pgio_data *, struct rpc_message *); 1427 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1439 int (*write_done) (struct rpc_task *, struct nfs_pgio_data *); 1428 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *);
1429 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1440 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1430 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1441 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1431 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1442 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *); 1432 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 447775ee2c4b..1d2a6ab6b8bb 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -63,4 +63,8 @@ extern int proc_dowatchdog(struct ctl_table *, int ,
63 void __user *, size_t *, loff_t *); 63 void __user *, size_t *, loff_t *);
64#endif 64#endif
65 65
66#ifdef CONFIG_HAVE_ACPI_APEI_NMI
67#include <asm/nmi.h>
68#endif
69
66#endif 70#endif
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 58b9a02c38d2..83a6aeda899d 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -430,7 +430,15 @@ static inline int num_node_state(enum node_states state)
430 for_each_node_mask((__node), node_states[__state]) 430 for_each_node_mask((__node), node_states[__state])
431 431
432#define first_online_node first_node(node_states[N_ONLINE]) 432#define first_online_node first_node(node_states[N_ONLINE])
433#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 433#define first_memory_node first_node(node_states[N_MEMORY])
434static inline int next_online_node(int nid)
435{
436 return next_node(nid, node_states[N_ONLINE]);
437}
438static inline int next_memory_node(int nid)
439{
440 return next_node(nid, node_states[N_MEMORY]);
441}
434 442
435extern int nr_node_ids; 443extern int nr_node_ids;
436extern int nr_online_nodes; 444extern int nr_online_nodes;
@@ -471,6 +479,7 @@ static inline int num_node_state(enum node_states state)
471 for ( (node) = 0; (node) == 0; (node) = 1) 479 for ( (node) = 0; (node) == 0; (node) = 1)
472 480
473#define first_online_node 0 481#define first_online_node 0
482#define first_memory_node 0
474#define next_online_node(nid) (MAX_NUMNODES) 483#define next_online_node(nid) (MAX_NUMNODES)
475#define nr_node_ids 1 484#define nr_node_ids 1
476#define nr_online_nodes 1 485#define nr_online_nodes 1
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index b4ec59d159ac..35fa08fd7739 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -40,32 +40,28 @@ extern struct nsproxy init_nsproxy;
40 * the namespaces access rules are: 40 * the namespaces access rules are:
41 * 41 *
42 * 1. only current task is allowed to change tsk->nsproxy pointer or 42 * 1. only current task is allowed to change tsk->nsproxy pointer or
43 * any pointer on the nsproxy itself 43 * any pointer on the nsproxy itself. Current must hold the task_lock
44 * when changing tsk->nsproxy.
44 * 45 *
45 * 2. when accessing (i.e. reading) current task's namespaces - no 46 * 2. when accessing (i.e. reading) current task's namespaces - no
46 * precautions should be taken - just dereference the pointers 47 * precautions should be taken - just dereference the pointers
47 * 48 *
48 * 3. the access to other task namespaces is performed like this 49 * 3. the access to other task namespaces is performed like this
49 * rcu_read_lock(); 50 * task_lock(task);
50 * nsproxy = task_nsproxy(tsk); 51 * nsproxy = task->nsproxy;
51 * if (nsproxy != NULL) { 52 * if (nsproxy != NULL) {
52 * / * 53 * / *
53 * * work with the namespaces here 54 * * work with the namespaces here
54 * * e.g. get the reference on one of them 55 * * e.g. get the reference on one of them
55 * * / 56 * * /
56 * } / * 57 * } / *
57 * * NULL task_nsproxy() means that this task is 58 * * NULL task->nsproxy means that this task is
58 * * almost dead (zombie) 59 * * almost dead (zombie)
59 * * / 60 * * /
60 * rcu_read_unlock(); 61 * task_unlock(task);
61 * 62 *
62 */ 63 */
63 64
64static inline struct nsproxy *task_nsproxy(struct task_struct *tsk)
65{
66 return rcu_dereference(tsk->nsproxy);
67}
68
69int copy_namespaces(unsigned long flags, struct task_struct *tsk); 65int copy_namespaces(unsigned long flags, struct task_struct *tsk);
70void exit_task_namespaces(struct task_struct *tsk); 66void exit_task_namespaces(struct task_struct *tsk);
71void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); 67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
diff --git a/include/linux/of.h b/include/linux/of.h
index 196b34c1ef4e..6c4363b8ddc3 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -74,8 +74,6 @@ struct of_phandle_args {
74 uint32_t args[MAX_PHANDLE_ARGS]; 74 uint32_t args[MAX_PHANDLE_ARGS];
75}; 75};
76 76
77extern int of_node_add(struct device_node *node);
78
79/* initialize a node */ 77/* initialize a node */
80extern struct kobj_type of_node_ktype; 78extern struct kobj_type of_node_ktype;
81static inline void of_node_init(struct device_node *node) 79static inline void of_node_init(struct device_node *node)
@@ -113,6 +111,7 @@ static inline void of_node_put(struct device_node *node) { }
113extern struct device_node *of_allnodes; 111extern struct device_node *of_allnodes;
114extern struct device_node *of_chosen; 112extern struct device_node *of_chosen;
115extern struct device_node *of_aliases; 113extern struct device_node *of_aliases;
114extern struct device_node *of_stdout;
116extern raw_spinlock_t devtree_lock; 115extern raw_spinlock_t devtree_lock;
117 116
118static inline bool of_have_populated_dt(void) 117static inline bool of_have_populated_dt(void)
@@ -204,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
204#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 203#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
205#define OF_DETACHED 2 /* node has been detached from the device tree */ 204#define OF_DETACHED 2 /* node has been detached from the device tree */
206#define OF_POPULATED 3 /* device already created for the node */ 205#define OF_POPULATED 3 /* device already created for the node */
206#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */
207 207
208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
@@ -322,6 +322,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop);
322struct of_prop_reconfig { 322struct of_prop_reconfig {
323 struct device_node *dn; 323 struct device_node *dn;
324 struct property *prop; 324 struct property *prop;
325 struct property *old_prop;
325}; 326};
326 327
327extern int of_reconfig_notifier_register(struct notifier_block *); 328extern int of_reconfig_notifier_register(struct notifier_block *);
@@ -352,7 +353,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
352 */ 353 */
353const char *of_prop_next_string(struct property *prop, const char *cur); 354const char *of_prop_next_string(struct property *prop, const char *cur);
354 355
355int of_device_is_stdout_path(struct device_node *dn); 356bool of_console_check(struct device_node *dn, char *name, int index);
356 357
357#else /* CONFIG_OF */ 358#else /* CONFIG_OF */
358 359
@@ -564,9 +565,9 @@ static inline int of_machine_is_compatible(const char *compat)
564 return 0; 565 return 0;
565} 566}
566 567
567static inline int of_device_is_stdout_path(struct device_node *dn) 568static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
568{ 569{
569 return 0; 570 return false;
570} 571}
571 572
572static inline const __be32 *of_prop_next_u32(struct property *prop, 573static inline const __be32 *of_prop_next_u32(struct property *prop,
@@ -786,4 +787,80 @@ typedef void (*of_init_fn_1)(struct device_node *);
786#define OF_DECLARE_2(table, name, compat, fn) \ 787#define OF_DECLARE_2(table, name, compat, fn) \
787 _OF_DECLARE(table, name, compat, fn, of_init_fn_2) 788 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
788 789
790/**
791 * struct of_changeset_entry - Holds a changeset entry
792 *
793 * @node: list_head for the log list
794 * @action: notifier action
795 * @np: pointer to the device node affected
796 * @prop: pointer to the property affected
797 * @old_prop: hold a pointer to the original property
798 *
799 * Every modification of the device tree during a changeset
800 * is held in a list of of_changeset_entry structures.
801 * That way we can recover from a partial application, or we can
802 * revert the changeset
803 */
804struct of_changeset_entry {
805 struct list_head node;
806 unsigned long action;
807 struct device_node *np;
808 struct property *prop;
809 struct property *old_prop;
810};
811
812/**
813 * struct of_changeset - changeset tracker structure
814 *
815 * @entries: list_head for the changeset entries
816 *
817 * changesets are a convenient way to apply bulk changes to the
818 * live tree. In case of an error, changes are rolled-back.
819 * changesets live on after initial application, and if not
820 * destroyed after use, they can be reverted in one single call.
821 */
822struct of_changeset {
823 struct list_head entries;
824};
825
826#ifdef CONFIG_OF_DYNAMIC
827extern void of_changeset_init(struct of_changeset *ocs);
828extern void of_changeset_destroy(struct of_changeset *ocs);
829extern int of_changeset_apply(struct of_changeset *ocs);
830extern int of_changeset_revert(struct of_changeset *ocs);
831extern int of_changeset_action(struct of_changeset *ocs,
832 unsigned long action, struct device_node *np,
833 struct property *prop);
834
835static inline int of_changeset_attach_node(struct of_changeset *ocs,
836 struct device_node *np)
837{
838 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
839}
840
841static inline int of_changeset_detach_node(struct of_changeset *ocs,
842 struct device_node *np)
843{
844 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
845}
846
847static inline int of_changeset_add_property(struct of_changeset *ocs,
848 struct device_node *np, struct property *prop)
849{
850 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
851}
852
853static inline int of_changeset_remove_property(struct of_changeset *ocs,
854 struct device_node *np, struct property *prop)
855{
856 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
857}
858
859static inline int of_changeset_update_property(struct of_changeset *ocs,
860 struct device_node *np, struct property *prop)
861{
862 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
863}
864#endif
865
789#endif /* _LINUX_OF_H */ 866#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index c13b8782a4eb..fb7b7221e063 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -109,7 +109,12 @@ static inline bool of_dma_is_coherent(struct device_node *np)
109extern int of_address_to_resource(struct device_node *dev, int index, 109extern int of_address_to_resource(struct device_node *dev, int index,
110 struct resource *r); 110 struct resource *r);
111void __iomem *of_iomap(struct device_node *node, int index); 111void __iomem *of_iomap(struct device_node *node, int index);
112void __iomem *of_io_request_and_map(struct device_node *device,
113 int index, char *name);
112#else 114#else
115
116#include <linux/io.h>
117
113static inline int of_address_to_resource(struct device_node *dev, int index, 118static inline int of_address_to_resource(struct device_node *dev, int index,
114 struct resource *r) 119 struct resource *r)
115{ 120{
@@ -120,6 +125,12 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
120{ 125{
121 return NULL; 126 return NULL;
122} 127}
128
129static inline void __iomem *of_io_request_and_map(struct device_node *device,
130 int index, char *name)
131{
132 return IOMEM_ERR_PTR(-EINVAL);
133}
123#endif 134#endif
124 135
125#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 136#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index ae36298ba076..56bc026c143f 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -41,6 +41,8 @@ extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
41 const char *name); 41 const char *name);
42extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, 42extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
43 struct of_dma *ofdma); 43 struct of_dma *ofdma);
44extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
45 struct of_dma *ofdma);
44#else 46#else
45static inline int of_dma_controller_register(struct device_node *np, 47static inline int of_dma_controller_register(struct device_node *np,
46 struct dma_chan *(*of_dma_xlate) 48 struct dma_chan *(*of_dma_xlate)
@@ -66,6 +68,8 @@ static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_s
66 return NULL; 68 return NULL;
67} 69}
68 70
71#define of_dma_xlate_by_chan_id NULL
72
69#endif 73#endif
70 74
71#endif /* __LINUX_OF_DMA_H */ 75#endif /* __LINUX_OF_DMA_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 05117899fcb4..0ff360d5b3b3 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -73,6 +73,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
73 int depth, void *data); 73 int depth, void *data);
74 74
75extern bool early_init_dt_scan(void *params); 75extern bool early_init_dt_scan(void *params);
76extern bool early_init_dt_verify(void *params);
77extern void early_init_dt_scan_nodes(void);
76 78
77extern const char *of_flat_dt_get_machine_name(void); 79extern const char *of_flat_dt_get_machine_name(void);
78extern const void *of_flat_dt_match_machine(const void *default_match, 80extern const void *of_flat_dt_match_machine(const void *default_match,
@@ -84,6 +86,7 @@ extern void unflatten_and_copy_device_tree(void);
84extern void early_init_devtree(void *); 86extern void early_init_devtree(void *);
85extern void early_get_first_memblock_info(void *, phys_addr_t *); 87extern void early_get_first_memblock_info(void *, phys_addr_t *);
86extern u64 fdt_translate_address(const void *blob, int node_offset); 88extern u64 fdt_translate_address(const void *blob, int node_offset);
89extern void of_fdt_limit_memory(int limit);
87#else /* CONFIG_OF_FLATTREE */ 90#else /* CONFIG_OF_FLATTREE */
88static inline void early_init_fdt_scan_reserved_mem(void) {} 91static inline void early_init_fdt_scan_reserved_mem(void) {}
89static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 92static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index d96e1badbee0..c2b0627a2317 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -72,7 +72,7 @@ extern int of_platform_populate(struct device_node *root,
72 const struct of_device_id *matches, 72 const struct of_device_id *matches,
73 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
74 struct device *parent); 74 struct device *parent);
75extern int of_platform_depopulate(struct device *parent); 75extern void of_platform_depopulate(struct device *parent);
76#else 76#else
77static inline int of_platform_populate(struct device_node *root, 77static inline int of_platform_populate(struct device_node *root,
78 const struct of_device_id *matches, 78 const struct of_device_id *matches,
@@ -81,10 +81,7 @@ static inline int of_platform_populate(struct device_node *root,
81{ 81{
82 return -ENODEV; 82 return -ENODEV;
83} 83}
84static inline int of_platform_depopulate(struct device *parent) 84static inline void of_platform_depopulate(struct device *parent) { }
85{
86 return -ENODEV;
87}
88#endif 85#endif
89 86
90#endif /* _LINUX_OF_PLATFORM_H */ 87#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 4669ddfdd5af..5b5efae09135 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -8,6 +8,7 @@ struct reserved_mem_ops;
8struct reserved_mem { 8struct reserved_mem {
9 const char *name; 9 const char *name;
10 unsigned long fdt_node; 10 unsigned long fdt_node;
11 unsigned long phandle;
11 const struct reserved_mem_ops *ops; 12 const struct reserved_mem_ops *ops;
12 phys_addr_t base; 13 phys_addr_t base;
13 phys_addr_t size; 14 phys_addr_t size;
@@ -27,10 +28,16 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
27 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) 28 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
28 29
29#ifdef CONFIG_OF_RESERVED_MEM 30#ifdef CONFIG_OF_RESERVED_MEM
31void of_reserved_mem_device_init(struct device *dev);
32void of_reserved_mem_device_release(struct device *dev);
33
30void fdt_init_reserved_mem(void); 34void fdt_init_reserved_mem(void);
31void fdt_reserved_mem_save_node(unsigned long node, const char *uname, 35void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
32 phys_addr_t base, phys_addr_t size); 36 phys_addr_t base, phys_addr_t size);
33#else 37#else
38static inline void of_reserved_mem_device_init(struct device *dev) { }
39static inline void of_reserved_mem_device_release(struct device *pdev) { }
40
34static inline void fdt_init_reserved_mem(void) { } 41static inline void fdt_init_reserved_mem(void) { }
35static inline void fdt_reserved_mem_save_node(unsigned long node, 42static inline void fdt_reserved_mem_save_node(unsigned long node,
36 const char *uname, phys_addr_t base, phys_addr_t size) { } 43 const char *uname, phys_addr_t base, phys_addr_t size) { }
diff --git a/include/linux/oid_registry.h b/include/linux/oid_registry.h
index 6926db724258..c2bbf672b84e 100644
--- a/include/linux/oid_registry.h
+++ b/include/linux/oid_registry.h
@@ -52,9 +52,15 @@ enum OID {
52 OID_md4, /* 1.2.840.113549.2.4 */ 52 OID_md4, /* 1.2.840.113549.2.4 */
53 OID_md5, /* 1.2.840.113549.2.5 */ 53 OID_md5, /* 1.2.840.113549.2.5 */
54 54
55 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */ 55 /* Microsoft Authenticode & Software Publishing */
56 OID_msIndirectData, /* 1.3.6.1.4.1.311.2.1.4 */
57 OID_msPeImageDataObjId, /* 1.3.6.1.4.1.311.2.1.15 */
58 OID_msIndividualSPKeyPurpose, /* 1.3.6.1.4.1.311.2.1.21 */
56 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */ 59 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */
60
61 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */
57 OID_sha1, /* 1.3.14.3.2.26 */ 62 OID_sha1, /* 1.3.14.3.2.26 */
63 OID_sha256, /* 2.16.840.1.101.3.4.2.1 */
58 64
59 /* Distinguished Name attribute IDs [RFC 2256] */ 65 /* Distinguished Name attribute IDs [RFC 2256] */
60 OID_commonName, /* 2.5.4.3 */ 66 OID_commonName, /* 2.5.4.3 */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 88e6ea4a5d36..6f06f8bc612c 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -130,6 +130,7 @@
130#define IS_WORD_16 BIT(0xd) 130#define IS_WORD_16 BIT(0xd)
131#define ENABLE_16XX_MODE BIT(0xe) 131#define ENABLE_16XX_MODE BIT(0xe)
132#define HS_CHANNELS_RESERVED BIT(0xf) 132#define HS_CHANNELS_RESERVED BIT(0xf)
133#define DMA_ENGINE_HANDLE_IRQ BIT(0x10)
133 134
134/* Defines for DMA Capabilities */ 135/* Defines for DMA Capabilities */
135#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18) 136#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
index cac78de09c07..c1aede46718b 100644
--- a/include/linux/omap-iommu.h
+++ b/include/linux/omap-iommu.h
@@ -10,41 +10,8 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#ifndef _INTEL_IOMMU_H_ 13#ifndef _OMAP_IOMMU_H_
14#define _INTEL_IOMMU_H_ 14#define _OMAP_IOMMU_H_
15
16struct iovm_struct {
17 struct omap_iommu *iommu; /* iommu object which this belongs to */
18 u32 da_start; /* area definition */
19 u32 da_end;
20 u32 flags; /* IOVMF_: see below */
21 struct list_head list; /* linked in ascending order */
22 const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */
23 void *va; /* mpu side mapped address */
24};
25
26#define MMU_RAM_ENDIAN_SHIFT 9
27#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
28#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT)
29#define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE
30#define MMU_RAM_ELSZ_SHIFT 7
31#define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8
32
33struct iommu_domain;
34
35extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
36extern u32
37omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
38 const struct sg_table *sgt, u32 flags);
39extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
40 struct device *dev, u32 da);
41extern u32
42omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
43 u32 da, size_t bytes, u32 flags);
44extern void
45omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
46 const u32 da);
47extern void *omap_da_to_va(struct device *dev, u32 da);
48 15
49extern void omap_iommu_save_ctx(struct device *dev); 16extern void omap_iommu_save_ctx(struct device *dev);
50extern void omap_iommu_restore_ctx(struct device *dev); 17extern void omap_iommu_restore_ctx(struct device *dev);
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 4cd62677feb9..647395a1a550 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -55,8 +55,8 @@ extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
55 struct mem_cgroup *memcg, nodemask_t *nodemask, 55 struct mem_cgroup *memcg, nodemask_t *nodemask,
56 const char *message); 56 const char *message);
57 57
58extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 58extern bool oom_zonelist_trylock(struct zonelist *zonelist, gfp_t gfp_flags);
59extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 59extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags);
60 60
61extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, 61extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
62 int order, const nodemask_t *nodemask); 62 int order, const nodemask_t *nodemask);
diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h
new file mode 100644
index 000000000000..90230d5811c5
--- /dev/null
+++ b/include/linux/osq_lock.h
@@ -0,0 +1,27 @@
1#ifndef __LINUX_OSQ_LOCK_H
2#define __LINUX_OSQ_LOCK_H
3
4/*
5 * An MCS like lock especially tailored for optimistic spinning for sleeping
6 * lock implementations (mutex, rwsem, etc).
7 */
8
9#define OSQ_UNLOCKED_VAL (0)
10
11struct optimistic_spin_queue {
12 /*
13 * Stores an encoded value of the CPU # of the tail node in the queue.
14 * If the queue is empty, then it's set to OSQ_UNLOCKED_VAL.
15 */
16 atomic_t tail;
17};
18
19/* Init macro and function. */
20#define OSQ_LOCK_UNLOCKED { ATOMIC_INIT(OSQ_UNLOCKED_VAL) }
21
22static inline void osq_lock_init(struct optimistic_spin_queue *lock)
23{
24 atomic_set(&lock->tail, OSQ_UNLOCKED_VAL);
25}
26
27#endif
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 8304959ad336..e1f5fcd79792 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -171,13 +171,12 @@ static inline int __TestClearPage##uname(struct page *page) \
171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname) 172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
173 173
174#define PAGEFLAG_FALSE(uname) \
175static inline int Page##uname(const struct page *page) \
176 { return 0; }
177
178#define TESTSCFLAG(uname, lname) \ 174#define TESTSCFLAG(uname, lname) \
179 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) 175 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
180 176
177#define TESTPAGEFLAG_FALSE(uname) \
178static inline int Page##uname(const struct page *page) { return 0; }
179
181#define SETPAGEFLAG_NOOP(uname) \ 180#define SETPAGEFLAG_NOOP(uname) \
182static inline void SetPage##uname(struct page *page) { } 181static inline void SetPage##uname(struct page *page) { }
183 182
@@ -187,12 +186,21 @@ static inline void ClearPage##uname(struct page *page) { }
187#define __CLEARPAGEFLAG_NOOP(uname) \ 186#define __CLEARPAGEFLAG_NOOP(uname) \
188static inline void __ClearPage##uname(struct page *page) { } 187static inline void __ClearPage##uname(struct page *page) { }
189 188
189#define TESTSETFLAG_FALSE(uname) \
190static inline int TestSetPage##uname(struct page *page) { return 0; }
191
190#define TESTCLEARFLAG_FALSE(uname) \ 192#define TESTCLEARFLAG_FALSE(uname) \
191static inline int TestClearPage##uname(struct page *page) { return 0; } 193static inline int TestClearPage##uname(struct page *page) { return 0; }
192 194
193#define __TESTCLEARFLAG_FALSE(uname) \ 195#define __TESTCLEARFLAG_FALSE(uname) \
194static inline int __TestClearPage##uname(struct page *page) { return 0; } 196static inline int __TestClearPage##uname(struct page *page) { return 0; }
195 197
198#define PAGEFLAG_FALSE(uname) TESTPAGEFLAG_FALSE(uname) \
199 SETPAGEFLAG_NOOP(uname) CLEARPAGEFLAG_NOOP(uname)
200
201#define TESTSCFLAG_FALSE(uname) \
202 TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
203
196struct page; /* forward declaration */ 204struct page; /* forward declaration */
197 205
198TESTPAGEFLAG(Locked, locked) 206TESTPAGEFLAG(Locked, locked)
@@ -248,7 +256,6 @@ PAGEFLAG_FALSE(HighMem)
248PAGEFLAG(SwapCache, swapcache) 256PAGEFLAG(SwapCache, swapcache)
249#else 257#else
250PAGEFLAG_FALSE(SwapCache) 258PAGEFLAG_FALSE(SwapCache)
251 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
252#endif 259#endif
253 260
254PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 261PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
@@ -258,8 +265,8 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
258PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 265PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
259 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) 266 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
260#else 267#else
261PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) 268PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked)
262 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) 269 TESTSCFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
263#endif 270#endif
264 271
265#ifdef CONFIG_ARCH_USES_PG_UNCACHED 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 777a524716db..5c831f1eca79 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -3,17 +3,15 @@
3 3
4enum { 4enum {
5 /* flags for mem_cgroup */ 5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ 6 PCG_USED = 0x01, /* This page is charged to a memcg */
7 PCG_USED, /* this object is in use. */ 7 PCG_MEM = 0x02, /* This page holds a memory charge */
8 PCG_MIGRATION, /* under page migration */ 8 PCG_MEMSW = 0x04, /* This page holds a memory+swap charge */
9 __NR_PCG_FLAGS,
10}; 9};
11 10
12#ifndef __GENERATING_BOUNDS_H 11struct pglist_data;
13#include <generated/bounds.h>
14 12
15#ifdef CONFIG_MEMCG 13#ifdef CONFIG_MEMCG
16#include <linux/bit_spinlock.h> 14struct mem_cgroup;
17 15
18/* 16/*
19 * Page Cgroup can be considered as an extended mem_map. 17 * Page Cgroup can be considered as an extended mem_map.
@@ -27,65 +25,30 @@ struct page_cgroup {
27 struct mem_cgroup *mem_cgroup; 25 struct mem_cgroup *mem_cgroup;
28}; 26};
29 27
30void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 28extern void pgdat_page_cgroup_init(struct pglist_data *pgdat);
31 29
32#ifdef CONFIG_SPARSEMEM 30#ifdef CONFIG_SPARSEMEM
33static inline void __init page_cgroup_init_flatmem(void) 31static inline void page_cgroup_init_flatmem(void)
34{ 32{
35} 33}
36extern void __init page_cgroup_init(void); 34extern void page_cgroup_init(void);
37#else 35#else
38void __init page_cgroup_init_flatmem(void); 36extern void page_cgroup_init_flatmem(void);
39static inline void __init page_cgroup_init(void) 37static inline void page_cgroup_init(void)
40{ 38{
41} 39}
42#endif 40#endif
43 41
44struct page_cgroup *lookup_page_cgroup(struct page *page); 42struct page_cgroup *lookup_page_cgroup(struct page *page);
45struct page *lookup_cgroup_page(struct page_cgroup *pc);
46
47#define TESTPCGFLAG(uname, lname) \
48static inline int PageCgroup##uname(struct page_cgroup *pc) \
49 { return test_bit(PCG_##lname, &pc->flags); }
50
51#define SETPCGFLAG(uname, lname) \
52static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
53 { set_bit(PCG_##lname, &pc->flags); }
54
55#define CLEARPCGFLAG(uname, lname) \
56static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
57 { clear_bit(PCG_##lname, &pc->flags); }
58
59#define TESTCLEARPCGFLAG(uname, lname) \
60static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
62
63TESTPCGFLAG(Used, USED)
64CLEARPCGFLAG(Used, USED)
65SETPCGFLAG(Used, USED)
66
67SETPCGFLAG(Migration, MIGRATION)
68CLEARPCGFLAG(Migration, MIGRATION)
69TESTPCGFLAG(Migration, MIGRATION)
70 43
71static inline void lock_page_cgroup(struct page_cgroup *pc) 44static inline int PageCgroupUsed(struct page_cgroup *pc)
72{ 45{
73 /* 46 return !!(pc->flags & PCG_USED);
74 * Don't take this lock in IRQ context.
75 * This lock is for pc->mem_cgroup, USED, MIGRATION
76 */
77 bit_spin_lock(PCG_LOCK, &pc->flags);
78} 47}
79 48#else /* !CONFIG_MEMCG */
80static inline void unlock_page_cgroup(struct page_cgroup *pc)
81{
82 bit_spin_unlock(PCG_LOCK, &pc->flags);
83}
84
85#else /* CONFIG_MEMCG */
86struct page_cgroup; 49struct page_cgroup;
87 50
88static inline void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat) 51static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat)
89{ 52{
90} 53}
91 54
@@ -98,10 +61,9 @@ static inline void page_cgroup_init(void)
98{ 61{
99} 62}
100 63
101static inline void __init page_cgroup_init_flatmem(void) 64static inline void page_cgroup_init_flatmem(void)
102{ 65{
103} 66}
104
105#endif /* CONFIG_MEMCG */ 67#endif /* CONFIG_MEMCG */
106 68
107#include <linux/swap.h> 69#include <linux/swap.h>
@@ -140,6 +102,4 @@ static inline void swap_cgroup_swapoff(int type)
140 102
141#endif /* CONFIG_MEMCG_SWAP */ 103#endif /* CONFIG_MEMCG_SWAP */
142 104
143#endif /* !__GENERATING_BOUNDS_H */
144
145#endif /* __LINUX_PAGE_CGROUP_H */ 105#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0a97b583ee8d..3df8c7db7a4e 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -399,6 +399,18 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
399} 399}
400 400
401/* 401/*
402 * Get the offset in PAGE_SIZE.
403 * (TODO: hugepage should have ->index in PAGE_SIZE)
404 */
405static inline pgoff_t page_to_pgoff(struct page *page)
406{
407 if (unlikely(PageHeadHuge(page)))
408 return page->index << compound_order(page);
409 else
410 return page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
411}
412
413/*
402 * Return byte-offset into filesystem object for page. 414 * Return byte-offset into filesystem object for page.
403 */ 415 */
404static inline loff_t page_offset(struct page *page) 416static inline loff_t page_offset(struct page *page)
@@ -472,6 +484,9 @@ static inline int lock_page_killable(struct page *page)
472/* 484/*
473 * lock_page_or_retry - Lock the page, unless this would block and the 485 * lock_page_or_retry - Lock the page, unless this would block and the
474 * caller indicated that it can handle a retry. 486 * caller indicated that it can handle a retry.
487 *
488 * Return value and mmap_sem implications depend on flags; see
489 * __lock_page_or_retry().
475 */ 490 */
476static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, 491static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
477 unsigned int flags) 492 unsigned int flags)
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 637a608ded0b..64dacb7288a6 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -11,12 +11,17 @@
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
14extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, 14extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev);
15 struct pci_bus *pci_bus); 15static inline acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev)
16extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev); 16{
17 return acpi_remove_pm_notifier(dev);
18}
17extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, 19extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
18 struct pci_dev *pci_dev); 20 struct pci_dev *pci_dev);
19extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev); 21static inline acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev)
22{
23 return acpi_remove_pm_notifier(dev);
24}
20extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); 25extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
21 26
22static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 27static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 466bcd111d85..61978a460841 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -978,6 +978,8 @@ int pci_try_reset_slot(struct pci_slot *slot);
978int pci_probe_reset_bus(struct pci_bus *bus); 978int pci_probe_reset_bus(struct pci_bus *bus);
979int pci_reset_bus(struct pci_bus *bus); 979int pci_reset_bus(struct pci_bus *bus);
980int pci_try_reset_bus(struct pci_bus *bus); 980int pci_try_reset_bus(struct pci_bus *bus);
981void pci_reset_secondary_bus(struct pci_dev *dev);
982void pcibios_reset_secondary_bus(struct pci_dev *dev);
981void pci_reset_bridge_secondary_bus(struct pci_dev *dev); 983void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
982void pci_update_resource(struct pci_dev *dev, int resno); 984void pci_update_resource(struct pci_dev *dev, int resno);
983int __must_check pci_assign_resource(struct pci_dev *dev, int i); 985int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -1186,7 +1188,6 @@ int pci_msix_vec_count(struct pci_dev *dev);
1186int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1188int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1187void pci_msix_shutdown(struct pci_dev *dev); 1189void pci_msix_shutdown(struct pci_dev *dev);
1188void pci_disable_msix(struct pci_dev *dev); 1190void pci_disable_msix(struct pci_dev *dev);
1189void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1190void pci_restore_msi_state(struct pci_dev *dev); 1191void pci_restore_msi_state(struct pci_dev *dev);
1191int pci_msi_enabled(void); 1192int pci_msi_enabled(void);
1192int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1193int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
@@ -1217,7 +1218,6 @@ static inline int pci_enable_msix(struct pci_dev *dev,
1217{ return -ENOSYS; } 1218{ return -ENOSYS; }
1218static inline void pci_msix_shutdown(struct pci_dev *dev) { } 1219static inline void pci_msix_shutdown(struct pci_dev *dev) { }
1219static inline void pci_disable_msix(struct pci_dev *dev) { } 1220static inline void pci_disable_msix(struct pci_dev *dev) { }
1220static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { }
1221static inline void pci_restore_msi_state(struct pci_dev *dev) { } 1221static inline void pci_restore_msi_state(struct pci_dev *dev) { }
1222static inline int pci_msi_enabled(void) { return 0; } 1222static inline int pci_msi_enabled(void) { return 0; }
1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, 1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,
@@ -1477,8 +1477,9 @@ enum pci_fixup_pass {
1477 pci_fixup_final, /* Final phase of device fixups */ 1477 pci_fixup_final, /* Final phase of device fixups */
1478 pci_fixup_enable, /* pci_enable_device() time */ 1478 pci_fixup_enable, /* pci_enable_device() time */
1479 pci_fixup_resume, /* pci_device_resume() */ 1479 pci_fixup_resume, /* pci_device_resume() */
1480 pci_fixup_suspend, /* pci_device_suspend */ 1480 pci_fixup_suspend, /* pci_device_suspend() */
1481 pci_fixup_resume_early, /* pci_device_resume_early() */ 1481 pci_fixup_resume_early, /* pci_device_resume_early() */
1482 pci_fixup_suspend_late, /* pci_device_suspend_late() */
1482}; 1483};
1483 1484
1484/* Anonymous variables would be nice... */ 1485/* Anonymous variables would be nice... */
@@ -1519,6 +1520,11 @@ enum pci_fixup_pass {
1519 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1520 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1520 suspend##hook, vendor, device, class, \ 1521 suspend##hook, vendor, device, class, \
1521 class_shift, hook) 1522 class_shift, hook)
1523#define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \
1524 class_shift, hook) \
1525 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \
1526 suspend_late##hook, vendor, device, \
1527 class, class_shift, hook)
1522 1528
1523#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1529#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1524 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1530 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
@@ -1544,6 +1550,10 @@ enum pci_fixup_pass {
1544 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1550 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1545 suspend##hook, vendor, device, \ 1551 suspend##hook, vendor, device, \
1546 PCI_ANY_ID, 0, hook) 1552 PCI_ANY_ID, 0, hook)
1553#define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \
1554 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \
1555 suspend_late##hook, vendor, device, \
1556 PCI_ANY_ID, 0, hook)
1547 1557
1548#ifdef CONFIG_PCI_QUIRKS 1558#ifdef CONFIG_PCI_QUIRKS
1549void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1559void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7fa31731c854..6ed0bb73a864 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -6,6 +6,8 @@
6 * Do not add new entries to this file unless the definitions 6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers. 7 * are shared between multiple drivers.
8 */ 8 */
9#ifndef _LINUX_PCI_IDS_H
10#define _LINUX_PCI_IDS_H
9 11
10/* Device classes and subclasses */ 12/* Device classes and subclasses */
11 13
@@ -2968,3 +2970,5 @@
2968#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 2970#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
2969 2971
2970#define PCI_VENDOR_ID_OCZ 0x1b85 2972#define PCI_VENDOR_ID_OCZ 0x1b85
2973
2974#endif /* _LINUX_PCI_IDS_H */
diff --git a/include/linux/pe.h b/include/linux/pe.h
new file mode 100644
index 000000000000..e170b95e763b
--- /dev/null
+++ b/include/linux/pe.h
@@ -0,0 +1,448 @@
1/*
2 * Copyright 2011 Red Hat, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
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, see <http://www.gnu.org/licenses/>.
16 *
17 * Author(s): Peter Jones <pjones@redhat.com>
18 */
19#ifndef __LINUX_PE_H
20#define __LINUX_PE_H
21
22#include <linux/types.h>
23
24#define MZ_MAGIC 0x5a4d /* "MZ" */
25
26struct mz_hdr {
27 uint16_t magic; /* MZ_MAGIC */
28 uint16_t lbsize; /* size of last used block */
29 uint16_t blocks; /* pages in file, 0x3 */
30 uint16_t relocs; /* relocations */
31 uint16_t hdrsize; /* header size in "paragraphs" */
32 uint16_t min_extra_pps; /* .bss */
33 uint16_t max_extra_pps; /* runtime limit for the arena size */
34 uint16_t ss; /* relative stack segment */
35 uint16_t sp; /* initial %sp register */
36 uint16_t checksum; /* word checksum */
37 uint16_t ip; /* initial %ip register */
38 uint16_t cs; /* initial %cs relative to load segment */
39 uint16_t reloc_table_offset; /* offset of the first relocation */
40 uint16_t overlay_num; /* overlay number. set to 0. */
41 uint16_t reserved0[4]; /* reserved */
42 uint16_t oem_id; /* oem identifier */
43 uint16_t oem_info; /* oem specific */
44 uint16_t reserved1[10]; /* reserved */
45 uint32_t peaddr; /* address of pe header */
46 char message[64]; /* message to print */
47};
48
49struct mz_reloc {
50 uint16_t offset;
51 uint16_t segment;
52};
53
54#define PE_MAGIC 0x00004550 /* "PE\0\0" */
55#define PE_OPT_MAGIC_PE32 0x010b
56#define PE_OPT_MAGIC_PE32_ROM 0x0107
57#define PE_OPT_MAGIC_PE32PLUS 0x020b
58
59/* machine type */
60#define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
61#define IMAGE_FILE_MACHINE_AM33 0x01d3
62#define IMAGE_FILE_MACHINE_AMD64 0x8664
63#define IMAGE_FILE_MACHINE_ARM 0x01c0
64#define IMAGE_FILE_MACHINE_ARMV7 0x01c4
65#define IMAGE_FILE_MACHINE_EBC 0x0ebc
66#define IMAGE_FILE_MACHINE_I386 0x014c
67#define IMAGE_FILE_MACHINE_IA64 0x0200
68#define IMAGE_FILE_MACHINE_M32R 0x9041
69#define IMAGE_FILE_MACHINE_MIPS16 0x0266
70#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
71#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
72#define IMAGE_FILE_MACHINE_POWERPC 0x01f0
73#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
74#define IMAGE_FILE_MACHINE_R4000 0x0166
75#define IMAGE_FILE_MACHINE_SH3 0x01a2
76#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
77#define IMAGE_FILE_MACHINE_SH3E 0x01a4
78#define IMAGE_FILE_MACHINE_SH4 0x01a6
79#define IMAGE_FILE_MACHINE_SH5 0x01a8
80#define IMAGE_FILE_MACHINE_THUMB 0x01c2
81#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
82
83/* flags */
84#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
85#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
86#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
87#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
88#define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010
89#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
90#define IMAGE_FILE_16BIT_MACHINE 0x0040
91#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
92#define IMAGE_FILE_32BIT_MACHINE 0x0100
93#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
94#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
95#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
96#define IMAGE_FILE_SYSTEM 0x1000
97#define IMAGE_FILE_DLL 0x2000
98#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
99#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
100
101struct pe_hdr {
102 uint32_t magic; /* PE magic */
103 uint16_t machine; /* machine type */
104 uint16_t sections; /* number of sections */
105 uint32_t timestamp; /* time_t */
106 uint32_t symbol_table; /* symbol table offset */
107 uint32_t symbols; /* number of symbols */
108 uint16_t opt_hdr_size; /* size of optional header */
109 uint16_t flags; /* flags */
110};
111
112#define IMAGE_FILE_OPT_ROM_MAGIC 0x107
113#define IMAGE_FILE_OPT_PE32_MAGIC 0x10b
114#define IMAGE_FILE_OPT_PE32_PLUS_MAGIC 0x20b
115
116#define IMAGE_SUBSYSTEM_UNKNOWN 0
117#define IMAGE_SUBSYSTEM_NATIVE 1
118#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
119#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
120#define IMAGE_SUBSYSTEM_POSIX_CUI 7
121#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
122#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
123#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
124#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
125#define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE 13
126#define IMAGE_SUBSYSTEM_XBOX 14
127
128#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040
129#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080
130#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100
131#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
132#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
133#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
134#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
135#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
136
137/* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
138 * work right. vomit. */
139struct pe32_opt_hdr {
140 /* "standard" header */
141 uint16_t magic; /* file type */
142 uint8_t ld_major; /* linker major version */
143 uint8_t ld_minor; /* linker minor version */
144 uint32_t text_size; /* size of text section(s) */
145 uint32_t data_size; /* size of data section(s) */
146 uint32_t bss_size; /* size of bss section(s) */
147 uint32_t entry_point; /* file offset of entry point */
148 uint32_t code_base; /* relative code addr in ram */
149 uint32_t data_base; /* relative data addr in ram */
150 /* "windows" header */
151 uint32_t image_base; /* preferred load address */
152 uint32_t section_align; /* alignment in bytes */
153 uint32_t file_align; /* file alignment in bytes */
154 uint16_t os_major; /* major OS version */
155 uint16_t os_minor; /* minor OS version */
156 uint16_t image_major; /* major image version */
157 uint16_t image_minor; /* minor image version */
158 uint16_t subsys_major; /* major subsystem version */
159 uint16_t subsys_minor; /* minor subsystem version */
160 uint32_t win32_version; /* reserved, must be 0 */
161 uint32_t image_size; /* image size */
162 uint32_t header_size; /* header size rounded up to
163 file_align */
164 uint32_t csum; /* checksum */
165 uint16_t subsys; /* subsystem */
166 uint16_t dll_flags; /* more flags! */
167 uint32_t stack_size_req;/* amt of stack requested */
168 uint32_t stack_size; /* amt of stack required */
169 uint32_t heap_size_req; /* amt of heap requested */
170 uint32_t heap_size; /* amt of heap required */
171 uint32_t loader_flags; /* reserved, must be 0 */
172 uint32_t data_dirs; /* number of data dir entries */
173};
174
175struct pe32plus_opt_hdr {
176 uint16_t magic; /* file type */
177 uint8_t ld_major; /* linker major version */
178 uint8_t ld_minor; /* linker minor version */
179 uint32_t text_size; /* size of text section(s) */
180 uint32_t data_size; /* size of data section(s) */
181 uint32_t bss_size; /* size of bss section(s) */
182 uint32_t entry_point; /* file offset of entry point */
183 uint32_t code_base; /* relative code addr in ram */
184 /* "windows" header */
185 uint64_t image_base; /* preferred load address */
186 uint32_t section_align; /* alignment in bytes */
187 uint32_t file_align; /* file alignment in bytes */
188 uint16_t os_major; /* major OS version */
189 uint16_t os_minor; /* minor OS version */
190 uint16_t image_major; /* major image version */
191 uint16_t image_minor; /* minor image version */
192 uint16_t subsys_major; /* major subsystem version */
193 uint16_t subsys_minor; /* minor subsystem version */
194 uint32_t win32_version; /* reserved, must be 0 */
195 uint32_t image_size; /* image size */
196 uint32_t header_size; /* header size rounded up to
197 file_align */
198 uint32_t csum; /* checksum */
199 uint16_t subsys; /* subsystem */
200 uint16_t dll_flags; /* more flags! */
201 uint64_t stack_size_req;/* amt of stack requested */
202 uint64_t stack_size; /* amt of stack required */
203 uint64_t heap_size_req; /* amt of heap requested */
204 uint64_t heap_size; /* amt of heap required */
205 uint32_t loader_flags; /* reserved, must be 0 */
206 uint32_t data_dirs; /* number of data dir entries */
207};
208
209struct data_dirent {
210 uint32_t virtual_address; /* relative to load address */
211 uint32_t size;
212};
213
214struct data_directory {
215 struct data_dirent exports; /* .edata */
216 struct data_dirent imports; /* .idata */
217 struct data_dirent resources; /* .rsrc */
218 struct data_dirent exceptions; /* .pdata */
219 struct data_dirent certs; /* certs */
220 struct data_dirent base_relocations; /* .reloc */
221 struct data_dirent debug; /* .debug */
222 struct data_dirent arch; /* reservered */
223 struct data_dirent global_ptr; /* global pointer reg. Size=0 */
224 struct data_dirent tls; /* .tls */
225 struct data_dirent load_config; /* load configuration structure */
226 struct data_dirent bound_imports; /* no idea */
227 struct data_dirent import_addrs; /* import address table */
228 struct data_dirent delay_imports; /* delay-load import table */
229 struct data_dirent clr_runtime_hdr; /* .cor (object only) */
230 struct data_dirent reserved;
231};
232
233struct section_header {
234 char name[8]; /* name or "/12\0" string tbl offset */
235 uint32_t virtual_size; /* size of loaded section in ram */
236 uint32_t virtual_address; /* relative virtual address */
237 uint32_t raw_data_size; /* size of the section */
238 uint32_t data_addr; /* file pointer to first page of sec */
239 uint32_t relocs; /* file pointer to relocation entries */
240 uint32_t line_numbers; /* line numbers! */
241 uint16_t num_relocs; /* number of relocations */
242 uint16_t num_lin_numbers; /* srsly. */
243 uint32_t flags;
244};
245
246/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
247#define IMAGE_SCN_RESERVED_0 0x00000001
248#define IMAGE_SCN_RESERVED_1 0x00000002
249#define IMAGE_SCN_RESERVED_2 0x00000004
250#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* don't pad - obsolete */
251#define IMAGE_SCN_RESERVED_3 0x00000010
252#define IMAGE_SCN_CNT_CODE 0x00000020 /* .text */
253#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
254#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
255#define IMAGE_SCN_LNK_OTHER 0x00000100 /* reserved */
256#define IMAGE_SCN_LNK_INFO 0x00000200 /* .drectve comments */
257#define IMAGE_SCN_RESERVED_4 0x00000400
258#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* .o only - scn to be rm'd*/
259#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* .o only - COMDAT data */
260#define IMAGE_SCN_RESERVED_5 0x00002000 /* spec omits this */
261#define IMAGE_SCN_RESERVED_6 0x00004000 /* spec omits this */
262#define IMAGE_SCN_GPREL 0x00008000 /* global pointer referenced data */
263/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
264#define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
265#define IMAGE_SCN_16BIT 0x00020000 /* reserved for "future" use */
266#define IMAGE_SCN_LOCKED 0x00040000 /* reserved for "future" use */
267#define IMAGE_SCN_PRELOAD 0x00080000 /* reserved for "future" use */
268/* and here they just stuck a 1-byte integer in the middle of a bitfield */
269#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 /* it does what it says on the box */
270#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
271#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
272#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
273#define IMAGE_SCN_ALIGN_16BYTES 0x00500000
274#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
275#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
276#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
277#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
278#define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
279#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
280#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
281#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
282#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
283#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
284#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
285#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
286#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* not pageable */
287#define IMAGE_SCN_MEM_SHARED 0x10000000 /* can be shared */
288#define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* can be executed as code */
289#define IMAGE_SCN_MEM_READ 0x40000000 /* readable */
290#define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */
291
292enum x64_coff_reloc_type {
293 IMAGE_REL_AMD64_ABSOLUTE = 0,
294 IMAGE_REL_AMD64_ADDR64,
295 IMAGE_REL_AMD64_ADDR32,
296 IMAGE_REL_AMD64_ADDR32N,
297 IMAGE_REL_AMD64_REL32,
298 IMAGE_REL_AMD64_REL32_1,
299 IMAGE_REL_AMD64_REL32_2,
300 IMAGE_REL_AMD64_REL32_3,
301 IMAGE_REL_AMD64_REL32_4,
302 IMAGE_REL_AMD64_REL32_5,
303 IMAGE_REL_AMD64_SECTION,
304 IMAGE_REL_AMD64_SECREL,
305 IMAGE_REL_AMD64_SECREL7,
306 IMAGE_REL_AMD64_TOKEN,
307 IMAGE_REL_AMD64_SREL32,
308 IMAGE_REL_AMD64_PAIR,
309 IMAGE_REL_AMD64_SSPAN32,
310};
311
312enum arm_coff_reloc_type {
313 IMAGE_REL_ARM_ABSOLUTE,
314 IMAGE_REL_ARM_ADDR32,
315 IMAGE_REL_ARM_ADDR32N,
316 IMAGE_REL_ARM_BRANCH2,
317 IMAGE_REL_ARM_BRANCH1,
318 IMAGE_REL_ARM_SECTION,
319 IMAGE_REL_ARM_SECREL,
320};
321
322enum sh_coff_reloc_type {
323 IMAGE_REL_SH3_ABSOLUTE,
324 IMAGE_REL_SH3_DIRECT16,
325 IMAGE_REL_SH3_DIRECT32,
326 IMAGE_REL_SH3_DIRECT8,
327 IMAGE_REL_SH3_DIRECT8_WORD,
328 IMAGE_REL_SH3_DIRECT8_LONG,
329 IMAGE_REL_SH3_DIRECT4,
330 IMAGE_REL_SH3_DIRECT4_WORD,
331 IMAGE_REL_SH3_DIRECT4_LONG,
332 IMAGE_REL_SH3_PCREL8_WORD,
333 IMAGE_REL_SH3_PCREL8_LONG,
334 IMAGE_REL_SH3_PCREL12_WORD,
335 IMAGE_REL_SH3_STARTOF_SECTION,
336 IMAGE_REL_SH3_SIZEOF_SECTION,
337 IMAGE_REL_SH3_SECTION,
338 IMAGE_REL_SH3_SECREL,
339 IMAGE_REL_SH3_DIRECT32_NB,
340 IMAGE_REL_SH3_GPREL4_LONG,
341 IMAGE_REL_SH3_TOKEN,
342 IMAGE_REL_SHM_PCRELPT,
343 IMAGE_REL_SHM_REFLO,
344 IMAGE_REL_SHM_REFHALF,
345 IMAGE_REL_SHM_RELLO,
346 IMAGE_REL_SHM_RELHALF,
347 IMAGE_REL_SHM_PAIR,
348 IMAGE_REL_SHM_NOMODE,
349};
350
351enum ppc_coff_reloc_type {
352 IMAGE_REL_PPC_ABSOLUTE,
353 IMAGE_REL_PPC_ADDR64,
354 IMAGE_REL_PPC_ADDR32,
355 IMAGE_REL_PPC_ADDR24,
356 IMAGE_REL_PPC_ADDR16,
357 IMAGE_REL_PPC_ADDR14,
358 IMAGE_REL_PPC_REL24,
359 IMAGE_REL_PPC_REL14,
360 IMAGE_REL_PPC_ADDR32N,
361 IMAGE_REL_PPC_SECREL,
362 IMAGE_REL_PPC_SECTION,
363 IMAGE_REL_PPC_SECREL16,
364 IMAGE_REL_PPC_REFHI,
365 IMAGE_REL_PPC_REFLO,
366 IMAGE_REL_PPC_PAIR,
367 IMAGE_REL_PPC_SECRELLO,
368 IMAGE_REL_PPC_GPREL,
369 IMAGE_REL_PPC_TOKEN,
370};
371
372enum x86_coff_reloc_type {
373 IMAGE_REL_I386_ABSOLUTE,
374 IMAGE_REL_I386_DIR16,
375 IMAGE_REL_I386_REL16,
376 IMAGE_REL_I386_DIR32,
377 IMAGE_REL_I386_DIR32NB,
378 IMAGE_REL_I386_SEG12,
379 IMAGE_REL_I386_SECTION,
380 IMAGE_REL_I386_SECREL,
381 IMAGE_REL_I386_TOKEN,
382 IMAGE_REL_I386_SECREL7,
383 IMAGE_REL_I386_REL32,
384};
385
386enum ia64_coff_reloc_type {
387 IMAGE_REL_IA64_ABSOLUTE,
388 IMAGE_REL_IA64_IMM14,
389 IMAGE_REL_IA64_IMM22,
390 IMAGE_REL_IA64_IMM64,
391 IMAGE_REL_IA64_DIR32,
392 IMAGE_REL_IA64_DIR64,
393 IMAGE_REL_IA64_PCREL21B,
394 IMAGE_REL_IA64_PCREL21M,
395 IMAGE_REL_IA64_PCREL21F,
396 IMAGE_REL_IA64_GPREL22,
397 IMAGE_REL_IA64_LTOFF22,
398 IMAGE_REL_IA64_SECTION,
399 IMAGE_REL_IA64_SECREL22,
400 IMAGE_REL_IA64_SECREL64I,
401 IMAGE_REL_IA64_SECREL32,
402 IMAGE_REL_IA64_DIR32NB,
403 IMAGE_REL_IA64_SREL14,
404 IMAGE_REL_IA64_SREL22,
405 IMAGE_REL_IA64_SREL32,
406 IMAGE_REL_IA64_UREL32,
407 IMAGE_REL_IA64_PCREL60X,
408 IMAGE_REL_IA64_PCREL60B,
409 IMAGE_REL_IA64_PCREL60F,
410 IMAGE_REL_IA64_PCREL60I,
411 IMAGE_REL_IA64_PCREL60M,
412 IMAGE_REL_IA64_IMMGPREL6,
413 IMAGE_REL_IA64_TOKEN,
414 IMAGE_REL_IA64_GPREL32,
415 IMAGE_REL_IA64_ADDEND,
416};
417
418struct coff_reloc {
419 uint32_t virtual_address;
420 uint32_t symbol_table_index;
421 union {
422 enum x64_coff_reloc_type x64_type;
423 enum arm_coff_reloc_type arm_type;
424 enum sh_coff_reloc_type sh_type;
425 enum ppc_coff_reloc_type ppc_type;
426 enum x86_coff_reloc_type x86_type;
427 enum ia64_coff_reloc_type ia64_type;
428 uint16_t data;
429 };
430};
431
432/*
433 * Definitions for the contents of the certs data block
434 */
435#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
436#define WIN_CERT_TYPE_EFI_OKCS115 0x0EF0
437#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
438
439#define WIN_CERT_REVISION_1_0 0x0100
440#define WIN_CERT_REVISION_2_0 0x0200
441
442struct win_certificate {
443 uint32_t length;
444 uint16_t revision;
445 uint16_t cert_type;
446};
447
448#endif /* __LINUX_PE_H */
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index dec01d6c3f80..cfd56046ecec 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -1,6 +1,40 @@
1/*
2 * linux/percpu-defs.h - basic definitions for percpu areas
3 *
4 * DO NOT INCLUDE DIRECTLY OUTSIDE PERCPU IMPLEMENTATION PROPER.
5 *
6 * This file is separate from linux/percpu.h to avoid cyclic inclusion
7 * dependency from arch header files. Only to be included from
8 * asm/percpu.h.
9 *
10 * This file includes macros necessary to declare percpu sections and
11 * variables, and definitions of percpu accessors and operations. It
12 * should provide enough percpu features to arch header files even when
13 * they can only include asm/percpu.h to avoid cyclic inclusion dependency.
14 */
15
1#ifndef _LINUX_PERCPU_DEFS_H 16#ifndef _LINUX_PERCPU_DEFS_H
2#define _LINUX_PERCPU_DEFS_H 17#define _LINUX_PERCPU_DEFS_H
3 18
19#ifdef CONFIG_SMP
20
21#ifdef MODULE
22#define PER_CPU_SHARED_ALIGNED_SECTION ""
23#define PER_CPU_ALIGNED_SECTION ""
24#else
25#define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned"
26#define PER_CPU_ALIGNED_SECTION "..shared_aligned"
27#endif
28#define PER_CPU_FIRST_SECTION "..first"
29
30#else
31
32#define PER_CPU_SHARED_ALIGNED_SECTION ""
33#define PER_CPU_ALIGNED_SECTION "..shared_aligned"
34#define PER_CPU_FIRST_SECTION ""
35
36#endif
37
4/* 38/*
5 * Base implementations of per-CPU variable declarations and definitions, where 39 * Base implementations of per-CPU variable declarations and definitions, where
6 * the section in which the variable is to be placed is provided by the 40 * the section in which the variable is to be placed is provided by the
@@ -19,19 +53,6 @@
19 __attribute__((section(".discard"), unused)) 53 __attribute__((section(".discard"), unused))
20 54
21/* 55/*
22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer.
25 *
26 * + 0 is required in order to convert the pointer type from a
27 * potential array type to a pointer to a single item of the array.
28 */
29#define __verify_pcpu_ptr(ptr) do { \
30 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
31 (void)__vpp_verify; \
32} while (0)
33
34/*
35 * s390 and alpha modules require percpu variables to be defined as 56 * s390 and alpha modules require percpu variables to be defined as
36 * weak to force the compiler to generate GOT based external 57 * weak to force the compiler to generate GOT based external
37 * references for them. This is necessary because percpu sections 58 * references for them. This is necessary because percpu sections
@@ -164,4 +185,337 @@
164#define EXPORT_PER_CPU_SYMBOL_GPL(var) 185#define EXPORT_PER_CPU_SYMBOL_GPL(var)
165#endif 186#endif
166 187
188/*
189 * Accessors and operations.
190 */
191#ifndef __ASSEMBLY__
192
193/*
194 * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating
195 * @ptr and is invoked once before a percpu area is accessed by all
196 * accessors and operations. This is performed in the generic part of
197 * percpu and arch overrides don't need to worry about it; however, if an
198 * arch wants to implement an arch-specific percpu accessor or operation,
199 * it may use __verify_pcpu_ptr() to verify the parameters.
200 *
201 * + 0 is required in order to convert the pointer type from a
202 * potential array type to a pointer to a single item of the array.
203 */
204#define __verify_pcpu_ptr(ptr) \
205do { \
206 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
207 (void)__vpp_verify; \
208} while (0)
209
210#ifdef CONFIG_SMP
211
212/*
213 * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE()
214 * to prevent the compiler from making incorrect assumptions about the
215 * pointer value. The weird cast keeps both GCC and sparse happy.
216 */
217#define SHIFT_PERCPU_PTR(__p, __offset) \
218 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
219
220#define per_cpu_ptr(ptr, cpu) \
221({ \
222 __verify_pcpu_ptr(ptr); \
223 SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
224})
225
226#define raw_cpu_ptr(ptr) \
227({ \
228 __verify_pcpu_ptr(ptr); \
229 arch_raw_cpu_ptr(ptr); \
230})
231
232#ifdef CONFIG_DEBUG_PREEMPT
233#define this_cpu_ptr(ptr) \
234({ \
235 __verify_pcpu_ptr(ptr); \
236 SHIFT_PERCPU_PTR(ptr, my_cpu_offset); \
237})
238#else
239#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
240#endif
241
242#else /* CONFIG_SMP */
243
244#define VERIFY_PERCPU_PTR(__p) \
245({ \
246 __verify_pcpu_ptr(__p); \
247 (typeof(*(__p)) __kernel __force *)(__p); \
248})
249
250#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
251#define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
252#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
253
254#endif /* CONFIG_SMP */
255
256#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
258#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
259
260/* keep until we have removed all uses of __this_cpu_ptr */
261#define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
262
263/*
264 * Must be an lvalue. Since @var must be a simple identifier,
265 * we force a syntax error here if it isn't.
266 */
267#define get_cpu_var(var) \
268(*({ \
269 preempt_disable(); \
270 this_cpu_ptr(&var); \
271}))
272
273/*
274 * The weird & is necessary because sparse considers (void)(var) to be
275 * a direct dereference of percpu variable (var).
276 */
277#define put_cpu_var(var) \
278do { \
279 (void)&(var); \
280 preempt_enable(); \
281} while (0)
282
283#define get_cpu_ptr(var) \
284({ \
285 preempt_disable(); \
286 this_cpu_ptr(var); \
287})
288
289#define put_cpu_ptr(var) \
290do { \
291 (void)(var); \
292 preempt_enable(); \
293} while (0)
294
295/*
296 * Branching function to split up a function into a set of functions that
297 * are called for different scalar sizes of the objects handled.
298 */
299
300extern void __bad_size_call_parameter(void);
301
302#ifdef CONFIG_DEBUG_PREEMPT
303extern void __this_cpu_preempt_check(const char *op);
304#else
305static inline void __this_cpu_preempt_check(const char *op) { }
306#endif
307
308#define __pcpu_size_call_return(stem, variable) \
309({ \
310 typeof(variable) pscr_ret__; \
311 __verify_pcpu_ptr(&(variable)); \
312 switch(sizeof(variable)) { \
313 case 1: pscr_ret__ = stem##1(variable); break; \
314 case 2: pscr_ret__ = stem##2(variable); break; \
315 case 4: pscr_ret__ = stem##4(variable); break; \
316 case 8: pscr_ret__ = stem##8(variable); break; \
317 default: \
318 __bad_size_call_parameter(); break; \
319 } \
320 pscr_ret__; \
321})
322
323#define __pcpu_size_call_return2(stem, variable, ...) \
324({ \
325 typeof(variable) pscr2_ret__; \
326 __verify_pcpu_ptr(&(variable)); \
327 switch(sizeof(variable)) { \
328 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
329 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
330 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
331 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
332 default: \
333 __bad_size_call_parameter(); break; \
334 } \
335 pscr2_ret__; \
336})
337
338/*
339 * Special handling for cmpxchg_double. cmpxchg_double is passed two
340 * percpu variables. The first has to be aligned to a double word
341 * boundary and the second has to follow directly thereafter.
342 * We enforce this on all architectures even if they don't support
343 * a double cmpxchg instruction, since it's a cheap requirement, and it
344 * avoids breaking the requirement for architectures with the instruction.
345 */
346#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
347({ \
348 bool pdcrb_ret__; \
349 __verify_pcpu_ptr(&(pcp1)); \
350 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
351 VM_BUG_ON((unsigned long)(&(pcp1)) % (2 * sizeof(pcp1))); \
352 VM_BUG_ON((unsigned long)(&(pcp2)) != \
353 (unsigned long)(&(pcp1)) + sizeof(pcp1)); \
354 switch(sizeof(pcp1)) { \
355 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
356 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
357 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
358 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
359 default: \
360 __bad_size_call_parameter(); break; \
361 } \
362 pdcrb_ret__; \
363})
364
365#define __pcpu_size_call(stem, variable, ...) \
366do { \
367 __verify_pcpu_ptr(&(variable)); \
368 switch(sizeof(variable)) { \
369 case 1: stem##1(variable, __VA_ARGS__);break; \
370 case 2: stem##2(variable, __VA_ARGS__);break; \
371 case 4: stem##4(variable, __VA_ARGS__);break; \
372 case 8: stem##8(variable, __VA_ARGS__);break; \
373 default: \
374 __bad_size_call_parameter();break; \
375 } \
376} while (0)
377
378/*
379 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
380 *
381 * Optimized manipulation for memory allocated through the per cpu
382 * allocator or for addresses of per cpu variables.
383 *
384 * These operation guarantee exclusivity of access for other operations
385 * on the *same* processor. The assumption is that per cpu data is only
386 * accessed by a single processor instance (the current one).
387 *
388 * The arch code can provide optimized implementation by defining macros
389 * for certain scalar sizes. F.e. provide this_cpu_add_2() to provide per
390 * cpu atomic operations for 2 byte sized RMW actions. If arch code does
391 * not provide operations for a scalar size then the fallback in the
392 * generic code will be used.
393 *
394 * cmpxchg_double replaces two adjacent scalars at once. The first two
395 * parameters are per cpu variables which have to be of the same size. A
396 * truth value is returned to indicate success or failure (since a double
397 * register result is difficult to handle). There is very limited hardware
398 * support for these operations, so only certain sizes may work.
399 */
400
401/*
402 * Operations for contexts where we do not want to do any checks for
403 * preemptions. Unless strictly necessary, always use [__]this_cpu_*()
404 * instead.
405 *
406 * If there is no other protection through preempt disable and/or disabling
407 * interupts then one of these RMW operations can show unexpected behavior
408 * because the execution thread was rescheduled on another processor or an
409 * interrupt occurred and the same percpu variable was modified from the
410 * interrupt context.
411 */
412#define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)
413#define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, pcp, val)
414#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
415#define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, pcp, val)
416#define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, pcp, val)
417#define raw_cpu_add_return(pcp, val) __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
418#define raw_cpu_xchg(pcp, nval) __pcpu_size_call_return2(raw_cpu_xchg_, pcp, nval)
419#define raw_cpu_cmpxchg(pcp, oval, nval) \
420 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
421#define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
422 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
423
424#define raw_cpu_sub(pcp, val) raw_cpu_add(pcp, -(val))
425#define raw_cpu_inc(pcp) raw_cpu_add(pcp, 1)
426#define raw_cpu_dec(pcp) raw_cpu_sub(pcp, 1)
427#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
428#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
429#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
430
431/*
432 * Operations for contexts that are safe from preemption/interrupts. These
433 * operations verify that preemption is disabled.
434 */
435#define __this_cpu_read(pcp) \
436({ \
437 __this_cpu_preempt_check("read"); \
438 raw_cpu_read(pcp); \
439})
440
441#define __this_cpu_write(pcp, val) \
442({ \
443 __this_cpu_preempt_check("write"); \
444 raw_cpu_write(pcp, val); \
445})
446
447#define __this_cpu_add(pcp, val) \
448({ \
449 __this_cpu_preempt_check("add"); \
450 raw_cpu_add(pcp, val); \
451})
452
453#define __this_cpu_and(pcp, val) \
454({ \
455 __this_cpu_preempt_check("and"); \
456 raw_cpu_and(pcp, val); \
457})
458
459#define __this_cpu_or(pcp, val) \
460({ \
461 __this_cpu_preempt_check("or"); \
462 raw_cpu_or(pcp, val); \
463})
464
465#define __this_cpu_add_return(pcp, val) \
466({ \
467 __this_cpu_preempt_check("add_return"); \
468 raw_cpu_add_return(pcp, val); \
469})
470
471#define __this_cpu_xchg(pcp, nval) \
472({ \
473 __this_cpu_preempt_check("xchg"); \
474 raw_cpu_xchg(pcp, nval); \
475})
476
477#define __this_cpu_cmpxchg(pcp, oval, nval) \
478({ \
479 __this_cpu_preempt_check("cmpxchg"); \
480 raw_cpu_cmpxchg(pcp, oval, nval); \
481})
482
483#define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
484({ __this_cpu_preempt_check("cmpxchg_double"); \
485 raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2); \
486})
487
488#define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val))
489#define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1)
490#define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1)
491#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
492#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
493#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
494
495/*
496 * Operations with implied preemption protection. These operations can be
497 * used without worrying about preemption. Note that interrupts may still
498 * occur while an operation is in progress and if the interrupt modifies
499 * the variable too then RMW actions may not be reliable.
500 */
501#define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp)
502#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
503#define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val)
504#define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, pcp, val)
505#define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, pcp, val)
506#define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
507#define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval)
508#define this_cpu_cmpxchg(pcp, oval, nval) \
509 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
510#define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
511 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2)
512
513#define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val))
514#define this_cpu_inc(pcp) this_cpu_add(pcp, 1)
515#define this_cpu_dec(pcp) this_cpu_sub(pcp, 1)
516#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
517#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
518#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
519
520#endif /* __ASSEMBLY__ */
167#endif /* _LINUX_PERCPU_DEFS_H */ 521#endif /* _LINUX_PERCPU_DEFS_H */
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 5d8920e23073..3dfbf237cd8f 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -57,11 +57,9 @@ struct percpu_ref {
57 atomic_t count; 57 atomic_t count;
58 /* 58 /*
59 * The low bit of the pointer indicates whether the ref is in percpu 59 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t (this is a 60 * mode; if set, then get/put will manipulate the atomic_t.
61 * hack because we need to keep the pointer around for
62 * percpu_ref_kill_rcu())
63 */ 61 */
64 unsigned __percpu *pcpu_count; 62 unsigned long pcpu_count_ptr;
65 percpu_ref_func_t *release; 63 percpu_ref_func_t *release;
66 percpu_ref_func_t *confirm_kill; 64 percpu_ref_func_t *confirm_kill;
67 struct rcu_head rcu; 65 struct rcu_head rcu;
@@ -69,7 +67,8 @@ struct percpu_ref {
69 67
70int __must_check percpu_ref_init(struct percpu_ref *ref, 68int __must_check percpu_ref_init(struct percpu_ref *ref,
71 percpu_ref_func_t *release); 69 percpu_ref_func_t *release);
72void percpu_ref_cancel_init(struct percpu_ref *ref); 70void percpu_ref_reinit(struct percpu_ref *ref);
71void percpu_ref_exit(struct percpu_ref *ref);
73void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 72void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
74 percpu_ref_func_t *confirm_kill); 73 percpu_ref_func_t *confirm_kill);
75 74
@@ -88,12 +87,28 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
88 return percpu_ref_kill_and_confirm(ref, NULL); 87 return percpu_ref_kill_and_confirm(ref, NULL);
89} 88}
90 89
91#define PCPU_STATUS_BITS 2
92#define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1)
93#define PCPU_REF_PTR 0
94#define PCPU_REF_DEAD 1 90#define PCPU_REF_DEAD 1
95 91
96#define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK) 92/*
93 * Internal helper. Don't use outside percpu-refcount proper. The
94 * function doesn't return the pointer and let the caller test it for NULL
95 * because doing so forces the compiler to generate two conditional
96 * branches as it can't assume that @ref->pcpu_count is not NULL.
97 */
98static inline bool __pcpu_ref_alive(struct percpu_ref *ref,
99 unsigned __percpu **pcpu_countp)
100{
101 unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr);
102
103 /* paired with smp_store_release() in percpu_ref_reinit() */
104 smp_read_barrier_depends();
105
106 if (unlikely(pcpu_ptr & PCPU_REF_DEAD))
107 return false;
108
109 *pcpu_countp = (unsigned __percpu *)pcpu_ptr;
110 return true;
111}
97 112
98/** 113/**
99 * percpu_ref_get - increment a percpu refcount 114 * percpu_ref_get - increment a percpu refcount
@@ -107,9 +122,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
107 122
108 rcu_read_lock_sched(); 123 rcu_read_lock_sched();
109 124
110 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 125 if (__pcpu_ref_alive(ref, &pcpu_count))
111
112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
113 this_cpu_inc(*pcpu_count); 126 this_cpu_inc(*pcpu_count);
114 else 127 else
115 atomic_inc(&ref->count); 128 atomic_inc(&ref->count);
@@ -133,9 +146,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
133 146
134 rcu_read_lock_sched(); 147 rcu_read_lock_sched();
135 148
136 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 149 if (__pcpu_ref_alive(ref, &pcpu_count)) {
137
138 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
139 this_cpu_inc(*pcpu_count); 150 this_cpu_inc(*pcpu_count);
140 ret = true; 151 ret = true;
141 } else { 152 } else {
@@ -168,9 +179,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
168 179
169 rcu_read_lock_sched(); 180 rcu_read_lock_sched();
170 181
171 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 182 if (__pcpu_ref_alive(ref, &pcpu_count)) {
172
173 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
174 this_cpu_inc(*pcpu_count); 183 this_cpu_inc(*pcpu_count);
175 ret = true; 184 ret = true;
176 } 185 }
@@ -193,9 +202,7 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
193 202
194 rcu_read_lock_sched(); 203 rcu_read_lock_sched();
195 204
196 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 205 if (__pcpu_ref_alive(ref, &pcpu_count))
197
198 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
199 this_cpu_dec(*pcpu_count); 206 this_cpu_dec(*pcpu_count);
200 else if (unlikely(atomic_dec_and_test(&ref->count))) 207 else if (unlikely(atomic_dec_and_test(&ref->count)))
201 ref->release(ref); 208 ref->release(ref);
@@ -203,4 +210,19 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
203 rcu_read_unlock_sched(); 210 rcu_read_unlock_sched();
204} 211}
205 212
213/**
214 * percpu_ref_is_zero - test whether a percpu refcount reached zero
215 * @ref: percpu_ref to test
216 *
217 * Returns %true if @ref reached zero.
218 */
219static inline bool percpu_ref_is_zero(struct percpu_ref *ref)
220{
221 unsigned __percpu *pcpu_count;
222
223 if (__pcpu_ref_alive(ref, &pcpu_count))
224 return false;
225 return !atomic_read(&ref->count);
226}
227
206#endif 228#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 8419053d0f2e..6f61b61b7996 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -23,32 +23,6 @@
23 PERCPU_MODULE_RESERVE) 23 PERCPU_MODULE_RESERVE)
24#endif 24#endif
25 25
26/*
27 * Must be an lvalue. Since @var must be a simple identifier,
28 * we force a syntax error here if it isn't.
29 */
30#define get_cpu_var(var) (*({ \
31 preempt_disable(); \
32 this_cpu_ptr(&var); }))
33
34/*
35 * The weird & is necessary because sparse considers (void)(var) to be
36 * a direct dereference of percpu variable (var).
37 */
38#define put_cpu_var(var) do { \
39 (void)&(var); \
40 preempt_enable(); \
41} while (0)
42
43#define get_cpu_ptr(var) ({ \
44 preempt_disable(); \
45 this_cpu_ptr(var); })
46
47#define put_cpu_ptr(var) do { \
48 (void)(var); \
49 preempt_enable(); \
50} while (0)
51
52/* minimum unit size, also is the maximum supported allocation size */ 26/* minimum unit size, also is the maximum supported allocation size */
53#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) 27#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10)
54 28
@@ -140,17 +114,6 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
140 pcpu_fc_populate_pte_fn_t populate_pte_fn); 114 pcpu_fc_populate_pte_fn_t populate_pte_fn);
141#endif 115#endif
142 116
143/*
144 * Use this to get to a cpu's version of the per-cpu object
145 * dynamically allocated. Non-atomic access to the current CPU's
146 * version should probably be combined with get_cpu()/put_cpu().
147 */
148#ifdef CONFIG_SMP
149#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
150#else
151#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); })
152#endif
153
154extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); 117extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
155extern bool is_kernel_percpu_address(unsigned long addr); 118extern bool is_kernel_percpu_address(unsigned long addr);
156 119
@@ -166,640 +129,4 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166#define alloc_percpu(type) \ 129#define alloc_percpu(type) \
167 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 130 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
168 131
169/*
170 * Branching function to split up a function into a set of functions that
171 * are called for different scalar sizes of the objects handled.
172 */
173
174extern void __bad_size_call_parameter(void);
175
176#ifdef CONFIG_DEBUG_PREEMPT
177extern void __this_cpu_preempt_check(const char *op);
178#else
179static inline void __this_cpu_preempt_check(const char *op) { }
180#endif
181
182#define __pcpu_size_call_return(stem, variable) \
183({ typeof(variable) pscr_ret__; \
184 __verify_pcpu_ptr(&(variable)); \
185 switch(sizeof(variable)) { \
186 case 1: pscr_ret__ = stem##1(variable);break; \
187 case 2: pscr_ret__ = stem##2(variable);break; \
188 case 4: pscr_ret__ = stem##4(variable);break; \
189 case 8: pscr_ret__ = stem##8(variable);break; \
190 default: \
191 __bad_size_call_parameter();break; \
192 } \
193 pscr_ret__; \
194})
195
196#define __pcpu_size_call_return2(stem, variable, ...) \
197({ \
198 typeof(variable) pscr2_ret__; \
199 __verify_pcpu_ptr(&(variable)); \
200 switch(sizeof(variable)) { \
201 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
202 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
203 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
204 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
205 default: \
206 __bad_size_call_parameter(); break; \
207 } \
208 pscr2_ret__; \
209})
210
211/*
212 * Special handling for cmpxchg_double. cmpxchg_double is passed two
213 * percpu variables. The first has to be aligned to a double word
214 * boundary and the second has to follow directly thereafter.
215 * We enforce this on all architectures even if they don't support
216 * a double cmpxchg instruction, since it's a cheap requirement, and it
217 * avoids breaking the requirement for architectures with the instruction.
218 */
219#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
220({ \
221 bool pdcrb_ret__; \
222 __verify_pcpu_ptr(&pcp1); \
223 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
224 VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
225 VM_BUG_ON((unsigned long)(&pcp2) != \
226 (unsigned long)(&pcp1) + sizeof(pcp1)); \
227 switch(sizeof(pcp1)) { \
228 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
229 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
230 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
231 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
232 default: \
233 __bad_size_call_parameter(); break; \
234 } \
235 pdcrb_ret__; \
236})
237
238#define __pcpu_size_call(stem, variable, ...) \
239do { \
240 __verify_pcpu_ptr(&(variable)); \
241 switch(sizeof(variable)) { \
242 case 1: stem##1(variable, __VA_ARGS__);break; \
243 case 2: stem##2(variable, __VA_ARGS__);break; \
244 case 4: stem##4(variable, __VA_ARGS__);break; \
245 case 8: stem##8(variable, __VA_ARGS__);break; \
246 default: \
247 __bad_size_call_parameter();break; \
248 } \
249} while (0)
250
251/*
252 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
253 *
254 * Optimized manipulation for memory allocated through the per cpu
255 * allocator or for addresses of per cpu variables.
256 *
257 * These operation guarantee exclusivity of access for other operations
258 * on the *same* processor. The assumption is that per cpu data is only
259 * accessed by a single processor instance (the current one).
260 *
261 * The first group is used for accesses that must be done in a
262 * preemption safe way since we know that the context is not preempt
263 * safe. Interrupts may occur. If the interrupt modifies the variable
264 * too then RMW actions will not be reliable.
265 *
266 * The arch code can provide optimized functions in two ways:
267 *
268 * 1. Override the function completely. F.e. define this_cpu_add().
269 * The arch must then ensure that the various scalar format passed
270 * are handled correctly.
271 *
272 * 2. Provide functions for certain scalar sizes. F.e. provide
273 * this_cpu_add_2() to provide per cpu atomic operations for 2 byte
274 * sized RMW actions. If arch code does not provide operations for
275 * a scalar size then the fallback in the generic code will be
276 * used.
277 */
278
279#define _this_cpu_generic_read(pcp) \
280({ typeof(pcp) ret__; \
281 preempt_disable(); \
282 ret__ = *this_cpu_ptr(&(pcp)); \
283 preempt_enable(); \
284 ret__; \
285})
286
287#ifndef this_cpu_read
288# ifndef this_cpu_read_1
289# define this_cpu_read_1(pcp) _this_cpu_generic_read(pcp)
290# endif
291# ifndef this_cpu_read_2
292# define this_cpu_read_2(pcp) _this_cpu_generic_read(pcp)
293# endif
294# ifndef this_cpu_read_4
295# define this_cpu_read_4(pcp) _this_cpu_generic_read(pcp)
296# endif
297# ifndef this_cpu_read_8
298# define this_cpu_read_8(pcp) _this_cpu_generic_read(pcp)
299# endif
300# define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, (pcp))
301#endif
302
303#define _this_cpu_generic_to_op(pcp, val, op) \
304do { \
305 unsigned long flags; \
306 raw_local_irq_save(flags); \
307 *raw_cpu_ptr(&(pcp)) op val; \
308 raw_local_irq_restore(flags); \
309} while (0)
310
311#ifndef this_cpu_write
312# ifndef this_cpu_write_1
313# define this_cpu_write_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
314# endif
315# ifndef this_cpu_write_2
316# define this_cpu_write_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
317# endif
318# ifndef this_cpu_write_4
319# define this_cpu_write_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
320# endif
321# ifndef this_cpu_write_8
322# define this_cpu_write_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), =)
323# endif
324# define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, (pcp), (val))
325#endif
326
327#ifndef this_cpu_add
328# ifndef this_cpu_add_1
329# define this_cpu_add_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
330# endif
331# ifndef this_cpu_add_2
332# define this_cpu_add_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
333# endif
334# ifndef this_cpu_add_4
335# define this_cpu_add_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
336# endif
337# ifndef this_cpu_add_8
338# define this_cpu_add_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), +=)
339# endif
340# define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, (pcp), (val))
341#endif
342
343#ifndef this_cpu_sub
344# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val))
345#endif
346
347#ifndef this_cpu_inc
348# define this_cpu_inc(pcp) this_cpu_add((pcp), 1)
349#endif
350
351#ifndef this_cpu_dec
352# define this_cpu_dec(pcp) this_cpu_sub((pcp), 1)
353#endif
354
355#ifndef this_cpu_and
356# ifndef this_cpu_and_1
357# define this_cpu_and_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
358# endif
359# ifndef this_cpu_and_2
360# define this_cpu_and_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
361# endif
362# ifndef this_cpu_and_4
363# define this_cpu_and_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
364# endif
365# ifndef this_cpu_and_8
366# define this_cpu_and_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), &=)
367# endif
368# define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, (pcp), (val))
369#endif
370
371#ifndef this_cpu_or
372# ifndef this_cpu_or_1
373# define this_cpu_or_1(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
374# endif
375# ifndef this_cpu_or_2
376# define this_cpu_or_2(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
377# endif
378# ifndef this_cpu_or_4
379# define this_cpu_or_4(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
380# endif
381# ifndef this_cpu_or_8
382# define this_cpu_or_8(pcp, val) _this_cpu_generic_to_op((pcp), (val), |=)
383# endif
384# define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
385#endif
386
387#define _this_cpu_generic_add_return(pcp, val) \
388({ \
389 typeof(pcp) ret__; \
390 unsigned long flags; \
391 raw_local_irq_save(flags); \
392 raw_cpu_add(pcp, val); \
393 ret__ = raw_cpu_read(pcp); \
394 raw_local_irq_restore(flags); \
395 ret__; \
396})
397
398#ifndef this_cpu_add_return
399# ifndef this_cpu_add_return_1
400# define this_cpu_add_return_1(pcp, val) _this_cpu_generic_add_return(pcp, val)
401# endif
402# ifndef this_cpu_add_return_2
403# define this_cpu_add_return_2(pcp, val) _this_cpu_generic_add_return(pcp, val)
404# endif
405# ifndef this_cpu_add_return_4
406# define this_cpu_add_return_4(pcp, val) _this_cpu_generic_add_return(pcp, val)
407# endif
408# ifndef this_cpu_add_return_8
409# define this_cpu_add_return_8(pcp, val) _this_cpu_generic_add_return(pcp, val)
410# endif
411# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
412#endif
413
414#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
415#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
416#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
417
418#define _this_cpu_generic_xchg(pcp, nval) \
419({ typeof(pcp) ret__; \
420 unsigned long flags; \
421 raw_local_irq_save(flags); \
422 ret__ = raw_cpu_read(pcp); \
423 raw_cpu_write(pcp, nval); \
424 raw_local_irq_restore(flags); \
425 ret__; \
426})
427
428#ifndef this_cpu_xchg
429# ifndef this_cpu_xchg_1
430# define this_cpu_xchg_1(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
431# endif
432# ifndef this_cpu_xchg_2
433# define this_cpu_xchg_2(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
434# endif
435# ifndef this_cpu_xchg_4
436# define this_cpu_xchg_4(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
437# endif
438# ifndef this_cpu_xchg_8
439# define this_cpu_xchg_8(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
440# endif
441# define this_cpu_xchg(pcp, nval) \
442 __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
443#endif
444
445#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
446({ \
447 typeof(pcp) ret__; \
448 unsigned long flags; \
449 raw_local_irq_save(flags); \
450 ret__ = raw_cpu_read(pcp); \
451 if (ret__ == (oval)) \
452 raw_cpu_write(pcp, nval); \
453 raw_local_irq_restore(flags); \
454 ret__; \
455})
456
457#ifndef this_cpu_cmpxchg
458# ifndef this_cpu_cmpxchg_1
459# define this_cpu_cmpxchg_1(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
460# endif
461# ifndef this_cpu_cmpxchg_2
462# define this_cpu_cmpxchg_2(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
463# endif
464# ifndef this_cpu_cmpxchg_4
465# define this_cpu_cmpxchg_4(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
466# endif
467# ifndef this_cpu_cmpxchg_8
468# define this_cpu_cmpxchg_8(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
469# endif
470# define this_cpu_cmpxchg(pcp, oval, nval) \
471 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
472#endif
473
474/*
475 * cmpxchg_double replaces two adjacent scalars at once. The first
476 * two parameters are per cpu variables which have to be of the same
477 * size. A truth value is returned to indicate success or failure
478 * (since a double register result is difficult to handle). There is
479 * very limited hardware support for these operations, so only certain
480 * sizes may work.
481 */
482#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
483({ \
484 int ret__; \
485 unsigned long flags; \
486 raw_local_irq_save(flags); \
487 ret__ = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
488 oval1, oval2, nval1, nval2); \
489 raw_local_irq_restore(flags); \
490 ret__; \
491})
492
493#ifndef this_cpu_cmpxchg_double
494# ifndef this_cpu_cmpxchg_double_1
495# define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
496 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
497# endif
498# ifndef this_cpu_cmpxchg_double_2
499# define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
500 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
501# endif
502# ifndef this_cpu_cmpxchg_double_4
503# define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
504 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
505# endif
506# ifndef this_cpu_cmpxchg_double_8
507# define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
508 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
509# endif
510# define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
511 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
512#endif
513
514/*
515 * Generic percpu operations for contexts where we do not want to do
516 * any checks for preemptiosn.
517 *
518 * If there is no other protection through preempt disable and/or
519 * disabling interupts then one of these RMW operations can show unexpected
520 * behavior because the execution thread was rescheduled on another processor
521 * or an interrupt occurred and the same percpu variable was modified from
522 * the interrupt context.
523 */
524#ifndef raw_cpu_read
525# ifndef raw_cpu_read_1
526# define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
527# endif
528# ifndef raw_cpu_read_2
529# define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
530# endif
531# ifndef raw_cpu_read_4
532# define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
533# endif
534# ifndef raw_cpu_read_8
535# define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
536# endif
537# define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, (pcp))
538#endif
539
540#define raw_cpu_generic_to_op(pcp, val, op) \
541do { \
542 *raw_cpu_ptr(&(pcp)) op val; \
543} while (0)
544
545
546#ifndef raw_cpu_write
547# ifndef raw_cpu_write_1
548# define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
549# endif
550# ifndef raw_cpu_write_2
551# define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
552# endif
553# ifndef raw_cpu_write_4
554# define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
555# endif
556# ifndef raw_cpu_write_8
557# define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
558# endif
559# define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, (pcp), (val))
560#endif
561
562#ifndef raw_cpu_add
563# ifndef raw_cpu_add_1
564# define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
565# endif
566# ifndef raw_cpu_add_2
567# define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
568# endif
569# ifndef raw_cpu_add_4
570# define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
571# endif
572# ifndef raw_cpu_add_8
573# define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
574# endif
575# define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, (pcp), (val))
576#endif
577
578#ifndef raw_cpu_sub
579# define raw_cpu_sub(pcp, val) raw_cpu_add((pcp), -(val))
580#endif
581
582#ifndef raw_cpu_inc
583# define raw_cpu_inc(pcp) raw_cpu_add((pcp), 1)
584#endif
585
586#ifndef raw_cpu_dec
587# define raw_cpu_dec(pcp) raw_cpu_sub((pcp), 1)
588#endif
589
590#ifndef raw_cpu_and
591# ifndef raw_cpu_and_1
592# define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
593# endif
594# ifndef raw_cpu_and_2
595# define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
596# endif
597# ifndef raw_cpu_and_4
598# define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
599# endif
600# ifndef raw_cpu_and_8
601# define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
602# endif
603# define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, (pcp), (val))
604#endif
605
606#ifndef raw_cpu_or
607# ifndef raw_cpu_or_1
608# define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
609# endif
610# ifndef raw_cpu_or_2
611# define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
612# endif
613# ifndef raw_cpu_or_4
614# define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
615# endif
616# ifndef raw_cpu_or_8
617# define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
618# endif
619# define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, (pcp), (val))
620#endif
621
622#define raw_cpu_generic_add_return(pcp, val) \
623({ \
624 raw_cpu_add(pcp, val); \
625 raw_cpu_read(pcp); \
626})
627
628#ifndef raw_cpu_add_return
629# ifndef raw_cpu_add_return_1
630# define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
631# endif
632# ifndef raw_cpu_add_return_2
633# define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
634# endif
635# ifndef raw_cpu_add_return_4
636# define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
637# endif
638# ifndef raw_cpu_add_return_8
639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
640# endif
641# define raw_cpu_add_return(pcp, val) \
642 __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
643#endif
644
645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
646#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
647#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
648
649#define raw_cpu_generic_xchg(pcp, nval) \
650({ typeof(pcp) ret__; \
651 ret__ = raw_cpu_read(pcp); \
652 raw_cpu_write(pcp, nval); \
653 ret__; \
654})
655
656#ifndef raw_cpu_xchg
657# ifndef raw_cpu_xchg_1
658# define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
659# endif
660# ifndef raw_cpu_xchg_2
661# define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
662# endif
663# ifndef raw_cpu_xchg_4
664# define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
665# endif
666# ifndef raw_cpu_xchg_8
667# define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
668# endif
669# define raw_cpu_xchg(pcp, nval) \
670 __pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval)
671#endif
672
673#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
674({ \
675 typeof(pcp) ret__; \
676 ret__ = raw_cpu_read(pcp); \
677 if (ret__ == (oval)) \
678 raw_cpu_write(pcp, nval); \
679 ret__; \
680})
681
682#ifndef raw_cpu_cmpxchg
683# ifndef raw_cpu_cmpxchg_1
684# define raw_cpu_cmpxchg_1(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
685# endif
686# ifndef raw_cpu_cmpxchg_2
687# define raw_cpu_cmpxchg_2(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
688# endif
689# ifndef raw_cpu_cmpxchg_4
690# define raw_cpu_cmpxchg_4(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
691# endif
692# ifndef raw_cpu_cmpxchg_8
693# define raw_cpu_cmpxchg_8(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
694# endif
695# define raw_cpu_cmpxchg(pcp, oval, nval) \
696 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
697#endif
698
699#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
700({ \
701 int __ret = 0; \
702 if (raw_cpu_read(pcp1) == (oval1) && \
703 raw_cpu_read(pcp2) == (oval2)) { \
704 raw_cpu_write(pcp1, (nval1)); \
705 raw_cpu_write(pcp2, (nval2)); \
706 __ret = 1; \
707 } \
708 (__ret); \
709})
710
711#ifndef raw_cpu_cmpxchg_double
712# ifndef raw_cpu_cmpxchg_double_1
713# define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
714 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
715# endif
716# ifndef raw_cpu_cmpxchg_double_2
717# define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
718 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
719# endif
720# ifndef raw_cpu_cmpxchg_double_4
721# define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
722 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
723# endif
724# ifndef raw_cpu_cmpxchg_double_8
725# define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
726 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
727# endif
728# define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
729 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
730#endif
731
732/*
733 * Generic percpu operations for context that are safe from preemption/interrupts.
734 */
735#ifndef __this_cpu_read
736# define __this_cpu_read(pcp) \
737 (__this_cpu_preempt_check("read"),__pcpu_size_call_return(raw_cpu_read_, (pcp)))
738#endif
739
740#ifndef __this_cpu_write
741# define __this_cpu_write(pcp, val) \
742do { __this_cpu_preempt_check("write"); \
743 __pcpu_size_call(raw_cpu_write_, (pcp), (val)); \
744} while (0)
745#endif
746
747#ifndef __this_cpu_add
748# define __this_cpu_add(pcp, val) \
749do { __this_cpu_preempt_check("add"); \
750 __pcpu_size_call(raw_cpu_add_, (pcp), (val)); \
751} while (0)
752#endif
753
754#ifndef __this_cpu_sub
755# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
756#endif
757
758#ifndef __this_cpu_inc
759# define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1)
760#endif
761
762#ifndef __this_cpu_dec
763# define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1)
764#endif
765
766#ifndef __this_cpu_and
767# define __this_cpu_and(pcp, val) \
768do { __this_cpu_preempt_check("and"); \
769 __pcpu_size_call(raw_cpu_and_, (pcp), (val)); \
770} while (0)
771
772#endif
773
774#ifndef __this_cpu_or
775# define __this_cpu_or(pcp, val) \
776do { __this_cpu_preempt_check("or"); \
777 __pcpu_size_call(raw_cpu_or_, (pcp), (val)); \
778} while (0)
779#endif
780
781#ifndef __this_cpu_add_return
782# define __this_cpu_add_return(pcp, val) \
783 (__this_cpu_preempt_check("add_return"),__pcpu_size_call_return2(raw_cpu_add_return_, pcp, val))
784#endif
785
786#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
787#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
788#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
789
790#ifndef __this_cpu_xchg
791# define __this_cpu_xchg(pcp, nval) \
792 (__this_cpu_preempt_check("xchg"),__pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval))
793#endif
794
795#ifndef __this_cpu_cmpxchg
796# define __this_cpu_cmpxchg(pcp, oval, nval) \
797 (__this_cpu_preempt_check("cmpxchg"),__pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval))
798#endif
799
800#ifndef __this_cpu_cmpxchg_double
801# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
802 (__this_cpu_preempt_check("cmpxchg_double"),__pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)))
803#endif
804
805#endif /* __LINUX_PERCPU_H */ 132#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 68041446c450..ed39956b5613 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -545,6 +545,24 @@ struct phy_driver {
545 */ 545 */
546 void (*link_change_notify)(struct phy_device *dev); 546 void (*link_change_notify)(struct phy_device *dev);
547 547
548 /* A function provided by a phy specific driver to override the
549 * the PHY driver framework support for reading a MMD register
550 * from the PHY. If not supported, return -1. This function is
551 * optional for PHY specific drivers, if not provided then the
552 * default MMD read function is used by the PHY framework.
553 */
554 int (*read_mmd_indirect)(struct phy_device *dev, int ptrad,
555 int devnum, int regnum);
556
557 /* A function provided by a phy specific driver to override the
558 * the PHY driver framework support for writing a MMD register
559 * from the PHY. This function is optional for PHY specific drivers,
560 * if not provided then the default MMD read function is used by
561 * the PHY framework.
562 */
563 void (*write_mmd_indirect)(struct phy_device *dev, int ptrad,
564 int devnum, int regnum, u32 val);
565
548 struct device_driver driver; 566 struct device_driver driver;
549}; 567};
550#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 568#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
diff --git a/include/linux/phy/omap_control_phy.h b/include/linux/phy/omap_control_phy.h
index 5450403c7546..e9e6cfbfbb58 100644
--- a/include/linux/phy/omap_control_phy.h
+++ b/include/linux/phy/omap_control_phy.h
@@ -23,6 +23,7 @@ enum omap_control_phy_type {
23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ 23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ 24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ 25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
26 OMAP_CTRL_TYPE_PCIE, /* RX TX control of ACSPCIE */
26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */ 27 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ 28 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
28}; 29};
@@ -33,6 +34,7 @@ struct omap_control_phy {
33 u32 __iomem *otghs_control; 34 u32 __iomem *otghs_control;
34 u32 __iomem *power; 35 u32 __iomem *power;
35 u32 __iomem *power_aux; 36 u32 __iomem *power_aux;
37 u32 __iomem *pcie_pcs;
36 38
37 struct clk *sys_clk; 39 struct clk *sys_clk;
38 40
@@ -63,6 +65,9 @@ enum omap_control_usb_mode {
63#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3 65#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0 66#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
65 67
68#define OMAP_CTRL_PCIE_PCS_MASK 0xff
69#define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 0x8
70
66#define OMAP_CTRL_USB2_PHY_PD BIT(28) 71#define OMAP_CTRL_USB2_PHY_PD BIT(28)
67 72
68#define AM437X_CTRL_USB2_PHY_PD BIT(0) 73#define AM437X_CTRL_USB2_PHY_PD BIT(0)
@@ -74,6 +79,7 @@ enum omap_control_usb_mode {
74void omap_control_phy_power(struct device *dev, int on); 79void omap_control_phy_power(struct device *dev, int on);
75void omap_control_usb_set_mode(struct device *dev, 80void omap_control_usb_set_mode(struct device *dev,
76 enum omap_control_usb_mode mode); 81 enum omap_control_usb_mode mode);
82void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay);
77#else 83#else
78 84
79static inline void omap_control_phy_power(struct device *dev, int on) 85static inline void omap_control_phy_power(struct device *dev, int on)
@@ -84,6 +90,10 @@ static inline void omap_control_usb_set_mode(struct device *dev,
84 enum omap_control_usb_mode mode) 90 enum omap_control_usb_mode mode)
85{ 91{
86} 92}
93
94static inline void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay)
95{
96}
87#endif 97#endif
88 98
89#endif /* __OMAP_CONTROL_PHY_H__ */ 99#endif /* __OMAP_CONTROL_PHY_H__ */
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 2760744cb2a7..8cb6f815475b 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -18,6 +18,7 @@
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/pm_runtime.h> 20#include <linux/pm_runtime.h>
21#include <linux/regulator/consumer.h>
21 22
22struct phy; 23struct phy;
23 24
@@ -65,6 +66,7 @@ struct phy {
65 int init_count; 66 int init_count;
66 int power_count; 67 int power_count;
67 struct phy_attrs attrs; 68 struct phy_attrs attrs;
69 struct regulator *pwr;
68}; 70};
69 71
70/** 72/**
@@ -156,9 +158,10 @@ void devm_phy_put(struct device *dev, struct phy *phy);
156struct phy *of_phy_get(struct device_node *np, const char *con_id); 158struct phy *of_phy_get(struct device_node *np, const char *con_id);
157struct phy *of_phy_simple_xlate(struct device *dev, 159struct phy *of_phy_simple_xlate(struct device *dev,
158 struct of_phandle_args *args); 160 struct of_phandle_args *args);
159struct phy *phy_create(struct device *dev, const struct phy_ops *ops, 161struct phy *phy_create(struct device *dev, struct device_node *node,
160 struct phy_init_data *init_data); 162 const struct phy_ops *ops,
161struct phy *devm_phy_create(struct device *dev, 163 struct phy_init_data *init_data);
164struct phy *devm_phy_create(struct device *dev, struct device_node *node,
162 const struct phy_ops *ops, struct phy_init_data *init_data); 165 const struct phy_ops *ops, struct phy_init_data *init_data);
163void phy_destroy(struct phy *phy); 166void phy_destroy(struct phy *phy);
164void devm_phy_destroy(struct device *dev, struct phy *phy); 167void devm_phy_destroy(struct device *dev, struct phy *phy);
@@ -297,13 +300,17 @@ static inline struct phy *of_phy_simple_xlate(struct device *dev,
297} 300}
298 301
299static inline struct phy *phy_create(struct device *dev, 302static inline struct phy *phy_create(struct device *dev,
300 const struct phy_ops *ops, struct phy_init_data *init_data) 303 struct device_node *node,
304 const struct phy_ops *ops,
305 struct phy_init_data *init_data)
301{ 306{
302 return ERR_PTR(-ENOSYS); 307 return ERR_PTR(-ENOSYS);
303} 308}
304 309
305static inline struct phy *devm_phy_create(struct device *dev, 310static inline struct phy *devm_phy_create(struct device *dev,
306 const struct phy_ops *ops, struct phy_init_data *init_data) 311 struct device_node *node,
312 const struct phy_ops *ops,
313 struct phy_init_data *init_data)
307{ 314{
308 return ERR_PTR(-ENOSYS); 315 return ERR_PTR(-ENOSYS);
309} 316}
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 7246ef3d4455..1997ffc295a7 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -33,6 +33,7 @@ struct pid_namespace {
33#ifdef CONFIG_PROC_FS 33#ifdef CONFIG_PROC_FS
34 struct vfsmount *proc_mnt; 34 struct vfsmount *proc_mnt;
35 struct dentry *proc_self; 35 struct dentry *proc_self;
36 struct dentry *proc_thread_self;
36#endif 37#endif
37#ifdef CONFIG_BSD_PROCESS_ACCT 38#ifdef CONFIG_BSD_PROCESS_ACCT
38 struct bsd_acct_struct *bacct; 39 struct bsd_acct_struct *bacct;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index c15395031cb3..3097aafbeb24 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -70,8 +70,6 @@ struct pinmux_ops {
70 unsigned * const num_groups); 70 unsigned * const num_groups);
71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector, 71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector,
72 unsigned group_selector); 72 unsigned group_selector);
73 void (*disable) (struct pinctrl_dev *pctldev, unsigned func_selector,
74 unsigned group_selector);
75 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
76 struct pinctrl_gpio_range *range, 74 struct pinctrl_gpio_range *range,
77 unsigned offset); 75 unsigned offset);
diff --git a/include/linux/platform_data/ad7291.h b/include/linux/platform_data/ad7291.h
new file mode 100644
index 000000000000..bbd89fa51188
--- /dev/null
+++ b/include/linux/platform_data/ad7291.h
@@ -0,0 +1,12 @@
1#ifndef __IIO_AD7291_H__
2#define __IIO_AD7291_H__
3
4/**
5 * struct ad7291_platform_data - AD7291 platform data
6 * @use_external_ref: Whether to use an external or internal reference voltage
7 */
8struct ad7291_platform_data {
9 bool use_external_ref;
10};
11
12#endif
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index 709c6f7e2f8c..a6591c693ebb 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -15,15 +15,6 @@
15#define S3C64XX_AC97_GPE 1 15#define S3C64XX_AC97_GPE 1
16extern void s3c64xx_ac97_setup_gpio(int); 16extern void s3c64xx_ac97_setup_gpio(int);
17 17
18/*
19 * The machine init code calls s5p*_spdif_setup_gpio with
20 * one of these defines in order to select appropriate bank
21 * of GPIO for S/PDIF pins
22 */
23#define S5PC100_SPDIF_GPD 0
24#define S5PC100_SPDIF_GPG3 1
25extern void s5pc100_spdif_setup_gpio(int);
26
27struct samsung_i2s { 18struct samsung_i2s {
28/* If the Primary DAI has 5.1 Channels */ 19/* If the Primary DAI has 5.1 Channels */
29#define QUIRK_PRI_6CHAN (1 << 0) 20#define QUIRK_PRI_6CHAN (1 << 0)
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h
index c2049e3d7444..748e71642c4a 100644
--- a/include/linux/platform_data/ata-samsung_cf.h
+++ b/include/linux/platform_data/ata-samsung_cf.h
@@ -29,7 +29,6 @@ extern void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata);
29 29
30/* architecture-specific IDE configuration */ 30/* architecture-specific IDE configuration */
31extern void s3c64xx_ide_setup_gpio(void); 31extern void s3c64xx_ide_setup_gpio(void);
32extern void s5pc100_ide_setup_gpio(void);
33extern void s5pv210_ide_setup_gpio(void); 32extern void s5pv210_ide_setup_gpio(void);
34 33
35#endif /*__ATA_SAMSUNG_CF_H */ 34#endif /*__ATA_SAMSUNG_CF_H */
diff --git a/include/linux/platform_data/camera-mx1.h b/include/linux/platform_data/camera-mx1.h
deleted file mode 100644
index 4fd6c70314b4..000000000000
--- a/include/linux/platform_data/camera-mx1.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * mx1_camera.h - i.MX1/i.MXL camera driver header file
3 *
4 * Copyright (c) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
6 *
7 * Based on PXA camera.h file:
8 * Copyright (C) 2003, Intel Corporation
9 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_CAMERA_H_
17#define __ASM_ARCH_CAMERA_H_
18
19#define MX1_CAMERA_DATA_HIGH 1
20#define MX1_CAMERA_PCLK_RISING 2
21#define MX1_CAMERA_VSYNC_HIGH 4
22
23extern unsigned char mx1_camera_sof_fiq_start, mx1_camera_sof_fiq_end;
24
25/**
26 * struct mx1_camera_pdata - i.MX1/i.MXL camera platform data
27 * @mclk_10khz: master clock frequency in 10kHz units
28 * @flags: MX1 camera platform flags
29 */
30struct mx1_camera_pdata {
31 unsigned long mclk_10khz;
32 unsigned long flags;
33};
34
35#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index bcbc6c3c14c0..6a1357d31871 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -40,6 +40,7 @@ enum sdma_peripheral_type {
40 IMX_DMATYPE_ASRC, /* ASRC */ 40 IMX_DMATYPE_ASRC, /* ASRC */
41 IMX_DMATYPE_ESAI, /* ESAI */ 41 IMX_DMATYPE_ESAI, /* ESAI */
42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */ 42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
43 IMX_DMATYPE_ASRC_SP, /* Shared ASRC */
43}; 44};
44 45
45enum imx_dma_prio { 46enum imx_dma_prio {
@@ -50,6 +51,7 @@ enum imx_dma_prio {
50 51
51struct imx_dma_data { 52struct imx_dma_data {
52 int dma_request; /* DMA request line */ 53 int dma_request; /* DMA request line */
54 int dma_request2; /* secondary DMA request line */
53 enum sdma_peripheral_type peripheral_type; 55 enum sdma_peripheral_type peripheral_type;
54 int priority; 56 int priority;
55}; 57};
diff --git a/include/linux/platform_data/dsp-omap.h b/include/linux/platform_data/dsp-omap.h
deleted file mode 100644
index 5927709b1908..000000000000
--- a/include/linux/platform_data/dsp-omap.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef __OMAP_DSP_H__
2#define __OMAP_DSP_H__
3
4#include <linux/types.h>
5
6struct omap_dsp_platform_data {
7 void (*dsp_set_min_opp) (u8 opp_id);
8 u8 (*dsp_get_opp) (void);
9 void (*cpu_set_freq) (unsigned long f);
10 unsigned long (*cpu_get_freq) (void);
11 unsigned long mpu_speed[6];
12
13 /* functions to write and read PRCM registers */
14 void (*dsp_prm_write)(u32, s16 , u16);
15 u32 (*dsp_prm_read)(s16 , u16);
16 u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16);
17 void (*dsp_cm_write)(u32, s16 , u16);
18 u32 (*dsp_cm_read)(s16 , u16);
19 u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16);
20
21 void (*set_bootaddr)(u32);
22 void (*set_bootmode)(u8);
23
24 phys_addr_t phys_mempool_base;
25 phys_addr_t phys_mempool_size;
26};
27
28#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
29extern void omap_dsp_reserve_sdram_memblock(void);
30#else
31static inline void omap_dsp_reserve_sdram_memblock(void) { }
32#endif
33
34#endif
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index eb8d5627d080..bdb2710e2aab 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -150,6 +150,8 @@ void edma_clear_event(unsigned channel);
150void edma_pause(unsigned channel); 150void edma_pause(unsigned channel);
151void edma_resume(unsigned channel); 151void edma_resume(unsigned channel);
152 152
153void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no);
154
153struct edma_rsv_info { 155struct edma_rsv_info {
154 156
155 const s16 (*rsv_chans)[2]; 157 const s16 (*rsv_chans)[2];
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h
index 5b429c43a297..54a0a9582fad 100644
--- a/include/linux/platform_data/iommu-omap.h
+++ b/include/linux/platform_data/iommu-omap.h
@@ -31,14 +31,10 @@ struct omap_iommu_arch_data {
31 31
32/** 32/**
33 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod 33 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod
34 * @da_start: device address where the va space starts.
35 * @da_end: device address where the va space ends.
36 * @nr_tlb_entries: number of entries supported by the translation 34 * @nr_tlb_entries: number of entries supported by the translation
37 * look-aside buffer (TLB). 35 * look-aside buffer (TLB).
38 */ 36 */
39struct omap_mmu_dev_attr { 37struct omap_mmu_dev_attr {
40 u32 da_start;
41 u32 da_end;
42 int nr_tlb_entries; 38 int nr_tlb_entries;
43}; 39};
44 40
@@ -46,8 +42,6 @@ struct iommu_platform_data {
46 const char *name; 42 const char *name;
47 const char *reset_name; 43 const char *reset_name;
48 int nr_tlb_entries; 44 int nr_tlb_entries;
49 u32 da_start;
50 u32 da_end;
51 45
52 int (*assert_reset)(struct platform_device *pdev, const char *name); 46 int (*assert_reset)(struct platform_device *pdev, const char *name);
53 int (*deassert_reset)(struct platform_device *pdev, const char *name); 47 int (*deassert_reset)(struct platform_device *pdev, const char *name);
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
index 2bf1b30cb5dc..51e70cf25cbc 100644
--- a/include/linux/platform_data/mmc-omap.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -28,6 +28,7 @@
28 */ 28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) 29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1) 30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
31 32
32struct mmc_card; 33struct mmc_card;
33 34
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
index c7285b575462..0a6de4ca4930 100644
--- a/include/linux/platform_data/ntc_thermistor.h
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -26,6 +26,7 @@ struct iio_channel;
26enum ntc_thermistor_type { 26enum ntc_thermistor_type {
27 TYPE_NCPXXWB473, 27 TYPE_NCPXXWB473,
28 TYPE_NCPXXWL333, 28 TYPE_NCPXXWL333,
29 TYPE_B57330V2103,
29}; 30};
30 31
31struct ntc_thermistor_platform_data { 32struct ntc_thermistor_platform_data {
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
new file mode 100644
index 000000000000..2d11f1f5efab
--- /dev/null
+++ b/include/linux/platform_data/st21nfcb.h
@@ -0,0 +1,32 @@
1/*
2 * Driver include for the ST21NFCB NFC chip.
3 *
4 * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef _ST21NFCB_NCI_H_
20#define _ST21NFCB_NCI_H_
21
22#include <linux/i2c.h>
23
24#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci"
25
26struct st21nfcb_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_reset;
29 unsigned int irq_polarity;
30};
31
32#endif /* _ST21NFCA_HCI_H_ */
diff --git a/include/linux/platform_data/usb-ehci-mxc.h b/include/linux/platform_data/usb-ehci-mxc.h
index 7eb9d1329671..157e71f79f99 100644
--- a/include/linux/platform_data/usb-ehci-mxc.h
+++ b/include/linux/platform_data/usb-ehci-mxc.h
@@ -1,46 +1,6 @@
1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H 1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H
2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H 2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H
3 3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
24#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
25#define MXC_EHCI_TTL_ENABLED (1 << 8)
26
27#define MXC_EHCI_INTERNAL_PHY (1 << 9)
28#define MXC_EHCI_IPPUE_DOWN (1 << 10)
29#define MXC_EHCI_IPPUE_UP (1 << 11)
30#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
31#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
32
33#define MXC_USBCTRL_OFFSET 0
34#define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8
35#define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc
36#define MXC_USBH2CTRL_OFFSET 0x14
37
38#define MX5_USBOTHER_REGS_OFFSET 0x800
39
40/* USB_PHY_CTRL_FUNC2*/
41#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK 0x3
42#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_SHIFT 0
43
44struct mxc_usbh_platform_data { 4struct mxc_usbh_platform_data {
45 int (*init)(struct platform_device *pdev); 5 int (*init)(struct platform_device *pdev);
46 int (*exit)(struct platform_device *pdev); 6 int (*exit)(struct platform_device *pdev);
@@ -49,11 +9,5 @@ struct mxc_usbh_platform_data {
49 struct usb_phy *otg; 9 struct usb_phy *otg;
50}; 10};
51 11
52int mx51_initialize_usb_hw(int port, unsigned int flags);
53int mx25_initialize_usb_hw(int port, unsigned int flags);
54int mx31_initialize_usb_hw(int port, unsigned int flags);
55int mx35_initialize_usb_hw(int port, unsigned int flags);
56int mx27_initialize_usb_hw(int port, unsigned int flags);
57
58#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */ 12#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */
59 13
diff --git a/include/linux/platform_data/usb-imx_udc.h b/include/linux/platform_data/usb-imx_udc.h
deleted file mode 100644
index be273371f34a..000000000000
--- a/include/linux/platform_data/usb-imx_udc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MXC_USB
16#define __ASM_ARCH_MXC_USB
17
18struct imxusb_platform_data {
19 int (*init)(struct device *);
20 void (*exit)(struct device *);
21};
22
23#endif /* __ASM_ARCH_MXC_USB */
diff --git a/include/linux/platform_data/video-clcd-versatile.h b/include/linux/platform_data/video-clcd-versatile.h
new file mode 100644
index 000000000000..09ccf182af4d
--- /dev/null
+++ b/include/linux/platform_data/video-clcd-versatile.h
@@ -0,0 +1,27 @@
1#ifndef PLAT_CLCD_H
2#define PLAT_CLCD_H
3
4#ifdef CONFIG_PLAT_VERSATILE_CLCD
5struct clcd_panel *versatile_clcd_get_panel(const char *);
6int versatile_clcd_setup_dma(struct clcd_fb *, unsigned long);
7int versatile_clcd_mmap_dma(struct clcd_fb *, struct vm_area_struct *);
8void versatile_clcd_remove_dma(struct clcd_fb *);
9#else
10static inline struct clcd_panel *versatile_clcd_get_panel(const char *s)
11{
12 return NULL;
13}
14static inline int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
15{
16 return -ENODEV;
17}
18static inline int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vm)
19{
20 return -ENODEV;
21}
22static inline void versatile_clcd_remove_dma(struct clcd_fb *fb)
23{
24}
25#endif
26
27#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 16f6654082dd..153d303af7eb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -28,6 +28,7 @@ struct platform_device {
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 char *driver_override; /* Driver name to force a match */
31 32
32 /* MFD cell pointer */ 33 /* MFD cell pointer */
33 struct mfd_cell *mfd_cell; 34 struct mfd_cell *mfd_cell;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 43fd6716f662..367f49b9a1c9 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -24,11 +24,20 @@
24#define RPM_AUTO 0x08 /* Use autosuspend_delay */ 24#define RPM_AUTO 0x08 /* Use autosuspend_delay */
25 25
26#ifdef CONFIG_PM 26#ifdef CONFIG_PM
27extern struct workqueue_struct *pm_wq;
28
29static inline bool queue_pm_work(struct work_struct *work)
30{
31 return queue_work(pm_wq, work);
32}
33
27extern int pm_generic_runtime_suspend(struct device *dev); 34extern int pm_generic_runtime_suspend(struct device *dev);
28extern int pm_generic_runtime_resume(struct device *dev); 35extern int pm_generic_runtime_resume(struct device *dev);
29extern int pm_runtime_force_suspend(struct device *dev); 36extern int pm_runtime_force_suspend(struct device *dev);
30extern int pm_runtime_force_resume(struct device *dev); 37extern int pm_runtime_force_resume(struct device *dev);
31#else 38#else
39static inline bool queue_pm_work(struct work_struct *work) { return false; }
40
32static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 41static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
33static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 42static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
34static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } 43static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
@@ -37,8 +46,6 @@ static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
37 46
38#ifdef CONFIG_PM_RUNTIME 47#ifdef CONFIG_PM_RUNTIME
39 48
40extern struct workqueue_struct *pm_wq;
41
42extern int __pm_runtime_idle(struct device *dev, int rpmflags); 49extern int __pm_runtime_idle(struct device *dev, int rpmflags);
43extern int __pm_runtime_suspend(struct device *dev, int rpmflags); 50extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
44extern int __pm_runtime_resume(struct device *dev, int rpmflags); 51extern int __pm_runtime_resume(struct device *dev, int rpmflags);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f2b76aeaf4e4..f3dea41dbcd2 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -120,6 +120,7 @@ enum power_supply_property {
120 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, 120 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
121 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, 121 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
122 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, 122 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
123 POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
123 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 124 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
124 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 125 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
125 POWER_SUPPLY_PROP_ENERGY_FULL, 126 POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -131,6 +132,8 @@ enum power_supply_property {
131 POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */ 132 POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */
132 POWER_SUPPLY_PROP_CAPACITY_LEVEL, 133 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
133 POWER_SUPPLY_PROP_TEMP, 134 POWER_SUPPLY_PROP_TEMP,
135 POWER_SUPPLY_PROP_TEMP_MAX,
136 POWER_SUPPLY_PROP_TEMP_MIN,
134 POWER_SUPPLY_PROP_TEMP_ALERT_MIN, 137 POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
135 POWER_SUPPLY_PROP_TEMP_ALERT_MAX, 138 POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
136 POWER_SUPPLY_PROP_TEMP_AMBIENT, 139 POWER_SUPPLY_PROP_TEMP_AMBIENT,
@@ -142,6 +145,7 @@ enum power_supply_property {
142 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 145 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
143 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
144 POWER_SUPPLY_PROP_SCOPE, 147 POWER_SUPPLY_PROP_SCOPE,
148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
145 /* Properties of type `const char *' */ 149 /* Properties of type `const char *' */
146 POWER_SUPPLY_PROP_MODEL_NAME, 150 POWER_SUPPLY_PROP_MODEL_NAME,
147 POWER_SUPPLY_PROP_MANUFACTURER, 151 POWER_SUPPLY_PROP_MANUFACTURER,
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 319ff7e53efb..d78125f73ac4 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -10,6 +10,9 @@
10extern const char linux_banner[]; 10extern const char linux_banner[];
11extern const char linux_proc_banner[]; 11extern const char linux_proc_banner[];
12 12
13extern char *log_buf_addr_get(void);
14extern u32 log_buf_len_get(void);
15
13static inline int printk_get_level(const char *buffer) 16static inline int printk_get_level(const char *buffer)
14{ 17{
15 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) { 18 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
@@ -31,7 +34,7 @@ static inline const char *printk_skip_level(const char *buffer)
31} 34}
32 35
33/* printk's without a loglevel use this.. */ 36/* printk's without a loglevel use this.. */
34#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL 37#define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT
35 38
36/* We show everything that is MORE important than this.. */ 39/* We show everything that is MORE important than this.. */
37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ 40#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
index 7dfed71d76a6..159c987b1853 100644
--- a/include/linux/ptp_classify.h
+++ b/include/linux/ptp_classify.h
@@ -33,8 +33,8 @@
33#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */ 33#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */
34#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */ 34#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */
35#define PTP_CLASS_L2 0x30 /* event in a L2 packet */ 35#define PTP_CLASS_L2 0x30 /* event in a L2 packet */
36#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged L2 packet */ 36#define PTP_CLASS_PMASK 0x30 /* mask for the packet type field */
37#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ 37#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged packet */
38 38
39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) 39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
40#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */ 40#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */
@@ -54,7 +54,6 @@
54#define IP6_HLEN 40 54#define IP6_HLEN 40
55#define UDP_HLEN 8 55#define UDP_HLEN 8
56#define OFF_IHL 14 56#define OFF_IHL 14
57#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
58#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) 57#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2)
59 58
60#if defined(CONFIG_NET_PTP_CLASSIFY) 59#if defined(CONFIG_NET_PTP_CLASSIFY)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 0f3c5d38da1f..80d345a3524c 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -390,7 +390,6 @@ struct quota_info {
390 unsigned int flags; /* Flags for diskquotas on this device */ 390 unsigned int flags; /* Flags for diskquotas on this device */
391 struct mutex dqio_mutex; /* lock device while I/O in progress */ 391 struct mutex dqio_mutex; /* lock device while I/O in progress */
392 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */ 392 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
393 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
394 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 393 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
395 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 394 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
396 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 395 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
diff --git a/include/linux/ras.h b/include/linux/ras.h
new file mode 100644
index 000000000000..2aceeafd6fe5
--- /dev/null
+++ b/include/linux/ras.h
@@ -0,0 +1,14 @@
1#ifndef __RAS_H__
2#define __RAS_H__
3
4#ifdef CONFIG_DEBUG_FS
5int ras_userspace_consumers(void);
6void ras_debugfs_init(void);
7int ras_add_daemon_trace(void);
8#else
9static inline int ras_userspace_consumers(void) { return 0; }
10static inline void ras_debugfs_init(void) { return; }
11static inline int ras_add_daemon_trace(void) { return 0; }
12#endif
13
14#endif
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 8183b46fbaa2..372ad5e0dcb8 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
432} 432}
433 433
434/** 434/**
435 * hlist_add_after_rcu 435 * hlist_add_behind_rcu
436 * @prev: the existing element to add the new element after.
437 * @n: the new element to add to the hash list. 436 * @n: the new element to add to the hash list.
437 * @prev: the existing element to add the new element after.
438 * 438 *
439 * Description: 439 * Description:
440 * Adds the specified element to the specified hlist 440 * Adds the specified element to the specified hlist
@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency 449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
450 * problems on Alpha CPUs. 450 * problems on Alpha CPUs.
451 */ 451 */
452static inline void hlist_add_after_rcu(struct hlist_node *prev, 452static inline void hlist_add_behind_rcu(struct hlist_node *n,
453 struct hlist_node *n) 453 struct hlist_node *prev)
454{ 454{
455 n->next = prev->next; 455 n->next = prev->next;
456 n->pprev = &prev->next; 456 n->pprev = &prev->next;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 5a75d19aa661..d231aa17b1d7 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -44,7 +44,6 @@
44#include <linux/debugobjects.h> 44#include <linux/debugobjects.h>
45#include <linux/bug.h> 45#include <linux/bug.h>
46#include <linux/compiler.h> 46#include <linux/compiler.h>
47#include <linux/percpu.h>
48#include <asm/barrier.h> 47#include <asm/barrier.h>
49 48
50extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
@@ -300,41 +299,6 @@ bool __rcu_is_watching(void);
300#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 299#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
301 300
302/* 301/*
303 * Hooks for cond_resched() and friends to avoid RCU CPU stall warnings.
304 */
305
306#define RCU_COND_RESCHED_LIM 256 /* ms vs. 100s of ms. */
307DECLARE_PER_CPU(int, rcu_cond_resched_count);
308void rcu_resched(void);
309
310/*
311 * Is it time to report RCU quiescent states?
312 *
313 * Note unsynchronized access to rcu_cond_resched_count. Yes, we might
314 * increment some random CPU's count, and possibly also load the result from
315 * yet another CPU's count. We might even clobber some other CPU's attempt
316 * to zero its counter. This is all OK because the goal is not precision,
317 * but rather reasonable amortization of rcu_note_context_switch() overhead
318 * and extremely high probability of avoiding RCU CPU stall warnings.
319 * Note that this function has to be preempted in just the wrong place,
320 * many thousands of times in a row, for anything bad to happen.
321 */
322static inline bool rcu_should_resched(void)
323{
324 return raw_cpu_inc_return(rcu_cond_resched_count) >=
325 RCU_COND_RESCHED_LIM;
326}
327
328/*
329 * Report quiscent states to RCU if it is time to do so.
330 */
331static inline void rcu_cond_resched(void)
332{
333 if (unlikely(rcu_should_resched()))
334 rcu_resched();
335}
336
337/*
338 * Infrastructure to implement the synchronize_() primitives in 302 * Infrastructure to implement the synchronize_() primitives in
339 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 303 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
340 */ 304 */
@@ -358,9 +322,19 @@ void wait_rcu_gp(call_rcu_func_t crf);
358 * initialization. 322 * initialization.
359 */ 323 */
360#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD 324#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
325void init_rcu_head(struct rcu_head *head);
326void destroy_rcu_head(struct rcu_head *head);
361void init_rcu_head_on_stack(struct rcu_head *head); 327void init_rcu_head_on_stack(struct rcu_head *head);
362void destroy_rcu_head_on_stack(struct rcu_head *head); 328void destroy_rcu_head_on_stack(struct rcu_head *head);
363#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 329#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
330static inline void init_rcu_head(struct rcu_head *head)
331{
332}
333
334static inline void destroy_rcu_head(struct rcu_head *head)
335{
336}
337
364static inline void init_rcu_head_on_stack(struct rcu_head *head) 338static inline void init_rcu_head_on_stack(struct rcu_head *head)
365{ 339{
366} 340}
@@ -852,15 +826,14 @@ static inline void rcu_preempt_sleep_check(void)
852 * read-side critical section that would block in a !PREEMPT kernel. 826 * read-side critical section that would block in a !PREEMPT kernel.
853 * But if you want the full story, read on! 827 * But if you want the full story, read on!
854 * 828 *
855 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), it 829 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU),
856 * is illegal to block while in an RCU read-side critical section. In 830 * it is illegal to block while in an RCU read-side critical section.
857 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU) 831 * In preemptible RCU implementations (TREE_PREEMPT_RCU) in CONFIG_PREEMPT
858 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may 832 * kernel builds, RCU read-side critical sections may be preempted,
859 * be preempted, but explicit blocking is illegal. Finally, in preemptible 833 * but explicit blocking is illegal. Finally, in preemptible RCU
860 * RCU implementations in real-time (with -rt patchset) kernel builds, 834 * implementations in real-time (with -rt patchset) kernel builds, RCU
861 * RCU read-side critical sections may be preempted and they may also 835 * read-side critical sections may be preempted and they may also block, but
862 * block, but only when acquiring spinlocks that are subject to priority 836 * only when acquiring spinlocks that are subject to priority inheritance.
863 * inheritance.
864 */ 837 */
865static inline void rcu_read_lock(void) 838static inline void rcu_read_lock(void)
866{ 839{
@@ -884,6 +857,34 @@ static inline void rcu_read_lock(void)
884/** 857/**
885 * rcu_read_unlock() - marks the end of an RCU read-side critical section. 858 * rcu_read_unlock() - marks the end of an RCU read-side critical section.
886 * 859 *
860 * In most situations, rcu_read_unlock() is immune from deadlock.
861 * However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
862 * is responsible for deboosting, which it does via rt_mutex_unlock().
863 * Unfortunately, this function acquires the scheduler's runqueue and
864 * priority-inheritance spinlocks. This means that deadlock could result
865 * if the caller of rcu_read_unlock() already holds one of these locks or
866 * any lock that is ever acquired while holding them.
867 *
868 * That said, RCU readers are never priority boosted unless they were
869 * preempted. Therefore, one way to avoid deadlock is to make sure
870 * that preemption never happens within any RCU read-side critical
871 * section whose outermost rcu_read_unlock() is called with one of
872 * rt_mutex_unlock()'s locks held. Such preemption can be avoided in
873 * a number of ways, for example, by invoking preempt_disable() before
874 * critical section's outermost rcu_read_lock().
875 *
876 * Given that the set of locks acquired by rt_mutex_unlock() might change
877 * at any time, a somewhat more future-proofed approach is to make sure
878 * that that preemption never happens within any RCU read-side critical
879 * section whose outermost rcu_read_unlock() is called with irqs disabled.
880 * This approach relies on the fact that rt_mutex_unlock() currently only
881 * acquires irq-disabled locks.
882 *
883 * The second of these two approaches is best in most situations,
884 * however, the first approach can also be useful, at least to those
885 * developers willing to keep abreast of the set of locks acquired by
886 * rt_mutex_unlock().
887 *
887 * See rcu_read_lock() for more information. 888 * See rcu_read_lock() for more information.
888 */ 889 */
889static inline void rcu_read_unlock(void) 890static inline void rcu_read_unlock(void)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 7b0e4b425cdf..c5ed83f49c4e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -396,6 +396,7 @@ void regmap_exit(struct regmap *map);
396int regmap_reinit_cache(struct regmap *map, 396int regmap_reinit_cache(struct regmap *map,
397 const struct regmap_config *config); 397 const struct regmap_config *config);
398struct regmap *dev_get_regmap(struct device *dev, const char *name); 398struct regmap *dev_get_regmap(struct device *dev, const char *name);
399struct device *regmap_get_device(struct regmap *map);
399int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 400int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
400int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); 401int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
401int regmap_raw_write(struct regmap *map, unsigned int reg, 402int regmap_raw_write(struct regmap *map, unsigned int reg,
@@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev,
729 return NULL; 730 return NULL;
730} 731}
731 732
733static inline struct device *regmap_get_device(struct regmap *map)
734{
735 WARN_ONCE(1, "regmap API is disabled");
736 return NULL;
737}
738
732#endif 739#endif
733 740
734#endif 741#endif
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 75307447cef9..d8ecefaf63ca 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -322,18 +322,4 @@ struct ab8500_regulator_platform_data {
322 struct regulator_init_data *ext_regulator; 322 struct regulator_init_data *ext_regulator;
323}; 323};
324 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#endif 325#endif
diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h
index 49206c1b4905..b6c4909b33af 100644
--- a/include/linux/regulator/act8865.h
+++ b/include/linux/regulator/act8865.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * act8865.h -- Voltage regulation for the active-semi act8865 2 * act8865.h -- Voltage regulation for active-semi act88xx PMUs
3 * 3 *
4 * Copyright (C) 2013 Atmel Corporation. 4 * Copyright (C) 2013 Atmel Corporation.
5 * 5 *
@@ -29,6 +29,27 @@ enum {
29 ACT8865_REG_NUM, 29 ACT8865_REG_NUM,
30}; 30};
31 31
32enum {
33 ACT8846_ID_REG1,
34 ACT8846_ID_REG2,
35 ACT8846_ID_REG3,
36 ACT8846_ID_REG4,
37 ACT8846_ID_REG5,
38 ACT8846_ID_REG6,
39 ACT8846_ID_REG7,
40 ACT8846_ID_REG8,
41 ACT8846_ID_REG9,
42 ACT8846_ID_REG10,
43 ACT8846_ID_REG11,
44 ACT8846_ID_REG12,
45 ACT8846_REG_NUM,
46};
47
48enum {
49 ACT8865,
50 ACT8846,
51};
52
32/** 53/**
33 * act8865_regulator_data - regulator data 54 * act8865_regulator_data - regulator data
34 * @id: regulator id 55 * @id: regulator id
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 14ec18d5e18b..f8a8733068a7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -37,6 +37,7 @@
37 37
38struct device; 38struct device;
39struct notifier_block; 39struct notifier_block;
40struct regmap;
40 41
41/* 42/*
42 * Regulator operating modes. 43 * Regulator operating modes.
@@ -215,6 +216,13 @@ int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
215 216
216int regulator_allow_bypass(struct regulator *regulator, bool allow); 217int regulator_allow_bypass(struct regulator *regulator, bool allow);
217 218
219struct regmap *regulator_get_regmap(struct regulator *regulator);
220int regulator_get_hardware_vsel_register(struct regulator *regulator,
221 unsigned *vsel_reg,
222 unsigned *vsel_mask);
223int regulator_list_hardware_vsel(struct regulator *regulator,
224 unsigned selector);
225
218/* regulator notifier block */ 226/* regulator notifier block */
219int regulator_register_notifier(struct regulator *regulator, 227int regulator_register_notifier(struct regulator *regulator,
220 struct notifier_block *nb); 228 struct notifier_block *nb);
@@ -457,6 +465,24 @@ static inline int regulator_allow_bypass(struct regulator *regulator,
457 return 0; 465 return 0;
458} 466}
459 467
468static inline struct regmap *regulator_get_regmap(struct regulator *regulator)
469{
470 return ERR_PTR(-EOPNOTSUPP);
471}
472
473static inline int regulator_get_hardware_vsel_register(struct regulator *regulator,
474 unsigned *vsel_reg,
475 unsigned *vsel_mask)
476{
477 return -EOPNOTSUPP;
478}
479
480static inline int regulator_list_hardware_vsel(struct regulator *regulator,
481 unsigned selector)
482{
483 return -EOPNOTSUPP;
484}
485
460static inline int regulator_register_notifier(struct regulator *regulator, 486static inline int regulator_register_notifier(struct regulator *regulator,
461 struct notifier_block *nb) 487 struct notifier_block *nb)
462{ 488{
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
new file mode 100644
index 000000000000..0981ce0e72cc
--- /dev/null
+++ b/include/linux/regulator/da9211.h
@@ -0,0 +1,32 @@
1/*
2 * da9211.h - Regulator device driver for DA9211
3 * Copyright (C) 2014 Dialog Semiconductor Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Library General Public License for more details.
14 */
15
16#ifndef __LINUX_REGULATOR_DA9211_H
17#define __LINUX_REGULATOR_DA9211_H
18
19#include <linux/regulator/machine.h>
20
21#define DA9211_MAX_REGULATORS 2
22
23struct da9211_pdata {
24 /*
25 * Number of buck
26 * 1 : 4 phase 1 buck
27 * 2 : 2 phase 2 buck
28 */
29 int num_buck;
30 struct regulator_init_data *init_data;
31};
32#endif
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index 813dae960ebd..5a0b64cf68b4 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -6,7 +6,7 @@
6 * Copyright (C) 2012 Texas Instruments 6 * Copyright (C) 2012 Texas Instruments
7 * 7 *
8 * Authors: 8 * Authors:
9 * Rob Clark <rob.clark@linaro.org> 9 * Rob Clark <robdclark@gmail.com>
10 * Maarten Lankhorst <maarten.lankhorst@canonical.com> 10 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com> 11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
12 * 12 *
@@ -40,23 +40,103 @@
40#define _LINUX_RESERVATION_H 40#define _LINUX_RESERVATION_H
41 41
42#include <linux/ww_mutex.h> 42#include <linux/ww_mutex.h>
43#include <linux/fence.h>
44#include <linux/slab.h>
45#include <linux/seqlock.h>
46#include <linux/rcupdate.h>
43 47
44extern struct ww_class reservation_ww_class; 48extern struct ww_class reservation_ww_class;
49extern struct lock_class_key reservation_seqcount_class;
50extern const char reservation_seqcount_string[];
51
52struct reservation_object_list {
53 struct rcu_head rcu;
54 u32 shared_count, shared_max;
55 struct fence __rcu *shared[];
56};
45 57
46struct reservation_object { 58struct reservation_object {
47 struct ww_mutex lock; 59 struct ww_mutex lock;
60 seqcount_t seq;
61
62 struct fence __rcu *fence_excl;
63 struct reservation_object_list __rcu *fence;
64 struct reservation_object_list *staged;
48}; 65};
49 66
67#define reservation_object_held(obj) lockdep_is_held(&(obj)->lock.base)
68#define reservation_object_assert_held(obj) \
69 lockdep_assert_held(&(obj)->lock.base)
70
50static inline void 71static inline void
51reservation_object_init(struct reservation_object *obj) 72reservation_object_init(struct reservation_object *obj)
52{ 73{
53 ww_mutex_init(&obj->lock, &reservation_ww_class); 74 ww_mutex_init(&obj->lock, &reservation_ww_class);
75
76 __seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class);
77 RCU_INIT_POINTER(obj->fence, NULL);
78 RCU_INIT_POINTER(obj->fence_excl, NULL);
79 obj->staged = NULL;
54} 80}
55 81
56static inline void 82static inline void
57reservation_object_fini(struct reservation_object *obj) 83reservation_object_fini(struct reservation_object *obj)
58{ 84{
85 int i;
86 struct reservation_object_list *fobj;
87 struct fence *excl;
88
89 /*
90 * This object should be dead and all references must have
91 * been released to it, so no need to be protected with rcu.
92 */
93 excl = rcu_dereference_protected(obj->fence_excl, 1);
94 if (excl)
95 fence_put(excl);
96
97 fobj = rcu_dereference_protected(obj->fence, 1);
98 if (fobj) {
99 for (i = 0; i < fobj->shared_count; ++i)
100 fence_put(rcu_dereference_protected(fobj->shared[i], 1));
101
102 kfree(fobj);
103 }
104 kfree(obj->staged);
105
59 ww_mutex_destroy(&obj->lock); 106 ww_mutex_destroy(&obj->lock);
60} 107}
61 108
109static inline struct reservation_object_list *
110reservation_object_get_list(struct reservation_object *obj)
111{
112 return rcu_dereference_protected(obj->fence,
113 reservation_object_held(obj));
114}
115
116static inline struct fence *
117reservation_object_get_excl(struct reservation_object *obj)
118{
119 return rcu_dereference_protected(obj->fence_excl,
120 reservation_object_held(obj));
121}
122
123int reservation_object_reserve_shared(struct reservation_object *obj);
124void reservation_object_add_shared_fence(struct reservation_object *obj,
125 struct fence *fence);
126
127void reservation_object_add_excl_fence(struct reservation_object *obj,
128 struct fence *fence);
129
130int reservation_object_get_fences_rcu(struct reservation_object *obj,
131 struct fence **pfence_excl,
132 unsigned *pshared_count,
133 struct fence ***pshared);
134
135long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
136 bool wait_all, bool intr,
137 unsigned long timeout);
138
139bool reservation_object_test_signaled_rcu(struct reservation_object *obj,
140 bool test_all);
141
62#endif /* _LINUX_RESERVATION_H */ 142#endif /* _LINUX_RESERVATION_H */
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
new file mode 100644
index 000000000000..36826c0166c5
--- /dev/null
+++ b/include/linux/rhashtable.h
@@ -0,0 +1,208 @@
1/*
2 * Resizable, Scalable, Concurrent Hash Table
3 *
4 * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch>
5 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net>
6 *
7 * Based on the following paper by Josh Triplett, Paul E. McKenney
8 * and Jonathan Walpole:
9 * https://www.usenix.org/legacy/event/atc11/tech/final_files/Triplett.pdf
10 *
11 * Code partially derived from nft_hash
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#ifndef _LINUX_RHASHTABLE_H
19#define _LINUX_RHASHTABLE_H
20
21#include <linux/rculist.h>
22
23struct rhash_head {
24 struct rhash_head __rcu *next;
25};
26
27#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL)
28
29struct bucket_table {
30 size_t size;
31 struct rhash_head __rcu *buckets[];
32};
33
34typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
35typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed);
36
37struct rhashtable;
38
39/**
40 * struct rhashtable_params - Hash table construction parameters
41 * @nelem_hint: Hint on number of elements, should be 75% of desired size
42 * @key_len: Length of key
43 * @key_offset: Offset of key in struct to be hashed
44 * @head_offset: Offset of rhash_head in struct to be hashed
45 * @hash_rnd: Seed to use while hashing
46 * @max_shift: Maximum number of shifts while expanding
47 * @hashfn: Function to hash key
48 * @obj_hashfn: Function to hash object
49 * @grow_decision: If defined, may return true if table should expand
50 * @shrink_decision: If defined, may return true if table should shrink
51 * @mutex_is_held: Must return true if protecting mutex is held
52 */
53struct rhashtable_params {
54 size_t nelem_hint;
55 size_t key_len;
56 size_t key_offset;
57 size_t head_offset;
58 u32 hash_rnd;
59 size_t max_shift;
60 rht_hashfn_t hashfn;
61 rht_obj_hashfn_t obj_hashfn;
62 bool (*grow_decision)(const struct rhashtable *ht,
63 size_t new_size);
64 bool (*shrink_decision)(const struct rhashtable *ht,
65 size_t new_size);
66 int (*mutex_is_held)(void);
67};
68
69/**
70 * struct rhashtable - Hash table handle
71 * @tbl: Bucket table
72 * @nelems: Number of elements in table
73 * @shift: Current size (1 << shift)
74 * @p: Configuration parameters
75 */
76struct rhashtable {
77 struct bucket_table __rcu *tbl;
78 size_t nelems;
79 size_t shift;
80 struct rhashtable_params p;
81};
82
83#ifdef CONFIG_PROVE_LOCKING
84int lockdep_rht_mutex_is_held(const struct rhashtable *ht);
85#else
86static inline int lockdep_rht_mutex_is_held(const struct rhashtable *ht)
87{
88 return 1;
89}
90#endif /* CONFIG_PROVE_LOCKING */
91
92int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
93
94u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len);
95u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
96
97void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t);
98bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t);
99void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
100 struct rhash_head __rcu **pprev, gfp_t flags);
101
102bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
103bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
104
105int rhashtable_expand(struct rhashtable *ht, gfp_t flags);
106int rhashtable_shrink(struct rhashtable *ht, gfp_t flags);
107
108void *rhashtable_lookup(const struct rhashtable *ht, const void *key);
109void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
110 bool (*compare)(void *, void *), void *arg);
111
112void rhashtable_destroy(const struct rhashtable *ht);
113
114#define rht_dereference(p, ht) \
115 rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht))
116
117#define rht_dereference_rcu(p, ht) \
118 rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht))
119
120#define rht_entry(ptr, type, member) container_of(ptr, type, member)
121#define rht_entry_safe(ptr, type, member) \
122({ \
123 typeof(ptr) __ptr = (ptr); \
124 __ptr ? rht_entry(__ptr, type, member) : NULL; \
125})
126
127#define rht_next_entry_safe(pos, ht, member) \
128({ \
129 pos ? rht_entry_safe(rht_dereference((pos)->member.next, ht), \
130 typeof(*(pos)), member) : NULL; \
131})
132
133/**
134 * rht_for_each - iterate over hash chain
135 * @pos: &struct rhash_head to use as a loop cursor.
136 * @head: head of the hash chain (struct rhash_head *)
137 * @ht: pointer to your struct rhashtable
138 */
139#define rht_for_each(pos, head, ht) \
140 for (pos = rht_dereference(head, ht); \
141 pos; \
142 pos = rht_dereference((pos)->next, ht))
143
144/**
145 * rht_for_each_entry - iterate over hash chain of given type
146 * @pos: type * to use as a loop cursor.
147 * @head: head of the hash chain (struct rhash_head *)
148 * @ht: pointer to your struct rhashtable
149 * @member: name of the rhash_head within the hashable struct.
150 */
151#define rht_for_each_entry(pos, head, ht, member) \
152 for (pos = rht_entry_safe(rht_dereference(head, ht), \
153 typeof(*(pos)), member); \
154 pos; \
155 pos = rht_next_entry_safe(pos, ht, member))
156
157/**
158 * rht_for_each_entry_safe - safely iterate over hash chain of given type
159 * @pos: type * to use as a loop cursor.
160 * @n: type * to use for temporary next object storage
161 * @head: head of the hash chain (struct rhash_head *)
162 * @ht: pointer to your struct rhashtable
163 * @member: name of the rhash_head within the hashable struct.
164 *
165 * This hash chain list-traversal primitive allows for the looped code to
166 * remove the loop cursor from the list.
167 */
168#define rht_for_each_entry_safe(pos, n, head, ht, member) \
169 for (pos = rht_entry_safe(rht_dereference(head, ht), \
170 typeof(*(pos)), member), \
171 n = rht_next_entry_safe(pos, ht, member); \
172 pos; \
173 pos = n, \
174 n = rht_next_entry_safe(pos, ht, member))
175
176/**
177 * rht_for_each_rcu - iterate over rcu hash chain
178 * @pos: &struct rhash_head to use as a loop cursor.
179 * @head: head of the hash chain (struct rhash_head *)
180 * @ht: pointer to your struct rhashtable
181 *
182 * This hash chain list-traversal primitive may safely run concurrently with
183 * the _rcu fkht mutation primitives such as rht_insert() as long as the
184 * traversal is guarded by rcu_read_lock().
185 */
186#define rht_for_each_rcu(pos, head, ht) \
187 for (pos = rht_dereference_rcu(head, ht); \
188 pos; \
189 pos = rht_dereference_rcu((pos)->next, ht))
190
191/**
192 * rht_for_each_entry_rcu - iterate over rcu hash chain of given type
193 * @pos: type * to use as a loop cursor.
194 * @head: head of the hash chain (struct rhash_head *)
195 * @member: name of the rhash_head within the hashable struct.
196 *
197 * This hash chain list-traversal primitive may safely run concurrently with
198 * the _rcu fkht mutation primitives such as rht_insert() as long as the
199 * traversal is guarded by rcu_read_lock().
200 */
201#define rht_for_each_entry_rcu(pos, head, member) \
202 for (pos = rht_entry_safe(rcu_dereference_raw(head), \
203 typeof(*(pos)), member); \
204 pos; \
205 pos = rht_entry_safe(rcu_dereference_raw((pos)->member.next), \
206 typeof(*(pos)), member))
207
208#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 5059994fe297..9fc2f213e74f 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -384,11 +384,16 @@ void rio_dev_put(struct rio_dev *);
384 384
385#ifdef CONFIG_RAPIDIO_DMA_ENGINE 385#ifdef CONFIG_RAPIDIO_DMA_ENGINE
386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev); 386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev);
387extern struct dma_chan *rio_request_mport_dma(struct rio_mport *mport);
387extern void rio_release_dma(struct dma_chan *dchan); 388extern void rio_release_dma(struct dma_chan *dchan);
388extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg( 389extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(
389 struct rio_dev *rdev, struct dma_chan *dchan, 390 struct rio_dev *rdev, struct dma_chan *dchan,
390 struct rio_dma_data *data, 391 struct rio_dma_data *data,
391 enum dma_transfer_direction direction, unsigned long flags); 392 enum dma_transfer_direction direction, unsigned long flags);
393extern struct dma_async_tx_descriptor *rio_dma_prep_xfer(
394 struct dma_chan *dchan, u16 destid,
395 struct rio_dma_data *data,
396 enum dma_transfer_direction direction, unsigned long flags);
392#endif 397#endif
393 398
394/** 399/**
diff --git a/include/linux/rndis.h b/include/linux/rndis.h
index 0c8dc7195cdb..93c0a64aefa6 100644
--- a/include/linux/rndis.h
+++ b/include/linux/rndis.h
@@ -65,6 +65,7 @@
65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION 66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L 67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L
68#define RNDIS_STATUS_NETWORK_CHANGE 0x40010018
68 69
69#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001 70#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001
70#define RNDIS_STATUS_SOFT_ERRORS 0x80010003 71#define RNDIS_STATUS_SOFT_ERRORS 0x80010003
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 3aed8d737e1a..1abba5ce2a2f 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -90,11 +90,9 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
90extern void rt_mutex_destroy(struct rt_mutex *lock); 90extern void rt_mutex_destroy(struct rt_mutex *lock);
91 91
92extern void rt_mutex_lock(struct rt_mutex *lock); 92extern void rt_mutex_lock(struct rt_mutex *lock);
93extern int rt_mutex_lock_interruptible(struct rt_mutex *lock, 93extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
94 int detect_deadlock);
95extern int rt_mutex_timed_lock(struct rt_mutex *lock, 94extern int rt_mutex_timed_lock(struct rt_mutex *lock,
96 struct hrtimer_sleeper *timeout, 95 struct hrtimer_sleeper *timeout);
97 int detect_deadlock);
98 96
99extern int rt_mutex_trylock(struct rt_mutex *lock); 97extern int rt_mutex_trylock(struct rt_mutex *lock);
100 98
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 953937ea5233..167bae7bdfa4 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -78,6 +78,7 @@ extern void __rtnl_unlock(void);
78extern int ndo_dflt_fdb_dump(struct sk_buff *skb, 78extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
79 struct netlink_callback *cb, 79 struct netlink_callback *cb,
80 struct net_device *dev, 80 struct net_device *dev,
81 struct net_device *filter_dev,
81 int idx); 82 int idx);
82extern int ndo_dflt_fdb_add(struct ndmsg *ndm, 83extern int ndo_dflt_fdb_add(struct ndmsg *ndm,
83 struct nlattr *tb[], 84 struct nlattr *tb[],
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index d5b13bc07a0b..561e8615528d 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -15,13 +15,13 @@
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16/* 16/*
17 * the rw-semaphore definition 17 * the rw-semaphore definition
18 * - if activity is 0 then there are no active readers or writers 18 * - if count is 0 then there are no active readers or writers
19 * - if activity is +ve then that is the number of active readers 19 * - if count is +ve then that is the number of active readers
20 * - if activity is -1 then there is one active writer 20 * - if count is -1 then there is one active writer
21 * - if wait_list is not empty, then there are processes waiting for the semaphore 21 * - if wait_list is not empty, then there are processes waiting for the semaphore
22 */ 22 */
23struct rw_semaphore { 23struct rw_semaphore {
24 __s32 activity; 24 __s32 count;
25 raw_spinlock_t wait_lock; 25 raw_spinlock_t wait_lock;
26 struct list_head wait_list; 26 struct list_head wait_list;
27#ifdef CONFIG_DEBUG_LOCK_ALLOC 27#ifdef CONFIG_DEBUG_LOCK_ALLOC
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 8d79708146aa..035d3c57fc8a 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -13,10 +13,11 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16
17#include <linux/atomic.h> 16#include <linux/atomic.h>
17#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
18#include <linux/osq_lock.h>
19#endif
18 20
19struct optimistic_spin_queue;
20struct rw_semaphore; 21struct rw_semaphore;
21 22
22#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK 23#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
@@ -25,15 +26,15 @@ struct rw_semaphore;
25/* All arch specific implementations share the same struct */ 26/* All arch specific implementations share the same struct */
26struct rw_semaphore { 27struct rw_semaphore {
27 long count; 28 long count;
28 raw_spinlock_t wait_lock;
29 struct list_head wait_list; 29 struct list_head wait_list;
30#ifdef CONFIG_SMP 30 raw_spinlock_t wait_lock;
31#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
32 struct optimistic_spin_queue osq; /* spinner MCS lock */
31 /* 33 /*
32 * Write owner. Used as a speculative check to see 34 * Write owner. Used as a speculative check to see
33 * if the owner is running on the cpu. 35 * if the owner is running on the cpu.
34 */ 36 */
35 struct task_struct *owner; 37 struct task_struct *owner;
36 struct optimistic_spin_queue *osq; /* spinner MCS lock */
37#endif 38#endif
38#ifdef CONFIG_DEBUG_LOCK_ALLOC 39#ifdef CONFIG_DEBUG_LOCK_ALLOC
39 struct lockdep_map dep_map; 40 struct lockdep_map dep_map;
@@ -64,22 +65,19 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem)
64# define __RWSEM_DEP_MAP_INIT(lockname) 65# define __RWSEM_DEP_MAP_INIT(lockname)
65#endif 66#endif
66 67
67#if defined(CONFIG_SMP) && !defined(CONFIG_RWSEM_GENERIC_SPINLOCK) 68#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
68#define __RWSEM_INITIALIZER(name) \ 69#define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL
69 { RWSEM_UNLOCKED_VALUE, \
70 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
71 LIST_HEAD_INIT((name).wait_list), \
72 NULL, /* owner */ \
73 NULL /* mcs lock */ \
74 __RWSEM_DEP_MAP_INIT(name) }
75#else 70#else
76#define __RWSEM_INITIALIZER(name) \ 71#define __RWSEM_OPT_INIT(lockname)
77 { RWSEM_UNLOCKED_VALUE, \
78 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
79 LIST_HEAD_INIT((name).wait_list) \
80 __RWSEM_DEP_MAP_INIT(name) }
81#endif 72#endif
82 73
74#define __RWSEM_INITIALIZER(name) \
75 { .count = RWSEM_UNLOCKED_VALUE, \
76 .wait_list = LIST_HEAD_INIT((name).wait_list), \
77 .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \
78 __RWSEM_OPT_INIT(name) \
79 __RWSEM_DEP_MAP_INIT(name) }
80
83#define DECLARE_RWSEM(name) \ 81#define DECLARE_RWSEM(name) \
84 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 82 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
85 83
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index f4ec8bbcb372..ed8f9e70df9b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -136,7 +136,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, 136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
137 struct scatterlist *sgl) 137 struct scatterlist *sgl)
138{ 138{
139#ifndef ARCH_HAS_SG_CHAIN 139#ifndef CONFIG_ARCH_HAS_SG_CHAIN
140 BUG(); 140 BUG();
141#endif 141#endif
142 142
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0376b054a0d0..5c2c885ee52b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -33,6 +33,7 @@ struct sched_param {
33 33
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/sem.h> 35#include <linux/sem.h>
36#include <linux/shm.h>
36#include <linux/signal.h> 37#include <linux/signal.h>
37#include <linux/compiler.h> 38#include <linux/compiler.h>
38#include <linux/completion.h> 39#include <linux/completion.h>
@@ -168,8 +169,7 @@ extern int nr_processes(void);
168extern unsigned long nr_running(void); 169extern unsigned long nr_running(void);
169extern unsigned long nr_iowait(void); 170extern unsigned long nr_iowait(void);
170extern unsigned long nr_iowait_cpu(int cpu); 171extern unsigned long nr_iowait_cpu(int cpu);
171extern unsigned long this_cpu_load(void); 172extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
172
173 173
174extern void calc_global_load(unsigned long ticks); 174extern void calc_global_load(unsigned long ticks);
175extern void update_cpu_load_nohz(void); 175extern void update_cpu_load_nohz(void);
@@ -813,7 +813,7 @@ struct task_delay_info {
813 * associated with the operation is added to XXX_delay. 813 * associated with the operation is added to XXX_delay.
814 * XXX_delay contains the accumulated delay time in nanoseconds. 814 * XXX_delay contains the accumulated delay time in nanoseconds.
815 */ 815 */
816 struct timespec blkio_start, blkio_end; /* Shared by blkio, swapin */ 816 u64 blkio_start; /* Shared by blkio, swapin */
817 u64 blkio_delay; /* wait for sync block io completion */ 817 u64 blkio_delay; /* wait for sync block io completion */
818 u64 swapin_delay; /* wait for swapin block io completion */ 818 u64 swapin_delay; /* wait for swapin block io completion */
819 u32 blkio_count; /* total count of the number of sync block */ 819 u32 blkio_count; /* total count of the number of sync block */
@@ -821,7 +821,7 @@ struct task_delay_info {
821 u32 swapin_count; /* total count of the number of swapin block */ 821 u32 swapin_count; /* total count of the number of swapin block */
822 /* io operations performed */ 822 /* io operations performed */
823 823
824 struct timespec freepages_start, freepages_end; 824 u64 freepages_start;
825 u64 freepages_delay; /* wait for memory reclaim */ 825 u64 freepages_delay; /* wait for memory reclaim */
826 u32 freepages_count; /* total count of memory reclaim */ 826 u32 freepages_count; /* total count of memory reclaim */
827}; 827};
@@ -1270,9 +1270,6 @@ struct task_struct {
1270#ifdef CONFIG_TREE_PREEMPT_RCU 1270#ifdef CONFIG_TREE_PREEMPT_RCU
1271 struct rcu_node *rcu_blocked_node; 1271 struct rcu_node *rcu_blocked_node;
1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1273#ifdef CONFIG_RCU_BOOST
1274 struct rt_mutex *rcu_boost_mutex;
1275#endif /* #ifdef CONFIG_RCU_BOOST */
1276 1273
1277#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1274#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1278 struct sched_info sched_info; 1275 struct sched_info sched_info;
@@ -1307,13 +1304,12 @@ struct task_struct {
1307 * execve */ 1304 * execve */
1308 unsigned in_iowait:1; 1305 unsigned in_iowait:1;
1309 1306
1310 /* task may not gain privileges */
1311 unsigned no_new_privs:1;
1312
1313 /* Revert to default priority/policy when forking */ 1307 /* Revert to default priority/policy when forking */
1314 unsigned sched_reset_on_fork:1; 1308 unsigned sched_reset_on_fork:1;
1315 unsigned sched_contributes_to_load:1; 1309 unsigned sched_contributes_to_load:1;
1316 1310
1311 unsigned long atomic_flags; /* Flags needing atomic access. */
1312
1317 pid_t pid; 1313 pid_t pid;
1318 pid_t tgid; 1314 pid_t tgid;
1319 1315
@@ -1367,8 +1363,8 @@ struct task_struct {
1367 } vtime_snap_whence; 1363 } vtime_snap_whence;
1368#endif 1364#endif
1369 unsigned long nvcsw, nivcsw; /* context switch counts */ 1365 unsigned long nvcsw, nivcsw; /* context switch counts */
1370 struct timespec start_time; /* monotonic time */ 1366 u64 start_time; /* monotonic time in nsec */
1371 struct timespec real_start_time; /* boot based time */ 1367 u64 real_start_time; /* boot based time in nsec */
1372/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ 1368/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
1373 unsigned long min_flt, maj_flt; 1369 unsigned long min_flt, maj_flt;
1374 1370
@@ -1389,6 +1385,7 @@ struct task_struct {
1389#ifdef CONFIG_SYSVIPC 1385#ifdef CONFIG_SYSVIPC
1390/* ipc stuff */ 1386/* ipc stuff */
1391 struct sysv_sem sysvsem; 1387 struct sysv_sem sysvsem;
1388 struct sysv_shm sysvshm;
1392#endif 1389#endif
1393#ifdef CONFIG_DETECT_HUNG_TASK 1390#ifdef CONFIG_DETECT_HUNG_TASK
1394/* hung task detection */ 1391/* hung task detection */
@@ -1440,8 +1437,6 @@ struct task_struct {
1440 struct rb_node *pi_waiters_leftmost; 1437 struct rb_node *pi_waiters_leftmost;
1441 /* Deadlock detection and priority inheritance handling */ 1438 /* Deadlock detection and priority inheritance handling */
1442 struct rt_mutex_waiter *pi_blocked_on; 1439 struct rt_mutex_waiter *pi_blocked_on;
1443 /* Top pi_waiters task */
1444 struct task_struct *pi_top_task;
1445#endif 1440#endif
1446 1441
1447#ifdef CONFIG_DEBUG_MUTEXES 1442#ifdef CONFIG_DEBUG_MUTEXES
@@ -1634,12 +1629,6 @@ struct task_struct {
1634 unsigned long trace_recursion; 1629 unsigned long trace_recursion;
1635#endif /* CONFIG_TRACING */ 1630#endif /* CONFIG_TRACING */
1636#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */ 1631#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */
1637 struct memcg_batch_info {
1638 int do_batch; /* incremented when batch uncharge started */
1639 struct mem_cgroup *memcg; /* target memcg of uncharge */
1640 unsigned long nr_pages; /* uncharged usage */
1641 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1642 } memcg_batch;
1643 unsigned int memcg_kmem_skip_account; 1632 unsigned int memcg_kmem_skip_account;
1644 struct memcg_oom_info { 1633 struct memcg_oom_info {
1645 struct mem_cgroup *memcg; 1634 struct mem_cgroup *memcg;
@@ -1967,6 +1956,19 @@ static inline void memalloc_noio_restore(unsigned int flags)
1967 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags; 1956 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
1968} 1957}
1969 1958
1959/* Per-process atomic flags. */
1960#define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */
1961
1962static inline bool task_no_new_privs(struct task_struct *p)
1963{
1964 return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags);
1965}
1966
1967static inline void task_set_no_new_privs(struct task_struct *p)
1968{
1969 set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags);
1970}
1971
1970/* 1972/*
1971 * task->jobctl flags 1973 * task->jobctl flags
1972 */ 1974 */
@@ -2009,9 +2011,6 @@ static inline void rcu_copy_process(struct task_struct *p)
2009#ifdef CONFIG_TREE_PREEMPT_RCU 2011#ifdef CONFIG_TREE_PREEMPT_RCU
2010 p->rcu_blocked_node = NULL; 2012 p->rcu_blocked_node = NULL;
2011#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 2013#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
2012#ifdef CONFIG_RCU_BOOST
2013 p->rcu_boost_mutex = NULL;
2014#endif /* #ifdef CONFIG_RCU_BOOST */
2015 INIT_LIST_HEAD(&p->rcu_node_entry); 2014 INIT_LIST_HEAD(&p->rcu_node_entry);
2016} 2015}
2017 2016
@@ -2360,8 +2359,10 @@ static inline int on_sig_stack(unsigned long sp)
2360 2359
2361static inline int sas_ss_flags(unsigned long sp) 2360static inline int sas_ss_flags(unsigned long sp)
2362{ 2361{
2363 return (current->sas_ss_size == 0 ? SS_DISABLE 2362 if (!current->sas_ss_size)
2364 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2363 return SS_DISABLE;
2364
2365 return on_sig_stack(sp) ? SS_ONSTACK : 0;
2365} 2366}
2366 2367
2367static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig) 2368static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
@@ -2788,7 +2789,7 @@ static inline bool __must_check current_set_polling_and_test(void)
2788 2789
2789 /* 2790 /*
2790 * Polling state must be visible before we test NEED_RESCHED, 2791 * Polling state must be visible before we test NEED_RESCHED,
2791 * paired by resched_task() 2792 * paired by resched_curr()
2792 */ 2793 */
2793 smp_mb__after_atomic(); 2794 smp_mb__after_atomic();
2794 2795
@@ -2806,7 +2807,7 @@ static inline bool __must_check current_clr_polling_and_test(void)
2806 2807
2807 /* 2808 /*
2808 * Polling state must be visible before we test NEED_RESCHED, 2809 * Polling state must be visible before we test NEED_RESCHED,
2809 * paired by resched_task() 2810 * paired by resched_curr()
2810 */ 2811 */
2811 smp_mb__after_atomic(); 2812 smp_mb__after_atomic();
2812 2813
@@ -2838,7 +2839,7 @@ static inline void current_clr_polling(void)
2838 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also 2839 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
2839 * fold. 2840 * fold.
2840 */ 2841 */
2841 smp_mb(); /* paired with resched_task() */ 2842 smp_mb(); /* paired with resched_curr() */
2842 2843
2843 preempt_fold_need_resched(); 2844 preempt_fold_need_resched();
2844} 2845}
@@ -2963,15 +2964,10 @@ static inline void inc_syscw(struct task_struct *tsk)
2963 2964
2964#ifdef CONFIG_MEMCG 2965#ifdef CONFIG_MEMCG
2965extern void mm_update_next_owner(struct mm_struct *mm); 2966extern void mm_update_next_owner(struct mm_struct *mm);
2966extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2967#else 2967#else
2968static inline void mm_update_next_owner(struct mm_struct *mm) 2968static inline void mm_update_next_owner(struct mm_struct *mm)
2969{ 2969{
2970} 2970}
2971
2972static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2973{
2974}
2975#endif /* CONFIG_MEMCG */ 2971#endif /* CONFIG_MEMCG */
2976 2972
2977static inline unsigned long task_rlimit(const struct task_struct *tsk, 2973static inline unsigned long task_rlimit(const struct task_struct *tsk,
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 4054b0994071..5d586a45a319 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -3,6 +3,8 @@
3 3
4#include <uapi/linux/seccomp.h> 4#include <uapi/linux/seccomp.h>
5 5
6#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC)
7
6#ifdef CONFIG_SECCOMP 8#ifdef CONFIG_SECCOMP
7 9
8#include <linux/thread_info.h> 10#include <linux/thread_info.h>
@@ -14,11 +16,11 @@ struct seccomp_filter;
14 * 16 *
15 * @mode: indicates one of the valid values above for controlled 17 * @mode: indicates one of the valid values above for controlled
16 * system calls available to a process. 18 * system calls available to a process.
17 * @filter: The metadata and ruleset for determining what system calls 19 * @filter: must always point to a valid seccomp-filter or NULL as it is
18 * are allowed for a task. 20 * accessed without locking during system call entry.
19 * 21 *
20 * @filter must only be accessed from the context of current as there 22 * @filter must only be accessed from the context of current as there
21 * is no locking. 23 * is no read locking.
22 */ 24 */
23struct seccomp { 25struct seccomp {
24 int mode; 26 int mode;
diff --git a/include/linux/security.h b/include/linux/security.h
index 9c6b9722ff48..623f90e5f38d 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -702,6 +702,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
702 * @inode points to the inode to use as a reference. 702 * @inode points to the inode to use as a reference.
703 * The current task must be the one that nominated @inode. 703 * The current task must be the one that nominated @inode.
704 * Return 0 if successful. 704 * Return 0 if successful.
705 * @kernel_fw_from_file:
706 * Load firmware from userspace (not called for built-in firmware).
707 * @file contains the file structure pointing to the file containing
708 * the firmware to load. This argument will be NULL if the firmware
709 * was loaded via the uevent-triggered blob-based interface exposed
710 * by CONFIG_FW_LOADER_USER_HELPER.
711 * @buf pointer to buffer containing firmware contents.
712 * @size length of the firmware contents.
713 * Return 0 if permission is granted.
705 * @kernel_module_request: 714 * @kernel_module_request:
706 * Ability to trigger the kernel to automatically upcall to userspace for 715 * Ability to trigger the kernel to automatically upcall to userspace for
707 * userspace to load a kernel module with the given name. 716 * userspace to load a kernel module with the given name.
@@ -1565,6 +1574,7 @@ struct security_operations {
1565 void (*cred_transfer)(struct cred *new, const struct cred *old); 1574 void (*cred_transfer)(struct cred *new, const struct cred *old);
1566 int (*kernel_act_as)(struct cred *new, u32 secid); 1575 int (*kernel_act_as)(struct cred *new, u32 secid);
1567 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1576 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1577 int (*kernel_fw_from_file)(struct file *file, char *buf, size_t size);
1568 int (*kernel_module_request)(char *kmod_name); 1578 int (*kernel_module_request)(char *kmod_name);
1569 int (*kernel_module_from_file)(struct file *file); 1579 int (*kernel_module_from_file)(struct file *file);
1570 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1580 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
@@ -1837,6 +1847,7 @@ int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1837void security_transfer_creds(struct cred *new, const struct cred *old); 1847void security_transfer_creds(struct cred *new, const struct cred *old);
1838int security_kernel_act_as(struct cred *new, u32 secid); 1848int security_kernel_act_as(struct cred *new, u32 secid);
1839int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1849int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1850int security_kernel_fw_from_file(struct file *file, char *buf, size_t size);
1840int security_kernel_module_request(char *kmod_name); 1851int security_kernel_module_request(char *kmod_name);
1841int security_kernel_module_from_file(struct file *file); 1852int security_kernel_module_from_file(struct file *file);
1842int security_task_fix_setuid(struct cred *new, const struct cred *old, 1853int security_task_fix_setuid(struct cred *new, const struct cred *old,
@@ -2363,6 +2374,12 @@ static inline int security_kernel_create_files_as(struct cred *cred,
2363 return 0; 2374 return 0;
2364} 2375}
2365 2376
2377static inline int security_kernel_fw_from_file(struct file *file,
2378 char *buf, size_t size)
2379{
2380 return 0;
2381}
2382
2366static inline int security_kernel_module_request(char *kmod_name) 2383static inline int security_kernel_module_request(char *kmod_name)
2367{ 2384{
2368 return 0; 2385 return 0;
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 535f158977b9..cc359636cfa3 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -117,6 +117,22 @@ repeat:
117} 117}
118 118
119/** 119/**
120 * raw_read_seqcount - Read the raw seqcount
121 * @s: pointer to seqcount_t
122 * Returns: count to be passed to read_seqcount_retry
123 *
124 * raw_read_seqcount opens a read critical section of the given
125 * seqcount without any lockdep checking and without checking or
126 * masking the LSB. Calling code is responsible for handling that.
127 */
128static inline unsigned raw_read_seqcount(const seqcount_t *s)
129{
130 unsigned ret = ACCESS_ONCE(s->sequence);
131 smp_rmb();
132 return ret;
133}
134
135/**
120 * raw_read_seqcount_begin - start seq-read critical section w/o lockdep 136 * raw_read_seqcount_begin - start seq-read critical section w/o lockdep
121 * @s: pointer to seqcount_t 137 * @s: pointer to seqcount_t
122 * Returns: count to be passed to read_seqcount_retry 138 * Returns: count to be passed to read_seqcount_retry
@@ -164,8 +180,6 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
164static inline unsigned raw_seqcount_begin(const seqcount_t *s) 180static inline unsigned raw_seqcount_begin(const seqcount_t *s)
165{ 181{
166 unsigned ret = ACCESS_ONCE(s->sequence); 182 unsigned ret = ACCESS_ONCE(s->sequence);
167
168 seqcount_lockdep_reader_access(s);
169 smp_rmb(); 183 smp_rmb();
170 return ret & ~1; 184 return ret & ~1;
171} 185}
@@ -220,6 +234,17 @@ static inline void raw_write_seqcount_end(seqcount_t *s)
220} 234}
221 235
222/* 236/*
237 * raw_write_seqcount_latch - redirect readers to even/odd copy
238 * @s: pointer to seqcount_t
239 */
240static inline void raw_write_seqcount_latch(seqcount_t *s)
241{
242 smp_wmb(); /* prior stores before incrementing "sequence" */
243 s->sequence++;
244 smp_wmb(); /* increment "sequence" before following stores */
245}
246
247/*
223 * Sequence counter only version assumes that callers are using their 248 * Sequence counter only version assumes that callers are using their
224 * own mutexing. 249 * own mutexing.
225 */ 250 */
diff --git a/include/linux/seqno-fence.h b/include/linux/seqno-fence.h
new file mode 100644
index 000000000000..3d6003de4b0d
--- /dev/null
+++ b/include/linux/seqno-fence.h
@@ -0,0 +1,116 @@
1/*
2 * seqno-fence, using a dma-buf to synchronize fencing
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Copyright (C) 2012 Canonical Ltd
6 * Authors:
7 * Rob Clark <robdclark@gmail.com>
8 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 */
19
20#ifndef __LINUX_SEQNO_FENCE_H
21#define __LINUX_SEQNO_FENCE_H
22
23#include <linux/fence.h>
24#include <linux/dma-buf.h>
25
26enum seqno_fence_condition {
27 SEQNO_FENCE_WAIT_GEQUAL,
28 SEQNO_FENCE_WAIT_NONZERO
29};
30
31struct seqno_fence {
32 struct fence base;
33
34 const struct fence_ops *ops;
35 struct dma_buf *sync_buf;
36 uint32_t seqno_ofs;
37 enum seqno_fence_condition condition;
38};
39
40extern const struct fence_ops seqno_fence_ops;
41
42/**
43 * to_seqno_fence - cast a fence to a seqno_fence
44 * @fence: fence to cast to a seqno_fence
45 *
46 * Returns NULL if the fence is not a seqno_fence,
47 * or the seqno_fence otherwise.
48 */
49static inline struct seqno_fence *
50to_seqno_fence(struct fence *fence)
51{
52 if (fence->ops != &seqno_fence_ops)
53 return NULL;
54 return container_of(fence, struct seqno_fence, base);
55}
56
57/**
58 * seqno_fence_init - initialize a seqno fence
59 * @fence: seqno_fence to initialize
60 * @lock: pointer to spinlock to use for fence
61 * @sync_buf: buffer containing the memory location to signal on
62 * @context: the execution context this fence is a part of
63 * @seqno_ofs: the offset within @sync_buf
64 * @seqno: the sequence # to signal on
65 * @ops: the fence_ops for operations on this seqno fence
66 *
67 * This function initializes a struct seqno_fence with passed parameters,
68 * and takes a reference on sync_buf which is released on fence destruction.
69 *
70 * A seqno_fence is a dma_fence which can complete in software when
71 * enable_signaling is called, but it also completes when
72 * (s32)((sync_buf)[seqno_ofs] - seqno) >= 0 is true
73 *
74 * The seqno_fence will take a refcount on the sync_buf until it's
75 * destroyed, but actual lifetime of sync_buf may be longer if one of the
76 * callers take a reference to it.
77 *
78 * Certain hardware have instructions to insert this type of wait condition
79 * in the command stream, so no intervention from software would be needed.
80 * This type of fence can be destroyed before completed, however a reference
81 * on the sync_buf dma-buf can be taken. It is encouraged to re-use the same
82 * dma-buf for sync_buf, since mapping or unmapping the sync_buf to the
83 * device's vm can be expensive.
84 *
85 * It is recommended for creators of seqno_fence to call fence_signal
86 * before destruction. This will prevent possible issues from wraparound at
87 * time of issue vs time of check, since users can check fence_is_signaled
88 * before submitting instructions for the hardware to wait on the fence.
89 * However, when ops.enable_signaling is not called, it doesn't have to be
90 * done as soon as possible, just before there's any real danger of seqno
91 * wraparound.
92 */
93static inline void
94seqno_fence_init(struct seqno_fence *fence, spinlock_t *lock,
95 struct dma_buf *sync_buf, uint32_t context,
96 uint32_t seqno_ofs, uint32_t seqno,
97 enum seqno_fence_condition cond,
98 const struct fence_ops *ops)
99{
100 BUG_ON(!fence || !sync_buf || !ops);
101 BUG_ON(!ops->wait || !ops->enable_signaling ||
102 !ops->get_driver_name || !ops->get_timeline_name);
103
104 /*
105 * ops is used in fence_init for get_driver_name, so needs to be
106 * initialized first
107 */
108 fence->ops = ops;
109 fence_init(&fence->base, &seqno_fence_ops, lock, context, seqno);
110 get_dma_buf(sync_buf);
111 fence->sync_buf = sync_buf;
112 fence->seqno_ofs = seqno_ofs;
113 fence->condition = cond;
114}
115
116#endif /* __LINUX_SEQNO_FENCE_H */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index af47a8af6024..f93649e22c43 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -74,8 +74,10 @@ struct uart_8250_port {
74 struct list_head list; /* ports on this IRQ */ 74 struct list_head list; /* ports on this IRQ */
75 unsigned short capabilities; /* port capabilities */ 75 unsigned short capabilities; /* port capabilities */
76 unsigned short bugs; /* port bugs */ 76 unsigned short bugs; /* port bugs */
77 bool fifo_bug; /* min RX trigger if enabled */
77 unsigned int tx_loadsz; /* transmit fifo load size */ 78 unsigned int tx_loadsz; /* transmit fifo load size */
78 unsigned char acr; 79 unsigned char acr;
80 unsigned char fcr;
79 unsigned char ier; 81 unsigned char ier;
80 unsigned char lcr; 82 unsigned char lcr;
81 unsigned char mcr; 83 unsigned char mcr;
@@ -100,6 +102,11 @@ struct uart_8250_port {
100 void (*dl_write)(struct uart_8250_port *, int); 102 void (*dl_write)(struct uart_8250_port *, int);
101}; 103};
102 104
105static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
106{
107 return container_of(up, struct uart_8250_port, port);
108}
109
103int serial8250_register_8250_port(struct uart_8250_port *); 110int serial8250_register_8250_port(struct uart_8250_port *);
104void serial8250_unregister_port(int line); 111void serial8250_unregister_port(int line);
105void serial8250_suspend_port(int line); 112void serial8250_suspend_port(int line);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 5bbb809ee197..cf3a1e789bf5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -199,6 +199,8 @@ struct uart_port {
199 unsigned char suspended; 199 unsigned char suspended;
200 unsigned char irq_wake; 200 unsigned char irq_wake;
201 unsigned char unused[2]; 201 unsigned char unused[2];
202 struct attribute_group *attr_group; /* port specific attributes */
203 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */
202 void *private_data; /* generic platform data pointer */ 204 void *private_data; /* generic platform data pointer */
203}; 205};
204 206
diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
index 4723bbfa1c26..a6e555cbe05c 100644
--- a/include/linux/sfi_acpi.h
+++ b/include/linux/sfi_acpi.h
@@ -63,8 +63,6 @@
63#include <linux/sfi.h> 63#include <linux/sfi.h>
64 64
65#ifdef CONFIG_SFI 65#ifdef CONFIG_SFI
66#include <acpi/acpi.h> /* FIXME: inclusion should be removed */
67
68extern int sfi_acpi_table_parse(char *signature, char *oem_id, 66extern int sfi_acpi_table_parse(char *signature, char *oem_id,
69 char *oem_table_id, 67 char *oem_table_id,
70 int (*handler)(struct acpi_table_header *)); 68 int (*handler)(struct acpi_table_header *));
@@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
78 return sfi_acpi_table_parse(signature, NULL, NULL, handler); 76 return sfi_acpi_table_parse(signature, NULL, NULL, handler);
79} 77}
80#else /* !CONFIG_SFI */ 78#else /* !CONFIG_SFI */
81
82static inline int sfi_acpi_table_parse(char *signature, char *oem_id, 79static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
83 char *oem_table_id, 80 char *oem_table_id,
84 int (*handler)(struct acpi_table_header *)) 81 int (*handler)(struct acpi_table_header *))
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b7b43b82231e..56b97eed28a4 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -95,19 +95,21 @@ struct sh_dmae_pdata {
95}; 95};
96 96
97/* DMAOR definitions */ 97/* DMAOR definitions */
98#define DMAOR_AE 0x00000004 98#define DMAOR_AE 0x00000004 /* Address Error Flag */
99#define DMAOR_NMIF 0x00000002 99#define DMAOR_NMIF 0x00000002
100#define DMAOR_DME 0x00000001 100#define DMAOR_DME 0x00000001 /* DMA Master Enable */
101 101
102/* Definitions for the SuperH DMAC */ 102/* Definitions for the SuperH DMAC */
103#define DM_INC 0x00004000 103#define DM_INC 0x00004000 /* Destination addresses are incremented */
104#define DM_DEC 0x00008000 104#define DM_DEC 0x00008000 /* Destination addresses are decremented */
105#define DM_FIX 0x0000c000 105#define DM_FIX 0x0000c000 /* Destination address is fixed */
106#define SM_INC 0x00001000 106#define SM_INC 0x00001000 /* Source addresses are incremented */
107#define SM_DEC 0x00002000 107#define SM_DEC 0x00002000 /* Source addresses are decremented */
108#define SM_FIX 0x00003000 108#define SM_FIX 0x00003000 /* Source address is fixed */
109#define CHCR_DE 0x00000001 109#define RS_AUTO 0x00000400 /* Auto Request */
110#define CHCR_TE 0x00000002 110#define RS_ERS 0x00000800 /* DMA extended resource selector */
111#define CHCR_IE 0x00000004 111#define CHCR_DE 0x00000001 /* DMA Enable */
112#define CHCR_TE 0x00000002 /* Transfer End Flag */
113#define CHCR_IE 0x00000004 /* Interrupt Enable */
112 114
113#endif 115#endif
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
index 8e1e036d6d45..64638b058076 100644
--- a/include/linux/sh_timer.h
+++ b/include/linux/sh_timer.h
@@ -2,11 +2,6 @@
2#define __SH_TIMER_H__ 2#define __SH_TIMER_H__
3 3
4struct sh_timer_config { 4struct sh_timer_config {
5 char *name;
6 long channel_offset;
7 int timer_bit;
8 unsigned long clockevent_rating;
9 unsigned long clocksource_rating;
10 unsigned int channels_mask; 5 unsigned int channels_mask;
11}; 6};
12 7
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 57d77709fbe2..6fb801686ad6 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_SHM_H_ 1#ifndef _LINUX_SHM_H_
2#define _LINUX_SHM_H_ 2#define _LINUX_SHM_H_
3 3
4#include <linux/list.h>
4#include <asm/page.h> 5#include <asm/page.h>
5#include <uapi/linux/shm.h> 6#include <uapi/linux/shm.h>
6#include <asm/shmparam.h> 7#include <asm/shmparam.h>
@@ -20,6 +21,7 @@ struct shmid_kernel /* private to the kernel */
20 21
21 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
22 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */
23}; 25};
24 26
25/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
@@ -44,11 +46,20 @@ struct shmid_kernel /* private to the kernel */
44#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) 46#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
45 47
46#ifdef CONFIG_SYSVIPC 48#ifdef CONFIG_SYSVIPC
49struct sysv_shm {
50 struct list_head shm_clist;
51};
52
47long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, 53long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
48 unsigned long shmlba); 54 unsigned long shmlba);
49extern int is_file_shm_hugepages(struct file *file); 55int is_file_shm_hugepages(struct file *file);
50extern void exit_shm(struct task_struct *task); 56void exit_shm(struct task_struct *task);
57#define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
51#else 58#else
59struct sysv_shm {
60 /* empty */
61};
62
52static inline long do_shmat(int shmid, char __user *shmaddr, 63static inline long do_shmat(int shmid, char __user *shmaddr,
53 int shmflg, unsigned long *addr, 64 int shmflg, unsigned long *addr,
54 unsigned long shmlba) 65 unsigned long shmlba)
@@ -62,6 +73,9 @@ static inline int is_file_shm_hugepages(struct file *file)
62static inline void exit_shm(struct task_struct *task) 73static inline void exit_shm(struct task_struct *task)
63{ 74{
64} 75}
76static inline void shm_init_task(struct task_struct *task)
77{
78}
65#endif 79#endif
66 80
67#endif /* _LINUX_SHM_H_ */ 81#endif /* _LINUX_SHM_H_ */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 4d1771c2d29f..50777b5b1e4c 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -1,6 +1,7 @@
1#ifndef __SHMEM_FS_H 1#ifndef __SHMEM_FS_H
2#define __SHMEM_FS_H 2#define __SHMEM_FS_H
3 3
4#include <linux/file.h>
4#include <linux/swap.h> 5#include <linux/swap.h>
5#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
6#include <linux/pagemap.h> 7#include <linux/pagemap.h>
@@ -11,6 +12,7 @@
11 12
12struct shmem_inode_info { 13struct shmem_inode_info {
13 spinlock_t lock; 14 spinlock_t lock;
15 unsigned int seals; /* shmem seals */
14 unsigned long flags; 16 unsigned long flags;
15 unsigned long alloced; /* data pages alloced to file */ 17 unsigned long alloced; /* data pages alloced to file */
16 union { 18 union {
@@ -65,4 +67,19 @@ static inline struct page *shmem_read_mapping_page(
65 mapping_gfp_mask(mapping)); 67 mapping_gfp_mask(mapping));
66} 68}
67 69
70#ifdef CONFIG_TMPFS
71
72extern int shmem_add_seals(struct file *file, unsigned int seals);
73extern int shmem_get_seals(struct file *file);
74extern long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
75
76#else
77
78static inline long shmem_fcntl(struct file *f, unsigned int c, unsigned long a)
79{
80 return -EINVAL;
81}
82
83#endif
84
68#endif 85#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c9e65360c49a..750196fcc0a5 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -280,9 +280,8 @@ struct ksignal {
280 int sig; 280 int sig;
281}; 281};
282 282
283extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 283extern int get_signal(struct ksignal *ksig);
284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
285extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
286extern void exit_signals(struct task_struct *tsk); 285extern void exit_signals(struct task_struct *tsk);
287extern void kernel_sigaction(int, __sighandler_t); 286extern void kernel_sigaction(int, __sighandler_t);
288 287
@@ -301,18 +300,6 @@ static inline void disallow_signal(int sig)
301 kernel_sigaction(sig, SIG_IGN); 300 kernel_sigaction(sig, SIG_IGN);
302} 301}
303 302
304/*
305 * Eventually that'll replace get_signal_to_deliver(); macro for now,
306 * to avoid nastiness with include order.
307 */
308#define get_signal(ksig) \
309({ \
310 struct ksignal *p = (ksig); \
311 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
312 signal_pt_regs(), NULL);\
313 p->sig > 0; \
314})
315
316extern struct kmem_cache *sighand_cachep; 303extern struct kmem_cache *sighand_cachep;
317 304
318int unhandled_signal(struct task_struct *tsk, int sig); 305int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ec89301ada41..abde271c18ae 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -112,8 +112,7 @@
112#define CHECKSUM_COMPLETE 2 112#define CHECKSUM_COMPLETE 2
113#define CHECKSUM_PARTIAL 3 113#define CHECKSUM_PARTIAL 3
114 114
115#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 115#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
116 ~(SMP_CACHE_BYTES - 1))
117#define SKB_WITH_OVERHEAD(X) \ 116#define SKB_WITH_OVERHEAD(X) \
118 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 117 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
119#define SKB_MAX_ORDER(X, ORDER) \ 118#define SKB_MAX_ORDER(X, ORDER) \
@@ -211,18 +210,9 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
211 * struct skb_shared_hwtstamps - hardware time stamps 210 * struct skb_shared_hwtstamps - hardware time stamps
212 * @hwtstamp: hardware time stamp transformed into duration 211 * @hwtstamp: hardware time stamp transformed into duration
213 * since arbitrary point in time 212 * since arbitrary point in time
214 * @syststamp: hwtstamp transformed to system time base
215 * 213 *
216 * Software time stamps generated by ktime_get_real() are stored in 214 * Software time stamps generated by ktime_get_real() are stored in
217 * skb->tstamp. The relation between the different kinds of time 215 * skb->tstamp.
218 * stamps is as follows:
219 *
220 * syststamp and tstamp can be compared against each other in
221 * arbitrary combinations. The accuracy of a
222 * syststamp/tstamp/"syststamp from other device" comparison is
223 * limited by the accuracy of the transformation into system time
224 * base. This depends on the device driver and its underlying
225 * hardware.
226 * 216 *
227 * hwtstamps can only be compared against other hwtstamps from 217 * hwtstamps can only be compared against other hwtstamps from
228 * the same device. 218 * the same device.
@@ -232,7 +222,6 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
232 */ 222 */
233struct skb_shared_hwtstamps { 223struct skb_shared_hwtstamps {
234 ktime_t hwtstamp; 224 ktime_t hwtstamp;
235 ktime_t syststamp;
236}; 225};
237 226
238/* Definitions for tx_flags in struct skb_shared_info */ 227/* Definitions for tx_flags in struct skb_shared_info */
@@ -240,7 +229,7 @@ enum {
240 /* generate hardware time stamp */ 229 /* generate hardware time stamp */
241 SKBTX_HW_TSTAMP = 1 << 0, 230 SKBTX_HW_TSTAMP = 1 << 0,
242 231
243 /* generate software time stamp */ 232 /* generate software time stamp when queueing packet to NIC */
244 SKBTX_SW_TSTAMP = 1 << 1, 233 SKBTX_SW_TSTAMP = 1 << 1,
245 234
246 /* device driver is going to provide hardware time stamp */ 235 /* device driver is going to provide hardware time stamp */
@@ -258,8 +247,19 @@ enum {
258 * all frags to avoid possible bad checksum 247 * all frags to avoid possible bad checksum
259 */ 248 */
260 SKBTX_SHARED_FRAG = 1 << 5, 249 SKBTX_SHARED_FRAG = 1 << 5,
250
251 /* generate software time stamp when entering packet scheduling */
252 SKBTX_SCHED_TSTAMP = 1 << 6,
253
254 /* generate software timestamp on peer data acknowledgment */
255 SKBTX_ACK_TSTAMP = 1 << 7,
261}; 256};
262 257
258#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \
259 SKBTX_SCHED_TSTAMP | \
260 SKBTX_ACK_TSTAMP)
261#define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP)
262
263/* 263/*
264 * The callback notifies userspace to release buffers when skb DMA is done in 264 * The callback notifies userspace to release buffers when skb DMA is done in
265 * lower device, the skb last reference should be 0 when calling this. 265 * lower device, the skb last reference should be 0 when calling this.
@@ -286,6 +286,7 @@ struct skb_shared_info {
286 unsigned short gso_type; 286 unsigned short gso_type;
287 struct sk_buff *frag_list; 287 struct sk_buff *frag_list;
288 struct skb_shared_hwtstamps hwtstamps; 288 struct skb_shared_hwtstamps hwtstamps;
289 u32 tskey;
289 __be32 ip6_frag_id; 290 __be32 ip6_frag_id;
290 291
291 /* 292 /*
@@ -455,6 +456,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
455 * @ooo_okay: allow the mapping of a socket to a queue to be changed 456 * @ooo_okay: allow the mapping of a socket to a queue to be changed
456 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 457 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
457 * ports. 458 * ports.
459 * @sw_hash: indicates hash was computed in software stack
458 * @wifi_acked_valid: wifi_acked was set 460 * @wifi_acked_valid: wifi_acked was set
459 * @wifi_acked: whether frame was acked on wifi or not 461 * @wifi_acked: whether frame was acked on wifi or not
460 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 462 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
@@ -562,6 +564,7 @@ struct sk_buff {
562 __u8 pfmemalloc:1; 564 __u8 pfmemalloc:1;
563 __u8 ooo_okay:1; 565 __u8 ooo_okay:1;
564 __u8 l4_hash:1; 566 __u8 l4_hash:1;
567 __u8 sw_hash:1;
565 __u8 wifi_acked_valid:1; 568 __u8 wifi_acked_valid:1;
566 __u8 wifi_acked:1; 569 __u8 wifi_acked:1;
567 __u8 no_fcs:1; 570 __u8 no_fcs:1;
@@ -575,7 +578,7 @@ struct sk_buff {
575 __u8 encap_hdr_csum:1; 578 __u8 encap_hdr_csum:1;
576 __u8 csum_valid:1; 579 __u8 csum_valid:1;
577 __u8 csum_complete_sw:1; 580 __u8 csum_complete_sw:1;
578 /* 3/5 bit hole (depending on ndisc_nodetype presence) */ 581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */
579 kmemcheck_bitfield_end(flags2); 582 kmemcheck_bitfield_end(flags2);
580 583
581#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -830,13 +833,14 @@ static inline void
830skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) 833skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type)
831{ 834{
832 skb->l4_hash = (type == PKT_HASH_TYPE_L4); 835 skb->l4_hash = (type == PKT_HASH_TYPE_L4);
836 skb->sw_hash = 0;
833 skb->hash = hash; 837 skb->hash = hash;
834} 838}
835 839
836void __skb_get_hash(struct sk_buff *skb); 840void __skb_get_hash(struct sk_buff *skb);
837static inline __u32 skb_get_hash(struct sk_buff *skb) 841static inline __u32 skb_get_hash(struct sk_buff *skb)
838{ 842{
839 if (!skb->l4_hash) 843 if (!skb->l4_hash && !skb->sw_hash)
840 __skb_get_hash(skb); 844 __skb_get_hash(skb);
841 845
842 return skb->hash; 846 return skb->hash;
@@ -850,6 +854,7 @@ static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
850static inline void skb_clear_hash(struct sk_buff *skb) 854static inline void skb_clear_hash(struct sk_buff *skb)
851{ 855{
852 skb->hash = 0; 856 skb->hash = 0;
857 skb->sw_hash = 0;
853 skb->l4_hash = 0; 858 skb->l4_hash = 0;
854} 859}
855 860
@@ -862,6 +867,7 @@ static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
862static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) 867static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
863{ 868{
864 to->hash = from->hash; 869 to->hash = from->hash;
870 to->sw_hash = from->sw_hash;
865 to->l4_hash = from->l4_hash; 871 to->l4_hash = from->l4_hash;
866}; 872};
867 873
@@ -2549,6 +2555,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2549void skb_scrub_packet(struct sk_buff *skb, bool xnet); 2555void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2550unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); 2556unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2551struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); 2557struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2558struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2552 2559
2553struct skb_checksum_ops { 2560struct skb_checksum_ops {
2554 __wsum (*update)(const void *mem, int len, __wsum wsum); 2561 __wsum (*update)(const void *mem, int len, __wsum wsum);
@@ -2697,6 +2704,10 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
2697void skb_complete_tx_timestamp(struct sk_buff *skb, 2704void skb_complete_tx_timestamp(struct sk_buff *skb,
2698 struct skb_shared_hwtstamps *hwtstamps); 2705 struct skb_shared_hwtstamps *hwtstamps);
2699 2706
2707void __skb_tstamp_tx(struct sk_buff *orig_skb,
2708 struct skb_shared_hwtstamps *hwtstamps,
2709 struct sock *sk, int tstype);
2710
2700/** 2711/**
2701 * skb_tstamp_tx - queue clone of skb with send time stamps 2712 * skb_tstamp_tx - queue clone of skb with send time stamps
2702 * @orig_skb: the original outgoing packet 2713 * @orig_skb: the original outgoing packet
@@ -3005,7 +3016,7 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
3005 return skb->queue_mapping != 0; 3016 return skb->queue_mapping != 0;
3006} 3017}
3007 3018
3008u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, 3019u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
3009 unsigned int num_tx_queues); 3020 unsigned int num_tx_queues);
3010 3021
3011static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 3022static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
diff --git a/include/linux/spi/cc2520.h b/include/linux/spi/cc2520.h
new file mode 100644
index 000000000000..85b8ee67e937
--- /dev/null
+++ b/include/linux/spi/cc2520.h
@@ -0,0 +1,26 @@
1/* Header file for cc2520 radio driver
2 *
3 * Copyright (C) 2014 Varka Bhadram <varkab@cdac.in>
4 * Md.Jamal Mohiuddin <mjmohiuddin@cdac.in>
5 * P Sowjanya <sowjanyap@cdac.in>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 */
13
14#ifndef __CC2520_H
15#define __CC2520_H
16
17struct cc2520_platform_data {
18 int fifo;
19 int fifop;
20 int cca;
21 int sfd;
22 int reset;
23 int vreg;
24};
25
26#endif
diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h
index 2e8db3d2d2e5..88a14d81c49e 100644
--- a/include/linux/spi/sh_msiof.h
+++ b/include/linux/spi/sh_msiof.h
@@ -5,6 +5,8 @@ struct sh_msiof_spi_info {
5 int tx_fifo_override; 5 int tx_fifo_override;
6 int rx_fifo_override; 6 int rx_fifo_override;
7 u16 num_chipselect; 7 u16 num_chipselect;
8 unsigned int dma_tx_id;
9 unsigned int dma_rx_id;
8}; 10};
9 11
10#endif /* __SPI_SH_MSIOF_H__ */ 12#endif /* __SPI_SH_MSIOF_H__ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index f9f931c89e3e..f7b9100686c3 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -345,6 +345,43 @@
345#define SSB_SPROM4_TXPID5GH2_SHIFT 0 345#define SSB_SPROM4_TXPID5GH2_SHIFT 0
346#define SSB_SPROM4_TXPID5GH3 0xFF00 346#define SSB_SPROM4_TXPID5GH3 0xFF00
347#define SSB_SPROM4_TXPID5GH3_SHIFT 8 347#define SSB_SPROM4_TXPID5GH3_SHIFT 8
348
349/* There are 4 blocks with power info sharing the same layout */
350#define SSB_SPROM4_PWR_INFO_CORE0 0x0080
351#define SSB_SPROM4_PWR_INFO_CORE1 0x00AE
352#define SSB_SPROM4_PWR_INFO_CORE2 0x00DC
353#define SSB_SPROM4_PWR_INFO_CORE3 0x010A
354
355#define SSB_SPROM4_2G_MAXP_ITSSI 0x00 /* 2 GHz ITSSI and 2 GHz Max Power */
356#define SSB_SPROM4_2G_MAXP 0x00FF
357#define SSB_SPROM4_2G_ITSSI 0xFF00
358#define SSB_SPROM4_2G_ITSSI_SHIFT 8
359#define SSB_SPROM4_2G_PA_0 0x02 /* 2 GHz power amp */
360#define SSB_SPROM4_2G_PA_1 0x04
361#define SSB_SPROM4_2G_PA_2 0x06
362#define SSB_SPROM4_2G_PA_3 0x08
363#define SSB_SPROM4_5G_MAXP_ITSSI 0x0A /* 5 GHz ITSSI and 5.3 GHz Max Power */
364#define SSB_SPROM4_5G_MAXP 0x00FF
365#define SSB_SPROM4_5G_ITSSI 0xFF00
366#define SSB_SPROM4_5G_ITSSI_SHIFT 8
367#define SSB_SPROM4_5GHL_MAXP 0x0C /* 5.2 GHz and 5.8 GHz Max Power */
368#define SSB_SPROM4_5GH_MAXP 0x00FF
369#define SSB_SPROM4_5GL_MAXP 0xFF00
370#define SSB_SPROM4_5GL_MAXP_SHIFT 8
371#define SSB_SPROM4_5G_PA_0 0x0E /* 5.3 GHz power amp */
372#define SSB_SPROM4_5G_PA_1 0x10
373#define SSB_SPROM4_5G_PA_2 0x12
374#define SSB_SPROM4_5G_PA_3 0x14
375#define SSB_SPROM4_5GL_PA_0 0x16 /* 5.2 GHz power amp */
376#define SSB_SPROM4_5GL_PA_1 0x18
377#define SSB_SPROM4_5GL_PA_2 0x1A
378#define SSB_SPROM4_5GL_PA_3 0x1C
379#define SSB_SPROM4_5GH_PA_0 0x1E /* 5.8 GHz power amp */
380#define SSB_SPROM4_5GH_PA_1 0x20
381#define SSB_SPROM4_5GH_PA_2 0x22
382#define SSB_SPROM4_5GH_PA_3 0x24
383
384/* TODO: Make it deprecated */
348#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ 385#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
349#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 386#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
350#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 387#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 6f27d4f957bd..cd63851b57f2 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -112,6 +112,8 @@ struct plat_stmmacenet_data {
112 int riwt_off; 112 int riwt_off;
113 int max_speed; 113 int max_speed;
114 int maxmtu; 114 int maxmtu;
115 int multicast_filter_bins;
116 int unicast_filter_entries;
115 void (*fix_mac_speed)(void *priv, unsigned int speed); 117 void (*fix_mac_speed)(void *priv, unsigned int speed);
116 void (*bus_setup)(void __iomem *ioaddr); 118 void (*bus_setup)(void __iomem *ioaddr);
117 void *(*setup)(struct platform_device *pdev); 119 void *(*setup)(struct platform_device *pdev);
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 790be1472792..8e030075fe79 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -103,6 +103,7 @@ struct rpc_auth_create_args {
103 103
104/* Flags for rpcauth_lookupcred() */ 104/* Flags for rpcauth_lookupcred() */
105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
106#define RPCAUTH_LOOKUP_RCU 0x02 /* lock-less lookup */
106 107
107/* 108/*
108 * Client authentication ops 109 * Client authentication ops
@@ -140,6 +141,7 @@ struct rpc_credops {
140 void *, __be32 *, void *); 141 void *, __be32 *, void *);
141 int (*crkey_timeout)(struct rpc_cred *); 142 int (*crkey_timeout)(struct rpc_cred *);
142 bool (*crkey_to_expire)(struct rpc_cred *); 143 bool (*crkey_to_expire)(struct rpc_cred *);
144 char * (*crstringify_acceptor)(struct rpc_cred *);
143}; 145};
144 146
145extern const struct rpc_authops authunix_ops; 147extern const struct rpc_authops authunix_ops;
@@ -153,6 +155,7 @@ void rpc_destroy_generic_auth(void);
153void rpc_destroy_authunix(void); 155void rpc_destroy_authunix(void);
154 156
155struct rpc_cred * rpc_lookup_cred(void); 157struct rpc_cred * rpc_lookup_cred(void);
158struct rpc_cred * rpc_lookup_cred_nonblock(void);
156struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 159struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
157int rpcauth_register(const struct rpc_authops *); 160int rpcauth_register(const struct rpc_authops *);
158int rpcauth_unregister(const struct rpc_authops *); 161int rpcauth_unregister(const struct rpc_authops *);
@@ -182,6 +185,7 @@ void rpcauth_clear_credcache(struct rpc_cred_cache *);
182int rpcauth_key_timeout_notify(struct rpc_auth *, 185int rpcauth_key_timeout_notify(struct rpc_auth *,
183 struct rpc_cred *); 186 struct rpc_cred *);
184bool rpcauth_cred_key_to_expire(struct rpc_cred *); 187bool rpcauth_cred_key_to_expire(struct rpc_cred *);
188char * rpcauth_stringify_acceptor(struct rpc_cred *);
185 189
186static inline 190static inline
187struct rpc_cred * get_rpccred(struct rpc_cred *cred) 191struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index f1cfd4c85cd0..36eebc451b41 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -69,8 +69,9 @@ struct gss_cl_ctx {
69 enum rpc_gss_proc gc_proc; 69 enum rpc_gss_proc gc_proc;
70 u32 gc_seq; 70 u32 gc_seq;
71 spinlock_t gc_seq_lock; 71 spinlock_t gc_seq_lock;
72 struct gss_ctx __rcu *gc_gss_ctx; 72 struct gss_ctx *gc_gss_ctx;
73 struct xdr_netobj gc_wire_ctx; 73 struct xdr_netobj gc_wire_ctx;
74 struct xdr_netobj gc_acceptor;
74 u32 gc_win; 75 u32 gc_win;
75 unsigned long gc_expiry; 76 unsigned long gc_expiry;
76 struct rcu_head gc_rcu; 77 struct rcu_head gc_rcu;
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 5af2931cf58d..df02a4188487 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -81,7 +81,7 @@ struct gss_krb5_enctype {
81 struct xdr_netobj *in, 81 struct xdr_netobj *in,
82 struct xdr_netobj *out); /* complete key generation */ 82 struct xdr_netobj *out); /* complete key generation */
83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset, 83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
84 struct xdr_buf *buf, int ec, 84 struct xdr_buf *buf,
85 struct page **pages); /* v2 encryption function */ 85 struct page **pages); /* v2 encryption function */
86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset, 86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
87 struct xdr_buf *buf, u32 *headskip, 87 struct xdr_buf *buf, u32 *headskip,
@@ -310,7 +310,7 @@ gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
310 310
311u32 311u32
312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset, 312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
313 struct xdr_buf *buf, int ec, 313 struct xdr_buf *buf,
314 struct page **pages); 314 struct page **pages);
315 315
316u32 316u32
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index ad7dbe2cfecd..1a8959944c5f 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -236,7 +236,7 @@ void * rpc_malloc(struct rpc_task *, size_t);
236void rpc_free(void *); 236void rpc_free(void *);
237int rpciod_up(void); 237int rpciod_up(void);
238void rpciod_down(void); 238void rpciod_down(void);
239int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 239int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *);
240#ifdef RPC_DEBUG 240#ifdef RPC_DEBUG
241struct net; 241struct net;
242void rpc_show_tasks(struct net *); 242void rpc_show_tasks(struct net *);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1bc7cd05b22e..cf61ecd148e0 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -236,7 +236,7 @@ struct svc_rqst {
236 struct svc_cred rq_cred; /* auth info */ 236 struct svc_cred rq_cred; /* auth info */
237 void * rq_xprt_ctxt; /* transport specific context ptr */ 237 void * rq_xprt_ctxt; /* transport specific context ptr */
238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
239 int rq_usedeferral; /* use deferral */ 239 bool rq_usedeferral; /* use deferral */
240 240
241 size_t rq_xprt_hlen; /* xprt header len */ 241 size_t rq_xprt_hlen; /* xprt header len */
242 struct xdr_buf rq_arg; 242 struct xdr_buf rq_arg;
@@ -277,7 +277,7 @@ struct svc_rqst {
277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
278 int rq_cachetype; 278 int rq_cachetype;
279 struct svc_cacherep * rq_cacherep; /* cache info */ 279 struct svc_cacherep * rq_cacherep; /* cache info */
280 int rq_splice_ok; /* turned off in gss privacy 280 bool rq_splice_ok; /* turned off in gss privacy
281 * to prevent encrypting page 281 * to prevent encrypting page
282 * cache pages */ 282 * cache pages */
283 wait_queue_head_t rq_wait; /* synchronization */ 283 wait_queue_head_t rq_wait; /* synchronization */
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index 5cf99a016368..975da754c778 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -174,8 +174,7 @@ struct svcxprt_rdma {
174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ 174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
175#define RPCRDMA_ORD (64/4) 175#define RPCRDMA_ORD (64/4)
176#define RPCRDMA_SQ_DEPTH_MULT 8 176#define RPCRDMA_SQ_DEPTH_MULT 8
177#define RPCRDMA_MAX_THREADS 16 177#define RPCRDMA_MAX_REQUESTS 32
178#define RPCRDMA_MAX_REQUESTS 16
179#define RPCRDMA_MAX_REQ_SIZE 4096 178#define RPCRDMA_MAX_REQ_SIZE 4096
180 179
181/* svc_rdma_marshal.c */ 180/* svc_rdma_marshal.c */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 7235040a19b2..ce6e4182a5b2 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -25,6 +25,7 @@ struct svc_xprt_ops {
25 void (*xpo_detach)(struct svc_xprt *); 25 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *);
27 int (*xpo_secure_port)(struct svc_rqst *); 27 int (*xpo_secure_port)(struct svc_rqst *);
28 void (*xpo_adjust_wspace)(struct svc_xprt *);
28}; 29};
29 30
30struct svc_xprt_class { 31struct svc_xprt_class {
@@ -33,6 +34,7 @@ struct svc_xprt_class {
33 struct svc_xprt_ops *xcl_ops; 34 struct svc_xprt_ops *xcl_ops;
34 struct list_head xcl_list; 35 struct list_head xcl_list;
35 u32 xcl_max_payload; 36 u32 xcl_max_payload;
37 int xcl_ident;
36}; 38};
37 39
38/* 40/*
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index c2f04e1ae159..64a0a0a97b23 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -62,8 +62,6 @@
62#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ 62#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
63 63
64/* memory registration strategies */ 64/* memory registration strategies */
65#define RPCRDMA_PERSISTENT_REGISTRATION (1)
66
67enum rpcrdma_memreg { 65enum rpcrdma_memreg {
68 RPCRDMA_BOUNCEBUFFERS = 0, 66 RPCRDMA_BOUNCEBUFFERS = 0,
69 RPCRDMA_REGISTER, 67 RPCRDMA_REGISTER,
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4bdbee80eede..1b72060f093a 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -311,7 +311,6 @@ extern void lru_add_page_tail(struct page *page, struct page *page_tail,
311 struct lruvec *lruvec, struct list_head *head); 311 struct lruvec *lruvec, struct list_head *head);
312extern void activate_page(struct page *); 312extern void activate_page(struct page *);
313extern void mark_page_accessed(struct page *); 313extern void mark_page_accessed(struct page *);
314extern void init_page_accessed(struct page *page);
315extern void lru_add_drain(void); 314extern void lru_add_drain(void);
316extern void lru_add_drain_cpu(int cpu); 315extern void lru_add_drain_cpu(int cpu);
317extern void lru_add_drain_all(void); 316extern void lru_add_drain_all(void);
@@ -321,6 +320,9 @@ extern void swap_setup(void);
321 320
322extern void add_page_to_unevictable_list(struct page *page); 321extern void add_page_to_unevictable_list(struct page *page);
323 322
323extern void lru_cache_add_active_or_unevictable(struct page *page,
324 struct vm_area_struct *vma);
325
324/* linux/mm/vmscan.c */ 326/* linux/mm/vmscan.c */
325extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 327extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
326 gfp_t gfp_mask, nodemask_t *mask); 328 gfp_t gfp_mask, nodemask_t *mask);
@@ -379,9 +381,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
379} 381}
380#endif 382#endif
381#ifdef CONFIG_MEMCG_SWAP 383#ifdef CONFIG_MEMCG_SWAP
382extern void mem_cgroup_uncharge_swap(swp_entry_t ent); 384extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry);
385extern void mem_cgroup_uncharge_swap(swp_entry_t entry);
383#else 386#else
384static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) 387static inline void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
388{
389}
390static inline void mem_cgroup_uncharge_swap(swp_entry_t entry)
385{ 391{
386} 392}
387#endif 393#endif
@@ -441,7 +447,7 @@ extern void swap_shmem_alloc(swp_entry_t);
441extern int swap_duplicate(swp_entry_t); 447extern int swap_duplicate(swp_entry_t);
442extern int swapcache_prepare(swp_entry_t); 448extern int swapcache_prepare(swp_entry_t);
443extern void swap_free(swp_entry_t); 449extern void swap_free(swp_entry_t);
444extern void swapcache_free(swp_entry_t, struct page *page); 450extern void swapcache_free(swp_entry_t);
445extern int free_swap_and_cache(swp_entry_t); 451extern int free_swap_and_cache(swp_entry_t);
446extern int swap_type_of(dev_t, sector_t, struct block_device **); 452extern int swap_type_of(dev_t, sector_t, struct block_device **);
447extern unsigned int count_swap_pages(int, int); 453extern unsigned int count_swap_pages(int, int);
@@ -505,7 +511,7 @@ static inline void swap_free(swp_entry_t swp)
505{ 511{
506} 512}
507 513
508static inline void swapcache_free(swp_entry_t swp, struct page *page) 514static inline void swapcache_free(swp_entry_t swp)
509{ 515{
510} 516}
511 517
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b0881a0ed322..0f86d85a9ce4 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -317,6 +317,10 @@ asmlinkage long sys_restart_syscall(void);
317asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 317asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
318 struct kexec_segment __user *segments, 318 struct kexec_segment __user *segments,
319 unsigned long flags); 319 unsigned long flags);
320asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
321 unsigned long cmdline_len,
322 const char __user *cmdline_ptr,
323 unsigned long flags);
320 324
321asmlinkage long sys_exit(int error_code); 325asmlinkage long sys_exit(int error_code);
322asmlinkage long sys_exit_group(int error_code); 326asmlinkage long sys_exit_group(int error_code);
@@ -802,6 +806,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
802asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); 806asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
803asmlinkage long sys_eventfd(unsigned int count); 807asmlinkage long sys_eventfd(unsigned int count);
804asmlinkage long sys_eventfd2(unsigned int count, int flags); 808asmlinkage long sys_eventfd2(unsigned int count, int flags);
809asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
805asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 810asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
806asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int); 811asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
807asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, 812asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
@@ -866,4 +871,9 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
866asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, 871asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
867 unsigned long idx1, unsigned long idx2); 872 unsigned long idx1, unsigned long idx2);
868asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); 873asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
874asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
875 const char __user *uargs);
876asmlinkage long sys_getrandom(char __user *buf, size_t count,
877 unsigned int flags);
878
869#endif 879#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 14a8ff2de11e..b7361f831226 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -34,8 +34,6 @@ struct ctl_table_root;
34struct ctl_table_header; 34struct ctl_table_header;
35struct ctl_dir; 35struct ctl_dir;
36 36
37typedef struct ctl_table ctl_table;
38
39typedef int proc_handler (struct ctl_table *ctl, int write, 37typedef int proc_handler (struct ctl_table *ctl, int write,
40 void __user *buffer, size_t *lenp, loff_t *ppos); 38 void __user *buffer, size_t *lenp, loff_t *ppos);
41 39
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index a0513210798f..fa5258f322e7 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -111,10 +111,7 @@ struct tcp_request_sock_ops;
111 111
112struct tcp_request_sock { 112struct tcp_request_sock {
113 struct inet_request_sock req; 113 struct inet_request_sock req;
114#ifdef CONFIG_TCP_MD5SIG
115 /* Only used by TCP MD5 Signature so far. */
116 const struct tcp_request_sock_ops *af_specific; 114 const struct tcp_request_sock_ops *af_specific;
117#endif
118 struct sock *listener; /* needed for TFO */ 115 struct sock *listener; /* needed for TFO */
119 u32 rcv_isn; 116 u32 rcv_isn;
120 u32 snt_isn; 117 u32 snt_isn;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index f7e11c7ea7d9..0305cde21a74 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -158,6 +158,42 @@ struct thermal_attr {
158 char name[THERMAL_NAME_LENGTH]; 158 char name[THERMAL_NAME_LENGTH];
159}; 159};
160 160
161/**
162 * struct thermal_zone_device - structure for a thermal zone
163 * @id: unique id number for each thermal zone
164 * @type: the thermal zone device type
165 * @device: &struct device for this thermal zone
166 * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature
167 * @trip_type_attrs: attributes for trip points for sysfs: trip type
168 * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
169 * @devdata: private pointer for device private data
170 * @trips: number of trip points the thermal zone supports
171 * @passive_delay: number of milliseconds to wait between polls when
172 * performing passive cooling. Currenty only used by the
173 * step-wise governor
174 * @polling_delay: number of milliseconds to wait between polls when
175 * checking whether trip points have been crossed (0 for
176 * interrupt driven systems)
177 * @temperature: current temperature. This is only for core code,
178 * drivers should use thermal_zone_get_temp() to get the
179 * current temperature
180 * @last_temperature: previous temperature read
181 * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION
182 * @passive: 1 if you've crossed a passive trip point, 0 otherwise.
183 * Currenty only used by the step-wise governor.
184 * @forced_passive: If > 0, temperature at which to switch on all ACPI
185 * processor cooling devices. Currently only used by the
186 * step-wise governor.
187 * @ops: operations this &thermal_zone_device supports
188 * @tzp: thermal zone parameters
189 * @governor: pointer to the governor for this thermal zone
190 * @thermal_instances: list of &struct thermal_instance of this thermal zone
191 * @idr: &struct idr to generate unique id for this zone's cooling
192 * devices
193 * @lock: lock to protect thermal_instances list
194 * @node: node in thermal_tz_list (in thermal_core.c)
195 * @poll_queue: delayed work for polling
196 */
161struct thermal_zone_device { 197struct thermal_zone_device {
162 int id; 198 int id;
163 char type[THERMAL_NAME_LENGTH]; 199 char type[THERMAL_NAME_LENGTH];
@@ -179,12 +215,18 @@ struct thermal_zone_device {
179 struct thermal_governor *governor; 215 struct thermal_governor *governor;
180 struct list_head thermal_instances; 216 struct list_head thermal_instances;
181 struct idr idr; 217 struct idr idr;
182 struct mutex lock; /* protect thermal_instances list */ 218 struct mutex lock;
183 struct list_head node; 219 struct list_head node;
184 struct delayed_work poll_queue; 220 struct delayed_work poll_queue;
185}; 221};
186 222
187/* Structure that holds thermal governor information */ 223/**
224 * struct thermal_governor - structure that holds thermal governor information
225 * @name: name of the governor
226 * @throttle: callback called for every trip point even if temperature is
227 * below the trip point temperature
228 * @governor_list: node in thermal_governor_list (in thermal_core.c)
229 */
188struct thermal_governor { 230struct thermal_governor {
189 char name[THERMAL_NAME_LENGTH]; 231 char name[THERMAL_NAME_LENGTH];
190 int (*throttle)(struct thermal_zone_device *tz, int trip); 232 int (*throttle)(struct thermal_zone_device *tz, int trip);
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b84773cb9f4c..059052306831 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -12,6 +12,7 @@
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h> 13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h> 14#include <linux/cpumask.h>
15#include <linux/sched.h>
15 16
16#ifdef CONFIG_GENERIC_CLOCKEVENTS 17#ifdef CONFIG_GENERIC_CLOCKEVENTS
17 18
@@ -162,6 +163,7 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
162#ifdef CONFIG_NO_HZ_FULL 163#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running; 164extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask; 165extern cpumask_var_t tick_nohz_full_mask;
166extern cpumask_var_t housekeeping_mask;
165 167
166static inline bool tick_nohz_full_enabled(void) 168static inline bool tick_nohz_full_enabled(void)
167{ 169{
@@ -181,7 +183,13 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 183
182extern void tick_nohz_init(void); 184extern void tick_nohz_init(void);
183extern void __tick_nohz_full_check(void); 185extern void __tick_nohz_full_check(void);
184extern void tick_nohz_full_kick(void); 186extern void tick_nohz_full_kick_cpu(int cpu);
187
188static inline void tick_nohz_full_kick(void)
189{
190 tick_nohz_full_kick_cpu(smp_processor_id());
191}
192
185extern void tick_nohz_full_kick_all(void); 193extern void tick_nohz_full_kick_all(void);
186extern void __tick_nohz_task_switch(struct task_struct *tsk); 194extern void __tick_nohz_task_switch(struct task_struct *tsk);
187#else 195#else
@@ -189,11 +197,30 @@ static inline void tick_nohz_init(void) { }
189static inline bool tick_nohz_full_enabled(void) { return false; } 197static inline bool tick_nohz_full_enabled(void) { return false; }
190static inline bool tick_nohz_full_cpu(int cpu) { return false; } 198static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { } 199static inline void __tick_nohz_full_check(void) { }
200static inline void tick_nohz_full_kick_cpu(int cpu) { }
192static inline void tick_nohz_full_kick(void) { } 201static inline void tick_nohz_full_kick(void) { }
193static inline void tick_nohz_full_kick_all(void) { } 202static inline void tick_nohz_full_kick_all(void) { }
194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } 203static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
195#endif 204#endif
196 205
206static inline bool is_housekeeping_cpu(int cpu)
207{
208#ifdef CONFIG_NO_HZ_FULL
209 if (tick_nohz_full_enabled())
210 return cpumask_test_cpu(cpu, housekeeping_mask);
211#endif
212 return true;
213}
214
215static inline void housekeeping_affine(struct task_struct *t)
216{
217#ifdef CONFIG_NO_HZ_FULL
218 if (tick_nohz_full_enabled())
219 set_cpus_allowed_ptr(t, housekeeping_mask);
220
221#endif
222}
223
197static inline void tick_nohz_full_check(void) 224static inline void tick_nohz_full_check(void)
198{ 225{
199 if (tick_nohz_full_enabled()) 226 if (tick_nohz_full_enabled())
diff --git a/include/linux/time.h b/include/linux/time.h
index d5d229b2e5af..8c42cf8d2444 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,19 +4,10 @@
4# include <linux/cache.h> 4# include <linux/cache.h>
5# include <linux/seqlock.h> 5# include <linux/seqlock.h>
6# include <linux/math64.h> 6# include <linux/math64.h>
7#include <uapi/linux/time.h> 7# include <linux/time64.h>
8 8
9extern struct timezone sys_tz; 9extern struct timezone sys_tz;
10 10
11/* Parameters used to convert the timespec values: */
12#define MSEC_PER_SEC 1000L
13#define USEC_PER_MSEC 1000L
14#define NSEC_PER_USEC 1000L
15#define NSEC_PER_MSEC 1000000L
16#define USEC_PER_SEC 1000000L
17#define NSEC_PER_SEC 1000000000L
18#define FSEC_PER_SEC 1000000000000000LL
19
20#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) 11#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
21 12
22static inline int timespec_equal(const struct timespec *a, 13static inline int timespec_equal(const struct timespec *a,
@@ -84,13 +75,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
84 return ts_delta; 75 return ts_delta;
85} 76}
86 77
87#define KTIME_MAX ((s64)~((u64)1 << 63))
88#if (BITS_PER_LONG == 64)
89# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
90#else
91# define KTIME_SEC_MAX LONG_MAX
92#endif
93
94/* 78/*
95 * Returns true if the timespec is norm, false if denorm: 79 * Returns true if the timespec is norm, false if denorm:
96 */ 80 */
@@ -115,27 +99,7 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
115 return true; 99 return true;
116} 100}
117 101
118extern bool persistent_clock_exist; 102extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
119
120static inline bool has_persistent_clock(void)
121{
122 return persistent_clock_exist;
123}
124
125extern void read_persistent_clock(struct timespec *ts);
126extern void read_boot_clock(struct timespec *ts);
127extern int persistent_clock_is_local;
128extern int update_persistent_clock(struct timespec now);
129void timekeeping_init(void);
130extern int timekeeping_suspended;
131
132unsigned long get_seconds(void);
133struct timespec current_kernel_time(void);
134struct timespec __current_kernel_time(void); /* does not take xtime_lock */
135struct timespec get_monotonic_coarse(void);
136void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
137 struct timespec *wtom, struct timespec *sleep);
138void timekeeping_inject_sleeptime(struct timespec *delta);
139 103
140#define CURRENT_TIME (current_kernel_time()) 104#define CURRENT_TIME (current_kernel_time())
141#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 105#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -153,33 +117,14 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
153extern u32 (*arch_gettimeoffset)(void); 117extern u32 (*arch_gettimeoffset)(void);
154#endif 118#endif
155 119
156extern void do_gettimeofday(struct timeval *tv);
157extern int do_settimeofday(const struct timespec *tv);
158extern int do_sys_settimeofday(const struct timespec *tv,
159 const struct timezone *tz);
160#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
161extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
162struct itimerval; 120struct itimerval;
163extern int do_setitimer(int which, struct itimerval *value, 121extern int do_setitimer(int which, struct itimerval *value,
164 struct itimerval *ovalue); 122 struct itimerval *ovalue);
165extern unsigned int alarm_setitimer(unsigned int seconds);
166extern int do_getitimer(int which, struct itimerval *value); 123extern int do_getitimer(int which, struct itimerval *value);
167extern int __getnstimeofday(struct timespec *tv);
168extern void getnstimeofday(struct timespec *tv);
169extern void getrawmonotonic(struct timespec *ts);
170extern void getnstime_raw_and_real(struct timespec *ts_raw,
171 struct timespec *ts_real);
172extern void getboottime(struct timespec *ts);
173extern void monotonic_to_bootbased(struct timespec *ts);
174extern void get_monotonic_boottime(struct timespec *ts);
175 124
176extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 125extern unsigned int alarm_setitimer(unsigned int seconds);
177extern int timekeeping_valid_for_hres(void); 126
178extern u64 timekeeping_max_deferment(void); 127extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
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);
183 128
184struct tms; 129struct tms;
185extern void do_sys_times(struct tms *); 130extern void do_sys_times(struct tms *);
diff --git a/include/linux/time64.h b/include/linux/time64.h
new file mode 100644
index 000000000000..a3831478d9cf
--- /dev/null
+++ b/include/linux/time64.h
@@ -0,0 +1,190 @@
1#ifndef _LINUX_TIME64_H
2#define _LINUX_TIME64_H
3
4#include <uapi/linux/time.h>
5
6typedef __s64 time64_t;
7
8/*
9 * This wants to go into uapi/linux/time.h once we agreed about the
10 * userspace interfaces.
11 */
12#if __BITS_PER_LONG == 64
13# define timespec64 timespec
14#else
15struct timespec64 {
16 time64_t tv_sec; /* seconds */
17 long tv_nsec; /* nanoseconds */
18};
19#endif
20
21/* Parameters used to convert the timespec values: */
22#define MSEC_PER_SEC 1000L
23#define USEC_PER_MSEC 1000L
24#define NSEC_PER_USEC 1000L
25#define NSEC_PER_MSEC 1000000L
26#define USEC_PER_SEC 1000000L
27#define NSEC_PER_SEC 1000000000L
28#define FSEC_PER_SEC 1000000000000000LL
29
30/* Located here for timespec[64]_valid_strict */
31#define KTIME_MAX ((s64)~((u64)1 << 63))
32#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
33
34#if __BITS_PER_LONG == 64
35
36static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
37{
38 return ts64;
39}
40
41static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
42{
43 return ts;
44}
45
46# define timespec64_equal timespec_equal
47# define timespec64_compare timespec_compare
48# define set_normalized_timespec64 set_normalized_timespec
49# define timespec64_add_safe timespec_add_safe
50# define timespec64_add timespec_add
51# define timespec64_sub timespec_sub
52# define timespec64_valid timespec_valid
53# define timespec64_valid_strict timespec_valid_strict
54# define timespec64_to_ns timespec_to_ns
55# define ns_to_timespec64 ns_to_timespec
56# define timespec64_add_ns timespec_add_ns
57
58#else
59
60static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
61{
62 struct timespec ret;
63
64 ret.tv_sec = (time_t)ts64.tv_sec;
65 ret.tv_nsec = ts64.tv_nsec;
66 return ret;
67}
68
69static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
70{
71 struct timespec64 ret;
72
73 ret.tv_sec = ts.tv_sec;
74 ret.tv_nsec = ts.tv_nsec;
75 return ret;
76}
77
78static inline int timespec64_equal(const struct timespec64 *a,
79 const struct timespec64 *b)
80{
81 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
82}
83
84/*
85 * lhs < rhs: return <0
86 * lhs == rhs: return 0
87 * lhs > rhs: return >0
88 */
89static inline int timespec64_compare(const struct timespec64 *lhs, const struct timespec64 *rhs)
90{
91 if (lhs->tv_sec < rhs->tv_sec)
92 return -1;
93 if (lhs->tv_sec > rhs->tv_sec)
94 return 1;
95 return lhs->tv_nsec - rhs->tv_nsec;
96}
97
98extern void set_normalized_timespec64(struct timespec64 *ts, time64_t sec, s64 nsec);
99
100/*
101 * timespec64_add_safe assumes both values are positive and checks for
102 * overflow. It will return TIME_T_MAX if the returned value would be
103 * smaller then either of the arguments.
104 */
105extern struct timespec64 timespec64_add_safe(const struct timespec64 lhs,
106 const struct timespec64 rhs);
107
108
109static inline struct timespec64 timespec64_add(struct timespec64 lhs,
110 struct timespec64 rhs)
111{
112 struct timespec64 ts_delta;
113 set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec,
114 lhs.tv_nsec + rhs.tv_nsec);
115 return ts_delta;
116}
117
118/*
119 * sub = lhs - rhs, in normalized form
120 */
121static inline struct timespec64 timespec64_sub(struct timespec64 lhs,
122 struct timespec64 rhs)
123{
124 struct timespec64 ts_delta;
125 set_normalized_timespec64(&ts_delta, lhs.tv_sec - rhs.tv_sec,
126 lhs.tv_nsec - rhs.tv_nsec);
127 return ts_delta;
128}
129
130/*
131 * Returns true if the timespec64 is norm, false if denorm:
132 */
133static inline bool timespec64_valid(const struct timespec64 *ts)
134{
135 /* Dates before 1970 are bogus */
136 if (ts->tv_sec < 0)
137 return false;
138 /* Can't have more nanoseconds then a second */
139 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
140 return false;
141 return true;
142}
143
144static inline bool timespec64_valid_strict(const struct timespec64 *ts)
145{
146 if (!timespec64_valid(ts))
147 return false;
148 /* Disallow values that could overflow ktime_t */
149 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
150 return false;
151 return true;
152}
153
154/**
155 * timespec64_to_ns - Convert timespec64 to nanoseconds
156 * @ts: pointer to the timespec64 variable to be converted
157 *
158 * Returns the scalar nanosecond representation of the timespec64
159 * parameter.
160 */
161static inline s64 timespec64_to_ns(const struct timespec64 *ts)
162{
163 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
164}
165
166/**
167 * ns_to_timespec64 - Convert nanoseconds to timespec64
168 * @nsec: the nanoseconds value to be converted
169 *
170 * Returns the timespec64 representation of the nsec parameter.
171 */
172extern struct timespec64 ns_to_timespec64(const s64 nsec);
173
174/**
175 * timespec64_add_ns - Adds nanoseconds to a timespec64
176 * @a: pointer to timespec64 to be incremented
177 * @ns: unsigned nanoseconds value to be added
178 *
179 * This must always be inlined because its used from the x86-64 vdso,
180 * which cannot call other kernel functions.
181 */
182static __always_inline void timespec64_add_ns(struct timespec64 *a, u64 ns)
183{
184 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
185 a->tv_nsec = ns;
186}
187
188#endif
189
190#endif /* _LINUX_TIME64_H */
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index c1825eb436ed..95640dcd1899 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -10,77 +10,100 @@
10#include <linux/jiffies.h> 10#include <linux/jiffies.h>
11#include <linux/time.h> 11#include <linux/time.h>
12 12
13/* Structure holding internal timekeeping values. */ 13/**
14struct timekeeper { 14 * struct tk_read_base - base structure for timekeeping readout
15 /* Current clocksource used for timekeeping. */ 15 * @clock: Current clocksource used for timekeeping.
16 * @read: Read function of @clock
17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks
18 * @cycle_last: @clock cycle value at last update
19 * @mult: NTP adjusted multiplier for scaled math conversion
20 * @shift: Shift value for scaled math conversion
21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout
22 * @base_mono: ktime_t (nanoseconds) base time for readout
23 *
24 * This struct has size 56 byte on 64 bit. Together with a seqcount it
25 * occupies a single 64byte cache line.
26 *
27 * The struct is separate from struct timekeeper as it is also used
28 * for a fast NMI safe accessor to clock monotonic.
29 */
30struct tk_read_base {
16 struct clocksource *clock; 31 struct clocksource *clock;
17 /* NTP adjusted clock multiplier */ 32 cycle_t (*read)(struct clocksource *cs);
33 cycle_t mask;
34 cycle_t cycle_last;
18 u32 mult; 35 u32 mult;
19 /* The shift value of the current clocksource. */
20 u32 shift; 36 u32 shift;
21 /* Number of clock cycles in one NTP interval. */ 37 u64 xtime_nsec;
38 ktime_t base_mono;
39};
40
41/**
42 * struct timekeeper - Structure holding internal timekeeping values.
43 * @tkr: The readout base structure
44 * @xtime_sec: Current CLOCK_REALTIME time in seconds
45 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset
46 * @offs_real: Offset clock monotonic -> clock realtime
47 * @offs_boot: Offset clock monotonic -> clock boottime
48 * @offs_tai: Offset clock monotonic -> clock tai
49 * @tai_offset: The current UTC to TAI offset in seconds
50 * @base_raw: Monotonic raw base time in ktime_t format
51 * @raw_time: Monotonic raw base time in timespec64 format
52 * @cycle_interval: Number of clock cycles in one NTP interval
53 * @xtime_interval: Number of clock shifted nano seconds in one NTP
54 * interval.
55 * @xtime_remainder: Shifted nano seconds left over when rounding
56 * @cycle_interval
57 * @raw_interval: Raw nano seconds accumulated per NTP interval.
58 * @ntp_error: Difference between accumulated time and NTP time in ntp
59 * shifted nano seconds.
60 * @ntp_error_shift: Shift conversion between clock shifted nano seconds and
61 * ntp shifted nano seconds.
62 *
63 * Note: For timespec(64) based interfaces wall_to_monotonic is what
64 * we need to add to xtime (or xtime corrected for sub jiffie times)
65 * to get to monotonic time. Monotonic is pegged at zero at system
66 * boot time, so wall_to_monotonic will be negative, however, we will
67 * ALWAYS keep the tv_nsec part positive so we can use the usual
68 * normalization.
69 *
70 * wall_to_monotonic is moved after resume from suspend for the
71 * monotonic time not to jump. We need to add total_sleep_time to
72 * wall_to_monotonic to get the real boot based time offset.
73 *
74 * wall_to_monotonic is no longer the boot time, getboottime must be
75 * used instead.
76 */
77struct timekeeper {
78 struct tk_read_base tkr;
79 u64 xtime_sec;
80 struct timespec64 wall_to_monotonic;
81 ktime_t offs_real;
82 ktime_t offs_boot;
83 ktime_t offs_tai;
84 s32 tai_offset;
85 ktime_t base_raw;
86 struct timespec64 raw_time;
87
88 /* The following members are for timekeeping internal use */
22 cycle_t cycle_interval; 89 cycle_t cycle_interval;
23 /* Last cycle value (also stored in clock->cycle_last) */
24 cycle_t cycle_last;
25 /* Number of clock shifted nano seconds in one NTP interval. */
26 u64 xtime_interval; 90 u64 xtime_interval;
27 /* shifted nano seconds left over when rounding cycle_interval */
28 s64 xtime_remainder; 91 s64 xtime_remainder;
29 /* Raw nano seconds accumulated per NTP interval. */
30 u32 raw_interval; 92 u32 raw_interval;
31 93 /* The ntp_tick_length() value currently being used.
32 /* Current CLOCK_REALTIME time in seconds */ 94 * This cached copy ensures we consistently apply the tick
33 u64 xtime_sec; 95 * length for an entire tick, as ntp_tick_length may change
34 /* Clock shifted nano seconds */ 96 * mid-tick, and we don't want to apply that new value to
35 u64 xtime_nsec; 97 * the tick in progress.
36 98 */
99 u64 ntp_tick;
37 /* Difference between accumulated time and NTP time in ntp 100 /* Difference between accumulated time and NTP time in ntp
38 * shifted nano seconds. */ 101 * shifted nano seconds. */
39 s64 ntp_error; 102 s64 ntp_error;
40 /* Shift conversion between clock shifted nano seconds and
41 * ntp shifted nano seconds. */
42 u32 ntp_error_shift; 103 u32 ntp_error_shift;
43 104 u32 ntp_err_mult;
44 /*
45 * wall_to_monotonic is what we need to add to xtime (or xtime corrected
46 * for sub jiffie times) to get to monotonic time. Monotonic is pegged
47 * at zero at system boot time, so wall_to_monotonic will be negative,
48 * however, we will ALWAYS keep the tv_nsec part positive so we can use
49 * the usual normalization.
50 *
51 * wall_to_monotonic is moved after resume from suspend for the
52 * monotonic time not to jump. We need to add total_sleep_time to
53 * wall_to_monotonic to get the real boot based time offset.
54 *
55 * - wall_to_monotonic is no longer the boot time, getboottime must be
56 * used instead.
57 */
58 struct timespec wall_to_monotonic;
59 /* Offset clock monotonic -> clock realtime */
60 ktime_t offs_real;
61 /* time spent in suspend */
62 struct timespec total_sleep_time;
63 /* Offset clock monotonic -> clock boottime */
64 ktime_t offs_boot;
65 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
66 struct timespec raw_time;
67 /* The current UTC to TAI offset in seconds */
68 s32 tai_offset;
69 /* Offset clock monotonic -> clock tai */
70 ktime_t offs_tai;
71
72}; 105};
73 106
74static inline struct timespec tk_xtime(struct timekeeper *tk)
75{
76 struct timespec ts;
77
78 ts.tv_sec = tk->xtime_sec;
79 ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
80 return ts;
81}
82
83
84#ifdef CONFIG_GENERIC_TIME_VSYSCALL 107#ifdef CONFIG_GENERIC_TIME_VSYSCALL
85 108
86extern void update_vsyscall(struct timekeeper *tk); 109extern void update_vsyscall(struct timekeeper *tk);
@@ -89,17 +112,10 @@ extern void update_vsyscall_tz(void);
89#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD) 112#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD)
90 113
91extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm, 114extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
92 struct clocksource *c, u32 mult); 115 struct clocksource *c, u32 mult,
116 cycle_t cycle_last);
93extern void update_vsyscall_tz(void); 117extern void update_vsyscall_tz(void);
94 118
95static inline void update_vsyscall(struct timekeeper *tk)
96{
97 struct timespec xt;
98
99 xt = tk_xtime(tk);
100 update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
101}
102
103#else 119#else
104 120
105static inline void update_vsyscall(struct timekeeper *tk) 121static inline void update_vsyscall(struct timekeeper *tk)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
new file mode 100644
index 000000000000..1caa6b04fdc5
--- /dev/null
+++ b/include/linux/timekeeping.h
@@ -0,0 +1,209 @@
1#ifndef _LINUX_TIMEKEEPING_H
2#define _LINUX_TIMEKEEPING_H
3
4/* Included from linux/ktime.h */
5
6void timekeeping_init(void);
7extern int timekeeping_suspended;
8
9/*
10 * Get and set timeofday
11 */
12extern void do_gettimeofday(struct timeval *tv);
13extern int do_settimeofday(const struct timespec *tv);
14extern int do_sys_settimeofday(const struct timespec *tv,
15 const struct timezone *tz);
16
17/*
18 * Kernel time accessors
19 */
20unsigned long get_seconds(void);
21struct timespec current_kernel_time(void);
22/* does not take xtime_lock */
23struct timespec __current_kernel_time(void);
24
25/*
26 * timespec based interfaces
27 */
28struct timespec get_monotonic_coarse(void);
29extern void getrawmonotonic(struct timespec *ts);
30extern void ktime_get_ts64(struct timespec64 *ts);
31
32extern int __getnstimeofday64(struct timespec64 *tv);
33extern void getnstimeofday64(struct timespec64 *tv);
34
35#if BITS_PER_LONG == 64
36static inline int __getnstimeofday(struct timespec *ts)
37{
38 return __getnstimeofday64(ts);
39}
40
41static inline void getnstimeofday(struct timespec *ts)
42{
43 getnstimeofday64(ts);
44}
45
46static inline void ktime_get_ts(struct timespec *ts)
47{
48 ktime_get_ts64(ts);
49}
50
51static inline void ktime_get_real_ts(struct timespec *ts)
52{
53 getnstimeofday64(ts);
54}
55
56#else
57static inline int __getnstimeofday(struct timespec *ts)
58{
59 struct timespec64 ts64;
60 int ret = __getnstimeofday64(&ts64);
61
62 *ts = timespec64_to_timespec(ts64);
63 return ret;
64}
65
66static inline void getnstimeofday(struct timespec *ts)
67{
68 struct timespec64 ts64;
69
70 getnstimeofday64(&ts64);
71 *ts = timespec64_to_timespec(ts64);
72}
73
74static inline void ktime_get_ts(struct timespec *ts)
75{
76 struct timespec64 ts64;
77
78 ktime_get_ts64(&ts64);
79 *ts = timespec64_to_timespec(ts64);
80}
81
82static inline void ktime_get_real_ts(struct timespec *ts)
83{
84 struct timespec64 ts64;
85
86 getnstimeofday64(&ts64);
87 *ts = timespec64_to_timespec(ts64);
88}
89#endif
90
91extern void getboottime(struct timespec *ts);
92
93#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
94#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
95
96/*
97 * ktime_t based interfaces
98 */
99
100enum tk_offsets {
101 TK_OFFS_REAL,
102 TK_OFFS_BOOT,
103 TK_OFFS_TAI,
104 TK_OFFS_MAX,
105};
106
107extern ktime_t ktime_get(void);
108extern ktime_t ktime_get_with_offset(enum tk_offsets offs);
109extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs);
110extern ktime_t ktime_get_raw(void);
111
112/**
113 * ktime_get_real - get the real (wall-) time in ktime_t format
114 */
115static inline ktime_t ktime_get_real(void)
116{
117 return ktime_get_with_offset(TK_OFFS_REAL);
118}
119
120/**
121 * ktime_get_boottime - Returns monotonic time since boot in ktime_t format
122 *
123 * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the
124 * time spent in suspend.
125 */
126static inline ktime_t ktime_get_boottime(void)
127{
128 return ktime_get_with_offset(TK_OFFS_BOOT);
129}
130
131/**
132 * ktime_get_clocktai - Returns the TAI time of day in ktime_t format
133 */
134static inline ktime_t ktime_get_clocktai(void)
135{
136 return ktime_get_with_offset(TK_OFFS_TAI);
137}
138
139/**
140 * ktime_mono_to_real - Convert monotonic time to clock realtime
141 */
142static inline ktime_t ktime_mono_to_real(ktime_t mono)
143{
144 return ktime_mono_to_any(mono, TK_OFFS_REAL);
145}
146
147static inline u64 ktime_get_ns(void)
148{
149 return ktime_to_ns(ktime_get());
150}
151
152static inline u64 ktime_get_real_ns(void)
153{
154 return ktime_to_ns(ktime_get_real());
155}
156
157static inline u64 ktime_get_boot_ns(void)
158{
159 return ktime_to_ns(ktime_get_boottime());
160}
161
162static inline u64 ktime_get_raw_ns(void)
163{
164 return ktime_to_ns(ktime_get_raw());
165}
166
167extern u64 ktime_get_mono_fast_ns(void);
168
169/*
170 * Timespec interfaces utilizing the ktime based ones
171 */
172static inline void get_monotonic_boottime(struct timespec *ts)
173{
174 *ts = ktime_to_timespec(ktime_get_boottime());
175}
176
177static inline void timekeeping_clocktai(struct timespec *ts)
178{
179 *ts = ktime_to_timespec(ktime_get_clocktai());
180}
181
182/*
183 * RTC specific
184 */
185extern void timekeeping_inject_sleeptime(struct timespec *delta);
186
187/*
188 * PPS accessor
189 */
190extern void getnstime_raw_and_real(struct timespec *ts_raw,
191 struct timespec *ts_real);
192
193/*
194 * Persistent clock related interfaces
195 */
196extern bool persistent_clock_exist;
197extern int persistent_clock_is_local;
198
199static inline bool has_persistent_clock(void)
200{
201 return persistent_clock_exist;
202}
203
204extern void read_persistent_clock(struct timespec *ts);
205extern void read_boot_clock(struct timespec *ts);
206extern int update_persistent_clock(struct timespec now);
207
208
209#endif
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index d3b57fa12225..bd36ce431e32 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -11,6 +11,9 @@
11/* For O_CLOEXEC and O_NONBLOCK */ 11/* For O_CLOEXEC and O_NONBLOCK */
12#include <linux/fcntl.h> 12#include <linux/fcntl.h>
13 13
14/* For _IO helpers */
15#include <linux/ioctl.h>
16
14/* 17/*
15 * CAREFUL: Check include/asm-generic/fcntl.h when defining 18 * CAREFUL: Check include/asm-generic/fcntl.h when defining
16 * new flags, since they might collide with O_* ones. We want 19 * new flags, since they might collide with O_* ones. We want
@@ -29,4 +32,6 @@
29/* Flags for timerfd_settime. */ 32/* Flags for timerfd_settime. */
30#define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET) 33#define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
31 34
35#define TFD_IOC_SET_TICKS _IOW('T', 0, u64)
36
32#endif /* _LINUX_TIMERFD_H */ 37#endif /* _LINUX_TIMERFD_H */
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index fff1d0976f80..8350c538b486 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -39,6 +39,9 @@ struct tpm_class_ops {
39 int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); 39 int (*send) (struct tpm_chip *chip, u8 *buf, size_t len);
40 void (*cancel) (struct tpm_chip *chip); 40 void (*cancel) (struct tpm_chip *chip);
41 u8 (*status) (struct tpm_chip *chip); 41 u8 (*status) (struct tpm_chip *chip);
42 bool (*update_timeouts)(struct tpm_chip *chip,
43 unsigned long *timeout_cap);
44
42}; 45};
43 46
44#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) 47#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE)
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index 136116924d8d..ea6c9dea79e3 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -25,6 +25,21 @@ trace_seq_init(struct trace_seq *s)
25 s->full = 0; 25 s->full = 0;
26} 26}
27 27
28/**
29 * trace_seq_buffer_ptr - return pointer to next location in buffer
30 * @s: trace sequence descriptor
31 *
32 * Returns the pointer to the buffer where the next write to
33 * the buffer will happen. This is useful to save the location
34 * that is about to be written to and then return the result
35 * of that write.
36 */
37static inline unsigned char *
38trace_seq_buffer_ptr(struct trace_seq *s)
39{
40 return s->buffer + s->len;
41}
42
28/* 43/*
29 * Currently only defined when tracing is enabled. 44 * Currently only defined when tracing is enabled.
30 */ 45 */
@@ -36,14 +51,13 @@ int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
36extern int 51extern int
37trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); 52trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
38extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); 53extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
39extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 54extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
40 size_t cnt); 55 int cnt);
41extern int trace_seq_puts(struct trace_seq *s, const char *str); 56extern int trace_seq_puts(struct trace_seq *s, const char *str);
42extern int trace_seq_putc(struct trace_seq *s, unsigned char c); 57extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
43extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len); 58extern int trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
44extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 59extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
45 size_t len); 60 unsigned int len);
46extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
47extern int trace_seq_path(struct trace_seq *s, const struct path *path); 61extern int trace_seq_path(struct trace_seq *s, const struct path *path);
48 62
49extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, 63extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
@@ -71,8 +85,8 @@ static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
71{ 85{
72 return 0; 86 return 0;
73} 87}
74static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 88static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
75 size_t cnt) 89 int cnt)
76{ 90{
77 return 0; 91 return 0;
78} 92}
@@ -85,19 +99,15 @@ static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
85 return 0; 99 return 0;
86} 100}
87static inline int 101static inline int
88trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) 102trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
89{ 103{
90 return 0; 104 return 0;
91} 105}
92static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 106static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
93 size_t len) 107 unsigned int len)
94{ 108{
95 return 0; 109 return 0;
96} 110}
97static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
98{
99 return NULL;
100}
101static inline int trace_seq_path(struct trace_seq *s, const struct path *path) 111static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
102{ 112{
103 return 0; 113 return 0;
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6f8ab7da27c4..84d497297c5f 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -133,10 +133,6 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
133 133
134/** 134/**
135 * tracehook_signal_handler - signal handler setup is complete 135 * tracehook_signal_handler - signal handler setup is complete
136 * @sig: number of signal being delivered
137 * @info: siginfo_t of signal being delivered
138 * @ka: sigaction setting that chose the handler
139 * @regs: user register state
140 * @stepping: nonzero if debugger single-step or block-step in use 136 * @stepping: nonzero if debugger single-step or block-step in use
141 * 137 *
142 * Called by the arch code after a signal handler has been set up. 138 * Called by the arch code after a signal handler has been set up.
@@ -146,9 +142,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
146 * Called without locks, shortly before returning to user mode 142 * Called without locks, shortly before returning to user mode
147 * (or handling more signals). 143 * (or handling more signals).
148 */ 144 */
149static inline void tracehook_signal_handler(int sig, siginfo_t *info, 145static inline void tracehook_signal_handler(int stepping)
150 const struct k_sigaction *ka,
151 struct pt_regs *regs, int stepping)
152{ 146{
153 if (stepping) 147 if (stepping)
154 ptrace_notify(SIGTRAP); 148 ptrace_notify(SIGTRAP);
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 2e2a5f7717e5..b1293f15f592 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -249,6 +249,50 @@ extern void syscall_unregfunc(void);
249 249
250#endif /* CONFIG_TRACEPOINTS */ 250#endif /* CONFIG_TRACEPOINTS */
251 251
252#ifdef CONFIG_TRACING
253/**
254 * tracepoint_string - register constant persistent string to trace system
255 * @str - a constant persistent string that will be referenced in tracepoints
256 *
257 * If constant strings are being used in tracepoints, it is faster and
258 * more efficient to just save the pointer to the string and reference
259 * that with a printf "%s" instead of saving the string in the ring buffer
260 * and wasting space and time.
261 *
262 * The problem with the above approach is that userspace tools that read
263 * the binary output of the trace buffers do not have access to the string.
264 * Instead they just show the address of the string which is not very
265 * useful to users.
266 *
267 * With tracepoint_string(), the string will be registered to the tracing
268 * system and exported to userspace via the debugfs/tracing/printk_formats
269 * file that maps the string address to the string text. This way userspace
270 * tools that read the binary buffers have a way to map the pointers to
271 * the ASCII strings they represent.
272 *
273 * The @str used must be a constant string and persistent as it would not
274 * make sense to show a string that no longer exists. But it is still fine
275 * to be used with modules, because when modules are unloaded, if they
276 * had tracepoints, the ring buffers are cleared too. As long as the string
277 * does not change during the life of the module, it is fine to use
278 * tracepoint_string() within a module.
279 */
280#define tracepoint_string(str) \
281 ({ \
282 static const char *___tp_str __tracepoint_string = str; \
283 ___tp_str; \
284 })
285#define __tracepoint_string __attribute__((section("__tracepoint_str")))
286#else
287/*
288 * tracepoint_string() is used to save the string address for userspace
289 * tracing tools. When tracing isn't configured, there's no need to save
290 * anything.
291 */
292# define tracepoint_string(str) str
293# define __tracepoint_string
294#endif
295
252/* 296/*
253 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype 297 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
254 * (void). "void" is a special value in a function prototype and can 298 * (void). "void" is a special value in a function prototype and can
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1c3316a47d7e..84132942902a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -477,13 +477,11 @@ extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
477 unsigned int cmd, unsigned long arg); 477 unsigned int cmd, unsigned long arg);
478extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 478extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
479extern void tty_default_fops(struct file_operations *fops); 479extern void tty_default_fops(struct file_operations *fops);
480extern struct tty_struct *alloc_tty_struct(void); 480extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx);
481extern int tty_alloc_file(struct file *file); 481extern int tty_alloc_file(struct file *file);
482extern void tty_add_file(struct tty_struct *tty, struct file *file); 482extern void tty_add_file(struct tty_struct *tty, struct file *file);
483extern void tty_free_file(struct file *file); 483extern void tty_free_file(struct file *file);
484extern void free_tty_struct(struct tty_struct *tty); 484extern void free_tty_struct(struct tty_struct *tty);
485extern void initialize_tty_struct(struct tty_struct *tty,
486 struct tty_driver *driver, int idx);
487extern void deinitialize_tty_struct(struct tty_struct *tty); 485extern void deinitialize_tty_struct(struct tty_struct *tty);
488extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); 486extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
489extern int tty_release(struct inode *inode, struct file *filp); 487extern int tty_release(struct inode *inode, struct file *filp);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 756a60989294..e48c608a8fa8 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -35,14 +35,14 @@
35 * This routine is mandatory; if this routine is not filled in, 35 * This routine is mandatory; if this routine is not filled in,
36 * the attempted open will fail with ENODEV. 36 * the attempted open will fail with ENODEV.
37 * 37 *
38 * Required method. 38 * Required method. Called with tty lock held.
39 * 39 *
40 * void (*close)(struct tty_struct * tty, struct file * filp); 40 * void (*close)(struct tty_struct * tty, struct file * filp);
41 * 41 *
42 * This routine is called when a particular tty device is closed. 42 * This routine is called when a particular tty device is closed.
43 * Note: called even if the corresponding open() failed. 43 * Note: called even if the corresponding open() failed.
44 * 44 *
45 * Required method. 45 * Required method. Called with tty lock held.
46 * 46 *
47 * void (*shutdown)(struct tty_struct * tty); 47 * void (*shutdown)(struct tty_struct * tty);
48 * 48 *
@@ -172,6 +172,8 @@
172 * 172 *
173 * Optional: 173 * Optional:
174 * 174 *
175 * Called with tty lock held.
176 *
175 * int (*break_ctl)(struct tty_struct *tty, int state); 177 * int (*break_ctl)(struct tty_struct *tty, int state);
176 * 178 *
177 * This optional routine requests the tty driver to turn on or 179 * This optional routine requests the tty driver to turn on or
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 09a7cffc224e..48d64e6ab292 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -84,7 +84,7 @@ unsigned long iov_iter_alignment(const struct iov_iter *i);
84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, 84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
85 unsigned long nr_segs, size_t count); 85 unsigned long nr_segs, size_t count);
86ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, 86ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
87 size_t maxsize, size_t *start); 87 unsigned maxpages, size_t *start);
88ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, 88ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
89 size_t maxsize, size_t *start); 89 size_t maxsize, size_t *start);
90int iov_iter_npages(const struct iov_iter *i, int maxpages); 90int iov_iter_npages(const struct iov_iter *i, int maxpages);
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 7373203140e7..c330f5ef42cf 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -386,6 +386,21 @@ struct usb_composite_driver {
386 386
387extern int usb_composite_probe(struct usb_composite_driver *driver); 387extern int usb_composite_probe(struct usb_composite_driver *driver);
388extern void usb_composite_unregister(struct usb_composite_driver *driver); 388extern void usb_composite_unregister(struct usb_composite_driver *driver);
389
390/**
391 * module_usb_composite_driver() - Helper macro for registering a USB gadget
392 * composite driver
393 * @__usb_composite_driver: usb_composite_driver struct
394 *
395 * Helper macro for USB gadget composite drivers which do not do anything
396 * special in module init/exit. This eliminates a lot of boilerplate. Each
397 * module may only use this macro once, and calling it replaces module_init()
398 * and module_exit()
399 */
400#define module_usb_composite_driver(__usb_composite_driver) \
401 module_driver(__usb_composite_driver, usb_composite_probe, \
402 usb_composite_unregister)
403
389extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 404extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
390extern int composite_dev_prepare(struct usb_composite_driver *composite, 405extern int composite_dev_prepare(struct usb_composite_driver *composite,
391 struct usb_composite_dev *cdev); 406 struct usb_composite_dev *cdev);
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 52f944dfe2fd..55a17b188daa 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -30,4 +30,15 @@
30 descriptor */ 30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040 31#define USB_QUIRK_DELAY_INIT 0x00000040
32 32
33/*
34 * For high speed and super speed interupt endpoints, the USB 2.0 and
35 * USB 3.0 spec require the interval in microframes
36 * (1 microframe = 125 microseconds) to be calculated as
37 * interval = 2 ^ (bInterval-1).
38 *
39 * Devices with this quirk report their bInterval as the result of this
40 * calculation instead of the exponent variable used in the calculation.
41 */
42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080
43
33#endif /* __LINUX_USB_QUIRKS_H */ 44#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index e452ba6ec6bd..d5952bb66752 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -153,6 +153,9 @@ struct renesas_usbhs_driver_param {
153 */ 153 */
154 int pio_dma_border; /* default is 64byte */ 154 int pio_dma_border; /* default is 64byte */
155 155
156 u32 type;
157 u32 enable_gpio;
158
156 /* 159 /*
157 * option: 160 * option:
158 */ 161 */
@@ -160,6 +163,9 @@ struct renesas_usbhs_driver_param {
160 u32 has_sudmac:1; /* for SUDMAC */ 163 u32 has_sudmac:1; /* for SUDMAC */
161}; 164};
162 165
166#define USBHS_TYPE_R8A7790 1
167#define USBHS_TYPE_R8A7791 2
168
163/* 169/*
164 * option: 170 * option:
165 * 171 *
diff --git a/include/linux/usb/usb338x.h b/include/linux/usb/usb338x.h
new file mode 100644
index 000000000000..f92eb635b9d3
--- /dev/null
+++ b/include/linux/usb/usb338x.h
@@ -0,0 +1,199 @@
1/*
2 * USB 338x super/high/full speed USB device controller.
3 * Unlike many such controllers, this one talks PCI.
4 *
5 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
6 * Copyright (C) 2003 David Brownell
7 * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#ifndef __LINUX_USB_USB338X_H
22#define __LINUX_USB_USB338X_H
23
24#include <linux/usb/net2280.h>
25
26/*
27 * Extra defined bits for net2280 registers
28 */
29#define SCRATCH 0x0b
30
31#define DEFECT7374_FSM_FIELD 28
32#define SUPER_SPEED 8
33#define DMA_REQUEST_OUTSTANDING 5
34#define DMA_PAUSE_DONE_INTERRUPT 26
35#define SET_ISOCHRONOUS_DELAY 24
36#define SET_SEL 22
37#define SUPER_SPEED_MODE 8
38
39/*ep_cfg*/
40#define MAX_BURST_SIZE 24
41#define EP_FIFO_BYTE_COUNT 16
42#define IN_ENDPOINT_ENABLE 14
43#define IN_ENDPOINT_TYPE 12
44#define OUT_ENDPOINT_ENABLE 10
45#define OUT_ENDPOINT_TYPE 8
46
47struct usb338x_usb_ext_regs {
48 u32 usbclass;
49#define DEVICE_PROTOCOL 16
50#define DEVICE_SUB_CLASS 8
51#define DEVICE_CLASS 0
52 u32 ss_sel;
53#define U2_SYSTEM_EXIT_LATENCY 8
54#define U1_SYSTEM_EXIT_LATENCY 0
55 u32 ss_del;
56#define U2_DEVICE_EXIT_LATENCY 8
57#define U1_DEVICE_EXIT_LATENCY 0
58 u32 usb2lpm;
59#define USB_L1_LPM_HIRD 2
60#define USB_L1_LPM_REMOTE_WAKE 1
61#define USB_L1_LPM_SUPPORT 0
62 u32 usb3belt;
63#define BELT_MULTIPLIER 10
64#define BEST_EFFORT_LATENCY_TOLERANCE 0
65 u32 usbctl2;
66#define LTM_ENABLE 7
67#define U2_ENABLE 6
68#define U1_ENABLE 5
69#define FUNCTION_SUSPEND 4
70#define USB3_CORE_ENABLE 3
71#define USB2_CORE_ENABLE 2
72#define SERIAL_NUMBER_STRING_ENABLE 0
73 u32 in_timeout;
74#define GPEP3_TIMEOUT 19
75#define GPEP2_TIMEOUT 18
76#define GPEP1_TIMEOUT 17
77#define GPEP0_TIMEOUT 16
78#define GPEP3_TIMEOUT_VALUE 13
79#define GPEP3_TIMEOUT_ENABLE 12
80#define GPEP2_TIMEOUT_VALUE 9
81#define GPEP2_TIMEOUT_ENABLE 8
82#define GPEP1_TIMEOUT_VALUE 5
83#define GPEP1_TIMEOUT_ENABLE 4
84#define GPEP0_TIMEOUT_VALUE 1
85#define GPEP0_TIMEOUT_ENABLE 0
86 u32 isodelay;
87#define ISOCHRONOUS_DELAY 0
88} __packed;
89
90struct usb338x_fifo_regs {
91 /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */
92 u32 ep_fifo_size_base;
93#define IN_FIFO_BASE_ADDRESS 22
94#define IN_FIFO_SIZE 16
95#define OUT_FIFO_BASE_ADDRESS 6
96#define OUT_FIFO_SIZE 0
97 u32 ep_fifo_out_wrptr;
98 u32 ep_fifo_out_rdptr;
99 u32 ep_fifo_in_wrptr;
100 u32 ep_fifo_in_rdptr;
101 u32 unused[3];
102} __packed;
103
104
105/* Link layer */
106struct usb338x_ll_regs {
107 /* offset 0x700 */
108 u32 ll_ltssm_ctrl1;
109 u32 ll_ltssm_ctrl2;
110 u32 ll_ltssm_ctrl3;
111 u32 unused[2];
112 u32 ll_general_ctrl0;
113 u32 ll_general_ctrl1;
114#define PM_U3_AUTO_EXIT 29
115#define PM_U2_AUTO_EXIT 28
116#define PM_U1_AUTO_EXIT 27
117#define PM_FORCE_U2_ENTRY 26
118#define PM_FORCE_U1_ENTRY 25
119#define PM_LGO_COLLISION_SEND_LAU 24
120#define PM_DIR_LINK_REJECT 23
121#define PM_FORCE_LINK_ACCEPT 22
122#define PM_DIR_ENTRY_U3 20
123#define PM_DIR_ENTRY_U2 19
124#define PM_DIR_ENTRY_U1 18
125#define PM_U2_ENABLE 17
126#define PM_U1_ENABLE 16
127#define SKP_THRESHOLD_ADJUST_FMW 8
128#define RESEND_DPP_ON_LRTY_FMW 7
129#define DL_BIT_VALUE_FMW 6
130#define FORCE_DL_BIT 5
131 u32 ll_general_ctrl2;
132#define SELECT_INVERT_LANE_POLARITY 7
133#define FORCE_INVERT_LANE_POLARITY 6
134 u32 ll_general_ctrl3;
135 u32 ll_general_ctrl4;
136 u32 ll_error_gen;
137} __packed;
138
139struct usb338x_ll_lfps_regs {
140 /* offset 0x748 */
141 u32 ll_lfps_5;
142#define TIMER_LFPS_6US 16
143 u32 ll_lfps_6;
144#define TIMER_LFPS_80US 0
145} __packed;
146
147struct usb338x_ll_tsn_regs {
148 /* offset 0x77C */
149 u32 ll_tsn_counters_2;
150#define HOT_TX_NORESET_TS2 24
151 u32 ll_tsn_counters_3;
152#define HOT_RX_RESET_TS2 0
153} __packed;
154
155struct usb338x_ll_chi_regs {
156 /* offset 0x79C */
157 u32 ll_tsn_chicken_bit;
158#define RECOVERY_IDLE_TO_RECOVER_FMW 3
159} __packed;
160
161/* protocol layer */
162struct usb338x_pl_regs {
163 /* offset 0x800 */
164 u32 pl_reg_1;
165 u32 pl_reg_2;
166 u32 pl_reg_3;
167 u32 pl_reg_4;
168 u32 pl_ep_ctrl;
169 /* Protocol Layer Endpoint Control*/
170#define PL_EP_CTRL 0x810
171#define ENDPOINT_SELECT 0
172 /* [4:0] */
173#define EP_INITIALIZED 16
174#define SEQUENCE_NUMBER_RESET 17
175#define CLEAR_ACK_ERROR_CODE 20
176 u32 pl_reg_6;
177 u32 pl_reg_7;
178 u32 pl_reg_8;
179 u32 pl_ep_status_1;
180 /* Protocol Layer Endpoint Status 1*/
181#define PL_EP_STATUS_1 0x820
182#define STATE 16
183#define ACK_GOOD_NORMAL 0x11
184#define ACK_GOOD_MORE_ACKS_TO_COME 0x16
185 u32 pl_ep_status_2;
186 u32 pl_ep_status_3;
187 /* Protocol Layer Endpoint Status 3*/
188#define PL_EP_STATUS_3 0x828
189#define SEQUENCE_NUMBER 0
190 u32 pl_ep_status_4;
191 /* Protocol Layer Endpoint Status 4*/
192#define PL_EP_STATUS_4 0x82c
193 u32 pl_ep_cfg_4;
194 /* Protocol Layer Endpoint Configuration 4*/
195#define PL_EP_CFG_4 0x830
196#define NON_CTRL_IN_TOLERATE_BAD_DIR 6
197} __packed;
198
199#endif /* __LINUX_USB_USB338X_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0662e98fef72..26088feb6608 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -148,6 +148,9 @@ struct driver_info {
148 struct sk_buff *(*tx_fixup)(struct usbnet *dev, 148 struct sk_buff *(*tx_fixup)(struct usbnet *dev,
149 struct sk_buff *skb, gfp_t flags); 149 struct sk_buff *skb, gfp_t flags);
150 150
151 /* recover from timeout */
152 void (*recover)(struct usbnet *dev);
153
151 /* early initialization code, can sleep. This is for minidrivers 154 /* early initialization code, can sleep. This is for minidrivers
152 * having 'subminidrivers' that need to do extra initialization 155 * having 'subminidrivers' that need to do extra initialization
153 * right after minidriver have initialized hardware. */ 156 * right after minidriver have initialized hardware. */
diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
new file mode 100644
index 000000000000..376654b5b0f7
--- /dev/null
+++ b/include/linux/usb/xhci_pdriver.h
@@ -0,0 +1,27 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful, but
7 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9 * for more details.
10 *
11 */
12
13#ifndef __USB_CORE_XHCI_PDRIVER_H
14#define __USB_CORE_XHCI_PDRIVER_H
15
16/**
17 * struct usb_xhci_pdata - platform_data for generic xhci platform driver
18 *
19 * @usb3_lpm_capable: determines if this xhci platform supports USB3
20 * LPM capability
21 *
22 */
23struct usb_xhci_pdata {
24 unsigned usb3_lpm_capable:1;
25};
26
27#endif /* __USB_CORE_XHCI_PDRIVER_H */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4836ba3c1cd8..e95372654f09 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -57,9 +57,9 @@ static inline void put_user_ns(struct user_namespace *ns)
57} 57}
58 58
59struct seq_operations; 59struct seq_operations;
60extern struct seq_operations proc_uid_seq_operations; 60extern const struct seq_operations proc_uid_seq_operations;
61extern struct seq_operations proc_gid_seq_operations; 61extern const struct seq_operations proc_gid_seq_operations;
62extern struct seq_operations proc_projid_seq_operations; 62extern const struct seq_operations proc_projid_seq_operations;
63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); 63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); 64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *); 65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/verify_pefile.h b/include/linux/verify_pefile.h
new file mode 100644
index 000000000000..ac34819214f9
--- /dev/null
+++ b/include/linux/verify_pefile.h
@@ -0,0 +1,18 @@
1/* Signed PE file verification
2 *
3 * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_VERIFY_PEFILE_H
13#define _LINUX_VERIFY_PEFILE_H
14
15extern int verify_pefile_signature(const void *pebuf, unsigned pelen,
16 struct key *trusted_keyring, bool *_trusted);
17
18#endif /* _LINUX_VERIFY_PEFILE_H */
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 8ec980b5e3af..d3204115f15d 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -98,4 +98,27 @@ extern int vfio_external_user_iommu_id(struct vfio_group *group);
98extern long vfio_external_check_extension(struct vfio_group *group, 98extern long vfio_external_check_extension(struct vfio_group *group,
99 unsigned long arg); 99 unsigned long arg);
100 100
101struct pci_dev;
102#ifdef CONFIG_EEH
103extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
104extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
105extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
106 unsigned int cmd,
107 unsigned long arg);
108#else
109static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
110{
111}
112
113static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
114{
115}
116
117static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
118 unsigned int cmd,
119 unsigned long arg)
120{
121 return -ENOTTY;
122}
123#endif /* CONFIG_EEH */
101#endif /* VFIO_H */ 124#endif /* VFIO_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4b8a89189a29..b87696fdf06a 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -113,7 +113,7 @@ extern struct vm_struct *remove_vm_area(const void *addr);
113extern struct vm_struct *find_vm_area(const void *addr); 113extern struct vm_struct *find_vm_area(const void *addr);
114 114
115extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 115extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
116 struct page ***pages); 116 struct page **pages);
117#ifdef CONFIG_MMU 117#ifdef CONFIG_MMU
118extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 118extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
119 pgprot_t prot, struct page **pages); 119 pgprot_t prot, struct page **pages);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index bd68819f0815..6fb1ba5f9b2f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -25,6 +25,7 @@ struct wait_bit_key {
25 void *flags; 25 void *flags;
26 int bit_nr; 26 int bit_nr;
27#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
28 unsigned long private;
28}; 29};
29 30
30struct wait_bit_queue { 31struct wait_bit_queue {
@@ -141,18 +142,19 @@ __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old)
141 list_del(&old->task_list); 142 list_del(&old->task_list);
142} 143}
143 144
145typedef int wait_bit_action_f(struct wait_bit_key *);
144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 146void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
145void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 147void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
146void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 148void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 149void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 150void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
149void __wake_up_bit(wait_queue_head_t *, void *, int); 151void __wake_up_bit(wait_queue_head_t *, void *, int);
150int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 152int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned);
151int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 153int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_action_f *, unsigned);
152void wake_up_bit(void *, int); 154void wake_up_bit(void *, int);
153void wake_up_atomic_t(atomic_t *); 155void wake_up_atomic_t(atomic_t *);
154int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); 156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned);
155int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); 157int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned);
156int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); 158int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
157wait_queue_head_t *bit_waitqueue(void *, int); 159wait_queue_head_t *bit_waitqueue(void *, int);
158 160
@@ -854,11 +856,14 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
854 (wait)->flags = 0; \ 856 (wait)->flags = 0; \
855 } while (0) 857 } while (0)
856 858
859
860extern int bit_wait(struct wait_bit_key *);
861extern int bit_wait_io(struct wait_bit_key *);
862
857/** 863/**
858 * wait_on_bit - wait for a bit to be cleared 864 * wait_on_bit - wait for a bit to be cleared
859 * @word: the word being waited on, a kernel virtual address 865 * @word: the word being waited on, a kernel virtual address
860 * @bit: the bit of the word being waited on 866 * @bit: the bit of the word being waited on
861 * @action: the function used to sleep, which may take special actions
862 * @mode: the task state to sleep in 867 * @mode: the task state to sleep in
863 * 868 *
864 * There is a standard hashed waitqueue table for generic use. This 869 * There is a standard hashed waitqueue table for generic use. This
@@ -867,9 +872,62 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
867 * call wait_on_bit() in threads waiting for the bit to clear. 872 * call wait_on_bit() in threads waiting for the bit to clear.
868 * One uses wait_on_bit() where one is waiting for the bit to clear, 873 * One uses wait_on_bit() where one is waiting for the bit to clear,
869 * but has no intention of setting it. 874 * but has no intention of setting it.
875 * Returned value will be zero if the bit was cleared, or non-zero
876 * if the process received a signal and the mode permitted wakeup
877 * on that signal.
878 */
879static inline int
880wait_on_bit(void *word, int bit, unsigned mode)
881{
882 if (!test_bit(bit, word))
883 return 0;
884 return out_of_line_wait_on_bit(word, bit,
885 bit_wait,
886 mode);
887}
888
889/**
890 * wait_on_bit_io - wait for a bit to be cleared
891 * @word: the word being waited on, a kernel virtual address
892 * @bit: the bit of the word being waited on
893 * @mode: the task state to sleep in
894 *
895 * Use the standard hashed waitqueue table to wait for a bit
896 * to be cleared. This is similar to wait_on_bit(), but calls
897 * io_schedule() instead of schedule() for the actual waiting.
898 *
899 * Returned value will be zero if the bit was cleared, or non-zero
900 * if the process received a signal and the mode permitted wakeup
901 * on that signal.
902 */
903static inline int
904wait_on_bit_io(void *word, int bit, unsigned mode)
905{
906 if (!test_bit(bit, word))
907 return 0;
908 return out_of_line_wait_on_bit(word, bit,
909 bit_wait_io,
910 mode);
911}
912
913/**
914 * wait_on_bit_action - wait for a bit to be cleared
915 * @word: the word being waited on, a kernel virtual address
916 * @bit: the bit of the word being waited on
917 * @action: the function used to sleep, which may take special actions
918 * @mode: the task state to sleep in
919 *
920 * Use the standard hashed waitqueue table to wait for a bit
921 * to be cleared, and allow the waiting action to be specified.
922 * This is like wait_on_bit() but allows fine control of how the waiting
923 * is done.
924 *
925 * Returned value will be zero if the bit was cleared, or non-zero
926 * if the process received a signal and the mode permitted wakeup
927 * on that signal.
870 */ 928 */
871static inline int 929static inline int
872wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode) 930wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
873{ 931{
874 if (!test_bit(bit, word)) 932 if (!test_bit(bit, word))
875 return 0; 933 return 0;
@@ -880,7 +938,6 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
880 * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it 938 * wait_on_bit_lock - wait for a bit to be cleared, when wanting to set it
881 * @word: the word being waited on, a kernel virtual address 939 * @word: the word being waited on, a kernel virtual address
882 * @bit: the bit of the word being waited on 940 * @bit: the bit of the word being waited on
883 * @action: the function used to sleep, which may take special actions
884 * @mode: the task state to sleep in 941 * @mode: the task state to sleep in
885 * 942 *
886 * There is a standard hashed waitqueue table for generic use. This 943 * There is a standard hashed waitqueue table for generic use. This
@@ -891,9 +948,61 @@ wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
891 * wait_on_bit() in threads waiting to be able to set the bit. 948 * wait_on_bit() in threads waiting to be able to set the bit.
892 * One uses wait_on_bit_lock() where one is waiting for the bit to 949 * One uses wait_on_bit_lock() where one is waiting for the bit to
893 * clear with the intention of setting it, and when done, clearing it. 950 * clear with the intention of setting it, and when done, clearing it.
951 *
952 * Returns zero if the bit was (eventually) found to be clear and was
953 * set. Returns non-zero if a signal was delivered to the process and
954 * the @mode allows that signal to wake the process.
955 */
956static inline int
957wait_on_bit_lock(void *word, int bit, unsigned mode)
958{
959 if (!test_and_set_bit(bit, word))
960 return 0;
961 return out_of_line_wait_on_bit_lock(word, bit, bit_wait, mode);
962}
963
964/**
965 * wait_on_bit_lock_io - wait for a bit to be cleared, when wanting to set it
966 * @word: the word being waited on, a kernel virtual address
967 * @bit: the bit of the word being waited on
968 * @mode: the task state to sleep in
969 *
970 * Use the standard hashed waitqueue table to wait for a bit
971 * to be cleared and then to atomically set it. This is similar
972 * to wait_on_bit(), but calls io_schedule() instead of schedule()
973 * for the actual waiting.
974 *
975 * Returns zero if the bit was (eventually) found to be clear and was
976 * set. Returns non-zero if a signal was delivered to the process and
977 * the @mode allows that signal to wake the process.
978 */
979static inline int
980wait_on_bit_lock_io(void *word, int bit, unsigned mode)
981{
982 if (!test_and_set_bit(bit, word))
983 return 0;
984 return out_of_line_wait_on_bit_lock(word, bit, bit_wait_io, mode);
985}
986
987/**
988 * wait_on_bit_lock_action - wait for a bit to be cleared, when wanting to set it
989 * @word: the word being waited on, a kernel virtual address
990 * @bit: the bit of the word being waited on
991 * @action: the function used to sleep, which may take special actions
992 * @mode: the task state to sleep in
993 *
994 * Use the standard hashed waitqueue table to wait for a bit
995 * to be cleared and then to set it, and allow the waiting action
996 * to be specified.
997 * This is like wait_on_bit() but allows fine control of how the waiting
998 * is done.
999 *
1000 * Returns zero if the bit was (eventually) found to be clear and was
1001 * set. Returns non-zero if a signal was delivered to the process and
1002 * the @mode allows that signal to wake the process.
894 */ 1003 */
895static inline int 1004static inline int
896wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode) 1005wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
897{ 1006{
898 if (!test_and_set_bit(bit, word)) 1007 if (!test_and_set_bit(bit, word))
899 return 0; 1008 return 0;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 5777c13849ba..a219be961c0a 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -90,7 +90,6 @@ struct writeback_control {
90 * fs/fs-writeback.c 90 * fs/fs-writeback.c
91 */ 91 */
92struct bdi_writeback; 92struct bdi_writeback;
93int inode_wait(void *);
94void writeback_inodes_sb(struct super_block *, enum wb_reason reason); 93void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
95void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 94void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
96 enum wb_reason reason); 95 enum wb_reason reason);
@@ -105,7 +104,7 @@ void inode_wait_for_writeback(struct inode *inode);
105static inline void wait_on_inode(struct inode *inode) 104static inline void wait_on_inode(struct inode *inode)
106{ 105{
107 might_sleep(); 106 might_sleep();
108 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); 107 wait_on_bit(&inode->i_state, __I_NEW, TASK_UNINTERRUPTIBLE);
109} 108}
110 109
111/* 110/*
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index 13af0d450bf6..f9d41a6e361f 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -11,7 +11,7 @@ struct zbud_ops {
11 11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops); 12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool); 13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, unsigned int size, gfp_t gfp, 14int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
15 unsigned long *handle); 15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle); 16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries); 17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 9c5a6b4de0a3..92dbbd3f6c75 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -83,11 +83,11 @@ struct internal_state;
83 83
84typedef struct z_stream_s { 84typedef struct z_stream_s {
85 const Byte *next_in; /* next input byte */ 85 const Byte *next_in; /* next input byte */
86 uInt avail_in; /* number of bytes available at next_in */ 86 uLong avail_in; /* number of bytes available at next_in */
87 uLong total_in; /* total nb of input bytes read so far */ 87 uLong total_in; /* total nb of input bytes read so far */
88 88
89 Byte *next_out; /* next output byte should be put there */ 89 Byte *next_out; /* next output byte should be put there */
90 uInt avail_out; /* remaining free space at next_out */ 90 uLong avail_out; /* remaining free space at next_out */
91 uLong total_out; /* total nb of bytes output so far */ 91 uLong total_out; /* total nb of bytes output so far */
92 92
93 char *msg; /* last error message, NULL if no error */ 93 char *msg; /* last error message, NULL if no error */
@@ -493,64 +493,6 @@ extern int deflateInit2 (z_streamp strm,
493 method). msg is set to null if there is no error message. deflateInit2 does 493 method). msg is set to null if there is no error message. deflateInit2 does
494 not perform any compression: this will be done by deflate(). 494 not perform any compression: this will be done by deflate().
495*/ 495*/
496
497#if 0
498extern int zlib_deflateSetDictionary (z_streamp strm,
499 const Byte *dictionary,
500 uInt dictLength);
501#endif
502/*
503 Initializes the compression dictionary from the given byte sequence
504 without producing any compressed output. This function must be called
505 immediately after deflateInit, deflateInit2 or deflateReset, before any
506 call of deflate. The compressor and decompressor must use exactly the same
507 dictionary (see inflateSetDictionary).
508
509 The dictionary should consist of strings (byte sequences) that are likely
510 to be encountered later in the data to be compressed, with the most commonly
511 used strings preferably put towards the end of the dictionary. Using a
512 dictionary is most useful when the data to be compressed is short and can be
513 predicted with good accuracy; the data can then be compressed better than
514 with the default empty dictionary.
515
516 Depending on the size of the compression data structures selected by
517 deflateInit or deflateInit2, a part of the dictionary may in effect be
518 discarded, for example if the dictionary is larger than the window size in
519 deflate or deflate2. Thus the strings most likely to be useful should be
520 put at the end of the dictionary, not at the front.
521
522 Upon return of this function, strm->adler is set to the Adler32 value
523 of the dictionary; the decompressor may later use this value to determine
524 which dictionary has been used by the compressor. (The Adler32 value
525 applies to the whole dictionary even if only a subset of the dictionary is
526 actually used by the compressor.)
527
528 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
529 parameter is invalid (such as NULL dictionary) or the stream state is
530 inconsistent (for example if deflate has already been called for this stream
531 or if the compression method is bsort). deflateSetDictionary does not
532 perform any compression: this will be done by deflate().
533*/
534
535#if 0
536extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
537#endif
538
539/*
540 Sets the destination stream as a complete copy of the source stream.
541
542 This function can be useful when several compression strategies will be
543 tried, for example when there are several ways of pre-processing the input
544 data with a filter. The streams that will be discarded should then be freed
545 by calling deflateEnd. Note that deflateCopy duplicates the internal
546 compression state which can be quite large, so this strategy is slow and
547 can consume lots of memory.
548
549 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
550 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
551 (such as zalloc being NULL). msg is left unchanged in both source and
552 destination.
553*/
554 496
555extern int zlib_deflateReset (z_streamp strm); 497extern int zlib_deflateReset (z_streamp strm);
556/* 498/*
@@ -568,27 +510,6 @@ static inline unsigned long deflateBound(unsigned long s)
568 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 510 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
569} 511}
570 512
571#if 0
572extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
573#endif
574/*
575 Dynamically update the compression level and compression strategy. The
576 interpretation of level and strategy is as in deflateInit2. This can be
577 used to switch between compression and straight copy of the input data, or
578 to switch to a different kind of input data requiring a different
579 strategy. If the compression level is changed, the input available so far
580 is compressed with the old level (and may be flushed); the new level will
581 take effect only at the next call of deflate().
582
583 Before the call of deflateParams, the stream state must be set as for
584 a call of deflate(), since the currently available input may have to
585 be compressed and flushed. In particular, strm->avail_out must be non-zero.
586
587 deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
588 stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
589 if strm->avail_out was zero.
590*/
591
592/* 513/*
593extern int inflateInit2 (z_streamp strm, int windowBits); 514extern int inflateInit2 (z_streamp strm, int windowBits);
594 515
@@ -631,45 +552,6 @@ extern int inflateInit2 (z_streamp strm, int windowBits);
631 and avail_out are unchanged.) 552 and avail_out are unchanged.)
632*/ 553*/
633 554
634extern int zlib_inflateSetDictionary (z_streamp strm,
635 const Byte *dictionary,
636 uInt dictLength);
637/*
638 Initializes the decompression dictionary from the given uncompressed byte
639 sequence. This function must be called immediately after a call of inflate,
640 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
641 can be determined from the adler32 value returned by that call of inflate.
642 The compressor and decompressor must use exactly the same dictionary (see
643 deflateSetDictionary). For raw inflate, this function can be called
644 immediately after inflateInit2() or inflateReset() and before any call of
645 inflate() to set the dictionary. The application must insure that the
646 dictionary that was used for compression is provided.
647
648 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
649 parameter is invalid (such as NULL dictionary) or the stream state is
650 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
651 expected one (incorrect adler32 value). inflateSetDictionary does not
652 perform any decompression: this will be done by subsequent calls of
653 inflate().
654*/
655
656#if 0
657extern int zlib_inflateSync (z_streamp strm);
658#endif
659/*
660 Skips invalid compressed data until a full flush point (see above the
661 description of deflate with Z_FULL_FLUSH) can be found, or until all
662 available input is skipped. No output is provided.
663
664 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
665 if no more input was provided, Z_DATA_ERROR if no flush point has been found,
666 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
667 case, the application may save the current current value of total_in which
668 indicates where valid compressed data was found. In the error case, the
669 application may repeatedly call inflateSync, providing more input each time,
670 until success or end of the input data.
671*/
672
673extern int zlib_inflateReset (z_streamp strm); 555extern int zlib_inflateReset (z_streamp strm);
674/* 556/*
675 This function is equivalent to inflateEnd followed by inflateInit, 557 This function is equivalent to inflateEnd followed by inflateInit,
diff --git a/include/linux/zpool.h b/include/linux/zpool.h
new file mode 100644
index 000000000000..f14bd75f08b3
--- /dev/null
+++ b/include/linux/zpool.h
@@ -0,0 +1,106 @@
1/*
2 * zpool memory storage api
3 *
4 * Copyright (C) 2014 Dan Streetman
5 *
6 * This is a common frontend for the zbud and zsmalloc memory
7 * storage pool implementations. Typically, this is used to
8 * store compressed memory.
9 */
10
11#ifndef _ZPOOL_H_
12#define _ZPOOL_H_
13
14struct zpool;
15
16struct zpool_ops {
17 int (*evict)(struct zpool *pool, unsigned long handle);
18};
19
20/*
21 * Control how a handle is mapped. It will be ignored if the
22 * implementation does not support it. Its use is optional.
23 * Note that this does not refer to memory protection, it
24 * refers to how the memory will be copied in/out if copying
25 * is necessary during mapping; read-write is the safest as
26 * it copies the existing memory in on map, and copies the
27 * changed memory back out on unmap. Write-only does not copy
28 * in the memory and should only be used for initialization.
29 * If in doubt, use ZPOOL_MM_DEFAULT which is read-write.
30 */
31enum zpool_mapmode {
32 ZPOOL_MM_RW, /* normal read-write mapping */
33 ZPOOL_MM_RO, /* read-only (no copy-out at unmap time) */
34 ZPOOL_MM_WO, /* write-only (no copy-in at map time) */
35
36 ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
37};
38
39struct zpool *zpool_create_pool(char *type, gfp_t gfp, struct zpool_ops *ops);
40
41char *zpool_get_type(struct zpool *pool);
42
43void zpool_destroy_pool(struct zpool *pool);
44
45int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
46 unsigned long *handle);
47
48void zpool_free(struct zpool *pool, unsigned long handle);
49
50int zpool_shrink(struct zpool *pool, unsigned int pages,
51 unsigned int *reclaimed);
52
53void *zpool_map_handle(struct zpool *pool, unsigned long handle,
54 enum zpool_mapmode mm);
55
56void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
57
58u64 zpool_get_total_size(struct zpool *pool);
59
60
61/**
62 * struct zpool_driver - driver implementation for zpool
63 * @type: name of the driver.
64 * @list: entry in the list of zpool drivers.
65 * @create: create a new pool.
66 * @destroy: destroy a pool.
67 * @malloc: allocate mem from a pool.
68 * @free: free mem from a pool.
69 * @shrink: shrink the pool.
70 * @map: map a handle.
71 * @unmap: unmap a handle.
72 * @total_size: get total size of a pool.
73 *
74 * This is created by a zpool implementation and registered
75 * with zpool.
76 */
77struct zpool_driver {
78 char *type;
79 struct module *owner;
80 atomic_t refcount;
81 struct list_head list;
82
83 void *(*create)(gfp_t gfp, struct zpool_ops *ops);
84 void (*destroy)(void *pool);
85
86 int (*malloc)(void *pool, size_t size, gfp_t gfp,
87 unsigned long *handle);
88 void (*free)(void *pool, unsigned long handle);
89
90 int (*shrink)(void *pool, unsigned int pages,
91 unsigned int *reclaimed);
92
93 void *(*map)(void *pool, unsigned long handle,
94 enum zpool_mapmode mm);
95 void (*unmap)(void *pool, unsigned long handle);
96
97 u64 (*total_size)(void *pool);
98};
99
100void zpool_register_driver(struct zpool_driver *driver);
101
102int zpool_unregister_driver(struct zpool_driver *driver);
103
104int zpool_evict(void *pool, unsigned long handle);
105
106#endif
diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h
index 2b023471ac89..c2e570336269 100644
--- a/include/media/atmel-isi.h
+++ b/include/media/atmel-isi.h
@@ -106,6 +106,8 @@
106#define ISI_DATAWIDTH_8 0x01 106#define ISI_DATAWIDTH_8 0x01
107#define ISI_DATAWIDTH_10 0x02 107#define ISI_DATAWIDTH_10 0x02
108 108
109struct v4l2_async_subdev;
110
109struct isi_platform_data { 111struct isi_platform_data {
110 u8 has_emb_sync; 112 u8 has_emb_sync;
111 u8 emb_crc_sync; 113 u8 emb_crc_sync;
@@ -118,6 +120,8 @@ struct isi_platform_data {
118 u32 frate; 120 u32 frate;
119 /* Using for ISI_MCK */ 121 /* Using for ISI_MCK */
120 u32 mck_hz; 122 u32 mck_hz;
123 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
124 int *asd_sizes; /* 0-terminated array of asd group sizes */
121}; 125};
122 126
123#endif /* __ATMEL_ISI_H__ */ 127#endif /* __ATMEL_ISI_H__ */
diff --git a/include/media/blackfin/ppi.h b/include/media/blackfin/ppi.h
index d0697f4edf87..4900baedd55a 100644
--- a/include/media/blackfin/ppi.h
+++ b/include/media/blackfin/ppi.h
@@ -83,6 +83,7 @@ struct ppi_info {
83}; 83};
84 84
85struct ppi_if { 85struct ppi_if {
86 struct device *dev;
86 unsigned long ppi_control; 87 unsigned long ppi_control;
87 const struct ppi_ops *ops; 88 const struct ppi_ops *ops;
88 const struct ppi_info *info; 89 const struct ppi_info *info;
@@ -91,6 +92,7 @@ struct ppi_if {
91 void *priv; 92 void *priv;
92}; 93};
93 94
94struct ppi_if *ppi_create_instance(const struct ppi_info *info); 95struct ppi_if *ppi_create_instance(struct platform_device *pdev,
96 const struct ppi_info *info);
95void ppi_delete_instance(struct ppi_if *ppi); 97void ppi_delete_instance(struct ppi_if *ppi);
96#endif 98#endif
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index e221bc74020b..d8564354debb 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -20,7 +20,8 @@ struct IR_i2c {
20 struct delayed_work work; 20 struct delayed_work work;
21 char name[32]; 21 char name[32];
22 char phys[32]; 22 char phys[32];
23 int (*get_key)(struct IR_i2c*, u32*, u32*); 23 int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol,
24 u32 *scancode, u8 *toggle);
24}; 25};
25 26
26enum ir_kbd_get_key_fn { 27enum ir_kbd_get_key_fn {
@@ -44,7 +45,8 @@ struct IR_i2c_init_data {
44 * Specify either a function pointer or a value indicating one of 45 * Specify either a function pointer or a value indicating one of
45 * ir_kbd_i2c's internal get_key functions 46 * ir_kbd_i2c's internal get_key functions
46 */ 47 */
47 int (*get_key)(struct IR_i2c*, u32*, u32*); 48 int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol,
49 u32 *scancode, u8 *toggle);
48 enum ir_kbd_get_key_fn internal_get_key_func; 50 enum ir_kbd_get_key_fn internal_get_key_func;
49 51
50 struct rc_dev *rc_dev; 52 struct rc_dev *rc_dev;
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index fde142e5f25a..2c7fbca40b69 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -26,7 +26,7 @@ extern int rc_core_debug;
26#define IR_dprintk(level, fmt, ...) \ 26#define IR_dprintk(level, fmt, ...) \
27do { \ 27do { \
28 if (rc_core_debug >= level) \ 28 if (rc_core_debug >= level) \
29 pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ 29 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
30} while (0) 30} while (0)
31 31
32enum rc_driver_type { 32enum rc_driver_type {
@@ -74,21 +74,25 @@ enum rc_filter_type {
74 * @input_dev: the input child device used to communicate events to userspace 74 * @input_dev: the input child device used to communicate events to userspace
75 * @driver_type: specifies if protocol decoding is done in hardware or software 75 * @driver_type: specifies if protocol decoding is done in hardware or software
76 * @idle: used to keep track of RX state 76 * @idle: used to keep track of RX state
77 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each 77 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols
78 * filter type 78 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
79 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each 79 * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols
80 * filter type 80 * @enabled_wakeup_protocols: bitmask with the enabled RC_BIT_* wakeup protocols
81 * @scanmask: some hardware decoders are not capable of providing the full 81 * @scancode_filter: scancode filter
82 * @scancode_wakeup_filter: scancode wakeup filters
83 * @scancode_mask: some hardware decoders are not capable of providing the full
82 * scancode to the application. As this is a hardware limit, we can't do 84 * scancode to the application. As this is a hardware limit, we can't do
83 * anything with it. Yet, as the same keycode table can be used with other 85 * anything with it. Yet, as the same keycode table can be used with other
84 * devices, a mask is provided to allow its usage. Drivers should generally 86 * devices, a mask is provided to allow its usage. Drivers should generally
85 * leave this field in blank 87 * leave this field in blank
88 * @users: number of current users of the device
86 * @priv: driver-specific data 89 * @priv: driver-specific data
87 * @keylock: protects the remaining members of the struct 90 * @keylock: protects the remaining members of the struct
88 * @keypressed: whether a key is currently pressed 91 * @keypressed: whether a key is currently pressed
89 * @keyup_jiffies: time (in jiffies) when the current keypress should be released 92 * @keyup_jiffies: time (in jiffies) when the current keypress should be released
90 * @timer_keyup: timer for releasing a keypress 93 * @timer_keyup: timer for releasing a keypress
91 * @last_keycode: keycode of last keypress 94 * @last_keycode: keycode of last keypress
95 * @last_protocol: protocol of last keypress
92 * @last_scancode: scancode of last keypress 96 * @last_scancode: scancode of last keypress
93 * @last_toggle: toggle value of last command 97 * @last_toggle: toggle value of last command
94 * @timeout: optional time after which device stops sending data 98 * @timeout: optional time after which device stops sending data
@@ -96,7 +100,6 @@ enum rc_filter_type {
96 * @max_timeout: maximum timeout supported by device 100 * @max_timeout: maximum timeout supported by device
97 * @rx_resolution : resolution (in ns) of input sampler 101 * @rx_resolution : resolution (in ns) of input sampler
98 * @tx_resolution: resolution (in ns) of output sampler 102 * @tx_resolution: resolution (in ns) of output sampler
99 * @scancode_filters: scancode filters (indexed by enum rc_filter_type)
100 * @change_protocol: allow changing the protocol used on hardware decoders 103 * @change_protocol: allow changing the protocol used on hardware decoders
101 * @change_wakeup_protocol: allow changing the protocol used for wakeup 104 * @change_wakeup_protocol: allow changing the protocol used for wakeup
102 * filtering 105 * filtering
@@ -113,7 +116,7 @@ enum rc_filter_type {
113 * device doesn't interrupt host until it sees IR pulses 116 * device doesn't interrupt host until it sees IR pulses
114 * @s_learning_mode: enable wide band receiver used for learning 117 * @s_learning_mode: enable wide band receiver used for learning
115 * @s_carrier_report: enable carrier reports 118 * @s_carrier_report: enable carrier reports
116 * @s_filter: set the scancode filter 119 * @s_filter: set the scancode filter
117 * @s_wakeup_filter: set the wakeup scancode filter 120 * @s_wakeup_filter: set the wakeup scancode filter
118 */ 121 */
119struct rc_dev { 122struct rc_dev {
@@ -131,16 +134,21 @@ struct rc_dev {
131 struct input_dev *input_dev; 134 struct input_dev *input_dev;
132 enum rc_driver_type driver_type; 135 enum rc_driver_type driver_type;
133 bool idle; 136 bool idle;
134 u64 allowed_protocols[RC_FILTER_MAX]; 137 u64 allowed_protocols;
135 u64 enabled_protocols[RC_FILTER_MAX]; 138 u64 enabled_protocols;
139 u64 allowed_wakeup_protocols;
140 u64 enabled_wakeup_protocols;
141 struct rc_scancode_filter scancode_filter;
142 struct rc_scancode_filter scancode_wakeup_filter;
143 u32 scancode_mask;
136 u32 users; 144 u32 users;
137 u32 scanmask;
138 void *priv; 145 void *priv;
139 spinlock_t keylock; 146 spinlock_t keylock;
140 bool keypressed; 147 bool keypressed;
141 unsigned long keyup_jiffies; 148 unsigned long keyup_jiffies;
142 struct timer_list timer_keyup; 149 struct timer_list timer_keyup;
143 u32 last_keycode; 150 u32 last_keycode;
151 enum rc_type last_protocol;
144 u32 last_scancode; 152 u32 last_scancode;
145 u8 last_toggle; 153 u8 last_toggle;
146 u32 timeout; 154 u32 timeout;
@@ -148,7 +156,6 @@ struct rc_dev {
148 u32 max_timeout; 156 u32 max_timeout;
149 u32 rx_resolution; 157 u32 rx_resolution;
150 u32 tx_resolution; 158 u32 tx_resolution;
151 struct rc_scancode_filter scancode_filters[RC_FILTER_MAX];
152 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); 159 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
153 int (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type); 160 int (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type);
154 int (*open)(struct rc_dev *dev); 161 int (*open)(struct rc_dev *dev);
@@ -169,42 +176,6 @@ struct rc_dev {
169 176
170#define to_rc_dev(d) container_of(d, struct rc_dev, dev) 177#define to_rc_dev(d) container_of(d, struct rc_dev, dev)
171 178
172static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
173{
174 return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
175}
176
177/* should be called prior to registration or with mutex held */
178static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
179{
180 rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
181}
182
183static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
184{
185 return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
186}
187
188/* should be called prior to registration or with mutex held */
189static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
190{
191 rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
192}
193
194/* should be called prior to registration or with mutex held */
195static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
196 u64 protos)
197{
198 rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
199}
200
201/* should be called prior to registration or with mutex held */
202static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
203 u64 protos)
204{
205 rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
206}
207
208/* 179/*
209 * From rc-main.c 180 * From rc-main.c
210 * Those functions can be used on any type of Remote Controller. They 181 * Those functions can be used on any type of Remote Controller. They
@@ -221,8 +192,8 @@ int rc_open(struct rc_dev *rdev);
221void rc_close(struct rc_dev *rdev); 192void rc_close(struct rc_dev *rdev);
222 193
223void rc_repeat(struct rc_dev *dev); 194void rc_repeat(struct rc_dev *dev);
224void rc_keydown(struct rc_dev *dev, int scancode, u8 toggle); 195void rc_keydown(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 toggle);
225void rc_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle); 196void rc_keydown_notimeout(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 toggle);
226void rc_keyup(struct rc_dev *dev); 197void rc_keyup(struct rc_dev *dev);
227u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode); 198u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode);
228 199
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e5aa2409c0ea..80f951890b4c 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -31,6 +31,7 @@ enum rc_type {
31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */ 31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */
32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */ 32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */
33 RC_TYPE_SHARP = 18, /* Sharp protocol */ 33 RC_TYPE_SHARP = 18, /* Sharp protocol */
34 RC_TYPE_XMP = 19, /* XMP protocol */
34}; 35};
35 36
36#define RC_BIT_NONE 0 37#define RC_BIT_NONE 0
@@ -53,6 +54,7 @@ enum rc_type {
53#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32) 54#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32)
54#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE) 55#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE)
55#define RC_BIT_SHARP (1 << RC_TYPE_SHARP) 56#define RC_BIT_SHARP (1 << RC_TYPE_SHARP)
57#define RC_BIT_XMP (1 << RC_TYPE_XMP)
56 58
57#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \ 59#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \
58 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ 60 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
@@ -60,7 +62,19 @@ enum rc_type {
60 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ 62 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \
61 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \ 63 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \
62 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ 64 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \
63 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP) 65 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \
66 RC_BIT_XMP)
67
68
69#define RC_SCANCODE_UNKNOWN(x) (x)
70#define RC_SCANCODE_OTHER(x) (x)
71#define RC_SCANCODE_NEC(addr, cmd) (((addr) << 8) | (cmd))
72#define RC_SCANCODE_NECX(addr, cmd) (((addr) << 8) | (cmd))
73#define RC_SCANCODE_NEC32(data) ((data) & 0xffffffff)
74#define RC_SCANCODE_RC5(sys, cmd) (((sys) << 8) | (cmd))
75#define RC_SCANCODE_RC5_SZ(sys, cmd) (((sys) << 8) | (cmd))
76#define RC_SCANCODE_RC6_0(sys, cmd) (((sys) << 8) | (cmd))
77#define RC_SCANCODE_RC6_6A(vendor, sys, cmd) (((vendor) << 16) | ((sys) << 8) | (cmd))
64 78
65struct rc_map_table { 79struct rc_map_table {
66 u32 scancode; 80 u32 scancode;
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 16f7f2606516..b7cd7a665e35 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -36,6 +36,25 @@ struct v4l2_subscribed_event;
36struct v4l2_fh; 36struct v4l2_fh;
37struct poll_table_struct; 37struct poll_table_struct;
38 38
39/** union v4l2_ctrl_ptr - A pointer to a control value.
40 * @p_s32: Pointer to a 32-bit signed value.
41 * @p_s64: Pointer to a 64-bit signed value.
42 * @p_u8: Pointer to a 8-bit unsigned value.
43 * @p_u16: Pointer to a 16-bit unsigned value.
44 * @p_u32: Pointer to a 32-bit unsigned value.
45 * @p_char: Pointer to a string.
46 * @p: Pointer to a compound value.
47 */
48union v4l2_ctrl_ptr {
49 s32 *p_s32;
50 s64 *p_s64;
51 u8 *p_u8;
52 u16 *p_u16;
53 u32 *p_u32;
54 char *p_char;
55 void *p;
56};
57
39/** struct v4l2_ctrl_ops - The control operations that the driver has to provide. 58/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
40 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant 59 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
41 * for volatile (and usually read-only) controls such as a control 60 * for volatile (and usually read-only) controls such as a control
@@ -54,6 +73,23 @@ struct v4l2_ctrl_ops {
54 int (*s_ctrl)(struct v4l2_ctrl *ctrl); 73 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
55}; 74};
56 75
76/** struct v4l2_ctrl_type_ops - The control type operations that the driver has to provide.
77 * @equal: return true if both values are equal.
78 * @init: initialize the value.
79 * @log: log the value.
80 * @validate: validate the value. Return 0 on success and a negative value otherwise.
81 */
82struct v4l2_ctrl_type_ops {
83 bool (*equal)(const struct v4l2_ctrl *ctrl, u32 idx,
84 union v4l2_ctrl_ptr ptr1,
85 union v4l2_ctrl_ptr ptr2);
86 void (*init)(const struct v4l2_ctrl *ctrl, u32 idx,
87 union v4l2_ctrl_ptr ptr);
88 void (*log)(const struct v4l2_ctrl *ctrl);
89 int (*validate)(const struct v4l2_ctrl *ctrl, u32 idx,
90 union v4l2_ctrl_ptr ptr);
91};
92
57typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); 93typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
58 94
59/** struct v4l2_ctrl - The control structure. 95/** struct v4l2_ctrl - The control structure.
@@ -66,6 +102,8 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
66 * @is_new: Set when the user specified a new value for this control. It 102 * @is_new: Set when the user specified a new value for this control. It
67 * is also set when called from v4l2_ctrl_handler_setup. Drivers 103 * is also set when called from v4l2_ctrl_handler_setup. Drivers
68 * should never set this flag. 104 * should never set this flag.
105 * @has_changed: Set when the current value differs from the new value. Drivers
106 * should never use this flag.
69 * @is_private: If set, then this control is private to its handler and it 107 * @is_private: If set, then this control is private to its handler and it
70 * will not be added to any other handlers. Drivers can set 108 * will not be added to any other handlers. Drivers can set
71 * this flag. 109 * this flag.
@@ -73,6 +111,13 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
73 * members are in 'automatic' mode or 'manual' mode. This is 111 * members are in 'automatic' mode or 'manual' mode. This is
74 * used for autogain/gain type clusters. Drivers should never 112 * used for autogain/gain type clusters. Drivers should never
75 * set this flag directly. 113 * set this flag directly.
114 * @is_int: If set, then this control has a simple integer value (i.e. it
115 * uses ctrl->val).
116 * @is_string: If set, then this control has type V4L2_CTRL_TYPE_STRING.
117 * @is_ptr: If set, then this control is an array and/or has type >= V4L2_CTRL_COMPOUND_TYPES
118 * and/or has type V4L2_CTRL_TYPE_STRING. In other words, struct
119 * v4l2_ext_control uses field p to point to the data.
120 * @is_array: If set, then this control contains an N-dimensional array.
76 * @has_volatiles: If set, then one or more members of the cluster are volatile. 121 * @has_volatiles: If set, then one or more members of the cluster are volatile.
77 * Drivers should never touch this flag. 122 * Drivers should never touch this flag.
78 * @call_notify: If set, then call the handler's notify function whenever the 123 * @call_notify: If set, then call the handler's notify function whenever the
@@ -83,6 +128,7 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
83 * value, then the whole cluster is in manual mode. Drivers should 128 * value, then the whole cluster is in manual mode. Drivers should
84 * never set this flag directly. 129 * never set this flag directly.
85 * @ops: The control ops. 130 * @ops: The control ops.
131 * @type_ops: The control type ops.
86 * @id: The control ID. 132 * @id: The control ID.
87 * @name: The control name. 133 * @name: The control name.
88 * @type: The control type. 134 * @type: The control type.
@@ -90,6 +136,10 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
90 * @maximum: The control's maximum value. 136 * @maximum: The control's maximum value.
91 * @default_value: The control's default value. 137 * @default_value: The control's default value.
92 * @step: The control's step value for non-menu controls. 138 * @step: The control's step value for non-menu controls.
139 * @elems: The number of elements in the N-dimensional array.
140 * @elem_size: The size in bytes of the control.
141 * @dims: The size of each dimension.
142 * @nr_of_dims:The number of dimensions in @dims.
93 * @menu_skip_mask: The control's skip mask for menu controls. This makes it 143 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
94 * easy to skip menu items that are not valid. If bit X is set, 144 * easy to skip menu items that are not valid. If bit X is set,
95 * then menu item X is skipped. Of course, this only works for 145 * then menu item X is skipped. Of course, this only works for
@@ -104,7 +154,6 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
104 * @cur: The control's current value. 154 * @cur: The control's current value.
105 * @val: The control's new s32 value. 155 * @val: The control's new s32 value.
106 * @val64: The control's new s64 value. 156 * @val64: The control's new s64 value.
107 * @string: The control's new string value.
108 * @priv: The control's private pointer. For use by the driver. It is 157 * @priv: The control's private pointer. For use by the driver. It is
109 * untouched by the control framework. Note that this pointer is 158 * untouched by the control framework. Note that this pointer is
110 * not freed when the control is deleted. Should this be needed 159 * not freed when the control is deleted. Should this be needed
@@ -121,37 +170,44 @@ struct v4l2_ctrl {
121 unsigned int done:1; 170 unsigned int done:1;
122 171
123 unsigned int is_new:1; 172 unsigned int is_new:1;
173 unsigned int has_changed:1;
124 unsigned int is_private:1; 174 unsigned int is_private:1;
125 unsigned int is_auto:1; 175 unsigned int is_auto:1;
176 unsigned int is_int:1;
177 unsigned int is_string:1;
178 unsigned int is_ptr:1;
179 unsigned int is_array:1;
126 unsigned int has_volatiles:1; 180 unsigned int has_volatiles:1;
127 unsigned int call_notify:1; 181 unsigned int call_notify:1;
128 unsigned int manual_mode_value:8; 182 unsigned int manual_mode_value:8;
129 183
130 const struct v4l2_ctrl_ops *ops; 184 const struct v4l2_ctrl_ops *ops;
185 const struct v4l2_ctrl_type_ops *type_ops;
131 u32 id; 186 u32 id;
132 const char *name; 187 const char *name;
133 enum v4l2_ctrl_type type; 188 enum v4l2_ctrl_type type;
134 s32 minimum, maximum, default_value; 189 s64 minimum, maximum, default_value;
190 u32 elems;
191 u32 elem_size;
192 u32 dims[V4L2_CTRL_MAX_DIMS];
193 u32 nr_of_dims;
135 union { 194 union {
136 u32 step; 195 u64 step;
137 u32 menu_skip_mask; 196 u64 menu_skip_mask;
138 }; 197 };
139 union { 198 union {
140 const char * const *qmenu; 199 const char * const *qmenu;
141 const s64 *qmenu_int; 200 const s64 *qmenu_int;
142 }; 201 };
143 unsigned long flags; 202 unsigned long flags;
144 union { 203 void *priv;
204 s32 val;
205 struct {
145 s32 val; 206 s32 val;
146 s64 val64;
147 char *string;
148 } cur; 207 } cur;
149 union { 208
150 s32 val; 209 union v4l2_ctrl_ptr p_new;
151 s64 val64; 210 union v4l2_ctrl_ptr p_cur;
152 char *string;
153 };
154 void *priv;
155}; 211};
156 212
157/** struct v4l2_ctrl_ref - The control reference. 213/** struct v4l2_ctrl_ref - The control reference.
@@ -205,6 +261,7 @@ struct v4l2_ctrl_handler {
205 261
206/** struct v4l2_ctrl_config - Control configuration structure. 262/** struct v4l2_ctrl_config - Control configuration structure.
207 * @ops: The control ops. 263 * @ops: The control ops.
264 * @type_ops: The control type ops. Only needed for compound controls.
208 * @id: The control ID. 265 * @id: The control ID.
209 * @name: The control name. 266 * @name: The control name.
210 * @type: The control type. 267 * @type: The control type.
@@ -212,13 +269,15 @@ struct v4l2_ctrl_handler {
212 * @max: The control's maximum value. 269 * @max: The control's maximum value.
213 * @step: The control's step value for non-menu controls. 270 * @step: The control's step value for non-menu controls.
214 * @def: The control's default value. 271 * @def: The control's default value.
272 * @dims: The size of each dimension.
273 * @elem_size: The size in bytes of the control.
215 * @flags: The control's flags. 274 * @flags: The control's flags.
216 * @menu_skip_mask: The control's skip mask for menu controls. This makes it 275 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
217 * easy to skip menu items that are not valid. If bit X is set, 276 * easy to skip menu items that are not valid. If bit X is set,
218 * then menu item X is skipped. Of course, this only works for 277 * then menu item X is skipped. Of course, this only works for
219 * menus with <= 32 menu items. There are no menus that come 278 * menus with <= 64 menu items. There are no menus that come
220 * close to that number, so this is OK. Should we ever need more, 279 * close to that number, so this is OK. Should we ever need more,
221 * then this will have to be extended to a u64 or a bit array. 280 * then this will have to be extended to a bit array.
222 * @qmenu: A const char * array for all menu items. Array entries that are 281 * @qmenu: A const char * array for all menu items. Array entries that are
223 * empty strings ("") correspond to non-existing menu items (this 282 * empty strings ("") correspond to non-existing menu items (this
224 * is in addition to the menu_skip_mask above). The last entry 283 * is in addition to the menu_skip_mask above). The last entry
@@ -228,15 +287,18 @@ struct v4l2_ctrl_handler {
228 */ 287 */
229struct v4l2_ctrl_config { 288struct v4l2_ctrl_config {
230 const struct v4l2_ctrl_ops *ops; 289 const struct v4l2_ctrl_ops *ops;
290 const struct v4l2_ctrl_type_ops *type_ops;
231 u32 id; 291 u32 id;
232 const char *name; 292 const char *name;
233 enum v4l2_ctrl_type type; 293 enum v4l2_ctrl_type type;
234 s32 min; 294 s64 min;
235 s32 max; 295 s64 max;
236 u32 step; 296 u64 step;
237 s32 def; 297 s64 def;
298 u32 dims[V4L2_CTRL_MAX_DIMS];
299 u32 elem_size;
238 u32 flags; 300 u32 flags;
239 u32 menu_skip_mask; 301 u64 menu_skip_mask;
240 const char * const *qmenu; 302 const char * const *qmenu;
241 const s64 *qmenu_int; 303 const s64 *qmenu_int;
242 unsigned int is_private:1; 304 unsigned int is_private:1;
@@ -257,7 +319,7 @@ struct v4l2_ctrl_config {
257 * control framework this function will no longer be exported. 319 * control framework this function will no longer be exported.
258 */ 320 */
259void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, 321void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
260 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); 322 s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags);
261 323
262 324
263/** v4l2_ctrl_handler_init_class() - Initialize the control handler. 325/** v4l2_ctrl_handler_init_class() - Initialize the control handler.
@@ -307,6 +369,24 @@ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
307 */ 369 */
308void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl); 370void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
309 371
372/** v4l2_ctrl_lock() - Helper function to lock the handler
373 * associated with the control.
374 * @ctrl: The control to lock.
375 */
376static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
377{
378 mutex_lock(ctrl->handler->lock);
379}
380
381/** v4l2_ctrl_unlock() - Helper function to unlock the handler
382 * associated with the control.
383 * @ctrl: The control to unlock.
384 */
385static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
386{
387 mutex_unlock(ctrl->handler->lock);
388}
389
310/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging 390/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
311 * to the handler to initialize the hardware to the current control values. 391 * to the handler to initialize the hardware to the current control values.
312 * @hdl: The control handler. 392 * @hdl: The control handler.
@@ -362,7 +442,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
362 */ 442 */
363struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, 443struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
364 const struct v4l2_ctrl_ops *ops, 444 const struct v4l2_ctrl_ops *ops,
365 u32 id, s32 min, s32 max, u32 step, s32 def); 445 u32 id, s64 min, s64 max, u64 step, s64 def);
366 446
367/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control. 447/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
368 * @hdl: The control handler. 448 * @hdl: The control handler.
@@ -372,9 +452,9 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
372 * @mask: The control's skip mask for menu controls. This makes it 452 * @mask: The control's skip mask for menu controls. This makes it
373 * easy to skip menu items that are not valid. If bit X is set, 453 * easy to skip menu items that are not valid. If bit X is set,
374 * then menu item X is skipped. Of course, this only works for 454 * then menu item X is skipped. Of course, this only works for
375 * menus with <= 32 menu items. There are no menus that come 455 * menus with <= 64 menu items. There are no menus that come
376 * close to that number, so this is OK. Should we ever need more, 456 * close to that number, so this is OK. Should we ever need more,
377 * then this will have to be extended to a u64 or a bit array. 457 * then this will have to be extended to a bit array.
378 * @def: The control's default value. 458 * @def: The control's default value.
379 * 459 *
380 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value 460 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
@@ -384,7 +464,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
384 */ 464 */
385struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, 465struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
386 const struct v4l2_ctrl_ops *ops, 466 const struct v4l2_ctrl_ops *ops,
387 u32 id, s32 max, s32 mask, s32 def); 467 u32 id, u8 max, u64 mask, u8 def);
388 468
389/** v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control 469/** v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
390 * with driver specific menu. 470 * with driver specific menu.
@@ -395,9 +475,9 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
395 * @mask: The control's skip mask for menu controls. This makes it 475 * @mask: The control's skip mask for menu controls. This makes it
396 * easy to skip menu items that are not valid. If bit X is set, 476 * easy to skip menu items that are not valid. If bit X is set,
397 * then menu item X is skipped. Of course, this only works for 477 * then menu item X is skipped. Of course, this only works for
398 * menus with <= 32 menu items. There are no menus that come 478 * menus with <= 64 menu items. There are no menus that come
399 * close to that number, so this is OK. Should we ever need more, 479 * close to that number, so this is OK. Should we ever need more,
400 * then this will have to be extended to a u64 or a bit array. 480 * then this will have to be extended to a bit array.
401 * @def: The control's default value. 481 * @def: The control's default value.
402 * @qmenu: The new menu. 482 * @qmenu: The new menu.
403 * 483 *
@@ -406,8 +486,8 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
406 * 486 *
407 */ 487 */
408struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, 488struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
409 const struct v4l2_ctrl_ops *ops, u32 id, s32 max, 489 const struct v4l2_ctrl_ops *ops, u32 id, u8 max,
410 s32 mask, s32 def, const char * const *qmenu); 490 u64 mask, u8 def, const char * const *qmenu);
411 491
412/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control. 492/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
413 * @hdl: The control handler. 493 * @hdl: The control handler.
@@ -424,7 +504,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
424 */ 504 */
425struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, 505struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
426 const struct v4l2_ctrl_ops *ops, 506 const struct v4l2_ctrl_ops *ops,
427 u32 id, s32 max, s32 def, const s64 *qmenu_int); 507 u32 id, u8 max, u8 def, const s64 *qmenu_int);
428 508
429/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. 509/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
430 * @hdl: The control handler. 510 * @hdl: The control handler.
@@ -542,6 +622,11 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
542 */ 622 */
543void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); 623void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
544 624
625
626/** __v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range() */
627int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
628 s64 min, s64 max, u64 step, s64 def);
629
545/** v4l2_ctrl_modify_range() - Update the range of a control. 630/** v4l2_ctrl_modify_range() - Update the range of a control.
546 * @ctrl: The control to update. 631 * @ctrl: The control to update.
547 * @min: The control's minimum value. 632 * @min: The control's minimum value.
@@ -559,25 +644,16 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
559 * This function assumes that the control handler is not locked and will 644 * This function assumes that the control handler is not locked and will
560 * take the lock itself. 645 * take the lock itself.
561 */ 646 */
562int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, 647static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
563 s32 min, s32 max, u32 step, s32 def); 648 s64 min, s64 max, u64 step, s64 def)
564
565/** v4l2_ctrl_lock() - Helper function to lock the handler
566 * associated with the control.
567 * @ctrl: The control to lock.
568 */
569static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
570{ 649{
571 mutex_lock(ctrl->handler->lock); 650 int rval;
572}
573 651
574/** v4l2_ctrl_unlock() - Helper function to unlock the handler 652 v4l2_ctrl_lock(ctrl);
575 * associated with the control. 653 rval = __v4l2_ctrl_modify_range(ctrl, min, max, step, def);
576 * @ctrl: The control to unlock. 654 v4l2_ctrl_unlock(ctrl);
577 */ 655
578static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) 656 return rval;
579{
580 mutex_unlock(ctrl->handler->lock);
581} 657}
582 658
583/** v4l2_ctrl_notify() - Function to set a notify callback for a control. 659/** v4l2_ctrl_notify() - Function to set a notify callback for a control.
@@ -605,6 +681,8 @@ void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void
605 */ 681 */
606s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); 682s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
607 683
684/** __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl(). */
685int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
608/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver. 686/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
609 * @ctrl: The control. 687 * @ctrl: The control.
610 * @val: The new value. 688 * @val: The new value.
@@ -615,7 +693,16 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
615 * 693 *
616 * This function is for integer type controls only. 694 * This function is for integer type controls only.
617 */ 695 */
618int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); 696static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
697{
698 int rval;
699
700 v4l2_ctrl_lock(ctrl);
701 rval = __v4l2_ctrl_s_ctrl(ctrl, val);
702 v4l2_ctrl_unlock(ctrl);
703
704 return rval;
705}
619 706
620/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver. 707/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver.
621 * @ctrl: The control. 708 * @ctrl: The control.
@@ -628,6 +715,9 @@ int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
628 */ 715 */
629s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl); 716s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
630 717
718/** __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64(). */
719int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
720
631/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver. 721/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver.
632 * @ctrl: The control. 722 * @ctrl: The control.
633 * @val: The new value. 723 * @val: The new value.
@@ -638,7 +728,40 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
638 * 728 *
639 * This function is for 64-bit integer type controls only. 729 * This function is for 64-bit integer type controls only.
640 */ 730 */
641int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val); 731static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
732{
733 int rval;
734
735 v4l2_ctrl_lock(ctrl);
736 rval = __v4l2_ctrl_s_ctrl_int64(ctrl, val);
737 v4l2_ctrl_unlock(ctrl);
738
739 return rval;
740}
741
742/** __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string(). */
743int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s);
744
745/** v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value from within a driver.
746 * @ctrl: The control.
747 * @s: The new string.
748 *
749 * This set the control's new string safely by going through the control
750 * framework. This function will lock the control's handler, so it cannot be
751 * used from within the &v4l2_ctrl_ops functions.
752 *
753 * This function is for string type controls only.
754 */
755static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
756{
757 int rval;
758
759 v4l2_ctrl_lock(ctrl);
760 rval = __v4l2_ctrl_s_ctrl_string(ctrl, s);
761 v4l2_ctrl_unlock(ctrl);
762
763 return rval;
764}
642 765
643/* Internal helper functions that deal with control events. */ 766/* Internal helper functions that deal with control events. */
644extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; 767extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
@@ -659,6 +782,7 @@ unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
659 782
660/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ 783/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
661int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); 784int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
785int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctrl *qc);
662int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); 786int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
663int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); 787int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
664int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, 788int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index eec6e460f649..eb76cfd47189 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -44,8 +44,6 @@ struct v4l2_ctrl_handler;
44#define V4L2_FL_REGISTERED (0) 44#define V4L2_FL_REGISTERED (0)
45/* file->private_data points to struct v4l2_fh */ 45/* file->private_data points to struct v4l2_fh */
46#define V4L2_FL_USES_V4L2_FH (1) 46#define V4L2_FL_USES_V4L2_FH (1)
47/* Use the prio field of v4l2_fh for core priority checking */
48#define V4L2_FL_USE_FH_PRIO (2)
49 47
50/* Priority helper functions */ 48/* Priority helper functions */
51 49
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 50cf7c110a70..53605f0f9903 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -158,6 +158,8 @@ struct v4l2_ioctl_ops {
158 /* Control handling */ 158 /* Control handling */
159 int (*vidioc_queryctrl) (struct file *file, void *fh, 159 int (*vidioc_queryctrl) (struct file *file, void *fh,
160 struct v4l2_queryctrl *a); 160 struct v4l2_queryctrl *a);
161 int (*vidioc_query_ext_ctrl) (struct file *file, void *fh,
162 struct v4l2_query_ext_ctrl *a);
161 int (*vidioc_g_ctrl) (struct file *file, void *fh, 163 int (*vidioc_g_ctrl) (struct file *file, void *fh,
162 struct v4l2_control *a); 164 struct v4l2_control *a);
163 int (*vidioc_s_ctrl) (struct file *file, void *fh, 165 int (*vidioc_s_ctrl) (struct file *file, void *fh,
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 12ea5a6a4331..c5f3914bc4d8 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -95,6 +95,8 @@ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
95struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, 95struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
96 enum v4l2_buf_type type); 96 enum v4l2_buf_type type);
97 97
98void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx);
99
98void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, 100void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
99 struct v4l2_m2m_ctx *m2m_ctx); 101 struct v4l2_m2m_ctx *m2m_ctx);
100 102
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index d8fb6012c10d..fb6fd4d8f4ed 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -53,6 +53,9 @@ struct videobuf_dmabuf {
53 53
54 /* for kernel buffers */ 54 /* for kernel buffers */
55 void *vaddr; 55 void *vaddr;
56 struct page **vaddr_pages;
57 dma_addr_t *dma_addr;
58 struct device *dev;
56 59
57 /* for overlay buffers (pci-pci dma) */ 60 /* for overlay buffers (pci-pci dma) */
58 dma_addr_t bus_addr; 61 dma_addr_t bus_addr;
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 8fab6fa0dbfb..fc910a622451 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -294,15 +294,19 @@ struct vb2_buffer {
294 * of already queued buffers in count parameter; driver 294 * of already queued buffers in count parameter; driver
295 * can return an error if hardware fails, in that case all 295 * can return an error if hardware fails, in that case all
296 * buffers that have been already given by the @buf_queue 296 * buffers that have been already given by the @buf_queue
297 * callback are invalidated. 297 * callback are to be returned by the driver by calling
298 * If there were not enough queued buffers to start 298 * @vb2_buffer_done(VB2_BUF_STATE_DEQUEUED).
299 * streaming, then this callback returns -ENOBUFS, and the 299 * If you need a minimum number of buffers before you can
300 * vb2 core will retry calling @start_streaming when a new 300 * start streaming, then set @min_buffers_needed in the
301 * buffer is queued. 301 * vb2_queue structure. If that is non-zero then
302 * start_streaming won't be called until at least that
303 * many buffers have been queued up by userspace.
302 * @stop_streaming: called when 'streaming' state must be disabled; driver 304 * @stop_streaming: called when 'streaming' state must be disabled; driver
303 * should stop any DMA transactions or wait until they 305 * should stop any DMA transactions or wait until they
304 * finish and give back all buffers it got from buf_queue() 306 * finish and give back all buffers it got from buf_queue()
305 * callback; may use vb2_wait_for_all_buffers() function 307 * callback by calling @vb2_buffer_done() with either
308 * VB2_BUF_STATE_DONE or VB2_BUF_STATE_ERROR; may use
309 * vb2_wait_for_all_buffers() function
306 * @buf_queue: passes buffer vb to the driver; driver may start 310 * @buf_queue: passes buffer vb to the driver; driver may start
307 * hardware operation on this buffer; driver should give 311 * hardware operation on this buffer; driver should give
308 * the buffer back by calling vb2_buffer_done() function; 312 * the buffer back by calling vb2_buffer_done() function;
@@ -375,6 +379,7 @@ struct v4l2_fh;
375 * @streaming: current streaming state 379 * @streaming: current streaming state
376 * @start_streaming_called: start_streaming() was called successfully and we 380 * @start_streaming_called: start_streaming() was called successfully and we
377 * started streaming. 381 * started streaming.
382 * @error: a fatal error occurred on the queue
378 * @fileio: file io emulator internal data, used only if emulator is active 383 * @fileio: file io emulator internal data, used only if emulator is active
379 * @threadio: thread io internal data, used only if thread is active 384 * @threadio: thread io internal data, used only if thread is active
380 */ 385 */
@@ -411,6 +416,7 @@ struct vb2_queue {
411 416
412 unsigned int streaming:1; 417 unsigned int streaming:1;
413 unsigned int start_streaming_called:1; 418 unsigned int start_streaming_called:1;
419 unsigned int error:1;
414 420
415 struct vb2_fileio_data *fileio; 421 struct vb2_fileio_data *fileio;
416 struct vb2_threadio_data *threadio; 422 struct vb2_threadio_data *threadio;
@@ -444,6 +450,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
444int __must_check vb2_queue_init(struct vb2_queue *q); 450int __must_check vb2_queue_init(struct vb2_queue *q);
445 451
446void vb2_queue_release(struct vb2_queue *q); 452void vb2_queue_release(struct vb2_queue *q);
453void vb2_queue_error(struct vb2_queue *q);
447 454
448int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); 455int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
449int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); 456int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb);
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index 79b530fb2c4d..d184df1d0d41 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -75,20 +75,6 @@
75 (((a)->s6_addr[14]) == (m)[6]) && \ 75 (((a)->s6_addr[14]) == (m)[6]) && \
76 (((a)->s6_addr[15]) == (m)[7])) 76 (((a)->s6_addr[15]) == (m)[7]))
77 77
78/* ipv6 address is unspecified */
79#define is_addr_unspecified(a) \
80 ((((a)->s6_addr32[0]) == 0) && \
81 (((a)->s6_addr32[1]) == 0) && \
82 (((a)->s6_addr32[2]) == 0) && \
83 (((a)->s6_addr32[3]) == 0))
84
85/* compare ipv6 addresses prefixes */
86#define ipaddr_prefixcmp(addr1, addr2, length) \
87 (memcmp(addr1, addr2, length >> 3) == 0)
88
89/* local link, i.e. FE80::/10 */
90#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
91
92/* 78/*
93 * check whether we can compress the IID to 16 bits, 79 * check whether we can compress the IID to 16 bits,
94 * it's possible for unicast adresses with first 49 bits are zero only. 80 * it's possible for unicast adresses with first 49 bits are zero only.
@@ -100,22 +86,8 @@
100 (((a)->s6_addr[12]) == 0xfe) && \ 86 (((a)->s6_addr[12]) == 0xfe) && \
101 (((a)->s6_addr[13]) == 0)) 87 (((a)->s6_addr[13]) == 0))
102 88
103/* multicast address */
104#define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
105
106/* check whether the 112-bit gid of the multicast address is mappable to: */ 89/* check whether the 112-bit gid of the multicast address is mappable to: */
107 90
108/* 9 bits, for FF02::1 (all nodes) and FF02::2 (all routers) addresses only. */
109#define lowpan_is_mcast_addr_compressable(a) \
110 ((((a)->s6_addr16[1]) == 0) && \
111 (((a)->s6_addr16[2]) == 0) && \
112 (((a)->s6_addr16[3]) == 0) && \
113 (((a)->s6_addr16[4]) == 0) && \
114 (((a)->s6_addr16[5]) == 0) && \
115 (((a)->s6_addr16[6]) == 0) && \
116 (((a)->s6_addr[14]) == 0) && \
117 ((((a)->s6_addr[15]) == 1) || (((a)->s6_addr[15]) == 2)))
118
119/* 48 bits, FFXX::00XX:XXXX:XXXX */ 91/* 48 bits, FFXX::00XX:XXXX:XXXX */
120#define lowpan_is_mcast_addr_compressable48(a) \ 92#define lowpan_is_mcast_addr_compressable48(a) \
121 ((((a)->s6_addr16[1]) == 0) && \ 93 ((((a)->s6_addr16[1]) == 0) && \
@@ -168,17 +140,6 @@
168#define LOWPAN_FRAGN_HEAD_SIZE 0x5 140#define LOWPAN_FRAGN_HEAD_SIZE 0x5
169 141
170/* 142/*
171 * According IEEE802.15.4 standard:
172 * - MTU is 127 octets
173 * - maximum MHR size is 37 octets
174 * - MFR size is 2 octets
175 *
176 * so minimal payload size that we may guarantee is:
177 * MTU - MHR - MFR = 88 octets
178 */
179#define LOWPAN_FRAG_SIZE 88
180
181/*
182 * Values of fields within the IPHC encoding first byte 143 * Values of fields within the IPHC encoding first byte
183 * (C stands for compressed and I for inline) 144 * (C stands for compressed and I for inline)
184 */ 145 */
@@ -279,17 +240,6 @@ static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val)
279 return 0; 240 return 0;
280} 241}
281 242
282static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
283{
284 if (unlikely(!pskb_may_pull(skb, 2)))
285 return -EINVAL;
286
287 *val = (skb->data[0] << 8) | skb->data[1];
288 skb_pull(skb, 2);
289
290 return 0;
291}
292
293static inline bool lowpan_fetch_skb(struct sk_buff *skb, 243static inline bool lowpan_fetch_skb(struct sk_buff *skb,
294 void *data, const unsigned int len) 244 void *data, const unsigned int len)
295{ 245{
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 904777c1cd24..373000de610d 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -260,15 +260,15 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
260 260
261/* Skb helpers */ 261/* Skb helpers */
262struct l2cap_ctrl { 262struct l2cap_ctrl {
263 unsigned int sframe:1, 263 __u8 sframe:1,
264 poll:1, 264 poll:1,
265 final:1, 265 final:1,
266 fcs:1, 266 fcs:1,
267 sar:2, 267 sar:2,
268 super:2; 268 super:2;
269 __u16 reqseq; 269 __u16 reqseq;
270 __u16 txseq; 270 __u16 txseq;
271 __u8 retries; 271 __u8 retries;
272}; 272};
273 273
274struct hci_dev; 274struct hci_dev;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 16587dcd6a91..3f8547f1c6f8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -81,10 +81,54 @@
81 81
82/* HCI device quirks */ 82/* HCI device quirks */
83enum { 83enum {
84 /* When this quirk is set, the HCI Reset command is send when
85 * closing the transport instead of when opening it.
86 *
87 * This quirk must be set before hci_register_dev is called.
88 */
84 HCI_QUIRK_RESET_ON_CLOSE, 89 HCI_QUIRK_RESET_ON_CLOSE,
90
91 /* When this quirk is set, the device is turned into a raw-only
92 * device and it will stay in unconfigured state.
93 *
94 * This quirk must be set before hci_register_dev is called.
95 */
85 HCI_QUIRK_RAW_DEVICE, 96 HCI_QUIRK_RAW_DEVICE,
97
98 /* When this quirk is set, the buffer sizes reported by
99 * HCI Read Buffer Size command are corrected if invalid.
100 *
101 * This quirk must be set before hci_register_dev is called.
102 */
86 HCI_QUIRK_FIXUP_BUFFER_SIZE, 103 HCI_QUIRK_FIXUP_BUFFER_SIZE,
104
105 /* When this quirk is set, then no stored link key handling
106 * is performed. This is mainly due to the fact that the
107 * HCI Delete Stored Link Key command is advertised, but
108 * not supported.
109 *
110 * This quirk must be set before hci_register_dev is called.
111 */
87 HCI_QUIRK_BROKEN_STORED_LINK_KEY, 112 HCI_QUIRK_BROKEN_STORED_LINK_KEY,
113
114 /* When this quirk is set, an external configuration step
115 * is required and will be indicated with the controller
116 * configuation.
117 *
118 * This quirk can be set before hci_register_dev is called or
119 * during the hdev->setup vendor callback.
120 */
121 HCI_QUIRK_EXTERNAL_CONFIG,
122
123 /* When this quirk is set, the public Bluetooth address
124 * initially reported by HCI Read BD Address command
125 * is considered invalid. Controller configuration is
126 * required before this device can be used.
127 *
128 * This quirk can be set before hci_register_dev is called or
129 * during the hdev->setup vendor callback.
130 */
131 HCI_QUIRK_INVALID_BDADDR,
88}; 132};
89 133
90/* HCI device flags */ 134/* HCI device flags */
@@ -104,24 +148,34 @@ enum {
104 HCI_RESET, 148 HCI_RESET,
105}; 149};
106 150
151/* BR/EDR and/or LE controller flags: the flags defined here should represent
152 * states configured via debugfs for debugging and testing purposes only.
153 */
154enum {
155 HCI_DUT_MODE,
156 HCI_FORCE_SC,
157 HCI_FORCE_STATIC_ADDR,
158};
159
107/* 160/*
108 * BR/EDR and/or LE controller flags: the flags defined here should represent 161 * BR/EDR and/or LE controller flags: the flags defined here should represent
109 * states from the controller. 162 * states from the controller.
110 */ 163 */
111enum { 164enum {
112 HCI_SETUP, 165 HCI_SETUP,
166 HCI_CONFIG,
113 HCI_AUTO_OFF, 167 HCI_AUTO_OFF,
114 HCI_RFKILLED, 168 HCI_RFKILLED,
115 HCI_MGMT, 169 HCI_MGMT,
116 HCI_PAIRABLE, 170 HCI_BONDABLE,
117 HCI_SERVICE_CACHE, 171 HCI_SERVICE_CACHE,
118 HCI_DEBUG_KEYS, 172 HCI_KEEP_DEBUG_KEYS,
119 HCI_DUT_MODE, 173 HCI_USE_DEBUG_KEYS,
120 HCI_FORCE_SC,
121 HCI_FORCE_STATIC_ADDR,
122 HCI_UNREGISTER, 174 HCI_UNREGISTER,
175 HCI_UNCONFIGURED,
123 HCI_USER_CHANNEL, 176 HCI_USER_CHANNEL,
124 177 HCI_EXT_CONFIGURED,
178 HCI_LE_ADV,
125 HCI_LE_SCAN, 179 HCI_LE_SCAN,
126 HCI_SSP_ENABLED, 180 HCI_SSP_ENABLED,
127 HCI_SC_ENABLED, 181 HCI_SC_ENABLED,
@@ -139,7 +193,6 @@ enum {
139 HCI_PERIODIC_INQ, 193 HCI_PERIODIC_INQ,
140 HCI_FAST_CONNECTABLE, 194 HCI_FAST_CONNECTABLE,
141 HCI_BREDR_ENABLED, 195 HCI_BREDR_ENABLED,
142 HCI_6LOWPAN_ENABLED,
143 HCI_LE_SCAN_INTERRUPTED, 196 HCI_LE_SCAN_INTERRUPTED,
144}; 197};
145 198
@@ -147,34 +200,7 @@ enum {
147 * or the HCI device is closed. 200 * or the HCI device is closed.
148 */ 201 */
149#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ 202#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
150 BIT(HCI_FAST_CONNECTABLE)) 203 BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
151
152/* HCI ioctl defines */
153#define HCIDEVUP _IOW('H', 201, int)
154#define HCIDEVDOWN _IOW('H', 202, int)
155#define HCIDEVRESET _IOW('H', 203, int)
156#define HCIDEVRESTAT _IOW('H', 204, int)
157
158#define HCIGETDEVLIST _IOR('H', 210, int)
159#define HCIGETDEVINFO _IOR('H', 211, int)
160#define HCIGETCONNLIST _IOR('H', 212, int)
161#define HCIGETCONNINFO _IOR('H', 213, int)
162#define HCIGETAUTHINFO _IOR('H', 215, int)
163
164#define HCISETRAW _IOW('H', 220, int)
165#define HCISETSCAN _IOW('H', 221, int)
166#define HCISETAUTH _IOW('H', 222, int)
167#define HCISETENCRYPT _IOW('H', 223, int)
168#define HCISETPTYPE _IOW('H', 224, int)
169#define HCISETLINKPOL _IOW('H', 225, int)
170#define HCISETLINKMODE _IOW('H', 226, int)
171#define HCISETACLMTU _IOW('H', 227, int)
172#define HCISETSCOMTU _IOW('H', 228, int)
173
174#define HCIBLOCKADDR _IOW('H', 230, int)
175#define HCIUNBLOCKADDR _IOW('H', 231, int)
176
177#define HCIINQUIRY _IOR('H', 240, int)
178 204
179/* HCI timeouts */ 205/* HCI timeouts */
180#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 206#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
@@ -185,6 +211,7 @@ enum {
185#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 211#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
186#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ 212#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
187#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ 213#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
214#define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
188 215
189/* HCI data types */ 216/* HCI data types */
190#define HCI_COMMAND_PKT 0x01 217#define HCI_COMMAND_PKT 0x01
@@ -301,6 +328,11 @@ enum {
301#define LMP_HOST_LE_BREDR 0x04 328#define LMP_HOST_LE_BREDR 0x04
302#define LMP_HOST_SC 0x08 329#define LMP_HOST_SC 0x08
303 330
331/* LE features */
332#define HCI_LE_ENCRYPTION 0x01
333#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
334#define HCI_LE_PING 0x10
335
304/* Connection modes */ 336/* Connection modes */
305#define HCI_CM_ACTIVE 0x0000 337#define HCI_CM_ACTIVE 0x0000
306#define HCI_CM_HOLD 0x0001 338#define HCI_CM_HOLD 0x0001
@@ -347,17 +379,9 @@ enum {
347#define HCI_LK_CHANGED_COMBINATION 0x06 379#define HCI_LK_CHANGED_COMBINATION 0x06
348#define HCI_LK_UNAUTH_COMBINATION_P256 0x07 380#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
349#define HCI_LK_AUTH_COMBINATION_P256 0x08 381#define HCI_LK_AUTH_COMBINATION_P256 0x08
350/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
351#define HCI_SMP_STK 0x80
352#define HCI_SMP_STK_SLAVE 0x81
353#define HCI_SMP_LTK 0x82
354#define HCI_SMP_LTK_SLAVE 0x83
355
356/* Long Term Key types */
357#define HCI_LTK_UNAUTH 0x00
358#define HCI_LTK_AUTH 0x01
359 382
360/* ---- HCI Error Codes ---- */ 383/* ---- HCI Error Codes ---- */
384#define HCI_ERROR_UNKNOWN_CONN_ID 0x02
361#define HCI_ERROR_AUTH_FAILURE 0x05 385#define HCI_ERROR_AUTH_FAILURE 0x05
362#define HCI_ERROR_MEMORY_EXCEEDED 0x07 386#define HCI_ERROR_MEMORY_EXCEEDED 0x07
363#define HCI_ERROR_CONNECTION_TIMEOUT 0x08 387#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
@@ -367,6 +391,7 @@ enum {
367#define HCI_ERROR_REMOTE_POWER_OFF 0x15 391#define HCI_ERROR_REMOTE_POWER_OFF 0x15
368#define HCI_ERROR_LOCAL_HOST_TERM 0x16 392#define HCI_ERROR_LOCAL_HOST_TERM 0x16
369#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 393#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
394#define HCI_ERROR_INVALID_LL_PARAMS 0x1E
370#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c 395#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
371 396
372/* Flow control modes */ 397/* Flow control modes */
@@ -376,6 +401,9 @@ enum {
376/* The core spec defines 127 as the "not available" value */ 401/* The core spec defines 127 as the "not available" value */
377#define HCI_TX_POWER_INVALID 127 402#define HCI_TX_POWER_INVALID 127
378 403
404#define HCI_ROLE_MASTER 0x00
405#define HCI_ROLE_SLAVE 0x01
406
379/* Extended Inquiry Response field types */ 407/* Extended Inquiry Response field types */
380#define EIR_FLAGS 0x01 /* flags */ 408#define EIR_FLAGS 0x01 /* flags */
381#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 409#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
@@ -536,6 +564,11 @@ struct hci_cp_read_remote_version {
536 __le16 handle; 564 __le16 handle;
537} __packed; 565} __packed;
538 566
567#define HCI_OP_READ_CLOCK_OFFSET 0x041f
568struct hci_cp_read_clock_offset {
569 __le16 handle;
570} __packed;
571
539#define HCI_OP_SETUP_SYNC_CONN 0x0428 572#define HCI_OP_SETUP_SYNC_CONN 0x0428
540struct hci_cp_setup_sync_conn { 573struct hci_cp_setup_sync_conn {
541 __le16 handle; 574 __le16 handle;
@@ -1041,6 +1074,8 @@ struct hci_rp_read_data_block_size {
1041 __le16 num_blocks; 1074 __le16 num_blocks;
1042} __packed; 1075} __packed;
1043 1076
1077#define HCI_OP_READ_LOCAL_CODECS 0x100b
1078
1044#define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b 1079#define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b
1045struct hci_rp_read_page_scan_activity { 1080struct hci_rp_read_page_scan_activity {
1046 __u8 status; 1081 __u8 status;
@@ -1085,6 +1120,18 @@ struct hci_rp_read_rssi {
1085 __s8 rssi; 1120 __s8 rssi;
1086} __packed; 1121} __packed;
1087 1122
1123#define HCI_OP_READ_CLOCK 0x1407
1124struct hci_cp_read_clock {
1125 __le16 handle;
1126 __u8 which;
1127} __packed;
1128struct hci_rp_read_clock {
1129 __u8 status;
1130 __le16 handle;
1131 __le32 clock;
1132 __le16 accuracy;
1133} __packed;
1134
1088#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1135#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
1089struct hci_rp_read_local_amp_info { 1136struct hci_rp_read_local_amp_info {
1090 __u8 status; 1137 __u8 status;
@@ -1125,6 +1172,8 @@ struct hci_rp_write_remote_amp_assoc {
1125 __u8 phy_handle; 1172 __u8 phy_handle;
1126} __packed; 1173} __packed;
1127 1174
1175#define HCI_OP_GET_MWS_TRANSPORT_CONFIG 0x140c
1176
1128#define HCI_OP_ENABLE_DUT_MODE 0x1803 1177#define HCI_OP_ENABLE_DUT_MODE 0x1803
1129 1178
1130#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804 1179#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
@@ -1291,6 +1340,23 @@ struct hci_rp_le_read_supported_states {
1291 __u8 le_states[8]; 1340 __u8 le_states[8];
1292} __packed; 1341} __packed;
1293 1342
1343#define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020
1344struct hci_cp_le_conn_param_req_reply {
1345 __le16 handle;
1346 __le16 interval_min;
1347 __le16 interval_max;
1348 __le16 latency;
1349 __le16 timeout;
1350 __le16 min_ce_len;
1351 __le16 max_ce_len;
1352} __packed;
1353
1354#define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021
1355struct hci_cp_le_conn_param_req_neg_reply {
1356 __le16 handle;
1357 __u8 reason;
1358} __packed;
1359
1294/* ---- HCI Events ---- */ 1360/* ---- HCI Events ---- */
1295#define HCI_EV_INQUIRY_COMPLETE 0x01 1361#define HCI_EV_INQUIRY_COMPLETE 0x01
1296 1362
@@ -1654,9 +1720,6 @@ struct hci_ev_sync_train_complete {
1654 1720
1655#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54 1721#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
1656 1722
1657/* Low energy meta events */
1658#define LE_CONN_ROLE_MASTER 0x00
1659
1660#define HCI_EV_LE_CONN_COMPLETE 0x01 1723#define HCI_EV_LE_CONN_COMPLETE 0x01
1661struct hci_ev_le_conn_complete { 1724struct hci_ev_le_conn_complete {
1662 __u8 status; 1725 __u8 status;
@@ -1670,6 +1733,15 @@ struct hci_ev_le_conn_complete {
1670 __u8 clk_accurancy; 1733 __u8 clk_accurancy;
1671} __packed; 1734} __packed;
1672 1735
1736#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
1737struct hci_ev_le_conn_update_complete {
1738 __u8 status;
1739 __le16 handle;
1740 __le16 interval;
1741 __le16 latency;
1742 __le16 supervision_timeout;
1743} __packed;
1744
1673#define HCI_EV_LE_LTK_REQ 0x05 1745#define HCI_EV_LE_LTK_REQ 0x05
1674struct hci_ev_le_ltk_req { 1746struct hci_ev_le_ltk_req {
1675 __le16 handle; 1747 __le16 handle;
@@ -1677,6 +1749,15 @@ struct hci_ev_le_ltk_req {
1677 __le16 ediv; 1749 __le16 ediv;
1678} __packed; 1750} __packed;
1679 1751
1752#define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06
1753struct hci_ev_le_remote_conn_param_req {
1754 __le16 handle;
1755 __le16 interval_min;
1756 __le16 interval_max;
1757 __le16 latency;
1758 __le16 timeout;
1759} __packed;
1760
1680/* Advertising report event types */ 1761/* Advertising report event types */
1681#define LE_ADV_IND 0x00 1762#define LE_ADV_IND 0x00
1682#define LE_ADV_DIRECT_IND 0x01 1763#define LE_ADV_DIRECT_IND 0x01
@@ -1768,126 +1849,4 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1768#define hci_handle(h) (h & 0x0fff) 1849#define hci_handle(h) (h & 0x0fff)
1769#define hci_flags(h) (h >> 12) 1850#define hci_flags(h) (h >> 12)
1770 1851
1771/* ---- HCI Sockets ---- */
1772
1773/* Socket options */
1774#define HCI_DATA_DIR 1
1775#define HCI_FILTER 2
1776#define HCI_TIME_STAMP 3
1777
1778/* CMSG flags */
1779#define HCI_CMSG_DIR 0x0001
1780#define HCI_CMSG_TSTAMP 0x0002
1781
1782struct sockaddr_hci {
1783 sa_family_t hci_family;
1784 unsigned short hci_dev;
1785 unsigned short hci_channel;
1786};
1787#define HCI_DEV_NONE 0xffff
1788
1789#define HCI_CHANNEL_RAW 0
1790#define HCI_CHANNEL_USER 1
1791#define HCI_CHANNEL_MONITOR 2
1792#define HCI_CHANNEL_CONTROL 3
1793
1794struct hci_filter {
1795 unsigned long type_mask;
1796 unsigned long event_mask[2];
1797 __le16 opcode;
1798};
1799
1800struct hci_ufilter {
1801 __u32 type_mask;
1802 __u32 event_mask[2];
1803 __le16 opcode;
1804};
1805
1806#define HCI_FLT_TYPE_BITS 31
1807#define HCI_FLT_EVENT_BITS 63
1808#define HCI_FLT_OGF_BITS 63
1809#define HCI_FLT_OCF_BITS 127
1810
1811/* ---- HCI Ioctl requests structures ---- */
1812struct hci_dev_stats {
1813 __u32 err_rx;
1814 __u32 err_tx;
1815 __u32 cmd_tx;
1816 __u32 evt_rx;
1817 __u32 acl_tx;
1818 __u32 acl_rx;
1819 __u32 sco_tx;
1820 __u32 sco_rx;
1821 __u32 byte_rx;
1822 __u32 byte_tx;
1823};
1824
1825struct hci_dev_info {
1826 __u16 dev_id;
1827 char name[8];
1828
1829 bdaddr_t bdaddr;
1830
1831 __u32 flags;
1832 __u8 type;
1833
1834 __u8 features[8];
1835
1836 __u32 pkt_type;
1837 __u32 link_policy;
1838 __u32 link_mode;
1839
1840 __u16 acl_mtu;
1841 __u16 acl_pkts;
1842 __u16 sco_mtu;
1843 __u16 sco_pkts;
1844
1845 struct hci_dev_stats stat;
1846};
1847
1848struct hci_conn_info {
1849 __u16 handle;
1850 bdaddr_t bdaddr;
1851 __u8 type;
1852 __u8 out;
1853 __u16 state;
1854 __u32 link_mode;
1855};
1856
1857struct hci_dev_req {
1858 __u16 dev_id;
1859 __u32 dev_opt;
1860};
1861
1862struct hci_dev_list_req {
1863 __u16 dev_num;
1864 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1865};
1866
1867struct hci_conn_list_req {
1868 __u16 dev_id;
1869 __u16 conn_num;
1870 struct hci_conn_info conn_info[0];
1871};
1872
1873struct hci_conn_info_req {
1874 bdaddr_t bdaddr;
1875 __u8 type;
1876 struct hci_conn_info conn_info[0];
1877};
1878
1879struct hci_auth_info_req {
1880 bdaddr_t bdaddr;
1881 __u8 type;
1882};
1883
1884struct hci_inquiry_req {
1885 __u16 dev_id;
1886 __u16 flags;
1887 __u8 lap[3];
1888 __u8 length;
1889 __u8 num_rsp;
1890};
1891#define IREQ_CACHE_FLUSH 0x0001
1892
1893#endif /* __HCI_H */ 1852#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b386bf17e6c2..b5d5af3aa469 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -26,6 +26,7 @@
26#define __HCI_CORE_H 26#define __HCI_CORE_H
27 27
28#include <net/bluetooth/hci.h> 28#include <net/bluetooth/hci.h>
29#include <net/bluetooth/hci_sock.h>
29 30
30/* HCI priority */ 31/* HCI priority */
31#define HCI_PRIO_MAX 7 32#define HCI_PRIO_MAX 7
@@ -71,6 +72,7 @@ struct discovery_state {
71 bdaddr_t last_adv_addr; 72 bdaddr_t last_adv_addr;
72 u8 last_adv_addr_type; 73 u8 last_adv_addr_type;
73 s8 last_adv_rssi; 74 s8 last_adv_rssi;
75 u32 last_adv_flags;
74 u8 last_adv_data[HCI_MAX_AD_LENGTH]; 76 u8 last_adv_data[HCI_MAX_AD_LENGTH];
75 u8 last_adv_data_len; 77 u8 last_adv_data_len;
76}; 78};
@@ -81,6 +83,7 @@ struct hci_conn_hash {
81 unsigned int amp_num; 83 unsigned int amp_num;
82 unsigned int sco_num; 84 unsigned int sco_num;
83 unsigned int le_num; 85 unsigned int le_num;
86 unsigned int le_num_slave;
84}; 87};
85 88
86struct bdaddr_list { 89struct bdaddr_list {
@@ -170,6 +173,8 @@ struct hci_dev {
170 __u8 bus; 173 __u8 bus;
171 __u8 dev_type; 174 __u8 dev_type;
172 bdaddr_t bdaddr; 175 bdaddr_t bdaddr;
176 bdaddr_t setup_addr;
177 bdaddr_t public_addr;
173 bdaddr_t random_addr; 178 bdaddr_t random_addr;
174 bdaddr_t static_addr; 179 bdaddr_t static_addr;
175 __u8 adv_addr_type; 180 __u8 adv_addr_type;
@@ -198,15 +203,20 @@ struct hci_dev {
198 __u16 page_scan_window; 203 __u16 page_scan_window;
199 __u8 page_scan_type; 204 __u8 page_scan_type;
200 __u8 le_adv_channel_map; 205 __u8 le_adv_channel_map;
206 __u16 le_adv_min_interval;
207 __u16 le_adv_max_interval;
201 __u8 le_scan_type; 208 __u8 le_scan_type;
202 __u16 le_scan_interval; 209 __u16 le_scan_interval;
203 __u16 le_scan_window; 210 __u16 le_scan_window;
204 __u16 le_conn_min_interval; 211 __u16 le_conn_min_interval;
205 __u16 le_conn_max_interval; 212 __u16 le_conn_max_interval;
213 __u16 le_conn_latency;
214 __u16 le_supv_timeout;
206 __u16 discov_interleaved_timeout; 215 __u16 discov_interleaved_timeout;
207 __u16 conn_info_min_age; 216 __u16 conn_info_min_age;
208 __u16 conn_info_max_age; 217 __u16 conn_info_max_age;
209 __u8 ssp_debug_mode; 218 __u8 ssp_debug_mode;
219 __u32 clock;
210 220
211 __u16 devid_source; 221 __u16 devid_source;
212 __u16 devid_vendor; 222 __u16 devid_vendor;
@@ -273,7 +283,7 @@ struct hci_dev {
273 283
274 struct delayed_work service_cache; 284 struct delayed_work service_cache;
275 285
276 struct timer_list cmd_timer; 286 struct delayed_work cmd_timer;
277 287
278 struct work_struct rx_work; 288 struct work_struct rx_work;
279 struct work_struct cmd_work; 289 struct work_struct cmd_work;
@@ -299,6 +309,7 @@ struct hci_dev {
299 309
300 struct list_head mgmt_pending; 310 struct list_head mgmt_pending;
301 struct list_head blacklist; 311 struct list_head blacklist;
312 struct list_head whitelist;
302 struct list_head uuids; 313 struct list_head uuids;
303 struct list_head link_keys; 314 struct list_head link_keys;
304 struct list_head long_term_keys; 315 struct list_head long_term_keys;
@@ -307,6 +318,7 @@ struct hci_dev {
307 struct list_head le_white_list; 318 struct list_head le_white_list;
308 struct list_head le_conn_params; 319 struct list_head le_conn_params;
309 struct list_head pend_le_conns; 320 struct list_head pend_le_conns;
321 struct list_head pend_le_reports;
310 322
311 struct hci_dev_stats stat; 323 struct hci_dev_stats stat;
312 324
@@ -318,6 +330,7 @@ struct hci_dev {
318 330
319 struct rfkill *rfkill; 331 struct rfkill *rfkill;
320 332
333 unsigned long dbg_flags;
321 unsigned long dev_flags; 334 unsigned long dev_flags;
322 335
323 struct delayed_work le_scan_disable; 336 struct delayed_work le_scan_disable;
@@ -339,6 +352,7 @@ struct hci_dev {
339 int (*setup)(struct hci_dev *hdev); 352 int (*setup)(struct hci_dev *hdev);
340 int (*send)(struct hci_dev *hdev, struct sk_buff *skb); 353 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
341 void (*notify)(struct hci_dev *hdev, unsigned int evt); 354 void (*notify)(struct hci_dev *hdev, unsigned int evt);
355 int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
342}; 356};
343 357
344#define HCI_PHY_HANDLE(handle) (handle & 0xff) 358#define HCI_PHY_HANDLE(handle) (handle & 0xff)
@@ -360,13 +374,13 @@ struct hci_conn {
360 __u16 state; 374 __u16 state;
361 __u8 mode; 375 __u8 mode;
362 __u8 type; 376 __u8 type;
377 __u8 role;
363 bool out; 378 bool out;
364 __u8 attempt; 379 __u8 attempt;
365 __u8 dev_class[3]; 380 __u8 dev_class[3];
366 __u8 features[HCI_MAX_PAGES][8]; 381 __u8 features[HCI_MAX_PAGES][8];
367 __u16 pkt_type; 382 __u16 pkt_type;
368 __u16 link_policy; 383 __u16 link_policy;
369 __u32 link_mode;
370 __u8 key_type; 384 __u8 key_type;
371 __u8 auth_type; 385 __u8 auth_type;
372 __u8 sec_level; 386 __u8 sec_level;
@@ -377,20 +391,26 @@ struct hci_conn {
377 __u32 passkey_notify; 391 __u32 passkey_notify;
378 __u8 passkey_entered; 392 __u8 passkey_entered;
379 __u16 disc_timeout; 393 __u16 disc_timeout;
394 __u16 conn_timeout;
380 __u16 setting; 395 __u16 setting;
381 __u16 le_conn_min_interval; 396 __u16 le_conn_min_interval;
382 __u16 le_conn_max_interval; 397 __u16 le_conn_max_interval;
398 __u16 le_conn_interval;
399 __u16 le_conn_latency;
400 __u16 le_supv_timeout;
383 __s8 rssi; 401 __s8 rssi;
384 __s8 tx_power; 402 __s8 tx_power;
385 __s8 max_tx_power; 403 __s8 max_tx_power;
386 unsigned long flags; 404 unsigned long flags;
387 405
406 __u32 clock;
407 __u16 clock_accuracy;
408
388 unsigned long conn_info_timestamp; 409 unsigned long conn_info_timestamp;
389 410
390 __u8 remote_cap; 411 __u8 remote_cap;
391 __u8 remote_auth; 412 __u8 remote_auth;
392 __u8 remote_id; 413 __u8 remote_id;
393 bool flush_key;
394 414
395 unsigned int sent; 415 unsigned int sent;
396 416
@@ -407,7 +427,6 @@ struct hci_conn {
407 struct hci_dev *hdev; 427 struct hci_dev *hdev;
408 void *l2cap_data; 428 void *l2cap_data;
409 void *sco_data; 429 void *sco_data;
410 void *smp_conn;
411 struct amp_mgr *amp_mgr; 430 struct amp_mgr *amp_mgr;
412 431
413 struct hci_conn *link; 432 struct hci_conn *link;
@@ -428,15 +447,20 @@ struct hci_chan {
428 447
429struct hci_conn_params { 448struct hci_conn_params {
430 struct list_head list; 449 struct list_head list;
450 struct list_head action;
431 451
432 bdaddr_t addr; 452 bdaddr_t addr;
433 u8 addr_type; 453 u8 addr_type;
434 454
435 u16 conn_min_interval; 455 u16 conn_min_interval;
436 u16 conn_max_interval; 456 u16 conn_max_interval;
457 u16 conn_latency;
458 u16 supervision_timeout;
437 459
438 enum { 460 enum {
439 HCI_AUTO_CONN_DISABLED, 461 HCI_AUTO_CONN_DISABLED,
462 HCI_AUTO_CONN_REPORT,
463 HCI_AUTO_CONN_DIRECT,
440 HCI_AUTO_CONN_ALWAYS, 464 HCI_AUTO_CONN_ALWAYS,
441 HCI_AUTO_CONN_LINK_LOSS, 465 HCI_AUTO_CONN_LINK_LOSS,
442 } auto_connect; 466 } auto_connect;
@@ -501,8 +525,8 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
501 int state); 525 int state);
502void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, 526void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
503 struct inquiry_entry *ie); 527 struct inquiry_entry *ie);
504bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, 528u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
505 bool name_known, bool *ssp); 529 bool name_known);
506void hci_inquiry_cache_flush(struct hci_dev *hdev); 530void hci_inquiry_cache_flush(struct hci_dev *hdev);
507 531
508/* ----- HCI Connections ----- */ 532/* ----- HCI Connections ----- */
@@ -520,7 +544,13 @@ enum {
520 HCI_CONN_AES_CCM, 544 HCI_CONN_AES_CCM,
521 HCI_CONN_POWER_SAVE, 545 HCI_CONN_POWER_SAVE,
522 HCI_CONN_REMOTE_OOB, 546 HCI_CONN_REMOTE_OOB,
523 HCI_CONN_6LOWPAN, 547 HCI_CONN_FLUSH_KEY,
548 HCI_CONN_ENCRYPT,
549 HCI_CONN_AUTH,
550 HCI_CONN_SECURE,
551 HCI_CONN_FIPS,
552 HCI_CONN_STK_ENCRYPT,
553 HCI_CONN_AUTH_INITIATOR,
524}; 554};
525 555
526static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 556static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
@@ -550,6 +580,8 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
550 break; 580 break;
551 case LE_LINK: 581 case LE_LINK:
552 h->le_num++; 582 h->le_num++;
583 if (c->role == HCI_ROLE_SLAVE)
584 h->le_num_slave++;
553 break; 585 break;
554 case SCO_LINK: 586 case SCO_LINK:
555 case ESCO_LINK: 587 case ESCO_LINK:
@@ -574,6 +606,8 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
574 break; 606 break;
575 case LE_LINK: 607 case LE_LINK:
576 h->le_num--; 608 h->le_num--;
609 if (c->role == HCI_ROLE_SLAVE)
610 h->le_num_slave--;
577 break; 611 break;
578 case SCO_LINK: 612 case SCO_LINK:
579 case ESCO_LINK: 613 case ESCO_LINK:
@@ -670,7 +704,8 @@ void hci_disconnect(struct hci_conn *conn, __u8 reason);
670bool hci_setup_sync(struct hci_conn *conn, __u16 handle); 704bool hci_setup_sync(struct hci_conn *conn, __u16 handle);
671void hci_sco_setup(struct hci_conn *conn, __u8 status); 705void hci_sco_setup(struct hci_conn *conn, __u8 status);
672 706
673struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); 707struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst,
708 u8 role);
674int hci_conn_del(struct hci_conn *conn); 709int hci_conn_del(struct hci_conn *conn);
675void hci_conn_hash_flush(struct hci_dev *hdev); 710void hci_conn_hash_flush(struct hci_dev *hdev);
676void hci_conn_check_pending(struct hci_dev *hdev); 711void hci_conn_check_pending(struct hci_dev *hdev);
@@ -681,14 +716,16 @@ void hci_chan_list_flush(struct hci_conn *conn);
681struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); 716struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
682 717
683struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, 718struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
684 u8 dst_type, u8 sec_level, u8 auth_type); 719 u8 dst_type, u8 sec_level, u16 conn_timeout,
720 u8 role);
685struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, 721struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
686 u8 sec_level, u8 auth_type); 722 u8 sec_level, u8 auth_type);
687struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, 723struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
688 __u16 setting); 724 __u16 setting);
689int hci_conn_check_link_mode(struct hci_conn *conn); 725int hci_conn_check_link_mode(struct hci_conn *conn);
690int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); 726int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
691int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); 727int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type,
728 bool initiator);
692int hci_conn_change_link_key(struct hci_conn *conn); 729int hci_conn_change_link_key(struct hci_conn *conn);
693int hci_conn_switch_role(struct hci_conn *conn, __u8 role); 730int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
694 731
@@ -825,30 +862,25 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
825int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); 862int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
826int hci_inquiry(void __user *arg); 863int hci_inquiry(void __user *arg);
827 864
828struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 865struct bdaddr_list *hci_bdaddr_list_lookup(struct list_head *list,
829 bdaddr_t *bdaddr, u8 type); 866 bdaddr_t *bdaddr, u8 type);
830int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 867int hci_bdaddr_list_add(struct list_head *list, bdaddr_t *bdaddr, u8 type);
831int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 868int hci_bdaddr_list_del(struct list_head *list, bdaddr_t *bdaddr, u8 type);
832 869void hci_bdaddr_list_clear(struct list_head *list);
833struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev,
834 bdaddr_t *bdaddr, u8 type);
835void hci_white_list_clear(struct hci_dev *hdev);
836int hci_white_list_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
837int hci_white_list_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
838 870
839struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, 871struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
840 bdaddr_t *addr, u8 addr_type); 872 bdaddr_t *addr, u8 addr_type);
841int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, 873struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,
842 u8 auto_connect, u16 conn_min_interval, 874 bdaddr_t *addr, u8 addr_type);
843 u16 conn_max_interval); 875int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
876 u8 auto_connect);
844void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); 877void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
845void hci_conn_params_clear(struct hci_dev *hdev); 878void hci_conn_params_clear_all(struct hci_dev *hdev);
879void hci_conn_params_clear_disabled(struct hci_dev *hdev);
846 880
847struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev, 881struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,
848 bdaddr_t *addr, u8 addr_type); 882 bdaddr_t *addr,
849void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); 883 u8 addr_type);
850void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
851void hci_pend_le_conns_clear(struct hci_dev *hdev);
852 884
853void hci_update_background_scan(struct hci_dev *hdev); 885void hci_update_background_scan(struct hci_dev *hdev);
854 886
@@ -856,15 +888,16 @@ void hci_uuids_clear(struct hci_dev *hdev);
856 888
857void hci_link_keys_clear(struct hci_dev *hdev); 889void hci_link_keys_clear(struct hci_dev *hdev);
858struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 890struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
859int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 891struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
860 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 892 bdaddr_t *bdaddr, u8 *val, u8 type,
893 u8 pin_len, bool *persistent);
861struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand, 894struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
862 bool master); 895 u8 role);
863struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, 896struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
864 u8 addr_type, u8 type, u8 authenticated, 897 u8 addr_type, u8 type, u8 authenticated,
865 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand); 898 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand);
866struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 899struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
867 u8 addr_type, bool master); 900 u8 addr_type, u8 role);
868int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type); 901int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
869void hci_smp_ltks_clear(struct hci_dev *hdev); 902void hci_smp_ltks_clear(struct hci_dev *hdev);
870int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 903int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
@@ -1021,7 +1054,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
1021 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) 1054 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1022 return; 1055 return;
1023 1056
1024 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 1057 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00;
1025 l2cap_security_cfm(conn, status, encrypt); 1058 l2cap_security_cfm(conn, status, encrypt);
1026 1059
1027 if (conn->security_cfm_cb) 1060 if (conn->security_cfm_cb)
@@ -1062,7 +1095,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
1062 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) 1095 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1063 return; 1096 return;
1064 1097
1065 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 1098 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00;
1066 1099
1067 read_lock(&hci_cb_list_lock); 1100 read_lock(&hci_cb_list_lock);
1068 list_for_each_entry(cb, &hci_cb_list, list) { 1101 list_for_each_entry(cb, &hci_cb_list, list) {
@@ -1147,7 +1180,7 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1147 1180
1148static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) 1181static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1149{ 1182{
1150 if (addr_type != 0x01) 1183 if (addr_type != ADDR_LE_DEV_RANDOM)
1151 return false; 1184 return false;
1152 1185
1153 if ((bdaddr->b[5] & 0xc0) == 0x40) 1186 if ((bdaddr->b[5] & 0xc0) == 0x40)
@@ -1156,6 +1189,18 @@ static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1156 return false; 1189 return false;
1157} 1190}
1158 1191
1192static inline bool hci_is_identity_address(bdaddr_t *addr, u8 addr_type)
1193{
1194 if (addr_type == ADDR_LE_DEV_PUBLIC)
1195 return true;
1196
1197 /* Check for Random Static address type */
1198 if ((addr->b[5] & 0xc0) == 0xc0)
1199 return true;
1200
1201 return false;
1202}
1203
1159static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, 1204static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1160 bdaddr_t *bdaddr, u8 addr_type) 1205 bdaddr_t *bdaddr, u8 addr_type)
1161{ 1206{
@@ -1165,6 +1210,27 @@ static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1165 return hci_find_irk_by_rpa(hdev, bdaddr); 1210 return hci_find_irk_by_rpa(hdev, bdaddr);
1166} 1211}
1167 1212
1213static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
1214 u16 to_multiplier)
1215{
1216 u16 max_latency;
1217
1218 if (min > max || min < 6 || max > 3200)
1219 return -EINVAL;
1220
1221 if (to_multiplier < 10 || to_multiplier > 3200)
1222 return -EINVAL;
1223
1224 if (max >= to_multiplier * 8)
1225 return -EINVAL;
1226
1227 max_latency = (to_multiplier * 8 / max) - 1;
1228 if (latency > 499 || latency > max_latency)
1229 return -EINVAL;
1230
1231 return 0;
1232}
1233
1168int hci_register_cb(struct hci_cb *hcb); 1234int hci_register_cb(struct hci_cb *hcb);
1169int hci_unregister_cb(struct hci_cb *hcb); 1235int hci_unregister_cb(struct hci_cb *hcb);
1170 1236
@@ -1185,6 +1251,7 @@ void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
1185void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, 1251void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1186 const void *param, u8 event); 1252 const void *param, u8 event);
1187void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); 1253void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1254bool hci_req_pending(struct hci_dev *hdev);
1188 1255
1189void hci_req_add_le_scan_disable(struct hci_request *req); 1256void hci_req_add_le_scan_disable(struct hci_request *req);
1190void hci_req_add_le_passive_scan(struct hci_request *req); 1257void hci_req_add_le_passive_scan(struct hci_request *req);
@@ -1227,15 +1294,13 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1227#define DISCOV_BREDR_INQUIRY_LEN 0x08 1294#define DISCOV_BREDR_INQUIRY_LEN 0x08
1228 1295
1229int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1296int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1297int mgmt_new_settings(struct hci_dev *hdev);
1230void mgmt_index_added(struct hci_dev *hdev); 1298void mgmt_index_added(struct hci_dev *hdev);
1231void mgmt_index_removed(struct hci_dev *hdev); 1299void mgmt_index_removed(struct hci_dev *hdev);
1232void mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1300void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1233int mgmt_powered(struct hci_dev *hdev, u8 powered); 1301int mgmt_powered(struct hci_dev *hdev, u8 powered);
1302int mgmt_update_adv_data(struct hci_dev *hdev);
1234void mgmt_discoverable_timeout(struct hci_dev *hdev); 1303void mgmt_discoverable_timeout(struct hci_dev *hdev);
1235void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1236void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1237void mgmt_advertising(struct hci_dev *hdev, u8 advertising);
1238void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1239void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1304void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1240 bool persistent); 1305 bool persistent);
1241void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1306void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
@@ -1281,51 +1346,23 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1281 u8 *randomizer192, u8 *hash256, 1346 u8 *randomizer192, u8 *hash256,
1282 u8 *randomizer256, u8 status); 1347 u8 *randomizer256, u8 status);
1283void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1348void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1284 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1349 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
1285 u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp, 1350 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
1286 u8 scan_rsp_len);
1287void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1351void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1288 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1352 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1289void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1353void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1290int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1291int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1292void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); 1354void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1293void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); 1355void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1294void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, 1356void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1295 bool persistent); 1357 bool persistent);
1358void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
1359 u8 bdaddr_type, u8 store_hint, u16 min_interval,
1360 u16 max_interval, u16 latency, u16 timeout);
1296void mgmt_reenable_advertising(struct hci_dev *hdev); 1361void mgmt_reenable_advertising(struct hci_dev *hdev);
1297void mgmt_smp_complete(struct hci_conn *conn, bool complete); 1362void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1298 1363
1299/* HCI info for socket */ 1364u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
1300#define hci_pi(sk) ((struct hci_pinfo *) sk) 1365 u16 to_multiplier);
1301
1302struct hci_pinfo {
1303 struct bt_sock bt;
1304 struct hci_dev *hdev;
1305 struct hci_filter filter;
1306 __u32 cmsg_mask;
1307 unsigned short channel;
1308};
1309
1310/* HCI security filter */
1311#define HCI_SFLT_MAX_OGF 5
1312
1313struct hci_sec_filter {
1314 __u32 type_mask;
1315 __u32 event_mask[2];
1316 __u32 ocf_mask[HCI_SFLT_MAX_OGF + 1][4];
1317};
1318
1319/* ----- HCI requests ----- */
1320#define HCI_REQ_DONE 0
1321#define HCI_REQ_PEND 1
1322#define HCI_REQ_CANCELED 2
1323
1324#define hci_req_lock(d) mutex_lock(&d->req_lock)
1325#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1326
1327void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1328 u16 latency, u16 to_multiplier);
1329void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, 1366void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
1330 __u8 ltk[16]); 1367 __u8 ltk[16]);
1331 1368
diff --git a/include/net/bluetooth/hci_sock.h b/include/net/bluetooth/hci_sock.h
new file mode 100644
index 000000000000..9a46d665c1b5
--- /dev/null
+++ b/include/net/bluetooth/hci_sock.h
@@ -0,0 +1,175 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
10
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __HCI_SOCK_H
26#define __HCI_SOCK_H
27
28/* Socket options */
29#define HCI_DATA_DIR 1
30#define HCI_FILTER 2
31#define HCI_TIME_STAMP 3
32
33/* CMSG flags */
34#define HCI_CMSG_DIR 0x0001
35#define HCI_CMSG_TSTAMP 0x0002
36
37struct sockaddr_hci {
38 sa_family_t hci_family;
39 unsigned short hci_dev;
40 unsigned short hci_channel;
41};
42#define HCI_DEV_NONE 0xffff
43
44#define HCI_CHANNEL_RAW 0
45#define HCI_CHANNEL_USER 1
46#define HCI_CHANNEL_MONITOR 2
47#define HCI_CHANNEL_CONTROL 3
48
49struct hci_filter {
50 unsigned long type_mask;
51 unsigned long event_mask[2];
52 __le16 opcode;
53};
54
55struct hci_ufilter {
56 __u32 type_mask;
57 __u32 event_mask[2];
58 __le16 opcode;
59};
60
61#define HCI_FLT_TYPE_BITS 31
62#define HCI_FLT_EVENT_BITS 63
63#define HCI_FLT_OGF_BITS 63
64#define HCI_FLT_OCF_BITS 127
65
66/* Ioctl defines */
67#define HCIDEVUP _IOW('H', 201, int)
68#define HCIDEVDOWN _IOW('H', 202, int)
69#define HCIDEVRESET _IOW('H', 203, int)
70#define HCIDEVRESTAT _IOW('H', 204, int)
71
72#define HCIGETDEVLIST _IOR('H', 210, int)
73#define HCIGETDEVINFO _IOR('H', 211, int)
74#define HCIGETCONNLIST _IOR('H', 212, int)
75#define HCIGETCONNINFO _IOR('H', 213, int)
76#define HCIGETAUTHINFO _IOR('H', 215, int)
77
78#define HCISETRAW _IOW('H', 220, int)
79#define HCISETSCAN _IOW('H', 221, int)
80#define HCISETAUTH _IOW('H', 222, int)
81#define HCISETENCRYPT _IOW('H', 223, int)
82#define HCISETPTYPE _IOW('H', 224, int)
83#define HCISETLINKPOL _IOW('H', 225, int)
84#define HCISETLINKMODE _IOW('H', 226, int)
85#define HCISETACLMTU _IOW('H', 227, int)
86#define HCISETSCOMTU _IOW('H', 228, int)
87
88#define HCIBLOCKADDR _IOW('H', 230, int)
89#define HCIUNBLOCKADDR _IOW('H', 231, int)
90
91#define HCIINQUIRY _IOR('H', 240, int)
92
93/* Ioctl requests structures */
94struct hci_dev_stats {
95 __u32 err_rx;
96 __u32 err_tx;
97 __u32 cmd_tx;
98 __u32 evt_rx;
99 __u32 acl_tx;
100 __u32 acl_rx;
101 __u32 sco_tx;
102 __u32 sco_rx;
103 __u32 byte_rx;
104 __u32 byte_tx;
105};
106
107struct hci_dev_info {
108 __u16 dev_id;
109 char name[8];
110
111 bdaddr_t bdaddr;
112
113 __u32 flags;
114 __u8 type;
115
116 __u8 features[8];
117
118 __u32 pkt_type;
119 __u32 link_policy;
120 __u32 link_mode;
121
122 __u16 acl_mtu;
123 __u16 acl_pkts;
124 __u16 sco_mtu;
125 __u16 sco_pkts;
126
127 struct hci_dev_stats stat;
128};
129
130struct hci_conn_info {
131 __u16 handle;
132 bdaddr_t bdaddr;
133 __u8 type;
134 __u8 out;
135 __u16 state;
136 __u32 link_mode;
137};
138
139struct hci_dev_req {
140 __u16 dev_id;
141 __u32 dev_opt;
142};
143
144struct hci_dev_list_req {
145 __u16 dev_num;
146 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
147};
148
149struct hci_conn_list_req {
150 __u16 dev_id;
151 __u16 conn_num;
152 struct hci_conn_info conn_info[0];
153};
154
155struct hci_conn_info_req {
156 bdaddr_t bdaddr;
157 __u8 type;
158 struct hci_conn_info conn_info[0];
159};
160
161struct hci_auth_info_req {
162 bdaddr_t bdaddr;
163 __u8 type;
164};
165
166struct hci_inquiry_req {
167 __u16 dev_id;
168 __u16 flags;
169 __u8 lap[3];
170 __u8 length;
171 __u8 num_rsp;
172};
173#define IREQ_CACHE_FLUSH 0x0001
174
175#endif /* __HCI_SOCK_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 4abdcb220e3a..8df15ad0d43f 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -134,10 +134,12 @@ struct l2cap_conninfo {
134#define L2CAP_FCS_CRC16 0x01 134#define L2CAP_FCS_CRC16 0x01
135 135
136/* L2CAP fixed channels */ 136/* L2CAP fixed channels */
137#define L2CAP_FC_L2CAP 0x02 137#define L2CAP_FC_SIG_BREDR 0x02
138#define L2CAP_FC_CONNLESS 0x04 138#define L2CAP_FC_CONNLESS 0x04
139#define L2CAP_FC_A2MP 0x08 139#define L2CAP_FC_A2MP 0x08
140#define L2CAP_FC_6LOWPAN 0x3e /* reserved and temporary value */ 140#define L2CAP_FC_ATT 0x10
141#define L2CAP_FC_SIG_LE 0x20
142#define L2CAP_FC_SMP_LE 0x40
141 143
142/* L2CAP Control Field bit masks */ 144/* L2CAP Control Field bit masks */
143#define L2CAP_CTRL_SAR 0xC000 145#define L2CAP_CTRL_SAR 0xC000
@@ -579,7 +581,7 @@ struct l2cap_chan {
579 struct list_head global_l; 581 struct list_head global_l;
580 582
581 void *data; 583 void *data;
582 struct l2cap_ops *ops; 584 const struct l2cap_ops *ops;
583 struct mutex lock; 585 struct mutex lock;
584}; 586};
585 587
@@ -600,7 +602,12 @@ struct l2cap_ops {
600 void (*set_shutdown) (struct l2cap_chan *chan); 602 void (*set_shutdown) (struct l2cap_chan *chan);
601 long (*get_sndtimeo) (struct l2cap_chan *chan); 603 long (*get_sndtimeo) (struct l2cap_chan *chan);
602 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 604 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
605 unsigned long hdr_len,
603 unsigned long len, int nb); 606 unsigned long len, int nb);
607 int (*memcpy_fromiovec) (struct l2cap_chan *chan,
608 unsigned char *kdata,
609 struct iovec *iov,
610 int len);
604}; 611};
605 612
606struct l2cap_conn { 613struct l2cap_conn {
@@ -618,11 +625,10 @@ struct l2cap_conn {
618 625
619 struct delayed_work info_timer; 626 struct delayed_work info_timer;
620 627
621 spinlock_t lock;
622
623 struct sk_buff *rx_skb; 628 struct sk_buff *rx_skb;
624 __u32 rx_len; 629 __u32 rx_len;
625 __u8 tx_ident; 630 __u8 tx_ident;
631 struct mutex ident_lock;
626 632
627 struct sk_buff_head pending_rx; 633 struct sk_buff_head pending_rx;
628 struct work_struct pending_rx_work; 634 struct work_struct pending_rx_work;
@@ -856,6 +862,31 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
856 return 0; 862 return 0;
857} 863}
858 864
865static inline int l2cap_chan_no_memcpy_fromiovec(struct l2cap_chan *chan,
866 unsigned char *kdata,
867 struct iovec *iov,
868 int len)
869{
870 /* Following is safe since for compiler definitions of kvec and
871 * iovec are identical, yielding the same in-core layout and alignment
872 */
873 struct kvec *vec = (struct kvec *)iov;
874
875 while (len > 0) {
876 if (vec->iov_len) {
877 int copy = min_t(unsigned int, len, vec->iov_len);
878 memcpy(kdata, vec->iov_base, copy);
879 len -= copy;
880 kdata += copy;
881 vec->iov_base += copy;
882 vec->iov_len -= copy;
883 }
884 vec++;
885 }
886
887 return 0;
888}
889
859extern bool disable_ertm; 890extern bool disable_ertm;
860 891
861int l2cap_init_sockets(void); 892int l2cap_init_sockets(void);
@@ -872,10 +903,9 @@ struct l2cap_chan *l2cap_chan_create(void);
872void l2cap_chan_close(struct l2cap_chan *chan, int reason); 903void l2cap_chan_close(struct l2cap_chan *chan, int reason);
873int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 904int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
874 bdaddr_t *dst, u8 dst_type); 905 bdaddr_t *dst, u8 dst_type);
875int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 906int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
876 u32 priority);
877void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 907void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
878int l2cap_chan_check_security(struct l2cap_chan *chan); 908int l2cap_chan_check_security(struct l2cap_chan *chan, bool initiator);
879void l2cap_chan_set_defaults(struct l2cap_chan *chan); 909void l2cap_chan_set_defaults(struct l2cap_chan *chan);
880int l2cap_ertm_init(struct l2cap_chan *chan); 910int l2cap_ertm_init(struct l2cap_chan *chan);
881void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 911void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index bcffc9ae0c89..414cd2f9a437 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -87,7 +87,7 @@ struct mgmt_rp_read_index_list {
87#define MGMT_SETTING_CONNECTABLE 0x00000002 87#define MGMT_SETTING_CONNECTABLE 0x00000002
88#define MGMT_SETTING_FAST_CONNECTABLE 0x00000004 88#define MGMT_SETTING_FAST_CONNECTABLE 0x00000004
89#define MGMT_SETTING_DISCOVERABLE 0x00000008 89#define MGMT_SETTING_DISCOVERABLE 0x00000008
90#define MGMT_SETTING_PAIRABLE 0x00000010 90#define MGMT_SETTING_BONDABLE 0x00000010
91#define MGMT_SETTING_LINK_SECURITY 0x00000020 91#define MGMT_SETTING_LINK_SECURITY 0x00000020
92#define MGMT_SETTING_SSP 0x00000040 92#define MGMT_SETTING_SSP 0x00000040
93#define MGMT_SETTING_BREDR 0x00000080 93#define MGMT_SETTING_BREDR 0x00000080
@@ -97,6 +97,7 @@ struct mgmt_rp_read_index_list {
97#define MGMT_SETTING_SECURE_CONN 0x00000800 97#define MGMT_SETTING_SECURE_CONN 0x00000800
98#define MGMT_SETTING_DEBUG_KEYS 0x00001000 98#define MGMT_SETTING_DEBUG_KEYS 0x00001000
99#define MGMT_SETTING_PRIVACY 0x00002000 99#define MGMT_SETTING_PRIVACY 0x00002000
100#define MGMT_SETTING_CONFIGURATION 0x00004000
100 101
101#define MGMT_OP_READ_INFO 0x0004 102#define MGMT_OP_READ_INFO 0x0004
102#define MGMT_READ_INFO_SIZE 0 103#define MGMT_READ_INFO_SIZE 0
@@ -130,7 +131,7 @@ struct mgmt_cp_set_discoverable {
130 131
131#define MGMT_OP_SET_FAST_CONNECTABLE 0x0008 132#define MGMT_OP_SET_FAST_CONNECTABLE 0x0008
132 133
133#define MGMT_OP_SET_PAIRABLE 0x0009 134#define MGMT_OP_SET_BONDABLE 0x0009
134 135
135#define MGMT_OP_SET_LINK_SECURITY 0x000A 136#define MGMT_OP_SET_LINK_SECURITY 0x000A
136 137
@@ -424,6 +425,76 @@ struct mgmt_rp_get_conn_info {
424 __s8 max_tx_power; 425 __s8 max_tx_power;
425} __packed; 426} __packed;
426 427
428#define MGMT_OP_GET_CLOCK_INFO 0x0032
429struct mgmt_cp_get_clock_info {
430 struct mgmt_addr_info addr;
431} __packed;
432#define MGMT_GET_CLOCK_INFO_SIZE MGMT_ADDR_INFO_SIZE
433struct mgmt_rp_get_clock_info {
434 struct mgmt_addr_info addr;
435 __le32 local_clock;
436 __le32 piconet_clock;
437 __le16 accuracy;
438} __packed;
439
440#define MGMT_OP_ADD_DEVICE 0x0033
441struct mgmt_cp_add_device {
442 struct mgmt_addr_info addr;
443 __u8 action;
444} __packed;
445#define MGMT_ADD_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
446
447#define MGMT_OP_REMOVE_DEVICE 0x0034
448struct mgmt_cp_remove_device {
449 struct mgmt_addr_info addr;
450} __packed;
451#define MGMT_REMOVE_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
452
453struct mgmt_conn_param {
454 struct mgmt_addr_info addr;
455 __le16 min_interval;
456 __le16 max_interval;
457 __le16 latency;
458 __le16 timeout;
459} __packed;
460
461#define MGMT_OP_LOAD_CONN_PARAM 0x0035
462struct mgmt_cp_load_conn_param {
463 __le16 param_count;
464 struct mgmt_conn_param params[0];
465} __packed;
466#define MGMT_LOAD_CONN_PARAM_SIZE 2
467
468#define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036
469#define MGMT_READ_UNCONF_INDEX_LIST_SIZE 0
470struct mgmt_rp_read_unconf_index_list {
471 __le16 num_controllers;
472 __le16 index[0];
473} __packed;
474
475#define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001
476#define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002
477
478#define MGMT_OP_READ_CONFIG_INFO 0x0037
479#define MGMT_READ_CONFIG_INFO_SIZE 0
480struct mgmt_rp_read_config_info {
481 __le16 manufacturer;
482 __le32 supported_options;
483 __le32 missing_options;
484} __packed;
485
486#define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038
487struct mgmt_cp_set_external_config {
488 __u8 config;
489} __packed;
490#define MGMT_SET_EXTERNAL_CONFIG_SIZE 1
491
492#define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039
493struct mgmt_cp_set_public_address {
494 bdaddr_t bdaddr;
495} __packed;
496#define MGMT_SET_PUBLIC_ADDRESS_SIZE 6
497
427#define MGMT_EV_CMD_COMPLETE 0x0001 498#define MGMT_EV_CMD_COMPLETE 0x0001
428struct mgmt_ev_cmd_complete { 499struct mgmt_ev_cmd_complete {
429 __le16 opcode; 500 __le16 opcode;
@@ -522,6 +593,7 @@ struct mgmt_ev_auth_failed {
522 593
523#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 594#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
524#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 595#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
596#define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
525 597
526#define MGMT_EV_DEVICE_FOUND 0x0012 598#define MGMT_EV_DEVICE_FOUND 0x0012
527struct mgmt_ev_device_found { 599struct mgmt_ev_device_found {
@@ -578,3 +650,30 @@ struct mgmt_ev_new_csrk {
578 __u8 store_hint; 650 __u8 store_hint;
579 struct mgmt_csrk_info key; 651 struct mgmt_csrk_info key;
580} __packed; 652} __packed;
653
654#define MGMT_EV_DEVICE_ADDED 0x001a
655struct mgmt_ev_device_added {
656 struct mgmt_addr_info addr;
657 __u8 action;
658} __packed;
659
660#define MGMT_EV_DEVICE_REMOVED 0x001b
661struct mgmt_ev_device_removed {
662 struct mgmt_addr_info addr;
663} __packed;
664
665#define MGMT_EV_NEW_CONN_PARAM 0x001c
666struct mgmt_ev_new_conn_param {
667 struct mgmt_addr_info addr;
668 __u8 store_hint;
669 __le16 min_interval;
670 __le16 max_interval;
671 __le16 latency;
672 __le16 timeout;
673} __packed;
674
675#define MGMT_EV_UNCONF_INDEX_ADDED 0x001d
676
677#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
678
679#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index 2019d1a0996a..f40ddb4264fc 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -27,11 +27,6 @@
27 27
28/* SCO defaults */ 28/* SCO defaults */
29#define SCO_DEFAULT_MTU 500 29#define SCO_DEFAULT_MTU 500
30#define SCO_DEFAULT_FLUSH_TO 0xFFFF
31
32#define SCO_CONN_TIMEOUT (HZ * 40)
33#define SCO_DISCONN_TIMEOUT (HZ * 2)
34#define SCO_CONN_IDLE_TIMEOUT (HZ * 60)
35 30
36/* SCO socket address */ 31/* SCO socket address */
37struct sockaddr_sco { 32struct sockaddr_sco {
@@ -51,29 +46,4 @@ struct sco_conninfo {
51 __u8 dev_class[3]; 46 __u8 dev_class[3];
52}; 47};
53 48
54/* ---- SCO connections ---- */
55struct sco_conn {
56 struct hci_conn *hcon;
57
58 spinlock_t lock;
59 struct sock *sk;
60
61 unsigned int mtu;
62};
63
64#define sco_conn_lock(c) spin_lock(&c->lock);
65#define sco_conn_unlock(c) spin_unlock(&c->lock);
66
67/* ----- SCO socket info ----- */
68#define sco_pi(sk) ((struct sco_pinfo *) sk)
69
70struct sco_pinfo {
71 struct bt_sock bt;
72 bdaddr_t src;
73 bdaddr_t dst;
74 __u32 flags;
75 __u16 setting;
76 struct sco_conn *conn;
77};
78
79#endif /* __SCO_H */ 49#endif /* __SCO_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e46c437944f7..0a080c4de275 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2266,10 +2266,6 @@ struct cfg80211_qos_map {
2266 * 2266 *
2267 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 2267 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
2268 * 2268 *
2269 * @set_ringparam: Set tx and rx ring sizes.
2270 *
2271 * @get_ringparam: Get tx and rx ring current and maximum sizes.
2272 *
2273 * @tdls_mgmt: Transmit a TDLS management frame. 2269 * @tdls_mgmt: Transmit a TDLS management frame.
2274 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 2270 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
2275 * 2271 *
@@ -2278,16 +2274,6 @@ struct cfg80211_qos_map {
2278 * 2274 *
2279 * @set_noack_map: Set the NoAck Map for the TIDs. 2275 * @set_noack_map: Set the NoAck Map for the TIDs.
2280 * 2276 *
2281 * @get_et_sset_count: Ethtool API to get string-set count.
2282 * See @ethtool_ops.get_sset_count
2283 *
2284 * @get_et_stats: Ethtool API to get a set of u64 stats.
2285 * See @ethtool_ops.get_ethtool_stats
2286 *
2287 * @get_et_strings: Ethtool API to get a set of strings to describe stats
2288 * and perhaps other supported types of ethtool data-sets.
2289 * See @ethtool_ops.get_strings
2290 *
2291 * @get_channel: Get the current operating channel for the virtual interface. 2277 * @get_channel: Get the current operating channel for the virtual interface.
2292 * For monitor interfaces, it should return %NULL unless there's a single 2278 * For monitor interfaces, it should return %NULL unless there's a single
2293 * current monitoring channel. 2279 * current monitoring channel.
@@ -2315,7 +2301,12 @@ struct cfg80211_qos_map {
2315 * reliability. This operation can not fail. 2301 * reliability. This operation can not fail.
2316 * @set_coalesce: Set coalesce parameters. 2302 * @set_coalesce: Set coalesce parameters.
2317 * 2303 *
2318 * @channel_switch: initiate channel-switch procedure (with CSA) 2304 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
2305 * responsible for veryfing if the switch is possible. Since this is
2306 * inherently tricky driver may decide to disconnect an interface later
2307 * with cfg80211_stop_iface(). This doesn't mean driver can accept
2308 * everything. It should do it's best to verify requests and reject them
2309 * as soon as possible.
2319 * 2310 *
2320 * @set_qos_map: Set QoS mapping information to the driver 2311 * @set_qos_map: Set QoS mapping information to the driver
2321 * 2312 *
@@ -2503,10 +2494,6 @@ struct cfg80211_ops {
2503 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2494 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2504 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 2495 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
2505 2496
2506 int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
2507 void (*get_ringparam)(struct wiphy *wiphy,
2508 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
2509
2510 int (*sched_scan_start)(struct wiphy *wiphy, 2497 int (*sched_scan_start)(struct wiphy *wiphy,
2511 struct net_device *dev, 2498 struct net_device *dev,
2512 struct cfg80211_sched_scan_request *request); 2499 struct cfg80211_sched_scan_request *request);
@@ -2518,7 +2505,7 @@ struct cfg80211_ops {
2518 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2505 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2519 const u8 *peer, u8 action_code, u8 dialog_token, 2506 const u8 *peer, u8 action_code, u8 dialog_token,
2520 u16 status_code, u32 peer_capability, 2507 u16 status_code, u32 peer_capability,
2521 const u8 *buf, size_t len); 2508 bool initiator, const u8 *buf, size_t len);
2522 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2509 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2523 const u8 *peer, enum nl80211_tdls_operation oper); 2510 const u8 *peer, enum nl80211_tdls_operation oper);
2524 2511
@@ -2529,13 +2516,6 @@ struct cfg80211_ops {
2529 struct net_device *dev, 2516 struct net_device *dev,
2530 u16 noack_map); 2517 u16 noack_map);
2531 2518
2532 int (*get_et_sset_count)(struct wiphy *wiphy,
2533 struct net_device *dev, int sset);
2534 void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2535 struct ethtool_stats *stats, u64 *data);
2536 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2537 u32 sset, u8 *data);
2538
2539 int (*get_channel)(struct wiphy *wiphy, 2519 int (*get_channel)(struct wiphy *wiphy,
2540 struct wireless_dev *wdev, 2520 struct wireless_dev *wdev,
2541 struct cfg80211_chan_def *chandef); 2521 struct cfg80211_chan_def *chandef);
@@ -4843,6 +4823,10 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
4843 */ 4823 */
4844void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 4824void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
4845 4825
4826
4827/* ethtool helper */
4828void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
4829
4846/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4830/* Logging, debugging and troubleshooting/diagnostic helpers. */
4847 4831
4848/* wiphy_printk helpers, similar to dev_printk */ 4832/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index a975edf21b22..597b88a94332 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -81,8 +81,8 @@ struct dcbnl_rtnl_ops {
81 void (*setbcncfg)(struct net_device *, int, u32); 81 void (*setbcncfg)(struct net_device *, int, u32);
82 void (*getbcnrp)(struct net_device *, int, u8 *); 82 void (*getbcnrp)(struct net_device *, int, u8 *);
83 void (*setbcnrp)(struct net_device *, int, u8); 83 void (*setbcnrp)(struct net_device *, int, u8);
84 u8 (*setapp)(struct net_device *, u8, u16, u8); 84 int (*setapp)(struct net_device *, u8, u16, u8);
85 u8 (*getapp)(struct net_device *, u8, u16); 85 int (*getapp)(struct net_device *, u8, u16);
86 u8 (*getfeatcfg)(struct net_device *, int, u8 *); 86 u8 (*getfeatcfg)(struct net_device *, int, u8 *);
87 u8 (*setfeatcfg)(struct net_device *, int, u8); 87 u8 (*setfeatcfg)(struct net_device *, int, u8);
88 88
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index 7e64bd8bbda9..6667a054763a 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -1,6 +1,19 @@
1#ifndef _NET_FLOW_KEYS_H 1#ifndef _NET_FLOW_KEYS_H
2#define _NET_FLOW_KEYS_H 2#define _NET_FLOW_KEYS_H
3 3
4/* struct flow_keys:
5 * @src: source ip address in case of IPv4
6 * For IPv6 it contains 32bit hash of src address
7 * @dst: destination ip address in case of IPv4
8 * For IPv6 it contains 32bit hash of dst address
9 * @ports: port numbers of Transport header
10 * port16[0]: src port number
11 * port16[1]: dst port number
12 * @thoff: Transport header offset
13 * @n_proto: Network header protocol (eg. IPv4/IPv6)
14 * @ip_proto: Transport header protocol (eg. TCP/UDP)
15 * All the members, except thoff, are in network byte order.
16 */
4struct flow_keys { 17struct flow_keys {
5 /* (src,dst) must be grouped, in the same way than in IP header */ 18 /* (src,dst) must be grouped, in the same way than in IP header */
6 __be32 src; 19 __be32 src;
@@ -10,9 +23,11 @@ struct flow_keys {
10 __be16 port16[2]; 23 __be16 port16[2];
11 }; 24 };
12 u16 thoff; 25 u16 thoff;
26 u16 n_proto;
13 u8 ip_proto; 27 u8 ip_proto;
14}; 28};
15 29
16bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); 30bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
17__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto); 31__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto);
32u32 flow_hash_from_keys(struct flow_keys *keys);
18#endif 33#endif
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index b4956a5fcc3f..d07b1a64b4e7 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -205,6 +205,7 @@ struct inet6_dev {
205 struct timer_list rs_timer; 205 struct timer_list rs_timer;
206 __u8 rs_probes; 206 __u8 rs_probes;
207 207
208 __u8 addr_gen_mode;
208 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ 209 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */
209 struct rcu_head rcu; 210 struct rcu_head rcu;
210}; 211};
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 7a4313887568..5fbe6568c3cf 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -62,6 +62,7 @@ struct inet_connection_sock_af_ops {
62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
63 int (*bind_conflict)(const struct sock *sk, 63 int (*bind_conflict)(const struct sock *sk,
64 const struct inet_bind_bucket *tb, bool relax); 64 const struct inet_bind_bucket *tb, bool relax);
65 void (*mtu_reduced)(struct sock *sk);
65}; 66};
66 67
67/** inet_connection_sock - INET connection oriented sock 68/** inet_connection_sock - INET connection oriented sock
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 6f59de98dabd..65a8855e99fe 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -4,10 +4,6 @@
4#include <linux/percpu_counter.h> 4#include <linux/percpu_counter.h>
5 5
6struct netns_frags { 6struct netns_frags {
7 int nqueues;
8 struct list_head lru_list;
9 spinlock_t lru_lock;
10
11 /* The percpu_counter "mem" need to be cacheline aligned. 7 /* The percpu_counter "mem" need to be cacheline aligned.
12 * mem.count must not share cacheline with other writers 8 * mem.count must not share cacheline with other writers
13 */ 9 */
@@ -19,25 +15,49 @@ struct netns_frags {
19 int low_thresh; 15 int low_thresh;
20}; 16};
21 17
18/**
19 * fragment queue flags
20 *
21 * @INET_FRAG_FIRST_IN: first fragment has arrived
22 * @INET_FRAG_LAST_IN: final fragment has arrived
23 * @INET_FRAG_COMPLETE: frag queue has been processed and is due for destruction
24 * @INET_FRAG_EVICTED: frag queue is being evicted
25 */
26enum {
27 INET_FRAG_FIRST_IN = BIT(0),
28 INET_FRAG_LAST_IN = BIT(1),
29 INET_FRAG_COMPLETE = BIT(2),
30 INET_FRAG_EVICTED = BIT(3)
31};
32
33/**
34 * struct inet_frag_queue - fragment queue
35 *
36 * @lock: spinlock protecting the queue
37 * @timer: queue expiration timer
38 * @list: hash bucket list
39 * @refcnt: reference count of the queue
40 * @fragments: received fragments head
41 * @fragments_tail: received fragments tail
42 * @stamp: timestamp of the last received fragment
43 * @len: total length of the original datagram
44 * @meat: length of received fragments so far
45 * @flags: fragment queue flags
46 * @max_size: (ipv4 only) maximum received fragment size with IP_DF set
47 * @net: namespace that this frag belongs to
48 */
22struct inet_frag_queue { 49struct inet_frag_queue {
23 spinlock_t lock; 50 spinlock_t lock;
24 struct timer_list timer; /* when will this queue expire? */ 51 struct timer_list timer;
25 struct list_head lru_list; /* lru list member */
26 struct hlist_node list; 52 struct hlist_node list;
27 atomic_t refcnt; 53 atomic_t refcnt;
28 struct sk_buff *fragments; /* list of received fragments */ 54 struct sk_buff *fragments;
29 struct sk_buff *fragments_tail; 55 struct sk_buff *fragments_tail;
30 ktime_t stamp; 56 ktime_t stamp;
31 int len; /* total length of orig datagram */ 57 int len;
32 int meat; 58 int meat;
33 __u8 last_in; /* first/last segment arrived? */ 59 __u8 flags;
34
35#define INET_FRAG_COMPLETE 4
36#define INET_FRAG_FIRST_IN 2
37#define INET_FRAG_LAST_IN 1
38
39 u16 max_size; 60 u16 max_size;
40
41 struct netns_frags *net; 61 struct netns_frags *net;
42}; 62};
43 63
@@ -48,7 +68,7 @@ struct inet_frag_queue {
48 * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or 68 * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or
49 * struct frag_queue)) 69 * struct frag_queue))
50 */ 70 */
51#define INETFRAGS_MAXDEPTH 128 71#define INETFRAGS_MAXDEPTH 128
52 72
53struct inet_frag_bucket { 73struct inet_frag_bucket {
54 struct hlist_head chain; 74 struct hlist_head chain;
@@ -57,49 +77,52 @@ struct inet_frag_bucket {
57 77
58struct inet_frags { 78struct inet_frags {
59 struct inet_frag_bucket hash[INETFRAGS_HASHSZ]; 79 struct inet_frag_bucket hash[INETFRAGS_HASHSZ];
60 /* This rwlock is a global lock (seperate per IPv4, IPv6 and 80
61 * netfilter). Important to keep this on a seperate cacheline. 81 struct work_struct frags_work;
62 * Its primarily a rebuild protection rwlock. 82 unsigned int next_bucket;
63 */ 83 unsigned long last_rebuild_jiffies;
64 rwlock_t lock ____cacheline_aligned_in_smp; 84 bool rebuild;
65 int secret_interval;
66 struct timer_list secret_timer;
67 85
68 /* The first call to hashfn is responsible to initialize 86 /* The first call to hashfn is responsible to initialize
69 * rnd. This is best done with net_get_random_once. 87 * rnd. This is best done with net_get_random_once.
88 *
89 * rnd_seqlock is used to let hash insertion detect
90 * when it needs to re-lookup the hash chain to use.
70 */ 91 */
71 u32 rnd; 92 u32 rnd;
93 seqlock_t rnd_seqlock;
72 int qsize; 94 int qsize;
73 95
74 unsigned int (*hashfn)(struct inet_frag_queue *); 96 unsigned int (*hashfn)(const struct inet_frag_queue *);
75 bool (*match)(struct inet_frag_queue *q, void *arg); 97 bool (*match)(const struct inet_frag_queue *q,
98 const void *arg);
76 void (*constructor)(struct inet_frag_queue *q, 99 void (*constructor)(struct inet_frag_queue *q,
77 void *arg); 100 const void *arg);
78 void (*destructor)(struct inet_frag_queue *); 101 void (*destructor)(struct inet_frag_queue *);
79 void (*skb_free)(struct sk_buff *); 102 void (*skb_free)(struct sk_buff *);
80 void (*frag_expire)(unsigned long data); 103 void (*frag_expire)(unsigned long data);
104 struct kmem_cache *frags_cachep;
105 const char *frags_cache_name;
81}; 106};
82 107
83void inet_frags_init(struct inet_frags *); 108int inet_frags_init(struct inet_frags *);
84void inet_frags_fini(struct inet_frags *); 109void inet_frags_fini(struct inet_frags *);
85 110
86void inet_frags_init_net(struct netns_frags *nf); 111void inet_frags_init_net(struct netns_frags *nf);
87void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f); 112void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
88 113
89void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); 114void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
90void inet_frag_destroy(struct inet_frag_queue *q, 115void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f);
91 struct inet_frags *f, int *work);
92int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force);
93struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 116struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
94 struct inet_frags *f, void *key, unsigned int hash) 117 struct inet_frags *f, void *key, unsigned int hash);
95 __releases(&f->lock); 118
96void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, 119void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
97 const char *prefix); 120 const char *prefix);
98 121
99static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) 122static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
100{ 123{
101 if (atomic_dec_and_test(&q->refcnt)) 124 if (atomic_dec_and_test(&q->refcnt))
102 inet_frag_destroy(q, f, NULL); 125 inet_frag_destroy(q, f);
103} 126}
104 127
105/* Memory Tracking Functions. */ 128/* Memory Tracking Functions. */
@@ -131,9 +154,9 @@ static inline void init_frag_mem_limit(struct netns_frags *nf)
131 percpu_counter_init(&nf->mem, 0); 154 percpu_counter_init(&nf->mem, 0);
132} 155}
133 156
134static inline int sum_frag_mem_limit(struct netns_frags *nf) 157static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
135{ 158{
136 int res; 159 unsigned int res;
137 160
138 local_bh_disable(); 161 local_bh_disable();
139 res = percpu_counter_sum_positive(&nf->mem); 162 res = percpu_counter_sum_positive(&nf->mem);
@@ -142,31 +165,6 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf)
142 return res; 165 return res;
143} 166}
144 167
145static inline void inet_frag_lru_move(struct inet_frag_queue *q)
146{
147 spin_lock(&q->net->lru_lock);
148 if (!list_empty(&q->lru_list))
149 list_move_tail(&q->lru_list, &q->net->lru_list);
150 spin_unlock(&q->net->lru_lock);
151}
152
153static inline void inet_frag_lru_del(struct inet_frag_queue *q)
154{
155 spin_lock(&q->net->lru_lock);
156 list_del_init(&q->lru_list);
157 q->net->nqueues--;
158 spin_unlock(&q->net->lru_lock);
159}
160
161static inline void inet_frag_lru_add(struct netns_frags *nf,
162 struct inet_frag_queue *q)
163{
164 spin_lock(&nf->lru_lock);
165 list_add_tail(&q->lru_list, &nf->lru_list);
166 q->net->nqueues++;
167 spin_unlock(&nf->lru_lock);
168}
169
170/* RFC 3168 support : 168/* RFC 3168 support :
171 * We want to check ECN values of all fragments, do detect invalid combinations. 169 * We want to check ECN values of all fragments, do detect invalid combinations.
172 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value. 170 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index b1edf17bec01..a829b77523cf 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -88,8 +88,10 @@ struct inet_request_sock {
88 acked : 1, 88 acked : 1,
89 no_srccheck: 1; 89 no_srccheck: 1;
90 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
91 struct ip_options_rcu *opt; 91 union {
92 struct sk_buff *pktopts; 92 struct ip_options_rcu *opt;
93 struct sk_buff *pktopts;
94 };
93 u32 ir_mark; 95 u32 ir_mark;
94}; 96};
95 97
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 61474ea02152..6c566034e26d 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -108,6 +108,7 @@ struct inet_timewait_sock {
108#define tw_family __tw_common.skc_family 108#define tw_family __tw_common.skc_family
109#define tw_state __tw_common.skc_state 109#define tw_state __tw_common.skc_state
110#define tw_reuse __tw_common.skc_reuse 110#define tw_reuse __tw_common.skc_reuse
111#define tw_ipv6only __tw_common.skc_ipv6only
111#define tw_bound_dev_if __tw_common.skc_bound_dev_if 112#define tw_bound_dev_if __tw_common.skc_bound_dev_if
112#define tw_node __tw_common.skc_nulls_node 113#define tw_node __tw_common.skc_nulls_node
113#define tw_bind_node __tw_common.skc_bind_node 114#define tw_bind_node __tw_common.skc_bind_node
@@ -131,7 +132,7 @@ struct inet_timewait_sock {
131 __be16 tw_sport; 132 __be16 tw_sport;
132 kmemcheck_bitfield_begin(flags); 133 kmemcheck_bitfield_begin(flags);
133 /* And these are ours. */ 134 /* And these are ours. */
134 unsigned int tw_ipv6only : 1, 135 unsigned int tw_pad0 : 1, /* 1 bit hole */
135 tw_transparent : 1, 136 tw_transparent : 1,
136 tw_flowlabel : 20, 137 tw_flowlabel : 20,
137 tw_pad : 2, /* 2 bits hole */ 138 tw_pad : 2, /* 2 bits hole */
diff --git a/include/net/ip.h b/include/net/ip.h
index 0e795df05ec9..db4a771b9ef3 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -31,6 +31,7 @@
31#include <net/route.h> 31#include <net/route.h>
32#include <net/snmp.h> 32#include <net/snmp.h>
33#include <net/flow.h> 33#include <net/flow.h>
34#include <net/flow_keys.h>
34 35
35struct sock; 36struct sock;
36 37
@@ -215,6 +216,12 @@ static inline int inet_is_local_reserved_port(struct net *net, int port)
215 return 0; 216 return 0;
216 return test_bit(port, net->ipv4.sysctl_local_reserved_ports); 217 return test_bit(port, net->ipv4.sysctl_local_reserved_ports);
217} 218}
219
220static inline bool sysctl_dev_name_is_allowed(const char *name)
221{
222 return strcmp(name, "default") != 0 && strcmp(name, "all") != 0;
223}
224
218#else 225#else
219static inline int inet_is_local_reserved_port(struct net *net, int port) 226static inline int inet_is_local_reserved_port(struct net *net, int port)
220{ 227{
@@ -309,16 +316,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
309 } 316 }
310} 317}
311 318
312#define IP_IDENTS_SZ 2048u 319u32 ip_idents_reserve(u32 hash, int segs);
313extern atomic_t *ip_idents;
314
315static inline u32 ip_idents_reserve(u32 hash, int segs)
316{
317 atomic_t *id_ptr = ip_idents + hash % IP_IDENTS_SZ;
318
319 return atomic_add_return(segs, id_ptr) - segs;
320}
321
322void __ip_select_ident(struct iphdr *iph, int segs); 320void __ip_select_ident(struct iphdr *iph, int segs);
323 321
324static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs) 322static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs)
@@ -353,6 +351,19 @@ static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto)
353 skb->len, proto, 0); 351 skb->len, proto, 0);
354} 352}
355 353
354static inline void inet_set_txhash(struct sock *sk)
355{
356 struct inet_sock *inet = inet_sk(sk);
357 struct flow_keys keys;
358
359 keys.src = inet->inet_saddr;
360 keys.dst = inet->inet_daddr;
361 keys.port16[0] = inet->inet_sport;
362 keys.port16[1] = inet->inet_dport;
363
364 sk->sk_txhash = flow_hash_from_keys(&keys);
365}
366
356/* 367/*
357 * Map a multicast IP onto multicast MAC for type ethernet. 368 * Map a multicast IP onto multicast MAC for type ethernet.
358 */ 369 */
@@ -481,7 +492,6 @@ static inline struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
481} 492}
482#endif 493#endif
483int ip_frag_mem(struct net *net); 494int ip_frag_mem(struct net *net);
484int ip_frag_nqueues(struct net *net);
485 495
486/* 496/*
487 * Functions provided by ip_forward.c 497 * Functions provided by ip_forward.c
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index a4daf9eb8562..8dd8cab88b87 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -40,6 +40,7 @@ struct ip_tunnel_prl_entry {
40 40
41struct ip_tunnel_dst { 41struct ip_tunnel_dst {
42 struct dst_entry __rcu *dst; 42 struct dst_entry __rcu *dst;
43 __be32 saddr;
43}; 44};
44 45
45struct ip_tunnel { 46struct ip_tunnel {
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 574337fe72dd..a2db816e8461 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -19,6 +19,7 @@
19#include <net/if_inet6.h> 19#include <net/if_inet6.h>
20#include <net/ndisc.h> 20#include <net/ndisc.h>
21#include <net/flow.h> 21#include <net/flow.h>
22#include <net/flow_keys.h>
22#include <net/snmp.h> 23#include <net/snmp.h>
23 24
24#define SIN6_LEN_RFC2133 24 25#define SIN6_LEN_RFC2133 24
@@ -298,11 +299,6 @@ static inline bool ipv6_accept_ra(struct inet6_dev *idev)
298} 299}
299 300
300#if IS_ENABLED(CONFIG_IPV6) 301#if IS_ENABLED(CONFIG_IPV6)
301static inline int ip6_frag_nqueues(struct net *net)
302{
303 return net->ipv6.frags.nqueues;
304}
305
306static inline int ip6_frag_mem(struct net *net) 302static inline int ip6_frag_mem(struct net *net)
307{ 303{
308 return sum_frag_mem_limit(&net->ipv6.frags); 304 return sum_frag_mem_limit(&net->ipv6.frags);
@@ -495,8 +491,8 @@ struct ip6_create_arg {
495 u8 ecn; 491 u8 ecn;
496}; 492};
497 493
498void ip6_frag_init(struct inet_frag_queue *q, void *a); 494void ip6_frag_init(struct inet_frag_queue *q, const void *a);
499bool ip6_frag_match(struct inet_frag_queue *q, void *a); 495bool ip6_frag_match(const struct inet_frag_queue *q, const void *a);
500 496
501/* 497/*
502 * Equivalent of ipv4 struct ip 498 * Equivalent of ipv4 struct ip
@@ -557,24 +553,29 @@ static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval)
557static inline bool ipv6_addr_loopback(const struct in6_addr *a) 553static inline bool ipv6_addr_loopback(const struct in6_addr *a)
558{ 554{
559#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 555#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
560 const unsigned long *ul = (const unsigned long *)a; 556 const __be64 *be = (const __be64 *)a;
561 557
562 return (ul[0] | (ul[1] ^ cpu_to_be64(1))) == 0UL; 558 return (be[0] | (be[1] ^ cpu_to_be64(1))) == 0UL;
563#else 559#else
564 return (a->s6_addr32[0] | a->s6_addr32[1] | 560 return (a->s6_addr32[0] | a->s6_addr32[1] |
565 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; 561 a->s6_addr32[2] | (a->s6_addr32[3] ^ cpu_to_be32(1))) == 0;
566#endif 562#endif
567} 563}
568 564
565/*
566 * Note that we must __force cast these to unsigned long to make sparse happy,
567 * since all of the endian-annotated types are fixed size regardless of arch.
568 */
569static inline bool ipv6_addr_v4mapped(const struct in6_addr *a) 569static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
570{ 570{
571 return ( 571 return (
572#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 572#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
573 *(__be64 *)a | 573 *(unsigned long *)a |
574#else 574#else
575 (a->s6_addr32[0] | a->s6_addr32[1]) | 575 (__force unsigned long)(a->s6_addr32[0] | a->s6_addr32[1]) |
576#endif 576#endif
577 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0UL; 577 (__force unsigned long)(a->s6_addr32[2] ^
578 cpu_to_be32(0x0000ffff))) == 0UL;
578} 579}
579 580
580/* 581/*
@@ -684,6 +685,50 @@ static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
684 return hlimit; 685 return hlimit;
685} 686}
686 687
688#if IS_ENABLED(CONFIG_IPV6)
689static inline void ip6_set_txhash(struct sock *sk)
690{
691 struct inet_sock *inet = inet_sk(sk);
692 struct ipv6_pinfo *np = inet6_sk(sk);
693 struct flow_keys keys;
694
695 keys.src = (__force __be32)ipv6_addr_hash(&np->saddr);
696 keys.dst = (__force __be32)ipv6_addr_hash(&sk->sk_v6_daddr);
697 keys.port16[0] = inet->inet_sport;
698 keys.port16[1] = inet->inet_dport;
699
700 sk->sk_txhash = flow_hash_from_keys(&keys);
701}
702
703static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
704 __be32 flowlabel, bool autolabel)
705{
706 if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
707 __be32 hash;
708
709 hash = skb_get_hash(skb);
710
711 /* Since this is being sent on the wire obfuscate hash a bit
712 * to minimize possbility that any useful information to an
713 * attacker is leaked. Only lower 20 bits are relevant.
714 */
715 hash ^= hash >> 12;
716
717 flowlabel = hash & IPV6_FLOWLABEL_MASK;
718 }
719
720 return flowlabel;
721}
722#else
723static inline void ip6_set_txhash(struct sock *sk) { }
724static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
725 __be32 flowlabel, bool autolabel)
726{
727 return flowlabel;
728}
729#endif
730
731
687/* 732/*
688 * Header manipulation 733 * Header manipulation
689 */ 734 */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 421b6ecb4b2c..dae2e24616e1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -754,20 +754,25 @@ struct ieee80211_tx_info {
754}; 754};
755 755
756/** 756/**
757 * struct ieee80211_sched_scan_ies - scheduled scan IEs 757 * struct ieee80211_scan_ies - descriptors for different blocks of IEs
758 * 758 *
759 * This structure is used to pass the appropriate IEs to be used in scheduled 759 * This structure is used to point to different blocks of IEs in HW scan
760 * scans for all bands. It contains both the IEs passed from the userspace 760 * and scheduled scan. These blocks contain the IEs passed by userspace
761 * and the ones generated by mac80211. 761 * and the ones generated by mac80211.
762 * 762 *
763 * @ie: array with the IEs for each supported band 763 * @ies: pointers to band specific IEs.
764 * @len: array with the total length of the IEs for each band 764 * @len: lengths of band_specific IEs.
765 * @common_ies: IEs for all bands (especially vendor specific ones)
766 * @common_ie_len: length of the common_ies
765 */ 767 */
766struct ieee80211_sched_scan_ies { 768struct ieee80211_scan_ies {
767 u8 *ie[IEEE80211_NUM_BANDS]; 769 const u8 *ies[IEEE80211_NUM_BANDS];
768 size_t len[IEEE80211_NUM_BANDS]; 770 size_t len[IEEE80211_NUM_BANDS];
771 const u8 *common_ies;
772 size_t common_ie_len;
769}; 773};
770 774
775
771static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) 776static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
772{ 777{
773 return (struct ieee80211_tx_info *)skb->cb; 778 return (struct ieee80211_tx_info *)skb->cb;
@@ -1601,11 +1606,8 @@ struct ieee80211_tx_control {
1601 * is not enabled the default action is to disconnect when getting the 1606 * is not enabled the default action is to disconnect when getting the
1602 * CSA frame. 1607 * CSA frame.
1603 * 1608 *
1604 * @IEEE80211_HW_CHANGE_RUNNING_CHANCTX: The hardware can change a 1609 * @IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
1605 * channel context on-the-fly. This is needed for channel switch 1610 * in one command, mac80211 doesn't have to run separate scans per band.
1606 * on single-channel hardware. It can also be used as an
1607 * optimization in certain channel switch cases with
1608 * multi-channel.
1609 */ 1611 */
1610enum ieee80211_hw_flags { 1612enum ieee80211_hw_flags {
1611 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1613 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1637,7 +1639,8 @@ enum ieee80211_hw_flags {
1637 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1639 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1638 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1640 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1639 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, 1641 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1640 IEEE80211_HW_CHANGE_RUNNING_CHANCTX = 1<<29, 1642 /* bit 29 unused */
1643 IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS = 1<<30,
1641}; 1644};
1642 1645
1643/** 1646/**
@@ -1764,6 +1767,19 @@ struct ieee80211_hw {
1764}; 1767};
1765 1768
1766/** 1769/**
1770 * struct ieee80211_scan_request - hw scan request
1771 *
1772 * @ies: pointers different parts of IEs (in req.ie)
1773 * @req: cfg80211 request.
1774 */
1775struct ieee80211_scan_request {
1776 struct ieee80211_scan_ies ies;
1777
1778 /* Keep last */
1779 struct cfg80211_scan_request req;
1780};
1781
1782/**
1767 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy 1783 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
1768 * 1784 *
1769 * @wiphy: the &struct wiphy which we want to query 1785 * @wiphy: the &struct wiphy which we want to query
@@ -2764,6 +2780,15 @@ enum ieee80211_roc_type {
2764 * mac80211 will transmit the frame right away. 2780 * mac80211 will transmit the frame right away.
2765 * The callback is optional and can (should!) sleep. 2781 * The callback is optional and can (should!) sleep.
2766 * 2782 *
2783 * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
2784 * a TDLS discovery-request, we expect a reply to arrive on the AP's
2785 * channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
2786 * setup-response is a direct packet not buffered by the AP.
2787 * mac80211 will call this function just before the transmission of a TDLS
2788 * discovery-request. The recommended period of protection is at least
2789 * 2 * (DTIM period).
2790 * The callback is optional and can sleep.
2791 *
2767 * @add_chanctx: Notifies device driver about new channel context creation. 2792 * @add_chanctx: Notifies device driver about new channel context creation.
2768 * @remove_chanctx: Notifies device driver about channel context destruction. 2793 * @remove_chanctx: Notifies device driver about channel context destruction.
2769 * @change_chanctx: Notifies device driver about channel context changes that 2794 * @change_chanctx: Notifies device driver about channel context changes that
@@ -2865,13 +2890,13 @@ struct ieee80211_ops {
2865 void (*set_default_unicast_key)(struct ieee80211_hw *hw, 2890 void (*set_default_unicast_key)(struct ieee80211_hw *hw,
2866 struct ieee80211_vif *vif, int idx); 2891 struct ieee80211_vif *vif, int idx);
2867 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2892 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2868 struct cfg80211_scan_request *req); 2893 struct ieee80211_scan_request *req);
2869 void (*cancel_hw_scan)(struct ieee80211_hw *hw, 2894 void (*cancel_hw_scan)(struct ieee80211_hw *hw,
2870 struct ieee80211_vif *vif); 2895 struct ieee80211_vif *vif);
2871 int (*sched_scan_start)(struct ieee80211_hw *hw, 2896 int (*sched_scan_start)(struct ieee80211_hw *hw,
2872 struct ieee80211_vif *vif, 2897 struct ieee80211_vif *vif,
2873 struct cfg80211_sched_scan_request *req, 2898 struct cfg80211_sched_scan_request *req,
2874 struct ieee80211_sched_scan_ies *ies); 2899 struct ieee80211_scan_ies *ies);
2875 int (*sched_scan_stop)(struct ieee80211_hw *hw, 2900 int (*sched_scan_stop)(struct ieee80211_hw *hw,
2876 struct ieee80211_vif *vif); 2901 struct ieee80211_vif *vif);
2877 void (*sw_scan_start)(struct ieee80211_hw *hw); 2902 void (*sw_scan_start)(struct ieee80211_hw *hw);
@@ -2981,6 +3006,9 @@ struct ieee80211_ops {
2981 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 3006 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2982 struct ieee80211_vif *vif); 3007 struct ieee80211_vif *vif);
2983 3008
3009 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
3010 struct ieee80211_vif *vif);
3011
2984 int (*add_chanctx)(struct ieee80211_hw *hw, 3012 int (*add_chanctx)(struct ieee80211_hw *hw,
2985 struct ieee80211_chanctx_conf *ctx); 3013 struct ieee80211_chanctx_conf *ctx);
2986 void (*remove_chanctx)(struct ieee80211_hw *hw, 3014 void (*remove_chanctx)(struct ieee80211_hw *hw,
@@ -4524,6 +4552,40 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
4524 */ 4552 */
4525void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn); 4553void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
4526 4554
4555/**
4556 * ieee80211_start_rx_ba_session_offl - start a Rx BA session
4557 *
4558 * Some device drivers may offload part of the Rx aggregation flow including
4559 * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
4560 * reordering.
4561 *
4562 * Create structures responsible for reordering so device drivers may call here
4563 * when they complete AddBa negotiation.
4564 *
4565 * @vif: &struct ieee80211_vif pointer from the add_interface callback
4566 * @addr: station mac address
4567 * @tid: the rx tid
4568 */
4569void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
4570 const u8 *addr, u16 tid);
4571
4572/**
4573 * ieee80211_stop_rx_ba_session_offl - stop a Rx BA session
4574 *
4575 * Some device drivers may offload part of the Rx aggregation flow including
4576 * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
4577 * reordering.
4578 *
4579 * Destroy structures responsible for reordering so device drivers may call here
4580 * when they complete DelBa negotiation.
4581 *
4582 * @vif: &struct ieee80211_vif pointer from the add_interface callback
4583 * @addr: station mac address
4584 * @tid: the rx tid
4585 */
4586void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
4587 const u8 *addr, u16 tid);
4588
4527/* Rate control API */ 4589/* Rate control API */
4528 4590
4529/** 4591/**
@@ -4815,4 +4877,17 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
4815 */ 4877 */
4816void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf); 4878void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
4817 4879
4880/**
4881 * ieee80211_tdls_oper - request userspace to perform a TDLS operation
4882 * @vif: virtual interface
4883 * @peer: the peer's destination address
4884 * @oper: the requested TDLS operation
4885 * @reason_code: reason code for the operation, valid for TDLS teardown
4886 * @gfp: allocation flags
4887 *
4888 * See cfg80211_tdls_oper_request().
4889 */
4890void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
4891 enum nl80211_tdls_operation oper,
4892 u16 reason_code, gfp_t gfp);
4818#endif /* MAC80211_H */ 4893#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index a591053cae63..2e67cdd19cdc 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -80,6 +80,25 @@ struct ieee802154_dev {
80#define IEEE802154_HW_OMIT_CKSUM 0x00000001 80#define IEEE802154_HW_OMIT_CKSUM 0x00000001
81/* Indicates that receiver will autorespond with ACK frames. */ 81/* Indicates that receiver will autorespond with ACK frames. */
82#define IEEE802154_HW_AACK 0x00000002 82#define IEEE802154_HW_AACK 0x00000002
83/* Indicates that transceiver will support transmit power setting. */
84#define IEEE802154_HW_TXPOWER 0x00000004
85/* Indicates that transceiver will support listen before transmit. */
86#define IEEE802154_HW_LBT 0x00000008
87/* Indicates that transceiver will support cca mode setting. */
88#define IEEE802154_HW_CCA_MODE 0x00000010
89/* Indicates that transceiver will support cca ed level setting. */
90#define IEEE802154_HW_CCA_ED_LEVEL 0x00000020
91/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
92 * settings. */
93#define IEEE802154_HW_CSMA_PARAMS 0x00000040
94/* Indicates that transceiver will support ARET frame retries setting. */
95#define IEEE802154_HW_FRAME_RETRIES 0x00000080
96
97/* This groups the most common CSMA support fields into one. */
98#define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \
99 IEEE802154_HW_CCA_ED_LEVEL | \
100 IEEE802154_HW_CSMA_PARAMS | \
101 IEEE802154_HW_FRAME_RETRIES)
83 102
84/* struct ieee802154_ops - callbacks from mac802154 to the driver 103/* struct ieee802154_ops - callbacks from mac802154 to the driver
85 * 104 *
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 0e3d08e4b1d3..57c880378443 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -18,7 +18,6 @@ struct nf_conntrack_ecache {
18 u16 ctmask; /* bitmask of ct events to be delivered */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */ 19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 portid; /* netlink portid of destroyer */ 20 u32 portid; /* netlink portid of destroyer */
21 struct timer_list timeout;
22}; 21};
23 22
24static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
@@ -216,8 +215,23 @@ void nf_conntrack_ecache_pernet_fini(struct net *net);
216 215
217int nf_conntrack_ecache_init(void); 216int nf_conntrack_ecache_init(void);
218void nf_conntrack_ecache_fini(void); 217void nf_conntrack_ecache_fini(void);
219#else /* CONFIG_NF_CONNTRACK_EVENTS */
220 218
219static inline void nf_conntrack_ecache_delayed_work(struct net *net)
220{
221 if (!delayed_work_pending(&net->ct.ecache_dwork)) {
222 schedule_delayed_work(&net->ct.ecache_dwork, HZ);
223 net->ct.ecache_dwork_pending = true;
224 }
225}
226
227static inline void nf_conntrack_ecache_work(struct net *net)
228{
229 if (net->ct.ecache_dwork_pending) {
230 net->ct.ecache_dwork_pending = false;
231 mod_delayed_work(system_wq, &net->ct.ecache_dwork, 0);
232 }
233}
234#else /* CONFIG_NF_CONNTRACK_EVENTS */
221static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 235static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
222 struct nf_conn *ct) {} 236 struct nf_conn *ct) {}
223static inline int nf_conntrack_eventmask_report(unsigned int eventmask, 237static inline int nf_conntrack_eventmask_report(unsigned int eventmask,
@@ -255,6 +269,14 @@ static inline int nf_conntrack_ecache_init(void)
255static inline void nf_conntrack_ecache_fini(void) 269static inline void nf_conntrack_ecache_fini(void)
256{ 270{
257} 271}
272
273static inline void nf_conntrack_ecache_delayed_work(struct net *net)
274{
275}
276
277static inline void nf_conntrack_ecache_work(struct net *net)
278{
279}
258#endif /* CONFIG_NF_CONNTRACK_EVENTS */ 280#endif /* CONFIG_NF_CONNTRACK_EVENTS */
259 281
260#endif /*_NF_CONNTRACK_ECACHE_H*/ 282#endif /*_NF_CONNTRACK_ECACHE_H*/
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 99eac12d040b..534e1f2ac4fc 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -12,8 +12,11 @@
12#define NF_LOG_UID 0x08 /* Log UID owning local socket */ 12#define NF_LOG_UID 0x08 /* Log UID owning local socket */
13#define NF_LOG_MASK 0x0f 13#define NF_LOG_MASK 0x0f
14 14
15#define NF_LOG_TYPE_LOG 0x01 15enum nf_log_type {
16#define NF_LOG_TYPE_ULOG 0x02 16 NF_LOG_TYPE_LOG = 0,
17 NF_LOG_TYPE_ULOG,
18 NF_LOG_TYPE_MAX
19};
17 20
18struct nf_loginfo { 21struct nf_loginfo {
19 u_int8_t type; 22 u_int8_t type;
@@ -40,10 +43,10 @@ typedef void nf_logfn(struct net *net,
40 const char *prefix); 43 const char *prefix);
41 44
42struct nf_logger { 45struct nf_logger {
43 struct module *me; 46 char *name;
44 nf_logfn *logfn; 47 enum nf_log_type type;
45 char *name; 48 nf_logfn *logfn;
46 struct list_head list[NFPROTO_NUMPROTO]; 49 struct module *me;
47}; 50};
48 51
49/* Function to register/unregister log function. */ 52/* Function to register/unregister log function. */
@@ -58,6 +61,13 @@ int nf_log_bind_pf(struct net *net, u_int8_t pf,
58 const struct nf_logger *logger); 61 const struct nf_logger *logger);
59void nf_log_unbind_pf(struct net *net, u_int8_t pf); 62void nf_log_unbind_pf(struct net *net, u_int8_t pf);
60 63
64int nf_logger_find_get(int pf, enum nf_log_type type);
65void nf_logger_put(int pf, enum nf_log_type type);
66void nf_logger_request_module(int pf, enum nf_log_type type);
67
68#define MODULE_ALIAS_NF_LOGGER(family, type) \
69 MODULE_ALIAS("nf-logger-" __stringify(family) "-" __stringify(type))
70
61/* Calls the registered backend logging function */ 71/* Calls the registered backend logging function */
62__printf(8, 9) 72__printf(8, 9)
63void nf_log_packet(struct net *net, 73void nf_log_packet(struct net *net,
@@ -69,4 +79,24 @@ void nf_log_packet(struct net *net,
69 const struct nf_loginfo *li, 79 const struct nf_loginfo *li,
70 const char *fmt, ...); 80 const char *fmt, ...);
71 81
82struct nf_log_buf;
83
84struct nf_log_buf *nf_log_buf_open(void);
85__printf(2, 3) int nf_log_buf_add(struct nf_log_buf *m, const char *f, ...);
86void nf_log_buf_close(struct nf_log_buf *m);
87
88/* common logging functions */
89int nf_log_dump_udp_header(struct nf_log_buf *m, const struct sk_buff *skb,
90 u8 proto, int fragment, unsigned int offset);
91int nf_log_dump_tcp_header(struct nf_log_buf *m, const struct sk_buff *skb,
92 u8 proto, int fragment, unsigned int offset,
93 unsigned int logflags);
94void nf_log_dump_sk_uid_gid(struct nf_log_buf *m, struct sock *sk);
95void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf,
96 unsigned int hooknum, const struct sk_buff *skb,
97 const struct net_device *in,
98 const struct net_device *out,
99 const struct nf_loginfo *loginfo,
100 const char *prefix);
101
72#endif /* _NF_LOG_H */ 102#endif /* _NF_LOG_H */
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 713b0b88bd5a..c4d86198d3d6 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -6,6 +6,7 @@
6#include <linux/netfilter/nfnetlink.h> 6#include <linux/netfilter/nfnetlink.h>
7#include <linux/netfilter/x_tables.h> 7#include <linux/netfilter/x_tables.h>
8#include <linux/netfilter/nf_tables.h> 8#include <linux/netfilter/nf_tables.h>
9#include <linux/u64_stats_sync.h>
9#include <net/netlink.h> 10#include <net/netlink.h>
10 11
11#define NFT_JUMP_STACK_SIZE 16 12#define NFT_JUMP_STACK_SIZE 16
@@ -528,8 +529,9 @@ enum nft_chain_type {
528}; 529};
529 530
530struct nft_stats { 531struct nft_stats {
531 u64 bytes; 532 u64 bytes;
532 u64 pkts; 533 u64 pkts;
534 struct u64_stats_sync syncp;
533}; 535};
534 536
535#define NFT_HOOK_OPS_MAX 2 537#define NFT_HOOK_OPS_MAX 2
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h
deleted file mode 100644
index 9d9756cca013..000000000000
--- a/include/net/netfilter/xt_log.h
+++ /dev/null
@@ -1,54 +0,0 @@
1#define S_SIZE (1024 - (sizeof(unsigned int) + 1))
2
3struct sbuff {
4 unsigned int count;
5 char buf[S_SIZE + 1];
6};
7static struct sbuff emergency, *emergency_ptr = &emergency;
8
9static __printf(2, 3) int sb_add(struct sbuff *m, const char *f, ...)
10{
11 va_list args;
12 int len;
13
14 if (likely(m->count < S_SIZE)) {
15 va_start(args, f);
16 len = vsnprintf(m->buf + m->count, S_SIZE - m->count, f, args);
17 va_end(args);
18 if (likely(m->count + len < S_SIZE)) {
19 m->count += len;
20 return 0;
21 }
22 }
23 m->count = S_SIZE;
24 printk_once(KERN_ERR KBUILD_MODNAME " please increase S_SIZE\n");
25 return -1;
26}
27
28static struct sbuff *sb_open(void)
29{
30 struct sbuff *m = kmalloc(sizeof(*m), GFP_ATOMIC);
31
32 if (unlikely(!m)) {
33 local_bh_disable();
34 do {
35 m = xchg(&emergency_ptr, NULL);
36 } while (!m);
37 }
38 m->count = 0;
39 return m;
40}
41
42static void sb_close(struct sbuff *m)
43{
44 m->buf[m->count] = 0;
45 printk("%s\n", m->buf);
46
47 if (likely(m != &emergency))
48 kfree(m);
49 else {
50 emergency_ptr = m;
51 local_bh_enable();
52 }
53}
54
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 4fe018c48ed9..7b5a300de7f5 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -139,7 +139,7 @@ struct netlbl_lsm_cache {
139}; 139};
140 140
141/** 141/**
142 * struct netlbl_lsm_secattr_catmap - NetLabel LSM secattr category bitmap 142 * struct netlbl_lsm_catmap - NetLabel LSM secattr category bitmap
143 * @startbit: the value of the lowest order bit in the bitmap 143 * @startbit: the value of the lowest order bit in the bitmap
144 * @bitmap: the category bitmap 144 * @bitmap: the category bitmap
145 * @next: pointer to the next bitmap "node" or NULL 145 * @next: pointer to the next bitmap "node" or NULL
@@ -162,10 +162,10 @@ struct netlbl_lsm_cache {
162#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \ 162#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \
163 NETLBL_CATMAP_MAPCNT) 163 NETLBL_CATMAP_MAPCNT)
164#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01 164#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01
165struct netlbl_lsm_secattr_catmap { 165struct netlbl_lsm_catmap {
166 u32 startbit; 166 u32 startbit;
167 NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT]; 167 NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT];
168 struct netlbl_lsm_secattr_catmap *next; 168 struct netlbl_lsm_catmap *next;
169}; 169};
170 170
171/** 171/**
@@ -209,7 +209,7 @@ struct netlbl_lsm_secattr {
209 struct netlbl_lsm_cache *cache; 209 struct netlbl_lsm_cache *cache;
210 struct { 210 struct {
211 struct { 211 struct {
212 struct netlbl_lsm_secattr_catmap *cat; 212 struct netlbl_lsm_catmap *cat;
213 u32 lvl; 213 u32 lvl;
214 } mls; 214 } mls;
215 u32 secid; 215 u32 secid;
@@ -258,7 +258,7 @@ static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
258} 258}
259 259
260/** 260/**
261 * netlbl_secattr_catmap_alloc - Allocate a LSM secattr catmap 261 * netlbl_catmap_alloc - Allocate a LSM secattr catmap
262 * @flags: memory allocation flags 262 * @flags: memory allocation flags
263 * 263 *
264 * Description: 264 * Description:
@@ -266,30 +266,28 @@ static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
266 * on failure. 266 * on failure.
267 * 267 *
268 */ 268 */
269static inline struct netlbl_lsm_secattr_catmap *netlbl_secattr_catmap_alloc( 269static inline struct netlbl_lsm_catmap *netlbl_catmap_alloc(gfp_t flags)
270 gfp_t flags)
271{ 270{
272 return kzalloc(sizeof(struct netlbl_lsm_secattr_catmap), flags); 271 return kzalloc(sizeof(struct netlbl_lsm_catmap), flags);
273} 272}
274 273
275/** 274/**
276 * netlbl_secattr_catmap_free - Free a LSM secattr catmap 275 * netlbl_catmap_free - Free a LSM secattr catmap
277 * @catmap: the category bitmap 276 * @catmap: the category bitmap
278 * 277 *
279 * Description: 278 * Description:
280 * Free a LSM secattr catmap. 279 * Free a LSM secattr catmap.
281 * 280 *
282 */ 281 */
283static inline void netlbl_secattr_catmap_free( 282static inline void netlbl_catmap_free(struct netlbl_lsm_catmap *catmap)
284 struct netlbl_lsm_secattr_catmap *catmap)
285{ 283{
286 struct netlbl_lsm_secattr_catmap *iter; 284 struct netlbl_lsm_catmap *iter;
287 285
288 do { 286 while (catmap) {
289 iter = catmap; 287 iter = catmap;
290 catmap = catmap->next; 288 catmap = catmap->next;
291 kfree(iter); 289 kfree(iter);
292 } while (catmap); 290 }
293} 291}
294 292
295/** 293/**
@@ -321,7 +319,7 @@ static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
321 if (secattr->flags & NETLBL_SECATTR_CACHE) 319 if (secattr->flags & NETLBL_SECATTR_CACHE)
322 netlbl_secattr_cache_free(secattr->cache); 320 netlbl_secattr_cache_free(secattr->cache);
323 if (secattr->flags & NETLBL_SECATTR_MLS_CAT) 321 if (secattr->flags & NETLBL_SECATTR_MLS_CAT)
324 netlbl_secattr_catmap_free(secattr->attr.mls.cat); 322 netlbl_catmap_free(secattr->attr.mls.cat);
325} 323}
326 324
327/** 325/**
@@ -390,17 +388,22 @@ int netlbl_cfg_cipsov4_map_add(u32 doi,
390/* 388/*
391 * LSM security attribute operations 389 * LSM security attribute operations
392 */ 390 */
393int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap, 391int netlbl_catmap_walk(struct netlbl_lsm_catmap *catmap, u32 offset);
394 u32 offset); 392int netlbl_catmap_walkrng(struct netlbl_lsm_catmap *catmap, u32 offset);
395int netlbl_secattr_catmap_walk_rng(struct netlbl_lsm_secattr_catmap *catmap, 393int netlbl_catmap_getlong(struct netlbl_lsm_catmap *catmap,
396 u32 offset); 394 u32 *offset,
397int netlbl_secattr_catmap_setbit(struct netlbl_lsm_secattr_catmap *catmap, 395 unsigned long *bitmap);
398 u32 bit, 396int netlbl_catmap_setbit(struct netlbl_lsm_catmap **catmap,
399 gfp_t flags); 397 u32 bit,
400int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap, 398 gfp_t flags);
401 u32 start, 399int netlbl_catmap_setrng(struct netlbl_lsm_catmap **catmap,
402 u32 end, 400 u32 start,
403 gfp_t flags); 401 u32 end,
402 gfp_t flags);
403int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
404 u32 offset,
405 unsigned long bitmap,
406 gfp_t flags);
404 407
405/* 408/*
406 * LSM protocol operations (NetLabel LSM/kernel API) 409 * LSM protocol operations (NetLabel LSM/kernel API)
@@ -492,30 +495,39 @@ static inline int netlbl_cfg_cipsov4_map_add(u32 doi,
492{ 495{
493 return -ENOSYS; 496 return -ENOSYS;
494} 497}
495static inline int netlbl_secattr_catmap_walk( 498static inline int netlbl_catmap_walk(struct netlbl_lsm_catmap *catmap,
496 struct netlbl_lsm_secattr_catmap *catmap, 499 u32 offset)
497 u32 offset)
498{ 500{
499 return -ENOENT; 501 return -ENOENT;
500} 502}
501static inline int netlbl_secattr_catmap_walk_rng( 503static inline int netlbl_catmap_walkrng(struct netlbl_lsm_catmap *catmap,
502 struct netlbl_lsm_secattr_catmap *catmap, 504 u32 offset)
503 u32 offset)
504{ 505{
505 return -ENOENT; 506 return -ENOENT;
506} 507}
507static inline int netlbl_secattr_catmap_setbit( 508static inline int netlbl_catmap_getlong(struct netlbl_lsm_catmap *catmap,
508 struct netlbl_lsm_secattr_catmap *catmap, 509 u32 *offset,
509 u32 bit, 510 unsigned long *bitmap)
510 gfp_t flags)
511{ 511{
512 return 0; 512 return 0;
513} 513}
514static inline int netlbl_secattr_catmap_setrng( 514static inline int netlbl_catmap_setbit(struct netlbl_lsm_catmap **catmap,
515 struct netlbl_lsm_secattr_catmap *catmap, 515 u32 bit,
516 u32 start, 516 gfp_t flags)
517 u32 end, 517{
518 gfp_t flags) 518 return 0;
519}
520static inline int netlbl_catmap_setrng(struct netlbl_lsm_catmap **catmap,
521 u32 start,
522 u32 end,
523 gfp_t flags)
524{
525 return 0;
526}
527static inline int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
528 u32 offset,
529 unsigned long bitmap,
530 gfp_t flags)
519{ 531{
520 return 0; 532 return 0;
521} 533}
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 2b47eaadba8f..6c1076275aaa 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -949,12 +949,12 @@ static inline int nla_put_flag(struct sk_buff *skb, int attrtype)
949 * nla_put_msecs - Add a msecs netlink attribute to a socket buffer 949 * nla_put_msecs - Add a msecs netlink attribute to a socket buffer
950 * @skb: socket buffer to add attribute to 950 * @skb: socket buffer to add attribute to
951 * @attrtype: attribute type 951 * @attrtype: attribute type
952 * @jiffies: number of msecs in jiffies 952 * @njiffies: number of jiffies to convert to msecs
953 */ 953 */
954static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, 954static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
955 unsigned long jiffies) 955 unsigned long njiffies)
956{ 956{
957 u64 tmp = jiffies_to_msecs(jiffies); 957 u64 tmp = jiffies_to_msecs(njiffies);
958 return nla_put(skb, attrtype, sizeof(u64), &tmp); 958 return nla_put(skb, attrtype, sizeof(u64), &tmp);
959} 959}
960 960
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 773cce308bc6..29d6a94db54d 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/list_nulls.h> 5#include <linux/list_nulls.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/workqueue.h>
7#include <linux/netfilter/nf_conntrack_tcp.h> 8#include <linux/netfilter/nf_conntrack_tcp.h>
8#include <linux/seqlock.h> 9#include <linux/seqlock.h>
9 10
@@ -73,6 +74,10 @@ struct ct_pcpu {
73struct netns_ct { 74struct netns_ct {
74 atomic_t count; 75 atomic_t count;
75 unsigned int expect_count; 76 unsigned int expect_count;
77#ifdef CONFIG_NF_CONNTRACK_EVENTS
78 struct delayed_work ecache_dwork;
79 bool ecache_dwork_pending;
80#endif
76#ifdef CONFIG_SYSCTL 81#ifdef CONFIG_SYSCTL
77 struct ctl_table_header *sysctl_header; 82 struct ctl_table_header *sysctl_header;
78 struct ctl_table_header *acct_sysctl_header; 83 struct ctl_table_header *acct_sysctl_header;
@@ -82,7 +87,6 @@ struct netns_ct {
82#endif 87#endif
83 char *slabname; 88 char *slabname;
84 unsigned int sysctl_log_invalid; /* Log invalid packets */ 89 unsigned int sysctl_log_invalid; /* Log invalid packets */
85 unsigned int sysctl_events_retry_timeout;
86 int sysctl_events; 90 int sysctl_events;
87 int sysctl_acct; 91 int sysctl_acct;
88 int sysctl_auto_assign_helper; 92 int sysctl_auto_assign_helper;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 19d3446e59d2..eade27adecf3 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -28,6 +28,7 @@ struct netns_sysctl_ipv6 {
28 int ip6_rt_mtu_expires; 28 int ip6_rt_mtu_expires;
29 int ip6_rt_min_advmss; 29 int ip6_rt_min_advmss;
30 int flowlabel_consistency; 30 int flowlabel_consistency;
31 int auto_flowlabels;
31 int icmpv6_time; 32 int icmpv6_time;
32 int anycast_src_echo_reply; 33 int anycast_src_echo_reply;
33 int fwmark_reflect; 34 int fwmark_reflect;
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
index 26a394cb91a8..eee608b12cc9 100644
--- a/include/net/netns/nftables.h
+++ b/include/net/netns/nftables.h
@@ -13,8 +13,8 @@ struct netns_nftables {
13 struct nft_af_info *inet; 13 struct nft_af_info *inet;
14 struct nft_af_info *arp; 14 struct nft_af_info *arp;
15 struct nft_af_info *bridge; 15 struct nft_af_info *bridge;
16 unsigned int base_seq;
16 u8 gencursor; 17 u8 gencursor;
17 u8 genctr;
18}; 18};
19 19
20#endif 20#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 02fe40f8c8fd..c24060ee411e 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -15,11 +15,5 @@ struct netns_xt {
15 struct ebt_table *frame_filter; 15 struct ebt_table *frame_filter;
16 struct ebt_table *frame_nat; 16 struct ebt_table *frame_nat;
17#endif 17#endif
18#if IS_ENABLED(CONFIG_IP_NF_TARGET_ULOG)
19 bool ulog_warn_deprecated;
20#endif
21#if IS_ENABLED(CONFIG_BRIDGE_EBT_ULOG)
22 bool ebt_ulog_warn_deprecated;
23#endif
24}; 18};
25#endif 19#endif
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index bdf55c3b7a19..d9a5cf7ac1c4 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -49,6 +49,7 @@ enum {
49 NFC_DIGITAL_FRAMING_NFCA_SHORT = 0, 49 NFC_DIGITAL_FRAMING_NFCA_SHORT = 0,
50 NFC_DIGITAL_FRAMING_NFCA_STANDARD, 50 NFC_DIGITAL_FRAMING_NFCA_STANDARD,
51 NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A, 51 NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A,
52 NFC_DIGITAL_FRAMING_NFCA_ANTICOL_COMPLETE,
52 53
53 NFC_DIGITAL_FRAMING_NFCA_T1T, 54 NFC_DIGITAL_FRAMING_NFCA_T1T,
54 NFC_DIGITAL_FRAMING_NFCA_T2T, 55 NFC_DIGITAL_FRAMING_NFCA_T2T,
@@ -126,6 +127,15 @@ typedef void (*nfc_digital_cmd_complete_t)(struct nfc_digital_dev *ddev,
126 * the NFC-DEP ATR_REQ command through cb. The digital stack deducts the RF 127 * the NFC-DEP ATR_REQ command through cb. The digital stack deducts the RF
127 * tech by analyzing the SoD of the frame containing the ATR_REQ command. 128 * tech by analyzing the SoD of the frame containing the ATR_REQ command.
128 * This is an asynchronous function. 129 * This is an asynchronous function.
130 * @tg_listen_md: If supported, put the device in automatic listen mode with
131 * mode detection but without automatic anti-collision. In this mode, the
132 * device automatically detects the RF technology. What the actual
133 * RF technology is can be retrieved by calling @tg_get_rf_tech.
134 * The digital stack will then perform the appropriate anti-collision
135 * sequence. This is an asynchronous function.
136 * @tg_get_rf_tech: Required when @tg_listen_md is supported, unused otherwise.
137 * Return the RF Technology that was detected by the @tg_listen_md call.
138 * This is a synchronous function.
129 * 139 *
130 * @switch_rf: Turns device radio on or off. The stack does not call explicitly 140 * @switch_rf: Turns device radio on or off. The stack does not call explicitly
131 * switch_rf to turn the radio on. A call to in|tg_configure_hw must turn 141 * switch_rf to turn the radio on. A call to in|tg_configure_hw must turn
@@ -160,6 +170,9 @@ struct nfc_digital_ops {
160 struct digital_tg_mdaa_params *mdaa_params, 170 struct digital_tg_mdaa_params *mdaa_params,
161 u16 timeout, nfc_digital_cmd_complete_t cb, 171 u16 timeout, nfc_digital_cmd_complete_t cb,
162 void *arg); 172 void *arg);
173 int (*tg_listen_md)(struct nfc_digital_dev *ddev, u16 timeout,
174 nfc_digital_cmd_complete_t cb, void *arg);
175 int (*tg_get_rf_tech)(struct nfc_digital_dev *ddev, u8 *rf_tech);
163 176
164 int (*switch_rf)(struct nfc_digital_dev *ddev, bool on); 177 int (*switch_rf)(struct nfc_digital_dev *ddev, bool on);
165 void (*abort_cmd)(struct nfc_digital_dev *ddev); 178 void (*abort_cmd)(struct nfc_digital_dev *ddev);
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 61286db54388..7ee8f4cc610b 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -37,6 +37,7 @@ struct nfc_hci_ops {
37 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); 37 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
38 int (*start_poll) (struct nfc_hci_dev *hdev, 38 int (*start_poll) (struct nfc_hci_dev *hdev,
39 u32 im_protocols, u32 tm_protocols); 39 u32 im_protocols, u32 tm_protocols);
40 void (*stop_poll) (struct nfc_hci_dev *hdev);
40 int (*dep_link_up)(struct nfc_hci_dev *hdev, struct nfc_target *target, 41 int (*dep_link_up)(struct nfc_hci_dev *hdev, struct nfc_target *target,
41 u8 comm_mode, u8 *gb, size_t gb_len); 42 u8 comm_mode, u8 *gb, size_t gb_len);
42 int (*dep_link_down)(struct nfc_hci_dev *hdev); 43 int (*dep_link_down)(struct nfc_hci_dev *hdev);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 72240e5ac2c4..e21b9f9653c0 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -136,6 +136,7 @@ void rtnl_af_unregister(struct rtnl_af_ops *ops);
136 136
137struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 137struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
138struct net_device *rtnl_create_link(struct net *net, char *ifname, 138struct net_device *rtnl_create_link(struct net *net, char *ifname,
139 unsigned char name_assign_type,
139 const struct rtnl_link_ops *ops, 140 const struct rtnl_link_ops *ops,
140 struct nlattr *tb[]); 141 struct nlattr *tb[]);
141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm); 142int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 624f9857c83e..a3cfb8ebeb53 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -231,7 +231,7 @@ struct qdisc_skb_cb {
231 unsigned int pkt_len; 231 unsigned int pkt_len;
232 u16 slave_dev_queue_mapping; 232 u16 slave_dev_queue_mapping;
233 u16 _pad; 233 u16 _pad;
234 unsigned char data[20]; 234 unsigned char data[24];
235}; 235};
236 236
237static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) 237static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 4b7cd695e431..f22538e68245 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -118,6 +118,7 @@ typedef enum {
118#define SCTP_MAX_NUM_COMMANDS 14 118#define SCTP_MAX_NUM_COMMANDS 14
119 119
120typedef union { 120typedef union {
121 void *zero_all; /* Set to NULL to clear the entire union */
121 __s32 i32; 122 __s32 i32;
122 __u32 u32; 123 __u32 u32;
123 __be32 be32; 124 __be32 be32;
@@ -154,7 +155,7 @@ typedef union {
154static inline sctp_arg_t \ 155static inline sctp_arg_t \
155SCTP_## name (type arg) \ 156SCTP_## name (type arg) \
156{ sctp_arg_t retval;\ 157{ sctp_arg_t retval;\
157 memset(&retval, 0, sizeof(sctp_arg_t));\ 158 retval.zero_all = NULL;\
158 retval.elt = arg;\ 159 retval.elt = arg;\
159 return retval;\ 160 return retval;\
160} 161}
@@ -191,7 +192,7 @@ static inline sctp_arg_t SCTP_NOFORCE(void)
191static inline sctp_arg_t SCTP_NULL(void) 192static inline sctp_arg_t SCTP_NULL(void)
192{ 193{
193 sctp_arg_t retval; 194 sctp_arg_t retval;
194 memset(&retval, 0, sizeof(sctp_arg_t)); 195 retval.zero_all = NULL;
195 return retval; 196 return retval;
196} 197}
197 198
@@ -202,27 +203,49 @@ typedef struct {
202 203
203typedef struct { 204typedef struct {
204 sctp_cmd_t cmds[SCTP_MAX_NUM_COMMANDS]; 205 sctp_cmd_t cmds[SCTP_MAX_NUM_COMMANDS];
205 __u8 next_free_slot; 206 sctp_cmd_t *last_used_slot;
206 __u8 next_cmd; 207 sctp_cmd_t *next_cmd;
207} sctp_cmd_seq_t; 208} sctp_cmd_seq_t;
208 209
209 210
210/* Initialize a block of memory as a command sequence. 211/* Initialize a block of memory as a command sequence.
211 * Return 0 if the initialization fails. 212 * Return 0 if the initialization fails.
212 */ 213 */
213int sctp_init_cmd_seq(sctp_cmd_seq_t *seq); 214static inline int sctp_init_cmd_seq(sctp_cmd_seq_t *seq)
215{
216 /* cmds[] is filled backwards to simplify the overflow BUG() check */
217 seq->last_used_slot = seq->cmds + SCTP_MAX_NUM_COMMANDS;
218 seq->next_cmd = seq->last_used_slot;
219 return 1; /* We always succeed. */
220}
221
214 222
215/* Add a command to an sctp_cmd_seq_t. 223/* Add a command to an sctp_cmd_seq_t.
216 * 224 *
217 * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above 225 * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above
218 * to wrap data which goes in the obj argument. 226 * to wrap data which goes in the obj argument.
219 */ 227 */
220void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj); 228static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb,
229 sctp_arg_t obj)
230{
231 sctp_cmd_t *cmd = seq->last_used_slot - 1;
232
233 BUG_ON(cmd < seq->cmds);
234
235 cmd->verb = verb;
236 cmd->obj = obj;
237 seq->last_used_slot = cmd;
238}
221 239
222/* Return the next command structure in an sctp_cmd_seq. 240/* Return the next command structure in an sctp_cmd_seq.
223 * Return NULL at the end of the sequence. 241 * Return NULL at the end of the sequence.
224 */ 242 */
225sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq); 243static inline sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq)
244{
245 if (seq->next_cmd <= seq->last_used_slot)
246 return NULL;
226 247
227#endif /* __net_sctp_command_h__ */ 248 return --seq->next_cmd;
249}
228 250
251#endif /* __net_sctp_command_h__ */
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 307728f622ef..8c337cd0e1e4 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -311,7 +311,7 @@ typedef enum {
311 SCTP_XMIT_OK, 311 SCTP_XMIT_OK,
312 SCTP_XMIT_PMTU_FULL, 312 SCTP_XMIT_PMTU_FULL,
313 SCTP_XMIT_RWND_FULL, 313 SCTP_XMIT_RWND_FULL,
314 SCTP_XMIT_NAGLE_DELAY, 314 SCTP_XMIT_DELAY,
315} sctp_xmit_t; 315} sctp_xmit_t;
316 316
317/* These are the commands for manipulating transports. */ 317/* These are the commands for manipulating transports. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 8e4de46c052e..f6e7397e799d 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -109,6 +109,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
109 struct sctp_association *asoc); 109 struct sctp_association *asoc);
110extern struct percpu_counter sctp_sockets_allocated; 110extern struct percpu_counter sctp_sockets_allocated;
111int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *); 111int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
112struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *);
112 113
113/* 114/*
114 * sctp/primitive.c 115 * sctp/primitive.c
@@ -388,27 +389,6 @@ static inline int sctp_list_single_entry(struct list_head *head)
388 return (head->next != head) && (head->next == head->prev); 389 return (head->next != head) && (head->next == head->prev);
389} 390}
390 391
391/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
392static inline __s32 sctp_jitter(__u32 rto)
393{
394 static __u32 sctp_rand;
395 __s32 ret;
396
397 /* Avoid divide by zero. */
398 if (!rto)
399 rto = 1;
400
401 sctp_rand += jiffies;
402 sctp_rand ^= (sctp_rand << 12);
403 sctp_rand ^= (sctp_rand >> 20);
404
405 /* Choose random number from 0 to rto, then move to -50% ~ +50%
406 * of rto.
407 */
408 ret = sctp_rand % rto - (rto >> 1);
409 return ret;
410}
411
412/* Break down data chunks at this point. */ 392/* Break down data chunks at this point. */
413static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu) 393static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
414{ 394{
@@ -574,6 +554,8 @@ static inline void sctp_v6_map_v4(union sctp_addr *addr)
574static inline void sctp_v4_map_v6(union sctp_addr *addr) 554static inline void sctp_v4_map_v6(union sctp_addr *addr)
575{ 555{
576 addr->v6.sin6_family = AF_INET6; 556 addr->v6.sin6_family = AF_INET6;
557 addr->v6.sin6_flowinfo = 0;
558 addr->v6.sin6_scope_id = 0;
577 addr->v6.sin6_port = addr->v4.sin_port; 559 addr->v6.sin6_port = addr->v4.sin_port;
578 addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; 560 addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr;
579 addr->v6.sin6_addr.s6_addr32[0] = 0; 561 addr->v6.sin6_addr.s6_addr32[0] = 0;
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index f38588bf3462..4ff3f67be62c 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -207,7 +207,9 @@ struct sctp_sock {
207 struct sctp_paddrparams paddrparam; 207 struct sctp_paddrparams paddrparam;
208 struct sctp_event_subscribe subscribe; 208 struct sctp_event_subscribe subscribe;
209 struct sctp_assocparams assocparams; 209 struct sctp_assocparams assocparams;
210
210 int user_frag; 211 int user_frag;
212
211 __u32 autoclose; 213 __u32 autoclose;
212 __u8 nodelay; 214 __u8 nodelay;
213 __u8 disable_fragments; 215 __u8 disable_fragments;
@@ -215,6 +217,8 @@ struct sctp_sock {
215 __u8 frag_interleave; 217 __u8 frag_interleave;
216 __u32 adaptation_ind; 218 __u32 adaptation_ind;
217 __u32 pd_point; 219 __u32 pd_point;
220 __u8 recvrcvinfo;
221 __u8 recvnxtinfo;
218 222
219 atomic_t pd_mode; 223 atomic_t pd_mode;
220 /* Receive to here while partial delivery is in effect. */ 224 /* Receive to here while partial delivery is in effect. */
@@ -461,10 +465,6 @@ struct sctp_af {
461 int saddr); 465 int saddr);
462 void (*from_sk) (union sctp_addr *, 466 void (*from_sk) (union sctp_addr *,
463 struct sock *sk); 467 struct sock *sk);
464 void (*to_sk_saddr) (union sctp_addr *,
465 struct sock *sk);
466 void (*to_sk_daddr) (union sctp_addr *,
467 struct sock *sk);
468 void (*from_addr_param) (union sctp_addr *, 468 void (*from_addr_param) (union sctp_addr *,
469 union sctp_addr_param *, 469 union sctp_addr_param *,
470 __be16 port, int iif); 470 __be16 port, int iif);
@@ -505,7 +505,9 @@ struct sctp_pf {
505 int (*supported_addrs)(const struct sctp_sock *, __be16 *); 505 int (*supported_addrs)(const struct sctp_sock *, __be16 *);
506 struct sock *(*create_accept_sk) (struct sock *sk, 506 struct sock *(*create_accept_sk) (struct sock *sk,
507 struct sctp_association *asoc); 507 struct sctp_association *asoc);
508 void (*addr_v4map) (struct sctp_sock *, union sctp_addr *); 508 int (*addr_to_user)(struct sctp_sock *sk, union sctp_addr *addr);
509 void (*to_sk_saddr)(union sctp_addr *, struct sock *sk);
510 void (*to_sk_daddr)(union sctp_addr *, struct sock *sk);
509 struct sctp_af *af; 511 struct sctp_af *af;
510}; 512};
511 513
@@ -1919,7 +1921,8 @@ struct sctp_chunk *sctp_get_ecne_prepend(struct sctp_association *asoc);
1919/* A convenience structure to parse out SCTP specific CMSGs. */ 1921/* A convenience structure to parse out SCTP specific CMSGs. */
1920typedef struct sctp_cmsgs { 1922typedef struct sctp_cmsgs {
1921 struct sctp_initmsg *init; 1923 struct sctp_initmsg *init;
1922 struct sctp_sndrcvinfo *info; 1924 struct sctp_sndrcvinfo *srinfo;
1925 struct sctp_sndinfo *sinfo;
1923} sctp_cmsgs_t; 1926} sctp_cmsgs_t;
1924 1927
1925/* Structure for tracking memory objects */ 1928/* Structure for tracking memory objects */
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index daacb32b55b5..cccdcfd14973 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -129,7 +129,12 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
129 const struct sctp_association *asoc, gfp_t gfp); 129 const struct sctp_association *asoc, gfp_t gfp);
130 130
131void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, 131void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
132 struct msghdr *); 132 struct msghdr *);
133void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event,
134 struct msghdr *);
135void sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event,
136 struct msghdr *, struct sock *sk);
137
133__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); 138__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
134 139
135/* Is this event type enabled? */ 140/* Is this event type enabled? */
@@ -155,10 +160,3 @@ static inline int sctp_ulpevent_is_enabled(const struct sctp_ulpevent *event,
155} 160}
156 161
157#endif /* __sctp_ulpevent_h__ */ 162#endif /* __sctp_ulpevent_h__ */
158
159
160
161
162
163
164
diff --git a/include/net/sock.h b/include/net/sock.h
index 156350745700..7f2ab72f321a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -67,6 +67,7 @@
67#include <linux/atomic.h> 67#include <linux/atomic.h>
68#include <net/dst.h> 68#include <net/dst.h>
69#include <net/checksum.h> 69#include <net/checksum.h>
70#include <linux/net_tstamp.h>
70 71
71struct cgroup; 72struct cgroup;
72struct cgroup_subsys; 73struct cgroup_subsys;
@@ -181,7 +182,8 @@ struct sock_common {
181 unsigned short skc_family; 182 unsigned short skc_family;
182 volatile unsigned char skc_state; 183 volatile unsigned char skc_state;
183 unsigned char skc_reuse:4; 184 unsigned char skc_reuse:4;
184 unsigned char skc_reuseport:4; 185 unsigned char skc_reuseport:1;
186 unsigned char skc_ipv6only:1;
185 int skc_bound_dev_if; 187 int skc_bound_dev_if;
186 union { 188 union {
187 struct hlist_node skc_bind_node; 189 struct hlist_node skc_bind_node;
@@ -272,10 +274,13 @@ struct cg_proto;
272 * @sk_rcvtimeo: %SO_RCVTIMEO setting 274 * @sk_rcvtimeo: %SO_RCVTIMEO setting
273 * @sk_sndtimeo: %SO_SNDTIMEO setting 275 * @sk_sndtimeo: %SO_SNDTIMEO setting
274 * @sk_rxhash: flow hash received from netif layer 276 * @sk_rxhash: flow hash received from netif layer
277 * @sk_txhash: computed flow hash for use on transmit
275 * @sk_filter: socket filtering instructions 278 * @sk_filter: socket filtering instructions
276 * @sk_protinfo: private area, net family specific, when not using slab 279 * @sk_protinfo: private area, net family specific, when not using slab
277 * @sk_timer: sock cleanup timer 280 * @sk_timer: sock cleanup timer
278 * @sk_stamp: time stamp of last packet received 281 * @sk_stamp: time stamp of last packet received
282 * @sk_tsflags: SO_TIMESTAMPING socket options
283 * @sk_tskey: counter to disambiguate concurrent tstamp requests
279 * @sk_socket: Identd and reporting IO signals 284 * @sk_socket: Identd and reporting IO signals
280 * @sk_user_data: RPC layer private data 285 * @sk_user_data: RPC layer private data
281 * @sk_frag: cached page frag 286 * @sk_frag: cached page frag
@@ -317,6 +322,7 @@ struct sock {
317#define sk_state __sk_common.skc_state 322#define sk_state __sk_common.skc_state
318#define sk_reuse __sk_common.skc_reuse 323#define sk_reuse __sk_common.skc_reuse
319#define sk_reuseport __sk_common.skc_reuseport 324#define sk_reuseport __sk_common.skc_reuseport
325#define sk_ipv6only __sk_common.skc_ipv6only
320#define sk_bound_dev_if __sk_common.skc_bound_dev_if 326#define sk_bound_dev_if __sk_common.skc_bound_dev_if
321#define sk_bind_node __sk_common.skc_bind_node 327#define sk_bind_node __sk_common.skc_bind_node
322#define sk_prot __sk_common.skc_prot 328#define sk_prot __sk_common.skc_prot
@@ -345,6 +351,7 @@ struct sock {
345#ifdef CONFIG_RPS 351#ifdef CONFIG_RPS
346 __u32 sk_rxhash; 352 __u32 sk_rxhash;
347#endif 353#endif
354 __u32 sk_txhash;
348#ifdef CONFIG_NET_RX_BUSY_POLL 355#ifdef CONFIG_NET_RX_BUSY_POLL
349 unsigned int sk_napi_id; 356 unsigned int sk_napi_id;
350 unsigned int sk_ll_usec; 357 unsigned int sk_ll_usec;
@@ -407,6 +414,8 @@ struct sock {
407 void *sk_protinfo; 414 void *sk_protinfo;
408 struct timer_list sk_timer; 415 struct timer_list sk_timer;
409 ktime_t sk_stamp; 416 ktime_t sk_stamp;
417 u16 sk_tsflags;
418 u32 sk_tskey;
410 struct socket *sk_socket; 419 struct socket *sk_socket;
411 void *sk_user_data; 420 void *sk_user_data;
412 struct page_frag sk_frag; 421 struct page_frag sk_frag;
@@ -656,6 +665,20 @@ static inline void sk_add_bind_node(struct sock *sk,
656#define sk_for_each_bound(__sk, list) \ 665#define sk_for_each_bound(__sk, list) \
657 hlist_for_each_entry(__sk, list, sk_bind_node) 666 hlist_for_each_entry(__sk, list, sk_bind_node)
658 667
668/**
669 * sk_nulls_for_each_entry_offset - iterate over a list at a given struct offset
670 * @tpos: the type * to use as a loop cursor.
671 * @pos: the &struct hlist_node to use as a loop cursor.
672 * @head: the head for your list.
673 * @offset: offset of hlist_node within the struct.
674 *
675 */
676#define sk_nulls_for_each_entry_offset(tpos, pos, head, offset) \
677 for (pos = (head)->first; \
678 (!is_a_nulls(pos)) && \
679 ({ tpos = (typeof(*tpos) *)((void *)pos - offset); 1;}); \
680 pos = pos->next)
681
659static inline struct user_namespace *sk_user_ns(struct sock *sk) 682static inline struct user_namespace *sk_user_ns(struct sock *sk)
660{ 683{
661 /* Careful only use this in a context where these parameters 684 /* Careful only use this in a context where these parameters
@@ -683,13 +706,7 @@ enum sock_flags {
683 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 706 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
684 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 707 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
685 SOCK_MEMALLOC, /* VM depends on this socket for swapping */ 708 SOCK_MEMALLOC, /* VM depends on this socket for swapping */
686 SOCK_TIMESTAMPING_TX_HARDWARE, /* %SOF_TIMESTAMPING_TX_HARDWARE */
687 SOCK_TIMESTAMPING_TX_SOFTWARE, /* %SOF_TIMESTAMPING_TX_SOFTWARE */
688 SOCK_TIMESTAMPING_RX_HARDWARE, /* %SOF_TIMESTAMPING_RX_HARDWARE */
689 SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */ 709 SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */
690 SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
691 SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
692 SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
693 SOCK_FASYNC, /* fasync() active */ 710 SOCK_FASYNC, /* fasync() active */
694 SOCK_RXQ_OVFL, 711 SOCK_RXQ_OVFL,
695 SOCK_ZEROCOPY, /* buffers from userspace */ 712 SOCK_ZEROCOPY, /* buffers from userspace */
@@ -792,8 +809,7 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
792 * Do not take into account this skb truesize, 809 * Do not take into account this skb truesize,
793 * to allow even a single big packet to come. 810 * to allow even a single big packet to come.
794 */ 811 */
795static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb, 812static inline bool sk_rcvqueues_full(const struct sock *sk, unsigned int limit)
796 unsigned int limit)
797{ 813{
798 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); 814 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
799 815
@@ -804,7 +820,7 @@ static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff
804static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb, 820static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb,
805 unsigned int limit) 821 unsigned int limit)
806{ 822{
807 if (sk_rcvqueues_full(sk, skb, limit)) 823 if (sk_rcvqueues_full(sk, limit))
808 return -ENOBUFS; 824 return -ENOBUFS;
809 825
810 __sk_add_backlog(sk, skb); 826 __sk_add_backlog(sk, skb);
@@ -971,7 +987,6 @@ struct proto {
971 struct sk_buff *skb); 987 struct sk_buff *skb);
972 988
973 void (*release_cb)(struct sock *sk); 989 void (*release_cb)(struct sock *sk);
974 void (*mtu_reduced)(struct sock *sk);
975 990
976 /* Keeping track of sk's, looking them up, and port selection methods. */ 991 /* Keeping track of sk's, looking them up, and port selection methods. */
977 void (*hash)(struct sock *sk); 992 void (*hash)(struct sock *sk);
@@ -1978,6 +1993,14 @@ static inline void sock_poll_wait(struct file *filp,
1978 } 1993 }
1979} 1994}
1980 1995
1996static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
1997{
1998 if (sk->sk_txhash) {
1999 skb->l4_hash = 1;
2000 skb->hash = sk->sk_txhash;
2001 }
2002}
2003
1981/* 2004/*
1982 * Queue a received datagram if it will fit. Stream and sequenced 2005 * Queue a received datagram if it will fit. Stream and sequenced
1983 * protocols can't normally use this as they need to fit buffers in 2006 * protocols can't normally use this as they need to fit buffers in
@@ -1992,6 +2015,7 @@ static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
1992 skb_orphan(skb); 2015 skb_orphan(skb);
1993 skb->sk = sk; 2016 skb->sk = sk;
1994 skb->destructor = sock_wfree; 2017 skb->destructor = sock_wfree;
2018 skb_set_hash_from_sk(skb, sk);
1995 /* 2019 /*
1996 * We used to take a refcount on sk, but following operation 2020 * We used to take a refcount on sk, but following operation
1997 * is enough to guarantee sk_free() wont free this sock until 2021 * is enough to guarantee sk_free() wont free this sock until
@@ -2135,21 +2159,17 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2135 2159
2136 /* 2160 /*
2137 * generate control messages if 2161 * generate control messages if
2138 * - receive time stamping in software requested (SOCK_RCVTSTAMP 2162 * - receive time stamping in software requested
2139 * or SOCK_TIMESTAMPING_RX_SOFTWARE)
2140 * - software time stamp available and wanted 2163 * - software time stamp available and wanted
2141 * (SOCK_TIMESTAMPING_SOFTWARE)
2142 * - hardware time stamps available and wanted 2164 * - hardware time stamps available and wanted
2143 * (SOCK_TIMESTAMPING_SYS_HARDWARE or
2144 * SOCK_TIMESTAMPING_RAW_HARDWARE)
2145 */ 2165 */
2146 if (sock_flag(sk, SOCK_RCVTSTAMP) || 2166 if (sock_flag(sk, SOCK_RCVTSTAMP) ||
2147 sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) || 2167 (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) ||
2148 (kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) || 2168 (kt.tv64 &&
2169 (sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE ||
2170 skb_shinfo(skb)->tx_flags & SKBTX_ANY_SW_TSTAMP)) ||
2149 (hwtstamps->hwtstamp.tv64 && 2171 (hwtstamps->hwtstamp.tv64 &&
2150 sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) || 2172 (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE)))
2151 (hwtstamps->syststamp.tv64 &&
2152 sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE)))
2153 __sock_recv_timestamp(msg, sk, skb); 2173 __sock_recv_timestamp(msg, sk, skb);
2154 else 2174 else
2155 sk->sk_stamp = kt; 2175 sk->sk_stamp = kt;
@@ -2165,12 +2185,11 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2165 struct sk_buff *skb) 2185 struct sk_buff *skb)
2166{ 2186{
2167#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \ 2187#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
2168 (1UL << SOCK_RCVTSTAMP) | \ 2188 (1UL << SOCK_RCVTSTAMP))
2169 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \ 2189#define TSFLAGS_ANY (SOF_TIMESTAMPING_SOFTWARE | \
2170 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \ 2190 SOF_TIMESTAMPING_RAW_HARDWARE)
2171 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
2172 2191
2173 if (sk->sk_flags & FLAGS_TS_OR_DROPS) 2192 if (sk->sk_flags & FLAGS_TS_OR_DROPS || sk->sk_tsflags & TSFLAGS_ANY)
2174 __sock_recv_ts_and_drops(msg, sk, skb); 2193 __sock_recv_ts_and_drops(msg, sk, skb);
2175 else 2194 else
2176 sk->sk_stamp = skb->tstamp; 2195 sk->sk_stamp = skb->tstamp;
@@ -2179,11 +2198,11 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2179/** 2198/**
2180 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 2199 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
2181 * @sk: socket sending this packet 2200 * @sk: socket sending this packet
2182 * @tx_flags: filled with instructions for time stamping 2201 * @tx_flags: completed with instructions for time stamping
2183 * 2202 *
2184 * Currently only depends on SOCK_TIMESTAMPING* flags. 2203 * Note : callers should take care of initial *tx_flags value (usually 0)
2185 */ 2204 */
2186void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2205void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags);
2187 2206
2188/** 2207/**
2189 * sk_eat_skb - Release a skb if it is no longer needed 2208 * 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 7286db80e8b8..590e01a476ac 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -411,13 +411,13 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
411 bool fastopen); 411 bool fastopen);
412int tcp_child_process(struct sock *parent, struct sock *child, 412int tcp_child_process(struct sock *parent, struct sock *child,
413 struct sk_buff *skb); 413 struct sk_buff *skb);
414void tcp_enter_loss(struct sock *sk, int how); 414void tcp_enter_loss(struct sock *sk);
415void tcp_clear_retrans(struct tcp_sock *tp); 415void tcp_clear_retrans(struct tcp_sock *tp);
416void tcp_update_metrics(struct sock *sk); 416void tcp_update_metrics(struct sock *sk);
417void tcp_init_metrics(struct sock *sk); 417void tcp_init_metrics(struct sock *sk);
418void tcp_metrics_init(void); 418void tcp_metrics_init(void);
419bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, 419bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst,
420 bool paws_check); 420 bool paws_check, bool timestamps);
421bool tcp_remember_stamp(struct sock *sk); 421bool tcp_remember_stamp(struct sock *sk);
422bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 422bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
423void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 423void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
@@ -448,6 +448,7 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
448 */ 448 */
449 449
450void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); 450void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
451void tcp_v4_mtu_reduced(struct sock *sk);
451int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 452int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
452struct sock *tcp_create_openreq_child(struct sock *sk, 453struct sock *tcp_create_openreq_child(struct sock *sk,
453 struct request_sock *req, 454 struct request_sock *req,
@@ -493,14 +494,8 @@ static inline u32 tcp_cookie_time(void)
493 494
494u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, 495u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
495 u16 *mssp); 496 u16 *mssp);
496__u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss); 497__u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb,
497#else 498 __u16 *mss);
498static inline __u32 cookie_v4_init_sequence(struct sock *sk,
499 struct sk_buff *skb,
500 __u16 *mss)
501{
502 return 0;
503}
504#endif 499#endif
505 500
506__u32 cookie_init_timestamp(struct request_sock *req); 501__u32 cookie_init_timestamp(struct request_sock *req);
@@ -516,13 +511,6 @@ u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
516 const struct tcphdr *th, u16 *mssp); 511 const struct tcphdr *th, u16 *mssp);
517__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 512__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
518 __u16 *mss); 513 __u16 *mss);
519#else
520static inline __u32 cookie_v6_init_sequence(struct sock *sk,
521 struct sk_buff *skb,
522 __u16 *mss)
523{
524 return 0;
525}
526#endif 514#endif
527/* tcp_output.c */ 515/* tcp_output.c */
528 516
@@ -718,8 +706,10 @@ struct tcp_skb_cb {
718#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 706#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
719#define TCPCB_LOST 0x04 /* SKB is lost */ 707#define TCPCB_LOST 0x04 /* SKB is lost */
720#define TCPCB_TAGBITS 0x07 /* All tag bits */ 708#define TCPCB_TAGBITS 0x07 /* All tag bits */
709#define TCPCB_REPAIRED 0x10 /* SKB repaired (no skb_mstamp) */
721#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 710#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
722#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 711#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS| \
712 TCPCB_REPAIRED)
723 713
724 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */ 714 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
725 /* 1 byte hole */ 715 /* 1 byte hole */
@@ -941,7 +931,7 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
941/* Use define here intentionally to get WARN_ON location shown at the caller */ 931/* Use define here intentionally to get WARN_ON location shown at the caller */
942#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 932#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
943 933
944void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 934void tcp_enter_cwr(struct sock *sk);
945__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 935__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst);
946 936
947/* The maximum number of MSS of available cwnd for which TSO defers 937/* The maximum number of MSS of available cwnd for which TSO defers
@@ -1098,7 +1088,7 @@ static inline int tcp_full_space(const struct sock *sk)
1098 1088
1099static inline void tcp_openreq_init(struct request_sock *req, 1089static inline void tcp_openreq_init(struct request_sock *req,
1100 struct tcp_options_received *rx_opt, 1090 struct tcp_options_received *rx_opt,
1101 struct sk_buff *skb) 1091 struct sk_buff *skb, struct sock *sk)
1102{ 1092{
1103 struct inet_request_sock *ireq = inet_rsk(req); 1093 struct inet_request_sock *ireq = inet_rsk(req);
1104 1094
@@ -1106,7 +1096,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
1106 req->cookie_ts = 0; 1096 req->cookie_ts = 0;
1107 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 1097 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1108 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; 1098 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1109 tcp_rsk(req)->snt_synack = 0; 1099 tcp_rsk(req)->snt_synack = tcp_time_stamp;
1110 req->mss = rx_opt->mss_clamp; 1100 req->mss = rx_opt->mss_clamp;
1111 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 1101 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1112 ireq->tstamp_ok = rx_opt->tstamp_ok; 1102 ireq->tstamp_ok = rx_opt->tstamp_ok;
@@ -1117,6 +1107,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
1117 ireq->ecn_ok = 0; 1107 ireq->ecn_ok = 0;
1118 ireq->ir_rmt_port = tcp_hdr(skb)->source; 1108 ireq->ir_rmt_port = tcp_hdr(skb)->source;
1119 ireq->ir_num = ntohs(tcp_hdr(skb)->dest); 1109 ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
1110 ireq->ir_mark = inet_request_mark(sk, skb);
1120} 1111}
1121 1112
1122extern void tcp_openreq_init_rwin(struct request_sock *req, 1113extern void tcp_openreq_init_rwin(struct request_sock *req,
@@ -1585,6 +1576,11 @@ int tcp4_proc_init(void);
1585void tcp4_proc_exit(void); 1576void tcp4_proc_exit(void);
1586#endif 1577#endif
1587 1578
1579int tcp_rtx_synack(struct sock *sk, struct request_sock *req);
1580int tcp_conn_request(struct request_sock_ops *rsk_ops,
1581 const struct tcp_request_sock_ops *af_ops,
1582 struct sock *sk, struct sk_buff *skb);
1583
1588/* TCP af-specific functions */ 1584/* TCP af-specific functions */
1589struct tcp_sock_af_ops { 1585struct tcp_sock_af_ops {
1590#ifdef CONFIG_TCP_MD5SIG 1586#ifdef CONFIG_TCP_MD5SIG
@@ -1602,6 +1598,7 @@ struct tcp_sock_af_ops {
1602}; 1598};
1603 1599
1604struct tcp_request_sock_ops { 1600struct tcp_request_sock_ops {
1601 u16 mss_clamp;
1605#ifdef CONFIG_TCP_MD5SIG 1602#ifdef CONFIG_TCP_MD5SIG
1606 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk, 1603 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1607 struct request_sock *req); 1604 struct request_sock *req);
@@ -1611,8 +1608,39 @@ struct tcp_request_sock_ops {
1611 const struct request_sock *req, 1608 const struct request_sock *req,
1612 const struct sk_buff *skb); 1609 const struct sk_buff *skb);
1613#endif 1610#endif
1611 void (*init_req)(struct request_sock *req, struct sock *sk,
1612 struct sk_buff *skb);
1613#ifdef CONFIG_SYN_COOKIES
1614 __u32 (*cookie_init_seq)(struct sock *sk, const struct sk_buff *skb,
1615 __u16 *mss);
1616#endif
1617 struct dst_entry *(*route_req)(struct sock *sk, struct flowi *fl,
1618 const struct request_sock *req,
1619 bool *strict);
1620 __u32 (*init_seq)(const struct sk_buff *skb);
1621 int (*send_synack)(struct sock *sk, struct dst_entry *dst,
1622 struct flowi *fl, struct request_sock *req,
1623 u16 queue_mapping, struct tcp_fastopen_cookie *foc);
1624 void (*queue_hash_add)(struct sock *sk, struct request_sock *req,
1625 const unsigned long timeout);
1614}; 1626};
1615 1627
1628#ifdef CONFIG_SYN_COOKIES
1629static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
1630 struct sock *sk, struct sk_buff *skb,
1631 __u16 *mss)
1632{
1633 return ops->cookie_init_seq(sk, skb, mss);
1634}
1635#else
1636static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
1637 struct sock *sk, struct sk_buff *skb,
1638 __u16 *mss)
1639{
1640 return 0;
1641}
1642#endif
1643
1616int tcpv4_offload_init(void); 1644int tcpv4_offload_init(void);
1617 1645
1618void tcp_v4_init(void); 1646void tcp_v4_init(void);
diff --git a/include/net/udp.h b/include/net/udp.h
index 68a1fefe3dfe..70f941368ace 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -176,6 +176,35 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
176 int (*)(const struct sock *, const struct sock *), 176 int (*)(const struct sock *, const struct sock *),
177 unsigned int hash2_nulladdr); 177 unsigned int hash2_nulladdr);
178 178
179static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
180 int min, int max, bool use_eth)
181{
182 u32 hash;
183
184 if (min >= max) {
185 /* Use default range */
186 inet_get_local_port_range(net, &min, &max);
187 }
188
189 hash = skb_get_hash(skb);
190 if (unlikely(!hash) && use_eth) {
191 /* Can't find a normal hash, caller has indicated an Ethernet
192 * packet so use that to compute a hash.
193 */
194 hash = jhash(skb->data, 2 * ETH_ALEN,
195 (__force u32) skb->protocol);
196 }
197
198 /* Since this is being sent on the wire obfuscate hash a bit
199 * to minimize possbility that any useful information to an
200 * attacker is leaked. Only upper 16 bits are relevant in the
201 * computation for 16 bit port value.
202 */
203 hash ^= hash << 16;
204
205 return htons((((u64) hash * (max - min)) >> 32) + min);
206}
207
179/* net/ipv4/udp.c */ 208/* net/ipv4/udp.c */
180void udp_v4_early_demux(struct sk_buff *skb); 209void udp_v4_early_demux(struct sk_buff *skb);
181int udp_get_port(struct sock *sk, unsigned short snum, 210int udp_get_port(struct sock *sk, unsigned short snum,
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
new file mode 100644
index 000000000000..ffd69cbded35
--- /dev/null
+++ b/include/net/udp_tunnel.h
@@ -0,0 +1,32 @@
1#ifndef __NET_UDP_TUNNEL_H
2#define __NET_UDP_TUNNEL_H
3
4struct udp_port_cfg {
5 u8 family;
6
7 /* Used only for kernel-created sockets */
8 union {
9 struct in_addr local_ip;
10#if IS_ENABLED(CONFIG_IPV6)
11 struct in6_addr local_ip6;
12#endif
13 };
14
15 union {
16 struct in_addr peer_ip;
17#if IS_ENABLED(CONFIG_IPV6)
18 struct in6_addr peer_ip6;
19#endif
20 };
21
22 __be16 local_udp_port;
23 __be16 peer_udp_port;
24 unsigned int use_udp_checksums:1,
25 use_udp6_tx_checksums:1,
26 use_udp6_rx_checksums:1;
27};
28
29int udp_sock_create(struct net *net, struct udp_port_cfg *cfg,
30 struct socket **sockp);
31
32#endif
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 12196ce661d9..d5f59f3fc35d 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -45,8 +45,6 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); 46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
47 47
48__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
49
50/* IP header + UDP + VXLAN + Ethernet header */ 48/* IP header + UDP + VXLAN + Ethernet header */
51#define VXLAN_HEADROOM (20 + 8 + 8 + 14) 49#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
52/* IPv6 header + UDP + VXLAN + Ethernet header */ 50/* IPv6 header + UDP + VXLAN + Ethernet header */
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index 21cdb0b7b0fb..47da53c27ffa 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -8,6 +8,71 @@
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include <linux/edac.h> 9#include <linux/edac.h>
10#include <linux/ktime.h> 10#include <linux/ktime.h>
11#include <linux/aer.h>
12#include <linux/cper.h>
13
14/*
15 * MCE Extended Error Log trace event
16 *
17 * These events are generated when hardware detects a corrected or
18 * uncorrected event.
19 */
20
21/* memory trace event */
22
23#if defined(CONFIG_ACPI_EXTLOG) || defined(CONFIG_ACPI_EXTLOG_MODULE)
24TRACE_EVENT(extlog_mem_event,
25 TP_PROTO(struct cper_sec_mem_err *mem,
26 u32 err_seq,
27 const uuid_le *fru_id,
28 const char *fru_text,
29 u8 sev),
30
31 TP_ARGS(mem, err_seq, fru_id, fru_text, sev),
32
33 TP_STRUCT__entry(
34 __field(u32, err_seq)
35 __field(u8, etype)
36 __field(u8, sev)
37 __field(u64, pa)
38 __field(u8, pa_mask_lsb)
39 __field_struct(uuid_le, fru_id)
40 __string(fru_text, fru_text)
41 __field_struct(struct cper_mem_err_compact, data)
42 ),
43
44 TP_fast_assign(
45 __entry->err_seq = err_seq;
46 if (mem->validation_bits & CPER_MEM_VALID_ERROR_TYPE)
47 __entry->etype = mem->error_type;
48 else
49 __entry->etype = ~0;
50 __entry->sev = sev;
51 if (mem->validation_bits & CPER_MEM_VALID_PA)
52 __entry->pa = mem->physical_addr;
53 else
54 __entry->pa = ~0ull;
55
56 if (mem->validation_bits & CPER_MEM_VALID_PA_MASK)
57 __entry->pa_mask_lsb = (u8)__ffs64(mem->physical_addr_mask);
58 else
59 __entry->pa_mask_lsb = ~0;
60 __entry->fru_id = *fru_id;
61 __assign_str(fru_text, fru_text);
62 cper_mem_err_pack(mem, &__entry->data);
63 ),
64
65 TP_printk("{%d} %s error: %s physical addr: %016llx (mask lsb: %x) %sFRU: %pUl %.20s",
66 __entry->err_seq,
67 cper_severity_str(__entry->sev),
68 cper_mem_err_type_str(__entry->etype),
69 __entry->pa,
70 __entry->pa_mask_lsb,
71 cper_mem_err_unpack(p, &__entry->data),
72 &__entry->fru_id,
73 __get_str(fru_text))
74);
75#endif
11 76
12/* 77/*
13 * Hardware Events Report 78 * Hardware Events Report
@@ -94,6 +159,69 @@ TRACE_EVENT(mc_event,
94 __get_str(driver_detail)) 159 __get_str(driver_detail))
95); 160);
96 161
162/*
163 * PCIe AER Trace event
164 *
165 * These events are generated when hardware detects a corrected or
166 * uncorrected event on a PCIe device. The event report has
167 * the following structure:
168 *
169 * char * dev_name - The name of the slot where the device resides
170 * ([domain:]bus:device.function).
171 * u32 status - Either the correctable or uncorrectable register
172 * indicating what error or errors have been seen
173 * u8 severity - error severity 0:NONFATAL 1:FATAL 2:CORRECTED
174 */
175
176#define aer_correctable_errors \
177 {BIT(0), "Receiver Error"}, \
178 {BIT(6), "Bad TLP"}, \
179 {BIT(7), "Bad DLLP"}, \
180 {BIT(8), "RELAY_NUM Rollover"}, \
181 {BIT(12), "Replay Timer Timeout"}, \
182 {BIT(13), "Advisory Non-Fatal"}
183
184#define aer_uncorrectable_errors \
185 {BIT(4), "Data Link Protocol"}, \
186 {BIT(12), "Poisoned TLP"}, \
187 {BIT(13), "Flow Control Protocol"}, \
188 {BIT(14), "Completion Timeout"}, \
189 {BIT(15), "Completer Abort"}, \
190 {BIT(16), "Unexpected Completion"}, \
191 {BIT(17), "Receiver Overflow"}, \
192 {BIT(18), "Malformed TLP"}, \
193 {BIT(19), "ECRC"}, \
194 {BIT(20), "Unsupported Request"}
195
196TRACE_EVENT(aer_event,
197 TP_PROTO(const char *dev_name,
198 const u32 status,
199 const u8 severity),
200
201 TP_ARGS(dev_name, status, severity),
202
203 TP_STRUCT__entry(
204 __string( dev_name, dev_name )
205 __field( u32, status )
206 __field( u8, severity )
207 ),
208
209 TP_fast_assign(
210 __assign_str(dev_name, dev_name);
211 __entry->status = status;
212 __entry->severity = severity;
213 ),
214
215 TP_printk("%s PCIe Bus Error: severity=%s, %s\n",
216 __get_str(dev_name),
217 __entry->severity == AER_CORRECTABLE ? "Corrected" :
218 __entry->severity == AER_FATAL ?
219 "Fatal" : "Uncorrected, non-fatal",
220 __entry->severity == AER_CORRECTABLE ?
221 __print_flags(__entry->status, "|", aer_correctable_errors) :
222 __print_flags(__entry->status, "|", aer_uncorrectable_errors))
223);
224
97#endif /* _TRACE_HW_EVENT_MC_H */ 225#endif /* _TRACE_HW_EVENT_MC_H */
98 226
99/* This part must be outside protection */ 227/* This part must be outside protection */
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 3d81b90cc315..9bb99e983f58 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -40,6 +40,7 @@
40#include <linux/list.h> 40#include <linux/list.h>
41 41
42#include <rdma/ib_verbs.h> 42#include <rdma/ib_verbs.h>
43#include <uapi/rdma/ib_user_mad.h>
43 44
44/* Management base version */ 45/* Management base version */
45#define IB_MGMT_BASE_VERSION 1 46#define IB_MGMT_BASE_VERSION 1
@@ -355,9 +356,13 @@ typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
355 * @hi_tid: Access layer assigned transaction ID for this client. 356 * @hi_tid: Access layer assigned transaction ID for this client.
356 * Unsolicited MADs sent by this client will have the upper 32-bits 357 * Unsolicited MADs sent by this client will have the upper 32-bits
357 * of their TID set to this value. 358 * of their TID set to this value.
359 * @flags: registration flags
358 * @port_num: Port number on which QP is registered 360 * @port_num: Port number on which QP is registered
359 * @rmpp_version: If set, indicates the RMPP version used by this agent. 361 * @rmpp_version: If set, indicates the RMPP version used by this agent.
360 */ 362 */
363enum {
364 IB_MAD_USER_RMPP = IB_USER_MAD_USER_RMPP,
365};
361struct ib_mad_agent { 366struct ib_mad_agent {
362 struct ib_device *device; 367 struct ib_device *device;
363 struct ib_qp *qp; 368 struct ib_qp *qp;
@@ -367,6 +372,7 @@ struct ib_mad_agent {
367 ib_mad_snoop_handler snoop_handler; 372 ib_mad_snoop_handler snoop_handler;
368 void *context; 373 void *context;
369 u32 hi_tid; 374 u32 hi_tid;
375 u32 flags;
370 u8 port_num; 376 u8 port_num;
371 u8 rmpp_version; 377 u8 rmpp_version;
372}; 378};
@@ -426,6 +432,7 @@ struct ib_mad_recv_wc {
426 * in the range from 0x30 to 0x4f. Otherwise not used. 432 * in the range from 0x30 to 0x4f. Otherwise not used.
427 * @method_mask: The caller will receive unsolicited MADs for any method 433 * @method_mask: The caller will receive unsolicited MADs for any method
428 * where @method_mask = 1. 434 * where @method_mask = 1.
435 *
429 */ 436 */
430struct ib_mad_reg_req { 437struct ib_mad_reg_req {
431 u8 mgmt_class; 438 u8 mgmt_class;
@@ -451,6 +458,7 @@ struct ib_mad_reg_req {
451 * @recv_handler: The completion callback routine invoked for a received 458 * @recv_handler: The completion callback routine invoked for a received
452 * MAD. 459 * MAD.
453 * @context: User specified context associated with the registration. 460 * @context: User specified context associated with the registration.
461 * @registration_flags: Registration flags to set for this agent
454 */ 462 */
455struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, 463struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
456 u8 port_num, 464 u8 port_num,
@@ -459,7 +467,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
459 u8 rmpp_version, 467 u8 rmpp_version,
460 ib_mad_send_handler send_handler, 468 ib_mad_send_handler send_handler,
461 ib_mad_recv_handler recv_handler, 469 ib_mad_recv_handler recv_handler,
462 void *context); 470 void *context,
471 u32 registration_flags);
463 472
464enum ib_mad_snoop_flags { 473enum ib_mad_snoop_flags {
465 /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/ 474 /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/
@@ -661,4 +670,11 @@ void *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf, int seg_num);
661 */ 670 */
662void ib_free_send_mad(struct ib_mad_send_buf *send_buf); 671void ib_free_send_mad(struct ib_mad_send_buf *send_buf);
663 672
673/**
674 * ib_mad_kernel_rmpp_agent - Returns if the agent is performing RMPP.
675 * @agent: the agent in question
676 * @return: true if agent is performing rmpp, false otherwise.
677 */
678int ib_mad_kernel_rmpp_agent(struct ib_mad_agent *agent);
679
664#endif /* IB_MAD_H */ 680#endif /* IB_MAD_H */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7ccef342f724..ed44cc07a7b3 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1097,7 +1097,8 @@ struct ib_mr_attr {
1097enum ib_mr_rereg_flags { 1097enum ib_mr_rereg_flags {
1098 IB_MR_REREG_TRANS = 1, 1098 IB_MR_REREG_TRANS = 1,
1099 IB_MR_REREG_PD = (1<<1), 1099 IB_MR_REREG_PD = (1<<1),
1100 IB_MR_REREG_ACCESS = (1<<2) 1100 IB_MR_REREG_ACCESS = (1<<2),
1101 IB_MR_REREG_SUPPORTED = ((IB_MR_REREG_ACCESS << 1) - 1)
1101}; 1102};
1102 1103
1103/** 1104/**
@@ -1547,6 +1548,13 @@ struct ib_device {
1547 u64 virt_addr, 1548 u64 virt_addr,
1548 int mr_access_flags, 1549 int mr_access_flags,
1549 struct ib_udata *udata); 1550 struct ib_udata *udata);
1551 int (*rereg_user_mr)(struct ib_mr *mr,
1552 int flags,
1553 u64 start, u64 length,
1554 u64 virt_addr,
1555 int mr_access_flags,
1556 struct ib_pd *pd,
1557 struct ib_udata *udata);
1550 int (*query_mr)(struct ib_mr *mr, 1558 int (*query_mr)(struct ib_mr *mr,
1551 struct ib_mr_attr *mr_attr); 1559 struct ib_mr_attr *mr_attr);
1552 int (*dereg_mr)(struct ib_mr *mr); 1560 int (*dereg_mr)(struct ib_mr *mr);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index e6df23cae7be..261e708010da 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -31,7 +31,7 @@ enum scsi_timeouts {
31 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit 31 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
32 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios. 32 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios.
33 */ 33 */
34#ifdef ARCH_HAS_SG_CHAIN 34#ifdef CONFIG_ARCH_HAS_SG_CHAIN
35#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048 35#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048
36#else 36#else
37#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS 37#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 9859355a7cf9..750e5db7c6bf 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -86,7 +86,9 @@ typedef struct sg_io_hdr
86#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */ 86#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */
87#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ 87#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */
88 /* user space (debug indirect IO) */ 88 /* user space (debug indirect IO) */
89#define SG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ 89/* defaults:: for sg driver: Q_AT_HEAD; for block layer: Q_AT_TAIL */
90#define SG_FLAG_Q_AT_TAIL 0x10
91#define SG_FLAG_Q_AT_HEAD 0x20
90 92
91/* following 'info' values are "or"-ed together */ 93/* following 'info' values are "or"-ed together */
92#define SG_INFO_OK_MASK 0x1 94#define SG_INFO_OK_MASK 0x1
diff --git a/include/linux/tegra-ahb.h b/include/soc/tegra/ahb.h
index f1cd075ceee1..504eb6f957e5 100644
--- a/include/linux/tegra-ahb.h
+++ b/include/soc/tegra/ahb.h
@@ -11,9 +11,9 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifndef __LINUX_AHB_H__ 14#ifndef __SOC_TEGRA_AHB_H__
15#define __LINUX_AHB_H__ 15#define __SOC_TEGRA_AHB_H__
16 16
17extern int tegra_ahb_enable_smmu(struct device_node *ahb); 17extern int tegra_ahb_enable_smmu(struct device_node *ahb);
18 18
19#endif /* __LINUX_AHB_H__ */ 19#endif /* __SOC_TEGRA_AHB_H__ */
diff --git a/include/soc/tegra/common.h b/include/soc/tegra/common.h
new file mode 100644
index 000000000000..fc13a9a134e9
--- /dev/null
+++ b/include/soc/tegra/common.h
@@ -0,0 +1,14 @@
1/*
2 * Copyright (C) 2014 NVIDIA Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOC_TEGRA_COMMON_H__
10#define __SOC_TEGRA_COMMON_H__
11
12bool soc_is_tegra(void);
13
14#endif /* __SOC_TEGRA_COMMON_H__ */
diff --git a/include/linux/tegra-cpuidle.h b/include/soc/tegra/cpuidle.h
index 9c6286bbf662..ea04f4225638 100644
--- a/include/linux/tegra-cpuidle.h
+++ b/include/soc/tegra/cpuidle.h
@@ -11,8 +11,8 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifndef __LINUX_TEGRA_CPUIDLE_H__ 14#ifndef __SOC_TEGRA_CPUIDLE_H__
15#define __LINUX_TEGRA_CPUIDLE_H__ 15#define __SOC_TEGRA_CPUIDLE_H__
16 16
17#ifdef CONFIG_CPU_IDLE 17#ifdef CONFIG_CPU_IDLE
18void tegra_cpuidle_pcie_irqs_in_use(void); 18void tegra_cpuidle_pcie_irqs_in_use(void);
@@ -22,4 +22,4 @@ static inline void tegra_cpuidle_pcie_irqs_in_use(void)
22} 22}
23#endif 23#endif
24 24
25#endif 25#endif /* __SOC_TEGRA_CPUIDLE_H__ */
diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
new file mode 100644
index 000000000000..8e1249474e84
--- /dev/null
+++ b/include/soc/tegra/fuse.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (c) 2012, 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 __SOC_TEGRA_FUSE_H__
18#define __SOC_TEGRA_FUSE_H__
19
20#define TEGRA20 0x20
21#define TEGRA30 0x30
22#define TEGRA114 0x35
23#define TEGRA124 0x40
24
25#define TEGRA_FUSE_SKU_CALIB_0 0xf0
26#define TEGRA30_FUSE_SATA_CALIB 0x124
27
28#ifndef __ASSEMBLY__
29
30u32 tegra_read_chipid(void);
31u8 tegra_get_chip_id(void);
32
33enum tegra_revision {
34 TEGRA_REVISION_UNKNOWN = 0,
35 TEGRA_REVISION_A01,
36 TEGRA_REVISION_A02,
37 TEGRA_REVISION_A03,
38 TEGRA_REVISION_A03p,
39 TEGRA_REVISION_A04,
40 TEGRA_REVISION_MAX,
41};
42
43struct tegra_sku_info {
44 int sku_id;
45 int cpu_process_id;
46 int cpu_speedo_id;
47 int cpu_speedo_value;
48 int cpu_iddq_value;
49 int core_process_id;
50 int soc_speedo_id;
51 int gpu_speedo_id;
52 int gpu_process_id;
53 int gpu_speedo_value;
54 enum tegra_revision revision;
55};
56
57u32 tegra_read_straps(void);
58u32 tegra_read_chipid(void);
59int tegra_fuse_readl(unsigned long offset, u32 *value);
60
61extern struct tegra_sku_info tegra_sku_info;
62
63#endif /* __ASSEMBLY__ */
64
65#endif /* __SOC_TEGRA_FUSE_H__ */
diff --git a/include/soc/tegra/pm.h b/include/soc/tegra/pm.h
new file mode 100644
index 000000000000..30fe2078a547
--- /dev/null
+++ b/include/soc/tegra/pm.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2014 NVIDIA Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOC_TEGRA_PM_H__
10#define __SOC_TEGRA_PM_H__
11
12enum tegra_suspend_mode {
13 TEGRA_SUSPEND_NONE = 0,
14 TEGRA_SUSPEND_LP2, /* CPU voltage off */
15 TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
16 TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
17 TEGRA_MAX_SUSPEND_MODE,
18};
19
20#ifdef CONFIG_PM_SLEEP
21enum tegra_suspend_mode
22tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode);
23
24/* low-level resume entry point */
25void tegra_resume(void);
26#else
27static inline enum tegra_suspend_mode
28tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode)
29{
30 return TEGRA_SUSPEND_NONE;
31}
32
33static inline void tegra_resume(void)
34{
35}
36#endif /* CONFIG_PM_SLEEP */
37
38#endif /* __SOC_TEGRA_PM_H__ */
diff --git a/include/linux/tegra-powergate.h b/include/soc/tegra/pmc.h
index 46f0a07812b4..65a93273e72f 100644
--- a/include/linux/tegra-powergate.h
+++ b/include/soc/tegra/pmc.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2010 Google, Inc 2 * Copyright (c) 2010 Google, Inc
3 * Copyright (c) 2014 NVIDIA Corporation
3 * 4 *
4 * Author: 5 * Author:
5 * Colin Cross <ccross@google.com> 6 * Colin Cross <ccross@google.com>
@@ -15,12 +16,34 @@
15 * 16 *
16 */ 17 */
17 18
18#ifndef _MACH_TEGRA_POWERGATE_H_ 19#ifndef __SOC_TEGRA_PMC_H__
19#define _MACH_TEGRA_POWERGATE_H_ 20#define __SOC_TEGRA_PMC_H__
21
22#include <linux/reboot.h>
23
24#include <soc/tegra/pm.h>
20 25
21struct clk; 26struct clk;
22struct reset_control; 27struct reset_control;
23 28
29void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
30
31#ifdef CONFIG_PM_SLEEP
32enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
33void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
34void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
35#endif /* CONFIG_PM_SLEEP */
36
37#ifdef CONFIG_SMP
38bool tegra_pmc_cpu_is_powered(int cpuid);
39int tegra_pmc_cpu_power_on(int cpuid);
40int tegra_pmc_cpu_remove_clamping(int cpuid);
41#endif /* CONFIG_SMP */
42
43/*
44 * powergate and I/O rail APIs
45 */
46
24#define TEGRA_POWERGATE_CPU 0 47#define TEGRA_POWERGATE_CPU 0
25#define TEGRA_POWERGATE_3D 1 48#define TEGRA_POWERGATE_3D 1
26#define TEGRA_POWERGATE_VENC 2 49#define TEGRA_POWERGATE_VENC 2
@@ -129,6 +152,6 @@ static inline int tegra_io_rail_power_off(int id)
129{ 152{
130 return -ENOSYS; 153 return -ENOSYS;
131} 154}
132#endif 155#endif /* CONFIG_ARCH_TEGRA */
133 156
134#endif /* _MACH_TEGRA_POWERGATE_H_ */ 157#endif /* __SOC_TEGRA_PMC_H__ */
diff --git a/include/sound/control.h b/include/sound/control.h
index 5358892b1b39..042613938a1d 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -31,10 +31,15 @@ typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ct
31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
33typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, 33typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol,
34 int op_flag, /* 0=read,1=write,-1=command */ 34 int op_flag, /* SNDRV_CTL_TLV_OP_XXX */
35 unsigned int size, 35 unsigned int size,
36 unsigned int __user *tlv); 36 unsigned int __user *tlv);
37 37
38enum {
39 SNDRV_CTL_TLV_OP_READ = 0,
40 SNDRV_CTL_TLV_OP_WRITE = 1,
41 SNDRV_CTL_TLV_OP_CMD = -1,
42};
38 43
39struct snd_kcontrol_new { 44struct snd_kcontrol_new {
40 snd_ctl_elem_iface_t iface; /* interface identifier */ 45 snd_ctl_elem_iface_t iface; /* interface identifier */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index d854fb31c000..6f3e10ca0e32 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -931,10 +931,17 @@ void snd_pcm_timer_done(struct snd_pcm_substream *substream);
931static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, 931static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
932 struct timespec *tv) 932 struct timespec *tv)
933{ 933{
934 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) 934 switch (runtime->tstamp_type) {
935 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC:
935 ktime_get_ts(tv); 936 ktime_get_ts(tv);
936 else 937 break;
938 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW:
939 getrawmonotonic(tv);
940 break;
941 default:
937 getnstimeofday(tv); 942 getnstimeofday(tv);
943 break;
944 }
938} 945}
939 946
940/* 947/*
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index f4a706f82cb7..d76412b84b48 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,6 +34,7 @@
34 * B : SSI direction 34 * B : SSI direction
35 */ 35 */
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31) 36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_NO_BUSIF (1 << 30) /* SSI+DMA without BUSIF */
37 38
38#define RSND_SSI(_dma_id, _pio_irq, _flags) \ 39#define RSND_SSI(_dma_id, _pio_irq, _flags) \
39{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } 40{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
diff --git a/include/sound/rt286.h b/include/sound/rt286.h
new file mode 100644
index 000000000000..eb773d1485f2
--- /dev/null
+++ b/include/sound/rt286.h
@@ -0,0 +1,19 @@
1/*
2 * linux/sound/rt286.h -- Platform data for RT286
3 *
4 * Copyright 2013 Realtek Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_RT286_H
12#define __LINUX_SND_RT286_H
13
14struct rt286_platform_data {
15 bool cbj_en; /*combo jack enable*/
16 bool gpio2_en; /*GPIO2 enable*/
17};
18
19#endif
diff --git a/include/sound/rt5670.h b/include/sound/rt5670.h
new file mode 100644
index 000000000000..bd311197a3b5
--- /dev/null
+++ b/include/sound/rt5670.h
@@ -0,0 +1,27 @@
1/*
2 * linux/sound/rt5670.h -- Platform data for RT5670
3 *
4 * Copyright 2014 Realtek Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_RT5670_H
12#define __LINUX_SND_RT5670_H
13
14struct rt5670_platform_data {
15 int jd_mode;
16 bool in2_diff;
17
18 bool dmic_en;
19 unsigned int dmic1_data_pin;
20 /* 0 = GPIO6; 1 = IN2P; 3 = GPIO7*/
21 unsigned int dmic2_data_pin;
22 /* 0 = GPIO8; 1 = IN3N; */
23 unsigned int dmic3_data_pin;
24 /* 0 = GPIO9; 1 = GPIO10; 2 = GPIO5*/
25};
26
27#endif
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 688f2ba8009f..e8b3080d196a 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -257,7 +257,6 @@ struct snd_soc_dai {
257 257
258 struct snd_soc_dapm_widget *playback_widget; 258 struct snd_soc_dapm_widget *playback_widget;
259 struct snd_soc_dapm_widget *capture_widget; 259 struct snd_soc_dapm_widget *capture_widget;
260 struct snd_soc_dapm_context dapm;
261 260
262 /* DAI DMA data */ 261 /* DAI DMA data */
263 void *playback_dma_data; 262 void *playback_dma_data;
@@ -273,6 +272,10 @@ struct snd_soc_dai {
273 struct snd_soc_codec *codec; 272 struct snd_soc_codec *codec;
274 struct snd_soc_component *component; 273 struct snd_soc_component *component;
275 274
275 /* CODEC TDM slot masks and params (for fixup) */
276 unsigned int tx_mask;
277 unsigned int rx_mask;
278
276 struct snd_soc_card *card; 279 struct snd_soc_card *card;
277 280
278 struct list_head list; 281 struct list_head list;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6b59471cdf44..aac04ff84eea 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -431,7 +431,7 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
431 const char *pin); 431 const char *pin);
432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
433 const char *pin); 433 const char *pin);
434void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); 434void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
435 435
436/* Mostly internal - should not normally be used */ 436/* Mostly internal - should not normally be used */
437void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm); 437void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
@@ -441,6 +441,8 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
441 struct snd_soc_dapm_widget_list **list); 441 struct snd_soc_dapm_widget_list **list);
442 442
443struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol); 443struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
444struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
445 struct snd_kcontrol *kcontrol);
444 446
445/* dapm widget types */ 447/* dapm widget types */
446enum snd_soc_dapm_type { 448enum snd_soc_dapm_type {
@@ -524,7 +526,6 @@ struct snd_soc_dapm_widget {
524 const char *name; /* widget name */ 526 const char *name; /* widget name */
525 const char *sname; /* stream name */ 527 const char *sname; /* stream name */
526 struct snd_soc_codec *codec; 528 struct snd_soc_codec *codec;
527 struct snd_soc_platform *platform;
528 struct list_head list; 529 struct list_head list;
529 struct snd_soc_dapm_context *dapm; 530 struct snd_soc_dapm_context *dapm;
530 531
@@ -593,7 +594,6 @@ struct snd_soc_dapm_context {
593 struct device *dev; /* from parent - for debug */ 594 struct device *dev; /* from parent - for debug */
594 struct snd_soc_component *component; /* parent component */ 595 struct snd_soc_component *component; /* parent component */
595 struct snd_soc_codec *codec; /* parent codec */ 596 struct snd_soc_codec *codec; /* parent codec */
596 struct snd_soc_platform *platform; /* parent platform */
597 struct snd_soc_card *card; /* parent card */ 597 struct snd_soc_card *card; /* parent card */
598 598
599 /* used during DAPM updates */ 599 /* used during DAPM updates */
@@ -601,6 +601,8 @@ struct snd_soc_dapm_context {
601 struct list_head list; 601 struct list_head list;
602 602
603 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); 603 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
604 int (*set_bias_level)(struct snd_soc_dapm_context *dapm,
605 enum snd_soc_bias_level level);
604 606
605#ifdef CONFIG_DEBUG_FS 607#ifdef CONFIG_DEBUG_FS
606 struct dentry *debugfs_dapm; 608 struct dentry *debugfs_dapm;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ed9e2d7e5fdc..be6ecae247b0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -248,6 +248,8 @@
248 .info = snd_soc_info_enum_double, \ 248 .info = snd_soc_info_enum_double, \
249 .get = xhandler_get, .put = xhandler_put, \ 249 .get = xhandler_get, .put = xhandler_put, \
250 .private_value = (unsigned long)&xenum } 250 .private_value = (unsigned long)&xenum }
251#define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
252 SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)
251 253
252#define SND_SOC_BYTES(xname, xbase, xregs) \ 254#define SND_SOC_BYTES(xname, xbase, xregs) \
253{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 255{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -270,7 +272,14 @@
270 .get = xhandler_get, .put = xhandler_put, \ 272 .get = xhandler_get, .put = xhandler_put, \
271 .private_value = (unsigned long)&(struct soc_bytes_ext) \ 273 .private_value = (unsigned long)&(struct soc_bytes_ext) \
272 {.max = xcount} } 274 {.max = xcount} }
273 275#define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \
276{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
277 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \
278 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
279 .tlv.c = (snd_soc_bytes_tlv_callback), \
280 .info = snd_soc_info_bytes_ext, \
281 .private_value = (unsigned long)&(struct soc_bytes_ext) \
282 {.max = xcount, .get = xhandler_get, .put = xhandler_put, } }
274#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 283#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
275 xmin, xmax, xinvert) \ 284 xmin, xmax, xinvert) \
276{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 285{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -436,6 +445,10 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
436int snd_soc_platform_trigger(struct snd_pcm_substream *substream, 445int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
437 int cmd, struct snd_soc_platform *platform); 446 int cmd, struct snd_soc_platform *platform);
438 447
448int soc_dai_hw_params(struct snd_pcm_substream *substream,
449 struct snd_pcm_hw_params *params,
450 struct snd_soc_dai *dai);
451
439/* Jack reporting */ 452/* Jack reporting */
440int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 453int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
441 struct snd_soc_jack *jack); 454 struct snd_soc_jack *jack);
@@ -503,10 +516,12 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
503 const char *prefix); 516 const char *prefix);
504struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, 517struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
505 const char *name); 518 const char *name);
519int snd_soc_add_component_controls(struct snd_soc_component *component,
520 const struct snd_kcontrol_new *controls, unsigned int num_controls);
506int snd_soc_add_codec_controls(struct snd_soc_codec *codec, 521int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
507 const struct snd_kcontrol_new *controls, int num_controls); 522 const struct snd_kcontrol_new *controls, unsigned int num_controls);
508int snd_soc_add_platform_controls(struct snd_soc_platform *platform, 523int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
509 const struct snd_kcontrol_new *controls, int num_controls); 524 const struct snd_kcontrol_new *controls, unsigned int num_controls);
510int snd_soc_add_card_controls(struct snd_soc_card *soc_card, 525int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
511 const struct snd_kcontrol_new *controls, int num_controls); 526 const struct snd_kcontrol_new *controls, int num_controls);
512int snd_soc_add_dai_controls(struct snd_soc_dai *dai, 527int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
@@ -552,6 +567,8 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_value *ucontrol); 567 struct snd_ctl_elem_value *ucontrol);
553int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, 568int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
554 struct snd_ctl_elem_info *ucontrol); 569 struct snd_ctl_elem_info *ucontrol);
570int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
571 unsigned int size, unsigned int __user *tlv);
555int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, 572int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
556 struct snd_ctl_elem_info *uinfo); 573 struct snd_ctl_elem_info *uinfo);
557int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, 574int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
@@ -677,12 +694,17 @@ struct snd_soc_component_driver {
677 int (*of_xlate_dai_name)(struct snd_soc_component *component, 694 int (*of_xlate_dai_name)(struct snd_soc_component *component,
678 struct of_phandle_args *args, 695 struct of_phandle_args *args,
679 const char **dai_name); 696 const char **dai_name);
697 void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
698 int subseq);
699 int (*stream_event)(struct snd_soc_component *, int event);
680}; 700};
681 701
682struct snd_soc_component { 702struct snd_soc_component {
683 const char *name; 703 const char *name;
684 int id; 704 int id;
705 const char *name_prefix;
685 struct device *dev; 706 struct device *dev;
707 struct snd_soc_card *card;
686 708
687 unsigned int active; 709 unsigned int active;
688 710
@@ -705,18 +727,18 @@ struct snd_soc_component {
705 int val_bytes; 727 int val_bytes;
706 728
707 struct mutex io_mutex; 729 struct mutex io_mutex;
730
731 /* Don't use these, use snd_soc_component_get_dapm() */
732 struct snd_soc_dapm_context dapm;
733 struct snd_soc_dapm_context *dapm_ptr;
708}; 734};
709 735
710/* SoC Audio Codec device */ 736/* SoC Audio Codec device */
711struct snd_soc_codec { 737struct snd_soc_codec {
712 const char *name;
713 const char *name_prefix;
714 int id;
715 struct device *dev; 738 struct device *dev;
716 const struct snd_soc_codec_driver *driver; 739 const struct snd_soc_codec_driver *driver;
717 740
718 struct mutex mutex; 741 struct mutex mutex;
719 struct snd_soc_card *card;
720 struct list_head list; 742 struct list_head list;
721 struct list_head card_list; 743 struct list_head card_list;
722 744
@@ -790,9 +812,6 @@ struct snd_soc_codec_driver {
790 void (*seq_notifier)(struct snd_soc_dapm_context *, 812 void (*seq_notifier)(struct snd_soc_dapm_context *,
791 enum snd_soc_dapm_type, int); 813 enum snd_soc_dapm_type, int);
792 814
793 /* codec stream completion event */
794 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
795
796 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ 815 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
797 816
798 /* probe ordering - for components with runtime dependencies */ 817 /* probe ordering - for components with runtime dependencies */
@@ -834,9 +853,6 @@ struct snd_soc_platform_driver {
834 /* platform stream compress ops */ 853 /* platform stream compress ops */
835 const struct snd_compr_ops *compr_ops; 854 const struct snd_compr_ops *compr_ops;
836 855
837 /* platform stream completion event */
838 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
839
840 /* probe ordering - for components with runtime dependencies */ 856 /* probe ordering - for components with runtime dependencies */
841 int probe_order; 857 int probe_order;
842 int remove_order; 858 int remove_order;
@@ -847,23 +863,23 @@ struct snd_soc_platform_driver {
847 int (*bespoke_trigger)(struct snd_pcm_substream *, int); 863 int (*bespoke_trigger)(struct snd_pcm_substream *, int);
848}; 864};
849 865
850struct snd_soc_platform { 866struct snd_soc_dai_link_component {
851 const char *name; 867 const char *name;
852 int id; 868 const struct device_node *of_node;
869 const char *dai_name;
870};
871
872struct snd_soc_platform {
853 struct device *dev; 873 struct device *dev;
854 const struct snd_soc_platform_driver *driver; 874 const struct snd_soc_platform_driver *driver;
855 875
856 unsigned int suspended:1; /* platform is suspended */ 876 unsigned int suspended:1; /* platform is suspended */
857 unsigned int probed:1; 877 unsigned int probed:1;
858 878
859 struct snd_soc_card *card;
860 struct list_head list; 879 struct list_head list;
861 struct list_head card_list;
862 880
863 struct snd_soc_component component; 881 struct snd_soc_component component;
864 882
865 struct snd_soc_dapm_context dapm;
866
867#ifdef CONFIG_DEBUG_FS 883#ifdef CONFIG_DEBUG_FS
868 struct dentry *debugfs_platform_root; 884 struct dentry *debugfs_platform_root;
869#endif 885#endif
@@ -896,6 +912,10 @@ struct snd_soc_dai_link {
896 const struct device_node *codec_of_node; 912 const struct device_node *codec_of_node;
897 /* You MUST specify the DAI name within the codec */ 913 /* You MUST specify the DAI name within the codec */
898 const char *codec_dai_name; 914 const char *codec_dai_name;
915
916 struct snd_soc_dai_link_component *codecs;
917 unsigned int num_codecs;
918
899 /* 919 /*
900 * You MAY specify the link's platform/PCM/DMA driver, either by 920 * You MAY specify the link's platform/PCM/DMA driver, either by
901 * device name, or by DT/OF node, but not both. Some forms of link 921 * device name, or by DT/OF node, but not both. Some forms of link
@@ -1047,7 +1067,6 @@ struct snd_soc_card {
1047 1067
1048 /* lists of probed devices belonging to this card */ 1068 /* lists of probed devices belonging to this card */
1049 struct list_head codec_dev_list; 1069 struct list_head codec_dev_list;
1050 struct list_head platform_dev_list;
1051 1070
1052 struct list_head widgets; 1071 struct list_head widgets;
1053 struct list_head paths; 1072 struct list_head paths;
@@ -1094,6 +1113,9 @@ struct snd_soc_pcm_runtime {
1094 struct snd_soc_dai *codec_dai; 1113 struct snd_soc_dai *codec_dai;
1095 struct snd_soc_dai *cpu_dai; 1114 struct snd_soc_dai *cpu_dai;
1096 1115
1116 struct snd_soc_dai **codec_dais;
1117 unsigned int num_codecs;
1118
1097 struct delayed_work delayed_work; 1119 struct delayed_work delayed_work;
1098#ifdef CONFIG_DEBUG_FS 1120#ifdef CONFIG_DEBUG_FS
1099 struct dentry *debugfs_dpcm_root; 1121 struct dentry *debugfs_dpcm_root;
@@ -1119,6 +1141,9 @@ struct soc_bytes {
1119 1141
1120struct soc_bytes_ext { 1142struct soc_bytes_ext {
1121 int max; 1143 int max;
1144 /* used for TLV byte control */
1145 int (*get)(unsigned int __user *bytes, unsigned int size);
1146 int (*put)(const unsigned int __user *bytes, unsigned int size);
1122}; 1147};
1123 1148
1124/* multi register control */ 1149/* multi register control */
@@ -1165,6 +1190,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
1165} 1190}
1166 1191
1167/** 1192/**
1193 * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
1194 * embedded in
1195 * @dapm: The DAPM context to cast to the component
1196 *
1197 * This function must only be used on DAPM contexts that are known to be part of
1198 * a component (e.g. in a component driver). Otherwise the behavior is
1199 * undefined.
1200 */
1201static inline struct snd_soc_component *snd_soc_dapm_to_component(
1202 struct snd_soc_dapm_context *dapm)
1203{
1204 return container_of(dapm, struct snd_soc_component, dapm);
1205}
1206
1207/**
1168 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in 1208 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
1169 * @dapm: The DAPM context to cast to the CODEC 1209 * @dapm: The DAPM context to cast to the CODEC
1170 * 1210 *
@@ -1188,7 +1228,18 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
1188static inline struct snd_soc_platform *snd_soc_dapm_to_platform( 1228static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
1189 struct snd_soc_dapm_context *dapm) 1229 struct snd_soc_dapm_context *dapm)
1190{ 1230{
1191 return container_of(dapm, struct snd_soc_platform, dapm); 1231 return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm));
1232}
1233
1234/**
1235 * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
1236 * component
1237 * @component: The component for which to get the DAPM context
1238 */
1239static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1240 struct snd_soc_component *component)
1241{
1242 return component->dapm_ptr;
1192} 1243}
1193 1244
1194/* codec IO */ 1245/* codec IO */
@@ -1261,7 +1312,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
1261static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 1312static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
1262{ 1313{
1263 INIT_LIST_HEAD(&card->codec_dev_list); 1314 INIT_LIST_HEAD(&card->codec_dev_list);
1264 INIT_LIST_HEAD(&card->platform_dev_list);
1265 INIT_LIST_HEAD(&card->widgets); 1315 INIT_LIST_HEAD(&card->widgets);
1266 INIT_LIST_HEAD(&card->paths); 1316 INIT_LIST_HEAD(&card->paths);
1267 INIT_LIST_HEAD(&card->dapm_list); 1317 INIT_LIST_HEAD(&card->dapm_list);
diff --git a/include/sound/tas2552-plat.h b/include/sound/tas2552-plat.h
new file mode 100644
index 000000000000..65e7627ba38e
--- /dev/null
+++ b/include/sound/tas2552-plat.h
@@ -0,0 +1,25 @@
1/*
2 * TAS2552 driver platform header
3 *
4 * Copyright (C) 2014 Texas Instruments Inc.
5 *
6 * Author: Dan Murphy <dmurphy@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
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#ifndef TAS2552_PLAT_H
19#define TAS2552_PLAT_H
20
21struct tas2552_platform_data {
22 int enable_gpio;
23};
24
25#endif
diff --git a/include/sound/wm8962.h b/include/sound/wm8962.h
index 79e6d427b858..0af7c1674cbf 100644
--- a/include/sound/wm8962.h
+++ b/include/sound/wm8962.h
@@ -37,6 +37,7 @@
37#define WM8962_GPIO_FN_MICSCD 22 37#define WM8962_GPIO_FN_MICSCD 22
38 38
39struct wm8962_pdata { 39struct wm8962_pdata {
40 struct clk *mclk;
40 int gpio_base; 41 int gpio_base;
41 u32 gpio_init[WM8962_MAX_GPIO]; 42 u32 gpio_init[WM8962_MAX_GPIO];
42 43
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index c75c795a377b..0194a641e4e2 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -296,17 +296,17 @@ TRACE_EVENT(snd_soc_cache_sync,
296 TP_ARGS(codec, type, status), 296 TP_ARGS(codec, type, status),
297 297
298 TP_STRUCT__entry( 298 TP_STRUCT__entry(
299 __string( name, codec->name ) 299 __string( name, codec->component.name)
300 __string( status, status ) 300 __string( status, status )
301 __string( type, type ) 301 __string( type, type )
302 __field( int, id ) 302 __field( int, id )
303 ), 303 ),
304 304
305 TP_fast_assign( 305 TP_fast_assign(
306 __assign_str(name, codec->name); 306 __assign_str(name, codec->component.name);
307 __assign_str(status, status); 307 __assign_str(status, status);
308 __assign_str(type, type); 308 __assign_str(type, type);
309 __entry->id = codec->id; 309 __entry->id = codec->component.id;
310 ), 310 ),
311 311
312 TP_printk("codec=%s.%d type=%s status=%s", __get_str(name), 312 TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index c9c3c044b32f..981acf74b14f 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -148,11 +148,13 @@ TRACE_EVENT(bcache_read,
148); 148);
149 149
150TRACE_EVENT(bcache_write, 150TRACE_EVENT(bcache_write,
151 TP_PROTO(struct bio *bio, bool writeback, bool bypass), 151 TP_PROTO(struct cache_set *c, u64 inode, struct bio *bio,
152 TP_ARGS(bio, writeback, bypass), 152 bool writeback, bool bypass),
153 TP_ARGS(c, inode, bio, writeback, bypass),
153 154
154 TP_STRUCT__entry( 155 TP_STRUCT__entry(
155 __field(dev_t, dev ) 156 __array(char, uuid, 16 )
157 __field(u64, inode )
156 __field(sector_t, sector ) 158 __field(sector_t, sector )
157 __field(unsigned int, nr_sector ) 159 __field(unsigned int, nr_sector )
158 __array(char, rwbs, 6 ) 160 __array(char, rwbs, 6 )
@@ -161,7 +163,8 @@ TRACE_EVENT(bcache_write,
161 ), 163 ),
162 164
163 TP_fast_assign( 165 TP_fast_assign(
164 __entry->dev = bio->bi_bdev->bd_dev; 166 memcpy(__entry->uuid, c->sb.set_uuid, 16);
167 __entry->inode = inode;
165 __entry->sector = bio->bi_iter.bi_sector; 168 __entry->sector = bio->bi_iter.bi_sector;
166 __entry->nr_sector = bio->bi_iter.bi_size >> 9; 169 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
167 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size); 170 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
@@ -169,8 +172,8 @@ TRACE_EVENT(bcache_write,
169 __entry->bypass = bypass; 172 __entry->bypass = bypass;
170 ), 173 ),
171 174
172 TP_printk("%d,%d %s %llu + %u hit %u bypass %u", 175 TP_printk("%pU inode %llu %s %llu + %u hit %u bypass %u",
173 MAJOR(__entry->dev), MINOR(__entry->dev), 176 __entry->uuid, __entry->inode,
174 __entry->rwbs, (unsigned long long)__entry->sector, 177 __entry->rwbs, (unsigned long long)__entry->sector,
175 __entry->nr_sector, __entry->writeback, __entry->bypass) 178 __entry->nr_sector, __entry->writeback, __entry->bypass)
176); 179);
@@ -258,9 +261,9 @@ DEFINE_EVENT(btree_node, bcache_btree_node_alloc,
258 TP_ARGS(b) 261 TP_ARGS(b)
259); 262);
260 263
261DEFINE_EVENT(btree_node, bcache_btree_node_alloc_fail, 264DEFINE_EVENT(cache_set, bcache_btree_node_alloc_fail,
262 TP_PROTO(struct btree *b), 265 TP_PROTO(struct cache_set *c),
263 TP_ARGS(b) 266 TP_ARGS(c)
264); 267);
265 268
266DEFINE_EVENT(btree_node, bcache_btree_node_free, 269DEFINE_EVENT(btree_node, bcache_btree_node_free,
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index b983990b4a9f..d06d44363fea 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -587,6 +587,69 @@ TRACE_EVENT(f2fs_fallocate,
587 __entry->ret) 587 __entry->ret)
588); 588);
589 589
590TRACE_EVENT(f2fs_direct_IO_enter,
591
592 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
593
594 TP_ARGS(inode, offset, len, rw),
595
596 TP_STRUCT__entry(
597 __field(dev_t, dev)
598 __field(ino_t, ino)
599 __field(loff_t, pos)
600 __field(unsigned long, len)
601 __field(int, rw)
602 ),
603
604 TP_fast_assign(
605 __entry->dev = inode->i_sb->s_dev;
606 __entry->ino = inode->i_ino;
607 __entry->pos = offset;
608 __entry->len = len;
609 __entry->rw = rw;
610 ),
611
612 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
613 show_dev_ino(__entry),
614 __entry->pos,
615 __entry->len,
616 __entry->rw)
617);
618
619TRACE_EVENT(f2fs_direct_IO_exit,
620
621 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
622 int rw, int ret),
623
624 TP_ARGS(inode, offset, len, rw, ret),
625
626 TP_STRUCT__entry(
627 __field(dev_t, dev)
628 __field(ino_t, ino)
629 __field(loff_t, pos)
630 __field(unsigned long, len)
631 __field(int, rw)
632 __field(int, ret)
633 ),
634
635 TP_fast_assign(
636 __entry->dev = inode->i_sb->s_dev;
637 __entry->ino = inode->i_ino;
638 __entry->pos = offset;
639 __entry->len = len;
640 __entry->rw = rw;
641 __entry->ret = ret;
642 ),
643
644 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
645 "rw = %d ret = %d",
646 show_dev_ino(__entry),
647 __entry->pos,
648 __entry->len,
649 __entry->rw,
650 __entry->ret)
651);
652
590TRACE_EVENT(f2fs_reserve_new_block, 653TRACE_EVENT(f2fs_reserve_new_block,
591 654
592 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node), 655 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node),
@@ -926,6 +989,30 @@ TRACE_EVENT(f2fs_issue_discard,
926 (unsigned long long)__entry->blkstart, 989 (unsigned long long)__entry->blkstart,
927 (unsigned long long)__entry->blklen) 990 (unsigned long long)__entry->blklen)
928); 991);
992
993TRACE_EVENT(f2fs_issue_flush,
994
995 TP_PROTO(struct super_block *sb, bool nobarrier, bool flush_merge),
996
997 TP_ARGS(sb, nobarrier, flush_merge),
998
999 TP_STRUCT__entry(
1000 __field(dev_t, dev)
1001 __field(bool, nobarrier)
1002 __field(bool, flush_merge)
1003 ),
1004
1005 TP_fast_assign(
1006 __entry->dev = sb->s_dev;
1007 __entry->nobarrier = nobarrier;
1008 __entry->flush_merge = flush_merge;
1009 ),
1010
1011 TP_printk("dev = (%d,%d), %s %s",
1012 show_dev(__entry),
1013 __entry->nobarrier ? "skip (nobarrier)" : "issue",
1014 __entry->flush_merge ? " with flush_merge" : "")
1015);
929#endif /* _TRACE_F2FS_H */ 1016#endif /* _TRACE_F2FS_H */
930 1017
931 /* This part must be outside protection */ 1018 /* This part must be outside protection */
diff --git a/include/trace/events/fence.h b/include/trace/events/fence.h
new file mode 100644
index 000000000000..98feb1b82896
--- /dev/null
+++ b/include/trace/events/fence.h
@@ -0,0 +1,128 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM fence
3
4#if !defined(_TRACE_FENCE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_FENCE_H
6
7#include <linux/tracepoint.h>
8
9struct fence;
10
11TRACE_EVENT(fence_annotate_wait_on,
12
13 /* fence: the fence waiting on f1, f1: the fence to be waited on. */
14 TP_PROTO(struct fence *fence, struct fence *f1),
15
16 TP_ARGS(fence, f1),
17
18 TP_STRUCT__entry(
19 __string(driver, fence->ops->get_driver_name(fence))
20 __string(timeline, fence->ops->get_driver_name(fence))
21 __field(unsigned int, context)
22 __field(unsigned int, seqno)
23
24 __string(waiting_driver, f1->ops->get_driver_name(f1))
25 __string(waiting_timeline, f1->ops->get_timeline_name(f1))
26 __field(unsigned int, waiting_context)
27 __field(unsigned int, waiting_seqno)
28 ),
29
30 TP_fast_assign(
31 __assign_str(driver, fence->ops->get_driver_name(fence))
32 __assign_str(timeline, fence->ops->get_timeline_name(fence))
33 __entry->context = fence->context;
34 __entry->seqno = fence->seqno;
35
36 __assign_str(waiting_driver, f1->ops->get_driver_name(f1))
37 __assign_str(waiting_timeline, f1->ops->get_timeline_name(f1))
38 __entry->waiting_context = f1->context;
39 __entry->waiting_seqno = f1->seqno;
40
41 ),
42
43 TP_printk("driver=%s timeline=%s context=%u seqno=%u " \
44 "waits on driver=%s timeline=%s context=%u seqno=%u",
45 __get_str(driver), __get_str(timeline), __entry->context,
46 __entry->seqno,
47 __get_str(waiting_driver), __get_str(waiting_timeline),
48 __entry->waiting_context, __entry->waiting_seqno)
49);
50
51DECLARE_EVENT_CLASS(fence,
52
53 TP_PROTO(struct fence *fence),
54
55 TP_ARGS(fence),
56
57 TP_STRUCT__entry(
58 __string(driver, fence->ops->get_driver_name(fence))
59 __string(timeline, fence->ops->get_timeline_name(fence))
60 __field(unsigned int, context)
61 __field(unsigned int, seqno)
62 ),
63
64 TP_fast_assign(
65 __assign_str(driver, fence->ops->get_driver_name(fence))
66 __assign_str(timeline, fence->ops->get_timeline_name(fence))
67 __entry->context = fence->context;
68 __entry->seqno = fence->seqno;
69 ),
70
71 TP_printk("driver=%s timeline=%s context=%u seqno=%u",
72 __get_str(driver), __get_str(timeline), __entry->context,
73 __entry->seqno)
74);
75
76DEFINE_EVENT(fence, fence_emit,
77
78 TP_PROTO(struct fence *fence),
79
80 TP_ARGS(fence)
81);
82
83DEFINE_EVENT(fence, fence_init,
84
85 TP_PROTO(struct fence *fence),
86
87 TP_ARGS(fence)
88);
89
90DEFINE_EVENT(fence, fence_destroy,
91
92 TP_PROTO(struct fence *fence),
93
94 TP_ARGS(fence)
95);
96
97DEFINE_EVENT(fence, fence_enable_signal,
98
99 TP_PROTO(struct fence *fence),
100
101 TP_ARGS(fence)
102);
103
104DEFINE_EVENT(fence, fence_signaled,
105
106 TP_PROTO(struct fence *fence),
107
108 TP_ARGS(fence)
109);
110
111DEFINE_EVENT(fence, fence_wait_start,
112
113 TP_PROTO(struct fence *fence),
114
115 TP_ARGS(fence)
116);
117
118DEFINE_EVENT(fence, fence_wait_end,
119
120 TP_PROTO(struct fence *fence),
121
122 TP_ARGS(fence)
123);
124
125#endif /* _TRACE_FENCE_H */
126
127/* This part must be outside protection */
128#include <trace/define_trace.h>
diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h
new file mode 100644
index 000000000000..834a7362a610
--- /dev/null
+++ b/include/trace/events/ipi.h
@@ -0,0 +1,89 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM ipi
3
4#if !defined(_TRACE_IPI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_IPI_H
6
7#include <linux/tracepoint.h>
8
9/**
10 * ipi_raise - called when a smp cross call is made
11 *
12 * @mask: mask of recipient CPUs for the IPI
13 * @reason: string identifying the IPI purpose
14 *
15 * It is necessary for @reason to be a static string declared with
16 * __tracepoint_string.
17 */
18TRACE_EVENT(ipi_raise,
19
20 TP_PROTO(const struct cpumask *mask, const char *reason),
21
22 TP_ARGS(mask, reason),
23
24 TP_STRUCT__entry(
25 __bitmask(target_cpus, nr_cpumask_bits)
26 __field(const char *, reason)
27 ),
28
29 TP_fast_assign(
30 __assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits);
31 __entry->reason = reason;
32 ),
33
34 TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
35);
36
37DECLARE_EVENT_CLASS(ipi_handler,
38
39 TP_PROTO(const char *reason),
40
41 TP_ARGS(reason),
42
43 TP_STRUCT__entry(
44 __field(const char *, reason)
45 ),
46
47 TP_fast_assign(
48 __entry->reason = reason;
49 ),
50
51 TP_printk("(%s)", __entry->reason)
52);
53
54/**
55 * ipi_entry - called immediately before the IPI handler
56 *
57 * @reason: string identifying the IPI purpose
58 *
59 * It is necessary for @reason to be a static string declared with
60 * __tracepoint_string, ideally the same as used with trace_ipi_raise
61 * for that IPI.
62 */
63DEFINE_EVENT(ipi_handler, ipi_entry,
64
65 TP_PROTO(const char *reason),
66
67 TP_ARGS(reason)
68);
69
70/**
71 * ipi_exit - called immediately after the IPI handler returns
72 *
73 * @reason: string identifying the IPI purpose
74 *
75 * It is necessary for @reason to be a static string declared with
76 * __tracepoint_string, ideally the same as used with trace_ipi_raise for
77 * that IPI.
78 */
79DEFINE_EVENT(ipi_handler, ipi_exit,
80
81 TP_PROTO(const char *reason),
82
83 TP_ARGS(reason)
84);
85
86#endif /* _TRACE_IPI_H */
87
88/* This part must be outside protection */
89#include <trace/define_trace.h>
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 131a0bda7aec..908925ace776 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(CONFIG_HAVE_KVM_IRQCHIP) 40#if defined(CONFIG_HAVE_KVM_IRQFD)
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),
@@ -57,7 +57,7 @@ TRACE_EVENT(kvm_set_irq,
57 TP_printk("gsi %u level %d source %d", 57 TP_printk("gsi %u level %d source %d",
58 __entry->gsi, __entry->level, __entry->irq_source_id) 58 __entry->gsi, __entry->level, __entry->irq_source_id)
59); 59);
60#endif 60#endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
61 61
62#if defined(__KVM_HAVE_IOAPIC) 62#if defined(__KVM_HAVE_IOAPIC)
63#define kvm_deliver_mode \ 63#define kvm_deliver_mode \
@@ -124,7 +124,7 @@ TRACE_EVENT(kvm_msi_set_irq,
124 124
125#endif /* defined(__KVM_HAVE_IOAPIC) */ 125#endif /* defined(__KVM_HAVE_IOAPIC) */
126 126
127#if defined(CONFIG_HAVE_KVM_IRQCHIP) 127#if defined(CONFIG_HAVE_KVM_IRQFD)
128 128
129TRACE_EVENT(kvm_ack_irq, 129TRACE_EVENT(kvm_ack_irq,
130 TP_PROTO(unsigned int irqchip, unsigned int pin), 130 TP_PROTO(unsigned int irqchip, unsigned int pin),
@@ -149,7 +149,7 @@ TRACE_EVENT(kvm_ack_irq,
149#endif 149#endif
150); 150);
151 151
152#endif /* defined(CONFIG_HAVE_KVM_IRQCHIP) */ 152#endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
153 153
154 154
155 155
diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
index 4e4f2f8b1ac2..dd2b5467d905 100644
--- a/include/trace/events/migrate.h
+++ b/include/trace/events/migrate.h
@@ -17,6 +17,7 @@
17 {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \ 17 {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \
18 {MR_SYSCALL, "syscall_or_cpuset"}, \ 18 {MR_SYSCALL, "syscall_or_cpuset"}, \
19 {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \ 19 {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \
20 {MR_NUMA_MISPLACED, "numa_misplaced"}, \
20 {MR_CMA, "cma"} 21 {MR_CMA, "cma"}
21 22
22TRACE_EVENT(mm_migrate_pages, 23TRACE_EVENT(mm_migrate_pages,
diff --git a/include/trace/events/pagemap.h b/include/trace/events/pagemap.h
index 1c9fabde69e4..ce0803b8d05f 100644
--- a/include/trace/events/pagemap.h
+++ b/include/trace/events/pagemap.h
@@ -28,12 +28,10 @@ TRACE_EVENT(mm_lru_insertion,
28 28
29 TP_PROTO( 29 TP_PROTO(
30 struct page *page, 30 struct page *page,
31 unsigned long pfn, 31 int lru
32 int lru,
33 unsigned long flags
34 ), 32 ),
35 33
36 TP_ARGS(page, pfn, lru, flags), 34 TP_ARGS(page, lru),
37 35
38 TP_STRUCT__entry( 36 TP_STRUCT__entry(
39 __field(struct page *, page ) 37 __field(struct page *, page )
@@ -44,9 +42,9 @@ TRACE_EVENT(mm_lru_insertion,
44 42
45 TP_fast_assign( 43 TP_fast_assign(
46 __entry->page = page; 44 __entry->page = page;
47 __entry->pfn = pfn; 45 __entry->pfn = page_to_pfn(page);
48 __entry->lru = lru; 46 __entry->lru = lru;
49 __entry->flags = flags; 47 __entry->flags = trace_pagemap_flags(page);
50 ), 48 ),
51 49
52 /* Flag format is based on page-types.c formatting for pagemap */ 50 /* Flag format is based on page-types.c formatting for pagemap */
@@ -64,9 +62,9 @@ TRACE_EVENT(mm_lru_insertion,
64 62
65TRACE_EVENT(mm_lru_activate, 63TRACE_EVENT(mm_lru_activate,
66 64
67 TP_PROTO(struct page *page, unsigned long pfn), 65 TP_PROTO(struct page *page),
68 66
69 TP_ARGS(page, pfn), 67 TP_ARGS(page),
70 68
71 TP_STRUCT__entry( 69 TP_STRUCT__entry(
72 __field(struct page *, page ) 70 __field(struct page *, page )
@@ -75,7 +73,7 @@ TRACE_EVENT(mm_lru_activate,
75 73
76 TP_fast_assign( 74 TP_fast_assign(
77 __entry->page = page; 75 __entry->page = page;
78 __entry->pfn = pfn; 76 __entry->pfn = page_to_pfn(page);
79 ), 77 ),
80 78
81 /* Flag format is based on page-types.c formatting for pagemap */ 79 /* Flag format is based on page-types.c formatting for pagemap */
diff --git a/include/trace/events/ras.h b/include/trace/events/ras.h
deleted file mode 100644
index 1c875ad1ee5f..000000000000
--- a/include/trace/events/ras.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM ras
3
4#if !defined(_TRACE_AER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_AER_H
6
7#include <linux/tracepoint.h>
8#include <linux/aer.h>
9
10
11/*
12 * PCIe AER Trace event
13 *
14 * These events are generated when hardware detects a corrected or
15 * uncorrected event on a PCIe device. The event report has
16 * the following structure:
17 *
18 * char * dev_name - The name of the slot where the device resides
19 * ([domain:]bus:device.function).
20 * u32 status - Either the correctable or uncorrectable register
21 * indicating what error or errors have been seen
22 * u8 severity - error severity 0:NONFATAL 1:FATAL 2:CORRECTED
23 */
24
25#define aer_correctable_errors \
26 {BIT(0), "Receiver Error"}, \
27 {BIT(6), "Bad TLP"}, \
28 {BIT(7), "Bad DLLP"}, \
29 {BIT(8), "RELAY_NUM Rollover"}, \
30 {BIT(12), "Replay Timer Timeout"}, \
31 {BIT(13), "Advisory Non-Fatal"}
32
33#define aer_uncorrectable_errors \
34 {BIT(4), "Data Link Protocol"}, \
35 {BIT(12), "Poisoned TLP"}, \
36 {BIT(13), "Flow Control Protocol"}, \
37 {BIT(14), "Completion Timeout"}, \
38 {BIT(15), "Completer Abort"}, \
39 {BIT(16), "Unexpected Completion"}, \
40 {BIT(17), "Receiver Overflow"}, \
41 {BIT(18), "Malformed TLP"}, \
42 {BIT(19), "ECRC"}, \
43 {BIT(20), "Unsupported Request"}
44
45TRACE_EVENT(aer_event,
46 TP_PROTO(const char *dev_name,
47 const u32 status,
48 const u8 severity),
49
50 TP_ARGS(dev_name, status, severity),
51
52 TP_STRUCT__entry(
53 __string( dev_name, dev_name )
54 __field( u32, status )
55 __field( u8, severity )
56 ),
57
58 TP_fast_assign(
59 __assign_str(dev_name, dev_name);
60 __entry->status = status;
61 __entry->severity = severity;
62 ),
63
64 TP_printk("%s PCIe Bus Error: severity=%s, %s\n",
65 __get_str(dev_name),
66 __entry->severity == AER_CORRECTABLE ? "Corrected" :
67 __entry->severity == AER_FATAL ?
68 "Fatal" : "Uncorrected, non-fatal",
69 __entry->severity == AER_CORRECTABLE ?
70 __print_flags(__entry->status, "|", aer_correctable_errors) :
71 __print_flags(__entry->status, "|", aer_uncorrectable_errors))
72);
73
74#endif /* _TRACE_AER_H */
75
76/* This part must be outside protection */
77#include <trace/define_trace.h>
diff --git a/include/trace/events/thp.h b/include/trace/events/thp.h
new file mode 100644
index 000000000000..b59b065e9e5d
--- /dev/null
+++ b/include/trace/events/thp.h
@@ -0,0 +1,88 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM thp
3
4#if !defined(_TRACE_THP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_THP_H
6
7#include <linux/types.h>
8#include <linux/tracepoint.h>
9
10TRACE_EVENT(hugepage_invalidate,
11
12 TP_PROTO(unsigned long addr, unsigned long pte),
13 TP_ARGS(addr, pte),
14 TP_STRUCT__entry(
15 __field(unsigned long, addr)
16 __field(unsigned long, pte)
17 ),
18
19 TP_fast_assign(
20 __entry->addr = addr;
21 __entry->pte = pte;
22 ),
23
24 TP_printk("hugepage invalidate at addr 0x%lx and pte = 0x%lx",
25 __entry->addr, __entry->pte)
26);
27
28TRACE_EVENT(hugepage_set_pmd,
29
30 TP_PROTO(unsigned long addr, unsigned long pmd),
31 TP_ARGS(addr, pmd),
32 TP_STRUCT__entry(
33 __field(unsigned long, addr)
34 __field(unsigned long, pmd)
35 ),
36
37 TP_fast_assign(
38 __entry->addr = addr;
39 __entry->pmd = pmd;
40 ),
41
42 TP_printk("Set pmd with 0x%lx with 0x%lx", __entry->addr, __entry->pmd)
43);
44
45
46TRACE_EVENT(hugepage_update,
47
48 TP_PROTO(unsigned long addr, unsigned long pte, unsigned long clr, unsigned long set),
49 TP_ARGS(addr, pte, clr, set),
50 TP_STRUCT__entry(
51 __field(unsigned long, addr)
52 __field(unsigned long, pte)
53 __field(unsigned long, clr)
54 __field(unsigned long, set)
55 ),
56
57 TP_fast_assign(
58 __entry->addr = addr;
59 __entry->pte = pte;
60 __entry->clr = clr;
61 __entry->set = set;
62
63 ),
64
65 TP_printk("hugepage update at addr 0x%lx and pte = 0x%lx clr = 0x%lx, set = 0x%lx", __entry->addr, __entry->pte, __entry->clr, __entry->set)
66);
67TRACE_EVENT(hugepage_splitting,
68
69 TP_PROTO(unsigned long addr, unsigned long pte),
70 TP_ARGS(addr, pte),
71 TP_STRUCT__entry(
72 __field(unsigned long, addr)
73 __field(unsigned long, pte)
74 ),
75
76 TP_fast_assign(
77 __entry->addr = addr;
78 __entry->pte = pte;
79 ),
80
81 TP_printk("hugepage splitting at addr 0x%lx and pte = 0x%lx",
82 __entry->addr, __entry->pte)
83);
84
85#endif /* _TRACE_THP_H */
86
87/* This part must be outside protection */
88#include <trace/define_trace.h>
diff --git a/include/trace/events/tlb.h b/include/trace/events/tlb.h
new file mode 100644
index 000000000000..13391d288107
--- /dev/null
+++ b/include/trace/events/tlb.h
@@ -0,0 +1,40 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM tlb
3
4#if !defined(_TRACE_TLB_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TLB_H
6
7#include <linux/mm_types.h>
8#include <linux/tracepoint.h>
9
10#define TLB_FLUSH_REASON \
11 { TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" }, \
12 { TLB_REMOTE_SHOOTDOWN, "remote shootdown" }, \
13 { TLB_LOCAL_SHOOTDOWN, "local shootdown" }, \
14 { TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" }
15
16TRACE_EVENT(tlb_flush,
17
18 TP_PROTO(int reason, unsigned long pages),
19 TP_ARGS(reason, pages),
20
21 TP_STRUCT__entry(
22 __field( int, reason)
23 __field(unsigned long, pages)
24 ),
25
26 TP_fast_assign(
27 __entry->reason = reason;
28 __entry->pages = pages;
29 ),
30
31 TP_printk("pages:%ld reason:%s (%d)",
32 __entry->pages,
33 __print_symbolic(__entry->reason, TLB_FLUSH_REASON),
34 __entry->reason)
35);
36
37#endif /* _TRACE_TLB_H */
38
39/* This part must be outside protection */
40#include <trace/define_trace.h>
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 333640608087..f1afd607f043 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -699,9 +699,13 @@ __SYSCALL(__NR_sched_setattr, sys_sched_setattr)
699__SYSCALL(__NR_sched_getattr, sys_sched_getattr) 699__SYSCALL(__NR_sched_getattr, sys_sched_getattr)
700#define __NR_renameat2 276 700#define __NR_renameat2 276
701__SYSCALL(__NR_renameat2, sys_renameat2) 701__SYSCALL(__NR_renameat2, sys_renameat2)
702#define __NR_seccomp 277
703__SYSCALL(__NR_seccomp, sys_seccomp)
704#define __NR_getrandom 278
705__SYSCALL(__NR_getrandom, sys_getrandom)
702 706
703#undef __NR_syscalls 707#undef __NR_syscalls
704#define __NR_syscalls 277 708#define __NR_syscalls 279
705 709
706/* 710/*
707 * All syscalls below here should go away really, 711 * All syscalls below here should go away really,
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 9abbeb924cbb..b0b855613641 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -780,7 +780,7 @@ struct drm_prime_handle {
780 780
781/** 781/**
782 * Device specific ioctls should only be in their respective headers 782 * Device specific ioctls should only be in their respective headers
783 * The device specific ioctl range is from 0x40 to 0x99. 783 * The device specific ioctl range is from 0x40 to 0x9f.
784 * Generic IOCTLS restart at 0xA0. 784 * Generic IOCTLS restart at 0xA0.
785 * 785 *
786 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 786 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index def54f9e07ca..a0db2d4aa5f0 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -88,6 +88,11 @@
88#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ 88#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */
89#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ 89#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */
90 90
91/* Picture aspect ratio options */
92#define DRM_MODE_PICTURE_ASPECT_NONE 0
93#define DRM_MODE_PICTURE_ASPECT_4_3 1
94#define DRM_MODE_PICTURE_ASPECT_16_9 2
95
91/* Dithering mode options */ 96/* Dithering mode options */
92#define DRM_MODE_DITHERING_OFF 0 97#define DRM_MODE_DITHERING_OFF 0
93#define DRM_MODE_DITHERING_ON 1 98#define DRM_MODE_DITHERING_ON 1
diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
index 2a5769fdf8ba..0d7608dc1a34 100644
--- a/include/uapi/drm/nouveau_drm.h
+++ b/include/uapi/drm/nouveau_drm.h
@@ -25,6 +25,16 @@
25#ifndef __NOUVEAU_DRM_H__ 25#ifndef __NOUVEAU_DRM_H__
26#define __NOUVEAU_DRM_H__ 26#define __NOUVEAU_DRM_H__
27 27
28#define DRM_NOUVEAU_EVENT_NVIF 0x80000000
29
30/* reserved object handles when using deprecated object APIs - these
31 * are here so that libdrm can allow interoperability with the new
32 * object APIs
33 */
34#define NOUVEAU_ABI16_CLIENT 0xffffffff
35#define NOUVEAU_ABI16_DEVICE 0xdddddddd
36#define NOUVEAU_ABI16_CHAN(n) (0xcccc0000 | (n))
37
28#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) 38#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
29#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) 39#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
30#define NOUVEAU_GEM_DOMAIN_GART (1 << 2) 40#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
@@ -123,6 +133,7 @@ struct drm_nouveau_gem_cpu_fini {
123#define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */ 133#define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */
124#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */ 134#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */
125#define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */ 135#define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */
136#define DRM_NOUVEAU_NVIF 0x07
126#define DRM_NOUVEAU_GEM_NEW 0x40 137#define DRM_NOUVEAU_GEM_NEW 0x40
127#define DRM_NOUVEAU_GEM_PUSHBUF 0x41 138#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
128#define DRM_NOUVEAU_GEM_CPU_PREP 0x42 139#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index 1cc0b610f162..509b2d7a41b7 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -796,7 +796,9 @@ struct drm_radeon_gem_info {
796 uint64_t vram_visible; 796 uint64_t vram_visible;
797}; 797};
798 798
799#define RADEON_GEM_NO_BACKING_STORE 1 799#define RADEON_GEM_NO_BACKING_STORE (1 << 0)
800#define RADEON_GEM_GTT_UC (1 << 1)
801#define RADEON_GEM_GTT_WC (1 << 2)
800 802
801struct drm_radeon_gem_create { 803struct drm_radeon_gem_create {
802 uint64_t size; 804 uint64_t size;
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index b75482112428..c15d781ecc0f 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -129,6 +129,44 @@ struct drm_tegra_submit {
129 __u32 reserved[5]; /* future expansion */ 129 __u32 reserved[5]; /* future expansion */
130}; 130};
131 131
132#define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
133#define DRM_TEGRA_GEM_TILING_MODE_TILED 1
134#define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
135
136struct drm_tegra_gem_set_tiling {
137 /* input */
138 __u32 handle;
139 __u32 mode;
140 __u32 value;
141 __u32 pad;
142};
143
144struct drm_tegra_gem_get_tiling {
145 /* input */
146 __u32 handle;
147 /* output */
148 __u32 mode;
149 __u32 value;
150 __u32 pad;
151};
152
153#define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0)
154#define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP)
155
156struct drm_tegra_gem_set_flags {
157 /* input */
158 __u32 handle;
159 /* output */
160 __u32 flags;
161};
162
163struct drm_tegra_gem_get_flags {
164 /* input */
165 __u32 handle;
166 /* output */
167 __u32 flags;
168};
169
132#define DRM_TEGRA_GEM_CREATE 0x00 170#define DRM_TEGRA_GEM_CREATE 0x00
133#define DRM_TEGRA_GEM_MMAP 0x01 171#define DRM_TEGRA_GEM_MMAP 0x01
134#define DRM_TEGRA_SYNCPT_READ 0x02 172#define DRM_TEGRA_SYNCPT_READ 0x02
@@ -139,6 +177,10 @@ struct drm_tegra_submit {
139#define DRM_TEGRA_GET_SYNCPT 0x07 177#define DRM_TEGRA_GET_SYNCPT 0x07
140#define DRM_TEGRA_SUBMIT 0x08 178#define DRM_TEGRA_SUBMIT 0x08
141#define DRM_TEGRA_GET_SYNCPT_BASE 0x09 179#define DRM_TEGRA_GET_SYNCPT_BASE 0x09
180#define DRM_TEGRA_GEM_SET_TILING 0x0a
181#define DRM_TEGRA_GEM_GET_TILING 0x0b
182#define DRM_TEGRA_GEM_SET_FLAGS 0x0c
183#define DRM_TEGRA_GEM_GET_FLAGS 0x0d
142 184
143#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create) 185#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
144#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap) 186#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
@@ -150,5 +192,9 @@ struct drm_tegra_submit {
150#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt) 192#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
151#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit) 193#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
152#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base) 194#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
195#define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
196#define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
197#define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
198#define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
153 199
154#endif 200#endif
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index cf6714752b69..3b9ff33e1768 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -342,6 +342,7 @@ enum {
342#define __AUDIT_ARCH_64BIT 0x80000000 342#define __AUDIT_ARCH_64BIT 0x80000000
343#define __AUDIT_ARCH_LE 0x40000000 343#define __AUDIT_ARCH_LE 0x40000000
344 344
345#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
345#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 346#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
346#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) 347#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
347#define AUDIT_ARCH_ARMEB (EM_ARM) 348#define AUDIT_ARCH_ARMEB (EM_ARM)
diff --git a/include/uapi/linux/bsg.h b/include/uapi/linux/bsg.h
index 7a12e1c0f371..02986cf8b6f1 100644
--- a/include/uapi/linux/bsg.h
+++ b/include/uapi/linux/bsg.h
@@ -10,12 +10,13 @@
10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
11 11
12/* 12/*
13 * For flags member below 13 * For flag constants below:
14 * sg.h sg_io_hdr also has bits defined for it's flags member. However 14 * sg.h sg_io_hdr also has bits defined for it's flags member. These
15 * none of these bits are implemented/used by bsg. The bits below are 15 * two flag values (0x10 and 0x20) have the same meaning in sg.h . For
16 * allocated to not conflict with sg.h ones anyway. 16 * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult.
17 */ 17 */
18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */ 18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */
19#define BSG_FLAG_Q_AT_HEAD 0x20
19 20
20struct sg_io_v4 { 21struct sg_io_v4 {
21 __s32 guard; /* [i] 'Q' to differentiate from v3 */ 22 __s32 guard; /* [i] 'Q' to differentiate from v3 */
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index 813d11f54977..3e4323a3918d 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -92,11 +92,12 @@ struct can_ctrlmode {
92}; 92};
93 93
94#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ 94#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */
95#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ 95#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */
96#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ 96#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
97#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ 97#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
98#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ 98#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
99#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ 99#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */
100#define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */
100 101
101/* 102/*
102 * CAN device statistics 103 * CAN device statistics
diff --git a/include/uapi/linux/dcbnl.h b/include/uapi/linux/dcbnl.h
index 6bb43382f3f3..e711f20dc522 100644
--- a/include/uapi/linux/dcbnl.h
+++ b/include/uapi/linux/dcbnl.h
@@ -148,7 +148,8 @@ struct cee_pfc {
148 * 148 *
149 * @selector: protocol identifier type 149 * @selector: protocol identifier type
150 * @protocol: protocol of type indicated 150 * @protocol: protocol of type indicated
151 * @priority: 3-bit unsigned integer indicating priority 151 * @priority: 3-bit unsigned integer indicating priority for IEEE
152 * 8-bit 802.1p user priority bitmap for CEE
152 * 153 *
153 * ---- 154 * ----
154 * Selector field values 155 * Selector field values
diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
index aacd4fb7102a..07bdce1f444a 100644
--- a/include/uapi/linux/errqueue.h
+++ b/include/uapi/linux/errqueue.h
@@ -22,5 +22,25 @@ struct sock_extended_err {
22 22
23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
24 24
25/**
26 * struct scm_timestamping - timestamps exposed through cmsg
27 *
28 * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
29 * communicate network timestamps by passing this struct in a cmsg with
30 * recvmsg(). See Documentation/networking/timestamping.txt for details.
31 */
32struct scm_timestamping {
33 struct timespec ts[3];
34};
35
36/* The type of scm_timestamping, passed in sock_extended_err ee_info.
37 * This defines the type of ts[0]. For SCM_TSTAMP_SND only, if ts[0]
38 * is zero, then this is a hardware timestamp and recorded in ts[2].
39 */
40enum {
41 SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */
42 SCM_TSTAMP_SCHED, /* data entered the packet scheduler */
43 SCM_TSTAMP_ACK, /* data acknowledged by peer */
44};
25 45
26#endif /* _UAPI_LINUX_ERRQUEUE_H */ 46#endif /* _UAPI_LINUX_ERRQUEUE_H */
diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
index 074b886c6be0..beed138bd359 100644
--- a/include/uapi/linux/fcntl.h
+++ b/include/uapi/linux/fcntl.h
@@ -28,6 +28,21 @@
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) 28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29 29
30/* 30/*
31 * Set/Get seals
32 */
33#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
34#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
35
36/*
37 * Types of seals
38 */
39#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
40#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
41#define F_SEAL_GROW 0x0004 /* prevent file from growing */
42#define F_SEAL_WRITE 0x0008 /* prevent writes */
43/* (1U << 31) is reserved for signed error codes */
44
45/*
31 * Types of directory notifications that may be requested. 46 * Types of directory notifications that may be requested.
32 */ 47 */
33#define DN_ACCESS 0x00000001 /* File accessed */ 48#define DN_ACCESS 0x00000001 /* File accessed */
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 40b5ca8a1b1f..25084a052a1e 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -101,6 +101,7 @@
101 * - add FATTR_CTIME 101 * - add FATTR_CTIME
102 * - add ctime and ctimensec to fuse_setattr_in 102 * - add ctime and ctimensec to fuse_setattr_in
103 * - add FUSE_RENAME2 request 103 * - add FUSE_RENAME2 request
104 * - add FUSE_NO_OPEN_SUPPORT flag
104 */ 105 */
105 106
106#ifndef _LINUX_FUSE_H 107#ifndef _LINUX_FUSE_H
@@ -229,6 +230,7 @@ struct fuse_file_lock {
229 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 230 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
230 * FUSE_ASYNC_DIO: asynchronous direct I/O submission 231 * FUSE_ASYNC_DIO: asynchronous direct I/O submission
231 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes 232 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
233 * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
232 */ 234 */
233#define FUSE_ASYNC_READ (1 << 0) 235#define FUSE_ASYNC_READ (1 << 0)
234#define FUSE_POSIX_LOCKS (1 << 1) 236#define FUSE_POSIX_LOCKS (1 << 1)
@@ -247,6 +249,7 @@ struct fuse_file_lock {
247#define FUSE_READDIRPLUS_AUTO (1 << 14) 249#define FUSE_READDIRPLUS_AUTO (1 << 14)
248#define FUSE_ASYNC_DIO (1 << 15) 250#define FUSE_ASYNC_DIO (1 << 15)
249#define FUSE_WRITEBACK_CACHE (1 << 16) 251#define FUSE_WRITEBACK_CACHE (1 << 16)
252#define FUSE_NO_OPEN_SUPPORT (1 << 17)
250 253
251/** 254/**
252 * CUSE INIT request/reply flags 255 * CUSE INIT request/reply flags
diff --git a/include/uapi/linux/genwqe/genwqe_card.h b/include/uapi/linux/genwqe/genwqe_card.h
index 795e957bb840..4fc065f29255 100644
--- a/include/uapi/linux/genwqe/genwqe_card.h
+++ b/include/uapi/linux/genwqe/genwqe_card.h
@@ -328,6 +328,7 @@ enum genwqe_card_state {
328 GENWQE_CARD_UNUSED = 0, 328 GENWQE_CARD_UNUSED = 0,
329 GENWQE_CARD_USED = 1, 329 GENWQE_CARD_USED = 1,
330 GENWQE_CARD_FATAL_ERROR = 2, 330 GENWQE_CARD_FATAL_ERROR = 2,
331 GENWQE_CARD_RELOAD_BITSTREAM = 3,
331 GENWQE_CARD_STATE_MAX, 332 GENWQE_CARD_STATE_MAX,
332}; 333};
333 334
diff --git a/include/uapi/linux/i8k.h b/include/uapi/linux/i8k.h
index 1c45ba505115..133d02f03c25 100644
--- a/include/uapi/linux/i8k.h
+++ b/include/uapi/linux/i8k.h
@@ -34,7 +34,8 @@
34#define I8K_FAN_OFF 0 34#define I8K_FAN_OFF 0
35#define I8K_FAN_LOW 1 35#define I8K_FAN_LOW 1
36#define I8K_FAN_HIGH 2 36#define I8K_FAN_HIGH 2
37#define I8K_FAN_MAX I8K_FAN_HIGH 37#define I8K_FAN_TURBO 3
38#define I8K_FAN_MAX I8K_FAN_TURBO
38 39
39#define I8K_VOL_UP 1 40#define I8K_VOL_UP 1
40#define I8K_VOL_DOWN 2 41#define I8K_VOL_DOWN 2
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b38534895db5..ff957604a721 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -204,11 +204,17 @@ enum {
204 IFLA_INET6_CACHEINFO, /* time values and max reasm size */ 204 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
205 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ 205 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
206 IFLA_INET6_TOKEN, /* device token */ 206 IFLA_INET6_TOKEN, /* device token */
207 IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */
207 __IFLA_INET6_MAX 208 __IFLA_INET6_MAX
208}; 209};
209 210
210#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) 211#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
211 212
213enum in6_addr_gen_mode {
214 IN6_ADDR_GEN_MODE_EUI64,
215 IN6_ADDR_GEN_MODE_NONE,
216};
217
212enum { 218enum {
213 BRIDGE_MODE_UNSPEC, 219 BRIDGE_MODE_UNSPEC,
214 BRIDGE_MODE_HAIRPIN, 220 BRIDGE_MODE_HAIRPIN,
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
index bac27fa05f5b..da2d668b8cf1 100644
--- a/include/uapi/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
@@ -108,7 +108,7 @@ struct tpacket_auxdata {
108 108
109/* Rx and Tx ring - header status */ 109/* Rx and Tx ring - header status */
110#define TP_STATUS_TS_SOFTWARE (1 << 29) 110#define TP_STATUS_TS_SOFTWARE (1 << 29)
111#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) 111#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */
112#define TP_STATUS_TS_RAW_HARDWARE (1 << 31) 112#define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
113 113
114/* Rx ring - feature request bits */ 114/* Rx ring - feature request bits */
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index 0d8e0f0342dc..74a2a1773494 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -261,6 +261,7 @@ struct in6_flowlabel_req {
261 * IP6T_SO_ORIGINAL_DST 80 261 * IP6T_SO_ORIGINAL_DST 80
262 */ 262 */
263 263
264#define IPV6_AUTOFLOWLABEL 70
264/* RFC5014: Source address selection */ 265/* RFC5014: Source address selection */
265#define IPV6_ADDR_PREFERENCES 72 266#define IPV6_ADDR_PREFERENCES 72
266 267
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 593b0e32d956..efa2666f4b8a 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -163,6 +163,7 @@ enum {
163 DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL, 163 DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, 164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
165 DEVCONF_SUPPRESS_FRAG_NDISC, 165 DEVCONF_SUPPRESS_FRAG_NDISC,
166 DEVCONF_ACCEPT_RA_FROM_LOCAL,
166 DEVCONF_MAX 167 DEVCONF_MAX
167}; 168};
168 169
diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h
index d6629d49a243..6925f5b42f89 100644
--- a/include/uapi/linux/kexec.h
+++ b/include/uapi/linux/kexec.h
@@ -13,6 +13,17 @@
13#define KEXEC_PRESERVE_CONTEXT 0x00000002 13#define KEXEC_PRESERVE_CONTEXT 0x00000002
14#define KEXEC_ARCH_MASK 0xffff0000 14#define KEXEC_ARCH_MASK 0xffff0000
15 15
16/*
17 * Kexec file load interface flags.
18 * KEXEC_FILE_UNLOAD : Unload already loaded kexec/kdump image.
19 * KEXEC_FILE_ON_CRASH : Load/unload operation belongs to kdump image.
20 * KEXEC_FILE_NO_INITRAMFS : No initramfs is being loaded. Ignore the initrd
21 * fd field.
22 */
23#define KEXEC_FILE_UNLOAD 0x00000001
24#define KEXEC_FILE_ON_CRASH 0x00000002
25#define KEXEC_FILE_NO_INITRAMFS 0x00000004
26
16/* These values match the ELF architecture values. 27/* These values match the ELF architecture values.
17 * Unless there is a good reason that should continue to be the case. 28 * Unless there is a good reason that should continue to be the case.
18 */ 29 */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index e11d8f170a62..cf3a2ff440e4 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -162,7 +162,7 @@ struct kvm_pit_config {
162#define KVM_EXIT_TPR_ACCESS 12 162#define KVM_EXIT_TPR_ACCESS 12
163#define KVM_EXIT_S390_SIEIC 13 163#define KVM_EXIT_S390_SIEIC 13
164#define KVM_EXIT_S390_RESET 14 164#define KVM_EXIT_S390_RESET 14
165#define KVM_EXIT_DCR 15 165#define KVM_EXIT_DCR 15 /* deprecated */
166#define KVM_EXIT_NMI 16 166#define KVM_EXIT_NMI 16
167#define KVM_EXIT_INTERNAL_ERROR 17 167#define KVM_EXIT_INTERNAL_ERROR 17
168#define KVM_EXIT_OSI 18 168#define KVM_EXIT_OSI 18
@@ -268,7 +268,7 @@ struct kvm_run {
268 __u64 trans_exc_code; 268 __u64 trans_exc_code;
269 __u32 pgm_code; 269 __u32 pgm_code;
270 } s390_ucontrol; 270 } s390_ucontrol;
271 /* KVM_EXIT_DCR */ 271 /* KVM_EXIT_DCR (deprecated) */
272 struct { 272 struct {
273 __u32 dcrn; 273 __u32 dcrn;
274 __u32 data; 274 __u32 data;
@@ -399,13 +399,18 @@ struct kvm_vapic_addr {
399 __u64 vapic_addr; 399 __u64 vapic_addr;
400}; 400};
401 401
402/* for KVM_SET_MPSTATE */ 402/* for KVM_SET_MP_STATE */
403 403
404/* not all states are valid on all architectures */
404#define KVM_MP_STATE_RUNNABLE 0 405#define KVM_MP_STATE_RUNNABLE 0
405#define KVM_MP_STATE_UNINITIALIZED 1 406#define KVM_MP_STATE_UNINITIALIZED 1
406#define KVM_MP_STATE_INIT_RECEIVED 2 407#define KVM_MP_STATE_INIT_RECEIVED 2
407#define KVM_MP_STATE_HALTED 3 408#define KVM_MP_STATE_HALTED 3
408#define KVM_MP_STATE_SIPI_RECEIVED 4 409#define KVM_MP_STATE_SIPI_RECEIVED 4
410#define KVM_MP_STATE_STOPPED 5
411#define KVM_MP_STATE_CHECK_STOP 6
412#define KVM_MP_STATE_OPERATING 7
413#define KVM_MP_STATE_LOAD 8
409 414
410struct kvm_mp_state { 415struct kvm_mp_state {
411 __u32 mp_state; 416 __u32 mp_state;
@@ -758,6 +763,8 @@ struct kvm_ppc_smmu_info {
758#define KVM_CAP_VM_ATTRIBUTES 101 763#define KVM_CAP_VM_ATTRIBUTES 101
759#define KVM_CAP_ARM_PSCI_0_2 102 764#define KVM_CAP_ARM_PSCI_0_2 102
760#define KVM_CAP_PPC_FIXUP_HCALL 103 765#define KVM_CAP_PPC_FIXUP_HCALL 103
766#define KVM_CAP_PPC_ENABLE_HCALL 104
767#define KVM_CAP_CHECK_EXTENSION_VM 105
761 768
762#ifdef KVM_CAP_IRQ_ROUTING 769#ifdef KVM_CAP_IRQ_ROUTING
763 770
diff --git a/include/uapi/linux/memfd.h b/include/uapi/linux/memfd.h
new file mode 100644
index 000000000000..534e364bda92
--- /dev/null
+++ b/include/uapi/linux/memfd.h
@@ -0,0 +1,8 @@
1#ifndef _UAPI_LINUX_MEMFD_H
2#define _UAPI_LINUX_MEMFD_H
3
4/* flags for memfd_create(2) (unsigned int) */
5#define MFD_CLOEXEC 0x0001U
6#define MFD_ALLOW_SEALING 0x0002U
7
8#endif /* _UAPI_LINUX_MEMFD_H */
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
index f53879c0f590..ff354021bb69 100644
--- a/include/uapi/linux/net_tstamp.h
+++ b/include/uapi/linux/net_tstamp.h
@@ -20,9 +20,13 @@ enum {
20 SOF_TIMESTAMPING_SOFTWARE = (1<<4), 20 SOF_TIMESTAMPING_SOFTWARE = (1<<4),
21 SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5), 21 SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
22 SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), 22 SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
23 SOF_TIMESTAMPING_MASK = 23 SOF_TIMESTAMPING_OPT_ID = (1<<7),
24 (SOF_TIMESTAMPING_RAW_HARDWARE - 1) | 24 SOF_TIMESTAMPING_TX_SCHED = (1<<8),
25 SOF_TIMESTAMPING_RAW_HARDWARE 25 SOF_TIMESTAMPING_TX_ACK = (1<<9),
26
27 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_TX_ACK,
28 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
29 SOF_TIMESTAMPING_LAST
26}; 30};
27 31
28/** 32/**
diff --git a/include/uapi/linux/netdevice.h b/include/uapi/linux/netdevice.h
index fdfbd1c17065..55818543342d 100644
--- a/include/uapi/linux/netdevice.h
+++ b/include/uapi/linux/netdevice.h
@@ -37,6 +37,12 @@
37#define INIT_NETDEV_GROUP 0 37#define INIT_NETDEV_GROUP 0
38 38
39 39
40/* interface name assignment types (sysfs name_assign_type attribute) */
41#define NET_NAME_UNKNOWN 0 /* unknown origin (not exposed to userspace) */
42#define NET_NAME_ENUM 1 /* enumerated by kernel */
43#define NET_NAME_PREDICTABLE 2 /* predictably named by the kernel */
44#define NET_NAME_USER 3 /* provided by user-space */
45#define NET_NAME_RENAMED 4 /* renamed by user-space */
40 46
41/* Media selection options. */ 47/* Media selection options. */
42enum { 48enum {
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 2a88f645a5d8..801bdd1e56e3 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -697,6 +697,8 @@ enum nft_counter_attributes {
697 * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING) 697 * @NFTA_LOG_PREFIX: prefix to prepend to log messages (NLA_STRING)
698 * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32) 698 * @NFTA_LOG_SNAPLEN: length of payload to include in netlink message (NLA_U32)
699 * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32) 699 * @NFTA_LOG_QTHRESHOLD: queue threshold (NLA_U32)
700 * @NFTA_LOG_LEVEL: log level (NLA_U32)
701 * @NFTA_LOG_FLAGS: logging flags (NLA_U32)
700 */ 702 */
701enum nft_log_attributes { 703enum nft_log_attributes {
702 NFTA_LOG_UNSPEC, 704 NFTA_LOG_UNSPEC,
@@ -704,6 +706,8 @@ enum nft_log_attributes {
704 NFTA_LOG_PREFIX, 706 NFTA_LOG_PREFIX,
705 NFTA_LOG_SNAPLEN, 707 NFTA_LOG_SNAPLEN,
706 NFTA_LOG_QTHRESHOLD, 708 NFTA_LOG_QTHRESHOLD,
709 NFTA_LOG_LEVEL,
710 NFTA_LOG_FLAGS,
707 __NFTA_LOG_MAX 711 __NFTA_LOG_MAX
708}; 712};
709#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1) 713#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
diff --git a/include/uapi/linux/netfilter/xt_bpf.h b/include/uapi/linux/netfilter/xt_bpf.h
index 5dda450eb55b..1fad2c27ac32 100644
--- a/include/uapi/linux/netfilter/xt_bpf.h
+++ b/include/uapi/linux/netfilter/xt_bpf.h
@@ -6,12 +6,14 @@
6 6
7#define XT_BPF_MAX_NUM_INSTR 64 7#define XT_BPF_MAX_NUM_INSTR 64
8 8
9struct bpf_prog;
10
9struct xt_bpf_info { 11struct xt_bpf_info {
10 __u16 bpf_program_num_elem; 12 __u16 bpf_program_num_elem;
11 struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; 13 struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR];
12 14
13 /* only used in the kernel */ 15 /* only used in the kernel */
14 struct sk_filter *filter __attribute__((aligned(8))); 16 struct bpf_prog *filter __attribute__((aligned(8)));
15}; 17};
16 18
17#endif /*_XT_BPF_H */ 19#endif /*_XT_BPF_H */
diff --git a/include/uapi/linux/netfilter_bridge/Kbuild b/include/uapi/linux/netfilter_bridge/Kbuild
index 348717c3a22f..0fbad8ef96de 100644
--- a/include/uapi/linux/netfilter_bridge/Kbuild
+++ b/include/uapi/linux/netfilter_bridge/Kbuild
@@ -14,6 +14,5 @@ header-y += ebt_nflog.h
14header-y += ebt_pkttype.h 14header-y += ebt_pkttype.h
15header-y += ebt_redirect.h 15header-y += ebt_redirect.h
16header-y += ebt_stp.h 16header-y += ebt_stp.h
17header-y += ebt_ulog.h
18header-y += ebt_vlan.h 17header-y += ebt_vlan.h
19header-y += ebtables.h 18header-y += ebtables.h
diff --git a/include/uapi/linux/netfilter_bridge/ebt_ulog.h b/include/uapi/linux/netfilter_bridge/ebt_ulog.h
deleted file mode 100644
index 89a6becb5269..000000000000
--- a/include/uapi/linux/netfilter_bridge/ebt_ulog.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _EBT_ULOG_H
2#define _EBT_ULOG_H
3
4#include <linux/types.h>
5
6#define EBT_ULOG_DEFAULT_NLGROUP 0
7#define EBT_ULOG_DEFAULT_QTHRESHOLD 1
8#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
9#define EBT_ULOG_PREFIX_LEN 32
10#define EBT_ULOG_MAX_QLEN 50
11#define EBT_ULOG_WATCHER "ulog"
12#define EBT_ULOG_VERSION 1
13
14struct ebt_ulog_info {
15 __u32 nlgroup;
16 unsigned int cprange;
17 unsigned int qthreshold;
18 char prefix[EBT_ULOG_PREFIX_LEN];
19};
20
21typedef struct ebt_ulog_packet_msg {
22 int version;
23 char indev[IFNAMSIZ];
24 char outdev[IFNAMSIZ];
25 char physindev[IFNAMSIZ];
26 char physoutdev[IFNAMSIZ];
27 char prefix[EBT_ULOG_PREFIX_LEN];
28 struct timeval stamp;
29 unsigned long mark;
30 unsigned int hook;
31 size_t data_len;
32 /* The complete packet, including Ethernet header and perhaps
33 * the VLAN header is appended */
34 unsigned char data[0] __attribute__
35 ((aligned (__alignof__(struct ebt_ulog_info))));
36} ebt_ulog_packet_msg_t;
37
38#endif /* _EBT_ULOG_H */
diff --git a/include/uapi/linux/netfilter_ipv4/Kbuild b/include/uapi/linux/netfilter_ipv4/Kbuild
index fb008437dde1..ecb291df390e 100644
--- a/include/uapi/linux/netfilter_ipv4/Kbuild
+++ b/include/uapi/linux/netfilter_ipv4/Kbuild
@@ -5,7 +5,6 @@ header-y += ipt_ECN.h
5header-y += ipt_LOG.h 5header-y += ipt_LOG.h
6header-y += ipt_REJECT.h 6header-y += ipt_REJECT.h
7header-y += ipt_TTL.h 7header-y += ipt_TTL.h
8header-y += ipt_ULOG.h
9header-y += ipt_ah.h 8header-y += ipt_ah.h
10header-y += ipt_ecn.h 9header-y += ipt_ecn.h
11header-y += ipt_ttl.h 10header-y += ipt_ttl.h
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h b/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h
deleted file mode 100644
index 417aad280bcc..000000000000
--- a/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/* Header file for IP tables userspace logging, Version 1.8
2 *
3 * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org>
4 *
5 * Distributed under the terms of GNU GPL */
6
7#ifndef _IPT_ULOG_H
8#define _IPT_ULOG_H
9
10#ifndef NETLINK_NFLOG
11#define NETLINK_NFLOG 5
12#endif
13
14#define ULOG_DEFAULT_NLGROUP 1
15#define ULOG_DEFAULT_QTHRESHOLD 1
16
17#define ULOG_MAC_LEN 80
18#define ULOG_PREFIX_LEN 32
19
20#define ULOG_MAX_QLEN 50
21/* Why 50? Well... there is a limit imposed by the slab cache 131000
22 * bytes. So the multipart netlink-message has to be < 131000 bytes.
23 * Assuming a standard ethernet-mtu of 1500, we could define this up
24 * to 80... but even 50 seems to be big enough. */
25
26/* private data structure for each rule with a ULOG target */
27struct ipt_ulog_info {
28 unsigned int nl_group;
29 size_t copy_range;
30 size_t qthreshold;
31 char prefix[ULOG_PREFIX_LEN];
32};
33
34/* Format of the ULOG packets passed through netlink */
35typedef struct ulog_packet_msg {
36 unsigned long mark;
37 long timestamp_sec;
38 long timestamp_usec;
39 unsigned int hook;
40 char indev_name[IFNAMSIZ];
41 char outdev_name[IFNAMSIZ];
42 size_t data_len;
43 char prefix[ULOG_PREFIX_LEN];
44 unsigned char mac_len;
45 unsigned char mac[ULOG_MAC_LEN];
46 unsigned char payload[0];
47} ulog_packet_msg_t;
48
49#endif /*_IPT_ULOG_H*/
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index be9519b52bb1..f1db15b9c041 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1591,6 +1591,9 @@ enum nl80211_commands {
1591 * creation then the new interface will be owned by the netlink socket 1591 * creation then the new interface will be owned by the netlink socket
1592 * that created it and will be destroyed when the socket is closed 1592 * that created it and will be destroyed when the socket is closed
1593 * 1593 *
1594 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
1595 * the TDLS link initiator.
1596 *
1594 * @NL80211_ATTR_MAX: highest attribute number currently defined 1597 * @NL80211_ATTR_MAX: highest attribute number currently defined
1595 * @__NL80211_ATTR_AFTER_LAST: internal use 1598 * @__NL80211_ATTR_AFTER_LAST: internal use
1596 */ 1599 */
@@ -1931,6 +1934,8 @@ enum nl80211_attrs {
1931 NL80211_ATTR_CSA_C_OFFSETS_TX, 1934 NL80211_ATTR_CSA_C_OFFSETS_TX,
1932 NL80211_ATTR_MAX_CSA_COUNTERS, 1935 NL80211_ATTR_MAX_CSA_COUNTERS,
1933 1936
1937 NL80211_ATTR_TDLS_INITIATOR,
1938
1934 /* add attributes here, update the policy in nl80211.c */ 1939 /* add attributes here, update the policy in nl80211.c */
1935 1940
1936 __NL80211_ATTR_AFTER_LAST, 1941 __NL80211_ATTR_AFTER_LAST,
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 0b979ee4bfc0..a794d1dd7b40 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -118,6 +118,9 @@ struct ovs_vport_stats {
118/* Allow last Netlink attribute to be unaligned */ 118/* Allow last Netlink attribute to be unaligned */
119#define OVS_DP_F_UNALIGNED (1 << 0) 119#define OVS_DP_F_UNALIGNED (1 << 0)
120 120
121/* Allow datapath to associate multiple Netlink PIDs to each vport */
122#define OVS_DP_F_VPORT_PIDS (1 << 1)
123
121/* Fixed logical ports. */ 124/* Fixed logical ports. */
122#define OVSP_LOCAL ((__u32)0) 125#define OVSP_LOCAL ((__u32)0)
123 126
@@ -203,9 +206,10 @@ enum ovs_vport_type {
203 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes 206 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
204 * plus a null terminator. 207 * plus a null terminator.
205 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. 208 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
206 * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that 209 * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace
207 * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on 210 * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets
208 * this port. A value of zero indicates that upcalls should not be sent. 211 * received on this port. If this is a single-element array of value 0,
212 * upcalls should not be sent.
209 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for 213 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
210 * packets sent or received through the vport. 214 * packets sent or received through the vport.
211 * 215 *
@@ -228,7 +232,8 @@ enum ovs_vport_attr {
228 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ 232 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
229 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ 233 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
230 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ 234 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
231 OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ 235 OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */
236 /* receiving upcalls */
232 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ 237 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
233 __OVS_VPORT_ATTR_MAX 238 __OVS_VPORT_ATTR_MAX
234}; 239};
diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h
index fff3528a078f..3f93d1695e7f 100644
--- a/include/uapi/linux/random.h
+++ b/include/uapi/linux/random.h
@@ -40,4 +40,13 @@ struct rand_pool_info {
40 __u32 buf[0]; 40 __u32 buf[0];
41}; 41};
42 42
43/*
44 * Flags for getrandom(2)
45 *
46 * GRND_NONBLOCK Don't block and return EAGAIN instead
47 * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
48 */
49#define GRND_NONBLOCK 0x0001
50#define GRND_RANDOM 0x0002
51
43#endif /* _UAPI_LINUX_RANDOM_H */ 52#endif /* _UAPI_LINUX_RANDOM_H */
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index 266022a2be4a..ce70fe6b45df 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -95,6 +95,9 @@ typedef __s32 sctp_assoc_t;
95#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ 95#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */
96#define SCTP_AUTO_ASCONF 30 96#define SCTP_AUTO_ASCONF 30
97#define SCTP_PEER_ADDR_THLDS 31 97#define SCTP_PEER_ADDR_THLDS 31
98#define SCTP_RECVRCVINFO 32
99#define SCTP_RECVNXTINFO 33
100#define SCTP_DEFAULT_SNDINFO 34
98 101
99/* Internal Socket Options. Some of the sctp library functions are 102/* Internal Socket Options. Some of the sctp library functions are
100 * implemented using these socket options. 103 * implemented using these socket options.
@@ -110,8 +113,14 @@ typedef __s32 sctp_assoc_t;
110#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ 113#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
111#define SCTP_GET_ASSOC_STATS 112 /* Read only */ 114#define SCTP_GET_ASSOC_STATS 112 /* Read only */
112 115
113/* 116/* These are bit fields for msghdr->msg_flags. See section 5.1. */
114 * 5.2.1 SCTP Initiation Structure (SCTP_INIT) 117/* On user space Linux, these live in <bits/socket.h> as an enum. */
118enum sctp_msg_flags {
119 MSG_NOTIFICATION = 0x8000,
120#define MSG_NOTIFICATION MSG_NOTIFICATION
121};
122
123/* 5.3.1 SCTP Initiation Structure (SCTP_INIT)
115 * 124 *
116 * This cmsghdr structure provides information for initializing new 125 * This cmsghdr structure provides information for initializing new
117 * SCTP associations with sendmsg(). The SCTP_INITMSG socket option 126 * SCTP associations with sendmsg(). The SCTP_INITMSG socket option
@@ -121,7 +130,6 @@ typedef __s32 sctp_assoc_t;
121 * cmsg_level cmsg_type cmsg_data[] 130 * cmsg_level cmsg_type cmsg_data[]
122 * ------------ ------------ ---------------------- 131 * ------------ ------------ ----------------------
123 * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg 132 * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
124 *
125 */ 133 */
126struct sctp_initmsg { 134struct sctp_initmsg {
127 __u16 sinit_num_ostreams; 135 __u16 sinit_num_ostreams;
@@ -130,8 +138,7 @@ struct sctp_initmsg {
130 __u16 sinit_max_init_timeo; 138 __u16 sinit_max_init_timeo;
131}; 139};
132 140
133/* 141/* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV)
134 * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
135 * 142 *
136 * This cmsghdr structure specifies SCTP options for sendmsg() and 143 * This cmsghdr structure specifies SCTP options for sendmsg() and
137 * describes SCTP header information about a received message through 144 * describes SCTP header information about a received message through
@@ -140,7 +147,6 @@ struct sctp_initmsg {
140 * cmsg_level cmsg_type cmsg_data[] 147 * cmsg_level cmsg_type cmsg_data[]
141 * ------------ ------------ ---------------------- 148 * ------------ ------------ ----------------------
142 * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo 149 * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
143 *
144 */ 150 */
145struct sctp_sndrcvinfo { 151struct sctp_sndrcvinfo {
146 __u16 sinfo_stream; 152 __u16 sinfo_stream;
@@ -154,19 +160,74 @@ struct sctp_sndrcvinfo {
154 sctp_assoc_t sinfo_assoc_id; 160 sctp_assoc_t sinfo_assoc_id;
155}; 161};
156 162
163/* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO)
164 *
165 * This cmsghdr structure specifies SCTP options for sendmsg().
166 *
167 * cmsg_level cmsg_type cmsg_data[]
168 * ------------ ------------ -------------------
169 * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo
170 */
171struct sctp_sndinfo {
172 __u16 snd_sid;
173 __u16 snd_flags;
174 __u32 snd_ppid;
175 __u32 snd_context;
176 sctp_assoc_t snd_assoc_id;
177};
178
179/* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO)
180 *
181 * This cmsghdr structure describes SCTP receive information
182 * about a received message through recvmsg().
183 *
184 * cmsg_level cmsg_type cmsg_data[]
185 * ------------ ------------ -------------------
186 * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo
187 */
188struct sctp_rcvinfo {
189 __u16 rcv_sid;
190 __u16 rcv_ssn;
191 __u16 rcv_flags;
192 __u32 rcv_ppid;
193 __u32 rcv_tsn;
194 __u32 rcv_cumtsn;
195 __u32 rcv_context;
196 sctp_assoc_t rcv_assoc_id;
197};
198
199/* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO)
200 *
201 * This cmsghdr structure describes SCTP receive information
202 * of the next message that will be delivered through recvmsg()
203 * if this information is already available when delivering
204 * the current message.
205 *
206 * cmsg_level cmsg_type cmsg_data[]
207 * ------------ ------------ -------------------
208 * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo
209 */
210struct sctp_nxtinfo {
211 __u16 nxt_sid;
212 __u16 nxt_flags;
213 __u32 nxt_ppid;
214 __u32 nxt_length;
215 sctp_assoc_t nxt_assoc_id;
216};
217
157/* 218/*
158 * sinfo_flags: 16 bits (unsigned integer) 219 * sinfo_flags: 16 bits (unsigned integer)
159 * 220 *
160 * This field may contain any of the following flags and is composed of 221 * This field may contain any of the following flags and is composed of
161 * a bitwise OR of these values. 222 * a bitwise OR of these values.
162 */ 223 */
163
164enum sctp_sinfo_flags { 224enum sctp_sinfo_flags {
165 SCTP_UNORDERED = 1, /* Send/receive message unordered. */ 225 SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */
166 SCTP_ADDR_OVER = 2, /* Override the primary destination. */ 226 SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */
167 SCTP_ABORT=4, /* Send an ABORT message to the peer. */ 227 SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */
168 SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */ 228 SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */
169 SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ 229 SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */
230 SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */
170}; 231};
171 232
172typedef union { 233typedef union {
@@ -177,10 +238,16 @@ typedef union {
177 238
178/* These are cmsg_types. */ 239/* These are cmsg_types. */
179typedef enum sctp_cmsg_type { 240typedef enum sctp_cmsg_type {
180 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ 241 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
181#define SCTP_INIT SCTP_INIT 242#define SCTP_INIT SCTP_INIT
182 SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ 243 SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
183#define SCTP_SNDRCV SCTP_SNDRCV 244#define SCTP_SNDRCV SCTP_SNDRCV
245 SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */
246#define SCTP_SNDINFO SCTP_SNDINFO
247 SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */
248#define SCTP_RCVINFO SCTP_RCVINFO
249 SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */
250#define SCTP_NXTINFO SCTP_NXTINFO
184} sctp_cmsg_t; 251} sctp_cmsg_t;
185 252
186/* 253/*
@@ -808,13 +875,6 @@ struct sctp_assoc_stats {
808 __u64 sas_ictrlchunks; /* Control chunks received */ 875 __u64 sas_ictrlchunks; /* Control chunks received */
809}; 876};
810 877
811/* These are bit fields for msghdr->msg_flags. See section 5.1. */
812/* On user space Linux, these live in <bits/socket.h> as an enum. */
813enum sctp_msg_flags {
814 MSG_NOTIFICATION = 0x8000,
815#define MSG_NOTIFICATION MSG_NOTIFICATION
816};
817
818/* 878/*
819 * 8.1 sctp_bindx() 879 * 8.1 sctp_bindx()
820 * 880 *
diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h
index ac2dc9f72973..0f238a43ff1e 100644
--- a/include/uapi/linux/seccomp.h
+++ b/include/uapi/linux/seccomp.h
@@ -10,6 +10,13 @@
10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */ 10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */ 11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
12 12
13/* Valid operations for seccomp syscall. */
14#define SECCOMP_SET_MODE_STRICT 0
15#define SECCOMP_SET_MODE_FILTER 1
16
17/* Valid flags for SECCOMP_SET_MODE_FILTER */
18#define SECCOMP_FILTER_FLAG_TSYNC 1
19
13/* 20/*
14 * All BPF programs must return a 32-bit value. 21 * All BPF programs must return a 32-bit value.
15 * The bottom 16-bits are for optional return data. 22 * The bottom 16-bits are for optional return data.
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index 99b47058816a..df6c9ab6b0cd 100644
--- a/include/uapi/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
@@ -88,6 +88,11 @@
88#define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ 88#define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */
89#define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750) */ 89#define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode (TI16C750) */
90 90
91#define UART_FCR_R_TRIG_SHIFT 6
92#define UART_FCR_R_TRIG_BITS(x) \
93 (((x) & UART_FCR_TRIGGER_MASK) >> UART_FCR_R_TRIG_SHIFT)
94#define UART_FCR_R_TRIG_MAX_STATE 4
95
91#define UART_LCR 3 /* Out: Line Control Register */ 96#define UART_LCR 3 /* Out: Line Control Register */
92/* 97/*
93 * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting 98 * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting
diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h
index 9f53fa7fc132..becdd78295cc 100644
--- a/include/uapi/linux/serio.h
+++ b/include/uapi/linux/serio.h
@@ -76,5 +76,6 @@
76#define SERIO_HAMPSHIRE 0x3b 76#define SERIO_HAMPSHIRE 0x3b
77#define SERIO_PS2MULT 0x3c 77#define SERIO_PS2MULT 0x3c
78#define SERIO_TSC40 0x3d 78#define SERIO_TSC40 0x3d
79#define SERIO_WACOM_IV 0x3e
79 80
80#endif /* _UAPI_SERIO_H */ 81#endif /* _UAPI_SERIO_H */
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index 6d6721341f49..43aaba1cc037 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -568,6 +568,7 @@ enum {
568 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, 568 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
569 NET_IPV6_PROXY_NDP=23, 569 NET_IPV6_PROXY_NDP=23,
570 NET_IPV6_ACCEPT_SOURCE_ROUTE=25, 570 NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
571 NET_IPV6_ACCEPT_RA_FROM_LOCAL=26,
571 __NET_IPV6_MAX 572 __NET_IPV6_MAX
572}; 573};
573 574
diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 41a76acbb305..876d0a14863c 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -182,7 +182,7 @@
182 182
183#define TIPC_MIN_LINK_WIN 16 183#define TIPC_MIN_LINK_WIN 16
184#define TIPC_DEF_LINK_WIN 50 184#define TIPC_DEF_LINK_WIN 50
185#define TIPC_MAX_LINK_WIN 150 185#define TIPC_MAX_LINK_WIN 8191
186 186
187 187
188struct tipc_node_info { 188struct tipc_node_info {
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index 0389b489bbba..baeab83deb64 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -84,6 +84,15 @@ struct uinput_ff_erase {
84 */ 84 */
85#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len) 85#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len)
86 86
87/**
88 * UI_GET_VERSION - Return version of uinput protocol
89 *
90 * This writes uinput protocol version implemented by the kernel into
91 * the integer pointed to by the ioctl argument. The protocol version
92 * is hard-coded in the kernel and is independent of the uinput device.
93 */
94#define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 301, unsigned int)
95
87/* 96/*
88 * To write a force-feedback-capable driver, the upload_effect 97 * To write a force-feedback-capable driver, the upload_effect
89 * and erase_effect callbacks in input_dev must be implemented. 98 * and erase_effect callbacks in input_dev must be implemented.
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index 24b68c59dcf8..0154b2859fd7 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -18,10 +18,9 @@ enum functionfs_flags {
18 FUNCTIONFS_HAS_FS_DESC = 1, 18 FUNCTIONFS_HAS_FS_DESC = 1,
19 FUNCTIONFS_HAS_HS_DESC = 2, 19 FUNCTIONFS_HAS_HS_DESC = 2,
20 FUNCTIONFS_HAS_SS_DESC = 4, 20 FUNCTIONFS_HAS_SS_DESC = 4,
21 FUNCTIONFS_HAS_MS_OS_DESC = 8,
21}; 22};
22 23
23#ifndef __KERNEL__
24
25/* Descriptor of an non-audio endpoint */ 24/* Descriptor of an non-audio endpoint */
26struct usb_endpoint_descriptor_no_audio { 25struct usb_endpoint_descriptor_no_audio {
27 __u8 bLength; 26 __u8 bLength;
@@ -41,6 +40,37 @@ struct usb_functionfs_descs_head {
41 __le32 hs_count; 40 __le32 hs_count;
42} __attribute__((packed, deprecated)); 41} __attribute__((packed, deprecated));
43 42
43/* MS OS Descriptor header */
44struct usb_os_desc_header {
45 __u8 interface;
46 __le32 dwLength;
47 __le16 bcdVersion;
48 __le16 wIndex;
49 union {
50 struct {
51 __u8 bCount;
52 __u8 Reserved;
53 };
54 __le16 wCount;
55 };
56} __attribute__((packed));
57
58struct usb_ext_compat_desc {
59 __u8 bFirstInterfaceNumber;
60 __u8 Reserved1;
61 __u8 CompatibleID[8];
62 __u8 SubCompatibleID[8];
63 __u8 Reserved2[6];
64};
65
66struct usb_ext_prop_desc {
67 __le32 dwSize;
68 __le32 dwPropertyDataType;
69 __le16 wPropertyNameLength;
70} __attribute__((packed));
71
72#ifndef __KERNEL__
73
44/* 74/*
45 * Descriptors format: 75 * Descriptors format:
46 * 76 *
@@ -52,9 +82,11 @@ struct usb_functionfs_descs_head {
52 * | | fs_count | LE32 | number of full-speed descriptors | 82 * | | fs_count | LE32 | number of full-speed descriptors |
53 * | | hs_count | LE32 | number of high-speed descriptors | 83 * | | hs_count | LE32 | number of high-speed descriptors |
54 * | | ss_count | LE32 | number of super-speed descriptors | 84 * | | ss_count | LE32 | number of super-speed descriptors |
85 * | | os_count | LE32 | number of MS OS descriptors |
55 * | | fs_descrs | Descriptor[] | list of full-speed descriptors | 86 * | | fs_descrs | Descriptor[] | list of full-speed descriptors |
56 * | | hs_descrs | Descriptor[] | list of high-speed descriptors | 87 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
57 * | | ss_descrs | Descriptor[] | list of super-speed descriptors | 88 * | | ss_descrs | Descriptor[] | list of super-speed descriptors |
89 * | | os_descrs | OSDesc[] | list of MS OS descriptors |
58 * 90 *
59 * Depending on which flags are set, various fields may be missing in the 91 * Depending on which flags are set, various fields may be missing in the
60 * structure. Any flags that are not recognised cause the whole block to be 92 * structure. Any flags that are not recognised cause the whole block to be
@@ -81,6 +113,52 @@ struct usb_functionfs_descs_head {
81 * | 0 | bLength | U8 | length of the descriptor | 113 * | 0 | bLength | U8 | length of the descriptor |
82 * | 1 | bDescriptorType | U8 | descriptor type | 114 * | 1 | bDescriptorType | U8 | descriptor type |
83 * | 2 | payload | | descriptor's payload | 115 * | 2 | payload | | descriptor's payload |
116 *
117 * OSDesc[] is an array of valid MS OS Feature Descriptors which have one of
118 * the following formats:
119 *
120 * | off | name | type | description |
121 * |-----+-----------------+------+--------------------------|
122 * | 0 | inteface | U8 | related interface number |
123 * | 1 | dwLength | U32 | length of the descriptor |
124 * | 5 | bcdVersion | U16 | currently supported: 1 |
125 * | 7 | wIndex | U16 | currently supported: 4 |
126 * | 9 | bCount | U8 | number of ext. compat. |
127 * | 10 | Reserved | U8 | 0 |
128 * | 11 | ExtCompat[] | | list of ext. compat. d. |
129 *
130 * | off | name | type | description |
131 * |-----+-----------------+------+--------------------------|
132 * | 0 | inteface | U8 | related interface number |
133 * | 1 | dwLength | U32 | length of the descriptor |
134 * | 5 | bcdVersion | U16 | currently supported: 1 |
135 * | 7 | wIndex | U16 | currently supported: 5 |
136 * | 9 | wCount | U16 | number of ext. compat. |
137 * | 11 | ExtProp[] | | list of ext. prop. d. |
138 *
139 * ExtCompat[] is an array of valid Extended Compatiblity descriptors
140 * which have the following format:
141 *
142 * | off | name | type | description |
143 * |-----+-----------------------+------+-------------------------------------|
144 * | 0 | bFirstInterfaceNumber | U8 | index of the interface or of the 1st|
145 * | | | | interface in an IAD group |
146 * | 1 | Reserved | U8 | 0 |
147 * | 2 | CompatibleID | U8[8]| compatible ID string |
148 * | 10 | SubCompatibleID | U8[8]| subcompatible ID string |
149 * | 18 | Reserved | U8[6]| 0 |
150 *
151 * ExtProp[] is an array of valid Extended Properties descriptors
152 * which have the following format:
153 *
154 * | off | name | type | description |
155 * |-----+-----------------------+------+-------------------------------------|
156 * | 0 | dwSize | U32 | length of the descriptor |
157 * | 4 | dwPropertyDataType | U32 | 1..7 |
158 * | 8 | wPropertyNameLength | U16 | bPropertyName length (NL) |
159 * | 10 | bPropertyName |U8[NL]| name of this property |
160 * |10+NL| dwPropertyDataLength | U32 | bPropertyData length (DL) |
161 * |14+NL| bProperty |U8[DL]| payload of this property |
84 */ 162 */
85 163
86struct usb_functionfs_strings_head { 164struct usb_functionfs_strings_head {
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 2ac5597f3ee1..e946e43fb8d5 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -61,6 +61,7 @@
61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ 61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */ 62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */
63#define V4L2_CTRL_CLASS_RF_TUNER 0x00a20000 /* RF tuner controls */ 63#define V4L2_CTRL_CLASS_RF_TUNER 0x00a20000 /* RF tuner controls */
64#define V4L2_CTRL_CLASS_DETECT 0x00a30000 /* Detection controls */
64 65
65/* User-class control IDs */ 66/* User-class control IDs */
66 67
@@ -756,6 +757,15 @@ enum v4l2_auto_focus_range {
756#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) 757#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
757#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) 758#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
758#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) 759#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
760#define V4L2_CID_RDS_TX_MONO_STEREO (V4L2_CID_FM_TX_CLASS_BASE + 7)
761#define V4L2_CID_RDS_TX_ARTIFICIAL_HEAD (V4L2_CID_FM_TX_CLASS_BASE + 8)
762#define V4L2_CID_RDS_TX_COMPRESSED (V4L2_CID_FM_TX_CLASS_BASE + 9)
763#define V4L2_CID_RDS_TX_DYNAMIC_PTY (V4L2_CID_FM_TX_CLASS_BASE + 10)
764#define V4L2_CID_RDS_TX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_TX_CLASS_BASE + 11)
765#define V4L2_CID_RDS_TX_TRAFFIC_PROGRAM (V4L2_CID_FM_TX_CLASS_BASE + 12)
766#define V4L2_CID_RDS_TX_MUSIC_SPEECH (V4L2_CID_FM_TX_CLASS_BASE + 13)
767#define V4L2_CID_RDS_TX_ALT_FREQS_ENABLE (V4L2_CID_FM_TX_CLASS_BASE + 14)
768#define V4L2_CID_RDS_TX_ALT_FREQS (V4L2_CID_FM_TX_CLASS_BASE + 15)
759 769
760#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) 770#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
761#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) 771#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
@@ -900,6 +910,12 @@ enum v4l2_deemphasis {
900}; 910};
901 911
902#define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2) 912#define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2)
913#define V4L2_CID_RDS_RX_PTY (V4L2_CID_FM_RX_CLASS_BASE + 3)
914#define V4L2_CID_RDS_RX_PS_NAME (V4L2_CID_FM_RX_CLASS_BASE + 4)
915#define V4L2_CID_RDS_RX_RADIO_TEXT (V4L2_CID_FM_RX_CLASS_BASE + 5)
916#define V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT (V4L2_CID_FM_RX_CLASS_BASE + 6)
917#define V4L2_CID_RDS_RX_TRAFFIC_PROGRAM (V4L2_CID_FM_RX_CLASS_BASE + 7)
918#define V4L2_CID_RDS_RX_MUSIC_SPEECH (V4L2_CID_FM_RX_CLASS_BASE + 8)
903 919
904#define V4L2_CID_RF_TUNER_CLASS_BASE (V4L2_CTRL_CLASS_RF_TUNER | 0x900) 920#define V4L2_CID_RF_TUNER_CLASS_BASE (V4L2_CTRL_CLASS_RF_TUNER | 0x900)
905#define V4L2_CID_RF_TUNER_CLASS (V4L2_CTRL_CLASS_RF_TUNER | 1) 921#define V4L2_CID_RF_TUNER_CLASS (V4L2_CTRL_CLASS_RF_TUNER | 1)
@@ -914,4 +930,20 @@ enum v4l2_deemphasis {
914#define V4L2_CID_RF_TUNER_IF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 62) 930#define V4L2_CID_RF_TUNER_IF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 62)
915#define V4L2_CID_RF_TUNER_PLL_LOCK (V4L2_CID_RF_TUNER_CLASS_BASE + 91) 931#define V4L2_CID_RF_TUNER_PLL_LOCK (V4L2_CID_RF_TUNER_CLASS_BASE + 91)
916 932
933
934/* Detection-class control IDs defined by V4L2 */
935#define V4L2_CID_DETECT_CLASS_BASE (V4L2_CTRL_CLASS_DETECT | 0x900)
936#define V4L2_CID_DETECT_CLASS (V4L2_CTRL_CLASS_DETECT | 1)
937
938#define V4L2_CID_DETECT_MD_MODE (V4L2_CID_DETECT_CLASS_BASE + 1)
939enum v4l2_detect_md_mode {
940 V4L2_DETECT_MD_MODE_DISABLED = 0,
941 V4L2_DETECT_MD_MODE_GLOBAL = 1,
942 V4L2_DETECT_MD_MODE_THRESHOLD_GRID = 2,
943 V4L2_DETECT_MD_MODE_REGION_GRID = 3,
944};
945#define V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD (V4L2_CID_DETECT_CLASS_BASE + 2)
946#define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3)
947#define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4)
948
917#endif 949#endif
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index cb9023d4f063..6612974c64bf 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -30,6 +30,9 @@
30 */ 30 */
31#define VFIO_DMA_CC_IOMMU 4 31#define VFIO_DMA_CC_IOMMU 4
32 32
33/* Check if EEH is supported */
34#define VFIO_EEH 5
35
33/* 36/*
34 * The IOCTL interface is designed for extensibility by embedding the 37 * The IOCTL interface is designed for extensibility by embedding the
35 * structure length (argsz) and flags into structures passed between 38 * structure length (argsz) and flags into structures passed between
@@ -455,6 +458,37 @@ struct vfio_iommu_spapr_tce_info {
455 458
456#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 459#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
457 460
461/*
462 * EEH PE operation struct provides ways to:
463 * - enable/disable EEH functionality;
464 * - unfreeze IO/DMA for frozen PE;
465 * - read PE state;
466 * - reset PE;
467 * - configure PE.
468 */
469struct vfio_eeh_pe_op {
470 __u32 argsz;
471 __u32 flags;
472 __u32 op;
473};
474
475#define VFIO_EEH_PE_DISABLE 0 /* Disable EEH functionality */
476#define VFIO_EEH_PE_ENABLE 1 /* Enable EEH functionality */
477#define VFIO_EEH_PE_UNFREEZE_IO 2 /* Enable IO for frozen PE */
478#define VFIO_EEH_PE_UNFREEZE_DMA 3 /* Enable DMA for frozen PE */
479#define VFIO_EEH_PE_GET_STATE 4 /* PE state retrieval */
480#define VFIO_EEH_PE_STATE_NORMAL 0 /* PE in functional state */
481#define VFIO_EEH_PE_STATE_RESET 1 /* PE reset in progress */
482#define VFIO_EEH_PE_STATE_STOPPED 2 /* Stopped DMA and IO */
483#define VFIO_EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */
484#define VFIO_EEH_PE_STATE_UNAVAIL 5 /* State unavailable */
485#define VFIO_EEH_PE_RESET_DEACTIVATE 5 /* Deassert PE reset */
486#define VFIO_EEH_PE_RESET_HOT 6 /* Assert hot reset */
487#define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 /* Assert fundamental reset */
488#define VFIO_EEH_PE_CONFIGURE 8 /* PE configuration */
489
490#define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21)
491
458/* ***************************************************************** */ 492/* ***************************************************************** */
459 493
460#endif /* _UAPIVFIO_H */ 494#endif /* _UAPIVFIO_H */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 168ff507bf75..778a3298fb34 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -124,6 +124,10 @@ enum v4l2_field {
124 (field) == V4L2_FIELD_INTERLACED_BT ||\ 124 (field) == V4L2_FIELD_INTERLACED_BT ||\
125 (field) == V4L2_FIELD_SEQ_TB ||\ 125 (field) == V4L2_FIELD_SEQ_TB ||\
126 (field) == V4L2_FIELD_SEQ_BT) 126 (field) == V4L2_FIELD_SEQ_BT)
127#define V4L2_FIELD_HAS_T_OR_B(field) \
128 ((field) == V4L2_FIELD_BOTTOM ||\
129 (field) == V4L2_FIELD_TOP ||\
130 (field) == V4L2_FIELD_ALTERNATE)
127 131
128enum v4l2_buf_type { 132enum v4l2_buf_type {
129 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, 133 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
@@ -268,6 +272,7 @@ struct v4l2_capability {
268#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ 272#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
269 273
270#define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */ 274#define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */
275#define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 /* Supports the extended pixel format */
271 276
272#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ 277#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
273#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 278#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
@@ -287,6 +292,7 @@ struct v4l2_pix_format {
287 __u32 sizeimage; 292 __u32 sizeimage;
288 __u32 colorspace; /* enum v4l2_colorspace */ 293 __u32 colorspace; /* enum v4l2_colorspace */
289 __u32 priv; /* private data, depends on pixelformat */ 294 __u32 priv; /* private data, depends on pixelformat */
295 __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
290}; 296};
291 297
292/* Pixel format FOURCC depth Description */ 298/* Pixel format FOURCC depth Description */
@@ -294,7 +300,11 @@ struct v4l2_pix_format {
294/* RGB formats */ 300/* RGB formats */
295#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ 301#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
296#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ 302#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
303#define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2') /* 16 aaaarrrr ggggbbbb */
304#define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2') /* 16 xxxxrrrr ggggbbbb */
297#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ 305#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
306#define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5') /* 16 ARGB-1-5-5-5 */
307#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16 XRGB-1-5-5-5 */
298#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ 308#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
299#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ 309#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
300#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ 310#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
@@ -302,7 +312,11 @@ struct v4l2_pix_format {
302#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ 312#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
303#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 313#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
304#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 314#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
315#define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4') /* 32 BGRA-8-8-8-8 */
316#define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4') /* 32 BGRX-8-8-8-8 */
305#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ 317#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
318#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */
319#define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */
306 320
307/* Grey formats */ 321/* Grey formats */
308#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 322#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
@@ -439,6 +453,15 @@ struct v4l2_pix_format {
439/* SDR formats - used only for Software Defined Radio devices */ 453/* SDR formats - used only for Software Defined Radio devices */
440#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */ 454#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
441#define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */ 455#define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */
456#define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */
457#define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */
458#define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */
459
460/* priv field value to indicates that subsequent fields are valid. */
461#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
462
463/* Flags */
464#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
442 465
443/* 466/*
444 * F O R M A T E N U M E R A T I O N 467 * F O R M A T E N U M E R A T I O N
@@ -744,7 +767,16 @@ struct v4l2_framebuffer {
744/* FIXME: in theory we should pass something like PCI device + memory 767/* FIXME: in theory we should pass something like PCI device + memory
745 * region + offset instead of some physical address */ 768 * region + offset instead of some physical address */
746 void *base; 769 void *base;
747 struct v4l2_pix_format fmt; 770 struct {
771 __u32 width;
772 __u32 height;
773 __u32 pixelformat;
774 __u32 field; /* enum v4l2_field */
775 __u32 bytesperline; /* for padding, zero if unused */
776 __u32 sizeimage;
777 __u32 colorspace; /* enum v4l2_colorspace */
778 __u32 priv; /* reserved field, set to 0 */
779 } fmt;
748}; 780};
749/* Flags for the 'capability' field. Read only */ 781/* Flags for the 'capability' field. Read only */
750#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 782#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
@@ -1254,6 +1286,10 @@ struct v4l2_ext_control {
1254 __s32 value; 1286 __s32 value;
1255 __s64 value64; 1287 __s64 value64;
1256 char *string; 1288 char *string;
1289 __u8 *p_u8;
1290 __u16 *p_u16;
1291 __u32 *p_u32;
1292 void *ptr;
1257 }; 1293 };
1258} __attribute__ ((packed)); 1294} __attribute__ ((packed));
1259 1295
@@ -1268,6 +1304,7 @@ struct v4l2_ext_controls {
1268#define V4L2_CTRL_ID_MASK (0x0fffffff) 1304#define V4L2_CTRL_ID_MASK (0x0fffffff)
1269#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1305#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
1270#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 1306#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
1307#define V4L2_CTRL_MAX_DIMS (4)
1271 1308
1272enum v4l2_ctrl_type { 1309enum v4l2_ctrl_type {
1273 V4L2_CTRL_TYPE_INTEGER = 1, 1310 V4L2_CTRL_TYPE_INTEGER = 1,
@@ -1278,7 +1315,13 @@ enum v4l2_ctrl_type {
1278 V4L2_CTRL_TYPE_CTRL_CLASS = 6, 1315 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
1279 V4L2_CTRL_TYPE_STRING = 7, 1316 V4L2_CTRL_TYPE_STRING = 7,
1280 V4L2_CTRL_TYPE_BITMASK = 8, 1317 V4L2_CTRL_TYPE_BITMASK = 8,
1281 V4L2_CTRL_TYPE_INTEGER_MENU = 9, 1318 V4L2_CTRL_TYPE_INTEGER_MENU = 9,
1319
1320 /* Compound types are >= 0x0100 */
1321 V4L2_CTRL_COMPOUND_TYPES = 0x0100,
1322 V4L2_CTRL_TYPE_U8 = 0x0100,
1323 V4L2_CTRL_TYPE_U16 = 0x0101,
1324 V4L2_CTRL_TYPE_U32 = 0x0102,
1282}; 1325};
1283 1326
1284/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 1327/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
@@ -1294,6 +1337,23 @@ struct v4l2_queryctrl {
1294 __u32 reserved[2]; 1337 __u32 reserved[2];
1295}; 1338};
1296 1339
1340/* Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls */
1341struct v4l2_query_ext_ctrl {
1342 __u32 id;
1343 __u32 type;
1344 char name[32];
1345 __s64 minimum;
1346 __s64 maximum;
1347 __u64 step;
1348 __s64 default_value;
1349 __u32 flags;
1350 __u32 elem_size;
1351 __u32 elems;
1352 __u32 nr_of_dims;
1353 __u32 dims[V4L2_CTRL_MAX_DIMS];
1354 __u32 reserved[32];
1355};
1356
1297/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ 1357/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
1298struct v4l2_querymenu { 1358struct v4l2_querymenu {
1299 __u32 id; 1359 __u32 id;
@@ -1314,9 +1374,11 @@ struct v4l2_querymenu {
1314#define V4L2_CTRL_FLAG_SLIDER 0x0020 1374#define V4L2_CTRL_FLAG_SLIDER 0x0020
1315#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 1375#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
1316#define V4L2_CTRL_FLAG_VOLATILE 0x0080 1376#define V4L2_CTRL_FLAG_VOLATILE 0x0080
1377#define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100
1317 1378
1318/* Query flag, to be ORed with the control ID */ 1379/* Query flags, to be ORed with the control ID */
1319#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 1380#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
1381#define V4L2_CTRL_FLAG_NEXT_COMPOUND 0x40000000
1320 1382
1321/* User-class control IDs defined by V4L2 */ 1383/* User-class control IDs defined by V4L2 */
1322#define V4L2_CID_MAX_CTRLS 1024 1384#define V4L2_CID_MAX_CTRLS 1024
@@ -1582,6 +1644,12 @@ struct v4l2_vbi_format {
1582#define V4L2_VBI_UNSYNC (1 << 0) 1644#define V4L2_VBI_UNSYNC (1 << 0)
1583#define V4L2_VBI_INTERLACED (1 << 1) 1645#define V4L2_VBI_INTERLACED (1 << 1)
1584 1646
1647/* ITU-R start lines for each field */
1648#define V4L2_VBI_ITU_525_F1_START (1)
1649#define V4L2_VBI_ITU_525_F2_START (264)
1650#define V4L2_VBI_ITU_625_F1_START (1)
1651#define V4L2_VBI_ITU_625_F2_START (314)
1652
1585/* Sliced VBI 1653/* Sliced VBI
1586 * 1654 *
1587 * This implements is a proposal V4L2 API to allow SLICED VBI 1655 * This implements is a proposal V4L2 API to allow SLICED VBI
@@ -1705,6 +1773,7 @@ struct v4l2_plane_pix_format {
1705 * @colorspace: enum v4l2_colorspace; supplemental to pixelformat 1773 * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
1706 * @plane_fmt: per-plane information 1774 * @plane_fmt: per-plane information
1707 * @num_planes: number of planes for this format 1775 * @num_planes: number of planes for this format
1776 * @flags: format flags (V4L2_PIX_FMT_FLAG_*)
1708 */ 1777 */
1709struct v4l2_pix_format_mplane { 1778struct v4l2_pix_format_mplane {
1710 __u32 width; 1779 __u32 width;
@@ -1715,16 +1784,19 @@ struct v4l2_pix_format_mplane {
1715 1784
1716 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; 1785 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1717 __u8 num_planes; 1786 __u8 num_planes;
1718 __u8 reserved[11]; 1787 __u8 flags;
1788 __u8 reserved[10];
1719} __attribute__ ((packed)); 1789} __attribute__ ((packed));
1720 1790
1721/** 1791/**
1722 * struct v4l2_sdr_format - SDR format definition 1792 * struct v4l2_sdr_format - SDR format definition
1723 * @pixelformat: little endian four character code (fourcc) 1793 * @pixelformat: little endian four character code (fourcc)
1794 * @buffersize: maximum size in bytes required for data
1724 */ 1795 */
1725struct v4l2_sdr_format { 1796struct v4l2_sdr_format {
1726 __u32 pixelformat; 1797 __u32 pixelformat;
1727 __u8 reserved[28]; 1798 __u32 buffersize;
1799 __u8 reserved[24];
1728} __attribute__ ((packed)); 1800} __attribute__ ((packed));
1729 1801
1730/** 1802/**
@@ -1771,6 +1843,7 @@ struct v4l2_streamparm {
1771#define V4L2_EVENT_CTRL 3 1843#define V4L2_EVENT_CTRL 3
1772#define V4L2_EVENT_FRAME_SYNC 4 1844#define V4L2_EVENT_FRAME_SYNC 4
1773#define V4L2_EVENT_SOURCE_CHANGE 5 1845#define V4L2_EVENT_SOURCE_CHANGE 5
1846#define V4L2_EVENT_MOTION_DET 6
1774#define V4L2_EVENT_PRIVATE_START 0x08000000 1847#define V4L2_EVENT_PRIVATE_START 0x08000000
1775 1848
1776/* Payload for V4L2_EVENT_VSYNC */ 1849/* Payload for V4L2_EVENT_VSYNC */
@@ -1808,6 +1881,21 @@ struct v4l2_event_src_change {
1808 __u32 changes; 1881 __u32 changes;
1809}; 1882};
1810 1883
1884#define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ (1 << 0)
1885
1886/**
1887 * struct v4l2_event_motion_det - motion detection event
1888 * @flags: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the
1889 * frame_sequence field is valid.
1890 * @frame_sequence: the frame sequence number associated with this event.
1891 * @region_mask: which regions detected motion.
1892 */
1893struct v4l2_event_motion_det {
1894 __u32 flags;
1895 __u32 frame_sequence;
1896 __u32 region_mask;
1897};
1898
1811struct v4l2_event { 1899struct v4l2_event {
1812 __u32 type; 1900 __u32 type;
1813 union { 1901 union {
@@ -1815,6 +1903,7 @@ struct v4l2_event {
1815 struct v4l2_event_ctrl ctrl; 1903 struct v4l2_event_ctrl ctrl;
1816 struct v4l2_event_frame_sync frame_sync; 1904 struct v4l2_event_frame_sync frame_sync;
1817 struct v4l2_event_src_change src_change; 1905 struct v4l2_event_src_change src_change;
1906 struct v4l2_event_motion_det motion_det;
1818 __u8 data[64]; 1907 __u8 data[64];
1819 } u; 1908 } u;
1820 __u32 pending; 1909 __u32 pending;
@@ -2005,6 +2094,8 @@ struct v4l2_create_buffers {
2005 Never use these in applications! */ 2094 Never use these in applications! */
2006#define VIDIOC_DBG_G_CHIP_INFO _IOWR('V', 102, struct v4l2_dbg_chip_info) 2095#define VIDIOC_DBG_G_CHIP_INFO _IOWR('V', 102, struct v4l2_dbg_chip_info)
2007 2096
2097#define VIDIOC_QUERY_EXT_CTRL _IOWR('V', 103, struct v4l2_query_ext_ctrl)
2098
2008/* Reminder: when adding new ioctls please add support for them to 2099/* Reminder: when adding new ioctls please add support for them to
2009 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2100 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2010 2101
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index 6d8e61c48563..9ad67b267584 100644
--- a/include/uapi/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
@@ -40,6 +40,7 @@
40#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ 40#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */
41#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ 41#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
42#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ 42#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
43#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
43 44
44#ifndef __KERNEL__ 45#ifndef __KERNEL__
45/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */ 46/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */
@@ -77,6 +78,10 @@ struct virtio_blk_config {
77 78
78 /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ 79 /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */
79 __u8 wce; 80 __u8 wce;
81 __u8 unused;
82
83 /* number of vqs, only available when VIRTIO_BLK_F_MQ is set */
84 __u16 num_queues;
80} __attribute__((packed)); 85} __attribute__((packed));
81 86
82/* 87/*
diff --git a/include/uapi/rdma/ib_user_mad.h b/include/uapi/rdma/ib_user_mad.h
index d6fce1cbdb90..09f809f323ea 100644
--- a/include/uapi/rdma/ib_user_mad.h
+++ b/include/uapi/rdma/ib_user_mad.h
@@ -191,6 +191,45 @@ struct ib_user_mad_reg_req {
191 __u8 rmpp_version; 191 __u8 rmpp_version;
192}; 192};
193 193
194/**
195 * ib_user_mad_reg_req2 - MAD registration request
196 *
197 * @id - Set by the _kernel_; used by userspace to identify the
198 * registered agent in future requests.
199 * @qpn - Queue pair number; must be 0 or 1.
200 * @mgmt_class - Indicates which management class of MADs should be
201 * receive by the caller. This field is only required if
202 * the user wishes to receive unsolicited MADs, otherwise
203 * it should be 0.
204 * @mgmt_class_version - Indicates which version of MADs for the given
205 * management class to receive.
206 * @res - Ignored.
207 * @flags - additional registration flags; Must be in the set of
208 * flags defined in IB_USER_MAD_REG_FLAGS_CAP
209 * @method_mask - The caller wishes to receive unsolicited MADs for the
210 * methods whose bit(s) is(are) set.
211 * @oui - Indicates IEEE OUI to use when mgmt_class is a vendor
212 * class in the range from 0x30 to 0x4f. Otherwise not
213 * used.
214 * @rmpp_version - If set, indicates the RMPP version to use.
215 */
216enum {
217 IB_USER_MAD_USER_RMPP = (1 << 0),
218};
219#define IB_USER_MAD_REG_FLAGS_CAP (IB_USER_MAD_USER_RMPP)
220struct ib_user_mad_reg_req2 {
221 __u32 id;
222 __u32 qpn;
223 __u8 mgmt_class;
224 __u8 mgmt_class_version;
225 __u16 res;
226 __u32 flags;
227 __u64 method_mask[2];
228 __u32 oui;
229 __u8 rmpp_version;
230 __u8 reserved[3];
231};
232
194#define IB_IOCTL_MAGIC 0x1b 233#define IB_IOCTL_MAGIC 0x1b
195 234
196#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ 235#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
@@ -200,4 +239,7 @@ struct ib_user_mad_reg_req {
200 239
201#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) 240#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3)
202 241
242#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \
243 struct ib_user_mad_reg_req2)
244
203#endif /* IB_USER_MAD_H */ 245#endif /* IB_USER_MAD_H */
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index cbfdd4ca9510..26daf55ff76e 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -276,6 +276,22 @@ struct ib_uverbs_reg_mr_resp {
276 __u32 rkey; 276 __u32 rkey;
277}; 277};
278 278
279struct ib_uverbs_rereg_mr {
280 __u64 response;
281 __u32 mr_handle;
282 __u32 flags;
283 __u64 start;
284 __u64 length;
285 __u64 hca_va;
286 __u32 pd_handle;
287 __u32 access_flags;
288};
289
290struct ib_uverbs_rereg_mr_resp {
291 __u32 lkey;
292 __u32 rkey;
293};
294
279struct ib_uverbs_dereg_mr { 295struct ib_uverbs_dereg_mr {
280 __u32 mr_handle; 296 __u32 mr_handle;
281}; 297};
diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
index 99b80abf360a..3066718eb120 100644
--- a/include/uapi/rdma/rdma_user_cm.h
+++ b/include/uapi/rdma/rdma_user_cm.h
@@ -34,6 +34,7 @@
34#define RDMA_USER_CM_H 34#define RDMA_USER_CM_H
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/socket.h>
37#include <linux/in6.h> 38#include <linux/in6.h>
38#include <rdma/ib_user_verbs.h> 39#include <rdma/ib_user_verbs.h>
39#include <rdma/ib_user_sa.h> 40#include <rdma/ib_user_sa.h>
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 224948342f14..32168f7ffce3 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -139,7 +139,7 @@ struct snd_hwdep_dsp_image {
139 * * 139 * *
140 *****************************************************************************/ 140 *****************************************************************************/
141 141
142#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 11) 142#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 12)
143 143
144typedef unsigned long snd_pcm_uframes_t; 144typedef unsigned long snd_pcm_uframes_t;
145typedef signed long snd_pcm_sframes_t; 145typedef signed long snd_pcm_sframes_t;
@@ -391,7 +391,9 @@ struct snd_pcm_sw_params {
391 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 391 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
392 snd_pcm_uframes_t silence_size; /* silence block size */ 392 snd_pcm_uframes_t silence_size; /* silence block size */
393 snd_pcm_uframes_t boundary; /* pointers wrap point */ 393 snd_pcm_uframes_t boundary; /* pointers wrap point */
394 unsigned char reserved[64]; /* reserved for future */ 394 unsigned int proto; /* protocol version */
395 unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
396 unsigned char reserved[56]; /* reserved for future */
395}; 397};
396 398
397struct snd_pcm_channel_info { 399struct snd_pcm_channel_info {
@@ -462,7 +464,8 @@ struct snd_xfern {
462enum { 464enum {
463 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ 465 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
464 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ 466 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
465 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 467 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */
468 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
466}; 469};
467 470
468/* channel positions */ 471/* channel positions */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index fc06c5b5f12a..069dfca9549a 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -61,6 +61,7 @@ struct omap_overlay_manager;
61struct dss_lcd_mgr_config; 61struct dss_lcd_mgr_config;
62struct snd_aes_iec958; 62struct snd_aes_iec958;
63struct snd_cea_861_aud_if; 63struct snd_cea_861_aud_if;
64struct hdmi_avi_infoframe;
64 65
65enum omap_display_type { 66enum omap_display_type {
66 OMAP_DISPLAY_TYPE_NONE = 0, 67 OMAP_DISPLAY_TYPE_NONE = 0,
@@ -631,6 +632,10 @@ struct omapdss_hdmi_ops {
631 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); 632 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
632 bool (*detect)(struct omap_dss_device *dssdev); 633 bool (*detect)(struct omap_dss_device *dssdev);
633 634
635 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
636 int (*set_infoframe)(struct omap_dss_device *dssdev,
637 const struct hdmi_avi_infoframe *avi);
638
634 /* 639 /*
635 * Note: These functions might sleep. Do not call while 640 * Note: These functions might sleep. Do not call while
636 * holding a spinlock/readlock. 641 * holding a spinlock/readlock.
@@ -850,6 +855,10 @@ struct omap_dss_driver {
850 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); 855 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
851 bool (*detect)(struct omap_dss_device *dssdev); 856 bool (*detect)(struct omap_dss_device *dssdev);
852 857
858 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
859 int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
860 const struct hdmi_avi_infoframe *avi);
861
853 /* 862 /*
854 * For display drivers that support audio. This encompasses 863 * For display drivers that support audio. This encompasses
855 * HDMI and DisplayPort at the moment. 864 * HDMI and DisplayPort at the moment.
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index b0393209679b..a20e4a3a8b15 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -19,6 +19,7 @@
19/* VIDCON0 */ 19/* VIDCON0 */
20 20
21#define VIDCON0 0x00 21#define VIDCON0 0x00
22#define VIDCON0_DSI_EN (1 << 30)
22#define VIDCON0_INTERLACE (1 << 29) 23#define VIDCON0_INTERLACE (1 << 29)
23#define VIDCON0_VIDOUT_MASK (0x7 << 26) 24#define VIDCON0_VIDOUT_MASK (0x7 << 26)
24#define VIDCON0_VIDOUT_SHIFT 26 25#define VIDCON0_VIDOUT_SHIFT 26
@@ -107,7 +108,7 @@
107#define VIDCON2_ORGYCbCr (1 << 8) 108#define VIDCON2_ORGYCbCr (1 << 8)
108#define VIDCON2_YUVORDCrCb (1 << 7) 109#define VIDCON2_YUVORDCrCb (1 << 7)
109 110
110/* PRTCON (S3C6410, S5PC100) 111/* PRTCON (S3C6410)
111 * Might not be present in the S3C6410 documentation, 112 * Might not be present in the S3C6410 documentation,
112 * but tests prove it's there almost for sure; shouldn't hurt in any case. 113 * but tests prove it's there almost for sure; shouldn't hurt in any case.
113 */ 114 */
@@ -355,7 +356,7 @@
355#define VIDINTCON0_INT_ENABLE (1 << 0) 356#define VIDINTCON0_INT_ENABLE (1 << 0)
356 357
357#define VIDINTCON1 0x134 358#define VIDINTCON1 0x134
358#define VIDINTCON1_INT_I180 (1 << 2) 359#define VIDINTCON1_INT_I80 (1 << 2)
359#define VIDINTCON1_INT_FRAME (1 << 1) 360#define VIDINTCON1_INT_FRAME (1 << 1)
360#define VIDINTCON1_INT_FIFO (1 << 0) 361#define VIDINTCON1_INT_FIFO (1 << 0)
361 362
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index a5af2a26d94f..3387465b9caa 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -64,24 +64,6 @@ int gnttab_resume(void);
64 64
65int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, 65int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
66 int readonly); 66 int readonly);
67int gnttab_grant_foreign_access_subpage(domid_t domid, unsigned long frame,
68 int flags, unsigned page_off,
69 unsigned length);
70int gnttab_grant_foreign_access_trans(domid_t domid, int flags,
71 domid_t trans_domid,
72 grant_ref_t trans_gref);
73
74/*
75 * Are sub-page grants available on this version of Xen? Returns true if they
76 * are, and false if they're not.
77 */
78bool gnttab_subpage_grants_available(void);
79
80/*
81 * Are transitive grants available on this version of Xen? Returns true if they
82 * are, and false if they're not.
83 */
84bool gnttab_trans_grants_available(void);
85 67
86/* 68/*
87 * End access through the given grant reference, iff the grant entry is no 69 * End access through the given grant reference, iff the grant entry is no
@@ -128,13 +110,6 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
128 110
129void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, 111void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
130 unsigned long frame, int readonly); 112 unsigned long frame, int readonly);
131int gnttab_grant_foreign_access_subpage_ref(grant_ref_t ref, domid_t domid,
132 unsigned long frame, int flags,
133 unsigned page_off,
134 unsigned length);
135int gnttab_grant_foreign_access_trans_ref(grant_ref_t ref, domid_t domid,
136 int flags, domid_t trans_domid,
137 grant_ref_t trans_gref);
138 113
139void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 114void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
140 unsigned long pfn); 115 unsigned long pfn);
@@ -170,12 +145,10 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
170 unmap->dev_bus_addr = 0; 145 unmap->dev_bus_addr = 0;
171} 146}
172 147
148int arch_gnttab_init(unsigned long nr_shared);
173int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes, 149int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
174 unsigned long max_nr_gframes, 150 unsigned long max_nr_gframes,
175 void **__shared); 151 void **__shared);
176int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
177 unsigned long max_nr_gframes,
178 grant_status_t **__shared);
179void arch_gnttab_unmap(void *shared, unsigned long nr_gframes); 152void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);
180 153
181struct grant_frames { 154struct grant_frames {
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index f1331e3e7271..5cc49ea8d840 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -108,11 +108,113 @@ struct xenpf_platform_quirk {
108}; 108};
109DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t); 109DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
110 110
111#define XENPF_efi_runtime_call 49
112#define XEN_EFI_get_time 1
113#define XEN_EFI_set_time 2
114#define XEN_EFI_get_wakeup_time 3
115#define XEN_EFI_set_wakeup_time 4
116#define XEN_EFI_get_next_high_monotonic_count 5
117#define XEN_EFI_get_variable 6
118#define XEN_EFI_set_variable 7
119#define XEN_EFI_get_next_variable_name 8
120#define XEN_EFI_query_variable_info 9
121#define XEN_EFI_query_capsule_capabilities 10
122#define XEN_EFI_update_capsule 11
123
124struct xenpf_efi_runtime_call {
125 uint32_t function;
126 /*
127 * This field is generally used for per sub-function flags (defined
128 * below), except for the XEN_EFI_get_next_high_monotonic_count case,
129 * where it holds the single returned value.
130 */
131 uint32_t misc;
132 xen_ulong_t status;
133 union {
134#define XEN_EFI_GET_TIME_SET_CLEARS_NS 0x00000001
135 struct {
136 struct xenpf_efi_time {
137 uint16_t year;
138 uint8_t month;
139 uint8_t day;
140 uint8_t hour;
141 uint8_t min;
142 uint8_t sec;
143 uint32_t ns;
144 int16_t tz;
145 uint8_t daylight;
146 } time;
147 uint32_t resolution;
148 uint32_t accuracy;
149 } get_time;
150
151 struct xenpf_efi_time set_time;
152
153#define XEN_EFI_GET_WAKEUP_TIME_ENABLED 0x00000001
154#define XEN_EFI_GET_WAKEUP_TIME_PENDING 0x00000002
155 struct xenpf_efi_time get_wakeup_time;
156
157#define XEN_EFI_SET_WAKEUP_TIME_ENABLE 0x00000001
158#define XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY 0x00000002
159 struct xenpf_efi_time set_wakeup_time;
160
161#define XEN_EFI_VARIABLE_NON_VOLATILE 0x00000001
162#define XEN_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
163#define XEN_EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
164 struct {
165 GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */
166 xen_ulong_t size;
167 GUEST_HANDLE(void) data;
168 struct xenpf_efi_guid {
169 uint32_t data1;
170 uint16_t data2;
171 uint16_t data3;
172 uint8_t data4[8];
173 } vendor_guid;
174 } get_variable, set_variable;
175
176 struct {
177 xen_ulong_t size;
178 GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */
179 struct xenpf_efi_guid vendor_guid;
180 } get_next_variable_name;
181
182 struct {
183 uint32_t attr;
184 uint64_t max_store_size;
185 uint64_t remain_store_size;
186 uint64_t max_size;
187 } query_variable_info;
188
189 struct {
190 GUEST_HANDLE(void) capsule_header_array;
191 xen_ulong_t capsule_count;
192 uint64_t max_capsule_size;
193 uint32_t reset_type;
194 } query_capsule_capabilities;
195
196 struct {
197 GUEST_HANDLE(void) capsule_header_array;
198 xen_ulong_t capsule_count;
199 uint64_t sg_list; /* machine address */
200 } update_capsule;
201 } u;
202};
203DEFINE_GUEST_HANDLE_STRUCT(xenpf_efi_runtime_call);
204
205#define XEN_FW_EFI_VERSION 0
206#define XEN_FW_EFI_CONFIG_TABLE 1
207#define XEN_FW_EFI_VENDOR 2
208#define XEN_FW_EFI_MEM_INFO 3
209#define XEN_FW_EFI_RT_VERSION 4
210
111#define XENPF_firmware_info 50 211#define XENPF_firmware_info 50
112#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ 212#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ 213#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
114#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ 214#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */
215#define XEN_FW_EFI_INFO 4 /* from EFI */
115#define XEN_FW_KBD_SHIFT_FLAGS 5 /* Int16, Fn02: Get keyboard shift flags. */ 216#define XEN_FW_KBD_SHIFT_FLAGS 5 /* Int16, Fn02: Get keyboard shift flags. */
217
116struct xenpf_firmware_info { 218struct xenpf_firmware_info {
117 /* IN variables. */ 219 /* IN variables. */
118 uint32_t type; 220 uint32_t type;
@@ -144,6 +246,26 @@ struct xenpf_firmware_info {
144 GUEST_HANDLE(uchar) edid; 246 GUEST_HANDLE(uchar) edid;
145 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ 247 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
146 248
249 union xenpf_efi_info {
250 uint32_t version;
251 struct {
252 uint64_t addr; /* EFI_CONFIGURATION_TABLE */
253 uint32_t nent;
254 } cfg;
255 struct {
256 uint32_t revision;
257 uint32_t bufsz; /* input, in bytes */
258 GUEST_HANDLE(void) name;
259 /* UCS-2/UTF-16 string */
260 } vendor;
261 struct {
262 uint64_t addr;
263 uint64_t size;
264 uint64_t attr;
265 uint32_t type;
266 } mem;
267 } efi_info; /* XEN_FW_EFI_INFO */
268
147 uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */ 269 uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */
148 } u; 270 } u;
149}; 271};
@@ -362,6 +484,7 @@ struct xen_platform_op {
362 struct xenpf_read_memtype read_memtype; 484 struct xenpf_read_memtype read_memtype;
363 struct xenpf_microcode_update microcode; 485 struct xenpf_microcode_update microcode;
364 struct xenpf_platform_quirk platform_quirk; 486 struct xenpf_platform_quirk platform_quirk;
487 struct xenpf_efi_runtime_call efi_runtime_call;
365 struct xenpf_firmware_info firmware_info; 488 struct xenpf_firmware_info firmware_info;
366 struct xenpf_enter_acpi_sleep enter_acpi_sleep; 489 struct xenpf_enter_acpi_sleep enter_acpi_sleep;
367 struct xenpf_change_freq change_freq; 490 struct xenpf_change_freq change_freq;
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 0b3149ed7eaa..7491ee5d8164 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/notifier.h> 5#include <linux/notifier.h>
6#include <linux/efi.h>
6#include <asm/xen/interface.h> 7#include <asm/xen/interface.h>
7 8
8DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 9DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
@@ -35,4 +36,14 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
35 int numpgs, struct page **pages); 36 int numpgs, struct page **pages);
36 37
37bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); 38bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
39
40#ifdef CONFIG_XEN_EFI
41extern efi_system_table_t *xen_efi_probe(void);
42#else
43static inline efi_system_table_t __init *xen_efi_probe(void)
44{
45 return NULL;
46}
47#endif
48
38#endif /* INCLUDE_XEN_OPS_H */ 49#endif /* INCLUDE_XEN_OPS_H */