aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild3
-rw-r--r--include/acpi/acconfig.h1
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acnames.h1
-rw-r--r--include/acpi/acpi_bus.h78
-rw-r--r--include/acpi/acpi_drivers.h4
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/acpixf.h18
-rw-r--r--include/acpi/actbl3.h22
-rw-r--r--include/acpi/actypes.h42
-rw-r--r--include/asm-generic/gpio.h52
-rw-r--r--include/asm-generic/io.h64
-rw-r--r--include/asm-generic/mmu.h6
-rw-r--r--include/asm-generic/parport.h4
-rw-r--r--include/asm-generic/pgtable.h136
-rw-r--r--include/asm-generic/signal.h2
-rw-r--r--include/asm-generic/syscalls.h20
-rw-r--r--include/asm-generic/tlb.h9
-rw-r--r--include/asm-generic/trace_clock.h16
-rw-r--r--include/crypto/cast5.h6
-rw-r--r--include/crypto/cast6.h6
-rw-r--r--include/crypto/cast_common.h9
-rw-r--r--include/crypto/vmac.h2
-rw-r--r--include/drm/drm_crtc.h8
-rw-r--r--include/drm/drm_dp_helper.h8
-rw-r--r--include/drm/drm_hashtab.h14
-rw-r--r--include/drm/drm_mm.h25
-rw-r--r--include/drm/drm_pciids.h1
-rw-r--r--include/drm/exynos_drm.h48
-rw-r--r--include/drm/ttm/ttm_bo_api.h3
-rw-r--r--include/drm/ttm/ttm_bo_driver.h19
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/acpi.h151
-rw-r--r--include/linux/acpi_gpio.h19
-rw-r--r--include/linux/amba/bus.h10
-rw-r--r--include/linux/asn1.h2
-rw-r--r--include/linux/ata_platform.h14
-rw-r--r--include/linux/ath9k_platform.h2
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/atmel-ssc.h6
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--include/linux/backlight.h10
-rw-r--r--include/linux/balloon_compaction.h272
-rw-r--r--include/linux/bcm47xx_wdt.h19
-rw-r--r--include/linux/bcma/bcma.h8
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h21
-rw-r--r--include/linux/bcma/bcma_driver_gmac_cmn.h2
-rw-r--r--include/linux/bcma/bcma_driver_mips.h3
-rw-r--r--include/linux/bcma/bcma_driver_pci.h2
-rw-r--r--include/linux/bcma/bcma_regs.h5
-rw-r--r--include/linux/binfmts.h11
-rw-r--r--include/linux/blkdev.h28
-rw-r--r--include/linux/bootmem.h7
-rw-r--r--include/linux/bsg-lib.h1
-rw-r--r--include/linux/bug.h1
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/osdmap.h1
-rw-r--r--include/linux/ceph/rados.h2
-rw-r--r--include/linux/cgroup.h167
-rw-r--r--include/linux/clk-provider.h24
-rw-r--r--include/linux/clk/mvebu.h22
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clk/zynq.h24
-rw-r--r--include/linux/compat.h69
-rw-r--r--include/linux/compiler-gcc4.h12
-rw-r--r--include/linux/compiler-intel.h7
-rw-r--r--include/linux/compiler.h11
-rw-r--r--include/linux/context_tracking.h18
-rw-r--r--include/linux/coredump.h4
-rw-r--r--include/linux/cpu_cooling.h6
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpuidle.h15
-rw-r--r--include/linux/cpuset.h2
-rw-r--r--include/linux/cred.h20
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/devfreq.h136
-rw-r--r--include/linux/device-mapper.h55
-rw-r--r--include/linux/device.h25
-rw-r--r--include/linux/devpts_fs.h20
-rw-r--r--include/linux/dlm.h2
-rw-r--r--include/linux/dma-attrs.h1
-rw-r--r--include/linux/dma-buf.h99
-rw-r--r--include/linux/dma-contiguous.h4
-rw-r--r--include/linux/dma-debug.h7
-rw-r--r--include/linux/dma/ipu-dma.h177
-rw-r--r--include/linux/drbd.h81
-rw-r--r--include/linux/drbd_genl.h378
-rw-r--r--include/linux/drbd_genl_api.h55
-rw-r--r--include/linux/drbd_limits.h90
-rw-r--r--include/linux/drbd_nl.h163
-rw-r--r--include/linux/drbd_tag_magic.h84
-rw-r--r--include/linux/dvb/Kbuild0
-rw-r--r--include/linux/dvb/dmx.h29
-rw-r--r--include/linux/dvb/video.h29
-rw-r--r--include/linux/earlycpio.h17
-rw-r--r--include/linux/edac.h3
-rw-r--r--include/linux/efi.h78
-rw-r--r--include/linux/etherdevice.h20
-rw-r--r--include/linux/exportfs.h7
-rw-r--r--include/linux/extcon.h50
-rw-r--r--include/linux/f2fs_fs.h413
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/freezer.h58
-rw-r--r--include/linux/fs.h31
-rw-r--r--include/linux/fs_struct.h1
-rw-r--r--include/linux/fscache-cache.h71
-rw-r--r--include/linux/fscache.h50
-rw-r--r--include/linux/fsl-diu-fb.h9
-rw-r--r--include/linux/fsnotify_backend.h31
-rw-r--r--include/linux/ftrace.h4
-rw-r--r--include/linux/ftrace_event.h20
-rw-r--r--include/linux/genhd.h8
-rw-r--r--include/linux/genl_magic_func.h422
-rw-r--r--include/linux/genl_magic_struct.h277
-rw-r--r--include/linux/gfp.h13
-rw-r--r--include/linux/gpio.h21
-rw-r--r--include/linux/hardirq.h15
-rw-r--r--include/linux/hash.h2
-rw-r--r--include/linux/hdlc/Kbuild1
-rw-r--r--include/linux/hid-sensor-ids.h1
-rw-r--r--include/linux/hid.h6
-rw-r--r--include/linux/hsi/Kbuild0
-rw-r--r--include/linux/huge_mm.h38
-rw-r--r--include/linux/hugetlb.h15
-rw-r--r--include/linux/hugetlb_cgroup.h5
-rw-r--r--include/linux/hw_breakpoint.h31
-rw-r--r--include/linux/i2c-omap.h3
-rw-r--r--include/linux/i2c.h9
-rw-r--r--include/linux/i2c/i2c-hid.h35
-rw-r--r--include/linux/i2c/i2c-sh_mobile.h1
-rw-r--r--include/linux/i2c/pcf857x.h3
-rw-r--r--include/linux/i2c/twl.h73
-rw-r--r--include/linux/idr.h11
-rw-r--r--include/linux/ieee80211.h188
-rw-r--r--include/linux/if_tunnel.h17
-rw-r--r--include/linux/iio/buffer.h26
-rw-r--r--include/linux/iio/consumer.h50
-rw-r--r--include/linux/iio/iio.h5
-rw-r--r--include/linux/iio/imu/adis.h280
-rw-r--r--include/linux/iio/machine.h2
-rw-r--r--include/linux/iio/types.h2
-rw-r--r--include/linux/ima.h6
-rw-r--r--include/linux/inetdevice.h3
-rw-r--r--include/linux/init.h58
-rw-r--r--include/linux/input.h10
-rw-r--r--include/linux/input/bu21013.h10
-rw-r--r--include/linux/input/mt.h6
-rw-r--r--include/linux/input/ti_am335x_tsc.h23
-rw-r--r--include/linux/input/ti_tscadc.h17
-rw-r--r--include/linux/ip.h5
-rw-r--r--include/linux/ipack.h245
-rw-r--r--include/linux/ipc_namespace.h10
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/ipv6.h38
-rw-r--r--include/linux/irq.h19
-rw-r--r--include/linux/irqchip/spear-shirq.h64
-rw-r--r--include/linux/irqchip/sunxi.h27
-rw-r--r--include/linux/irqchip/versatile-fpga.h13
-rw-r--r--include/linux/irqdesc.h3
-rw-r--r--include/linux/jbd2.h11
-rw-r--r--include/linux/jiffies.h3
-rw-r--r--include/linux/kernel.h61
-rw-r--r--include/linux/kernel_stat.h17
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/kobject.h18
-rw-r--r--include/linux/ktime.h19
-rw-r--r--include/linux/kvm_host.h65
-rw-r--r--include/linux/leds.h17
-rw-r--r--include/linux/libata.h5
-rw-r--r--include/linux/loop.h3
-rw-r--r--include/linux/lru_cache.h71
-rw-r--r--include/linux/memcontrol.h218
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h13
-rw-r--r--include/linux/mempolicy.h37
-rw-r--r--include/linux/mfd/88pm80x.h2
-rw-r--r--include/linux/mfd/abx500.h34
-rw-r--r--include/linux/mfd/abx500/ab8500.h4
-rw-r--r--include/linux/mfd/arizona/core.h4
-rw-r--r--include/linux/mfd/arizona/pdata.h6
-rw-r--r--include/linux/mfd/arizona/registers.h17
-rw-r--r--include/linux/mfd/as3711.h126
-rw-r--r--include/linux/mfd/da9052/da9052.h10
-rw-r--r--include/linux/mfd/da9055/core.h2
-rw-r--r--include/linux/mfd/da9055/pdata.h29
-rw-r--r--include/linux/mfd/da9055/reg.h2
-rw-r--r--include/linux/mfd/db8500-prcmu.h4
-rw-r--r--include/linux/mfd/dbx500-prcmu.h10
-rw-r--r--include/linux/mfd/lp8788.h8
-rw-r--r--include/linux/mfd/max8997-private.h1
-rw-r--r--include/linux/mfd/max8997.h1
-rw-r--r--include/linux/mfd/menelaus.h47
-rw-r--r--include/linux/mfd/pm8xxx/irq.h8
-rw-r--r--include/linux/mfd/rc5t583.h3
-rw-r--r--include/linux/mfd/retu.h22
-rw-r--r--include/linux/mfd/rtsx_common.h48
-rw-r--r--include/linux/mfd/rtsx_pci.h794
-rw-r--r--include/linux/mfd/sta2x11-mfd.h198
-rw-r--r--include/linux/mfd/stmpe.h4
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h152
-rw-r--r--include/linux/mfd/tps65090.h104
-rw-r--r--include/linux/mfd/tps6586x.h4
-rw-r--r--include/linux/mfd/tps65910.h145
-rw-r--r--include/linux/mfd/tps80031.h637
-rw-r--r--include/linux/mfd/twl6040.h10
-rw-r--r--include/linux/mfd/viperboard.h110
-rw-r--r--include/linux/mfd/wm8994/core.h4
-rw-r--r--include/linux/mfd/wm8994/pdata.h5
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/migrate.h65
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/device.h22
-rw-r--r--include/linux/mm.h75
-rw-r--r--include/linux/mm_types.h57
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/dw_mmc.h11
-rw-r--r--include/linux/mmc/host.h17
-rw-r--r--include/linux/mmc/mmc.h2
-rw-r--r--include/linux/mmc/mxs-mmc.h19
-rw-r--r--include/linux/mmc/sdhci.h7
-rw-r--r--include/linux/mmzone.h73
-rw-r--r--include/linux/mnt_namespace.h3
-rw-r--r--include/linux/moduleparam.h6
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/mtd/blktrans.h4
-rw-r--r--include/linux/mtd/doc2000.h22
-rw-r--r--include/linux/mtd/fsmc.h3
-rw-r--r--include/linux/mtd/gpmi-nand.h68
-rw-r--r--include/linux/mtd/map.h4
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/mtd/nand.h11
-rw-r--r--include/linux/mtd/sh_flctl.h14
-rw-r--r--include/linux/namei.h21
-rw-r--r--include/linux/netdevice.h49
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h9
-rw-r--r--include/linux/nfc/pn544.h104
-rw-r--r--include/linux/nfs_fs_sb.h47
-rw-r--r--include/linux/nfs_xdr.h155
-rw-r--r--include/linux/node.h3
-rw-r--r--include/linux/nodemask.h5
-rw-r--r--include/linux/nsproxy.h2
-rw-r--r--include/linux/of.h88
-rw-r--r--include/linux/of_address.h4
-rw-r--r--include/linux/of_i2c.h12
-rw-r--r--include/linux/of_platform.h1
-rw-r--r--include/linux/omap-dma.h366
-rw-r--r--include/linux/omap-iommu.h52
-rw-r--r--include/linux/oom.h21
-rw-r--r--include/linux/openvswitch.h1
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/page-isolation.h10
-rw-r--r--include/linux/pagemap.h16
-rw-r--r--include/linux/pci.h44
-rw-r--r--include/linux/pci_ids.h6
-rw-r--r--include/linux/percpu-rwsem.h91
-rw-r--r--include/linux/pid.h1
-rw-r--r--include/linux/pid_namespace.h13
-rw-r--r--include/linux/pinctrl/pinconf-generic.h5
-rw-r--r--include/linux/pinctrl/pinctrl.h19
-rw-r--r--include/linux/platform_data/ad5449.h40
-rw-r--r--include/linux/platform_data/ad7298.h20
-rw-r--r--include/linux/platform_data/ad7793.h112
-rw-r--r--include/linux/platform_data/ad7887.h26
-rw-r--r--include/linux/platform_data/ads7828.h29
-rw-r--r--include/linux/platform_data/asoc-imx-ssi.h2
-rw-r--r--include/linux/platform_data/asoc-s3c.h6
-rw-r--r--include/linux/platform_data/atmel.h73
-rw-r--r--include/linux/platform_data/clk-integrator.h2
-rw-r--r--include/linux/platform_data/clocksource-nomadik-mtu.h9
-rw-r--r--include/linux/platform_data/cpsw.h23
-rw-r--r--include/linux/platform_data/crypto-ux500.h2
-rw-r--r--include/linux/platform_data/davinci_asp.h4
-rw-r--r--include/linux/platform_data/db8500_thermal.h38
-rw-r--r--include/linux/platform_data/dma-imx.h4
-rw-r--r--include/linux/platform_data/dma-mv_xor.h11
-rw-r--r--include/linux/platform_data/dma-ste-dma40.h223
-rw-r--r--include/linux/platform_data/dmtimer-omap.h31
-rw-r--r--include/linux/platform_data/gpio-omap.h1
-rw-r--r--include/linux/platform_data/gpio-ts5500.h27
-rw-r--r--include/linux/platform_data/i2c-cbus-gpio.h27
-rw-r--r--include/linux/platform_data/iommu-omap.h54
-rw-r--r--include/linux/platform_data/leds-omap.h22
-rw-r--r--include/linux/platform_data/lp855x.h9
-rw-r--r--include/linux/platform_data/macb.h1
-rw-r--r--include/linux/platform_data/mmc-omap.h151
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h46
-rw-r--r--include/linux/platform_data/mtd-nomadik-nand.h16
-rw-r--r--include/linux/platform_data/mtd-onenand-omap2.h28
-rw-r--r--include/linux/platform_data/omap-twl4030.h26
-rw-r--r--include/linux/platform_data/omap-wd-timer.h38
-rw-r--r--include/linux/platform_data/omap_drm.h1
-rw-r--r--include/linux/platform_data/omap_ocp2scp.h31
-rw-r--r--include/linux/platform_data/pinctrl-coh901.h4
-rw-r--r--include/linux/platform_data/pinctrl-nomadik.h266
-rw-r--r--include/linux/platform_data/pn544.h44
-rw-r--r--include/linux/platform_data/pxa2xx_udc.h27
-rw-r--r--include/linux/platform_data/pxa_sdhci.h6
-rw-r--r--include/linux/platform_data/sa11x0-serial.h33
-rw-r--r--include/linux/platform_data/serial-omap.h51
-rw-r--r--include/linux/platform_data/spi-clps711x.h21
-rw-r--r--include/linux/platform_data/spi-omap2-mcspi.h4
-rw-r--r--include/linux/platform_data/ti_am335x_adc.h14
-rw-r--r--include/linux/platform_data/uio_dmem_genirq.h26
-rw-r--r--include/linux/platform_data/uio_pruss.h3
-rw-r--r--include/linux/platform_data/usb-omap.h83
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h3
-rw-r--r--include/linux/pm_qos.h77
-rw-r--r--include/linux/power/bq2415x_charger.h95
-rw-r--r--include/linux/power/smartreflex.h14
-rw-r--r--include/linux/power_supply.h3
-rw-r--r--include/linux/proc_fs.h29
-rw-r--r--include/linux/pstore.h6
-rw-r--r--include/linux/pstore_ram.h5
-rw-r--r--include/linux/ptp_clock_kernel.h3
-rw-r--r--include/linux/ptrace.h19
-rw-r--r--include/linux/pvclock_gtod.h9
-rw-r--r--include/linux/pwm.h3
-rw-r--r--include/linux/raid/Kbuild0
-rw-r--r--include/linux/raid/pq.h4
-rw-r--r--include/linux/random.h19
-rw-r--r--include/linux/rculist.h17
-rw-r--r--include/linux/rcupdate.h29
-rw-r--r--include/linux/regmap.h95
-rw-r--r--include/linux/regulator/consumer.h13
-rw-r--r--include/linux/regulator/driver.h5
-rw-r--r--include/linux/regulator/max8973-regulator.h72
-rw-r--r--include/linux/regulator/tps51632-regulator.h47
-rw-r--r--include/linux/regulator/tps65090-regulator.h50
-rw-r--r--include/linux/res_counter.h17
-rw-r--r--include/linux/ring_buffer.h3
-rw-r--r--include/linux/rio.h2
-rw-r--r--include/linux/rmap.h33
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/sched.h117
-rw-r--r--include/linux/security.h13
-rw-r--r--include/linux/serial_8250.h2
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/sh_clk.h9
-rw-r--r--include/linux/shm.h15
-rw-r--r--include/linux/signal.h3
-rw-r--r--include/linux/skbuff.h102
-rw-r--r--include/linux/slab.h57
-rw-r--r--include/linux/slab_def.h9
-rw-r--r--include/linux/slub_def.h9
-rw-r--r--include/linux/smscphy.h5
-rw-r--r--include/linux/spi/ads7846.h5
-rw-r--r--include/linux/spi/spi-tegra.h40
-rw-r--r--include/linux/spi/spi.h3
-rw-r--r--include/linux/srcu.h34
-rw-r--r--include/linux/ssb/ssb.h6
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h8
-rw-r--r--include/linux/ssb/ssb_driver_extif.h53
-rw-r--r--include/linux/ssb/ssb_driver_mips.h10
-rw-r--r--include/linux/ssb/ssb_regs.h2
-rw-r--r--include/linux/stmmac.h3
-rw-r--r--include/linux/string.h11
-rw-r--r--include/linux/sunrpc/cache.h6
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/svc.h6
-rw-r--r--include/linux/sunrpc/svcsock.h21
-rw-r--r--include/linux/sunxi_timer.h24
-rw-r--r--include/linux/swiotlb.h20
-rw-r--r--include/linux/syscalls.h28
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/tegra-ahb.h19
-rw-r--r--include/linux/thermal.h134
-rw-r--r--include/linux/thread_info.h2
-rw-r--r--include/linux/tick.h6
-rw-r--r--include/linux/timecompare.h125
-rw-r--r--include/linux/trace_clock.h2
-rw-r--r--include/linux/tty.h45
-rw-r--r--include/linux/tty_flip.h2
-rw-r--r--include/linux/types.h1
-rw-r--r--include/linux/udp.h5
-rw-r--r--include/linux/uprobes.h10
-rw-r--r--include/linux/usb.h50
-rw-r--r--include/linux/usb/Kbuild0
-rw-r--r--include/linux/usb/cdc_ncm.h134
-rw-r--r--include/linux/usb/composite.h4
-rw-r--r--include/linux/usb/ehci_pdriver.h5
-rw-r--r--include/linux/usb/ezusb.h8
-rw-r--r--include/linux/usb/gadget.h7
-rw-r--r--include/linux/usb/ohci_pdriver.h2
-rw-r--r--include/linux/usb/phy.h15
-rw-r--r--include/linux/usb/usbnet.h13
-rw-r--r--include/linux/user_namespace.h10
-rw-r--r--include/linux/utsname.h7
-rw-r--r--include/linux/vexpress.h121
-rw-r--r--include/linux/vgaarb.h4
-rw-r--r--include/linux/virtio.h25
-rw-r--r--include/linux/virtio_scsi.h28
-rw-r--r--include/linux/vm_event_item.h14
-rw-r--r--include/linux/vmstat.h8
-rw-r--r--include/linux/vtime.h48
-rw-r--r--include/linux/wait.h164
-rw-r--r--include/linux/watchdog.h4
-rw-r--r--include/linux/writeback.h9
-rw-r--r--include/media/adp1653.h4
-rw-r--r--include/media/adv7604.h21
-rw-r--r--include/media/davinci/vpbe_display.h15
-rw-r--r--include/media/davinci/vpbe_osd.h2
-rw-r--r--include/media/ir-kbd-i2c.h2
-rw-r--r--include/media/mt9v022.h16
-rw-r--r--include/media/rc-core.h4
-rw-r--r--include/media/rc-map.h64
-rw-r--r--include/media/s3c_camif.h45
-rw-r--r--include/media/smiapp.h2
-rw-r--r--include/media/v4l2-event.h2
-rw-r--r--include/media/v4l2-fh.h2
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-mem2mem.h3
-rw-r--r--include/media/videobuf2-core.h38
-rw-r--r--include/media/videobuf2-memops.h5
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/af_unix.h1
-rw-r--r--include/net/bluetooth/a2mp.h24
-rw-r--r--include/net/bluetooth/amp.h54
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/bluetooth/hci.h69
-rw-r--r--include/net/bluetooth/hci_core.h123
-rw-r--r--include/net/bluetooth/l2cap.h50
-rw-r--r--include/net/cfg80211.h306
-rw-r--r--include/net/cls_cgroup.h6
-rw-r--r--include/net/gro_cells.h14
-rw-r--r--include/net/ieee80211_radiotap.h24
-rw-r--r--include/net/inet_connection_sock.h1
-rw-r--r--include/net/inet_hashtables.h50
-rw-r--r--include/net/inet_sock.h8
-rw-r--r--include/net/inet_timewait_sock.h7
-rw-r--r--include/net/ip6_checksum.h35
-rw-r--r--include/net/ip6_fib.h20
-rw-r--r--include/net/ip6_route.h3
-rw-r--r--include/net/ip_vs.h195
-rw-r--r--include/net/ipip.h40
-rw-r--r--include/net/ipv6.h19
-rw-r--r--include/net/irda/irlmp.h2
-rw-r--r--include/net/mac80211.h275
-rw-r--r--include/net/ndisc.h22
-rw-r--r--include/net/net_namespace.h26
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netfilter/nf_nat.h15
-rw-r--r--include/net/netfilter/nf_queue.h8
-rw-r--r--include/net/netns/conntrack.h1
-rw-r--r--include/net/netns/sctp.h3
-rw-r--r--include/net/netns/x_tables.h1
-rw-r--r--include/net/netprio_cgroup.h11
-rw-r--r--include/net/nfc/hci.h21
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/protocol.h31
-rw-r--r--include/net/request_sock.h12
-rw-r--r--include/net/route.h9
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h7
-rw-r--r--include/net/sctp/command.h38
-rw-r--r--include/net/sctp/constants.h8
-rw-r--r--include/net/sctp/sctp.h12
-rw-r--r--include/net/sctp/sm.h2
-rw-r--r--include/net/sctp/structs.h39
-rw-r--r--include/net/sctp/ulpqueue.h2
-rw-r--r--include/net/sctp/user.h27
-rw-r--r--include/net/sock.h32
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/net/xfrm.h2
-rw-r--r--include/rdma/Kbuild6
-rw-r--r--include/rdma/rdma_netlink.h36
-rw-r--r--include/scsi/scsi_device.h5
-rw-r--r--include/scsi/scsi_transport_sas.h1
-rw-r--r--include/scsi/scsi_transport_srp.h8
-rw-r--r--include/sound/Kbuild10
-rw-r--r--include/sound/asequencer.h594
-rw-r--r--include/sound/asound.h935
-rw-r--r--include/sound/cs4271.h1
-rw-r--r--include/sound/emu10k1.h359
-rw-r--r--include/sound/pcm.h3
-rw-r--r--include/sound/sb16_csp.h104
-rw-r--r--include/sound/sh_fsi.h6
-rw-r--r--include/sound/soc-dai.h1
-rw-r--r--include/sound/soc.h1
-rw-r--r--include/sound/tlv320aic32x4.h1
-rw-r--r--include/sound/vx_core.h6
-rw-r--r--include/target/target_core_backend.h49
-rw-r--r--include/target/target_core_base.h212
-rw-r--r--include/target/target_core_fabric.h15
-rw-r--r--include/trace/events/btrfs.h3
-rw-r--r--include/trace/events/ext4.h150
-rw-r--r--include/trace/events/gfpflags.h2
-rw-r--r--include/trace/events/migrate.h51
-rw-r--r--include/trace/events/oom.h4
-rw-r--r--include/trace/events/rcu.h1
-rw-r--r--include/trace/events/task.h8
-rw-r--r--include/trace/ftrace.h76
-rw-r--r--include/trace/syscall.h23
-rw-r--r--include/uapi/asm-generic/ioctls.h3
-rw-r--r--include/uapi/asm-generic/mman-common.h11
-rw-r--r--include/uapi/asm-generic/mman.h2
-rw-r--r--include/uapi/asm-generic/signal.h6
-rw-r--r--include/uapi/asm-generic/socket.h1
-rw-r--r--include/uapi/asm-generic/unistd.h4
-rw-r--r--include/uapi/drm/exynos_drm.h227
-rw-r--r--include/uapi/drm/i915_drm.h10
-rw-r--r--include/uapi/drm/radeon_drm.h6
-rw-r--r--include/uapi/linux/Kbuild2
-rw-r--r--include/uapi/linux/dm-ioctl.h4
-rw-r--r--include/uapi/linux/ethtool.h25
-rw-r--r--include/uapi/linux/eventpoll.h1
-rw-r--r--include/uapi/linux/filter.h4
-rw-r--r--include/uapi/linux/hdlc/Kbuild1
-rw-r--r--include/uapi/linux/hdlc/ioctl.h (renamed from include/linux/hdlc/ioctl.h)7
-rw-r--r--include/uapi/linux/hw_breakpoint.h30
-rw-r--r--include/uapi/linux/if_bridge.h84
-rw-r--r--include/uapi/linux/if_ether.h1
-rw-r--r--include/uapi/linux/if_link.h22
-rw-r--r--include/uapi/linux/if_packet.h1
-rw-r--r--include/uapi/linux/if_tun.h7
-rw-r--r--include/uapi/linux/if_tunnel.h20
-rw-r--r--include/uapi/linux/in6.h1
-rw-r--r--include/uapi/linux/inet_diag.h3
-rw-r--r--include/uapi/linux/input.h1
-rw-r--r--include/uapi/linux/ipv6.h1
-rw-r--r--include/uapi/linux/ipv6_route.h3
-rw-r--r--include/uapi/linux/kvm.h21
-rw-r--r--include/uapi/linux/magic.h2
-rw-r--r--include/uapi/linux/mempolicy.h15
-rw-r--r--include/uapi/linux/module.h8
-rw-r--r--include/uapi/linux/msg.h1
-rw-r--r--include/uapi/linux/netconf.h24
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_conntrack.h2
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/uapi/linux/nfc.h15
-rw-r--r--include/uapi/linux/nl80211.h177
-rw-r--r--include/uapi/linux/oom.h9
-rw-r--r--include/uapi/linux/pci_regs.h25
-rw-r--r--include/uapi/linux/ptp_clock.h14
-rw-r--r--include/uapi/linux/ptrace.h5
-rw-r--r--include/uapi/linux/rtnetlink.h26
-rw-r--r--include/uapi/linux/serial_core.h5
-rw-r--r--include/uapi/linux/serial_reg.h18
-rw-r--r--include/uapi/linux/signal.h2
-rw-r--r--include/uapi/linux/swab.h12
-rw-r--r--include/uapi/linux/unix_diag.h1
-rw-r--r--include/uapi/linux/usb/cdc.h23
-rw-r--r--include/uapi/linux/videodev2.h37
-rw-r--r--include/uapi/linux/virtio_ids.h1
-rw-r--r--include/uapi/linux/virtio_net.h27
-rw-r--r--include/uapi/rdma/Kbuild6
-rw-r--r--include/uapi/rdma/ib_user_cm.h (renamed from include/rdma/ib_user_cm.h)0
-rw-r--r--include/uapi/rdma/ib_user_mad.h (renamed from include/rdma/ib_user_mad.h)0
-rw-r--r--include/uapi/rdma/ib_user_sa.h (renamed from include/rdma/ib_user_sa.h)0
-rw-r--r--include/uapi/rdma/ib_user_verbs.h (renamed from include/rdma/ib_user_verbs.h)0
-rw-r--r--include/uapi/rdma/rdma_netlink.h37
-rw-r--r--include/uapi/rdma/rdma_user_cm.h (renamed from include/rdma/rdma_user_cm.h)0
-rw-r--r--include/uapi/sound/Kbuild10
-rw-r--r--include/uapi/sound/asequencer.h614
-rw-r--r--include/uapi/sound/asound.h971
-rw-r--r--include/uapi/sound/asound_fm.h (renamed from include/sound/asound_fm.h)0
-rw-r--r--include/uapi/sound/compress_offload.h (renamed from include/sound/compress_offload.h)0
-rw-r--r--include/uapi/sound/compress_params.h (renamed from include/sound/compress_params.h)0
-rw-r--r--include/uapi/sound/emu10k1.h373
-rw-r--r--include/uapi/sound/hdsp.h (renamed from include/sound/hdsp.h)0
-rw-r--r--include/uapi/sound/hdspm.h (renamed from include/sound/hdspm.h)0
-rw-r--r--include/uapi/sound/sb16_csp.h122
-rw-r--r--include/uapi/sound/sfnt_info.h (renamed from include/sound/sfnt_info.h)0
-rw-r--r--include/video/da8xx-fb.h25
-rw-r--r--include/video/omap-panel-tfp410.h2
-rw-r--r--include/video/omapdss.h105
-rw-r--r--include/video/omapvrfb.h68
-rw-r--r--include/video/samsung_fimd.h168
-rw-r--r--include/video/sh_mipi_dsi.h4
-rw-r--r--include/video/sh_mobile_lcdc.h1
-rw-r--r--include/xen/hvm.h34
-rw-r--r--include/xen/interface/event_channel.h13
-rw-r--r--include/xen/interface/memory.h44
-rw-r--r--include/xen/interface/platform.h17
-rw-r--r--include/xen/xen-ops.h9
579 files changed, 17631 insertions, 5445 deletions
diff --git a/include/Kbuild b/include/Kbuild
index 83256b64166a..1dfd33e8d43b 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,8 +1,5 @@
1# Top-level Makefile calls into asm-$(ARCH) 1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below 2# List only non-arch directories below
3 3
4header-y += linux/
5header-y += sound/
6header-y += rdma/
7header-y += video/ 4header-y += video/
8header-y += scsi/ 5header-y += scsi/
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 03f14856bd09..0943457e0fa5 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -241,6 +241,7 @@
241 *****************************************************************************/ 241 *****************************************************************************/
242 242
243#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ 243#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
244#define ACPI_DB_LINE_BUFFER_SIZE 512
244 245
245#define ACPI_DEBUGGER_COMMAND_PROMPT '-' 246#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
246#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' 247#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 19503449814f..6c3890e02140 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -122,7 +122,7 @@
122#define AE_CODE_TBL_MAX 0x0005 122#define AE_CODE_TBL_MAX 0x0005
123 123
124/* 124/*
125 * AML exceptions. These are caused by problems with 125 * AML exceptions. These are caused by problems with
126 * the actual AML byte stream 126 * the actual AML byte stream
127 */ 127 */
128#define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML) 128#define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML)
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 745dd24e3cb5..7665df663284 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -50,6 +50,7 @@
50#define METHOD_NAME__HID "_HID" 50#define METHOD_NAME__HID "_HID"
51#define METHOD_NAME__CID "_CID" 51#define METHOD_NAME__CID "_CID"
52#define METHOD_NAME__UID "_UID" 52#define METHOD_NAME__UID "_UID"
53#define METHOD_NAME__SUB "_SUB"
53#define METHOD_NAME__ADR "_ADR" 54#define METHOD_NAME__ADR "_ADR"
54#define METHOD_NAME__INI "_INI" 55#define METHOD_NAME__INI "_INI"
55#define METHOD_NAME__STA "_STA" 56#define METHOD_NAME__STA "_STA"
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 0daa0fbd8654..7ced5dc20dd3 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -144,12 +144,11 @@ struct acpi_device_flags {
144 u32 bus_address:1; 144 u32 bus_address:1;
145 u32 removable:1; 145 u32 removable:1;
146 u32 ejectable:1; 146 u32 ejectable:1;
147 u32 lockable:1;
148 u32 suprise_removal_ok:1; 147 u32 suprise_removal_ok:1;
149 u32 power_manageable:1; 148 u32 power_manageable:1;
150 u32 performance_manageable:1; 149 u32 performance_manageable:1;
151 u32 eject_pending:1; 150 u32 eject_pending:1;
152 u32 reserved:23; 151 u32 reserved:24;
153}; 152};
154 153
155/* File System */ 154/* File System */
@@ -180,6 +179,7 @@ struct acpi_device_pnp {
180 acpi_device_name device_name; /* Driver-determined */ 179 acpi_device_name device_name; /* Driver-determined */
181 acpi_device_class device_class; /* " */ 180 acpi_device_class device_class; /* " */
182 union acpi_object *str_obj; /* unicode string for _STR method */ 181 union acpi_object *str_obj; /* unicode string for _STR method */
182 unsigned long sun; /* _SUN */
183}; 183};
184 184
185#define acpi_device_bid(d) ((d)->pnp.bus_id) 185#define acpi_device_bid(d) ((d)->pnp.bus_id)
@@ -201,6 +201,7 @@ struct acpi_device_power_flags {
201struct acpi_device_power_state { 201struct acpi_device_power_state {
202 struct { 202 struct {
203 u8 valid:1; 203 u8 valid:1;
204 u8 os_accessible:1;
204 u8 explicit_set:1; /* _PSx present? */ 205 u8 explicit_set:1; /* _PSx present? */
205 u8 reserved:6; 206 u8 reserved:6;
206 } flags; 207 } flags;
@@ -339,6 +340,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
339 unsigned long long *sta); 340 unsigned long long *sta);
340int acpi_bus_get_status(struct acpi_device *device); 341int acpi_bus_get_status(struct acpi_device *device);
341int acpi_bus_set_power(acpi_handle handle, int state); 342int acpi_bus_set_power(acpi_handle handle, int state);
343int acpi_device_set_power(struct acpi_device *device, int state);
342int acpi_bus_update_power(acpi_handle handle, int *state_p); 344int acpi_bus_update_power(acpi_handle handle, int *state_p);
343bool acpi_bus_power_manageable(acpi_handle handle); 345bool acpi_bus_power_manageable(acpi_handle handle);
344bool acpi_bus_can_wakeup(acpi_handle handle); 346bool acpi_bus_can_wakeup(acpi_handle handle);
@@ -410,36 +412,100 @@ acpi_handle acpi_get_child(acpi_handle, u64);
410int acpi_is_root_bridge(acpi_handle); 412int acpi_is_root_bridge(acpi_handle);
411acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 413acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
412struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 414struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
413#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 415#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
414 416
415int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); 417int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
416int acpi_disable_wakeup_device_power(struct acpi_device *dev); 418int acpi_disable_wakeup_device_power(struct acpi_device *dev);
417 419
418#ifdef CONFIG_PM 420#ifdef CONFIG_PM
421acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
422 acpi_notify_handler handler, void *context);
423acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
424 acpi_notify_handler handler);
425int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
426 u32 target_state, int d_max_in, int *d_min_p);
419int acpi_pm_device_sleep_state(struct device *, int *, int); 427int acpi_pm_device_sleep_state(struct device *, int *, int);
420#else 428#else
421static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) 429static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
430 acpi_notify_handler handler,
431 void *context)
432{
433 return AE_SUPPORT;
434}
435static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
436 acpi_notify_handler handler)
437{
438 return AE_SUPPORT;
439}
440static inline int __acpi_device_power_state(int m, int *p)
422{ 441{
423 if (p) 442 if (p)
424 *p = ACPI_STATE_D0; 443 *p = ACPI_STATE_D0;
425 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; 444 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0;
426} 445}
446static inline int acpi_device_power_state(struct device *dev,
447 struct acpi_device *adev,
448 u32 target_state, int d_max_in,
449 int *d_min_p)
450{
451 return __acpi_device_power_state(d_max_in, d_min_p);
452}
453static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
454{
455 return __acpi_device_power_state(m, p);
456}
427#endif 457#endif
428 458
429#ifdef CONFIG_PM_SLEEP 459#ifdef CONFIG_PM_RUNTIME
460int __acpi_device_run_wake(struct acpi_device *, bool);
430int acpi_pm_device_run_wake(struct device *, bool); 461int acpi_pm_device_run_wake(struct device *, bool);
431int acpi_pm_device_sleep_wake(struct device *, bool);
432#else 462#else
463static inline int __acpi_device_run_wake(struct acpi_device *adev, bool en)
464{
465 return -ENODEV;
466}
433static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) 467static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
434{ 468{
435 return -ENODEV; 469 return -ENODEV;
436} 470}
471#endif
472
473#ifdef CONFIG_PM_SLEEP
474int __acpi_device_sleep_wake(struct acpi_device *, u32, bool);
475int acpi_pm_device_sleep_wake(struct device *, bool);
476#else
477static inline int __acpi_device_sleep_wake(struct acpi_device *adev,
478 u32 target_state, bool enable)
479{
480 return -ENODEV;
481}
437static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) 482static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
438{ 483{
439 return -ENODEV; 484 return -ENODEV;
440} 485}
441#endif 486#endif
442 487
488#ifdef CONFIG_ACPI_SLEEP
489u32 acpi_target_system_state(void);
490#else
491static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; }
492#endif
493
494static inline bool acpi_device_power_manageable(struct acpi_device *adev)
495{
496 return adev->flags.power_manageable;
497}
498
499static inline bool acpi_device_can_wakeup(struct acpi_device *adev)
500{
501 return adev->wakeup.flags.valid;
502}
503
504static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
505{
506 return adev->power.states[ACPI_STATE_D3_COLD].flags.os_accessible;
507}
508
443#else /* CONFIG_ACPI */ 509#else /* CONFIG_ACPI */
444 510
445static inline int register_acpi_bus_type(void *bus) { return 0; } 511static inline int register_acpi_bus_type(void *bus) { return 0; }
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index bb145e4b935e..8b1d7a6a9695 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -92,8 +92,8 @@ int acpi_pci_link_free_irq(acpi_handle handle);
92 92
93/* ACPI PCI Interrupt Routing (pci_irq.c) */ 93/* ACPI PCI Interrupt Routing (pci_irq.c) */
94 94
95int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus); 95int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus);
96void acpi_pci_irq_del_prt(struct pci_bus *bus); 96void acpi_pci_irq_del_prt(int segment, int bus);
97 97
98/* ACPI PCI Device Binding (pci_bind.c) */ 98/* ACPI PCI Device Binding (pci_bind.c) */
99 99
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 1222ba93d80a..43152742b46f 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -1,7 +1,6 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These 3 * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
5 * interfaces must be implemented by OSL to interface the 4 * interfaces must be implemented by OSL to interface the
6 * ACPI components to the host operating system. 5 * ACPI components to the host operating system.
7 * 6 *
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 8b891dbead66..3d88395d4d6f 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Name: acpixf.h - External interfaces to the ACPI subsystem 3 * Name: acpixf.h - External interfaces to the ACPI subsystem
@@ -47,7 +46,7 @@
47 46
48/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
49 48
50#define ACPI_CA_VERSION 0x20120913 49#define ACPI_CA_VERSION 0x20121018
51 50
52#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
53#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -178,8 +177,7 @@ acpi_status acpi_unload_table_id(acpi_owner_id id);
178 177
179acpi_status 178acpi_status
180acpi_get_table_header(acpi_string signature, 179acpi_get_table_header(acpi_string signature,
181 u32 instance, 180 u32 instance, struct acpi_table_header *out_table_header);
182 struct acpi_table_header *out_table_header);
183 181
184acpi_status 182acpi_status
185acpi_get_table_with_size(acpi_string signature, 183acpi_get_table_with_size(acpi_string signature,
@@ -190,8 +188,7 @@ acpi_get_table(acpi_string signature,
190 u32 instance, struct acpi_table_header **out_table); 188 u32 instance, struct acpi_table_header **out_table);
191 189
192acpi_status 190acpi_status
193acpi_get_table_by_index(u32 table_index, 191acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table);
194 struct acpi_table_header **out_table);
195 192
196acpi_status 193acpi_status
197acpi_install_table_handler(acpi_tbl_handler handler, void *context); 194acpi_install_table_handler(acpi_tbl_handler handler, void *context);
@@ -274,7 +271,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
274 271
275ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 272ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
276 acpi_install_global_event_handler 273 acpi_install_global_event_handler
277 (ACPI_GBL_EVENT_HANDLER handler, void *context)) 274 (acpi_gbl_event_handler handler, void *context))
278 275
279ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 276ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
280 acpi_install_fixed_event_handler(u32 277 acpi_install_fixed_event_handler(u32
@@ -300,10 +297,9 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
300 u32 gpe_number, 297 u32 gpe_number,
301 acpi_gpe_handler 298 acpi_gpe_handler
302 address)) 299 address))
303acpi_status 300acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type,
304acpi_install_notify_handler(acpi_handle device, 301 acpi_notify_handler handler,
305 u32 handler_type, 302 void *context);
306 acpi_notify_handler handler, void *context);
307 303
308acpi_status 304acpi_status
309acpi_remove_notify_handler(acpi_handle device, 305acpi_remove_notify_handler(acpi_handle device,
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index 8c61b5fe42a4..6585141e4b97 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -277,10 +277,10 @@ struct acpi_table_gtdt {
277 ******************************************************************************/ 277 ******************************************************************************/
278 278
279#define ACPI_MPST_CHANNEL_INFO \ 279#define ACPI_MPST_CHANNEL_INFO \
280 u16 reserved1; \
281 u8 channel_id; \ 280 u8 channel_id; \
282 u8 reserved2; \ 281 u8 reserved1[3]; \
283 u16 power_node_count; 282 u16 power_node_count; \
283 u16 reserved2;
284 284
285/* Main table */ 285/* Main table */
286 286
@@ -304,9 +304,8 @@ struct acpi_mpst_power_node {
304 u32 length; 304 u32 length;
305 u64 range_address; 305 u64 range_address;
306 u64 range_length; 306 u64 range_length;
307 u8 num_power_states; 307 u32 num_power_states;
308 u8 num_physical_components; 308 u32 num_physical_components;
309 u16 reserved2;
310}; 309};
311 310
312/* Values for Flags field above */ 311/* Values for Flags field above */
@@ -332,10 +331,11 @@ struct acpi_mpst_component {
332 331
333struct acpi_mpst_data_hdr { 332struct acpi_mpst_data_hdr {
334 u16 characteristics_count; 333 u16 characteristics_count;
334 u16 reserved;
335}; 335};
336 336
337struct acpi_mpst_power_data { 337struct acpi_mpst_power_data {
338 u8 revision; 338 u8 structure_id;
339 u8 flags; 339 u8 flags;
340 u16 reserved1; 340 u16 reserved1;
341 u32 average_power; 341 u32 average_power;
@@ -356,10 +356,10 @@ struct acpi_mpst_shared {
356 u32 signature; 356 u32 signature;
357 u16 pcc_command; 357 u16 pcc_command;
358 u16 pcc_status; 358 u16 pcc_status;
359 u16 command_register; 359 u32 command_register;
360 u16 status_register; 360 u32 status_register;
361 u16 power_state_id; 361 u32 power_state_id;
362 u16 power_node_id; 362 u32 power_node_id;
363 u64 energy_consumed; 363 u64 energy_consumed;
364 u64 average_power; 364 u64 average_power;
365}; 365};
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index a85bae968262..4f43f1fba132 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -453,10 +453,14 @@ typedef u64 acpi_integer;
453#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 453#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
454#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 454#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
455 455
456/* Optimizations for 4-character (32-bit) acpi_name manipulation */
457
456#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 458#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
457#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) 459#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
460#define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src)))
458#else 461#else
459#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) 462#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
463#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
460#endif 464#endif
461 465
462/******************************************************************************* 466/*******************************************************************************
@@ -796,11 +800,11 @@ typedef u8 acpi_adr_space_type;
796 800
797/* Sleep function dispatch */ 801/* Sleep function dispatch */
798 802
799typedef acpi_status(*ACPI_SLEEP_FUNCTION) (u8 sleep_state); 803typedef acpi_status(*acpi_sleep_function) (u8 sleep_state);
800 804
801struct acpi_sleep_functions { 805struct acpi_sleep_functions {
802 ACPI_SLEEP_FUNCTION legacy_function; 806 acpi_sleep_function legacy_function;
803 ACPI_SLEEP_FUNCTION extended_function; 807 acpi_sleep_function extended_function;
804}; 808};
805 809
806/* 810/*
@@ -922,7 +926,8 @@ struct acpi_system_info {
922/* 926/*
923 * Types specific to the OS service interfaces 927 * Types specific to the OS service interfaces
924 */ 928 */
925typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); 929typedef u32
930 (ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context);
926 931
927typedef void 932typedef void
928 (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); 933 (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context);
@@ -931,14 +936,15 @@ typedef void
931 * Various handlers and callback procedures 936 * Various handlers and callback procedures
932 */ 937 */
933typedef 938typedef
934void (*ACPI_GBL_EVENT_HANDLER) (u32 event_type, 939void (*acpi_gbl_event_handler) (u32 event_type,
935 acpi_handle device, 940 acpi_handle device,
936 u32 event_number, void *context); 941 u32 event_number, void *context);
937 942
938#define ACPI_EVENT_TYPE_GPE 0 943#define ACPI_EVENT_TYPE_GPE 0
939#define ACPI_EVENT_TYPE_FIXED 1 944#define ACPI_EVENT_TYPE_FIXED 1
940 945
941typedef u32(*acpi_event_handler) (void *context); 946typedef
947u32(*acpi_event_handler) (void *context);
942 948
943typedef 949typedef
944u32 (*acpi_gpe_handler) (acpi_handle gpe_device, u32 gpe_number, void *context); 950u32 (*acpi_gpe_handler) (acpi_handle gpe_device, u32 gpe_number, void *context);
@@ -1018,17 +1024,17 @@ u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported);
1018 1024
1019#define ACPI_UUID_LENGTH 16 1025#define ACPI_UUID_LENGTH 16
1020 1026
1021/* Structures used for device/processor HID, UID, CID */ 1027/* Structures used for device/processor HID, UID, CID, and SUB */
1022 1028
1023struct acpica_device_id { 1029struct acpi_pnp_device_id {
1024 u32 length; /* Length of string + null */ 1030 u32 length; /* Length of string + null */
1025 char *string; 1031 char *string;
1026}; 1032};
1027 1033
1028struct acpica_device_id_list { 1034struct acpi_pnp_device_id_list {
1029 u32 count; /* Number of IDs in Ids array */ 1035 u32 count; /* Number of IDs in Ids array */
1030 u32 list_size; /* Size of list, including ID strings */ 1036 u32 list_size; /* Size of list, including ID strings */
1031 struct acpica_device_id ids[1]; /* ID array */ 1037 struct acpi_pnp_device_id ids[1]; /* ID array */
1032}; 1038};
1033 1039
1034/* 1040/*
@@ -1046,9 +1052,10 @@ struct acpi_device_info {
1046 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ 1052 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */
1047 u32 current_status; /* _STA value */ 1053 u32 current_status; /* _STA value */
1048 u64 address; /* _ADR value */ 1054 u64 address; /* _ADR value */
1049 struct acpica_device_id hardware_id; /* _HID value */ 1055 struct acpi_pnp_device_id hardware_id; /* _HID value */
1050 struct acpica_device_id unique_id; /* _UID value */ 1056 struct acpi_pnp_device_id unique_id; /* _UID value */
1051 struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ 1057 struct acpi_pnp_device_id subsystem_id; /* _SUB value */
1058 struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */
1052}; 1059};
1053 1060
1054/* Values for Flags field above (acpi_get_object_info) */ 1061/* Values for Flags field above (acpi_get_object_info) */
@@ -1061,11 +1068,12 @@ struct acpi_device_info {
1061#define ACPI_VALID_ADR 0x02 1068#define ACPI_VALID_ADR 0x02
1062#define ACPI_VALID_HID 0x04 1069#define ACPI_VALID_HID 0x04
1063#define ACPI_VALID_UID 0x08 1070#define ACPI_VALID_UID 0x08
1064#define ACPI_VALID_CID 0x10 1071#define ACPI_VALID_SUB 0x10
1065#define ACPI_VALID_SXDS 0x20 1072#define ACPI_VALID_CID 0x20
1066#define ACPI_VALID_SXWS 0x40 1073#define ACPI_VALID_SXDS 0x40
1074#define ACPI_VALID_SXWS 0x80
1067 1075
1068/* Flags for _STA method */ 1076/* Flags for _STA return value (current_status above) */
1069 1077
1070#define ACPI_STA_DEVICE_PRESENT 0x01 1078#define ACPI_STA_DEVICE_PRESENT 0x01
1071#define ACPI_STA_DEVICE_ENABLED 0x02 1079#define ACPI_STA_DEVICE_ENABLED 0x02
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index a9432fc6b8ba..20ca7663975f 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -5,6 +5,7 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/of.h> 7#include <linux/of.h>
8#include <linux/pinctrl/pinctrl.h>
8 9
9#ifdef CONFIG_GPIOLIB 10#ifdef CONFIG_GPIOLIB
10 11
@@ -56,6 +57,8 @@ struct device_node;
56 * enabling module power and clock; may sleep 57 * enabling module power and clock; may sleep
57 * @free: optional hook for chip-specific deactivation, such as 58 * @free: optional hook for chip-specific deactivation, such as
58 * disabling module power and clock; may sleep 59 * disabling module power and clock; may sleep
60 * @get_direction: returns direction for signal "offset", 0=out, 1=in,
61 * (same as GPIOF_DIR_XXX), or negative error
59 * @direction_input: configures signal "offset" as input, or returns error 62 * @direction_input: configures signal "offset" as input, or returns error
60 * @get: returns value for signal "offset"; for output signals this 63 * @get: returns value for signal "offset"; for output signals this
61 * returns either the value actually sensed, or zero 64 * returns either the value actually sensed, or zero
@@ -100,7 +103,8 @@ struct gpio_chip {
100 unsigned offset); 103 unsigned offset);
101 void (*free)(struct gpio_chip *chip, 104 void (*free)(struct gpio_chip *chip,
102 unsigned offset); 105 unsigned offset);
103 106 int (*get_direction)(struct gpio_chip *chip,
107 unsigned offset);
104 int (*direction_input)(struct gpio_chip *chip, 108 int (*direction_input)(struct gpio_chip *chip,
105 unsigned offset); 109 unsigned offset);
106 int (*get)(struct gpio_chip *chip, 110 int (*get)(struct gpio_chip *chip,
@@ -134,6 +138,15 @@ struct gpio_chip {
134 int (*of_xlate)(struct gpio_chip *gc, 138 int (*of_xlate)(struct gpio_chip *gc,
135 const struct of_phandle_args *gpiospec, u32 *flags); 139 const struct of_phandle_args *gpiospec, u32 *flags);
136#endif 140#endif
141#ifdef CONFIG_PINCTRL
142 /*
143 * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
144 * describe the actual pin range which they serve in an SoC. This
145 * information would be used by pinctrl subsystem to configure
146 * corresponding pins for gpio usage.
147 */
148 struct list_head pin_ranges;
149#endif
137}; 150};
138 151
139extern const char *gpiochip_is_requested(struct gpio_chip *chip, 152extern const char *gpiochip_is_requested(struct gpio_chip *chip,
@@ -257,4 +270,41 @@ static inline void gpio_unexport(unsigned gpio)
257} 270}
258#endif /* CONFIG_GPIO_SYSFS */ 271#endif /* CONFIG_GPIO_SYSFS */
259 272
273#ifdef CONFIG_PINCTRL
274
275/**
276 * struct gpio_pin_range - pin range controlled by a gpio chip
277 * @head: list for maintaining set of pin ranges, used internally
278 * @pctldev: pinctrl device which handles corresponding pins
279 * @range: actual range of pins controlled by a gpio controller
280 */
281
282struct gpio_pin_range {
283 struct list_head node;
284 struct pinctrl_dev *pctldev;
285 struct pinctrl_gpio_range range;
286};
287
288int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
289 unsigned int gpio_offset, unsigned int pin_offset,
290 unsigned int npins);
291void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
292
293#else
294
295static inline int
296gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
297 unsigned int gpio_offset, unsigned int pin_offset,
298 unsigned int npins)
299{
300 return 0;
301}
302
303static inline void
304gpiochip_remove_pin_ranges(struct gpio_chip *chip)
305{
306}
307
308#endif /* CONFIG_PINCTRL */
309
260#endif /* _ASM_GENERIC_GPIO_H */ 310#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 448303bdb85f..33bbbae4ddc6 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -12,7 +12,6 @@
12#define __ASM_GENERIC_IO_H 12#define __ASM_GENERIC_IO_H
13 13
14#include <asm/page.h> /* I/O is all done through memory accesses */ 14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <asm/cacheflush.h>
16#include <linux/types.h> 15#include <linux/types.h>
17 16
18#ifdef CONFIG_GENERIC_IOMAP 17#ifdef CONFIG_GENERIC_IOMAP
@@ -83,19 +82,25 @@ static inline void __raw_writel(u32 b, volatile void __iomem *addr)
83#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr) 82#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr)
84 83
85#ifdef CONFIG_64BIT 84#ifdef CONFIG_64BIT
85#ifndef __raw_readq
86static inline u64 __raw_readq(const volatile void __iomem *addr) 86static inline u64 __raw_readq(const volatile void __iomem *addr)
87{ 87{
88 return *(const volatile u64 __force *) addr; 88 return *(const volatile u64 __force *) addr;
89} 89}
90#endif
91
90#define readq(addr) __le64_to_cpu(__raw_readq(addr)) 92#define readq(addr) __le64_to_cpu(__raw_readq(addr))
91 93
94#ifndef __raw_writeq
92static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 95static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
93{ 96{
94 *(volatile u64 __force *) addr = b; 97 *(volatile u64 __force *) addr = b;
95} 98}
96#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
97#endif 99#endif
98 100
101#define writeq(b, addr) __raw_writeq(__cpu_to_le64(b), addr)
102#endif /* CONFIG_64BIT */
103
99#ifndef PCI_IOBASE 104#ifndef PCI_IOBASE
100#define PCI_IOBASE ((void __iomem *) 0) 105#define PCI_IOBASE ((void __iomem *) 0)
101#endif 106#endif
@@ -148,7 +153,7 @@ static inline void insb(unsigned long addr, void *buffer, int count)
148 if (count) { 153 if (count) {
149 u8 *buf = buffer; 154 u8 *buf = buffer;
150 do { 155 do {
151 u8 x = inb(addr); 156 u8 x = __raw_readb(addr + PCI_IOBASE);
152 *buf++ = x; 157 *buf++ = x;
153 } while (--count); 158 } while (--count);
154 } 159 }
@@ -161,7 +166,7 @@ static inline void insw(unsigned long addr, void *buffer, int count)
161 if (count) { 166 if (count) {
162 u16 *buf = buffer; 167 u16 *buf = buffer;
163 do { 168 do {
164 u16 x = inw(addr); 169 u16 x = __raw_readw(addr + PCI_IOBASE);
165 *buf++ = x; 170 *buf++ = x;
166 } while (--count); 171 } while (--count);
167 } 172 }
@@ -174,7 +179,7 @@ static inline void insl(unsigned long addr, void *buffer, int count)
174 if (count) { 179 if (count) {
175 u32 *buf = buffer; 180 u32 *buf = buffer;
176 do { 181 do {
177 u32 x = inl(addr); 182 u32 x = __raw_readl(addr + PCI_IOBASE);
178 *buf++ = x; 183 *buf++ = x;
179 } while (--count); 184 } while (--count);
180 } 185 }
@@ -187,7 +192,7 @@ static inline void outsb(unsigned long addr, const void *buffer, int count)
187 if (count) { 192 if (count) {
188 const u8 *buf = buffer; 193 const u8 *buf = buffer;
189 do { 194 do {
190 outb(*buf++, addr); 195 __raw_writeb(*buf++, addr + PCI_IOBASE);
191 } while (--count); 196 } while (--count);
192 } 197 }
193} 198}
@@ -199,7 +204,7 @@ static inline void outsw(unsigned long addr, const void *buffer, int count)
199 if (count) { 204 if (count) {
200 const u16 *buf = buffer; 205 const u16 *buf = buffer;
201 do { 206 do {
202 outw(*buf++, addr); 207 __raw_writew(*buf++, addr + PCI_IOBASE);
203 } while (--count); 208 } while (--count);
204 } 209 }
205} 210}
@@ -211,42 +216,12 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
211 if (count) { 216 if (count) {
212 const u32 *buf = buffer; 217 const u32 *buf = buffer;
213 do { 218 do {
214 outl(*buf++, addr); 219 __raw_writel(*buf++, addr + PCI_IOBASE);
215 } while (--count); 220 } while (--count);
216 } 221 }
217} 222}
218#endif 223#endif
219 224
220static inline void readsl(const void __iomem *addr, void *buf, int len)
221{
222 insl(addr - PCI_IOBASE, buf, len);
223}
224
225static inline void readsw(const void __iomem *addr, void *buf, int len)
226{
227 insw(addr - PCI_IOBASE, buf, len);
228}
229
230static inline void readsb(const void __iomem *addr, void *buf, int len)
231{
232 insb(addr - PCI_IOBASE, buf, len);
233}
234
235static inline void writesl(const void __iomem *addr, const void *buf, int len)
236{
237 outsl(addr - PCI_IOBASE, buf, len);
238}
239
240static inline void writesw(const void __iomem *addr, const void *buf, int len)
241{
242 outsw(addr - PCI_IOBASE, buf, len);
243}
244
245static inline void writesb(const void __iomem *addr, const void *buf, int len)
246{
247 outsb(addr - PCI_IOBASE, buf, len);
248}
249
250#ifndef CONFIG_GENERIC_IOMAP 225#ifndef CONFIG_GENERIC_IOMAP
251#define ioread8(addr) readb(addr) 226#define ioread8(addr) readb(addr)
252#define ioread16(addr) readw(addr) 227#define ioread16(addr) readw(addr)
@@ -286,15 +261,20 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
286 261
287#ifndef CONFIG_GENERIC_IOMAP 262#ifndef CONFIG_GENERIC_IOMAP
288struct pci_dev; 263struct pci_dev;
264extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
265
266#ifndef pci_iounmap
289static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 267static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
290{ 268{
291} 269}
270#endif
292#endif /* CONFIG_GENERIC_IOMAP */ 271#endif /* CONFIG_GENERIC_IOMAP */
293 272
294/* 273/*
295 * Change virtual addresses to physical addresses and vv. 274 * Change virtual addresses to physical addresses and vv.
296 * These are pretty trivial 275 * These are pretty trivial
297 */ 276 */
277#ifndef virt_to_phys
298static inline unsigned long virt_to_phys(volatile void *address) 278static inline unsigned long virt_to_phys(volatile void *address)
299{ 279{
300 return __pa((unsigned long)address); 280 return __pa((unsigned long)address);
@@ -304,6 +284,7 @@ static inline void *phys_to_virt(unsigned long address)
304{ 284{
305 return __va(address); 285 return __va(address);
306} 286}
287#endif
307 288
308/* 289/*
309 * Change "struct page" to physical address. 290 * Change "struct page" to physical address.
@@ -363,9 +344,16 @@ static inline void *bus_to_virt(unsigned long address)
363} 344}
364#endif 345#endif
365 346
347#ifndef memset_io
366#define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) 348#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
349#endif
350
351#ifndef memcpy_fromio
367#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c)) 352#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
353#endif
354#ifndef memcpy_toio
368#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c)) 355#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
356#endif
369 357
370#endif /* __KERNEL__ */ 358#endif /* __KERNEL__ */
371 359
diff --git a/include/asm-generic/mmu.h b/include/asm-generic/mmu.h
index 4f4aa56d6b52..0ed3f1cfb854 100644
--- a/include/asm-generic/mmu.h
+++ b/include/asm-generic/mmu.h
@@ -7,8 +7,12 @@
7 */ 7 */
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9typedef struct { 9typedef struct {
10 struct vm_list_struct *vmlist;
11 unsigned long end_brk; 10 unsigned long end_brk;
11
12#ifdef CONFIG_BINFMT_ELF_FDPIC
13 unsigned long exec_fdpic_loadmap;
14 unsigned long interp_fdpic_loadmap;
15#endif
12} mm_context_t; 16} mm_context_t;
13#endif 17#endif
14 18
diff --git a/include/asm-generic/parport.h b/include/asm-generic/parport.h
index 40528cb977e8..2c9f9d4336ca 100644
--- a/include/asm-generic/parport.h
+++ b/include/asm-generic/parport.h
@@ -10,8 +10,8 @@
10 * to devices on the PCI bus. 10 * to devices on the PCI bus.
11 */ 11 */
12 12
13static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma); 13static int parport_pc_find_isa_ports(int autoirq, int autodma);
14static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma) 14static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
15{ 15{
16#ifdef CONFIG_ISA 16#ifdef CONFIG_ISA
17 return parport_pc_find_isa_ports(autoirq, autodma); 17 return parport_pc_find_isa_ports(autoirq, autodma);
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index b36ce40bd1c6..701beab27aab 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -219,6 +219,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
219#define move_pte(pte, prot, old_addr, new_addr) (pte) 219#define move_pte(pte, prot, old_addr, new_addr) (pte)
220#endif 220#endif
221 221
222#ifndef pte_accessible
223# define pte_accessible(pte) ((void)(pte),1)
224#endif
225
222#ifndef flush_tlb_fix_spurious_fault 226#ifndef flush_tlb_fix_spurious_fault
223#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) 227#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
224#endif 228#endif
@@ -449,6 +453,32 @@ extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
449 unsigned long size); 453 unsigned long size);
450#endif 454#endif
451 455
456#ifdef __HAVE_COLOR_ZERO_PAGE
457static inline int is_zero_pfn(unsigned long pfn)
458{
459 extern unsigned long zero_pfn;
460 unsigned long offset_from_zero_pfn = pfn - zero_pfn;
461 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
462}
463
464static inline unsigned long my_zero_pfn(unsigned long addr)
465{
466 return page_to_pfn(ZERO_PAGE(addr));
467}
468#else
469static inline int is_zero_pfn(unsigned long pfn)
470{
471 extern unsigned long zero_pfn;
472 return pfn == zero_pfn;
473}
474
475static inline unsigned long my_zero_pfn(unsigned long addr)
476{
477 extern unsigned long zero_pfn;
478 return zero_pfn;
479}
480#endif
481
452#ifdef CONFIG_MMU 482#ifdef CONFIG_MMU
453 483
454#ifndef CONFIG_TRANSPARENT_HUGEPAGE 484#ifndef CONFIG_TRANSPARENT_HUGEPAGE
@@ -554,6 +584,112 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
554#endif 584#endif
555} 585}
556 586
587#ifdef CONFIG_NUMA_BALANCING
588#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
589/*
590 * _PAGE_NUMA works identical to _PAGE_PROTNONE (it's actually the
591 * same bit too). It's set only when _PAGE_PRESET is not set and it's
592 * never set if _PAGE_PRESENT is set.
593 *
594 * pte/pmd_present() returns true if pte/pmd_numa returns true. Page
595 * fault triggers on those regions if pte/pmd_numa returns true
596 * (because _PAGE_PRESENT is not set).
597 */
598#ifndef pte_numa
599static inline int pte_numa(pte_t pte)
600{
601 return (pte_flags(pte) &
602 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
603}
604#endif
605
606#ifndef pmd_numa
607static inline int pmd_numa(pmd_t pmd)
608{
609 return (pmd_flags(pmd) &
610 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
611}
612#endif
613
614/*
615 * pte/pmd_mknuma sets the _PAGE_ACCESSED bitflag automatically
616 * because they're called by the NUMA hinting minor page fault. If we
617 * wouldn't set the _PAGE_ACCESSED bitflag here, the TLB miss handler
618 * would be forced to set it later while filling the TLB after we
619 * return to userland. That would trigger a second write to memory
620 * that we optimize away by setting _PAGE_ACCESSED here.
621 */
622#ifndef pte_mknonnuma
623static inline pte_t pte_mknonnuma(pte_t pte)
624{
625 pte = pte_clear_flags(pte, _PAGE_NUMA);
626 return pte_set_flags(pte, _PAGE_PRESENT|_PAGE_ACCESSED);
627}
628#endif
629
630#ifndef pmd_mknonnuma
631static inline pmd_t pmd_mknonnuma(pmd_t pmd)
632{
633 pmd = pmd_clear_flags(pmd, _PAGE_NUMA);
634 return pmd_set_flags(pmd, _PAGE_PRESENT|_PAGE_ACCESSED);
635}
636#endif
637
638#ifndef pte_mknuma
639static inline pte_t pte_mknuma(pte_t pte)
640{
641 pte = pte_set_flags(pte, _PAGE_NUMA);
642 return pte_clear_flags(pte, _PAGE_PRESENT);
643}
644#endif
645
646#ifndef pmd_mknuma
647static inline pmd_t pmd_mknuma(pmd_t pmd)
648{
649 pmd = pmd_set_flags(pmd, _PAGE_NUMA);
650 return pmd_clear_flags(pmd, _PAGE_PRESENT);
651}
652#endif
653#else
654extern int pte_numa(pte_t pte);
655extern int pmd_numa(pmd_t pmd);
656extern pte_t pte_mknonnuma(pte_t pte);
657extern pmd_t pmd_mknonnuma(pmd_t pmd);
658extern pte_t pte_mknuma(pte_t pte);
659extern pmd_t pmd_mknuma(pmd_t pmd);
660#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
661#else
662static inline int pmd_numa(pmd_t pmd)
663{
664 return 0;
665}
666
667static inline int pte_numa(pte_t pte)
668{
669 return 0;
670}
671
672static inline pte_t pte_mknonnuma(pte_t pte)
673{
674 return pte;
675}
676
677static inline pmd_t pmd_mknonnuma(pmd_t pmd)
678{
679 return pmd;
680}
681
682static inline pte_t pte_mknuma(pte_t pte)
683{
684 return pte;
685}
686
687static inline pmd_t pmd_mknuma(pmd_t pmd)
688{
689 return pmd;
690}
691#endif /* CONFIG_NUMA_BALANCING */
692
557#endif /* CONFIG_MMU */ 693#endif /* CONFIG_MMU */
558 694
559#endif /* !__ASSEMBLY__ */ 695#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index 98caa306122a..d840c90a157a 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -10,7 +10,5 @@
10#include <asm/sigcontext.h> 10#include <asm/sigcontext.h>
11#undef __HAVE_ARCH_SIG_BITOPS 11#undef __HAVE_ARCH_SIG_BITOPS
12 12
13#define ptrace_signal_deliver(regs, cookie) do { } while (0)
14
15#endif /* __ASSEMBLY__ */ 13#endif /* __ASSEMBLY__ */
16#endif /* _ASM_GENERIC_SIGNAL_H */ 14#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index d89dec864d42..58f466ff00d3 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -8,26 +8,6 @@
8 * Calling conventions for these system calls can differ, so 8 * Calling conventions for these system calls can differ, so
9 * it's possible to override them. 9 * it's possible to override them.
10 */ 10 */
11#ifndef sys_clone
12asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
13 void __user *parent_tid, void __user *child_tid,
14 struct pt_regs *regs);
15#endif
16
17#ifndef sys_fork
18asmlinkage long sys_fork(struct pt_regs *regs);
19#endif
20
21#ifndef sys_vfork
22asmlinkage long sys_vfork(struct pt_regs *regs);
23#endif
24
25#ifndef sys_execve
26asmlinkage long sys_execve(const char __user *filename,
27 const char __user *const __user *argv,
28 const char __user *const __user *envp,
29 struct pt_regs *regs);
30#endif
31 11
32#ifndef sys_mmap2 12#ifndef sys_mmap2
33asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 13asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index ed6642ad03e0..25f01d0bc149 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -78,6 +78,14 @@ struct mmu_gather_batch {
78#define MAX_GATHER_BATCH \ 78#define MAX_GATHER_BATCH \
79 ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *)) 79 ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *))
80 80
81/*
82 * Limit the maximum number of mmu_gather batches to reduce a risk of soft
83 * lockups for non-preemptible kernels on huge machines when a lot of memory
84 * is zapped during unmapping.
85 * 10K pages freed at once should be safe even without a preemption point.
86 */
87#define MAX_GATHER_BATCH_COUNT (10000UL/MAX_GATHER_BATCH)
88
81/* struct mmu_gather is an opaque type used by the mm code for passing around 89/* struct mmu_gather is an opaque type used by the mm code for passing around
82 * any data needed by arch specific code for tlb_remove_page. 90 * any data needed by arch specific code for tlb_remove_page.
83 */ 91 */
@@ -96,6 +104,7 @@ struct mmu_gather {
96 struct mmu_gather_batch *active; 104 struct mmu_gather_batch *active;
97 struct mmu_gather_batch local; 105 struct mmu_gather_batch local;
98 struct page *__pages[MMU_GATHER_BUNDLE]; 106 struct page *__pages[MMU_GATHER_BUNDLE];
107 unsigned int batch_count;
99}; 108};
100 109
101#define HAVE_GENERIC_MMU_GATHER 110#define HAVE_GENERIC_MMU_GATHER
diff --git a/include/asm-generic/trace_clock.h b/include/asm-generic/trace_clock.h
new file mode 100644
index 000000000000..6726f1bafb5e
--- /dev/null
+++ b/include/asm-generic/trace_clock.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_GENERIC_TRACE_CLOCK_H
2#define _ASM_GENERIC_TRACE_CLOCK_H
3/*
4 * Arch-specific trace clocks.
5 */
6
7/*
8 * Additional trace clocks added to the trace_clocks
9 * array in kernel/trace/trace.c
10 * None if the architecture has not defined it.
11 */
12#ifndef ARCH_TRACE_CLOCKS
13# define ARCH_TRACE_CLOCKS
14#endif
15
16#endif /* _ASM_GENERIC_TRACE_CLOCK_H */
diff --git a/include/crypto/cast5.h b/include/crypto/cast5.h
index 586183a0406e..14fbf39d6380 100644
--- a/include/crypto/cast5.h
+++ b/include/crypto/cast5.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/crypto.h> 5#include <linux/crypto.h>
6#include <crypto/cast_common.h>
6 7
7#define CAST5_BLOCK_SIZE 8 8#define CAST5_BLOCK_SIZE 8
8#define CAST5_MIN_KEY_SIZE 5 9#define CAST5_MIN_KEY_SIZE 5
@@ -19,9 +20,4 @@ int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
19void __cast5_encrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src); 20void __cast5_encrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
20void __cast5_decrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src); 21void __cast5_decrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
21 22
22extern const u32 cast5_s1[256];
23extern const u32 cast5_s2[256];
24extern const u32 cast5_s3[256];
25extern const u32 cast5_s4[256];
26
27#endif 23#endif
diff --git a/include/crypto/cast6.h b/include/crypto/cast6.h
index 157af6f342c8..32b60eb8bd24 100644
--- a/include/crypto/cast6.h
+++ b/include/crypto/cast6.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/crypto.h> 5#include <linux/crypto.h>
6#include <crypto/cast_common.h>
6 7
7#define CAST6_BLOCK_SIZE 16 8#define CAST6_BLOCK_SIZE 16
8#define CAST6_MIN_KEY_SIZE 16 9#define CAST6_MIN_KEY_SIZE 16
@@ -20,9 +21,4 @@ int cast6_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
20void __cast6_encrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src); 21void __cast6_encrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src);
21void __cast6_decrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src); 22void __cast6_decrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src);
22 23
23extern const u32 cast6_s1[256];
24extern const u32 cast6_s2[256];
25extern const u32 cast6_s3[256];
26extern const u32 cast6_s4[256];
27
28#endif 24#endif
diff --git a/include/crypto/cast_common.h b/include/crypto/cast_common.h
new file mode 100644
index 000000000000..b7df35cd9f0a
--- /dev/null
+++ b/include/crypto/cast_common.h
@@ -0,0 +1,9 @@
1#ifndef _CRYPTO_CAST_COMMON_H
2#define _CRYPTO_CAST_COMMON_H
3
4extern const u32 cast_s1[256];
5extern const u32 cast_s2[256];
6extern const u32 cast_s3[256];
7extern const u32 cast_s4[256];
8
9#endif
diff --git a/include/crypto/vmac.h b/include/crypto/vmac.h
index c4467c55df1e..6b700c7b2fe1 100644
--- a/include/crypto/vmac.h
+++ b/include/crypto/vmac.h
@@ -56,6 +56,8 @@ typedef u64 vmac_t;
56struct vmac_ctx_t { 56struct vmac_ctx_t {
57 struct crypto_cipher *child; 57 struct crypto_cipher *child;
58 struct vmac_ctx __vmac_ctx; 58 struct vmac_ctx __vmac_ctx;
59 u8 partial[VMAC_NHBYTES]; /* partial block */
60 int partial_size; /* size of the partial block */
59}; 61};
60 62
61#endif /* __CRYPTO_VMAC_H */ 63#endif /* __CRYPTO_VMAC_H */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3538eda94ef5..00d78b5161c0 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -920,12 +920,6 @@ extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
920extern void drm_mode_connector_list_update(struct drm_connector *connector); 920extern void drm_mode_connector_list_update(struct drm_connector *connector);
921extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 921extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
922 struct edid *edid); 922 struct edid *edid);
923extern int drm_connector_property_set_value(struct drm_connector *connector,
924 struct drm_property *property,
925 uint64_t value);
926extern int drm_connector_property_get_value(struct drm_connector *connector,
927 struct drm_property *property,
928 uint64_t *value);
929extern int drm_object_property_set_value(struct drm_mode_object *obj, 923extern int drm_object_property_set_value(struct drm_mode_object *obj,
930 struct drm_property *property, 924 struct drm_property *property,
931 uint64_t val); 925 uint64_t val);
@@ -947,8 +941,6 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
947extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); 941extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
948extern bool drm_crtc_in_use(struct drm_crtc *crtc); 942extern bool drm_crtc_in_use(struct drm_crtc *crtc);
949 943
950extern void drm_connector_attach_property(struct drm_connector *connector,
951 struct drm_property *property, uint64_t init_val);
952extern void drm_object_attach_property(struct drm_mode_object *obj, 944extern void drm_object_attach_property(struct drm_mode_object *obj,
953 struct drm_property *property, 945 struct drm_property *property,
954 uint64_t init_val); 946 uint64_t init_val);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c09d36741c94..e8e1417af3d9 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -312,6 +312,14 @@
312#define MODE_I2C_READ 4 312#define MODE_I2C_READ 4
313#define MODE_I2C_STOP 8 313#define MODE_I2C_STOP 8
314 314
315/**
316 * struct i2c_algo_dp_aux_data - driver interface structure for i2c over dp
317 * aux algorithm
318 * @running: set by the algo indicating whether an i2c is ongoing or whether
319 * the i2c bus is quiescent
320 * @address: i2c target address for the currently ongoing transfer
321 * @aux_ch: driver callback to transfer a single byte of the i2c payload
322 */
315struct i2c_algo_dp_aux_data { 323struct i2c_algo_dp_aux_data {
316 bool running; 324 bool running;
317 u16 address; 325 u16 address;
diff --git a/include/drm/drm_hashtab.h b/include/drm/drm_hashtab.h
index 3650d5d011ee..fce2ef3fdfff 100644
--- a/include/drm/drm_hashtab.h
+++ b/include/drm/drm_hashtab.h
@@ -61,5 +61,19 @@ extern int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key);
61extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item); 61extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item);
62extern void drm_ht_remove(struct drm_open_hash *ht); 62extern void drm_ht_remove(struct drm_open_hash *ht);
63 63
64/*
65 * RCU-safe interface
66 *
67 * The user of this API needs to make sure that two or more instances of the
68 * hash table manipulation functions are never run simultaneously.
69 * The lookup function drm_ht_find_item_rcu may, however, run simultaneously
70 * with any of the manipulation functions as long as it's called from within
71 * an RCU read-locked section.
72 */
73#define drm_ht_insert_item_rcu drm_ht_insert_item
74#define drm_ht_just_insert_please_rcu drm_ht_just_insert_please
75#define drm_ht_remove_key_rcu drm_ht_remove_key
76#define drm_ht_remove_item_rcu drm_ht_remove_item
77#define drm_ht_find_item_rcu drm_ht_find_item
64 78
65#endif 79#endif
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index cd453653f634..9b991f91d81b 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -198,12 +198,29 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
198 return drm_mm_get_block_range_generic(parent, size, alignment, 0, 198 return drm_mm_get_block_range_generic(parent, size, alignment, 0,
199 start, end, 1); 199 start, end, 1);
200} 200}
201extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, 201
202 unsigned long size, unsigned alignment); 202extern int drm_mm_insert_node(struct drm_mm *mm,
203 struct drm_mm_node *node,
204 unsigned long size,
205 unsigned alignment);
203extern int drm_mm_insert_node_in_range(struct drm_mm *mm, 206extern int drm_mm_insert_node_in_range(struct drm_mm *mm,
204 struct drm_mm_node *node, 207 struct drm_mm_node *node,
205 unsigned long size, unsigned alignment, 208 unsigned long size,
206 unsigned long start, unsigned long end); 209 unsigned alignment,
210 unsigned long start,
211 unsigned long end);
212extern int drm_mm_insert_node_generic(struct drm_mm *mm,
213 struct drm_mm_node *node,
214 unsigned long size,
215 unsigned alignment,
216 unsigned long color);
217extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
218 struct drm_mm_node *node,
219 unsigned long size,
220 unsigned alignment,
221 unsigned long color,
222 unsigned long start,
223 unsigned long end);
207extern void drm_mm_put_block(struct drm_mm_node *cur); 224extern void drm_mm_put_block(struct drm_mm_node *cur);
208extern void drm_mm_remove_node(struct drm_mm_node *node); 225extern void drm_mm_remove_node(struct drm_mm_node *node);
209extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); 226extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index af1cbaf535ed..c5c35e629426 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -210,6 +210,7 @@
210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x679B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 214 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
214 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 215 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
215 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 216 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 3c13a3a4b158..d6aeaf3c6d6c 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28#ifndef _EXYNOS_DRM_H_ 14#ifndef _EXYNOS_DRM_H_
29#define _EXYNOS_DRM_H_ 15#define _EXYNOS_DRM_H_
@@ -85,4 +71,30 @@ struct exynos_drm_hdmi_pdata {
85 int (*get_hpd)(void); 71 int (*get_hpd)(void);
86}; 72};
87 73
74/**
75 * Platform Specific Structure for DRM based IPP.
76 *
77 * @inv_pclk: if set 1. invert pixel clock
78 * @inv_vsync: if set 1. invert vsync signal for wb
79 * @inv_href: if set 1. invert href signal
80 * @inv_hsync: if set 1. invert hsync signal for wb
81 */
82struct exynos_drm_ipp_pol {
83 unsigned int inv_pclk;
84 unsigned int inv_vsync;
85 unsigned int inv_href;
86 unsigned int inv_hsync;
87};
88
89/**
90 * Platform Specific Structure for DRM based FIMC.
91 *
92 * @pol: current hardware block polarity settings.
93 * @clk_rate: current hardware clock rate.
94 */
95struct exynos_drm_fimc_pdata {
96 struct exynos_drm_ipp_pol pol;
97 int clk_rate;
98};
99
88#endif /* _EXYNOS_DRM_H_ */ 100#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index c6cae733ddef..3cb5d848fb66 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -337,7 +337,6 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
337 * @bo: The buffer object. 337 * @bo: The buffer object.
338 * @placement: Proposed placement for the buffer object. 338 * @placement: Proposed placement for the buffer object.
339 * @interruptible: Sleep interruptible if sleeping. 339 * @interruptible: Sleep interruptible if sleeping.
340 * @no_wait_reserve: Return immediately if other buffers are busy.
341 * @no_wait_gpu: Return immediately if the GPU is busy. 340 * @no_wait_gpu: Return immediately if the GPU is busy.
342 * 341 *
343 * Changes placement and caching policy of the buffer object 342 * Changes placement and caching policy of the buffer object
@@ -350,7 +349,7 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
350 */ 349 */
351extern int ttm_bo_validate(struct ttm_buffer_object *bo, 350extern int ttm_bo_validate(struct ttm_buffer_object *bo,
352 struct ttm_placement *placement, 351 struct ttm_placement *placement,
353 bool interruptible, bool no_wait_reserve, 352 bool interruptible,
354 bool no_wait_gpu); 353 bool no_wait_gpu);
355 354
356/** 355/**
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index dd96442cdc2a..e3a43a47d78c 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -394,7 +394,7 @@ struct ttm_bo_driver {
394 */ 394 */
395 int (*move) (struct ttm_buffer_object *bo, 395 int (*move) (struct ttm_buffer_object *bo,
396 bool evict, bool interruptible, 396 bool evict, bool interruptible,
397 bool no_wait_reserve, bool no_wait_gpu, 397 bool no_wait_gpu,
398 struct ttm_mem_reg *new_mem); 398 struct ttm_mem_reg *new_mem);
399 399
400 /** 400 /**
@@ -703,7 +703,6 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
703 * @proposed_placement: Proposed new placement for the buffer object. 703 * @proposed_placement: Proposed new placement for the buffer object.
704 * @mem: A struct ttm_mem_reg. 704 * @mem: A struct ttm_mem_reg.
705 * @interruptible: Sleep interruptible when sliping. 705 * @interruptible: Sleep interruptible when sliping.
706 * @no_wait_reserve: Return immediately if other buffers are busy.
707 * @no_wait_gpu: Return immediately if the GPU is busy. 706 * @no_wait_gpu: Return immediately if the GPU is busy.
708 * 707 *
709 * Allocate memory space for the buffer object pointed to by @bo, using 708 * Allocate memory space for the buffer object pointed to by @bo, using
@@ -719,7 +718,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
719 struct ttm_placement *placement, 718 struct ttm_placement *placement,
720 struct ttm_mem_reg *mem, 719 struct ttm_mem_reg *mem,
721 bool interruptible, 720 bool interruptible,
722 bool no_wait_reserve, bool no_wait_gpu); 721 bool no_wait_gpu);
723 722
724extern void ttm_bo_mem_put(struct ttm_buffer_object *bo, 723extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
725 struct ttm_mem_reg *mem); 724 struct ttm_mem_reg *mem);
@@ -901,7 +900,6 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
901 * 900 *
902 * @bo: A pointer to a struct ttm_buffer_object. 901 * @bo: A pointer to a struct ttm_buffer_object.
903 * @evict: 1: This is an eviction. Don't try to pipeline. 902 * @evict: 1: This is an eviction. Don't try to pipeline.
904 * @no_wait_reserve: Return immediately if other buffers are busy.
905 * @no_wait_gpu: Return immediately if the GPU is busy. 903 * @no_wait_gpu: Return immediately if the GPU is busy.
906 * @new_mem: struct ttm_mem_reg indicating where to move. 904 * @new_mem: struct ttm_mem_reg indicating where to move.
907 * 905 *
@@ -916,15 +914,14 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
916 */ 914 */
917 915
918extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 916extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
919 bool evict, bool no_wait_reserve, 917 bool evict, bool no_wait_gpu,
920 bool no_wait_gpu, struct ttm_mem_reg *new_mem); 918 struct ttm_mem_reg *new_mem);
921 919
922/** 920/**
923 * ttm_bo_move_memcpy 921 * ttm_bo_move_memcpy
924 * 922 *
925 * @bo: A pointer to a struct ttm_buffer_object. 923 * @bo: A pointer to a struct ttm_buffer_object.
926 * @evict: 1: This is an eviction. Don't try to pipeline. 924 * @evict: 1: This is an eviction. Don't try to pipeline.
927 * @no_wait_reserve: Return immediately if other buffers are busy.
928 * @no_wait_gpu: Return immediately if the GPU is busy. 925 * @no_wait_gpu: Return immediately if the GPU is busy.
929 * @new_mem: struct ttm_mem_reg indicating where to move. 926 * @new_mem: struct ttm_mem_reg indicating where to move.
930 * 927 *
@@ -939,8 +936,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
939 */ 936 */
940 937
941extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 938extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
942 bool evict, bool no_wait_reserve, 939 bool evict, bool no_wait_gpu,
943 bool no_wait_gpu, struct ttm_mem_reg *new_mem); 940 struct ttm_mem_reg *new_mem);
944 941
945/** 942/**
946 * ttm_bo_free_old_node 943 * ttm_bo_free_old_node
@@ -957,7 +954,6 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
957 * @bo: A pointer to a struct ttm_buffer_object. 954 * @bo: A pointer to a struct ttm_buffer_object.
958 * @sync_obj: A sync object that signals when moving is complete. 955 * @sync_obj: A sync object that signals when moving is complete.
959 * @evict: This is an evict move. Don't return until the buffer is idle. 956 * @evict: This is an evict move. Don't return until the buffer is idle.
960 * @no_wait_reserve: Return immediately if other buffers are busy.
961 * @no_wait_gpu: Return immediately if the GPU is busy. 957 * @no_wait_gpu: Return immediately if the GPU is busy.
962 * @new_mem: struct ttm_mem_reg indicating where to move. 958 * @new_mem: struct ttm_mem_reg indicating where to move.
963 * 959 *
@@ -971,8 +967,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
971 967
972extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 968extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
973 void *sync_obj, 969 void *sync_obj,
974 bool evict, bool no_wait_reserve, 970 bool evict, bool no_wait_gpu,
975 bool no_wait_gpu,
976 struct ttm_mem_reg *new_mem); 971 struct ttm_mem_reg *new_mem);
977/** 972/**
978 * ttm_io_prot 973 * ttm_io_prot
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
deleted file mode 100644
index 7fe2dae251e5..000000000000
--- a/include/linux/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1header-y += dvb/
2header-y += hdlc/
3header-y += hsi/
4header-y += raid/
5header-y += usb/
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90be98981102..3994d7790b23 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -25,7 +25,9 @@
25#ifndef _LINUX_ACPI_H 25#ifndef _LINUX_ACPI_H
26#define _LINUX_ACPI_H 26#define _LINUX_ACPI_H
27 27
28#include <linux/errno.h>
28#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h>
29 31
30#ifdef CONFIG_ACPI 32#ifdef CONFIG_ACPI
31 33
@@ -76,6 +78,14 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
76 78
77typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
78 80
81#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
82void acpi_initrd_override(void *data, size_t size);
83#else
84static inline void acpi_initrd_override(void *data, size_t size)
85{
86}
87#endif
88
79char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 89char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
80void __acpi_unmap_table(char *map, unsigned long size); 90void __acpi_unmap_table(char *map, unsigned long size);
81int early_acpi_boot_init(void); 91int early_acpi_boot_init(void);
@@ -250,6 +260,26 @@ extern int pnpacpi_disabled;
250 260
251#define PXM_INVAL (-1) 261#define PXM_INVAL (-1)
252 262
263bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res);
264bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res);
265bool acpi_dev_resource_address_space(struct acpi_resource *ares,
266 struct resource *res);
267bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
268 struct resource *res);
269unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
270bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
271 struct resource *res);
272
273struct resource_list_entry {
274 struct list_head node;
275 struct resource res;
276};
277
278void acpi_dev_free_resource_list(struct list_head *list);
279int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
280 int (*preproc)(struct acpi_resource *, void *),
281 void *preproc_data);
282
253int acpi_check_resource_conflict(const struct resource *res); 283int acpi_check_resource_conflict(const struct resource *res);
254 284
255int acpi_check_region(resource_size_t start, resource_size_t n, 285int acpi_check_region(resource_size_t start, resource_size_t n,
@@ -257,10 +287,14 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
257 287
258int acpi_resources_are_enforced(void); 288int acpi_resources_are_enforced(void);
259 289
260#ifdef CONFIG_PM_SLEEP 290#ifdef CONFIG_HIBERNATION
261void __init acpi_no_s4_hw_signature(void); 291void __init acpi_no_s4_hw_signature(void);
292#endif
293
294#ifdef CONFIG_PM_SLEEP
262void __init acpi_old_suspend_ordering(void); 295void __init acpi_old_suspend_ordering(void);
263void __init acpi_nvs_nosave(void); 296void __init acpi_nvs_nosave(void);
297void __init acpi_nvs_nosave_s3(void);
264#endif /* CONFIG_PM_SLEEP */ 298#endif /* CONFIG_PM_SLEEP */
265 299
266struct acpi_osc_context { 300struct acpi_osc_context {
@@ -364,6 +398,17 @@ extern int acpi_nvs_register(__u64 start, __u64 size);
364extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), 398extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
365 void *data); 399 void *data);
366 400
401const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
402 const struct device *dev);
403
404static inline bool acpi_driver_match_device(struct device *dev,
405 const struct device_driver *drv)
406{
407 return !!acpi_match_device(drv->acpi_match_table, dev);
408}
409
410#define ACPI_PTR(_ptr) (_ptr)
411
367#else /* !CONFIG_ACPI */ 412#else /* !CONFIG_ACPI */
368 413
369#define acpi_disabled 1 414#define acpi_disabled 1
@@ -418,6 +463,22 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
418 return 0; 463 return 0;
419} 464}
420 465
466struct acpi_device_id;
467
468static inline const struct acpi_device_id *acpi_match_device(
469 const struct acpi_device_id *ids, const struct device *dev)
470{
471 return NULL;
472}
473
474static inline bool acpi_driver_match_device(struct device *dev,
475 const struct device_driver *drv)
476{
477 return false;
478}
479
480#define ACPI_PTR(_ptr) (NULL)
481
421#endif /* !CONFIG_ACPI */ 482#endif /* !CONFIG_ACPI */
422 483
423#ifdef CONFIG_ACPI 484#ifdef CONFIG_ACPI
@@ -426,8 +487,96 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
426 487
427acpi_status acpi_os_prepare_sleep(u8 sleep_state, 488acpi_status acpi_os_prepare_sleep(u8 sleep_state,
428 u32 pm1a_control, u32 pm1b_control); 489 u32 pm1a_control, u32 pm1b_control);
490#ifdef CONFIG_X86
491void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
492#else
493static inline void arch_reserve_mem_area(acpi_physical_address addr,
494 size_t size)
495{
496}
497#endif /* CONFIG_X86 */
429#else 498#else
430#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 499#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
431#endif 500#endif
432 501
502#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
503int acpi_dev_runtime_suspend(struct device *dev);
504int acpi_dev_runtime_resume(struct device *dev);
505int acpi_subsys_runtime_suspend(struct device *dev);
506int acpi_subsys_runtime_resume(struct device *dev);
507#else
508static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
509static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
510static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
511static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
512#endif
513
514#ifdef CONFIG_ACPI_SLEEP
515int acpi_dev_suspend_late(struct device *dev);
516int acpi_dev_resume_early(struct device *dev);
517int acpi_subsys_prepare(struct device *dev);
518int acpi_subsys_suspend_late(struct device *dev);
519int acpi_subsys_resume_early(struct device *dev);
520#else
521static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
522static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
523static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
524static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
525static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
526#endif
527
528#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
529int acpi_dev_pm_attach(struct device *dev, bool power_on);
530void acpi_dev_pm_detach(struct device *dev, bool power_off);
531#else
532static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
533{
534 return -ENODEV;
535}
536static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
537#endif
538
539#ifdef CONFIG_ACPI
540__printf(3, 4)
541void acpi_handle_printk(const char *level, acpi_handle handle,
542 const char *fmt, ...);
543#else /* !CONFIG_ACPI */
544static inline __printf(3, 4) void
545acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
546#endif /* !CONFIG_ACPI */
547
548/*
549 * acpi_handle_<level>: Print message with ACPI prefix and object path
550 *
551 * These interfaces acquire the global namespace mutex to obtain an object
552 * path. In interrupt context, it shows the object path as <n/a>.
553 */
554#define acpi_handle_emerg(handle, fmt, ...) \
555 acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
556#define acpi_handle_alert(handle, fmt, ...) \
557 acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
558#define acpi_handle_crit(handle, fmt, ...) \
559 acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
560#define acpi_handle_err(handle, fmt, ...) \
561 acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
562#define acpi_handle_warn(handle, fmt, ...) \
563 acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
564#define acpi_handle_notice(handle, fmt, ...) \
565 acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
566#define acpi_handle_info(handle, fmt, ...) \
567 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
568
569/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */
570#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
571#define acpi_handle_debug(handle, fmt, ...) \
572 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
573#else
574#define acpi_handle_debug(handle, fmt, ...) \
575({ \
576 if (0) \
577 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \
578 0; \
579})
580#endif
581
433#endif /*_LINUX_ACPI_H*/ 582#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
new file mode 100644
index 000000000000..91615a389b65
--- /dev/null
+++ b/include/linux/acpi_gpio.h
@@ -0,0 +1,19 @@
1#ifndef _LINUX_ACPI_GPIO_H_
2#define _LINUX_ACPI_GPIO_H_
3
4#include <linux/errno.h>
5
6#ifdef CONFIG_GPIO_ACPI
7
8int acpi_get_gpio(char *path, int pin);
9
10#else /* CONFIG_GPIO_ACPI */
11
12static inline int acpi_get_gpio(char *path, int pin)
13{
14 return -ENODEV;
15}
16
17#endif /* CONFIG_GPIO_ACPI */
18
19#endif /* _LINUX_ACPI_GPIO_H_ */
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index d36417158d8f..43ec7e247a80 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -71,6 +71,16 @@ struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
71 resource_size_t base, size_t size, 71 resource_size_t base, size_t size,
72 int irq1, int irq2, void *pdata, 72 int irq1, int irq2, void *pdata,
73 unsigned int periphid); 73 unsigned int periphid);
74struct amba_device *
75amba_apb_device_add_res(struct device *parent, const char *name,
76 resource_size_t base, size_t size, int irq1,
77 int irq2, void *pdata, unsigned int periphid,
78 struct resource *resbase);
79struct amba_device *
80amba_ahb_device_add_res(struct device *parent, const char *name,
81 resource_size_t base, size_t size, int irq1,
82 int irq2, void *pdata, unsigned int periphid,
83 struct resource *resbase);
74void amba_device_unregister(struct amba_device *); 84void amba_device_unregister(struct amba_device *);
75struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 85struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
76int amba_request_regions(struct amba_device *, const char *); 86int amba_request_regions(struct amba_device *, const char *);
diff --git a/include/linux/asn1.h b/include/linux/asn1.h
index 5c3f4e4b9a23..eed6982860ba 100644
--- a/include/linux/asn1.h
+++ b/include/linux/asn1.h
@@ -64,4 +64,6 @@ enum asn1_tag {
64 ASN1_LONG_TAG = 31 /* Long form tag */ 64 ASN1_LONG_TAG = 31 /* Long form tag */
65}; 65};
66 66
67#define ASN1_INDEFINITE_LENGTH 0x80
68
67#endif /* _LINUX_ASN1_H */ 69#endif /* _LINUX_ASN1_H */
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b856a2a590d9..b9fde17f767c 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -15,14 +15,12 @@ struct pata_platform_info {
15 unsigned int irq_flags; 15 unsigned int irq_flags;
16}; 16};
17 17
18extern int __devinit __pata_platform_probe(struct device *dev, 18extern int __pata_platform_probe(struct device *dev,
19 struct resource *io_res, 19 struct resource *io_res,
20 struct resource *ctl_res, 20 struct resource *ctl_res,
21 struct resource *irq_res, 21 struct resource *irq_res,
22 unsigned int ioport_shift, 22 unsigned int ioport_shift,
23 int __pio_mask); 23 int __pio_mask);
24
25extern int __devexit __pata_platform_remove(struct device *dev);
26 24
27/* 25/*
28 * Marvell SATA private data 26 * Marvell SATA private data
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 6e3f54f37844..fcdd81bd5314 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -22,6 +22,8 @@
22#define ATH9K_PLAT_EEP_MAX_WORDS 2048 22#define ATH9K_PLAT_EEP_MAX_WORDS 2048
23 23
24struct ath9k_platform_data { 24struct ath9k_platform_data {
25 const char *eeprom_name;
26
25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; 27 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
26 u8 *macaddr; 28 u8 *macaddr;
27 29
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 22ef21c33d0c..c1da539f5e28 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -99,6 +99,7 @@ struct atm_vcc {
99 struct atm_dev *dev; /* device back pointer */ 99 struct atm_dev *dev; /* device back pointer */
100 struct atm_qos qos; /* QOS */ 100 struct atm_qos qos; /* QOS */
101 struct atm_sap sap; /* SAP */ 101 struct atm_sap sap; /* SAP */
102 void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */
102 void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); 103 void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
103 void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ 104 void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
104 int (*push_oam)(struct atm_vcc *vcc,void *cell); 105 int (*push_oam)(struct atm_vcc *vcc,void *cell);
@@ -106,6 +107,7 @@ struct atm_vcc {
106 void *dev_data; /* per-device data */ 107 void *dev_data; /* per-device data */
107 void *proto_data; /* per-protocol data */ 108 void *proto_data; /* per-protocol data */
108 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */ 109 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
110 struct module *owner; /* owner of ->push function */
109 /* SVC part --- may move later ------------------------------------- */ 111 /* SVC part --- may move later ------------------------------------- */
110 short itf; /* interface number */ 112 short itf; /* interface number */
111 struct sockaddr_atmsvc local; 113 struct sockaddr_atmsvc local;
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 4eb31752e2b7..deb0ae58b99b 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -5,10 +5,16 @@
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/io.h> 6#include <linux/io.h>
7 7
8struct atmel_ssc_platform_data {
9 int use_dma;
10};
11
8struct ssc_device { 12struct ssc_device {
9 struct list_head list; 13 struct list_head list;
14 resource_size_t phybase;
10 void __iomem *regs; 15 void __iomem *regs;
11 struct platform_device *pdev; 16 struct platform_device *pdev;
17 struct atmel_ssc_platform_data *pdata;
12 struct clk *clk; 18 struct clk *clk;
13 int user; 19 int user;
14 int irq; 20 int irq;
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 2a9a9abc9126..12731a19ef06 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -114,6 +114,7 @@ struct backing_dev_info {
114int bdi_init(struct backing_dev_info *bdi); 114int bdi_init(struct backing_dev_info *bdi);
115void bdi_destroy(struct backing_dev_info *bdi); 115void bdi_destroy(struct backing_dev_info *bdi);
116 116
117__printf(3, 4)
117int bdi_register(struct backing_dev_info *bdi, struct device *parent, 118int bdi_register(struct backing_dev_info *bdi, struct device *parent,
118 const char *fmt, ...); 119 const char *fmt, ...);
119int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 120int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5ffc6dda4675..da9a0825e007 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -134,4 +134,14 @@ struct generic_bl_info {
134 void (*kick_battery)(void); 134 void (*kick_battery)(void);
135}; 135};
136 136
137#ifdef CONFIG_OF
138struct backlight_device *of_find_backlight_by_node(struct device_node *node);
139#else
140static inline struct backlight_device *
141of_find_backlight_by_node(struct device_node *node)
142{
143 return NULL;
144}
145#endif
146
137#endif 147#endif
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
new file mode 100644
index 000000000000..f7f1d7169b11
--- /dev/null
+++ b/include/linux/balloon_compaction.h
@@ -0,0 +1,272 @@
1/*
2 * include/linux/balloon_compaction.h
3 *
4 * Common interface definitions for making balloon pages movable by compaction.
5 *
6 * Despite being perfectly possible to perform ballooned pages migration, they
7 * make a special corner case to compaction scans because balloon pages are not
8 * enlisted at any LRU list like the other pages we do compact / migrate.
9 *
10 * As the page isolation scanning step a compaction thread does is a lockless
11 * procedure (from a page standpoint), it might bring some racy situations while
12 * performing balloon page compaction. In order to sort out these racy scenarios
13 * and safely perform balloon's page compaction and migration we must, always,
14 * ensure following these three simple rules:
15 *
16 * i. when updating a balloon's page ->mapping element, strictly do it under
17 * the following lock order, independently of the far superior
18 * locking scheme (lru_lock, balloon_lock):
19 * +-page_lock(page);
20 * +--spin_lock_irq(&b_dev_info->pages_lock);
21 * ... page->mapping updates here ...
22 *
23 * ii. before isolating or dequeueing a balloon page from the balloon device
24 * pages list, the page reference counter must be raised by one and the
25 * extra refcount must be dropped when the page is enqueued back into
26 * the balloon device page list, thus a balloon page keeps its reference
27 * counter raised only while it is under our special handling;
28 *
29 * iii. after the lockless scan step have selected a potential balloon page for
30 * isolation, re-test the page->mapping flags and the page ref counter
31 * under the proper page lock, to ensure isolating a valid balloon page
32 * (not yet isolated, nor under release procedure)
33 *
34 * The functions provided by this interface are placed to help on coping with
35 * the aforementioned balloon page corner case, as well as to ensure the simple
36 * set of exposed rules are satisfied while we are dealing with balloon pages
37 * compaction / migration.
38 *
39 * Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
40 */
41#ifndef _LINUX_BALLOON_COMPACTION_H
42#define _LINUX_BALLOON_COMPACTION_H
43#include <linux/pagemap.h>
44#include <linux/page-flags.h>
45#include <linux/migrate.h>
46#include <linux/gfp.h>
47#include <linux/err.h>
48
49/*
50 * Balloon device information descriptor.
51 * This struct is used to allow the common balloon compaction interface
52 * procedures to find the proper balloon device holding memory pages they'll
53 * have to cope for page compaction / migration, as well as it serves the
54 * balloon driver as a page book-keeper for its registered balloon devices.
55 */
56struct balloon_dev_info {
57 void *balloon_device; /* balloon device descriptor */
58 struct address_space *mapping; /* balloon special page->mapping */
59 unsigned long isolated_pages; /* # of isolated pages for migration */
60 spinlock_t pages_lock; /* Protection to pages list */
61 struct list_head pages; /* Pages enqueued & handled to Host */
62};
63
64extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info);
65extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
66extern struct balloon_dev_info *balloon_devinfo_alloc(
67 void *balloon_dev_descriptor);
68
69static inline void balloon_devinfo_free(struct balloon_dev_info *b_dev_info)
70{
71 kfree(b_dev_info);
72}
73
74/*
75 * balloon_page_free - release a balloon page back to the page free lists
76 * @page: ballooned page to be set free
77 *
78 * This function must be used to properly set free an isolated/dequeued balloon
79 * page at the end of a sucessful page migration, or at the balloon driver's
80 * page release procedure.
81 */
82static inline void balloon_page_free(struct page *page)
83{
84 /*
85 * Balloon pages always get an extra refcount before being isolated
86 * and before being dequeued to help on sorting out fortuite colisions
87 * between a thread attempting to isolate and another thread attempting
88 * to release the very same balloon page.
89 *
90 * Before we handle the page back to Buddy, lets drop its extra refcnt.
91 */
92 put_page(page);
93 __free_page(page);
94}
95
96#ifdef CONFIG_BALLOON_COMPACTION
97extern bool balloon_page_isolate(struct page *page);
98extern void balloon_page_putback(struct page *page);
99extern int balloon_page_migrate(struct page *newpage,
100 struct page *page, enum migrate_mode mode);
101extern struct address_space
102*balloon_mapping_alloc(struct balloon_dev_info *b_dev_info,
103 const struct address_space_operations *a_ops);
104
105static inline void balloon_mapping_free(struct address_space *balloon_mapping)
106{
107 kfree(balloon_mapping);
108}
109
110/*
111 * page_flags_cleared - helper to perform balloon @page ->flags tests.
112 *
113 * As balloon pages are obtained from buddy and we do not play with page->flags
114 * at driver level (exception made when we get the page lock for compaction),
115 * we can safely identify a ballooned page by checking if the
116 * PAGE_FLAGS_CHECK_AT_PREP page->flags are all cleared. This approach also
117 * helps us skip ballooned pages that are locked for compaction or release, thus
118 * mitigating their racy check at balloon_page_movable()
119 */
120static inline bool page_flags_cleared(struct page *page)
121{
122 return !(page->flags & PAGE_FLAGS_CHECK_AT_PREP);
123}
124
125/*
126 * __is_movable_balloon_page - helper to perform @page mapping->flags tests
127 */
128static inline bool __is_movable_balloon_page(struct page *page)
129{
130 struct address_space *mapping = page->mapping;
131 return mapping_balloon(mapping);
132}
133
134/*
135 * balloon_page_movable - test page->mapping->flags to identify balloon pages
136 * that can be moved by compaction/migration.
137 *
138 * This function is used at core compaction's page isolation scheme, therefore
139 * most pages exposed to it are not enlisted as balloon pages and so, to avoid
140 * undesired side effects like racing against __free_pages(), we cannot afford
141 * holding the page locked while testing page->mapping->flags here.
142 *
143 * As we might return false positives in the case of a balloon page being just
144 * released under us, the page->mapping->flags need to be re-tested later,
145 * under the proper page lock, at the functions that will be coping with the
146 * balloon page case.
147 */
148static inline bool balloon_page_movable(struct page *page)
149{
150 /*
151 * Before dereferencing and testing mapping->flags, let's make sure
152 * this is not a page that uses ->mapping in a different way
153 */
154 if (page_flags_cleared(page) && !page_mapped(page) &&
155 page_count(page) == 1)
156 return __is_movable_balloon_page(page);
157
158 return false;
159}
160
161/*
162 * balloon_page_insert - insert a page into the balloon's page list and make
163 * the page->mapping assignment accordingly.
164 * @page : page to be assigned as a 'balloon page'
165 * @mapping : allocated special 'balloon_mapping'
166 * @head : balloon's device page list head
167 *
168 * Caller must ensure the page is locked and the spin_lock protecting balloon
169 * pages list is held before inserting a page into the balloon device.
170 */
171static inline void balloon_page_insert(struct page *page,
172 struct address_space *mapping,
173 struct list_head *head)
174{
175 page->mapping = mapping;
176 list_add(&page->lru, head);
177}
178
179/*
180 * balloon_page_delete - delete a page from balloon's page list and clear
181 * the page->mapping assignement accordingly.
182 * @page : page to be released from balloon's page list
183 *
184 * Caller must ensure the page is locked and the spin_lock protecting balloon
185 * pages list is held before deleting a page from the balloon device.
186 */
187static inline void balloon_page_delete(struct page *page)
188{
189 page->mapping = NULL;
190 list_del(&page->lru);
191}
192
193/*
194 * balloon_page_device - get the b_dev_info descriptor for the balloon device
195 * that enqueues the given page.
196 */
197static inline struct balloon_dev_info *balloon_page_device(struct page *page)
198{
199 struct address_space *mapping = page->mapping;
200 if (likely(mapping))
201 return mapping->private_data;
202
203 return NULL;
204}
205
206static inline gfp_t balloon_mapping_gfp_mask(void)
207{
208 return GFP_HIGHUSER_MOVABLE;
209}
210
211static inline bool balloon_compaction_check(void)
212{
213 return true;
214}
215
216#else /* !CONFIG_BALLOON_COMPACTION */
217
218static inline void *balloon_mapping_alloc(void *balloon_device,
219 const struct address_space_operations *a_ops)
220{
221 return ERR_PTR(-EOPNOTSUPP);
222}
223
224static inline void balloon_mapping_free(struct address_space *balloon_mapping)
225{
226 return;
227}
228
229static inline void balloon_page_insert(struct page *page,
230 struct address_space *mapping,
231 struct list_head *head)
232{
233 list_add(&page->lru, head);
234}
235
236static inline void balloon_page_delete(struct page *page)
237{
238 list_del(&page->lru);
239}
240
241static inline bool balloon_page_movable(struct page *page)
242{
243 return false;
244}
245
246static inline bool balloon_page_isolate(struct page *page)
247{
248 return false;
249}
250
251static inline void balloon_page_putback(struct page *page)
252{
253 return;
254}
255
256static inline int balloon_page_migrate(struct page *newpage,
257 struct page *page, enum migrate_mode mode)
258{
259 return 0;
260}
261
262static inline gfp_t balloon_mapping_gfp_mask(void)
263{
264 return GFP_HIGHUSER;
265}
266
267static inline bool balloon_compaction_check(void)
268{
269 return false;
270}
271#endif /* CONFIG_BALLOON_COMPACTION */
272#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h
new file mode 100644
index 000000000000..e5dfc256485b
--- /dev/null
+++ b/include/linux/bcm47xx_wdt.h
@@ -0,0 +1,19 @@
1#ifndef LINUX_BCM47XX_WDT_H_
2#define LINUX_BCM47XX_WDT_H_
3
4#include <linux/types.h>
5
6
7struct bcm47xx_wdt {
8 u32 (*timer_set)(struct bcm47xx_wdt *, u32);
9 u32 (*timer_set_ms)(struct bcm47xx_wdt *, u32);
10 u32 max_timer_ms;
11
12 void *driver_data;
13};
14
15static inline void *bcm47xx_wdt_get_drvdata(struct bcm47xx_wdt *wdt)
16{
17 return wdt->driver_data;
18}
19#endif /* LINUX_BCM47XX_WDT_H_ */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 4180eb78d575..e0ce311011c0 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -157,6 +157,7 @@ struct bcma_host_ops {
157 157
158/* Chip IDs of SoCs */ 158/* Chip IDs of SoCs */
159#define BCMA_CHIP_ID_BCM4706 0x5300 159#define BCMA_CHIP_ID_BCM4706 0x5300
160#define BCMA_PKG_ID_BCM4706L 1
160#define BCMA_CHIP_ID_BCM4716 0x4716 161#define BCMA_CHIP_ID_BCM4716 0x4716
161#define BCMA_PKG_ID_BCM4716 8 162#define BCMA_PKG_ID_BCM4716 8
162#define BCMA_PKG_ID_BCM4717 9 163#define BCMA_PKG_ID_BCM4717 9
@@ -166,7 +167,11 @@ struct bcma_host_ops {
166#define BCMA_CHIP_ID_BCM4749 0x4749 167#define BCMA_CHIP_ID_BCM4749 0x4749
167#define BCMA_CHIP_ID_BCM5356 0x5356 168#define BCMA_CHIP_ID_BCM5356 0x5356
168#define BCMA_CHIP_ID_BCM5357 0x5357 169#define BCMA_CHIP_ID_BCM5357 0x5357
170#define BCMA_PKG_ID_BCM5358 9
171#define BCMA_PKG_ID_BCM47186 10
172#define BCMA_PKG_ID_BCM5357 11
169#define BCMA_CHIP_ID_BCM53572 53572 173#define BCMA_CHIP_ID_BCM53572 53572
174#define BCMA_PKG_ID_BCM47188 9
170 175
171struct bcma_device { 176struct bcma_device {
172 struct bcma_bus *bus; 177 struct bcma_bus *bus;
@@ -251,7 +256,7 @@ struct bcma_bus {
251 u8 num; 256 u8 num;
252 257
253 struct bcma_drv_cc drv_cc; 258 struct bcma_drv_cc drv_cc;
254 struct bcma_drv_pci drv_pci; 259 struct bcma_drv_pci drv_pci[2];
255 struct bcma_drv_mips drv_mips; 260 struct bcma_drv_mips drv_mips;
256 struct bcma_drv_gmac_cmn drv_gmac_cmn; 261 struct bcma_drv_gmac_cmn drv_gmac_cmn;
257 262
@@ -345,6 +350,7 @@ extern void bcma_core_set_clockmode(struct bcma_device *core,
345 enum bcma_clkmode clkmode); 350 enum bcma_clkmode clkmode);
346extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status, 351extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
347 bool on); 352 bool on);
353extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
348#define BCMA_DMA_TRANSLATION_MASK 0xC0000000 354#define BCMA_DMA_TRANSLATION_MASK 0xC0000000
349#define BCMA_DMA_TRANSLATION_NONE 0x00000000 355#define BCMA_DMA_TRANSLATION_NONE 0x00000000
350#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */ 356#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1cf1749440ac..9a0e3fa3ca95 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -1,6 +1,9 @@
1#ifndef LINUX_BCMA_DRIVER_CC_H_ 1#ifndef LINUX_BCMA_DRIVER_CC_H_
2#define LINUX_BCMA_DRIVER_CC_H_ 2#define LINUX_BCMA_DRIVER_CC_H_
3 3
4#include <linux/platform_device.h>
5#include <linux/gpio.h>
6
4/** ChipCommon core registers. **/ 7/** ChipCommon core registers. **/
5#define BCMA_CC_ID 0x0000 8#define BCMA_CC_ID 0x0000
6#define BCMA_CC_ID_ID 0x0000FFFF 9#define BCMA_CC_ID_ID 0x0000FFFF
@@ -510,6 +513,7 @@ struct bcma_chipcommon_pmu {
510 513
511#ifdef CONFIG_BCMA_DRIVER_MIPS 514#ifdef CONFIG_BCMA_DRIVER_MIPS
512struct bcma_pflash { 515struct bcma_pflash {
516 bool present;
513 u8 buswidth; 517 u8 buswidth;
514 u32 window; 518 u32 window;
515 u32 window_size; 519 u32 window_size;
@@ -532,6 +536,7 @@ struct mtd_info;
532 536
533struct bcma_nflash { 537struct bcma_nflash {
534 bool present; 538 bool present;
539 bool boot; /* This is the flash the SoC boots from */
535 540
536 struct mtd_info *mtd; 541 struct mtd_info *mtd;
537}; 542};
@@ -552,6 +557,7 @@ struct bcma_drv_cc {
552 u32 capabilities; 557 u32 capabilities;
553 u32 capabilities_ext; 558 u32 capabilities_ext;
554 u8 setup_done:1; 559 u8 setup_done:1;
560 u8 early_setup_done:1;
555 /* Fast Powerup Delay constant */ 561 /* Fast Powerup Delay constant */
556 u16 fast_pwrup_delay; 562 u16 fast_pwrup_delay;
557 struct bcma_chipcommon_pmu pmu; 563 struct bcma_chipcommon_pmu pmu;
@@ -567,6 +573,14 @@ struct bcma_drv_cc {
567 int nr_serial_ports; 573 int nr_serial_ports;
568 struct bcma_serial_port serial_ports[4]; 574 struct bcma_serial_port serial_ports[4];
569#endif /* CONFIG_BCMA_DRIVER_MIPS */ 575#endif /* CONFIG_BCMA_DRIVER_MIPS */
576 u32 ticks_per_ms;
577 struct platform_device *watchdog;
578
579 /* Lock for GPIO register access. */
580 spinlock_t gpio_lock;
581#ifdef CONFIG_BCMA_DRIVER_GPIO
582 struct gpio_chip gpio;
583#endif
570}; 584};
571 585
572/* Register access */ 586/* Register access */
@@ -583,14 +597,14 @@ struct bcma_drv_cc {
583 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 597 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
584 598
585extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); 599extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
600extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
586 601
587extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); 602extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
588extern void bcma_chipco_resume(struct bcma_drv_cc *cc); 603extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
589 604
590void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); 605void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
591 606
592extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, 607extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
593 u32 ticks);
594 608
595void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); 609void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
596 610
@@ -603,9 +617,12 @@ u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value);
603u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value); 617u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value);
604u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value); 618u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value);
605u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value); 619u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
620u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
621u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
606 622
607/* PMU support */ 623/* PMU support */
608extern void bcma_pmu_init(struct bcma_drv_cc *cc); 624extern void bcma_pmu_init(struct bcma_drv_cc *cc);
625extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
609 626
610extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, 627extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
611 u32 value); 628 u32 value);
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h
index def894b83b0d..4dd1f33e36a2 100644
--- a/include/linux/bcma/bcma_driver_gmac_cmn.h
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -92,7 +92,7 @@ struct bcma_drv_gmac_cmn {
92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) 92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
93 93
94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN 94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
95extern void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); 95extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
96#else 96#else
97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { } 97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
98#endif 98#endif
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index c0043645cdcb..0baf8a56b794 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -35,13 +35,16 @@ struct bcma_device;
35struct bcma_drv_mips { 35struct bcma_drv_mips {
36 struct bcma_device *core; 36 struct bcma_device *core;
37 u8 setup_done:1; 37 u8 setup_done:1;
38 u8 early_setup_done:1;
38 unsigned int assigned_irqs; 39 unsigned int assigned_irqs;
39}; 40};
40 41
41#ifdef CONFIG_BCMA_DRIVER_MIPS 42#ifdef CONFIG_BCMA_DRIVER_MIPS
42extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); 43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
43#else 45#else
44static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 46static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
47static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
45#endif 48#endif
46 49
47extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 50extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 41da581e1612..c48d98d27b77 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -214,7 +214,7 @@ struct bcma_drv_pci {
214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
216 216
217extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); 217extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
219 struct bcma_device *core, bool enable); 219 struct bcma_device *core, bool enable);
220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend); 220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 6c9cb93ae3de..7e8104bb7a7e 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -85,6 +85,9 @@
85 * (2 ZettaBytes), high 32 bits 85 * (2 ZettaBytes), high 32 bits
86 */ 86 */
87 87
88#define BCMA_SFLASH 0x1c000000 88#define BCMA_SOC_FLASH1 0x1fc00000 /* MIPS Flash Region 1 */
89#define BCMA_SOC_FLASH1_SZ 0x00400000 /* MIPS Size of Flash Region 1 */
90#define BCMA_SOC_FLASH2 0x1c000000 /* Flash Region 2 (region 1 shadowed here) */
91#define BCMA_SOC_FLASH2_SZ 0x02000000 /* Size of Flash Region 2 */
89 92
90#endif /* LINUX_BCMA_REGS_H_ */ 93#endif /* LINUX_BCMA_REGS_H_ */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index cfcc6bfcaec0..0530b9860359 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -54,8 +54,6 @@ struct linux_binprm {
54#define BINPRM_FLAGS_EXECFD_BIT 1 54#define BINPRM_FLAGS_EXECFD_BIT 1
55#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) 55#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
56 56
57#define BINPRM_MAX_RECURSION 4
58
59/* Function parameter for binfmt->coredump */ 57/* Function parameter for binfmt->coredump */
60struct coredump_params { 58struct coredump_params {
61 siginfo_t *siginfo; 59 siginfo_t *siginfo;
@@ -72,7 +70,7 @@ struct coredump_params {
72struct linux_binfmt { 70struct linux_binfmt {
73 struct list_head lh; 71 struct list_head lh;
74 struct module *module; 72 struct module *module;
75 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); 73 int (*load_binary)(struct linux_binprm *);
76 int (*load_shlib)(struct file *); 74 int (*load_shlib)(struct file *);
77 int (*core_dump)(struct coredump_params *cprm); 75 int (*core_dump)(struct coredump_params *cprm);
78 unsigned long min_coredump; /* minimal dump size */ 76 unsigned long min_coredump; /* minimal dump size */
@@ -95,7 +93,7 @@ extern void unregister_binfmt(struct linux_binfmt *);
95 93
96extern int prepare_binprm(struct linux_binprm *); 94extern int prepare_binprm(struct linux_binprm *);
97extern int __must_check remove_arg_zero(struct linux_binprm *); 95extern int __must_check remove_arg_zero(struct linux_binprm *);
98extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); 96extern int search_binary_handler(struct linux_binprm *);
99extern int flush_old_exec(struct linux_binprm * bprm); 97extern int flush_old_exec(struct linux_binprm * bprm);
100extern void setup_new_exec(struct linux_binprm * bprm); 98extern void setup_new_exec(struct linux_binprm * bprm);
101extern void would_dump(struct linux_binprm *, struct file *); 99extern void would_dump(struct linux_binprm *, struct file *);
@@ -114,6 +112,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
114 unsigned long stack_top, 112 unsigned long stack_top,
115 int executable_stack); 113 int executable_stack);
116extern int bprm_mm_init(struct linux_binprm *bprm); 114extern int bprm_mm_init(struct linux_binprm *bprm);
115extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
117extern int copy_strings_kernel(int argc, const char *const *argv, 116extern int copy_strings_kernel(int argc, const char *const *argv,
118 struct linux_binprm *bprm); 117 struct linux_binprm *bprm);
119extern int prepare_bprm_creds(struct linux_binprm *bprm); 118extern int prepare_bprm_creds(struct linux_binprm *bprm);
@@ -121,8 +120,4 @@ extern void install_exec_creds(struct linux_binprm *bprm);
121extern void set_binfmt(struct linux_binfmt *new); 120extern void set_binfmt(struct linux_binfmt *new);
122extern void free_bprm(struct linux_binprm *); 121extern void free_bprm(struct linux_binprm *);
123 122
124#ifdef __ARCH_WANT_KERNEL_EXECVE
125extern void ret_from_kernel_execve(struct pt_regs *normal) __noreturn;
126#endif
127
128#endif /* _LINUX_BINFMTS_H */ 123#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 1756001210d2..f94bc83011ed 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -378,6 +378,12 @@ struct request_queue {
378 378
379 unsigned int nr_sorted; 379 unsigned int nr_sorted;
380 unsigned int in_flight[2]; 380 unsigned int in_flight[2];
381 /*
382 * Number of active block driver functions for which blk_drain_queue()
383 * must wait. Must be incremented around functions that unlock the
384 * queue_lock internally, e.g. scsi_request_fn().
385 */
386 unsigned int request_fn_active;
381 387
382 unsigned int rq_timeout; 388 unsigned int rq_timeout;
383 struct timer_list timeout; 389 struct timer_list timeout;
@@ -437,7 +443,7 @@ struct request_queue {
437#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 443#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
438#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ 444#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
439#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ 445#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
440#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 446#define QUEUE_FLAG_DYING 5 /* queue being torn down */
441#define QUEUE_FLAG_BYPASS 6 /* act as dumb FIFO queue */ 447#define QUEUE_FLAG_BYPASS 6 /* act as dumb FIFO queue */
442#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ 448#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */
443#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ 449#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */
@@ -452,6 +458,7 @@ struct request_queue {
452#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ 458#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */
453#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ 459#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */
454#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ 460#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
461#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
455 462
456#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 463#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
457 (1 << QUEUE_FLAG_STACKABLE) | \ 464 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -521,6 +528,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
521 528
522#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 529#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
523#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 530#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
531#define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags)
524#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) 532#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
525#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags) 533#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags)
526#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 534#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
@@ -1180,13 +1188,25 @@ static inline int queue_discard_alignment(struct request_queue *q)
1180 1188
1181static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) 1189static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
1182{ 1190{
1183 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); 1191 unsigned int alignment, granularity, offset;
1184 1192
1185 if (!lim->max_discard_sectors) 1193 if (!lim->max_discard_sectors)
1186 return 0; 1194 return 0;
1187 1195
1188 return (lim->discard_granularity + lim->discard_alignment - alignment) 1196 /* Why are these in bytes, not sectors? */
1189 & (lim->discard_granularity - 1); 1197 alignment = lim->discard_alignment >> 9;
1198 granularity = lim->discard_granularity >> 9;
1199 if (!granularity)
1200 return 0;
1201
1202 /* Offset of the partition start in 'granularity' sectors */
1203 offset = sector_div(sector, granularity);
1204
1205 /* And why do we do this modulus *again* in blkdev_issue_discard()? */
1206 offset = (granularity + alignment - offset) % granularity;
1207
1208 /* Turn it back into bytes, gaah */
1209 return offset << 9;
1190} 1210}
1191 1211
1192static inline int bdev_discard_alignment(struct block_device *bdev) 1212static inline int bdev_discard_alignment(struct block_device *bdev)
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 6d6795d46a75..3f778c27f825 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -51,8 +51,8 @@ extern unsigned long free_all_bootmem(void);
51extern void free_bootmem_node(pg_data_t *pgdat, 51extern void free_bootmem_node(pg_data_t *pgdat,
52 unsigned long addr, 52 unsigned long addr,
53 unsigned long size); 53 unsigned long size);
54extern void free_bootmem(unsigned long addr, unsigned long size); 54extern void free_bootmem(unsigned long physaddr, unsigned long size);
55extern void free_bootmem_late(unsigned long addr, unsigned long size); 55extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
56 56
57/* 57/*
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, 58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
@@ -137,9 +137,6 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
137#define alloc_bootmem_low_pages_node(pgdat, x) \ 137#define alloc_bootmem_low_pages_node(pgdat, x) \
138 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) 138 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
139 139
140extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
141 int flags);
142
143#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 140#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
144extern void *alloc_remap(int nid, unsigned long size); 141extern void *alloc_remap(int nid, unsigned long size);
145#else 142#else
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index 4d0fb3df2f4a..a226652a5a6c 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -67,6 +67,5 @@ void bsg_job_done(struct bsg_job *job, int result,
67int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name, 67int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name,
68 bsg_job_fn *job_fn, int dd_job_size); 68 bsg_job_fn *job_fn, int dd_job_size);
69void bsg_request_fn(struct request_queue *q); 69void bsg_request_fn(struct request_queue *q);
70void bsg_goose_queue(struct request_queue *q);
71 70
72#endif 71#endif
diff --git a/include/linux/bug.h b/include/linux/bug.h
index aaac4bba6f5c..b1cf40de847e 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -15,6 +15,7 @@ struct pt_regs;
15#define BUILD_BUG_ON_NOT_POWER_OF_2(n) 15#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
16#define BUILD_BUG_ON_ZERO(e) (0) 16#define BUILD_BUG_ON_ZERO(e) (0)
17#define BUILD_BUG_ON_NULL(e) ((void*)0) 17#define BUILD_BUG_ON_NULL(e) ((void*)0)
18#define BUILD_BUG_ON_INVALID(e) (0)
18#define BUILD_BUG_ON(condition) 19#define BUILD_BUG_ON(condition)
19#define BUILD_BUG() (0) 20#define BUILD_BUG() (0)
20#else /* __CHECKER__ */ 21#else /* __CHECKER__ */
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 6470792b13d3..084d3c622b12 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -43,7 +43,6 @@ struct ceph_options {
43 struct ceph_entity_addr my_addr; 43 struct ceph_entity_addr my_addr;
44 int mount_timeout; 44 int mount_timeout;
45 int osd_idle_ttl; 45 int osd_idle_ttl;
46 int osd_timeout;
47 int osd_keepalive_timeout; 46 int osd_keepalive_timeout;
48 47
49 /* 48 /*
@@ -63,7 +62,6 @@ struct ceph_options {
63 * defaults 62 * defaults
64 */ 63 */
65#define CEPH_MOUNT_TIMEOUT_DEFAULT 60 64#define CEPH_MOUNT_TIMEOUT_DEFAULT 60
66#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
67#define CEPH_OSD_KEEPALIVE_DEFAULT 5 65#define CEPH_OSD_KEEPALIVE_DEFAULT 5
68#define CEPH_OSD_IDLE_TTL_DEFAULT 60 66#define CEPH_OSD_IDLE_TTL_DEFAULT 60
69 67
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index e37acbe989a9..10a417f9f76f 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -123,6 +123,7 @@ extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
124 struct ceph_pg pgid); 124 struct ceph_pg pgid);
125 125
126extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
126extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); 127extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
127 128
128#endif 129#endif
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index de91fbdf127e..2c04afeead1c 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -87,6 +87,8 @@ struct ceph_pg {
87 * 87 *
88 * lpgp_num -- as above. 88 * lpgp_num -- as above.
89 */ 89 */
90#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
91
90#define CEPH_PG_TYPE_REP 1 92#define CEPH_PG_TYPE_REP 1
91#define CEPH_PG_TYPE_RAID4 2 93#define CEPH_PG_TYPE_RAID4 2
92#define CEPH_PG_POOL_VERSION 2 94#define CEPH_PG_POOL_VERSION 2
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index f8a030ced0c7..7d73905dcba2 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -12,6 +12,7 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/rculist.h>
15#include <linux/cgroupstats.h> 16#include <linux/cgroupstats.h>
16#include <linux/prio_heap.h> 17#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 18#include <linux/rwsem.h>
@@ -34,7 +35,6 @@ extern int cgroup_lock_is_held(void);
34extern bool cgroup_lock_live_group(struct cgroup *cgrp); 35extern bool cgroup_lock_live_group(struct cgroup *cgrp);
35extern void cgroup_unlock(void); 36extern void cgroup_unlock(void);
36extern void cgroup_fork(struct task_struct *p); 37extern void cgroup_fork(struct task_struct *p);
37extern void cgroup_fork_callbacks(struct task_struct *p);
38extern void cgroup_post_fork(struct task_struct *p); 38extern void cgroup_post_fork(struct task_struct *p);
39extern void cgroup_exit(struct task_struct *p, int run_callbacks); 39extern void cgroup_exit(struct task_struct *p, int run_callbacks);
40extern int cgroupstats_build(struct cgroupstats *stats, 40extern int cgroupstats_build(struct cgroupstats *stats,
@@ -66,7 +66,7 @@ struct cgroup_subsys_state {
66 /* 66 /*
67 * State maintained by the cgroup system to allow subsystems 67 * State maintained by the cgroup system to allow subsystems
68 * to be "busy". Should be accessed via css_get(), 68 * to be "busy". Should be accessed via css_get(),
69 * css_tryget() and and css_put(). 69 * css_tryget() and css_put().
70 */ 70 */
71 71
72 atomic_t refcnt; 72 atomic_t refcnt;
@@ -81,9 +81,8 @@ struct cgroup_subsys_state {
81 81
82/* bits in struct cgroup_subsys_state flags field */ 82/* bits in struct cgroup_subsys_state flags field */
83enum { 83enum {
84 CSS_ROOT, /* This CSS is the root of the subsystem */ 84 CSS_ROOT = (1 << 0), /* this CSS is the root of the subsystem */
85 CSS_REMOVED, /* This CSS is dead */ 85 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */
86 CSS_CLEAR_CSS_REFS, /* @ss->__DEPRECATED_clear_css_refs */
87}; 86};
88 87
89/* Caller must verify that the css is not for root cgroup */ 88/* Caller must verify that the css is not for root cgroup */
@@ -102,15 +101,10 @@ static inline void __css_get(struct cgroup_subsys_state *css, int count)
102static inline void css_get(struct cgroup_subsys_state *css) 101static inline void css_get(struct cgroup_subsys_state *css)
103{ 102{
104 /* We don't need to reference count the root state */ 103 /* We don't need to reference count the root state */
105 if (!test_bit(CSS_ROOT, &css->flags)) 104 if (!(css->flags & CSS_ROOT))
106 __css_get(css, 1); 105 __css_get(css, 1);
107} 106}
108 107
109static inline bool css_is_removed(struct cgroup_subsys_state *css)
110{
111 return test_bit(CSS_REMOVED, &css->flags);
112}
113
114/* 108/*
115 * Call css_tryget() to take a reference on a css if your existing 109 * Call css_tryget() to take a reference on a css if your existing
116 * (known-valid) reference isn't already ref-counted. Returns false if 110 * (known-valid) reference isn't already ref-counted. Returns false if
@@ -120,7 +114,7 @@ static inline bool css_is_removed(struct cgroup_subsys_state *css)
120extern bool __css_tryget(struct cgroup_subsys_state *css); 114extern bool __css_tryget(struct cgroup_subsys_state *css);
121static inline bool css_tryget(struct cgroup_subsys_state *css) 115static inline bool css_tryget(struct cgroup_subsys_state *css)
122{ 116{
123 if (test_bit(CSS_ROOT, &css->flags)) 117 if (css->flags & CSS_ROOT)
124 return true; 118 return true;
125 return __css_tryget(css); 119 return __css_tryget(css);
126} 120}
@@ -133,7 +127,7 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
133extern void __css_put(struct cgroup_subsys_state *css); 127extern void __css_put(struct cgroup_subsys_state *css);
134static inline void css_put(struct cgroup_subsys_state *css) 128static inline void css_put(struct cgroup_subsys_state *css)
135{ 129{
136 if (!test_bit(CSS_ROOT, &css->flags)) 130 if (!(css->flags & CSS_ROOT))
137 __css_put(css); 131 __css_put(css);
138} 132}
139 133
@@ -149,13 +143,11 @@ enum {
149 /* Control Group requires release notifications to userspace */ 143 /* Control Group requires release notifications to userspace */
150 CGRP_NOTIFY_ON_RELEASE, 144 CGRP_NOTIFY_ON_RELEASE,
151 /* 145 /*
152 * A thread in rmdir() is wating for this cgroup. 146 * Clone the parent's configuration when creating a new child
153 */ 147 * cpuset cgroup. For historical reasons, this option can be
154 CGRP_WAIT_ON_RMDIR, 148 * specified at mount time and thus is implemented here.
155 /*
156 * Clone cgroup values when creating a new child cgroup
157 */ 149 */
158 CGRP_CLONE_CHILDREN, 150 CGRP_CPUSET_CLONE_CHILDREN,
159}; 151};
160 152
161struct cgroup { 153struct cgroup {
@@ -167,6 +159,8 @@ struct cgroup {
167 */ 159 */
168 atomic_t count; 160 atomic_t count;
169 161
162 int id; /* ida allocated in-hierarchy ID */
163
170 /* 164 /*
171 * We link our 'sibling' struct into our parent's 'children'. 165 * We link our 'sibling' struct into our parent's 'children'.
172 * Our children link their 'sibling' into our 'children'. 166 * Our children link their 'sibling' into our 'children'.
@@ -176,7 +170,7 @@ struct cgroup {
176 struct list_head files; /* my files */ 170 struct list_head files; /* my files */
177 171
178 struct cgroup *parent; /* my parent */ 172 struct cgroup *parent; /* my parent */
179 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */ 173 struct dentry *dentry; /* cgroup fs entry, RCU protected */
180 174
181 /* Private pointers for each registered subsystem */ 175 /* Private pointers for each registered subsystem */
182 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 176 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
@@ -282,7 +276,7 @@ struct cgroup_map_cb {
282 276
283/* cftype->flags */ 277/* cftype->flags */
284#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ 278#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */
285#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create onp root cg */ 279#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */
286 280
287#define MAX_CFTYPE_NAME 64 281#define MAX_CFTYPE_NAME 64
288 282
@@ -422,23 +416,6 @@ int cgroup_task_count(const struct cgroup *cgrp);
422int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task); 416int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
423 417
424/* 418/*
425 * When the subsys has to access css and may add permanent refcnt to css,
426 * it should take care of racy conditions with rmdir(). Following set of
427 * functions, is for stop/restart rmdir if necessary.
428 * Because these will call css_get/put, "css" should be alive css.
429 *
430 * cgroup_exclude_rmdir();
431 * ...do some jobs which may access arbitrary empty cgroup
432 * cgroup_release_and_wakeup_rmdir();
433 *
434 * When someone removes a cgroup while cgroup_exclude_rmdir() holds it,
435 * it sleeps and cgroup_release_and_wakeup_rmdir() will wake him up.
436 */
437
438void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
439void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
440
441/*
442 * Control Group taskset, used to pass around set of tasks to cgroup_subsys 419 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
443 * methods. 420 * methods.
444 */ 421 */
@@ -466,16 +443,17 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
466 */ 443 */
467 444
468struct cgroup_subsys { 445struct cgroup_subsys {
469 struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); 446 struct cgroup_subsys_state *(*css_alloc)(struct cgroup *cgrp);
470 int (*pre_destroy)(struct cgroup *cgrp); 447 int (*css_online)(struct cgroup *cgrp);
471 void (*destroy)(struct cgroup *cgrp); 448 void (*css_offline)(struct cgroup *cgrp);
449 void (*css_free)(struct cgroup *cgrp);
450
472 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 451 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
473 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 452 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
474 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 453 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
475 void (*fork)(struct task_struct *task); 454 void (*fork)(struct task_struct *task);
476 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 455 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
477 struct task_struct *task); 456 struct task_struct *task);
478 void (*post_clone)(struct cgroup *cgrp);
479 void (*bind)(struct cgroup *root); 457 void (*bind)(struct cgroup *root);
480 458
481 int subsys_id; 459 int subsys_id;
@@ -489,17 +467,6 @@ struct cgroup_subsys {
489 bool use_id; 467 bool use_id;
490 468
491 /* 469 /*
492 * If %true, cgroup removal will try to clear css refs by retrying
493 * ss->pre_destroy() until there's no css ref left. This behavior
494 * is strictly for backward compatibility and will be removed as
495 * soon as the current user (memcg) is updated.
496 *
497 * If %false, ss->pre_destroy() can't fail and cgroup removal won't
498 * wait for css refs to drop to zero before proceeding.
499 */
500 bool __DEPRECATED_clear_css_refs;
501
502 /*
503 * If %false, this subsystem is properly hierarchical - 470 * If %false, this subsystem is properly hierarchical -
504 * configuration, resource accounting and restriction on a parent 471 * configuration, resource accounting and restriction on a parent
505 * cgroup cover those of its children. If %true, hierarchy support 472 * cgroup cover those of its children. If %true, hierarchy support
@@ -572,6 +539,100 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
572 return task_subsys_state(task, subsys_id)->cgroup; 539 return task_subsys_state(task, subsys_id)->cgroup;
573} 540}
574 541
542/**
543 * cgroup_for_each_child - iterate through children of a cgroup
544 * @pos: the cgroup * to use as the loop cursor
545 * @cgroup: cgroup whose children to walk
546 *
547 * Walk @cgroup's children. Must be called under rcu_read_lock(). A child
548 * cgroup which hasn't finished ->css_online() or already has finished
549 * ->css_offline() may show up during traversal and it's each subsystem's
550 * responsibility to verify that each @pos is alive.
551 *
552 * If a subsystem synchronizes against the parent in its ->css_online() and
553 * before starting iterating, a cgroup which finished ->css_online() is
554 * guaranteed to be visible in the future iterations.
555 */
556#define cgroup_for_each_child(pos, cgroup) \
557 list_for_each_entry_rcu(pos, &(cgroup)->children, sibling)
558
559struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos,
560 struct cgroup *cgroup);
561
562/**
563 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants
564 * @pos: the cgroup * to use as the loop cursor
565 * @cgroup: cgroup whose descendants to walk
566 *
567 * Walk @cgroup's descendants. Must be called under rcu_read_lock(). A
568 * descendant cgroup which hasn't finished ->css_online() or already has
569 * finished ->css_offline() may show up during traversal and it's each
570 * subsystem's responsibility to verify that each @pos is alive.
571 *
572 * If a subsystem synchronizes against the parent in its ->css_online() and
573 * before starting iterating, and synchronizes against @pos on each
574 * iteration, any descendant cgroup which finished ->css_offline() is
575 * guaranteed to be visible in the future iterations.
576 *
577 * In other words, the following guarantees that a descendant can't escape
578 * state updates of its ancestors.
579 *
580 * my_online(@cgrp)
581 * {
582 * Lock @cgrp->parent and @cgrp;
583 * Inherit state from @cgrp->parent;
584 * Unlock both.
585 * }
586 *
587 * my_update_state(@cgrp)
588 * {
589 * Lock @cgrp;
590 * Update @cgrp's state;
591 * Unlock @cgrp;
592 *
593 * cgroup_for_each_descendant_pre(@pos, @cgrp) {
594 * Lock @pos;
595 * Verify @pos is alive and inherit state from @pos->parent;
596 * Unlock @pos;
597 * }
598 * }
599 *
600 * As long as the inheriting step, including checking the parent state, is
601 * enclosed inside @pos locking, double-locking the parent isn't necessary
602 * while inheriting. The state update to the parent is guaranteed to be
603 * visible by walking order and, as long as inheriting operations to the
604 * same @pos are atomic to each other, multiple updates racing each other
605 * still result in the correct state. It's guaranateed that at least one
606 * inheritance happens for any cgroup after the latest update to its
607 * parent.
608 *
609 * If checking parent's state requires locking the parent, each inheriting
610 * iteration should lock and unlock both @pos->parent and @pos.
611 *
612 * Alternatively, a subsystem may choose to use a single global lock to
613 * synchronize ->css_online() and ->css_offline() against tree-walking
614 * operations.
615 */
616#define cgroup_for_each_descendant_pre(pos, cgroup) \
617 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \
618 pos = cgroup_next_descendant_pre((pos), (cgroup)))
619
620struct cgroup *cgroup_next_descendant_post(struct cgroup *pos,
621 struct cgroup *cgroup);
622
623/**
624 * cgroup_for_each_descendant_post - post-order walk of a cgroup's descendants
625 * @pos: the cgroup * to use as the loop cursor
626 * @cgroup: cgroup whose descendants to walk
627 *
628 * Similar to cgroup_for_each_descendant_pre() but performs post-order
629 * traversal instead. Note that the walk visibility guarantee described in
630 * pre-order walk doesn't apply the same to post-order walks.
631 */
632#define cgroup_for_each_descendant_post(pos, cgroup) \
633 for (pos = cgroup_next_descendant_post(NULL, (cgroup)); (pos); \
634 pos = cgroup_next_descendant_post((pos), (cgroup)))
635
575/* A cgroup_iter should be treated as an opaque object */ 636/* A cgroup_iter should be treated as an opaque object */
576struct cgroup_iter { 637struct cgroup_iter {
577 struct list_head *cg_link; 638 struct list_head *cg_link;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index c12731582920..4989b8a7bed1 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -53,9 +53,18 @@ struct clk_hw;
53 * @disable: Disable the clock atomically. Called with enable_lock held. 53 * @disable: Disable the clock atomically. Called with enable_lock held.
54 * This function must not sleep. 54 * This function must not sleep.
55 * 55 *
56 * @recalc_rate Recalculate the rate of this clock, by quering hardware. The 56 * @is_enabled: Queries the hardware to determine if the clock is enabled.
57 * This function must not sleep. Optional, if this op is not
58 * set then the enable count will be used.
59 *
60 * @disable_unused: Disable the clock atomically. Only called from
61 * clk_disable_unused for gate clocks with special needs.
62 * Called with enable_lock held. This function must not
63 * sleep.
64 *
65 * @recalc_rate Recalculate the rate of this clock, by querying hardware. The
57 * parent rate is an input parameter. It is up to the caller to 66 * parent rate is an input parameter. It is up to the caller to
58 * insure that the prepare_mutex is held across this call. 67 * ensure that the prepare_mutex is held across this call.
59 * Returns the calculated rate. Optional, but recommended - if 68 * Returns the calculated rate. Optional, but recommended - if
60 * this op is not set then clock rate will be initialized to 0. 69 * this op is not set then clock rate will be initialized to 0.
61 * 70 *
@@ -89,7 +98,7 @@ struct clk_hw;
89 * implementations to split any work between atomic (enable) and sleepable 98 * implementations to split any work between atomic (enable) and sleepable
90 * (prepare) contexts. If enabling a clock requires code that might sleep, 99 * (prepare) contexts. If enabling a clock requires code that might sleep,
91 * this must be done in clk_prepare. Clock enable code that will never be 100 * this must be done in clk_prepare. Clock enable code that will never be
92 * called in a sleepable context may be implement in clk_enable. 101 * called in a sleepable context may be implemented in clk_enable.
93 * 102 *
94 * Typically, drivers will call clk_prepare when a clock may be needed later 103 * Typically, drivers will call clk_prepare when a clock may be needed later
95 * (eg. when a device is opened), and clk_enable when the clock is actually 104 * (eg. when a device is opened), and clk_enable when the clock is actually
@@ -102,6 +111,7 @@ struct clk_ops {
102 int (*enable)(struct clk_hw *hw); 111 int (*enable)(struct clk_hw *hw);
103 void (*disable)(struct clk_hw *hw); 112 void (*disable)(struct clk_hw *hw);
104 int (*is_enabled)(struct clk_hw *hw); 113 int (*is_enabled)(struct clk_hw *hw);
114 void (*disable_unused)(struct clk_hw *hw);
105 unsigned long (*recalc_rate)(struct clk_hw *hw, 115 unsigned long (*recalc_rate)(struct clk_hw *hw,
106 unsigned long parent_rate); 116 unsigned long parent_rate);
107 long (*round_rate)(struct clk_hw *hw, unsigned long, 117 long (*round_rate)(struct clk_hw *hw, unsigned long,
@@ -327,19 +337,21 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
327 * error code; drivers must test for an error code after calling clk_register. 337 * error code; drivers must test for an error code after calling clk_register.
328 */ 338 */
329struct clk *clk_register(struct device *dev, struct clk_hw *hw); 339struct clk *clk_register(struct device *dev, struct clk_hw *hw);
340struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw);
330 341
331void clk_unregister(struct clk *clk); 342void clk_unregister(struct clk *clk);
343void devm_clk_unregister(struct device *dev, struct clk *clk);
332 344
333/* helper functions */ 345/* helper functions */
334const char *__clk_get_name(struct clk *clk); 346const char *__clk_get_name(struct clk *clk);
335struct clk_hw *__clk_get_hw(struct clk *clk); 347struct clk_hw *__clk_get_hw(struct clk *clk);
336u8 __clk_get_num_parents(struct clk *clk); 348u8 __clk_get_num_parents(struct clk *clk);
337struct clk *__clk_get_parent(struct clk *clk); 349struct clk *__clk_get_parent(struct clk *clk);
338inline int __clk_get_enable_count(struct clk *clk); 350unsigned int __clk_get_enable_count(struct clk *clk);
339inline int __clk_get_prepare_count(struct clk *clk); 351unsigned int __clk_get_prepare_count(struct clk *clk);
340unsigned long __clk_get_rate(struct clk *clk); 352unsigned long __clk_get_rate(struct clk *clk);
341unsigned long __clk_get_flags(struct clk *clk); 353unsigned long __clk_get_flags(struct clk *clk);
342int __clk_is_enabled(struct clk *clk); 354bool __clk_is_enabled(struct clk *clk);
343struct clk *__clk_lookup(const char *name); 355struct clk *__clk_lookup(const char *name);
344 356
345/* 357/*
diff --git a/include/linux/clk/mvebu.h b/include/linux/clk/mvebu.h
new file mode 100644
index 000000000000..8c4ae713b063
--- /dev/null
+++ b/include/linux/clk/mvebu.h
@@ -0,0 +1,22 @@
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 as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16
17#ifndef __CLK_MVEBU_H_
18#define __CLK_MVEBU_H_
19
20void __init mvebu_clocks_init(void);
21
22#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
new file mode 100644
index 000000000000..e074fdd5a236
--- /dev/null
+++ b/include/linux/clk/sunxi.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
new file mode 100644
index 000000000000..56be7cd9aa8b
--- /dev/null
+++ b/include/linux/clk/zynq.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2012 National Instruments
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __LINUX_CLK_ZYNQ_H_
20#define __LINUX_CLK_ZYNQ_H_
21
22void __init xilinx_zynq_clocks_init(void __iomem *slcr);
23
24#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index d0ced1011f2f..dec7e2d18875 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -23,6 +23,61 @@
23#define COMPAT_USE_64BIT_TIME 0 23#define COMPAT_USE_64BIT_TIME 0
24#endif 24#endif
25 25
26#ifndef __SC_DELOUSE
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif
29
30#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
31#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
32#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
33#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
34#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
35#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
36#define COMPAT_SYSCALL_DEFINE1(name, ...) \
37 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
38#define COMPAT_SYSCALL_DEFINE2(name, ...) \
39 COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
40#define COMPAT_SYSCALL_DEFINE3(name, ...) \
41 COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
42#define COMPAT_SYSCALL_DEFINE4(name, ...) \
43 COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
44#define COMPAT_SYSCALL_DEFINE5(name, ...) \
45 COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
46#define COMPAT_SYSCALL_DEFINE6(name, ...) \
47 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
48
49#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \
53 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \
54 asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \
55 { \
56 return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \
57 } \
58 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
59 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__))
60
61#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
62
63#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
64 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
65
66#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
67
68#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer()
70#endif
71#ifdef CONFIG_GENERIC_SIGALTSTACK
72#ifndef compat_sigaltstack /* we'll need that for MIPS */
73typedef struct compat_sigaltstack {
74 compat_uptr_t ss_sp;
75 int ss_flags;
76 compat_size_t ss_size;
77} compat_stack_t;
78#endif
79#endif
80
26#define compat_jiffies_to_clock_t(x) \ 81#define compat_jiffies_to_clock_t(x) \
27 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
28 83
@@ -284,12 +339,8 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
284 const struct compat_iovec __user *vec, 339 const struct compat_iovec __user *vec,
285 unsigned long vlen, u32 pos_low, u32 pos_high); 340 unsigned long vlen, u32 pos_low, u32 pos_high);
286 341
287int compat_do_execve(const char *filename, const compat_uptr_t __user *argv,
288 const compat_uptr_t __user *envp, struct pt_regs *regs);
289#ifdef __ARCH_WANT_SYS_EXECVE
290asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 342asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
291 const compat_uptr_t __user *envp); 343 const compat_uptr_t __user *envp);
292#endif
293 344
294asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 345asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
295 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 346 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
@@ -591,6 +642,16 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
591 642
592asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
593 compat_off_t __user *offset, compat_size_t count); 644 compat_off_t __user *offset, compat_size_t count);
645#ifdef CONFIG_GENERIC_SIGALTSTACK
646asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
647 compat_stack_t __user *uoss_ptr);
648
649int compat_restore_altstack(const compat_stack_t __user *uss);
650int __compat_save_altstack(compat_stack_t __user *, unsigned long);
651#endif
652
653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
654 struct compat_timespec __user *interval);
594 655
595#else 656#else
596 657
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 412bc6c2b023..662fd1b4c42a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -31,6 +31,8 @@
31 31
32#define __linktime_error(message) __attribute__((__error__(message))) 32#define __linktime_error(message) __attribute__((__error__(message)))
33 33
34#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
35
34#if __GNUC_MINOR__ >= 5 36#if __GNUC_MINOR__ >= 5
35/* 37/*
36 * Mark a position in code as unreachable. This can be used to 38 * Mark a position in code as unreachable. This can be used to
@@ -63,3 +65,13 @@
63#define __compiletime_warning(message) __attribute__((warning(message))) 65#define __compiletime_warning(message) __attribute__((warning(message)))
64#define __compiletime_error(message) __attribute__((error(message))) 66#define __compiletime_error(message) __attribute__((error(message)))
65#endif 67#endif
68
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if __GNUC_MINOR__ >= 4
71#define __HAVE_BUILTIN_BSWAP32__
72#define __HAVE_BUILTIN_BSWAP64__
73#endif
74#if __GNUC_MINOR__ >= 8 || (defined(__powerpc__) && __GNUC_MINOR__ >= 6)
75#define __HAVE_BUILTIN_BSWAP16__
76#endif
77#endif
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index d8e636e5607d..973ce10c40b6 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -29,3 +29,10 @@
29#endif 29#endif
30 30
31#define uninitialized_var(x) x 31#define uninitialized_var(x) x
32
33#ifndef __HAVE_BUILTIN_BSWAP16__
34/* icc has this, but it's called _bswap16 */
35#define __HAVE_BUILTIN_BSWAP16__
36#define __builtin_bswap16 _bswap16
37#endif
38
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index f430e4162f41..dd852b73b286 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -10,6 +10,7 @@
10# define __force __attribute__((force)) 10# define __force __attribute__((force))
11# define __nocast __attribute__((nocast)) 11# define __nocast __attribute__((nocast))
12# define __iomem __attribute__((noderef, address_space(2))) 12# define __iomem __attribute__((noderef, address_space(2)))
13# define __must_hold(x) __attribute__((context(x,1,1)))
13# define __acquires(x) __attribute__((context(x,0,1))) 14# define __acquires(x) __attribute__((context(x,0,1)))
14# define __releases(x) __attribute__((context(x,1,0))) 15# define __releases(x) __attribute__((context(x,1,0)))
15# define __acquire(x) __context__(x,1) 16# define __acquire(x) __context__(x,1)
@@ -33,6 +34,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
33# define __chk_user_ptr(x) (void)0 34# define __chk_user_ptr(x) (void)0
34# define __chk_io_ptr(x) (void)0 35# define __chk_io_ptr(x) (void)0
35# define __builtin_warning(x, y...) (1) 36# define __builtin_warning(x, y...) (1)
37# define __must_hold(x)
36# define __acquires(x) 38# define __acquires(x)
37# define __releases(x) 39# define __releases(x)
38# define __acquire(x) (void)0 40# define __acquire(x) (void)0
@@ -42,6 +44,10 @@ extern void __chk_io_ptr(const volatile void __iomem *);
42# define __rcu 44# define __rcu
43#endif 45#endif
44 46
47/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
48#define ___PASTE(a,b) a##b
49#define __PASTE(a,b) ___PASTE(a,b)
50
45#ifdef __KERNEL__ 51#ifdef __KERNEL__
46 52
47#ifdef __GNUC__ 53#ifdef __GNUC__
@@ -164,6 +170,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
164 (typeof(ptr)) (__ptr + (off)); }) 170 (typeof(ptr)) (__ptr + (off)); })
165#endif 171#endif
166 172
173/* Not-quite-unique ID. */
174#ifndef __UNIQUE_ID
175# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
176#endif
177
167#endif /* __KERNEL__ */ 178#endif /* __KERNEL__ */
168 179
169#endif /* __ASSEMBLY__ */ 180#endif /* __ASSEMBLY__ */
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
new file mode 100644
index 000000000000..e24339ccb7f0
--- /dev/null
+++ b/include/linux/context_tracking.h
@@ -0,0 +1,18 @@
1#ifndef _LINUX_CONTEXT_TRACKING_H
2#define _LINUX_CONTEXT_TRACKING_H
3
4#ifdef CONFIG_CONTEXT_TRACKING
5#include <linux/sched.h>
6
7extern void user_enter(void);
8extern void user_exit(void);
9extern void context_tracking_task_switch(struct task_struct *prev,
10 struct task_struct *next);
11#else
12static inline void user_enter(void) { }
13static inline void user_exit(void) { }
14static inline void context_tracking_task_switch(struct task_struct *prev,
15 struct task_struct *next) { }
16#endif /* !CONFIG_CONTEXT_TRACKING */
17
18#endif
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 1d7399314a89..a98f1ca60407 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -13,9 +13,9 @@
13extern int dump_write(struct file *file, const void *addr, int nr); 13extern int dump_write(struct file *file, const void *addr, int nr);
14extern int dump_seek(struct file *file, loff_t off); 14extern int dump_seek(struct file *file, loff_t off);
15#ifdef CONFIG_COREDUMP 15#ifdef CONFIG_COREDUMP
16extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs); 16extern void do_coredump(siginfo_t *siginfo);
17#else 17#else
18static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {} 18static inline void do_coredump(siginfo_t *siginfo) {}
19#endif 19#endif
20 20
21#endif /* _LINUX_COREDUMP_H */ 21#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 851530128e65..40b4ef54cc7d 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -29,13 +29,13 @@
29#define CPUFREQ_COOLING_START 0 29#define CPUFREQ_COOLING_START 0
30#define CPUFREQ_COOLING_STOP 1 30#define CPUFREQ_COOLING_STOP 1
31 31
32#ifdef CONFIG_CPU_THERMAL 32#if defined(CONFIG_CPU_THERMAL) || defined(CONFIG_CPU_THERMAL_MODULE)
33/** 33/**
34 * cpufreq_cooling_register - function to create cpufreq cooling device. 34 * cpufreq_cooling_register - function to create cpufreq cooling device.
35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen 35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
36 */ 36 */
37struct thermal_cooling_device *cpufreq_cooling_register( 37struct thermal_cooling_device *cpufreq_cooling_register(
38 struct cpumask *clip_cpus); 38 const struct cpumask *clip_cpus);
39 39
40/** 40/**
41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
@@ -44,7 +44,7 @@ struct thermal_cooling_device *cpufreq_cooling_register(
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device *cpufreq_cooling_register( 46static inline struct thermal_cooling_device *cpufreq_cooling_register(
47 struct cpumask *clip_cpus) 47 const struct cpumask *clip_cpus)
48{ 48{
49 return NULL; 49 return NULL;
50} 50}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index b60f6ba01d0c..a55b88eaf96a 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -11,6 +11,7 @@
11#ifndef _LINUX_CPUFREQ_H 11#ifndef _LINUX_CPUFREQ_H
12#define _LINUX_CPUFREQ_H 12#define _LINUX_CPUFREQ_H
13 13
14#include <asm/cputime.h>
14#include <linux/mutex.h> 15#include <linux/mutex.h>
15#include <linux/notifier.h> 16#include <linux/notifier.h>
16#include <linux/threads.h> 17#include <linux/threads.h>
@@ -22,6 +23,8 @@
22#include <asm/div64.h> 23#include <asm/div64.h>
23 24
24#define CPUFREQ_NAME_LEN 16 25#define CPUFREQ_NAME_LEN 16
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
25 28
26 29
27/********************************************************************* 30/*********************************************************************
@@ -404,6 +407,4 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
404 unsigned int cpu); 407 unsigned int cpu);
405 408
406void cpufreq_frequency_table_put_attr(unsigned int cpu); 409void cpufreq_frequency_table_put_attr(unsigned int cpu);
407
408
409#endif /* _LINUX_CPUFREQ_H */ 410#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 279b1eaa8b73..3711b34dc4f9 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -82,13 +82,6 @@ cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data)
82 st_usage->driver_data = data; 82 st_usage->driver_data = data;
83} 83}
84 84
85struct cpuidle_state_kobj {
86 struct cpuidle_state *state;
87 struct cpuidle_state_usage *state_usage;
88 struct completion kobj_unregister;
89 struct kobject kobj;
90};
91
92struct cpuidle_device { 85struct cpuidle_device {
93 unsigned int registered:1; 86 unsigned int registered:1;
94 unsigned int enabled:1; 87 unsigned int enabled:1;
@@ -98,7 +91,7 @@ struct cpuidle_device {
98 int state_count; 91 int state_count;
99 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 92 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
100 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 93 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
101 94 struct cpuidle_driver_kobj *kobj_driver;
102 struct list_head device_list; 95 struct list_head device_list;
103 struct kobject kobj; 96 struct kobject kobj;
104 struct completion kobj_unregister; 97 struct completion kobj_unregister;
@@ -131,6 +124,7 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
131struct cpuidle_driver { 124struct cpuidle_driver {
132 const char *name; 125 const char *name;
133 struct module *owner; 126 struct module *owner;
127 int refcnt;
134 128
135 unsigned int power_specified:1; 129 unsigned int power_specified:1;
136 /* set to 1 to use the core cpuidle time keeping (for all states). */ 130 /* set to 1 to use the core cpuidle time keeping (for all states). */
@@ -163,6 +157,10 @@ extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
163 struct cpuidle_driver *drv, int index)); 157 struct cpuidle_driver *drv, int index));
164extern int cpuidle_play_dead(void); 158extern int cpuidle_play_dead(void);
165 159
160extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
161extern int cpuidle_register_cpu_driver(struct cpuidle_driver *drv, int cpu);
162extern void cpuidle_unregister_cpu_driver(struct cpuidle_driver *drv, int cpu);
163
166#else 164#else
167static inline void disable_cpuidle(void) { } 165static inline void disable_cpuidle(void) { }
168static inline int cpuidle_idle_call(void) { return -ENODEV; } 166static inline int cpuidle_idle_call(void) { return -ENODEV; }
@@ -189,7 +187,6 @@ static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
189 struct cpuidle_driver *drv, int index)) 187 struct cpuidle_driver *drv, int index))
190{ return -ENODEV; } 188{ return -ENODEV; }
191static inline int cpuidle_play_dead(void) {return -ENODEV; } 189static inline int cpuidle_play_dead(void) {return -ENODEV; }
192
193#endif 190#endif
194 191
195#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 192#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 838320fc3d1d..8c8a60d29407 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -144,7 +144,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
144 return node_possible_map; 144 return node_possible_map;
145} 145}
146 146
147#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) 147#define cpuset_current_mems_allowed (node_states[N_MEMORY])
148static inline void cpuset_init_current_mems_allowed(void) {} 148static inline void cpuset_init_current_mems_allowed(void) {}
149 149
150static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) 150static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index ebbed2ce6637..04421e825365 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -77,21 +77,6 @@ extern int in_group_p(kgid_t);
77extern int in_egroup_p(kgid_t); 77extern int in_egroup_p(kgid_t);
78 78
79/* 79/*
80 * The common credentials for a thread group
81 * - shared by CLONE_THREAD
82 */
83#ifdef CONFIG_KEYS
84struct thread_group_cred {
85 atomic_t usage;
86 pid_t tgid; /* thread group process ID */
87 spinlock_t lock;
88 struct key __rcu *session_keyring; /* keyring inherited over fork */
89 struct key *process_keyring; /* keyring private to this process */
90 struct rcu_head rcu; /* RCU deletion hook */
91};
92#endif
93
94/*
95 * The security context of a task 80 * The security context of a task
96 * 81 *
97 * The parts of the context break down into two categories: 82 * The parts of the context break down into two categories:
@@ -139,9 +124,10 @@ struct cred {
139#ifdef CONFIG_KEYS 124#ifdef CONFIG_KEYS
140 unsigned char jit_keyring; /* default keyring to attach requested 125 unsigned char jit_keyring; /* default keyring to attach requested
141 * keys to */ 126 * keys to */
127 struct key __rcu *session_keyring; /* keyring inherited over fork */
128 struct key *process_keyring; /* keyring private to this process */
142 struct key *thread_keyring; /* keyring private to this thread */ 129 struct key *thread_keyring; /* keyring private to this thread */
143 struct key *request_key_auth; /* assumed request_key authority */ 130 struct key *request_key_auth; /* assumed request_key authority */
144 struct thread_group_cred *tgcred; /* thread-group shared credentials */
145#endif 131#endif
146#ifdef CONFIG_SECURITY 132#ifdef CONFIG_SECURITY
147 void *security; /* subjective LSM security */ 133 void *security; /* subjective LSM security */
@@ -357,10 +343,8 @@ static inline void put_cred(const struct cred *_cred)
357extern struct user_namespace init_user_ns; 343extern struct user_namespace init_user_ns;
358#ifdef CONFIG_USER_NS 344#ifdef CONFIG_USER_NS
359#define current_user_ns() (current_cred_xxx(user_ns)) 345#define current_user_ns() (current_cred_xxx(user_ns))
360#define task_user_ns(task) (task_cred_xxx((task), user_ns))
361#else 346#else
362#define current_user_ns() (&init_user_ns) 347#define current_user_ns() (&init_user_ns)
363#define task_user_ns(task) (&init_user_ns)
364#endif 348#endif
365 349
366 350
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 59200795482e..c1754b59ddd3 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -202,7 +202,6 @@ struct dentry_operations {
202#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 202#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
203#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 203#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
204#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 204#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
205#define DCACHE_NEED_LOOKUP 0x80000 /* dentry requires i_op->lookup */
206#define DCACHE_MANAGED_DENTRY \ 205#define DCACHE_MANAGED_DENTRY \
207 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 206 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
208 207
@@ -408,13 +407,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
408 return dentry->d_flags & DCACHE_MOUNTED; 407 return dentry->d_flags & DCACHE_MOUNTED;
409} 408}
410 409
411static inline bool d_need_lookup(struct dentry *dentry)
412{
413 return dentry->d_flags & DCACHE_NEED_LOOKUP;
414}
415
416extern void d_clear_need_lookup(struct dentry *dentry);
417
418extern int sysctl_vfs_cache_pressure; 410extern int sysctl_vfs_cache_pressure;
419 411
420#endif /* __LINUX_DCACHE_H */ 412#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 281c72a3b9d5..e83ef39b3bea 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -25,12 +25,12 @@ struct devfreq;
25 * struct devfreq_dev_status - Data given from devfreq user device to 25 * struct devfreq_dev_status - Data given from devfreq user device to
26 * governors. Represents the performance 26 * governors. Represents the performance
27 * statistics. 27 * statistics.
28 * @total_time The total time represented by this instance of 28 * @total_time: The total time represented by this instance of
29 * devfreq_dev_status 29 * devfreq_dev_status
30 * @busy_time The time that the device was working among the 30 * @busy_time: The time that the device was working among the
31 * total_time. 31 * total_time.
32 * @current_frequency The operating frequency. 32 * @current_frequency: The operating frequency.
33 * @private_data An entry not specified by the devfreq framework. 33 * @private_data: An entry not specified by the devfreq framework.
34 * A device and a specific governor may have their 34 * A device and a specific governor may have their
35 * own protocol with private_data. However, because 35 * own protocol with private_data. However, because
36 * this is governor-specific, a governor using this 36 * this is governor-specific, a governor using this
@@ -54,23 +54,27 @@ struct devfreq_dev_status {
54 54
55/** 55/**
56 * struct devfreq_dev_profile - Devfreq's user device profile 56 * struct devfreq_dev_profile - Devfreq's user device profile
57 * @initial_freq The operating frequency when devfreq_add_device() is 57 * @initial_freq: The operating frequency when devfreq_add_device() is
58 * called. 58 * called.
59 * @polling_ms The polling interval in ms. 0 disables polling. 59 * @polling_ms: The polling interval in ms. 0 disables polling.
60 * @target The device should set its operating frequency at 60 * @target: The device should set its operating frequency at
61 * freq or lowest-upper-than-freq value. If freq is 61 * freq or lowest-upper-than-freq value. If freq is
62 * higher than any operable frequency, set maximum. 62 * higher than any operable frequency, set maximum.
63 * Before returning, target function should set 63 * Before returning, target function should set
64 * freq at the current frequency. 64 * freq at the current frequency.
65 * The "flags" parameter's possible values are 65 * The "flags" parameter's possible values are
66 * explained above with "DEVFREQ_FLAG_*" macros. 66 * explained above with "DEVFREQ_FLAG_*" macros.
67 * @get_dev_status The device should provide the current performance 67 * @get_dev_status: The device should provide the current performance
68 * status to devfreq, which is used by governors. 68 * status to devfreq, which is used by governors.
69 * @exit An optional callback that is called when devfreq 69 * @get_cur_freq: The device should provide the current frequency
70 * at which it is operating.
71 * @exit: An optional callback that is called when devfreq
70 * is removing the devfreq object due to error or 72 * is removing the devfreq object due to error or
71 * from devfreq_remove_device() call. If the user 73 * from devfreq_remove_device() call. If the user
72 * has registered devfreq->nb at a notifier-head, 74 * has registered devfreq->nb at a notifier-head,
73 * this is the time to unregister it. 75 * this is the time to unregister it.
76 * @freq_table: Optional list of frequencies to support statistics.
77 * @max_state: The size of freq_table.
74 */ 78 */
75struct devfreq_dev_profile { 79struct devfreq_dev_profile {
76 unsigned long initial_freq; 80 unsigned long initial_freq;
@@ -79,63 +83,63 @@ struct devfreq_dev_profile {
79 int (*target)(struct device *dev, unsigned long *freq, u32 flags); 83 int (*target)(struct device *dev, unsigned long *freq, u32 flags);
80 int (*get_dev_status)(struct device *dev, 84 int (*get_dev_status)(struct device *dev,
81 struct devfreq_dev_status *stat); 85 struct devfreq_dev_status *stat);
86 int (*get_cur_freq)(struct device *dev, unsigned long *freq);
82 void (*exit)(struct device *dev); 87 void (*exit)(struct device *dev);
88
89 unsigned int *freq_table;
90 unsigned int max_state;
83}; 91};
84 92
85/** 93/**
86 * struct devfreq_governor - Devfreq policy governor 94 * struct devfreq_governor - Devfreq policy governor
87 * @name Governor's name 95 * @node: list node - contains registered devfreq governors
88 * @get_target_freq Returns desired operating frequency for the device. 96 * @name: Governor's name
97 * @get_target_freq: Returns desired operating frequency for the device.
89 * Basically, get_target_freq will run 98 * Basically, get_target_freq will run
90 * devfreq_dev_profile.get_dev_status() to get the 99 * devfreq_dev_profile.get_dev_status() to get the
91 * status of the device (load = busy_time / total_time). 100 * status of the device (load = busy_time / total_time).
92 * If no_central_polling is set, this callback is called 101 * If no_central_polling is set, this callback is called
93 * only with update_devfreq() notified by OPP. 102 * only with update_devfreq() notified by OPP.
94 * @init Called when the devfreq is being attached to a device 103 * @event_handler: Callback for devfreq core framework to notify events
95 * @exit Called when the devfreq is being removed from a 104 * to governors. Events include per device governor
96 * device. Governor should stop any internal routines 105 * init and exit, opp changes out of devfreq, suspend
97 * before return because related data may be 106 * and resume of per device devfreq during device idle.
98 * freed after exit().
99 * @no_central_polling Do not use devfreq's central polling mechanism.
100 * When this is set, devfreq will not call
101 * get_target_freq with devfreq_monitor(). However,
102 * devfreq will call get_target_freq with
103 * devfreq_update() notified by OPP framework.
104 * 107 *
105 * Note that the callbacks are called with devfreq->lock locked by devfreq. 108 * Note that the callbacks are called with devfreq->lock locked by devfreq.
106 */ 109 */
107struct devfreq_governor { 110struct devfreq_governor {
111 struct list_head node;
112
108 const char name[DEVFREQ_NAME_LEN]; 113 const char name[DEVFREQ_NAME_LEN];
109 int (*get_target_freq)(struct devfreq *this, unsigned long *freq); 114 int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
110 int (*init)(struct devfreq *this); 115 int (*event_handler)(struct devfreq *devfreq,
111 void (*exit)(struct devfreq *this); 116 unsigned int event, void *data);
112 const bool no_central_polling;
113}; 117};
114 118
115/** 119/**
116 * struct devfreq - Device devfreq structure 120 * struct devfreq - Device devfreq structure
117 * @node list node - contains the devices with devfreq that have been 121 * @node: list node - contains the devices with devfreq that have been
118 * registered. 122 * registered.
119 * @lock a mutex to protect accessing devfreq. 123 * @lock: a mutex to protect accessing devfreq.
120 * @dev device registered by devfreq class. dev.parent is the device 124 * @dev: device registered by devfreq class. dev.parent is the device
121 * using devfreq. 125 * using devfreq.
122 * @profile device-specific devfreq profile 126 * @profile: device-specific devfreq profile
123 * @governor method how to choose frequency based on the usage. 127 * @governor: method how to choose frequency based on the usage.
124 * @nb notifier block used to notify devfreq object that it should 128 * @governor_name: devfreq governor name for use with this devfreq
129 * @nb: notifier block used to notify devfreq object that it should
125 * reevaluate operable frequencies. Devfreq users may use 130 * reevaluate operable frequencies. Devfreq users may use
126 * devfreq.nb to the corresponding register notifier call chain. 131 * devfreq.nb to the corresponding register notifier call chain.
127 * @polling_jiffies interval in jiffies. 132 * @work: delayed work for load monitoring.
128 * @previous_freq previously configured frequency value. 133 * @previous_freq: previously configured frequency value.
129 * @next_polling the number of remaining jiffies to poll with 134 * @data: Private data of the governor. The devfreq framework does not
130 * "devfreq_monitor" executions to reevaluate
131 * frequency/voltage of the device. Set by
132 * profile's polling_ms interval.
133 * @data Private data of the governor. The devfreq framework does not
134 * touch this. 135 * touch this.
135 * @being_removed a flag to mark that this object is being removed in 136 * @min_freq: Limit minimum frequency requested by user (0: none)
136 * order to prevent trying to remove the object multiple times. 137 * @max_freq: Limit maximum frequency requested by user (0: none)
137 * @min_freq Limit minimum frequency requested by user (0: none) 138 * @stop_polling: devfreq polling status of a device.
138 * @max_freq Limit maximum frequency requested by user (0: none) 139 * @total_trans: Number of devfreq transitions
140 * @trans_table: Statistics of devfreq transitions
141 * @time_in_state: Statistics of devfreq states
142 * @last_stat_updated: The last time stat updated
139 * 143 *
140 * This structure stores the devfreq information for a give device. 144 * This structure stores the devfreq information for a give device.
141 * 145 *
@@ -152,26 +156,33 @@ struct devfreq {
152 struct device dev; 156 struct device dev;
153 struct devfreq_dev_profile *profile; 157 struct devfreq_dev_profile *profile;
154 const struct devfreq_governor *governor; 158 const struct devfreq_governor *governor;
159 char governor_name[DEVFREQ_NAME_LEN];
155 struct notifier_block nb; 160 struct notifier_block nb;
161 struct delayed_work work;
156 162
157 unsigned long polling_jiffies;
158 unsigned long previous_freq; 163 unsigned long previous_freq;
159 unsigned int next_polling;
160 164
161 void *data; /* private data for governors */ 165 void *data; /* private data for governors */
162 166
163 bool being_removed;
164
165 unsigned long min_freq; 167 unsigned long min_freq;
166 unsigned long max_freq; 168 unsigned long max_freq;
169 bool stop_polling;
170
171 /* information for device freqeuncy transition */
172 unsigned int total_trans;
173 unsigned int *trans_table;
174 unsigned long *time_in_state;
175 unsigned long last_stat_updated;
167}; 176};
168 177
169#if defined(CONFIG_PM_DEVFREQ) 178#if defined(CONFIG_PM_DEVFREQ)
170extern struct devfreq *devfreq_add_device(struct device *dev, 179extern struct devfreq *devfreq_add_device(struct device *dev,
171 struct devfreq_dev_profile *profile, 180 struct devfreq_dev_profile *profile,
172 const struct devfreq_governor *governor, 181 const char *governor_name,
173 void *data); 182 void *data);
174extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184extern int devfreq_suspend_device(struct devfreq *devfreq);
185extern int devfreq_resume_device(struct devfreq *devfreq);
175 186
176/* Helper functions for devfreq user device driver with OPP. */ 187/* Helper functions for devfreq user device driver with OPP. */
177extern struct opp *devfreq_recommended_opp(struct device *dev, 188extern struct opp *devfreq_recommended_opp(struct device *dev,
@@ -181,23 +192,13 @@ extern int devfreq_register_opp_notifier(struct device *dev,
181extern int devfreq_unregister_opp_notifier(struct device *dev, 192extern int devfreq_unregister_opp_notifier(struct device *dev,
182 struct devfreq *devfreq); 193 struct devfreq *devfreq);
183 194
184#ifdef CONFIG_DEVFREQ_GOV_POWERSAVE 195#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
185extern const struct devfreq_governor devfreq_powersave;
186#endif
187#ifdef CONFIG_DEVFREQ_GOV_PERFORMANCE
188extern const struct devfreq_governor devfreq_performance;
189#endif
190#ifdef CONFIG_DEVFREQ_GOV_USERSPACE
191extern const struct devfreq_governor devfreq_userspace;
192#endif
193#ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
194extern const struct devfreq_governor devfreq_simple_ondemand;
195/** 196/**
196 * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq 197 * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
197 * and devfreq_add_device 198 * and devfreq_add_device
198 * @ upthreshold If the load is over this value, the frequency jumps. 199 * @upthreshold: If the load is over this value, the frequency jumps.
199 * Specify 0 to use the default. Valid value = 0 to 100. 200 * Specify 0 to use the default. Valid value = 0 to 100.
200 * @ downdifferential If the load is under upthreshold - downdifferential, 201 * @downdifferential: If the load is under upthreshold - downdifferential,
201 * the governor may consider slowing the frequency down. 202 * the governor may consider slowing the frequency down.
202 * Specify 0 to use the default. Valid value = 0 to 100. 203 * Specify 0 to use the default. Valid value = 0 to 100.
203 * downdifferential < upthreshold must hold. 204 * downdifferential < upthreshold must hold.
@@ -214,7 +215,7 @@ struct devfreq_simple_ondemand_data {
214#else /* !CONFIG_PM_DEVFREQ */ 215#else /* !CONFIG_PM_DEVFREQ */
215static struct devfreq *devfreq_add_device(struct device *dev, 216static struct devfreq *devfreq_add_device(struct device *dev,
216 struct devfreq_dev_profile *profile, 217 struct devfreq_dev_profile *profile,
217 struct devfreq_governor *governor, 218 const char *governor_name,
218 void *data) 219 void *data)
219{ 220{
220 return NULL; 221 return NULL;
@@ -225,6 +226,16 @@ static int devfreq_remove_device(struct devfreq *devfreq)
225 return 0; 226 return 0;
226} 227}
227 228
229static int devfreq_suspend_device(struct devfreq *devfreq)
230{
231 return 0;
232}
233
234static int devfreq_resume_device(struct devfreq *devfreq)
235{
236 return 0;
237}
238
228static struct opp *devfreq_recommended_opp(struct device *dev, 239static struct opp *devfreq_recommended_opp(struct device *dev,
229 unsigned long *freq, u32 flags) 240 unsigned long *freq, u32 flags)
230{ 241{
@@ -243,11 +254,6 @@ static int devfreq_unregister_opp_notifier(struct device *dev,
243 return -EINVAL; 254 return -EINVAL;
244} 255}
245 256
246#define devfreq_powersave NULL
247#define devfreq_performance NULL
248#define devfreq_userspace NULL
249#define devfreq_simple_ondemand NULL
250
251#endif /* CONFIG_PM_DEVFREQ */ 257#endif /* CONFIG_PM_DEVFREQ */
252 258
253#endif /* __LINUX_DEVFREQ_H__ */ 259#endif /* __LINUX_DEVFREQ_H__ */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 38d27a10aa5d..bf6afa2fc432 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -23,7 +23,6 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
23union map_info { 23union map_info {
24 void *ptr; 24 void *ptr;
25 unsigned long long ll; 25 unsigned long long ll;
26 unsigned target_request_nr;
27}; 26};
28 27
29/* 28/*
@@ -46,8 +45,7 @@ typedef void (*dm_dtr_fn) (struct dm_target *ti);
46 * = 1: simple remap complete 45 * = 1: simple remap complete
47 * = 2: The target wants to push back the io 46 * = 2: The target wants to push back the io
48 */ 47 */
49typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio, 48typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio);
50 union map_info *map_context);
51typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone, 49typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone,
52 union map_info *map_context); 50 union map_info *map_context);
53 51
@@ -60,8 +58,7 @@ typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone,
60 * 2 : The target wants to push back the io 58 * 2 : The target wants to push back the io
61 */ 59 */
62typedef int (*dm_endio_fn) (struct dm_target *ti, 60typedef int (*dm_endio_fn) (struct dm_target *ti,
63 struct bio *bio, int error, 61 struct bio *bio, int error);
64 union map_info *map_context);
65typedef int (*dm_request_endio_fn) (struct dm_target *ti, 62typedef int (*dm_request_endio_fn) (struct dm_target *ti,
66 struct request *clone, int error, 63 struct request *clone, int error,
67 union map_info *map_context); 64 union map_info *map_context);
@@ -193,18 +190,30 @@ struct dm_target {
193 * A number of zero-length barrier requests that will be submitted 190 * A number of zero-length barrier requests that will be submitted
194 * to the target for the purpose of flushing cache. 191 * to the target for the purpose of flushing cache.
195 * 192 *
196 * The request number will be placed in union map_info->target_request_nr. 193 * The request number can be accessed with dm_bio_get_target_request_nr.
197 * It is a responsibility of the target driver to remap these requests 194 * It is a responsibility of the target driver to remap these requests
198 * to the real underlying devices. 195 * to the real underlying devices.
199 */ 196 */
200 unsigned num_flush_requests; 197 unsigned num_flush_requests;
201 198
202 /* 199 /*
203 * The number of discard requests that will be submitted to the 200 * The number of discard requests that will be submitted to the target.
204 * target. map_info->request_nr is used just like num_flush_requests. 201 * The request number can be accessed with dm_bio_get_target_request_nr.
205 */ 202 */
206 unsigned num_discard_requests; 203 unsigned num_discard_requests;
207 204
205 /*
206 * The number of WRITE SAME requests that will be submitted to the target.
207 * The request number can be accessed with dm_bio_get_target_request_nr.
208 */
209 unsigned num_write_same_requests;
210
211 /*
212 * The minimum number of extra bytes allocated in each bio for the
213 * target to use. dm_per_bio_data returns the data location.
214 */
215 unsigned per_bio_data_size;
216
208 /* target specific data */ 217 /* target specific data */
209 void *private; 218 void *private;
210 219
@@ -241,6 +250,36 @@ struct dm_target_callbacks {
241 int (*congested_fn) (struct dm_target_callbacks *, int); 250 int (*congested_fn) (struct dm_target_callbacks *, int);
242}; 251};
243 252
253/*
254 * For bio-based dm.
255 * One of these is allocated for each bio.
256 * This structure shouldn't be touched directly by target drivers.
257 * It is here so that we can inline dm_per_bio_data and
258 * dm_bio_from_per_bio_data
259 */
260struct dm_target_io {
261 struct dm_io *io;
262 struct dm_target *ti;
263 union map_info info;
264 unsigned target_request_nr;
265 struct bio clone;
266};
267
268static inline void *dm_per_bio_data(struct bio *bio, size_t data_size)
269{
270 return (char *)bio - offsetof(struct dm_target_io, clone) - data_size;
271}
272
273static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
274{
275 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
276}
277
278static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio)
279{
280 return container_of(bio, struct dm_target_io, clone)->target_request_nr;
281}
282
244int dm_register_target(struct target_type *t); 283int dm_register_target(struct target_type *t);
245void dm_unregister_target(struct target_type *t); 284void dm_unregister_target(struct target_type *t);
246 285
diff --git a/include/linux/device.h b/include/linux/device.h
index 86ef6ab553b1..43dcda937ddf 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -190,6 +190,7 @@ extern struct klist *bus_get_device_klist(struct bus_type *bus);
190 * @mod_name: Used for built-in modules. 190 * @mod_name: Used for built-in modules.
191 * @suppress_bind_attrs: Disables bind/unbind via sysfs. 191 * @suppress_bind_attrs: Disables bind/unbind via sysfs.
192 * @of_match_table: The open firmware table. 192 * @of_match_table: The open firmware table.
193 * @acpi_match_table: The ACPI match table.
193 * @probe: Called to query the existence of a specific device, 194 * @probe: Called to query the existence of a specific device,
194 * whether this driver can work with it, and bind the driver 195 * whether this driver can work with it, and bind the driver
195 * to a specific device. 196 * to a specific device.
@@ -223,6 +224,7 @@ struct device_driver {
223 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 224 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
224 225
225 const struct of_device_id *of_match_table; 226 const struct of_device_id *of_match_table;
227 const struct acpi_device_id *acpi_match_table;
226 228
227 int (*probe) (struct device *dev); 229 int (*probe) (struct device *dev);
228 int (*remove) (struct device *dev); 230 int (*remove) (struct device *dev);
@@ -496,6 +498,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
496 char *buf); 498 char *buf);
497ssize_t device_store_int(struct device *dev, struct device_attribute *attr, 499ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
498 const char *buf, size_t count); 500 const char *buf, size_t count);
501ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
502 char *buf);
503ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
504 const char *buf, size_t count);
499 505
500#define DEVICE_ATTR(_name, _mode, _show, _store) \ 506#define DEVICE_ATTR(_name, _mode, _show, _store) \
501 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 507 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
@@ -505,6 +511,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
505#define DEVICE_INT_ATTR(_name, _mode, _var) \ 511#define DEVICE_INT_ATTR(_name, _mode, _var) \
506 struct dev_ext_attribute dev_attr_##_name = \ 512 struct dev_ext_attribute dev_attr_##_name = \
507 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } 513 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
514#define DEVICE_BOOL_ATTR(_name, _mode, _var) \
515 struct dev_ext_attribute dev_attr_##_name = \
516 { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
508#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ 517#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
509 struct device_attribute dev_attr_##_name = \ 518 struct device_attribute dev_attr_##_name = \
510 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) 519 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
@@ -576,6 +585,12 @@ struct device_dma_parameters {
576 unsigned long segment_boundary_mask; 585 unsigned long segment_boundary_mask;
577}; 586};
578 587
588struct acpi_dev_node {
589#ifdef CONFIG_ACPI
590 void *handle;
591#endif
592};
593
579/** 594/**
580 * struct device - The basic device structure 595 * struct device - The basic device structure
581 * @parent: The device's "parent" device, the device to which it is attached. 596 * @parent: The device's "parent" device, the device to which it is attached.
@@ -616,6 +631,7 @@ struct device_dma_parameters {
616 * @dma_mem: Internal for coherent mem override. 631 * @dma_mem: Internal for coherent mem override.
617 * @archdata: For arch-specific additions. 632 * @archdata: For arch-specific additions.
618 * @of_node: Associated device tree node. 633 * @of_node: Associated device tree node.
634 * @acpi_node: Associated ACPI device node.
619 * @devt: For creating the sysfs "dev". 635 * @devt: For creating the sysfs "dev".
620 * @id: device instance 636 * @id: device instance
621 * @devres_lock: Spinlock to protect the resource of the device. 637 * @devres_lock: Spinlock to protect the resource of the device.
@@ -680,6 +696,7 @@ struct device {
680 struct dev_archdata archdata; 696 struct dev_archdata archdata;
681 697
682 struct device_node *of_node; /* associated device tree node */ 698 struct device_node *of_node; /* associated device tree node */
699 struct acpi_dev_node acpi_node; /* associated ACPI device node */
683 700
684 dev_t devt; /* dev_t, creates the sysfs "dev" */ 701 dev_t devt; /* dev_t, creates the sysfs "dev" */
685 u32 id; /* device instance */ 702 u32 id; /* device instance */
@@ -700,6 +717,14 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
700 return container_of(kobj, struct device, kobj); 717 return container_of(kobj, struct device, kobj);
701} 718}
702 719
720#ifdef CONFIG_ACPI
721#define ACPI_HANDLE(dev) ((dev)->acpi_node.handle)
722#define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_)
723#else
724#define ACPI_HANDLE(dev) (NULL)
725#define ACPI_HANDLE_SET(dev, _handle_) do { } while (0)
726#endif
727
703/* Get the wakeup routines, which depend on struct device */ 728/* Get the wakeup routines, which depend on struct device */
704#include <linux/pm_wakeup.h> 729#include <linux/pm_wakeup.h>
705 730
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index 5ce0e5fd712e..251a2090a554 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -20,28 +20,28 @@
20int devpts_new_index(struct inode *ptmx_inode); 20int devpts_new_index(struct inode *ptmx_inode);
21void devpts_kill_index(struct inode *ptmx_inode, int idx); 21void devpts_kill_index(struct inode *ptmx_inode, int idx);
22/* mknod in devpts */ 22/* mknod in devpts */
23int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty); 23struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
24/* get tty structure */ 24 void *priv);
25struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number); 25/* get private structure */
26void *devpts_get_priv(struct inode *pts_inode);
26/* unlink */ 27/* unlink */
27void devpts_pty_kill(struct tty_struct *tty); 28void devpts_pty_kill(struct inode *inode);
28 29
29#else 30#else
30 31
31/* Dummy stubs in the no-pty case */ 32/* Dummy stubs in the no-pty case */
32static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } 33static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; }
33static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } 34static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { }
34static inline int devpts_pty_new(struct inode *ptmx_inode, 35static inline struct inode *devpts_pty_new(struct inode *ptmx_inode,
35 struct tty_struct *tty) 36 dev_t device, int index, void *priv)
36{ 37{
37 return -EINVAL; 38 return ERR_PTR(-EINVAL);
38} 39}
39static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode, 40static inline void *devpts_get_priv(struct inode *pts_inode)
40 int number)
41{ 41{
42 return NULL; 42 return NULL;
43} 43}
44static inline void devpts_pty_kill(struct tty_struct *tty) { } 44static inline void devpts_pty_kill(struct inode *inode) { }
45 45
46#endif 46#endif
47 47
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 1d47dcce11e1..d02da2c6fc1a 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -98,7 +98,7 @@ int dlm_release_lockspace(dlm_lockspace_t *lockspace, int force);
98/* 98/*
99 * dlm_lock 99 * dlm_lock
100 * 100 *
101 * Make an asyncronous request to acquire or convert a lock on a named 101 * Make an asynchronous request to acquire or convert a lock on a named
102 * resource. 102 * resource.
103 * 103 *
104 * lockspace: context for the request 104 * lockspace: context for the request
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index f83f793223ff..c8e1831d7572 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -17,6 +17,7 @@ enum dma_attr {
17 DMA_ATTR_NON_CONSISTENT, 17 DMA_ATTR_NON_CONSISTENT,
18 DMA_ATTR_NO_KERNEL_MAPPING, 18 DMA_ATTR_NO_KERNEL_MAPPING,
19 DMA_ATTR_SKIP_CPU_SYNC, 19 DMA_ATTR_SKIP_CPU_SYNC,
20 DMA_ATTR_FORCE_CONTIGUOUS,
20 DMA_ATTR_MAX, 21 DMA_ATTR_MAX,
21}; 22};
22 23
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index eb48f3816df9..bd2e52ccc4f2 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -156,7 +156,6 @@ static inline void get_dma_buf(struct dma_buf *dmabuf)
156 get_file(dmabuf->file); 156 get_file(dmabuf->file);
157} 157}
158 158
159#ifdef CONFIG_DMA_SHARED_BUFFER
160struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 159struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
161 struct device *dev); 160 struct device *dev);
162void dma_buf_detach(struct dma_buf *dmabuf, 161void dma_buf_detach(struct dma_buf *dmabuf,
@@ -184,103 +183,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
184 unsigned long); 183 unsigned long);
185void *dma_buf_vmap(struct dma_buf *); 184void *dma_buf_vmap(struct dma_buf *);
186void dma_buf_vunmap(struct dma_buf *, void *vaddr); 185void dma_buf_vunmap(struct dma_buf *, void *vaddr);
187#else
188
189static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
190 struct device *dev)
191{
192 return ERR_PTR(-ENODEV);
193}
194
195static inline void dma_buf_detach(struct dma_buf *dmabuf,
196 struct dma_buf_attachment *dmabuf_attach)
197{
198 return;
199}
200
201static inline struct dma_buf *dma_buf_export(void *priv,
202 const struct dma_buf_ops *ops,
203 size_t size, int flags)
204{
205 return ERR_PTR(-ENODEV);
206}
207
208static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags)
209{
210 return -ENODEV;
211}
212
213static inline struct dma_buf *dma_buf_get(int fd)
214{
215 return ERR_PTR(-ENODEV);
216}
217
218static inline void dma_buf_put(struct dma_buf *dmabuf)
219{
220 return;
221}
222
223static inline struct sg_table *dma_buf_map_attachment(
224 struct dma_buf_attachment *attach, enum dma_data_direction write)
225{
226 return ERR_PTR(-ENODEV);
227}
228
229static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
230 struct sg_table *sg, enum dma_data_direction dir)
231{
232 return;
233}
234
235static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
236 size_t start, size_t len,
237 enum dma_data_direction dir)
238{
239 return -ENODEV;
240}
241
242static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf,
243 size_t start, size_t len,
244 enum dma_data_direction dir)
245{
246}
247
248static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf,
249 unsigned long pnum)
250{
251 return NULL;
252}
253
254static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf,
255 unsigned long pnum, void *vaddr)
256{
257}
258
259static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum)
260{
261 return NULL;
262}
263
264static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
265 unsigned long pnum, void *vaddr)
266{
267}
268
269static inline int dma_buf_mmap(struct dma_buf *dmabuf,
270 struct vm_area_struct *vma,
271 unsigned long pgoff)
272{
273 return -ENODEV;
274}
275
276static inline void *dma_buf_vmap(struct dma_buf *dmabuf)
277{
278 return NULL;
279}
280
281static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
282{
283}
284#endif /* CONFIG_DMA_SHARED_BUFFER */
285 186
286#endif /* __DMA_BUF_H__ */ 187#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 2f303e4b7ed3..01b5c84be828 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -68,7 +68,7 @@ struct device;
68extern struct cma *dma_contiguous_default_area; 68extern struct cma *dma_contiguous_default_area;
69 69
70void dma_contiguous_reserve(phys_addr_t addr_limit); 70void dma_contiguous_reserve(phys_addr_t addr_limit);
71int dma_declare_contiguous(struct device *dev, unsigned long size, 71int dma_declare_contiguous(struct device *dev, phys_addr_t size,
72 phys_addr_t base, phys_addr_t limit); 72 phys_addr_t base, phys_addr_t limit);
73 73
74struct page *dma_alloc_from_contiguous(struct device *dev, int count, 74struct page *dma_alloc_from_contiguous(struct device *dev, int count,
@@ -83,7 +83,7 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
83static inline void dma_contiguous_reserve(phys_addr_t limit) { } 83static inline void dma_contiguous_reserve(phys_addr_t limit) { }
84 84
85static inline 85static inline
86int dma_declare_contiguous(struct device *dev, unsigned long size, 86int dma_declare_contiguous(struct device *dev, phys_addr_t size,
87 phys_addr_t base, phys_addr_t limit) 87 phys_addr_t base, phys_addr_t limit)
88{ 88{
89 return -ENOSYS; 89 return -ENOSYS;
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index 171ad8aedc83..fc0e34ce038f 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -39,6 +39,8 @@ extern void debug_dma_map_page(struct device *dev, struct page *page,
39 int direction, dma_addr_t dma_addr, 39 int direction, dma_addr_t dma_addr,
40 bool map_single); 40 bool map_single);
41 41
42extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
43
42extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 44extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
43 size_t size, int direction, bool map_single); 45 size_t size, int direction, bool map_single);
44 46
@@ -105,6 +107,11 @@ static inline void debug_dma_map_page(struct device *dev, struct page *page,
105{ 107{
106} 108}
107 109
110static inline void debug_dma_mapping_error(struct device *dev,
111 dma_addr_t dma_addr)
112{
113}
114
108static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 115static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
109 size_t size, int direction, 116 size_t size, int direction,
110 bool map_single) 117 bool map_single)
diff --git a/include/linux/dma/ipu-dma.h b/include/linux/dma/ipu-dma.h
new file mode 100644
index 000000000000..18031115c668
--- /dev/null
+++ b/include/linux/dma/ipu-dma.h
@@ -0,0 +1,177 @@
1/*
2 * Copyright (C) 2008
3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
4 *
5 * Copyright (C) 2005-2007 Freescale Semiconductor, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_DMA_IPU_DMA_H
13#define __LINUX_DMA_IPU_DMA_H
14
15#include <linux/types.h>
16#include <linux/dmaengine.h>
17
18/* IPU DMA Controller channel definitions. */
19enum ipu_channel {
20 IDMAC_IC_0 = 0, /* IC (encoding task) to memory */
21 IDMAC_IC_1 = 1, /* IC (viewfinder task) to memory */
22 IDMAC_ADC_0 = 1,
23 IDMAC_IC_2 = 2,
24 IDMAC_ADC_1 = 2,
25 IDMAC_IC_3 = 3,
26 IDMAC_IC_4 = 4,
27 IDMAC_IC_5 = 5,
28 IDMAC_IC_6 = 6,
29 IDMAC_IC_7 = 7, /* IC (sensor data) to memory */
30 IDMAC_IC_8 = 8,
31 IDMAC_IC_9 = 9,
32 IDMAC_IC_10 = 10,
33 IDMAC_IC_11 = 11,
34 IDMAC_IC_12 = 12,
35 IDMAC_IC_13 = 13,
36 IDMAC_SDC_0 = 14, /* Background synchronous display data */
37 IDMAC_SDC_1 = 15, /* Foreground data (overlay) */
38 IDMAC_SDC_2 = 16,
39 IDMAC_SDC_3 = 17,
40 IDMAC_ADC_2 = 18,
41 IDMAC_ADC_3 = 19,
42 IDMAC_ADC_4 = 20,
43 IDMAC_ADC_5 = 21,
44 IDMAC_ADC_6 = 22,
45 IDMAC_ADC_7 = 23,
46 IDMAC_PF_0 = 24,
47 IDMAC_PF_1 = 25,
48 IDMAC_PF_2 = 26,
49 IDMAC_PF_3 = 27,
50 IDMAC_PF_4 = 28,
51 IDMAC_PF_5 = 29,
52 IDMAC_PF_6 = 30,
53 IDMAC_PF_7 = 31,
54};
55
56/* Order significant! */
57enum ipu_channel_status {
58 IPU_CHANNEL_FREE,
59 IPU_CHANNEL_INITIALIZED,
60 IPU_CHANNEL_READY,
61 IPU_CHANNEL_ENABLED,
62};
63
64#define IPU_CHANNELS_NUM 32
65
66enum pixel_fmt {
67 /* 1 byte */
68 IPU_PIX_FMT_GENERIC,
69 IPU_PIX_FMT_RGB332,
70 IPU_PIX_FMT_YUV420P,
71 IPU_PIX_FMT_YUV422P,
72 IPU_PIX_FMT_YUV420P2,
73 IPU_PIX_FMT_YVU422P,
74 /* 2 bytes */
75 IPU_PIX_FMT_RGB565,
76 IPU_PIX_FMT_RGB666,
77 IPU_PIX_FMT_BGR666,
78 IPU_PIX_FMT_YUYV,
79 IPU_PIX_FMT_UYVY,
80 /* 3 bytes */
81 IPU_PIX_FMT_RGB24,
82 IPU_PIX_FMT_BGR24,
83 /* 4 bytes */
84 IPU_PIX_FMT_GENERIC_32,
85 IPU_PIX_FMT_RGB32,
86 IPU_PIX_FMT_BGR32,
87 IPU_PIX_FMT_ABGR32,
88 IPU_PIX_FMT_BGRA32,
89 IPU_PIX_FMT_RGBA32,
90};
91
92enum ipu_color_space {
93 IPU_COLORSPACE_RGB,
94 IPU_COLORSPACE_YCBCR,
95 IPU_COLORSPACE_YUV
96};
97
98/*
99 * Enumeration of IPU rotation modes
100 */
101enum ipu_rotate_mode {
102 /* Note the enum values correspond to BAM value */
103 IPU_ROTATE_NONE = 0,
104 IPU_ROTATE_VERT_FLIP = 1,
105 IPU_ROTATE_HORIZ_FLIP = 2,
106 IPU_ROTATE_180 = 3,
107 IPU_ROTATE_90_RIGHT = 4,
108 IPU_ROTATE_90_RIGHT_VFLIP = 5,
109 IPU_ROTATE_90_RIGHT_HFLIP = 6,
110 IPU_ROTATE_90_LEFT = 7,
111};
112
113/*
114 * Enumeration of DI ports for ADC.
115 */
116enum display_port {
117 DISP0,
118 DISP1,
119 DISP2,
120 DISP3
121};
122
123struct idmac_video_param {
124 unsigned short in_width;
125 unsigned short in_height;
126 uint32_t in_pixel_fmt;
127 unsigned short out_width;
128 unsigned short out_height;
129 uint32_t out_pixel_fmt;
130 unsigned short out_stride;
131 bool graphics_combine_en;
132 bool global_alpha_en;
133 bool key_color_en;
134 enum display_port disp;
135 unsigned short out_left;
136 unsigned short out_top;
137};
138
139/*
140 * Union of initialization parameters for a logical channel. So far only video
141 * parameters are used.
142 */
143union ipu_channel_param {
144 struct idmac_video_param video;
145};
146
147struct idmac_tx_desc {
148 struct dma_async_tx_descriptor txd;
149 struct scatterlist *sg; /* scatterlist for this */
150 unsigned int sg_len; /* tx-descriptor. */
151 struct list_head list;
152};
153
154struct idmac_channel {
155 struct dma_chan dma_chan;
156 dma_cookie_t completed; /* last completed cookie */
157 union ipu_channel_param params;
158 enum ipu_channel link; /* input channel, linked to the output */
159 enum ipu_channel_status status;
160 void *client; /* Only one client per channel */
161 unsigned int n_tx_desc;
162 struct idmac_tx_desc *desc; /* allocated tx-descriptors */
163 struct scatterlist *sg[2]; /* scatterlist elements in buffer-0 and -1 */
164 struct list_head free_list; /* free tx-descriptors */
165 struct list_head queue; /* queued tx-descriptors */
166 spinlock_t lock; /* protects sg[0,1], queue */
167 struct mutex chan_mutex; /* protects status, cookie, free_list */
168 bool sec_chan_en;
169 int active_buffer;
170 unsigned int eof_irq;
171 char eof_name[16]; /* EOF IRQ name for request_irq() */
172};
173
174#define to_tx_desc(tx) container_of(tx, struct idmac_tx_desc, txd)
175#define to_idmac_chan(c) container_of(c, struct idmac_channel, dma_chan)
176
177#endif /* __LINUX_DMA_IPU_DMA_H */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 47e3d4850584..0c5a18ec322c 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -51,12 +51,11 @@
51 51
52#endif 52#endif
53 53
54
55extern const char *drbd_buildtag(void); 54extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.13" 55#define REL_VERSION "8.4.2"
57#define API_VERSION 88 56#define API_VERSION 1
58#define PRO_VERSION_MIN 86 57#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 96 58#define PRO_VERSION_MAX 101
60 59
61 60
62enum drbd_io_error_p { 61enum drbd_io_error_p {
@@ -66,7 +65,8 @@ enum drbd_io_error_p {
66}; 65};
67 66
68enum drbd_fencing_p { 67enum drbd_fencing_p {
69 FP_DONT_CARE, 68 FP_NOT_AVAIL = -1, /* Not a policy */
69 FP_DONT_CARE = 0,
70 FP_RESOURCE, 70 FP_RESOURCE,
71 FP_STONITH 71 FP_STONITH
72}; 72};
@@ -102,6 +102,20 @@ enum drbd_on_congestion {
102 OC_DISCONNECT, 102 OC_DISCONNECT,
103}; 103};
104 104
105enum drbd_read_balancing {
106 RB_PREFER_LOCAL,
107 RB_PREFER_REMOTE,
108 RB_ROUND_ROBIN,
109 RB_LEAST_PENDING,
110 RB_CONGESTED_REMOTE,
111 RB_32K_STRIPING,
112 RB_64K_STRIPING,
113 RB_128K_STRIPING,
114 RB_256K_STRIPING,
115 RB_512K_STRIPING,
116 RB_1M_STRIPING,
117};
118
105/* KEEP the order, do not delete or insert. Only append. */ 119/* KEEP the order, do not delete or insert. Only append. */
106enum drbd_ret_code { 120enum drbd_ret_code {
107 ERR_CODE_BASE = 100, 121 ERR_CODE_BASE = 100,
@@ -122,7 +136,7 @@ enum drbd_ret_code {
122 ERR_AUTH_ALG = 120, 136 ERR_AUTH_ALG = 120,
123 ERR_AUTH_ALG_ND = 121, 137 ERR_AUTH_ALG_ND = 121,
124 ERR_NOMEM = 122, 138 ERR_NOMEM = 122,
125 ERR_DISCARD = 123, 139 ERR_DISCARD_IMPOSSIBLE = 123,
126 ERR_DISK_CONFIGURED = 124, 140 ERR_DISK_CONFIGURED = 124,
127 ERR_NET_CONFIGURED = 125, 141 ERR_NET_CONFIGURED = 125,
128 ERR_MANDATORY_TAG = 126, 142 ERR_MANDATORY_TAG = 126,
@@ -130,8 +144,8 @@ enum drbd_ret_code {
130 ERR_INTR = 129, /* EINTR */ 144 ERR_INTR = 129, /* EINTR */
131 ERR_RESIZE_RESYNC = 130, 145 ERR_RESIZE_RESYNC = 130,
132 ERR_NO_PRIMARY = 131, 146 ERR_NO_PRIMARY = 131,
133 ERR_SYNC_AFTER = 132, 147 ERR_RESYNC_AFTER = 132,
134 ERR_SYNC_AFTER_CYCLE = 133, 148 ERR_RESYNC_AFTER_CYCLE = 133,
135 ERR_PAUSE_IS_SET = 134, 149 ERR_PAUSE_IS_SET = 134,
136 ERR_PAUSE_IS_CLEAR = 135, 150 ERR_PAUSE_IS_CLEAR = 135,
137 ERR_PACKET_NR = 137, 151 ERR_PACKET_NR = 137,
@@ -155,6 +169,14 @@ enum drbd_ret_code {
155 ERR_CONG_NOT_PROTO_A = 155, 169 ERR_CONG_NOT_PROTO_A = 155,
156 ERR_PIC_AFTER_DEP = 156, 170 ERR_PIC_AFTER_DEP = 156,
157 ERR_PIC_PEER_DEP = 157, 171 ERR_PIC_PEER_DEP = 157,
172 ERR_RES_NOT_KNOWN = 158,
173 ERR_RES_IN_USE = 159,
174 ERR_MINOR_CONFIGURED = 160,
175 ERR_MINOR_EXISTS = 161,
176 ERR_INVALID_REQUEST = 162,
177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164,
179 ERR_MD_UNCLEAN = 165,
158 180
159 /* insert new ones above this line */ 181 /* insert new ones above this line */
160 AFTER_LAST_ERR_CODE 182 AFTER_LAST_ERR_CODE
@@ -296,7 +318,8 @@ enum drbd_state_rv {
296 SS_NOT_SUPPORTED = -17, /* drbd-8.2 only */ 318 SS_NOT_SUPPORTED = -17, /* drbd-8.2 only */
297 SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ 319 SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */
298 SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ 320 SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */
299 SS_AFTER_LAST_ERROR = -20, /* Keep this at bottom */ 321 SS_O_VOL_PEER_PRI = -20,
322 SS_AFTER_LAST_ERROR = -21, /* Keep this at bottom */
300}; 323};
301 324
302/* from drbd_strings.c */ 325/* from drbd_strings.c */
@@ -313,7 +336,9 @@ extern const char *drbd_set_st_err_str(enum drbd_state_rv);
313#define MDF_FULL_SYNC (1 << 3) 336#define MDF_FULL_SYNC (1 << 3)
314#define MDF_WAS_UP_TO_DATE (1 << 4) 337#define MDF_WAS_UP_TO_DATE (1 << 4)
315#define MDF_PEER_OUT_DATED (1 << 5) 338#define MDF_PEER_OUT_DATED (1 << 5)
316#define MDF_CRASHED_PRIMARY (1 << 6) 339#define MDF_CRASHED_PRIMARY (1 << 6)
340#define MDF_AL_CLEAN (1 << 7)
341#define MDF_AL_DISABLED (1 << 8)
317 342
318enum drbd_uuid_index { 343enum drbd_uuid_index {
319 UI_CURRENT, 344 UI_CURRENT,
@@ -333,37 +358,23 @@ enum drbd_timeout_flag {
333 358
334#define UUID_JUST_CREATED ((__u64)4) 359#define UUID_JUST_CREATED ((__u64)4)
335 360
361/* magic numbers used in meta data and network packets */
336#define DRBD_MAGIC 0x83740267 362#define DRBD_MAGIC 0x83740267
337#define BE_DRBD_MAGIC __constant_cpu_to_be32(DRBD_MAGIC)
338#define DRBD_MAGIC_BIG 0x835a 363#define DRBD_MAGIC_BIG 0x835a
339#define BE_DRBD_MAGIC_BIG __constant_cpu_to_be16(DRBD_MAGIC_BIG) 364#define DRBD_MAGIC_100 0x8620ec20
365
366#define DRBD_MD_MAGIC_07 (DRBD_MAGIC+3)
367#define DRBD_MD_MAGIC_08 (DRBD_MAGIC+4)
368#define DRBD_MD_MAGIC_84_UNCLEAN (DRBD_MAGIC+5)
369
370
371/* how I came up with this magic?
372 * base64 decode "actlog==" ;) */
373#define DRBD_AL_MAGIC 0x69cb65a2
340 374
341/* these are of type "int" */ 375/* these are of type "int" */
342#define DRBD_MD_INDEX_INTERNAL -1 376#define DRBD_MD_INDEX_INTERNAL -1
343#define DRBD_MD_INDEX_FLEX_EXT -2 377#define DRBD_MD_INDEX_FLEX_EXT -2
344#define DRBD_MD_INDEX_FLEX_INT -3 378#define DRBD_MD_INDEX_FLEX_INT -3
345 379
346/* Start of the new netlink/connector stuff */
347
348#define DRBD_NL_CREATE_DEVICE 0x01
349#define DRBD_NL_SET_DEFAULTS 0x02
350
351
352/* For searching a vacant cn_idx value */
353#define CN_IDX_STEP 6977
354
355struct drbd_nl_cfg_req {
356 int packet_type;
357 unsigned int drbd_minor;
358 int flags;
359 unsigned short tag_list[];
360};
361
362struct drbd_nl_cfg_reply {
363 int packet_type;
364 unsigned int minor;
365 int ret_code; /* enum ret_code or set_st_err_t */
366 unsigned short tag_list[]; /* only used with get_* calls */
367};
368
369#endif 380#endif
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
new file mode 100644
index 000000000000..d0d8fac8a6e4
--- /dev/null
+++ b/include/linux/drbd_genl.h
@@ -0,0 +1,378 @@
1/*
2 * General overview:
3 * full generic netlink message:
4 * |nlmsghdr|genlmsghdr|<payload>
5 *
6 * payload:
7 * |optional fixed size family header|<sequence of netlink attributes>
8 *
9 * sequence of netlink attributes:
10 * I chose to have all "top level" attributes NLA_NESTED,
11 * corresponding to some real struct.
12 * So we have a sequence of |tla, len|<nested nla sequence>
13 *
14 * nested nla sequence:
15 * may be empty, or contain a sequence of netlink attributes
16 * representing the struct fields.
17 *
18 * The tag number of any field (regardless of containing struct)
19 * will be available as T_ ## field_name,
20 * so you cannot have the same field name in two differnt structs.
21 *
22 * The tag numbers themselves are per struct, though,
23 * so should always begin at 1 (not 0, that is the special "NLA_UNSPEC" type,
24 * which we won't use here).
25 * The tag numbers are used as index in the respective nla_policy array.
26 *
27 * GENL_struct(tag_name, tag_number, struct name, struct fields) - struct and policy
28 * genl_magic_struct.h
29 * generates the struct declaration,
30 * generates an entry in the tla enum,
31 * genl_magic_func.h
32 * generates an entry in the static tla policy
33 * with .type = NLA_NESTED
34 * generates the static <struct_name>_nl_policy definition,
35 * and static conversion functions
36 *
37 * genl_magic_func.h
38 *
39 * GENL_mc_group(group)
40 * genl_magic_struct.h
41 * does nothing
42 * genl_magic_func.h
43 * defines and registers the mcast group,
44 * and provides a send helper
45 *
46 * GENL_notification(op_name, op_num, mcast_group, tla list)
47 * These are notifications to userspace.
48 *
49 * genl_magic_struct.h
50 * generates an entry in the genl_ops enum,
51 * genl_magic_func.h
52 * does nothing
53 *
54 * mcast group: the name of the mcast group this notification should be
55 * expected on
56 * tla list: the list of expected top level attributes,
57 * for documentation and sanity checking.
58 *
59 * GENL_op(op_name, op_num, flags and handler, tla list) - "genl operations"
60 * These are requests from userspace.
61 *
62 * _op and _notification share the same "number space",
63 * op_nr will be assigned to "genlmsghdr->cmd"
64 *
65 * genl_magic_struct.h
66 * generates an entry in the genl_ops enum,
67 * genl_magic_func.h
68 * generates an entry in the static genl_ops array,
69 * and static register/unregister functions to
70 * genl_register_family_with_ops().
71 *
72 * flags and handler:
73 * GENL_op_init( .doit = x, .dumpit = y, .flags = something)
74 * GENL_doit(x) => .dumpit = NULL, .flags = GENL_ADMIN_PERM
75 * tla list: the list of expected top level attributes,
76 * for documentation and sanity checking.
77 */
78
79/*
80 * STRUCTS
81 */
82
83/* this is sent kernel -> userland on various error conditions, and contains
84 * informational textual info, which is supposedly human readable.
85 * The computer relevant return code is in the drbd_genlmsghdr.
86 */
87GENL_struct(DRBD_NLA_CFG_REPLY, 1, drbd_cfg_reply,
88 /* "arbitrary" size strings, nla_policy.len = 0 */
89 __str_field(1, DRBD_GENLA_F_MANDATORY, info_text, 0)
90)
91
92/* Configuration requests typically need a context to operate on.
93 * Possible keys are device minor (fits in the drbd_genlmsghdr),
94 * the replication link (aka connection) name,
95 * and/or the replication group (aka resource) name,
96 * and the volume id within the resource. */
97GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
98 __u32_field(1, DRBD_GENLA_F_MANDATORY, ctx_volume)
99 __str_field(2, DRBD_GENLA_F_MANDATORY, ctx_resource_name, 128)
100 __bin_field(3, DRBD_GENLA_F_MANDATORY, ctx_my_addr, 128)
101 __bin_field(4, DRBD_GENLA_F_MANDATORY, ctx_peer_addr, 128)
102)
103
104GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
105 __str_field(1, DRBD_F_REQUIRED | DRBD_F_INVARIANT, backing_dev, 128)
106 __str_field(2, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev, 128)
107 __s32_field(3, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev_idx)
108
109 /* use the resize command to try and change the disk_size */
110 __u64_field(4, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, disk_size)
111 /* we could change the max_bio_bvecs,
112 * but it won't propagate through the stack */
113 __u32_field(5, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, max_bio_bvecs)
114
115 __u32_field_def(6, DRBD_GENLA_F_MANDATORY, on_io_error, DRBD_ON_IO_ERROR_DEF)
116 __u32_field_def(7, DRBD_GENLA_F_MANDATORY, fencing, DRBD_FENCING_DEF)
117
118 __u32_field_def(8, DRBD_GENLA_F_MANDATORY, resync_rate, DRBD_RESYNC_RATE_DEF)
119 __s32_field_def(9, DRBD_GENLA_F_MANDATORY, resync_after, DRBD_MINOR_NUMBER_DEF)
120 __u32_field_def(10, DRBD_GENLA_F_MANDATORY, al_extents, DRBD_AL_EXTENTS_DEF)
121 __u32_field_def(11, DRBD_GENLA_F_MANDATORY, c_plan_ahead, DRBD_C_PLAN_AHEAD_DEF)
122 __u32_field_def(12, DRBD_GENLA_F_MANDATORY, c_delay_target, DRBD_C_DELAY_TARGET_DEF)
123 __u32_field_def(13, DRBD_GENLA_F_MANDATORY, c_fill_target, DRBD_C_FILL_TARGET_DEF)
124 __u32_field_def(14, DRBD_GENLA_F_MANDATORY, c_max_rate, DRBD_C_MAX_RATE_DEF)
125 __u32_field_def(15, DRBD_GENLA_F_MANDATORY, c_min_rate, DRBD_C_MIN_RATE_DEF)
126
127 __flg_field_def(16, DRBD_GENLA_F_MANDATORY, disk_barrier, DRBD_DISK_BARRIER_DEF)
128 __flg_field_def(17, DRBD_GENLA_F_MANDATORY, disk_flushes, DRBD_DISK_FLUSHES_DEF)
129 __flg_field_def(18, DRBD_GENLA_F_MANDATORY, disk_drain, DRBD_DISK_DRAIN_DEF)
130 __flg_field_def(19, DRBD_GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF)
131 __u32_field_def(20, DRBD_GENLA_F_MANDATORY, disk_timeout, DRBD_DISK_TIMEOUT_DEF)
132 __u32_field_def(21, 0 /* OPTIONAL */, read_balancing, DRBD_READ_BALANCING_DEF)
133 /* 9: __u32_field_def(22, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF) */
134 __flg_field_def(23, 0 /* OPTIONAL */, al_updates, DRBD_AL_UPDATES_DEF)
135)
136
137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
138 __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, 32)
139 __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF)
140)
141
142GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
143 __str_field_def(1, DRBD_GENLA_F_MANDATORY | DRBD_F_SENSITIVE,
144 shared_secret, SHARED_SECRET_MAX)
145 __str_field_def(2, DRBD_GENLA_F_MANDATORY, cram_hmac_alg, SHARED_SECRET_MAX)
146 __str_field_def(3, DRBD_GENLA_F_MANDATORY, integrity_alg, SHARED_SECRET_MAX)
147 __str_field_def(4, DRBD_GENLA_F_MANDATORY, verify_alg, SHARED_SECRET_MAX)
148 __str_field_def(5, DRBD_GENLA_F_MANDATORY, csums_alg, SHARED_SECRET_MAX)
149 __u32_field_def(6, DRBD_GENLA_F_MANDATORY, wire_protocol, DRBD_PROTOCOL_DEF)
150 __u32_field_def(7, DRBD_GENLA_F_MANDATORY, connect_int, DRBD_CONNECT_INT_DEF)
151 __u32_field_def(8, DRBD_GENLA_F_MANDATORY, timeout, DRBD_TIMEOUT_DEF)
152 __u32_field_def(9, DRBD_GENLA_F_MANDATORY, ping_int, DRBD_PING_INT_DEF)
153 __u32_field_def(10, DRBD_GENLA_F_MANDATORY, ping_timeo, DRBD_PING_TIMEO_DEF)
154 __u32_field_def(11, DRBD_GENLA_F_MANDATORY, sndbuf_size, DRBD_SNDBUF_SIZE_DEF)
155 __u32_field_def(12, DRBD_GENLA_F_MANDATORY, rcvbuf_size, DRBD_RCVBUF_SIZE_DEF)
156 __u32_field_def(13, DRBD_GENLA_F_MANDATORY, ko_count, DRBD_KO_COUNT_DEF)
157 __u32_field_def(14, DRBD_GENLA_F_MANDATORY, max_buffers, DRBD_MAX_BUFFERS_DEF)
158 __u32_field_def(15, DRBD_GENLA_F_MANDATORY, max_epoch_size, DRBD_MAX_EPOCH_SIZE_DEF)
159 __u32_field_def(16, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF)
160 __u32_field_def(17, DRBD_GENLA_F_MANDATORY, after_sb_0p, DRBD_AFTER_SB_0P_DEF)
161 __u32_field_def(18, DRBD_GENLA_F_MANDATORY, after_sb_1p, DRBD_AFTER_SB_1P_DEF)
162 __u32_field_def(19, DRBD_GENLA_F_MANDATORY, after_sb_2p, DRBD_AFTER_SB_2P_DEF)
163 __u32_field_def(20, DRBD_GENLA_F_MANDATORY, rr_conflict, DRBD_RR_CONFLICT_DEF)
164 __u32_field_def(21, DRBD_GENLA_F_MANDATORY, on_congestion, DRBD_ON_CONGESTION_DEF)
165 __u32_field_def(22, DRBD_GENLA_F_MANDATORY, cong_fill, DRBD_CONG_FILL_DEF)
166 __u32_field_def(23, DRBD_GENLA_F_MANDATORY, cong_extents, DRBD_CONG_EXTENTS_DEF)
167 __flg_field_def(24, DRBD_GENLA_F_MANDATORY, two_primaries, DRBD_ALLOW_TWO_PRIMARIES_DEF)
168 __flg_field(25, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, discard_my_data)
169 __flg_field_def(26, DRBD_GENLA_F_MANDATORY, tcp_cork, DRBD_TCP_CORK_DEF)
170 __flg_field_def(27, DRBD_GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF)
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)
173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */
174)
175
176GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
177 __flg_field(1, DRBD_GENLA_F_MANDATORY, assume_uptodate)
178)
179
180GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
184)
185
186GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
187 /* the reason of the broadcast,
188 * if this is an event triggered broadcast. */
189 __u32_field(1, DRBD_GENLA_F_MANDATORY, sib_reason)
190 __u32_field(2, DRBD_F_REQUIRED, current_state)
191 __u64_field(3, DRBD_GENLA_F_MANDATORY, capacity)
192 __u64_field(4, DRBD_GENLA_F_MANDATORY, ed_uuid)
193
194 /* These are for broadcast from after state change work.
195 * prev_state and new_state are from the moment the state change took
196 * place, new_state is not neccessarily the same as current_state,
197 * there may have been more state changes since. Which will be
198 * broadcasted soon, in their respective after state change work. */
199 __u32_field(5, DRBD_GENLA_F_MANDATORY, prev_state)
200 __u32_field(6, DRBD_GENLA_F_MANDATORY, new_state)
201
202 /* if we have a local disk: */
203 __bin_field(7, DRBD_GENLA_F_MANDATORY, uuids, (UI_SIZE*sizeof(__u64)))
204 __u32_field(8, DRBD_GENLA_F_MANDATORY, disk_flags)
205 __u64_field(9, DRBD_GENLA_F_MANDATORY, bits_total)
206 __u64_field(10, DRBD_GENLA_F_MANDATORY, bits_oos)
207 /* and in case resync or online verify is active */
208 __u64_field(11, DRBD_GENLA_F_MANDATORY, bits_rs_total)
209 __u64_field(12, DRBD_GENLA_F_MANDATORY, bits_rs_failed)
210
211 /* for pre and post notifications of helper execution */
212 __str_field(13, DRBD_GENLA_F_MANDATORY, helper, 32)
213 __u32_field(14, DRBD_GENLA_F_MANDATORY, helper_exit_code)
214
215 __u64_field(15, 0, send_cnt)
216 __u64_field(16, 0, recv_cnt)
217 __u64_field(17, 0, read_cnt)
218 __u64_field(18, 0, writ_cnt)
219 __u64_field(19, 0, al_writ_cnt)
220 __u64_field(20, 0, bm_writ_cnt)
221 __u32_field(21, 0, ap_bio_cnt)
222 __u32_field(22, 0, ap_pending_cnt)
223 __u32_field(23, 0, rs_pending_cnt)
224)
225
226GENL_struct(DRBD_NLA_START_OV_PARMS, 9, start_ov_parms,
227 __u64_field(1, DRBD_GENLA_F_MANDATORY, ov_start_sector)
228 __u64_field(2, DRBD_GENLA_F_MANDATORY, ov_stop_sector)
229)
230
231GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms,
232 __flg_field(1, DRBD_GENLA_F_MANDATORY, clear_bm)
233)
234
235GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms,
236 __u32_field(1, DRBD_F_REQUIRED, timeout_type)
237)
238
239GENL_struct(DRBD_NLA_DISCONNECT_PARMS, 12, disconnect_parms,
240 __flg_field(1, DRBD_GENLA_F_MANDATORY, force_disconnect)
241)
242
243GENL_struct(DRBD_NLA_DETACH_PARMS, 13, detach_parms,
244 __flg_field(1, DRBD_GENLA_F_MANDATORY, force_detach)
245)
246
247/*
248 * Notifications and commands (genlmsghdr->cmd)
249 */
250GENL_mc_group(events)
251
252 /* kernel -> userspace announcement of changes */
253GENL_notification(
254 DRBD_EVENT, 1, events,
255 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
256 GENL_tla_expected(DRBD_NLA_STATE_INFO, DRBD_F_REQUIRED)
257 GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_GENLA_F_MANDATORY)
258 GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_GENLA_F_MANDATORY)
259 GENL_tla_expected(DRBD_NLA_SYNCER_CONF, DRBD_GENLA_F_MANDATORY)
260)
261
262 /* query kernel for specific or all info */
263GENL_op(
264 DRBD_ADM_GET_STATUS, 2,
265 GENL_op_init(
266 .doit = drbd_adm_get_status,
267 .dumpit = drbd_adm_get_status_all,
268 /* anyone may ask for the status,
269 * it is broadcasted anyways */
270 ),
271 /* To select the object .doit.
272 * Or a subset of objects in .dumpit. */
273 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_GENLA_F_MANDATORY)
274)
275
276 /* add DRBD minor devices as volumes to resources */
277GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_add_minor),
278 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
279GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_delete_minor),
280 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
281
282 /* add or delete resources */
283GENL_op(DRBD_ADM_NEW_RESOURCE, 7, GENL_doit(drbd_adm_new_resource),
284 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
285GENL_op(DRBD_ADM_DEL_RESOURCE, 8, GENL_doit(drbd_adm_del_resource),
286 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
287
288GENL_op(DRBD_ADM_RESOURCE_OPTS, 9,
289 GENL_doit(drbd_adm_resource_opts),
290 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
291 GENL_tla_expected(DRBD_NLA_RESOURCE_OPTS, DRBD_GENLA_F_MANDATORY)
292)
293
294GENL_op(
295 DRBD_ADM_CONNECT, 10,
296 GENL_doit(drbd_adm_connect),
297 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
298 GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
299)
300
301GENL_op(
302 DRBD_ADM_CHG_NET_OPTS, 29,
303 GENL_doit(drbd_adm_net_opts),
304 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
305 GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
306)
307
308GENL_op(DRBD_ADM_DISCONNECT, 11, GENL_doit(drbd_adm_disconnect),
309 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
310
311GENL_op(DRBD_ADM_ATTACH, 12,
312 GENL_doit(drbd_adm_attach),
313 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
314 GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_F_REQUIRED)
315)
316
317GENL_op(DRBD_ADM_CHG_DISK_OPTS, 28,
318 GENL_doit(drbd_adm_disk_opts),
319 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
320 GENL_tla_expected(DRBD_NLA_DISK_OPTS, DRBD_F_REQUIRED)
321)
322
323GENL_op(
324 DRBD_ADM_RESIZE, 13,
325 GENL_doit(drbd_adm_resize),
326 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
327 GENL_tla_expected(DRBD_NLA_RESIZE_PARMS, DRBD_GENLA_F_MANDATORY)
328)
329
330GENL_op(
331 DRBD_ADM_PRIMARY, 14,
332 GENL_doit(drbd_adm_set_role),
333 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
334 GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
335)
336
337GENL_op(
338 DRBD_ADM_SECONDARY, 15,
339 GENL_doit(drbd_adm_set_role),
340 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
341 GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
342)
343
344GENL_op(
345 DRBD_ADM_NEW_C_UUID, 16,
346 GENL_doit(drbd_adm_new_c_uuid),
347 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
348 GENL_tla_expected(DRBD_NLA_NEW_C_UUID_PARMS, DRBD_GENLA_F_MANDATORY)
349)
350
351GENL_op(
352 DRBD_ADM_START_OV, 17,
353 GENL_doit(drbd_adm_start_ov),
354 GENL_tla_expected(DRBD_NLA_START_OV_PARMS, DRBD_GENLA_F_MANDATORY)
355)
356
357GENL_op(DRBD_ADM_DETACH, 18, GENL_doit(drbd_adm_detach),
358 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
359 GENL_tla_expected(DRBD_NLA_DETACH_PARMS, DRBD_GENLA_F_MANDATORY))
360
361GENL_op(DRBD_ADM_INVALIDATE, 19, GENL_doit(drbd_adm_invalidate),
362 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
363GENL_op(DRBD_ADM_INVAL_PEER, 20, GENL_doit(drbd_adm_invalidate_peer),
364 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
365GENL_op(DRBD_ADM_PAUSE_SYNC, 21, GENL_doit(drbd_adm_pause_sync),
366 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
367GENL_op(DRBD_ADM_RESUME_SYNC, 22, GENL_doit(drbd_adm_resume_sync),
368 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
369GENL_op(DRBD_ADM_SUSPEND_IO, 23, GENL_doit(drbd_adm_suspend_io),
370 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
371GENL_op(DRBD_ADM_RESUME_IO, 24, GENL_doit(drbd_adm_resume_io),
372 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
373GENL_op(DRBD_ADM_OUTDATE, 25, GENL_doit(drbd_adm_outdate),
374 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
375GENL_op(DRBD_ADM_GET_TIMEOUT_TYPE, 26, GENL_doit(drbd_adm_get_timeout_type),
376 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
377GENL_op(DRBD_ADM_DOWN, 27, GENL_doit(drbd_adm_down),
378 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
diff --git a/include/linux/drbd_genl_api.h b/include/linux/drbd_genl_api.h
new file mode 100644
index 000000000000..9ef50d51e34e
--- /dev/null
+++ b/include/linux/drbd_genl_api.h
@@ -0,0 +1,55 @@
1#ifndef DRBD_GENL_STRUCT_H
2#define DRBD_GENL_STRUCT_H
3
4/**
5 * struct drbd_genlmsghdr - DRBD specific header used in NETLINK_GENERIC requests
6 * @minor:
7 * For admin requests (user -> kernel): which minor device to operate on.
8 * For (unicast) replies or informational (broadcast) messages
9 * (kernel -> user): which minor device the information is about.
10 * If we do not operate on minors, but on connections or resources,
11 * the minor value shall be (~0), and the attribute DRBD_NLA_CFG_CONTEXT
12 * is used instead.
13 * @flags: possible operation modifiers (relevant only for user->kernel):
14 * DRBD_GENL_F_SET_DEFAULTS
15 * @volume:
16 * When creating a new minor (adding it to a resource), the resource needs
17 * to know which volume number within the resource this is supposed to be.
18 * The volume number corresponds to the same volume number on the remote side,
19 * whereas the minor number on the remote side may be different
20 * (union with flags).
21 * @ret_code: kernel->userland unicast cfg reply return code (union with flags);
22 */
23struct drbd_genlmsghdr {
24 __u32 minor;
25 union {
26 __u32 flags;
27 __s32 ret_code;
28 };
29};
30
31/* To be used in drbd_genlmsghdr.flags */
32enum {
33 DRBD_GENL_F_SET_DEFAULTS = 1,
34};
35
36enum drbd_state_info_bcast_reason {
37 SIB_GET_STATUS_REPLY = 1,
38 SIB_STATE_CHANGE = 2,
39 SIB_HELPER_PRE = 3,
40 SIB_HELPER_POST = 4,
41 SIB_SYNC_PROGRESS = 5,
42};
43
44/* hack around predefined gcc/cpp "linux=1",
45 * we cannot possibly include <1/drbd_genl.h> */
46#undef linux
47
48#include <linux/drbd.h>
49#define GENL_MAGIC_VERSION API_VERSION
50#define GENL_MAGIC_FAMILY drbd
51#define GENL_MAGIC_FAMILY_HDRSZ sizeof(struct drbd_genlmsghdr)
52#define GENL_MAGIC_INCLUDE_FILE <linux/drbd_genl.h>
53#include <linux/genl_magic_struct.h>
54
55#endif
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index fb670bf603f7..1fa19c5f5e64 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -16,29 +16,37 @@
16#define DEBUG_RANGE_CHECK 0 16#define DEBUG_RANGE_CHECK 0
17 17
18#define DRBD_MINOR_COUNT_MIN 1 18#define DRBD_MINOR_COUNT_MIN 1
19#define DRBD_MINOR_COUNT_MAX 256 19#define DRBD_MINOR_COUNT_MAX 255
20#define DRBD_MINOR_COUNT_DEF 32 20#define DRBD_MINOR_COUNT_DEF 32
21#define DRBD_MINOR_COUNT_SCALE '1'
22
23#define DRBD_VOLUME_MAX 65535
21 24
22#define DRBD_DIALOG_REFRESH_MIN 0 25#define DRBD_DIALOG_REFRESH_MIN 0
23#define DRBD_DIALOG_REFRESH_MAX 600 26#define DRBD_DIALOG_REFRESH_MAX 600
27#define DRBD_DIALOG_REFRESH_SCALE '1'
24 28
25/* valid port number */ 29/* valid port number */
26#define DRBD_PORT_MIN 1 30#define DRBD_PORT_MIN 1
27#define DRBD_PORT_MAX 0xffff 31#define DRBD_PORT_MAX 0xffff
32#define DRBD_PORT_SCALE '1'
28 33
29/* startup { */ 34/* startup { */
30 /* if you want more than 3.4 days, disable */ 35 /* if you want more than 3.4 days, disable */
31#define DRBD_WFC_TIMEOUT_MIN 0 36#define DRBD_WFC_TIMEOUT_MIN 0
32#define DRBD_WFC_TIMEOUT_MAX 300000 37#define DRBD_WFC_TIMEOUT_MAX 300000
33#define DRBD_WFC_TIMEOUT_DEF 0 38#define DRBD_WFC_TIMEOUT_DEF 0
39#define DRBD_WFC_TIMEOUT_SCALE '1'
34 40
35#define DRBD_DEGR_WFC_TIMEOUT_MIN 0 41#define DRBD_DEGR_WFC_TIMEOUT_MIN 0
36#define DRBD_DEGR_WFC_TIMEOUT_MAX 300000 42#define DRBD_DEGR_WFC_TIMEOUT_MAX 300000
37#define DRBD_DEGR_WFC_TIMEOUT_DEF 0 43#define DRBD_DEGR_WFC_TIMEOUT_DEF 0
44#define DRBD_DEGR_WFC_TIMEOUT_SCALE '1'
38 45
39#define DRBD_OUTDATED_WFC_TIMEOUT_MIN 0 46#define DRBD_OUTDATED_WFC_TIMEOUT_MIN 0
40#define DRBD_OUTDATED_WFC_TIMEOUT_MAX 300000 47#define DRBD_OUTDATED_WFC_TIMEOUT_MAX 300000
41#define DRBD_OUTDATED_WFC_TIMEOUT_DEF 0 48#define DRBD_OUTDATED_WFC_TIMEOUT_DEF 0
49#define DRBD_OUTDATED_WFC_TIMEOUT_SCALE '1'
42/* }*/ 50/* }*/
43 51
44/* net { */ 52/* net { */
@@ -47,75 +55,91 @@
47#define DRBD_TIMEOUT_MIN 1 55#define DRBD_TIMEOUT_MIN 1
48#define DRBD_TIMEOUT_MAX 600 56#define DRBD_TIMEOUT_MAX 600
49#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */ 57#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */
58#define DRBD_TIMEOUT_SCALE '1'
50 59
51 /* If backing disk takes longer than disk_timeout, mark the disk as failed */ 60 /* If backing disk takes longer than disk_timeout, mark the disk as failed */
52#define DRBD_DISK_TIMEOUT_MIN 0 /* 0 = disabled */ 61#define DRBD_DISK_TIMEOUT_MIN 0 /* 0 = disabled */
53#define DRBD_DISK_TIMEOUT_MAX 6000 /* 10 Minutes */ 62#define DRBD_DISK_TIMEOUT_MAX 6000 /* 10 Minutes */
54#define DRBD_DISK_TIMEOUT_DEF 0 /* disabled */ 63#define DRBD_DISK_TIMEOUT_DEF 0 /* disabled */
64#define DRBD_DISK_TIMEOUT_SCALE '1'
55 65
56 /* active connection retries when C_WF_CONNECTION */ 66 /* active connection retries when C_WF_CONNECTION */
57#define DRBD_CONNECT_INT_MIN 1 67#define DRBD_CONNECT_INT_MIN 1
58#define DRBD_CONNECT_INT_MAX 120 68#define DRBD_CONNECT_INT_MAX 120
59#define DRBD_CONNECT_INT_DEF 10 /* seconds */ 69#define DRBD_CONNECT_INT_DEF 10 /* seconds */
70#define DRBD_CONNECT_INT_SCALE '1'
60 71
61 /* keep-alive probes when idle */ 72 /* keep-alive probes when idle */
62#define DRBD_PING_INT_MIN 1 73#define DRBD_PING_INT_MIN 1
63#define DRBD_PING_INT_MAX 120 74#define DRBD_PING_INT_MAX 120
64#define DRBD_PING_INT_DEF 10 75#define DRBD_PING_INT_DEF 10
76#define DRBD_PING_INT_SCALE '1'
65 77
66 /* timeout for the ping packets.*/ 78 /* timeout for the ping packets.*/
67#define DRBD_PING_TIMEO_MIN 1 79#define DRBD_PING_TIMEO_MIN 1
68#define DRBD_PING_TIMEO_MAX 300 80#define DRBD_PING_TIMEO_MAX 300
69#define DRBD_PING_TIMEO_DEF 5 81#define DRBD_PING_TIMEO_DEF 5
82#define DRBD_PING_TIMEO_SCALE '1'
70 83
71 /* max number of write requests between write barriers */ 84 /* max number of write requests between write barriers */
72#define DRBD_MAX_EPOCH_SIZE_MIN 1 85#define DRBD_MAX_EPOCH_SIZE_MIN 1
73#define DRBD_MAX_EPOCH_SIZE_MAX 20000 86#define DRBD_MAX_EPOCH_SIZE_MAX 20000
74#define DRBD_MAX_EPOCH_SIZE_DEF 2048 87#define DRBD_MAX_EPOCH_SIZE_DEF 2048
88#define DRBD_MAX_EPOCH_SIZE_SCALE '1'
75 89
76 /* I don't think that a tcp send buffer of more than 10M is useful */ 90 /* I don't think that a tcp send buffer of more than 10M is useful */
77#define DRBD_SNDBUF_SIZE_MIN 0 91#define DRBD_SNDBUF_SIZE_MIN 0
78#define DRBD_SNDBUF_SIZE_MAX (10<<20) 92#define DRBD_SNDBUF_SIZE_MAX (10<<20)
79#define DRBD_SNDBUF_SIZE_DEF 0 93#define DRBD_SNDBUF_SIZE_DEF 0
94#define DRBD_SNDBUF_SIZE_SCALE '1'
80 95
81#define DRBD_RCVBUF_SIZE_MIN 0 96#define DRBD_RCVBUF_SIZE_MIN 0
82#define DRBD_RCVBUF_SIZE_MAX (10<<20) 97#define DRBD_RCVBUF_SIZE_MAX (10<<20)
83#define DRBD_RCVBUF_SIZE_DEF 0 98#define DRBD_RCVBUF_SIZE_DEF 0
99#define DRBD_RCVBUF_SIZE_SCALE '1'
84 100
85 /* @4k PageSize -> 128kB - 512MB */ 101 /* @4k PageSize -> 128kB - 512MB */
86#define DRBD_MAX_BUFFERS_MIN 32 102#define DRBD_MAX_BUFFERS_MIN 32
87#define DRBD_MAX_BUFFERS_MAX 131072 103#define DRBD_MAX_BUFFERS_MAX 131072
88#define DRBD_MAX_BUFFERS_DEF 2048 104#define DRBD_MAX_BUFFERS_DEF 2048
105#define DRBD_MAX_BUFFERS_SCALE '1'
89 106
90 /* @4k PageSize -> 4kB - 512MB */ 107 /* @4k PageSize -> 4kB - 512MB */
91#define DRBD_UNPLUG_WATERMARK_MIN 1 108#define DRBD_UNPLUG_WATERMARK_MIN 1
92#define DRBD_UNPLUG_WATERMARK_MAX 131072 109#define DRBD_UNPLUG_WATERMARK_MAX 131072
93#define DRBD_UNPLUG_WATERMARK_DEF (DRBD_MAX_BUFFERS_DEF/16) 110#define DRBD_UNPLUG_WATERMARK_DEF (DRBD_MAX_BUFFERS_DEF/16)
111#define DRBD_UNPLUG_WATERMARK_SCALE '1'
94 112
95 /* 0 is disabled. 113 /* 0 is disabled.
96 * 200 should be more than enough even for very short timeouts */ 114 * 200 should be more than enough even for very short timeouts */
97#define DRBD_KO_COUNT_MIN 0 115#define DRBD_KO_COUNT_MIN 0
98#define DRBD_KO_COUNT_MAX 200 116#define DRBD_KO_COUNT_MAX 200
99#define DRBD_KO_COUNT_DEF 0 117#define DRBD_KO_COUNT_DEF 7
118#define DRBD_KO_COUNT_SCALE '1'
100/* } */ 119/* } */
101 120
102/* syncer { */ 121/* syncer { */
103 /* FIXME allow rate to be zero? */ 122 /* FIXME allow rate to be zero? */
104#define DRBD_RATE_MIN 1 123#define DRBD_RESYNC_RATE_MIN 1
105/* channel bonding 10 GbE, or other hardware */ 124/* channel bonding 10 GbE, or other hardware */
106#define DRBD_RATE_MAX (4 << 20) 125#define DRBD_RESYNC_RATE_MAX (4 << 20)
107#define DRBD_RATE_DEF 250 /* kb/second */ 126#define DRBD_RESYNC_RATE_DEF 250
127#define DRBD_RESYNC_RATE_SCALE 'k' /* kilobytes */
108 128
109 /* less than 7 would hit performance unnecessarily. 129 /* less than 7 would hit performance unnecessarily.
110 * 3833 is the largest prime that still does fit 130 * 919 slots context information per transaction,
111 * into 64 sectors of activity log */ 131 * 32k activity log, 4k transaction size,
132 * one transaction in flight:
133 * 919 * 7 = 6433 */
112#define DRBD_AL_EXTENTS_MIN 7 134#define DRBD_AL_EXTENTS_MIN 7
113#define DRBD_AL_EXTENTS_MAX 3833 135#define DRBD_AL_EXTENTS_MAX 6433
114#define DRBD_AL_EXTENTS_DEF 127 136#define DRBD_AL_EXTENTS_DEF 1237
137#define DRBD_AL_EXTENTS_SCALE '1'
115 138
116#define DRBD_AFTER_MIN -1 139#define DRBD_MINOR_NUMBER_MIN -1
117#define DRBD_AFTER_MAX 255 140#define DRBD_MINOR_NUMBER_MAX ((1 << 20) - 1)
118#define DRBD_AFTER_DEF -1 141#define DRBD_MINOR_NUMBER_DEF -1
142#define DRBD_MINOR_NUMBER_SCALE '1'
119 143
120/* } */ 144/* } */
121 145
@@ -124,11 +148,12 @@
124 * the upper limit with 64bit kernel, enough ram and flexible meta data 148 * the upper limit with 64bit kernel, enough ram and flexible meta data
125 * is 1 PiB, currently. */ 149 * is 1 PiB, currently. */
126/* DRBD_MAX_SECTORS */ 150/* DRBD_MAX_SECTORS */
127#define DRBD_DISK_SIZE_SECT_MIN 0 151#define DRBD_DISK_SIZE_MIN 0
128#define DRBD_DISK_SIZE_SECT_MAX (1 * (2LLU << 40)) 152#define DRBD_DISK_SIZE_MAX (1 * (2LLU << 40))
129#define DRBD_DISK_SIZE_SECT_DEF 0 /* = disabled = no user size... */ 153#define DRBD_DISK_SIZE_DEF 0 /* = disabled = no user size... */
154#define DRBD_DISK_SIZE_SCALE 's' /* sectors */
130 155
131#define DRBD_ON_IO_ERROR_DEF EP_PASS_ON 156#define DRBD_ON_IO_ERROR_DEF EP_DETACH
132#define DRBD_FENCING_DEF FP_DONT_CARE 157#define DRBD_FENCING_DEF FP_DONT_CARE
133#define DRBD_AFTER_SB_0P_DEF ASB_DISCONNECT 158#define DRBD_AFTER_SB_0P_DEF ASB_DISCONNECT
134#define DRBD_AFTER_SB_1P_DEF ASB_DISCONNECT 159#define DRBD_AFTER_SB_1P_DEF ASB_DISCONNECT
@@ -136,38 +161,59 @@
136#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT 161#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT
137#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR 162#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR
138#define DRBD_ON_CONGESTION_DEF OC_BLOCK 163#define DRBD_ON_CONGESTION_DEF OC_BLOCK
164#define DRBD_READ_BALANCING_DEF RB_PREFER_LOCAL
139 165
140#define DRBD_MAX_BIO_BVECS_MIN 0 166#define DRBD_MAX_BIO_BVECS_MIN 0
141#define DRBD_MAX_BIO_BVECS_MAX 128 167#define DRBD_MAX_BIO_BVECS_MAX 128
142#define DRBD_MAX_BIO_BVECS_DEF 0 168#define DRBD_MAX_BIO_BVECS_DEF 0
169#define DRBD_MAX_BIO_BVECS_SCALE '1'
143 170
144#define DRBD_C_PLAN_AHEAD_MIN 0 171#define DRBD_C_PLAN_AHEAD_MIN 0
145#define DRBD_C_PLAN_AHEAD_MAX 300 172#define DRBD_C_PLAN_AHEAD_MAX 300
146#define DRBD_C_PLAN_AHEAD_DEF 0 /* RS rate controller disabled by default */ 173#define DRBD_C_PLAN_AHEAD_DEF 20
174#define DRBD_C_PLAN_AHEAD_SCALE '1'
147 175
148#define DRBD_C_DELAY_TARGET_MIN 1 176#define DRBD_C_DELAY_TARGET_MIN 1
149#define DRBD_C_DELAY_TARGET_MAX 100 177#define DRBD_C_DELAY_TARGET_MAX 100
150#define DRBD_C_DELAY_TARGET_DEF 10 178#define DRBD_C_DELAY_TARGET_DEF 10
179#define DRBD_C_DELAY_TARGET_SCALE '1'
151 180
152#define DRBD_C_FILL_TARGET_MIN 0 181#define DRBD_C_FILL_TARGET_MIN 0
153#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */ 182#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */
154#define DRBD_C_FILL_TARGET_DEF 0 /* By default disabled -> controlled by delay_target */ 183#define DRBD_C_FILL_TARGET_DEF 100 /* Try to place 50KiB in socket send buffer during resync */
184#define DRBD_C_FILL_TARGET_SCALE 's' /* sectors */
155 185
156#define DRBD_C_MAX_RATE_MIN 250 /* kByte/sec */ 186#define DRBD_C_MAX_RATE_MIN 250
157#define DRBD_C_MAX_RATE_MAX (4 << 20) 187#define DRBD_C_MAX_RATE_MAX (4 << 20)
158#define DRBD_C_MAX_RATE_DEF 102400 188#define DRBD_C_MAX_RATE_DEF 102400
189#define DRBD_C_MAX_RATE_SCALE 'k' /* kilobytes */
159 190
160#define DRBD_C_MIN_RATE_MIN 0 /* kByte/sec */ 191#define DRBD_C_MIN_RATE_MIN 0
161#define DRBD_C_MIN_RATE_MAX (4 << 20) 192#define DRBD_C_MIN_RATE_MAX (4 << 20)
162#define DRBD_C_MIN_RATE_DEF 4096 193#define DRBD_C_MIN_RATE_DEF 250
194#define DRBD_C_MIN_RATE_SCALE 'k' /* kilobytes */
163 195
164#define DRBD_CONG_FILL_MIN 0 196#define DRBD_CONG_FILL_MIN 0
165#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */ 197#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */
166#define DRBD_CONG_FILL_DEF 0 198#define DRBD_CONG_FILL_DEF 0
199#define DRBD_CONG_FILL_SCALE 's' /* sectors */
167 200
168#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN 201#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN
169#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX 202#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX
170#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF 203#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF
204#define DRBD_CONG_EXTENTS_SCALE DRBD_AL_EXTENTS_SCALE
205
206#define DRBD_PROTOCOL_DEF DRBD_PROT_C
207
208#define DRBD_DISK_BARRIER_DEF 0
209#define DRBD_DISK_FLUSHES_DEF 1
210#define DRBD_DISK_DRAIN_DEF 1
211#define DRBD_MD_FLUSHES_DEF 1
212#define DRBD_TCP_CORK_DEF 1
213#define DRBD_AL_UPDATES_DEF 1
214
215#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
216#define DRBD_ALWAYS_ASBP_DEF 0
217#define DRBD_USE_RLE_DEF 1
171 218
172#undef RANGE
173#endif 219#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
deleted file mode 100644
index a8706f08ab36..000000000000
--- a/include/linux/drbd_nl.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 PAKET( name,
3 TYPE ( pn, pr, member )
4 ...
5 )
6
7 You may never reissue one of the pn arguments
8*/
9
10#if !defined(NL_PACKET) || !defined(NL_STRING) || !defined(NL_INTEGER) || !defined(NL_BIT) || !defined(NL_INT64)
11#error "The macros NL_PACKET, NL_STRING, NL_INTEGER, NL_INT64 and NL_BIT needs to be defined"
12#endif
13
14NL_PACKET(primary, 1,
15 NL_BIT( 1, T_MAY_IGNORE, primary_force)
16)
17
18NL_PACKET(secondary, 2, )
19
20NL_PACKET(disk_conf, 3,
21 NL_INT64( 2, T_MAY_IGNORE, disk_size)
22 NL_STRING( 3, T_MANDATORY, backing_dev, 128)
23 NL_STRING( 4, T_MANDATORY, meta_dev, 128)
24 NL_INTEGER( 5, T_MANDATORY, meta_dev_idx)
25 NL_INTEGER( 6, T_MAY_IGNORE, on_io_error)
26 NL_INTEGER( 7, T_MAY_IGNORE, fencing)
27 NL_BIT( 37, T_MAY_IGNORE, use_bmbv)
28 NL_BIT( 53, T_MAY_IGNORE, no_disk_flush)
29 NL_BIT( 54, T_MAY_IGNORE, no_md_flush)
30 /* 55 max_bio_size was available in 8.2.6rc2 */
31 NL_INTEGER( 56, T_MAY_IGNORE, max_bio_bvecs)
32 NL_BIT( 57, T_MAY_IGNORE, no_disk_barrier)
33 NL_BIT( 58, T_MAY_IGNORE, no_disk_drain)
34 NL_INTEGER( 89, T_MAY_IGNORE, disk_timeout)
35)
36
37NL_PACKET(detach, 4,
38 NL_BIT( 88, T_MANDATORY, detach_force)
39)
40
41NL_PACKET(net_conf, 5,
42 NL_STRING( 8, T_MANDATORY, my_addr, 128)
43 NL_STRING( 9, T_MANDATORY, peer_addr, 128)
44 NL_STRING( 10, T_MAY_IGNORE, shared_secret, SHARED_SECRET_MAX)
45 NL_STRING( 11, T_MAY_IGNORE, cram_hmac_alg, SHARED_SECRET_MAX)
46 NL_STRING( 44, T_MAY_IGNORE, integrity_alg, SHARED_SECRET_MAX)
47 NL_INTEGER( 14, T_MAY_IGNORE, timeout)
48 NL_INTEGER( 15, T_MANDATORY, wire_protocol)
49 NL_INTEGER( 16, T_MAY_IGNORE, try_connect_int)
50 NL_INTEGER( 17, T_MAY_IGNORE, ping_int)
51 NL_INTEGER( 18, T_MAY_IGNORE, max_epoch_size)
52 NL_INTEGER( 19, T_MAY_IGNORE, max_buffers)
53 NL_INTEGER( 20, T_MAY_IGNORE, unplug_watermark)
54 NL_INTEGER( 21, T_MAY_IGNORE, sndbuf_size)
55 NL_INTEGER( 22, T_MAY_IGNORE, ko_count)
56 NL_INTEGER( 24, T_MAY_IGNORE, after_sb_0p)
57 NL_INTEGER( 25, T_MAY_IGNORE, after_sb_1p)
58 NL_INTEGER( 26, T_MAY_IGNORE, after_sb_2p)
59 NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict)
60 NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo)
61 NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size)
62 NL_INTEGER( 81, T_MAY_IGNORE, on_congestion)
63 NL_INTEGER( 82, T_MAY_IGNORE, cong_fill)
64 NL_INTEGER( 83, T_MAY_IGNORE, cong_extents)
65 /* 59 addr_family was available in GIT, never released */
66 NL_BIT( 60, T_MANDATORY, mind_af)
67 NL_BIT( 27, T_MAY_IGNORE, want_lose)
68 NL_BIT( 28, T_MAY_IGNORE, two_primaries)
69 NL_BIT( 41, T_MAY_IGNORE, always_asbp)
70 NL_BIT( 61, T_MAY_IGNORE, no_cork)
71 NL_BIT( 62, T_MANDATORY, auto_sndbuf_size)
72 NL_BIT( 70, T_MANDATORY, dry_run)
73)
74
75NL_PACKET(disconnect, 6,
76 NL_BIT( 84, T_MAY_IGNORE, force)
77)
78
79NL_PACKET(resize, 7,
80 NL_INT64( 29, T_MAY_IGNORE, resize_size)
81 NL_BIT( 68, T_MAY_IGNORE, resize_force)
82 NL_BIT( 69, T_MANDATORY, no_resync)
83)
84
85NL_PACKET(syncer_conf, 8,
86 NL_INTEGER( 30, T_MAY_IGNORE, rate)
87 NL_INTEGER( 31, T_MAY_IGNORE, after)
88 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
89/* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
90 * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
91 * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
92 * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
93 * feature will be reimplemented differently with 8.3.9 */
94 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
95 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
96 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
97 NL_BIT( 65, T_MAY_IGNORE, use_rle)
98 NL_INTEGER( 75, T_MAY_IGNORE, on_no_data)
99 NL_INTEGER( 76, T_MAY_IGNORE, c_plan_ahead)
100 NL_INTEGER( 77, T_MAY_IGNORE, c_delay_target)
101 NL_INTEGER( 78, T_MAY_IGNORE, c_fill_target)
102 NL_INTEGER( 79, T_MAY_IGNORE, c_max_rate)
103 NL_INTEGER( 80, T_MAY_IGNORE, c_min_rate)
104)
105
106NL_PACKET(invalidate, 9, )
107NL_PACKET(invalidate_peer, 10, )
108NL_PACKET(pause_sync, 11, )
109NL_PACKET(resume_sync, 12, )
110NL_PACKET(suspend_io, 13, )
111NL_PACKET(resume_io, 14, )
112NL_PACKET(outdate, 15, )
113NL_PACKET(get_config, 16, )
114NL_PACKET(get_state, 17,
115 NL_INTEGER( 33, T_MAY_IGNORE, state_i)
116)
117
118NL_PACKET(get_uuids, 18,
119 NL_STRING( 34, T_MAY_IGNORE, uuids, (UI_SIZE*sizeof(__u64)))
120 NL_INTEGER( 35, T_MAY_IGNORE, uuids_flags)
121)
122
123NL_PACKET(get_timeout_flag, 19,
124 NL_BIT( 36, T_MAY_IGNORE, use_degraded)
125)
126
127NL_PACKET(call_helper, 20,
128 NL_STRING( 38, T_MAY_IGNORE, helper, 32)
129)
130
131/* Tag nr 42 already allocated in drbd-8.1 development. */
132
133NL_PACKET(sync_progress, 23,
134 NL_INTEGER( 43, T_MAY_IGNORE, sync_progress)
135)
136
137NL_PACKET(dump_ee, 24,
138 NL_STRING( 45, T_MAY_IGNORE, dump_ee_reason, 32)
139 NL_STRING( 46, T_MAY_IGNORE, seen_digest, SHARED_SECRET_MAX)
140 NL_STRING( 47, T_MAY_IGNORE, calc_digest, SHARED_SECRET_MAX)
141 NL_INT64( 48, T_MAY_IGNORE, ee_sector)
142 NL_INT64( 49, T_MAY_IGNORE, ee_block_id)
143 NL_STRING( 50, T_MAY_IGNORE, ee_data, 32 << 10)
144)
145
146NL_PACKET(start_ov, 25,
147 NL_INT64( 66, T_MAY_IGNORE, start_sector)
148)
149
150NL_PACKET(new_c_uuid, 26,
151 NL_BIT( 63, T_MANDATORY, clear_bm)
152)
153
154#ifdef NL_RESPONSE
155NL_RESPONSE(return_code_only, 27)
156#endif
157
158#undef NL_PACKET
159#undef NL_INTEGER
160#undef NL_INT64
161#undef NL_BIT
162#undef NL_STRING
163#undef NL_RESPONSE
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
deleted file mode 100644
index 82de1f9e48b1..000000000000
--- a/include/linux/drbd_tag_magic.h
+++ /dev/null
@@ -1,84 +0,0 @@
1#ifndef DRBD_TAG_MAGIC_H
2#define DRBD_TAG_MAGIC_H
3
4#define TT_END 0
5#define TT_REMOVED 0xE000
6
7/* declare packet_type enums */
8enum packet_types {
9#define NL_PACKET(name, number, fields) P_ ## name = number,
10#define NL_RESPONSE(name, number) P_ ## name = number,
11#define NL_INTEGER(pn, pr, member)
12#define NL_INT64(pn, pr, member)
13#define NL_BIT(pn, pr, member)
14#define NL_STRING(pn, pr, member, len)
15#include <linux/drbd_nl.h>
16 P_nl_after_last_packet,
17};
18
19/* These struct are used to deduce the size of the tag lists: */
20#define NL_PACKET(name, number, fields) \
21 struct name ## _tag_len_struct { fields };
22#define NL_INTEGER(pn, pr, member) \
23 int member; int tag_and_len ## member;
24#define NL_INT64(pn, pr, member) \
25 __u64 member; int tag_and_len ## member;
26#define NL_BIT(pn, pr, member) \
27 unsigned char member:1; int tag_and_len ## member;
28#define NL_STRING(pn, pr, member, len) \
29 unsigned char member[len]; int member ## _len; \
30 int tag_and_len ## member;
31#include <linux/drbd_nl.h>
32
33/* declare tag-list-sizes */
34static const int tag_list_sizes[] = {
35#define NL_PACKET(name, number, fields) 2 fields ,
36#define NL_INTEGER(pn, pr, member) + 4 + 4
37#define NL_INT64(pn, pr, member) + 4 + 8
38#define NL_BIT(pn, pr, member) + 4 + 1
39#define NL_STRING(pn, pr, member, len) + 4 + (len)
40#include <linux/drbd_nl.h>
41};
42
43/* The two highest bits are used for the tag type */
44#define TT_MASK 0xC000
45#define TT_INTEGER 0x0000
46#define TT_INT64 0x4000
47#define TT_BIT 0x8000
48#define TT_STRING 0xC000
49/* The next bit indicates if processing of the tag is mandatory */
50#define T_MANDATORY 0x2000
51#define T_MAY_IGNORE 0x0000
52#define TN_MASK 0x1fff
53/* The remaining 13 bits are used to enumerate the tags */
54
55#define tag_type(T) ((T) & TT_MASK)
56#define tag_number(T) ((T) & TN_MASK)
57
58/* declare tag enums */
59#define NL_PACKET(name, number, fields) fields
60enum drbd_tags {
61#define NL_INTEGER(pn, pr, member) T_ ## member = pn | TT_INTEGER | pr ,
62#define NL_INT64(pn, pr, member) T_ ## member = pn | TT_INT64 | pr ,
63#define NL_BIT(pn, pr, member) T_ ## member = pn | TT_BIT | pr ,
64#define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING | pr ,
65#include <linux/drbd_nl.h>
66};
67
68struct tag {
69 const char *name;
70 int type_n_flags;
71 int max_len;
72};
73
74/* declare tag names */
75#define NL_PACKET(name, number, fields) fields
76static const struct tag tag_descriptions[] = {
77#define NL_INTEGER(pn, pr, member) [ pn ] = { #member, TT_INTEGER | pr, sizeof(int) },
78#define NL_INT64(pn, pr, member) [ pn ] = { #member, TT_INT64 | pr, sizeof(__u64) },
79#define NL_BIT(pn, pr, member) [ pn ] = { #member, TT_BIT | pr, sizeof(int) },
80#define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING | pr, (len) },
81#include <linux/drbd_nl.h>
82};
83
84#endif
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/dvb/Kbuild
+++ /dev/null
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
deleted file mode 100644
index 0be6d8f2b52b..000000000000
--- a/include/linux/dvb/dmx.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * dmx.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23#ifndef _DVBDMX_H_
24#define _DVBDMX_H_
25
26#include <linux/time.h>
27#include <uapi/linux/dvb/dmx.h>
28
29#endif /*_DVBDMX_H_*/
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
deleted file mode 100644
index 85c20d925696..000000000000
--- a/include/linux/dvb/video.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * video.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23#ifndef _DVBVIDEO_H_
24#define _DVBVIDEO_H_
25
26#include <linux/compiler.h>
27#include <uapi/linux/dvb/video.h>
28
29#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/earlycpio.h b/include/linux/earlycpio.h
new file mode 100644
index 000000000000..111f46d83d00
--- /dev/null
+++ b/include/linux/earlycpio.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_EARLYCPIO_H
2#define _LINUX_EARLYCPIO_H
3
4#include <linux/types.h>
5
6#define MAX_CPIO_FILE_NAME 18
7
8struct cpio_data {
9 void *data;
10 size_t size;
11 char name[MAX_CPIO_FILE_NAME];
12};
13
14struct cpio_data find_cpio_data(const char *path, void *data, size_t len,
15 long *offset);
16
17#endif /* _LINUX_EARLYCPIO_H */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index bab9f8473dc1..1b8c02b36f76 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -533,6 +533,7 @@ struct csrow_info {
533 533
534 u32 ue_count; /* Uncorrectable Errors for this csrow */ 534 u32 ue_count; /* Uncorrectable Errors for this csrow */
535 u32 ce_count; /* Correctable Errors for this csrow */ 535 u32 ce_count; /* Correctable Errors for this csrow */
536 u32 nr_pages; /* combined pages count of all channels */
536 537
537 struct mem_ctl_info *mci; /* the parent */ 538 struct mem_ctl_info *mci; /* the parent */
538 539
@@ -667,6 +668,8 @@ struct mem_ctl_info {
667 u32 fake_inject_ue; 668 u32 fake_inject_ue;
668 u16 fake_inject_count; 669 u16 fake_inject_count;
669#endif 670#endif
671 __u8 csbased : 1, /* csrow-based memory controller */
672 __resv : 7;
670}; 673};
671 674
672#endif 675#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 8670eb1eb8cd..8b84916dc671 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -29,7 +29,12 @@
29#define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1))) 29#define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1)))
30#define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1))) 30#define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1)))
31#define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1))) 31#define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1)))
32#define EFI_NOT_READY ( 6 | (1UL << (BITS_PER_LONG-1)))
33#define EFI_DEVICE_ERROR ( 7 | (1UL << (BITS_PER_LONG-1)))
34#define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1)))
35#define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1)))
32#define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1))) 36#define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1)))
37#define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1)))
33 38
34typedef unsigned long efi_status_t; 39typedef unsigned long efi_status_t;
35typedef u8 efi_bool_t; 40typedef u8 efi_bool_t;
@@ -196,6 +201,77 @@ typedef struct {
196 void *create_event_ex; 201 void *create_event_ex;
197} efi_boot_services_t; 202} efi_boot_services_t;
198 203
204typedef enum {
205 EfiPciIoWidthUint8,
206 EfiPciIoWidthUint16,
207 EfiPciIoWidthUint32,
208 EfiPciIoWidthUint64,
209 EfiPciIoWidthFifoUint8,
210 EfiPciIoWidthFifoUint16,
211 EfiPciIoWidthFifoUint32,
212 EfiPciIoWidthFifoUint64,
213 EfiPciIoWidthFillUint8,
214 EfiPciIoWidthFillUint16,
215 EfiPciIoWidthFillUint32,
216 EfiPciIoWidthFillUint64,
217 EfiPciIoWidthMaximum
218} EFI_PCI_IO_PROTOCOL_WIDTH;
219
220typedef enum {
221 EfiPciIoAttributeOperationGet,
222 EfiPciIoAttributeOperationSet,
223 EfiPciIoAttributeOperationEnable,
224 EfiPciIoAttributeOperationDisable,
225 EfiPciIoAttributeOperationSupported,
226 EfiPciIoAttributeOperationMaximum
227} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
228
229
230typedef struct {
231 void *read;
232 void *write;
233} efi_pci_io_protocol_access_t;
234
235typedef struct {
236 void *poll_mem;
237 void *poll_io;
238 efi_pci_io_protocol_access_t mem;
239 efi_pci_io_protocol_access_t io;
240 efi_pci_io_protocol_access_t pci;
241 void *copy_mem;
242 void *map;
243 void *unmap;
244 void *allocate_buffer;
245 void *free_buffer;
246 void *flush;
247 void *get_location;
248 void *attributes;
249 void *get_bar_attributes;
250 void *set_bar_attributes;
251 uint64_t romsize;
252 void *romimage;
253} efi_pci_io_protocol;
254
255#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
256#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002
257#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004
258#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008
259#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010
260#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
261#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
262#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
263#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100
264#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200
265#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400
266#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800
267#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000
268#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
269#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000
270#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
271#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000
272#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
273#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000
274
199/* 275/*
200 * Types and defines for EFI ResetSystem 276 * Types and defines for EFI ResetSystem
201 */ 277 */
@@ -643,6 +719,7 @@ struct efivar_operations {
643 efi_get_variable_t *get_variable; 719 efi_get_variable_t *get_variable;
644 efi_get_next_variable_t *get_next_variable; 720 efi_get_next_variable_t *get_next_variable;
645 efi_set_variable_t *set_variable; 721 efi_set_variable_t *set_variable;
722 efi_query_variable_info_t *query_variable_info;
646}; 723};
647 724
648struct efivars { 725struct efivars {
@@ -657,6 +734,7 @@ struct efivars {
657 spinlock_t lock; 734 spinlock_t lock;
658 struct list_head list; 735 struct list_head list;
659 struct kset *kset; 736 struct kset *kset;
737 struct kobject *kobject;
660 struct bin_attribute *new_var, *del_var; 738 struct bin_attribute *new_var, *del_var;
661 const struct efivar_operations *ops; 739 const struct efivar_operations *ops;
662 struct efivar_entry *walk_entry; 740 struct efivar_entry *walk_entry;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index b006ba0a9f42..243eea1e33d8 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -51,6 +51,26 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
51#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) 51#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
52#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count) 52#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
53 53
54/* Reserved Ethernet Addresses per IEEE 802.1Q */
55static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) =
56{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
57
58/**
59 * is_link_local_ether_addr - Determine if given Ethernet address is link-local
60 * @addr: Pointer to a six-byte array containing the Ethernet address
61 *
62 * Return true if address is link local reserved addr (01:80:c2:00:00:0X) per
63 * IEEE 802.1Q 8.6.3 Frame filtering.
64 */
65static inline bool is_link_local_ether_addr(const u8 *addr)
66{
67 __be16 *a = (__be16 *)addr;
68 static const __be16 *b = (const __be16 *)eth_reserved_addr_base;
69 static const __be16 m = cpu_to_be16(0xfff0);
70
71 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0;
72}
73
54/** 74/**
55 * is_zero_ether_addr - Determine if give Ethernet address is all zeros. 75 * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
56 * @addr: Pointer to a six-byte array containing the Ethernet address 76 * @addr: Pointer to a six-byte array containing the Ethernet address
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 12291a7ee275..5b9b5b317180 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -83,6 +83,11 @@ enum fid_type {
83 * 64 bit parent inode number. 83 * 64 bit parent inode number.
84 */ 84 */
85 FILEID_NILFS_WITH_PARENT = 0x62, 85 FILEID_NILFS_WITH_PARENT = 0x62,
86
87 /*
88 * Filesystems must not use 0xff file ID.
89 */
90 FILEID_INVALID = 0xff,
86}; 91};
87 92
88struct fid { 93struct fid {
@@ -177,6 +182,8 @@ struct export_operations {
177 int (*commit_metadata)(struct inode *inode); 182 int (*commit_metadata)(struct inode *inode);
178}; 183};
179 184
185extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,
186 int *max_len, struct inode *parent);
180extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, 187extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
181 int *max_len, int connectable); 188 int *max_len, int connectable);
182extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, 189extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 2c26c14cd710..fcb51c88319f 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -23,7 +23,9 @@
23#ifndef __LINUX_EXTCON_H__ 23#ifndef __LINUX_EXTCON_H__
24#define __LINUX_EXTCON_H__ 24#define __LINUX_EXTCON_H__
25 25
26#include <linux/device.h>
26#include <linux/notifier.h> 27#include <linux/notifier.h>
28#include <linux/sysfs.h>
27 29
28#define SUPPORTED_CABLE_MAX 32 30#define SUPPORTED_CABLE_MAX 32
29#define CABLE_NAME_MAX 30 31#define CABLE_NAME_MAX 30
@@ -74,12 +76,12 @@ struct extcon_cable;
74 76
75/** 77/**
76 * struct extcon_dev - An extcon device represents one external connector. 78 * struct extcon_dev - An extcon device represents one external connector.
77 * @name The name of this extcon device. Parent device name is used 79 * @name: The name of this extcon device. Parent device name is used
78 * if NULL. 80 * if NULL.
79 * @supported_cable Array of supported cable names ending with NULL. 81 * @supported_cable: Array of supported cable names ending with NULL.
80 * If supported_cable is NULL, cable name related APIs 82 * If supported_cable is NULL, cable name related APIs
81 * are disabled. 83 * are disabled.
82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot 84 * @mutually_exclusive: Array of mutually exclusive set of cables that cannot
83 * be attached simultaneously. The array should be 85 * be attached simultaneously. The array should be
84 * ending with NULL or be NULL (no mutually exclusive 86 * ending with NULL or be NULL (no mutually exclusive
85 * cables). For example, if it is { 0x7, 0x30, 0}, then, 87 * cables). For example, if it is { 0x7, 0x30, 0}, then,
@@ -87,21 +89,21 @@ struct extcon_cable;
87 * be attached simulataneously. {0x7, 0} is equivalent to 89 * be attached simulataneously. {0x7, 0} is equivalent to
88 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there 90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
89 * can be no simultaneous connections. 91 * can be no simultaneous connections.
90 * @print_name An optional callback to override the method to print the 92 * @print_name: An optional callback to override the method to print the
91 * name of the extcon device. 93 * name of the extcon device.
92 * @print_state An optional callback to override the method to print the 94 * @print_state: An optional callback to override the method to print the
93 * status of the extcon device. 95 * status of the extcon device.
94 * @dev Device of this extcon. Do not provide at register-time. 96 * @dev: Device of this extcon. Do not provide at register-time.
95 * @state Attach/detach state of this extcon. Do not provide at 97 * @state: Attach/detach state of this extcon. Do not provide at
96 * register-time 98 * register-time
97 * @nh Notifier for the state change events from this extcon 99 * @nh: Notifier for the state change events from this extcon
98 * @entry To support list of extcon devices so that users can search 100 * @entry: To support list of extcon devices so that users can search
99 * for extcon devices based on the extcon name. 101 * for extcon devices based on the extcon name.
100 * @lock 102 * @lock:
101 * @max_supported Internal value to store the number of cables. 103 * @max_supported: Internal value to store the number of cables.
102 * @extcon_dev_type Device_type struct to provide attribute_groups 104 * @extcon_dev_type: Device_type struct to provide attribute_groups
103 * customized for each extcon device. 105 * customized for each extcon device.
104 * @cables Sysfs subdirectories. Each represents one cable. 106 * @cables: Sysfs subdirectories. Each represents one cable.
105 * 107 *
106 * In most cases, users only need to provide "User initializing data" of 108 * In most cases, users only need to provide "User initializing data" of
107 * this struct when registering an extcon. In some exceptional cases, 109 * this struct when registering an extcon. In some exceptional cases,
@@ -137,12 +139,12 @@ struct extcon_dev {
137 139
138/** 140/**
139 * struct extcon_cable - An internal data for each cable of extcon device. 141 * struct extcon_cable - An internal data for each cable of extcon device.
140 * @edev The extcon device 142 * @edev: The extcon device
141 * @cable_index Index of this cable in the edev 143 * @cable_index: Index of this cable in the edev
142 * @attr_g Attribute group for the cable 144 * @attr_g: Attribute group for the cable
143 * @attr_name "name" sysfs entry 145 * @attr_name: "name" sysfs entry
144 * @attr_state "state" sysfs entry 146 * @attr_state: "state" sysfs entry
145 * @attrs Array pointing to attr_name and attr_state for attr_g 147 * @attrs: Array pointing to attr_name and attr_state for attr_g
146 */ 148 */
147struct extcon_cable { 149struct extcon_cable {
148 struct extcon_dev *edev; 150 struct extcon_dev *edev;
@@ -158,11 +160,11 @@ struct extcon_cable {
158/** 160/**
159 * struct extcon_specific_cable_nb - An internal data for 161 * struct extcon_specific_cable_nb - An internal data for
160 * extcon_register_interest(). 162 * extcon_register_interest().
161 * @internal_nb a notifier block bridging extcon notifier and cable notifier. 163 * @internal_nb: a notifier block bridging extcon notifier and cable notifier.
162 * @user_nb user provided notifier block for events from a specific cable. 164 * @user_nb: user provided notifier block for events from a specific cable.
163 * @cable_index the target cable. 165 * @cable_index: the target cable.
164 * @edev the target extcon device. 166 * @edev: the target extcon device.
165 * @previous_value the saved previous event value. 167 * @previous_value: the saved previous event value.
166 */ 168 */
167struct extcon_specific_cable_nb { 169struct extcon_specific_cable_nb {
168 struct notifier_block internal_nb; 170 struct notifier_block internal_nb;
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
new file mode 100644
index 000000000000..f9a12f6243a5
--- /dev/null
+++ b/include/linux/f2fs_fs.h
@@ -0,0 +1,413 @@
1/**
2 * include/linux/f2fs_fs.h
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _LINUX_F2FS_FS_H
12#define _LINUX_F2FS_FS_H
13
14#include <linux/pagemap.h>
15#include <linux/types.h>
16
17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */
18#define F2FS_LOG_SECTOR_SIZE 9 /* 9 bits for 512 byte */
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22
23#define NULL_ADDR 0x0U
24#define NEW_ADDR -1U
25
26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
28#define F2FS_META_INO(sbi) (sbi->meta_ino_num)
29
30/* This flag is used by node and meta inodes, and by recovery */
31#define GFP_F2FS_ZERO (GFP_NOFS | __GFP_ZERO)
32
33/*
34 * For further optimization on multi-head logs, on-disk layout supports maximum
35 * 16 logs by default. The number, 16, is expected to cover all the cases
36 * enoughly. The implementaion currently uses no more than 6 logs.
37 * Half the logs are used for nodes, and the other half are used for data.
38 */
39#define MAX_ACTIVE_LOGS 16
40#define MAX_ACTIVE_NODE_LOGS 8
41#define MAX_ACTIVE_DATA_LOGS 8
42
43/*
44 * For superblock
45 */
46struct f2fs_super_block {
47 __le32 magic; /* Magic Number */
48 __le16 major_ver; /* Major Version */
49 __le16 minor_ver; /* Minor Version */
50 __le32 log_sectorsize; /* log2 sector size in bytes */
51 __le32 log_sectors_per_block; /* log2 # of sectors per block */
52 __le32 log_blocksize; /* log2 block size in bytes */
53 __le32 log_blocks_per_seg; /* log2 # of blocks per segment */
54 __le32 segs_per_sec; /* # of segments per section */
55 __le32 secs_per_zone; /* # of sections per zone */
56 __le32 checksum_offset; /* checksum offset inside super block */
57 __le64 block_count; /* total # of user blocks */
58 __le32 section_count; /* total # of sections */
59 __le32 segment_count; /* total # of segments */
60 __le32 segment_count_ckpt; /* # of segments for checkpoint */
61 __le32 segment_count_sit; /* # of segments for SIT */
62 __le32 segment_count_nat; /* # of segments for NAT */
63 __le32 segment_count_ssa; /* # of segments for SSA */
64 __le32 segment_count_main; /* # of segments for main area */
65 __le32 segment0_blkaddr; /* start block address of segment 0 */
66 __le32 cp_blkaddr; /* start block address of checkpoint */
67 __le32 sit_blkaddr; /* start block address of SIT */
68 __le32 nat_blkaddr; /* start block address of NAT */
69 __le32 ssa_blkaddr; /* start block address of SSA */
70 __le32 main_blkaddr; /* start block address of main area */
71 __le32 root_ino; /* root inode number */
72 __le32 node_ino; /* node inode number */
73 __le32 meta_ino; /* meta inode number */
74 __u8 uuid[16]; /* 128-bit uuid for volume */
75 __le16 volume_name[512]; /* volume name */
76 __le32 extension_count; /* # of extensions below */
77 __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
78} __packed;
79
80/*
81 * For checkpoint
82 */
83#define CP_ERROR_FLAG 0x00000008
84#define CP_COMPACT_SUM_FLAG 0x00000004
85#define CP_ORPHAN_PRESENT_FLAG 0x00000002
86#define CP_UMOUNT_FLAG 0x00000001
87
88struct f2fs_checkpoint {
89 __le64 checkpoint_ver; /* checkpoint block version number */
90 __le64 user_block_count; /* # of user blocks */
91 __le64 valid_block_count; /* # of valid blocks in main area */
92 __le32 rsvd_segment_count; /* # of reserved segments for gc */
93 __le32 overprov_segment_count; /* # of overprovision segments */
94 __le32 free_segment_count; /* # of free segments in main area */
95
96 /* information of current node segments */
97 __le32 cur_node_segno[MAX_ACTIVE_NODE_LOGS];
98 __le16 cur_node_blkoff[MAX_ACTIVE_NODE_LOGS];
99 /* information of current data segments */
100 __le32 cur_data_segno[MAX_ACTIVE_DATA_LOGS];
101 __le16 cur_data_blkoff[MAX_ACTIVE_DATA_LOGS];
102 __le32 ckpt_flags; /* Flags : umount and journal_present */
103 __le32 cp_pack_total_block_count; /* total # of one cp pack */
104 __le32 cp_pack_start_sum; /* start block number of data summary */
105 __le32 valid_node_count; /* Total number of valid nodes */
106 __le32 valid_inode_count; /* Total number of valid inodes */
107 __le32 next_free_nid; /* Next free node number */
108 __le32 sit_ver_bitmap_bytesize; /* Default value 64 */
109 __le32 nat_ver_bitmap_bytesize; /* Default value 256 */
110 __le32 checksum_offset; /* checksum offset inside cp block */
111 __le64 elapsed_time; /* mounted time */
112 /* allocation type of current segment */
113 unsigned char alloc_type[MAX_ACTIVE_LOGS];
114
115 /* SIT and NAT version bitmap */
116 unsigned char sit_nat_version_bitmap[1];
117} __packed;
118
119/*
120 * For orphan inode management
121 */
122#define F2FS_ORPHANS_PER_BLOCK 1020
123
124struct f2fs_orphan_block {
125 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */
126 __le32 reserved; /* reserved */
127 __le16 blk_addr; /* block index in current CP */
128 __le16 blk_count; /* Number of orphan inode blocks in CP */
129 __le32 entry_count; /* Total number of orphan nodes in current CP */
130 __le32 check_sum; /* CRC32 for orphan inode block */
131} __packed;
132
133/*
134 * For NODE structure
135 */
136struct f2fs_extent {
137 __le32 fofs; /* start file offset of the extent */
138 __le32 blk_addr; /* start block address of the extent */
139 __le32 len; /* lengh of the extent */
140} __packed;
141
142#define F2FS_MAX_NAME_LEN 256
143#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
144#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
145#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
146
147struct f2fs_inode {
148 __le16 i_mode; /* file mode */
149 __u8 i_advise; /* file hints */
150 __u8 i_reserved; /* reserved */
151 __le32 i_uid; /* user ID */
152 __le32 i_gid; /* group ID */
153 __le32 i_links; /* links count */
154 __le64 i_size; /* file size in bytes */
155 __le64 i_blocks; /* file size in blocks */
156 __le64 i_atime; /* access time */
157 __le64 i_ctime; /* change time */
158 __le64 i_mtime; /* modification time */
159 __le32 i_atime_nsec; /* access time in nano scale */
160 __le32 i_ctime_nsec; /* change time in nano scale */
161 __le32 i_mtime_nsec; /* modification time in nano scale */
162 __le32 i_generation; /* file version (for NFS) */
163 __le32 i_current_depth; /* only for directory depth */
164 __le32 i_xattr_nid; /* nid to save xattr */
165 __le32 i_flags; /* file attributes */
166 __le32 i_pino; /* parent inode number */
167 __le32 i_namelen; /* file name length */
168 __u8 i_name[F2FS_MAX_NAME_LEN]; /* file name for SPOR */
169
170 struct f2fs_extent i_ext; /* caching a largest extent */
171
172 __le32 i_addr[ADDRS_PER_INODE]; /* Pointers to data blocks */
173
174 __le32 i_nid[5]; /* direct(2), indirect(2),
175 double_indirect(1) node id */
176} __packed;
177
178struct direct_node {
179 __le32 addr[ADDRS_PER_BLOCK]; /* array of data block address */
180} __packed;
181
182struct indirect_node {
183 __le32 nid[NIDS_PER_BLOCK]; /* array of data block address */
184} __packed;
185
186enum {
187 COLD_BIT_SHIFT = 0,
188 FSYNC_BIT_SHIFT,
189 DENT_BIT_SHIFT,
190 OFFSET_BIT_SHIFT
191};
192
193struct node_footer {
194 __le32 nid; /* node id */
195 __le32 ino; /* inode nunmber */
196 __le32 flag; /* include cold/fsync/dentry marks and offset */
197 __le64 cp_ver; /* checkpoint version */
198 __le32 next_blkaddr; /* next node page block address */
199} __packed;
200
201struct f2fs_node {
202 /* can be one of three types: inode, direct, and indirect types */
203 union {
204 struct f2fs_inode i;
205 struct direct_node dn;
206 struct indirect_node in;
207 };
208 struct node_footer footer;
209} __packed;
210
211/*
212 * For NAT entries
213 */
214#define NAT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_nat_entry))
215
216struct f2fs_nat_entry {
217 __u8 version; /* latest version of cached nat entry */
218 __le32 ino; /* inode number */
219 __le32 block_addr; /* block address */
220} __packed;
221
222struct f2fs_nat_block {
223 struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK];
224} __packed;
225
226/*
227 * For SIT entries
228 *
229 * Each segment is 2MB in size by default so that a bitmap for validity of
230 * there-in blocks should occupy 64 bytes, 512 bits.
231 * Not allow to change this.
232 */
233#define SIT_VBLOCK_MAP_SIZE 64
234#define SIT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_sit_entry))
235
236/*
237 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
238 * [15:10] : allocation type such as CURSEG_XXXX_TYPE
239 * [9:0] : valid block count
240 */
241#define SIT_VBLOCKS_SHIFT 10
242#define SIT_VBLOCKS_MASK ((1 << SIT_VBLOCKS_SHIFT) - 1)
243#define GET_SIT_VBLOCKS(raw_sit) \
244 (le16_to_cpu((raw_sit)->vblocks) & SIT_VBLOCKS_MASK)
245#define GET_SIT_TYPE(raw_sit) \
246 ((le16_to_cpu((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK) \
247 >> SIT_VBLOCKS_SHIFT)
248
249struct f2fs_sit_entry {
250 __le16 vblocks; /* reference above */
251 __u8 valid_map[SIT_VBLOCK_MAP_SIZE]; /* bitmap for valid blocks */
252 __le64 mtime; /* segment age for cleaning */
253} __packed;
254
255struct f2fs_sit_block {
256 struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK];
257} __packed;
258
259/*
260 * For segment summary
261 *
262 * One summary block contains exactly 512 summary entries, which represents
263 * exactly 2MB segment by default. Not allow to change the basic units.
264 *
265 * NOTE: For initializing fields, you must use set_summary
266 *
267 * - If data page, nid represents dnode's nid
268 * - If node page, nid represents the node page's nid.
269 *
270 * The ofs_in_node is used by only data page. It represents offset
271 * from node's page's beginning to get a data block address.
272 * ex) data_blkaddr = (block_t)(nodepage_start_address + ofs_in_node)
273 */
274#define ENTRIES_IN_SUM 512
275#define SUMMARY_SIZE (7) /* sizeof(struct summary) */
276#define SUM_FOOTER_SIZE (5) /* sizeof(struct summary_footer) */
277#define SUM_ENTRY_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM)
278
279/* a summary entry for a 4KB-sized block in a segment */
280struct f2fs_summary {
281 __le32 nid; /* parent node id */
282 union {
283 __u8 reserved[3];
284 struct {
285 __u8 version; /* node version number */
286 __le16 ofs_in_node; /* block index in parent node */
287 } __packed;
288 };
289} __packed;
290
291/* summary block type, node or data, is stored to the summary_footer */
292#define SUM_TYPE_NODE (1)
293#define SUM_TYPE_DATA (0)
294
295struct summary_footer {
296 unsigned char entry_type; /* SUM_TYPE_XXX */
297 __u32 check_sum; /* summary checksum */
298} __packed;
299
300#define SUM_JOURNAL_SIZE (F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
301 SUM_ENTRY_SIZE)
302#define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
303 sizeof(struct nat_journal_entry))
304#define NAT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
305 sizeof(struct nat_journal_entry))
306#define SIT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
307 sizeof(struct sit_journal_entry))
308#define SIT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
309 sizeof(struct sit_journal_entry))
310/*
311 * frequently updated NAT/SIT entries can be stored in the spare area in
312 * summary blocks
313 */
314enum {
315 NAT_JOURNAL = 0,
316 SIT_JOURNAL
317};
318
319struct nat_journal_entry {
320 __le32 nid;
321 struct f2fs_nat_entry ne;
322} __packed;
323
324struct nat_journal {
325 struct nat_journal_entry entries[NAT_JOURNAL_ENTRIES];
326 __u8 reserved[NAT_JOURNAL_RESERVED];
327} __packed;
328
329struct sit_journal_entry {
330 __le32 segno;
331 struct f2fs_sit_entry se;
332} __packed;
333
334struct sit_journal {
335 struct sit_journal_entry entries[SIT_JOURNAL_ENTRIES];
336 __u8 reserved[SIT_JOURNAL_RESERVED];
337} __packed;
338
339/* 4KB-sized summary block structure */
340struct f2fs_summary_block {
341 struct f2fs_summary entries[ENTRIES_IN_SUM];
342 union {
343 __le16 n_nats;
344 __le16 n_sits;
345 };
346 /* spare area is used by NAT or SIT journals */
347 union {
348 struct nat_journal nat_j;
349 struct sit_journal sit_j;
350 };
351 struct summary_footer footer;
352} __packed;
353
354/*
355 * For directory operations
356 */
357#define F2FS_DOT_HASH 0
358#define F2FS_DDOT_HASH F2FS_DOT_HASH
359#define F2FS_MAX_HASH (~((0x3ULL) << 62))
360#define F2FS_HASH_COL_BIT ((0x1ULL) << 63)
361
362typedef __le32 f2fs_hash_t;
363
364/* One directory entry slot covers 8bytes-long file name */
365#define F2FS_NAME_LEN 8
366#define F2FS_NAME_LEN_BITS 3
367
368#define GET_DENTRY_SLOTS(x) ((x + F2FS_NAME_LEN - 1) >> F2FS_NAME_LEN_BITS)
369
370/* the number of dentry in a block */
371#define NR_DENTRY_IN_BLOCK 214
372
373/* MAX level for dir lookup */
374#define MAX_DIR_HASH_DEPTH 63
375
376#define SIZE_OF_DIR_ENTRY 11 /* by byte */
377#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
378 BITS_PER_BYTE)
379#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \
380 F2FS_NAME_LEN) * \
381 NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
382
383/* One directory entry slot representing F2FS_NAME_LEN-sized file name */
384struct f2fs_dir_entry {
385 __le32 hash_code; /* hash code of file name */
386 __le32 ino; /* inode number */
387 __le16 name_len; /* lengh of file name */
388 __u8 file_type; /* file type */
389} __packed;
390
391/* 4KB-sized directory entry block */
392struct f2fs_dentry_block {
393 /* validity bitmap for directory entries in each block */
394 __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP];
395 __u8 reserved[SIZE_OF_RESERVED];
396 struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK];
397 __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_NAME_LEN];
398} __packed;
399
400/* file types used in inode_info->flags */
401enum {
402 F2FS_FT_UNKNOWN,
403 F2FS_FT_REG_FILE,
404 F2FS_FT_DIR,
405 F2FS_FT_CHRDEV,
406 F2FS_FT_BLKDEV,
407 F2FS_FT_FIFO,
408 F2FS_FT_SOCK,
409 F2FS_FT_SYMLINK,
410 F2FS_FT_MAX
411};
412
413#endif /* _LINUX_F2FS_FS_H */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 45052aa814c8..fb7dacae0522 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -95,7 +95,6 @@ struct task_struct;
95struct files_struct *get_files_struct(struct task_struct *); 95struct files_struct *get_files_struct(struct task_struct *);
96void put_files_struct(struct files_struct *fs); 96void put_files_struct(struct files_struct *fs);
97void reset_files_struct(struct files_struct *); 97void reset_files_struct(struct files_struct *);
98void daemonize_descriptors(void);
99int unshare_files(struct files_struct **); 98int unshare_files(struct files_struct **);
100struct files_struct *dup_fd(struct files_struct *, int *); 99struct files_struct *dup_fd(struct files_struct *, int *);
101void do_close_on_exec(struct files_struct *); 100void do_close_on_exec(struct files_struct *);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 24d251f3bab0..c45eabc135e1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -45,6 +45,7 @@ extern void sk_unattached_filter_destroy(struct sk_filter *fp);
45extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 45extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
46extern int sk_detach_filter(struct sock *sk); 46extern int sk_detach_filter(struct sock *sk);
47extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 47extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
48extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len);
48 49
49#ifdef CONFIG_BPF_JIT 50#ifdef CONFIG_BPF_JIT
50extern void bpf_jit_compile(struct sk_filter *fp); 51extern void bpf_jit_compile(struct sk_filter *fp);
@@ -123,6 +124,8 @@ enum {
123 BPF_S_ANC_CPU, 124 BPF_S_ANC_CPU,
124 BPF_S_ANC_ALU_XOR_X, 125 BPF_S_ANC_ALU_XOR_X,
125 BPF_S_ANC_SECCOMP_LD_W, 126 BPF_S_ANC_SECCOMP_LD_W,
127 BPF_S_ANC_VLAN_TAG,
128 BPF_S_ANC_VLAN_TAG_PRESENT,
126}; 129};
127 130
128#endif /* __LINUX_FILTER_H__ */ 131#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index d09af4b67cf1..e4238ceaa4d6 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -75,35 +75,68 @@ static inline bool cgroup_freezing(struct task_struct *task)
75 */ 75 */
76 76
77 77
78/* Tell the freezer not to count the current task as freezable. */ 78/**
79 * freezer_do_not_count - tell freezer to ignore %current
80 *
81 * Tell freezers to ignore the current task when determining whether the
82 * target frozen state is reached. IOW, the current task will be
83 * considered frozen enough by freezers.
84 *
85 * The caller shouldn't do anything which isn't allowed for a frozen task
86 * until freezer_cont() is called. Usually, freezer[_do_not]_count() pair
87 * wrap a scheduling operation and nothing much else.
88 */
79static inline void freezer_do_not_count(void) 89static inline void freezer_do_not_count(void)
80{ 90{
81 current->flags |= PF_FREEZER_SKIP; 91 current->flags |= PF_FREEZER_SKIP;
82} 92}
83 93
84/* 94/**
85 * Tell the freezer to count the current task as freezable again and try to 95 * freezer_count - tell freezer to stop ignoring %current
86 * freeze it. 96 *
97 * Undo freezer_do_not_count(). It tells freezers that %current should be
98 * considered again and tries to freeze if freezing condition is already in
99 * effect.
87 */ 100 */
88static inline void freezer_count(void) 101static inline void freezer_count(void)
89{ 102{
90 current->flags &= ~PF_FREEZER_SKIP; 103 current->flags &= ~PF_FREEZER_SKIP;
104 /*
105 * If freezing is in progress, the following paired with smp_mb()
106 * in freezer_should_skip() ensures that either we see %true
107 * freezing() or freezer_should_skip() sees !PF_FREEZER_SKIP.
108 */
109 smp_mb();
91 try_to_freeze(); 110 try_to_freeze();
92} 111}
93 112
94/* 113/**
95 * Check if the task should be counted as freezable by the freezer 114 * freezer_should_skip - whether to skip a task when determining frozen
115 * state is reached
116 * @p: task in quesion
117 *
118 * This function is used by freezers after establishing %true freezing() to
119 * test whether a task should be skipped when determining the target frozen
120 * state is reached. IOW, if this function returns %true, @p is considered
121 * frozen enough.
96 */ 122 */
97static inline int freezer_should_skip(struct task_struct *p) 123static inline bool freezer_should_skip(struct task_struct *p)
98{ 124{
99 return !!(p->flags & PF_FREEZER_SKIP); 125 /*
126 * The following smp_mb() paired with the one in freezer_count()
127 * ensures that either freezer_count() sees %true freezing() or we
128 * see cleared %PF_FREEZER_SKIP and return %false. This makes it
129 * impossible for a task to slip frozen state testing after
130 * clearing %PF_FREEZER_SKIP.
131 */
132 smp_mb();
133 return p->flags & PF_FREEZER_SKIP;
100} 134}
101 135
102/* 136/*
103 * These macros are intended to be used whenever you want allow a task that's 137 * These macros are intended to be used whenever you want allow a sleeping
104 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note 138 * task to be frozen. Note that neither return any clear indication of
105 * that neither return any clear indication of whether a freeze event happened 139 * whether a freeze event happened while in this function.
106 * while in this function.
107 */ 140 */
108 141
109/* Like schedule(), but should not block the freezer. */ 142/* Like schedule(), but should not block the freezer. */
@@ -177,6 +210,7 @@ static inline int freeze_kernel_threads(void) { return -ENOSYS; }
177static inline void thaw_processes(void) {} 210static inline void thaw_processes(void) {}
178static inline void thaw_kernel_threads(void) {} 211static inline void thaw_kernel_threads(void) {}
179 212
213static inline bool try_to_freeze_nowarn(void) { return false; }
180static inline bool try_to_freeze(void) { return false; } 214static inline bool try_to_freeze(void) { return false; }
181 215
182static inline void freezer_do_not_count(void) {} 216static inline void freezer_do_not_count(void) {}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b33cfc97b9ca..7617ee04f066 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -44,6 +44,7 @@ struct vm_area_struct;
44struct vfsmount; 44struct vfsmount;
45struct cred; 45struct cred;
46struct swap_info_struct; 46struct swap_info_struct;
47struct seq_file;
47 48
48extern void __init inode_init(void); 49extern void __init inode_init(void);
49extern void __init inode_init_early(void); 50extern void __init inode_init_early(void);
@@ -418,7 +419,7 @@ struct address_space {
418 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 419 struct backing_dev_info *backing_dev_info; /* device readahead, etc */
419 spinlock_t private_lock; /* for use by the address_space */ 420 spinlock_t private_lock; /* for use by the address_space */
420 struct list_head private_list; /* ditto */ 421 struct list_head private_list; /* ditto */
421 struct address_space *assoc_mapping; /* ditto */ 422 void *private_data; /* ditto */
422} __attribute__((aligned(sizeof(long)))); 423} __attribute__((aligned(sizeof(long))));
423 /* 424 /*
424 * On most architectures that alignment is already the case; but 425 * On most architectures that alignment is already the case; but
@@ -462,8 +463,6 @@ struct block_device {
462 int bd_fsfreeze_count; 463 int bd_fsfreeze_count;
463 /* Mutex for freeze */ 464 /* Mutex for freeze */
464 struct mutex bd_fsfreeze_mutex; 465 struct mutex bd_fsfreeze_mutex;
465 /* A semaphore that prevents I/O while block size is being changed */
466 struct percpu_rw_semaphore bd_block_size_semaphore;
467}; 466};
468 467
469/* 468/*
@@ -1446,10 +1445,6 @@ static inline void sb_start_intwrite(struct super_block *sb)
1446 1445
1447extern bool inode_owner_or_capable(const struct inode *inode); 1446extern bool inode_owner_or_capable(const struct inode *inode);
1448 1447
1449/* not quite ready to be deprecated, but... */
1450extern void lock_super(struct super_block *);
1451extern void unlock_super(struct super_block *);
1452
1453/* 1448/*
1454 * VFS helper functions.. 1449 * VFS helper functions..
1455 */ 1450 */
@@ -1545,6 +1540,7 @@ struct file_operations {
1545 int (*setlease)(struct file *, long, struct file_lock **); 1540 int (*setlease)(struct file *, long, struct file_lock **);
1546 long (*fallocate)(struct file *file, int mode, loff_t offset, 1541 long (*fallocate)(struct file *file, int mode, loff_t offset,
1547 loff_t len); 1542 loff_t len);
1543 int (*show_fdinfo)(struct seq_file *m, struct file *f);
1548}; 1544};
1549 1545
1550struct inode_operations { 1546struct inode_operations {
@@ -1565,7 +1561,6 @@ struct inode_operations {
1565 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); 1561 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1566 int (*rename) (struct inode *, struct dentry *, 1562 int (*rename) (struct inode *, struct dentry *,
1567 struct inode *, struct dentry *); 1563 struct inode *, struct dentry *);
1568 void (*truncate) (struct inode *);
1569 int (*setattr) (struct dentry *, struct iattr *); 1564 int (*setattr) (struct dentry *, struct iattr *);
1570 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1565 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1571 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1566 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1580,8 +1575,6 @@ struct inode_operations {
1580 umode_t create_mode, int *opened); 1575 umode_t create_mode, int *opened);
1581} ____cacheline_aligned; 1576} ____cacheline_aligned;
1582 1577
1583struct seq_file;
1584
1585ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1578ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1586 unsigned long nr_segs, unsigned long fast_segs, 1579 unsigned long nr_segs, unsigned long fast_segs,
1587 struct iovec *fast_pointer, 1580 struct iovec *fast_pointer,
@@ -1812,6 +1805,8 @@ struct file_system_type {
1812#define FS_REQUIRES_DEV 1 1805#define FS_REQUIRES_DEV 1
1813#define FS_BINARY_MOUNTDATA 2 1806#define FS_BINARY_MOUNTDATA 2
1814#define FS_HAS_SUBTYPE 4 1807#define FS_HAS_SUBTYPE 4
1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
1809#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
1815#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ 1810#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1816#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 1811#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
1817 struct dentry *(*mount) (struct file_system_type *, int, 1812 struct dentry *(*mount) (struct file_system_type *, int,
@@ -1999,6 +1994,7 @@ struct filename {
1999 bool separate; /* should "name" be freed? */ 1994 bool separate; /* should "name" be freed? */
2000}; 1995};
2001 1996
1997extern long vfs_truncate(struct path *, loff_t);
2002extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, 1998extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2003 struct file *filp); 1999 struct file *filp);
2004extern int do_fallocate(struct file *file, int mode, loff_t offset, 2000extern int do_fallocate(struct file *file, int mode, loff_t offset,
@@ -2049,7 +2045,6 @@ extern void unregister_blkdev(unsigned int, const char *);
2049extern struct block_device *bdget(dev_t); 2045extern struct block_device *bdget(dev_t);
2050extern struct block_device *bdgrab(struct block_device *bdev); 2046extern struct block_device *bdgrab(struct block_device *bdev);
2051extern void bd_set_size(struct block_device *, loff_t size); 2047extern void bd_set_size(struct block_device *, loff_t size);
2052extern sector_t blkdev_max_block(struct block_device *bdev);
2053extern void bd_forget(struct inode *inode); 2048extern void bd_forget(struct inode *inode);
2054extern void bdput(struct block_device *); 2049extern void bdput(struct block_device *);
2055extern void invalidate_bdev(struct block_device *); 2050extern void invalidate_bdev(struct block_device *);
@@ -2289,9 +2284,9 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
2289#include <linux/err.h> 2284#include <linux/err.h>
2290 2285
2291/* needed for stackable file system support */ 2286/* needed for stackable file system support */
2292extern loff_t default_llseek(struct file *file, loff_t offset, int origin); 2287extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
2293 2288
2294extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); 2289extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2295 2290
2296extern int inode_init_always(struct super_block *, struct inode *); 2291extern int inode_init_always(struct super_block *, struct inode *);
2297extern void inode_init_once(struct inode *); 2292extern void inode_init_once(struct inode *);
@@ -2379,8 +2374,6 @@ extern int generic_segment_checks(const struct iovec *iov,
2379 unsigned long *nr_segs, size_t *count, int access_flags); 2374 unsigned long *nr_segs, size_t *count, int access_flags);
2380 2375
2381/* fs/block_dev.c */ 2376/* fs/block_dev.c */
2382extern ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov,
2383 unsigned long nr_segs, loff_t pos);
2384extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2377extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2385 unsigned long nr_segs, loff_t pos); 2378 unsigned long nr_segs, loff_t pos);
2386extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2379extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
@@ -2401,11 +2394,11 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2401 2394
2402extern void 2395extern void
2403file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2396file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2404extern loff_t noop_llseek(struct file *file, loff_t offset, int origin); 2397extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
2405extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 2398extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
2406extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 2399extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
2407extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, 2400extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
2408 int origin, loff_t maxsize, loff_t eof); 2401 int whence, loff_t maxsize, loff_t eof);
2409extern int generic_file_open(struct inode * inode, struct file * filp); 2402extern int generic_file_open(struct inode * inode, struct file * filp);
2410extern int nonseekable_open(struct inode * inode, struct file * filp); 2403extern int nonseekable_open(struct inode * inode, struct file * filp);
2411 2404
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 003dc0fd7347..d0ae3a84bcfb 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -21,7 +21,6 @@ extern void set_fs_root(struct fs_struct *, struct path *);
21extern void set_fs_pwd(struct fs_struct *, struct path *); 21extern void set_fs_pwd(struct fs_struct *, struct path *);
22extern struct fs_struct *copy_fs_struct(struct fs_struct *); 22extern struct fs_struct *copy_fs_struct(struct fs_struct *);
23extern void free_fs_struct(struct fs_struct *); 23extern void free_fs_struct(struct fs_struct *);
24extern void daemonize_fs_struct(void);
25extern int unshare_fs_struct(void); 24extern int unshare_fs_struct(void);
26 25
27static inline void get_fs_root(struct fs_struct *fs, struct path *root) 26static inline void get_fs_root(struct fs_struct *fs, struct path *root)
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index ce31408b1e47..5dfa0aa216b6 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -75,6 +75,16 @@ extern wait_queue_head_t fscache_cache_cleared_wq;
75typedef void (*fscache_operation_release_t)(struct fscache_operation *op); 75typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); 76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77 77
78enum fscache_operation_state {
79 FSCACHE_OP_ST_BLANK, /* Op is not yet submitted */
80 FSCACHE_OP_ST_INITIALISED, /* Op is initialised */
81 FSCACHE_OP_ST_PENDING, /* Op is blocked from running */
82 FSCACHE_OP_ST_IN_PROGRESS, /* Op is in progress */
83 FSCACHE_OP_ST_COMPLETE, /* Op is complete */
84 FSCACHE_OP_ST_CANCELLED, /* Op has been cancelled */
85 FSCACHE_OP_ST_DEAD /* Op is now dead */
86};
87
78struct fscache_operation { 88struct fscache_operation {
79 struct work_struct work; /* record for async ops */ 89 struct work_struct work; /* record for async ops */
80 struct list_head pend_link; /* link in object->pending_ops */ 90 struct list_head pend_link; /* link in object->pending_ops */
@@ -86,10 +96,10 @@ struct fscache_operation {
86#define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */ 96#define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */
87#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
88#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
89#define FSCACHE_OP_DEAD 6 /* op is now dead */ 99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */
90#define FSCACHE_OP_DEC_READ_CNT 7 /* decrement object->n_reads on destruction */ 100#define FSCACHE_OP_KEEP_FLAGS 0x0070 /* flags to keep when repurposing an op */
91#define FSCACHE_OP_KEEP_FLAGS 0xc0 /* flags to keep when repurposing an op */
92 101
102 enum fscache_operation_state state;
93 atomic_t usage; 103 atomic_t usage;
94 unsigned debug_id; /* debugging ID */ 104 unsigned debug_id; /* debugging ID */
95 105
@@ -106,6 +116,7 @@ extern atomic_t fscache_op_debug_id;
106extern void fscache_op_work_func(struct work_struct *work); 116extern void fscache_op_work_func(struct work_struct *work);
107 117
108extern void fscache_enqueue_operation(struct fscache_operation *); 118extern void fscache_enqueue_operation(struct fscache_operation *);
119extern void fscache_op_complete(struct fscache_operation *, bool);
109extern void fscache_put_operation(struct fscache_operation *); 120extern void fscache_put_operation(struct fscache_operation *);
110 121
111/** 122/**
@@ -122,6 +133,7 @@ static inline void fscache_operation_init(struct fscache_operation *op,
122{ 133{
123 INIT_WORK(&op->work, fscache_op_work_func); 134 INIT_WORK(&op->work, fscache_op_work_func);
124 atomic_set(&op->usage, 1); 135 atomic_set(&op->usage, 1);
136 op->state = FSCACHE_OP_ST_INITIALISED;
125 op->debug_id = atomic_inc_return(&fscache_op_debug_id); 137 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
126 op->processor = processor; 138 op->processor = processor;
127 op->release = release; 139 op->release = release;
@@ -138,6 +150,7 @@ struct fscache_retrieval {
138 void *context; /* netfs read context (pinned) */ 150 void *context; /* netfs read context (pinned) */
139 struct list_head to_do; /* list of things to be done by the backend */ 151 struct list_head to_do; /* list of things to be done by the backend */
140 unsigned long start_time; /* time at which retrieval started */ 152 unsigned long start_time; /* time at which retrieval started */
153 unsigned n_pages; /* number of pages to be retrieved */
141}; 154};
142 155
143typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, 156typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
@@ -174,8 +187,22 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
174} 187}
175 188
176/** 189/**
190 * fscache_retrieval_complete - Record (partial) completion of a retrieval
191 * @op: The retrieval operation affected
192 * @n_pages: The number of pages to account for
193 */
194static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
195 int n_pages)
196{
197 op->n_pages -= n_pages;
198 if (op->n_pages <= 0)
199 fscache_op_complete(&op->op, true);
200}
201
202/**
177 * fscache_put_retrieval - Drop a reference to a retrieval operation 203 * fscache_put_retrieval - Drop a reference to a retrieval operation
178 * @op: The retrieval operation affected 204 * @op: The retrieval operation affected
205 * @n_pages: The number of pages to account for
179 * 206 *
180 * Drop a reference to a retrieval operation. 207 * Drop a reference to a retrieval operation.
181 */ 208 */
@@ -227,6 +254,9 @@ struct fscache_cache_ops {
227 /* store the updated auxiliary data on an object */ 254 /* store the updated auxiliary data on an object */
228 void (*update_object)(struct fscache_object *object); 255 void (*update_object)(struct fscache_object *object);
229 256
257 /* Invalidate an object */
258 void (*invalidate_object)(struct fscache_operation *op);
259
230 /* discard the resources pinned by an object and effect retirement if 260 /* discard the resources pinned by an object and effect retirement if
231 * necessary */ 261 * necessary */
232 void (*drop_object)(struct fscache_object *object); 262 void (*drop_object)(struct fscache_object *object);
@@ -301,11 +331,30 @@ struct fscache_cookie {
301#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ 331#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */
302#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ 332#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */
303#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ 333#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */
334#define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */
335#define FSCACHE_COOKIE_INVALIDATING 7 /* T if cookie is being invalidated */
304}; 336};
305 337
306extern struct fscache_cookie fscache_fsdef_index; 338extern struct fscache_cookie fscache_fsdef_index;
307 339
308/* 340/*
341 * Event list for fscache_object::{event_mask,events}
342 */
343enum {
344 FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */
345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */
346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */
347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */
348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */
349 FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */
350 FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */
351 FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */
352 NR_FSCACHE_OBJECT_EVENTS
353};
354
355#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1)
356
357/*
309 * on-disk cache file or index handle 358 * on-disk cache file or index handle
310 */ 359 */
311struct fscache_object { 360struct fscache_object {
@@ -317,6 +366,7 @@ struct fscache_object {
317 /* active states */ 366 /* active states */
318 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */ 367 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
319 FSCACHE_OBJECT_ACTIVE, /* object is usable */ 368 FSCACHE_OBJECT_ACTIVE, /* object is usable */
369 FSCACHE_OBJECT_INVALIDATING, /* object is invalidating */
320 FSCACHE_OBJECT_UPDATING, /* object is updating */ 370 FSCACHE_OBJECT_UPDATING, /* object is updating */
321 371
322 /* terminal states */ 372 /* terminal states */
@@ -332,10 +382,10 @@ struct fscache_object {
332 382
333 int debug_id; /* debugging ID */ 383 int debug_id; /* debugging ID */
334 int n_children; /* number of child objects */ 384 int n_children; /* number of child objects */
335 int n_ops; /* number of ops outstanding on object */ 385 int n_ops; /* number of extant ops on object */
336 int n_obj_ops; /* number of object ops outstanding on object */ 386 int n_obj_ops; /* number of object ops outstanding on object */
337 int n_in_progress; /* number of ops in progress */ 387 int n_in_progress; /* number of ops in progress */
338 int n_exclusive; /* number of exclusive ops queued */ 388 int n_exclusive; /* number of exclusive ops queued or in progress */
339 atomic_t n_reads; /* number of read ops in progress */ 389 atomic_t n_reads; /* number of read ops in progress */
340 spinlock_t lock; /* state and operations lock */ 390 spinlock_t lock; /* state and operations lock */
341 391
@@ -343,14 +393,6 @@ struct fscache_object {
343 unsigned long event_mask; /* events this object is interested in */ 393 unsigned long event_mask; /* events this object is interested in */
344 unsigned long events; /* events to be processed by this object 394 unsigned long events; /* events to be processed by this object
345 * (order is important - using fls) */ 395 * (order is important - using fls) */
346#define FSCACHE_OBJECT_EV_REQUEUE 0 /* T if object should be requeued */
347#define FSCACHE_OBJECT_EV_UPDATE 1 /* T if object should be updated */
348#define FSCACHE_OBJECT_EV_CLEARED 2 /* T if accessors all gone */
349#define FSCACHE_OBJECT_EV_ERROR 3 /* T if fatal error occurred during processing */
350#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
351#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
352#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
353#define FSCACHE_OBJECT_EVENTS_MASK 0x7f /* mask of all events*/
354 396
355 unsigned long flags; 397 unsigned long flags;
356#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 398#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
@@ -504,6 +546,9 @@ extern void fscache_withdraw_cache(struct fscache_cache *cache);
504 546
505extern void fscache_io_error(struct fscache_cache *cache); 547extern void fscache_io_error(struct fscache_cache *cache);
506 548
549extern void fscache_mark_page_cached(struct fscache_retrieval *op,
550 struct page *page);
551
507extern void fscache_mark_pages_cached(struct fscache_retrieval *op, 552extern void fscache_mark_pages_cached(struct fscache_retrieval *op,
508 struct pagevec *pagevec); 553 struct pagevec *pagevec);
509 554
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 9ec20dec3353..7a086235da4b 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -135,14 +135,14 @@ struct fscache_cookie_def {
135 */ 135 */
136 void (*put_context)(void *cookie_netfs_data, void *context); 136 void (*put_context)(void *cookie_netfs_data, void *context);
137 137
138 /* indicate pages that now have cache metadata retained 138 /* indicate page that now have cache metadata retained
139 * - this function should mark the specified pages as now being cached 139 * - this function should mark the specified page as now being cached
140 * - the pages will have been marked with PG_fscache before this is 140 * - the page will have been marked with PG_fscache before this is
141 * called, so this is optional 141 * called, so this is optional
142 */ 142 */
143 void (*mark_pages_cached)(void *cookie_netfs_data, 143 void (*mark_page_cached)(void *cookie_netfs_data,
144 struct address_space *mapping, 144 struct address_space *mapping,
145 struct pagevec *cached_pvec); 145 struct page *page);
146 146
147 /* indicate the cookie is no longer cached 147 /* indicate the cookie is no longer cached
148 * - this function is called when the backing store currently caching 148 * - this function is called when the backing store currently caching
@@ -185,6 +185,8 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern void __fscache_update_cookie(struct fscache_cookie *); 186extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *); 187extern int __fscache_attr_changed(struct fscache_cookie *);
188extern void __fscache_invalidate(struct fscache_cookie *);
189extern void __fscache_wait_on_invalidate(struct fscache_cookie *);
188extern int __fscache_read_or_alloc_page(struct fscache_cookie *, 190extern int __fscache_read_or_alloc_page(struct fscache_cookie *,
189 struct page *, 191 struct page *,
190 fscache_rw_complete_t, 192 fscache_rw_complete_t,
@@ -390,6 +392,42 @@ int fscache_attr_changed(struct fscache_cookie *cookie)
390} 392}
391 393
392/** 394/**
395 * fscache_invalidate - Notify cache that an object needs invalidation
396 * @cookie: The cookie representing the cache object
397 *
398 * Notify the cache that an object is needs to be invalidated and that it
399 * should abort any retrievals or stores it is doing on the cache. The object
400 * is then marked non-caching until such time as the invalidation is complete.
401 *
402 * This can be called with spinlocks held.
403 *
404 * See Documentation/filesystems/caching/netfs-api.txt for a complete
405 * description.
406 */
407static inline
408void fscache_invalidate(struct fscache_cookie *cookie)
409{
410 if (fscache_cookie_valid(cookie))
411 __fscache_invalidate(cookie);
412}
413
414/**
415 * fscache_wait_on_invalidate - Wait for invalidation to complete
416 * @cookie: The cookie representing the cache object
417 *
418 * Wait for the invalidation of an object to complete.
419 *
420 * See Documentation/filesystems/caching/netfs-api.txt for a complete
421 * description.
422 */
423static inline
424void fscache_wait_on_invalidate(struct fscache_cookie *cookie)
425{
426 if (fscache_cookie_valid(cookie))
427 __fscache_wait_on_invalidate(cookie);
428}
429
430/**
393 * fscache_reserve_space - Reserve data space for a cached object 431 * fscache_reserve_space - Reserve data space for a cached object
394 * @cookie: The cookie representing the cache object 432 * @cookie: The cookie representing the cache object
395 * @i_size: The amount of space to be reserved 433 * @i_size: The amount of space to be reserved
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
index 11c16a1fb9e3..a1e8277120c7 100644
--- a/include/linux/fsl-diu-fb.h
+++ b/include/linux/fsl-diu-fb.h
@@ -47,6 +47,15 @@ struct aoi_display_offset {
47#define MFB_GET_PIXFMT _IOR('M', 8, __u32) 47#define MFB_GET_PIXFMT _IOR('M', 8, __u32)
48 48
49/* 49/*
50 * The MPC5121 BSP comes with a gamma_set utility that initializes the
51 * gamma table. Unfortunately, it uses bad values for the IOCTL commands,
52 * but there's nothing we can do about it now. These ioctls are only
53 * supported on the MPC5121.
54 */
55#define MFB_SET_GAMMA _IOW('M', 1, __u8)
56#define MFB_GET_GAMMA _IOR('M', 1, __u8)
57
58/*
50 * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the 59 * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the
51 * wrong value for 'size' field of the ioctl. The current macros above use the 60 * wrong value for 'size' field of the ioctl. The current macros above use the
52 * right size, but we still need to provide backwards compatibility, at least 61 * right size, but we still need to provide backwards compatibility, at least
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 63d966d5c2ea..d5b0910d4961 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -88,9 +88,10 @@ struct fsnotify_event_private_data;
88 * if the group is interested in this event. 88 * if the group is interested in this event.
89 * handle_event - main call for a group to handle an fs event 89 * handle_event - main call for a group to handle an fs event
90 * free_group_priv - called when a group refcnt hits 0 to clean up the private union 90 * free_group_priv - called when a group refcnt hits 0 to clean up the private union
91 * freeing-mark - this means that a mark has been flagged to die when everything 91 * freeing_mark - called when a mark is being destroyed for some reason. The group
92 * finishes using it. The function is supplied with what must be a 92 * MUST be holding a reference on each mark and that reference must be
93 * valid group and inode to use to clean up. 93 * dropped in this function. inotify uses this function to send
94 * userspace messages that marks have been removed.
94 */ 95 */
95struct fsnotify_ops { 96struct fsnotify_ops {
96 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, 97 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
@@ -141,12 +142,14 @@ struct fsnotify_group {
141 unsigned int priority; 142 unsigned int priority;
142 143
143 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ 144 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
144 spinlock_t mark_lock; /* protect marks_list */ 145 struct mutex mark_mutex; /* protect marks_list */
145 atomic_t num_marks; /* 1 for each mark and 1 for not being 146 atomic_t num_marks; /* 1 for each mark and 1 for not being
146 * past the point of no return when freeing 147 * past the point of no return when freeing
147 * a group */ 148 * a group */
148 struct list_head marks_list; /* all inode marks for this group */ 149 struct list_head marks_list; /* all inode marks for this group */
149 150
151 struct fasync_struct *fsn_fa; /* async notification */
152
150 /* groups can define private fields here or use the void *private */ 153 /* groups can define private fields here or use the void *private */
151 union { 154 union {
152 void *private; 155 void *private;
@@ -155,7 +158,6 @@ struct fsnotify_group {
155 spinlock_t idr_lock; 158 spinlock_t idr_lock;
156 struct idr idr; 159 struct idr idr;
157 u32 last_wd; 160 u32 last_wd;
158 struct fasync_struct *fa; /* async notification */
159 struct user_struct *user; 161 struct user_struct *user;
160 } inotify_data; 162 } inotify_data;
161#endif 163#endif
@@ -287,7 +289,6 @@ struct fsnotify_mark {
287 struct fsnotify_inode_mark i; 289 struct fsnotify_inode_mark i;
288 struct fsnotify_vfsmount_mark m; 290 struct fsnotify_vfsmount_mark m;
289 }; 291 };
290 struct list_head free_g_list; /* tmp list used when freeing this mark */
291 __u32 ignored_mask; /* events types to ignore */ 292 __u32 ignored_mask; /* events types to ignore */
292#define FSNOTIFY_MARK_FLAG_INODE 0x01 293#define FSNOTIFY_MARK_FLAG_INODE 0x01
293#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02 294#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
@@ -360,11 +361,16 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
360 361
361/* called from fsnotify listeners, such as fanotify or dnotify */ 362/* called from fsnotify listeners, such as fanotify or dnotify */
362 363
363/* get a reference to an existing or create a new group */ 364/* create a new group */
364extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops); 365extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
366/* get reference to a group */
367extern void fsnotify_get_group(struct fsnotify_group *group);
365/* drop reference on a group from fsnotify_alloc_group */ 368/* drop reference on a group from fsnotify_alloc_group */
366extern void fsnotify_put_group(struct fsnotify_group *group); 369extern void fsnotify_put_group(struct fsnotify_group *group);
367 370/* destroy group */
371extern void fsnotify_destroy_group(struct fsnotify_group *group);
372/* fasync handler function */
373extern int fsnotify_fasync(int fd, struct file *file, int on);
368/* take a reference to an event */ 374/* take a reference to an event */
369extern void fsnotify_get_event(struct fsnotify_event *event); 375extern void fsnotify_get_event(struct fsnotify_event *event);
370extern void fsnotify_put_event(struct fsnotify_event *event); 376extern void fsnotify_put_event(struct fsnotify_event *event);
@@ -405,8 +411,13 @@ extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask
405/* attach the mark to both the group and the inode */ 411/* attach the mark to both the group and the inode */
406extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, 412extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
407 struct inode *inode, struct vfsmount *mnt, int allow_dups); 413 struct inode *inode, struct vfsmount *mnt, int allow_dups);
408/* given a mark, flag it to be freed when all references are dropped */ 414extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark, struct fsnotify_group *group,
409extern void fsnotify_destroy_mark(struct fsnotify_mark *mark); 415 struct inode *inode, struct vfsmount *mnt, int allow_dups);
416/* given a group and a mark, flag mark to be freed when all references are dropped */
417extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
418 struct fsnotify_group *group);
419extern void fsnotify_destroy_mark_locked(struct fsnotify_mark *mark,
420 struct fsnotify_group *group);
410/* run all the marks in a group, and clear all of the vfsmount marks */ 421/* run all the marks in a group, and clear all of the vfsmount marks */
411extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group); 422extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
412/* run all the marks in a group, and clear all of the inode marks */ 423/* run all the marks in a group, and clear all of the inode marks */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index a52f2f4fe030..92691d85c320 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -394,7 +394,7 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
394 size_t cnt, loff_t *ppos); 394 size_t cnt, loff_t *ppos);
395ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 395ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
396 size_t cnt, loff_t *ppos); 396 size_t cnt, loff_t *ppos);
397loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin); 397loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);
398int ftrace_regex_release(struct inode *inode, struct file *file); 398int ftrace_regex_release(struct inode *inode, struct file *file);
399 399
400void __init 400void __init
@@ -559,7 +559,7 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
559 size_t cnt, loff_t *ppos) { return -ENODEV; } 559 size_t cnt, loff_t *ppos) { return -ENODEV; }
560static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 560static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
561 size_t cnt, loff_t *ppos) { return -ENODEV; } 561 size_t cnt, loff_t *ppos) { return -ENODEV; }
562static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin) 562static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
563{ 563{
564 return -ENODEV; 564 return -ENODEV;
565} 565}
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 642928cf57b4..a3d489531d83 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -86,6 +86,12 @@ struct trace_iterator {
86 cpumask_var_t started; 86 cpumask_var_t started;
87}; 87};
88 88
89enum trace_iter_flags {
90 TRACE_FILE_LAT_FMT = 1,
91 TRACE_FILE_ANNOTATE = 2,
92 TRACE_FILE_TIME_IN_NS = 4,
93};
94
89 95
90struct trace_event; 96struct trace_event;
91 97
@@ -127,13 +133,13 @@ trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
127void trace_current_buffer_unlock_commit(struct ring_buffer *buffer, 133void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
128 struct ring_buffer_event *event, 134 struct ring_buffer_event *event,
129 unsigned long flags, int pc); 135 unsigned long flags, int pc);
130void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer, 136void trace_buffer_unlock_commit(struct ring_buffer *buffer,
131 struct ring_buffer_event *event, 137 struct ring_buffer_event *event,
132 unsigned long flags, int pc); 138 unsigned long flags, int pc);
133void trace_nowake_buffer_unlock_commit_regs(struct ring_buffer *buffer, 139void trace_buffer_unlock_commit_regs(struct ring_buffer *buffer,
134 struct ring_buffer_event *event, 140 struct ring_buffer_event *event,
135 unsigned long flags, int pc, 141 unsigned long flags, int pc,
136 struct pt_regs *regs); 142 struct pt_regs *regs);
137void trace_current_buffer_discard_commit(struct ring_buffer *buffer, 143void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
138 struct ring_buffer_event *event); 144 struct ring_buffer_event *event);
139 145
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 4f440b3e89fe..79b8bba19363 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -88,10 +88,14 @@ struct disk_stats {
88}; 88};
89 89
90#define PARTITION_META_INFO_VOLNAMELTH 64 90#define PARTITION_META_INFO_VOLNAMELTH 64
91#define PARTITION_META_INFO_UUIDLTH 16 91/*
92 * Enough for the string representation of any kind of UUID plus NULL.
93 * EFI UUID is 36 characters. MSDOS UUID is 11 characters.
94 */
95#define PARTITION_META_INFO_UUIDLTH 37
92 96
93struct partition_meta_info { 97struct partition_meta_info {
94 u8 uuid[PARTITION_META_INFO_UUIDLTH]; /* always big endian */ 98 char uuid[PARTITION_META_INFO_UUIDLTH];
95 u8 volname[PARTITION_META_INFO_VOLNAMELTH]; 99 u8 volname[PARTITION_META_INFO_VOLNAMELTH];
96}; 100};
97 101
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
new file mode 100644
index 000000000000..023bc346b877
--- /dev/null
+++ b/include/linux/genl_magic_func.h
@@ -0,0 +1,422 @@
1#ifndef GENL_MAGIC_FUNC_H
2#define GENL_MAGIC_FUNC_H
3
4#include <linux/genl_magic_struct.h>
5
6/*
7 * Magic: declare tla policy {{{1
8 * Magic: declare nested policies
9 * {{{2
10 */
11#undef GENL_mc_group
12#define GENL_mc_group(group)
13
14#undef GENL_notification
15#define GENL_notification(op_name, op_num, mcast_group, tla_list)
16
17#undef GENL_op
18#define GENL_op(op_name, op_num, handler, tla_list)
19
20#undef GENL_struct
21#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
22 [tag_name] = { .type = NLA_NESTED },
23
24static struct nla_policy CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy)[] = {
25#include GENL_MAGIC_INCLUDE_FILE
26};
27
28#undef GENL_struct
29#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
30static struct nla_policy s_name ## _nl_policy[] __read_mostly = \
31{ s_fields };
32
33#undef __field
34#define __field(attr_nr, attr_flag, name, nla_type, _type, __get, \
35 __put, __is_signed) \
36 [attr_nr] = { .type = nla_type },
37
38#undef __array
39#define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \
40 __get, __put, __is_signed) \
41 [attr_nr] = { .type = nla_type, \
42 .len = maxlen - (nla_type == NLA_NUL_STRING) },
43
44#include GENL_MAGIC_INCLUDE_FILE
45
46#ifndef __KERNEL__
47#ifndef pr_info
48#define pr_info(args...) fprintf(stderr, args);
49#endif
50#endif
51
52#ifdef GENL_MAGIC_DEBUG
53static void dprint_field(const char *dir, int nla_type,
54 const char *name, void *valp)
55{
56 __u64 val = valp ? *(__u32 *)valp : 1;
57 switch (nla_type) {
58 case NLA_U8: val = (__u8)val;
59 case NLA_U16: val = (__u16)val;
60 case NLA_U32: val = (__u32)val;
61 pr_info("%s attr %s: %d 0x%08x\n", dir,
62 name, (int)val, (unsigned)val);
63 break;
64 case NLA_U64:
65 val = *(__u64*)valp;
66 pr_info("%s attr %s: %lld 0x%08llx\n", dir,
67 name, (long long)val, (unsigned long long)val);
68 break;
69 case NLA_FLAG:
70 if (val)
71 pr_info("%s attr %s: set\n", dir, name);
72 break;
73 }
74}
75
76static void dprint_array(const char *dir, int nla_type,
77 const char *name, const char *val, unsigned len)
78{
79 switch (nla_type) {
80 case NLA_NUL_STRING:
81 if (len && val[len-1] == '\0')
82 len--;
83 pr_info("%s attr %s: [len:%u] '%s'\n", dir, name, len, val);
84 break;
85 default:
86 /* we can always show 4 byte,
87 * thats what nlattr are aligned to. */
88 pr_info("%s attr %s: [len:%u] %02x%02x%02x%02x ...\n",
89 dir, name, len, val[0], val[1], val[2], val[3]);
90 }
91}
92
93#define DPRINT_TLA(a, op, b) pr_info("%s %s %s\n", a, op, b);
94
95/* Name is a member field name of the struct s.
96 * If s is NULL (only parsing, no copy requested in *_from_attrs()),
97 * nla is supposed to point to the attribute containing the information
98 * corresponding to that struct member. */
99#define DPRINT_FIELD(dir, nla_type, name, s, nla) \
100 do { \
101 if (s) \
102 dprint_field(dir, nla_type, #name, &s->name); \
103 else if (nla) \
104 dprint_field(dir, nla_type, #name, \
105 (nla_type == NLA_FLAG) ? NULL \
106 : nla_data(nla)); \
107 } while (0)
108
109#define DPRINT_ARRAY(dir, nla_type, name, s, nla) \
110 do { \
111 if (s) \
112 dprint_array(dir, nla_type, #name, \
113 s->name, s->name ## _len); \
114 else if (nla) \
115 dprint_array(dir, nla_type, #name, \
116 nla_data(nla), nla_len(nla)); \
117 } while (0)
118#else
119#define DPRINT_TLA(a, op, b) do {} while (0)
120#define DPRINT_FIELD(dir, nla_type, name, s, nla) do {} while (0)
121#define DPRINT_ARRAY(dir, nla_type, name, s, nla) do {} while (0)
122#endif
123
124/*
125 * Magic: provide conversion functions {{{1
126 * populate struct from attribute table:
127 * {{{2
128 */
129
130/* processing of generic netlink messages is serialized.
131 * use one static buffer for parsing of nested attributes */
132static struct nlattr *nested_attr_tb[128];
133
134#ifndef BUILD_BUG_ON
135/* Force a compilation error if condition is true */
136#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
137/* Force a compilation error if condition is true, but also produce a
138 result (of value 0 and type size_t), so the expression can be used
139 e.g. in a structure initializer (or where-ever else comma expressions
140 aren't permitted). */
141#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
142#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
143#endif
144
145#undef GENL_struct
146#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
147/* *_from_attrs functions are static, but potentially unused */ \
148static int __ ## s_name ## _from_attrs(struct s_name *s, \
149 struct genl_info *info, bool exclude_invariants) \
150{ \
151 const int maxtype = ARRAY_SIZE(s_name ## _nl_policy)-1; \
152 struct nlattr *tla = info->attrs[tag_number]; \
153 struct nlattr **ntb = nested_attr_tb; \
154 struct nlattr *nla; \
155 int err; \
156 BUILD_BUG_ON(ARRAY_SIZE(s_name ## _nl_policy) > ARRAY_SIZE(nested_attr_tb)); \
157 if (!tla) \
158 return -ENOMSG; \
159 DPRINT_TLA(#s_name, "<=-", #tag_name); \
160 err = drbd_nla_parse_nested(ntb, maxtype, tla, s_name ## _nl_policy); \
161 if (err) \
162 return err; \
163 \
164 s_fields \
165 return 0; \
166} __attribute__((unused)) \
167static int s_name ## _from_attrs(struct s_name *s, \
168 struct genl_info *info) \
169{ \
170 return __ ## s_name ## _from_attrs(s, info, false); \
171} __attribute__((unused)) \
172static int s_name ## _from_attrs_for_change(struct s_name *s, \
173 struct genl_info *info) \
174{ \
175 return __ ## s_name ## _from_attrs(s, info, true); \
176} __attribute__((unused)) \
177
178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
179 nla = ntb[attr_nr]; \
180 if (nla) { \
181 if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \
182 pr_info("<< must not change invariant attr: %s\n", #name); \
183 return -EEXIST; \
184 } \
185 assignment; \
186 } else if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \
187 /* attribute missing from payload, */ \
188 /* which was expected */ \
189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \
190 pr_info("<< missing attr: %s\n", #name); \
191 return -ENOMSG; \
192 }
193
194#undef __field
195#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
196 __is_signed) \
197 __assign(attr_nr, attr_flag, name, nla_type, type, \
198 if (s) \
199 s->name = __get(nla); \
200 DPRINT_FIELD("<<", nla_type, name, s, nla))
201
202/* validate_nla() already checked nla_len <= maxlen appropriately. */
203#undef __array
204#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
205 __get, __put, __is_signed) \
206 __assign(attr_nr, attr_flag, name, nla_type, type, \
207 if (s) \
208 s->name ## _len = \
209 __get(s->name, nla, maxlen); \
210 DPRINT_ARRAY("<<", nla_type, name, s, nla))
211
212#include GENL_MAGIC_INCLUDE_FILE
213
214#undef GENL_struct
215#define GENL_struct(tag_name, tag_number, s_name, s_fields)
216
217/*
218 * Magic: define op number to op name mapping {{{1
219 * {{{2
220 */
221const char *CONCAT_(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd)
222{
223 switch (cmd) {
224#undef GENL_op
225#define GENL_op(op_name, op_num, handler, tla_list) \
226 case op_num: return #op_name;
227#include GENL_MAGIC_INCLUDE_FILE
228 default:
229 return "unknown";
230 }
231}
232
233#ifdef __KERNEL__
234#include <linux/stringify.h>
235/*
236 * Magic: define genl_ops {{{1
237 * {{{2
238 */
239
240#undef GENL_op
241#define GENL_op(op_name, op_num, handler, tla_list) \
242{ \
243 handler \
244 .cmd = op_name, \
245 .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), \
246},
247
248#define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops)
249static struct genl_ops ZZZ_genl_ops[] __read_mostly = {
250#include GENL_MAGIC_INCLUDE_FILE
251};
252
253#undef GENL_op
254#define GENL_op(op_name, op_num, handler, tla_list)
255
256/*
257 * Define the genl_family, multicast groups, {{{1
258 * and provide register/unregister functions.
259 * {{{2
260 */
261#define ZZZ_genl_family CONCAT_(GENL_MAGIC_FAMILY, _genl_family)
262static struct genl_family ZZZ_genl_family __read_mostly = {
263 .id = GENL_ID_GENERATE,
264 .name = __stringify(GENL_MAGIC_FAMILY),
265 .version = GENL_MAGIC_VERSION,
266#ifdef GENL_MAGIC_FAMILY_HDRSZ
267 .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
268#endif
269 .maxattr = ARRAY_SIZE(drbd_tla_nl_policy)-1,
270};
271
272/*
273 * Magic: define multicast groups
274 * Magic: define multicast group registration helper
275 */
276#undef GENL_mc_group
277#define GENL_mc_group(group) \
278static struct genl_multicast_group \
279CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group) __read_mostly = { \
280 .name = #group, \
281}; \
282static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \
283 struct sk_buff *skb, gfp_t flags) \
284{ \
285 unsigned int group_id = \
286 CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id; \
287 if (!group_id) \
288 return -EINVAL; \
289 return genlmsg_multicast(skb, 0, group_id, flags); \
290}
291
292#include GENL_MAGIC_INCLUDE_FILE
293
294int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void)
295{
296 int err = genl_register_family_with_ops(&ZZZ_genl_family,
297 ZZZ_genl_ops, ARRAY_SIZE(ZZZ_genl_ops));
298 if (err)
299 return err;
300#undef GENL_mc_group
301#define GENL_mc_group(group) \
302 err = genl_register_mc_group(&ZZZ_genl_family, \
303 &CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group)); \
304 if (err) \
305 goto fail; \
306 else \
307 pr_info("%s: mcg %s: %u\n", #group, \
308 __stringify(GENL_MAGIC_FAMILY), \
309 CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id);
310
311#include GENL_MAGIC_INCLUDE_FILE
312
313#undef GENL_mc_group
314#define GENL_mc_group(group)
315 return 0;
316fail:
317 genl_unregister_family(&ZZZ_genl_family);
318 return err;
319}
320
321void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void)
322{
323 genl_unregister_family(&ZZZ_genl_family);
324}
325
326/*
327 * Magic: provide conversion functions {{{1
328 * populate skb from struct.
329 * {{{2
330 */
331
332#undef GENL_op
333#define GENL_op(op_name, op_num, handler, tla_list)
334
335#undef GENL_struct
336#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
337static int s_name ## _to_skb(struct sk_buff *skb, struct s_name *s, \
338 const bool exclude_sensitive) \
339{ \
340 struct nlattr *tla = nla_nest_start(skb, tag_number); \
341 if (!tla) \
342 goto nla_put_failure; \
343 DPRINT_TLA(#s_name, "-=>", #tag_name); \
344 s_fields \
345 nla_nest_end(skb, tla); \
346 return 0; \
347 \
348nla_put_failure: \
349 if (tla) \
350 nla_nest_cancel(skb, tla); \
351 return -EMSGSIZE; \
352} \
353static inline int s_name ## _to_priv_skb(struct sk_buff *skb, \
354 struct s_name *s) \
355{ \
356 return s_name ## _to_skb(skb, s, 0); \
357} \
358static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
359 struct s_name *s) \
360{ \
361 return s_name ## _to_skb(skb, s, 1); \
362}
363
364
365#undef __field
366#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
367 __is_signed) \
368 if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
369 DPRINT_FIELD(">>", nla_type, name, s, NULL); \
370 if (__put(skb, attr_nr, s->name)) \
371 goto nla_put_failure; \
372 }
373
374#undef __array
375#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
376 __get, __put, __is_signed) \
377 if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
378 DPRINT_ARRAY(">>",nla_type, name, s, NULL); \
379 if (__put(skb, attr_nr, min_t(int, maxlen, \
380 s->name ## _len + (nla_type == NLA_NUL_STRING)),\
381 s->name)) \
382 goto nla_put_failure; \
383 }
384
385#include GENL_MAGIC_INCLUDE_FILE
386
387
388/* Functions for initializing structs to default values. */
389
390#undef __field
391#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
392 __is_signed)
393#undef __array
394#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
395 __get, __put, __is_signed)
396#undef __u32_field_def
397#define __u32_field_def(attr_nr, attr_flag, name, default) \
398 x->name = default;
399#undef __s32_field_def
400#define __s32_field_def(attr_nr, attr_flag, name, default) \
401 x->name = default;
402#undef __flg_field_def
403#define __flg_field_def(attr_nr, attr_flag, name, default) \
404 x->name = default;
405#undef __str_field_def
406#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
407 memset(x->name, 0, sizeof(x->name)); \
408 x->name ## _len = 0;
409#undef GENL_struct
410#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
411static void set_ ## s_name ## _defaults(struct s_name *x) __attribute__((unused)); \
412static void set_ ## s_name ## _defaults(struct s_name *x) { \
413s_fields \
414}
415
416#include GENL_MAGIC_INCLUDE_FILE
417
418#endif /* __KERNEL__ */
419
420/* }}}1 */
421#endif /* GENL_MAGIC_FUNC_H */
422/* vim: set foldmethod=marker foldlevel=1 nofoldenable : */
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
new file mode 100644
index 000000000000..eecd19b37001
--- /dev/null
+++ b/include/linux/genl_magic_struct.h
@@ -0,0 +1,277 @@
1#ifndef GENL_MAGIC_STRUCT_H
2#define GENL_MAGIC_STRUCT_H
3
4#ifndef GENL_MAGIC_FAMILY
5# error "you need to define GENL_MAGIC_FAMILY before inclusion"
6#endif
7
8#ifndef GENL_MAGIC_VERSION
9# error "you need to define GENL_MAGIC_VERSION before inclusion"
10#endif
11
12#ifndef GENL_MAGIC_INCLUDE_FILE
13# error "you need to define GENL_MAGIC_INCLUDE_FILE before inclusion"
14#endif
15
16#include <linux/genetlink.h>
17#include <linux/types.h>
18
19#define CONCAT__(a,b) a ## b
20#define CONCAT_(a,b) CONCAT__(a,b)
21
22extern int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void);
23extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
24
25/*
26 * Extension of genl attribute validation policies {{{2
27 */
28
29/*
30 * @DRBD_GENLA_F_MANDATORY: By default, netlink ignores attributes it does not
31 * know about. This flag can be set in nlattr->nla_type to indicate that this
32 * attribute must not be ignored.
33 *
34 * We check and remove this flag in drbd_nla_check_mandatory() before
35 * validating the attribute types and lengths via nla_parse_nested().
36 */
37#define DRBD_GENLA_F_MANDATORY (1 << 14)
38
39/*
40 * Flags specific to drbd and not visible at the netlink layer, used in
41 * <struct>_from_attrs and <struct>_to_skb:
42 *
43 * @DRBD_F_REQUIRED: Attribute is required; a request without this attribute is
44 * invalid.
45 *
46 * @DRBD_F_SENSITIVE: Attribute includes sensitive information and must not be
47 * included in unpriviledged get requests or broadcasts.
48 *
49 * @DRBD_F_INVARIANT: Attribute is set when an object is initially created, but
50 * cannot subsequently be changed.
51 */
52#define DRBD_F_REQUIRED (1 << 0)
53#define DRBD_F_SENSITIVE (1 << 1)
54#define DRBD_F_INVARIANT (1 << 2)
55
56#define __nla_type(x) ((__u16)((x) & NLA_TYPE_MASK & ~DRBD_GENLA_F_MANDATORY))
57
58/* }}}1
59 * MAGIC
60 * multi-include macro expansion magic starts here
61 */
62
63/* MAGIC helpers {{{2 */
64
65/* possible field types */
66#define __flg_field(attr_nr, attr_flag, name) \
67 __field(attr_nr, attr_flag, name, NLA_U8, char, \
68 nla_get_u8, nla_put_u8, false)
69#define __u8_field(attr_nr, attr_flag, name) \
70 __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \
71 nla_get_u8, nla_put_u8, false)
72#define __u16_field(attr_nr, attr_flag, name) \
73 __field(attr_nr, attr_flag, name, NLA_U16, __u16, \
74 nla_get_u16, nla_put_u16, false)
75#define __u32_field(attr_nr, attr_flag, name) \
76 __field(attr_nr, attr_flag, name, NLA_U32, __u32, \
77 nla_get_u32, nla_put_u32, false)
78#define __s32_field(attr_nr, attr_flag, name) \
79 __field(attr_nr, attr_flag, name, NLA_U32, __s32, \
80 nla_get_u32, nla_put_u32, true)
81#define __u64_field(attr_nr, attr_flag, name) \
82 __field(attr_nr, attr_flag, name, NLA_U64, __u64, \
83 nla_get_u64, nla_put_u64, false)
84#define __str_field(attr_nr, attr_flag, name, maxlen) \
85 __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \
86 nla_strlcpy, nla_put, false)
87#define __bin_field(attr_nr, attr_flag, name, maxlen) \
88 __array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \
89 nla_memcpy, nla_put, false)
90
91/* fields with default values */
92#define __flg_field_def(attr_nr, attr_flag, name, default) \
93 __flg_field(attr_nr, attr_flag, name)
94#define __u32_field_def(attr_nr, attr_flag, name, default) \
95 __u32_field(attr_nr, attr_flag, name)
96#define __s32_field_def(attr_nr, attr_flag, name, default) \
97 __s32_field(attr_nr, attr_flag, name)
98#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
99 __str_field(attr_nr, attr_flag, name, maxlen)
100
101#define GENL_op_init(args...) args
102#define GENL_doit(handler) \
103 .doit = handler, \
104 .flags = GENL_ADMIN_PERM,
105#define GENL_dumpit(handler) \
106 .dumpit = handler, \
107 .flags = GENL_ADMIN_PERM,
108
109/* }}}1
110 * Magic: define the enum symbols for genl_ops
111 * Magic: define the enum symbols for top level attributes
112 * Magic: define the enum symbols for nested attributes
113 * {{{2
114 */
115
116#undef GENL_struct
117#define GENL_struct(tag_name, tag_number, s_name, s_fields)
118
119#undef GENL_mc_group
120#define GENL_mc_group(group)
121
122#undef GENL_notification
123#define GENL_notification(op_name, op_num, mcast_group, tla_list) \
124 op_name = op_num,
125
126#undef GENL_op
127#define GENL_op(op_name, op_num, handler, tla_list) \
128 op_name = op_num,
129
130enum {
131#include GENL_MAGIC_INCLUDE_FILE
132};
133
134#undef GENL_notification
135#define GENL_notification(op_name, op_num, mcast_group, tla_list)
136
137#undef GENL_op
138#define GENL_op(op_name, op_num, handler, attr_list)
139
140#undef GENL_struct
141#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
142 tag_name = tag_number,
143
144enum {
145#include GENL_MAGIC_INCLUDE_FILE
146};
147
148#undef GENL_struct
149#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
150enum { \
151 s_fields \
152};
153
154#undef __field
155#define __field(attr_nr, attr_flag, name, nla_type, type, \
156 __get, __put, __is_signed) \
157 T_ ## name = (__u16)(attr_nr | ((attr_flag) & DRBD_GENLA_F_MANDATORY)),
158
159#undef __array
160#define __array(attr_nr, attr_flag, name, nla_type, type, \
161 maxlen, __get, __put, __is_signed) \
162 T_ ## name = (__u16)(attr_nr | ((attr_flag) & DRBD_GENLA_F_MANDATORY)),
163
164#include GENL_MAGIC_INCLUDE_FILE
165
166/* }}}1
167 * Magic: compile time assert unique numbers for operations
168 * Magic: -"- unique numbers for top level attributes
169 * Magic: -"- unique numbers for nested attributes
170 * {{{2
171 */
172
173#undef GENL_struct
174#define GENL_struct(tag_name, tag_number, s_name, s_fields)
175
176#undef GENL_op
177#define GENL_op(op_name, op_num, handler, attr_list) \
178 case op_name:
179
180#undef GENL_notification
181#define GENL_notification(op_name, op_num, mcast_group, tla_list) \
182 case op_name:
183
184static inline void ct_assert_unique_operations(void)
185{
186 switch (0) {
187#include GENL_MAGIC_INCLUDE_FILE
188 ;
189 }
190}
191
192#undef GENL_op
193#define GENL_op(op_name, op_num, handler, attr_list)
194
195#undef GENL_notification
196#define GENL_notification(op_name, op_num, mcast_group, tla_list)
197
198#undef GENL_struct
199#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
200 case tag_number:
201
202static inline void ct_assert_unique_top_level_attributes(void)
203{
204 switch (0) {
205#include GENL_MAGIC_INCLUDE_FILE
206 ;
207 }
208}
209
210#undef GENL_struct
211#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
212static inline void ct_assert_unique_ ## s_name ## _attributes(void) \
213{ \
214 switch (0) { \
215 s_fields \
216 ; \
217 } \
218}
219
220#undef __field
221#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
222 __is_signed) \
223 case attr_nr:
224
225#undef __array
226#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
227 __get, __put, __is_signed) \
228 case attr_nr:
229
230#include GENL_MAGIC_INCLUDE_FILE
231
232/* }}}1
233 * Magic: declare structs
234 * struct <name> {
235 * fields
236 * };
237 * {{{2
238 */
239
240#undef GENL_struct
241#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
242struct s_name { s_fields };
243
244#undef __field
245#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
246 __is_signed) \
247 type name;
248
249#undef __array
250#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
251 __get, __put, __is_signed) \
252 type name[maxlen]; \
253 __u32 name ## _len;
254
255#include GENL_MAGIC_INCLUDE_FILE
256
257#undef GENL_struct
258#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
259enum { \
260 s_fields \
261};
262
263#undef __field
264#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
265 is_signed) \
266 F_ ## name ## _IS_SIGNED = is_signed,
267
268#undef __array
269#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
270 __get, __put, is_signed) \
271 F_ ## name ## _IS_SIGNED = is_signed,
272
273#include GENL_MAGIC_INCLUDE_FILE
274
275/* }}}1 */
276#endif /* GENL_MAGIC_STRUCT_H */
277/* vim: set foldmethod=marker nofoldenable : */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 02c1c9710be0..0f615eb23d05 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -30,9 +30,12 @@ struct vm_area_struct;
30#define ___GFP_HARDWALL 0x20000u 30#define ___GFP_HARDWALL 0x20000u
31#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
32#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
33#define ___GFP_KMEMCG 0x100000u
33#define ___GFP_NOTRACK 0x200000u 34#define ___GFP_NOTRACK 0x200000u
35#define ___GFP_NO_KSWAPD 0x400000u
34#define ___GFP_OTHER_NODE 0x800000u 36#define ___GFP_OTHER_NODE 0x800000u
35#define ___GFP_WRITE 0x1000000u 37#define ___GFP_WRITE 0x1000000u
38/* If the above are modified, __GFP_BITS_SHIFT may need updating */
36 39
37/* 40/*
38 * GFP bitmasks.. 41 * GFP bitmasks..
@@ -85,7 +88,9 @@ struct vm_area_struct;
85#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 88#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
86#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 89#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
87 90
91#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 92#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
93#define __GFP_KMEMCG ((__force gfp_t)___GFP_KMEMCG) /* Allocation comes from a memcg-accounted resource */
89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 94#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
90 95
91/* 96/*
@@ -114,7 +119,8 @@ struct vm_area_struct;
114 __GFP_MOVABLE) 119 __GFP_MOVABLE)
115#define GFP_IOFS (__GFP_IO | __GFP_FS) 120#define GFP_IOFS (__GFP_IO | __GFP_FS)
116#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 121#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) 122 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
123 __GFP_NO_KSWAPD)
118 124
119#ifdef CONFIG_NUMA 125#ifdef CONFIG_NUMA
120#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 126#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
@@ -263,7 +269,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
263 269
264static inline int gfp_zonelist(gfp_t flags) 270static inline int gfp_zonelist(gfp_t flags)
265{ 271{
266 if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE)) 272 if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE))
267 return 1; 273 return 1;
268 274
269 return 0; 275 return 0;
@@ -361,6 +367,9 @@ extern void free_pages(unsigned long addr, unsigned int order);
361extern void free_hot_cold_page(struct page *page, int cold); 367extern void free_hot_cold_page(struct page *page, int cold);
362extern void free_hot_cold_page_list(struct list_head *list, int cold); 368extern void free_hot_cold_page_list(struct list_head *list, int cold);
363 369
370extern void __free_memcg_kmem_pages(struct page *page, unsigned int order);
371extern void free_memcg_kmem_pages(unsigned long addr, unsigned int order);
372
364#define __free_page(page) __free_pages((page), 0) 373#define __free_page(page) __free_pages((page), 0)
365#define free_page(addr) free_pages((addr), 0) 374#define free_page(addr) free_pages((addr), 0)
366 375
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 2e31e8b3a190..bfe665621536 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -72,9 +72,9 @@ static inline int irq_to_gpio(unsigned int irq)
72 return -EINVAL; 72 return -EINVAL;
73} 73}
74 74
75#endif 75#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
76 76
77#else 77#else /* ! CONFIG_GENERIC_GPIO */
78 78
79#include <linux/kernel.h> 79#include <linux/kernel.h>
80#include <linux/types.h> 80#include <linux/types.h>
@@ -231,6 +231,21 @@ static inline int irq_to_gpio(unsigned irq)
231 return -EINVAL; 231 return -EINVAL;
232} 232}
233 233
234#endif 234static inline int
235gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
236 unsigned int gpio_offset, unsigned int pin_offset,
237 unsigned int npins)
238{
239 WARN_ON(1);
240 return -EINVAL;
241}
242
243static inline void
244gpiochip_remove_pin_ranges(struct gpio_chip *chip)
245{
246 WARN_ON(1);
247}
248
249#endif /* ! CONFIG_GENERIC_GPIO */
235 250
236#endif /* __LINUX_GPIO_H */ 251#endif /* __LINUX_GPIO_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index cab3da3d0949..624ef3f45c8e 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -4,6 +4,7 @@
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/ftrace_irq.h> 6#include <linux/ftrace_irq.h>
7#include <linux/vtime.h>
7#include <asm/hardirq.h> 8#include <asm/hardirq.h>
8 9
9/* 10/*
@@ -129,16 +130,6 @@ extern void synchronize_irq(unsigned int irq);
129# define synchronize_irq(irq) barrier() 130# define synchronize_irq(irq) barrier()
130#endif 131#endif
131 132
132struct task_struct;
133
134#if !defined(CONFIG_VIRT_CPU_ACCOUNTING) && !defined(CONFIG_IRQ_TIME_ACCOUNTING)
135static inline void vtime_account(struct task_struct *tsk)
136{
137}
138#else
139extern void vtime_account(struct task_struct *tsk);
140#endif
141
142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 133#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
143 134
144static inline void rcu_nmi_enter(void) 135static inline void rcu_nmi_enter(void)
@@ -162,7 +153,7 @@ extern void rcu_nmi_exit(void);
162 */ 153 */
163#define __irq_enter() \ 154#define __irq_enter() \
164 do { \ 155 do { \
165 vtime_account(current); \ 156 vtime_account_irq_enter(current); \
166 add_preempt_count(HARDIRQ_OFFSET); \ 157 add_preempt_count(HARDIRQ_OFFSET); \
167 trace_hardirq_enter(); \ 158 trace_hardirq_enter(); \
168 } while (0) 159 } while (0)
@@ -178,7 +169,7 @@ extern void irq_enter(void);
178#define __irq_exit() \ 169#define __irq_exit() \
179 do { \ 170 do { \
180 trace_hardirq_exit(); \ 171 trace_hardirq_exit(); \
181 vtime_account(current); \ 172 vtime_account_irq_exit(current); \
182 sub_preempt_count(HARDIRQ_OFFSET); \ 173 sub_preempt_count(HARDIRQ_OFFSET); \
183 } while (0) 174 } while (0)
184 175
diff --git a/include/linux/hash.h b/include/linux/hash.h
index 24df9e70406f..61c97ae22e01 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_HASH_H 1#ifndef _LINUX_HASH_H
2#define _LINUX_HASH_H 2#define _LINUX_HASH_H
3/* Fast hashing routine for ints, longs and pointers. 3/* Fast hashing routine for ints, longs and pointers.
4 (C) 2002 William Lee Irwin III, IBM */ 4 (C) 2002 Nadia Yvette Chambers, IBM */
5 5
6/* 6/*
7 * Knuth recommends primes in approximately golden ratio to the maximum 7 * Knuth recommends primes in approximately golden ratio to the maximum
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild
deleted file mode 100644
index 1fb26448faa9..000000000000
--- a/include/linux/hdlc/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += ioctl.h
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index ca8d7e94eb3c..55f277372fed 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -19,7 +19,6 @@
19#ifndef _HID_SENSORS_IDS_H 19#ifndef _HID_SENSORS_IDS_H
20#define _HID_SENSORS_IDS_H 20#define _HID_SENSORS_IDS_H
21 21
22#define HID_UP_SENSOR 0x00200000
23#define HID_MAX_PHY_DEVICES 0xFF 22#define HID_MAX_PHY_DEVICES 0xFF
24 23
25/* Accel 3D (200073) */ 24/* Accel 3D (200073) */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c076041a069e..7330a0fef0c0 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_SENSOR 0x00200000
170 171
171#define HID_USAGE 0x0000ffff 172#define HID_USAGE 0x0000ffff
172 173
@@ -292,6 +293,7 @@ struct hid_item {
292 */ 293 */
293#define HID_GROUP_GENERIC 0x0001 294#define HID_GROUP_GENERIC 0x0001
294#define HID_GROUP_MULTITOUCH 0x0002 295#define HID_GROUP_MULTITOUCH 0x0002
296#define HID_GROUP_SENSOR_HUB 0x0003
295 297
296/* 298/*
297 * This is the global environment of the parser. This information is 299 * This is the global environment of the parser. This information is
@@ -342,6 +344,7 @@ struct hid_collection {
342struct hid_usage { 344struct hid_usage {
343 unsigned hid; /* hid usage code */ 345 unsigned hid; /* hid usage code */
344 unsigned collection_index; /* index into collection array */ 346 unsigned collection_index; /* index into collection array */
347 unsigned usage_index; /* index into usage array */
345 /* hidinput data */ 348 /* hidinput data */
346 __u16 code; /* input driver code */ 349 __u16 code; /* input driver code */
347 __u8 type; /* input driver type */ 350 __u8 type; /* input driver type */
@@ -684,6 +687,7 @@ struct hid_ll_driver {
684 687
685extern int hid_debug; 688extern int hid_debug;
686 689
690extern bool hid_ignore(struct hid_device *);
687extern int hid_add_device(struct hid_device *); 691extern int hid_add_device(struct hid_device *);
688extern void hid_destroy_device(struct hid_device *); 692extern void hid_destroy_device(struct hid_device *);
689 693
@@ -706,6 +710,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int);
706int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 710int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
707struct hid_field *hidinput_get_led_field(struct hid_device *hid); 711struct hid_field *hidinput_get_led_field(struct hid_device *hid);
708unsigned int hidinput_count_leds(struct hid_device *hid); 712unsigned int hidinput_count_leds(struct hid_device *hid);
713__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
709void hid_output_report(struct hid_report *report, __u8 *data); 714void hid_output_report(struct hid_report *report, __u8 *data);
710struct hid_device *hid_allocate_device(void); 715struct hid_device *hid_allocate_device(void);
711struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 716struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -716,6 +721,7 @@ int hid_connect(struct hid_device *hid, unsigned int connect_mask);
716void hid_disconnect(struct hid_device *hid); 721void hid_disconnect(struct hid_device *hid);
717const struct hid_device_id *hid_match_id(struct hid_device *hdev, 722const struct hid_device_id *hid_match_id(struct hid_device *hdev,
718 const struct hid_device_id *id); 723 const struct hid_device_id *id);
724s32 hid_snto32(__u32 value, unsigned n);
719 725
720/** 726/**
721 * hid_map_usage - map usage input bits 727 * hid_map_usage - map usage input bits
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/hsi/Kbuild
+++ /dev/null
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b31cb7da0346..1d76f8ca90f0 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -8,6 +8,10 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct *mm,
8extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, 8extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
9 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, 9 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
10 struct vm_area_struct *vma); 10 struct vm_area_struct *vma);
11extern void huge_pmd_set_accessed(struct mm_struct *mm,
12 struct vm_area_struct *vma,
13 unsigned long address, pmd_t *pmd,
14 pmd_t orig_pmd, int dirty);
11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, 15extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
12 unsigned long address, pmd_t *pmd, 16 unsigned long address, pmd_t *pmd,
13 pmd_t orig_pmd); 17 pmd_t orig_pmd);
@@ -27,7 +31,8 @@ extern int move_huge_pmd(struct vm_area_struct *vma,
27 unsigned long new_addr, unsigned long old_end, 31 unsigned long new_addr, unsigned long old_end,
28 pmd_t *old_pmd, pmd_t *new_pmd); 32 pmd_t *old_pmd, pmd_t *new_pmd);
29extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 33extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
30 unsigned long addr, pgprot_t newprot); 34 unsigned long addr, pgprot_t newprot,
35 int prot_numa);
31 36
32enum transparent_hugepage_flag { 37enum transparent_hugepage_flag {
33 TRANSPARENT_HUGEPAGE_FLAG, 38 TRANSPARENT_HUGEPAGE_FLAG,
@@ -35,6 +40,7 @@ enum transparent_hugepage_flag {
35 TRANSPARENT_HUGEPAGE_DEFRAG_FLAG, 40 TRANSPARENT_HUGEPAGE_DEFRAG_FLAG,
36 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, 41 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG,
37 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, 42 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG,
43 TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG,
38#ifdef CONFIG_DEBUG_VM 44#ifdef CONFIG_DEBUG_VM
39 TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG, 45 TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG,
40#endif 46#endif
@@ -74,6 +80,9 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
74 (transparent_hugepage_flags & \ 80 (transparent_hugepage_flags & \
75 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG) && \ 81 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG) && \
76 (__vma)->vm_flags & VM_HUGEPAGE)) 82 (__vma)->vm_flags & VM_HUGEPAGE))
83#define transparent_hugepage_use_zero_page() \
84 (transparent_hugepage_flags & \
85 (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))
77#ifdef CONFIG_DEBUG_VM 86#ifdef CONFIG_DEBUG_VM
78#define transparent_hugepage_debug_cow() \ 87#define transparent_hugepage_debug_cow() \
79 (transparent_hugepage_flags & \ 88 (transparent_hugepage_flags & \
@@ -91,21 +100,25 @@ extern int handle_pte_fault(struct mm_struct *mm,
91 struct vm_area_struct *vma, unsigned long address, 100 struct vm_area_struct *vma, unsigned long address,
92 pte_t *pte, pmd_t *pmd, unsigned int flags); 101 pte_t *pte, pmd_t *pmd, unsigned int flags);
93extern int split_huge_page(struct page *page); 102extern int split_huge_page(struct page *page);
94extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd); 103extern void __split_huge_page_pmd(struct vm_area_struct *vma,
95#define split_huge_page_pmd(__mm, __pmd) \ 104 unsigned long address, pmd_t *pmd);
105#define split_huge_page_pmd(__vma, __address, __pmd) \
96 do { \ 106 do { \
97 pmd_t *____pmd = (__pmd); \ 107 pmd_t *____pmd = (__pmd); \
98 if (unlikely(pmd_trans_huge(*____pmd))) \ 108 if (unlikely(pmd_trans_huge(*____pmd))) \
99 __split_huge_page_pmd(__mm, ____pmd); \ 109 __split_huge_page_pmd(__vma, __address, \
110 ____pmd); \
100 } while (0) 111 } while (0)
101#define wait_split_huge_page(__anon_vma, __pmd) \ 112#define wait_split_huge_page(__anon_vma, __pmd) \
102 do { \ 113 do { \
103 pmd_t *____pmd = (__pmd); \ 114 pmd_t *____pmd = (__pmd); \
104 anon_vma_lock(__anon_vma); \ 115 anon_vma_lock_write(__anon_vma); \
105 anon_vma_unlock(__anon_vma); \ 116 anon_vma_unlock(__anon_vma); \
106 BUG_ON(pmd_trans_splitting(*____pmd) || \ 117 BUG_ON(pmd_trans_splitting(*____pmd) || \
107 pmd_trans_huge(*____pmd)); \ 118 pmd_trans_huge(*____pmd)); \
108 } while (0) 119 } while (0)
120extern void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address,
121 pmd_t *pmd);
109#if HPAGE_PMD_ORDER > MAX_ORDER 122#if HPAGE_PMD_ORDER > MAX_ORDER
110#error "hugepages can't be allocated by the buddy allocator" 123#error "hugepages can't be allocated by the buddy allocator"
111#endif 124#endif
@@ -159,6 +172,10 @@ static inline struct page *compound_trans_head(struct page *page)
159 } 172 }
160 return page; 173 return page;
161} 174}
175
176extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
177 unsigned long addr, pmd_t pmd, pmd_t *pmdp);
178
162#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 179#else /* CONFIG_TRANSPARENT_HUGEPAGE */
163#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) 180#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
164#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) 181#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
@@ -173,10 +190,12 @@ static inline int split_huge_page(struct page *page)
173{ 190{
174 return 0; 191 return 0;
175} 192}
176#define split_huge_page_pmd(__mm, __pmd) \ 193#define split_huge_page_pmd(__vma, __address, __pmd) \
177 do { } while (0) 194 do { } while (0)
178#define wait_split_huge_page(__anon_vma, __pmd) \ 195#define wait_split_huge_page(__anon_vma, __pmd) \
179 do { } while (0) 196 do { } while (0)
197#define split_huge_page_pmd_mm(__mm, __address, __pmd) \
198 do { } while (0)
180#define compound_trans_head(page) compound_head(page) 199#define compound_trans_head(page) compound_head(page)
181static inline int hugepage_madvise(struct vm_area_struct *vma, 200static inline int hugepage_madvise(struct vm_area_struct *vma,
182 unsigned long *vm_flags, int advice) 201 unsigned long *vm_flags, int advice)
@@ -195,6 +214,13 @@ static inline int pmd_trans_huge_lock(pmd_t *pmd,
195{ 214{
196 return 0; 215 return 0;
197} 216}
217
218static inline int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
219 unsigned long addr, pmd_t pmd, pmd_t *pmdp)
220{
221 return 0;
222}
223
198#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 224#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
199 225
200#endif /* _LINUX_HUGE_MM_H */ 226#endif /* _LINUX_HUGE_MM_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 225164842ab6..0c80d3f57a5b 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -87,7 +87,7 @@ struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
87 pud_t *pud, int write); 87 pud_t *pud, int write);
88int pmd_huge(pmd_t pmd); 88int pmd_huge(pmd_t pmd);
89int pud_huge(pud_t pmd); 89int pud_huge(pud_t pmd);
90void hugetlb_change_protection(struct vm_area_struct *vma, 90unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
91 unsigned long address, unsigned long end, pgprot_t newprot); 91 unsigned long address, unsigned long end, pgprot_t newprot);
92 92
93#else /* !CONFIG_HUGETLB_PAGE */ 93#else /* !CONFIG_HUGETLB_PAGE */
@@ -132,7 +132,11 @@ static inline void copy_huge_page(struct page *dst, struct page *src)
132{ 132{
133} 133}
134 134
135#define hugetlb_change_protection(vma, address, end, newprot) 135static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
136 unsigned long address, unsigned long end, pgprot_t newprot)
137{
138 return 0;
139}
136 140
137static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb, 141static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb,
138 struct vm_area_struct *vma, unsigned long start, 142 struct vm_area_struct *vma, unsigned long start,
@@ -183,7 +187,8 @@ extern const struct file_operations hugetlbfs_file_operations;
183extern const struct vm_operations_struct hugetlb_vm_ops; 187extern const struct vm_operations_struct hugetlb_vm_ops;
184struct file *hugetlb_file_setup(const char *name, unsigned long addr, 188struct file *hugetlb_file_setup(const char *name, unsigned long addr,
185 size_t size, vm_flags_t acct, 189 size_t size, vm_flags_t acct,
186 struct user_struct **user, int creat_flags); 190 struct user_struct **user, int creat_flags,
191 int page_size_log);
187 192
188static inline int is_file_hugepages(struct file *file) 193static inline int is_file_hugepages(struct file *file)
189{ 194{
@@ -195,12 +200,14 @@ static inline int is_file_hugepages(struct file *file)
195 return 0; 200 return 0;
196} 201}
197 202
203
198#else /* !CONFIG_HUGETLBFS */ 204#else /* !CONFIG_HUGETLBFS */
199 205
200#define is_file_hugepages(file) 0 206#define is_file_hugepages(file) 0
201static inline struct file * 207static inline struct file *
202hugetlb_file_setup(const char *name, unsigned long addr, size_t size, 208hugetlb_file_setup(const char *name, unsigned long addr, size_t size,
203 vm_flags_t acctflag, struct user_struct **user, int creat_flags) 209 vm_flags_t acctflag, struct user_struct **user, int creat_flags,
210 int page_size_log)
204{ 211{
205 return ERR_PTR(-ENOSYS); 212 return ERR_PTR(-ENOSYS);
206} 213}
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index d73878c694b3..ce8217f7b5c2 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -62,7 +62,7 @@ extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
62 struct page *page); 62 struct page *page);
63extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, 63extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
64 struct hugetlb_cgroup *h_cg); 64 struct hugetlb_cgroup *h_cg);
65extern int hugetlb_cgroup_file_init(int idx) __init; 65extern void hugetlb_cgroup_file_init(void) __init;
66extern void hugetlb_cgroup_migrate(struct page *oldhpage, 66extern void hugetlb_cgroup_migrate(struct page *oldhpage,
67 struct page *newhpage); 67 struct page *newhpage);
68 68
@@ -111,9 +111,8 @@ hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
111 return; 111 return;
112} 112}
113 113
114static inline int __init hugetlb_cgroup_file_init(int idx) 114static inline void hugetlb_cgroup_file_init(void)
115{ 115{
116 return 0;
117} 116}
118 117
119static inline void hugetlb_cgroup_migrate(struct page *oldhpage, 118static inline void hugetlb_cgroup_migrate(struct page *oldhpage,
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index 6ae9c631a1be..0464c85e63fd 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -1,35 +1,8 @@
1#ifndef _LINUX_HW_BREAKPOINT_H 1#ifndef _LINUX_HW_BREAKPOINT_H
2#define _LINUX_HW_BREAKPOINT_H 2#define _LINUX_HW_BREAKPOINT_H
3 3
4enum {
5 HW_BREAKPOINT_LEN_1 = 1,
6 HW_BREAKPOINT_LEN_2 = 2,
7 HW_BREAKPOINT_LEN_4 = 4,
8 HW_BREAKPOINT_LEN_8 = 8,
9};
10
11enum {
12 HW_BREAKPOINT_EMPTY = 0,
13 HW_BREAKPOINT_R = 1,
14 HW_BREAKPOINT_W = 2,
15 HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
16 HW_BREAKPOINT_X = 4,
17 HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
18};
19
20enum bp_type_idx {
21 TYPE_INST = 0,
22#ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
23 TYPE_DATA = 0,
24#else
25 TYPE_DATA = 1,
26#endif
27 TYPE_MAX
28};
29
30#ifdef __KERNEL__
31
32#include <linux/perf_event.h> 4#include <linux/perf_event.h>
5#include <uapi/linux/hw_breakpoint.h>
33 6
34#ifdef CONFIG_HAVE_HW_BREAKPOINT 7#ifdef CONFIG_HAVE_HW_BREAKPOINT
35 8
@@ -151,6 +124,4 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
151} 124}
152 125
153#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 126#endif /* CONFIG_HAVE_HW_BREAKPOINT */
154#endif /* __KERNEL__ */
155
156#endif /* _LINUX_HW_BREAKPOINT_H */ 127#endif /* _LINUX_HW_BREAKPOINT_H */
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index df804ba73e0b..babe0cf6d56b 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -20,8 +20,6 @@
20#define OMAP_I2C_FLAG_NO_FIFO BIT(0) 20#define OMAP_I2C_FLAG_NO_FIFO BIT(0)
21#define OMAP_I2C_FLAG_SIMPLE_CLOCK BIT(1) 21#define OMAP_I2C_FLAG_SIMPLE_CLOCK BIT(1)
22#define OMAP_I2C_FLAG_16BIT_DATA_REG BIT(2) 22#define OMAP_I2C_FLAG_16BIT_DATA_REG BIT(2)
23#define OMAP_I2C_FLAG_RESET_REGS_POSTIDLE BIT(3)
24#define OMAP_I2C_FLAG_APPLY_ERRATA_I207 BIT(4)
25#define OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK BIT(5) 23#define OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK BIT(5)
26#define OMAP_I2C_FLAG_FORCE_19200_INT_CLK BIT(6) 24#define OMAP_I2C_FLAG_FORCE_19200_INT_CLK BIT(6)
27/* how the CPU address bus must be translated for I2C unit access */ 25/* how the CPU address bus must be translated for I2C unit access */
@@ -34,6 +32,7 @@ struct omap_i2c_bus_platform_data {
34 u32 clkrate; 32 u32 clkrate;
35 u32 rev; 33 u32 rev;
36 u32 flags; 34 u32 flags;
35 void (*set_mpu_wkup_lat)(struct device *dev, long set);
37}; 36};
38 37
39#endif 38#endif
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 800de224336b..d0c4db7b4872 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -259,6 +259,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
259 * @platform_data: stored in i2c_client.dev.platform_data 259 * @platform_data: stored in i2c_client.dev.platform_data
260 * @archdata: copied into i2c_client.dev.archdata 260 * @archdata: copied into i2c_client.dev.archdata
261 * @of_node: pointer to OpenFirmware device node 261 * @of_node: pointer to OpenFirmware device node
262 * @acpi_node: ACPI device node
262 * @irq: stored in i2c_client.irq 263 * @irq: stored in i2c_client.irq
263 * 264 *
264 * I2C doesn't actually support hardware probing, although controllers and 265 * I2C doesn't actually support hardware probing, although controllers and
@@ -279,6 +280,7 @@ struct i2c_board_info {
279 void *platform_data; 280 void *platform_data;
280 struct dev_archdata *archdata; 281 struct dev_archdata *archdata;
281 struct device_node *of_node; 282 struct device_node *of_node;
283 struct acpi_dev_node acpi_node;
282 int irq; 284 int irq;
283}; 285};
284 286
@@ -501,4 +503,11 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
501 i2c_del_driver) 503 i2c_del_driver)
502 504
503#endif /* I2C */ 505#endif /* I2C */
506
507#if IS_ENABLED(CONFIG_ACPI_I2C)
508extern void acpi_i2c_register_devices(struct i2c_adapter *adap);
509#else
510static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) {}
511#endif
512
504#endif /* _LINUX_I2C_H */ 513#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/i2c-hid.h b/include/linux/i2c/i2c-hid.h
new file mode 100644
index 000000000000..60e411d764d4
--- /dev/null
+++ b/include/linux/i2c/i2c-hid.h
@@ -0,0 +1,35 @@
1/*
2 * HID over I2C protocol implementation
3 *
4 * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
5 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#ifndef __LINUX_I2C_HID_H
13#define __LINUX_I2C_HID_H
14
15#include <linux/types.h>
16
17/**
18 * struct i2chid_platform_data - used by hid over i2c implementation.
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
20 *
21 * Note that it is the responsibility of the platform driver (or the acpi 5.0
22 * driver) to setup the irq related to the gpio in the struct i2c_board_info.
23 * The platform driver should also setup the gpio according to the device:
24 *
25 * A typical example is the following:
26 * irq = gpio_to_irq(intr_gpio);
27 * hkdk4412_i2c_devs5[0].irq = irq; // store the irq in i2c_board_info
28 * gpio_request(intr_gpio, "elan-irq");
29 * s3c_gpio_setpull(intr_gpio, S3C_GPIO_PULL_UP);
30 */
31struct i2c_hid_platform_data {
32 u16 hid_descriptor_address;
33};
34
35#endif /* __LINUX_I2C_HID_H */
diff --git a/include/linux/i2c/i2c-sh_mobile.h b/include/linux/i2c/i2c-sh_mobile.h
index beda7081aead..06e3089795fb 100644
--- a/include/linux/i2c/i2c-sh_mobile.h
+++ b/include/linux/i2c/i2c-sh_mobile.h
@@ -5,6 +5,7 @@
5 5
6struct i2c_sh_mobile_platform_data { 6struct i2c_sh_mobile_platform_data {
7 unsigned long bus_speed; 7 unsigned long bus_speed;
8 unsigned int clks_per_count;
8}; 9};
9 10
10#endif /* __I2C_SH_MOBILE_H__ */ 11#endif /* __I2C_SH_MOBILE_H__ */
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h
index 781e6bd06c34..0767a2a6b2f1 100644
--- a/include/linux/i2c/pcf857x.h
+++ b/include/linux/i2c/pcf857x.h
@@ -10,7 +10,6 @@
10 * @setup: optional callback issued once the GPIOs are valid 10 * @setup: optional callback issued once the GPIOs are valid
11 * @teardown: optional callback issued before the GPIOs are invalidated 11 * @teardown: optional callback issued before the GPIOs are invalidated
12 * @context: optional parameter passed to setup() and teardown() 12 * @context: optional parameter passed to setup() and teardown()
13 * @irq: optional interrupt number
14 * 13 *
15 * In addition to the I2C_BOARD_INFO() state appropriate to each chip, 14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
16 * the i2c_board_info used with the pcf875x driver must provide its 15 * the i2c_board_info used with the pcf875x driver must provide its
@@ -40,8 +39,6 @@ struct pcf857x_platform_data {
40 int gpio, unsigned ngpio, 39 int gpio, unsigned ngpio,
41 void *context); 40 void *context);
42 void *context; 41 void *context;
43
44 int irq;
45}; 42};
46 43
47#endif /* __LINUX_PCF857X_H */ 44#endif /* __LINUX_PCF857X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 9a5e28462324..1ff54b114efc 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -39,52 +39,51 @@
39 * address each module uses within a given i2c slave. 39 * address each module uses within a given i2c slave.
40 */ 40 */
41 41
42/* Slave 0 (i2c address 0x48) */ 42enum twl4030_module_ids {
43#define TWL4030_MODULE_USB 0x00 43 TWL4030_MODULE_USB = 0, /* Slave 0 (i2c address 0x48) */
44 44 TWL4030_MODULE_AUDIO_VOICE, /* Slave 1 (i2c address 0x49) */
45/* Slave 1 (i2c address 0x49) */ 45 TWL4030_MODULE_GPIO,
46#define TWL4030_MODULE_AUDIO_VOICE 0x01 46 TWL4030_MODULE_INTBR,
47#define TWL4030_MODULE_GPIO 0x02 47 TWL4030_MODULE_PIH,
48#define TWL4030_MODULE_INTBR 0x03 48
49#define TWL4030_MODULE_PIH 0x04 49 TWL4030_MODULE_TEST,
50#define TWL4030_MODULE_TEST 0x05 50 TWL4030_MODULE_KEYPAD, /* Slave 2 (i2c address 0x4a) */
51 51 TWL4030_MODULE_MADC,
52/* Slave 2 (i2c address 0x4a) */ 52 TWL4030_MODULE_INTERRUPTS,
53#define TWL4030_MODULE_KEYPAD 0x06 53 TWL4030_MODULE_LED,
54#define TWL4030_MODULE_MADC 0x07 54
55#define TWL4030_MODULE_INTERRUPTS 0x08 55 TWL4030_MODULE_MAIN_CHARGE,
56#define TWL4030_MODULE_LED 0x09 56 TWL4030_MODULE_PRECHARGE,
57#define TWL4030_MODULE_MAIN_CHARGE 0x0A 57 TWL4030_MODULE_PWM0,
58#define TWL4030_MODULE_PRECHARGE 0x0B 58 TWL4030_MODULE_PWM1,
59#define TWL4030_MODULE_PWM0 0x0C 59 TWL4030_MODULE_PWMA,
60#define TWL4030_MODULE_PWM1 0x0D 60
61#define TWL4030_MODULE_PWMA 0x0E 61 TWL4030_MODULE_PWMB,
62#define TWL4030_MODULE_PWMB 0x0F 62 TWL5031_MODULE_ACCESSORY,
63 63 TWL5031_MODULE_INTERRUPTS,
64#define TWL5031_MODULE_ACCESSORY 0x10 64 TWL4030_MODULE_BACKUP, /* Slave 3 (i2c address 0x4b) */
65#define TWL5031_MODULE_INTERRUPTS 0x11 65 TWL4030_MODULE_INT,
66 66
67/* Slave 3 (i2c address 0x4b) */ 67 TWL4030_MODULE_PM_MASTER,
68#define TWL4030_MODULE_BACKUP 0x12 68 TWL4030_MODULE_PM_RECEIVER,
69#define TWL4030_MODULE_INT 0x13 69 TWL4030_MODULE_RTC,
70#define TWL4030_MODULE_PM_MASTER 0x14 70 TWL4030_MODULE_SECURED_REG,
71#define TWL4030_MODULE_PM_RECEIVER 0x15 71 TWL4030_MODULE_LAST,
72#define TWL4030_MODULE_RTC 0x16 72};
73#define TWL4030_MODULE_SECURED_REG 0x17
74 73
74/* Similar functionalities implemented in TWL4030/6030 */
75#define TWL_MODULE_USB TWL4030_MODULE_USB 75#define TWL_MODULE_USB TWL4030_MODULE_USB
76#define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
77#define TWL_MODULE_PIH TWL4030_MODULE_PIH 76#define TWL_MODULE_PIH TWL4030_MODULE_PIH
78#define TWL_MODULE_MADC TWL4030_MODULE_MADC
79#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE 77#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
80#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER 78#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
81#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER 79#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
82#define TWL_MODULE_RTC TWL4030_MODULE_RTC 80#define TWL_MODULE_RTC TWL4030_MODULE_RTC
83#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 81#define TWL_MODULE_PWM TWL4030_MODULE_PWM0
82#define TWL_MODULE_LED TWL4030_MODULE_LED
84 83
85#define TWL6030_MODULE_ID0 0x0D 84#define TWL6030_MODULE_ID0 13
86#define TWL6030_MODULE_ID1 0x0E 85#define TWL6030_MODULE_ID1 14
87#define TWL6030_MODULE_ID2 0x0F 86#define TWL6030_MODULE_ID2 15
88 87
89#define GPIO_INTR_OFFSET 0 88#define GPIO_INTR_OFFSET 0
90#define KEYPAD_INTR_OFFSET 1 89#define KEYPAD_INTR_OFFSET 1
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 87259a44c251..de7e190f1af4 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id);
152 152
153void __init idr_init_cache(void); 153void __init idr_init_cache(void);
154 154
155/**
156 * idr_for_each_entry - iterate over an idr's elements of a given type
157 * @idp: idr handle
158 * @entry: the type * to use as cursor
159 * @id: id entry's key
160 */
161#define idr_for_each_entry(idp, entry, id) \
162 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \
163 entry != NULL; \
164 ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
165
155#endif /* __IDR_H__ */ 166#endif /* __IDR_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 2385119f8bb0..f0859cc73861 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -131,6 +131,8 @@
131 131
132#define IEEE80211_MAX_MESH_ID_LEN 32 132#define IEEE80211_MAX_MESH_ID_LEN 32
133 133
134#define IEEE80211_NUM_TIDS 16
135
134#define IEEE80211_QOS_CTL_LEN 2 136#define IEEE80211_QOS_CTL_LEN 2
135/* 1d tag mask */ 137/* 1d tag mask */
136#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 138#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -666,6 +668,21 @@ struct ieee80211_meshconf_ie {
666} __attribute__ ((packed)); 668} __attribute__ ((packed));
667 669
668/** 670/**
671 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
672 *
673 * @IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS: STA is willing to establish
674 * additional mesh peerings with other mesh STAs
675 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs
676 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure
677 * is ongoing
678 */
679enum mesh_config_capab_flags {
680 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
681 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
682 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
683};
684
685/**
669 * struct ieee80211_rann_ie 686 * struct ieee80211_rann_ie
670 * 687 *
671 * This structure refers to "Root Announcement information element" 688 * This structure refers to "Root Announcement information element"
@@ -905,6 +922,38 @@ struct ieee80211_tdls_data {
905 } u; 922 } u;
906} __packed; 923} __packed;
907 924
925/*
926 * Peer-to-Peer IE attribute related definitions.
927 */
928/**
929 * enum ieee80211_p2p_attr_id - identifies type of peer-to-peer attribute.
930 */
931enum ieee80211_p2p_attr_id {
932 IEEE80211_P2P_ATTR_STATUS = 0,
933 IEEE80211_P2P_ATTR_MINOR_REASON,
934 IEEE80211_P2P_ATTR_CAPABILITY,
935 IEEE80211_P2P_ATTR_DEVICE_ID,
936 IEEE80211_P2P_ATTR_GO_INTENT,
937 IEEE80211_P2P_ATTR_GO_CONFIG_TIMEOUT,
938 IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
939 IEEE80211_P2P_ATTR_GROUP_BSSID,
940 IEEE80211_P2P_ATTR_EXT_LISTEN_TIMING,
941 IEEE80211_P2P_ATTR_INTENDED_IFACE_ADDR,
942 IEEE80211_P2P_ATTR_MANAGABILITY,
943 IEEE80211_P2P_ATTR_CHANNEL_LIST,
944 IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
945 IEEE80211_P2P_ATTR_DEVICE_INFO,
946 IEEE80211_P2P_ATTR_GROUP_INFO,
947 IEEE80211_P2P_ATTR_GROUP_ID,
948 IEEE80211_P2P_ATTR_INTERFACE,
949 IEEE80211_P2P_ATTR_OPER_CHANNEL,
950 IEEE80211_P2P_ATTR_INVITE_FLAGS,
951 /* 19 - 220: Reserved */
952 IEEE80211_P2P_ATTR_VENDOR_SPECIFIC = 221,
953
954 IEEE80211_P2P_ATTR_MAX
955};
956
908/** 957/**
909 * struct ieee80211_bar - HT Block Ack Request 958 * struct ieee80211_bar - HT Block Ack Request
910 * 959 *
@@ -1107,20 +1156,6 @@ struct ieee80211_ht_operation {
1107#define WLAN_HT_SMPS_CONTROL_STATIC 1 1156#define WLAN_HT_SMPS_CONTROL_STATIC 1
1108#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3 1157#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3
1109 1158
1110#define VHT_MCS_SUPPORTED_SET_SIZE 8
1111
1112struct ieee80211_vht_capabilities {
1113 __le32 vht_capabilities_info;
1114 u8 vht_supported_mcs_set[VHT_MCS_SUPPORTED_SET_SIZE];
1115} __packed;
1116
1117struct ieee80211_vht_operation {
1118 u8 vht_op_info_chwidth;
1119 u8 vht_op_info_chan_center_freq_seg1_idx;
1120 u8 vht_op_info_chan_center_freq_seg2_idx;
1121 __le16 vht_basic_mcs_set;
1122} __packed;
1123
1124/** 1159/**
1125 * struct ieee80211_vht_mcs_info - VHT MCS information 1160 * struct ieee80211_vht_mcs_info - VHT MCS information
1126 * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams 1161 * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams
@@ -1128,11 +1163,13 @@ struct ieee80211_vht_operation {
1128 * STA can receive. Rate expressed in units of 1 Mbps. 1163 * STA can receive. Rate expressed in units of 1 Mbps.
1129 * If this field is 0 this value should not be used to 1164 * If this field is 0 this value should not be used to
1130 * consider the highest RX data rate supported. 1165 * consider the highest RX data rate supported.
1166 * The top 3 bits of this field are reserved.
1131 * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams 1167 * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams
1132 * @tx_highest: Indicates highest long GI VHT PPDU data rate 1168 * @tx_highest: Indicates highest long GI VHT PPDU data rate
1133 * STA can transmit. Rate expressed in units of 1 Mbps. 1169 * STA can transmit. Rate expressed in units of 1 Mbps.
1134 * If this field is 0 this value should not be used to 1170 * If this field is 0 this value should not be used to
1135 * consider the highest TX data rate supported. 1171 * consider the highest TX data rate supported.
1172 * The top 3 bits of this field are reserved.
1136 */ 1173 */
1137struct ieee80211_vht_mcs_info { 1174struct ieee80211_vht_mcs_info {
1138 __le16 rx_mcs_map; 1175 __le16 rx_mcs_map;
@@ -1141,38 +1178,107 @@ struct ieee80211_vht_mcs_info {
1141 __le16 tx_highest; 1178 __le16 tx_highest;
1142} __packed; 1179} __packed;
1143 1180
1181/**
1182 * enum ieee80211_vht_mcs_support - VHT MCS support definitions
1183 * @IEEE80211_VHT_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the
1184 * number of streams
1185 * @IEEE80211_VHT_MCS_SUPPORT_0_8: MCSes 0-8 are supported
1186 * @IEEE80211_VHT_MCS_SUPPORT_0_9: MCSes 0-9 are supported
1187 * @IEEE80211_VHT_MCS_NOT_SUPPORTED: This number of streams isn't supported
1188 *
1189 * These definitions are used in each 2-bit subfield of the @rx_mcs_map
1190 * and @tx_mcs_map fields of &struct ieee80211_vht_mcs_info, which are
1191 * both split into 8 subfields by number of streams. These values indicate
1192 * which MCSes are supported for the number of streams the value appears
1193 * for.
1194 */
1195enum ieee80211_vht_mcs_support {
1196 IEEE80211_VHT_MCS_SUPPORT_0_7 = 0,
1197 IEEE80211_VHT_MCS_SUPPORT_0_8 = 1,
1198 IEEE80211_VHT_MCS_SUPPORT_0_9 = 2,
1199 IEEE80211_VHT_MCS_NOT_SUPPORTED = 3,
1200};
1201
1202/**
1203 * struct ieee80211_vht_cap - VHT capabilities
1204 *
1205 * This structure is the "VHT capabilities element" as
1206 * described in 802.11ac D3.0 8.4.2.160
1207 * @vht_cap_info: VHT capability info
1208 * @supp_mcs: VHT MCS supported rates
1209 */
1210struct ieee80211_vht_cap {
1211 __le32 vht_cap_info;
1212 struct ieee80211_vht_mcs_info supp_mcs;
1213} __packed;
1214
1215/**
1216 * enum ieee80211_vht_chanwidth - VHT channel width
1217 * @IEEE80211_VHT_CHANWIDTH_USE_HT: use the HT operation IE to
1218 * determine the channel width (20 or 40 MHz)
1219 * @IEEE80211_VHT_CHANWIDTH_80MHZ: 80 MHz bandwidth
1220 * @IEEE80211_VHT_CHANWIDTH_160MHZ: 160 MHz bandwidth
1221 * @IEEE80211_VHT_CHANWIDTH_80P80MHZ: 80+80 MHz bandwidth
1222 */
1223enum ieee80211_vht_chanwidth {
1224 IEEE80211_VHT_CHANWIDTH_USE_HT = 0,
1225 IEEE80211_VHT_CHANWIDTH_80MHZ = 1,
1226 IEEE80211_VHT_CHANWIDTH_160MHZ = 2,
1227 IEEE80211_VHT_CHANWIDTH_80P80MHZ = 3,
1228};
1229
1230/**
1231 * struct ieee80211_vht_operation - VHT operation IE
1232 *
1233 * This structure is the "VHT operation element" as
1234 * described in 802.11ac D3.0 8.4.2.161
1235 * @chan_width: Operating channel width
1236 * @center_freq_seg1_idx: center freq segment 1 index
1237 * @center_freq_seg2_idx: center freq segment 2 index
1238 * @basic_mcs_set: VHT Basic MCS rate set
1239 */
1240struct ieee80211_vht_operation {
1241 u8 chan_width;
1242 u8 center_freq_seg1_idx;
1243 u8 center_freq_seg2_idx;
1244 __le16 basic_mcs_set;
1245} __packed;
1246
1247
1144#define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0 1248#define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0
1145#define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1 1249#define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1
1146#define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2 1250#define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2
1147#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3 1251#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3
1148 1252
1149/* 802.11ac VHT Capabilities */ 1253/* 802.11ac VHT Capabilities */
1150#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 1254#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
1151#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 1255#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
1152#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 1256#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1153#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 1257#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1154#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 1258#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1155#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 1259#define IEEE80211_VHT_CAP_RXLDPC 0x00000010
1156#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 1260#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
1157#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 1261#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
1158#define IEEE80211_VHT_CAP_TXSTBC 0x00000080 1262#define IEEE80211_VHT_CAP_TXSTBC 0x00000080
1159#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 1263#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100
1160#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 1264#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200
1161#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 1265#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
1162#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 1266#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
1163#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 1267#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1164#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 1268#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1165#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 1269#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000
1166#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000 1270#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000
1167#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 1271#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1168#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 1272#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1169#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 1273#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
1170#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 1274#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000
1171#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT 0x00800000 1275#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23
1172#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000 1276#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
1173#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 1277 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)
1174#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 1278#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000
1175#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 1279#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000
1280#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
1281#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
1176 1282
1177/* Authentication algorithms */ 1283/* Authentication algorithms */
1178#define WLAN_AUTH_OPEN 0 1284#define WLAN_AUTH_OPEN 0
@@ -1440,8 +1546,6 @@ enum ieee80211_eid {
1440 1546
1441 WLAN_EID_RSN = 48, 1547 WLAN_EID_RSN = 48,
1442 WLAN_EID_MMIE = 76, 1548 WLAN_EID_MMIE = 76,
1443 WLAN_EID_WPA = 221,
1444 WLAN_EID_GENERIC = 221,
1445 WLAN_EID_VENDOR_SPECIFIC = 221, 1549 WLAN_EID_VENDOR_SPECIFIC = 221,
1446 WLAN_EID_QOS_PARAMETER = 222, 1550 WLAN_EID_QOS_PARAMETER = 222,
1447 1551
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 1cc595a67cc9..f4e56ecd0b1a 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -4,5 +4,22 @@
4#include <linux/ip.h> 4#include <linux/ip.h>
5#include <linux/in6.h> 5#include <linux/in6.h>
6#include <uapi/linux/if_tunnel.h> 6#include <uapi/linux/if_tunnel.h>
7#include <linux/u64_stats_sync.h>
8
9/*
10 * Locking : hash tables are protected by RCU and RTNL
11 */
12
13#define for_each_ip_tunnel_rcu(pos, start) \
14 for (pos = rcu_dereference(start); pos; pos = rcu_dereference(pos->next))
15
16/* often modified stats are per cpu, other are shared (netdev->stats) */
17struct pcpu_tstats {
18 u64 rx_packets;
19 u64 rx_bytes;
20 u64 tx_packets;
21 u64 tx_bytes;
22 struct u64_stats_sync syncp;
23};
7 24
8#endif /* _IF_TUNNEL_H_ */ 25#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index c629b3a1d9a9..f3eea18fdf46 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -66,7 +66,8 @@ struct iio_buffer_access_funcs {
66 * @stufftoread: [INTERN] flag to indicate new data. 66 * @stufftoread: [INTERN] flag to indicate new data.
67 * @demux_list: [INTERN] list of operations required to demux the scan. 67 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 **/ 69 * @buffer_list: [INTERN] entry in the devices list of current buffers.
70 */
70struct iio_buffer { 71struct iio_buffer {
71 int length; 72 int length;
72 int bytes_per_datum; 73 int bytes_per_datum;
@@ -81,9 +82,22 @@ struct iio_buffer {
81 const struct attribute_group *attrs; 82 const struct attribute_group *attrs;
82 struct list_head demux_list; 83 struct list_head demux_list;
83 unsigned char *demux_bounce; 84 unsigned char *demux_bounce;
85 struct list_head buffer_list;
84}; 86};
85 87
86/** 88/**
89 * iio_update_buffers() - add or remove buffer from active list
90 * @indio_dev: device to add buffer to
91 * @insert_buffer: buffer to insert
92 * @remove_buffer: buffer_to_remove
93 *
94 * Note this will tear down the all buffering and build it up again
95 */
96int iio_update_buffers(struct iio_dev *indio_dev,
97 struct iio_buffer *insert_buffer,
98 struct iio_buffer *remove_buffer);
99
100/**
87 * iio_buffer_init() - Initialize the buffer structure 101 * iio_buffer_init() - Initialize the buffer structure
88 * @buffer: buffer to be initialized 102 * @buffer: buffer to be initialized
89 **/ 103 **/
@@ -115,11 +129,11 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
115 struct iio_buffer *buffer, int bit); 129 struct iio_buffer *buffer, int bit);
116 130
117/** 131/**
118 * iio_push_to_buffer() - push to a registered buffer. 132 * iio_push_to_buffers() - push to a registered buffer.
119 * @buffer: IIO buffer structure for device 133 * @indio_dev: iio_dev structure for device.
120 * @data: the data to push to the buffer 134 * @data: Full scan.
121 */ 135 */
122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data); 136int iio_push_to_buffers(struct iio_dev *indio_dev, unsigned char *data);
123 137
124int iio_update_demux(struct iio_dev *indio_dev); 138int iio_update_demux(struct iio_dev *indio_dev);
125 139
@@ -181,7 +195,7 @@ bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
181#else /* CONFIG_IIO_BUFFER */ 195#else /* CONFIG_IIO_BUFFER */
182 196
183static inline int iio_buffer_register(struct iio_dev *indio_dev, 197static inline int iio_buffer_register(struct iio_dev *indio_dev,
184 struct iio_chan_spec *channels, 198 const struct iio_chan_spec *channels,
185 int num_channels) 199 int num_channels)
186{ 200{
187 return 0; 201 return 0;
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index e875bcf0478f..16c35ac045bd 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -9,6 +9,8 @@
9 */ 9 */
10#ifndef _IIO_INKERN_CONSUMER_H_ 10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H_ 11#define _IIO_INKERN_CONSUMER_H_
12
13#include <linux/types.h>
12#include <linux/iio/types.h> 14#include <linux/iio/types.h>
13 15
14struct iio_dev; 16struct iio_dev;
@@ -18,10 +20,12 @@ struct iio_chan_spec;
18 * struct iio_channel - everything needed for a consumer to use a channel 20 * struct iio_channel - everything needed for a consumer to use a channel
19 * @indio_dev: Device on which the channel exists. 21 * @indio_dev: Device on which the channel exists.
20 * @channel: Full description of the channel. 22 * @channel: Full description of the channel.
23 * @data: Data about the channel used by consumer.
21 */ 24 */
22struct iio_channel { 25struct iio_channel {
23 struct iio_dev *indio_dev; 26 struct iio_dev *indio_dev;
24 const struct iio_chan_spec *channel; 27 const struct iio_chan_spec *channel;
28 void *data;
25}; 29};
26 30
27/** 31/**
@@ -59,6 +63,52 @@ struct iio_channel *iio_channel_get_all(const char *name);
59 */ 63 */
60void iio_channel_release_all(struct iio_channel *chan); 64void iio_channel_release_all(struct iio_channel *chan);
61 65
66struct iio_cb_buffer;
67/**
68 * iio_channel_get_all_cb() - register callback for triggered capture
69 * @name: Name of client device.
70 * @cb: Callback function.
71 * @private: Private data passed to callback.
72 *
73 * NB right now we have no ability to mux data from multiple devices.
74 * So if the channels requested come from different devices this will
75 * fail.
76 */
77struct iio_cb_buffer *iio_channel_get_all_cb(const char *name,
78 int (*cb)(u8 *data,
79 void *private),
80 void *private);
81/**
82 * iio_channel_release_all_cb() - release and unregister the callback.
83 * @cb_buffer: The callback buffer that was allocated.
84 */
85void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buffer);
86
87/**
88 * iio_channel_start_all_cb() - start the flow of data through callback.
89 * @cb_buff: The callback buffer we are starting.
90 */
91int iio_channel_start_all_cb(struct iio_cb_buffer *cb_buff);
92
93/**
94 * iio_channel_stop_all_cb() - stop the flow of data through the callback.
95 * @cb_buff: The callback buffer we are stopping.
96 */
97void iio_channel_stop_all_cb(struct iio_cb_buffer *cb_buff);
98
99/**
100 * iio_channel_cb_get_channels() - get access to the underlying channels.
101 * @cb_buff: The callback buffer from whom we want the channel
102 * information.
103 *
104 * This function allows one to obtain information about the channels.
105 * Whilst this may allow direct reading if all buffers are disabled, the
106 * primary aim is to allow drivers that are consuming a channel to query
107 * things like scaling of the channel.
108 */
109struct iio_channel
110*iio_channel_cb_get_channels(const struct iio_cb_buffer *cb_buffer);
111
62/** 112/**
63 * iio_read_channel_raw() - read from a given channel 113 * iio_read_channel_raw() - read from a given channel
64 * @chan: The channel being queried. 114 * @chan: The channel being queried.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 7806c24e5bc8..da8c776ba0bd 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -410,6 +410,7 @@ struct iio_buffer_setup_ops {
410 * and owner 410 * and owner
411 * @event_interface: [INTERN] event chrdevs associated with interrupt lines 411 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
412 * @buffer: [DRIVER] any buffer present 412 * @buffer: [DRIVER] any buffer present
413 * @buffer_list: [INTERN] list of all buffers currently attached
413 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux 414 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
414 * @mlock: [INTERN] lock used to prevent simultaneous device state 415 * @mlock: [INTERN] lock used to prevent simultaneous device state
415 * changes 416 * changes
@@ -448,6 +449,7 @@ struct iio_dev {
448 struct iio_event_interface *event_interface; 449 struct iio_event_interface *event_interface;
449 450
450 struct iio_buffer *buffer; 451 struct iio_buffer *buffer;
452 struct list_head buffer_list;
451 int scan_bytes; 453 int scan_bytes;
452 struct mutex mlock; 454 struct mutex mlock;
453 455
@@ -618,6 +620,9 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
618}; 620};
619#endif 621#endif
620 622
623int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
624 int *fract);
625
621/** 626/**
622 * IIO_DEGREE_TO_RAD() - Convert degree to rad 627 * IIO_DEGREE_TO_RAD() - Convert degree to rad
623 * @deg: A value in degree 628 * @deg: A value in degree
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
new file mode 100644
index 000000000000..ff781dca2e9a
--- /dev/null
+++ b/include/linux/iio/imu/adis.h
@@ -0,0 +1,280 @@
1/*
2 * Common library for ADIS16XXX devices
3 *
4 * Copyright 2012 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef __IIO_ADIS_H__
11#define __IIO_ADIS_H__
12
13#include <linux/spi/spi.h>
14#include <linux/interrupt.h>
15#include <linux/iio/types.h>
16
17#define ADIS_WRITE_REG(reg) ((0x80 | (reg)))
18#define ADIS_READ_REG(reg) ((reg) & 0x7f)
19
20#define ADIS_PAGE_SIZE 0x80
21#define ADIS_REG_PAGE_ID 0x00
22
23struct adis;
24
25/**
26 * struct adis_data - ADIS chip variant specific data
27 * @read_delay: SPI delay for read operations in us
28 * @write_delay: SPI delay for write operations in us
29 * @glob_cmd_reg: Register address of the GLOB_CMD register
30 * @msc_ctrl_reg: Register address of the MSC_CTRL register
31 * @diag_stat_reg: Register address of the DIAG_STAT register
32 * @status_error_msgs: Array of error messgaes
33 * @status_error_mask:
34 */
35struct adis_data {
36 unsigned int read_delay;
37 unsigned int write_delay;
38
39 unsigned int glob_cmd_reg;
40 unsigned int msc_ctrl_reg;
41 unsigned int diag_stat_reg;
42
43 unsigned int self_test_mask;
44 unsigned int startup_delay;
45
46 const char * const *status_error_msgs;
47 unsigned int status_error_mask;
48
49 int (*enable_irq)(struct adis *adis, bool enable);
50
51 bool has_paging;
52};
53
54struct adis {
55 struct spi_device *spi;
56 struct iio_trigger *trig;
57
58 const struct adis_data *data;
59
60 struct mutex txrx_lock;
61 struct spi_message msg;
62 struct spi_transfer *xfer;
63 unsigned int current_page;
64 void *buffer;
65
66 uint8_t tx[10] ____cacheline_aligned;
67 uint8_t rx[4];
68};
69
70int adis_init(struct adis *adis, struct iio_dev *indio_dev,
71 struct spi_device *spi, const struct adis_data *data);
72int adis_reset(struct adis *adis);
73
74int adis_write_reg(struct adis *adis, unsigned int reg,
75 unsigned int val, unsigned int size);
76int adis_read_reg(struct adis *adis, unsigned int reg,
77 unsigned int *val, unsigned int size);
78
79/**
80 * adis_write_reg_8() - Write single byte to a register
81 * @adis: The adis device
82 * @reg: The address of the register to be written
83 * @value: The value to write
84 */
85static inline int adis_write_reg_8(struct adis *adis, unsigned int reg,
86 uint8_t val)
87{
88 return adis_write_reg(adis, reg, val, 1);
89}
90
91/**
92 * adis_write_reg_16() - Write 2 bytes to a pair of registers
93 * @adis: The adis device
94 * @reg: The address of the lower of the two registers
95 * @value: Value to be written
96 */
97static inline int adis_write_reg_16(struct adis *adis, unsigned int reg,
98 uint16_t val)
99{
100 return adis_write_reg(adis, reg, val, 2);
101}
102
103/**
104 * adis_write_reg_32() - write 4 bytes to four registers
105 * @adis: The adis device
106 * @reg: The address of the lower of the four register
107 * @value: Value to be written
108 */
109static inline int adis_write_reg_32(struct adis *adis, unsigned int reg,
110 uint32_t val)
111{
112 return adis_write_reg(adis, reg, val, 4);
113}
114
115/**
116 * adis_read_reg_16() - read 2 bytes from a 16-bit register
117 * @adis: The adis device
118 * @reg: The address of the lower of the two registers
119 * @val: The value read back from the device
120 */
121static inline int adis_read_reg_16(struct adis *adis, unsigned int reg,
122 uint16_t *val)
123{
124 unsigned int tmp;
125 int ret;
126
127 ret = adis_read_reg(adis, reg, &tmp, 2);
128 *val = tmp;
129
130 return ret;
131}
132
133/**
134 * adis_read_reg_32() - read 4 bytes from a 32-bit register
135 * @adis: The adis device
136 * @reg: The address of the lower of the two registers
137 * @val: The value read back from the device
138 */
139static inline int adis_read_reg_32(struct adis *adis, unsigned int reg,
140 uint32_t *val)
141{
142 unsigned int tmp;
143 int ret;
144
145 ret = adis_read_reg(adis, reg, &tmp, 4);
146 *val = tmp;
147
148 return ret;
149}
150
151int adis_enable_irq(struct adis *adis, bool enable);
152int adis_check_status(struct adis *adis);
153
154int adis_initial_startup(struct adis *adis);
155
156int adis_single_conversion(struct iio_dev *indio_dev,
157 const struct iio_chan_spec *chan, unsigned int error_mask,
158 int *val);
159
160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \
161 .type = IIO_VOLTAGE, \
162 .indexed = 1, \
163 .channel = (chan), \
164 .extend_name = name, \
165 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
166 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
167 .address = (addr), \
168 .scan_index = (si), \
169 .scan_type = { \
170 .sign = 'u', \
171 .realbits = (bits), \
172 .storagebits = 16, \
173 .endianness = IIO_BE, \
174 }, \
175}
176
177#define ADIS_SUPPLY_CHAN(addr, si, bits) \
178 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits)
179
180#define ADIS_AUX_ADC_CHAN(addr, si, bits) \
181 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits)
182
183#define ADIS_TEMP_CHAN(addr, si, bits) { \
184 .type = IIO_TEMP, \
185 .indexed = 1, \
186 .channel = 0, \
187 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
188 IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \
189 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
190 .address = (addr), \
191 .scan_index = (si), \
192 .scan_type = { \
193 .sign = 'u', \
194 .realbits = (bits), \
195 .storagebits = 16, \
196 .endianness = IIO_BE, \
197 }, \
198}
199
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \
201 .type = (_type), \
202 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
205 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
206 info, \
207 .address = (addr), \
208 .scan_index = (si), \
209 .scan_type = { \
210 .sign = 's', \
211 .realbits = (bits), \
212 .storagebits = 16, \
213 .endianness = IIO_BE, \
214 }, \
215}
216
217#define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits)
219
220#define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits)
222
223#define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits)
225
226#define ADIS_ROT_CHAN(mod, addr, si, info, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits)
228
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230
231int adis_setup_buffer_and_trigger(struct adis *adis,
232 struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *));
233void adis_cleanup_buffer_and_trigger(struct adis *adis,
234 struct iio_dev *indio_dev);
235
236int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev);
237void adis_remove_trigger(struct adis *adis);
238
239int adis_update_scan_mode(struct iio_dev *indio_dev,
240 const unsigned long *scan_mask);
241
242#else /* CONFIG_IIO_BUFFER */
243
244static inline int adis_setup_buffer_and_trigger(struct adis *adis,
245 struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *))
246{
247 return 0;
248}
249
250static inline void adis_cleanup_buffer_and_trigger(struct adis *adis,
251 struct iio_dev *indio_dev)
252{
253}
254
255static inline int adis_probe_trigger(struct adis *adis,
256 struct iio_dev *indio_dev)
257{
258 return 0;
259}
260
261static inline void adis_remove_trigger(struct adis *adis)
262{
263}
264
265#define adis_update_scan_mode NULL
266
267#endif /* CONFIG_IIO_BUFFER */
268
269#ifdef CONFIG_DEBUG_FS
270
271int adis_debugfs_reg_access(struct iio_dev *indio_dev,
272 unsigned int reg, unsigned int writeval, unsigned int *readval);
273
274#else
275
276#define adis_debugfs_reg_access NULL
277
278#endif
279
280#endif
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
index 809a3f08d5a5..1601a2a63a72 100644
--- a/include/linux/iio/machine.h
+++ b/include/linux/iio/machine.h
@@ -19,11 +19,13 @@
19 * @consumer_dev_name: Name to uniquely identify the consumer device. 19 * @consumer_dev_name: Name to uniquely identify the consumer device.
20 * @consumer_channel: Unique name used to identify the channel on the 20 * @consumer_channel: Unique name used to identify the channel on the
21 * consumer side. 21 * consumer side.
22 * @consumer_data: Data about the channel for use by the consumer driver.
22 */ 23 */
23struct iio_map { 24struct iio_map {
24 const char *adc_channel_label; 25 const char *adc_channel_label;
25 const char *consumer_dev_name; 26 const char *consumer_dev_name;
26 const char *consumer_channel; 27 const char *consumer_channel;
28 void *consumer_data;
27}; 29};
28 30
29#endif 31#endif
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 5c647ecfd5ba..88bf0f0d27b4 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -28,6 +28,7 @@ enum iio_chan_type {
28 IIO_CAPACITANCE, 28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE, 29 IIO_ALTVOLTAGE,
30 IIO_CCT, 30 IIO_CCT,
31 IIO_PRESSURE,
31}; 32};
32 33
33enum iio_modifier { 34enum iio_modifier {
@@ -58,5 +59,6 @@ enum iio_modifier {
58#define IIO_VAL_INT_PLUS_NANO 3 59#define IIO_VAL_INT_PLUS_NANO 3
59#define IIO_VAL_INT_PLUS_MICRO_DB 4 60#define IIO_VAL_INT_PLUS_MICRO_DB 4
60#define IIO_VAL_FRACTIONAL 10 61#define IIO_VAL_FRACTIONAL 10
62#define IIO_VAL_FRACTIONAL_LOG2 11
61 63
62#endif /* _IIO_TYPES_H_ */ 64#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 2c7223d7e73b..86c361e947b9 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -18,6 +18,7 @@ extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_file_check(struct file *file, int mask); 18extern 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);
21 22
22#else 23#else
23static inline int ima_bprm_check(struct linux_binprm *bprm) 24static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -40,6 +41,11 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
40 return 0; 41 return 0;
41} 42}
42 43
44static inline int ima_module_check(struct file *file)
45{
46 return 0;
47}
48
43#endif /* CONFIG_IMA_H */ 49#endif /* CONFIG_IMA_H */
44 50
45#ifdef CONFIG_IMA_APPRAISE 51#ifdef CONFIG_IMA_APPRAISE
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index d032780d0ce5..a9d828976a77 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -171,6 +171,9 @@ struct in_ifaddr {
171extern int register_inetaddr_notifier(struct notifier_block *nb); 171extern int register_inetaddr_notifier(struct notifier_block *nb);
172extern int unregister_inetaddr_notifier(struct notifier_block *nb); 172extern int unregister_inetaddr_notifier(struct notifier_block *nb);
173 173
174extern void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,
175 struct ipv4_devconf *devconf);
176
174extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref); 177extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
175static inline struct net_device *ip_dev_find(struct net *net, __be32 addr) 178static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
176{ 179{
diff --git a/include/linux/init.h b/include/linux/init.h
index e59041e21df3..a799273714ac 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,13 +93,13 @@
93 93
94#define __exit __section(.exit.text) __exitused __cold notrace 94#define __exit __section(.exit.text) __exitused __cold notrace
95 95
96/* Used for HOTPLUG */ 96/* Used for HOTPLUG, but that is always enabled now, so just make them noops */
97#define __devinit __section(.devinit.text) __cold notrace 97#define __devinit
98#define __devinitdata __section(.devinit.data) 98#define __devinitdata
99#define __devinitconst __constsection(.devinit.rodata) 99#define __devinitconst
100#define __devexit __section(.devexit.text) __exitused __cold notrace 100#define __devexit
101#define __devexitdata __section(.devexit.data) 101#define __devexitdata
102#define __devexitconst __constsection(.devexit.rodata) 102#define __devexitconst
103 103
104/* Used for HOTPLUG_CPU */ 104/* Used for HOTPLUG_CPU */
105#define __cpuinit __section(.cpuinit.text) __cold notrace 105#define __cpuinit __section(.cpuinit.text) __cold notrace
@@ -126,10 +126,6 @@
126#define __INITRODATA .section ".init.rodata","a",%progbits 126#define __INITRODATA .section ".init.rodata","a",%progbits
127#define __FINITDATA .previous 127#define __FINITDATA .previous
128 128
129#define __DEVINIT .section ".devinit.text", "ax"
130#define __DEVINITDATA .section ".devinit.data", "aw"
131#define __DEVINITRODATA .section ".devinit.rodata", "a"
132
133#define __CPUINIT .section ".cpuinit.text", "ax" 129#define __CPUINIT .section ".cpuinit.text", "ax"
134#define __CPUINITDATA .section ".cpuinit.data", "aw" 130#define __CPUINITDATA .section ".cpuinit.data", "aw"
135#define __CPUINITRODATA .section ".cpuinit.rodata", "a" 131#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
@@ -186,16 +182,16 @@ extern bool initcall_debug;
186 * can point at the same handler without causing duplicate-symbol build errors. 182 * can point at the same handler without causing duplicate-symbol build errors.
187 */ 183 */
188 184
189#define __define_initcall(level,fn,id) \ 185#define __define_initcall(fn, id) \
190 static initcall_t __initcall_##fn##id __used \ 186 static initcall_t __initcall_##fn##id __used \
191 __attribute__((__section__(".initcall" level ".init"))) = fn 187 __attribute__((__section__(".initcall" #id ".init"))) = fn
192 188
193/* 189/*
194 * Early initcalls run before initializing SMP. 190 * Early initcalls run before initializing SMP.
195 * 191 *
196 * Only for built-in code, not modules. 192 * Only for built-in code, not modules.
197 */ 193 */
198#define early_initcall(fn) __define_initcall("early",fn,early) 194#define early_initcall(fn) __define_initcall(fn, early)
199 195
200/* 196/*
201 * A "pure" initcall has no dependencies on anything else, and purely 197 * A "pure" initcall has no dependencies on anything else, and purely
@@ -204,23 +200,23 @@ extern bool initcall_debug;
204 * This only exists for built-in code, not for modules. 200 * This only exists for built-in code, not for modules.
205 * Keep main.c:initcall_level_names[] in sync. 201 * Keep main.c:initcall_level_names[] in sync.
206 */ 202 */
207#define pure_initcall(fn) __define_initcall("0",fn,0) 203#define pure_initcall(fn) __define_initcall(fn, 0)
208 204
209#define core_initcall(fn) __define_initcall("1",fn,1) 205#define core_initcall(fn) __define_initcall(fn, 1)
210#define core_initcall_sync(fn) __define_initcall("1s",fn,1s) 206#define core_initcall_sync(fn) __define_initcall(fn, 1s)
211#define postcore_initcall(fn) __define_initcall("2",fn,2) 207#define postcore_initcall(fn) __define_initcall(fn, 2)
212#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s) 208#define postcore_initcall_sync(fn) __define_initcall(fn, 2s)
213#define arch_initcall(fn) __define_initcall("3",fn,3) 209#define arch_initcall(fn) __define_initcall(fn, 3)
214#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s) 210#define arch_initcall_sync(fn) __define_initcall(fn, 3s)
215#define subsys_initcall(fn) __define_initcall("4",fn,4) 211#define subsys_initcall(fn) __define_initcall(fn, 4)
216#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s) 212#define subsys_initcall_sync(fn) __define_initcall(fn, 4s)
217#define fs_initcall(fn) __define_initcall("5",fn,5) 213#define fs_initcall(fn) __define_initcall(fn, 5)
218#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s) 214#define fs_initcall_sync(fn) __define_initcall(fn, 5s)
219#define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs) 215#define rootfs_initcall(fn) __define_initcall(fn, rootfs)
220#define device_initcall(fn) __define_initcall("6",fn,6) 216#define device_initcall(fn) __define_initcall(fn, 6)
221#define device_initcall_sync(fn) __define_initcall("6s",fn,6s) 217#define device_initcall_sync(fn) __define_initcall(fn, 6s)
222#define late_initcall(fn) __define_initcall("7",fn,7) 218#define late_initcall(fn) __define_initcall(fn, 7)
223#define late_initcall_sync(fn) __define_initcall("7s",fn,7s) 219#define late_initcall_sync(fn) __define_initcall(fn, 7s)
224 220
225#define __initcall(fn) device_initcall(fn) 221#define __initcall(fn) device_initcall(fn)
226 222
diff --git a/include/linux/input.h b/include/linux/input.h
index cab994ba6d91..82ce323b9986 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -112,6 +112,11 @@ struct input_value {
112 * @h_list: list of input handles associated with the device. When 112 * @h_list: list of input handles associated with the device. When
113 * accessing the list dev->mutex must be held 113 * accessing the list dev->mutex must be held
114 * @node: used to place the device onto input_dev_list 114 * @node: used to place the device onto input_dev_list
115 * @num_vals: number of values queued in the current frame
116 * @max_vals: maximum number of values queued in a frame
117 * @vals: array of values queued in the current frame
118 * @devres_managed: indicates that devices is managed with devres framework
119 * and needs not be explicitly unregistered or freed.
115 */ 120 */
116struct input_dev { 121struct input_dev {
117 const char *name; 122 const char *name;
@@ -180,6 +185,8 @@ struct input_dev {
180 unsigned int num_vals; 185 unsigned int num_vals;
181 unsigned int max_vals; 186 unsigned int max_vals;
182 struct input_value *vals; 187 struct input_value *vals;
188
189 bool devres_managed;
183}; 190};
184#define to_input_dev(d) container_of(d, struct input_dev, dev) 191#define to_input_dev(d) container_of(d, struct input_dev, dev)
185 192
@@ -323,7 +330,8 @@ struct input_handle {
323 struct list_head h_node; 330 struct list_head h_node;
324}; 331};
325 332
326struct input_dev *input_allocate_device(void); 333struct input_dev __must_check *input_allocate_device(void);
334struct input_dev __must_check *devm_input_allocate_device(struct device *);
327void input_free_device(struct input_dev *dev); 335void input_free_device(struct input_dev *dev);
328 336
329static inline struct input_dev *input_get_device(struct input_dev *dev) 337static inline struct input_dev *input_get_device(struct input_dev *dev)
diff --git a/include/linux/input/bu21013.h b/include/linux/input/bu21013.h
index 05e03284b92a..6230d76bde5d 100644
--- a/include/linux/input/bu21013.h
+++ b/include/linux/input/bu21013.h
@@ -9,13 +9,10 @@
9 9
10/** 10/**
11 * struct bu21013_platform_device - Handle the platform data 11 * struct bu21013_platform_device - Handle the platform data
12 * @cs_en: pointer to the cs enable function
13 * @cs_dis: pointer to the cs disable function
14 * @irq_read_val: pointer to read the pen irq value function
15 * @touch_x_max: touch x max 12 * @touch_x_max: touch x max
16 * @touch_y_max: touch y max 13 * @touch_y_max: touch y max
17 * @cs_pin: chip select pin 14 * @cs_pin: chip select pin
18 * @irq: irq pin 15 * @touch_pin: touch gpio pin
19 * @ext_clk: external clock flag 16 * @ext_clk: external clock flag
20 * @x_flip: x flip flag 17 * @x_flip: x flip flag
21 * @y_flip: y flip flag 18 * @y_flip: y flip flag
@@ -24,13 +21,10 @@
24 * This is used to handle the platform data 21 * This is used to handle the platform data
25 */ 22 */
26struct bu21013_platform_device { 23struct bu21013_platform_device {
27 int (*cs_en)(int reset_pin);
28 int (*cs_dis)(int reset_pin);
29 int (*irq_read_val)(void);
30 int touch_x_max; 24 int touch_x_max;
31 int touch_y_max; 25 int touch_y_max;
32 unsigned int cs_pin; 26 unsigned int cs_pin;
33 unsigned int irq; 27 unsigned int touch_pin;
34 bool ext_clk; 28 bool ext_clk;
35 bool x_flip; 29 bool x_flip;
36 bool y_flip; 30 bool y_flip;
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index cc5cca774bab..2e86bd0bfba1 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -69,6 +69,12 @@ static inline bool input_mt_is_active(const struct input_mt_slot *slot)
69 return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0; 69 return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0;
70} 70}
71 71
72static inline bool input_mt_is_used(const struct input_mt *mt,
73 const struct input_mt_slot *slot)
74{
75 return slot->frame == mt->frame;
76}
77
72int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, 78int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
73 unsigned int flags); 79 unsigned int flags);
74void input_mt_destroy_slots(struct input_dev *dev); 80void input_mt_destroy_slots(struct input_dev *dev);
diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h
new file mode 100644
index 000000000000..49269a2aa329
--- /dev/null
+++ b/include/linux/input/ti_am335x_tsc.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_TI_AM335X_TSC_H
2#define __LINUX_TI_AM335X_TSC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 * @steps_to_configure: The sequencer supports a total of
11 * 16 programmable steps.
12 * A step configured to read a single
13 * co-ordinate value, can be applied
14 * more number of times for better results.
15 */
16
17struct tsc_data {
18 int wires;
19 int x_plate_resistance;
20 int steps_to_configure;
21};
22
23#endif
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
deleted file mode 100644
index b10a527a92a4..000000000000
--- a/include/linux/input/ti_tscadc.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __LINUX_TI_TSCADC_H
2#define __LINUX_TI_TSCADC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 */
11
12struct tsc_data {
13 int wires;
14 int x_plate_resistance;
15};
16
17#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 58b82a22a52b..492bc6513533 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -25,6 +25,11 @@ static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
25 return (struct iphdr *)skb_network_header(skb); 25 return (struct iphdr *)skb_network_header(skb);
26} 26}
27 27
28static inline struct iphdr *inner_ip_hdr(const struct sk_buff *skb)
29{
30 return (struct iphdr *)skb_inner_network_header(skb);
31}
32
28static inline struct iphdr *ipip_hdr(const struct sk_buff *skb) 33static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
29{ 34{
30 return (struct iphdr *)skb_transport_header(skb); 35 return (struct iphdr *)skb_transport_header(skb);
diff --git a/include/linux/ipack.h b/include/linux/ipack.h
new file mode 100644
index 000000000000..fea12cbb2aeb
--- /dev/null
+++ b/include/linux/ipack.h
@@ -0,0 +1,245 @@
1/*
2 * Industry-pack bus.
3 *
4 * Copyright (C) 2011-2012 CERN (www.cern.ch)
5 * Author: Samuel Iglesias Gonsalvez <siglesias@igalia.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 Free
9 * Software Foundation; version 2 of the License.
10 */
11
12#include <linux/mod_devicetable.h>
13#include <linux/device.h>
14#include <linux/interrupt.h>
15
16#define IPACK_IDPROM_OFFSET_I 0x01
17#define IPACK_IDPROM_OFFSET_P 0x03
18#define IPACK_IDPROM_OFFSET_A 0x05
19#define IPACK_IDPROM_OFFSET_C 0x07
20#define IPACK_IDPROM_OFFSET_MANUFACTURER_ID 0x09
21#define IPACK_IDPROM_OFFSET_MODEL 0x0B
22#define IPACK_IDPROM_OFFSET_REVISION 0x0D
23#define IPACK_IDPROM_OFFSET_RESERVED 0x0F
24#define IPACK_IDPROM_OFFSET_DRIVER_ID_L 0x11
25#define IPACK_IDPROM_OFFSET_DRIVER_ID_H 0x13
26#define IPACK_IDPROM_OFFSET_NUM_BYTES 0x15
27#define IPACK_IDPROM_OFFSET_CRC 0x17
28
29/*
30 * IndustryPack Fromat, Vendor and Device IDs.
31 */
32
33/* ID section format versions */
34#define IPACK_ID_VERSION_INVALID 0x00
35#define IPACK_ID_VERSION_1 0x01
36#define IPACK_ID_VERSION_2 0x02
37
38/* Vendors and devices. Sort key: vendor first, device next. */
39#define IPACK1_VENDOR_ID_RESERVED1 0x00
40#define IPACK1_VENDOR_ID_RESERVED2 0xFF
41#define IPACK1_VENDOR_ID_UNREGISTRED01 0x01
42#define IPACK1_VENDOR_ID_UNREGISTRED02 0x02
43#define IPACK1_VENDOR_ID_UNREGISTRED03 0x03
44#define IPACK1_VENDOR_ID_UNREGISTRED04 0x04
45#define IPACK1_VENDOR_ID_UNREGISTRED05 0x05
46#define IPACK1_VENDOR_ID_UNREGISTRED06 0x06
47#define IPACK1_VENDOR_ID_UNREGISTRED07 0x07
48#define IPACK1_VENDOR_ID_UNREGISTRED08 0x08
49#define IPACK1_VENDOR_ID_UNREGISTRED09 0x09
50#define IPACK1_VENDOR_ID_UNREGISTRED10 0x0A
51#define IPACK1_VENDOR_ID_UNREGISTRED11 0x0B
52#define IPACK1_VENDOR_ID_UNREGISTRED12 0x0C
53#define IPACK1_VENDOR_ID_UNREGISTRED13 0x0D
54#define IPACK1_VENDOR_ID_UNREGISTRED14 0x0E
55#define IPACK1_VENDOR_ID_UNREGISTRED15 0x0F
56
57#define IPACK1_VENDOR_ID_SBS 0xF0
58#define IPACK1_DEVICE_ID_SBS_OCTAL_232 0x22
59#define IPACK1_DEVICE_ID_SBS_OCTAL_422 0x2A
60#define IPACK1_DEVICE_ID_SBS_OCTAL_485 0x48
61
62struct ipack_bus_ops;
63struct ipack_driver;
64
65enum ipack_space {
66 IPACK_IO_SPACE = 0,
67 IPACK_ID_SPACE,
68 IPACK_INT_SPACE,
69 IPACK_MEM8_SPACE,
70 IPACK_MEM16_SPACE,
71 /* Dummy for counting the number of entries. Must remain the last
72 * entry */
73 IPACK_SPACE_COUNT,
74};
75
76/**
77 */
78struct ipack_region {
79 phys_addr_t start;
80 size_t size;
81};
82
83/**
84 * struct ipack_device
85 *
86 * @slot: Slot where the device is plugged in the carrier board
87 * @bus: ipack_bus_device where the device is plugged to.
88 * @id_space: Virtual address to ID space.
89 * @io_space: Virtual address to IO space.
90 * @mem_space: Virtual address to MEM space.
91 * @dev: device in kernel representation.
92 *
93 * Warning: Direct access to mapped memory is possible but the endianness
94 * is not the same with PCI carrier or VME carrier. The endianness is managed
95 * by the carrier board throught bus->ops.
96 */
97struct ipack_device {
98 unsigned int slot;
99 struct ipack_bus_device *bus;
100 struct device dev;
101 void (*release) (struct ipack_device *dev);
102 struct ipack_region region[IPACK_SPACE_COUNT];
103 u8 *id;
104 size_t id_avail;
105 u32 id_vendor;
106 u32 id_device;
107 u8 id_format;
108 unsigned int id_crc_correct:1;
109 unsigned int speed_8mhz:1;
110 unsigned int speed_32mhz:1;
111};
112
113/**
114 * struct ipack_driver_ops -- Callbacks to IPack device driver
115 *
116 * @probe: Probe function
117 * @remove: Prepare imminent removal of the device. Services provided by the
118 * device should be revoked.
119 */
120
121struct ipack_driver_ops {
122 int (*probe) (struct ipack_device *dev);
123 void (*remove) (struct ipack_device *dev);
124};
125
126/**
127 * struct ipack_driver -- Specific data to each ipack device driver
128 *
129 * @driver: Device driver kernel representation
130 * @ops: Callbacks provided by the IPack device driver
131 */
132struct ipack_driver {
133 struct device_driver driver;
134 const struct ipack_device_id *id_table;
135 const struct ipack_driver_ops *ops;
136};
137
138/**
139 * struct ipack_bus_ops - available operations on a bridge module
140 *
141 * @map_space: map IP address space
142 * @unmap_space: unmap IP address space
143 * @request_irq: request IRQ
144 * @free_irq: free IRQ
145 * @get_clockrate: Returns the clockrate the carrier is currently
146 * communicating with the device at.
147 * @set_clockrate: Sets the clock-rate for carrier / module communication.
148 * Should return -EINVAL if the requested speed is not supported.
149 * @get_error: Returns the error state for the slot the device is attached
150 * to.
151 * @get_timeout: Returns 1 if the communication with the device has
152 * previously timed out.
153 * @reset_timeout: Resets the state returned by get_timeout.
154 */
155struct ipack_bus_ops {
156 int (*request_irq) (struct ipack_device *dev,
157 irqreturn_t (*handler)(void *), void *arg);
158 int (*free_irq) (struct ipack_device *dev);
159 int (*get_clockrate) (struct ipack_device *dev);
160 int (*set_clockrate) (struct ipack_device *dev, int mherz);
161 int (*get_error) (struct ipack_device *dev);
162 int (*get_timeout) (struct ipack_device *dev);
163 int (*reset_timeout) (struct ipack_device *dev);
164};
165
166/**
167 * struct ipack_bus_device
168 *
169 * @dev: pointer to carrier device
170 * @slots: number of slots available
171 * @bus_nr: ipack bus number
172 * @ops: bus operations for the mezzanine drivers
173 */
174struct ipack_bus_device {
175 struct device *parent;
176 int slots;
177 int bus_nr;
178 const struct ipack_bus_ops *ops;
179};
180
181/**
182 * ipack_bus_register -- register a new ipack bus
183 *
184 * @parent: pointer to the parent device, if any.
185 * @slots: number of slots available in the bus device.
186 * @ops: bus operations for the mezzanine drivers.
187 *
188 * The carrier board device should call this function to register itself as
189 * available bus device in ipack.
190 */
191struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
192 const struct ipack_bus_ops *ops);
193
194/**
195 * ipack_bus_unregister -- unregister an ipack bus
196 */
197int ipack_bus_unregister(struct ipack_bus_device *bus);
198
199/**
200 * ipack_driver_register -- Register a new ipack device driver
201 *
202 * Called by a ipack driver to register itself as a driver
203 * that can manage ipack devices.
204 */
205int ipack_driver_register(struct ipack_driver *edrv, struct module *owner,
206 const char *name);
207void ipack_driver_unregister(struct ipack_driver *edrv);
208
209/**
210 * ipack_device_register -- register an IPack device with the kernel
211 * @dev: the new device to register.
212 *
213 * Register a new IPack device ("module" in IndustryPack jargon). The call
214 * is done by the carrier driver. The carrier should populate the fields
215 * bus and slot as well as the region array of @dev prior to calling this
216 * function. The rest of the fields will be allocated and populated
217 * during registration.
218 *
219 * Return zero on success or error code on failure.
220 */
221int ipack_device_register(struct ipack_device *dev);
222void ipack_device_unregister(struct ipack_device *dev);
223
224/**
225 * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table
226 * @_table: device table name
227 *
228 * This macro is used to create a struct ipack_device_id array (a device table)
229 * in a generic manner.
230 */
231#define DEFINE_IPACK_DEVICE_TABLE(_table) \
232 const struct ipack_device_id _table[]
233/**
234 * IPACK_DEVICE - macro used to describe a specific IndustryPack device
235 * @_format: the format version (currently either 1 or 2, 8 bit value)
236 * @vend: the 8 or 24 bit IndustryPack Vendor ID
237 * @dev: the 8 or 16 bit IndustryPack Device ID
238 *
239 * This macro is used to create a struct ipack_device_id that matches a specific
240 * device.
241 */
242#define IPACK_DEVICE(_format, vend, dev) \
243 .format = (_format), \
244 .vendor = (vend), \
245 .device = (dev)
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 5499c92a9153..ae221a7b5092 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -24,6 +24,7 @@ struct ipc_ids {
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rw_mutex;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id;
27}; 28};
28 29
29struct ipc_namespace { 30struct ipc_namespace {
@@ -67,6 +68,8 @@ struct ipc_namespace {
67 68
68 /* user_ns which owns the ipc ns */ 69 /* user_ns which owns the ipc ns */
69 struct user_namespace *user_ns; 70 struct user_namespace *user_ns;
71
72 unsigned int proc_inum;
70}; 73};
71 74
72extern struct ipc_namespace init_ipc_ns; 75extern struct ipc_namespace init_ipc_ns;
@@ -133,7 +136,8 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
133 136
134#if defined(CONFIG_IPC_NS) 137#if defined(CONFIG_IPC_NS)
135extern struct ipc_namespace *copy_ipcs(unsigned long flags, 138extern struct ipc_namespace *copy_ipcs(unsigned long flags,
136 struct task_struct *tsk); 139 struct user_namespace *user_ns, struct ipc_namespace *ns);
140
137static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 141static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
138{ 142{
139 if (ns) 143 if (ns)
@@ -144,12 +148,12 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
144extern void put_ipc_ns(struct ipc_namespace *ns); 148extern void put_ipc_ns(struct ipc_namespace *ns);
145#else 149#else
146static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 150static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
147 struct task_struct *tsk) 151 struct user_namespace *user_ns, struct ipc_namespace *ns)
148{ 152{
149 if (flags & CLONE_NEWIPC) 153 if (flags & CLONE_NEWIPC)
150 return ERR_PTR(-EINVAL); 154 return ERR_PTR(-EINVAL);
151 155
152 return tsk->nsproxy->ipc_ns; 156 return ns;
153} 157}
154 158
155static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 159static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index fcb5d44ea635..8ea3fe0b9759 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -216,7 +216,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf);
216 216
217/* 217/*
218 * The lower layer reports received messages through this interface. 218 * The lower layer reports received messages through this interface.
219 * The data_size should be zero if this is an asyncronous message. If 219 * The data_size should be zero if this is an asynchronous message. If
220 * the lower layer gets an error sending a message, it should format 220 * the lower layer gets an error sending a message, it should format
221 * an error response in the message response. 221 * an error response in the message response.
222 */ 222 */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index bcba48a97868..faed1e357dd6 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -47,6 +47,7 @@ struct ipv6_devconf {
47 __s32 disable_ipv6; 47 __s32 disable_ipv6;
48 __s32 accept_dad; 48 __s32 accept_dad;
49 __s32 force_tllao; 49 __s32 force_tllao;
50 __s32 ndisc_notify;
50 void *sysctl; 51 void *sysctl;
51}; 52};
52 53
@@ -66,6 +67,11 @@ static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
66 return (struct ipv6hdr *)skb_network_header(skb); 67 return (struct ipv6hdr *)skb_network_header(skb);
67} 68}
68 69
70static inline struct ipv6hdr *inner_ipv6_hdr(const struct sk_buff *skb)
71{
72 return (struct ipv6hdr *)skb_inner_network_header(skb);
73}
74
69static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) 75static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
70{ 76{
71 return (struct ipv6hdr *)skb_transport_header(skb); 77 return (struct ipv6hdr *)skb_transport_header(skb);
@@ -363,20 +369,22 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
363#define inet_v6_ipv6only(__sk) 0 369#define inet_v6_ipv6only(__sk) 0
364#endif /* IS_ENABLED(CONFIG_IPV6) */ 370#endif /* IS_ENABLED(CONFIG_IPV6) */
365 371
366#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 372#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
367 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 373 ((inet_sk(__sk)->inet_portpair == (__ports)) && \
368 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ 374 ((__sk)->sk_family == AF_INET6) && \
369 ((__sk)->sk_family == AF_INET6) && \ 375 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
370 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 376 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
371 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 377 (!(__sk)->sk_bound_dev_if || \
372 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 378 ((__sk)->sk_bound_dev_if == (__dif))) && \
373 379 net_eq(sock_net(__sk), (__net)))
374#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ 380
375 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 381#define INET6_TW_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
376 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ 382 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
377 ((__sk)->sk_family == PF_INET6) && \ 383 ((__sk)->sk_family == AF_INET6) && \
378 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ 384 ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr)) && \
379 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \ 385 ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr)) && \
380 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 386 (!(__sk)->sk_bound_dev_if || \
387 ((__sk)->sk_bound_dev_if == (__dif))) && \
388 net_eq(sock_net(__sk), (__net)))
381 389
382#endif /* _IPV6_H */ 390#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 216b0ba109d7..fdf2c4a238cc 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -10,9 +10,6 @@
10 */ 10 */
11 11
12#include <linux/smp.h> 12#include <linux/smp.h>
13
14#ifndef CONFIG_S390
15
16#include <linux/linkage.h> 13#include <linux/linkage.h>
17#include <linux/cache.h> 14#include <linux/cache.h>
18#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -392,6 +389,15 @@ static inline void irq_move_masked_irq(struct irq_data *data) { }
392 389
393extern int no_irq_affinity; 390extern int no_irq_affinity;
394 391
392#ifdef CONFIG_HARDIRQS_SW_RESEND
393int irq_set_parent(int irq, int parent_irq);
394#else
395static inline int irq_set_parent(int irq, int parent_irq)
396{
397 return 0;
398}
399#endif
400
395/* 401/*
396 * Built-in IRQ handlers for various IRQ types, 402 * Built-in IRQ handlers for various IRQ types,
397 * callable via desc->handle_irq() 403 * callable via desc->handle_irq()
@@ -737,8 +743,11 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
737static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 743static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
738#endif 744#endif
739 745
740#endif /* CONFIG_GENERIC_HARDIRQS */ 746#else /* !CONFIG_GENERIC_HARDIRQS */
741 747
742#endif /* !CONFIG_S390 */ 748extern struct msi_desc *irq_get_msi_desc(unsigned int irq);
749extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
750
751#endif /* CONFIG_GENERIC_HARDIRQS */
743 752
744#endif /* _LINUX_IRQ_H */ 753#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqchip/spear-shirq.h b/include/linux/irqchip/spear-shirq.h
new file mode 100644
index 000000000000..c8be16d213a3
--- /dev/null
+++ b/include/linux/irqchip/spear-shirq.h
@@ -0,0 +1,64 @@
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/irqchip/sunxi.h b/include/linux/irqchip/sunxi.h
new file mode 100644
index 000000000000..1fe2c2260e2b
--- /dev/null
+++ b/include/linux/irqchip/sunxi.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_IRQCHIP_SUNXI_H
18#define __LINUX_IRQCHIP_SUNXI_H
19
20#include <asm/exception.h>
21
22extern void sunxi_init_irq(void);
23
24extern asmlinkage void __exception_irq_entry sunxi_handle_irq(
25 struct pt_regs *regs);
26
27#endif
diff --git a/include/linux/irqchip/versatile-fpga.h b/include/linux/irqchip/versatile-fpga.h
new file mode 100644
index 000000000000..1fac9651d3ca
--- /dev/null
+++ b/include/linux/irqchip/versatile-fpga.h
@@ -0,0 +1,13 @@
1#ifndef PLAT_FPGA_IRQ_H
2#define PLAT_FPGA_IRQ_H
3
4struct device_node;
5struct pt_regs;
6
7void fpga_handle_irq(struct pt_regs *regs);
8void fpga_irq_init(void __iomem *, const char *, int, int, u32,
9 struct device_node *node);
10int fpga_irq_of_init(struct device_node *node,
11 struct device_node *parent);
12
13#endif
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 0ba014c55056..623325e2ff97 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -11,6 +11,8 @@
11struct irq_affinity_notify; 11struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct module; 13struct module;
14struct irq_desc;
15
14/** 16/**
15 * struct irq_desc - interrupt descriptor 17 * struct irq_desc - interrupt descriptor
16 * @irq_data: per irq and chip data passed down to chip functions 18 * @irq_data: per irq and chip data passed down to chip functions
@@ -65,6 +67,7 @@ struct irq_desc {
65#ifdef CONFIG_PROC_FS 67#ifdef CONFIG_PROC_FS
66 struct proc_dir_entry *dir; 68 struct proc_dir_entry *dir;
67#endif 69#endif
70 int parent_irq;
68 struct module *owner; 71 struct module *owner;
69 const char *name; 72 const char *name;
70} ____cacheline_internodealigned_in_smp; 73} ____cacheline_internodealigned_in_smp;
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 3efc43f3f162..e30b66346942 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1096,10 +1096,9 @@ extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1096void jbd2_journal_set_triggers(struct buffer_head *, 1096void jbd2_journal_set_triggers(struct buffer_head *,
1097 struct jbd2_buffer_trigger_type *type); 1097 struct jbd2_buffer_trigger_type *type);
1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1099extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1100extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1099extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1101extern void journal_sync_buffer (struct buffer_head *); 1100extern void journal_sync_buffer (struct buffer_head *);
1102extern void jbd2_journal_invalidatepage(journal_t *, 1101extern int jbd2_journal_invalidatepage(journal_t *,
1103 struct page *, unsigned long); 1102 struct page *, unsigned long);
1104extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 1103extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
1105extern int jbd2_journal_stop(handle_t *); 1104extern int jbd2_journal_stop(handle_t *);
@@ -1303,15 +1302,21 @@ static inline int jbd_space_needed(journal_t *journal)
1303 1302
1304extern int jbd_blocks_per_page(struct inode *inode); 1303extern int jbd_blocks_per_page(struct inode *inode);
1305 1304
1305/* JBD uses a CRC32 checksum */
1306#define JBD_MAX_CHECKSUM_SIZE 4
1307
1306static inline u32 jbd2_chksum(journal_t *journal, u32 crc, 1308static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
1307 const void *address, unsigned int length) 1309 const void *address, unsigned int length)
1308{ 1310{
1309 struct { 1311 struct {
1310 struct shash_desc shash; 1312 struct shash_desc shash;
1311 char ctx[crypto_shash_descsize(journal->j_chksum_driver)]; 1313 char ctx[JBD_MAX_CHECKSUM_SIZE];
1312 } desc; 1314 } desc;
1313 int err; 1315 int err;
1314 1316
1317 BUG_ON(crypto_shash_descsize(journal->j_chksum_driver) >
1318 JBD_MAX_CHECKSUM_SIZE);
1319
1315 desc.shash.tfm = journal->j_chksum_driver; 1320 desc.shash.tfm = journal->j_chksum_driver;
1316 desc.shash.flags = 0; 1321 desc.shash.flags = 0;
1317 *(u32 *)desc.ctx = crc; 1322 *(u32 *)desc.ctx = crc;
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6b87413da9d6..82ed068b1ebe 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -70,11 +70,12 @@ extern int register_refined_jiffies(long clock_tick_rate);
70 70
71/* 71/*
72 * The 64-bit value is not atomic - you MUST NOT read it 72 * The 64-bit value is not atomic - you MUST NOT read it
73 * without sampling the sequence number in xtime_lock. 73 * without sampling the sequence number in jiffies_lock.
74 * get_jiffies_64() will do this for you as appropriate. 74 * get_jiffies_64() will do this for you as appropriate.
75 */ 75 */
76extern u64 __jiffy_data jiffies_64; 76extern u64 __jiffy_data jiffies_64;
77extern unsigned long volatile __jiffy_data jiffies; 77extern unsigned long volatile __jiffy_data jiffies;
78extern seqlock_t jiffies_lock;
78 79
79#if (BITS_PER_LONG < 64) 80#if (BITS_PER_LONG < 64)
80u64 get_jiffies_64(void); 81u64 get_jiffies_64(void);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a123b13b70fd..c566927efcbd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -77,13 +77,15 @@
77 77
78/* 78/*
79 * Divide positive or negative dividend by positive divisor and round 79 * Divide positive or negative dividend by positive divisor and round
80 * to closest integer. Result is undefined for negative divisors. 80 * to closest integer. Result is undefined for negative divisors and
81 * for negative dividends if the divisor variable type is unsigned.
81 */ 82 */
82#define DIV_ROUND_CLOSEST(x, divisor)( \ 83#define DIV_ROUND_CLOSEST(x, divisor)( \
83{ \ 84{ \
84 typeof(x) __x = x; \ 85 typeof(x) __x = x; \
85 typeof(divisor) __d = divisor; \ 86 typeof(divisor) __d = divisor; \
86 (((typeof(x))-1) > 0 || (__x) > 0) ? \ 87 (((typeof(x))-1) > 0 || \
88 ((typeof(divisor))-1) > 0 || (__x) > 0) ? \
87 (((__x) + ((__d) / 2)) / (__d)) : \ 89 (((__x) + ((__d) / 2)) / (__d)) : \
88 (((__x) - ((__d) / 2)) / (__d)); \ 90 (((__x) - ((__d) / 2)) / (__d)); \
89} \ 91} \
@@ -220,6 +222,23 @@ int __must_check _kstrtol(const char *s, unsigned int base, long *res);
220 222
221int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res); 223int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
222int __must_check kstrtoll(const char *s, unsigned int base, long long *res); 224int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
225
226/**
227 * kstrtoul - convert a string to an unsigned long
228 * @s: The start of the string. The string must be null-terminated, and may also
229 * include a single newline before its terminating null. The first character
230 * may also be a plus sign, but not a minus sign.
231 * @base: The number base to use. The maximum supported base is 16. If base is
232 * given as 0, then the base of the string is automatically detected with the
233 * conventional semantics - If it begins with 0x the number will be parsed as a
234 * hexadecimal (case insensitive), if it otherwise begins with 0, it will be
235 * parsed as an octal number. Otherwise it will be parsed as a decimal.
236 * @res: Where to write the result of the conversion on success.
237 *
238 * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
239 * Used as a replacement for the obsolete simple_strtoull. Return code must
240 * be checked.
241*/
223static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) 242static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
224{ 243{
225 /* 244 /*
@@ -233,6 +252,22 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign
233 return _kstrtoul(s, base, res); 252 return _kstrtoul(s, base, res);
234} 253}
235 254
255/**
256 * kstrtol - convert a string to a long
257 * @s: The start of the string. The string must be null-terminated, and may also
258 * include a single newline before its terminating null. The first character
259 * may also be a plus sign or a minus sign.
260 * @base: The number base to use. The maximum supported base is 16. If base is
261 * given as 0, then the base of the string is automatically detected with the
262 * conventional semantics - If it begins with 0x the number will be parsed as a
263 * hexadecimal (case insensitive), if it otherwise begins with 0, it will be
264 * parsed as an octal number. Otherwise it will be parsed as a decimal.
265 * @res: Where to write the result of the conversion on success.
266 *
267 * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
268 * Used as a replacement for the obsolete simple_strtoull. Return code must
269 * be checked.
270 */
236static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) 271static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
237{ 272{
238 /* 273 /*
@@ -527,9 +562,6 @@ __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
527 562
528extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); 563extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
529#else 564#else
530static inline __printf(1, 2)
531int trace_printk(const char *fmt, ...);
532
533static inline void tracing_start(void) { } 565static inline void tracing_start(void) { }
534static inline void tracing_stop(void) { } 566static inline void tracing_stop(void) { }
535static inline void ftrace_off_permanent(void) { } 567static inline void ftrace_off_permanent(void) { }
@@ -539,8 +571,8 @@ static inline void tracing_on(void) { }
539static inline void tracing_off(void) { } 571static inline void tracing_off(void) { }
540static inline int tracing_is_on(void) { return 0; } 572static inline int tracing_is_on(void) { return 0; }
541 573
542static inline int 574static inline __printf(1, 2)
543trace_printk(const char *fmt, ...) 575int trace_printk(const char *fmt, ...)
544{ 576{
545 return 0; 577 return 0;
546} 578}
@@ -687,18 +719,11 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
687/* Trap pasters of __FUNCTION__ at compile-time */ 719/* Trap pasters of __FUNCTION__ at compile-time */
688#define __FUNCTION__ (__func__) 720#define __FUNCTION__ (__func__)
689 721
690/* This helps us to avoid #ifdef CONFIG_NUMA */ 722/* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */
691#ifdef CONFIG_NUMA 723#ifdef CONFIG_SYMBOL_PREFIX
692#define NUMA_BUILD 1 724#define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
693#else
694#define NUMA_BUILD 0
695#endif
696
697/* This helps us avoid #ifdef CONFIG_COMPACTION */
698#ifdef CONFIG_COMPACTION
699#define COMPACTION_BUILD 1
700#else 725#else
701#define COMPACTION_BUILD 0 726#define SYMBOL_PREFIX ""
702#endif 727#endif
703 728
704/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ 729/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 36d12f0884c3..66b70780e910 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -7,6 +7,7 @@
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/vtime.h>
10#include <asm/irq.h> 11#include <asm/irq.h>
11#include <asm/cputime.h> 12#include <asm/cputime.h>
12 13
@@ -126,16 +127,16 @@ extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t)
126extern void account_steal_time(cputime_t); 127extern void account_steal_time(cputime_t);
127extern void account_idle_time(cputime_t); 128extern void account_idle_time(cputime_t);
128 129
129extern void account_process_tick(struct task_struct *, int user);
130extern void account_steal_ticks(unsigned long ticks);
131extern void account_idle_ticks(unsigned long ticks);
132
133#ifdef CONFIG_VIRT_CPU_ACCOUNTING 130#ifdef CONFIG_VIRT_CPU_ACCOUNTING
134extern void vtime_task_switch(struct task_struct *prev); 131static inline void account_process_tick(struct task_struct *tsk, int user)
135extern void vtime_account_system(struct task_struct *tsk); 132{
136extern void vtime_account_idle(struct task_struct *tsk); 133 vtime_account_user(tsk);
134}
137#else 135#else
138static inline void vtime_task_switch(struct task_struct *prev) { } 136extern void account_process_tick(struct task_struct *, int user);
139#endif 137#endif
140 138
139extern void account_steal_ticks(unsigned long ticks);
140extern void account_idle_ticks(unsigned long ticks);
141
141#endif /* _LINUX_KERNEL_STAT_H */ 142#endif /* _LINUX_KERNEL_STAT_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 2393b1c040b6..4dfde1161c5e 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -265,6 +265,7 @@ extern int key_unlink(struct key *keyring,
265 265
266extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid, 266extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
267 const struct cred *cred, 267 const struct cred *cred,
268 key_perm_t perm,
268 unsigned long flags, 269 unsigned long flags,
269 struct key *dest); 270 struct key *dest);
270 271
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 1e57449395b1..939b11268c86 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -203,7 +203,6 @@ extern struct kobject *power_kobj;
203/* The global /sys/firmware/ kobject for people to chain off of */ 203/* The global /sys/firmware/ kobject for people to chain off of */
204extern struct kobject *firmware_kobj; 204extern struct kobject *firmware_kobj;
205 205
206#if defined(CONFIG_HOTPLUG)
207int kobject_uevent(struct kobject *kobj, enum kobject_action action); 206int kobject_uevent(struct kobject *kobj, enum kobject_action action);
208int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, 207int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
209 char *envp[]); 208 char *envp[]);
@@ -213,22 +212,5 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...);
213 212
214int kobject_action_type(const char *buf, size_t count, 213int kobject_action_type(const char *buf, size_t count,
215 enum kobject_action *type); 214 enum kobject_action *type);
216#else
217static inline int kobject_uevent(struct kobject *kobj,
218 enum kobject_action action)
219{ return 0; }
220static inline int kobject_uevent_env(struct kobject *kobj,
221 enum kobject_action action,
222 char *envp[])
223{ return 0; }
224
225static inline __printf(2, 3)
226int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
227{ return -ENOMEM; }
228
229static inline int kobject_action_type(const char *buf, size_t count,
230 enum kobject_action *type)
231{ return -EINVAL; }
232#endif
233 215
234#endif /* _KOBJECT_H_ */ 216#endif /* _KOBJECT_H_ */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 06177ba10a16..e83512f63df5 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -282,6 +282,25 @@ static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
282 return cmp1.tv64 == cmp2.tv64; 282 return cmp1.tv64 == cmp2.tv64;
283} 283}
284 284
285/**
286 * ktime_compare - Compares two ktime_t variables for less, greater or equal
287 * @cmp1: comparable1
288 * @cmp2: comparable2
289 *
290 * Returns ...
291 * cmp1 < cmp2: return <0
292 * cmp1 == cmp2: return 0
293 * cmp1 > cmp2: return >0
294 */
295static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
296{
297 if (cmp1.tv64 < cmp2.tv64)
298 return -1;
299 if (cmp1.tv64 > cmp2.tv64)
300 return 1;
301 return 0;
302}
303
285static inline s64 ktime_to_us(const ktime_t kt) 304static inline s64 ktime_to_us(const ktime_t kt)
286{ 305{
287 struct timeval tv = ktime_to_timeval(kt); 306 struct timeval tv = ktime_to_timeval(kt);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ecc554374e44..2c497ab0d03d 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -47,28 +47,40 @@
47 47
48/* 48/*
49 * For the normal pfn, the highest 12 bits should be zero, 49 * For the normal pfn, the highest 12 bits should be zero,
50 * so we can mask these bits to indicate the error. 50 * so we can mask bit 62 ~ bit 52 to indicate the error pfn,
51 * mask bit 63 to indicate the noslot pfn.
51 */ 52 */
52#define KVM_PFN_ERR_MASK (0xfffULL << 52) 53#define KVM_PFN_ERR_MASK (0x7ffULL << 52)
54#define KVM_PFN_ERR_NOSLOT_MASK (0xfffULL << 52)
55#define KVM_PFN_NOSLOT (0x1ULL << 63)
53 56
54#define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK) 57#define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK)
55#define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1) 58#define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1)
56#define KVM_PFN_ERR_BAD (KVM_PFN_ERR_MASK + 2) 59#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 2)
57#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 3)
58 60
61/*
62 * error pfns indicate that the gfn is in slot but faild to
63 * translate it to pfn on host.
64 */
59static inline bool is_error_pfn(pfn_t pfn) 65static inline bool is_error_pfn(pfn_t pfn)
60{ 66{
61 return !!(pfn & KVM_PFN_ERR_MASK); 67 return !!(pfn & KVM_PFN_ERR_MASK);
62} 68}
63 69
64static inline bool is_noslot_pfn(pfn_t pfn) 70/*
71 * error_noslot pfns indicate that the gfn can not be
72 * translated to pfn - it is not in slot or failed to
73 * translate it to pfn.
74 */
75static inline bool is_error_noslot_pfn(pfn_t pfn)
65{ 76{
66 return pfn == KVM_PFN_ERR_BAD; 77 return !!(pfn & KVM_PFN_ERR_NOSLOT_MASK);
67} 78}
68 79
69static inline bool is_invalid_pfn(pfn_t pfn) 80/* noslot pfn indicates that the gfn is not in slot. */
81static inline bool is_noslot_pfn(pfn_t pfn)
70{ 82{
71 return !is_noslot_pfn(pfn) && is_error_pfn(pfn); 83 return pfn == KVM_PFN_NOSLOT;
72} 84}
73 85
74#define KVM_HVA_ERR_BAD (PAGE_OFFSET) 86#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
@@ -107,6 +119,9 @@ static inline bool is_error_page(struct page *page)
107#define KVM_REQ_IMMEDIATE_EXIT 15 119#define KVM_REQ_IMMEDIATE_EXIT 15
108#define KVM_REQ_PMU 16 120#define KVM_REQ_PMU 16
109#define KVM_REQ_PMI 17 121#define KVM_REQ_PMI 17
122#define KVM_REQ_WATCHDOG 18
123#define KVM_REQ_MASTERCLOCK_UPDATE 19
124#define KVM_REQ_MCLOCK_INPROGRESS 20
110 125
111#define KVM_USERSPACE_IRQ_SOURCE_ID 0 126#define KVM_USERSPACE_IRQ_SOURCE_ID 0
112#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 127#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -516,6 +531,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
516 531
517void kvm_flush_remote_tlbs(struct kvm *kvm); 532void kvm_flush_remote_tlbs(struct kvm *kvm);
518void kvm_reload_remote_mmus(struct kvm *kvm); 533void kvm_reload_remote_mmus(struct kvm *kvm);
534void kvm_make_mclock_inprogress_request(struct kvm *kvm);
519 535
520long kvm_arch_dev_ioctl(struct file *filp, 536long kvm_arch_dev_ioctl(struct file *filp,
521 unsigned int ioctl, unsigned long arg); 537 unsigned int ioctl, unsigned long arg);
@@ -569,9 +585,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
569void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); 585void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
570struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id); 586struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
571int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); 587int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
588int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
572void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); 589void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
573 590
574int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
575int kvm_arch_hardware_enable(void *garbage); 591int kvm_arch_hardware_enable(void *garbage);
576void kvm_arch_hardware_disable(void *garbage); 592void kvm_arch_hardware_disable(void *garbage);
577int kvm_arch_hardware_setup(void); 593int kvm_arch_hardware_setup(void);
@@ -666,6 +682,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
666 unsigned long *deliver_bitmask); 682 unsigned long *deliver_bitmask);
667#endif 683#endif
668int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level); 684int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level);
685int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
669int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, 686int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
670 int irq_source_id, int level); 687 int irq_source_id, int level);
671void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 688void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
@@ -726,7 +743,11 @@ static inline int kvm_deassign_device(struct kvm *kvm,
726static inline void kvm_guest_enter(void) 743static inline void kvm_guest_enter(void)
727{ 744{
728 BUG_ON(preemptible()); 745 BUG_ON(preemptible());
729 vtime_account(current); 746 /*
747 * This is running in ioctl context so we can avoid
748 * the call to vtime_account() with its unnecessary idle check.
749 */
750 vtime_account_system_irqsafe(current);
730 current->flags |= PF_VCPU; 751 current->flags |= PF_VCPU;
731 /* KVM does not hold any references to rcu protected data when it 752 /* KVM does not hold any references to rcu protected data when it
732 * switches CPU into a guest mode. In fact switching to a guest mode 753 * switches CPU into a guest mode. In fact switching to a guest mode
@@ -740,7 +761,11 @@ static inline void kvm_guest_enter(void)
740 761
741static inline void kvm_guest_exit(void) 762static inline void kvm_guest_exit(void)
742{ 763{
743 vtime_account(current); 764 /*
765 * This is running in ioctl context so we can avoid
766 * the call to vtime_account() with its unnecessary idle check.
767 */
768 vtime_account_system_irqsafe(current);
744 current->flags &= ~PF_VCPU; 769 current->flags &= ~PF_VCPU;
745} 770}
746 771
@@ -830,9 +855,9 @@ extern struct kvm_stats_debugfs_item debugfs_entries[];
830extern struct dentry *kvm_debugfs_dir; 855extern struct dentry *kvm_debugfs_dir;
831 856
832#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER) 857#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
833static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq) 858static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
834{ 859{
835 if (unlikely(vcpu->kvm->mmu_notifier_count)) 860 if (unlikely(kvm->mmu_notifier_count))
836 return 1; 861 return 1;
837 /* 862 /*
838 * Ensure the read of mmu_notifier_count happens before the read 863 * Ensure the read of mmu_notifier_count happens before the read
@@ -845,7 +870,7 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
845 * can't rely on kvm->mmu_lock to keep things ordered. 870 * can't rely on kvm->mmu_lock to keep things ordered.
846 */ 871 */
847 smp_rmb(); 872 smp_rmb();
848 if (vcpu->kvm->mmu_notifier_seq != mmu_seq) 873 if (kvm->mmu_notifier_seq != mmu_seq)
849 return 1; 874 return 1;
850 return 0; 875 return 0;
851} 876}
@@ -873,10 +898,20 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
873#ifdef CONFIG_HAVE_KVM_EVENTFD 898#ifdef CONFIG_HAVE_KVM_EVENTFD
874 899
875void kvm_eventfd_init(struct kvm *kvm); 900void kvm_eventfd_init(struct kvm *kvm);
901int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
902
903#ifdef CONFIG_HAVE_KVM_IRQCHIP
876int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 904int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
877void kvm_irqfd_release(struct kvm *kvm); 905void kvm_irqfd_release(struct kvm *kvm);
878void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 906void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
879int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 907#else
908static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
909{
910 return -EINVAL;
911}
912
913static inline void kvm_irqfd_release(struct kvm *kvm) {}
914#endif
880 915
881#else 916#else
882 917
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 6e53bb31c220..0d9b5eed714e 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -179,6 +179,23 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger,
179 unsigned long *delay_on, 179 unsigned long *delay_on,
180 unsigned long *delay_off, 180 unsigned long *delay_off,
181 int invert); 181 int invert);
182/**
183 * led_trigger_rename_static - rename a trigger
184 * @name: the new trigger name
185 * @trig: the LED trigger to rename
186 *
187 * Change a LED trigger name by copying the string passed in
188 * name into current trigger name, which MUST be large
189 * enough for the new string.
190 *
191 * Note that name must NOT point to the same string used
192 * during LED registration, as that could lead to races.
193 *
194 * This is meant to be used on triggers with statically
195 * allocated name.
196 */
197extern void led_trigger_rename_static(const char *name,
198 struct led_trigger *trig);
182 199
183#else 200#else
184 201
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 77eeeda2b6e2..83ba0ab2c915 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -163,6 +163,7 @@ enum {
163 163
164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ 164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
165 ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */ 165 ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
166 ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */
166 167
167 ATA_DEV_UNKNOWN = 0, /* unknown device */ 168 ATA_DEV_UNKNOWN = 0, /* unknown device */
168 ATA_DEV_ATA = 1, /* ATA device */ 169 ATA_DEV_ATA = 1, /* ATA device */
@@ -1114,6 +1115,10 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
1114#endif /* CONFIG_PM */ 1115#endif /* CONFIG_PM */
1115#endif /* CONFIG_PCI */ 1116#endif /* CONFIG_PCI */
1116 1117
1118struct platform_device;
1119
1120extern int ata_platform_remove_one(struct platform_device *pdev);
1121
1117/* 1122/*
1118 * ACPI - drivers/ata/libata-acpi.c 1123 * ACPI - drivers/ata/libata-acpi.c
1119 */ 1124 */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 6492181bcb1d..460b60fa7adf 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -53,10 +53,13 @@ struct loop_device {
53 53
54 spinlock_t lo_lock; 54 spinlock_t lo_lock;
55 struct bio_list lo_bio_list; 55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
56 int lo_state; 57 int lo_state;
57 struct mutex lo_ctl_mutex; 58 struct mutex lo_ctl_mutex;
58 struct task_struct *lo_thread; 59 struct task_struct *lo_thread;
59 wait_queue_head_t lo_event; 60 wait_queue_head_t lo_event;
61 /* wait queue for incoming requests */
62 wait_queue_head_t lo_req_wait;
60 63
61 struct request_queue *lo_queue; 64 struct request_queue *lo_queue;
62 struct gendisk *lo_disk; 65 struct gendisk *lo_disk;
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index 7a71ffad037c..4019013c6593 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -52,8 +52,8 @@ We replicate IO (more or less synchronously) to local and remote disk.
52 52
53For crash recovery after replication node failure, 53For crash recovery after replication node failure,
54 we need to resync all regions that have been target of in-flight WRITE IO 54 we need to resync all regions that have been target of in-flight WRITE IO
55 (in use, or "hot", regions), as we don't know wether or not those WRITEs have 55 (in use, or "hot", regions), as we don't know whether or not those WRITEs
56 made it to stable storage. 56 have made it to stable storage.
57 57
58 To avoid a "full resync", we need to persistently track these regions. 58 To avoid a "full resync", we need to persistently track these regions.
59 59
@@ -166,9 +166,11 @@ struct lc_element {
166 /* if we want to track a larger set of objects, 166 /* if we want to track a larger set of objects,
167 * it needs to become arch independend u64 */ 167 * it needs to become arch independend u64 */
168 unsigned lc_number; 168 unsigned lc_number;
169
170 /* special label when on free list */ 169 /* special label when on free list */
171#define LC_FREE (~0U) 170#define LC_FREE (~0U)
171
172 /* for pending changes */
173 unsigned lc_new_number;
172}; 174};
173 175
174struct lru_cache { 176struct lru_cache {
@@ -176,6 +178,7 @@ struct lru_cache {
176 struct list_head lru; 178 struct list_head lru;
177 struct list_head free; 179 struct list_head free;
178 struct list_head in_use; 180 struct list_head in_use;
181 struct list_head to_be_changed;
179 182
180 /* the pre-created kmem cache to allocate the objects from */ 183 /* the pre-created kmem cache to allocate the objects from */
181 struct kmem_cache *lc_cache; 184 struct kmem_cache *lc_cache;
@@ -186,7 +189,7 @@ struct lru_cache {
186 size_t element_off; 189 size_t element_off;
187 190
188 /* number of elements (indices) */ 191 /* number of elements (indices) */
189 unsigned int nr_elements; 192 unsigned int nr_elements;
190 /* Arbitrary limit on maximum tracked objects. Practical limit is much 193 /* Arbitrary limit on maximum tracked objects. Practical limit is much
191 * lower due to allocation failures, probably. For typical use cases, 194 * lower due to allocation failures, probably. For typical use cases,
192 * nr_elements should be a few thousand at most. 195 * nr_elements should be a few thousand at most.
@@ -194,18 +197,19 @@ struct lru_cache {
194 * 8 high bits of .lc_index to be overloaded with flags in the future. */ 197 * 8 high bits of .lc_index to be overloaded with flags in the future. */
195#define LC_MAX_ACTIVE (1<<24) 198#define LC_MAX_ACTIVE (1<<24)
196 199
200 /* allow to accumulate a few (index:label) changes,
201 * but no more than max_pending_changes */
202 unsigned int max_pending_changes;
203 /* number of elements currently on to_be_changed list */
204 unsigned int pending_changes;
205
197 /* statistics */ 206 /* statistics */
198 unsigned used; /* number of lelements currently on in_use list */ 207 unsigned used; /* number of elements currently on in_use list */
199 unsigned long hits, misses, starving, dirty, changed; 208 unsigned long hits, misses, starving, locked, changed;
200 209
201 /* see below: flag-bits for lru_cache */ 210 /* see below: flag-bits for lru_cache */
202 unsigned long flags; 211 unsigned long flags;
203 212
204 /* when changing the label of an index element */
205 unsigned int new_number;
206
207 /* for paranoia when changing the label of an index element */
208 struct lc_element *changing_element;
209 213
210 void *lc_private; 214 void *lc_private;
211 const char *name; 215 const char *name;
@@ -221,10 +225,15 @@ enum {
221 /* debugging aid, to catch concurrent access early. 225 /* debugging aid, to catch concurrent access early.
222 * user needs to guarantee exclusive access by proper locking! */ 226 * user needs to guarantee exclusive access by proper locking! */
223 __LC_PARANOIA, 227 __LC_PARANOIA,
224 /* if we need to change the set, but currently there is a changing 228
225 * transaction pending, we are "dirty", and must deferr further 229 /* annotate that the set is "dirty", possibly accumulating further
226 * changing requests */ 230 * changes, until a transaction is finally triggered */
227 __LC_DIRTY, 231 __LC_DIRTY,
232
233 /* Locked, no further changes allowed.
234 * Also used to serialize changing transactions. */
235 __LC_LOCKED,
236
228 /* if we need to change the set, but currently there is no free nor 237 /* if we need to change the set, but currently there is no free nor
229 * unused element available, we are "starving", and must not give out 238 * unused element available, we are "starving", and must not give out
230 * further references, to guarantee that eventually some refcnt will 239 * further references, to guarantee that eventually some refcnt will
@@ -236,9 +245,11 @@ enum {
236}; 245};
237#define LC_PARANOIA (1<<__LC_PARANOIA) 246#define LC_PARANOIA (1<<__LC_PARANOIA)
238#define LC_DIRTY (1<<__LC_DIRTY) 247#define LC_DIRTY (1<<__LC_DIRTY)
248#define LC_LOCKED (1<<__LC_LOCKED)
239#define LC_STARVING (1<<__LC_STARVING) 249#define LC_STARVING (1<<__LC_STARVING)
240 250
241extern struct lru_cache *lc_create(const char *name, struct kmem_cache *cache, 251extern struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
252 unsigned max_pending_changes,
242 unsigned e_count, size_t e_size, size_t e_off); 253 unsigned e_count, size_t e_size, size_t e_off);
243extern void lc_reset(struct lru_cache *lc); 254extern void lc_reset(struct lru_cache *lc);
244extern void lc_destroy(struct lru_cache *lc); 255extern void lc_destroy(struct lru_cache *lc);
@@ -249,7 +260,7 @@ extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr);
249extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); 260extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr);
250extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); 261extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr);
251extern unsigned int lc_put(struct lru_cache *lc, struct lc_element *e); 262extern unsigned int lc_put(struct lru_cache *lc, struct lc_element *e);
252extern void lc_changed(struct lru_cache *lc, struct lc_element *e); 263extern void lc_committed(struct lru_cache *lc);
253 264
254struct seq_file; 265struct seq_file;
255extern size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc); 266extern size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc);
@@ -258,32 +269,40 @@ extern void lc_seq_dump_details(struct seq_file *seq, struct lru_cache *lc, char
258 void (*detail) (struct seq_file *, struct lc_element *)); 269 void (*detail) (struct seq_file *, struct lc_element *));
259 270
260/** 271/**
261 * lc_try_lock - can be used to stop lc_get() from changing the tracked set 272 * lc_try_lock_for_transaction - can be used to stop lc_get() from changing the tracked set
262 * @lc: the lru cache to operate on 273 * @lc: the lru cache to operate on
263 * 274 *
264 * Note that the reference counts and order on the active and lru lists may 275 * Allows (expects) the set to be "dirty". Note that the reference counts and
265 * still change. Returns true if we acquired the lock. 276 * order on the active and lru lists may still change. Used to serialize
277 * changing transactions. Returns true if we aquired the lock.
266 */ 278 */
267static inline int lc_try_lock(struct lru_cache *lc) 279static inline int lc_try_lock_for_transaction(struct lru_cache *lc)
268{ 280{
269 return !test_and_set_bit(__LC_DIRTY, &lc->flags); 281 return !test_and_set_bit(__LC_LOCKED, &lc->flags);
270} 282}
271 283
272/** 284/**
285 * lc_try_lock - variant to stop lc_get() from changing the tracked set
286 * @lc: the lru cache to operate on
287 *
288 * Note that the reference counts and order on the active and lru lists may
289 * still change. Only works on a "clean" set. Returns true if we aquired the
290 * lock, which means there are no pending changes, and any further attempt to
291 * change the set will not succeed until the next lc_unlock().
292 */
293extern int lc_try_lock(struct lru_cache *lc);
294
295/**
273 * lc_unlock - unlock @lc, allow lc_get() to change the set again 296 * lc_unlock - unlock @lc, allow lc_get() to change the set again
274 * @lc: the lru cache to operate on 297 * @lc: the lru cache to operate on
275 */ 298 */
276static inline void lc_unlock(struct lru_cache *lc) 299static inline void lc_unlock(struct lru_cache *lc)
277{ 300{
278 clear_bit(__LC_DIRTY, &lc->flags); 301 clear_bit(__LC_DIRTY, &lc->flags);
279 smp_mb__after_clear_bit(); 302 clear_bit_unlock(__LC_LOCKED, &lc->flags);
280} 303}
281 304
282static inline int lc_is_used(struct lru_cache *lc, unsigned int enr) 305extern bool lc_is_used(struct lru_cache *lc, unsigned int enr);
283{
284 struct lc_element *e = lc_find(lc, enr);
285 return e && e->refcnt;
286}
287 306
288#define lc_entry(ptr, type, member) \ 307#define lc_entry(ptr, type, member) \
289 container_of(ptr, type, member) 308 container_of(ptr, type, member)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 11ddc7ffeba8..0108a56f814e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -21,11 +21,14 @@
21#define _LINUX_MEMCONTROL_H 21#define _LINUX_MEMCONTROL_H
22#include <linux/cgroup.h> 22#include <linux/cgroup.h>
23#include <linux/vm_event_item.h> 23#include <linux/vm_event_item.h>
24#include <linux/hardirq.h>
25#include <linux/jump_label.h>
24 26
25struct mem_cgroup; 27struct mem_cgroup;
26struct page_cgroup; 28struct page_cgroup;
27struct page; 29struct page;
28struct mm_struct; 30struct mm_struct;
31struct kmem_cache;
29 32
30/* Stats that can be updated by kernel. */ 33/* Stats that can be updated by kernel. */
31enum mem_cgroup_page_stat_item { 34enum mem_cgroup_page_stat_item {
@@ -181,7 +184,14 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
181 gfp_t gfp_mask, 184 gfp_t gfp_mask,
182 unsigned long *total_scanned); 185 unsigned long *total_scanned);
183 186
184void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); 187void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
188static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
189 enum vm_event_item idx)
190{
191 if (mem_cgroup_disabled())
192 return;
193 __mem_cgroup_count_vm_event(mm, idx);
194}
185#ifdef CONFIG_TRANSPARENT_HUGEPAGE 195#ifdef CONFIG_TRANSPARENT_HUGEPAGE
186void mem_cgroup_split_huge_fixup(struct page *head); 196void mem_cgroup_split_huge_fixup(struct page *head);
187#endif 197#endif
@@ -407,5 +417,211 @@ static inline void sock_release_memcg(struct sock *sk)
407{ 417{
408} 418}
409#endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */ 419#endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */
420
421#ifdef CONFIG_MEMCG_KMEM
422extern struct static_key memcg_kmem_enabled_key;
423
424extern int memcg_limited_groups_array_size;
425
426/*
427 * Helper macro to loop through all memcg-specific caches. Callers must still
428 * check if the cache is valid (it is either valid or NULL).
429 * the slab_mutex must be held when looping through those caches
430 */
431#define for_each_memcg_cache_index(_idx) \
432 for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++)
433
434static inline bool memcg_kmem_enabled(void)
435{
436 return static_key_false(&memcg_kmem_enabled_key);
437}
438
439/*
440 * In general, we'll do everything in our power to not incur in any overhead
441 * for non-memcg users for the kmem functions. Not even a function call, if we
442 * can avoid it.
443 *
444 * Therefore, we'll inline all those functions so that in the best case, we'll
445 * see that kmemcg is off for everybody and proceed quickly. If it is on,
446 * we'll still do most of the flag checking inline. We check a lot of
447 * conditions, but because they are pretty simple, they are expected to be
448 * fast.
449 */
450bool __memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg,
451 int order);
452void __memcg_kmem_commit_charge(struct page *page,
453 struct mem_cgroup *memcg, int order);
454void __memcg_kmem_uncharge_pages(struct page *page, int order);
455
456int memcg_cache_id(struct mem_cgroup *memcg);
457int memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s,
458 struct kmem_cache *root_cache);
459void memcg_release_cache(struct kmem_cache *cachep);
460void memcg_cache_list_add(struct mem_cgroup *memcg, struct kmem_cache *cachep);
461
462int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
463void memcg_update_array_size(int num_groups);
464
465struct kmem_cache *
466__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp);
467
468void mem_cgroup_destroy_cache(struct kmem_cache *cachep);
469void kmem_cache_destroy_memcg_children(struct kmem_cache *s);
470
471/**
472 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed.
473 * @gfp: the gfp allocation flags.
474 * @memcg: a pointer to the memcg this was charged against.
475 * @order: allocation order.
476 *
477 * returns true if the memcg where the current task belongs can hold this
478 * allocation.
479 *
480 * We return true automatically if this allocation is not to be accounted to
481 * any memcg.
482 */
483static inline bool
484memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
485{
486 if (!memcg_kmem_enabled())
487 return true;
488
489 /*
490 * __GFP_NOFAIL allocations will move on even if charging is not
491 * possible. Therefore we don't even try, and have this allocation
492 * unaccounted. We could in theory charge it with
493 * res_counter_charge_nofail, but we hope those allocations are rare,
494 * and won't be worth the trouble.
495 */
496 if (!(gfp & __GFP_KMEMCG) || (gfp & __GFP_NOFAIL))
497 return true;
498 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
499 return true;
500
501 /* If the test is dying, just let it go. */
502 if (unlikely(fatal_signal_pending(current)))
503 return true;
504
505 return __memcg_kmem_newpage_charge(gfp, memcg, order);
506}
507
508/**
509 * memcg_kmem_uncharge_pages: uncharge pages from memcg
510 * @page: pointer to struct page being freed
511 * @order: allocation order.
512 *
513 * there is no need to specify memcg here, since it is embedded in page_cgroup
514 */
515static inline void
516memcg_kmem_uncharge_pages(struct page *page, int order)
517{
518 if (memcg_kmem_enabled())
519 __memcg_kmem_uncharge_pages(page, order);
520}
521
522/**
523 * memcg_kmem_commit_charge: embeds correct memcg in a page
524 * @page: pointer to struct page recently allocated
525 * @memcg: the memcg structure we charged against
526 * @order: allocation order.
527 *
528 * Needs to be called after memcg_kmem_newpage_charge, regardless of success or
529 * failure of the allocation. if @page is NULL, this function will revert the
530 * charges. Otherwise, it will commit the memcg given by @memcg to the
531 * corresponding page_cgroup.
532 */
533static inline void
534memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
535{
536 if (memcg_kmem_enabled() && memcg)
537 __memcg_kmem_commit_charge(page, memcg, order);
538}
539
540/**
541 * memcg_kmem_get_cache: selects the correct per-memcg cache for allocation
542 * @cachep: the original global kmem cache
543 * @gfp: allocation flags.
544 *
545 * This function assumes that the task allocating, which determines the memcg
546 * in the page allocator, belongs to the same cgroup throughout the whole
547 * process. Misacounting can happen if the task calls memcg_kmem_get_cache()
548 * while belonging to a cgroup, and later on changes. This is considered
549 * acceptable, and should only happen upon task migration.
550 *
551 * Before the cache is created by the memcg core, there is also a possible
552 * imbalance: the task belongs to a memcg, but the cache being allocated from
553 * is the global cache, since the child cache is not yet guaranteed to be
554 * ready. This case is also fine, since in this case the GFP_KMEMCG will not be
555 * passed and the page allocator will not attempt any cgroup accounting.
556 */
557static __always_inline struct kmem_cache *
558memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
559{
560 if (!memcg_kmem_enabled())
561 return cachep;
562 if (gfp & __GFP_NOFAIL)
563 return cachep;
564 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
565 return cachep;
566 if (unlikely(fatal_signal_pending(current)))
567 return cachep;
568
569 return __memcg_kmem_get_cache(cachep, gfp);
570}
571#else
572#define for_each_memcg_cache_index(_idx) \
573 for (; NULL; )
574
575static inline bool memcg_kmem_enabled(void)
576{
577 return false;
578}
579
580static inline bool
581memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
582{
583 return true;
584}
585
586static inline void memcg_kmem_uncharge_pages(struct page *page, int order)
587{
588}
589
590static inline void
591memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
592{
593}
594
595static inline int memcg_cache_id(struct mem_cgroup *memcg)
596{
597 return -1;
598}
599
600static inline int
601memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s,
602 struct kmem_cache *root_cache)
603{
604 return 0;
605}
606
607static inline void memcg_release_cache(struct kmem_cache *cachep)
608{
609}
610
611static inline void memcg_cache_list_add(struct mem_cgroup *memcg,
612 struct kmem_cache *s)
613{
614}
615
616static inline struct kmem_cache *
617memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
618{
619 return cachep;
620}
621
622static inline void kmem_cache_destroy_memcg_children(struct kmem_cache *s)
623{
624}
625#endif /* CONFIG_MEMCG_KMEM */
410#endif /* _LINUX_MEMCONTROL_H */ 626#endif /* _LINUX_MEMCONTROL_H */
411 627
diff --git a/include/linux/memory.h b/include/linux/memory.h
index ff9a9f8e0ed9..45e93b468878 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -53,6 +53,8 @@ int arch_get_memory_phys_device(unsigned long start_pfn);
53struct memory_notify { 53struct memory_notify {
54 unsigned long start_pfn; 54 unsigned long start_pfn;
55 unsigned long nr_pages; 55 unsigned long nr_pages;
56 int status_change_nid_normal;
57 int status_change_nid_high;
56 int status_change_nid; 58 int status_change_nid;
57}; 59};
58 60
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 95573ec4ee6c..4a45c4e50025 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -26,6 +26,13 @@ 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 */
30enum {
31 ONLINE_KEEP,
32 ONLINE_KERNEL,
33 ONLINE_MOVABLE,
34};
35
29/* 36/*
30 * pgdat resizing functions 37 * pgdat resizing functions
31 */ 38 */
@@ -46,6 +53,10 @@ void pgdat_resize_init(struct pglist_data *pgdat)
46} 53}
47/* 54/*
48 * Zone resizing functions 55 * Zone resizing functions
56 *
57 * Note: any attempt to resize a zone should has pgdat_resize_lock()
58 * zone_span_writelock() both held. This ensure the size of a zone
59 * can't be changed while pgdat_resize_lock() held.
49 */ 60 */
50static inline unsigned zone_span_seqbegin(struct zone *zone) 61static inline unsigned zone_span_seqbegin(struct zone *zone)
51{ 62{
@@ -71,7 +82,7 @@ extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages);
71extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); 82extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
72extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 83extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
73/* VM interface that may be used by firmware interface */ 84/* VM interface that may be used by firmware interface */
74extern int online_pages(unsigned long, unsigned long); 85extern int online_pages(unsigned long, unsigned long, int);
75extern void __offline_isolated_pages(unsigned long, unsigned long); 86extern void __offline_isolated_pages(unsigned long, unsigned long);
76 87
77typedef void (*online_page_callback_t)(struct page *page); 88typedef void (*online_page_callback_t)(struct page *page);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index e5ccb9ddd90e..0d7df39a5885 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -82,16 +82,6 @@ static inline void mpol_cond_put(struct mempolicy *pol)
82 __mpol_put(pol); 82 __mpol_put(pol);
83} 83}
84 84
85extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
86 struct mempolicy *frompol);
87static inline struct mempolicy *mpol_cond_copy(struct mempolicy *tompol,
88 struct mempolicy *frompol)
89{
90 if (!frompol)
91 return frompol;
92 return __mpol_cond_copy(tompol, frompol);
93}
94
95extern struct mempolicy *__mpol_dup(struct mempolicy *pol); 85extern struct mempolicy *__mpol_dup(struct mempolicy *pol);
96static inline struct mempolicy *mpol_dup(struct mempolicy *pol) 86static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
97{ 87{
@@ -133,7 +123,7 @@ struct sp_node {
133 123
134struct shared_policy { 124struct shared_policy {
135 struct rb_root root; 125 struct rb_root root;
136 struct mutex mutex; 126 spinlock_t lock;
137}; 127};
138 128
139void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
@@ -175,11 +165,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
175 165
176 166
177#ifdef CONFIG_TMPFS 167#ifdef CONFIG_TMPFS
178extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); 168extern int mpol_parse_str(char *str, struct mempolicy **mpol);
179#endif 169#endif
180 170
181extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
182 int no_context);
183 172
184/* Check if a vma is migratable */ 173/* Check if a vma is migratable */
185static inline int vma_migratable(struct vm_area_struct *vma) 174static inline int vma_migratable(struct vm_area_struct *vma)
@@ -198,6 +187,8 @@ static inline int vma_migratable(struct vm_area_struct *vma)
198 return 1; 187 return 1;
199} 188}
200 189
190extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
191
201#else 192#else
202 193
203struct mempolicy {}; 194struct mempolicy {};
@@ -215,12 +206,6 @@ static inline void mpol_cond_put(struct mempolicy *pol)
215{ 206{
216} 207}
217 208
218static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to,
219 struct mempolicy *from)
220{
221 return from;
222}
223
224static inline void mpol_get(struct mempolicy *pol) 209static inline void mpol_get(struct mempolicy *pol)
225{ 210{
226} 211}
@@ -310,18 +295,22 @@ static inline void check_highest_zone(int k)
310} 295}
311 296
312#ifdef CONFIG_TMPFS 297#ifdef CONFIG_TMPFS
313static inline int mpol_parse_str(char *str, struct mempolicy **mpol, 298static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
314 int no_context)
315{ 299{
316 return 1; /* error */ 300 return 1; /* error */
317} 301}
318#endif 302#endif
319 303
320static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 304static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
321 int no_context)
322{ 305{
323 return 0; 306 return 0;
324} 307}
325 308
309static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
310 unsigned long address)
311{
312 return -1; /* no node preference */
313}
314
326#endif /* CONFIG_NUMA */ 315#endif /* CONFIG_NUMA */
327#endif 316#endif
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index a0ca0dca1244..478672ed0c3d 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -364,6 +364,6 @@ static inline int pm80x_dev_resume(struct device *dev)
364#endif 364#endif
365 365
366extern int pm80x_init(struct i2c_client *client, 366extern int pm80x_init(struct i2c_client *client,
367 const struct i2c_device_id *id) __devinit; 367 const struct i2c_device_id *id);
368extern int pm80x_deinit(struct i2c_client *client); 368extern int pm80x_deinit(struct i2c_client *client);
369#endif /* __LINUX_MFD_88PM80X_H */ 369#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 5d5298d56026..2138bd33021a 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -267,39 +267,21 @@ struct abx500_bm_data {
267 int gnd_lift_resistance; 267 int gnd_lift_resistance;
268 const struct abx500_maxim_parameters *maxi; 268 const struct abx500_maxim_parameters *maxi;
269 const struct abx500_bm_capacity_levels *cap_levels; 269 const struct abx500_bm_capacity_levels *cap_levels;
270 const struct abx500_battery_type *bat_type; 270 struct abx500_battery_type *bat_type;
271 const struct abx500_bm_charger_parameters *chg_params; 271 const struct abx500_bm_charger_parameters *chg_params;
272 const struct abx500_fg_parameters *fg_params; 272 const struct abx500_fg_parameters *fg_params;
273}; 273};
274 274
275struct abx500_chargalg_platform_data { 275extern struct abx500_bm_data ab8500_bm_data;
276 char **supplied_to;
277 size_t num_supplicants;
278};
279
280struct abx500_charger_platform_data {
281 char **supplied_to;
282 size_t num_supplicants;
283 bool autopower_cfg;
284};
285 276
286struct abx500_btemp_platform_data { 277enum {
287 char **supplied_to; 278 NTC_EXTERNAL = 0,
288 size_t num_supplicants; 279 NTC_INTERNAL,
289}; 280};
290 281
291struct abx500_fg_platform_data { 282int bmdevs_of_probe(struct device *dev,
292 char **supplied_to; 283 struct device_node *np,
293 size_t num_supplicants; 284 struct abx500_bm_data **battery);
294};
295
296struct abx500_bm_plat_data {
297 struct abx500_bm_data *battery;
298 struct abx500_charger_platform_data *charger;
299 struct abx500_btemp_platform_data *btemp;
300 struct abx500_fg_platform_data *fg;
301 struct abx500_chargalg_platform_data *chargalg;
302};
303 285
304int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, 286int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
305 u8 value); 287 u8 value);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 1491044efa10..1cb5698b4d76 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,9 +291,9 @@ struct ab8500_platform_data {
291 struct ab8500_codec_platform_data *codec; 291 struct ab8500_codec_platform_data *codec;
292}; 292};
293 293
294extern int __devinit ab8500_init(struct ab8500 *ab8500, 294extern int ab8500_init(struct ab8500 *ab8500,
295 enum ab8500_version version); 295 enum ab8500_version version);
296extern int __devexit ab8500_exit(struct ab8500 *ab8500); 296extern int ab8500_exit(struct ab8500 *ab8500);
297 297
298extern int ab8500_suspend(struct ab8500 *ab8500); 298extern int ab8500_suspend(struct ab8500 *ab8500);
299 299
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index dd231ac0bb1f..a580363a7d29 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -78,6 +78,8 @@ enum arizona_type {
78 78
79#define ARIZONA_NUM_IRQ 50 79#define ARIZONA_NUM_IRQ 50
80 80
81struct snd_soc_dapm_context;
82
81struct arizona { 83struct arizona {
82 struct regmap *regmap; 84 struct regmap *regmap;
83 struct device *dev; 85 struct device *dev;
@@ -98,6 +100,8 @@ struct arizona {
98 100
99 struct mutex clk_lock; 101 struct mutex clk_lock;
100 int clk32k_ref; 102 int clk32k_ref;
103
104 struct snd_soc_dapm_context *dapm;
101}; 105};
102 106
103int arizona_clk32k_enable(struct arizona *arizona); 107int arizona_clk32k_enable(struct arizona *arizona);
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 7ab442905a57..8b1d1daaae16 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -62,6 +62,9 @@
62 62
63#define ARIZONA_MAX_OUTPUT 6 63#define ARIZONA_MAX_OUTPUT 6
64 64
65#define ARIZONA_HAP_ACT_ERM 0
66#define ARIZONA_HAP_ACT_LRA 2
67
65#define ARIZONA_MAX_PDM_SPK 2 68#define ARIZONA_MAX_PDM_SPK 2
66 69
67struct regulator_init_data; 70struct regulator_init_data;
@@ -114,6 +117,9 @@ struct arizona_pdata {
114 117
115 /** PDM speaker format */ 118 /** PDM speaker format */
116 unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK]; 119 unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
120
121 /** Haptic actuator type */
122 unsigned int hap_act;
117}; 123};
118 124
119#endif 125#endif
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7671a287dfee..1f6fe31a4d5c 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -76,6 +76,7 @@
76#define ARIZONA_RATE_ESTIMATOR_3 0x154 76#define ARIZONA_RATE_ESTIMATOR_3 0x154
77#define ARIZONA_RATE_ESTIMATOR_4 0x155 77#define ARIZONA_RATE_ESTIMATOR_4 0x155
78#define ARIZONA_RATE_ESTIMATOR_5 0x156 78#define ARIZONA_RATE_ESTIMATOR_5 0x156
79#define ARIZONA_DYNAMIC_FREQUENCY_SCALING_1 0x161
79#define ARIZONA_FLL1_CONTROL_1 0x171 80#define ARIZONA_FLL1_CONTROL_1 0x171
80#define ARIZONA_FLL1_CONTROL_2 0x172 81#define ARIZONA_FLL1_CONTROL_2 0x172
81#define ARIZONA_FLL1_CONTROL_3 0x173 82#define ARIZONA_FLL1_CONTROL_3 0x173
@@ -110,6 +111,7 @@
110#define ARIZONA_FLL2_GPIO_CLOCK 0x1AA 111#define ARIZONA_FLL2_GPIO_CLOCK 0x1AA
111#define ARIZONA_MIC_CHARGE_PUMP_1 0x200 112#define ARIZONA_MIC_CHARGE_PUMP_1 0x200
112#define ARIZONA_LDO1_CONTROL_1 0x210 113#define ARIZONA_LDO1_CONTROL_1 0x210
114#define ARIZONA_LDO1_CONTROL_2 0x212
113#define ARIZONA_LDO2_CONTROL_1 0x213 115#define ARIZONA_LDO2_CONTROL_1 0x213
114#define ARIZONA_MIC_BIAS_CTRL_1 0x218 116#define ARIZONA_MIC_BIAS_CTRL_1 0x218
115#define ARIZONA_MIC_BIAS_CTRL_2 0x219 117#define ARIZONA_MIC_BIAS_CTRL_2 0x219
@@ -979,6 +981,7 @@
979#define ARIZONA_DSP1_CLOCKING_1 0x1101 981#define ARIZONA_DSP1_CLOCKING_1 0x1101
980#define ARIZONA_DSP1_STATUS_1 0x1104 982#define ARIZONA_DSP1_STATUS_1 0x1104
981#define ARIZONA_DSP1_STATUS_2 0x1105 983#define ARIZONA_DSP1_STATUS_2 0x1105
984#define ARIZONA_DSP1_STATUS_3 0x1106
982#define ARIZONA_DSP2_CONTROL_1 0x1200 985#define ARIZONA_DSP2_CONTROL_1 0x1200
983#define ARIZONA_DSP2_CLOCKING_1 0x1201 986#define ARIZONA_DSP2_CLOCKING_1 0x1201
984#define ARIZONA_DSP2_STATUS_1 0x1204 987#define ARIZONA_DSP2_STATUS_1 0x1204
@@ -1574,6 +1577,13 @@
1574#define ARIZONA_SAMPLE_RATE_DETECT_D_WIDTH 5 /* SAMPLE_RATE_DETECT_D - [4:0] */ 1577#define ARIZONA_SAMPLE_RATE_DETECT_D_WIDTH 5 /* SAMPLE_RATE_DETECT_D - [4:0] */
1575 1578
1576/* 1579/*
1580 * R353 (0x161) - Dynamic Frequency Scaling 1
1581 */
1582#define ARIZONA_SUBSYS_MAX_FREQ 0x0001 /* SUBSYS_MAX_FREQ */
1583#define ARIZONA_SUBSYS_MAX_FREQ_SHIFT 0 /* SUBSYS_MAX_FREQ */
1584#define ARIZONA_SUBSYS_MAX_FREQ_WIDTH 1 /* SUBSYS_MAX_FREQ */
1585
1586/*
1577 * R369 (0x171) - FLL1 Control 1 1587 * R369 (0x171) - FLL1 Control 1
1578 */ 1588 */
1579#define ARIZONA_FLL1_FREERUN 0x0002 /* FLL1_FREERUN */ 1589#define ARIZONA_FLL1_FREERUN 0x0002 /* FLL1_FREERUN */
@@ -1889,6 +1899,13 @@
1889#define ARIZONA_LDO1_ENA_WIDTH 1 /* LDO1_ENA */ 1899#define ARIZONA_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
1890 1900
1891/* 1901/*
1902 * R530 (0x212) - LDO1 Control 2
1903 */
1904#define ARIZONA_LDO1_HI_PWR 0x0001 /* LDO1_HI_PWR */
1905#define ARIZONA_LDO1_HI_PWR_SHIFT 0 /* LDO1_HI_PWR */
1906#define ARIZONA_LDO1_HI_PWR_WIDTH 1 /* LDO1_HI_PWR */
1907
1908/*
1892 * R531 (0x213) - LDO2 Control 1 1909 * R531 (0x213) - LDO2 Control 1
1893 */ 1910 */
1894#define ARIZONA_LDO2_VSEL_MASK 0x07E0 /* LDO2_VSEL - [10:5] */ 1911#define ARIZONA_LDO2_VSEL_MASK 0x07E0 /* LDO2_VSEL - [10:5] */
diff --git a/include/linux/mfd/as3711.h b/include/linux/mfd/as3711.h
new file mode 100644
index 000000000000..38452ce1e892
--- /dev/null
+++ b/include/linux/mfd/as3711.h
@@ -0,0 +1,126 @@
1/*
2 * AS3711 PMIC MFC driver header
3 *
4 * Copyright (C) 2012 Renesas Electronics Corporation
5 * Author: Guennadi Liakhovetski, <g.liakhovetski@gmx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the version 2 of the GNU General Public License as
9 * published by the Free Software Foundation
10 */
11
12#ifndef MFD_AS3711_H
13#define MFD_AS3711_H
14
15/*
16 * Client data
17 */
18
19/* Register addresses */
20#define AS3711_SD_1_VOLTAGE 0 /* Digital Step-Down */
21#define AS3711_SD_2_VOLTAGE 1
22#define AS3711_SD_3_VOLTAGE 2
23#define AS3711_SD_4_VOLTAGE 3
24#define AS3711_LDO_1_VOLTAGE 4 /* Analog LDO */
25#define AS3711_LDO_2_VOLTAGE 5
26#define AS3711_LDO_3_VOLTAGE 6 /* Digital LDO */
27#define AS3711_LDO_4_VOLTAGE 7
28#define AS3711_LDO_5_VOLTAGE 8
29#define AS3711_LDO_6_VOLTAGE 9
30#define AS3711_LDO_7_VOLTAGE 0xa
31#define AS3711_LDO_8_VOLTAGE 0xb
32#define AS3711_SD_CONTROL 0x10
33#define AS3711_GPIO_SIGNAL_OUT 0x20
34#define AS3711_GPIO_SIGNAL_IN 0x21
35#define AS3711_SD_CONTROL_1 0x30
36#define AS3711_SD_CONTROL_2 0x31
37#define AS3711_CURR_CONTROL 0x40
38#define AS3711_CURR1_VALUE 0x43
39#define AS3711_CURR2_VALUE 0x44
40#define AS3711_CURR3_VALUE 0x45
41#define AS3711_STEPUP_CONTROL_1 0x50
42#define AS3711_STEPUP_CONTROL_2 0x51
43#define AS3711_STEPUP_CONTROL_4 0x53
44#define AS3711_STEPUP_CONTROL_5 0x54
45#define AS3711_REG_STATUS 0x73
46#define AS3711_INTERRUPT_STATUS_1 0x77
47#define AS3711_INTERRUPT_STATUS_2 0x78
48#define AS3711_INTERRUPT_STATUS_3 0x79
49#define AS3711_CHARGER_STATUS_1 0x86
50#define AS3711_CHARGER_STATUS_2 0x87
51#define AS3711_ASIC_ID_1 0x90
52#define AS3711_ASIC_ID_2 0x91
53
54#define AS3711_MAX_REGS 0x92
55
56/* Regulators */
57enum {
58 AS3711_REGULATOR_SD_1,
59 AS3711_REGULATOR_SD_2,
60 AS3711_REGULATOR_SD_3,
61 AS3711_REGULATOR_SD_4,
62 AS3711_REGULATOR_LDO_1,
63 AS3711_REGULATOR_LDO_2,
64 AS3711_REGULATOR_LDO_3,
65 AS3711_REGULATOR_LDO_4,
66 AS3711_REGULATOR_LDO_5,
67 AS3711_REGULATOR_LDO_6,
68 AS3711_REGULATOR_LDO_7,
69 AS3711_REGULATOR_LDO_8,
70
71 AS3711_REGULATOR_MAX,
72};
73
74struct device;
75struct regmap;
76
77struct as3711 {
78 struct device *dev;
79 struct regmap *regmap;
80};
81
82#define AS3711_MAX_STEPDOWN 4
83#define AS3711_MAX_STEPUP 2
84#define AS3711_MAX_LDO 8
85
86enum as3711_su2_feedback {
87 AS3711_SU2_VOLTAGE,
88 AS3711_SU2_CURR1,
89 AS3711_SU2_CURR2,
90 AS3711_SU2_CURR3,
91 AS3711_SU2_CURR_AUTO,
92};
93
94enum as3711_su2_fbprot {
95 AS3711_SU2_LX_SD4,
96 AS3711_SU2_GPIO2,
97 AS3711_SU2_GPIO3,
98 AS3711_SU2_GPIO4,
99};
100
101/*
102 * Platform data
103 */
104
105struct as3711_regulator_pdata {
106 struct regulator_init_data *init_data[AS3711_REGULATOR_MAX];
107};
108
109struct as3711_bl_pdata {
110 const char *su1_fb;
111 int su1_max_uA;
112 const char *su2_fb;
113 int su2_max_uA;
114 enum as3711_su2_feedback su2_feedback;
115 enum as3711_su2_fbprot su2_fbprot;
116 bool su2_auto_curr1;
117 bool su2_auto_curr2;
118 bool su2_auto_curr3;
119};
120
121struct as3711_platform_data {
122 struct as3711_regulator_pdata regulator;
123 struct as3711_bl_pdata backlight;
124};
125
126#endif
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 0507c4c21a7d..86dd93de6ff2 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -146,4 +146,14 @@ void da9052_device_exit(struct da9052 *da9052);
146 146
147extern struct regmap_config da9052_regmap_config; 147extern struct regmap_config da9052_regmap_config;
148 148
149int da9052_irq_init(struct da9052 *da9052);
150int da9052_irq_exit(struct da9052 *da9052);
151int da9052_request_irq(struct da9052 *da9052, int irq, char *name,
152 irq_handler_t handler, void *data);
153void da9052_free_irq(struct da9052 *da9052, int irq, void *data);
154
155int da9052_enable_irq(struct da9052 *da9052, int irq);
156int da9052_disable_irq(struct da9052 *da9052, int irq);
157int da9052_disable_irq_nosync(struct da9052 *da9052, int irq);
158
149#endif /* __MFD_DA9052_DA9052_H */ 159#endif /* __MFD_DA9052_DA9052_H */
diff --git a/include/linux/mfd/da9055/core.h b/include/linux/mfd/da9055/core.h
index c96ad682c59e..956afa445998 100644
--- a/include/linux/mfd/da9055/core.h
+++ b/include/linux/mfd/da9055/core.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * da9055 declarations for DA9055 PMICs. 2 * da9055 declarations for DA9055 PMICs.
3 * 3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd. 4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
diff --git a/include/linux/mfd/da9055/pdata.h b/include/linux/mfd/da9055/pdata.h
index 147293b4471d..04e092be4b07 100644
--- a/include/linux/mfd/da9055/pdata.h
+++ b/include/linux/mfd/da9055/pdata.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2012 Dialog Semiconductor Ltd. 1/* Copyright (C) 2012 Dialog Semiconductor Ltd.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify 3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -25,8 +25,29 @@ struct da9055_pdata {
25 int gpio_base; 25 int gpio_base;
26 26
27 struct regulator_init_data *regulators[DA9055_MAX_REGULATORS]; 27 struct regulator_init_data *regulators[DA9055_MAX_REGULATORS];
28 bool reset_enable; /* Enable RTC in RESET Mode */ 28 /* Enable RTC in RESET Mode */
29 enum gpio_select *gpio_rsel; /* Select regulator set thru GPIO 1/2 */ 29 bool reset_enable;
30 enum gpio_select *gpio_ren; /* Enable regulator thru GPIO 1/2 */ 30 /*
31 * GPI muxed pin to control
32 * regulator state A/B, 0 if not available.
33 */
34 int *gpio_ren;
35 /*
36 * GPI muxed pin to control
37 * regulator set, 0 if not available.
38 */
39 int *gpio_rsel;
40 /*
41 * Regulator mode control bits value (GPI offset) that
42 * that controls the regulator state, 0 if not available.
43 */
44 enum gpio_select *reg_ren;
45 /*
46 * Regulator mode control bits value (GPI offset) that
47 * controls the regulator set A/B, 0 if not available.
48 */
49 enum gpio_select *reg_rsel;
50 /* GPIOs to enable regulator, 0 if not available */
51 int *ena_gpio;
31}; 52};
32#endif /* __DA9055_PDATA_H */ 53#endif /* __DA9055_PDATA_H */
diff --git a/include/linux/mfd/da9055/reg.h b/include/linux/mfd/da9055/reg.h
index df237ee54803..2b592e072dbf 100644
--- a/include/linux/mfd/da9055/reg.h
+++ b/include/linux/mfd/da9055/reg.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * DA9055 declarations for DA9055 PMICs. 2 * DA9055 declarations for DA9055 PMICs.
3 * 3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd. 4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index b82f6ee66a0b..6ee4247df11e 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -515,7 +515,6 @@ enum romcode_read prcmu_get_rc_p2a(void);
515enum ap_pwrst prcmu_get_xp70_current_state(void); 515enum ap_pwrst prcmu_get_xp70_current_state(void);
516bool prcmu_has_arm_maxopp(void); 516bool prcmu_has_arm_maxopp(void);
517struct prcmu_fw_version *prcmu_get_fw_version(void); 517struct prcmu_fw_version *prcmu_get_fw_version(void);
518int prcmu_request_ape_opp_100_voltage(bool enable);
519int prcmu_release_usb_wakeup_state(void); 518int prcmu_release_usb_wakeup_state(void);
520void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 519void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
521 struct prcmu_auto_pm_config *idle); 520 struct prcmu_auto_pm_config *idle);
@@ -564,6 +563,7 @@ int db8500_prcmu_set_arm_opp(u8 opp);
564int db8500_prcmu_get_arm_opp(void); 563int db8500_prcmu_get_arm_opp(void);
565int db8500_prcmu_set_ape_opp(u8 opp); 564int db8500_prcmu_set_ape_opp(u8 opp);
566int db8500_prcmu_get_ape_opp(void); 565int db8500_prcmu_get_ape_opp(void);
566int db8500_prcmu_request_ape_opp_100_voltage(bool enable);
567int db8500_prcmu_set_ddr_opp(u8 opp); 567int db8500_prcmu_set_ddr_opp(u8 opp);
568int db8500_prcmu_get_ddr_opp(void); 568int db8500_prcmu_get_ddr_opp(void);
569 569
@@ -610,7 +610,7 @@ static inline int db8500_prcmu_get_ape_opp(void)
610 return APE_100_OPP; 610 return APE_100_OPP;
611} 611}
612 612
613static inline int prcmu_request_ape_opp_100_voltage(bool enable) 613static inline int db8500_prcmu_request_ape_opp_100_voltage(bool enable)
614{ 614{
615 return 0; 615 return 0;
616} 616}
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index c410d99bd667..c202d6c4d879 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -336,6 +336,11 @@ static inline int prcmu_get_ape_opp(void)
336 return db8500_prcmu_get_ape_opp(); 336 return db8500_prcmu_get_ape_opp();
337} 337}
338 338
339static inline int prcmu_request_ape_opp_100_voltage(bool enable)
340{
341 return db8500_prcmu_request_ape_opp_100_voltage(enable);
342}
343
339static inline void prcmu_system_reset(u16 reset_code) 344static inline void prcmu_system_reset(u16 reset_code)
340{ 345{
341 return db8500_prcmu_system_reset(reset_code); 346 return db8500_prcmu_system_reset(reset_code);
@@ -507,6 +512,11 @@ static inline int prcmu_get_ape_opp(void)
507 return APE_100_OPP; 512 return APE_100_OPP;
508} 513}
509 514
515static inline int prcmu_request_ape_opp_100_voltage(bool enable)
516{
517 return 0;
518}
519
510static inline int prcmu_set_arm_opp(u8 opp) 520static inline int prcmu_set_arm_opp(u8 opp)
511{ 521{
512 return 0; 522 return 0;
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h
index cec364bdccfa..2a32b16f79cb 100644
--- a/include/linux/mfd/lp8788.h
+++ b/include/linux/mfd/lp8788.h
@@ -211,16 +211,16 @@ struct lp8788_chg_param {
211 211
212/* 212/*
213 * struct lp8788_charger_platform_data 213 * struct lp8788_charger_platform_data
214 * @vbatt_adc : adc selection id for battery voltage 214 * @adc_vbatt : adc channel name for battery voltage
215 * @batt_temp_adc : adc selection id for battery temperature 215 * @adc_batt_temp : adc channel name for battery temperature
216 * @max_vbatt_mv : used for calculating battery capacity 216 * @max_vbatt_mv : used for calculating battery capacity
217 * @chg_params : initial charging parameters 217 * @chg_params : initial charging parameters
218 * @num_chg_params : numbers of charging parameters 218 * @num_chg_params : numbers of charging parameters
219 * @charger_event : the charger event can be reported to the platform side 219 * @charger_event : the charger event can be reported to the platform side
220 */ 220 */
221struct lp8788_charger_platform_data { 221struct lp8788_charger_platform_data {
222 enum lp8788_adc_id vbatt_adc; 222 const char *adc_vbatt;
223 enum lp8788_adc_id batt_temp_adc; 223 const char *adc_batt_temp;
224 unsigned int max_vbatt_mv; 224 unsigned int max_vbatt_mv;
225 struct lp8788_chg_param *chg_params; 225 struct lp8788_chg_param *chg_params;
226 int num_chg_params; 226 int num_chg_params;
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 830152cfae33..6ae21bf47d64 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -316,6 +316,7 @@ enum max8997_irq {
316#define MAX8997_NUM_GPIO 12 316#define MAX8997_NUM_GPIO 12
317struct max8997_dev { 317struct max8997_dev {
318 struct device *dev; 318 struct device *dev;
319 struct max8997_platform_data *pdata;
319 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 320 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
320 struct i2c_client *rtc; /* slave addr 0x0c */ 321 struct i2c_client *rtc; /* slave addr 0x0c */
321 struct i2c_client *haptic; /* slave addr 0x90 */ 322 struct i2c_client *haptic; /* slave addr 0x90 */
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 328d8e24b533..1d4a4fe6ac33 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -75,6 +75,7 @@ enum max8998_regulators {
75struct max8997_regulator_data { 75struct max8997_regulator_data {
76 int id; 76 int id;
77 struct regulator_init_data *initdata; 77 struct regulator_init_data *initdata;
78 struct device_node *reg_node;
78}; 79};
79 80
80enum max8997_muic_usb_type { 81enum max8997_muic_usb_type {
diff --git a/include/linux/mfd/menelaus.h b/include/linux/mfd/menelaus.h
new file mode 100644
index 000000000000..f097e89134cb
--- /dev/null
+++ b/include/linux/mfd/menelaus.h
@@ -0,0 +1,47 @@
1/*
2 * Functions to access Menelaus power management chip
3 */
4
5#ifndef __ASM_ARCH_MENELAUS_H
6#define __ASM_ARCH_MENELAUS_H
7
8struct device;
9
10struct menelaus_platform_data {
11 int (* late_init)(struct device *dev);
12};
13
14extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
15 void *data);
16extern void menelaus_unregister_mmc_callback(void);
17extern int menelaus_set_mmc_opendrain(int slot, int enable);
18extern int menelaus_set_mmc_slot(int slot, int enable, int power, int cd_on);
19
20extern int menelaus_set_vmem(unsigned int mV);
21extern int menelaus_set_vio(unsigned int mV);
22extern int menelaus_set_vmmc(unsigned int mV);
23extern int menelaus_set_vaux(unsigned int mV);
24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
25extern int menelaus_set_slot_sel(int enable);
26extern int menelaus_get_slot_pin_states(void);
27extern int menelaus_set_vcore_sw(unsigned int mV);
28extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
29
30#define EN_VPLL_SLEEP (1 << 7)
31#define EN_VMMC_SLEEP (1 << 6)
32#define EN_VAUX_SLEEP (1 << 5)
33#define EN_VIO_SLEEP (1 << 4)
34#define EN_VMEM_SLEEP (1 << 3)
35#define EN_DC3_SLEEP (1 << 2)
36#define EN_DC2_SLEEP (1 << 1)
37#define EN_VC_SLEEP (1 << 0)
38
39extern int menelaus_set_regulator_sleep(int enable, u32 val);
40
41#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
42#define omap_has_menelaus() 1
43#else
44#define omap_has_menelaus() 0
45#endif
46
47#endif
diff --git a/include/linux/mfd/pm8xxx/irq.h b/include/linux/mfd/pm8xxx/irq.h
index 4b21769f4483..f83d6b43ecbb 100644
--- a/include/linux/mfd/pm8xxx/irq.h
+++ b/include/linux/mfd/pm8xxx/irq.h
@@ -37,21 +37,21 @@ struct pm_irq_chip;
37 37
38#ifdef CONFIG_MFD_PM8XXX_IRQ 38#ifdef CONFIG_MFD_PM8XXX_IRQ
39int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq); 39int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq);
40struct pm_irq_chip * __devinit pm8xxx_irq_init(struct device *dev, 40struct pm_irq_chip *pm8xxx_irq_init(struct device *dev,
41 const struct pm8xxx_irq_platform_data *pdata); 41 const struct pm8xxx_irq_platform_data *pdata);
42int __devexit pm8xxx_irq_exit(struct pm_irq_chip *chip); 42int pm8xxx_irq_exit(struct pm_irq_chip *chip);
43#else 43#else
44static inline int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq) 44static inline int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq)
45{ 45{
46 return -ENXIO; 46 return -ENXIO;
47} 47}
48static inline struct pm_irq_chip * __devinit pm8xxx_irq_init( 48static inline struct pm_irq_chip *pm8xxx_irq_init(
49 const struct device *dev, 49 const struct device *dev,
50 const struct pm8xxx_irq_platform_data *pdata) 50 const struct pm8xxx_irq_platform_data *pdata)
51{ 51{
52 return ERR_PTR(-ENXIO); 52 return ERR_PTR(-ENXIO);
53} 53}
54static inline int __devexit pm8xxx_irq_exit(struct pm_irq_chip *chip) 54static inline int pm8xxx_irq_exit(struct pm_irq_chip *chip)
55{ 55{
56 return -ENXIO; 56 return -ENXIO;
57} 57}
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 36c242e52ef1..fd413ccab915 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -33,6 +33,7 @@
33/* Maximum number of main interrupts */ 33/* Maximum number of main interrupts */
34#define MAX_MAIN_INTERRUPT 5 34#define MAX_MAIN_INTERRUPT 5
35#define RC5T583_MAX_GPEDGE_REG 2 35#define RC5T583_MAX_GPEDGE_REG 2
36#define RC5T583_MAX_INTERRUPT_EN_REGS 8
36#define RC5T583_MAX_INTERRUPT_MASK_REGS 9 37#define RC5T583_MAX_INTERRUPT_MASK_REGS 9
37 38
38/* Interrupt enable register */ 39/* Interrupt enable register */
@@ -304,7 +305,7 @@ struct rc5t583 {
304 uint8_t intc_inten_reg; 305 uint8_t intc_inten_reg;
305 306
306 /* For group interrupt bits and address */ 307 /* For group interrupt bits and address */
307 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS]; 308 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_EN_REGS];
308 309
309 /* For gpio edge */ 310 /* For gpio edge */
310 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG]; 311 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG];
diff --git a/include/linux/mfd/retu.h b/include/linux/mfd/retu.h
new file mode 100644
index 000000000000..1e2715d5b836
--- /dev/null
+++ b/include/linux/mfd/retu.h
@@ -0,0 +1,22 @@
1/*
2 * Retu MFD driver interface
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of this
6 * archive for more details.
7 */
8
9#ifndef __LINUX_MFD_RETU_H
10#define __LINUX_MFD_RETU_H
11
12struct retu_dev;
13
14int retu_read(struct retu_dev *, u8);
15int retu_write(struct retu_dev *, u8, u16);
16
17/* Registers */
18#define RETU_REG_WATCHDOG 0x17 /* Watchdog */
19#define RETU_REG_CC1 0x0d /* Common control register 1 */
20#define RETU_REG_STATUS 0x16 /* Status register */
21
22#endif /* __LINUX_MFD_RETU_H */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
new file mode 100644
index 000000000000..a8d393e3066b
--- /dev/null
+++ b/include/linux/mfd/rtsx_common.h
@@ -0,0 +1,48 @@
1/* Driver for Realtek driver-based card reader
2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */
22
23#ifndef __RTSX_COMMON_H
24#define __RTSX_COMMON_H
25
26#define DRV_NAME_RTSX_PCI "rtsx_pci"
27#define DRV_NAME_RTSX_PCI_SDMMC "rtsx_pci_sdmmc"
28#define DRV_NAME_RTSX_PCI_MS "rtsx_pci_ms"
29
30#define RTSX_REG_PAIR(addr, val) (((u32)(addr) << 16) | (u8)(val))
31
32#define RTSX_SSC_DEPTH_4M 0x01
33#define RTSX_SSC_DEPTH_2M 0x02
34#define RTSX_SSC_DEPTH_1M 0x03
35#define RTSX_SSC_DEPTH_500K 0x04
36#define RTSX_SSC_DEPTH_250K 0x05
37
38#define RTSX_SD_CARD 0
39#define RTSX_MS_CARD 1
40
41struct platform_device;
42
43struct rtsx_slot {
44 struct platform_device *p_dev;
45 void (*card_event)(struct platform_device *p_dev);
46};
47
48#endif
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
new file mode 100644
index 000000000000..060b721fcbfb
--- /dev/null
+++ b/include/linux/mfd/rtsx_pci.h
@@ -0,0 +1,794 @@
1/* Driver for Realtek PCI-Express card reader
2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */
22
23#ifndef __RTSX_PCI_H
24#define __RTSX_PCI_H
25
26#include <linux/sched.h>
27#include <linux/pci.h>
28
29#include "rtsx_common.h"
30
31#define MAX_RW_REG_CNT 1024
32
33/* PCI Operation Register Address */
34#define RTSX_HCBAR 0x00
35#define RTSX_HCBCTLR 0x04
36#define RTSX_HDBAR 0x08
37#define RTSX_HDBCTLR 0x0C
38#define RTSX_HAIMR 0x10
39#define RTSX_BIPR 0x14
40#define RTSX_BIER 0x18
41
42/* Host command buffer control register */
43#define STOP_CMD (0x01 << 28)
44
45/* Host data buffer control register */
46#define SDMA_MODE 0x00
47#define ADMA_MODE (0x02 << 26)
48#define STOP_DMA (0x01 << 28)
49#define TRIG_DMA (0x01 << 31)
50
51/* Host access internal memory register */
52#define HAIMR_TRANS_START (0x01 << 31)
53#define HAIMR_READ 0x00
54#define HAIMR_WRITE (0x01 << 30)
55#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
56#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE)
57#define HAIMR_TRANS_END (HAIMR_TRANS_START)
58
59/* Bus interrupt pending register */
60#define CMD_DONE_INT (1 << 31)
61#define DATA_DONE_INT (1 << 30)
62#define TRANS_OK_INT (1 << 29)
63#define TRANS_FAIL_INT (1 << 28)
64#define XD_INT (1 << 27)
65#define MS_INT (1 << 26)
66#define SD_INT (1 << 25)
67#define GPIO0_INT (1 << 24)
68#define OC_INT (1 << 23)
69#define SD_WRITE_PROTECT (1 << 19)
70#define XD_EXIST (1 << 18)
71#define MS_EXIST (1 << 17)
72#define SD_EXIST (1 << 16)
73#define DELINK_INT GPIO0_INT
74#define MS_OC_INT (1 << 23)
75#define SD_OC_INT (1 << 22)
76
77#define CARD_INT (XD_INT | MS_INT | SD_INT)
78#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
79#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \
80 CARD_INT | GPIO0_INT | OC_INT)
81
82#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
83
84/* Bus interrupt enable register */
85#define CMD_DONE_INT_EN (1 << 31)
86#define DATA_DONE_INT_EN (1 << 30)
87#define TRANS_OK_INT_EN (1 << 29)
88#define TRANS_FAIL_INT_EN (1 << 28)
89#define XD_INT_EN (1 << 27)
90#define MS_INT_EN (1 << 26)
91#define SD_INT_EN (1 << 25)
92#define GPIO0_INT_EN (1 << 24)
93#define OC_INT_EN (1 << 23)
94#define DELINK_INT_EN GPIO0_INT_EN
95#define MS_OC_INT_EN (1 << 23)
96#define SD_OC_INT_EN (1 << 22)
97
98#define READ_REG_CMD 0
99#define WRITE_REG_CMD 1
100#define CHECK_REG_CMD 2
101
102/*
103 * macros for easy use
104 */
105#define rtsx_pci_writel(pcr, reg, value) \
106 iowrite32(value, (pcr)->remap_addr + reg)
107#define rtsx_pci_readl(pcr, reg) \
108 ioread32((pcr)->remap_addr + reg)
109#define rtsx_pci_writew(pcr, reg, value) \
110 iowrite16(value, (pcr)->remap_addr + reg)
111#define rtsx_pci_readw(pcr, reg) \
112 ioread16((pcr)->remap_addr + reg)
113#define rtsx_pci_writeb(pcr, reg, value) \
114 iowrite8(value, (pcr)->remap_addr + reg)
115#define rtsx_pci_readb(pcr, reg) \
116 ioread8((pcr)->remap_addr + reg)
117
118#define rtsx_pci_read_config_byte(pcr, where, val) \
119 pci_read_config_byte((pcr)->pci, where, val)
120
121#define rtsx_pci_write_config_byte(pcr, where, val) \
122 pci_write_config_byte((pcr)->pci, where, val)
123
124#define rtsx_pci_read_config_dword(pcr, where, val) \
125 pci_read_config_dword((pcr)->pci, where, val)
126
127#define rtsx_pci_write_config_dword(pcr, where, val) \
128 pci_write_config_dword((pcr)->pci, where, val)
129
130#define STATE_TRANS_NONE 0
131#define STATE_TRANS_CMD 1
132#define STATE_TRANS_BUF 2
133#define STATE_TRANS_SG 3
134
135#define TRANS_NOT_READY 0
136#define TRANS_RESULT_OK 1
137#define TRANS_RESULT_FAIL 2
138#define TRANS_NO_DEVICE 3
139
140#define RTSX_RESV_BUF_LEN 4096
141#define HOST_CMDS_BUF_LEN 1024
142#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
143#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
144#define MAX_SG_ITEM_LEN 0x80000
145
146#define HOST_TO_DEVICE 0
147#define DEVICE_TO_HOST 1
148
149#define MAX_PHASE 31
150#define RX_TUNING_CNT 3
151
152/* SG descriptor */
153#define SG_INT 0x04
154#define SG_END 0x02
155#define SG_VALID 0x01
156
157#define SG_NO_OP 0x00
158#define SG_TRANS_DATA (0x02 << 4)
159#define SG_LINK_DESC (0x03 << 4)
160
161/* SD bank voltage */
162#define SD_IO_3V3 0
163#define SD_IO_1V8 1
164
165
166/* Card Clock Enable Register */
167#define SD_CLK_EN 0x04
168#define MS_CLK_EN 0x08
169
170/* Card Select Register */
171#define SD_MOD_SEL 2
172#define MS_MOD_SEL 3
173
174/* Card Output Enable Register */
175#define SD_OUTPUT_EN 0x04
176#define MS_OUTPUT_EN 0x08
177
178/* CARD_SHARE_MODE */
179#define CARD_SHARE_MASK 0x0F
180#define CARD_SHARE_MULTI_LUN 0x00
181#define CARD_SHARE_NORMAL 0x00
182#define CARD_SHARE_48_SD 0x04
183#define CARD_SHARE_48_MS 0x08
184/* CARD_SHARE_MODE for barossa */
185#define CARD_SHARE_BAROSSA_SD 0x01
186#define CARD_SHARE_BAROSSA_MS 0x02
187
188/* SD30_DRIVE_SEL */
189#define DRIVER_TYPE_A 0x05
190#define DRIVER_TYPE_B 0x03
191#define DRIVER_TYPE_C 0x02
192#define DRIVER_TYPE_D 0x01
193
194/* FPDCTL */
195#define SSC_POWER_DOWN 0x01
196#define SD_OC_POWER_DOWN 0x02
197#define ALL_POWER_DOWN 0x07
198#define OC_POWER_DOWN 0x06
199
200/* CLK_CTL */
201#define CHANGE_CLK 0x01
202
203/* LDO_CTL */
204#define BPP_LDO_POWB 0x03
205#define BPP_LDO_ON 0x00
206#define BPP_LDO_SUSPEND 0x02
207#define BPP_LDO_OFF 0x03
208
209/* CD_PAD_CTL */
210#define CD_DISABLE_MASK 0x07
211#define MS_CD_DISABLE 0x04
212#define SD_CD_DISABLE 0x02
213#define XD_CD_DISABLE 0x01
214#define CD_DISABLE 0x07
215#define CD_ENABLE 0x00
216#define MS_CD_EN_ONLY 0x03
217#define SD_CD_EN_ONLY 0x05
218#define XD_CD_EN_ONLY 0x06
219#define FORCE_CD_LOW_MASK 0x38
220#define FORCE_CD_XD_LOW 0x08
221#define FORCE_CD_SD_LOW 0x10
222#define FORCE_CD_MS_LOW 0x20
223#define CD_AUTO_DISABLE 0x40
224
225/* SD_STAT1 */
226#define SD_CRC7_ERR 0x80
227#define SD_CRC16_ERR 0x40
228#define SD_CRC_WRITE_ERR 0x20
229#define SD_CRC_WRITE_ERR_MASK 0x1C
230#define GET_CRC_TIME_OUT 0x02
231#define SD_TUNING_COMPARE_ERR 0x01
232
233/* SD_STAT2 */
234#define SD_RSP_80CLK_TIMEOUT 0x01
235
236/* SD_BUS_STAT */
237#define SD_CLK_TOGGLE_EN 0x80
238#define SD_CLK_FORCE_STOP 0x40
239#define SD_DAT3_STATUS 0x10
240#define SD_DAT2_STATUS 0x08
241#define SD_DAT1_STATUS 0x04
242#define SD_DAT0_STATUS 0x02
243#define SD_CMD_STATUS 0x01
244
245/* SD_PAD_CTL */
246#define SD_IO_USING_1V8 0x80
247#define SD_IO_USING_3V3 0x7F
248#define TYPE_A_DRIVING 0x00
249#define TYPE_B_DRIVING 0x01
250#define TYPE_C_DRIVING 0x02
251#define TYPE_D_DRIVING 0x03
252
253/* SD_SAMPLE_POINT_CTL */
254#define DDR_FIX_RX_DAT 0x00
255#define DDR_VAR_RX_DAT 0x80
256#define DDR_FIX_RX_DAT_EDGE 0x00
257#define DDR_FIX_RX_DAT_14_DELAY 0x40
258#define DDR_FIX_RX_CMD 0x00
259#define DDR_VAR_RX_CMD 0x20
260#define DDR_FIX_RX_CMD_POS_EDGE 0x00
261#define DDR_FIX_RX_CMD_14_DELAY 0x10
262#define SD20_RX_POS_EDGE 0x00
263#define SD20_RX_14_DELAY 0x08
264#define SD20_RX_SEL_MASK 0x08
265
266/* SD_PUSH_POINT_CTL */
267#define DDR_FIX_TX_CMD_DAT 0x00
268#define DDR_VAR_TX_CMD_DAT 0x80
269#define DDR_FIX_TX_DAT_14_TSU 0x00
270#define DDR_FIX_TX_DAT_12_TSU 0x40
271#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
272#define DDR_FIX_TX_CMD_14_AHEAD 0x20
273#define SD20_TX_NEG_EDGE 0x00
274#define SD20_TX_14_AHEAD 0x10
275#define SD20_TX_SEL_MASK 0x10
276#define DDR_VAR_SDCLK_POL_SWAP 0x01
277
278/* SD_TRANSFER */
279#define SD_TRANSFER_START 0x80
280#define SD_TRANSFER_END 0x40
281#define SD_STAT_IDLE 0x20
282#define SD_TRANSFER_ERR 0x10
283/* SD Transfer Mode definition */
284#define SD_TM_NORMAL_WRITE 0x00
285#define SD_TM_AUTO_WRITE_3 0x01
286#define SD_TM_AUTO_WRITE_4 0x02
287#define SD_TM_AUTO_READ_3 0x05
288#define SD_TM_AUTO_READ_4 0x06
289#define SD_TM_CMD_RSP 0x08
290#define SD_TM_AUTO_WRITE_1 0x09
291#define SD_TM_AUTO_WRITE_2 0x0A
292#define SD_TM_NORMAL_READ 0x0C
293#define SD_TM_AUTO_READ_1 0x0D
294#define SD_TM_AUTO_READ_2 0x0E
295#define SD_TM_AUTO_TUNING 0x0F
296
297/* SD_VPTX_CTL / SD_VPRX_CTL */
298#define PHASE_CHANGE 0x80
299#define PHASE_NOT_RESET 0x40
300
301/* SD_DCMPS_TX_CTL / SD_DCMPS_RX_CTL */
302#define DCMPS_CHANGE 0x80
303#define DCMPS_CHANGE_DONE 0x40
304#define DCMPS_ERROR 0x20
305#define DCMPS_CURRENT_PHASE 0x1F
306
307/* SD Configure 1 Register */
308#define SD_CLK_DIVIDE_0 0x00
309#define SD_CLK_DIVIDE_256 0xC0
310#define SD_CLK_DIVIDE_128 0x80
311#define SD_BUS_WIDTH_1BIT 0x00
312#define SD_BUS_WIDTH_4BIT 0x01
313#define SD_BUS_WIDTH_8BIT 0x02
314#define SD_ASYNC_FIFO_NOT_RST 0x10
315#define SD_20_MODE 0x00
316#define SD_DDR_MODE 0x04
317#define SD_30_MODE 0x08
318
319#define SD_CLK_DIVIDE_MASK 0xC0
320
321/* SD_CMD_STATE */
322#define SD_CMD_IDLE 0x80
323
324/* SD_DATA_STATE */
325#define SD_DATA_IDLE 0x80
326
327/* DCM_DRP_CTL */
328#define DCM_RESET 0x08
329#define DCM_LOCKED 0x04
330#define DCM_208M 0x00
331#define DCM_TX 0x01
332#define DCM_RX 0x02
333
334/* DCM_DRP_TRIG */
335#define DRP_START 0x80
336#define DRP_DONE 0x40
337
338/* DCM_DRP_CFG */
339#define DRP_WRITE 0x80
340#define DRP_READ 0x00
341#define DCM_WRITE_ADDRESS_50 0x50
342#define DCM_WRITE_ADDRESS_51 0x51
343#define DCM_READ_ADDRESS_00 0x00
344#define DCM_READ_ADDRESS_51 0x51
345
346/* IRQSTAT0 */
347#define DMA_DONE_INT 0x80
348#define SUSPEND_INT 0x40
349#define LINK_RDY_INT 0x20
350#define LINK_DOWN_INT 0x10
351
352/* DMACTL */
353#define DMA_RST 0x80
354#define DMA_BUSY 0x04
355#define DMA_DIR_TO_CARD 0x00
356#define DMA_DIR_FROM_CARD 0x02
357#define DMA_EN 0x01
358#define DMA_128 (0 << 4)
359#define DMA_256 (1 << 4)
360#define DMA_512 (2 << 4)
361#define DMA_1024 (3 << 4)
362#define DMA_PACK_SIZE_MASK 0x30
363
364/* SSC_CTL1 */
365#define SSC_RSTB 0x80
366#define SSC_8X_EN 0x40
367#define SSC_FIX_FRAC 0x20
368#define SSC_SEL_1M 0x00
369#define SSC_SEL_2M 0x08
370#define SSC_SEL_4M 0x10
371#define SSC_SEL_8M 0x18
372
373/* SSC_CTL2 */
374#define SSC_DEPTH_MASK 0x07
375#define SSC_DEPTH_DISALBE 0x00
376#define SSC_DEPTH_4M 0x01
377#define SSC_DEPTH_2M 0x02
378#define SSC_DEPTH_1M 0x03
379#define SSC_DEPTH_500K 0x04
380#define SSC_DEPTH_250K 0x05
381
382/* System Clock Control Register */
383#define CLK_LOW_FREQ 0x01
384
385/* System Clock Divider Register */
386#define CLK_DIV_1 0x01
387#define CLK_DIV_2 0x02
388#define CLK_DIV_4 0x03
389#define CLK_DIV_8 0x04
390
391/* MS_CFG */
392#define SAMPLE_TIME_RISING 0x00
393#define SAMPLE_TIME_FALLING 0x80
394#define PUSH_TIME_DEFAULT 0x00
395#define PUSH_TIME_ODD 0x40
396#define NO_EXTEND_TOGGLE 0x00
397#define EXTEND_TOGGLE_CHK 0x20
398#define MS_BUS_WIDTH_1 0x00
399#define MS_BUS_WIDTH_4 0x10
400#define MS_BUS_WIDTH_8 0x18
401#define MS_2K_SECTOR_MODE 0x04
402#define MS_512_SECTOR_MODE 0x00
403#define MS_TOGGLE_TIMEOUT_EN 0x00
404#define MS_TOGGLE_TIMEOUT_DISEN 0x01
405#define MS_NO_CHECK_INT 0x02
406
407/* MS_TRANS_CFG */
408#define WAIT_INT 0x80
409#define NO_WAIT_INT 0x00
410#define NO_AUTO_READ_INT_REG 0x00
411#define AUTO_READ_INT_REG 0x40
412#define MS_CRC16_ERR 0x20
413#define MS_RDY_TIMEOUT 0x10
414#define MS_INT_CMDNK 0x08
415#define MS_INT_BREQ 0x04
416#define MS_INT_ERR 0x02
417#define MS_INT_CED 0x01
418
419/* MS_TRANSFER */
420#define MS_TRANSFER_START 0x80
421#define MS_TRANSFER_END 0x40
422#define MS_TRANSFER_ERR 0x20
423#define MS_BS_STATE 0x10
424#define MS_TM_READ_BYTES 0x00
425#define MS_TM_NORMAL_READ 0x01
426#define MS_TM_WRITE_BYTES 0x04
427#define MS_TM_NORMAL_WRITE 0x05
428#define MS_TM_AUTO_READ 0x08
429#define MS_TM_AUTO_WRITE 0x0C
430
431/* SD Configure 2 Register */
432#define SD_CALCULATE_CRC7 0x00
433#define SD_NO_CALCULATE_CRC7 0x80
434#define SD_CHECK_CRC16 0x00
435#define SD_NO_CHECK_CRC16 0x40
436#define SD_NO_CHECK_WAIT_CRC_TO 0x20
437#define SD_WAIT_BUSY_END 0x08
438#define SD_NO_WAIT_BUSY_END 0x00
439#define SD_CHECK_CRC7 0x00
440#define SD_NO_CHECK_CRC7 0x04
441#define SD_RSP_LEN_0 0x00
442#define SD_RSP_LEN_6 0x01
443#define SD_RSP_LEN_17 0x02
444/* SD/MMC Response Type Definition */
445#define SD_RSP_TYPE_R0 0x04
446#define SD_RSP_TYPE_R1 0x01
447#define SD_RSP_TYPE_R1b 0x09
448#define SD_RSP_TYPE_R2 0x02
449#define SD_RSP_TYPE_R3 0x05
450#define SD_RSP_TYPE_R4 0x05
451#define SD_RSP_TYPE_R5 0x01
452#define SD_RSP_TYPE_R6 0x01
453#define SD_RSP_TYPE_R7 0x01
454
455/* SD_CONFIURE3 */
456#define SD_RSP_80CLK_TIMEOUT_EN 0x01
457
458/* Card Transfer Reset Register */
459#define SPI_STOP 0x01
460#define XD_STOP 0x02
461#define SD_STOP 0x04
462#define MS_STOP 0x08
463#define SPI_CLR_ERR 0x10
464#define XD_CLR_ERR 0x20
465#define SD_CLR_ERR 0x40
466#define MS_CLR_ERR 0x80
467
468/* Card Data Source Register */
469#define PINGPONG_BUFFER 0x01
470#define RING_BUFFER 0x00
471
472/* Card Power Control Register */
473#define PMOS_STRG_MASK 0x10
474#define PMOS_STRG_800mA 0x10
475#define PMOS_STRG_400mA 0x00
476#define SD_POWER_OFF 0x03
477#define SD_PARTIAL_POWER_ON 0x01
478#define SD_POWER_ON 0x00
479#define SD_POWER_MASK 0x03
480#define MS_POWER_OFF 0x0C
481#define MS_PARTIAL_POWER_ON 0x04
482#define MS_POWER_ON 0x00
483#define MS_POWER_MASK 0x0C
484#define BPP_POWER_OFF 0x0F
485#define BPP_POWER_5_PERCENT_ON 0x0E
486#define BPP_POWER_10_PERCENT_ON 0x0C
487#define BPP_POWER_15_PERCENT_ON 0x08
488#define BPP_POWER_ON 0x00
489#define BPP_POWER_MASK 0x0F
490
491/* PWR_GATE_CTRL */
492#define PWR_GATE_EN 0x01
493#define LDO3318_PWR_MASK 0x06
494#define LDO_ON 0x00
495#define LDO_SUSPEND 0x04
496#define LDO_OFF 0x06
497
498/* CARD_CLK_SOURCE */
499#define CRC_FIX_CLK (0x00 << 0)
500#define CRC_VAR_CLK0 (0x01 << 0)
501#define CRC_VAR_CLK1 (0x02 << 0)
502#define SD30_FIX_CLK (0x00 << 2)
503#define SD30_VAR_CLK0 (0x01 << 2)
504#define SD30_VAR_CLK1 (0x02 << 2)
505#define SAMPLE_FIX_CLK (0x00 << 4)
506#define SAMPLE_VAR_CLK0 (0x01 << 4)
507#define SAMPLE_VAR_CLK1 (0x02 << 4)
508
509#define MS_CFG 0xFD40
510#define MS_TPC 0xFD41
511#define MS_TRANS_CFG 0xFD42
512#define MS_TRANSFER 0xFD43
513#define MS_INT_REG 0xFD44
514#define MS_BYTE_CNT 0xFD45
515#define MS_SECTOR_CNT_L 0xFD46
516#define MS_SECTOR_CNT_H 0xFD47
517#define MS_DBUS_H 0xFD48
518
519#define SD_CFG1 0xFDA0
520#define SD_CFG2 0xFDA1
521#define SD_CFG3 0xFDA2
522#define SD_STAT1 0xFDA3
523#define SD_STAT2 0xFDA4
524#define SD_BUS_STAT 0xFDA5
525#define SD_PAD_CTL 0xFDA6
526#define SD_SAMPLE_POINT_CTL 0xFDA7
527#define SD_PUSH_POINT_CTL 0xFDA8
528#define SD_CMD0 0xFDA9
529#define SD_CMD1 0xFDAA
530#define SD_CMD2 0xFDAB
531#define SD_CMD3 0xFDAC
532#define SD_CMD4 0xFDAD
533#define SD_CMD5 0xFDAE
534#define SD_BYTE_CNT_L 0xFDAF
535#define SD_BYTE_CNT_H 0xFDB0
536#define SD_BLOCK_CNT_L 0xFDB1
537#define SD_BLOCK_CNT_H 0xFDB2
538#define SD_TRANSFER 0xFDB3
539#define SD_CMD_STATE 0xFDB5
540#define SD_DATA_STATE 0xFDB6
541
542#define SRCTL 0xFC13
543
544#define DCM_DRP_CTL 0xFC23
545#define DCM_DRP_TRIG 0xFC24
546#define DCM_DRP_CFG 0xFC25
547#define DCM_DRP_WR_DATA_L 0xFC26
548#define DCM_DRP_WR_DATA_H 0xFC27
549#define DCM_DRP_RD_DATA_L 0xFC28
550#define DCM_DRP_RD_DATA_H 0xFC29
551#define SD_VPCLK0_CTL 0xFC2A
552#define SD_VPCLK1_CTL 0xFC2B
553#define SD_DCMPS0_CTL 0xFC2C
554#define SD_DCMPS1_CTL 0xFC2D
555#define SD_VPTX_CTL SD_VPCLK0_CTL
556#define SD_VPRX_CTL SD_VPCLK1_CTL
557#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL
558#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL
559#define CARD_CLK_SOURCE 0xFC2E
560
561#define CARD_PWR_CTL 0xFD50
562#define CARD_CLK_SWITCH 0xFD51
563#define CARD_SHARE_MODE 0xFD52
564#define CARD_DRIVE_SEL 0xFD53
565#define CARD_STOP 0xFD54
566#define CARD_OE 0xFD55
567#define CARD_AUTO_BLINK 0xFD56
568#define CARD_GPIO_DIR 0xFD57
569#define CARD_GPIO 0xFD58
570#define CARD_DATA_SOURCE 0xFD5B
571#define CARD_SELECT 0xFD5C
572#define SD30_DRIVE_SEL 0xFD5E
573#define CARD_CLK_EN 0xFD69
574#define SDIO_CTRL 0xFD6B
575#define CD_PAD_CTL 0xFD73
576
577#define FPDCTL 0xFC00
578#define PDINFO 0xFC01
579
580#define CLK_CTL 0xFC02
581#define CLK_DIV 0xFC03
582#define CLK_SEL 0xFC04
583
584#define SSC_DIV_N_0 0xFC0F
585#define SSC_DIV_N_1 0xFC10
586#define SSC_CTL1 0xFC11
587#define SSC_CTL2 0xFC12
588
589#define RCCTL 0xFC14
590
591#define FPGA_PULL_CTL 0xFC1D
592#define OLT_LED_CTL 0xFC1E
593#define GPIO_CTL 0xFC1F
594
595#define LDO_CTL 0xFC1E
596#define SYS_VER 0xFC32
597
598#define CARD_PULL_CTL1 0xFD60
599#define CARD_PULL_CTL2 0xFD61
600#define CARD_PULL_CTL3 0xFD62
601#define CARD_PULL_CTL4 0xFD63
602#define CARD_PULL_CTL5 0xFD64
603#define CARD_PULL_CTL6 0xFD65
604
605/* PCI Express Related Registers */
606#define IRQEN0 0xFE20
607#define IRQSTAT0 0xFE21
608#define IRQEN1 0xFE22
609#define IRQSTAT1 0xFE23
610#define TLPRIEN 0xFE24
611#define TLPRISTAT 0xFE25
612#define TLPTIEN 0xFE26
613#define TLPTISTAT 0xFE27
614#define DMATC0 0xFE28
615#define DMATC1 0xFE29
616#define DMATC2 0xFE2A
617#define DMATC3 0xFE2B
618#define DMACTL 0xFE2C
619#define BCTL 0xFE2D
620#define RBBC0 0xFE2E
621#define RBBC1 0xFE2F
622#define RBDAT 0xFE30
623#define RBCTL 0xFE34
624#define CFGADDR0 0xFE35
625#define CFGADDR1 0xFE36
626#define CFGDATA0 0xFE37
627#define CFGDATA1 0xFE38
628#define CFGDATA2 0xFE39
629#define CFGDATA3 0xFE3A
630#define CFGRWCTL 0xFE3B
631#define PHYRWCTL 0xFE3C
632#define PHYDATA0 0xFE3D
633#define PHYDATA1 0xFE3E
634#define PHYADDR 0xFE3F
635#define MSGRXDATA0 0xFE40
636#define MSGRXDATA1 0xFE41
637#define MSGRXDATA2 0xFE42
638#define MSGRXDATA3 0xFE43
639#define MSGTXDATA0 0xFE44
640#define MSGTXDATA1 0xFE45
641#define MSGTXDATA2 0xFE46
642#define MSGTXDATA3 0xFE47
643#define MSGTXCTL 0xFE48
644#define PETXCFG 0xFE49
645
646#define CDRESUMECTL 0xFE52
647#define WAKE_SEL_CTL 0xFE54
648#define PME_FORCE_CTL 0xFE56
649#define ASPM_FORCE_CTL 0xFE57
650#define PM_CLK_FORCE_CTL 0xFE58
651#define PERST_GLITCH_WIDTH 0xFE5C
652#define CHANGE_LINK_STATE 0xFE5B
653#define RESET_LOAD_REG 0xFE5E
654#define EFUSE_CONTENT 0xFE5F
655#define HOST_SLEEP_STATE 0xFE60
656#define SDIO_CFG 0xFE70
657
658#define NFTS_TX_CTRL 0xFE72
659
660#define PWR_GATE_CTRL 0xFE75
661#define PWD_SUSPEND_EN 0xFE76
662#define LDO_PWR_SEL 0xFE78
663
664#define DUMMY_REG_RESET_0 0xFE90
665
666/* Memory mapping */
667#define SRAM_BASE 0xE600
668#define RBUF_BASE 0xF400
669#define PPBUF_BASE1 0xF800
670#define PPBUF_BASE2 0xFA00
671#define IMAGE_FLAG_ADDR0 0xCE80
672#define IMAGE_FLAG_ADDR1 0xCE81
673
674#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
675
676struct rtsx_pcr;
677
678struct pcr_handle {
679 struct rtsx_pcr *pcr;
680};
681
682struct pcr_ops {
683 int (*extra_init_hw)(struct rtsx_pcr *pcr);
684 int (*optimize_phy)(struct rtsx_pcr *pcr);
685 int (*turn_on_led)(struct rtsx_pcr *pcr);
686 int (*turn_off_led)(struct rtsx_pcr *pcr);
687 int (*enable_auto_blink)(struct rtsx_pcr *pcr);
688 int (*disable_auto_blink)(struct rtsx_pcr *pcr);
689 int (*card_power_on)(struct rtsx_pcr *pcr, int card);
690 int (*card_power_off)(struct rtsx_pcr *pcr, int card);
691 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
692};
693
694enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
695
696struct rtsx_pcr {
697 struct pci_dev *pci;
698 unsigned int id;
699
700 /* pci resources */
701 unsigned long addr;
702 void __iomem *remap_addr;
703 int irq;
704
705 /* host reserved buffer */
706 void *rtsx_resv_buf;
707 dma_addr_t rtsx_resv_buf_addr;
708
709 void *host_cmds_ptr;
710 dma_addr_t host_cmds_addr;
711 int ci;
712
713 void *host_sg_tbl_ptr;
714 dma_addr_t host_sg_tbl_addr;
715 int sgi;
716
717 u32 bier;
718 char trans_result;
719
720 unsigned int card_inserted;
721 unsigned int card_removed;
722
723 struct delayed_work carddet_work;
724 struct delayed_work idle_work;
725
726 spinlock_t lock;
727 struct mutex pcr_mutex;
728 struct completion *done;
729 struct completion *finish_me;
730
731 unsigned int cur_clock;
732 bool ms_pmos;
733 bool remove_pci;
734 bool msi_en;
735
736#define EXTRA_CAPS_SD_SDR50 (1 << 0)
737#define EXTRA_CAPS_SD_SDR104 (1 << 1)
738#define EXTRA_CAPS_SD_DDR50 (1 << 2)
739#define EXTRA_CAPS_MMC_HSDDR (1 << 3)
740#define EXTRA_CAPS_MMC_HS200 (1 << 4)
741#define EXTRA_CAPS_MMC_8BIT (1 << 5)
742 u32 extra_caps;
743
744#define IC_VER_A 0
745#define IC_VER_B 1
746#define IC_VER_C 2
747#define IC_VER_D 3
748 u8 ic_version;
749
750 const u32 *sd_pull_ctl_enable_tbl;
751 const u32 *sd_pull_ctl_disable_tbl;
752 const u32 *ms_pull_ctl_enable_tbl;
753 const u32 *ms_pull_ctl_disable_tbl;
754
755 const struct pcr_ops *ops;
756 enum PDEV_STAT state;
757
758 int num_slots;
759 struct rtsx_slot *slots;
760};
761
762#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))
763#define PCI_VID(pcr) ((pcr)->pci->vendor)
764#define PCI_PID(pcr) ((pcr)->pci->device)
765
766void rtsx_pci_start_run(struct rtsx_pcr *pcr);
767int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data);
768int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data);
769int rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val);
770int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val);
771void rtsx_pci_stop_cmd(struct rtsx_pcr *pcr);
772void rtsx_pci_add_cmd(struct rtsx_pcr *pcr,
773 u8 cmd_type, u16 reg_addr, u8 mask, u8 data);
774void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
775int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
776int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
777 int num_sg, bool read, int timeout);
778int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
779int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
780int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
781int rtsx_pci_card_pull_ctl_disable(struct rtsx_pcr *pcr, int card);
782int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
784int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);
785int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);
786unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);
787void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);
788
789static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr)
790{
791 return (u8 *)(pcr->host_cmds_ptr);
792}
793
794#endif
diff --git a/include/linux/mfd/sta2x11-mfd.h b/include/linux/mfd/sta2x11-mfd.h
index d179227e866f..9a855ac11cbf 100644
--- a/include/linux/mfd/sta2x11-mfd.h
+++ b/include/linux/mfd/sta2x11-mfd.h
@@ -26,6 +26,28 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28 28
29enum sta2x11_mfd_plat_dev {
30 sta2x11_sctl = 0,
31 sta2x11_gpio,
32 sta2x11_scr,
33 sta2x11_time,
34 sta2x11_apbreg,
35 sta2x11_apb_soc_regs,
36 sta2x11_vic,
37 sta2x11_n_mfd_plat_devs,
38};
39
40#define STA2X11_MFD_SCTL_NAME "sta2x11-sctl"
41#define STA2X11_MFD_GPIO_NAME "sta2x11-gpio"
42#define STA2X11_MFD_SCR_NAME "sta2x11-scr"
43#define STA2X11_MFD_TIME_NAME "sta2x11-time"
44#define STA2X11_MFD_APBREG_NAME "sta2x11-apbreg"
45#define STA2X11_MFD_APB_SOC_REGS_NAME "sta2x11-apb-soc-regs"
46#define STA2X11_MFD_VIC_NAME "sta2x11-vic"
47
48extern u32
49__sta2x11_mfd_mask(struct pci_dev *, u32, u32, u32, enum sta2x11_mfd_plat_dev);
50
29/* 51/*
30 * The MFD PCI block includes the GPIO peripherals and other register blocks. 52 * The MFD PCI block includes the GPIO peripherals and other register blocks.
31 * For GPIO, we have 32*4 bits (I use "gsta" for "gpio sta2x11".) 53 * For GPIO, we have 32*4 bits (I use "gsta" for "gpio sta2x11".)
@@ -182,7 +204,11 @@ struct sta2x11_gpio_pdata {
182 * The APB bridge has its own registers, needed by our users as well. 204 * The APB bridge has its own registers, needed by our users as well.
183 * They are accessed with the following read/mask/write function. 205 * They are accessed with the following read/mask/write function.
184 */ 206 */
185u32 sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val); 207static inline u32
208sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val)
209{
210 return __sta2x11_mfd_mask(pdev, reg, mask, val, sta2x11_apbreg);
211}
186 212
187/* CAN and MLB */ 213/* CAN and MLB */
188#define APBREG_BSR 0x00 /* Bridge Status Reg */ 214#define APBREG_BSR 0x00 /* Bridge Status Reg */
@@ -211,19 +237,45 @@ u32 sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val);
211 * The system controller has its own registers. Some of these are accessed 237 * The system controller has its own registers. Some of these are accessed
212 * by out users as well, using the following read/mask/write/function 238 * by out users as well, using the following read/mask/write/function
213 */ 239 */
214u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val); 240static inline
241u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val)
242{
243 return __sta2x11_mfd_mask(pdev, reg, mask, val, sta2x11_sctl);
244}
215 245
216#define SCTL_SCCTL 0x00 /* System controller control register */ 246#define SCTL_SCCTL 0x00 /* System controller control register */
217#define SCTL_ARMCFG 0x04 /* ARM configuration register */ 247#define SCTL_ARMCFG 0x04 /* ARM configuration register */
218#define SCTL_SCPLLCTL 0x08 /* PLL control status register */ 248#define SCTL_SCPLLCTL 0x08 /* PLL control status register */
249
250#define SCTL_SCPLLCTL_AUDIO_PLL_PD BIT(1)
251#define SCTL_SCPLLCTL_FRAC_CONTROL BIT(3)
252#define SCTL_SCPLLCTL_STRB_BYPASS BIT(6)
253#define SCTL_SCPLLCTL_STRB_INPUT BIT(8)
254
219#define SCTL_SCPLLFCTRL 0x0c /* PLL frequency control register */ 255#define SCTL_SCPLLFCTRL 0x0c /* PLL frequency control register */
256
257#define SCTL_SCPLLFCTRL_AUDIO_PLL_NDIV_MASK 0xff
258#define SCTL_SCPLLFCTRL_AUDIO_PLL_NDIV_SHIFT 10
259#define SCTL_SCPLLFCTRL_AUDIO_PLL_IDF_MASK 7
260#define SCTL_SCPLLFCTRL_AUDIO_PLL_IDF_SHIFT 21
261#define SCTL_SCPLLFCTRL_AUDIO_PLL_ODF_MASK 7
262#define SCTL_SCPLLFCTRL_AUDIO_PLL_ODF_SHIFT 18
263#define SCTL_SCPLLFCTRL_DITHER_DISABLE_MASK 0x03
264#define SCTL_SCPLLFCTRL_DITHER_DISABLE_SHIFT 4
265
266
220#define SCTL_SCRESFRACT 0x10 /* PLL fractional input register */ 267#define SCTL_SCRESFRACT 0x10 /* PLL fractional input register */
268
269#define SCTL_SCRESFRACT_MASK 0x0000ffff
270
271
221#define SCTL_SCRESCTRL1 0x14 /* Peripheral reset control 1 */ 272#define SCTL_SCRESCTRL1 0x14 /* Peripheral reset control 1 */
222#define SCTL_SCRESXTRL2 0x18 /* Peripheral reset control 2 */ 273#define SCTL_SCRESXTRL2 0x18 /* Peripheral reset control 2 */
223#define SCTL_SCPEREN0 0x1c /* Peripheral clock enable register 0 */ 274#define SCTL_SCPEREN0 0x1c /* Peripheral clock enable register 0 */
224#define SCTL_SCPEREN1 0x20 /* Peripheral clock enable register 1 */ 275#define SCTL_SCPEREN1 0x20 /* Peripheral clock enable register 1 */
225#define SCTL_SCPEREN2 0x24 /* Peripheral clock enable register 2 */ 276#define SCTL_SCPEREN2 0x24 /* Peripheral clock enable register 2 */
226#define SCTL_SCGRST 0x28 /* Peripheral global reset */ 277#define SCTL_SCGRST 0x28 /* Peripheral global reset */
278#define SCTL_SCPCIECSBRST 0x2c /* PCIe PAB CSB reset status register */
227#define SCTL_SCPCIPMCR1 0x30 /* PCI power management control 1 */ 279#define SCTL_SCPCIPMCR1 0x30 /* PCI power management control 1 */
228#define SCTL_SCPCIPMCR2 0x34 /* PCI power management control 2 */ 280#define SCTL_SCPCIPMCR2 0x34 /* PCI power management control 2 */
229#define SCTL_SCPCIPMSR1 0x38 /* PCI power management status 1 */ 281#define SCTL_SCPCIPMSR1 0x38 /* PCI power management status 1 */
@@ -321,4 +373,146 @@ u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val);
321#define SCTL_SCPEREN1_I2C3 (1 << 16) 373#define SCTL_SCPEREN1_I2C3 (1 << 16)
322#define SCTL_SCPEREN1_USB_PHY (1 << 17) 374#define SCTL_SCPEREN1_USB_PHY (1 << 17)
323 375
376/*
377 * APB-SOC registers
378 */
379static inline
380u32 sta2x11_apb_soc_regs_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val)
381{
382 return __sta2x11_mfd_mask(pdev, reg, mask, val, sta2x11_apb_soc_regs);
383}
384
385#define PCIE_EP1_FUNC3_0_INTR_REG 0x000
386#define PCIE_EP1_FUNC7_4_INTR_REG 0x004
387#define PCIE_EP2_FUNC3_0_INTR_REG 0x008
388#define PCIE_EP2_FUNC7_4_INTR_REG 0x00c
389#define PCIE_EP3_FUNC3_0_INTR_REG 0x010
390#define PCIE_EP3_FUNC7_4_INTR_REG 0x014
391#define PCIE_EP4_FUNC3_0_INTR_REG 0x018
392#define PCIE_EP4_FUNC7_4_INTR_REG 0x01c
393#define PCIE_INTR_ENABLE0_REG 0x020
394#define PCIE_INTR_ENABLE1_REG 0x024
395#define PCIE_EP1_FUNC_TC_REG 0x028
396#define PCIE_EP2_FUNC_TC_REG 0x02c
397#define PCIE_EP3_FUNC_TC_REG 0x030
398#define PCIE_EP4_FUNC_TC_REG 0x034
399#define PCIE_EP1_FUNC_F_REG 0x038
400#define PCIE_EP2_FUNC_F_REG 0x03c
401#define PCIE_EP3_FUNC_F_REG 0x040
402#define PCIE_EP4_FUNC_F_REG 0x044
403#define PCIE_PAB_AMBA_SW_RST_REG 0x048
404#define PCIE_PM_STATUS_0_PORT_0_4 0x04c
405#define PCIE_PM_STATUS_7_0_EP1 0x050
406#define PCIE_PM_STATUS_7_0_EP2 0x054
407#define PCIE_PM_STATUS_7_0_EP3 0x058
408#define PCIE_PM_STATUS_7_0_EP4 0x05c
409#define PCIE_DEV_ID_0_EP1_REG 0x060
410#define PCIE_CC_REV_ID_0_EP1_REG 0x064
411#define PCIE_DEV_ID_1_EP1_REG 0x068
412#define PCIE_CC_REV_ID_1_EP1_REG 0x06c
413#define PCIE_DEV_ID_2_EP1_REG 0x070
414#define PCIE_CC_REV_ID_2_EP1_REG 0x074
415#define PCIE_DEV_ID_3_EP1_REG 0x078
416#define PCIE_CC_REV_ID_3_EP1_REG 0x07c
417#define PCIE_DEV_ID_4_EP1_REG 0x080
418#define PCIE_CC_REV_ID_4_EP1_REG 0x084
419#define PCIE_DEV_ID_5_EP1_REG 0x088
420#define PCIE_CC_REV_ID_5_EP1_REG 0x08c
421#define PCIE_DEV_ID_6_EP1_REG 0x090
422#define PCIE_CC_REV_ID_6_EP1_REG 0x094
423#define PCIE_DEV_ID_7_EP1_REG 0x098
424#define PCIE_CC_REV_ID_7_EP1_REG 0x09c
425#define PCIE_DEV_ID_0_EP2_REG 0x0a0
426#define PCIE_CC_REV_ID_0_EP2_REG 0x0a4
427#define PCIE_DEV_ID_1_EP2_REG 0x0a8
428#define PCIE_CC_REV_ID_1_EP2_REG 0x0ac
429#define PCIE_DEV_ID_2_EP2_REG 0x0b0
430#define PCIE_CC_REV_ID_2_EP2_REG 0x0b4
431#define PCIE_DEV_ID_3_EP2_REG 0x0b8
432#define PCIE_CC_REV_ID_3_EP2_REG 0x0bc
433#define PCIE_DEV_ID_4_EP2_REG 0x0c0
434#define PCIE_CC_REV_ID_4_EP2_REG 0x0c4
435#define PCIE_DEV_ID_5_EP2_REG 0x0c8
436#define PCIE_CC_REV_ID_5_EP2_REG 0x0cc
437#define PCIE_DEV_ID_6_EP2_REG 0x0d0
438#define PCIE_CC_REV_ID_6_EP2_REG 0x0d4
439#define PCIE_DEV_ID_7_EP2_REG 0x0d8
440#define PCIE_CC_REV_ID_7_EP2_REG 0x0dC
441#define PCIE_DEV_ID_0_EP3_REG 0x0e0
442#define PCIE_CC_REV_ID_0_EP3_REG 0x0e4
443#define PCIE_DEV_ID_1_EP3_REG 0x0e8
444#define PCIE_CC_REV_ID_1_EP3_REG 0x0ec
445#define PCIE_DEV_ID_2_EP3_REG 0x0f0
446#define PCIE_CC_REV_ID_2_EP3_REG 0x0f4
447#define PCIE_DEV_ID_3_EP3_REG 0x0f8
448#define PCIE_CC_REV_ID_3_EP3_REG 0x0fc
449#define PCIE_DEV_ID_4_EP3_REG 0x100
450#define PCIE_CC_REV_ID_4_EP3_REG 0x104
451#define PCIE_DEV_ID_5_EP3_REG 0x108
452#define PCIE_CC_REV_ID_5_EP3_REG 0x10c
453#define PCIE_DEV_ID_6_EP3_REG 0x110
454#define PCIE_CC_REV_ID_6_EP3_REG 0x114
455#define PCIE_DEV_ID_7_EP3_REG 0x118
456#define PCIE_CC_REV_ID_7_EP3_REG 0x11c
457#define PCIE_DEV_ID_0_EP4_REG 0x120
458#define PCIE_CC_REV_ID_0_EP4_REG 0x124
459#define PCIE_DEV_ID_1_EP4_REG 0x128
460#define PCIE_CC_REV_ID_1_EP4_REG 0x12c
461#define PCIE_DEV_ID_2_EP4_REG 0x130
462#define PCIE_CC_REV_ID_2_EP4_REG 0x134
463#define PCIE_DEV_ID_3_EP4_REG 0x138
464#define PCIE_CC_REV_ID_3_EP4_REG 0x13c
465#define PCIE_DEV_ID_4_EP4_REG 0x140
466#define PCIE_CC_REV_ID_4_EP4_REG 0x144
467#define PCIE_DEV_ID_5_EP4_REG 0x148
468#define PCIE_CC_REV_ID_5_EP4_REG 0x14c
469#define PCIE_DEV_ID_6_EP4_REG 0x150
470#define PCIE_CC_REV_ID_6_EP4_REG 0x154
471#define PCIE_DEV_ID_7_EP4_REG 0x158
472#define PCIE_CC_REV_ID_7_EP4_REG 0x15c
473#define PCIE_SUBSYS_VEN_ID_REG 0x160
474#define PCIE_COMMON_CLOCK_CONFIG_0_4_0 0x164
475#define PCIE_MIPHYP_SSC_EN_REG 0x168
476#define PCIE_MIPHYP_ADDR_REG 0x16c
477#define PCIE_L1_ASPM_READY_REG 0x170
478#define PCIE_EXT_CFG_RDY_REG 0x174
479#define PCIE_SoC_INT_ROUTER_STATUS0_REG 0x178
480#define PCIE_SoC_INT_ROUTER_STATUS1_REG 0x17c
481#define PCIE_SoC_INT_ROUTER_STATUS2_REG 0x180
482#define PCIE_SoC_INT_ROUTER_STATUS3_REG 0x184
483#define DMA_IP_CTRL_REG 0x324
484#define DISP_BRIDGE_PU_PD_CTRL_REG 0x328
485#define VIP_PU_PD_CTRL_REG 0x32c
486#define USB_MLB_PU_PD_CTRL_REG 0x330
487#define SDIO_PU_PD_MISCFUNC_CTRL_REG1 0x334
488#define SDIO_PU_PD_MISCFUNC_CTRL_REG2 0x338
489#define UART_PU_PD_CTRL_REG 0x33c
490#define ARM_Lock 0x340
491#define SYS_IO_CHAR_REG1 0x344
492#define SYS_IO_CHAR_REG2 0x348
493#define SATA_CORE_ID_REG 0x34c
494#define SATA_CTRL_REG 0x350
495#define I2C_HSFIX_MISC_REG 0x354
496#define SPARE2_RESERVED 0x358
497#define SPARE3_RESERVED 0x35c
498#define MASTER_LOCK_REG 0x368
499#define SYSTEM_CONFIG_STATUS_REG 0x36c
500#define MSP_CLK_CTRL_REG 0x39c
501#define COMPENSATION_REG1 0x3c4
502#define COMPENSATION_REG2 0x3c8
503#define COMPENSATION_REG3 0x3cc
504#define TEST_CTL_REG 0x3d0
505
506/*
507 * SECR (OTP) registers
508 */
509#define STA2X11_SECR_CR 0x00
510#define STA2X11_SECR_FVR0 0x10
511#define STA2X11_SECR_FVR1 0x14
512
513extern int sta2x11_mfd_get_regs_data(struct platform_device *pdev,
514 enum sta2x11_mfd_plat_dev index,
515 void __iomem **regs,
516 spinlock_t **lock);
517
324#endif /* __STA2X11_MFD_H */ 518#endif /* __STA2X11_MFD_H */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index f8d5b4d5843f..383ac1512a39 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -62,6 +62,7 @@ struct stmpe_client_info;
62 * @lock: lock protecting I/O operations 62 * @lock: lock protecting I/O operations
63 * @irq_lock: IRQ bus lock 63 * @irq_lock: IRQ bus lock
64 * @dev: device, mostly for dev_dbg() 64 * @dev: device, mostly for dev_dbg()
65 * @irq_domain: IRQ domain
65 * @client: client - i2c or spi 66 * @client: client - i2c or spi
66 * @ci: client specific information 67 * @ci: client specific information
67 * @partnum: part number 68 * @partnum: part number
@@ -79,6 +80,7 @@ struct stmpe {
79 struct mutex lock; 80 struct mutex lock;
80 struct mutex irq_lock; 81 struct mutex irq_lock;
81 struct device *dev; 82 struct device *dev;
83 struct irq_domain *domain;
82 void *client; 84 void *client;
83 struct stmpe_client_info *ci; 85 struct stmpe_client_info *ci;
84 enum stmpe_partnum partnum; 86 enum stmpe_partnum partnum;
@@ -188,7 +190,6 @@ struct stmpe_ts_platform_data {
188 * @id: device id to distinguish between multiple STMPEs on the same board 190 * @id: device id to distinguish between multiple STMPEs on the same board
189 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*) 191 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
190 * @irq_trigger: IRQ trigger to use for the interrupt to the host 192 * @irq_trigger: IRQ trigger to use for the interrupt to the host
191 * @irq_invert_polarity: IRQ line is connected with reversed polarity
192 * @autosleep: bool to enable/disable stmpe autosleep 193 * @autosleep: bool to enable/disable stmpe autosleep
193 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 194 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
194 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or 195 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
@@ -205,7 +206,6 @@ struct stmpe_platform_data {
205 unsigned int blocks; 206 unsigned int blocks;
206 int irq_base; 207 int irq_base;
207 unsigned int irq_trigger; 208 unsigned int irq_trigger;
208 bool irq_invert_polarity;
209 bool autosleep; 209 bool autosleep;
210 bool irq_over_gpio; 210 bool irq_over_gpio;
211 int irq_gpio; 211 int irq_gpio;
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
new file mode 100644
index 000000000000..c79ad5d2f271
--- /dev/null
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -0,0 +1,152 @@
1#ifndef __LINUX_TI_AM335X_TSCADC_MFD_H
2#define __LINUX_TI_AM335X_TSCADC_MFD_H
3
4/*
5 * TI Touch Screen / ADC MFD driver
6 *
7 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/mfd/core.h>
20
21#define REG_RAWIRQSTATUS 0x024
22#define REG_IRQSTATUS 0x028
23#define REG_IRQENABLE 0x02C
24#define REG_IRQCLR 0x030
25#define REG_IRQWAKEUP 0x034
26#define REG_CTRL 0x040
27#define REG_ADCFSM 0x044
28#define REG_CLKDIV 0x04C
29#define REG_SE 0x054
30#define REG_IDLECONFIG 0x058
31#define REG_CHARGECONFIG 0x05C
32#define REG_CHARGEDELAY 0x060
33#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8))
34#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8))
35#define REG_FIFO0CNT 0xE4
36#define REG_FIFO0THR 0xE8
37#define REG_FIFO1CNT 0xF0
38#define REG_FIFO1THR 0xF4
39#define REG_FIFO0 0x100
40#define REG_FIFO1 0x200
41
42/* Register Bitfields */
43/* IRQ wakeup enable */
44#define IRQWKUP_ENB BIT(0)
45
46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0)
49#define STPENB_STEPENB STEPENB(0x1FFFF)
50#define STPENB_STEPENB_TC STEPENB(0x1FFF)
51
52/* IRQ enable */
53#define IRQENB_HW_PEN BIT(0)
54#define IRQENB_FIFO0THRES BIT(2)
55#define IRQENB_FIFO1THRES BIT(5)
56#define IRQENB_PENUP BIT(9)
57
58/* Step Configuration */
59#define STEPCONFIG_MODE_MASK (3 << 0)
60#define STEPCONFIG_MODE(val) ((val) << 0)
61#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2)
62#define STEPCONFIG_AVG_MASK (7 << 2)
63#define STEPCONFIG_AVG(val) ((val) << 2)
64#define STEPCONFIG_AVG_16 STEPCONFIG_AVG(4)
65#define STEPCONFIG_XPP BIT(5)
66#define STEPCONFIG_XNN BIT(6)
67#define STEPCONFIG_YPP BIT(7)
68#define STEPCONFIG_YNN BIT(8)
69#define STEPCONFIG_XNP BIT(9)
70#define STEPCONFIG_YPN BIT(10)
71#define STEPCONFIG_INM_MASK (0xF << 15)
72#define STEPCONFIG_INM(val) ((val) << 15)
73#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
74#define STEPCONFIG_INP_MASK (0xF << 19)
75#define STEPCONFIG_INP(val) ((val) << 19)
76#define STEPCONFIG_INP_AN2 STEPCONFIG_INP(2)
77#define STEPCONFIG_INP_AN3 STEPCONFIG_INP(3)
78#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
79#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
80#define STEPCONFIG_FIFO1 BIT(26)
81
82/* Delay register */
83#define STEPDELAY_OPEN_MASK (0x3FFFF << 0)
84#define STEPDELAY_OPEN(val) ((val) << 0)
85#define STEPCONFIG_OPENDLY STEPDELAY_OPEN(0x098)
86#define STEPDELAY_SAMPLE_MASK (0xFF << 24)
87#define STEPDELAY_SAMPLE(val) ((val) << 24)
88#define STEPCONFIG_SAMPLEDLY STEPDELAY_SAMPLE(0)
89
90/* Charge Config */
91#define STEPCHARGE_RFP_MASK (7 << 12)
92#define STEPCHARGE_RFP(val) ((val) << 12)
93#define STEPCHARGE_RFP_XPUL STEPCHARGE_RFP(1)
94#define STEPCHARGE_INM_MASK (0xF << 15)
95#define STEPCHARGE_INM(val) ((val) << 15)
96#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
97#define STEPCHARGE_INP_MASK (0xF << 19)
98#define STEPCHARGE_INP(val) ((val) << 19)
99#define STEPCHARGE_INP_AN1 STEPCHARGE_INP(1)
100#define STEPCHARGE_RFM_MASK (3 << 23)
101#define STEPCHARGE_RFM(val) ((val) << 23)
102#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
103
104/* Charge delay */
105#define CHARGEDLY_OPEN_MASK (0x3FFFF << 0)
106#define CHARGEDLY_OPEN(val) ((val) << 0)
107#define CHARGEDLY_OPENDLY CHARGEDLY_OPEN(1)
108
109/* Control register */
110#define CNTRLREG_TSCSSENB BIT(0)
111#define CNTRLREG_STEPID BIT(1)
112#define CNTRLREG_STEPCONFIGWRT BIT(2)
113#define CNTRLREG_POWERDOWN BIT(4)
114#define CNTRLREG_AFE_CTRL_MASK (3 << 5)
115#define CNTRLREG_AFE_CTRL(val) ((val) << 5)
116#define CNTRLREG_4WIRE CNTRLREG_AFE_CTRL(1)
117#define CNTRLREG_5WIRE CNTRLREG_AFE_CTRL(2)
118#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
119#define CNTRLREG_TSCENB BIT(7)
120
121#define ADC_CLK 3000000
122#define MAX_CLK_DIV 7
123#define TOTAL_STEPS 16
124#define TOTAL_CHANNELS 8
125
126#define TSCADC_CELLS 2
127
128enum tscadc_cells {
129 TSC_CELL,
130 ADC_CELL,
131};
132
133struct mfd_tscadc_board {
134 struct tsc_data *tsc_init;
135 struct adc_data *adc_init;
136};
137
138struct ti_tscadc_dev {
139 struct device *dev;
140 struct regmap *regmap_tscadc;
141 void __iomem *tscadc_base;
142 int irq;
143 struct mfd_cell cells[TSCADC_CELLS];
144
145 /* tsc device */
146 struct titsc *tsc;
147
148 /* adc device */
149 struct adc_device *adc;
150};
151
152#endif
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 6bc31d854626..6694cf43e8b8 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -23,37 +23,109 @@
23#define __LINUX_MFD_TPS65090_H 23#define __LINUX_MFD_TPS65090_H
24 24
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/regmap.h>
27
28/* TPS65090 IRQs */
29enum {
30 TPS65090_IRQ_VAC_STATUS_CHANGE,
31 TPS65090_IRQ_VSYS_STATUS_CHANGE,
32 TPS65090_IRQ_BAT_STATUS_CHANGE,
33 TPS65090_IRQ_CHARGING_STATUS_CHANGE,
34 TPS65090_IRQ_CHARGING_COMPLETE,
35 TPS65090_IRQ_OVERLOAD_DCDC1,
36 TPS65090_IRQ_OVERLOAD_DCDC2,
37 TPS65090_IRQ_OVERLOAD_DCDC3,
38 TPS65090_IRQ_OVERLOAD_FET1,
39 TPS65090_IRQ_OVERLOAD_FET2,
40 TPS65090_IRQ_OVERLOAD_FET3,
41 TPS65090_IRQ_OVERLOAD_FET4,
42 TPS65090_IRQ_OVERLOAD_FET5,
43 TPS65090_IRQ_OVERLOAD_FET6,
44 TPS65090_IRQ_OVERLOAD_FET7,
45};
46
47/* TPS65090 Regulator ID */
48enum {
49 TPS65090_REGULATOR_DCDC1,
50 TPS65090_REGULATOR_DCDC2,
51 TPS65090_REGULATOR_DCDC3,
52 TPS65090_REGULATOR_FET1,
53 TPS65090_REGULATOR_FET2,
54 TPS65090_REGULATOR_FET3,
55 TPS65090_REGULATOR_FET4,
56 TPS65090_REGULATOR_FET5,
57 TPS65090_REGULATOR_FET6,
58 TPS65090_REGULATOR_FET7,
59 TPS65090_REGULATOR_LDO1,
60 TPS65090_REGULATOR_LDO2,
61
62 /* Last entry for maximum ID */
63 TPS65090_REGULATOR_MAX,
64};
26 65
27struct tps65090 { 66struct tps65090 {
28 struct mutex lock;
29 struct device *dev; 67 struct device *dev;
30 struct i2c_client *client;
31 struct regmap *rmap; 68 struct regmap *rmap;
32 struct irq_chip irq_chip; 69 struct regmap_irq_chip_data *irq_data;
33 struct mutex irq_lock;
34 int irq_base;
35 unsigned int id;
36}; 70};
37 71
38struct tps65090_subdev_info { 72/*
39 int id; 73 * struct tps65090_regulator_plat_data
40 const char *name; 74 *
41 void *platform_data; 75 * @reg_init_data: The regulator init data.
76 * @enable_ext_control: Enable extrenal control or not. Only available for
77 * DCDC1, DCDC2 and DCDC3.
78 * @gpio: Gpio number if external control is enabled and controlled through
79 * gpio.
80 */
81struct tps65090_regulator_plat_data {
82 struct regulator_init_data *reg_init_data;
83 bool enable_ext_control;
84 int gpio;
42}; 85};
43 86
44struct tps65090_platform_data { 87struct tps65090_platform_data {
45 int irq_base; 88 int irq_base;
46 int num_subdevs; 89 struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX];
47 struct tps65090_subdev_info *subdevs;
48}; 90};
49 91
50/* 92/*
51 * NOTE: the functions below are not intended for use outside 93 * NOTE: the functions below are not intended for use outside
52 * of the TPS65090 sub-device drivers 94 * of the TPS65090 sub-device drivers
53 */ 95 */
54extern int tps65090_write(struct device *dev, int reg, uint8_t val); 96static inline int tps65090_write(struct device *dev, int reg, uint8_t val)
55extern int tps65090_read(struct device *dev, int reg, uint8_t *val); 97{
56extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num); 98 struct tps65090 *tps = dev_get_drvdata(dev);
57extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num); 99
100 return regmap_write(tps->rmap, reg, val);
101}
102
103static inline int tps65090_read(struct device *dev, int reg, uint8_t *val)
104{
105 struct tps65090 *tps = dev_get_drvdata(dev);
106 unsigned int temp_val;
107 int ret;
108
109 ret = regmap_read(tps->rmap, reg, &temp_val);
110 if (!ret)
111 *val = temp_val;
112 return ret;
113}
114
115static inline int tps65090_set_bits(struct device *dev, int reg,
116 uint8_t bit_num)
117{
118 struct tps65090 *tps = dev_get_drvdata(dev);
119
120 return regmap_update_bits(tps->rmap, reg, BIT(bit_num), ~0u);
121}
122
123static inline int tps65090_clr_bits(struct device *dev, int reg,
124 uint8_t bit_num)
125{
126 struct tps65090 *tps = dev_get_drvdata(dev);
127
128 return regmap_update_bits(tps->rmap, reg, BIT(bit_num), 0u);
129}
58 130
59#endif /*__LINUX_MFD_TPS65090_H */ 131#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index 2dd123194958..87994542573b 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -29,6 +29,7 @@ enum {
29 TPS6586X_ID_LDO_8, 29 TPS6586X_ID_LDO_8,
30 TPS6586X_ID_LDO_9, 30 TPS6586X_ID_LDO_9,
31 TPS6586X_ID_LDO_RTC, 31 TPS6586X_ID_LDO_RTC,
32 TPS6586X_ID_MAX_REGULATOR,
32}; 33};
33 34
34enum { 35enum {
@@ -79,6 +80,8 @@ struct tps6586x_platform_data {
79 int gpio_base; 80 int gpio_base;
80 int irq_base; 81 int irq_base;
81 bool pm_off; 82 bool pm_off;
83
84 struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR];
82}; 85};
83 86
84/* 87/*
@@ -93,5 +96,6 @@ extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
93extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); 96extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
94extern int tps6586x_update(struct device *dev, int reg, uint8_t val, 97extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
95 uint8_t mask); 98 uint8_t mask);
99extern int tps6586x_irq_get_virq(struct device *dev, int irq);
96 100
97#endif /*__LINUX_MFD_TPS6586X_H */ 101#endif /*__LINUX_MFD_TPS6586X_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 02e894f3ff45..20e433e551e3 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -572,6 +572,49 @@
572#define SPARE_SPARE_MASK 0xFF 572#define SPARE_SPARE_MASK 0xFF
573#define SPARE_SPARE_SHIFT 0 573#define SPARE_SPARE_SHIFT 0
574 574
575#define TPS65910_INT_STS_RTC_PERIOD_IT_MASK 0x80
576#define TPS65910_INT_STS_RTC_PERIOD_IT_SHIFT 7
577#define TPS65910_INT_STS_RTC_ALARM_IT_MASK 0x40
578#define TPS65910_INT_STS_RTC_ALARM_IT_SHIFT 6
579#define TPS65910_INT_STS_HOTDIE_IT_MASK 0x20
580#define TPS65910_INT_STS_HOTDIE_IT_SHIFT 5
581#define TPS65910_INT_STS_PWRHOLD_F_IT_MASK 0x10
582#define TPS65910_INT_STS_PWRHOLD_F_IT_SHIFT 4
583#define TPS65910_INT_STS_PWRON_LP_IT_MASK 0x08
584#define TPS65910_INT_STS_PWRON_LP_IT_SHIFT 3
585#define TPS65910_INT_STS_PWRON_IT_MASK 0x04
586#define TPS65910_INT_STS_PWRON_IT_SHIFT 2
587#define TPS65910_INT_STS_VMBHI_IT_MASK 0x02
588#define TPS65910_INT_STS_VMBHI_IT_SHIFT 1
589#define TPS65910_INT_STS_VMBDCH_IT_MASK 0x01
590#define TPS65910_INT_STS_VMBDCH_IT_SHIFT 0
591
592#define TPS65910_INT_MSK_RTC_PERIOD_IT_MSK_MASK 0x80
593#define TPS65910_INT_MSK_RTC_PERIOD_IT_MSK_SHIFT 7
594#define TPS65910_INT_MSK_RTC_ALARM_IT_MSK_MASK 0x40
595#define TPS65910_INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6
596#define TPS65910_INT_MSK_HOTDIE_IT_MSK_MASK 0x20
597#define TPS65910_INT_MSK_HOTDIE_IT_MSK_SHIFT 5
598#define TPS65910_INT_MSK_PWRHOLD_IT_MSK_MASK 0x10
599#define TPS65910_INT_MSK_PWRHOLD_IT_MSK_SHIFT 4
600#define TPS65910_INT_MSK_PWRON_LP_IT_MSK_MASK 0x08
601#define TPS65910_INT_MSK_PWRON_LP_IT_MSK_SHIFT 3
602#define TPS65910_INT_MSK_PWRON_IT_MSK_MASK 0x04
603#define TPS65910_INT_MSK_PWRON_IT_MSK_SHIFT 2
604#define TPS65910_INT_MSK_VMBHI_IT_MSK_MASK 0x02
605#define TPS65910_INT_MSK_VMBHI_IT_MSK_SHIFT 1
606#define TPS65910_INT_MSK_VMBDCH_IT_MSK_MASK 0x01
607#define TPS65910_INT_MSK_VMBDCH_IT_MSK_SHIFT 0
608
609#define TPS65910_INT_STS2_GPIO0_F_IT_SHIFT 2
610#define TPS65910_INT_STS2_GPIO0_F_IT_MASK 0x02
611#define TPS65910_INT_STS2_GPIO0_R_IT_SHIFT 1
612#define TPS65910_INT_STS2_GPIO0_R_IT_MASK 0x01
613
614#define TPS65910_INT_MSK2_GPIO0_F_IT_MSK_SHIFT 2
615#define TPS65910_INT_MSK2_GPIO0_F_IT_MSK_MASK 0x02
616#define TPS65910_INT_MSK2_GPIO0_R_IT_MSK_SHIFT 1
617#define TPS65910_INT_MSK2_GPIO0_R_IT_MSK_MASK 0x01
575 618
576/*Register INT_STS (0x80) register.RegisterDescription */ 619/*Register INT_STS (0x80) register.RegisterDescription */
577#define INT_STS_RTC_PERIOD_IT_MASK 0x80 620#define INT_STS_RTC_PERIOD_IT_MASK 0x80
@@ -580,16 +623,16 @@
580#define INT_STS_RTC_ALARM_IT_SHIFT 6 623#define INT_STS_RTC_ALARM_IT_SHIFT 6
581#define INT_STS_HOTDIE_IT_MASK 0x20 624#define INT_STS_HOTDIE_IT_MASK 0x20
582#define INT_STS_HOTDIE_IT_SHIFT 5 625#define INT_STS_HOTDIE_IT_SHIFT 5
583#define INT_STS_PWRHOLD_IT_MASK 0x10 626#define INT_STS_PWRHOLD_R_IT_MASK 0x10
584#define INT_STS_PWRHOLD_IT_SHIFT 4 627#define INT_STS_PWRHOLD_R_IT_SHIFT 4
585#define INT_STS_PWRON_LP_IT_MASK 0x08 628#define INT_STS_PWRON_LP_IT_MASK 0x08
586#define INT_STS_PWRON_LP_IT_SHIFT 3 629#define INT_STS_PWRON_LP_IT_SHIFT 3
587#define INT_STS_PWRON_IT_MASK 0x04 630#define INT_STS_PWRON_IT_MASK 0x04
588#define INT_STS_PWRON_IT_SHIFT 2 631#define INT_STS_PWRON_IT_SHIFT 2
589#define INT_STS_VMBHI_IT_MASK 0x02 632#define INT_STS_VMBHI_IT_MASK 0x02
590#define INT_STS_VMBHI_IT_SHIFT 1 633#define INT_STS_VMBHI_IT_SHIFT 1
591#define INT_STS_VMBDCH_IT_MASK 0x01 634#define INT_STS_PWRHOLD_F_IT_MASK 0x01
592#define INT_STS_VMBDCH_IT_SHIFT 0 635#define INT_STS_PWRHOLD_F_IT_SHIFT 0
593 636
594 637
595/*Register INT_MSK (0x80) register.RegisterDescription */ 638/*Register INT_MSK (0x80) register.RegisterDescription */
@@ -599,16 +642,16 @@
599#define INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6 642#define INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6
600#define INT_MSK_HOTDIE_IT_MSK_MASK 0x20 643#define INT_MSK_HOTDIE_IT_MSK_MASK 0x20
601#define INT_MSK_HOTDIE_IT_MSK_SHIFT 5 644#define INT_MSK_HOTDIE_IT_MSK_SHIFT 5
602#define INT_MSK_PWRHOLD_IT_MSK_MASK 0x10 645#define INT_MSK_PWRHOLD_R_IT_MSK_MASK 0x10
603#define INT_MSK_PWRHOLD_IT_MSK_SHIFT 4 646#define INT_MSK_PWRHOLD_R_IT_MSK_SHIFT 4
604#define INT_MSK_PWRON_LP_IT_MSK_MASK 0x08 647#define INT_MSK_PWRON_LP_IT_MSK_MASK 0x08
605#define INT_MSK_PWRON_LP_IT_MSK_SHIFT 3 648#define INT_MSK_PWRON_LP_IT_MSK_SHIFT 3
606#define INT_MSK_PWRON_IT_MSK_MASK 0x04 649#define INT_MSK_PWRON_IT_MSK_MASK 0x04
607#define INT_MSK_PWRON_IT_MSK_SHIFT 2 650#define INT_MSK_PWRON_IT_MSK_SHIFT 2
608#define INT_MSK_VMBHI_IT_MSK_MASK 0x02 651#define INT_MSK_VMBHI_IT_MSK_MASK 0x02
609#define INT_MSK_VMBHI_IT_MSK_SHIFT 1 652#define INT_MSK_VMBHI_IT_MSK_SHIFT 1
610#define INT_MSK_VMBDCH_IT_MSK_MASK 0x01 653#define INT_MSK_PWRHOLD_F_IT_MSK_MASK 0x01
611#define INT_MSK_VMBDCH_IT_MSK_SHIFT 0 654#define INT_MSK_PWRHOLD_F_IT_MSK_SHIFT 0
612 655
613 656
614/*Register INT_STS2 (0x80) register.RegisterDescription */ 657/*Register INT_STS2 (0x80) register.RegisterDescription */
@@ -650,6 +693,14 @@
650 693
651 694
652/*Register INT_STS3 (0x80) register.RegisterDescription */ 695/*Register INT_STS3 (0x80) register.RegisterDescription */
696#define INT_STS3_PWRDN_IT_MASK 0x80
697#define INT_STS3_PWRDN_IT_SHIFT 7
698#define INT_STS3_VMBCH2_L_IT_MASK 0x40
699#define INT_STS3_VMBCH2_L_IT_SHIFT 6
700#define INT_STS3_VMBCH2_H_IT_MASK 0x20
701#define INT_STS3_VMBCH2_H_IT_SHIFT 5
702#define INT_STS3_WTCHDG_IT_MASK 0x10
703#define INT_STS3_WTCHDG_IT_SHIFT 4
653#define INT_STS3_GPIO5_F_IT_MASK 0x08 704#define INT_STS3_GPIO5_F_IT_MASK 0x08
654#define INT_STS3_GPIO5_F_IT_SHIFT 3 705#define INT_STS3_GPIO5_F_IT_SHIFT 3
655#define INT_STS3_GPIO5_R_IT_MASK 0x04 706#define INT_STS3_GPIO5_R_IT_MASK 0x04
@@ -661,6 +712,14 @@
661 712
662 713
663/*Register INT_MSK3 (0x80) register.RegisterDescription */ 714/*Register INT_MSK3 (0x80) register.RegisterDescription */
715#define INT_MSK3_PWRDN_IT_MSK_MASK 0x80
716#define INT_MSK3_PWRDN_IT_MSK_SHIFT 7
717#define INT_MSK3_VMBCH2_L_IT_MSK_MASK 0x40
718#define INT_MSK3_VMBCH2_L_IT_MSK_SHIFT 6
719#define INT_MSK3_VMBCH2_H_IT_MSK_MASK 0x20
720#define INT_MSK3_VMBCH2_H_IT_MSK_SHIFT 5
721#define INT_MSK3_WTCHDG_IT_MSK_MASK 0x10
722#define INT_MSK3_WTCHDG_IT_MSK_SHIFT 4
664#define INT_MSK3_GPIO5_F_IT_MSK_MASK 0x08 723#define INT_MSK3_GPIO5_F_IT_MSK_MASK 0x08
665#define INT_MSK3_GPIO5_F_IT_MSK_SHIFT 3 724#define INT_MSK3_GPIO5_F_IT_MSK_SHIFT 3
666#define INT_MSK3_GPIO5_R_IT_MSK_MASK 0x04 725#define INT_MSK3_GPIO5_R_IT_MSK_MASK 0x04
@@ -721,34 +780,32 @@
721#define TPS65910_IRQ_GPIO_F 9 780#define TPS65910_IRQ_GPIO_F 9
722#define TPS65910_NUM_IRQ 10 781#define TPS65910_NUM_IRQ 10
723 782
724#define TPS65911_IRQ_VBAT_VMBDCH 0 783#define TPS65911_IRQ_PWRHOLD_F 0
725#define TPS65911_IRQ_VBAT_VMBDCH2L 1 784#define TPS65911_IRQ_VBAT_VMHI 1
726#define TPS65911_IRQ_VBAT_VMBDCH2H 2 785#define TPS65911_IRQ_PWRON 2
727#define TPS65911_IRQ_VBAT_VMHI 3 786#define TPS65911_IRQ_PWRON_LP 3
728#define TPS65911_IRQ_PWRON 4 787#define TPS65911_IRQ_PWRHOLD_R 4
729#define TPS65911_IRQ_PWRON_LP 5 788#define TPS65911_IRQ_HOTDIE 5
730#define TPS65911_IRQ_PWRHOLD_F 6 789#define TPS65911_IRQ_RTC_ALARM 6
731#define TPS65911_IRQ_PWRHOLD_R 7 790#define TPS65911_IRQ_RTC_PERIOD 7
732#define TPS65911_IRQ_HOTDIE 8 791#define TPS65911_IRQ_GPIO0_R 8
733#define TPS65911_IRQ_RTC_ALARM 9 792#define TPS65911_IRQ_GPIO0_F 9
734#define TPS65911_IRQ_RTC_PERIOD 10 793#define TPS65911_IRQ_GPIO1_R 10
735#define TPS65911_IRQ_GPIO0_R 11 794#define TPS65911_IRQ_GPIO1_F 11
736#define TPS65911_IRQ_GPIO0_F 12 795#define TPS65911_IRQ_GPIO2_R 12
737#define TPS65911_IRQ_GPIO1_R 13 796#define TPS65911_IRQ_GPIO2_F 13
738#define TPS65911_IRQ_GPIO1_F 14 797#define TPS65911_IRQ_GPIO3_R 14
739#define TPS65911_IRQ_GPIO2_R 15 798#define TPS65911_IRQ_GPIO3_F 15
740#define TPS65911_IRQ_GPIO2_F 16 799#define TPS65911_IRQ_GPIO4_R 16
741#define TPS65911_IRQ_GPIO3_R 17 800#define TPS65911_IRQ_GPIO4_F 17
742#define TPS65911_IRQ_GPIO3_F 18 801#define TPS65911_IRQ_GPIO5_R 18
743#define TPS65911_IRQ_GPIO4_R 19 802#define TPS65911_IRQ_GPIO5_F 19
744#define TPS65911_IRQ_GPIO4_F 20 803#define TPS65911_IRQ_WTCHDG 20
745#define TPS65911_IRQ_GPIO5_R 21 804#define TPS65911_IRQ_VMBCH2_H 21
746#define TPS65911_IRQ_GPIO5_F 22 805#define TPS65911_IRQ_VMBCH2_L 22
747#define TPS65911_IRQ_WTCHDG 23 806#define TPS65911_IRQ_PWRDN 23
748#define TPS65911_IRQ_PWRDN 24 807
749 808#define TPS65911_NUM_IRQ 24
750#define TPS65911_NUM_IRQ 25
751
752 809
753/* GPIO Register Definitions */ 810/* GPIO Register Definitions */
754#define TPS65910_GPIO_DEB BIT(2) 811#define TPS65910_GPIO_DEB BIT(2)
@@ -836,7 +893,6 @@ struct tps65910 {
836 struct device *dev; 893 struct device *dev;
837 struct i2c_client *i2c_client; 894 struct i2c_client *i2c_client;
838 struct regmap *regmap; 895 struct regmap *regmap;
839 struct mutex io_mutex;
840 unsigned int id; 896 unsigned int id;
841 897
842 /* Client devices */ 898 /* Client devices */
@@ -848,12 +904,8 @@ struct tps65910 {
848 struct tps65910_board *of_plat_data; 904 struct tps65910_board *of_plat_data;
849 905
850 /* IRQ Handling */ 906 /* IRQ Handling */
851 struct mutex irq_lock;
852 int chip_irq; 907 int chip_irq;
853 int irq_base; 908 struct regmap_irq_chip_data *irq_data;
854 int irq_num;
855 u32 irq_mask;
856 struct irq_domain *domain;
857}; 909};
858 910
859struct tps65910_platform_data { 911struct tps65910_platform_data {
@@ -861,10 +913,6 @@ struct tps65910_platform_data {
861 int irq_base; 913 int irq_base;
862}; 914};
863 915
864int tps65910_irq_init(struct tps65910 *tps65910, int irq,
865 struct tps65910_platform_data *pdata);
866int tps65910_irq_exit(struct tps65910 *tps65910);
867
868static inline int tps65910_chip_id(struct tps65910 *tps65910) 916static inline int tps65910_chip_id(struct tps65910 *tps65910)
869{ 917{
870 return tps65910->id; 918 return tps65910->id;
@@ -900,4 +948,9 @@ static inline int tps65910_reg_update_bits(struct tps65910 *tps65910, u8 reg,
900 return regmap_update_bits(tps65910->regmap, reg, mask, val); 948 return regmap_update_bits(tps65910->regmap, reg, mask, val);
901} 949}
902 950
951static inline int tps65910_irq_get_virq(struct tps65910 *tps65910, int irq)
952{
953 return regmap_irq_get_virq(tps65910->irq_data, irq);
954}
955
903#endif /* __LINUX_MFD_TPS65910_H */ 956#endif /* __LINUX_MFD_TPS65910_H */
diff --git a/include/linux/mfd/tps80031.h b/include/linux/mfd/tps80031.h
new file mode 100644
index 000000000000..2c75c9c9318f
--- /dev/null
+++ b/include/linux/mfd/tps80031.h
@@ -0,0 +1,637 @@
1/*
2 * tps80031.h -- TI TPS80031 and TI TPS80032 PMIC driver.
3 *
4 * Copyright (c) 2012, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
13 * whether express or implied; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * 02111-1307, USA
21 */
22
23#ifndef __LINUX_MFD_TPS80031_H
24#define __LINUX_MFD_TPS80031_H
25
26#include <linux/device.h>
27#include <linux/regmap.h>
28
29/* Pull-ups/Pull-downs */
30#define TPS80031_CFG_INPUT_PUPD1 0xF0
31#define TPS80031_CFG_INPUT_PUPD2 0xF1
32#define TPS80031_CFG_INPUT_PUPD3 0xF2
33#define TPS80031_CFG_INPUT_PUPD4 0xF3
34#define TPS80031_CFG_LDO_PD1 0xF4
35#define TPS80031_CFG_LDO_PD2 0xF5
36#define TPS80031_CFG_SMPS_PD 0xF6
37
38/* Real Time Clock */
39#define TPS80031_SECONDS_REG 0x00
40#define TPS80031_MINUTES_REG 0x01
41#define TPS80031_HOURS_REG 0x02
42#define TPS80031_DAYS_REG 0x03
43#define TPS80031_MONTHS_REG 0x04
44#define TPS80031_YEARS_REG 0x05
45#define TPS80031_WEEKS_REG 0x06
46#define TPS80031_ALARM_SECONDS_REG 0x08
47#define TPS80031_ALARM_MINUTES_REG 0x09
48#define TPS80031_ALARM_HOURS_REG 0x0A
49#define TPS80031_ALARM_DAYS_REG 0x0B
50#define TPS80031_ALARM_MONTHS_REG 0x0C
51#define TPS80031_ALARM_YEARS_REG 0x0D
52#define TPS80031_RTC_CTRL_REG 0x10
53#define TPS80031_RTC_STATUS_REG 0x11
54#define TPS80031_RTC_INTERRUPTS_REG 0x12
55#define TPS80031_RTC_COMP_LSB_REG 0x13
56#define TPS80031_RTC_COMP_MSB_REG 0x14
57#define TPS80031_RTC_RESET_STATUS_REG 0x16
58
59/*PMC Master Module */
60#define TPS80031_PHOENIX_START_CONDITION 0x1F
61#define TPS80031_PHOENIX_MSK_TRANSITION 0x20
62#define TPS80031_STS_HW_CONDITIONS 0x21
63#define TPS80031_PHOENIX_LAST_TURNOFF_STS 0x22
64#define TPS80031_VSYSMIN_LO_THRESHOLD 0x23
65#define TPS80031_VSYSMIN_HI_THRESHOLD 0x24
66#define TPS80031_PHOENIX_DEV_ON 0x25
67#define TPS80031_STS_PWR_GRP_STATE 0x27
68#define TPS80031_PH_CFG_VSYSLOW 0x28
69#define TPS80031_PH_STS_BOOT 0x29
70#define TPS80031_PHOENIX_SENS_TRANSITION 0x2A
71#define TPS80031_PHOENIX_SEQ_CFG 0x2B
72#define TPS80031_PRIMARY_WATCHDOG_CFG 0X2C
73#define TPS80031_KEY_PRESS_DUR_CFG 0X2D
74#define TPS80031_SMPS_LDO_SHORT_STS 0x2E
75
76/* PMC Slave Module - Broadcast */
77#define TPS80031_BROADCAST_ADDR_ALL 0x31
78#define TPS80031_BROADCAST_ADDR_REF 0x32
79#define TPS80031_BROADCAST_ADDR_PROV 0x33
80#define TPS80031_BROADCAST_ADDR_CLK_RST 0x34
81
82/* PMC Slave Module SMPS Regulators */
83#define TPS80031_SMPS4_CFG_TRANS 0x41
84#define TPS80031_SMPS4_CFG_STATE 0x42
85#define TPS80031_SMPS4_CFG_VOLTAGE 0x44
86#define TPS80031_VIO_CFG_TRANS 0x47
87#define TPS80031_VIO_CFG_STATE 0x48
88#define TPS80031_VIO_CFG_FORCE 0x49
89#define TPS80031_VIO_CFG_VOLTAGE 0x4A
90#define TPS80031_VIO_CFG_STEP 0x48
91#define TPS80031_SMPS1_CFG_TRANS 0x53
92#define TPS80031_SMPS1_CFG_STATE 0x54
93#define TPS80031_SMPS1_CFG_FORCE 0x55
94#define TPS80031_SMPS1_CFG_VOLTAGE 0x56
95#define TPS80031_SMPS1_CFG_STEP 0x57
96#define TPS80031_SMPS2_CFG_TRANS 0x59
97#define TPS80031_SMPS2_CFG_STATE 0x5A
98#define TPS80031_SMPS2_CFG_FORCE 0x5B
99#define TPS80031_SMPS2_CFG_VOLTAGE 0x5C
100#define TPS80031_SMPS2_CFG_STEP 0x5D
101#define TPS80031_SMPS3_CFG_TRANS 0x65
102#define TPS80031_SMPS3_CFG_STATE 0x66
103#define TPS80031_SMPS3_CFG_VOLTAGE 0x68
104
105/* PMC Slave Module LDO Regulators */
106#define TPS80031_VANA_CFG_TRANS 0x81
107#define TPS80031_VANA_CFG_STATE 0x82
108#define TPS80031_VANA_CFG_VOLTAGE 0x83
109#define TPS80031_LDO2_CFG_TRANS 0x85
110#define TPS80031_LDO2_CFG_STATE 0x86
111#define TPS80031_LDO2_CFG_VOLTAGE 0x87
112#define TPS80031_LDO4_CFG_TRANS 0x89
113#define TPS80031_LDO4_CFG_STATE 0x8A
114#define TPS80031_LDO4_CFG_VOLTAGE 0x8B
115#define TPS80031_LDO3_CFG_TRANS 0x8D
116#define TPS80031_LDO3_CFG_STATE 0x8E
117#define TPS80031_LDO3_CFG_VOLTAGE 0x8F
118#define TPS80031_LDO6_CFG_TRANS 0x91
119#define TPS80031_LDO6_CFG_STATE 0x92
120#define TPS80031_LDO6_CFG_VOLTAGE 0x93
121#define TPS80031_LDOLN_CFG_TRANS 0x95
122#define TPS80031_LDOLN_CFG_STATE 0x96
123#define TPS80031_LDOLN_CFG_VOLTAGE 0x97
124#define TPS80031_LDO5_CFG_TRANS 0x99
125#define TPS80031_LDO5_CFG_STATE 0x9A
126#define TPS80031_LDO5_CFG_VOLTAGE 0x9B
127#define TPS80031_LDO1_CFG_TRANS 0x9D
128#define TPS80031_LDO1_CFG_STATE 0x9E
129#define TPS80031_LDO1_CFG_VOLTAGE 0x9F
130#define TPS80031_LDOUSB_CFG_TRANS 0xA1
131#define TPS80031_LDOUSB_CFG_STATE 0xA2
132#define TPS80031_LDOUSB_CFG_VOLTAGE 0xA3
133#define TPS80031_LDO7_CFG_TRANS 0xA5
134#define TPS80031_LDO7_CFG_STATE 0xA6
135#define TPS80031_LDO7_CFG_VOLTAGE 0xA7
136
137/* PMC Slave Module External Control */
138#define TPS80031_REGEN1_CFG_TRANS 0xAE
139#define TPS80031_REGEN1_CFG_STATE 0xAF
140#define TPS80031_REGEN2_CFG_TRANS 0xB1
141#define TPS80031_REGEN2_CFG_STATE 0xB2
142#define TPS80031_SYSEN_CFG_TRANS 0xB4
143#define TPS80031_SYSEN_CFG_STATE 0xB5
144
145/* PMC Slave Module Internal Control */
146#define TPS80031_NRESPWRON_CFG_TRANS 0xB7
147#define TPS80031_NRESPWRON_CFG_STATE 0xB8
148#define TPS80031_CLK32KAO_CFG_TRANS 0xBA
149#define TPS80031_CLK32KAO_CFG_STATE 0xBB
150#define TPS80031_CLK32KG_CFG_TRANS 0xBD
151#define TPS80031_CLK32KG_CFG_STATE 0xBE
152#define TPS80031_CLK32KAUDIO_CFG_TRANS 0xC0
153#define TPS80031_CLK32KAUDIO_CFG_STATE 0xC1
154#define TPS80031_VRTC_CFG_TRANS 0xC3
155#define TPS80031_VRTC_CFG_STATE 0xC4
156#define TPS80031_BIAS_CFG_TRANS 0xC6
157#define TPS80031_BIAS_CFG_STATE 0xC7
158#define TPS80031_VSYSMIN_HI_CFG_TRANS 0xC9
159#define TPS80031_VSYSMIN_HI_CFG_STATE 0xCA
160#define TPS80031_RC6MHZ_CFG_TRANS 0xCC
161#define TPS80031_RC6MHZ_CFG_STATE 0xCD
162#define TPS80031_TMP_CFG_TRANS 0xCF
163#define TPS80031_TMP_CFG_STATE 0xD0
164
165/* PMC Slave Module resources assignment */
166#define TPS80031_PREQ1_RES_ASS_A 0xD7
167#define TPS80031_PREQ1_RES_ASS_B 0xD8
168#define TPS80031_PREQ1_RES_ASS_C 0xD9
169#define TPS80031_PREQ2_RES_ASS_A 0xDA
170#define TPS80031_PREQ2_RES_ASS_B 0xDB
171#define TPS80031_PREQ2_RES_ASS_C 0xDC
172#define TPS80031_PREQ3_RES_ASS_A 0xDD
173#define TPS80031_PREQ3_RES_ASS_B 0xDE
174#define TPS80031_PREQ3_RES_ASS_C 0xDF
175
176/* PMC Slave Module Miscellaneous */
177#define TPS80031_SMPS_OFFSET 0xE0
178#define TPS80031_SMPS_MULT 0xE3
179#define TPS80031_MISC1 0xE4
180#define TPS80031_MISC2 0xE5
181#define TPS80031_BBSPOR_CFG 0xE6
182#define TPS80031_TMP_CFG 0xE7
183
184/* Battery Charging Controller and Indicator LED */
185#define TPS80031_CONTROLLER_CTRL2 0xDA
186#define TPS80031_CONTROLLER_VSEL_COMP 0xDB
187#define TPS80031_CHARGERUSB_VSYSREG 0xDC
188#define TPS80031_CHARGERUSB_VICHRG_PC 0xDD
189#define TPS80031_LINEAR_CHRG_STS 0xDE
190#define TPS80031_CONTROLLER_INT_MASK 0xE0
191#define TPS80031_CONTROLLER_CTRL1 0xE1
192#define TPS80031_CONTROLLER_WDG 0xE2
193#define TPS80031_CONTROLLER_STAT1 0xE3
194#define TPS80031_CHARGERUSB_INT_STATUS 0xE4
195#define TPS80031_CHARGERUSB_INT_MASK 0xE5
196#define TPS80031_CHARGERUSB_STATUS_INT1 0xE6
197#define TPS80031_CHARGERUSB_STATUS_INT2 0xE7
198#define TPS80031_CHARGERUSB_CTRL1 0xE8
199#define TPS80031_CHARGERUSB_CTRL2 0xE9
200#define TPS80031_CHARGERUSB_CTRL3 0xEA
201#define TPS80031_CHARGERUSB_STAT1 0xEB
202#define TPS80031_CHARGERUSB_VOREG 0xEC
203#define TPS80031_CHARGERUSB_VICHRG 0xED
204#define TPS80031_CHARGERUSB_CINLIMIT 0xEE
205#define TPS80031_CHARGERUSB_CTRLLIMIT1 0xEF
206#define TPS80031_CHARGERUSB_CTRLLIMIT2 0xF0
207#define TPS80031_LED_PWM_CTRL1 0xF4
208#define TPS80031_LED_PWM_CTRL2 0xF5
209
210/* USB On-The-Go */
211#define TPS80031_BACKUP_REG 0xFA
212#define TPS80031_USB_VENDOR_ID_LSB 0x00
213#define TPS80031_USB_VENDOR_ID_MSB 0x01
214#define TPS80031_USB_PRODUCT_ID_LSB 0x02
215#define TPS80031_USB_PRODUCT_ID_MSB 0x03
216#define TPS80031_USB_VBUS_CTRL_SET 0x04
217#define TPS80031_USB_VBUS_CTRL_CLR 0x05
218#define TPS80031_USB_ID_CTRL_SET 0x06
219#define TPS80031_USB_ID_CTRL_CLR 0x07
220#define TPS80031_USB_VBUS_INT_SRC 0x08
221#define TPS80031_USB_VBUS_INT_LATCH_SET 0x09
222#define TPS80031_USB_VBUS_INT_LATCH_CLR 0x0A
223#define TPS80031_USB_VBUS_INT_EN_LO_SET 0x0B
224#define TPS80031_USB_VBUS_INT_EN_LO_CLR 0x0C
225#define TPS80031_USB_VBUS_INT_EN_HI_SET 0x0D
226#define TPS80031_USB_VBUS_INT_EN_HI_CLR 0x0E
227#define TPS80031_USB_ID_INT_SRC 0x0F
228#define TPS80031_USB_ID_INT_LATCH_SET 0x10
229#define TPS80031_USB_ID_INT_LATCH_CLR 0x11
230#define TPS80031_USB_ID_INT_EN_LO_SET 0x12
231#define TPS80031_USB_ID_INT_EN_LO_CLR 0x13
232#define TPS80031_USB_ID_INT_EN_HI_SET 0x14
233#define TPS80031_USB_ID_INT_EN_HI_CLR 0x15
234#define TPS80031_USB_OTG_ADP_CTRL 0x16
235#define TPS80031_USB_OTG_ADP_HIGH 0x17
236#define TPS80031_USB_OTG_ADP_LOW 0x18
237#define TPS80031_USB_OTG_ADP_RISE 0x19
238#define TPS80031_USB_OTG_REVISION 0x1A
239
240/* Gas Gauge */
241#define TPS80031_FG_REG_00 0xC0
242#define TPS80031_FG_REG_01 0xC1
243#define TPS80031_FG_REG_02 0xC2
244#define TPS80031_FG_REG_03 0xC3
245#define TPS80031_FG_REG_04 0xC4
246#define TPS80031_FG_REG_05 0xC5
247#define TPS80031_FG_REG_06 0xC6
248#define TPS80031_FG_REG_07 0xC7
249#define TPS80031_FG_REG_08 0xC8
250#define TPS80031_FG_REG_09 0xC9
251#define TPS80031_FG_REG_10 0xCA
252#define TPS80031_FG_REG_11 0xCB
253
254/* General Purpose ADC */
255#define TPS80031_GPADC_CTRL 0x2E
256#define TPS80031_GPADC_CTRL2 0x2F
257#define TPS80031_RTSELECT_LSB 0x32
258#define TPS80031_RTSELECT_ISB 0x33
259#define TPS80031_RTSELECT_MSB 0x34
260#define TPS80031_GPSELECT_ISB 0x35
261#define TPS80031_CTRL_P1 0x36
262#define TPS80031_RTCH0_LSB 0x37
263#define TPS80031_RTCH0_MSB 0x38
264#define TPS80031_RTCH1_LSB 0x39
265#define TPS80031_RTCH1_MSB 0x3A
266#define TPS80031_GPCH0_LSB 0x3B
267#define TPS80031_GPCH0_MSB 0x3C
268
269/* SIM, MMC and Battery Detection */
270#define TPS80031_SIMDEBOUNCING 0xEB
271#define TPS80031_SIMCTRL 0xEC
272#define TPS80031_MMCDEBOUNCING 0xED
273#define TPS80031_MMCCTRL 0xEE
274#define TPS80031_BATDEBOUNCING 0xEF
275
276/* Vibrator Driver and PWMs */
277#define TPS80031_VIBCTRL 0x9B
278#define TPS80031_VIBMODE 0x9C
279#define TPS80031_PWM1ON 0xBA
280#define TPS80031_PWM1OFF 0xBB
281#define TPS80031_PWM2ON 0xBD
282#define TPS80031_PWM2OFF 0xBE
283
284/* Control Interface */
285#define TPS80031_INT_STS_A 0xD0
286#define TPS80031_INT_STS_B 0xD1
287#define TPS80031_INT_STS_C 0xD2
288#define TPS80031_INT_MSK_LINE_A 0xD3
289#define TPS80031_INT_MSK_LINE_B 0xD4
290#define TPS80031_INT_MSK_LINE_C 0xD5
291#define TPS80031_INT_MSK_STS_A 0xD6
292#define TPS80031_INT_MSK_STS_B 0xD7
293#define TPS80031_INT_MSK_STS_C 0xD8
294#define TPS80031_TOGGLE1 0x90
295#define TPS80031_TOGGLE2 0x91
296#define TPS80031_TOGGLE3 0x92
297#define TPS80031_PWDNSTATUS1 0x93
298#define TPS80031_PWDNSTATUS2 0x94
299#define TPS80031_VALIDITY0 0x17
300#define TPS80031_VALIDITY1 0x18
301#define TPS80031_VALIDITY2 0x19
302#define TPS80031_VALIDITY3 0x1A
303#define TPS80031_VALIDITY4 0x1B
304#define TPS80031_VALIDITY5 0x1C
305#define TPS80031_VALIDITY6 0x1D
306#define TPS80031_VALIDITY7 0x1E
307
308/* Version number related register */
309#define TPS80031_JTAGVERNUM 0x87
310#define TPS80031_EPROM_REV 0xDF
311
312/* GPADC Trimming Bits. */
313#define TPS80031_GPADC_TRIM0 0xCC
314#define TPS80031_GPADC_TRIM1 0xCD
315#define TPS80031_GPADC_TRIM2 0xCE
316#define TPS80031_GPADC_TRIM3 0xCF
317#define TPS80031_GPADC_TRIM4 0xD0
318#define TPS80031_GPADC_TRIM5 0xD1
319#define TPS80031_GPADC_TRIM6 0xD2
320#define TPS80031_GPADC_TRIM7 0xD3
321#define TPS80031_GPADC_TRIM8 0xD4
322#define TPS80031_GPADC_TRIM9 0xD5
323#define TPS80031_GPADC_TRIM10 0xD6
324#define TPS80031_GPADC_TRIM11 0xD7
325#define TPS80031_GPADC_TRIM12 0xD8
326#define TPS80031_GPADC_TRIM13 0xD9
327#define TPS80031_GPADC_TRIM14 0xDA
328#define TPS80031_GPADC_TRIM15 0xDB
329#define TPS80031_GPADC_TRIM16 0xDC
330#define TPS80031_GPADC_TRIM17 0xDD
331#define TPS80031_GPADC_TRIM18 0xDE
332
333/* TPS80031_CONTROLLER_STAT1 bit fields */
334#define TPS80031_CONTROLLER_STAT1_BAT_TEMP 0
335#define TPS80031_CONTROLLER_STAT1_BAT_REMOVED 1
336#define TPS80031_CONTROLLER_STAT1_VBUS_DET 2
337#define TPS80031_CONTROLLER_STAT1_VAC_DET 3
338#define TPS80031_CONTROLLER_STAT1_FAULT_WDG 4
339#define TPS80031_CONTROLLER_STAT1_LINCH_GATED 6
340/* TPS80031_CONTROLLER_INT_MASK bit filed */
341#define TPS80031_CONTROLLER_INT_MASK_MVAC_DET 0
342#define TPS80031_CONTROLLER_INT_MASK_MVBUS_DET 1
343#define TPS80031_CONTROLLER_INT_MASK_MBAT_TEMP 2
344#define TPS80031_CONTROLLER_INT_MASK_MFAULT_WDG 3
345#define TPS80031_CONTROLLER_INT_MASK_MBAT_REMOVED 4
346#define TPS80031_CONTROLLER_INT_MASK_MLINCH_GATED 5
347
348#define TPS80031_CHARGE_CONTROL_SUB_INT_MASK 0x3F
349
350/* TPS80031_PHOENIX_DEV_ON bit field */
351#define TPS80031_DEVOFF 0x1
352
353#define TPS80031_EXT_CONTROL_CFG_TRANS 0
354#define TPS80031_EXT_CONTROL_CFG_STATE 1
355
356/* State register field */
357#define TPS80031_STATE_OFF 0x00
358#define TPS80031_STATE_ON 0x01
359#define TPS80031_STATE_MASK 0x03
360
361/* Trans register field */
362#define TPS80031_TRANS_ACTIVE_OFF 0x00
363#define TPS80031_TRANS_ACTIVE_ON 0x01
364#define TPS80031_TRANS_ACTIVE_MASK 0x03
365#define TPS80031_TRANS_SLEEP_OFF 0x00
366#define TPS80031_TRANS_SLEEP_ON 0x04
367#define TPS80031_TRANS_SLEEP_MASK 0x0C
368#define TPS80031_TRANS_OFF_OFF 0x00
369#define TPS80031_TRANS_OFF_ACTIVE 0x10
370#define TPS80031_TRANS_OFF_MASK 0x30
371
372#define TPS80031_EXT_PWR_REQ (TPS80031_PWR_REQ_INPUT_PREQ1 | \
373 TPS80031_PWR_REQ_INPUT_PREQ2 | \
374 TPS80031_PWR_REQ_INPUT_PREQ3)
375
376/* TPS80031_BBSPOR_CFG bit field */
377#define TPS80031_BBSPOR_CHG_EN 0x8
378#define TPS80031_MAX_REGISTER 0xFF
379
380struct i2c_client;
381
382/* Supported chips */
383enum chips {
384 TPS80031 = 0x00000001,
385 TPS80032 = 0x00000002,
386};
387
388enum {
389 TPS80031_INT_PWRON,
390 TPS80031_INT_RPWRON,
391 TPS80031_INT_SYS_VLOW,
392 TPS80031_INT_RTC_ALARM,
393 TPS80031_INT_RTC_PERIOD,
394 TPS80031_INT_HOT_DIE,
395 TPS80031_INT_VXX_SHORT,
396 TPS80031_INT_SPDURATION,
397 TPS80031_INT_WATCHDOG,
398 TPS80031_INT_BAT,
399 TPS80031_INT_SIM,
400 TPS80031_INT_MMC,
401 TPS80031_INT_RES,
402 TPS80031_INT_GPADC_RT,
403 TPS80031_INT_GPADC_SW2_EOC,
404 TPS80031_INT_CC_AUTOCAL,
405 TPS80031_INT_ID_WKUP,
406 TPS80031_INT_VBUSS_WKUP,
407 TPS80031_INT_ID,
408 TPS80031_INT_VBUS,
409 TPS80031_INT_CHRG_CTRL,
410 TPS80031_INT_EXT_CHRG,
411 TPS80031_INT_INT_CHRG,
412 TPS80031_INT_RES2,
413 TPS80031_INT_BAT_TEMP_OVRANGE,
414 TPS80031_INT_BAT_REMOVED,
415 TPS80031_INT_VBUS_DET,
416 TPS80031_INT_VAC_DET,
417 TPS80031_INT_FAULT_WDG,
418 TPS80031_INT_LINCH_GATED,
419
420 /* Last interrupt id to get the end number */
421 TPS80031_INT_NR,
422};
423
424/* TPS80031 Slave IDs */
425#define TPS80031_NUM_SLAVES 4
426#define TPS80031_SLAVE_ID0 0
427#define TPS80031_SLAVE_ID1 1
428#define TPS80031_SLAVE_ID2 2
429#define TPS80031_SLAVE_ID3 3
430
431/* TPS80031 I2C addresses */
432#define TPS80031_I2C_ID0_ADDR 0x12
433#define TPS80031_I2C_ID1_ADDR 0x48
434#define TPS80031_I2C_ID2_ADDR 0x49
435#define TPS80031_I2C_ID3_ADDR 0x4A
436
437enum {
438 TPS80031_REGULATOR_VIO,
439 TPS80031_REGULATOR_SMPS1,
440 TPS80031_REGULATOR_SMPS2,
441 TPS80031_REGULATOR_SMPS3,
442 TPS80031_REGULATOR_SMPS4,
443 TPS80031_REGULATOR_VANA,
444 TPS80031_REGULATOR_LDO1,
445 TPS80031_REGULATOR_LDO2,
446 TPS80031_REGULATOR_LDO3,
447 TPS80031_REGULATOR_LDO4,
448 TPS80031_REGULATOR_LDO5,
449 TPS80031_REGULATOR_LDO6,
450 TPS80031_REGULATOR_LDO7,
451 TPS80031_REGULATOR_LDOLN,
452 TPS80031_REGULATOR_LDOUSB,
453 TPS80031_REGULATOR_VBUS,
454 TPS80031_REGULATOR_REGEN1,
455 TPS80031_REGULATOR_REGEN2,
456 TPS80031_REGULATOR_SYSEN,
457 TPS80031_REGULATOR_MAX,
458};
459
460/* Different configurations for the rails */
461enum {
462 /* USBLDO input selection */
463 TPS80031_USBLDO_INPUT_VSYS = 0x00000001,
464 TPS80031_USBLDO_INPUT_PMID = 0x00000002,
465
466 /* LDO3 output mode */
467 TPS80031_LDO3_OUTPUT_VIB = 0x00000004,
468
469 /* VBUS configuration */
470 TPS80031_VBUS_DISCHRG_EN_PDN = 0x00000004,
471 TPS80031_VBUS_SW_ONLY = 0x00000008,
472 TPS80031_VBUS_SW_N_ID = 0x00000010,
473};
474
475/* External controls requests */
476enum tps80031_ext_control {
477 TPS80031_PWR_REQ_INPUT_NONE = 0x00000000,
478 TPS80031_PWR_REQ_INPUT_PREQ1 = 0x00000001,
479 TPS80031_PWR_REQ_INPUT_PREQ2 = 0x00000002,
480 TPS80031_PWR_REQ_INPUT_PREQ3 = 0x00000004,
481 TPS80031_PWR_OFF_ON_SLEEP = 0x00000008,
482 TPS80031_PWR_ON_ON_SLEEP = 0x00000010,
483};
484
485enum tps80031_pupd_pins {
486 TPS80031_PREQ1 = 0,
487 TPS80031_PREQ2A,
488 TPS80031_PREQ2B,
489 TPS80031_PREQ2C,
490 TPS80031_PREQ3,
491 TPS80031_NRES_WARM,
492 TPS80031_PWM_FORCE,
493 TPS80031_CHRG_EXT_CHRG_STATZ,
494 TPS80031_SIM,
495 TPS80031_MMC,
496 TPS80031_GPADC_START,
497 TPS80031_DVSI2C_SCL,
498 TPS80031_DVSI2C_SDA,
499 TPS80031_CTLI2C_SCL,
500 TPS80031_CTLI2C_SDA,
501};
502
503enum tps80031_pupd_settings {
504 TPS80031_PUPD_NORMAL,
505 TPS80031_PUPD_PULLDOWN,
506 TPS80031_PUPD_PULLUP,
507};
508
509struct tps80031 {
510 struct device *dev;
511 unsigned long chip_info;
512 int es_version;
513 struct i2c_client *clients[TPS80031_NUM_SLAVES];
514 struct regmap *regmap[TPS80031_NUM_SLAVES];
515 struct regmap_irq_chip_data *irq_data;
516};
517
518struct tps80031_pupd_init_data {
519 int input_pin;
520 int setting;
521};
522
523/*
524 * struct tps80031_regulator_platform_data - tps80031 regulator platform data.
525 *
526 * @reg_init_data: The regulator init data.
527 * @ext_ctrl_flag: External control flag for sleep/power request control.
528 * @config_flags: Configuration flag to configure the rails.
529 * It should be ORed of config enums.
530 */
531
532struct tps80031_regulator_platform_data {
533 struct regulator_init_data *reg_init_data;
534 unsigned int ext_ctrl_flag;
535 unsigned int config_flags;
536};
537
538struct tps80031_platform_data {
539 int irq_base;
540 bool use_power_off;
541 struct tps80031_pupd_init_data *pupd_init_data;
542 int pupd_init_data_size;
543 struct tps80031_regulator_platform_data
544 *regulator_pdata[TPS80031_REGULATOR_MAX];
545};
546
547static inline int tps80031_write(struct device *dev, int sid,
548 int reg, uint8_t val)
549{
550 struct tps80031 *tps80031 = dev_get_drvdata(dev);
551
552 return regmap_write(tps80031->regmap[sid], reg, val);
553}
554
555static inline int tps80031_writes(struct device *dev, int sid, int reg,
556 int len, uint8_t *val)
557{
558 struct tps80031 *tps80031 = dev_get_drvdata(dev);
559
560 return regmap_bulk_write(tps80031->regmap[sid], reg, val, len);
561}
562
563static inline int tps80031_read(struct device *dev, int sid,
564 int reg, uint8_t *val)
565{
566 struct tps80031 *tps80031 = dev_get_drvdata(dev);
567 unsigned int ival;
568 int ret;
569
570 ret = regmap_read(tps80031->regmap[sid], reg, &ival);
571 if (ret < 0) {
572 dev_err(dev, "failed reading from reg 0x%02x\n", reg);
573 return ret;
574 }
575
576 *val = ival;
577 return ret;
578}
579
580static inline int tps80031_reads(struct device *dev, int sid,
581 int reg, int len, uint8_t *val)
582{
583 struct tps80031 *tps80031 = dev_get_drvdata(dev);
584
585 return regmap_bulk_read(tps80031->regmap[sid], reg, val, len);
586}
587
588static inline int tps80031_set_bits(struct device *dev, int sid,
589 int reg, uint8_t bit_mask)
590{
591 struct tps80031 *tps80031 = dev_get_drvdata(dev);
592
593 return regmap_update_bits(tps80031->regmap[sid], reg,
594 bit_mask, bit_mask);
595}
596
597static inline int tps80031_clr_bits(struct device *dev, int sid,
598 int reg, uint8_t bit_mask)
599{
600 struct tps80031 *tps80031 = dev_get_drvdata(dev);
601
602 return regmap_update_bits(tps80031->regmap[sid], reg, bit_mask, 0);
603}
604
605static inline int tps80031_update(struct device *dev, int sid,
606 int reg, uint8_t val, uint8_t mask)
607{
608 struct tps80031 *tps80031 = dev_get_drvdata(dev);
609
610 return regmap_update_bits(tps80031->regmap[sid], reg, mask, val);
611}
612
613static inline unsigned long tps80031_get_chip_info(struct device *dev)
614{
615 struct tps80031 *tps80031 = dev_get_drvdata(dev);
616
617 return tps80031->chip_info;
618}
619
620static inline int tps80031_get_pmu_version(struct device *dev)
621{
622 struct tps80031 *tps80031 = dev_get_drvdata(dev);
623
624 return tps80031->es_version;
625}
626
627static inline int tps80031_irq_get_virq(struct device *dev, int irq)
628{
629 struct tps80031 *tps80031 = dev_get_drvdata(dev);
630
631 return regmap_irq_get_virq(tps80031->irq_data, irq);
632}
633
634extern int tps80031_ext_power_req_config(struct device *dev,
635 unsigned long ext_ctrl_flag, int preq_bit,
636 int state_reg_add, int trans_reg_add);
637#endif /*__LINUX_MFD_TPS80031_H */
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index a8eff4ad9be5..94ac944d12f0 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -207,10 +207,12 @@ struct twl6040_platform_data {
207}; 207};
208 208
209struct regmap; 209struct regmap;
210struct regmap_irq_chips_data;
210 211
211struct twl6040 { 212struct twl6040 {
212 struct device *dev; 213 struct device *dev;
213 struct regmap *regmap; 214 struct regmap *regmap;
215 struct regmap_irq_chip_data *irq_data;
214 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ 216 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
215 struct mutex mutex; 217 struct mutex mutex;
216 struct mutex irq_mutex; 218 struct mutex irq_mutex;
@@ -228,9 +230,8 @@ struct twl6040 {
228 unsigned int mclk; 230 unsigned int mclk;
229 231
230 unsigned int irq; 232 unsigned int irq;
231 unsigned int irq_base; 233 unsigned int irq_ready;
232 u8 irq_masks_cur; 234 unsigned int irq_th;
233 u8 irq_masks_cache;
234}; 235};
235 236
236int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg); 237int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg);
@@ -245,8 +246,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
245 unsigned int freq_in, unsigned int freq_out); 246 unsigned int freq_in, unsigned int freq_out);
246int twl6040_get_pll(struct twl6040 *twl6040); 247int twl6040_get_pll(struct twl6040 *twl6040);
247unsigned int twl6040_get_sysclk(struct twl6040 *twl6040); 248unsigned int twl6040_get_sysclk(struct twl6040 *twl6040);
248int twl6040_irq_init(struct twl6040 *twl6040); 249
249void twl6040_irq_exit(struct twl6040 *twl6040);
250/* Get the combined status of the vibra control register */ 250/* Get the combined status of the vibra control register */
251int twl6040_get_vibralr_status(struct twl6040 *twl6040); 251int twl6040_get_vibralr_status(struct twl6040 *twl6040);
252 252
diff --git a/include/linux/mfd/viperboard.h b/include/linux/mfd/viperboard.h
new file mode 100644
index 000000000000..193452848c04
--- /dev/null
+++ b/include/linux/mfd/viperboard.h
@@ -0,0 +1,110 @@
1/*
2 * include/linux/mfd/viperboard.h
3 *
4 * Nano River Technologies viperboard definitions
5 *
6 * (C) 2012 by Lemonage GmbH
7 * Author: Lars Poeschel <poeschel@lemonage.de>
8 * All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MFD_VIPERBOARD_H__
18#define __MFD_VIPERBOARD_H__
19
20#include <linux/types.h>
21#include <linux/usb.h>
22
23#define VPRBRD_EP_OUT 0x02
24#define VPRBRD_EP_IN 0x86
25
26#define VPRBRD_I2C_MSG_LEN 512 /* max length of a msg on USB level */
27
28#define VPRBRD_I2C_FREQ_6MHZ 1 /* 6 MBit/s */
29#define VPRBRD_I2C_FREQ_3MHZ 2 /* 3 MBit/s */
30#define VPRBRD_I2C_FREQ_1MHZ 3 /* 1 MBit/s */
31#define VPRBRD_I2C_FREQ_FAST 4 /* 400 kbit/s */
32#define VPRBRD_I2C_FREQ_400KHZ VPRBRD_I2C_FREQ_FAST
33#define VPRBRD_I2C_FREQ_200KHZ 5 /* 200 kbit/s */
34#define VPRBRD_I2C_FREQ_STD 6 /* 100 kbit/s */
35#define VPRBRD_I2C_FREQ_100KHZ VPRBRD_I2C_FREQ_STD
36#define VPRBRD_I2C_FREQ_10KHZ 7 /* 10 kbit/s */
37
38#define VPRBRD_I2C_CMD_WRITE 0x00
39#define VPRBRD_I2C_CMD_READ 0x01
40#define VPRBRD_I2C_CMD_ADDR 0x02
41
42#define VPRBRD_USB_TYPE_OUT 0x40
43#define VPRBRD_USB_TYPE_IN 0xc0
44#define VPRBRD_USB_TIMEOUT_MS 100
45#define VPRBRD_USB_REQUEST_I2C_FREQ 0xe6
46#define VPRBRD_USB_REQUEST_I2C 0xe9
47#define VPRBRD_USB_REQUEST_MAJOR 0xea
48#define VPRBRD_USB_REQUEST_MINOR 0xeb
49#define VPRBRD_USB_REQUEST_ADC 0xec
50#define VPRBRD_USB_REQUEST_GPIOA 0xed
51#define VPRBRD_USB_REQUEST_GPIOB 0xdd
52
53struct vprbrd_i2c_write_hdr {
54 u8 cmd;
55 u16 addr;
56 u8 len1;
57 u8 len2;
58 u8 last;
59 u8 chan;
60 u16 spi;
61} __packed;
62
63struct vprbrd_i2c_read_hdr {
64 u8 cmd;
65 u16 addr;
66 u8 len0;
67 u8 len1;
68 u8 len2;
69 u8 len3;
70 u8 len4;
71 u8 len5;
72 u16 tf1; /* transfer 1 length */
73 u16 tf2; /* transfer 2 length */
74} __packed;
75
76struct vprbrd_i2c_status {
77 u8 unknown[11];
78 u8 status;
79} __packed;
80
81struct vprbrd_i2c_write_msg {
82 struct vprbrd_i2c_write_hdr header;
83 u8 data[VPRBRD_I2C_MSG_LEN
84 - sizeof(struct vprbrd_i2c_write_hdr)];
85} __packed;
86
87struct vprbrd_i2c_read_msg {
88 struct vprbrd_i2c_read_hdr header;
89 u8 data[VPRBRD_I2C_MSG_LEN
90 - sizeof(struct vprbrd_i2c_read_hdr)];
91} __packed;
92
93struct vprbrd_i2c_addr_msg {
94 u8 cmd;
95 u8 addr;
96 u8 unknown1;
97 u16 len;
98 u8 unknown2;
99 u8 unknown3;
100} __packed;
101
102/* Structure to hold all device specific stuff */
103struct vprbrd {
104 struct usb_device *usb_dev; /* the usb device for this device */
105 struct mutex lock;
106 u8 buf[sizeof(struct vprbrd_i2c_write_msg)];
107 struct platform_device pdev;
108};
109
110#endif /* __MFD_VIPERBOARD_H__ */
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 1f173306bf05..ae5c249530b4 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -19,6 +19,8 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/regmap.h> 20#include <linux/regmap.h>
21 21
22#include <linux/mfd/wm8994/pdata.h>
23
22enum wm8994_type { 24enum wm8994_type {
23 WM8994 = 0, 25 WM8994 = 0,
24 WM8958 = 1, 26 WM8958 = 1,
@@ -55,6 +57,8 @@ struct regulator_bulk_data;
55struct wm8994 { 57struct wm8994 {
56 struct mutex irq_lock; 58 struct mutex irq_lock;
57 59
60 struct wm8994_pdata pdata;
61
58 enum wm8994_type type; 62 enum wm8994_type type;
59 int revision; 63 int revision;
60 int cust_id; 64 int cust_id;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index fc87be4fdc25..8e21a094836d 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -176,6 +176,11 @@ struct wm8994_pdata {
176 unsigned int lineout1fb:1; 176 unsigned int lineout1fb:1;
177 unsigned int lineout2fb:1; 177 unsigned int lineout2fb:1;
178 178
179 /* Delay between detecting a jack and starting microphone
180 * detect (specified in ms)
181 */
182 int micdet_delay;
183
179 /* IRQ for microphone detection if brought out directly as a 184 /* IRQ for microphone detection if brought out directly as a
180 * signal. 185 * signal.
181 */ 186 */
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index de201203bc7c..adfe8c058f29 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -15,6 +15,7 @@
15 15
16#define MICREL_PHY_ID_MASK 0x00fffff0 16#define MICREL_PHY_ID_MASK 0x00fffff0
17 17
18#define PHY_ID_KSZ8873MLL 0x000e7237
18#define PHY_ID_KSZ9021 0x00221610 19#define PHY_ID_KSZ9021 0x00221610
19#define PHY_ID_KS8737 0x00221720 20#define PHY_ID_KS8737 0x00221720
20#define PHY_ID_KSZ8021 0x00221555 21#define PHY_ID_KSZ8021 0x00221555
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index ce7e6671968b..1e9f627967a3 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -7,14 +7,41 @@
7 7
8typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9 9
10/*
11 * Return values from addresss_space_operations.migratepage():
12 * - negative errno on page migration failure;
13 * - zero on page migration success;
14 *
15 * The balloon page migration introduces this special case where a 'distinct'
16 * return code is used to flag a successful page migration to unmap_and_move().
17 * This approach is necessary because page migration can race against balloon
18 * deflation procedure, and for such case we could introduce a nasty page leak
19 * if a successfully migrated balloon page gets released concurrently with
20 * migration's unmap_and_move() wrap-up steps.
21 */
22#define MIGRATEPAGE_SUCCESS 0
23#define MIGRATEPAGE_BALLOON_SUCCESS 1 /* special ret code for balloon page
24 * sucessful migration case.
25 */
26enum migrate_reason {
27 MR_COMPACTION,
28 MR_MEMORY_FAILURE,
29 MR_MEMORY_HOTPLUG,
30 MR_SYSCALL, /* also applies to cpusets */
31 MR_MEMPOLICY_MBIND,
32 MR_NUMA_MISPLACED,
33 MR_CMA
34};
35
10#ifdef CONFIG_MIGRATION 36#ifdef CONFIG_MIGRATION
11 37
12extern void putback_lru_pages(struct list_head *l); 38extern void putback_lru_pages(struct list_head *l);
39extern void putback_movable_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 40extern int migrate_page(struct address_space *,
14 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
15extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, bool offlining, 43 unsigned long private, bool offlining,
17 enum migrate_mode mode); 44 enum migrate_mode mode, int reason);
18extern int migrate_huge_page(struct page *, new_page_t x, 45extern int migrate_huge_page(struct page *, new_page_t x,
19 unsigned long private, bool offlining, 46 unsigned long private, bool offlining,
20 enum migrate_mode mode); 47 enum migrate_mode mode);
@@ -33,9 +60,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
33#else 60#else
34 61
35static inline void putback_lru_pages(struct list_head *l) {} 62static inline void putback_lru_pages(struct list_head *l) {}
63static inline void putback_movable_pages(struct list_head *l) {}
36static inline int migrate_pages(struct list_head *l, new_page_t x, 64static inline int migrate_pages(struct list_head *l, new_page_t x,
37 unsigned long private, bool offlining, 65 unsigned long private, bool offlining,
38 enum migrate_mode mode) { return -ENOSYS; } 66 enum migrate_mode mode, int reason) { return -ENOSYS; }
39static inline int migrate_huge_page(struct page *page, new_page_t x, 67static inline int migrate_huge_page(struct page *page, new_page_t x,
40 unsigned long private, bool offlining, 68 unsigned long private, bool offlining,
41 enum migrate_mode mode) { return -ENOSYS; } 69 enum migrate_mode mode) { return -ENOSYS; }
@@ -64,4 +92,37 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
64#define fail_migrate_page NULL 92#define fail_migrate_page NULL
65 93
66#endif /* CONFIG_MIGRATION */ 94#endif /* CONFIG_MIGRATION */
95
96#ifdef CONFIG_NUMA_BALANCING
97extern int migrate_misplaced_page(struct page *page, int node);
98extern int migrate_misplaced_page(struct page *page, int node);
99extern bool migrate_ratelimited(int node);
100#else
101static inline int migrate_misplaced_page(struct page *page, int node)
102{
103 return -EAGAIN; /* can't migrate now */
104}
105static inline bool migrate_ratelimited(int node)
106{
107 return false;
108}
109#endif /* CONFIG_NUMA_BALANCING */
110
111#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
112extern int migrate_misplaced_transhuge_page(struct mm_struct *mm,
113 struct vm_area_struct *vma,
114 pmd_t *pmd, pmd_t entry,
115 unsigned long address,
116 struct page *page, int node);
117#else
118static inline int migrate_misplaced_transhuge_page(struct mm_struct *mm,
119 struct vm_area_struct *vma,
120 pmd_t *pmd, pmd_t entry,
121 unsigned long address,
122 struct page *page, int node)
123{
124 return -EAGAIN;
125}
126#endif /* CONFIG_NUMA_BALANCING && CONFIG_TRANSPARENT_HUGEPAGE*/
127
67#endif /* _LINUX_MIGRATE_H */ 128#endif /* _LINUX_MIGRATE_H */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index e0deeb2cc939..09c2300ddb37 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -34,6 +34,7 @@
34#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 34#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
35#define MPT_MINOR 220 35#define MPT_MINOR 220
36#define MPT2SAS_MINOR 221 36#define MPT2SAS_MINOR 221
37#define MPT3SAS_MINOR 222
37#define UINPUT_MINOR 223 38#define UINPUT_MINOR 223
38#define MISC_MCELOG_MINOR 227 39#define MISC_MCELOG_MINOR 227
39#define HPET_MINOR 228 40#define HPET_MINOR 228
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6d1acb04cd17..20ea939c22a6 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -142,6 +142,8 @@ enum {
142 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 142 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
143 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 143 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
144 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 144 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
145 MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61,
146 MLX4_DEV_CAP_FLAG_64B_CQE = 1LL << 62
145}; 147};
146 148
147enum { 149enum {
@@ -151,6 +153,20 @@ enum {
151 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3 153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3
152}; 154};
153 155
156enum {
157 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
158 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1
159};
160
161enum {
162 MLX4_USER_DEV_CAP_64B_CQE = 1L << 0
163};
164
165enum {
166 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0
167};
168
169
154#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 170#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
155 171
156enum { 172enum {
@@ -419,6 +435,11 @@ struct mlx4_caps {
419 u32 max_counters; 435 u32 max_counters;
420 u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; 436 u8 port_ib_mtu[MLX4_MAX_PORTS + 1];
421 u16 sqp_demux; 437 u16 sqp_demux;
438 u32 eqe_size;
439 u32 cqe_size;
440 u8 eqe_factor;
441 u32 userspace_caps; /* userspace must be aware of these */
442 u32 function_caps; /* VFs must be aware of these */
422}; 443};
423 444
424struct mlx4_buf_list { 445struct mlx4_buf_list {
@@ -604,6 +625,7 @@ struct mlx4_dev {
604 u8 rev_id; 625 u8 rev_id;
605 char board_id[MLX4_BOARD_ID_LEN]; 626 char board_id[MLX4_BOARD_ID_LEN];
606 int num_vfs; 627 int num_vfs;
628 int oper_log_mgm_entry_size;
607 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 629 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
608 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 630 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
609}; 631};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index fa0680402738..63204078f72b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -693,6 +693,36 @@ static inline int page_to_nid(const struct page *page)
693} 693}
694#endif 694#endif
695 695
696#ifdef CONFIG_NUMA_BALANCING
697static inline int page_xchg_last_nid(struct page *page, int nid)
698{
699 return xchg(&page->_last_nid, nid);
700}
701
702static inline int page_last_nid(struct page *page)
703{
704 return page->_last_nid;
705}
706static inline void reset_page_last_nid(struct page *page)
707{
708 page->_last_nid = -1;
709}
710#else
711static inline int page_xchg_last_nid(struct page *page, int nid)
712{
713 return page_to_nid(page);
714}
715
716static inline int page_last_nid(struct page *page)
717{
718 return page_to_nid(page);
719}
720
721static inline void reset_page_last_nid(struct page *page)
722{
723}
724#endif
725
696static inline struct zone *page_zone(const struct page *page) 726static inline struct zone *page_zone(const struct page *page)
697{ 727{
698 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 728 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
@@ -977,7 +1007,6 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
977 1007
978extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 1008extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
979extern void truncate_setsize(struct inode *inode, loff_t newsize); 1009extern void truncate_setsize(struct inode *inode, loff_t newsize);
980extern int vmtruncate(struct inode *inode, loff_t offset);
981void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 1010void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
982int truncate_inode_page(struct address_space *mapping, struct page *page); 1011int truncate_inode_page(struct address_space *mapping, struct page *page);
983int generic_error_remove_page(struct address_space *mapping, struct page *page); 1012int generic_error_remove_page(struct address_space *mapping, struct page *page);
@@ -1078,6 +1107,9 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma,
1078extern unsigned long do_mremap(unsigned long addr, 1107extern unsigned long do_mremap(unsigned long addr,
1079 unsigned long old_len, unsigned long new_len, 1108 unsigned long old_len, unsigned long new_len,
1080 unsigned long flags, unsigned long new_addr); 1109 unsigned long flags, unsigned long new_addr);
1110extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,
1111 unsigned long end, pgprot_t newprot,
1112 int dirty_accountable, int prot_numa);
1081extern int mprotect_fixup(struct vm_area_struct *vma, 1113extern int mprotect_fixup(struct vm_area_struct *vma,
1082 struct vm_area_struct **pprev, unsigned long start, 1114 struct vm_area_struct **pprev, unsigned long start,
1083 unsigned long end, unsigned long newflags); 1115 unsigned long end, unsigned long newflags);
@@ -1456,6 +1488,37 @@ extern unsigned long vm_mmap(struct file *, unsigned long,
1456 unsigned long, unsigned long, 1488 unsigned long, unsigned long,
1457 unsigned long, unsigned long); 1489 unsigned long, unsigned long);
1458 1490
1491struct vm_unmapped_area_info {
1492#define VM_UNMAPPED_AREA_TOPDOWN 1
1493 unsigned long flags;
1494 unsigned long length;
1495 unsigned long low_limit;
1496 unsigned long high_limit;
1497 unsigned long align_mask;
1498 unsigned long align_offset;
1499};
1500
1501extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
1502extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
1503
1504/*
1505 * Search for an unmapped address range.
1506 *
1507 * We are looking for a range that:
1508 * - does not intersect with any VMA;
1509 * - is contained within the [low_limit, high_limit) interval;
1510 * - is at least the desired size.
1511 * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
1512 */
1513static inline unsigned long
1514vm_unmapped_area(struct vm_unmapped_area_info *info)
1515{
1516 if (!(info->flags & VM_UNMAPPED_AREA_TOPDOWN))
1517 return unmapped_area(info);
1518 else
1519 return unmapped_area_topdown(info);
1520}
1521
1459/* truncate.c */ 1522/* truncate.c */
1460extern void truncate_inode_pages(struct address_space *, loff_t); 1523extern void truncate_inode_pages(struct address_space *, loff_t);
1461extern void truncate_inode_pages_range(struct address_space *, 1524extern void truncate_inode_pages_range(struct address_space *,
@@ -1548,6 +1611,11 @@ static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
1548} 1611}
1549#endif 1612#endif
1550 1613
1614#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
1615unsigned long change_prot_numa(struct vm_area_struct *vma,
1616 unsigned long start, unsigned long end);
1617#endif
1618
1551struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); 1619struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
1552int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 1620int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1553 unsigned long pfn, unsigned long size, pgprot_t); 1621 unsigned long pfn, unsigned long size, pgprot_t);
@@ -1569,6 +1637,7 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1569#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 1637#define FOLL_MLOCK 0x40 /* mark page as mlocked */
1570#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1638#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1571#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 1639#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1640#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1572 1641
1573typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1642typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1574 void *data); 1643 void *data);
@@ -1684,9 +1753,5 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1684static inline bool page_is_guard(struct page *page) { return false; } 1753static inline bool page_is_guard(struct page *page) { return false; }
1685#endif /* CONFIG_DEBUG_PAGEALLOC */ 1754#endif /* CONFIG_DEBUG_PAGEALLOC */
1686 1755
1687extern void reset_zone_present_pages(void);
1688extern void fixup_zone_present_pages(int nid, unsigned long start_pfn,
1689 unsigned long end_pfn);
1690
1691#endif /* __KERNEL__ */ 1756#endif /* __KERNEL__ */
1692#endif /* _LINUX_MM_H */ 1757#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 31f8a3af7d94..f8f5162a3571 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -128,10 +128,7 @@ struct page {
128 }; 128 };
129 129
130 struct list_head list; /* slobs list of pages */ 130 struct list_head list; /* slobs list of pages */
131 struct { /* slab fields */ 131 struct slab *slab_page; /* slab fields */
132 struct kmem_cache *slab_cache;
133 struct slab *slab_page;
134 };
135 }; 132 };
136 133
137 /* Remainder is not double word aligned */ 134 /* Remainder is not double word aligned */
@@ -146,7 +143,7 @@ struct page {
146#if USE_SPLIT_PTLOCKS 143#if USE_SPLIT_PTLOCKS
147 spinlock_t ptl; 144 spinlock_t ptl;
148#endif 145#endif
149 struct kmem_cache *slab; /* SLUB: Pointer to slab */ 146 struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
150 struct page *first_page; /* Compound tail pages */ 147 struct page *first_page; /* Compound tail pages */
151 }; 148 };
152 149
@@ -175,6 +172,10 @@ struct page {
175 */ 172 */
176 void *shadow; 173 void *shadow;
177#endif 174#endif
175
176#ifdef CONFIG_NUMA_BALANCING
177 int _last_nid;
178#endif
178} 179}
179/* 180/*
180 * The struct page can be forced to be double word aligned so that atomic ops 181 * The struct page can be forced to be double word aligned so that atomic ops
@@ -224,7 +225,8 @@ struct vm_region {
224 * library, the executable area etc). 225 * library, the executable area etc).
225 */ 226 */
226struct vm_area_struct { 227struct vm_area_struct {
227 struct mm_struct * vm_mm; /* The address space we belong to. */ 228 /* The first cache line has the info for VMA tree walking. */
229
228 unsigned long vm_start; /* Our start address within vm_mm. */ 230 unsigned long vm_start; /* Our start address within vm_mm. */
229 unsigned long vm_end; /* The first byte after our end address 231 unsigned long vm_end; /* The first byte after our end address
230 within vm_mm. */ 232 within vm_mm. */
@@ -232,11 +234,22 @@ struct vm_area_struct {
232 /* linked list of VM areas per task, sorted by address */ 234 /* linked list of VM areas per task, sorted by address */
233 struct vm_area_struct *vm_next, *vm_prev; 235 struct vm_area_struct *vm_next, *vm_prev;
234 236
237 struct rb_node vm_rb;
238
239 /*
240 * Largest free memory gap in bytes to the left of this VMA.
241 * Either between this VMA and vma->vm_prev, or between one of the
242 * VMAs below us in the VMA rbtree and its ->vm_prev. This helps
243 * get_unmapped_area find a free area of the right size.
244 */
245 unsigned long rb_subtree_gap;
246
247 /* Second cache line starts here. */
248
249 struct mm_struct *vm_mm; /* The address space we belong to. */
235 pgprot_t vm_page_prot; /* Access permissions of this VMA. */ 250 pgprot_t vm_page_prot; /* Access permissions of this VMA. */
236 unsigned long vm_flags; /* Flags, see mm.h. */ 251 unsigned long vm_flags; /* Flags, see mm.h. */
237 252
238 struct rb_node vm_rb;
239
240 /* 253 /*
241 * For areas with an address space and backing store, 254 * For areas with an address space and backing store,
242 * linkage into the address_space->i_mmap interval tree, or 255 * linkage into the address_space->i_mmap interval tree, or
@@ -322,6 +335,7 @@ struct mm_struct {
322 unsigned long task_size; /* size of task vm space */ 335 unsigned long task_size; /* size of task vm space */
323 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ 336 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
324 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */ 337 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
338 unsigned long highest_vm_end; /* highest vma end address */
325 pgd_t * pgd; 339 pgd_t * pgd;
326 atomic_t mm_users; /* How many users with user space? */ 340 atomic_t mm_users; /* How many users with user space? */
327 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 341 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
@@ -398,9 +412,36 @@ struct mm_struct {
398#ifdef CONFIG_CPUMASK_OFFSTACK 412#ifdef CONFIG_CPUMASK_OFFSTACK
399 struct cpumask cpumask_allocation; 413 struct cpumask cpumask_allocation;
400#endif 414#endif
415#ifdef CONFIG_NUMA_BALANCING
416 /*
417 * numa_next_scan is the next time when the PTEs will me marked
418 * pte_numa to gather statistics and migrate pages to new nodes
419 * if necessary
420 */
421 unsigned long numa_next_scan;
422
423 /* numa_next_reset is when the PTE scanner period will be reset */
424 unsigned long numa_next_reset;
425
426 /* Restart point for scanning and setting pte_numa */
427 unsigned long numa_scan_offset;
428
429 /* numa_scan_seq prevents two threads setting pte_numa */
430 int numa_scan_seq;
431
432 /*
433 * The first node a task was scheduled on. If a task runs on
434 * a different node than Make PTE Scan Go Now.
435 */
436 int first_nid;
437#endif
401 struct uprobes_state uprobes_state; 438 struct uprobes_state uprobes_state;
402}; 439};
403 440
441/* first nid will either be a valid NID or one of these values */
442#define NUMA_PTE_SCAN_INIT -1
443#define NUMA_PTE_SCAN_ACTIVE -2
444
404static inline void mm_init_cpumask(struct mm_struct *mm) 445static inline void mm_init_cpumask(struct mm_struct *mm)
405{ 446{
406#ifdef CONFIG_CPUMASK_OFFSTACK 447#ifdef CONFIG_CPUMASK_OFFSTACK
diff --git a/include/linux/mman.h b/include/linux/mman.h
index d09dde1e57fb..9aa863da287f 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -11,6 +11,8 @@ extern int sysctl_overcommit_memory;
11extern int sysctl_overcommit_ratio; 11extern int sysctl_overcommit_ratio;
12extern struct percpu_counter vm_committed_as; 12extern struct percpu_counter vm_committed_as;
13 13
14unsigned long vm_memory_committed(void);
15
14static inline void vm_acct_memory(long pages) 16static inline void vm_acct_memory(long pages)
15{ 17{
16 percpu_counter_add(&vm_committed_as, pages); 18 percpu_counter_add(&vm_committed_as, pages);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 943550dfe9ea..5c69315d60cc 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -85,6 +85,7 @@ struct mmc_ext_csd {
85 bool boot_ro_lockable; 85 bool boot_ro_lockable;
86 u8 raw_exception_status; /* 53 */ 86 u8 raw_exception_status; /* 53 */
87 u8 raw_partition_support; /* 160 */ 87 u8 raw_partition_support; /* 160 */
88 u8 raw_rpmb_size_mult; /* 168 */
88 u8 raw_erased_mem_count; /* 181 */ 89 u8 raw_erased_mem_count; /* 181 */
89 u8 raw_ext_csd_structure; /* 194 */ 90 u8 raw_ext_csd_structure; /* 194 */
90 u8 raw_card_type; /* 196 */ 91 u8 raw_card_type; /* 196 */
@@ -206,6 +207,7 @@ struct mmc_part {
206#define MMC_BLK_DATA_AREA_MAIN (1<<0) 207#define MMC_BLK_DATA_AREA_MAIN (1<<0)
207#define MMC_BLK_DATA_AREA_BOOT (1<<1) 208#define MMC_BLK_DATA_AREA_BOOT (1<<1)
208#define MMC_BLK_DATA_AREA_GP (1<<2) 209#define MMC_BLK_DATA_AREA_GP (1<<2)
210#define MMC_BLK_DATA_AREA_RPMB (1<<3)
209}; 211};
210 212
211/* 213/*
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 9b9cdafc7737..5bf7c2274fcb 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -170,6 +170,8 @@ extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
170extern unsigned int mmc_calc_max_discard(struct mmc_card *card); 170extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
171 171
172extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); 172extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
173extern int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
174 bool is_rel_write);
173extern int mmc_hw_reset(struct mmc_host *host); 175extern int mmc_hw_reset(struct mmc_host *host);
174extern int mmc_hw_reset_check(struct mmc_host *host); 176extern int mmc_hw_reset_check(struct mmc_host *host);
175extern int mmc_can_reset(struct mmc_card *card); 177extern int mmc_can_reset(struct mmc_card *card);
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 7c6a1139d8fa..34be4f47293c 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -137,7 +137,7 @@ struct dw_mci {
137 137
138 dma_addr_t sg_dma; 138 dma_addr_t sg_dma;
139 void *sg_cpu; 139 void *sg_cpu;
140 struct dw_mci_dma_ops *dma_ops; 140 const struct dw_mci_dma_ops *dma_ops;
141#ifdef CONFIG_MMC_DW_IDMAC 141#ifdef CONFIG_MMC_DW_IDMAC
142 unsigned int ring_size; 142 unsigned int ring_size;
143#else 143#else
@@ -162,7 +162,7 @@ struct dw_mci {
162 u16 data_offset; 162 u16 data_offset;
163 struct device *dev; 163 struct device *dev;
164 struct dw_mci_board *pdata; 164 struct dw_mci_board *pdata;
165 struct dw_mci_drv_data *drv_data; 165 const struct dw_mci_drv_data *drv_data;
166 void *priv; 166 void *priv;
167 struct clk *biu_clk; 167 struct clk *biu_clk;
168 struct clk *ciu_clk; 168 struct clk *ciu_clk;
@@ -186,7 +186,7 @@ struct dw_mci {
186 186
187 struct regulator *vmmc; /* Power regulator */ 187 struct regulator *vmmc; /* Power regulator */
188 unsigned long irq_flags; /* IRQ flags */ 188 unsigned long irq_flags; /* IRQ flags */
189 unsigned int irq; 189 int irq;
190}; 190};
191 191
192/* DMA ops for Internal/External DMAC interface */ 192/* DMA ops for Internal/External DMAC interface */
@@ -229,8 +229,9 @@ struct dw_mci_board {
229 u32 quirks; /* Workaround / Quirk flags */ 229 u32 quirks; /* Workaround / Quirk flags */
230 unsigned int bus_hz; /* Clock speed at the cclk_in pad */ 230 unsigned int bus_hz; /* Clock speed at the cclk_in pad */
231 231
232 unsigned int caps; /* Capabilities */ 232 u32 caps; /* Capabilities */
233 unsigned int caps2; /* More capabilities */ 233 u32 caps2; /* More capabilities */
234 u32 pm_caps; /* PM capabilities */
234 /* 235 /*
235 * Override fifo depth. If 0, autodetect it from the FIFOTH register, 236 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
236 * but note that this may not be reliable after a bootloader has used 237 * but note that this may not be reliable after a bootloader has used
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7abb0e1f7bda..61a10c17aabd 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -53,12 +53,12 @@ struct mmc_ios {
53#define MMC_TIMING_LEGACY 0 53#define MMC_TIMING_LEGACY 0
54#define MMC_TIMING_MMC_HS 1 54#define MMC_TIMING_MMC_HS 1
55#define MMC_TIMING_SD_HS 2 55#define MMC_TIMING_SD_HS 2
56#define MMC_TIMING_UHS_SDR12 MMC_TIMING_LEGACY 56#define MMC_TIMING_UHS_SDR12 3
57#define MMC_TIMING_UHS_SDR25 MMC_TIMING_SD_HS 57#define MMC_TIMING_UHS_SDR25 4
58#define MMC_TIMING_UHS_SDR50 3 58#define MMC_TIMING_UHS_SDR50 5
59#define MMC_TIMING_UHS_SDR104 4 59#define MMC_TIMING_UHS_SDR104 6
60#define MMC_TIMING_UHS_DDR50 5 60#define MMC_TIMING_UHS_DDR50 7
61#define MMC_TIMING_MMC_HS200 6 61#define MMC_TIMING_MMC_HS200 8
62 62
63#define MMC_SDR_MODE 0 63#define MMC_SDR_MODE 0
64#define MMC_1_2V_DDR_MODE 1 64#define MMC_1_2V_DDR_MODE 1
@@ -136,6 +136,7 @@ struct mmc_host_ops {
136 void (*enable_preset_value)(struct mmc_host *host, bool enable); 136 void (*enable_preset_value)(struct mmc_host *host, bool enable);
137 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 137 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
138 void (*hw_reset)(struct mmc_host *host); 138 void (*hw_reset)(struct mmc_host *host);
139 void (*card_event)(struct mmc_host *host);
139}; 140};
140 141
141struct mmc_card; 142struct mmc_card;
@@ -211,7 +212,7 @@ struct mmc_host {
211#define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */ 212#define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */
212#define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */ 213#define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */
213 214
214 unsigned long caps; /* Host capabilities */ 215 u32 caps; /* Host capabilities */
215 216
216#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 217#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
217#define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */ 218#define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
@@ -241,7 +242,7 @@ struct mmc_host {
241#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ 242#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
242#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */ 243#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */
243 244
244 unsigned int caps2; /* More host capabilities */ 245 u32 caps2; /* More host capabilities */
245 246
246#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 247#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
247#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 248#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 01e4b394029b..94d532e41c61 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -286,6 +286,7 @@ struct _mmc_csd {
286#define EXT_CSD_BKOPS_START 164 /* W */ 286#define EXT_CSD_BKOPS_START 164 /* W */
287#define EXT_CSD_SANITIZE_START 165 /* W */ 287#define EXT_CSD_SANITIZE_START 165 /* W */
288#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 288#define EXT_CSD_WR_REL_PARAM 166 /* RO */
289#define EXT_CSD_RPMB_MULT 168 /* RO */
289#define EXT_CSD_BOOT_WP 173 /* R/W */ 290#define EXT_CSD_BOOT_WP 173 /* R/W */
290#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 291#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
291#define EXT_CSD_PART_CONFIG 179 /* R/W */ 292#define EXT_CSD_PART_CONFIG 179 /* R/W */
@@ -339,6 +340,7 @@ struct _mmc_csd {
339 340
340#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) 341#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7)
341#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) 342#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
343#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3)
342#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 344#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
343 345
344#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) 346#define EXT_CSD_PART_SUPPORT_PART_EN (0x1)
diff --git a/include/linux/mmc/mxs-mmc.h b/include/linux/mmc/mxs-mmc.h
deleted file mode 100644
index 7c2ad3a7f2f3..000000000000
--- a/include/linux/mmc/mxs-mmc.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_MMC_MXS_MMC_H__
10#define __LINUX_MMC_MXS_MMC_H__
11
12struct mxs_mmc_platform_data {
13 int wp_gpio; /* write protect pin */
14 unsigned int flags;
15#define SLOTF_4_BIT_CAPABLE (1 << 0)
16#define SLOTF_8_BIT_CAPABLE (1 << 1)
17};
18
19#endif /* __LINUX_MMC_MXS_MMC_H__ */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index fa8529a859b8..4bbc3301fbbf 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -91,6 +91,9 @@ struct sdhci_host {
91 unsigned int quirks2; /* More deviations from spec. */ 91 unsigned int quirks2; /* More deviations from spec. */
92 92
93#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0) 93#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
94 97
95 int irq; /* Device IRQ */ 98 int irq; /* Device IRQ */
96 void __iomem *ioaddr; /* Mapped address */ 99 void __iomem *ioaddr; /* Mapped address */
@@ -157,8 +160,8 @@ struct sdhci_host {
157 160
158 struct timer_list timer; /* Timer for timeouts */ 161 struct timer_list timer; /* Timer for timeouts */
159 162
160 unsigned int caps; /* Alternative CAPABILITY_0 */ 163 u32 caps; /* Alternative CAPABILITY_0 */
161 unsigned int caps1; /* Alternative CAPABILITY_1 */ 164 u32 caps1; /* Alternative CAPABILITY_1 */
162 165
163 unsigned int ocr_avail_sdio; /* OCR bit masks */ 166 unsigned int ocr_avail_sdio; /* OCR bit masks */
164 unsigned int ocr_avail_sd; 167 unsigned int ocr_avail_sd;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 50aaca81f63d..73b64a38b984 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -63,10 +63,8 @@ enum {
63 63
64#ifdef CONFIG_CMA 64#ifdef CONFIG_CMA
65# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA) 65# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
66# define cma_wmark_pages(zone) zone->min_cma_pages
67#else 66#else
68# define is_migrate_cma(migratetype) false 67# define is_migrate_cma(migratetype) false
69# define cma_wmark_pages(zone) 0
70#endif 68#endif
71 69
72#define for_each_migratetype_order(order, type) \ 70#define for_each_migratetype_order(order, type) \
@@ -383,13 +381,6 @@ struct zone {
383 /* see spanned/present_pages for more description */ 381 /* see spanned/present_pages for more description */
384 seqlock_t span_seqlock; 382 seqlock_t span_seqlock;
385#endif 383#endif
386#ifdef CONFIG_CMA
387 /*
388 * CMA needs to increase watermark levels during the allocation
389 * process to make sure that the system is not starved.
390 */
391 unsigned long min_cma_pages;
392#endif
393 struct free_area free_area[MAX_ORDER]; 384 struct free_area free_area[MAX_ORDER];
394 385
395#ifndef CONFIG_SPARSEMEM 386#ifndef CONFIG_SPARSEMEM
@@ -469,30 +460,49 @@ struct zone {
469 unsigned long zone_start_pfn; 460 unsigned long zone_start_pfn;
470 461
471 /* 462 /*
472 * zone_start_pfn, spanned_pages and present_pages are all 463 * spanned_pages is the total pages spanned by the zone, including
473 * protected by span_seqlock. It is a seqlock because it has 464 * holes, which is calculated as:
474 * to be read outside of zone->lock, and it is done in the main 465 * spanned_pages = zone_end_pfn - zone_start_pfn;
475 * allocator path. But, it is written quite infrequently. 466 *
467 * present_pages is physical pages existing within the zone, which
468 * is calculated as:
469 * present_pages = spanned_pages - absent_pages(pags in holes);
470 *
471 * managed_pages is present pages managed by the buddy system, which
472 * is calculated as (reserved_pages includes pages allocated by the
473 * bootmem allocator):
474 * managed_pages = present_pages - reserved_pages;
475 *
476 * So present_pages may be used by memory hotplug or memory power
477 * management logic to figure out unmanaged pages by checking
478 * (present_pages - managed_pages). And managed_pages should be used
479 * by page allocator and vm scanner to calculate all kinds of watermarks
480 * and thresholds.
481 *
482 * Locking rules:
483 *
484 * zone_start_pfn and spanned_pages are protected by span_seqlock.
485 * It is a seqlock because it has to be read outside of zone->lock,
486 * and it is done in the main allocator path. But, it is written
487 * quite infrequently.
476 * 488 *
477 * The lock is declared along with zone->lock because it is 489 * The span_seq lock is declared along with zone->lock because it is
478 * frequently read in proximity to zone->lock. It's good to 490 * frequently read in proximity to zone->lock. It's good to
479 * give them a chance of being in the same cacheline. 491 * give them a chance of being in the same cacheline.
492 *
493 * Write access to present_pages and managed_pages at runtime should
494 * be protected by lock_memory_hotplug()/unlock_memory_hotplug().
495 * Any reader who can't tolerant drift of present_pages and
496 * managed_pages should hold memory hotplug lock to get a stable value.
480 */ 497 */
481 unsigned long spanned_pages; /* total size, including holes */ 498 unsigned long spanned_pages;
482 unsigned long present_pages; /* amount of memory (excluding holes) */ 499 unsigned long present_pages;
500 unsigned long managed_pages;
483 501
484 /* 502 /*
485 * rarely used fields: 503 * rarely used fields:
486 */ 504 */
487 const char *name; 505 const char *name;
488#ifdef CONFIG_MEMORY_ISOLATION
489 /*
490 * the number of MIGRATE_ISOLATE *pageblock*.
491 * We need this for free page counting. Look at zone_watermark_ok_safe.
492 * It's protected by zone->lock
493 */
494 int nr_pageblock_isolate;
495#endif
496} ____cacheline_internodealigned_in_smp; 506} ____cacheline_internodealigned_in_smp;
497 507
498typedef enum { 508typedef enum {
@@ -717,6 +727,19 @@ typedef struct pglist_data {
717 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ 727 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */
718 int kswapd_max_order; 728 int kswapd_max_order;
719 enum zone_type classzone_idx; 729 enum zone_type classzone_idx;
730#ifdef CONFIG_NUMA_BALANCING
731 /*
732 * Lock serializing the per destination node AutoNUMA memory
733 * migration rate limiting data.
734 */
735 spinlock_t numabalancing_migrate_lock;
736
737 /* Rate limiting time interval */
738 unsigned long numabalancing_migrate_next_window;
739
740 /* Number of pages migrated during the rate limiting time interval */
741 unsigned long numabalancing_migrate_nr_pages;
742#endif
720} pg_data_t; 743} pg_data_t;
721 744
722#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) 745#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
@@ -752,7 +775,7 @@ extern int init_currently_empty_zone(struct zone *zone, unsigned long start_pfn,
752 unsigned long size, 775 unsigned long size,
753 enum memmap_context context); 776 enum memmap_context context);
754 777
755extern void lruvec_init(struct lruvec *lruvec, struct zone *zone); 778extern void lruvec_init(struct lruvec *lruvec);
756 779
757static inline struct zone *lruvec_zone(struct lruvec *lruvec) 780static inline struct zone *lruvec_zone(struct lruvec *lruvec)
758{ 781{
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 5a8e3903d770..12b2ab510323 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -4,9 +4,10 @@
4 4
5struct mnt_namespace; 5struct mnt_namespace;
6struct fs_struct; 6struct fs_struct;
7struct user_namespace;
7 8
8extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 9extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
9 struct fs_struct *); 10 struct user_namespace *, struct fs_struct *);
10extern void put_mnt_ns(struct mnt_namespace *ns); 11extern void put_mnt_ns(struct mnt_namespace *ns);
11 12
12extern const struct file_operations proc_mounts_operations; 13extern const struct file_operations proc_mounts_operations;
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index d6a58065c09c..137b4198fc03 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -16,17 +16,15 @@
16/* Chosen so that structs with an unsigned long line up. */ 16/* Chosen so that structs with an unsigned long line up. */
17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) 17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
18 18
19#define ___module_cat(a,b) __mod_ ## a ## b
20#define __module_cat(a,b) ___module_cat(a,b)
21#ifdef MODULE 19#ifdef MODULE
22#define __MODULE_INFO(tag, name, info) \ 20#define __MODULE_INFO(tag, name, info) \
23static const char __module_cat(name,__LINE__)[] \ 21static const char __UNIQUE_ID(name)[] \
24 __used __attribute__((section(".modinfo"), unused, aligned(1))) \ 22 __used __attribute__((section(".modinfo"), unused, aligned(1))) \
25 = __stringify(tag) "=" info 23 = __stringify(tag) "=" info
26#else /* !MODULE */ 24#else /* !MODULE */
27/* This struct is here for syntactic coherency, it is not used */ 25/* This struct is here for syntactic coherency, it is not used */
28#define __MODULE_INFO(tag, name, info) \ 26#define __MODULE_INFO(tag, name, info) \
29 struct __module_cat(name,__LINE__) {} 27 struct __UNIQUE_ID(name) {}
30#endif 28#endif
31#define __MODULE_PARM_TYPE(name, _type) \ 29#define __MODULE_PARM_TYPE(name, _type) \
32 __MODULE_INFO(parmtype, name##type, #name ":" _type) 30 __MODULE_INFO(parmtype, name##type, #name ":" _type)
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 7a4b9e97d29a..391af8d11cce 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -34,7 +34,9 @@ struct msg_queue {
34/* Helper routines for sys_msgsnd and sys_msgrcv */ 34/* Helper routines for sys_msgsnd and sys_msgrcv */
35extern long do_msgsnd(int msqid, long mtype, void __user *mtext, 35extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
36 size_t msgsz, int msgflg); 36 size_t msgsz, int msgflg);
37extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext, 37extern long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
38 size_t msgsz, long msgtyp, int msgflg); 38 int msgflg,
39 long (*msg_fill)(void __user *, struct msg_msg *,
40 size_t));
39 41
40#endif /* _LINUX_MSG_H */ 42#endif /* _LINUX_MSG_H */
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index ed270bd2e4df..4eb0a50d0c55 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -23,6 +23,7 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/kref.h> 24#include <linux/kref.h>
25#include <linux/sysfs.h> 25#include <linux/sysfs.h>
26#include <linux/workqueue.h>
26 27
27struct hd_geometry; 28struct hd_geometry;
28struct mtd_info; 29struct mtd_info;
@@ -43,7 +44,8 @@ struct mtd_blktrans_dev {
43 struct kref ref; 44 struct kref ref;
44 struct gendisk *disk; 45 struct gendisk *disk;
45 struct attribute_group *disk_attributes; 46 struct attribute_group *disk_attributes;
46 struct task_struct *thread; 47 struct workqueue_struct *wq;
48 struct work_struct work;
47 struct request_queue *rq; 49 struct request_queue *rq;
48 spinlock_t queue_lock; 50 spinlock_t queue_lock;
49 void *priv; 51 void *priv;
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0f6fea73a1f6..407d1e556c39 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -92,12 +92,26 @@
92 * Others use readb/writeb 92 * Others use readb/writeb
93 */ 93 */
94#if defined(__arm__) 94#if defined(__arm__)
95#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) 95static inline u8 ReadDOC_(u32 __iomem *addr, unsigned long reg)
96#define WriteDOC_(d, adr, reg) do{ *(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)) = (__u32)d; wmb();} while(0) 96{
97 return __raw_readl(addr + reg);
98}
99static inline void WriteDOC_(u8 data, u32 __iomem *addr, unsigned long reg)
100{
101 __raw_writel(data, addr + reg);
102 wmb();
103}
97#define DOC_IOREMAP_LEN 0x8000 104#define DOC_IOREMAP_LEN 0x8000
98#elif defined(__ppc__) 105#elif defined(__ppc__)
99#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)))) 106static inline u8 ReadDOC_(u16 __iomem *addr, unsigned long reg)
100#define WriteDOC_(d, adr, reg) do{ *(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)) = (__u16)d; wmb();} while(0) 107{
108 return __raw_readw(addr + reg);
109}
110static inline void WriteDOC_(u8 data, u16 __iomem *addr, unsigned long reg)
111{
112 __raw_writew(data, addr + reg);
113 wmb();
114}
101#define DOC_IOREMAP_LEN 0x4000 115#define DOC_IOREMAP_LEN 0x4000
102#else 116#else
103#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg)) 117#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg))
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index b20029221fb1..d6ed61ef451d 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -155,9 +155,6 @@ struct fsmc_nand_platform_data {
155 unsigned int width; 155 unsigned int width;
156 unsigned int bank; 156 unsigned int bank;
157 157
158 /* CLE, ALE offsets */
159 unsigned int cle_off;
160 unsigned int ale_off;
161 enum access_mode mode; 158 enum access_mode mode;
162 159
163 void (*select_bank)(uint32_t bank, uint32_t busw); 160 void (*select_bank)(uint32_t bank, uint32_t busw);
diff --git a/include/linux/mtd/gpmi-nand.h b/include/linux/mtd/gpmi-nand.h
deleted file mode 100644
index ed3c4e09f3d1..000000000000
--- a/include/linux/mtd/gpmi-nand.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef __MACH_MXS_GPMI_NAND_H__
20#define __MACH_MXS_GPMI_NAND_H__
21
22/* The size of the resources is fixed. */
23#define GPMI_NAND_RES_SIZE 6
24
25/* Resource names for the GPMI NAND driver. */
26#define GPMI_NAND_GPMI_REGS_ADDR_RES_NAME "gpmi-nand"
27#define GPMI_NAND_GPMI_INTERRUPT_RES_NAME "GPMI NAND GPMI Interrupt"
28#define GPMI_NAND_BCH_REGS_ADDR_RES_NAME "bch"
29#define GPMI_NAND_BCH_INTERRUPT_RES_NAME "bch"
30#define GPMI_NAND_DMA_CHANNELS_RES_NAME "GPMI NAND DMA Channels"
31#define GPMI_NAND_DMA_INTERRUPT_RES_NAME "gpmi-dma"
32
33/**
34 * struct gpmi_nand_platform_data - GPMI NAND driver platform data.
35 *
36 * This structure communicates platform-specific information to the GPMI NAND
37 * driver that can't be expressed as resources.
38 *
39 * @platform_init: A pointer to a function the driver will call to
40 * initialize the platform (e.g., set up the pin mux).
41 * @min_prop_delay_in_ns: Minimum propagation delay of GPMI signals to and
42 * from the NAND Flash device, in nanoseconds.
43 * @max_prop_delay_in_ns: Maximum propagation delay of GPMI signals to and
44 * from the NAND Flash device, in nanoseconds.
45 * @max_chip_count: The maximum number of chips for which the driver
46 * should configure the hardware. This value most
47 * likely reflects the number of pins that are
48 * connected to a NAND Flash device. If this is
49 * greater than the SoC hardware can support, the
50 * driver will print a message and fail to initialize.
51 * @partitions: An optional pointer to an array of partition
52 * descriptions.
53 * @partition_count: The number of elements in the partitions array.
54 */
55struct gpmi_nand_platform_data {
56 /* SoC hardware information. */
57 int (*platform_init)(void);
58
59 /* NAND Flash information. */
60 unsigned int min_prop_delay_in_ns;
61 unsigned int max_prop_delay_in_ns;
62 unsigned int max_chip_count;
63
64 /* Medium information. */
65 struct mtd_partition *partitions;
66 unsigned partition_count;
67};
68#endif
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 3595a0236b0f..f6eb4332ac92 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -328,7 +328,7 @@ static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word
328 328
329static inline map_word map_word_load(struct map_info *map, const void *ptr) 329static inline map_word map_word_load(struct map_info *map, const void *ptr)
330{ 330{
331 map_word r; 331 map_word r = {{0} };
332 332
333 if (map_bankwidth_is_1(map)) 333 if (map_bankwidth_is_1(map))
334 r.x[0] = *(unsigned char *)ptr; 334 r.x[0] = *(unsigned char *)ptr;
@@ -391,7 +391,7 @@ static inline map_word map_word_ff(struct map_info *map)
391 391
392static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) 392static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
393{ 393{
394 map_word r; 394 map_word uninitialized_var(r);
395 395
396 if (map_bankwidth_is_1(map)) 396 if (map_bankwidth_is_1(map))
397 r.x[0] = __raw_readb(map->virt + ofs); 397 r.x[0] = __raw_readb(map->virt + ofs);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 81d61e704599..f9ac2897b86b 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -98,7 +98,7 @@ struct mtd_oob_ops {
98}; 98};
99 99
100#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32 100#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32
101#define MTD_MAX_ECCPOS_ENTRIES_LARGE 448 101#define MTD_MAX_ECCPOS_ENTRIES_LARGE 640
102/* 102/*
103 * Internal ECC layout control structure. For historical reasons, there is a 103 * Internal ECC layout control structure. For historical reasons, there is a
104 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained 104 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 24e915957e4f..7ccb3c59ed60 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -219,6 +219,13 @@ typedef enum {
219#define NAND_OWN_BUFFERS 0x00020000 219#define NAND_OWN_BUFFERS 0x00020000
220/* Chip may not exist, so silence any errors in scan */ 220/* Chip may not exist, so silence any errors in scan */
221#define NAND_SCAN_SILENT_NODEV 0x00040000 221#define NAND_SCAN_SILENT_NODEV 0x00040000
222/*
223 * Autodetect nand buswidth with readid/onfi.
224 * This suppose the driver will configure the hardware in 8 bits mode
225 * when calling nand_scan_ident, and update its configuration
226 * before calling nand_scan_tail.
227 */
228#define NAND_BUSWIDTH_AUTO 0x00080000
222 229
223/* Options set by nand scan */ 230/* Options set by nand scan */
224/* Nand scan has allocated controller struct */ 231/* Nand scan has allocated controller struct */
@@ -471,8 +478,8 @@ struct nand_buffers {
471 * non 0 if ONFI supported. 478 * non 0 if ONFI supported.
472 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is 479 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is
473 * supported, 0 otherwise. 480 * supported, 0 otherwise.
474 * @onfi_set_features [REPLACEABLE] set the features for ONFI nand 481 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
475 * @onfi_get_features [REPLACEABLE] get the features for ONFI nand 482 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
476 * @ecclayout: [REPLACEABLE] the default ECC placement scheme 483 * @ecclayout: [REPLACEABLE] the default ECC placement scheme
477 * @bbt: [INTERN] bad block table pointer 484 * @bbt: [INTERN] bad block table pointer
478 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash 485 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index 01e4b15b280e..1c28f8879b1c 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -20,6 +20,7 @@
20#ifndef __SH_FLCTL_H__ 20#ifndef __SH_FLCTL_H__
21#define __SH_FLCTL_H__ 21#define __SH_FLCTL_H__
22 22
23#include <linux/completion.h>
23#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
24#include <linux/mtd/nand.h> 25#include <linux/mtd/nand.h>
25#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
@@ -107,6 +108,7 @@
107#define ESTERINTE (0x1 << 24) /* ECC error interrupt enable */ 108#define ESTERINTE (0x1 << 24) /* ECC error interrupt enable */
108#define AC1CLR (0x1 << 19) /* ECC FIFO clear */ 109#define AC1CLR (0x1 << 19) /* ECC FIFO clear */
109#define AC0CLR (0x1 << 18) /* Data FIFO clear */ 110#define AC0CLR (0x1 << 18) /* Data FIFO clear */
111#define DREQ0EN (0x1 << 16) /* FLDTFIFODMA Request Enable */
110#define ECERB (0x1 << 9) /* ECC error */ 112#define ECERB (0x1 << 9) /* ECC error */
111#define STERB (0x1 << 8) /* Status error */ 113#define STERB (0x1 << 8) /* Status error */
112#define STERINTE (0x1 << 4) /* Status error enable */ 114#define STERINTE (0x1 << 4) /* Status error enable */
@@ -138,6 +140,8 @@ enum flctl_ecc_res_t {
138 FL_TIMEOUT 140 FL_TIMEOUT
139}; 141};
140 142
143struct dma_chan;
144
141struct sh_flctl { 145struct sh_flctl {
142 struct mtd_info mtd; 146 struct mtd_info mtd;
143 struct nand_chip chip; 147 struct nand_chip chip;
@@ -147,7 +151,7 @@ struct sh_flctl {
147 151
148 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ 152 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
149 int read_bytes; 153 int read_bytes;
150 int index; 154 unsigned int index;
151 int seqin_column; /* column in SEQIN cmd */ 155 int seqin_column; /* column in SEQIN cmd */
152 int seqin_page_addr; /* page_addr in SEQIN cmd */ 156 int seqin_page_addr; /* page_addr in SEQIN cmd */
153 uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */ 157 uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */
@@ -161,6 +165,11 @@ struct sh_flctl {
161 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ 165 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */
162 unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */ 166 unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */
163 unsigned qos_request:1; /* QoS request to prevent deep power shutdown */ 167 unsigned qos_request:1; /* QoS request to prevent deep power shutdown */
168
169 /* DMA related objects */
170 struct dma_chan *chan_fifo0_rx;
171 struct dma_chan *chan_fifo0_tx;
172 struct completion dma_complete;
164}; 173};
165 174
166struct sh_flctl_platform_data { 175struct sh_flctl_platform_data {
@@ -170,6 +179,9 @@ struct sh_flctl_platform_data {
170 179
171 unsigned has_hwecc:1; 180 unsigned has_hwecc:1;
172 unsigned use_holden:1; 181 unsigned use_holden:1;
182
183 unsigned int slave_id_fifo0_tx;
184 unsigned int slave_id_fifo0_rx;
173}; 185};
174 186
175static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) 187static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 4bf19d8174ed..5a5ff57ceed4 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -2,6 +2,7 @@
2#define _LINUX_NAMEI_H 2#define _LINUX_NAMEI_H
3 3
4#include <linux/dcache.h> 4#include <linux/dcache.h>
5#include <linux/errno.h>
5#include <linux/linkage.h> 6#include <linux/linkage.h>
6#include <linux/path.h> 7#include <linux/path.h>
7 8
@@ -65,8 +66,8 @@ extern int user_path_at_empty(int, const char __user *, unsigned, struct path *,
65 66
66extern int kern_path(const char *, unsigned, struct path *); 67extern int kern_path(const char *, unsigned, struct path *);
67 68
68extern struct dentry *kern_path_create(int, const char *, struct path *, int); 69extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int);
69extern struct dentry *user_path_create(int, const char __user *, struct path *, int); 70extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
70extern void done_path_create(struct path *, struct dentry *); 71extern void done_path_create(struct path *, struct dentry *);
71extern struct dentry *kern_path_locked(const char *, struct path *); 72extern struct dentry *kern_path_locked(const char *, struct path *);
72extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 73extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
@@ -98,4 +99,20 @@ static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
98 ((char *) name)[min(len, maxlen)] = '\0'; 99 ((char *) name)[min(len, maxlen)] = '\0';
99} 100}
100 101
102/**
103 * retry_estale - determine whether the caller should retry an operation
104 * @error: the error that would currently be returned
105 * @flags: flags being used for next lookup attempt
106 *
107 * Check to see if the error code was -ESTALE, and then determine whether
108 * to retry the call based on whether "flags" already has LOOKUP_REVAL set.
109 *
110 * Returns true if the caller should try the operation again.
111 */
112static inline bool
113retry_estale(const long error, const unsigned int flags)
114{
115 return error == -ESTALE && !(flags & LOOKUP_REVAL);
116}
117
101#endif /* _LINUX_NAMEI_H */ 118#endif /* _LINUX_NAMEI_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f8eda0276f03..c599e4782d45 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -369,7 +369,7 @@ typedef enum gro_result gro_result_t;
369 * 369 *
370 * If the rx_handler consider the skb should be ignored, it should return 370 * If the rx_handler consider the skb should be ignored, it should return
371 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that 371 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
372 * are registred on exact device (ptype->dev == skb->dev). 372 * are registered on exact device (ptype->dev == skb->dev).
373 * 373 *
374 * If the rx_handler didn't changed skb->dev, but want the skb to be normally 374 * If the rx_handler didn't changed skb->dev, but want the skb to be normally
375 * delivered, it should return RX_HANDLER_PASS. 375 * delivered, it should return RX_HANDLER_PASS.
@@ -887,6 +887,10 @@ struct netdev_fcoe_hbainfo {
887 * struct net_device *dev, int idx) 887 * struct net_device *dev, int idx)
888 * Used to add FDB entries to dump requests. Implementers should add 888 * Used to add FDB entries to dump requests. Implementers should add
889 * entries to skb and update idx with the number of entries. 889 * entries to skb and update idx with the number of entries.
890 *
891 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
892 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
893 * struct net_device *dev)
890 */ 894 */
891struct net_device_ops { 895struct net_device_ops {
892 int (*ndo_init)(struct net_device *dev); 896 int (*ndo_init)(struct net_device *dev);
@@ -998,6 +1002,12 @@ struct net_device_ops {
998 struct netlink_callback *cb, 1002 struct netlink_callback *cb,
999 struct net_device *dev, 1003 struct net_device *dev,
1000 int idx); 1004 int idx);
1005
1006 int (*ndo_bridge_setlink)(struct net_device *dev,
1007 struct nlmsghdr *nlh);
1008 int (*ndo_bridge_getlink)(struct sk_buff *skb,
1009 u32 pid, u32 seq,
1010 struct net_device *dev);
1001}; 1011};
1002 1012
1003/* 1013/*
@@ -1053,6 +1063,12 @@ struct net_device {
1053 netdev_features_t wanted_features; 1063 netdev_features_t wanted_features;
1054 /* mask of features inheritable by VLAN devices */ 1064 /* mask of features inheritable by VLAN devices */
1055 netdev_features_t vlan_features; 1065 netdev_features_t vlan_features;
1066 /* mask of features inherited by encapsulating devices
1067 * This field indicates what encapsulation offloads
1068 * the hardware is capable of doing, and drivers will
1069 * need to set them appropriately.
1070 */
1071 netdev_features_t hw_enc_features;
1056 1072
1057 /* Interface index. Unique device identifier */ 1073 /* Interface index. Unique device identifier */
1058 int ifindex; 1074 int ifindex;
@@ -1488,6 +1504,9 @@ struct napi_gro_cb {
1488 1504
1489 /* Used in ipv6_gro_receive() */ 1505 /* Used in ipv6_gro_receive() */
1490 int proto; 1506 int proto;
1507
1508 /* used in skb_gro_receive() slow path */
1509 struct sk_buff *last;
1491}; 1510};
1492 1511
1493#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1512#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1499,16 +1518,25 @@ struct packet_type {
1499 struct net_device *, 1518 struct net_device *,
1500 struct packet_type *, 1519 struct packet_type *,
1501 struct net_device *); 1520 struct net_device *);
1521 bool (*id_match)(struct packet_type *ptype,
1522 struct sock *sk);
1523 void *af_packet_priv;
1524 struct list_head list;
1525};
1526
1527struct offload_callbacks {
1502 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1528 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1503 netdev_features_t features); 1529 netdev_features_t features);
1504 int (*gso_send_check)(struct sk_buff *skb); 1530 int (*gso_send_check)(struct sk_buff *skb);
1505 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1531 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1506 struct sk_buff *skb); 1532 struct sk_buff *skb);
1507 int (*gro_complete)(struct sk_buff *skb); 1533 int (*gro_complete)(struct sk_buff *skb);
1508 bool (*id_match)(struct packet_type *ptype, 1534};
1509 struct sock *sk); 1535
1510 void *af_packet_priv; 1536struct packet_offload {
1511 struct list_head list; 1537 __be16 type; /* This is really htons(ether_type). */
1538 struct offload_callbacks callbacks;
1539 struct list_head list;
1512}; 1540};
1513 1541
1514#include <linux/notifier.h> 1542#include <linux/notifier.h>
@@ -1548,6 +1576,8 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1548 1576
1549extern rwlock_t dev_base_lock; /* Device list lock */ 1577extern rwlock_t dev_base_lock; /* Device list lock */
1550 1578
1579extern seqcount_t devnet_rename_seq; /* Device rename seq */
1580
1551 1581
1552#define for_each_netdev(net, d) \ 1582#define for_each_netdev(net, d) \
1553 list_for_each_entry(d, &(net)->dev_base_head, dev_list) 1583 list_for_each_entry(d, &(net)->dev_base_head, dev_list)
@@ -1605,6 +1635,9 @@ extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short
1605extern void dev_add_pack(struct packet_type *pt); 1635extern void dev_add_pack(struct packet_type *pt);
1606extern void dev_remove_pack(struct packet_type *pt); 1636extern void dev_remove_pack(struct packet_type *pt);
1607extern void __dev_remove_pack(struct packet_type *pt); 1637extern void __dev_remove_pack(struct packet_type *pt);
1638extern void dev_add_offload(struct packet_offload *po);
1639extern void dev_remove_offload(struct packet_offload *po);
1640extern void __dev_remove_offload(struct packet_offload *po);
1608 1641
1609extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 1642extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1610 unsigned short mask); 1643 unsigned short mask);
@@ -2129,16 +2162,10 @@ extern void dev_kfree_skb_any(struct sk_buff *skb);
2129extern int netif_rx(struct sk_buff *skb); 2162extern int netif_rx(struct sk_buff *skb);
2130extern int netif_rx_ni(struct sk_buff *skb); 2163extern int netif_rx_ni(struct sk_buff *skb);
2131extern int netif_receive_skb(struct sk_buff *skb); 2164extern int netif_receive_skb(struct sk_buff *skb);
2132extern gro_result_t dev_gro_receive(struct napi_struct *napi,
2133 struct sk_buff *skb);
2134extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
2135extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2165extern gro_result_t napi_gro_receive(struct napi_struct *napi,
2136 struct sk_buff *skb); 2166 struct sk_buff *skb);
2137extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2167extern void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2138extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2168extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2139extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2140 struct sk_buff *skb,
2141 gro_result_t ret);
2142extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2169extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2143 2170
2144static inline void napi_free_frags(struct napi_struct *napi) 2171static inline void napi_free_frags(struct napi_struct *napi)
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 5f84c6229dc6..610208b18c05 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -47,15 +47,6 @@ ip6t_ext_hdr(u8 nexthdr)
47 (nexthdr == IPPROTO_DSTOPTS); 47 (nexthdr == IPPROTO_DSTOPTS);
48} 48}
49 49
50enum {
51 IP6T_FH_F_FRAG = (1 << 0),
52 IP6T_FH_F_AUTH = (1 << 1),
53};
54
55/* find specified header and get offset to it */
56extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
57 int target, unsigned short *fragoff, int *fragflg);
58
59#ifdef CONFIG_COMPAT 50#ifdef CONFIG_COMPAT
60#include <net/compat.h> 51#include <net/compat.h>
61 52
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
deleted file mode 100644
index 9890bbaf4328..000000000000
--- a/include/linux/nfc/pn544.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) Nokia Corporation
5 *
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com>
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _PN544_H_
24#define _PN544_H_
25
26#include <linux/i2c.h>
27
28#define PN544_DRIVER_NAME "pn544"
29#define PN544_MAXWINDOW_SIZE 7
30#define PN544_WINDOW_SIZE 4
31#define PN544_RETRIES 10
32#define PN544_MAX_I2C_TRANSFER 0x0400
33#define PN544_MSG_MAX_SIZE 0x21 /* at normal HCI mode */
34
35/* ioctl */
36#define PN544_CHAR_BASE 'P'
37#define PN544_IOR(num, dtype) _IOR(PN544_CHAR_BASE, num, dtype)
38#define PN544_IOW(num, dtype) _IOW(PN544_CHAR_BASE, num, dtype)
39#define PN544_GET_FW_MODE PN544_IOW(1, unsigned int)
40#define PN544_SET_FW_MODE PN544_IOW(2, unsigned int)
41#define PN544_GET_DEBUG PN544_IOW(3, unsigned int)
42#define PN544_SET_DEBUG PN544_IOW(4, unsigned int)
43
44/* Timing restrictions (ms) */
45#define PN544_RESETVEN_TIME 30 /* 7 */
46#define PN544_PVDDVEN_TIME 0
47#define PN544_VBATVEN_TIME 0
48#define PN544_GPIO4VEN_TIME 0
49#define PN544_WAKEUP_ACK 5
50#define PN544_WAKEUP_GUARD (PN544_WAKEUP_ACK + 1)
51#define PN544_INACTIVITY_TIME 1000
52#define PN544_INTERFRAME_DELAY 200 /* us */
53#define PN544_BAUDRATE_CHANGE 150 /* us */
54
55/* Debug bits */
56#define PN544_DEBUG_BUF 0x01
57#define PN544_DEBUG_READ 0x02
58#define PN544_DEBUG_WRITE 0x04
59#define PN544_DEBUG_IRQ 0x08
60#define PN544_DEBUG_CALLS 0x10
61#define PN544_DEBUG_MODE 0x20
62
63/* Normal (HCI) mode */
64#define PN544_LLC_HCI_OVERHEAD 3 /* header + crc (to length) */
65#define PN544_LLC_MIN_SIZE (1 + PN544_LLC_HCI_OVERHEAD) /* length + */
66#define PN544_LLC_MAX_DATA (PN544_MSG_MAX_SIZE - 2)
67#define PN544_LLC_MAX_HCI_SIZE (PN544_LLC_MAX_DATA - 2)
68
69struct pn544_llc_packet {
70 unsigned char length; /* of rest of packet */
71 unsigned char header;
72 unsigned char data[PN544_LLC_MAX_DATA]; /* includes crc-ccitt */
73};
74
75/* Firmware upgrade mode */
76#define PN544_FW_HEADER_SIZE 3
77/* max fw transfer is 1024bytes, but I2C limits it to 0xC0 */
78#define PN544_MAX_FW_DATA (PN544_MAX_I2C_TRANSFER - PN544_FW_HEADER_SIZE)
79
80struct pn544_fw_packet {
81 unsigned char command; /* status in answer */
82 unsigned char length[2]; /* big-endian order (msf) */
83 unsigned char data[PN544_MAX_FW_DATA];
84};
85
86#ifdef __KERNEL__
87enum {
88 NFC_GPIO_ENABLE,
89 NFC_GPIO_FW_RESET,
90 NFC_GPIO_IRQ
91};
92
93/* board config */
94struct pn544_nfc_platform_data {
95 int (*request_resources) (struct i2c_client *client);
96 void (*free_resources) (void);
97 void (*enable) (int fw);
98 int (*test) (void);
99 void (*disable) (void);
100 int (*get_gpio)(int type);
101};
102#endif /* __KERNEL__ */
103
104#endif /* _PN544_H_ */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index a9e76ee1adca..6c6ed153a9b4 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -198,51 +198,4 @@ struct nfs_server {
198#define NFS_CAP_POSIX_LOCK (1U << 14) 198#define NFS_CAP_POSIX_LOCK (1U << 14)
199#define NFS_CAP_UIDGID_NOMAP (1U << 15) 199#define NFS_CAP_UIDGID_NOMAP (1U << 15)
200 200
201
202/* maximum number of slots to use */
203#define NFS4_DEF_SLOT_TABLE_SIZE (16U)
204#define NFS4_MAX_SLOT_TABLE (256U)
205#define NFS4_NO_SLOT ((u32)-1)
206
207#if IS_ENABLED(CONFIG_NFS_V4)
208
209/* Sessions */
210#define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long))
211struct nfs4_slot_table {
212 struct nfs4_slot *slots; /* seqid per slot */
213 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */
214 spinlock_t slot_tbl_lock;
215 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */
216 u32 max_slots; /* # slots in table */
217 u32 highest_used_slotid; /* sent to server on each SEQ.
218 * op for dynamic resizing */
219 u32 target_max_slots; /* Set by CB_RECALL_SLOT as
220 * the new max_slots */
221 struct completion complete;
222};
223
224static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp)
225{
226 return sp - tbl->slots;
227}
228
229/*
230 * Session related parameters
231 */
232struct nfs4_session {
233 struct nfs4_sessionid sess_id;
234 u32 flags;
235 unsigned long session_state;
236 u32 hash_alg;
237 u32 ssv_len;
238
239 /* The fore and back channel */
240 struct nfs4_channel_attrs fc_attrs;
241 struct nfs4_slot_table fc_slot_table;
242 struct nfs4_channel_attrs bc_attrs;
243 struct nfs4_slot_table bc_slot_table;
244 struct nfs_client *clp;
245};
246
247#endif /* CONFIG_NFS_V4 */
248#endif 201#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a73ea89789d1..29adb12c7ecf 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -185,23 +185,20 @@ struct nfs4_channel_attrs {
185 u32 max_reqs; 185 u32 max_reqs;
186}; 186};
187 187
188/* nfs41 sessions slot seqid */ 188struct nfs4_slot;
189struct nfs4_slot {
190 u32 seq_nr;
191};
192
193struct nfs4_sequence_args { 189struct nfs4_sequence_args {
194 struct nfs4_session *sa_session; 190 struct nfs4_slot *sa_slot;
195 u32 sa_slotid; 191 u8 sa_cache_this : 1,
196 u8 sa_cache_this; 192 sa_privileged : 1;
197}; 193};
198 194
199struct nfs4_sequence_res { 195struct nfs4_sequence_res {
200 struct nfs4_session *sr_session;
201 struct nfs4_slot *sr_slot; /* slot used to send request */ 196 struct nfs4_slot *sr_slot; /* slot used to send request */
197 unsigned long sr_timestamp;
202 int sr_status; /* sequence operation status */ 198 int sr_status; /* sequence operation status */
203 unsigned long sr_renewal_time;
204 u32 sr_status_flags; 199 u32 sr_status_flags;
200 u32 sr_highest_slotid;
201 u32 sr_target_highest_slotid;
205}; 202};
206 203
207struct nfs4_get_lease_time_args { 204struct nfs4_get_lease_time_args {
@@ -209,8 +206,8 @@ struct nfs4_get_lease_time_args {
209}; 206};
210 207
211struct nfs4_get_lease_time_res { 208struct nfs4_get_lease_time_res {
212 struct nfs_fsinfo *lr_fsinfo;
213 struct nfs4_sequence_res lr_seq_res; 209 struct nfs4_sequence_res lr_seq_res;
210 struct nfs_fsinfo *lr_fsinfo;
214}; 211};
215 212
216#define PNFS_LAYOUT_MAXSIZE 4096 213#define PNFS_LAYOUT_MAXSIZE 4096
@@ -228,23 +225,23 @@ struct pnfs_layout_range {
228}; 225};
229 226
230struct nfs4_layoutget_args { 227struct nfs4_layoutget_args {
228 struct nfs4_sequence_args seq_args;
231 __u32 type; 229 __u32 type;
232 struct pnfs_layout_range range; 230 struct pnfs_layout_range range;
233 __u64 minlength; 231 __u64 minlength;
234 __u32 maxcount; 232 __u32 maxcount;
235 struct inode *inode; 233 struct inode *inode;
236 struct nfs_open_context *ctx; 234 struct nfs_open_context *ctx;
237 struct nfs4_sequence_args seq_args;
238 nfs4_stateid stateid; 235 nfs4_stateid stateid;
239 struct nfs4_layoutdriver_data layout; 236 struct nfs4_layoutdriver_data layout;
240}; 237};
241 238
242struct nfs4_layoutget_res { 239struct nfs4_layoutget_res {
240 struct nfs4_sequence_res seq_res;
243 __u32 return_on_close; 241 __u32 return_on_close;
244 struct pnfs_layout_range range; 242 struct pnfs_layout_range range;
245 __u32 type; 243 __u32 type;
246 nfs4_stateid stateid; 244 nfs4_stateid stateid;
247 struct nfs4_sequence_res seq_res;
248 struct nfs4_layoutdriver_data *layoutp; 245 struct nfs4_layoutdriver_data *layoutp;
249}; 246};
250 247
@@ -255,38 +252,38 @@ struct nfs4_layoutget {
255}; 252};
256 253
257struct nfs4_getdevicelist_args { 254struct nfs4_getdevicelist_args {
255 struct nfs4_sequence_args seq_args;
258 const struct nfs_fh *fh; 256 const struct nfs_fh *fh;
259 u32 layoutclass; 257 u32 layoutclass;
260 struct nfs4_sequence_args seq_args;
261}; 258};
262 259
263struct nfs4_getdevicelist_res { 260struct nfs4_getdevicelist_res {
264 struct pnfs_devicelist *devlist;
265 struct nfs4_sequence_res seq_res; 261 struct nfs4_sequence_res seq_res;
262 struct pnfs_devicelist *devlist;
266}; 263};
267 264
268struct nfs4_getdeviceinfo_args { 265struct nfs4_getdeviceinfo_args {
269 struct pnfs_device *pdev;
270 struct nfs4_sequence_args seq_args; 266 struct nfs4_sequence_args seq_args;
267 struct pnfs_device *pdev;
271}; 268};
272 269
273struct nfs4_getdeviceinfo_res { 270struct nfs4_getdeviceinfo_res {
274 struct pnfs_device *pdev;
275 struct nfs4_sequence_res seq_res; 271 struct nfs4_sequence_res seq_res;
272 struct pnfs_device *pdev;
276}; 273};
277 274
278struct nfs4_layoutcommit_args { 275struct nfs4_layoutcommit_args {
276 struct nfs4_sequence_args seq_args;
279 nfs4_stateid stateid; 277 nfs4_stateid stateid;
280 __u64 lastbytewritten; 278 __u64 lastbytewritten;
281 struct inode *inode; 279 struct inode *inode;
282 const u32 *bitmask; 280 const u32 *bitmask;
283 struct nfs4_sequence_args seq_args;
284}; 281};
285 282
286struct nfs4_layoutcommit_res { 283struct nfs4_layoutcommit_res {
284 struct nfs4_sequence_res seq_res;
287 struct nfs_fattr *fattr; 285 struct nfs_fattr *fattr;
288 const struct nfs_server *server; 286 const struct nfs_server *server;
289 struct nfs4_sequence_res seq_res;
290 int status; 287 int status;
291}; 288};
292 289
@@ -300,11 +297,11 @@ struct nfs4_layoutcommit_data {
300}; 297};
301 298
302struct nfs4_layoutreturn_args { 299struct nfs4_layoutreturn_args {
300 struct nfs4_sequence_args seq_args;
303 struct pnfs_layout_hdr *layout; 301 struct pnfs_layout_hdr *layout;
304 struct inode *inode; 302 struct inode *inode;
305 nfs4_stateid stateid; 303 nfs4_stateid stateid;
306 __u32 layout_type; 304 __u32 layout_type;
307 struct nfs4_sequence_args seq_args;
308}; 305};
309 306
310struct nfs4_layoutreturn_res { 307struct nfs4_layoutreturn_res {
@@ -330,6 +327,7 @@ struct stateowner_id {
330 * Arguments to the open call. 327 * Arguments to the open call.
331 */ 328 */
332struct nfs_openargs { 329struct nfs_openargs {
330 struct nfs4_sequence_args seq_args;
333 const struct nfs_fh * fh; 331 const struct nfs_fh * fh;
334 struct nfs_seqid * seqid; 332 struct nfs_seqid * seqid;
335 int open_flags; 333 int open_flags;
@@ -350,10 +348,10 @@ struct nfs_openargs {
350 const u32 * bitmask; 348 const u32 * bitmask;
351 const u32 * open_bitmap; 349 const u32 * open_bitmap;
352 __u32 claim; 350 __u32 claim;
353 struct nfs4_sequence_args seq_args;
354}; 351};
355 352
356struct nfs_openres { 353struct nfs_openres {
354 struct nfs4_sequence_res seq_res;
357 nfs4_stateid stateid; 355 nfs4_stateid stateid;
358 struct nfs_fh fh; 356 struct nfs_fh fh;
359 struct nfs4_change_info cinfo; 357 struct nfs4_change_info cinfo;
@@ -368,7 +366,6 @@ struct nfs_openres {
368 __u32 attrset[NFS4_BITMAP_SIZE]; 366 __u32 attrset[NFS4_BITMAP_SIZE];
369 struct nfs4_string *owner; 367 struct nfs4_string *owner;
370 struct nfs4_string *group_owner; 368 struct nfs4_string *group_owner;
371 struct nfs4_sequence_res seq_res;
372 __u32 access_request; 369 __u32 access_request;
373 __u32 access_supported; 370 __u32 access_supported;
374 __u32 access_result; 371 __u32 access_result;
@@ -392,20 +389,20 @@ struct nfs_open_confirmres {
392 * Arguments to the close call. 389 * Arguments to the close call.
393 */ 390 */
394struct nfs_closeargs { 391struct nfs_closeargs {
392 struct nfs4_sequence_args seq_args;
395 struct nfs_fh * fh; 393 struct nfs_fh * fh;
396 nfs4_stateid * stateid; 394 nfs4_stateid * stateid;
397 struct nfs_seqid * seqid; 395 struct nfs_seqid * seqid;
398 fmode_t fmode; 396 fmode_t fmode;
399 const u32 * bitmask; 397 const u32 * bitmask;
400 struct nfs4_sequence_args seq_args;
401}; 398};
402 399
403struct nfs_closeres { 400struct nfs_closeres {
401 struct nfs4_sequence_res seq_res;
404 nfs4_stateid stateid; 402 nfs4_stateid stateid;
405 struct nfs_fattr * fattr; 403 struct nfs_fattr * fattr;
406 struct nfs_seqid * seqid; 404 struct nfs_seqid * seqid;
407 const struct nfs_server *server; 405 const struct nfs_server *server;
408 struct nfs4_sequence_res seq_res;
409}; 406};
410/* 407/*
411 * * Arguments to the lock,lockt, and locku call. 408 * * Arguments to the lock,lockt, and locku call.
@@ -417,6 +414,7 @@ struct nfs_lowner {
417}; 414};
418 415
419struct nfs_lock_args { 416struct nfs_lock_args {
417 struct nfs4_sequence_args seq_args;
420 struct nfs_fh * fh; 418 struct nfs_fh * fh;
421 struct file_lock * fl; 419 struct file_lock * fl;
422 struct nfs_seqid * lock_seqid; 420 struct nfs_seqid * lock_seqid;
@@ -427,40 +425,39 @@ struct nfs_lock_args {
427 unsigned char block : 1; 425 unsigned char block : 1;
428 unsigned char reclaim : 1; 426 unsigned char reclaim : 1;
429 unsigned char new_lock_owner : 1; 427 unsigned char new_lock_owner : 1;
430 struct nfs4_sequence_args seq_args;
431}; 428};
432 429
433struct nfs_lock_res { 430struct nfs_lock_res {
431 struct nfs4_sequence_res seq_res;
434 nfs4_stateid stateid; 432 nfs4_stateid stateid;
435 struct nfs_seqid * lock_seqid; 433 struct nfs_seqid * lock_seqid;
436 struct nfs_seqid * open_seqid; 434 struct nfs_seqid * open_seqid;
437 struct nfs4_sequence_res seq_res;
438}; 435};
439 436
440struct nfs_locku_args { 437struct nfs_locku_args {
438 struct nfs4_sequence_args seq_args;
441 struct nfs_fh * fh; 439 struct nfs_fh * fh;
442 struct file_lock * fl; 440 struct file_lock * fl;
443 struct nfs_seqid * seqid; 441 struct nfs_seqid * seqid;
444 nfs4_stateid * stateid; 442 nfs4_stateid * stateid;
445 struct nfs4_sequence_args seq_args;
446}; 443};
447 444
448struct nfs_locku_res { 445struct nfs_locku_res {
446 struct nfs4_sequence_res seq_res;
449 nfs4_stateid stateid; 447 nfs4_stateid stateid;
450 struct nfs_seqid * seqid; 448 struct nfs_seqid * seqid;
451 struct nfs4_sequence_res seq_res;
452}; 449};
453 450
454struct nfs_lockt_args { 451struct nfs_lockt_args {
452 struct nfs4_sequence_args seq_args;
455 struct nfs_fh * fh; 453 struct nfs_fh * fh;
456 struct file_lock * fl; 454 struct file_lock * fl;
457 struct nfs_lowner lock_owner; 455 struct nfs_lowner lock_owner;
458 struct nfs4_sequence_args seq_args;
459}; 456};
460 457
461struct nfs_lockt_res { 458struct nfs_lockt_res {
462 struct file_lock * denied; /* LOCK, LOCKT failed */
463 struct nfs4_sequence_res seq_res; 459 struct nfs4_sequence_res seq_res;
460 struct file_lock * denied; /* LOCK, LOCKT failed */
464}; 461};
465 462
466struct nfs_release_lockowner_args { 463struct nfs_release_lockowner_args {
@@ -468,22 +465,23 @@ struct nfs_release_lockowner_args {
468}; 465};
469 466
470struct nfs4_delegreturnargs { 467struct nfs4_delegreturnargs {
468 struct nfs4_sequence_args seq_args;
471 const struct nfs_fh *fhandle; 469 const struct nfs_fh *fhandle;
472 const nfs4_stateid *stateid; 470 const nfs4_stateid *stateid;
473 const u32 * bitmask; 471 const u32 * bitmask;
474 struct nfs4_sequence_args seq_args;
475}; 472};
476 473
477struct nfs4_delegreturnres { 474struct nfs4_delegreturnres {
475 struct nfs4_sequence_res seq_res;
478 struct nfs_fattr * fattr; 476 struct nfs_fattr * fattr;
479 const struct nfs_server *server; 477 const struct nfs_server *server;
480 struct nfs4_sequence_res seq_res;
481}; 478};
482 479
483/* 480/*
484 * Arguments to the read call. 481 * Arguments to the read call.
485 */ 482 */
486struct nfs_readargs { 483struct nfs_readargs {
484 struct nfs4_sequence_args seq_args;
487 struct nfs_fh * fh; 485 struct nfs_fh * fh;
488 struct nfs_open_context *context; 486 struct nfs_open_context *context;
489 struct nfs_lock_context *lock_context; 487 struct nfs_lock_context *lock_context;
@@ -491,20 +489,20 @@ struct nfs_readargs {
491 __u32 count; 489 __u32 count;
492 unsigned int pgbase; 490 unsigned int pgbase;
493 struct page ** pages; 491 struct page ** pages;
494 struct nfs4_sequence_args seq_args;
495}; 492};
496 493
497struct nfs_readres { 494struct nfs_readres {
495 struct nfs4_sequence_res seq_res;
498 struct nfs_fattr * fattr; 496 struct nfs_fattr * fattr;
499 __u32 count; 497 __u32 count;
500 int eof; 498 int eof;
501 struct nfs4_sequence_res seq_res;
502}; 499};
503 500
504/* 501/*
505 * Arguments to the write call. 502 * Arguments to the write call.
506 */ 503 */
507struct nfs_writeargs { 504struct nfs_writeargs {
505 struct nfs4_sequence_args seq_args;
508 struct nfs_fh * fh; 506 struct nfs_fh * fh;
509 struct nfs_open_context *context; 507 struct nfs_open_context *context;
510 struct nfs_lock_context *lock_context; 508 struct nfs_lock_context *lock_context;
@@ -514,7 +512,6 @@ struct nfs_writeargs {
514 unsigned int pgbase; 512 unsigned int pgbase;
515 struct page ** pages; 513 struct page ** pages;
516 const u32 * bitmask; 514 const u32 * bitmask;
517 struct nfs4_sequence_args seq_args;
518}; 515};
519 516
520struct nfs_write_verifier { 517struct nfs_write_verifier {
@@ -527,65 +524,65 @@ struct nfs_writeverf {
527}; 524};
528 525
529struct nfs_writeres { 526struct nfs_writeres {
527 struct nfs4_sequence_res seq_res;
530 struct nfs_fattr * fattr; 528 struct nfs_fattr * fattr;
531 struct nfs_writeverf * verf; 529 struct nfs_writeverf * verf;
532 __u32 count; 530 __u32 count;
533 const struct nfs_server *server; 531 const struct nfs_server *server;
534 struct nfs4_sequence_res seq_res;
535}; 532};
536 533
537/* 534/*
538 * Arguments to the commit call. 535 * Arguments to the commit call.
539 */ 536 */
540struct nfs_commitargs { 537struct nfs_commitargs {
538 struct nfs4_sequence_args seq_args;
541 struct nfs_fh *fh; 539 struct nfs_fh *fh;
542 __u64 offset; 540 __u64 offset;
543 __u32 count; 541 __u32 count;
544 const u32 *bitmask; 542 const u32 *bitmask;
545 struct nfs4_sequence_args seq_args;
546}; 543};
547 544
548struct nfs_commitres { 545struct nfs_commitres {
546 struct nfs4_sequence_res seq_res;
549 struct nfs_fattr *fattr; 547 struct nfs_fattr *fattr;
550 struct nfs_writeverf *verf; 548 struct nfs_writeverf *verf;
551 const struct nfs_server *server; 549 const struct nfs_server *server;
552 struct nfs4_sequence_res seq_res;
553}; 550};
554 551
555/* 552/*
556 * Common arguments to the unlink call 553 * Common arguments to the unlink call
557 */ 554 */
558struct nfs_removeargs { 555struct nfs_removeargs {
556 struct nfs4_sequence_args seq_args;
559 const struct nfs_fh *fh; 557 const struct nfs_fh *fh;
560 struct qstr name; 558 struct qstr name;
561 struct nfs4_sequence_args seq_args;
562}; 559};
563 560
564struct nfs_removeres { 561struct nfs_removeres {
562 struct nfs4_sequence_res seq_res;
565 const struct nfs_server *server; 563 const struct nfs_server *server;
566 struct nfs_fattr *dir_attr; 564 struct nfs_fattr *dir_attr;
567 struct nfs4_change_info cinfo; 565 struct nfs4_change_info cinfo;
568 struct nfs4_sequence_res seq_res;
569}; 566};
570 567
571/* 568/*
572 * Common arguments to the rename call 569 * Common arguments to the rename call
573 */ 570 */
574struct nfs_renameargs { 571struct nfs_renameargs {
572 struct nfs4_sequence_args seq_args;
575 const struct nfs_fh *old_dir; 573 const struct nfs_fh *old_dir;
576 const struct nfs_fh *new_dir; 574 const struct nfs_fh *new_dir;
577 const struct qstr *old_name; 575 const struct qstr *old_name;
578 const struct qstr *new_name; 576 const struct qstr *new_name;
579 struct nfs4_sequence_args seq_args;
580}; 577};
581 578
582struct nfs_renameres { 579struct nfs_renameres {
580 struct nfs4_sequence_res seq_res;
583 const struct nfs_server *server; 581 const struct nfs_server *server;
584 struct nfs4_change_info old_cinfo; 582 struct nfs4_change_info old_cinfo;
585 struct nfs_fattr *old_fattr; 583 struct nfs_fattr *old_fattr;
586 struct nfs4_change_info new_cinfo; 584 struct nfs4_change_info new_cinfo;
587 struct nfs_fattr *new_fattr; 585 struct nfs_fattr *new_fattr;
588 struct nfs4_sequence_res seq_res;
589}; 586};
590 587
591/* 588/*
@@ -626,20 +623,20 @@ struct nfs_createargs {
626}; 623};
627 624
628struct nfs_setattrargs { 625struct nfs_setattrargs {
626 struct nfs4_sequence_args seq_args;
629 struct nfs_fh * fh; 627 struct nfs_fh * fh;
630 nfs4_stateid stateid; 628 nfs4_stateid stateid;
631 struct iattr * iap; 629 struct iattr * iap;
632 const struct nfs_server * server; /* Needed for name mapping */ 630 const struct nfs_server * server; /* Needed for name mapping */
633 const u32 * bitmask; 631 const u32 * bitmask;
634 struct nfs4_sequence_args seq_args;
635}; 632};
636 633
637struct nfs_setaclargs { 634struct nfs_setaclargs {
635 struct nfs4_sequence_args seq_args;
638 struct nfs_fh * fh; 636 struct nfs_fh * fh;
639 size_t acl_len; 637 size_t acl_len;
640 unsigned int acl_pgbase; 638 unsigned int acl_pgbase;
641 struct page ** acl_pages; 639 struct page ** acl_pages;
642 struct nfs4_sequence_args seq_args;
643}; 640};
644 641
645struct nfs_setaclres { 642struct nfs_setaclres {
@@ -647,27 +644,27 @@ struct nfs_setaclres {
647}; 644};
648 645
649struct nfs_getaclargs { 646struct nfs_getaclargs {
647 struct nfs4_sequence_args seq_args;
650 struct nfs_fh * fh; 648 struct nfs_fh * fh;
651 size_t acl_len; 649 size_t acl_len;
652 unsigned int acl_pgbase; 650 unsigned int acl_pgbase;
653 struct page ** acl_pages; 651 struct page ** acl_pages;
654 struct nfs4_sequence_args seq_args;
655}; 652};
656 653
657/* getxattr ACL interface flags */ 654/* getxattr ACL interface flags */
658#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */ 655#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
659struct nfs_getaclres { 656struct nfs_getaclres {
657 struct nfs4_sequence_res seq_res;
660 size_t acl_len; 658 size_t acl_len;
661 size_t acl_data_offset; 659 size_t acl_data_offset;
662 int acl_flags; 660 int acl_flags;
663 struct page * acl_scratch; 661 struct page * acl_scratch;
664 struct nfs4_sequence_res seq_res;
665}; 662};
666 663
667struct nfs_setattrres { 664struct nfs_setattrres {
665 struct nfs4_sequence_res seq_res;
668 struct nfs_fattr * fattr; 666 struct nfs_fattr * fattr;
669 const struct nfs_server * server; 667 const struct nfs_server * server;
670 struct nfs4_sequence_res seq_res;
671}; 668};
672 669
673struct nfs_linkargs { 670struct nfs_linkargs {
@@ -832,21 +829,22 @@ struct nfs3_getaclres {
832typedef u64 clientid4; 829typedef u64 clientid4;
833 830
834struct nfs4_accessargs { 831struct nfs4_accessargs {
832 struct nfs4_sequence_args seq_args;
835 const struct nfs_fh * fh; 833 const struct nfs_fh * fh;
836 const u32 * bitmask; 834 const u32 * bitmask;
837 u32 access; 835 u32 access;
838 struct nfs4_sequence_args seq_args;
839}; 836};
840 837
841struct nfs4_accessres { 838struct nfs4_accessres {
839 struct nfs4_sequence_res seq_res;
842 const struct nfs_server * server; 840 const struct nfs_server * server;
843 struct nfs_fattr * fattr; 841 struct nfs_fattr * fattr;
844 u32 supported; 842 u32 supported;
845 u32 access; 843 u32 access;
846 struct nfs4_sequence_res seq_res;
847}; 844};
848 845
849struct nfs4_create_arg { 846struct nfs4_create_arg {
847 struct nfs4_sequence_args seq_args;
850 u32 ftype; 848 u32 ftype;
851 union { 849 union {
852 struct { 850 struct {
@@ -863,88 +861,88 @@ struct nfs4_create_arg {
863 const struct iattr * attrs; 861 const struct iattr * attrs;
864 const struct nfs_fh * dir_fh; 862 const struct nfs_fh * dir_fh;
865 const u32 * bitmask; 863 const u32 * bitmask;
866 struct nfs4_sequence_args seq_args;
867}; 864};
868 865
869struct nfs4_create_res { 866struct nfs4_create_res {
867 struct nfs4_sequence_res seq_res;
870 const struct nfs_server * server; 868 const struct nfs_server * server;
871 struct nfs_fh * fh; 869 struct nfs_fh * fh;
872 struct nfs_fattr * fattr; 870 struct nfs_fattr * fattr;
873 struct nfs4_change_info dir_cinfo; 871 struct nfs4_change_info dir_cinfo;
874 struct nfs4_sequence_res seq_res;
875}; 872};
876 873
877struct nfs4_fsinfo_arg { 874struct nfs4_fsinfo_arg {
875 struct nfs4_sequence_args seq_args;
878 const struct nfs_fh * fh; 876 const struct nfs_fh * fh;
879 const u32 * bitmask; 877 const u32 * bitmask;
880 struct nfs4_sequence_args seq_args;
881}; 878};
882 879
883struct nfs4_fsinfo_res { 880struct nfs4_fsinfo_res {
884 struct nfs_fsinfo *fsinfo;
885 struct nfs4_sequence_res seq_res; 881 struct nfs4_sequence_res seq_res;
882 struct nfs_fsinfo *fsinfo;
886}; 883};
887 884
888struct nfs4_getattr_arg { 885struct nfs4_getattr_arg {
886 struct nfs4_sequence_args seq_args;
889 const struct nfs_fh * fh; 887 const struct nfs_fh * fh;
890 const u32 * bitmask; 888 const u32 * bitmask;
891 struct nfs4_sequence_args seq_args;
892}; 889};
893 890
894struct nfs4_getattr_res { 891struct nfs4_getattr_res {
892 struct nfs4_sequence_res seq_res;
895 const struct nfs_server * server; 893 const struct nfs_server * server;
896 struct nfs_fattr * fattr; 894 struct nfs_fattr * fattr;
897 struct nfs4_sequence_res seq_res;
898}; 895};
899 896
900struct nfs4_link_arg { 897struct nfs4_link_arg {
898 struct nfs4_sequence_args seq_args;
901 const struct nfs_fh * fh; 899 const struct nfs_fh * fh;
902 const struct nfs_fh * dir_fh; 900 const struct nfs_fh * dir_fh;
903 const struct qstr * name; 901 const struct qstr * name;
904 const u32 * bitmask; 902 const u32 * bitmask;
905 struct nfs4_sequence_args seq_args;
906}; 903};
907 904
908struct nfs4_link_res { 905struct nfs4_link_res {
906 struct nfs4_sequence_res seq_res;
909 const struct nfs_server * server; 907 const struct nfs_server * server;
910 struct nfs_fattr * fattr; 908 struct nfs_fattr * fattr;
911 struct nfs4_change_info cinfo; 909 struct nfs4_change_info cinfo;
912 struct nfs_fattr * dir_attr; 910 struct nfs_fattr * dir_attr;
913 struct nfs4_sequence_res seq_res;
914}; 911};
915 912
916 913
917struct nfs4_lookup_arg { 914struct nfs4_lookup_arg {
915 struct nfs4_sequence_args seq_args;
918 const struct nfs_fh * dir_fh; 916 const struct nfs_fh * dir_fh;
919 const struct qstr * name; 917 const struct qstr * name;
920 const u32 * bitmask; 918 const u32 * bitmask;
921 struct nfs4_sequence_args seq_args;
922}; 919};
923 920
924struct nfs4_lookup_res { 921struct nfs4_lookup_res {
922 struct nfs4_sequence_res seq_res;
925 const struct nfs_server * server; 923 const struct nfs_server * server;
926 struct nfs_fattr * fattr; 924 struct nfs_fattr * fattr;
927 struct nfs_fh * fh; 925 struct nfs_fh * fh;
928 struct nfs4_sequence_res seq_res;
929}; 926};
930 927
931struct nfs4_lookup_root_arg { 928struct nfs4_lookup_root_arg {
932 const u32 * bitmask;
933 struct nfs4_sequence_args seq_args; 929 struct nfs4_sequence_args seq_args;
930 const u32 * bitmask;
934}; 931};
935 932
936struct nfs4_pathconf_arg { 933struct nfs4_pathconf_arg {
934 struct nfs4_sequence_args seq_args;
937 const struct nfs_fh * fh; 935 const struct nfs_fh * fh;
938 const u32 * bitmask; 936 const u32 * bitmask;
939 struct nfs4_sequence_args seq_args;
940}; 937};
941 938
942struct nfs4_pathconf_res { 939struct nfs4_pathconf_res {
943 struct nfs_pathconf *pathconf;
944 struct nfs4_sequence_res seq_res; 940 struct nfs4_sequence_res seq_res;
941 struct nfs_pathconf *pathconf;
945}; 942};
946 943
947struct nfs4_readdir_arg { 944struct nfs4_readdir_arg {
945 struct nfs4_sequence_args seq_args;
948 const struct nfs_fh * fh; 946 const struct nfs_fh * fh;
949 u64 cookie; 947 u64 cookie;
950 nfs4_verifier verifier; 948 nfs4_verifier verifier;
@@ -953,21 +951,20 @@ struct nfs4_readdir_arg {
953 unsigned int pgbase; /* zero-copy data */ 951 unsigned int pgbase; /* zero-copy data */
954 const u32 * bitmask; 952 const u32 * bitmask;
955 int plus; 953 int plus;
956 struct nfs4_sequence_args seq_args;
957}; 954};
958 955
959struct nfs4_readdir_res { 956struct nfs4_readdir_res {
957 struct nfs4_sequence_res seq_res;
960 nfs4_verifier verifier; 958 nfs4_verifier verifier;
961 unsigned int pgbase; 959 unsigned int pgbase;
962 struct nfs4_sequence_res seq_res;
963}; 960};
964 961
965struct nfs4_readlink { 962struct nfs4_readlink {
963 struct nfs4_sequence_args seq_args;
966 const struct nfs_fh * fh; 964 const struct nfs_fh * fh;
967 unsigned int pgbase; 965 unsigned int pgbase;
968 unsigned int pglen; /* zero-copy data */ 966 unsigned int pglen; /* zero-copy data */
969 struct page ** pages; /* zero-copy data */ 967 struct page ** pages; /* zero-copy data */
970 struct nfs4_sequence_args seq_args;
971}; 968};
972 969
973struct nfs4_readlink_res { 970struct nfs4_readlink_res {
@@ -993,28 +990,28 @@ struct nfs4_setclientid_res {
993}; 990};
994 991
995struct nfs4_statfs_arg { 992struct nfs4_statfs_arg {
993 struct nfs4_sequence_args seq_args;
996 const struct nfs_fh * fh; 994 const struct nfs_fh * fh;
997 const u32 * bitmask; 995 const u32 * bitmask;
998 struct nfs4_sequence_args seq_args;
999}; 996};
1000 997
1001struct nfs4_statfs_res { 998struct nfs4_statfs_res {
1002 struct nfs_fsstat *fsstat;
1003 struct nfs4_sequence_res seq_res; 999 struct nfs4_sequence_res seq_res;
1000 struct nfs_fsstat *fsstat;
1004}; 1001};
1005 1002
1006struct nfs4_server_caps_arg { 1003struct nfs4_server_caps_arg {
1007 struct nfs_fh *fhandle;
1008 struct nfs4_sequence_args seq_args; 1004 struct nfs4_sequence_args seq_args;
1005 struct nfs_fh *fhandle;
1009}; 1006};
1010 1007
1011struct nfs4_server_caps_res { 1008struct nfs4_server_caps_res {
1009 struct nfs4_sequence_res seq_res;
1012 u32 attr_bitmask[3]; 1010 u32 attr_bitmask[3];
1013 u32 acl_bitmask; 1011 u32 acl_bitmask;
1014 u32 has_links; 1012 u32 has_links;
1015 u32 has_symlinks; 1013 u32 has_symlinks;
1016 u32 fh_expire_type; 1014 u32 fh_expire_type;
1017 struct nfs4_sequence_res seq_res;
1018}; 1015};
1019 1016
1020#define NFS4_PATHNAME_MAXCOMPONENTS 512 1017#define NFS4_PATHNAME_MAXCOMPONENTS 512
@@ -1040,16 +1037,16 @@ struct nfs4_fs_locations {
1040}; 1037};
1041 1038
1042struct nfs4_fs_locations_arg { 1039struct nfs4_fs_locations_arg {
1040 struct nfs4_sequence_args seq_args;
1043 const struct nfs_fh *dir_fh; 1041 const struct nfs_fh *dir_fh;
1044 const struct qstr *name; 1042 const struct qstr *name;
1045 struct page *page; 1043 struct page *page;
1046 const u32 *bitmask; 1044 const u32 *bitmask;
1047 struct nfs4_sequence_args seq_args;
1048}; 1045};
1049 1046
1050struct nfs4_fs_locations_res { 1047struct nfs4_fs_locations_res {
1051 struct nfs4_fs_locations *fs_locations;
1052 struct nfs4_sequence_res seq_res; 1048 struct nfs4_sequence_res seq_res;
1049 struct nfs4_fs_locations *fs_locations;
1053}; 1050};
1054 1051
1055struct nfs4_secinfo_oid { 1052struct nfs4_secinfo_oid {
@@ -1074,14 +1071,14 @@ struct nfs4_secinfo_flavors {
1074}; 1071};
1075 1072
1076struct nfs4_secinfo_arg { 1073struct nfs4_secinfo_arg {
1074 struct nfs4_sequence_args seq_args;
1077 const struct nfs_fh *dir_fh; 1075 const struct nfs_fh *dir_fh;
1078 const struct qstr *name; 1076 const struct qstr *name;
1079 struct nfs4_sequence_args seq_args;
1080}; 1077};
1081 1078
1082struct nfs4_secinfo_res { 1079struct nfs4_secinfo_res {
1083 struct nfs4_secinfo_flavors *flavors;
1084 struct nfs4_sequence_res seq_res; 1080 struct nfs4_sequence_res seq_res;
1081 struct nfs4_secinfo_flavors *flavors;
1085}; 1082};
1086 1083
1087#endif /* CONFIG_NFS_V4 */ 1084#endif /* CONFIG_NFS_V4 */
@@ -1161,9 +1158,9 @@ struct nfs41_create_session_res {
1161}; 1158};
1162 1159
1163struct nfs41_reclaim_complete_args { 1160struct nfs41_reclaim_complete_args {
1161 struct nfs4_sequence_args seq_args;
1164 /* In the future extend to include curr_fh for use with migration */ 1162 /* In the future extend to include curr_fh for use with migration */
1165 unsigned char one_fs:1; 1163 unsigned char one_fs:1;
1166 struct nfs4_sequence_args seq_args;
1167}; 1164};
1168 1165
1169struct nfs41_reclaim_complete_res { 1166struct nfs41_reclaim_complete_res {
@@ -1173,28 +1170,28 @@ struct nfs41_reclaim_complete_res {
1173#define SECINFO_STYLE_CURRENT_FH 0 1170#define SECINFO_STYLE_CURRENT_FH 0
1174#define SECINFO_STYLE_PARENT 1 1171#define SECINFO_STYLE_PARENT 1
1175struct nfs41_secinfo_no_name_args { 1172struct nfs41_secinfo_no_name_args {
1176 int style;
1177 struct nfs4_sequence_args seq_args; 1173 struct nfs4_sequence_args seq_args;
1174 int style;
1178}; 1175};
1179 1176
1180struct nfs41_test_stateid_args { 1177struct nfs41_test_stateid_args {
1181 nfs4_stateid *stateid;
1182 struct nfs4_sequence_args seq_args; 1178 struct nfs4_sequence_args seq_args;
1179 nfs4_stateid *stateid;
1183}; 1180};
1184 1181
1185struct nfs41_test_stateid_res { 1182struct nfs41_test_stateid_res {
1186 unsigned int status;
1187 struct nfs4_sequence_res seq_res; 1183 struct nfs4_sequence_res seq_res;
1184 unsigned int status;
1188}; 1185};
1189 1186
1190struct nfs41_free_stateid_args { 1187struct nfs41_free_stateid_args {
1191 nfs4_stateid *stateid;
1192 struct nfs4_sequence_args seq_args; 1188 struct nfs4_sequence_args seq_args;
1189 nfs4_stateid *stateid;
1193}; 1190};
1194 1191
1195struct nfs41_free_stateid_res { 1192struct nfs41_free_stateid_res {
1196 unsigned int status;
1197 struct nfs4_sequence_res seq_res; 1193 struct nfs4_sequence_res seq_res;
1194 unsigned int status;
1198}; 1195};
1199 1196
1200#else 1197#else
diff --git a/include/linux/node.h b/include/linux/node.h
index 624e53cecc02..2115ad5d6f19 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -27,10 +27,9 @@ struct node {
27}; 27};
28 28
29struct memory_block; 29struct memory_block;
30extern struct node node_devices[]; 30extern struct node *node_devices[];
31typedef void (*node_registration_func_t)(struct node *); 31typedef void (*node_registration_func_t)(struct node *);
32 32
33extern int register_node(struct node *, int, struct node *);
34extern void unregister_node(struct node *node); 33extern void unregister_node(struct node *node);
35#ifdef CONFIG_NUMA 34#ifdef CONFIG_NUMA
36extern int register_one_node(int nid); 35extern int register_one_node(int nid);
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 7afc36334d52..4e2cbfa640b7 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -380,6 +380,11 @@ enum node_states {
380#else 380#else
381 N_HIGH_MEMORY = N_NORMAL_MEMORY, 381 N_HIGH_MEMORY = N_NORMAL_MEMORY,
382#endif 382#endif
383#ifdef CONFIG_MOVABLE_NODE
384 N_MEMORY, /* The node has memory(regular, high, movable) */
385#else
386 N_MEMORY = N_HIGH_MEMORY,
387#endif
383 N_CPU, /* The node has one or more cpus */ 388 N_CPU, /* The node has one or more cpus */
384 NR_NODE_STATES 389 NR_NODE_STATES
385}; 390};
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index cc37a55ad004..10e5947491c7 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -67,7 +67,7 @@ void exit_task_namespaces(struct task_struct *tsk);
67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); 67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
68void free_nsproxy(struct nsproxy *ns); 68void free_nsproxy(struct nsproxy *ns);
69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **, 69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
70 struct fs_struct *); 70 struct cred *, struct fs_struct *);
71int __init nsproxy_cache_init(void); 71int __init nsproxy_cache_init(void);
72 72
73static inline void put_nsproxy(struct nsproxy *ns) 73static inline void put_nsproxy(struct nsproxy *ns)
diff --git a/include/linux/of.h b/include/linux/of.h
index b4e50d56fc74..5ebcc5c8e423 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -22,6 +22,7 @@
22#include <linux/mod_devicetable.h> 22#include <linux/mod_devicetable.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/notifier.h>
25 26
26#include <asm/byteorder.h> 27#include <asm/byteorder.h>
27#include <asm/errno.h> 28#include <asm/errno.h>
@@ -46,7 +47,7 @@ struct device_node {
46 const char *name; 47 const char *name;
47 const char *type; 48 const char *type;
48 phandle phandle; 49 phandle phandle;
49 char *full_name; 50 const char *full_name;
50 51
51 struct property *properties; 52 struct property *properties;
52 struct property *deadprops; /* removed properties */ 53 struct property *deadprops; /* removed properties */
@@ -60,7 +61,7 @@ struct device_node {
60 unsigned long _flags; 61 unsigned long _flags;
61 void *data; 62 void *data;
62#if defined(CONFIG_SPARC) 63#if defined(CONFIG_SPARC)
63 char *path_component_name; 64 const char *path_component_name;
64 unsigned int unique_id; 65 unsigned int unique_id;
65 struct of_irq_controller *irq_trans; 66 struct of_irq_controller *irq_trans;
66#endif 67#endif
@@ -88,14 +89,14 @@ static inline void of_node_put(struct device_node *node) { }
88#ifdef CONFIG_OF 89#ifdef CONFIG_OF
89 90
90/* Pointer for first entry in chain of all nodes. */ 91/* Pointer for first entry in chain of all nodes. */
91extern struct device_node *allnodes; 92extern struct device_node *of_allnodes;
92extern struct device_node *of_chosen; 93extern struct device_node *of_chosen;
93extern struct device_node *of_aliases; 94extern struct device_node *of_aliases;
94extern rwlock_t devtree_lock; 95extern rwlock_t devtree_lock;
95 96
96static inline bool of_have_populated_dt(void) 97static inline bool of_have_populated_dt(void)
97{ 98{
98 return allnodes != NULL; 99 return of_allnodes != NULL;
99} 100}
100 101
101static inline bool of_node_is_root(const struct device_node *node) 102static inline bool of_node_is_root(const struct device_node *node)
@@ -179,11 +180,22 @@ extern struct device_node *of_find_compatible_node(struct device_node *from,
179#define for_each_compatible_node(dn, type, compatible) \ 180#define for_each_compatible_node(dn, type, compatible) \
180 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ 181 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
181 dn = of_find_compatible_node(dn, type, compatible)) 182 dn = of_find_compatible_node(dn, type, compatible))
182extern struct device_node *of_find_matching_node(struct device_node *from, 183extern struct device_node *of_find_matching_node_and_match(
183 const struct of_device_id *matches); 184 struct device_node *from,
185 const struct of_device_id *matches,
186 const struct of_device_id **match);
187static inline struct device_node *of_find_matching_node(
188 struct device_node *from,
189 const struct of_device_id *matches)
190{
191 return of_find_matching_node_and_match(from, matches, NULL);
192}
184#define for_each_matching_node(dn, matches) \ 193#define for_each_matching_node(dn, matches) \
185 for (dn = of_find_matching_node(NULL, matches); dn; \ 194 for (dn = of_find_matching_node(NULL, matches); dn; \
186 dn = of_find_matching_node(dn, matches)) 195 dn = of_find_matching_node(dn, matches))
196#define for_each_matching_node_and_match(dn, matches, match) \
197 for (dn = of_find_matching_node_and_match(NULL, matches, match); \
198 dn; dn = of_find_matching_node_and_match(dn, matches, match))
187extern struct device_node *of_find_node_by_path(const char *path); 199extern struct device_node *of_find_node_by_path(const char *path);
188extern struct device_node *of_find_node_by_phandle(phandle handle); 200extern struct device_node *of_find_node_by_phandle(phandle handle);
189extern struct device_node *of_get_parent(const struct device_node *node); 201extern struct device_node *of_get_parent(const struct device_node *node);
@@ -223,6 +235,10 @@ extern struct device_node *of_find_node_with_property(
223extern struct property *of_find_property(const struct device_node *np, 235extern struct property *of_find_property(const struct device_node *np,
224 const char *name, 236 const char *name,
225 int *lenp); 237 int *lenp);
238extern int of_property_read_u8_array(const struct device_node *np,
239 const char *propname, u8 *out_values, size_t sz);
240extern int of_property_read_u16_array(const struct device_node *np,
241 const char *propname, u16 *out_values, size_t sz);
226extern int of_property_read_u32_array(const struct device_node *np, 242extern int of_property_read_u32_array(const struct device_node *np,
227 const char *propname, 243 const char *propname,
228 u32 *out_values, 244 u32 *out_values,
@@ -255,10 +271,10 @@ extern int of_n_size_cells(struct device_node *np);
255extern const struct of_device_id *of_match_node( 271extern const struct of_device_id *of_match_node(
256 const struct of_device_id *matches, const struct device_node *node); 272 const struct of_device_id *matches, const struct device_node *node);
257extern int of_modalias_node(struct device_node *node, char *modalias, int len); 273extern int of_modalias_node(struct device_node *node, char *modalias, int len);
258extern struct device_node *of_parse_phandle(struct device_node *np, 274extern struct device_node *of_parse_phandle(const struct device_node *np,
259 const char *phandle_name, 275 const char *phandle_name,
260 int index); 276 int index);
261extern int of_parse_phandle_with_args(struct device_node *np, 277extern int of_parse_phandle_with_args(const struct device_node *np,
262 const char *list_name, const char *cells_name, int index, 278 const char *list_name, const char *cells_name, int index,
263 struct of_phandle_args *out_args); 279 struct of_phandle_args *out_args);
264 280
@@ -267,16 +283,28 @@ extern int of_alias_get_id(struct device_node *np, const char *stem);
267 283
268extern int of_machine_is_compatible(const char *compat); 284extern int of_machine_is_compatible(const char *compat);
269 285
270extern int prom_add_property(struct device_node* np, struct property* prop); 286extern int of_add_property(struct device_node *np, struct property *prop);
271extern int prom_remove_property(struct device_node *np, struct property *prop); 287extern int of_remove_property(struct device_node *np, struct property *prop);
272extern int prom_update_property(struct device_node *np, 288extern int of_update_property(struct device_node *np, struct property *newprop);
273 struct property *newprop);
274 289
275#if defined(CONFIG_OF_DYNAMIC)
276/* For updating the device tree at runtime */ 290/* For updating the device tree at runtime */
277extern void of_attach_node(struct device_node *); 291#define OF_RECONFIG_ATTACH_NODE 0x0001
278extern void of_detach_node(struct device_node *); 292#define OF_RECONFIG_DETACH_NODE 0x0002
279#endif 293#define OF_RECONFIG_ADD_PROPERTY 0x0003
294#define OF_RECONFIG_REMOVE_PROPERTY 0x0004
295#define OF_RECONFIG_UPDATE_PROPERTY 0x0005
296
297struct of_prop_reconfig {
298 struct device_node *dn;
299 struct property *prop;
300};
301
302extern int of_reconfig_notifier_register(struct notifier_block *);
303extern int of_reconfig_notifier_unregister(struct notifier_block *);
304extern int of_reconfig_notify(unsigned long, void *);
305
306extern int of_attach_node(struct device_node *);
307extern int of_detach_node(struct device_node *);
280 308
281#define of_match_ptr(_ptr) (_ptr) 309#define of_match_ptr(_ptr) (_ptr)
282 310
@@ -364,6 +392,18 @@ static inline struct device_node *of_find_compatible_node(
364 return NULL; 392 return NULL;
365} 393}
366 394
395static inline int of_property_read_u8_array(const struct device_node *np,
396 const char *propname, u8 *out_values, size_t sz)
397{
398 return -ENOSYS;
399}
400
401static inline int of_property_read_u16_array(const struct device_node *np,
402 const char *propname, u16 *out_values, size_t sz)
403{
404 return -ENOSYS;
405}
406
367static inline int of_property_read_u32_array(const struct device_node *np, 407static inline int of_property_read_u32_array(const struct device_node *np,
368 const char *propname, 408 const char *propname,
369 u32 *out_values, size_t sz) 409 u32 *out_values, size_t sz)
@@ -411,7 +451,7 @@ static inline int of_property_match_string(struct device_node *np,
411 return -ENOSYS; 451 return -ENOSYS;
412} 452}
413 453
414static inline struct device_node *of_parse_phandle(struct device_node *np, 454static inline struct device_node *of_parse_phandle(const struct device_node *np,
415 const char *phandle_name, 455 const char *phandle_name,
416 int index) 456 int index)
417{ 457{
@@ -470,6 +510,20 @@ static inline bool of_property_read_bool(const struct device_node *np,
470 return prop ? true : false; 510 return prop ? true : false;
471} 511}
472 512
513static inline int of_property_read_u8(const struct device_node *np,
514 const char *propname,
515 u8 *out_value)
516{
517 return of_property_read_u8_array(np, propname, out_value, 1);
518}
519
520static inline int of_property_read_u16(const struct device_node *np,
521 const char *propname,
522 u16 *out_value)
523{
524 return of_property_read_u16_array(np, propname, out_value, 1);
525}
526
473static inline int of_property_read_u32(const struct device_node *np, 527static inline int of_property_read_u32(const struct device_node *np,
474 const char *propname, 528 const char *propname,
475 u32 *out_value) 529 u32 *out_value)
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd037da..0506eb53519b 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
28#endif 28#endif
29 29
30#else /* CONFIG_OF_ADDRESS */ 30#else /* CONFIG_OF_ADDRESS */
31#ifndef of_address_to_resource
31static inline int of_address_to_resource(struct device_node *dev, int index, 32static inline int of_address_to_resource(struct device_node *dev, int index,
32 struct resource *r) 33 struct resource *r)
33{ 34{
34 return -EINVAL; 35 return -EINVAL;
35} 36}
37#endif
36static inline struct device_node *of_find_matching_node_by_address( 38static inline struct device_node *of_find_matching_node_by_address(
37 struct device_node *from, 39 struct device_node *from,
38 const struct of_device_id *matches, 40 const struct of_device_id *matches,
@@ -40,10 +42,12 @@ static inline struct device_node *of_find_matching_node_by_address(
40{ 42{
41 return NULL; 43 return NULL;
42} 44}
45#ifndef of_iomap
43static inline void __iomem *of_iomap(struct device_node *device, int index) 46static inline void __iomem *of_iomap(struct device_node *device, int index)
44{ 47{
45 return NULL; 48 return NULL;
46} 49}
50#endif
47static inline const __be32 *of_get_address(struct device_node *dev, int index, 51static inline const __be32 *of_get_address(struct device_node *dev, int index,
48 u64 *size, unsigned int *flags) 52 u64 *size, unsigned int *flags)
49{ 53{
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 1cb775f8e663..cfb545cd86b5 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -29,6 +29,18 @@ static inline void of_i2c_register_devices(struct i2c_adapter *adap)
29{ 29{
30 return; 30 return;
31} 31}
32
33static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
34{
35 return NULL;
36}
37
38/* must call put_device() when done with returned i2c_adapter device */
39static inline struct i2c_adapter *of_find_i2c_adapter_by_node(
40 struct device_node *node)
41{
42 return NULL;
43}
32#endif /* CONFIG_OF_I2C */ 44#endif /* CONFIG_OF_I2C */
33 45
34#endif /* __LINUX_OF_I2C_H */ 46#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index b47d2040c9f2..3863a4dbdf18 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -100,6 +100,7 @@ extern int of_platform_populate(struct device_node *root,
100 100
101#if !defined(CONFIG_OF_ADDRESS) 101#if !defined(CONFIG_OF_ADDRESS)
102struct of_dev_auxdata; 102struct of_dev_auxdata;
103struct device;
103static inline int of_platform_populate(struct device_node *root, 104static inline int of_platform_populate(struct device_node *root,
104 const struct of_device_id *matches, 105 const struct of_device_id *matches,
105 const struct of_dev_auxdata *lookup, 106 const struct of_dev_auxdata *lookup,
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index eb475a8ea25b..7af25a9c9c51 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -19,4 +19,370 @@ static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
19} 19}
20#endif 20#endif
21 21
22/*
23 * Legacy OMAP DMA handling defines and functions
24 *
25 * NOTE: Do not use these any longer.
26 *
27 * Use the generic dmaengine functions as defined in
28 * include/linux/dmaengine.h.
29 *
30 * Copyright (C) 2003 Nokia Corporation
31 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
32 *
33 */
34
35#include <linux/platform_device.h>
36
37#define INT_DMA_LCD 25
38
39#define OMAP1_DMA_TOUT_IRQ (1 << 0)
40#define OMAP_DMA_DROP_IRQ (1 << 1)
41#define OMAP_DMA_HALF_IRQ (1 << 2)
42#define OMAP_DMA_FRAME_IRQ (1 << 3)
43#define OMAP_DMA_LAST_IRQ (1 << 4)
44#define OMAP_DMA_BLOCK_IRQ (1 << 5)
45#define OMAP1_DMA_SYNC_IRQ (1 << 6)
46#define OMAP2_DMA_PKT_IRQ (1 << 7)
47#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8)
48#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9)
49#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
50#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
51
52#define OMAP_DMA_CCR_EN (1 << 7)
53#define OMAP_DMA_CCR_RD_ACTIVE (1 << 9)
54#define OMAP_DMA_CCR_WR_ACTIVE (1 << 10)
55#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24)
56#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25)
57
58#define OMAP_DMA_DATA_TYPE_S8 0x00
59#define OMAP_DMA_DATA_TYPE_S16 0x01
60#define OMAP_DMA_DATA_TYPE_S32 0x02
61
62#define OMAP_DMA_SYNC_ELEMENT 0x00
63#define OMAP_DMA_SYNC_FRAME 0x01
64#define OMAP_DMA_SYNC_BLOCK 0x02
65#define OMAP_DMA_SYNC_PACKET 0x03
66
67#define OMAP_DMA_DST_SYNC_PREFETCH 0x02
68#define OMAP_DMA_SRC_SYNC 0x01
69#define OMAP_DMA_DST_SYNC 0x00
70
71#define OMAP_DMA_PORT_EMIFF 0x00
72#define OMAP_DMA_PORT_EMIFS 0x01
73#define OMAP_DMA_PORT_OCP_T1 0x02
74#define OMAP_DMA_PORT_TIPB 0x03
75#define OMAP_DMA_PORT_OCP_T2 0x04
76#define OMAP_DMA_PORT_MPUI 0x05
77
78#define OMAP_DMA_AMODE_CONSTANT 0x00
79#define OMAP_DMA_AMODE_POST_INC 0x01
80#define OMAP_DMA_AMODE_SINGLE_IDX 0x02
81#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03
82
83#define DMA_DEFAULT_FIFO_DEPTH 0x10
84#define DMA_DEFAULT_ARB_RATE 0x01
85/* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */
86#define DMA_THREAD_RESERVE_NORM (0x00 << 12) /* Def */
87#define DMA_THREAD_RESERVE_ONET (0x01 << 12)
88#define DMA_THREAD_RESERVE_TWOT (0x02 << 12)
89#define DMA_THREAD_RESERVE_THREET (0x03 << 12)
90#define DMA_THREAD_FIFO_NONE (0x00 << 14) /* Def */
91#define DMA_THREAD_FIFO_75 (0x01 << 14)
92#define DMA_THREAD_FIFO_25 (0x02 << 14)
93#define DMA_THREAD_FIFO_50 (0x03 << 14)
94
95/* DMA4_OCP_SYSCONFIG bits */
96#define DMA_SYSCONFIG_MIDLEMODE_MASK (3 << 12)
97#define DMA_SYSCONFIG_CLOCKACTIVITY_MASK (3 << 8)
98#define DMA_SYSCONFIG_EMUFREE (1 << 5)
99#define DMA_SYSCONFIG_SIDLEMODE_MASK (3 << 3)
100#define DMA_SYSCONFIG_SOFTRESET (1 << 2)
101#define DMA_SYSCONFIG_AUTOIDLE (1 << 0)
102
103#define DMA_SYSCONFIG_MIDLEMODE(n) ((n) << 12)
104#define DMA_SYSCONFIG_SIDLEMODE(n) ((n) << 3)
105
106#define DMA_IDLEMODE_SMARTIDLE 0x2
107#define DMA_IDLEMODE_NO_IDLE 0x1
108#define DMA_IDLEMODE_FORCE_IDLE 0x0
109
110/* Chaining modes*/
111#ifndef CONFIG_ARCH_OMAP1
112#define OMAP_DMA_STATIC_CHAIN 0x1
113#define OMAP_DMA_DYNAMIC_CHAIN 0x2
114#define OMAP_DMA_CHAIN_ACTIVE 0x1
115#define OMAP_DMA_CHAIN_INACTIVE 0x0
116#endif
117
118#define DMA_CH_PRIO_HIGH 0x1
119#define DMA_CH_PRIO_LOW 0x0 /* Def */
120
121/* Errata handling */
122#define IS_DMA_ERRATA(id) (errata & (id))
123#define SET_DMA_ERRATA(id) (errata |= (id))
124
125#define DMA_ERRATA_IFRAME_BUFFERING BIT(0x0)
126#define DMA_ERRATA_PARALLEL_CHANNELS BIT(0x1)
127#define DMA_ERRATA_i378 BIT(0x2)
128#define DMA_ERRATA_i541 BIT(0x3)
129#define DMA_ERRATA_i88 BIT(0x4)
130#define DMA_ERRATA_3_3 BIT(0x5)
131#define DMA_ROMCODE_BUG BIT(0x6)
132
133/* Attributes for OMAP DMA Contrller */
134#define DMA_LINKED_LCH BIT(0x0)
135#define GLOBAL_PRIORITY BIT(0x1)
136#define RESERVE_CHANNEL BIT(0x2)
137#define IS_CSSA_32 BIT(0x3)
138#define IS_CDSA_32 BIT(0x4)
139#define IS_RW_PRIORITY BIT(0x5)
140#define ENABLE_1510_MODE BIT(0x6)
141#define SRC_PORT BIT(0x7)
142#define DST_PORT BIT(0x8)
143#define SRC_INDEX BIT(0x9)
144#define DST_INDEX BIT(0xa)
145#define IS_BURST_ONLY4 BIT(0xb)
146#define CLEAR_CSR_ON_READ BIT(0xc)
147#define IS_WORD_16 BIT(0xd)
148#define ENABLE_16XX_MODE BIT(0xe)
149#define HS_CHANNELS_RESERVED BIT(0xf)
150
151/* Defines for DMA Capabilities */
152#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
153#define DMA_HAS_CONSTANT_FILL_CAPS (0x1 << 19)
154#define DMA_HAS_DESCRIPTOR_CAPS (0x3 << 20)
155
156enum omap_reg_offsets {
157
158GCR, GSCR, GRST1, HW_ID,
159PCH2_ID, PCH0_ID, PCH1_ID, PCHG_ID,
160PCHD_ID, CAPS_0, CAPS_1, CAPS_2,
161CAPS_3, CAPS_4, PCH2_SR, PCH0_SR,
162PCH1_SR, PCHD_SR, REVISION, IRQSTATUS_L0,
163IRQSTATUS_L1, IRQSTATUS_L2, IRQSTATUS_L3, IRQENABLE_L0,
164IRQENABLE_L1, IRQENABLE_L2, IRQENABLE_L3, SYSSTATUS,
165OCP_SYSCONFIG,
166
167/* omap1+ specific */
168CPC, CCR2, LCH_CTRL,
169
170/* Common registers for all omap's */
171CSDP, CCR, CICR, CSR,
172CEN, CFN, CSFI, CSEI,
173CSAC, CDAC, CDEI,
174CDFI, CLNK_CTRL,
175
176/* Channel specific registers */
177CSSA, CDSA, COLOR,
178CCEN, CCFN,
179
180/* omap3630 and omap4 specific */
181CDP, CNDP, CCDN,
182
183};
184
185enum omap_dma_burst_mode {
186 OMAP_DMA_DATA_BURST_DIS = 0,
187 OMAP_DMA_DATA_BURST_4,
188 OMAP_DMA_DATA_BURST_8,
189 OMAP_DMA_DATA_BURST_16,
190};
191
192enum end_type {
193 OMAP_DMA_LITTLE_ENDIAN = 0,
194 OMAP_DMA_BIG_ENDIAN
195};
196
197enum omap_dma_color_mode {
198 OMAP_DMA_COLOR_DIS = 0,
199 OMAP_DMA_CONSTANT_FILL,
200 OMAP_DMA_TRANSPARENT_COPY
201};
202
203enum omap_dma_write_mode {
204 OMAP_DMA_WRITE_NON_POSTED = 0,
205 OMAP_DMA_WRITE_POSTED,
206 OMAP_DMA_WRITE_LAST_NON_POSTED
207};
208
209enum omap_dma_channel_mode {
210 OMAP_DMA_LCH_2D = 0,
211 OMAP_DMA_LCH_G,
212 OMAP_DMA_LCH_P,
213 OMAP_DMA_LCH_PD
214};
215
216struct omap_dma_channel_params {
217 int data_type; /* data type 8,16,32 */
218 int elem_count; /* number of elements in a frame */
219 int frame_count; /* number of frames in a element */
220
221 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
222 int src_amode; /* constant, post increment, indexed,
223 double indexed */
224 unsigned long src_start; /* source address : physical */
225 int src_ei; /* source element index */
226 int src_fi; /* source frame index */
227
228 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
229 int dst_amode; /* constant, post increment, indexed,
230 double indexed */
231 unsigned long dst_start; /* source address : physical */
232 int dst_ei; /* source element index */
233 int dst_fi; /* source frame index */
234
235 int trigger; /* trigger attached if the channel is
236 synchronized */
237 int sync_mode; /* sycn on element, frame , block or packet */
238 int src_or_dst_synch; /* source synch(1) or destination synch(0) */
239
240 int ie; /* interrupt enabled */
241
242 unsigned char read_prio;/* read priority */
243 unsigned char write_prio;/* write priority */
244
245#ifndef CONFIG_ARCH_OMAP1
246 enum omap_dma_burst_mode burst_mode; /* Burst mode 4/8/16 words */
247#endif
248};
249
250struct omap_dma_lch {
251 int next_lch;
252 int dev_id;
253 u16 saved_csr;
254 u16 enabled_irqs;
255 const char *dev_name;
256 void (*callback)(int lch, u16 ch_status, void *data);
257 void *data;
258 long flags;
259 /* required for Dynamic chaining */
260 int prev_linked_ch;
261 int next_linked_ch;
262 int state;
263 int chain_id;
264 int status;
265};
266
267struct omap_dma_dev_attr {
268 u32 dev_caps;
269 u16 lch_count;
270 u16 chan_count;
271 struct omap_dma_lch *chan;
272};
273
274/* System DMA platform data structure */
275struct omap_system_dma_plat_info {
276 struct omap_dma_dev_attr *dma_attr;
277 u32 errata;
278 void (*disable_irq_lch)(int lch);
279 void (*show_dma_caps)(void);
280 void (*clear_lch_regs)(int lch);
281 void (*clear_dma)(int lch);
282 void (*dma_write)(u32 val, int reg, int lch);
283 u32 (*dma_read)(int reg, int lch);
284};
285
286#ifdef CONFIG_ARCH_OMAP2PLUS
287#define dma_omap2plus() 1
288#else
289#define dma_omap2plus() 0
22#endif 290#endif
291#define dma_omap1() (!dma_omap2plus())
292#define dma_omap15xx() ((dma_omap1() && (d->dev_caps & ENABLE_1510_MODE)))
293#define dma_omap16xx() ((dma_omap1() && (d->dev_caps & ENABLE_16XX_MODE)))
294
295extern void omap_set_dma_priority(int lch, int dst_port, int priority);
296extern int omap_request_dma(int dev_id, const char *dev_name,
297 void (*callback)(int lch, u16 ch_status, void *data),
298 void *data, int *dma_ch);
299extern void omap_enable_dma_irq(int ch, u16 irq_bits);
300extern void omap_disable_dma_irq(int ch, u16 irq_bits);
301extern void omap_free_dma(int ch);
302extern void omap_start_dma(int lch);
303extern void omap_stop_dma(int lch);
304extern void omap_set_dma_transfer_params(int lch, int data_type,
305 int elem_count, int frame_count,
306 int sync_mode,
307 int dma_trigger, int src_or_dst_synch);
308extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
309 u32 color);
310extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
311extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
312
313extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
314 unsigned long src_start,
315 int src_ei, int src_fi);
316extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
317extern void omap_set_dma_src_data_pack(int lch, int enable);
318extern void omap_set_dma_src_burst_mode(int lch,
319 enum omap_dma_burst_mode burst_mode);
320
321extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
322 unsigned long dest_start,
323 int dst_ei, int dst_fi);
324extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
325extern void omap_set_dma_dest_data_pack(int lch, int enable);
326extern void omap_set_dma_dest_burst_mode(int lch,
327 enum omap_dma_burst_mode burst_mode);
328
329extern void omap_set_dma_params(int lch,
330 struct omap_dma_channel_params *params);
331
332extern void omap_dma_link_lch(int lch_head, int lch_queue);
333extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
334
335extern int omap_set_dma_callback(int lch,
336 void (*callback)(int lch, u16 ch_status, void *data),
337 void *data);
338extern dma_addr_t omap_get_dma_src_pos(int lch);
339extern dma_addr_t omap_get_dma_dst_pos(int lch);
340extern void omap_clear_dma(int lch);
341extern int omap_get_dma_active_status(int lch);
342extern int omap_dma_running(void);
343extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
344 int tparams);
345extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
346 unsigned char write_prio);
347extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
348extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
349extern int omap_get_dma_index(int lch, int *ei, int *fi);
350
351void omap_dma_global_context_save(void);
352void omap_dma_global_context_restore(void);
353
354extern void omap_dma_disable_irq(int lch);
355
356/* Chaining APIs */
357#ifndef CONFIG_ARCH_OMAP1
358extern int omap_request_dma_chain(int dev_id, const char *dev_name,
359 void (*callback) (int lch, u16 ch_status,
360 void *data),
361 int *chain_id, int no_of_chans,
362 int chain_mode,
363 struct omap_dma_channel_params params);
364extern int omap_free_dma_chain(int chain_id);
365extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
366 int dest_start, int elem_count,
367 int frame_count, void *callbk_data);
368extern int omap_start_dma_chain_transfers(int chain_id);
369extern int omap_stop_dma_chain_transfers(int chain_id);
370extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
371extern int omap_get_dma_chain_dst_pos(int chain_id);
372extern int omap_get_dma_chain_src_pos(int chain_id);
373
374extern int omap_modify_dma_chain_params(int chain_id,
375 struct omap_dma_channel_params params);
376extern int omap_dma_chain_status(int chain_id);
377#endif
378
379#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP)
380#include <mach/lcd_dma.h>
381#else
382static inline int omap_lcd_dma_running(void)
383{
384 return 0;
385}
386#endif
387
388#endif /* __LINUX_OMAP_DMA_H */
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
new file mode 100644
index 000000000000..cac78de09c07
--- /dev/null
+++ b/include/linux/omap-iommu.h
@@ -0,0 +1,52 @@
1/*
2 * omap iommu: simple virtual address space management
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _INTEL_IOMMU_H_
14#define _INTEL_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
49extern void omap_iommu_save_ctx(struct device *dev);
50extern void omap_iommu_restore_ctx(struct device *dev);
51
52#endif
diff --git a/include/linux/oom.h b/include/linux/oom.h
index fb9826847b89..da60007075b5 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -29,8 +29,23 @@ enum oom_scan_t {
29 OOM_SCAN_SELECT, /* always select this thread first */ 29 OOM_SCAN_SELECT, /* always select this thread first */
30}; 30};
31 31
32extern void compare_swap_oom_score_adj(int old_val, int new_val); 32/* Thread is the potential origin of an oom condition; kill first on oom */
33extern int test_set_oom_score_adj(int new_val); 33#define OOM_FLAG_ORIGIN ((__force oom_flags_t)0x1)
34
35static inline void set_current_oom_origin(void)
36{
37 current->signal->oom_flags |= OOM_FLAG_ORIGIN;
38}
39
40static inline void clear_current_oom_origin(void)
41{
42 current->signal->oom_flags &= ~OOM_FLAG_ORIGIN;
43}
44
45static inline bool oom_task_origin(const struct task_struct *p)
46{
47 return !!(p->signal->oom_flags & OOM_FLAG_ORIGIN);
48}
34 49
35extern unsigned long oom_badness(struct task_struct *p, 50extern unsigned long oom_badness(struct task_struct *p,
36 struct mem_cgroup *memcg, const nodemask_t *nodemask, 51 struct mem_cgroup *memcg, const nodemask_t *nodemask,
@@ -49,8 +64,6 @@ extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
49extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task, 64extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
50 unsigned long totalpages, const nodemask_t *nodemask, 65 unsigned long totalpages, const nodemask_t *nodemask,
51 bool force_kill); 66 bool force_kill);
52extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
53 int order);
54 67
55extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, 68extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
56 int order, nodemask_t *mask, bool force_kill); 69 int order, nodemask_t *mask, bool force_kill);
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index eb1efa54fe84..d42e174bd0c8 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -243,6 +243,7 @@ enum ovs_key_attr {
243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ 243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
246 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
246 __OVS_KEY_ATTR_MAX 247 __OVS_KEY_ATTR_MAX
247}; 248};
248 249
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5d13841604e..70473da47b3f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -362,7 +362,7 @@ static inline void ClearPageCompound(struct page *page)
362 * pages on the LRU and/or pagecache. 362 * pages on the LRU and/or pagecache.
363 */ 363 */
364TESTPAGEFLAG(Compound, compound) 364TESTPAGEFLAG(Compound, compound)
365__PAGEFLAG(Head, compound) 365__SETPAGEFLAG(Head, compound) __CLEARPAGEFLAG(Head, compound)
366 366
367/* 367/*
368 * PG_reclaim is used in combination with PG_compound to mark the 368 * PG_reclaim is used in combination with PG_compound to mark the
@@ -374,8 +374,14 @@ __PAGEFLAG(Head, compound)
374 * PG_compound & PG_reclaim => Tail page 374 * PG_compound & PG_reclaim => Tail page
375 * PG_compound & ~PG_reclaim => Head page 375 * PG_compound & ~PG_reclaim => Head page
376 */ 376 */
377#define PG_head_mask ((1L << PG_compound))
377#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 378#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
378 379
380static inline int PageHead(struct page *page)
381{
382 return ((page->flags & PG_head_tail_mask) == PG_head_mask);
383}
384
379static inline int PageTail(struct page *page) 385static inline int PageTail(struct page *page)
380{ 386{
381 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask); 387 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 76a9539cfd3f..a92061e08d48 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -2,7 +2,8 @@
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4 4
5bool has_unmovable_pages(struct zone *zone, struct page *page, int count); 5bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
6 bool skip_hwpoisoned_pages);
6void set_pageblock_migratetype(struct page *page, int migratetype); 7void set_pageblock_migratetype(struct page *page, int migratetype);
7int move_freepages_block(struct zone *zone, struct page *page, 8int move_freepages_block(struct zone *zone, struct page *page,
8 int migratetype); 9 int migratetype);
@@ -21,7 +22,7 @@ int move_freepages(struct zone *zone,
21 */ 22 */
22int 23int
23start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, 24start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
24 unsigned migratetype); 25 unsigned migratetype, bool skip_hwpoisoned_pages);
25 26
26/* 27/*
27 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. 28 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
@@ -34,12 +35,13 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
34/* 35/*
35 * Test all pages in [start_pfn, end_pfn) are isolated or not. 36 * Test all pages in [start_pfn, end_pfn) are isolated or not.
36 */ 37 */
37int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn); 38int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
39 bool skip_hwpoisoned_pages);
38 40
39/* 41/*
40 * Internal functions. Changes pageblock's migrate type. 42 * Internal functions. Changes pageblock's migrate type.
41 */ 43 */
42int set_migratetype_isolate(struct page *page); 44int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages);
43void unset_migratetype_isolate(struct page *page, unsigned migratetype); 45void unset_migratetype_isolate(struct page *page, unsigned migratetype);
44struct page *alloc_migrate_target(struct page *page, unsigned long private, 46struct page *alloc_migrate_target(struct page *page, unsigned long private,
45 int **resultp); 47 int **resultp);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e42c762f0dc7..6da609d14c15 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -24,6 +24,7 @@ enum mapping_flags {
24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */
27}; 28};
28 29
29static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -53,6 +54,21 @@ static inline int mapping_unevictable(struct address_space *mapping)
53 return !!mapping; 54 return !!mapping;
54} 55}
55 56
57static inline void mapping_set_balloon(struct address_space *mapping)
58{
59 set_bit(AS_BALLOON_MAP, &mapping->flags);
60}
61
62static inline void mapping_clear_balloon(struct address_space *mapping)
63{
64 clear_bit(AS_BALLOON_MAP, &mapping->flags);
65}
66
67static inline int mapping_balloon(struct address_space *mapping)
68{
69 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
70}
71
56static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 72static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
57{ 73{
58 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; 74 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ee2179546c63..15472d691ee6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -333,6 +333,8 @@ struct pci_dev {
333 }; 333 };
334 struct pci_ats *ats; /* Address Translation Service */ 334 struct pci_ats *ats; /* Address Translation Service */
335#endif 335#endif
336 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
337 size_t romlen; /* Length of ROM if it's not from the BAR */
336}; 338};
337 339
338static inline struct pci_dev *pci_physfn(struct pci_dev *dev) 340static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
@@ -538,6 +540,9 @@ enum pci_ers_result {
538 540
539 /* Device driver is fully recovered and operational */ 541 /* Device driver is fully recovered and operational */
540 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5, 542 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
543
544 /* No AER capabilities registered for the driver */
545 PCI_ERS_RESULT_NO_AER_DRIVER = (__force pci_ers_result_t) 6,
541}; 546};
542 547
543/* PCI bus error event callbacks */ 548/* PCI bus error event callbacks */
@@ -573,6 +578,7 @@ struct pci_driver {
573 int (*resume_early) (struct pci_dev *dev); 578 int (*resume_early) (struct pci_dev *dev);
574 int (*resume) (struct pci_dev *dev); /* Device woken up */ 579 int (*resume) (struct pci_dev *dev); /* Device woken up */
575 void (*shutdown) (struct pci_dev *dev); 580 void (*shutdown) (struct pci_dev *dev);
581 int (*sriov_configure) (struct pci_dev *dev, int num_vfs); /* PF pdev */
576 const struct pci_error_handlers *err_handler; 582 const struct pci_error_handlers *err_handler;
577 struct device_driver driver; 583 struct device_driver driver;
578 struct pci_dynids dynids; 584 struct pci_dynids dynids;
@@ -588,7 +594,7 @@ struct pci_driver {
588 * in a generic manner. 594 * in a generic manner.
589 */ 595 */
590#define DEFINE_PCI_DEVICE_TABLE(_table) \ 596#define DEFINE_PCI_DEVICE_TABLE(_table) \
591 const struct pci_device_id _table[] __devinitconst 597 const struct pci_device_id _table[]
592 598
593/** 599/**
594 * PCI_DEVICE - macro used to describe a specific pci device 600 * PCI_DEVICE - macro used to describe a specific pci device
@@ -604,6 +610,20 @@ struct pci_driver {
604 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 610 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
605 611
606/** 612/**
613 * PCI_DEVICE_SUB - macro used to describe a specific pci device with subsystem
614 * @vend: the 16 bit PCI Vendor ID
615 * @dev: the 16 bit PCI Device ID
616 * @subvend: the 16 bit PCI Subvendor ID
617 * @subdev: the 16 bit PCI Subdevice ID
618 *
619 * This macro is used to create a struct pci_device_id that matches a
620 * specific device with subsystem information.
621 */
622#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \
623 .vendor = (vend), .device = (dev), \
624 .subvendor = (subvend), .subdevice = (subdev)
625
626/**
607 * PCI_DEVICE_CLASS - macro used to describe a specific pci device class 627 * PCI_DEVICE_CLASS - macro used to describe a specific pci device class
608 * @dev_class: the class, subclass, prog-if triple for this device 628 * @dev_class: the class, subclass, prog-if triple for this device
609 * @dev_class_mask: the class mask for this device 629 * @dev_class_mask: the class mask for this device
@@ -686,7 +706,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
686int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); 706int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
687int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); 707int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
688void pci_bus_release_busn_res(struct pci_bus *b); 708void pci_bus_release_busn_res(struct pci_bus *b);
689struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, 709struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
690 struct pci_ops *ops, void *sysdata, 710 struct pci_ops *ops, void *sysdata,
691 struct list_head *resources); 711 struct list_head *resources);
692struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 712struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
@@ -712,6 +732,8 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
712extern void pci_dev_put(struct pci_dev *dev); 732extern void pci_dev_put(struct pci_dev *dev);
713extern void pci_remove_bus(struct pci_bus *b); 733extern void pci_remove_bus(struct pci_bus *b);
714extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); 734extern void pci_stop_and_remove_bus_device(struct pci_dev *dev);
735void pci_stop_root_bus(struct pci_bus *bus);
736void pci_remove_root_bus(struct pci_bus *bus);
715void pci_setup_cardbus(struct pci_bus *bus); 737void pci_setup_cardbus(struct pci_bus *bus);
716extern void pci_sort_breadthfirst(void); 738extern void pci_sort_breadthfirst(void);
717#define dev_is_pci(d) ((d)->bus == &pci_bus_type) 739#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
@@ -941,10 +963,8 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev);
941 963
942/* Functions for PCI Hotplug drivers to use */ 964/* Functions for PCI Hotplug drivers to use */
943int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 965int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
944#ifdef CONFIG_HOTPLUG
945unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); 966unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
946unsigned int pci_rescan_bus(struct pci_bus *bus); 967unsigned int pci_rescan_bus(struct pci_bus *bus);
947#endif
948 968
949/* Vital product data routines */ 969/* Vital product data routines */
950ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 970ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
@@ -958,6 +978,7 @@ void pci_bus_size_bridges(struct pci_bus *bus);
958int pci_claim_resource(struct pci_dev *, int); 978int pci_claim_resource(struct pci_dev *, int);
959void pci_assign_unassigned_resources(void); 979void pci_assign_unassigned_resources(void);
960void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 980void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
981void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
961void pdev_enable_device(struct pci_dev *); 982void pdev_enable_device(struct pci_dev *);
962int pci_enable_resources(struct pci_dev *, int mask); 983int pci_enable_resources(struct pci_dev *, int mask);
963void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 984void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
@@ -1580,7 +1601,7 @@ extern int pci_pci_problems;
1580 1601
1581extern unsigned long pci_cardbus_io_size; 1602extern unsigned long pci_cardbus_io_size;
1582extern unsigned long pci_cardbus_mem_size; 1603extern unsigned long pci_cardbus_mem_size;
1583extern u8 __devinitdata pci_dfl_cache_line_size; 1604extern u8 pci_dfl_cache_line_size;
1584extern u8 pci_cache_line_size; 1605extern u8 pci_cache_line_size;
1585 1606
1586extern unsigned long pci_hotplug_io_size; 1607extern unsigned long pci_hotplug_io_size;
@@ -1592,6 +1613,7 @@ void pcibios_disable_device(struct pci_dev *dev);
1592void pcibios_set_master(struct pci_dev *dev); 1613void pcibios_set_master(struct pci_dev *dev);
1593int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1614int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1594 enum pcie_reset_state state); 1615 enum pcie_reset_state state);
1616int pcibios_add_device(struct pci_dev *dev);
1595 1617
1596#ifdef CONFIG_PCI_MMCONFIG 1618#ifdef CONFIG_PCI_MMCONFIG
1597extern void __init pci_mmcfg_early_init(void); 1619extern void __init pci_mmcfg_early_init(void);
@@ -1601,7 +1623,7 @@ static inline void pci_mmcfg_early_init(void) { }
1601static inline void pci_mmcfg_late_init(void) { } 1623static inline void pci_mmcfg_late_init(void) { }
1602#endif 1624#endif
1603 1625
1604int pci_ext_cfg_avail(struct pci_dev *dev); 1626int pci_ext_cfg_avail(void);
1605 1627
1606void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1628void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1607 1629
@@ -1610,6 +1632,8 @@ extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1610extern void pci_disable_sriov(struct pci_dev *dev); 1632extern void pci_disable_sriov(struct pci_dev *dev);
1611extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1633extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1612extern int pci_num_vf(struct pci_dev *dev); 1634extern int pci_num_vf(struct pci_dev *dev);
1635extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1636extern int pci_sriov_get_totalvfs(struct pci_dev *dev);
1613#else 1637#else
1614static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1638static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1615{ 1639{
@@ -1626,6 +1650,14 @@ static inline int pci_num_vf(struct pci_dev *dev)
1626{ 1650{
1627 return 0; 1651 return 0;
1628} 1652}
1653static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1654{
1655 return 0;
1656}
1657static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1658{
1659 return 0;
1660}
1629#endif 1661#endif
1630 1662
1631#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1663#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9d36b829533a..0eb65796bcb9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1568,6 +1568,7 @@
1568#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1568#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1569#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1569#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1570#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 1570#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
1571#define PCI_DEVICE_ID_RICOH_R5CE822 0xe822
1571#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 1572#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823
1572#define PCI_DEVICE_ID_RICOH_R5C832 0x0832 1573#define PCI_DEVICE_ID_RICOH_R5C832 0x0832
1573#define PCI_DEVICE_ID_RICOH_R5C843 0x0843 1574#define PCI_DEVICE_ID_RICOH_R5C843 0x0843
@@ -1985,6 +1986,9 @@
1985#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 1986#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152
1986#define PCI_DEVICE_ID_EXAR_XR17C154 0x0154 1987#define PCI_DEVICE_ID_EXAR_XR17C154 0x0154
1987#define PCI_DEVICE_ID_EXAR_XR17C158 0x0158 1988#define PCI_DEVICE_ID_EXAR_XR17C158 0x0158
1989#define PCI_DEVICE_ID_EXAR_XR17V352 0x0352
1990#define PCI_DEVICE_ID_EXAR_XR17V354 0x0354
1991#define PCI_DEVICE_ID_EXAR_XR17V358 0x0358
1988 1992
1989#define PCI_VENDOR_ID_MICROGATE 0x13c0 1993#define PCI_VENDOR_ID_MICROGATE 0x13c0
1990#define PCI_DEVICE_ID_MICROGATE_USC 0x0010 1994#define PCI_DEVICE_ID_MICROGATE_USC 0x0010
@@ -2323,6 +2327,8 @@
2323 2327
2324#define PCI_VENDOR_ID_TOPSPIN 0x1867 2328#define PCI_VENDOR_ID_TOPSPIN 0x1867
2325 2329
2330#define PCI_VENDOR_ID_COMMTECH 0x18f7
2331
2326#define PCI_VENDOR_ID_SILAN 0x1904 2332#define PCI_VENDOR_ID_SILAN 0x1904
2327 2333
2328#define PCI_VENDOR_ID_RENESAS 0x1912 2334#define PCI_VENDOR_ID_RENESAS 0x1912
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index 250a4acddb2b..3e88c9a7d57f 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -1,83 +1,34 @@
1#ifndef _LINUX_PERCPU_RWSEM_H 1#ifndef _LINUX_PERCPU_RWSEM_H
2#define _LINUX_PERCPU_RWSEM_H 2#define _LINUX_PERCPU_RWSEM_H
3 3
4#include <linux/mutex.h> 4#include <linux/atomic.h>
5#include <linux/rwsem.h>
5#include <linux/percpu.h> 6#include <linux/percpu.h>
6#include <linux/rcupdate.h> 7#include <linux/wait.h>
7#include <linux/delay.h> 8#include <linux/lockdep.h>
8 9
9struct percpu_rw_semaphore { 10struct percpu_rw_semaphore {
10 unsigned __percpu *counters; 11 unsigned int __percpu *fast_read_ctr;
11 bool locked; 12 atomic_t write_ctr;
12 struct mutex mtx; 13 struct rw_semaphore rw_sem;
14 atomic_t slow_read_ctr;
15 wait_queue_head_t write_waitq;
13}; 16};
14 17
15#define light_mb() barrier() 18extern void percpu_down_read(struct percpu_rw_semaphore *);
16#define heavy_mb() synchronize_sched() 19extern void percpu_up_read(struct percpu_rw_semaphore *);
17 20
18static inline void percpu_down_read(struct percpu_rw_semaphore *p) 21extern void percpu_down_write(struct percpu_rw_semaphore *);
19{ 22extern void percpu_up_write(struct percpu_rw_semaphore *);
20 rcu_read_lock_sched();
21 if (unlikely(p->locked)) {
22 rcu_read_unlock_sched();
23 mutex_lock(&p->mtx);
24 this_cpu_inc(*p->counters);
25 mutex_unlock(&p->mtx);
26 return;
27 }
28 this_cpu_inc(*p->counters);
29 rcu_read_unlock_sched();
30 light_mb(); /* A, between read of p->locked and read of data, paired with D */
31}
32 23
33static inline void percpu_up_read(struct percpu_rw_semaphore *p) 24extern int __percpu_init_rwsem(struct percpu_rw_semaphore *,
34{ 25 const char *, struct lock_class_key *);
35 light_mb(); /* B, between read of the data and write to p->counter, paired with C */ 26extern void percpu_free_rwsem(struct percpu_rw_semaphore *);
36 this_cpu_dec(*p->counters);
37}
38 27
39static inline unsigned __percpu_count(unsigned __percpu *counters) 28#define percpu_init_rwsem(brw) \
40{ 29({ \
41 unsigned total = 0; 30 static struct lock_class_key rwsem_key; \
42 int cpu; 31 __percpu_init_rwsem(brw, #brw, &rwsem_key); \
43 32})
44 for_each_possible_cpu(cpu)
45 total += ACCESS_ONCE(*per_cpu_ptr(counters, cpu));
46
47 return total;
48}
49
50static inline void percpu_down_write(struct percpu_rw_semaphore *p)
51{
52 mutex_lock(&p->mtx);
53 p->locked = true;
54 synchronize_sched(); /* make sure that all readers exit the rcu_read_lock_sched region */
55 while (__percpu_count(p->counters))
56 msleep(1);
57 heavy_mb(); /* C, between read of p->counter and write to data, paired with B */
58}
59
60static inline void percpu_up_write(struct percpu_rw_semaphore *p)
61{
62 heavy_mb(); /* D, between write to data and write to p->locked, paired with A */
63 p->locked = false;
64 mutex_unlock(&p->mtx);
65}
66
67static inline int percpu_init_rwsem(struct percpu_rw_semaphore *p)
68{
69 p->counters = alloc_percpu(unsigned);
70 if (unlikely(!p->counters))
71 return -ENOMEM;
72 p->locked = false;
73 mutex_init(&p->mtx);
74 return 0;
75}
76
77static inline void percpu_free_rwsem(struct percpu_rw_semaphore *p)
78{
79 free_percpu(p->counters);
80 p->counters = NULL; /* catch use after free bugs */
81}
82 33
83#endif 34#endif
diff --git a/include/linux/pid.h b/include/linux/pid.h
index b152d44fb181..2381c973d897 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -121,6 +121,7 @@ int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
121 121
122extern struct pid *alloc_pid(struct pid_namespace *ns); 122extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
124extern void disable_pid_allocation(struct pid_namespace *ns);
124 125
125/* 126/*
126 * ns_of_pid() returns the pid namespace in which the specified pid was 127 * ns_of_pid() returns the pid namespace in which the specified pid was
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 65e3e87eacc5..215e5e3dda10 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -21,6 +21,7 @@ struct pid_namespace {
21 struct kref kref; 21 struct kref kref;
22 struct pidmap pidmap[PIDMAP_ENTRIES]; 22 struct pidmap pidmap[PIDMAP_ENTRIES];
23 int last_pid; 23 int last_pid;
24 unsigned int nr_hashed;
24 struct task_struct *child_reaper; 25 struct task_struct *child_reaper;
25 struct kmem_cache *pid_cachep; 26 struct kmem_cache *pid_cachep;
26 unsigned int level; 27 unsigned int level;
@@ -31,13 +32,18 @@ struct pid_namespace {
31#ifdef CONFIG_BSD_PROCESS_ACCT 32#ifdef CONFIG_BSD_PROCESS_ACCT
32 struct bsd_acct_struct *bacct; 33 struct bsd_acct_struct *bacct;
33#endif 34#endif
35 struct user_namespace *user_ns;
36 struct work_struct proc_work;
34 kgid_t pid_gid; 37 kgid_t pid_gid;
35 int hide_pid; 38 int hide_pid;
36 int reboot; /* group exit code if this pidns was rebooted */ 39 int reboot; /* group exit code if this pidns was rebooted */
40 unsigned int proc_inum;
37}; 41};
38 42
39extern struct pid_namespace init_pid_ns; 43extern struct pid_namespace init_pid_ns;
40 44
45#define PIDNS_HASH_ADDING (1U << 31)
46
41#ifdef CONFIG_PID_NS 47#ifdef CONFIG_PID_NS
42static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) 48static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
43{ 49{
@@ -46,7 +52,8 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
46 return ns; 52 return ns;
47} 53}
48 54
49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 55extern struct pid_namespace *copy_pid_ns(unsigned long flags,
56 struct user_namespace *user_ns, struct pid_namespace *ns);
50extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); 57extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
51extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); 58extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
52extern void put_pid_ns(struct pid_namespace *ns); 59extern void put_pid_ns(struct pid_namespace *ns);
@@ -59,8 +66,8 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
59 return ns; 66 return ns;
60} 67}
61 68
62static inline struct pid_namespace * 69static inline struct pid_namespace *copy_pid_ns(unsigned long flags,
63copy_pid_ns(unsigned long flags, struct pid_namespace *ns) 70 struct user_namespace *user_ns, struct pid_namespace *ns)
64{ 71{
65 if (flags & CLONE_NEWPID) 72 if (flags & CLONE_NEWPID)
66 ns = ERR_PTR(-EINVAL); 73 ns = ERR_PTR(-EINVAL);
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 4f0abb9f1c09..47a1bdd88878 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -46,11 +46,11 @@
46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
47 * (open emitter). Sending this config will enabale open drain mode, the 47 * (open emitter). Sending this config will enabale open drain mode, the
48 * argument is ignored. 48 * argument is ignored.
49 * @PIN_CONFIG_INPUT_SCHMITT_DISABLE: disable schmitt-trigger mode on the pin.
49 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in 50 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
50 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, 51 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
51 * the threshold value is given on a custom format as argument when 52 * the threshold value is given on a custom format as argument when
52 * setting pins to this mode. The argument zero turns the schmitt trigger 53 * setting pins to this mode.
53 * off.
54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, 54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
55 * which means it will wait for signals to settle when reading inputs. The 55 * which means it will wait for signals to settle when reading inputs. The
56 * argument gives the debounce time on a custom format. Setting the 56 * argument gives the debounce time on a custom format. Setting the
@@ -74,6 +74,7 @@ enum pin_config_param {
74 PIN_CONFIG_DRIVE_PUSH_PULL, 74 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN, 75 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE, 76 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT_DISABLE,
77 PIN_CONFIG_INPUT_SCHMITT, 78 PIN_CONFIG_INPUT_SCHMITT,
78 PIN_CONFIG_INPUT_DEBOUNCE, 79 PIN_CONFIG_INPUT_DEBOUNCE,
79 PIN_CONFIG_POWER_SOURCE, 80 PIN_CONFIG_POWER_SOURCE,
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 7d087f03e91e..04d6700d99af 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -134,6 +134,25 @@ extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev,
134extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev, 134extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev,
135 struct pinctrl_gpio_range *ranges, 135 struct pinctrl_gpio_range *ranges,
136 unsigned nranges); 136 unsigned nranges);
137extern void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
138 struct pinctrl_gpio_range *range);
139
140extern struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
141 struct pinctrl_gpio_range *range);
142extern struct pinctrl_gpio_range *
143pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
144 unsigned int pin);
145
146#ifdef CONFIG_OF
147extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
148#else
149static inline
150struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
151{
152 return NULL;
153}
154#endif /* CONFIG_OF */
155
137extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); 156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);
138extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); 157extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
139#else 158#else
diff --git a/include/linux/platform_data/ad5449.h b/include/linux/platform_data/ad5449.h
new file mode 100644
index 000000000000..bd712bd4b94e
--- /dev/null
+++ b/include/linux/platform_data/ad5449.h
@@ -0,0 +1,40 @@
1/*
2 * AD5415, AD5426, AD5429, AD5432, AD5439, AD5443, AD5449 Digital to Analog
3 * Converter driver.
4 *
5 * Copyright 2012 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef __LINUX_PLATFORM_DATA_AD5449_H__
12#define __LINUX_PLATFORM_DATA_AD5449_H__
13
14/**
15 * enum ad5449_sdo_mode - AD5449 SDO pin configuration
16 * @AD5449_SDO_DRIVE_FULL: Drive the SDO pin with full strength.
17 * @AD5449_SDO_DRIVE_WEAK: Drive the SDO pin with not full strength.
18 * @AD5449_SDO_OPEN_DRAIN: Operate the SDO pin in open-drain mode.
19 * @AD5449_SDO_DISABLED: Disable the SDO pin, in this mode it is not possible to
20 * read back from the device.
21 */
22enum ad5449_sdo_mode {
23 AD5449_SDO_DRIVE_FULL = 0x0,
24 AD5449_SDO_DRIVE_WEAK = 0x1,
25 AD5449_SDO_OPEN_DRAIN = 0x2,
26 AD5449_SDO_DISABLED = 0x3,
27};
28
29/**
30 * struct ad5449_platform_data - Platform data for the ad5449 DAC driver
31 * @sdo_mode: SDO pin mode
32 * @hardware_clear_to_midscale: Whether asserting the hardware CLR pin sets the
33 * outputs to midscale (true) or to zero scale(false).
34 */
35struct ad5449_platform_data {
36 enum ad5449_sdo_mode sdo_mode;
37 bool hardware_clear_to_midscale;
38};
39
40#endif
diff --git a/include/linux/platform_data/ad7298.h b/include/linux/platform_data/ad7298.h
new file mode 100644
index 000000000000..fbf8adf1363a
--- /dev/null
+++ b/include/linux/platform_data/ad7298.h
@@ -0,0 +1,20 @@
1/*
2 * AD7298 SPI ADC driver
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8
9#ifndef __LINUX_PLATFORM_DATA_AD7298_H__
10#define __LINUX_PLATFORM_DATA_AD7298_H__
11
12/**
13 * struct ad7298_platform_data - Platform data for the ad7298 ADC driver
14 * @ext_ref: Whether to use an external reference voltage.
15 **/
16struct ad7298_platform_data {
17 bool ext_ref;
18};
19
20#endif /* IIO_ADC_AD7298_H_ */
diff --git a/include/linux/platform_data/ad7793.h b/include/linux/platform_data/ad7793.h
new file mode 100644
index 000000000000..7ea6751aae6d
--- /dev/null
+++ b/include/linux/platform_data/ad7793.h
@@ -0,0 +1,112 @@
1/*
2 * AD7792/AD7793 SPI ADC driver
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8#ifndef __LINUX_PLATFORM_DATA_AD7793_H__
9#define __LINUX_PLATFORM_DATA_AD7793_H__
10
11/**
12 * enum ad7793_clock_source - AD7793 clock source selection
13 * @AD7793_CLK_SRC_INT: Internal 64 kHz clock, not available at the CLK pin.
14 * @AD7793_CLK_SRC_INT_CO: Internal 64 kHz clock, available at the CLK pin.
15 * @AD7793_CLK_SRC_EXT: Use external clock.
16 * @AD7793_CLK_SRC_EXT_DIV2: Use external clock divided by 2.
17 */
18enum ad7793_clock_source {
19 AD7793_CLK_SRC_INT,
20 AD7793_CLK_SRC_INT_CO,
21 AD7793_CLK_SRC_EXT,
22 AD7793_CLK_SRC_EXT_DIV2,
23};
24
25/**
26 * enum ad7793_bias_voltage - AD7793 bias voltage selection
27 * @AD7793_BIAS_VOLTAGE_DISABLED: Bias voltage generator disabled
28 * @AD7793_BIAS_VOLTAGE_AIN1: Bias voltage connected to AIN1(-).
29 * @AD7793_BIAS_VOLTAGE_AIN2: Bias voltage connected to AIN2(-).
30 * @AD7793_BIAS_VOLTAGE_AIN3: Bias voltage connected to AIN3(-).
31 * Only valid for AD7795/AD7796.
32 */
33enum ad7793_bias_voltage {
34 AD7793_BIAS_VOLTAGE_DISABLED,
35 AD7793_BIAS_VOLTAGE_AIN1,
36 AD7793_BIAS_VOLTAGE_AIN2,
37 AD7793_BIAS_VOLTAGE_AIN3,
38};
39
40/**
41 * enum ad7793_refsel - AD7793 reference voltage selection
42 * @AD7793_REFSEL_REFIN1: External reference applied between REFIN1(+)
43 * and REFIN1(-).
44 * @AD7793_REFSEL_REFIN2: External reference applied between REFIN2(+) and
45 * and REFIN1(-). Only valid for AD7795/AD7796.
46 * @AD7793_REFSEL_INTERNAL: Internal 1.17 V reference.
47 */
48enum ad7793_refsel {
49 AD7793_REFSEL_REFIN1 = 0,
50 AD7793_REFSEL_REFIN2 = 1,
51 AD7793_REFSEL_INTERNAL = 2,
52};
53
54/**
55 * enum ad7793_current_source_direction - AD7793 excitation current direction
56 * @AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2: Current source IEXC1 connected to pin
57 * IOUT1, current source IEXC2 connected to pin IOUT2.
58 * @AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1: Current source IEXC2 connected to pin
59 * IOUT1, current source IEXC1 connected to pin IOUT2.
60 * @AD7793_IEXEC1_IEXEC2_IOUT1: Both current sources connected to pin IOUT1.
61 * Only valid when the current sources are set to 10 uA or 210 uA.
62 * @AD7793_IEXEC1_IEXEC2_IOUT2: Both current sources connected to Pin IOUT2.
63 * Only valid when the current ources are set to 10 uA or 210 uA.
64 */
65enum ad7793_current_source_direction {
66 AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2 = 0,
67 AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1 = 1,
68 AD7793_IEXEC1_IEXEC2_IOUT1 = 2,
69 AD7793_IEXEC1_IEXEC2_IOUT2 = 3,
70};
71
72/**
73 * enum ad7793_excitation_current - AD7793 excitation current selection
74 * @AD7793_IX_DISABLED: Excitation current Disabled.
75 * @AD7793_IX_10uA: Enable 10 micro-ampere excitation current.
76 * @AD7793_IX_210uA: Enable 210 micro-ampere excitation current.
77 * @AD7793_IX_1mA: Enable 1 milli-Ampere excitation current.
78 */
79enum ad7793_excitation_current {
80 AD7793_IX_DISABLED = 0,
81 AD7793_IX_10uA = 1,
82 AD7793_IX_210uA = 2,
83 AD7793_IX_1mA = 3,
84};
85
86/**
87 * struct ad7793_platform_data - AD7793 platform data
88 * @clock_src: Clock source selection
89 * @burnout_current: If set to true the 100nA burnout current is enabled.
90 * @boost_enable: Enable boost for the bias voltage generator.
91 * @buffered: If set to true configure the device for buffered input mode.
92 * @unipolar: If set to true sample in unipolar mode, if set to false sample in
93 * bipolar mode.
94 * @refsel: Reference voltage selection
95 * @bias_voltage: Bias voltage selection
96 * @exitation_current: Excitation current selection
97 * @current_source_direction: Excitation current direction selection
98 */
99struct ad7793_platform_data {
100 enum ad7793_clock_source clock_src;
101 bool burnout_current;
102 bool boost_enable;
103 bool buffered;
104 bool unipolar;
105
106 enum ad7793_refsel refsel;
107 enum ad7793_bias_voltage bias_voltage;
108 enum ad7793_excitation_current exitation_current;
109 enum ad7793_current_source_direction current_source_direction;
110};
111
112#endif /* IIO_ADC_AD7793_H_ */
diff --git a/include/linux/platform_data/ad7887.h b/include/linux/platform_data/ad7887.h
new file mode 100644
index 000000000000..1e06eac3174d
--- /dev/null
+++ b/include/linux/platform_data/ad7887.h
@@ -0,0 +1,26 @@
1/*
2 * AD7887 SPI ADC driver
3 *
4 * Copyright 2010 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8#ifndef IIO_ADC_AD7887_H_
9#define IIO_ADC_AD7887_H_
10
11/**
12 * struct ad7887_platform_data - AD7887 ADC driver platform data
13 * @en_dual: Whether to use dual channel mode. If set to true AIN1 becomes the
14 * second input channel, and Vref is internally connected to Vdd. If set to
15 * false the device is used in single channel mode and AIN1/Vref is used as
16 * VREF input.
17 * @use_onchip_ref: Whether to use the onchip reference. If set to true the
18 * internal 2.5V reference is used. If set to false a external reference is
19 * used.
20 */
21struct ad7887_platform_data {
22 bool en_dual;
23 bool use_onchip_ref;
24};
25
26#endif /* IIO_ADC_AD7887_H_ */
diff --git a/include/linux/platform_data/ads7828.h b/include/linux/platform_data/ads7828.h
new file mode 100644
index 000000000000..3245f45f9d77
--- /dev/null
+++ b/include/linux/platform_data/ads7828.h
@@ -0,0 +1,29 @@
1/*
2 * TI ADS7828 A/D Converter platform data definition
3 *
4 * Copyright (c) 2012 Savoir-faire Linux Inc.
5 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
6 *
7 * For further information, see the Documentation/hwmon/ads7828 file.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef _PDATA_ADS7828_H
15#define _PDATA_ADS7828_H
16
17/**
18 * struct ads7828_platform_data - optional ADS7828 connectivity info
19 * @diff_input: Differential input mode.
20 * @ext_vref: Use an external voltage reference.
21 * @vref_mv: Voltage reference value, if external.
22 */
23struct ads7828_platform_data {
24 bool diff_input;
25 bool ext_vref;
26 unsigned int vref_mv;
27};
28
29#endif /* _PDATA_ADS7828_H */
diff --git a/include/linux/platform_data/asoc-imx-ssi.h b/include/linux/platform_data/asoc-imx-ssi.h
index 63f3c2804239..92c7fd72f636 100644
--- a/include/linux/platform_data/asoc-imx-ssi.h
+++ b/include/linux/platform_data/asoc-imx-ssi.h
@@ -17,5 +17,7 @@ struct imx_ssi_platform_data {
17 void (*ac97_warm_reset)(struct snd_ac97 *ac97); 17 void (*ac97_warm_reset)(struct snd_ac97 *ac97);
18}; 18};
19 19
20extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
21
20#endif /* __MACH_SSI_H */ 22#endif /* __MACH_SSI_H */
21 23
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index aa9875f77c40..88272591a895 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -38,12 +38,6 @@ struct samsung_i2s {
38#define QUIRK_NEED_RSTCLR (1 << 3) 38#define QUIRK_NEED_RSTCLR (1 << 3)
39 /* Quirks of the I2S controller */ 39 /* Quirks of the I2S controller */
40 u32 quirks; 40 u32 quirks;
41
42 /*
43 * Array of clock names that can be used to generate I2S signals.
44 * Also corresponds to clocks of I2SMOD[10]
45 */
46 const char **src_clk;
47 dma_addr_t idma_addr; 41 dma_addr_t idma_addr;
48}; 42};
49 43
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index b0f2c56a8ea2..6a293b7fff3b 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -8,6 +8,55 @@
8#define __ATMEL_H__ 8#define __ATMEL_H__
9 9
10#include <linux/mtd/nand.h> 10#include <linux/mtd/nand.h>
11#include <linux/mtd/partitions.h>
12#include <linux/device.h>
13#include <linux/i2c.h>
14#include <linux/leds.h>
15#include <linux/spi/spi.h>
16#include <linux/usb/atmel_usba_udc.h>
17#include <linux/atmel-mci.h>
18#include <sound/atmel-ac97c.h>
19#include <linux/serial.h>
20#include <linux/platform_data/macb.h>
21
22/*
23 * at91: 6 USARTs and one DBGU port (SAM9260)
24 * avr32: 4
25 */
26#define ATMEL_MAX_UART 7
27
28 /* USB Device */
29struct at91_udc_data {
30 int vbus_pin; /* high == host powering us */
31 u8 vbus_active_low; /* vbus polarity */
32 u8 vbus_polled; /* Use polling, not interrupt */
33 int pullup_pin; /* active == D+ pulled up */
34 u8 pullup_active_low; /* true == pullup_pin is active low */
35};
36
37 /* Compact Flash */
38struct at91_cf_data {
39 int irq_pin; /* I/O IRQ */
40 int det_pin; /* Card detect */
41 int vcc_pin; /* power switching */
42 int rst_pin; /* card reset */
43 u8 chipselect; /* EBI Chip Select number */
44 u8 flags;
45#define AT91_CF_TRUE_IDE 0x01
46#define AT91_IDE_SWAP_A0_A2 0x02
47};
48
49 /* USB Host */
50#define AT91_MAX_USBH_PORTS 3
51struct at91_usbh_data {
52 int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
53 int overcurrent_pin[AT91_MAX_USBH_PORTS];
54 u8 ports; /* number of ports on root hub */
55 u8 overcurrent_supported;
56 u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
57 u8 overcurrent_status[AT91_MAX_USBH_PORTS];
58 u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
59};
11 60
12 /* NAND / SmartMedia */ 61 /* NAND / SmartMedia */
13struct atmel_nand_data { 62struct atmel_nand_data {
@@ -24,4 +73,28 @@ struct atmel_nand_data {
24 unsigned int num_parts; 73 unsigned int num_parts;
25}; 74};
26 75
76 /* Serial */
77struct atmel_uart_data {
78 int num; /* port num */
79 short use_dma_tx; /* use transmit DMA? */
80 short use_dma_rx; /* use receive DMA? */
81 void __iomem *regs; /* virt. base address, if any */
82 struct serial_rs485 rs485; /* rs485 settings */
83};
84
85 /* Touchscreen Controller */
86struct at91_tsadcc_data {
87 unsigned int adc_clock;
88 u8 pendet_debounce;
89 u8 ts_sample_hold_time;
90};
91
92/* CAN */
93struct at91_can_data {
94 void (*transceiver_switch)(int on);
95};
96
97/* FIXME: this needs a better location, but gets stuff building again */
98extern int at91_suspend_entering_slow_clock(void);
99
27#endif /* __ATMEL_H__ */ 100#endif /* __ATMEL_H__ */
diff --git a/include/linux/platform_data/clk-integrator.h b/include/linux/platform_data/clk-integrator.h
index 83fe9c283bb8..280edac9d0a5 100644
--- a/include/linux/platform_data/clk-integrator.h
+++ b/include/linux/platform_data/clk-integrator.h
@@ -1 +1,3 @@
1void integrator_clk_init(bool is_cp); 1void integrator_clk_init(bool is_cp);
2void integrator_impd1_clk_init(void __iomem *base, unsigned int id);
3void integrator_impd1_clk_exit(unsigned int id);
diff --git a/include/linux/platform_data/clocksource-nomadik-mtu.h b/include/linux/platform_data/clocksource-nomadik-mtu.h
new file mode 100644
index 000000000000..80088973b734
--- /dev/null
+++ b/include/linux/platform_data/clocksource-nomadik-mtu.h
@@ -0,0 +1,9 @@
1#ifndef __PLAT_MTU_H
2#define __PLAT_MTU_H
3
4void nmdk_timer_init(void __iomem *base, int irq);
5void nmdk_clkevt_reset(void);
6void nmdk_clksrc_reset(void);
7
8#endif /* __PLAT_MTU_H */
9
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
index c4e23d029498..24368a2e8b87 100644
--- a/include/linux/platform_data/cpsw.h
+++ b/include/linux/platform_data/cpsw.h
@@ -18,9 +18,7 @@
18#include <linux/if_ether.h> 18#include <linux/if_ether.h>
19 19
20struct cpsw_slave_data { 20struct cpsw_slave_data {
21 u32 slave_reg_ofs; 21 char phy_id[MII_BUS_ID_SIZE];
22 u32 sliver_reg_ofs;
23 const char *phy_id;
24 int phy_if; 22 int phy_if;
25 u8 mac_addr[ETH_ALEN]; 23 u8 mac_addr[ETH_ALEN];
26}; 24};
@@ -28,27 +26,14 @@ struct cpsw_slave_data {
28struct cpsw_platform_data { 26struct cpsw_platform_data {
29 u32 ss_reg_ofs; /* Subsystem control register offset */ 27 u32 ss_reg_ofs; /* Subsystem control register offset */
30 u32 channels; /* number of cpdma channels (symmetric) */ 28 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 cpdma_reg_ofs; /* cpdma register offset */
32 u32 cpdma_sram_ofs; /* cpdma sram offset */
33
34 u32 slaves; /* number of slave cpgmac ports */ 29 u32 slaves; /* number of slave cpgmac ports */
35 struct cpsw_slave_data *slave_data; 30 struct cpsw_slave_data *slave_data;
36 31 u32 cpts_active_slave; /* time stamping slave */
37 u32 ale_reg_ofs; /* address lookup engine reg offset */ 32 u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */
33 u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */
38 u32 ale_entries; /* ale table size */ 34 u32 ale_entries; /* ale table size */
39
40 u32 host_port_reg_ofs; /* cpsw cpdma host port registers */
41 u32 host_port_num; /* The port number for the host port */
42
43 u32 hw_stats_reg_ofs; /* cpsw hardware statistics counters */
44
45 u32 bd_ram_ofs; /* embedded buffer descriptor RAM offset*/
46 u32 bd_ram_size; /*buffer descriptor ram size */ 35 u32 bd_ram_size; /*buffer descriptor ram size */
47 u32 hw_ram_addr; /*if the HW address for BD RAM is different */
48 bool no_bd_ram; /* no embedded BD ram*/
49
50 u32 rx_descs; /* Number of Rx Descriptios */ 36 u32 rx_descs; /* Number of Rx Descriptios */
51
52 u32 mac_control; /* Mac control register */ 37 u32 mac_control; /* Mac control register */
53}; 38};
54 39
diff --git a/include/linux/platform_data/crypto-ux500.h b/include/linux/platform_data/crypto-ux500.h
index 5b2d0817e26a..94df96d9a336 100644
--- a/include/linux/platform_data/crypto-ux500.h
+++ b/include/linux/platform_data/crypto-ux500.h
@@ -7,7 +7,7 @@
7#ifndef _CRYPTO_UX500_H 7#ifndef _CRYPTO_UX500_H
8#define _CRYPTO_UX500_H 8#define _CRYPTO_UX500_H
9#include <linux/dmaengine.h> 9#include <linux/dmaengine.h>
10#include <plat/ste_dma40.h> 10#include <linux/platform_data/dma-ste-dma40.h>
11 11
12struct hash_platform_data { 12struct hash_platform_data {
13 void *mem_to_engine; 13 void *mem_to_engine;
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index d0c5825876f8..8db5ae03b6e3 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -16,12 +16,13 @@
16#ifndef __DAVINCI_ASP_H 16#ifndef __DAVINCI_ASP_H
17#define __DAVINCI_ASP_H 17#define __DAVINCI_ASP_H
18 18
19#include <linux/genalloc.h>
20
19struct snd_platform_data { 21struct snd_platform_data {
20 u32 tx_dma_offset; 22 u32 tx_dma_offset;
21 u32 rx_dma_offset; 23 u32 rx_dma_offset;
22 int asp_chan_q; /* event queue number for ASP channel */ 24 int asp_chan_q; /* event queue number for ASP channel */
23 int ram_chan_q; /* event queue number for RAM channel */ 25 int ram_chan_q; /* event queue number for RAM channel */
24 unsigned int codec_fmt;
25 /* 26 /*
26 * Allowing this is more efficient and eliminates left and right swaps 27 * Allowing this is more efficient and eliminates left and right swaps
27 * caused by underruns, but will swap the left and right channels 28 * caused by underruns, but will swap the left and right channels
@@ -30,6 +31,7 @@ struct snd_platform_data {
30 unsigned enable_channel_combine:1; 31 unsigned enable_channel_combine:1;
31 unsigned sram_size_playback; 32 unsigned sram_size_playback;
32 unsigned sram_size_capture; 33 unsigned sram_size_capture;
34 struct gen_pool *sram_pool;
33 35
34 /* 36 /*
35 * If McBSP peripheral gets the clock from an external pin, 37 * If McBSP peripheral gets the clock from an external pin,
diff --git a/include/linux/platform_data/db8500_thermal.h b/include/linux/platform_data/db8500_thermal.h
new file mode 100644
index 000000000000..3bf60902e902
--- /dev/null
+++ b/include/linux/platform_data/db8500_thermal.h
@@ -0,0 +1,38 @@
1/*
2 * db8500_thermal.h - DB8500 Thermal Management Implementation
3 *
4 * Copyright (C) 2012 ST-Ericsson
5 * Copyright (C) 2012 Linaro Ltd.
6 *
7 * Author: Hongbo Zhang <hongbo.zhang@linaro.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; 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#ifndef _DB8500_THERMAL_H_
21#define _DB8500_THERMAL_H_
22
23#include <linux/thermal.h>
24
25#define COOLING_DEV_MAX 8
26
27struct db8500_trip_point {
28 unsigned long temp;
29 enum thermal_trip_type type;
30 char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH];
31};
32
33struct db8500_thsens_platform_data {
34 struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS];
35 int num_trips;
36};
37
38#endif /* _DB8500_THERMAL_H_ */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index 1b9080385b46..f6d30cc1cb77 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -61,7 +61,9 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return strstr(dev_name(chan->device->dev), "sdma") || 63 return strstr(dev_name(chan->device->dev), "sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx-dma"); 64 !strcmp(dev_name(chan->device->dev), "imx1-dma") ||
65 !strcmp(dev_name(chan->device->dev), "imx21-dma") ||
66 !strcmp(dev_name(chan->device->dev), "imx27-dma");
65} 67}
66 68
67#endif 69#endif
diff --git a/include/linux/platform_data/dma-mv_xor.h b/include/linux/platform_data/dma-mv_xor.h
index 2ba1f7d76eef..8ec18f64e396 100644
--- a/include/linux/platform_data/dma-mv_xor.h
+++ b/include/linux/platform_data/dma-mv_xor.h
@@ -10,15 +10,14 @@
10#include <linux/dmaengine.h> 10#include <linux/dmaengine.h>
11#include <linux/mbus.h> 11#include <linux/mbus.h>
12 12
13#define MV_XOR_SHARED_NAME "mv_xor_shared" 13#define MV_XOR_NAME "mv_xor"
14#define MV_XOR_NAME "mv_xor"
15 14
16struct mv_xor_platform_data { 15struct mv_xor_channel_data {
17 struct platform_device *shared;
18 int hw_id;
19 dma_cap_mask_t cap_mask; 16 dma_cap_mask_t cap_mask;
20 size_t pool_size;
21}; 17};
22 18
19struct mv_xor_platform_data {
20 struct mv_xor_channel_data *channels;
21};
23 22
24#endif 23#endif
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
new file mode 100644
index 000000000000..9ff93b065686
--- /dev/null
+++ b/include/linux/platform_data/dma-ste-dma40.h
@@ -0,0 +1,223 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2007-2010
3 * Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
4 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8
9#ifndef STE_DMA40_H
10#define STE_DMA40_H
11
12#include <linux/dmaengine.h>
13#include <linux/scatterlist.h>
14#include <linux/workqueue.h>
15#include <linux/interrupt.h>
16
17/*
18 * Maxium size for a single dma descriptor
19 * Size is limited to 16 bits.
20 * Size is in the units of addr-widths (1,2,4,8 bytes)
21 * Larger transfers will be split up to multiple linked desc
22 */
23#define STEDMA40_MAX_SEG_SIZE 0xFFFF
24
25/* dev types for memcpy */
26#define STEDMA40_DEV_DST_MEMORY (-1)
27#define STEDMA40_DEV_SRC_MEMORY (-1)
28
29enum stedma40_mode {
30 STEDMA40_MODE_LOGICAL = 0,
31 STEDMA40_MODE_PHYSICAL,
32 STEDMA40_MODE_OPERATION,
33};
34
35enum stedma40_mode_opt {
36 STEDMA40_PCHAN_BASIC_MODE = 0,
37 STEDMA40_LCHAN_SRC_LOG_DST_LOG = 0,
38 STEDMA40_PCHAN_MODULO_MODE,
39 STEDMA40_PCHAN_DOUBLE_DST_MODE,
40 STEDMA40_LCHAN_SRC_PHY_DST_LOG,
41 STEDMA40_LCHAN_SRC_LOG_DST_PHY,
42};
43
44#define STEDMA40_ESIZE_8_BIT 0x0
45#define STEDMA40_ESIZE_16_BIT 0x1
46#define STEDMA40_ESIZE_32_BIT 0x2
47#define STEDMA40_ESIZE_64_BIT 0x3
48
49/* The value 4 indicates that PEN-reg shall be set to 0 */
50#define STEDMA40_PSIZE_PHY_1 0x4
51#define STEDMA40_PSIZE_PHY_2 0x0
52#define STEDMA40_PSIZE_PHY_4 0x1
53#define STEDMA40_PSIZE_PHY_8 0x2
54#define STEDMA40_PSIZE_PHY_16 0x3
55
56/*
57 * The number of elements differ in logical and
58 * physical mode
59 */
60#define STEDMA40_PSIZE_LOG_1 STEDMA40_PSIZE_PHY_2
61#define STEDMA40_PSIZE_LOG_4 STEDMA40_PSIZE_PHY_4
62#define STEDMA40_PSIZE_LOG_8 STEDMA40_PSIZE_PHY_8
63#define STEDMA40_PSIZE_LOG_16 STEDMA40_PSIZE_PHY_16
64
65/* Maximum number of possible physical channels */
66#define STEDMA40_MAX_PHYS 32
67
68enum stedma40_flow_ctrl {
69 STEDMA40_NO_FLOW_CTRL,
70 STEDMA40_FLOW_CTRL,
71};
72
73enum stedma40_periph_data_width {
74 STEDMA40_BYTE_WIDTH = STEDMA40_ESIZE_8_BIT,
75 STEDMA40_HALFWORD_WIDTH = STEDMA40_ESIZE_16_BIT,
76 STEDMA40_WORD_WIDTH = STEDMA40_ESIZE_32_BIT,
77 STEDMA40_DOUBLEWORD_WIDTH = STEDMA40_ESIZE_64_BIT
78};
79
80enum stedma40_xfer_dir {
81 STEDMA40_MEM_TO_MEM = 1,
82 STEDMA40_MEM_TO_PERIPH,
83 STEDMA40_PERIPH_TO_MEM,
84 STEDMA40_PERIPH_TO_PERIPH
85};
86
87
88/**
89 * struct stedma40_chan_cfg - dst/src channel configuration
90 *
91 * @big_endian: true if the src/dst should be read as big endian
92 * @data_width: Data width of the src/dst hardware
93 * @p_size: Burst size
94 * @flow_ctrl: Flow control on/off.
95 */
96struct stedma40_half_channel_info {
97 bool big_endian;
98 enum stedma40_periph_data_width data_width;
99 int psize;
100 enum stedma40_flow_ctrl flow_ctrl;
101};
102
103/**
104 * struct stedma40_chan_cfg - Structure to be filled by client drivers.
105 *
106 * @dir: MEM 2 MEM, PERIPH 2 MEM , MEM 2 PERIPH, PERIPH 2 PERIPH
107 * @high_priority: true if high-priority
108 * @realtime: true if realtime mode is to be enabled. Only available on DMA40
109 * version 3+, i.e DB8500v2+
110 * @mode: channel mode: physical, logical, or operation
111 * @mode_opt: options for the chosen channel mode
112 * @src_dev_type: Src device type
113 * @dst_dev_type: Dst device type
114 * @src_info: Parameters for dst half channel
115 * @dst_info: Parameters for dst half channel
116 * @use_fixed_channel: if true, use physical channel specified by phy_channel
117 * @phy_channel: physical channel to use, only if use_fixed_channel is true
118 *
119 * This structure has to be filled by the client drivers.
120 * It is recommended to do all dma configurations for clients in the machine.
121 *
122 */
123struct stedma40_chan_cfg {
124 enum stedma40_xfer_dir dir;
125 bool high_priority;
126 bool realtime;
127 enum stedma40_mode mode;
128 enum stedma40_mode_opt mode_opt;
129 int src_dev_type;
130 int dst_dev_type;
131 struct stedma40_half_channel_info src_info;
132 struct stedma40_half_channel_info dst_info;
133
134 bool use_fixed_channel;
135 int phy_channel;
136};
137
138/**
139 * struct stedma40_platform_data - Configuration struct for the dma device.
140 *
141 * @dev_len: length of dev_tx and dev_rx
142 * @dev_tx: mapping between destination event line and io address
143 * @dev_rx: mapping between source event line and io address
144 * @memcpy: list of memcpy event lines
145 * @memcpy_len: length of memcpy
146 * @memcpy_conf_phy: default configuration of physical channel memcpy
147 * @memcpy_conf_log: default configuration of logical channel memcpy
148 * @disabled_channels: A vector, ending with -1, that marks physical channels
149 * that are for different reasons not available for the driver.
150 */
151struct stedma40_platform_data {
152 u32 dev_len;
153 const dma_addr_t *dev_tx;
154 const dma_addr_t *dev_rx;
155 int *memcpy;
156 u32 memcpy_len;
157 struct stedma40_chan_cfg *memcpy_conf_phy;
158 struct stedma40_chan_cfg *memcpy_conf_log;
159 int disabled_channels[STEDMA40_MAX_PHYS];
160 bool use_esram_lcla;
161};
162
163#ifdef CONFIG_STE_DMA40
164
165/**
166 * stedma40_filter() - Provides stedma40_chan_cfg to the
167 * ste_dma40 dma driver via the dmaengine framework.
168 * does some checking of what's provided.
169 *
170 * Never directly called by client. It used by dmaengine.
171 * @chan: dmaengine handle.
172 * @data: Must be of type: struct stedma40_chan_cfg and is
173 * the configuration of the framework.
174 *
175 *
176 */
177
178bool stedma40_filter(struct dma_chan *chan, void *data);
179
180/**
181 * stedma40_slave_mem() - Transfers a raw data buffer to or from a slave
182 * (=device)
183 *
184 * @chan: dmaengine handle
185 * @addr: source or destination physicall address.
186 * @size: bytes to transfer
187 * @direction: direction of transfer
188 * @flags: is actually enum dma_ctrl_flags. See dmaengine.h
189 */
190
191static inline struct
192dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
193 dma_addr_t addr,
194 unsigned int size,
195 enum dma_transfer_direction direction,
196 unsigned long flags)
197{
198 struct scatterlist sg;
199 sg_init_table(&sg, 1);
200 sg.dma_address = addr;
201 sg.length = size;
202
203 return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags);
204}
205
206#else
207static inline bool stedma40_filter(struct dma_chan *chan, void *data)
208{
209 return false;
210}
211
212static inline struct
213dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
214 dma_addr_t addr,
215 unsigned int size,
216 enum dma_transfer_direction direction,
217 unsigned long flags)
218{
219 return NULL;
220}
221#endif
222
223#endif
diff --git a/include/linux/platform_data/dmtimer-omap.h b/include/linux/platform_data/dmtimer-omap.h
new file mode 100644
index 000000000000..a19b78d826e9
--- /dev/null
+++ b/include/linux/platform_data/dmtimer-omap.h
@@ -0,0 +1,31 @@
1/*
2 * DMTIMER platform data for TI OMAP platforms
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Author: Jon Hunter <jon-hunter@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
21#define __PLATFORM_DATA_DMTIMER_OMAP_H__
22
23struct dmtimer_platform_data {
24 /* set_timer_src - Only used for OMAP1 devices */
25 int (*set_timer_src)(struct platform_device *pdev, int source);
26 u32 timer_capability;
27 u32 timer_errata;
28 int (*get_context_loss_count)(struct device *);
29};
30
31#endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
index e8741c2678d5..5d50b25a73d7 100644
--- a/include/linux/platform_data/gpio-omap.h
+++ b/include/linux/platform_data/gpio-omap.h
@@ -26,7 +26,6 @@
26 26
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <mach/irqs.h>
30 29
31#define OMAP1_MPUIO_BASE 0xfffb5000 30#define OMAP1_MPUIO_BASE 0xfffb5000
32 31
diff --git a/include/linux/platform_data/gpio-ts5500.h b/include/linux/platform_data/gpio-ts5500.h
new file mode 100644
index 000000000000..b10d11c9bb49
--- /dev/null
+++ b/include/linux/platform_data/gpio-ts5500.h
@@ -0,0 +1,27 @@
1/*
2 * GPIO (DIO) header for Technologic Systems TS-5500
3 *
4 * Copyright (c) 2012 Savoir-faire Linux Inc.
5 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _PDATA_GPIO_TS5500_H
13#define _PDATA_GPIO_TS5500_H
14
15/**
16 * struct ts5500_dio_platform_data - TS-5500 pin block configuration
17 * @base: The GPIO base number to use.
18 * @strap: The only pin connected to an interrupt in a block is input-only.
19 * If you need a bidirectional line which can trigger an IRQ, you
20 * may strap it with an in/out pin. This flag indicates this case.
21 */
22struct ts5500_dio_platform_data {
23 int base;
24 bool strap;
25};
26
27#endif /* _PDATA_GPIO_TS5500_H */
diff --git a/include/linux/platform_data/i2c-cbus-gpio.h b/include/linux/platform_data/i2c-cbus-gpio.h
new file mode 100644
index 000000000000..6faa992a9502
--- /dev/null
+++ b/include/linux/platform_data/i2c-cbus-gpio.h
@@ -0,0 +1,27 @@
1/*
2 * i2c-cbus-gpio.h - CBUS I2C platform_data definition
3 *
4 * Copyright (C) 2004-2009 Nokia Corporation
5 *
6 * Written by Felipe Balbi and Aaro Koskinen.
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file "COPYING" in the main directory of this
10 * archive for more details.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __INCLUDE_LINUX_I2C_CBUS_GPIO_H
19#define __INCLUDE_LINUX_I2C_CBUS_GPIO_H
20
21struct i2c_cbus_platform_data {
22 int dat_gpio;
23 int clk_gpio;
24 int sel_gpio;
25};
26
27#endif /* __INCLUDE_LINUX_I2C_CBUS_GPIO_H */
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h
new file mode 100644
index 000000000000..5b429c43a297
--- /dev/null
+++ b/include/linux/platform_data/iommu-omap.h
@@ -0,0 +1,54 @@
1/*
2 * omap iommu: main structures
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/platform_device.h>
14
15#define MMU_REG_SIZE 256
16
17/**
18 * struct iommu_arch_data - omap iommu private data
19 * @name: name of the iommu device
20 * @iommu_dev: handle of the iommu device
21 *
22 * This is an omap iommu private data object, which binds an iommu user
23 * to its iommu device. This object should be placed at the iommu user's
24 * dev_archdata so generic IOMMU API can be used without having to
25 * utilize omap-specific plumbing anymore.
26 */
27struct omap_iommu_arch_data {
28 const char *name;
29 struct omap_iommu *iommu_dev;
30};
31
32/**
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
37 * look-aside buffer (TLB).
38 */
39struct omap_mmu_dev_attr {
40 u32 da_start;
41 u32 da_end;
42 int nr_tlb_entries;
43};
44
45struct iommu_platform_data {
46 const char *name;
47 const char *reset_name;
48 int nr_tlb_entries;
49 u32 da_start;
50 u32 da_end;
51
52 int (*assert_reset)(struct platform_device *pdev, const char *name);
53 int (*deassert_reset)(struct platform_device *pdev, const char *name);
54};
diff --git a/include/linux/platform_data/leds-omap.h b/include/linux/platform_data/leds-omap.h
new file mode 100644
index 000000000000..56c9b2a0ada5
--- /dev/null
+++ b/include/linux/platform_data/leds-omap.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2006 Samsung Electronics
3 * Kyungmin Park <kyungmin.park@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#ifndef ASMARM_ARCH_LED_H
10#define ASMARM_ARCH_LED_H
11
12struct omap_led_config {
13 struct led_classdev cdev;
14 s16 gpio;
15};
16
17struct omap_led_platform_data {
18 s16 nr_leds;
19 struct omap_led_config *leds;
20};
21
22#endif
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index 761f31752367..e81f62d24ee2 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -89,11 +89,6 @@ enum lp8556_brightness_source {
89 LP8556_COMBINED2, /* pwm + i2c after the shaper block */ 89 LP8556_COMBINED2, /* pwm + i2c after the shaper block */
90}; 90};
91 91
92struct lp855x_pwm_data {
93 void (*pwm_set_intensity) (int brightness, int max_brightness);
94 int (*pwm_get_intensity) (int max_brightness);
95};
96
97struct lp855x_rom_data { 92struct lp855x_rom_data {
98 u8 addr; 93 u8 addr;
99 u8 val; 94 u8 val;
@@ -105,7 +100,7 @@ struct lp855x_rom_data {
105 * @mode : brightness control by pwm or lp855x register 100 * @mode : brightness control by pwm or lp855x register
106 * @device_control : value of DEVICE CONTROL register 101 * @device_control : value of DEVICE CONTROL register
107 * @initial_brightness : initial value of backlight brightness 102 * @initial_brightness : initial value of backlight brightness
108 * @pwm_data : platform specific pwm generation functions. 103 * @period_ns : platform specific pwm period value. unit is nano.
109 Only valid when mode is PWM_BASED. 104 Only valid when mode is PWM_BASED.
110 * @load_new_rom_data : 105 * @load_new_rom_data :
111 0 : use default configuration data 106 0 : use default configuration data
@@ -118,7 +113,7 @@ struct lp855x_platform_data {
118 enum lp855x_brightness_ctrl_mode mode; 113 enum lp855x_brightness_ctrl_mode mode;
119 u8 device_control; 114 u8 device_control;
120 int initial_brightness; 115 int initial_brightness;
121 struct lp855x_pwm_data pwm_data; 116 unsigned int period_ns;
122 u8 load_new_rom_data; 117 u8 load_new_rom_data;
123 int size_program; 118 int size_program;
124 struct lp855x_rom_data *rom_data; 119 struct lp855x_rom_data *rom_data;
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
index b081c7245ec8..044a124bfbbc 100644
--- a/include/linux/platform_data/macb.h
+++ b/include/linux/platform_data/macb.h
@@ -12,6 +12,7 @@ struct macb_platform_data {
12 u32 phy_mask; 12 u32 phy_mask;
13 int phy_irq_pin; /* PHY IRQ */ 13 int phy_irq_pin; /* PHY IRQ */
14 u8 is_rmii; /* using RMII interface? */ 14 u8 is_rmii; /* using RMII interface? */
15 u8 rev_eth_addr; /* reverse Ethernet address byte order */
15}; 16};
16 17
17#endif /* __MACB_PDATA_H__ */ 18#endif /* __MACB_PDATA_H__ */
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
new file mode 100644
index 000000000000..2bf1b30cb5dc
--- /dev/null
+++ b/include/linux/platform_data/mmc-omap.h
@@ -0,0 +1,151 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia 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
11#define OMAP_MMC_MAX_SLOTS 2
12
13/*
14 * struct omap_mmc_dev_attr.flags possibilities
15 *
16 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
17 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
18 * should be set if this is the case. See for example Section 22.5.3
19 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
20 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
21 *
22 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
23 * don't work correctly on some MMC controller instances on some
24 * OMAP3 SoCs; this flag should be set if this is the case. See
25 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
26 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
27 * Revision F (October 2010) (SPRZ278F).
28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31
32struct mmc_card;
33
34struct omap_mmc_dev_attr {
35 u8 flags;
36};
37
38struct omap_mmc_platform_data {
39 /* back-link to device */
40 struct device *dev;
41
42 /* number of slots per controller */
43 unsigned nr_slots:2;
44
45 /* set if your board has components or wiring that limits the
46 * maximum frequency on the MMC bus */
47 unsigned int max_freq;
48
49 /* switch the bus to a new slot */
50 int (*switch_slot)(struct device *dev, int slot);
51 /* initialize board-specific MMC functionality, can be NULL if
52 * not supported */
53 int (*init)(struct device *dev);
54 void (*cleanup)(struct device *dev);
55 void (*shutdown)(struct device *dev);
56
57 /* To handle board related suspend/resume functionality for MMC */
58 int (*suspend)(struct device *dev, int slot);
59 int (*resume)(struct device *dev, int slot);
60
61 /* Return context loss count due to PM states changing */
62 int (*get_context_loss_count)(struct device *dev);
63
64 /* Integrating attributes from the omap_hwmod layer */
65 u8 controller_flags;
66
67 /* Register offset deviation */
68 u16 reg_offset;
69
70 struct omap_mmc_slot_data {
71
72 /*
73 * 4/8 wires and any additional host capabilities
74 * need to OR'd all capabilities (ref. linux/mmc/host.h)
75 */
76 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
77 u32 caps; /* Used for the MMC driver on 2430 and later */
78 u32 pm_caps; /* PM capabilities of the mmc */
79
80 /*
81 * nomux means "standard" muxing is wrong on this board, and
82 * that board-specific code handled it before common init logic.
83 */
84 unsigned nomux:1;
85
86 /* switch pin can be for card detect (default) or card cover */
87 unsigned cover:1;
88
89 /* use the internal clock */
90 unsigned internal_clock:1;
91
92 /* nonremovable e.g. eMMC */
93 unsigned nonremovable:1;
94
95 /* Try to sleep or power off when possible */
96 unsigned power_saving:1;
97
98 /* If using power_saving and the MMC power is not to go off */
99 unsigned no_off:1;
100
101 /* eMMC does not handle power off when not in sleep state */
102 unsigned no_regulator_off_init:1;
103
104 /* Regulator off remapped to sleep */
105 unsigned vcc_aux_disable_is_sleep:1;
106
107 /* we can put the features above into this variable */
108#define HSMMC_HAS_PBIAS (1 << 0)
109#define HSMMC_HAS_UPDATED_RESET (1 << 1)
110#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
111#define MMC_OMAP7XX (1 << 3)
112#define MMC_OMAP15XX (1 << 4)
113#define MMC_OMAP16XX (1 << 5)
114 unsigned features;
115
116 int switch_pin; /* gpio (card detect) */
117 int gpio_wp; /* gpio (write protect) */
118
119 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
120 int (*set_power)(struct device *dev, int slot,
121 int power_on, int vdd);
122 int (*get_ro)(struct device *dev, int slot);
123 void (*remux)(struct device *dev, int slot, int power_on);
124 /* Call back before enabling / disabling regulators */
125 void (*before_set_reg)(struct device *dev, int slot,
126 int power_on, int vdd);
127 /* Call back after enabling / disabling regulators */
128 void (*after_set_reg)(struct device *dev, int slot,
129 int power_on, int vdd);
130 /* if we have special card, init it using this callback */
131 void (*init_card)(struct mmc_card *card);
132
133 /* return MMC cover switch state, can be NULL if not supported.
134 *
135 * possible return values:
136 * 0 - closed
137 * 1 - open
138 */
139 int (*get_cover_state)(struct device *dev, int slot);
140
141 const char *name;
142 u32 ocr_mask;
143
144 /* Card detection IRQs */
145 int card_detect_irq;
146 int (*card_detect)(struct device *dev, int slot);
147
148 unsigned int ban_openended:1;
149
150 } slots[OMAP_MMC_MAX_SLOTS];
151};
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 1a68c1e5fe53..24d32ca34bef 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -8,9 +8,13 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <plat/gpmc.h> 11#ifndef _MTD_NAND_OMAP2_H
12#define _MTD_NAND_OMAP2_H
13
12#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
13 15
16#define GPMC_BCH_NUM_REMAINDER 8
17
14enum nand_io { 18enum nand_io {
15 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ 19 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
16 NAND_OMAP_POLLED, /* polled mode, without prefetch */ 20 NAND_OMAP_POLLED, /* polled mode, without prefetch */
@@ -18,10 +22,38 @@ enum nand_io {
18 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ 22 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
19}; 23};
20 24
25enum omap_ecc {
26 /* 1-bit ecc: stored at end of spare area */
27 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
28 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
29 /* 1-bit ecc: stored at beginning of spare area as romcode */
30 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
31 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
32 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
33};
34
35struct gpmc_nand_regs {
36 void __iomem *gpmc_status;
37 void __iomem *gpmc_nand_command;
38 void __iomem *gpmc_nand_address;
39 void __iomem *gpmc_nand_data;
40 void __iomem *gpmc_prefetch_config1;
41 void __iomem *gpmc_prefetch_config2;
42 void __iomem *gpmc_prefetch_control;
43 void __iomem *gpmc_prefetch_status;
44 void __iomem *gpmc_ecc_config;
45 void __iomem *gpmc_ecc_control;
46 void __iomem *gpmc_ecc_size_config;
47 void __iomem *gpmc_ecc1_result;
48 void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
49 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
50 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
51 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
52};
53
21struct omap_nand_platform_data { 54struct omap_nand_platform_data {
22 int cs; 55 int cs;
23 struct mtd_partition *parts; 56 struct mtd_partition *parts;
24 struct gpmc_timings *gpmc_t;
25 int nr_parts; 57 int nr_parts;
26 bool dev_ready; 58 bool dev_ready;
27 enum nand_io xfer_type; 59 enum nand_io xfer_type;
@@ -30,14 +62,4 @@ struct omap_nand_platform_data {
30 struct gpmc_nand_regs reg; 62 struct gpmc_nand_regs reg;
31}; 63};
32 64
33/* minimum size for IO mapping */
34#define NAND_IO_SIZE 4
35
36#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
37extern int gpmc_nand_init(struct omap_nand_platform_data *d);
38#else
39static inline int gpmc_nand_init(struct omap_nand_platform_data *d)
40{
41 return 0;
42}
43#endif 65#endif
diff --git a/include/linux/platform_data/mtd-nomadik-nand.h b/include/linux/platform_data/mtd-nomadik-nand.h
deleted file mode 100644
index c3c8254c22a5..000000000000
--- a/include/linux/platform_data/mtd-nomadik-nand.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_ARCH_NAND_H
2#define __ASM_ARCH_NAND_H
3
4struct nomadik_nand_platform_data {
5 struct mtd_partition *parts;
6 int nparts;
7 int options;
8 int (*init) (void);
9 int (*exit) (void);
10};
11
12#define NAND_IO_DATA 0x40000000
13#define NAND_IO_CMD 0x40800000
14#define NAND_IO_ADDR 0x41000000
15
16#endif /* __ASM_ARCH_NAND_H */
diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h
index 2858667d2e4f..685af7e8b120 100644
--- a/include/linux/platform_data/mtd-onenand-omap2.h
+++ b/include/linux/platform_data/mtd-onenand-omap2.h
@@ -9,17 +9,15 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#ifndef __MTD_ONENAND_OMAP2_H
13#define __MTD_ONENAND_OMAP2_H
14
12#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h> 16#include <linux/mtd/partitions.h>
14 17
15#define ONENAND_SYNC_READ (1 << 0) 18#define ONENAND_SYNC_READ (1 << 0)
16#define ONENAND_SYNC_READWRITE (1 << 1) 19#define ONENAND_SYNC_READWRITE (1 << 1)
17 20#define ONENAND_IN_OMAP34XX (1 << 2)
18struct onenand_freq_info {
19 u16 maf_id;
20 u16 dev_id;
21 u16 ver_id;
22};
23 21
24struct omap_onenand_platform_data { 22struct omap_onenand_platform_data {
25 int cs; 23 int cs;
@@ -27,27 +25,9 @@ struct omap_onenand_platform_data {
27 struct mtd_partition *parts; 25 struct mtd_partition *parts;
28 int nr_parts; 26 int nr_parts;
29 int (*onenand_setup)(void __iomem *, int *freq_ptr); 27 int (*onenand_setup)(void __iomem *, int *freq_ptr);
30 int (*get_freq)(const struct onenand_freq_info *freq_info,
31 bool *clk_dep);
32 int dma_channel; 28 int dma_channel;
33 u8 flags; 29 u8 flags;
34 u8 regulator_can_sleep; 30 u8 regulator_can_sleep;
35 u8 skip_initial_unlocking; 31 u8 skip_initial_unlocking;
36}; 32};
37
38#define ONENAND_MAX_PARTITIONS 8
39
40#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
41 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
42
43extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
44
45#else
46
47#define board_onenand_data NULL
48
49static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
50{
51}
52
53#endif 33#endif
diff --git a/include/linux/platform_data/omap-twl4030.h b/include/linux/platform_data/omap-twl4030.h
index c7bef788daab..ee60ef79d792 100644
--- a/include/linux/platform_data/omap-twl4030.h
+++ b/include/linux/platform_data/omap-twl4030.h
@@ -25,8 +25,34 @@
25#ifndef _OMAP_TWL4030_H_ 25#ifndef _OMAP_TWL4030_H_
26#define _OMAP_TWL4030_H_ 26#define _OMAP_TWL4030_H_
27 27
28/* To select if only one channel is connected in a stereo port */
29#define OMAP_TWL4030_LEFT (1 << 0)
30#define OMAP_TWL4030_RIGHT (1 << 1)
31
28struct omap_tw4030_pdata { 32struct omap_tw4030_pdata {
29 const char *card_name; 33 const char *card_name;
34 /* Voice port is connected to McBSP3 */
35 bool voice_connected;
36
37 /* The driver will parse the connection flags if this flag is set */
38 bool custom_routing;
39 /* Flags to indicate connected audio ports. */
40 u8 has_hs;
41 u8 has_hf;
42 u8 has_predriv;
43 u8 has_carkit;
44 bool has_ear;
45
46 bool has_mainmic;
47 bool has_submic;
48 bool has_hsmic;
49 bool has_carkitmic;
50 bool has_digimic0;
51 bool has_digimic1;
52 u8 has_linein;
53
54 /* Jack detect GPIO or <= 0 if it is not implemented */
55 int jack_detect;
30}; 56};
31 57
32#endif /* _OMAP_TWL4030_H_ */ 58#endif /* _OMAP_TWL4030_H_ */
diff --git a/include/linux/platform_data/omap-wd-timer.h b/include/linux/platform_data/omap-wd-timer.h
new file mode 100644
index 000000000000..d75f5f802d98
--- /dev/null
+++ b/include/linux/platform_data/omap-wd-timer.h
@@ -0,0 +1,38 @@
1/*
2 * OMAP2+ WDTIMER-specific function prototypes
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
14#define __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
15
16#include <linux/types.h>
17
18/*
19 * Standardized OMAP reset source bits
20 *
21 * This is a subset of the ones listed in arch/arm/mach-omap2/prm.h
22 * and are the only ones needed in the watchdog driver.
23 */
24#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
25
26/**
27 * struct omap_wd_timer_platform_data - WDTIMER integration to the host SoC
28 * @read_reset_sources - fn ptr for the SoC to indicate the last reset cause
29 *
30 * The function pointed to by @read_reset_sources must return its data
31 * in a standard format - search for RST_SRC_ID_SHIFT in
32 * arch/arm/mach-omap2
33 */
34struct omap_wd_timer_platform_data {
35 u32 (*read_reset_sources)(void);
36};
37
38#endif
diff --git a/include/linux/platform_data/omap_drm.h b/include/linux/platform_data/omap_drm.h
index 3da73bdc2031..f4e4a237ebd2 100644
--- a/include/linux/platform_data/omap_drm.h
+++ b/include/linux/platform_data/omap_drm.h
@@ -46,6 +46,7 @@ struct omap_kms_platform_data {
46}; 46};
47 47
48struct omap_drm_platform_data { 48struct omap_drm_platform_data {
49 uint32_t omaprev;
49 struct omap_kms_platform_data *kms_pdata; 50 struct omap_kms_platform_data *kms_pdata;
50}; 51};
51 52
diff --git a/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h
new file mode 100644
index 000000000000..5c6c3939355f
--- /dev/null
+++ b/include/linux/platform_data/omap_ocp2scp.h
@@ -0,0 +1,31 @@
1/*
2 * omap_ocp2scp.h -- ocp2scp header file
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __DRIVERS_OMAP_OCP2SCP_H
20#define __DRIVERS_OMAP_OCP2SCP_H
21
22struct omap_ocp2scp_dev {
23 const char *drv_name;
24 struct resource *res;
25};
26
27struct omap_ocp2scp_platform_data {
28 int dev_cnt;
29 struct omap_ocp2scp_dev **devices;
30};
31#endif /* __DRIVERS_OMAP_OCP2SCP_H */
diff --git a/include/linux/platform_data/pinctrl-coh901.h b/include/linux/platform_data/pinctrl-coh901.h
index 30dea251b835..dfbc65d10484 100644
--- a/include/linux/platform_data/pinctrl-coh901.h
+++ b/include/linux/platform_data/pinctrl-coh901.h
@@ -13,14 +13,10 @@
13 * struct u300_gpio_platform - U300 GPIO platform data 13 * struct u300_gpio_platform - U300 GPIO platform data
14 * @ports: number of GPIO block ports 14 * @ports: number of GPIO block ports
15 * @gpio_base: first GPIO number for this block (use a free range) 15 * @gpio_base: first GPIO number for this block (use a free range)
16 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
17 * @pinctrl_device: pin control device to spawn as child
18 */ 16 */
19struct u300_gpio_platform { 17struct u300_gpio_platform {
20 u8 ports; 18 u8 ports;
21 int gpio_base; 19 int gpio_base;
22 int gpio_irq_base;
23 struct platform_device *pinctrl_device;
24}; 20};
25 21
26#endif /* __MACH_U300_GPIO_U300_H */ 22#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/include/linux/platform_data/pinctrl-nomadik.h b/include/linux/platform_data/pinctrl-nomadik.h
new file mode 100644
index 000000000000..f73b2f0c55b7
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-nomadik.h
@@ -0,0 +1,266 @@
1/*
2 * Structures and registers for GPIO access in the Nomadik SoC
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Author: Prafulla WADASKAR <prafulla.wadaskar@st.com>
6 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __PLAT_NOMADIK_GPIO
14#define __PLAT_NOMADIK_GPIO
15
16/*
17 * pin configurations are represented by 32-bit integers:
18 *
19 * bit 0.. 8 - Pin Number (512 Pins Maximum)
20 * bit 9..10 - Alternate Function Selection
21 * bit 11..12 - Pull up/down state
22 * bit 13 - Sleep mode behaviour
23 * bit 14 - Direction
24 * bit 15 - Value (if output)
25 * bit 16..18 - SLPM pull up/down state
26 * bit 19..20 - SLPM direction
27 * bit 21..22 - SLPM Value (if output)
28 * bit 23..25 - PDIS value (if input)
29 * bit 26 - Gpio mode
30 * bit 27 - Sleep mode
31 *
32 * to facilitate the definition, the following macros are provided
33 *
34 * PIN_CFG_DEFAULT - default config (0):
35 * pull up/down = disabled
36 * sleep mode = input/wakeup
37 * direction = input
38 * value = low
39 * SLPM direction = same as normal
40 * SLPM pull = same as normal
41 * SLPM value = same as normal
42 *
43 * PIN_CFG - default config with alternate function
44 */
45
46typedef unsigned long pin_cfg_t;
47
48#define PIN_NUM_MASK 0x1ff
49#define PIN_NUM(x) ((x) & PIN_NUM_MASK)
50
51#define PIN_ALT_SHIFT 9
52#define PIN_ALT_MASK (0x3 << PIN_ALT_SHIFT)
53#define PIN_ALT(x) (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
54#define PIN_GPIO (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
55#define PIN_ALT_A (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
56#define PIN_ALT_B (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
57#define PIN_ALT_C (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
58
59#define PIN_PULL_SHIFT 11
60#define PIN_PULL_MASK (0x3 << PIN_PULL_SHIFT)
61#define PIN_PULL(x) (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
62#define PIN_PULL_NONE (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
63#define PIN_PULL_UP (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
64#define PIN_PULL_DOWN (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
65
66#define PIN_SLPM_SHIFT 13
67#define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT)
68#define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
69#define PIN_SLPM_MAKE_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
70#define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
71/* These two replace the above in DB8500v2+ */
72#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
73#define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
74#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
75
76#define PIN_SLPM_GPIO PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
77#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
78
79#define PIN_DIR_SHIFT 14
80#define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT)
81#define PIN_DIR(x) (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
82#define PIN_DIR_INPUT (0 << PIN_DIR_SHIFT)
83#define PIN_DIR_OUTPUT (1 << PIN_DIR_SHIFT)
84
85#define PIN_VAL_SHIFT 15
86#define PIN_VAL_MASK (0x1 << PIN_VAL_SHIFT)
87#define PIN_VAL(x) (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
88#define PIN_VAL_LOW (0 << PIN_VAL_SHIFT)
89#define PIN_VAL_HIGH (1 << PIN_VAL_SHIFT)
90
91#define PIN_SLPM_PULL_SHIFT 16
92#define PIN_SLPM_PULL_MASK (0x7 << PIN_SLPM_PULL_SHIFT)
93#define PIN_SLPM_PULL(x) \
94 (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
95#define PIN_SLPM_PULL_NONE \
96 ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
97#define PIN_SLPM_PULL_UP \
98 ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
99#define PIN_SLPM_PULL_DOWN \
100 ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
101
102#define PIN_SLPM_DIR_SHIFT 19
103#define PIN_SLPM_DIR_MASK (0x3 << PIN_SLPM_DIR_SHIFT)
104#define PIN_SLPM_DIR(x) \
105 (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
106#define PIN_SLPM_DIR_INPUT ((1 + 0) << PIN_SLPM_DIR_SHIFT)
107#define PIN_SLPM_DIR_OUTPUT ((1 + 1) << PIN_SLPM_DIR_SHIFT)
108
109#define PIN_SLPM_VAL_SHIFT 21
110#define PIN_SLPM_VAL_MASK (0x3 << PIN_SLPM_VAL_SHIFT)
111#define PIN_SLPM_VAL(x) \
112 (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
113#define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT)
114#define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT)
115
116#define PIN_SLPM_PDIS_SHIFT 23
117#define PIN_SLPM_PDIS_MASK (0x3 << PIN_SLPM_PDIS_SHIFT)
118#define PIN_SLPM_PDIS(x) \
119 (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
120#define PIN_SLPM_PDIS_NO_CHANGE (0 << PIN_SLPM_PDIS_SHIFT)
121#define PIN_SLPM_PDIS_DISABLED (1 << PIN_SLPM_PDIS_SHIFT)
122#define PIN_SLPM_PDIS_ENABLED (2 << PIN_SLPM_PDIS_SHIFT)
123
124#define PIN_LOWEMI_SHIFT 25
125#define PIN_LOWEMI_MASK (0x1 << PIN_LOWEMI_SHIFT)
126#define PIN_LOWEMI(x) (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
127#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT)
128#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT)
129
130#define PIN_GPIOMODE_SHIFT 26
131#define PIN_GPIOMODE_MASK (0x1 << PIN_GPIOMODE_SHIFT)
132#define PIN_GPIOMODE(x) (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
133#define PIN_GPIOMODE_DISABLED (0 << PIN_GPIOMODE_SHIFT)
134#define PIN_GPIOMODE_ENABLED (1 << PIN_GPIOMODE_SHIFT)
135
136#define PIN_SLEEPMODE_SHIFT 27
137#define PIN_SLEEPMODE_MASK (0x1 << PIN_SLEEPMODE_SHIFT)
138#define PIN_SLEEPMODE(x) (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
139#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
140#define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT)
141
142
143/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */
144#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN)
145#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP)
146#define PIN_INPUT_NOPULL (PIN_DIR_INPUT | PIN_PULL_NONE)
147#define PIN_OUTPUT_LOW (PIN_DIR_OUTPUT | PIN_VAL_LOW)
148#define PIN_OUTPUT_HIGH (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
149
150#define PIN_SLPM_INPUT_PULLDOWN (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
151#define PIN_SLPM_INPUT_PULLUP (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
152#define PIN_SLPM_INPUT_NOPULL (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
153#define PIN_SLPM_OUTPUT_LOW (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
154#define PIN_SLPM_OUTPUT_HIGH (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
155
156#define PIN_CFG_DEFAULT (0)
157
158#define PIN_CFG(num, alt) \
159 (PIN_CFG_DEFAULT |\
160 (PIN_NUM(num) | PIN_##alt))
161
162#define PIN_CFG_INPUT(num, alt, pull) \
163 (PIN_CFG_DEFAULT |\
164 (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))
165
166#define PIN_CFG_OUTPUT(num, alt, val) \
167 (PIN_CFG_DEFAULT |\
168 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))
169
170/*
171 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
172 * the "gpio" namespace for generic and cross-machine functions
173 */
174
175#define GPIO_BLOCK_SHIFT 5
176#define NMK_GPIO_PER_CHIP (1 << GPIO_BLOCK_SHIFT)
177
178/* Register in the logic block */
179#define NMK_GPIO_DAT 0x00
180#define NMK_GPIO_DATS 0x04
181#define NMK_GPIO_DATC 0x08
182#define NMK_GPIO_PDIS 0x0c
183#define NMK_GPIO_DIR 0x10
184#define NMK_GPIO_DIRS 0x14
185#define NMK_GPIO_DIRC 0x18
186#define NMK_GPIO_SLPC 0x1c
187#define NMK_GPIO_AFSLA 0x20
188#define NMK_GPIO_AFSLB 0x24
189#define NMK_GPIO_LOWEMI 0x28
190
191#define NMK_GPIO_RIMSC 0x40
192#define NMK_GPIO_FIMSC 0x44
193#define NMK_GPIO_IS 0x48
194#define NMK_GPIO_IC 0x4c
195#define NMK_GPIO_RWIMSC 0x50
196#define NMK_GPIO_FWIMSC 0x54
197#define NMK_GPIO_WKS 0x58
198/* These appear in DB8540 and later ASICs */
199#define NMK_GPIO_EDGELEVEL 0x5C
200#define NMK_GPIO_LEVEL 0x60
201
202/* Alternate functions: function C is set in hw by setting both A and B */
203#define NMK_GPIO_ALT_GPIO 0
204#define NMK_GPIO_ALT_A 1
205#define NMK_GPIO_ALT_B 2
206#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
207
208#define NMK_GPIO_ALT_CX_SHIFT 2
209#define NMK_GPIO_ALT_C1 ((1<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
210#define NMK_GPIO_ALT_C2 ((2<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
211#define NMK_GPIO_ALT_C3 ((3<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
212#define NMK_GPIO_ALT_C4 ((4<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
213
214/* Pull up/down values */
215enum nmk_gpio_pull {
216 NMK_GPIO_PULL_NONE,
217 NMK_GPIO_PULL_UP,
218 NMK_GPIO_PULL_DOWN,
219};
220
221/* Sleep mode */
222enum nmk_gpio_slpm {
223 NMK_GPIO_SLPM_INPUT,
224 NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT,
225 NMK_GPIO_SLPM_NOCHANGE,
226 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
227};
228
229/* Older deprecated pin config API that should go away soon */
230extern int nmk_config_pin(pin_cfg_t cfg, bool sleep);
231extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
232extern int nmk_config_pins_sleep(pin_cfg_t *cfgs, int num);
233extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
234extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
235#ifdef CONFIG_PINCTRL_NOMADIK
236extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
237#else
238static inline int nmk_gpio_set_mode(int gpio, int gpio_mode)
239{
240 return -ENODEV;
241}
242#endif
243extern int nmk_gpio_get_mode(int gpio);
244
245extern void nmk_gpio_wakeups_suspend(void);
246extern void nmk_gpio_wakeups_resume(void);
247
248extern void nmk_gpio_clocks_enable(void);
249extern void nmk_gpio_clocks_disable(void);
250
251extern void nmk_gpio_read_pull(int gpio_bank, u32 *pull_up);
252
253/*
254 * Platform data to register a block: only the initial gpio/irq number.
255 */
256struct nmk_gpio_platform_data {
257 char *name;
258 int first_gpio;
259 int first_irq;
260 int num_gpio;
261 u32 (*get_secondary_status)(unsigned int bank);
262 void (*set_ioforce)(bool enable);
263 bool supports_sleepmode;
264};
265
266#endif /* __PLAT_NOMADIK_GPIO */
diff --git a/include/linux/platform_data/pn544.h b/include/linux/platform_data/pn544.h
new file mode 100644
index 000000000000..713bfd703342
--- /dev/null
+++ b/include/linux/platform_data/pn544.h
@@ -0,0 +1,44 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) Nokia Corporation
5 *
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com>
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _PN544_H_
24#define _PN544_H_
25
26#include <linux/i2c.h>
27
28enum {
29 NFC_GPIO_ENABLE,
30 NFC_GPIO_FW_RESET,
31 NFC_GPIO_IRQ
32};
33
34/* board config */
35struct pn544_nfc_platform_data {
36 int (*request_resources) (struct i2c_client *client);
37 void (*free_resources) (void);
38 void (*enable) (int fw);
39 int (*test) (void);
40 void (*disable) (void);
41 int (*get_gpio)(int type);
42};
43
44#endif /* _PN544_H_ */
diff --git a/include/linux/platform_data/pxa2xx_udc.h b/include/linux/platform_data/pxa2xx_udc.h
new file mode 100644
index 000000000000..c6c5e98b5b82
--- /dev/null
+++ b/include/linux/platform_data/pxa2xx_udc.h
@@ -0,0 +1,27 @@
1/*
2 * This supports machine-specific differences in how the PXA2xx
3 * USB Device Controller (UDC) is wired.
4 *
5 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
6 * linux/arch/mach-ixp4xx/<machine>.c and used in
7 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
8 */
9#ifndef PXA2XX_UDC_H
10#define PXA2XX_UDC_H
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here. Note that sometimes the signals go through inverters...
22 */
23 bool gpio_pullup_inverted;
24 int gpio_pullup; /* high == pullup activated */
25};
26
27#endif
diff --git a/include/linux/platform_data/pxa_sdhci.h b/include/linux/platform_data/pxa_sdhci.h
index 59acd987ed34..27d3156d093a 100644
--- a/include/linux/platform_data/pxa_sdhci.h
+++ b/include/linux/platform_data/pxa_sdhci.h
@@ -38,6 +38,7 @@
38 * @max_speed: the maximum speed supported 38 * @max_speed: the maximum speed supported
39 * @host_caps: Standard MMC host capabilities bit field. 39 * @host_caps: Standard MMC host capabilities bit field.
40 * @quirks: quirks of platfrom 40 * @quirks: quirks of platfrom
41 * @quirks2: quirks2 of platfrom
41 * @pm_caps: pm_caps of platfrom 42 * @pm_caps: pm_caps of platfrom
42 */ 43 */
43struct sdhci_pxa_platdata { 44struct sdhci_pxa_platdata {
@@ -48,9 +49,10 @@ struct sdhci_pxa_platdata {
48 unsigned int ext_cd_gpio; 49 unsigned int ext_cd_gpio;
49 bool ext_cd_gpio_invert; 50 bool ext_cd_gpio_invert;
50 unsigned int max_speed; 51 unsigned int max_speed;
51 unsigned int host_caps; 52 u32 host_caps;
52 unsigned int host_caps2; 53 u32 host_caps2;
53 unsigned int quirks; 54 unsigned int quirks;
55 unsigned int quirks2;
54 unsigned int pm_caps; 56 unsigned int pm_caps;
55}; 57};
56 58
diff --git a/include/linux/platform_data/sa11x0-serial.h b/include/linux/platform_data/sa11x0-serial.h
new file mode 100644
index 000000000000..4504d5d592f0
--- /dev/null
+++ b/include/linux/platform_data/sa11x0-serial.h
@@ -0,0 +1,33 @@
1/*
2 * Author: Nicolas Pitre
3 *
4 * Moved and changed lots, Russell King
5 *
6 * Low level machine dependent UART functions.
7 */
8#ifndef SA11X0_SERIAL_H
9#define SA11X0_SERIAL_H
10
11struct uart_port;
12struct uart_info;
13
14/*
15 * This is a temporary structure for registering these
16 * functions; it is intended to be discarded after boot.
17 */
18struct sa1100_port_fns {
19 void (*set_mctrl)(struct uart_port *, u_int);
20 u_int (*get_mctrl)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23};
24
25#ifdef CONFIG_SERIAL_SA1100
26void sa1100_register_uart_fns(struct sa1100_port_fns *fns);
27void sa1100_register_uart(int idx, int port);
28#else
29#define sa1100_register_uart_fns(fns) do { } while (0)
30#define sa1100_register_uart(idx,port) do { } while (0)
31#endif
32
33#endif
diff --git a/include/linux/platform_data/serial-omap.h b/include/linux/platform_data/serial-omap.h
new file mode 100644
index 000000000000..ff9b0aab5281
--- /dev/null
+++ b/include/linux/platform_data/serial-omap.h
@@ -0,0 +1,51 @@
1/*
2 * Driver for OMAP-UART controller.
3 * Based on drivers/serial/8250.c
4 *
5 * Copyright (C) 2010 Texas Instruments.
6 *
7 * Authors:
8 * Govindraj R <govindraj.raja@ti.com>
9 * Thara Gopinath <thara@ti.com>
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 as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#ifndef __OMAP_SERIAL_H__
18#define __OMAP_SERIAL_H__
19
20#include <linux/serial_core.h>
21#include <linux/device.h>
22#include <linux/pm_qos.h>
23
24#define DRIVER_NAME "omap_uart"
25
26/*
27 * Use tty device name as ttyO, [O -> OMAP]
28 * in bootargs we specify as console=ttyO0 if uart1
29 * is used as console uart.
30 */
31#define OMAP_SERIAL_NAME "ttyO"
32
33struct omap_uart_port_info {
34 bool dma_enabled; /* To specify DMA Mode */
35 unsigned int uartclk; /* UART clock rate */
36 upf_t flags; /* UPF_* flags */
37 unsigned int dma_rx_buf_size;
38 unsigned int dma_rx_timeout;
39 unsigned int autosuspend_timeout;
40 unsigned int dma_rx_poll_rate;
41 int DTR_gpio;
42 int DTR_inverted;
43 int DTR_present;
44
45 int (*get_context_loss_count)(struct device *);
46 void (*set_forceidle)(struct device *);
47 void (*set_noidle)(struct device *);
48 void (*enable_wakeup)(struct device *, bool);
49};
50
51#endif /* __OMAP_SERIAL_H__ */
diff --git a/include/linux/platform_data/spi-clps711x.h b/include/linux/platform_data/spi-clps711x.h
new file mode 100644
index 000000000000..301956e63143
--- /dev/null
+++ b/include/linux/platform_data/spi-clps711x.h
@@ -0,0 +1,21 @@
1/*
2 * CLPS711X SPI bus driver definitions
3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef ____LINUX_PLATFORM_DATA_SPI_CLPS711X_H
13#define ____LINUX_PLATFORM_DATA_SPI_CLPS711X_H
14
15/* Board specific platform_data */
16struct spi_clps711x_pdata {
17 int *chipselect; /* Array of GPIO-numbers */
18 int num_chipselect; /* Total count of GPIOs */
19};
20
21#endif
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index a357eb26bd25..a65572d53211 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -7,9 +7,13 @@
7 7
8#define OMAP4_MCSPI_REG_OFFSET 0x100 8#define OMAP4_MCSPI_REG_OFFSET 0x100
9 9
10#define MCSPI_PINDIR_D0_IN_D1_OUT 0
11#define MCSPI_PINDIR_D0_OUT_D1_IN 1
12
10struct omap2_mcspi_platform_config { 13struct omap2_mcspi_platform_config {
11 unsigned short num_cs; 14 unsigned short num_cs;
12 unsigned int regs_offset; 15 unsigned int regs_offset;
16 unsigned int pin_dir:1;
13}; 17};
14 18
15struct omap2_mcspi_dev_attr { 19struct omap2_mcspi_dev_attr {
diff --git a/include/linux/platform_data/ti_am335x_adc.h b/include/linux/platform_data/ti_am335x_adc.h
new file mode 100644
index 000000000000..e41d5834cb84
--- /dev/null
+++ b/include/linux/platform_data/ti_am335x_adc.h
@@ -0,0 +1,14 @@
1#ifndef __LINUX_TI_AM335X_ADC_H
2#define __LINUX_TI_AM335X_ADC_H
3
4/**
5 * struct adc_data ADC Input information
6 * @adc_channels: Number of analog inputs
7 * available for ADC.
8 */
9
10struct adc_data {
11 unsigned int adc_channels;
12};
13
14#endif
diff --git a/include/linux/platform_data/uio_dmem_genirq.h b/include/linux/platform_data/uio_dmem_genirq.h
new file mode 100644
index 000000000000..973c1bb32168
--- /dev/null
+++ b/include/linux/platform_data/uio_dmem_genirq.h
@@ -0,0 +1,26 @@
1/*
2 * include/linux/platform_data/uio_dmem_genirq.h
3 *
4 * Copyright (C) 2012 Damian Hobson-Garcia
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _UIO_DMEM_GENIRQ_H
17#define _UIO_DMEM_GENIRQ_H
18
19#include <linux/uio_driver.h>
20
21struct uio_dmem_genirq_pdata {
22 struct uio_info uioinfo;
23 unsigned int *dynamic_region_sizes;
24 unsigned int num_dynamic_regions;
25};
26#endif /* _UIO_DMEM_GENIRQ_H */
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
index f39140aabc6f..3d47d219827f 100644
--- a/include/linux/platform_data/uio_pruss.h
+++ b/include/linux/platform_data/uio_pruss.h
@@ -20,6 +20,7 @@
20 20
21/* To configure the PRUSS INTC base offset for UIO driver */ 21/* To configure the PRUSS INTC base offset for UIO driver */
22struct uio_pruss_pdata { 22struct uio_pruss_pdata {
23 u32 pintc_base; 23 u32 pintc_base;
24 struct gen_pool *sram_pool;
24}; 25};
25#endif /* _UIO_PRUSS_H_ */ 26#endif /* _UIO_PRUSS_H_ */
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
new file mode 100644
index 000000000000..ef65b67c56c3
--- /dev/null
+++ b/include/linux/platform_data/usb-omap.h
@@ -0,0 +1,83 @@
1/*
2 * usb-omap.h - Platform data for the various OMAP USB IPs
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * This software is distributed under the terms of the GNU General Public
7 * License ("GPL") version 2, as published by the Free Software Foundation.
8 *
9 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
10 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
12 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
13 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
14 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
15 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
16 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
17 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
18 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
19 * POSSIBILITY OF SUCH DAMAGE.
20 */
21
22#define OMAP3_HS_USB_PORTS 3
23
24enum usbhs_omap_port_mode {
25 OMAP_USBHS_PORT_MODE_UNUSED,
26 OMAP_EHCI_PORT_MODE_PHY,
27 OMAP_EHCI_PORT_MODE_TLL,
28 OMAP_EHCI_PORT_MODE_HSIC,
29 OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
30 OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
31 OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
32 OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
33 OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
34 OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
35 OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
36 OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
37 OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
38 OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
39};
40
41struct usbtll_omap_platform_data {
42 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
43};
44
45struct ehci_hcd_omap_platform_data {
46 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
47 int reset_gpio_port[OMAP3_HS_USB_PORTS];
48 struct regulator *regulator[OMAP3_HS_USB_PORTS];
49 unsigned phy_reset:1;
50};
51
52struct ohci_hcd_omap_platform_data {
53 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
54 unsigned es2_compatibility:1;
55};
56
57struct usbhs_omap_platform_data {
58 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
59
60 struct ehci_hcd_omap_platform_data *ehci_data;
61 struct ohci_hcd_omap_platform_data *ohci_data;
62
63 /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */
64 unsigned single_ulpi_bypass:1;
65};
66
67/*-------------------------------------------------------------------------*/
68
69struct omap_musb_board_data {
70 u8 interface_type;
71 u8 mode;
72 u16 power;
73 unsigned extvbus:1;
74 void (*set_phy_power)(u8 on);
75 void (*clear_irq)(void);
76 void (*set_mode)(u8 mode);
77 void (*reset)(void);
78};
79
80enum musb_interface {
81 MUSB_INTERFACE_ULPI,
82 MUSB_INTERFACE_UTMI
83};
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 5711e9525a2a..a9ded9a3c175 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,6 +55,7 @@ extern int platform_add_devices(struct platform_device **, int);
55 55
56struct platform_device_info { 56struct platform_device_info {
57 struct device *parent; 57 struct device *parent;
58 struct acpi_dev_node acpi_node;
58 59
59 const char *name; 60 const char *name;
60 int id; 61 int id;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 007e687c4f69..03d7bb145311 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -546,10 +546,9 @@ struct dev_pm_info {
546 unsigned long active_jiffies; 546 unsigned long active_jiffies;
547 unsigned long suspended_jiffies; 547 unsigned long suspended_jiffies;
548 unsigned long accounting_timestamp; 548 unsigned long accounting_timestamp;
549 struct dev_pm_qos_request *pq_req;
550#endif 549#endif
551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 550 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
552 struct pm_qos_constraints *constraints; 551 struct dev_pm_qos *qos;
553}; 552};
554 553
555extern void update_pm_runtime_accounting(struct device *dev); 554extern void update_pm_runtime_accounting(struct device *dev);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 9924ea1f22e0..5a95013905c8 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -20,6 +20,13 @@ enum {
20 PM_QOS_NUM_CLASSES, 20 PM_QOS_NUM_CLASSES,
21}; 21};
22 22
23enum pm_qos_flags_status {
24 PM_QOS_FLAGS_UNDEFINED = -1,
25 PM_QOS_FLAGS_NONE,
26 PM_QOS_FLAGS_SOME,
27 PM_QOS_FLAGS_ALL,
28};
29
23#define PM_QOS_DEFAULT_VALUE -1 30#define PM_QOS_DEFAULT_VALUE -1
24 31
25#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
@@ -27,14 +34,31 @@ enum {
27#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
28#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 35#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0
29 36
37#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
38#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1)
39
30struct pm_qos_request { 40struct pm_qos_request {
31 struct plist_node node; 41 struct plist_node node;
32 int pm_qos_class; 42 int pm_qos_class;
33 struct delayed_work work; /* for pm_qos_update_request_timeout */ 43 struct delayed_work work; /* for pm_qos_update_request_timeout */
34}; 44};
35 45
46struct pm_qos_flags_request {
47 struct list_head node;
48 s32 flags; /* Do not change to 64 bit */
49};
50
51enum dev_pm_qos_req_type {
52 DEV_PM_QOS_LATENCY = 1,
53 DEV_PM_QOS_FLAGS,
54};
55
36struct dev_pm_qos_request { 56struct dev_pm_qos_request {
37 struct plist_node node; 57 enum dev_pm_qos_req_type type;
58 union {
59 struct plist_node pnode;
60 struct pm_qos_flags_request flr;
61 } data;
38 struct device *dev; 62 struct device *dev;
39}; 63};
40 64
@@ -45,8 +69,8 @@ enum pm_qos_type {
45}; 69};
46 70
47/* 71/*
48 * Note: The lockless read path depends on the CPU accessing 72 * Note: The lockless read path depends on the CPU accessing target_value
49 * target_value atomically. Atomic access is only guaranteed on all CPU 73 * or effective_flags atomically. Atomic access is only guaranteed on all CPU
50 * types linux supports for 32 bit quantites 74 * types linux supports for 32 bit quantites
51 */ 75 */
52struct pm_qos_constraints { 76struct pm_qos_constraints {
@@ -57,6 +81,18 @@ struct pm_qos_constraints {
57 struct blocking_notifier_head *notifiers; 81 struct blocking_notifier_head *notifiers;
58}; 82};
59 83
84struct pm_qos_flags {
85 struct list_head list;
86 s32 effective_flags; /* Do not change to 64 bit */
87};
88
89struct dev_pm_qos {
90 struct pm_qos_constraints latency;
91 struct pm_qos_flags flags;
92 struct dev_pm_qos_request *latency_req;
93 struct dev_pm_qos_request *flags_req;
94};
95
60/* Action requested to pm_qos_update_target */ 96/* Action requested to pm_qos_update_target */
61enum pm_qos_req_action { 97enum pm_qos_req_action {
62 PM_QOS_ADD_REQ, /* Add a new request */ 98 PM_QOS_ADD_REQ, /* Add a new request */
@@ -71,6 +107,9 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req)
71 107
72int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, 108int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
73 enum pm_qos_req_action action, int value); 109 enum pm_qos_req_action action, int value);
110bool pm_qos_update_flags(struct pm_qos_flags *pqf,
111 struct pm_qos_flags_request *req,
112 enum pm_qos_req_action action, s32 val);
74void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, 113void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
75 s32 value); 114 s32 value);
76void pm_qos_update_request(struct pm_qos_request *req, 115void pm_qos_update_request(struct pm_qos_request *req,
@@ -86,10 +125,12 @@ int pm_qos_request_active(struct pm_qos_request *req);
86s32 pm_qos_read_value(struct pm_qos_constraints *c); 125s32 pm_qos_read_value(struct pm_qos_constraints *c);
87 126
88#ifdef CONFIG_PM 127#ifdef CONFIG_PM
128enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);
129enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask);
89s32 __dev_pm_qos_read_value(struct device *dev); 130s32 __dev_pm_qos_read_value(struct device *dev);
90s32 dev_pm_qos_read_value(struct device *dev); 131s32 dev_pm_qos_read_value(struct device *dev);
91int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 132int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
92 s32 value); 133 enum dev_pm_qos_req_type type, s32 value);
93int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); 134int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
94int dev_pm_qos_remove_request(struct dev_pm_qos_request *req); 135int dev_pm_qos_remove_request(struct dev_pm_qos_request *req);
95int dev_pm_qos_add_notifier(struct device *dev, 136int dev_pm_qos_add_notifier(struct device *dev,
@@ -103,12 +144,19 @@ void dev_pm_qos_constraints_destroy(struct device *dev);
103int dev_pm_qos_add_ancestor_request(struct device *dev, 144int dev_pm_qos_add_ancestor_request(struct device *dev,
104 struct dev_pm_qos_request *req, s32 value); 145 struct dev_pm_qos_request *req, s32 value);
105#else 146#else
147static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
148 s32 mask)
149 { return PM_QOS_FLAGS_UNDEFINED; }
150static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev,
151 s32 mask)
152 { return PM_QOS_FLAGS_UNDEFINED; }
106static inline s32 __dev_pm_qos_read_value(struct device *dev) 153static inline s32 __dev_pm_qos_read_value(struct device *dev)
107 { return 0; } 154 { return 0; }
108static inline s32 dev_pm_qos_read_value(struct device *dev) 155static inline s32 dev_pm_qos_read_value(struct device *dev)
109 { return 0; } 156 { return 0; }
110static inline int dev_pm_qos_add_request(struct device *dev, 157static inline int dev_pm_qos_add_request(struct device *dev,
111 struct dev_pm_qos_request *req, 158 struct dev_pm_qos_request *req,
159 enum dev_pm_qos_req_type type,
112 s32 value) 160 s32 value)
113 { return 0; } 161 { return 0; }
114static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req, 162static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req,
@@ -144,10 +192,31 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
144#ifdef CONFIG_PM_RUNTIME 192#ifdef CONFIG_PM_RUNTIME
145int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); 193int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
146void dev_pm_qos_hide_latency_limit(struct device *dev); 194void dev_pm_qos_hide_latency_limit(struct device *dev);
195int dev_pm_qos_expose_flags(struct device *dev, s32 value);
196void dev_pm_qos_hide_flags(struct device *dev);
197int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
198
199static inline s32 dev_pm_qos_requested_latency(struct device *dev)
200{
201 return dev->power.qos->latency_req->data.pnode.prio;
202}
203
204static inline s32 dev_pm_qos_requested_flags(struct device *dev)
205{
206 return dev->power.qos->flags_req->data.flr.flags;
207}
147#else 208#else
148static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) 209static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
149 { return 0; } 210 { return 0; }
150static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} 211static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
212static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value)
213 { return 0; }
214static inline void dev_pm_qos_hide_flags(struct device *dev) {}
215static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set)
216 { return 0; }
217
218static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; }
219static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; }
151#endif 220#endif
152 221
153#endif 222#endif
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h
new file mode 100644
index 000000000000..97a1665eaeaf
--- /dev/null
+++ b/include/linux/power/bq2415x_charger.h
@@ -0,0 +1,95 @@
1/*
2 * bq2415x charger driver
3 *
4 * Copyright (C) 2011-2012 Pali Rohár <pali.rohar@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef BQ2415X_CHARGER_H
22#define BQ2415X_CHARGER_H
23
24/*
25 * This is platform data for bq2415x chip. It contains default board
26 * voltages and currents which can be also later configured via sysfs. If
27 * value is -1 then default chip value (specified in datasheet) will be
28 * used.
29 *
30 * Value resistor_sense is needed for for configuring charge and
31 * termination current. It it is less or equal to zero, configuring charge
32 * and termination current will not be possible.
33 *
34 * Function set_mode_hook is needed for automode (setting correct current
35 * limit when charger is connected/disconnected or setting boost mode).
36 * When is NULL, automode function is disabled. When is not NULL, it must
37 * have this prototype:
38 *
39 * int (*set_mode_hook)(
40 * void (*hook)(enum bq2415x_mode mode, void *data),
41 * void *data)
42 *
43 * hook is hook function (see below) and data is pointer to driver private
44 * data
45 *
46 * bq2415x driver will call it as:
47 *
48 * platform_data->set_mode_hook(bq2415x_hook_function, bq2415x_device);
49 *
50 * Board/platform function set_mode_hook return non zero value when hook
51 * function was successful registered. Platform code should call that hook
52 * function (which get from pointer, with data) every time when charger
53 * was connected/disconnected or require to enable boost mode. bq2415x
54 * driver then will set correct current limit, enable/disable charger or
55 * boost mode.
56 *
57 * Hook function has this prototype:
58 *
59 * void hook(enum bq2415x_mode mode, void *data);
60 *
61 * mode is bq2415x mode (charger or boost)
62 * data is pointer to driver private data (which get from
63 * set_charger_type_hook)
64 *
65 * When bq driver is being unloaded, it call function:
66 *
67 * platform_data->set_mode_hook(NULL, NULL);
68 *
69 * (hook function and driver private data are NULL)
70 *
71 * After that board/platform code must not call driver hook function! It
72 * is possible that pointer to hook function will not be valid and calling
73 * will cause undefined result.
74 */
75
76/* Supported modes with maximal current limit */
77enum bq2415x_mode {
78 BQ2415X_MODE_NONE, /* unknown or no charger (100mA) */
79 BQ2415X_MODE_HOST_CHARGER, /* usb host/hub charger (500mA) */
80 BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */
81 BQ2415X_MODE_BOOST, /* boost mode (charging disabled) */
82};
83
84struct bq2415x_platform_data {
85 int current_limit; /* mA */
86 int weak_battery_voltage; /* mV */
87 int battery_regulation_voltage; /* mV */
88 int charge_current; /* mA */
89 int termination_current; /* mA */
90 int resistor_sense; /* m ohm */
91 int (*set_mode_hook)(void (*hook)(enum bq2415x_mode mode, void *data),
92 void *data);
93};
94
95#endif
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index 4a496ebc7d73..c0f44c2b006d 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -260,8 +260,13 @@ struct omap_sr_nvalue_table {
260 * 260 *
261 * @name: instance name 261 * @name: instance name
262 * @ip_type: Smartreflex IP type. 262 * @ip_type: Smartreflex IP type.
263 * @senp_mod: SENPENABLE value for the sr 263 * @senp_mod: SENPENABLE value of the sr CONFIG register
264 * @senn_mod: SENNENABLE value for sr 264 * @senn_mod: SENNENABLE value for sr CONFIG register
265 * @err_weight ERRWEIGHT value of the sr ERRCONFIG register
266 * @err_maxlimit ERRMAXLIMIT value of the sr ERRCONFIG register
267 * @accum_data ACCUMDATA value of the sr CONFIG register
268 * @senn_avgweight SENNAVGWEIGHT value of the sr AVGWEIGHT register
269 * @senp_avgweight SENPAVGWEIGHT value of the sr AVGWEIGHT register
265 * @nvalue_count: Number of distinct nvalues in the nvalue table 270 * @nvalue_count: Number of distinct nvalues in the nvalue table
266 * @enable_on_init: whether this sr module needs to enabled at 271 * @enable_on_init: whether this sr module needs to enabled at
267 * boot up or not. 272 * boot up or not.
@@ -274,6 +279,11 @@ struct omap_sr_data {
274 int ip_type; 279 int ip_type;
275 u32 senp_mod; 280 u32 senp_mod;
276 u32 senn_mod; 281 u32 senn_mod;
282 u32 err_weight;
283 u32 err_maxlimit;
284 u32 accum_data;
285 u32 senn_avgweight;
286 u32 senp_avgweight;
277 int nvalue_count; 287 int nvalue_count;
278 bool enable_on_init; 288 bool enable_on_init;
279 struct omap_sr_nvalue_table *nvalue_table; 289 struct omap_sr_nvalue_table *nvalue_table;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index e5ef45834c3c..1f0ab90aff00 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -114,6 +114,8 @@ enum power_supply_property {
114 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, 114 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, 115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
116 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, 116 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
117 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
118 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
117 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 119 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
118 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 120 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
119 POWER_SUPPLY_PROP_ENERGY_FULL, 121 POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -186,6 +188,7 @@ struct power_supply {
186 struct work_struct changed_work; 188 struct work_struct changed_work;
187#ifdef CONFIG_THERMAL 189#ifdef CONFIG_THERMAL
188 struct thermal_zone_device *tzd; 190 struct thermal_zone_device *tzd;
191 struct thermal_cooling_device *tcd;
189#endif 192#endif
190 193
191#ifdef CONFIG_LEDS_TRIGGERS 194#ifdef CONFIG_LEDS_TRIGGERS
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 3fd2e871ff1b..32676b35d2f5 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -28,7 +28,11 @@ struct mm_struct;
28 */ 28 */
29 29
30enum { 30enum {
31 PROC_ROOT_INO = 1, 31 PROC_ROOT_INO = 1,
32 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
33 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
34 PROC_USER_INIT_INO = 0xEFFFFFFDU,
35 PROC_PID_INIT_INO = 0xEFFFFFFCU,
32}; 36};
33 37
34/* 38/*
@@ -174,7 +178,10 @@ extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 178 struct proc_dir_entry *parent);
175 179
176extern struct file *proc_ns_fget(int fd); 180extern struct file *proc_ns_fget(int fd);
181extern bool proc_ns_inode(struct inode *inode);
177 182
183extern int proc_alloc_inum(unsigned int *pino);
184extern void proc_free_inum(unsigned int inum);
178#else 185#else
179 186
180#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 187#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
@@ -229,6 +236,19 @@ static inline struct file *proc_ns_fget(int fd)
229 return ERR_PTR(-EINVAL); 236 return ERR_PTR(-EINVAL);
230} 237}
231 238
239static inline bool proc_ns_inode(struct inode *inode)
240{
241 return false;
242}
243
244static inline int proc_alloc_inum(unsigned int *inum)
245{
246 *inum = 1;
247 return 0;
248}
249static inline void proc_free_inum(unsigned int inum)
250{
251}
232#endif /* CONFIG_PROC_FS */ 252#endif /* CONFIG_PROC_FS */
233 253
234#if !defined(CONFIG_PROC_KCORE) 254#if !defined(CONFIG_PROC_KCORE)
@@ -247,10 +267,14 @@ struct proc_ns_operations {
247 void *(*get)(struct task_struct *task); 267 void *(*get)(struct task_struct *task);
248 void (*put)(void *ns); 268 void (*put)(void *ns);
249 int (*install)(struct nsproxy *nsproxy, void *ns); 269 int (*install)(struct nsproxy *nsproxy, void *ns);
270 unsigned int (*inum)(void *ns);
250}; 271};
251extern const struct proc_ns_operations netns_operations; 272extern const struct proc_ns_operations netns_operations;
252extern const struct proc_ns_operations utsns_operations; 273extern const struct proc_ns_operations utsns_operations;
253extern const struct proc_ns_operations ipcns_operations; 274extern const struct proc_ns_operations ipcns_operations;
275extern const struct proc_ns_operations pidns_operations;
276extern const struct proc_ns_operations userns_operations;
277extern const struct proc_ns_operations mntns_operations;
254 278
255union proc_op { 279union proc_op {
256 int (*proc_get_link)(struct dentry *, struct path *); 280 int (*proc_get_link)(struct dentry *, struct path *);
@@ -290,4 +314,7 @@ static inline struct net *PDE_NET(struct proc_dir_entry *pde)
290 return pde->parent->data; 314 return pde->parent->data;
291} 315}
292 316
317#include <linux/signal.h>
318
319void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set);
293#endif /* _LINUX_PROC_FS_H */ 320#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index ee3034a40884..1788909d9a99 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -50,16 +50,18 @@ struct pstore_info {
50 int (*open)(struct pstore_info *psi); 50 int (*open)(struct pstore_info *psi);
51 int (*close)(struct pstore_info *psi); 51 int (*close)(struct pstore_info *psi);
52 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 52 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
53 struct timespec *time, char **buf, 53 int *count, struct timespec *time, char **buf,
54 struct pstore_info *psi); 54 struct pstore_info *psi);
55 int (*write)(enum pstore_type_id type, 55 int (*write)(enum pstore_type_id type,
56 enum kmsg_dump_reason reason, u64 *id, 56 enum kmsg_dump_reason reason, u64 *id,
57 unsigned int part, size_t size, struct pstore_info *psi); 57 unsigned int part, int count, size_t size,
58 struct pstore_info *psi);
58 int (*write_buf)(enum pstore_type_id type, 59 int (*write_buf)(enum pstore_type_id type,
59 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
60 unsigned int part, const char *buf, size_t size, 61 unsigned int part, const char *buf, size_t size,
61 struct pstore_info *psi); 62 struct pstore_info *psi);
62 int (*erase)(enum pstore_type_id type, u64 id, 63 int (*erase)(enum pstore_type_id type, u64 id,
64 int count, struct timespec time,
63 struct pstore_info *psi); 65 struct pstore_info *psi);
64 void *data; 66 void *data;
65}; 67};
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index 098d2a838296..cb6ab5feab67 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -46,9 +46,8 @@ struct persistent_ram_zone {
46 size_t old_log_size; 46 size_t old_log_size;
47}; 47};
48 48
49struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, 49struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
50 size_t size, u32 sig, 50 u32 sig, int ecc_size);
51 int ecc_size);
52void persistent_ram_free(struct persistent_ram_zone *prz); 51void persistent_ram_free(struct persistent_ram_zone *prz);
53void persistent_ram_zap(struct persistent_ram_zone *prz); 52void persistent_ram_zap(struct persistent_ram_zone *prz);
54 53
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index f2dc6d8fc680..38a993508327 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -54,7 +54,8 @@ struct ptp_clock_request {
54 * clock operations 54 * clock operations
55 * 55 *
56 * @adjfreq: Adjusts the frequency of the hardware clock. 56 * @adjfreq: Adjusts the frequency of the hardware clock.
57 * parameter delta: Desired period change in parts per billion. 57 * parameter delta: Desired frequency offset from nominal frequency
58 * in parts per billion
58 * 59 *
59 * @adjtime: Shifts the time of the hardware clock. 60 * @adjtime: Shifts the time of the hardware clock.
60 * parameter delta: Desired change in nanoseconds. 61 * parameter delta: Desired change in nanoseconds.
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index e0ff4689d35a..1693775ecfe8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -32,6 +32,8 @@
32#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 32#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
33#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP) 33#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP)
34 34
35#define PT_EXITKILL (PTRACE_O_EXITKILL << PT_OPT_FLAG_SHIFT)
36
35/* single stepping state bits (used on ARM and PA-RISC) */ 37/* single stepping state bits (used on ARM and PA-RISC) */
36#define PT_SINGLESTEP_BIT 31 38#define PT_SINGLESTEP_BIT 31
37#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) 39#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT)
@@ -329,6 +331,23 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
329#define current_pt_regs() task_pt_regs(current) 331#define current_pt_regs() task_pt_regs(current)
330#endif 332#endif
331 333
334#ifndef ptrace_signal_deliver
335#define ptrace_signal_deliver() ((void)0)
336#endif
337
338/*
339 * unlike current_pt_regs(), this one is equal to task_pt_regs(current)
340 * on *all* architectures; the only reason to have a per-arch definition
341 * is optimisation.
342 */
343#ifndef signal_pt_regs
344#define signal_pt_regs() task_pt_regs(current)
345#endif
346
347#ifndef current_user_stack_pointer
348#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
349#endif
350
332extern int task_current_syscall(struct task_struct *target, long *callno, 351extern int task_current_syscall(struct task_struct *target, long *callno,
333 unsigned long args[6], unsigned int maxargs, 352 unsigned long args[6], unsigned int maxargs,
334 unsigned long *sp, unsigned long *pc); 353 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h
new file mode 100644
index 000000000000..0ca75825b60d
--- /dev/null
+++ b/include/linux/pvclock_gtod.h
@@ -0,0 +1,9 @@
1#ifndef _PVCLOCK_GTOD_H
2#define _PVCLOCK_GTOD_H
3
4#include <linux/notifier.h>
5
6extern int pvclock_gtod_register_notifier(struct notifier_block *nb);
7extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb);
8
9#endif /* _PVCLOCK_GTOD_H */
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 112b31436848..6d661f32e0e4 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -171,6 +171,9 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
171 unsigned int index, 171 unsigned int index,
172 const char *label); 172 const char *label);
173 173
174struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
175 const struct of_phandle_args *args);
176
174struct pwm_device *pwm_get(struct device *dev, const char *consumer); 177struct pwm_device *pwm_get(struct device *dev, const char *consumer);
175void pwm_put(struct pwm_device *pwm); 178void pwm_put(struct pwm_device *pwm);
176 179
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/raid/Kbuild
+++ /dev/null
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 640c69ceec96..8dfaa2ce2e95 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -98,6 +98,9 @@ extern const struct raid6_calls raid6_altivec1;
98extern const struct raid6_calls raid6_altivec2; 98extern const struct raid6_calls raid6_altivec2;
99extern const struct raid6_calls raid6_altivec4; 99extern const struct raid6_calls raid6_altivec4;
100extern const struct raid6_calls raid6_altivec8; 100extern const struct raid6_calls raid6_altivec8;
101extern const struct raid6_calls raid6_avx2x1;
102extern const struct raid6_calls raid6_avx2x2;
103extern const struct raid6_calls raid6_avx2x4;
101 104
102struct raid6_recov_calls { 105struct raid6_recov_calls {
103 void (*data2)(int, size_t, int, int, void **); 106 void (*data2)(int, size_t, int, int, void **);
@@ -109,6 +112,7 @@ struct raid6_recov_calls {
109 112
110extern const struct raid6_recov_calls raid6_recov_intx1; 113extern const struct raid6_recov_calls raid6_recov_intx1;
111extern const struct raid6_recov_calls raid6_recov_ssse3; 114extern const struct raid6_recov_calls raid6_recov_ssse3;
115extern const struct raid6_recov_calls raid6_recov_avx2;
112 116
113/* Algorithm list */ 117/* Algorithm list */
114extern const struct raid6_calls * const raid6_algos[]; 118extern const struct raid6_calls * const raid6_algos[];
diff --git a/include/linux/random.h b/include/linux/random.h
index 6330ed47b38b..d9846088c2c5 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -25,10 +25,19 @@ extern const struct file_operations random_fops, urandom_fops;
25unsigned int get_random_int(void); 25unsigned int get_random_int(void);
26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
27 27
28u32 random32(void); 28u32 prandom_u32(void);
29void srandom32(u32 seed); 29void prandom_bytes(void *buf, int nbytes);
30void prandom_seed(u32 seed);
30 31
31u32 prandom32(struct rnd_state *); 32/*
33 * These macros are preserved for backward compatibility and should be
34 * removed as soon as a transition is finished.
35 */
36#define random32() prandom_u32()
37#define srandom32(seed) prandom_seed(seed)
38
39u32 prandom_u32_state(struct rnd_state *);
40void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
32 41
33/* 42/*
34 * Handle minimum values for seeds 43 * Handle minimum values for seeds
@@ -39,11 +48,11 @@ static inline u32 __seed(u32 x, u32 m)
39} 48}
40 49
41/** 50/**
42 * prandom32_seed - set seed for prandom32(). 51 * prandom_seed_state - set seed for prandom_u32_state().
43 * @state: pointer to state structure to receive the seed. 52 * @state: pointer to state structure to receive the seed.
44 * @seed: arbitrary 64-bit value to use as a seed. 53 * @seed: arbitrary 64-bit value to use as a seed.
45 */ 54 */
46static inline void prandom32_seed(struct rnd_state *state, u64 seed) 55static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
47{ 56{
48 u32 i = (seed >> 32) ^ (seed << 10) ^ seed; 57 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
49 58
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index e0f0fab20415..c92dd28eaa6c 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -286,23 +286,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
286 &pos->member != (head); \ 286 &pos->member != (head); \
287 pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) 287 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
288 288
289
290/**
291 * list_for_each_continue_rcu
292 * @pos: the &struct list_head to use as a loop cursor.
293 * @head: the head for your list.
294 *
295 * Iterate over an rcu-protected list, continuing after current point.
296 *
297 * This list-traversal primitive may safely run concurrently with
298 * the _rcu list-mutation primitives such as list_add_rcu()
299 * as long as the traversal is guarded by rcu_read_lock().
300 */
301#define list_for_each_continue_rcu(pos, head) \
302 for ((pos) = rcu_dereference_raw(list_next_rcu(pos)); \
303 (pos) != (head); \
304 (pos) = rcu_dereference_raw(list_next_rcu(pos)))
305
306/** 289/**
307 * list_for_each_entry_continue_rcu - continue iteration over list of given type 290 * list_for_each_entry_continue_rcu - continue iteration over list of given type
308 * @pos: the type * to use as a loop cursor. 291 * @pos: the type * to use as a loop cursor.
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 7c968e4f929e..275aa3f1062d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -90,6 +90,25 @@ extern void do_trace_rcu_torture_read(char *rcutorturename,
90 * that started after call_rcu() was invoked. RCU read-side critical 90 * that started after call_rcu() was invoked. RCU read-side critical
91 * sections are delimited by rcu_read_lock() and rcu_read_unlock(), 91 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
92 * and may be nested. 92 * and may be nested.
93 *
94 * Note that all CPUs must agree that the grace period extended beyond
95 * all pre-existing RCU read-side critical section. On systems with more
96 * than one CPU, this means that when "func()" is invoked, each CPU is
97 * guaranteed to have executed a full memory barrier since the end of its
98 * last RCU read-side critical section whose beginning preceded the call
99 * to call_rcu(). It also means that each CPU executing an RCU read-side
100 * critical section that continues beyond the start of "func()" must have
101 * executed a memory barrier after the call_rcu() but before the beginning
102 * of that RCU read-side critical section. Note that these guarantees
103 * include CPUs that are offline, idle, or executing in user mode, as
104 * well as CPUs that are executing in the kernel.
105 *
106 * Furthermore, if CPU A invoked call_rcu() and CPU B invoked the
107 * resulting RCU callback function "func()", then both CPU A and CPU B are
108 * guaranteed to execute a full memory barrier during the time interval
109 * between the call to call_rcu() and the invocation of "func()" -- even
110 * if CPU A and CPU B are the same CPU (but again only if the system has
111 * more than one CPU).
93 */ 112 */
94extern void call_rcu(struct rcu_head *head, 113extern void call_rcu(struct rcu_head *head,
95 void (*func)(struct rcu_head *head)); 114 void (*func)(struct rcu_head *head));
@@ -118,6 +137,9 @@ extern void call_rcu(struct rcu_head *head,
118 * OR 137 * OR
119 * - rcu_read_lock_bh() and rcu_read_unlock_bh(), if in process context. 138 * - rcu_read_lock_bh() and rcu_read_unlock_bh(), if in process context.
120 * These may be nested. 139 * These may be nested.
140 *
141 * See the description of call_rcu() for more detailed information on
142 * memory ordering guarantees.
121 */ 143 */
122extern void call_rcu_bh(struct rcu_head *head, 144extern void call_rcu_bh(struct rcu_head *head,
123 void (*func)(struct rcu_head *head)); 145 void (*func)(struct rcu_head *head));
@@ -137,6 +159,9 @@ extern void call_rcu_bh(struct rcu_head *head,
137 * OR 159 * OR
138 * anything that disables preemption. 160 * anything that disables preemption.
139 * These may be nested. 161 * These may be nested.
162 *
163 * See the description of call_rcu() for more detailed information on
164 * memory ordering guarantees.
140 */ 165 */
141extern void call_rcu_sched(struct rcu_head *head, 166extern void call_rcu_sched(struct rcu_head *head,
142 void (*func)(struct rcu_head *rcu)); 167 void (*func)(struct rcu_head *rcu));
@@ -197,13 +222,13 @@ extern void rcu_user_enter(void);
197extern void rcu_user_exit(void); 222extern void rcu_user_exit(void);
198extern void rcu_user_enter_after_irq(void); 223extern void rcu_user_enter_after_irq(void);
199extern void rcu_user_exit_after_irq(void); 224extern void rcu_user_exit_after_irq(void);
200extern void rcu_user_hooks_switch(struct task_struct *prev,
201 struct task_struct *next);
202#else 225#else
203static inline void rcu_user_enter(void) { } 226static inline void rcu_user_enter(void) { }
204static inline void rcu_user_exit(void) { } 227static inline void rcu_user_exit(void) { }
205static inline void rcu_user_enter_after_irq(void) { } 228static inline void rcu_user_enter_after_irq(void) { }
206static inline void rcu_user_exit_after_irq(void) { } 229static inline void rcu_user_exit_after_irq(void) { }
230static inline void rcu_user_hooks_switch(struct task_struct *prev,
231 struct task_struct *next) { }
207#endif /* CONFIG_RCU_USER_QS */ 232#endif /* CONFIG_RCU_USER_QS */
208 233
209extern void exit_rcu(void); 234extern void exit_rcu(void);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e3bcc3f4dcb8..b7e95bf942c9 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -19,6 +19,7 @@
19struct module; 19struct module;
20struct device; 20struct device;
21struct i2c_client; 21struct i2c_client;
22struct irq_domain;
22struct spi_device; 23struct spi_device;
23struct regmap; 24struct regmap;
24struct regmap_range_cfg; 25struct regmap_range_cfg;
@@ -54,6 +55,39 @@ enum regmap_endian {
54}; 55};
55 56
56/** 57/**
58 * A register range, used for access related checks
59 * (readable/writeable/volatile/precious checks)
60 *
61 * @range_min: address of first register
62 * @range_max: address of last register
63 */
64struct regmap_range {
65 unsigned int range_min;
66 unsigned int range_max;
67};
68
69/*
70 * A table of ranges including some yes ranges and some no ranges.
71 * If a register belongs to a no_range, the corresponding check function
72 * will return false. If a register belongs to a yes range, the corresponding
73 * check function will return true. "no_ranges" are searched first.
74 *
75 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
76 * @n_yes_ranges: size of the above array
77 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
78 * @n_no_ranges: size of the above array
79 */
80struct regmap_access_table {
81 const struct regmap_range *yes_ranges;
82 unsigned int n_yes_ranges;
83 const struct regmap_range *no_ranges;
84 unsigned int n_no_ranges;
85};
86
87typedef void (*regmap_lock)(void *);
88typedef void (*regmap_unlock)(void *);
89
90/**
57 * Configuration for the register map of a device. 91 * Configuration for the register map of a device.
58 * 92 *
59 * @name: Optional name of the regmap. Useful when a device has multiple 93 * @name: Optional name of the regmap. Useful when a device has multiple
@@ -67,16 +101,39 @@ enum regmap_endian {
67 * @val_bits: Number of bits in a register value, mandatory. 101 * @val_bits: Number of bits in a register value, mandatory.
68 * 102 *
69 * @writeable_reg: Optional callback returning true if the register 103 * @writeable_reg: Optional callback returning true if the register
70 * can be written to. 104 * can be written to. If this field is NULL but wr_table
105 * (see below) is not, the check is performed on such table
106 * (a register is writeable if it belongs to one of the ranges
107 * specified by wr_table).
71 * @readable_reg: Optional callback returning true if the register 108 * @readable_reg: Optional callback returning true if the register
72 * can be read from. 109 * can be read from. If this field is NULL but rd_table
110 * (see below) is not, the check is performed on such table
111 * (a register is readable if it belongs to one of the ranges
112 * specified by rd_table).
73 * @volatile_reg: Optional callback returning true if the register 113 * @volatile_reg: Optional callback returning true if the register
74 * value can't be cached. 114 * value can't be cached. If this field is NULL but
115 * volatile_table (see below) is not, the check is performed on
116 * such table (a register is volatile if it belongs to one of
117 * the ranges specified by volatile_table).
75 * @precious_reg: Optional callback returning true if the rgister 118 * @precious_reg: Optional callback returning true if the rgister
76 * should not be read outside of a call from the driver 119 * should not be read outside of a call from the driver
77 * (eg, a clear on read interrupt status register). 120 * (eg, a clear on read interrupt status register). If this
121 * field is NULL but precious_table (see below) is not, the
122 * check is performed on such table (a register is precious if
123 * it belongs to one of the ranges specified by precious_table).
124 * @lock: Optional lock callback (overrides regmap's default lock
125 * function, based on spinlock or mutex).
126 * @unlock: As above for unlocking.
127 * @lock_arg: this field is passed as the only argument of lock/unlock
128 * functions (ignored in case regular lock/unlock functions
129 * are not overridden).
78 * 130 *
79 * @max_register: Optional, specifies the maximum valid register index. 131 * @max_register: Optional, specifies the maximum valid register index.
132 * @wr_table: Optional, points to a struct regmap_access_table specifying
133 * valid ranges for write access.
134 * @rd_table: As above, for read access.
135 * @volatile_table: As above, for volatile registers.
136 * @precious_table: As above, for precious registers.
80 * @reg_defaults: Power on reset values for registers (for use with 137 * @reg_defaults: Power on reset values for registers (for use with
81 * register cache support). 138 * register cache support).
82 * @num_reg_defaults: Number of elements in reg_defaults. 139 * @num_reg_defaults: Number of elements in reg_defaults.
@@ -116,8 +173,15 @@ struct regmap_config {
116 bool (*readable_reg)(struct device *dev, unsigned int reg); 173 bool (*readable_reg)(struct device *dev, unsigned int reg);
117 bool (*volatile_reg)(struct device *dev, unsigned int reg); 174 bool (*volatile_reg)(struct device *dev, unsigned int reg);
118 bool (*precious_reg)(struct device *dev, unsigned int reg); 175 bool (*precious_reg)(struct device *dev, unsigned int reg);
176 regmap_lock lock;
177 regmap_unlock unlock;
178 void *lock_arg;
119 179
120 unsigned int max_register; 180 unsigned int max_register;
181 const struct regmap_access_table *wr_table;
182 const struct regmap_access_table *rd_table;
183 const struct regmap_access_table *volatile_table;
184 const struct regmap_access_table *precious_table;
121 const struct reg_default *reg_defaults; 185 const struct reg_default *reg_defaults;
122 unsigned int num_reg_defaults; 186 unsigned int num_reg_defaults;
123 enum regcache_type cache_type; 187 enum regcache_type cache_type;
@@ -133,7 +197,7 @@ struct regmap_config {
133 enum regmap_endian val_format_endian; 197 enum regmap_endian val_format_endian;
134 198
135 const struct regmap_range_cfg *ranges; 199 const struct regmap_range_cfg *ranges;
136 unsigned int n_ranges; 200 unsigned int num_ranges;
137}; 201};
138 202
139/** 203/**
@@ -142,6 +206,8 @@ struct regmap_config {
142 * 1. page selector register update; 206 * 1. page selector register update;
143 * 2. access through data window registers. 207 * 2. access through data window registers.
144 * 208 *
209 * @name: Descriptive name for diagnostics
210 *
145 * @range_min: Address of the lowest register address in virtual range. 211 * @range_min: Address of the lowest register address in virtual range.
146 * @range_max: Address of the highest register in virtual range. 212 * @range_max: Address of the highest register in virtual range.
147 * 213 *
@@ -153,6 +219,8 @@ struct regmap_config {
153 * @window_len: Number of registers in data window. 219 * @window_len: Number of registers in data window.
154 */ 220 */
155struct regmap_range_cfg { 221struct regmap_range_cfg {
222 const char *name;
223
156 /* Registers of virtual address range */ 224 /* Registers of virtual address range */
157 unsigned int range_min; 225 unsigned int range_min;
158 unsigned int range_max; 226 unsigned int range_max;
@@ -181,7 +249,9 @@ typedef void (*regmap_hw_free_context)(void *context);
181 * Description of a hardware bus for the register map infrastructure. 249 * Description of a hardware bus for the register map infrastructure.
182 * 250 *
183 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex 251 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
184 * to perform locking. 252 * to perform locking. This field is ignored if custom lock/unlock
253 * functions are used (see fields lock/unlock of
254 * struct regmap_config).
185 * @write: Write operation. 255 * @write: Write operation.
186 * @gather_write: Write operation with split register/value, return -ENOTSUPP 256 * @gather_write: Write operation with split register/value, return -ENOTSUPP
187 * if not implemented on a given device. 257 * if not implemented on a given device.
@@ -262,6 +332,16 @@ void regcache_mark_dirty(struct regmap *map);
262int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 332int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
263 int num_regs); 333 int num_regs);
264 334
335static inline bool regmap_reg_in_range(unsigned int reg,
336 const struct regmap_range *range)
337{
338 return reg >= range->range_min && reg <= range->range_max;
339}
340
341bool regmap_reg_in_ranges(unsigned int reg,
342 const struct regmap_range *ranges,
343 unsigned int nranges);
344
265/** 345/**
266 * Description of an IRQ for the generic regmap irq_chip. 346 * Description of an IRQ for the generic regmap irq_chip.
267 * 347 *
@@ -317,6 +397,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
317void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 397void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
318int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 398int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
319int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq); 399int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
400struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
320 401
321#else 402#else
322 403
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index c43cd3556b1f..7bc732ce6e50 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -160,6 +160,7 @@ int regulator_bulk_force_disable(int num_consumers,
160void regulator_bulk_free(int num_consumers, 160void regulator_bulk_free(int num_consumers,
161 struct regulator_bulk_data *consumers); 161 struct regulator_bulk_data *consumers);
162 162
163int regulator_can_change_voltage(struct regulator *regulator);
163int regulator_count_voltages(struct regulator *regulator); 164int regulator_count_voltages(struct regulator *regulator);
164int regulator_list_voltage(struct regulator *regulator, unsigned selector); 165int regulator_list_voltage(struct regulator *regulator, unsigned selector);
165int regulator_is_supported_voltage(struct regulator *regulator, 166int regulator_is_supported_voltage(struct regulator *regulator,
@@ -358,6 +359,10 @@ static inline void regulator_set_drvdata(struct regulator *regulator,
358{ 359{
359} 360}
360 361
362static inline int regulator_count_voltages(struct regulator *regulator)
363{
364 return 0;
365}
361#endif 366#endif
362 367
363static inline int regulator_set_voltage_tol(struct regulator *regulator, 368static inline int regulator_set_voltage_tol(struct regulator *regulator,
@@ -367,4 +372,12 @@ static inline int regulator_set_voltage_tol(struct regulator *regulator,
367 new_uV - tol_uV, new_uV + tol_uV); 372 new_uV - tol_uV, new_uV + tol_uV);
368} 373}
369 374
375static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
376 int target_uV, int tol_uV)
377{
378 return regulator_is_supported_voltage(regulator,
379 target_uV - tol_uV,
380 target_uV + tol_uV);
381}
382
370#endif 383#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 7932a3bf21bd..d10bb0f39c5e 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -181,10 +181,13 @@ enum regulator_type {
181 * @type: Indicates if the regulator is a voltage or current regulator. 181 * @type: Indicates if the regulator is a voltage or current regulator.
182 * @owner: Module providing the regulator, used for refcounting. 182 * @owner: Module providing the regulator, used for refcounting.
183 * 183 *
184 * @continuous_voltage_range: Indicates if the regulator can set any
185 * voltage within constrains range.
184 * @n_voltages: Number of selectors available for ops.list_voltage(). 186 * @n_voltages: Number of selectors available for ops.list_voltage().
185 * 187 *
186 * @min_uV: Voltage given by the lowest selector (if linear mapping) 188 * @min_uV: Voltage given by the lowest selector (if linear mapping)
187 * @uV_step: Voltage increase with each selector (if linear mapping) 189 * @uV_step: Voltage increase with each selector (if linear mapping)
190 * @linear_min_sel: Minimal selector for starting linear mapping
188 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 191 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
189 * @volt_table: Voltage mapping table (if table based mapping) 192 * @volt_table: Voltage mapping table (if table based mapping)
190 * 193 *
@@ -199,6 +202,7 @@ struct regulator_desc {
199 const char *name; 202 const char *name;
200 const char *supply_name; 203 const char *supply_name;
201 int id; 204 int id;
205 bool continuous_voltage_range;
202 unsigned n_voltages; 206 unsigned n_voltages;
203 struct regulator_ops *ops; 207 struct regulator_ops *ops;
204 int irq; 208 int irq;
@@ -207,6 +211,7 @@ struct regulator_desc {
207 211
208 unsigned int min_uV; 212 unsigned int min_uV;
209 unsigned int uV_step; 213 unsigned int uV_step;
214 unsigned int linear_min_sel;
210 unsigned int ramp_delay; 215 unsigned int ramp_delay;
211 216
212 const unsigned int *volt_table; 217 const unsigned int *volt_table;
diff --git a/include/linux/regulator/max8973-regulator.h b/include/linux/regulator/max8973-regulator.h
new file mode 100644
index 000000000000..f8acc052e353
--- /dev/null
+++ b/include/linux/regulator/max8973-regulator.h
@@ -0,0 +1,72 @@
1/*
2 * max8973-regulator.h -- MAXIM 8973 regulator
3 *
4 * Interface for regulator driver for MAXIM 8973 DC-DC step-down
5 * switching regulator.
6 *
7 * Copyright (C) 2012 NVIDIA Corporation
8
9 * Author: Laxman Dewangan <ldewangan@nvidia.com>
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 as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 *
25 */
26
27#ifndef __LINUX_REGULATOR_MAX8973_H
28#define __LINUX_REGULATOR_MAX8973_H
29
30/*
31 * Control flags for configuration of the device.
32 * Client need to pass this information with ORed
33 */
34#define MAX8973_CONTROL_REMOTE_SENSE_ENABLE 0x00000001
35#define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE 0x00000002
36#define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE 0x00000004
37#define MAX8973_CONTROL_BIAS_ENABLE 0x00000008
38#define MAX8973_CONTROL_PULL_DOWN_ENABLE 0x00000010
39#define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE 0x00000020
40
41#define MAX8973_CONTROL_CLKADV_TRIP_DISABLED 0x00000000
42#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US 0x00010000
43#define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US 0x00020000
44#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS 0x00030000
45
46#define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL 0x00000000
47#define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER 0x00100000
48#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER 0x00200000
49#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER 0x00300000
50
51/*
52 * struct max8973_regulator_platform_data - max8973 regulator platform data.
53 *
54 * @reg_init_data: The regulator init data.
55 * @control_flags: Control flags which are ORed value of above flags to
56 * configure device.
57 * @enable_ext_control: Enable the voltage enable/disable through external
58 * control signal from EN input pin. If it is false then
59 * voltage output will be enabled/disabled through EN bit of
60 * device register.
61 * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic.
62 * @dvs_def_state: Default state of dvs. 1 if it is high else 0.
63 */
64struct max8973_regulator_platform_data {
65 struct regulator_init_data *reg_init_data;
66 unsigned long control_flags;
67 bool enable_ext_control;
68 int dvs_gpio;
69 unsigned dvs_def_state:1;
70};
71
72#endif /* __LINUX_REGULATOR_MAX8973_H */
diff --git a/include/linux/regulator/tps51632-regulator.h b/include/linux/regulator/tps51632-regulator.h
new file mode 100644
index 000000000000..d00841e1a75a
--- /dev/null
+++ b/include/linux/regulator/tps51632-regulator.h
@@ -0,0 +1,47 @@
1/*
2 * tps51632-regulator.h -- TPS51632 regulator
3 *
4 * Interface for regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down
5 * Driverless Controller with serial VID control and DVFS.
6 *
7 * Copyright (C) 2012 NVIDIA Corporation
8
9 * Author: Laxman Dewangan <ldewangan@nvidia.com>
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 as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 *
25 */
26
27#ifndef __LINUX_REGULATOR_TPS51632_H
28#define __LINUX_REGULATOR_TPS51632_H
29
30/*
31 * struct tps51632_regulator_platform_data - tps51632 regulator platform data.
32 *
33 * @reg_init_data: The regulator init data.
34 * @enable_pwm_dvfs: Enable PWM DVFS or not.
35 * @dvfs_step_20mV: Step for DVFS is 20mV or 10mV.
36 * @max_voltage_uV: Maximum possible voltage in PWM-DVFS mode.
37 * @base_voltage_uV: Base voltage when PWM-DVFS enabled.
38 */
39struct tps51632_regulator_platform_data {
40 struct regulator_init_data *reg_init_data;
41 bool enable_pwm_dvfs;
42 bool dvfs_step_20mV;
43 int max_voltage_uV;
44 int base_voltage_uV;
45};
46
47#endif /* __LINUX_REGULATOR_TPS51632_H */
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
deleted file mode 100644
index 0fa04b64db3e..000000000000
--- a/include/linux/regulator/tps65090-regulator.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Regulator driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14
15 * 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 __REGULATOR_TPS65090_H
20#define __REGULATOR_TPS65090_H
21
22#include <linux/regulator/machine.h>
23
24#define tps65090_rails(_name) "tps65090_"#_name
25
26enum {
27 TPS65090_ID_DCDC1,
28 TPS65090_ID_DCDC2,
29 TPS65090_ID_DCDC3,
30 TPS65090_ID_FET1,
31 TPS65090_ID_FET2,
32 TPS65090_ID_FET3,
33 TPS65090_ID_FET4,
34 TPS65090_ID_FET5,
35 TPS65090_ID_FET6,
36 TPS65090_ID_FET7,
37};
38
39/*
40 * struct tps65090_regulator_platform_data
41 *
42 * @regulator: The regulator init data.
43 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
44 */
45
46struct tps65090_regulator_platform_data {
47 struct regulator_init_data regulator;
48};
49
50#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 7d7fbe2ef782..5ae8456d9670 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -74,14 +74,9 @@ ssize_t res_counter_read(struct res_counter *counter, int member,
74 const char __user *buf, size_t nbytes, loff_t *pos, 74 const char __user *buf, size_t nbytes, loff_t *pos,
75 int (*read_strategy)(unsigned long long val, char *s)); 75 int (*read_strategy)(unsigned long long val, char *s));
76 76
77typedef int (*write_strategy_fn)(const char *buf, unsigned long long *val);
78
79int res_counter_memparse_write_strategy(const char *buf, 77int res_counter_memparse_write_strategy(const char *buf,
80 unsigned long long *res); 78 unsigned long long *res);
81 79
82int res_counter_write(struct res_counter *counter, int member,
83 const char *buffer, write_strategy_fn write_strategy);
84
85/* 80/*
86 * the field descriptors. one for each member of res_counter 81 * the field descriptors. one for each member of res_counter
87 */ 82 */
@@ -130,14 +125,16 @@ int res_counter_charge_nofail(struct res_counter *counter,
130 * 125 *
131 * these calls check for usage underflow and show a warning on the console 126 * these calls check for usage underflow and show a warning on the console
132 * _locked call expects the counter->lock to be taken 127 * _locked call expects the counter->lock to be taken
128 *
129 * returns the total charges still present in @counter.
133 */ 130 */
134 131
135void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); 132u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
136void res_counter_uncharge(struct res_counter *counter, unsigned long val); 133u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
137 134
138void res_counter_uncharge_until(struct res_counter *counter, 135u64 res_counter_uncharge_until(struct res_counter *counter,
139 struct res_counter *top, 136 struct res_counter *top,
140 unsigned long val); 137 unsigned long val);
141/** 138/**
142 * res_counter_margin - calculate chargeable space of a counter 139 * res_counter_margin - calculate chargeable space of a counter
143 * @cnt: the counter 140 * @cnt: the counter
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 6c8835f74f79..519777e3fa01 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -159,13 +159,14 @@ int ring_buffer_record_is_on(struct ring_buffer *buffer);
159void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); 159void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
160void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); 160void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
161 161
162unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu); 162u64 ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu);
163unsigned long ring_buffer_bytes_cpu(struct ring_buffer *buffer, int cpu); 163unsigned long ring_buffer_bytes_cpu(struct ring_buffer *buffer, int cpu);
164unsigned long ring_buffer_entries(struct ring_buffer *buffer); 164unsigned long ring_buffer_entries(struct ring_buffer *buffer);
165unsigned long ring_buffer_overruns(struct ring_buffer *buffer); 165unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
166unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); 166unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
167unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 167unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
168unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu); 168unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
169unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu);
169 170
170u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 171u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
171void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 172void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 4187da511006..a3e784278667 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -275,9 +275,11 @@ struct rio_id_table {
275 * struct rio_net - RIO network info 275 * struct rio_net - RIO network info
276 * @node: Node in global list of RIO networks 276 * @node: Node in global list of RIO networks
277 * @devices: List of devices in this network 277 * @devices: List of devices in this network
278 * @switches: List of switches in this netowrk
278 * @mports: List of master ports accessing this network 279 * @mports: List of master ports accessing this network
279 * @hport: Default port for accessing this network 280 * @hport: Default port for accessing this network
280 * @id: RIO network ID 281 * @id: RIO network ID
282 * @destid_table: destID allocation table
281 */ 283 */
282struct rio_net { 284struct rio_net {
283 struct list_head node; /* node in list of networks */ 285 struct list_head node; /* node in list of networks */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bfe1f4780644..c20635c527a9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -7,7 +7,7 @@
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/slab.h> 8#include <linux/slab.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/mutex.h> 10#include <linux/rwsem.h>
11#include <linux/memcontrol.h> 11#include <linux/memcontrol.h>
12 12
13/* 13/*
@@ -25,8 +25,8 @@
25 * pointing to this anon_vma once its vma list is empty. 25 * pointing to this anon_vma once its vma list is empty.
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 struct anon_vma *root; /* Root of this anon_vma tree */ 28 struct anon_vma *root; /* Root of this anon_vma tree */
29 struct mutex mutex; /* Serialize access to vma list */ 29 struct rw_semaphore rwsem; /* W: modification, R: walking the list */
30 /* 30 /*
31 * The refcount is taken on an anon_vma when there is no 31 * The refcount is taken on an anon_vma when there is no
32 * guarantee that the vma of page tables will exist for 32 * guarantee that the vma of page tables will exist for
@@ -64,7 +64,7 @@ struct anon_vma_chain {
64 struct vm_area_struct *vma; 64 struct vm_area_struct *vma;
65 struct anon_vma *anon_vma; 65 struct anon_vma *anon_vma;
66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ 66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */
67 struct rb_node rb; /* locked by anon_vma->mutex */ 67 struct rb_node rb; /* locked by anon_vma->rwsem */
68 unsigned long rb_subtree_last; 68 unsigned long rb_subtree_last;
69#ifdef CONFIG_DEBUG_VM_RB 69#ifdef CONFIG_DEBUG_VM_RB
70 unsigned long cached_vma_start, cached_vma_last; 70 unsigned long cached_vma_start, cached_vma_last;
@@ -108,26 +108,37 @@ static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
108{ 108{
109 struct anon_vma *anon_vma = vma->anon_vma; 109 struct anon_vma *anon_vma = vma->anon_vma;
110 if (anon_vma) 110 if (anon_vma)
111 mutex_lock(&anon_vma->root->mutex); 111 down_write(&anon_vma->root->rwsem);
112} 112}
113 113
114static inline void vma_unlock_anon_vma(struct vm_area_struct *vma) 114static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
115{ 115{
116 struct anon_vma *anon_vma = vma->anon_vma; 116 struct anon_vma *anon_vma = vma->anon_vma;
117 if (anon_vma) 117 if (anon_vma)
118 mutex_unlock(&anon_vma->root->mutex); 118 up_write(&anon_vma->root->rwsem);
119} 119}
120 120
121static inline void anon_vma_lock(struct anon_vma *anon_vma) 121static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
122{ 122{
123 mutex_lock(&anon_vma->root->mutex); 123 down_write(&anon_vma->root->rwsem);
124} 124}
125 125
126static inline void anon_vma_unlock(struct anon_vma *anon_vma) 126static inline void anon_vma_unlock(struct anon_vma *anon_vma)
127{ 127{
128 mutex_unlock(&anon_vma->root->mutex); 128 up_write(&anon_vma->root->rwsem);
129} 129}
130 130
131static inline void anon_vma_lock_read(struct anon_vma *anon_vma)
132{
133 down_read(&anon_vma->root->rwsem);
134}
135
136static inline void anon_vma_unlock_read(struct anon_vma *anon_vma)
137{
138 up_read(&anon_vma->root->rwsem);
139}
140
141
131/* 142/*
132 * anon_vma helper functions. 143 * anon_vma helper functions.
133 */ 144 */
@@ -220,8 +231,8 @@ int try_to_munlock(struct page *);
220/* 231/*
221 * Called by memory-failure.c to kill processes. 232 * Called by memory-failure.c to kill processes.
222 */ 233 */
223struct anon_vma *page_lock_anon_vma(struct page *page); 234struct anon_vma *page_lock_anon_vma_read(struct page *page);
224void page_unlock_anon_vma(struct anon_vma *anon_vma); 235void page_unlock_anon_vma_read(struct anon_vma *anon_vma);
225int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); 236int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
226 237
227/* 238/*
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 7002bbfd5d4a..489dd7bb28ec 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -69,4 +69,7 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
69 struct netlink_callback *cb, 69 struct netlink_callback *cb,
70 struct net_device *dev, 70 struct net_device *dev,
71 int idx); 71 int idx);
72
73extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
74 struct net_device *dev, u16 mode);
72#endif /* __LINUX_RTNETLINK_H */ 75#endif /* __LINUX_RTNETLINK_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0dd42a02df2e..206bb089c06b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -107,8 +107,18 @@ extern unsigned long this_cpu_load(void);
107extern void calc_global_load(unsigned long ticks); 107extern void calc_global_load(unsigned long ticks);
108extern void update_cpu_load_nohz(void); 108extern void update_cpu_load_nohz(void);
109 109
110/* Notifier for when a task gets migrated to a new CPU */
111struct task_migration_notifier {
112 struct task_struct *task;
113 int from_cpu;
114 int to_cpu;
115};
116extern void register_task_migration_notifier(struct notifier_block *n);
117
110extern unsigned long get_parent_ip(unsigned long addr); 118extern unsigned long get_parent_ip(unsigned long addr);
111 119
120extern void dump_cpu_task(int cpu);
121
112struct seq_file; 122struct seq_file;
113struct cfs_rq; 123struct cfs_rq;
114struct task_group; 124struct task_group;
@@ -434,13 +444,28 @@ struct cpu_itimer {
434}; 444};
435 445
436/** 446/**
447 * struct cputime - snaphsot of system and user cputime
448 * @utime: time spent in user mode
449 * @stime: time spent in system mode
450 *
451 * Gathers a generic snapshot of user and system time.
452 */
453struct cputime {
454 cputime_t utime;
455 cputime_t stime;
456};
457
458/**
437 * struct task_cputime - collected CPU time counts 459 * struct task_cputime - collected CPU time counts
438 * @utime: time spent in user mode, in &cputime_t units 460 * @utime: time spent in user mode, in &cputime_t units
439 * @stime: time spent in kernel mode, in &cputime_t units 461 * @stime: time spent in kernel mode, in &cputime_t units
440 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds 462 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds
441 * 463 *
442 * This structure groups together three kinds of CPU time that are 464 * This is an extension of struct cputime that includes the total runtime
443 * tracked for threads and thread groups. Most things considering 465 * spent by the task from the scheduler point of view.
466 *
467 * As a result, this structure groups together three kinds of CPU time
468 * that are tracked for threads and thread groups. Most things considering
444 * CPU time want to group these counts together and treat all three 469 * CPU time want to group these counts together and treat all three
445 * of them in parallel. 470 * of them in parallel.
446 */ 471 */
@@ -581,7 +606,7 @@ struct signal_struct {
581 cputime_t gtime; 606 cputime_t gtime;
582 cputime_t cgtime; 607 cputime_t cgtime;
583#ifndef CONFIG_VIRT_CPU_ACCOUNTING 608#ifndef CONFIG_VIRT_CPU_ACCOUNTING
584 cputime_t prev_utime, prev_stime; 609 struct cputime prev_cputime;
585#endif 610#endif
586 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 611 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
587 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 612 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
@@ -631,9 +656,10 @@ struct signal_struct {
631 struct rw_semaphore group_rwsem; 656 struct rw_semaphore group_rwsem;
632#endif 657#endif
633 658
634 int oom_score_adj; /* OOM kill score adjustment */ 659 oom_flags_t oom_flags;
635 int oom_score_adj_min; /* OOM kill score adjustment minimum value. 660 short oom_score_adj; /* OOM kill score adjustment */
636 * Only settable by CAP_SYS_RESOURCE. */ 661 short oom_score_adj_min; /* OOM kill score adjustment min value.
662 * Only settable by CAP_SYS_RESOURCE. */
637 663
638 struct mutex cred_guard_mutex; /* guard against foreign influences on 664 struct mutex cred_guard_mutex; /* guard against foreign influences on
639 * credential calculations 665 * credential calculations
@@ -1061,6 +1087,7 @@ struct sched_class {
1061 1087
1062#ifdef CONFIG_SMP 1088#ifdef CONFIG_SMP
1063 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); 1089 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
1090 void (*migrate_task_rq)(struct task_struct *p, int next_cpu);
1064 1091
1065 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1092 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1066 void (*post_schedule) (struct rq *this_rq); 1093 void (*post_schedule) (struct rq *this_rq);
@@ -1095,6 +1122,18 @@ struct load_weight {
1095 unsigned long weight, inv_weight; 1122 unsigned long weight, inv_weight;
1096}; 1123};
1097 1124
1125struct sched_avg {
1126 /*
1127 * These sums represent an infinite geometric series and so are bound
1128 * above by 1024/(1-y). Thus we only need a u32 to store them for for all
1129 * choices of y < 1-2^(-32)*1024.
1130 */
1131 u32 runnable_avg_sum, runnable_avg_period;
1132 u64 last_runnable_update;
1133 s64 decay_count;
1134 unsigned long load_avg_contrib;
1135};
1136
1098#ifdef CONFIG_SCHEDSTATS 1137#ifdef CONFIG_SCHEDSTATS
1099struct sched_statistics { 1138struct sched_statistics {
1100 u64 wait_start; 1139 u64 wait_start;
@@ -1155,6 +1194,15 @@ struct sched_entity {
1155 /* rq "owned" by this entity/group: */ 1194 /* rq "owned" by this entity/group: */
1156 struct cfs_rq *my_q; 1195 struct cfs_rq *my_q;
1157#endif 1196#endif
1197/*
1198 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
1199 * removed when useful for applications beyond shares distribution (e.g.
1200 * load-balance).
1201 */
1202#if defined(CONFIG_SMP) && defined(CONFIG_FAIR_GROUP_SCHED)
1203 /* Per-entity load-tracking */
1204 struct sched_avg avg;
1205#endif
1158}; 1206};
1159 1207
1160struct sched_rt_entity { 1208struct sched_rt_entity {
@@ -1318,7 +1366,7 @@ struct task_struct {
1318 cputime_t utime, stime, utimescaled, stimescaled; 1366 cputime_t utime, stime, utimescaled, stimescaled;
1319 cputime_t gtime; 1367 cputime_t gtime;
1320#ifndef CONFIG_VIRT_CPU_ACCOUNTING 1368#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1321 cputime_t prev_utime, prev_stime; 1369 struct cputime prev_cputime;
1322#endif 1370#endif
1323 unsigned long nvcsw, nivcsw; /* context switch counts */ 1371 unsigned long nvcsw, nivcsw; /* context switch counts */
1324 struct timespec start_time; /* monotonic time */ 1372 struct timespec start_time; /* monotonic time */
@@ -1479,6 +1527,14 @@ struct task_struct {
1479 short il_next; 1527 short il_next;
1480 short pref_node_fork; 1528 short pref_node_fork;
1481#endif 1529#endif
1530#ifdef CONFIG_NUMA_BALANCING
1531 int numa_scan_seq;
1532 int numa_migrate_seq;
1533 unsigned int numa_scan_period;
1534 u64 node_stamp; /* migration stamp */
1535 struct callback_head numa_work;
1536#endif /* CONFIG_NUMA_BALANCING */
1537
1482 struct rcu_head rcu; 1538 struct rcu_head rcu;
1483 1539
1484 /* 1540 /*
@@ -1541,6 +1597,7 @@ struct task_struct {
1541 unsigned long nr_pages; /* uncharged usage */ 1597 unsigned long nr_pages; /* uncharged usage */
1542 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ 1598 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1543 } memcg_batch; 1599 } memcg_batch;
1600 unsigned int memcg_kmem_skip_account;
1544#endif 1601#endif
1545#ifdef CONFIG_HAVE_HW_BREAKPOINT 1602#ifdef CONFIG_HAVE_HW_BREAKPOINT
1546 atomic_t ptrace_bp_refcnt; 1603 atomic_t ptrace_bp_refcnt;
@@ -1553,6 +1610,18 @@ struct task_struct {
1553/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1610/* Future-safe accessor for struct task_struct's cpus_allowed. */
1554#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) 1611#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1555 1612
1613#ifdef CONFIG_NUMA_BALANCING
1614extern void task_numa_fault(int node, int pages, bool migrated);
1615extern void set_numabalancing_state(bool enabled);
1616#else
1617static inline void task_numa_fault(int node, int pages, bool migrated)
1618{
1619}
1620static inline void set_numabalancing_state(bool enabled)
1621{
1622}
1623#endif
1624
1556/* 1625/*
1557 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 1626 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1558 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH 1627 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
@@ -1710,12 +1779,6 @@ static inline int is_global_init(struct task_struct *tsk)
1710 return tsk->pid == 1; 1779 return tsk->pid == 1;
1711} 1780}
1712 1781
1713/*
1714 * is_container_init:
1715 * check whether in the task is init in its own pid namespace.
1716 */
1717extern int is_container_init(struct task_struct *tsk);
1718
1719extern struct pid *cad_pid; 1782extern struct pid *cad_pid;
1720 1783
1721extern void free_task(struct task_struct *tsk); 1784extern void free_task(struct task_struct *tsk);
@@ -1729,8 +1792,8 @@ static inline void put_task_struct(struct task_struct *t)
1729 __put_task_struct(t); 1792 __put_task_struct(t);
1730} 1793}
1731 1794
1732extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1795extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1733extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1796extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1734 1797
1735/* 1798/*
1736 * Per process flags 1799 * Per process flags
@@ -1844,14 +1907,6 @@ static inline void rcu_copy_process(struct task_struct *p)
1844 1907
1845#endif 1908#endif
1846 1909
1847static inline void rcu_switch(struct task_struct *prev,
1848 struct task_struct *next)
1849{
1850#ifdef CONFIG_RCU_USER_QS
1851 rcu_user_hooks_switch(prev, next);
1852#endif
1853}
1854
1855static inline void tsk_restore_flags(struct task_struct *task, 1910static inline void tsk_restore_flags(struct task_struct *task,
1856 unsigned long orig_flags, unsigned long flags) 1911 unsigned long orig_flags, unsigned long flags)
1857{ 1912{
@@ -1990,6 +2045,13 @@ enum sched_tunable_scaling {
1990}; 2045};
1991extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; 2046extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
1992 2047
2048extern unsigned int sysctl_numa_balancing_scan_delay;
2049extern unsigned int sysctl_numa_balancing_scan_period_min;
2050extern unsigned int sysctl_numa_balancing_scan_period_max;
2051extern unsigned int sysctl_numa_balancing_scan_period_reset;
2052extern unsigned int sysctl_numa_balancing_scan_size;
2053extern unsigned int sysctl_numa_balancing_settle_count;
2054
1993#ifdef CONFIG_SCHED_DEBUG 2055#ifdef CONFIG_SCHED_DEBUG
1994extern unsigned int sysctl_sched_migration_cost; 2056extern unsigned int sysctl_sched_migration_cost;
1995extern unsigned int sysctl_sched_nr_migrate; 2057extern unsigned int sysctl_sched_nr_migrate;
@@ -2271,7 +2333,7 @@ extern void mm_release(struct task_struct *, struct mm_struct *);
2271extern struct mm_struct *dup_mm(struct task_struct *tsk); 2333extern struct mm_struct *dup_mm(struct task_struct *tsk);
2272 2334
2273extern int copy_thread(unsigned long, unsigned long, unsigned long, 2335extern int copy_thread(unsigned long, unsigned long, unsigned long,
2274 struct task_struct *, struct pt_regs *); 2336 struct task_struct *);
2275extern void flush_thread(void); 2337extern void flush_thread(void);
2276extern void exit_thread(void); 2338extern void exit_thread(void);
2277 2339
@@ -2283,18 +2345,15 @@ extern void flush_itimer_signals(void);
2283 2345
2284extern void do_group_exit(int); 2346extern void do_group_exit(int);
2285 2347
2286extern void daemonize(const char *, ...);
2287extern int allow_signal(int); 2348extern int allow_signal(int);
2288extern int disallow_signal(int); 2349extern int disallow_signal(int);
2289 2350
2290extern int do_execve(const char *, 2351extern int do_execve(const char *,
2291 const char __user * const __user *, 2352 const char __user * const __user *,
2292 const char __user * const __user *, struct pt_regs *); 2353 const char __user * const __user *);
2293extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2354extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
2294struct task_struct *fork_idle(int); 2355struct task_struct *fork_idle(int);
2295#ifdef CONFIG_GENERIC_KERNEL_THREAD
2296extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2356extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2297#endif
2298 2357
2299extern void set_task_comm(struct task_struct *tsk, char *from); 2358extern void set_task_comm(struct task_struct *tsk, char *from);
2300extern char *get_task_comm(char *to, struct task_struct *tsk); 2359extern char *get_task_comm(char *to, struct task_struct *tsk);
diff --git a/include/linux/security.h b/include/linux/security.h
index 05e88bdcf7d9..0f6afc657f77 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -694,6 +694,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
694 * userspace to load a kernel module with the given name. 694 * userspace to load a kernel module with the given name.
695 * @kmod_name name of the module requested by the kernel 695 * @kmod_name name of the module requested by the kernel
696 * Return 0 if successful. 696 * Return 0 if successful.
697 * @kernel_module_from_file:
698 * Load a kernel module from userspace.
699 * @file contains the file structure pointing to the file containing
700 * the kernel module to load. If the module is being loaded from a blob,
701 * this argument will be NULL.
702 * Return 0 if permission is granted.
697 * @task_fix_setuid: 703 * @task_fix_setuid:
698 * Update the module's state after setting one or more of the user 704 * Update the module's state after setting one or more of the user
699 * identity attributes of the current process. The @flags parameter 705 * identity attributes of the current process. The @flags parameter
@@ -1508,6 +1514,7 @@ struct security_operations {
1508 int (*kernel_act_as)(struct cred *new, u32 secid); 1514 int (*kernel_act_as)(struct cred *new, u32 secid);
1509 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1515 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1510 int (*kernel_module_request)(char *kmod_name); 1516 int (*kernel_module_request)(char *kmod_name);
1517 int (*kernel_module_from_file)(struct file *file);
1511 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1518 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1512 int flags); 1519 int flags);
1513 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1520 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
@@ -1765,6 +1772,7 @@ void security_transfer_creds(struct cred *new, const struct cred *old);
1765int security_kernel_act_as(struct cred *new, u32 secid); 1772int security_kernel_act_as(struct cred *new, u32 secid);
1766int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1773int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1767int security_kernel_module_request(char *kmod_name); 1774int security_kernel_module_request(char *kmod_name);
1775int security_kernel_module_from_file(struct file *file);
1768int security_task_fix_setuid(struct cred *new, const struct cred *old, 1776int security_task_fix_setuid(struct cred *new, const struct cred *old,
1769 int flags); 1777 int flags);
1770int security_task_setpgid(struct task_struct *p, pid_t pgid); 1778int security_task_setpgid(struct task_struct *p, pid_t pgid);
@@ -2278,6 +2286,11 @@ static inline int security_kernel_module_request(char *kmod_name)
2278 return 0; 2286 return 0;
2279} 2287}
2280 2288
2289static inline int security_kernel_module_from_file(struct file *file)
2290{
2291 return 0;
2292}
2293
2281static inline int security_task_fix_setuid(struct cred *new, 2294static inline int security_task_fix_setuid(struct cred *new,
2282 const struct cred *old, 2295 const struct cred *old,
2283 int flags) 2296 int flags)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index c174c90fb3fb..c490d20b3fb8 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -105,6 +105,8 @@ extern int early_serial_setup(struct uart_port *port);
105 105
106extern int serial8250_find_port(struct uart_port *p); 106extern int serial8250_find_port(struct uart_port *p);
107extern int serial8250_find_port_for_earlycon(void); 107extern int serial8250_find_port_for_earlycon(void);
108extern unsigned int serial8250_early_in(struct uart_port *port, int offset);
109extern void serial8250_early_out(struct uart_port *port, int offset, int value);
108extern int setup_early_serial8250_console(char *cmdline); 110extern int setup_early_serial8250_console(char *cmdline);
109extern void serial8250_do_set_termios(struct uart_port *port, 111extern void serial8250_do_set_termios(struct uart_port *port,
110 struct ktermios *termios, struct ktermios *old); 112 struct ktermios *termios, struct ktermios *old);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 3c430228d232..c6690a2a27fb 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -46,6 +46,8 @@ struct uart_ops {
46 unsigned int (*get_mctrl)(struct uart_port *); 46 unsigned int (*get_mctrl)(struct uart_port *);
47 void (*stop_tx)(struct uart_port *); 47 void (*stop_tx)(struct uart_port *);
48 void (*start_tx)(struct uart_port *); 48 void (*start_tx)(struct uart_port *);
49 void (*throttle)(struct uart_port *);
50 void (*unthrottle)(struct uart_port *);
49 void (*send_xchar)(struct uart_port *, char ch); 51 void (*send_xchar)(struct uart_port *, char ch);
50 void (*stop_rx)(struct uart_port *); 52 void (*stop_rx)(struct uart_port *);
51 void (*enable_ms)(struct uart_port *); 53 void (*enable_ms)(struct uart_port *);
@@ -163,6 +165,10 @@ struct uart_port {
163#define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) 165#define UPF_BUGGY_UART ((__force upf_t) (1 << 14))
164#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15)) 166#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
165#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) 167#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16))
168/* Port has hardware-assisted h/w flow control (iow, auto-RTS *not* auto-CTS) */
169#define UPF_HARD_FLOW ((__force upf_t) (1 << 21))
170/* Port has hardware-assisted s/w flow control */
171#define UPF_SOFT_FLOW ((__force upf_t) (1 << 22))
166#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 172#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
167#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 173#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
168#define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) 174#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 50910913b268..60c72395ec6b 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -199,4 +199,13 @@ int sh_clk_div6_reparent_register(struct clk *clks, int nr);
199#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } 199#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
200#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } 200#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
201 201
202/* .enable_reg will be updated to .mapping on sh_clk_fsidiv_register() */
203#define SH_CLK_FSIDIV(_reg, _parent) \
204{ \
205 .enable_reg = (void __iomem *)_reg, \
206 .parent = _parent, \
207}
208
209int sh_clk_fsidiv_register(struct clk *clks, int nr);
210
202#endif /* __SH_CLOCK_H */ 211#endif /* __SH_CLOCK_H */
diff --git a/include/linux/shm.h b/include/linux/shm.h
index bcf8a6a3ec00..429c1995d756 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -29,6 +29,21 @@ struct shmid_kernel /* private to the kernel */
29#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ 29#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
30#define SHM_NORESERVE 010000 /* don't check for reservations */ 30#define SHM_NORESERVE 010000 /* don't check for reservations */
31 31
32/* Bits [26:31] are reserved */
33
34/*
35 * When SHM_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
36 * This gives us 6 bits, which is enough until someone invents 128 bit address
37 * spaces.
38 *
39 * Assume these are all power of twos.
40 * When 0 use the default page size.
41 */
42#define SHM_HUGE_SHIFT 26
43#define SHM_HUGE_MASK 0x3f
44#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
45#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
46
32#ifdef CONFIG_SYSVIPC 47#ifdef CONFIG_SYSVIPC
33long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, 48long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
34 unsigned long shmlba); 49 unsigned long shmlba);
diff --git a/include/linux/signal.h b/include/linux/signal.h
index e19a011b43b7..0a89ffc48466 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -385,4 +385,7 @@ int unhandled_signal(struct task_struct *tsk, int sig);
385 385
386void signals_init(void); 386void signals_init(void);
387 387
388int restore_altstack(const stack_t __user *);
389int __save_altstack(stack_t __user *, unsigned long);
390
388#endif /* _LINUX_SIGNAL_H */ 391#endif /* _LINUX_SIGNAL_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6a2c34e6d962..320e976d5ab8 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -235,11 +235,13 @@ enum {
235/* 235/*
236 * The callback notifies userspace to release buffers when skb DMA is done in 236 * The callback notifies userspace to release buffers when skb DMA is done in
237 * lower device, the skb last reference should be 0 when calling this. 237 * lower device, the skb last reference should be 0 when calling this.
238 * The zerocopy_success argument is true if zero copy transmit occurred,
239 * false on data copy or out of memory error caused by data copy attempt.
238 * The ctx field is used to track device context. 240 * The ctx field is used to track device context.
239 * The desc field is used to track userspace buffer index. 241 * The desc field is used to track userspace buffer index.
240 */ 242 */
241struct ubuf_info { 243struct ubuf_info {
242 void (*callback)(struct ubuf_info *); 244 void (*callback)(struct ubuf_info *, bool zerocopy_success);
243 void *ctx; 245 void *ctx;
244 unsigned long desc; 246 unsigned long desc;
245}; 247};
@@ -374,6 +376,8 @@ typedef unsigned char *sk_buff_data_t;
374 * @mark: Generic packet mark 376 * @mark: Generic packet mark
375 * @dropcount: total number of sk_receive_queue overflows 377 * @dropcount: total number of sk_receive_queue overflows
376 * @vlan_tci: vlan tag control information 378 * @vlan_tci: vlan tag control information
379 * @inner_transport_header: Inner transport layer header (encapsulation)
380 * @inner_network_header: Network layer header (encapsulation)
377 * @transport_header: Transport layer header 381 * @transport_header: Transport layer header
378 * @network_header: Network layer header 382 * @network_header: Network layer header
379 * @mac_header: Link layer header 383 * @mac_header: Link layer header
@@ -469,7 +473,13 @@ struct sk_buff {
469 __u8 wifi_acked:1; 473 __u8 wifi_acked:1;
470 __u8 no_fcs:1; 474 __u8 no_fcs:1;
471 __u8 head_frag:1; 475 __u8 head_frag:1;
472 /* 8/10 bit hole (depending on ndisc_nodetype presence) */ 476 /* Encapsulation protocol and NIC drivers should use
477 * this flag to indicate to each other if the skb contains
478 * encapsulated packet or not and maybe use the inner packet
479 * headers if needed
480 */
481 __u8 encapsulation:1;
482 /* 7/9 bit hole (depending on ndisc_nodetype presence) */
473 kmemcheck_bitfield_end(flags2); 483 kmemcheck_bitfield_end(flags2);
474 484
475#ifdef CONFIG_NET_DMA 485#ifdef CONFIG_NET_DMA
@@ -484,6 +494,8 @@ struct sk_buff {
484 __u32 avail_size; 494 __u32 avail_size;
485 }; 495 };
486 496
497 sk_buff_data_t inner_transport_header;
498 sk_buff_data_t inner_network_header;
487 sk_buff_data_t transport_header; 499 sk_buff_data_t transport_header;
488 sk_buff_data_t network_header; 500 sk_buff_data_t network_header;
489 sk_buff_data_t mac_header; 501 sk_buff_data_t mac_header;
@@ -566,6 +578,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
566} 578}
567 579
568extern void kfree_skb(struct sk_buff *skb); 580extern void kfree_skb(struct sk_buff *skb);
581extern void skb_tx_error(struct sk_buff *skb);
569extern void consume_skb(struct sk_buff *skb); 582extern void consume_skb(struct sk_buff *skb);
570extern void __kfree_skb(struct sk_buff *skb); 583extern void __kfree_skb(struct sk_buff *skb);
571extern struct kmem_cache *skbuff_head_cache; 584extern struct kmem_cache *skbuff_head_cache;
@@ -643,7 +656,7 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
643extern void __skb_get_rxhash(struct sk_buff *skb); 656extern void __skb_get_rxhash(struct sk_buff *skb);
644static inline __u32 skb_get_rxhash(struct sk_buff *skb) 657static inline __u32 skb_get_rxhash(struct sk_buff *skb)
645{ 658{
646 if (!skb->rxhash) 659 if (!skb->l4_rxhash)
647 __skb_get_rxhash(skb); 660 __skb_get_rxhash(skb);
648 661
649 return skb->rxhash; 662 return skb->rxhash;
@@ -1432,12 +1445,53 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
1432 skb->tail += len; 1445 skb->tail += len;
1433} 1446}
1434 1447
1448static inline void skb_reset_inner_headers(struct sk_buff *skb)
1449{
1450 skb->inner_network_header = skb->network_header;
1451 skb->inner_transport_header = skb->transport_header;
1452}
1453
1435static inline void skb_reset_mac_len(struct sk_buff *skb) 1454static inline void skb_reset_mac_len(struct sk_buff *skb)
1436{ 1455{
1437 skb->mac_len = skb->network_header - skb->mac_header; 1456 skb->mac_len = skb->network_header - skb->mac_header;
1438} 1457}
1439 1458
1440#ifdef NET_SKBUFF_DATA_USES_OFFSET 1459#ifdef NET_SKBUFF_DATA_USES_OFFSET
1460static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1461 *skb)
1462{
1463 return skb->head + skb->inner_transport_header;
1464}
1465
1466static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1467{
1468 skb->inner_transport_header = skb->data - skb->head;
1469}
1470
1471static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1472 const int offset)
1473{
1474 skb_reset_inner_transport_header(skb);
1475 skb->inner_transport_header += offset;
1476}
1477
1478static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1479{
1480 return skb->head + skb->inner_network_header;
1481}
1482
1483static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1484{
1485 skb->inner_network_header = skb->data - skb->head;
1486}
1487
1488static inline void skb_set_inner_network_header(struct sk_buff *skb,
1489 const int offset)
1490{
1491 skb_reset_inner_network_header(skb);
1492 skb->inner_network_header += offset;
1493}
1494
1441static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1495static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1442{ 1496{
1443 return skb->head + skb->transport_header; 1497 return skb->head + skb->transport_header;
@@ -1493,6 +1547,38 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1493} 1547}
1494 1548
1495#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1549#else /* NET_SKBUFF_DATA_USES_OFFSET */
1550static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1551 *skb)
1552{
1553 return skb->inner_transport_header;
1554}
1555
1556static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1557{
1558 skb->inner_transport_header = skb->data;
1559}
1560
1561static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1562 const int offset)
1563{
1564 skb->inner_transport_header = skb->data + offset;
1565}
1566
1567static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1568{
1569 return skb->inner_network_header;
1570}
1571
1572static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1573{
1574 skb->inner_network_header = skb->data;
1575}
1576
1577static inline void skb_set_inner_network_header(struct sk_buff *skb,
1578 const int offset)
1579{
1580 skb->inner_network_header = skb->data + offset;
1581}
1496 1582
1497static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1583static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1498{ 1584{
@@ -1571,11 +1657,21 @@ static inline u32 skb_network_header_len(const struct sk_buff *skb)
1571 return skb->transport_header - skb->network_header; 1657 return skb->transport_header - skb->network_header;
1572} 1658}
1573 1659
1660static inline u32 skb_inner_network_header_len(const struct sk_buff *skb)
1661{
1662 return skb->inner_transport_header - skb->inner_network_header;
1663}
1664
1574static inline int skb_network_offset(const struct sk_buff *skb) 1665static inline int skb_network_offset(const struct sk_buff *skb)
1575{ 1666{
1576 return skb_network_header(skb) - skb->data; 1667 return skb_network_header(skb) - skb->data;
1577} 1668}
1578 1669
1670static inline int skb_inner_network_offset(const struct sk_buff *skb)
1671{
1672 return skb_inner_network_header(skb) - skb->data;
1673}
1674
1579static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) 1675static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1580{ 1676{
1581 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1677 return pskb_may_pull(skb, skb_network_offset(skb) + len);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 83d1a1454b7e..5d168d7e0a28 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -11,6 +11,8 @@
11 11
12#include <linux/gfp.h> 12#include <linux/gfp.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/workqueue.h>
15
14 16
15/* 17/*
16 * Flags to pass to kmem_cache_create(). 18 * Flags to pass to kmem_cache_create().
@@ -116,6 +118,7 @@ struct kmem_cache {
116}; 118};
117#endif 119#endif
118 120
121struct mem_cgroup;
119/* 122/*
120 * struct kmem_cache related prototypes 123 * struct kmem_cache related prototypes
121 */ 124 */
@@ -125,10 +128,12 @@ int slab_is_available(void);
125struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 128struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
126 unsigned long, 129 unsigned long,
127 void (*)(void *)); 130 void (*)(void *));
131struct kmem_cache *
132kmem_cache_create_memcg(struct mem_cgroup *, const char *, size_t, size_t,
133 unsigned long, void (*)(void *), struct kmem_cache *);
128void kmem_cache_destroy(struct kmem_cache *); 134void kmem_cache_destroy(struct kmem_cache *);
129int kmem_cache_shrink(struct kmem_cache *); 135int kmem_cache_shrink(struct kmem_cache *);
130void kmem_cache_free(struct kmem_cache *, void *); 136void kmem_cache_free(struct kmem_cache *, void *);
131unsigned int kmem_cache_size(struct kmem_cache *);
132 137
133/* 138/*
134 * Please use this macro to create slab caches. Simply specify the 139 * Please use this macro to create slab caches. Simply specify the
@@ -176,6 +181,48 @@ unsigned int kmem_cache_size(struct kmem_cache *);
176#ifndef ARCH_SLAB_MINALIGN 181#ifndef ARCH_SLAB_MINALIGN
177#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long) 182#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
178#endif 183#endif
184/*
185 * This is the main placeholder for memcg-related information in kmem caches.
186 * struct kmem_cache will hold a pointer to it, so the memory cost while
187 * disabled is 1 pointer. The runtime cost while enabled, gets bigger than it
188 * would otherwise be if that would be bundled in kmem_cache: we'll need an
189 * extra pointer chase. But the trade off clearly lays in favor of not
190 * penalizing non-users.
191 *
192 * Both the root cache and the child caches will have it. For the root cache,
193 * this will hold a dynamically allocated array large enough to hold
194 * information about the currently limited memcgs in the system.
195 *
196 * Child caches will hold extra metadata needed for its operation. Fields are:
197 *
198 * @memcg: pointer to the memcg this cache belongs to
199 * @list: list_head for the list of all caches in this memcg
200 * @root_cache: pointer to the global, root cache, this cache was derived from
201 * @dead: set to true after the memcg dies; the cache may still be around.
202 * @nr_pages: number of pages that belongs to this cache.
203 * @destroy: worker to be called whenever we are ready, or believe we may be
204 * ready, to destroy this cache.
205 */
206struct memcg_cache_params {
207 bool is_root_cache;
208 union {
209 struct kmem_cache *memcg_caches[0];
210 struct {
211 struct mem_cgroup *memcg;
212 struct list_head list;
213 struct kmem_cache *root_cache;
214 bool dead;
215 atomic_t nr_pages;
216 struct work_struct destroy;
217 };
218 };
219};
220
221int memcg_update_all_caches(int num_memcgs);
222
223struct seq_file;
224int cache_show(struct kmem_cache *s, struct seq_file *m);
225void print_slabinfo_header(struct seq_file *m);
179 226
180/* 227/*
181 * Common kmalloc functions provided by all allocators 228 * Common kmalloc functions provided by all allocators
@@ -388,6 +435,14 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
388 return kmalloc_node(size, flags | __GFP_ZERO, node); 435 return kmalloc_node(size, flags | __GFP_ZERO, node);
389} 436}
390 437
438/*
439 * Determine the size of a slab object
440 */
441static inline unsigned int kmem_cache_size(struct kmem_cache *s)
442{
443 return s->object_size;
444}
445
391void __init kmem_cache_init_late(void); 446void __init kmem_cache_init_late(void);
392 447
393#endif /* _LINUX_SLAB_H */ 448#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index cc290f0bdb34..8bb6e0eaf3c6 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -81,6 +81,9 @@ struct kmem_cache {
81 */ 81 */
82 int obj_offset; 82 int obj_offset;
83#endif /* CONFIG_DEBUG_SLAB */ 83#endif /* CONFIG_DEBUG_SLAB */
84#ifdef CONFIG_MEMCG_KMEM
85 struct memcg_cache_params *memcg_params;
86#endif
84 87
85/* 6) per-cpu/per-node data, touched during every alloc/free */ 88/* 6) per-cpu/per-node data, touched during every alloc/free */
86 /* 89 /*
@@ -89,9 +92,13 @@ struct kmem_cache {
89 * (see kmem_cache_init()) 92 * (see kmem_cache_init())
90 * We still use [NR_CPUS] and not [1] or [0] because cache_cache 93 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
91 * is statically defined, so we reserve the max number of cpus. 94 * is statically defined, so we reserve the max number of cpus.
95 *
96 * We also need to guarantee that the list is able to accomodate a
97 * pointer for each node since "nodelists" uses the remainder of
98 * available pointers.
92 */ 99 */
93 struct kmem_list3 **nodelists; 100 struct kmem_list3 **nodelists;
94 struct array_cache *array[NR_CPUS]; 101 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
95 /* 102 /*
96 * Do not add fields after array[] 103 * Do not add fields after array[]
97 */ 104 */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index df448adb7283..9db4825cd393 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -101,6 +101,10 @@ struct kmem_cache {
101#ifdef CONFIG_SYSFS 101#ifdef CONFIG_SYSFS
102 struct kobject kobj; /* For sysfs */ 102 struct kobject kobj; /* For sysfs */
103#endif 103#endif
104#ifdef CONFIG_MEMCG_KMEM
105 struct memcg_cache_params *memcg_params;
106 int max_attr_size; /* for propagation, maximum size of a stored attr */
107#endif
104 108
105#ifdef CONFIG_NUMA 109#ifdef CONFIG_NUMA
106 /* 110 /*
@@ -222,7 +226,10 @@ void *__kmalloc(size_t size, gfp_t flags);
222static __always_inline void * 226static __always_inline void *
223kmalloc_order(size_t size, gfp_t flags, unsigned int order) 227kmalloc_order(size_t size, gfp_t flags, unsigned int order)
224{ 228{
225 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); 229 void *ret;
230
231 flags |= (__GFP_COMP | __GFP_KMEMCG);
232 ret = (void *) __get_free_pages(flags, order);
226 kmemleak_alloc(ret, size, 1, flags); 233 kmemleak_alloc(ret, size, 1, flags);
227 return ret; 234 return ret;
228} 235}
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
index ce718cbce435..f4bf16e16e16 100644
--- a/include/linux/smscphy.h
+++ b/include/linux/smscphy.h
@@ -4,6 +4,7 @@
4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */ 4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
5#define MII_LAN83C185_IM 30 /* Interrupt Mask */ 5#define MII_LAN83C185_IM 30 /* Interrupt Mask */
6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */ 6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
7#define MII_LAN83C185_SPECIAL_MODES 18 /* Special Modes Register */
7 8
8#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */ 9#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */
9#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */ 10#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */
@@ -22,4 +23,8 @@
22#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */ 23#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
23#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */ 24#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */
24 25
26#define MII_LAN83C185_MODE_MASK 0xE0
27#define MII_LAN83C185_MODE_POWERDOWN 0xC0 /* Power Down mode */
28#define MII_LAN83C185_MODE_ALL 0xE0 /* All capable mode */
29
25#endif /* __LINUX_SMSCPHY_H__ */ 30#endif /* __LINUX_SMSCPHY_H__ */
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index c64de9dd7631..2f694f3846a9 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -46,8 +46,9 @@ struct ads7846_platform_data {
46 u16 debounce_rep; /* additional consecutive good readings 46 u16 debounce_rep; /* additional consecutive good readings
47 * required after the first two */ 47 * required after the first two */
48 int gpio_pendown; /* the GPIO used to decide the pendown 48 int gpio_pendown; /* the GPIO used to decide the pendown
49 * state if get_pendown_state == NULL 49 * state if get_pendown_state == NULL */
50 */ 50 int gpio_pendown_debounce; /* platform specific debounce time for
51 * the gpio_pendown */
51 int (*get_pendown_state)(void); 52 int (*get_pendown_state)(void);
52 int (*filter_init) (const struct ads7846_platform_data *pdata, 53 int (*filter_init) (const struct ads7846_platform_data *pdata,
53 void **filter_data); 54 void **filter_data);
diff --git a/include/linux/spi/spi-tegra.h b/include/linux/spi/spi-tegra.h
new file mode 100644
index 000000000000..786932c62edb
--- /dev/null
+++ b/include/linux/spi/spi-tegra.h
@@ -0,0 +1,40 @@
1/*
2 * spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller.
3 *
4 * Copyright (C) 2011 NVIDIA Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _LINUX_SPI_TEGRA_H
22#define _LINUX_SPI_TEGRA_H
23
24struct tegra_spi_platform_data {
25 int dma_req_sel;
26 unsigned int spi_max_frequency;
27};
28
29/*
30 * Controller data from device to pass some info like
31 * hw based chip select can be used or not and if yes
32 * then CS hold and setup time.
33 */
34struct tegra_spi_device_controller_data {
35 bool is_hw_based_cs;
36 int cs_setup_clk_count;
37 int cs_hold_clk_count;
38};
39
40#endif /* _LINUX_SPI_TEGRA_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index fa702aeb5038..f62918946d86 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -90,6 +90,7 @@ struct spi_device {
90 void *controller_state; 90 void *controller_state;
91 void *controller_data; 91 void *controller_data;
92 char modalias[SPI_NAME_SIZE]; 92 char modalias[SPI_NAME_SIZE];
93 int cs_gpio; /* chip select gpio */
93 94
94 /* 95 /*
95 * likely need more hooks for more protocol options affecting how 96 * likely need more hooks for more protocol options affecting how
@@ -362,6 +363,8 @@ struct spi_master {
362 int (*transfer_one_message)(struct spi_master *master, 363 int (*transfer_one_message)(struct spi_master *master,
363 struct spi_message *mesg); 364 struct spi_message *mesg);
364 int (*unprepare_transfer_hardware)(struct spi_master *master); 365 int (*unprepare_transfer_hardware)(struct spi_master *master);
366 /* gpio chip select */
367 int *cs_gpios;
365}; 368};
366 369
367static inline void *spi_master_get_devdata(struct spi_master *master) 370static inline void *spi_master_get_devdata(struct spi_master *master)
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 55a5c52cbb25..6eb691b08358 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -16,8 +16,10 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * 17 *
18 * Copyright (C) IBM Corporation, 2006 18 * Copyright (C) IBM Corporation, 2006
19 * Copyright (C) Fujitsu, 2012
19 * 20 *
20 * Author: Paul McKenney <paulmck@us.ibm.com> 21 * Author: Paul McKenney <paulmck@us.ibm.com>
22 * Lai Jiangshan <laijs@cn.fujitsu.com>
21 * 23 *
22 * For detailed explanation of Read-Copy Update mechanism see - 24 * For detailed explanation of Read-Copy Update mechanism see -
23 * Documentation/RCU/ *.txt 25 * Documentation/RCU/ *.txt
@@ -40,6 +42,8 @@ struct rcu_batch {
40 struct rcu_head *head, **tail; 42 struct rcu_head *head, **tail;
41}; 43};
42 44
45#define RCU_BATCH_INIT(name) { NULL, &(name.head) }
46
43struct srcu_struct { 47struct srcu_struct {
44 unsigned completed; 48 unsigned completed;
45 struct srcu_struct_array __percpu *per_cpu_ref; 49 struct srcu_struct_array __percpu *per_cpu_ref;
@@ -70,12 +74,42 @@ int __init_srcu_struct(struct srcu_struct *sp, const char *name,
70 __init_srcu_struct((sp), #sp, &__srcu_key); \ 74 __init_srcu_struct((sp), #sp, &__srcu_key); \
71}) 75})
72 76
77#define __SRCU_DEP_MAP_INIT(srcu_name) .dep_map = { .name = #srcu_name },
73#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 78#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
74 79
75int init_srcu_struct(struct srcu_struct *sp); 80int init_srcu_struct(struct srcu_struct *sp);
76 81
82#define __SRCU_DEP_MAP_INIT(srcu_name)
77#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 83#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
78 84
85void process_srcu(struct work_struct *work);
86
87#define __SRCU_STRUCT_INIT(name) \
88 { \
89 .completed = -300, \
90 .per_cpu_ref = &name##_srcu_array, \
91 .queue_lock = __SPIN_LOCK_UNLOCKED(name.queue_lock), \
92 .running = false, \
93 .batch_queue = RCU_BATCH_INIT(name.batch_queue), \
94 .batch_check0 = RCU_BATCH_INIT(name.batch_check0), \
95 .batch_check1 = RCU_BATCH_INIT(name.batch_check1), \
96 .batch_done = RCU_BATCH_INIT(name.batch_done), \
97 .work = __DELAYED_WORK_INITIALIZER(name.work, process_srcu, 0),\
98 __SRCU_DEP_MAP_INIT(name) \
99 }
100
101/*
102 * define and init a srcu struct at build time.
103 * dont't call init_srcu_struct() nor cleanup_srcu_struct() on it.
104 */
105#define DEFINE_SRCU(name) \
106 static DEFINE_PER_CPU(struct srcu_struct_array, name##_srcu_array);\
107 struct srcu_struct name = __SRCU_STRUCT_INIT(name);
108
109#define DEFINE_STATIC_SRCU(name) \
110 static DEFINE_PER_CPU(struct srcu_struct_array, name##_srcu_array);\
111 static struct srcu_struct name = __SRCU_STRUCT_INIT(name);
112
79/** 113/**
80 * call_srcu() - Queue a callback for invocation after an SRCU grace period 114 * call_srcu() - Queue a callback for invocation after an SRCU grace period
81 * @sp: srcu_struct in queue the callback 115 * @sp: srcu_struct in queue the callback
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index bb674c02f306..22958d68ecfe 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -6,8 +6,10 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/gpio.h>
9#include <linux/mod_devicetable.h> 10#include <linux/mod_devicetable.h>
10#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/platform_device.h>
11 13
12#include <linux/ssb/ssb_regs.h> 14#include <linux/ssb/ssb_regs.h>
13 15
@@ -432,7 +434,11 @@ struct ssb_bus {
432#ifdef CONFIG_SSB_EMBEDDED 434#ifdef CONFIG_SSB_EMBEDDED
433 /* Lock for GPIO register access. */ 435 /* Lock for GPIO register access. */
434 spinlock_t gpio_lock; 436 spinlock_t gpio_lock;
437 struct platform_device *watchdog;
435#endif /* EMBEDDED */ 438#endif /* EMBEDDED */
439#ifdef CONFIG_SSB_DRIVER_GPIO
440 struct gpio_chip gpio;
441#endif /* DRIVER_GPIO */
436 442
437 /* Internal-only stuff follows. Do not touch. */ 443 /* Internal-only stuff follows. Do not touch. */
438 struct list_head list; 444 struct list_head list;
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index c2b02a5c86ae..9e492be5244b 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -590,7 +590,10 @@ struct ssb_chipcommon {
590 u32 status; 590 u32 status;
591 /* Fast Powerup Delay constant */ 591 /* Fast Powerup Delay constant */
592 u16 fast_pwrup_delay; 592 u16 fast_pwrup_delay;
593 spinlock_t gpio_lock;
593 struct ssb_chipcommon_pmu pmu; 594 struct ssb_chipcommon_pmu pmu;
595 u32 ticks_per_ms;
596 u32 max_timer_ms;
594}; 597};
595 598
596static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) 599static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
@@ -630,8 +633,7 @@ enum ssb_clkmode {
630extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, 633extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
631 enum ssb_clkmode mode); 634 enum ssb_clkmode mode);
632 635
633extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 636extern u32 ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks);
634 u32 ticks);
635 637
636void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value); 638void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value);
637 639
@@ -644,6 +646,8 @@ u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
644u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value); 646u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value);
645u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value); 647u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value);
646u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value); 648u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value);
649u32 ssb_chipco_gpio_pullup(struct ssb_chipcommon *cc, u32 mask, u32 value);
650u32 ssb_chipco_gpio_pulldown(struct ssb_chipcommon *cc, u32 mask, u32 value);
647 651
648#ifdef CONFIG_SSB_SERIAL 652#ifdef CONFIG_SSB_SERIAL
649extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc, 653extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
diff --git a/include/linux/ssb/ssb_driver_extif.h b/include/linux/ssb/ssb_driver_extif.h
index 91161f0aa22b..a410e841eb91 100644
--- a/include/linux/ssb/ssb_driver_extif.h
+++ b/include/linux/ssb/ssb_driver_extif.h
@@ -152,12 +152,16 @@
152/* watchdog */ 152/* watchdog */
153#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ 153#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */
154 154
155#define SSB_EXTIF_WATCHDOG_MAX_TIMER ((1 << 28) - 1)
156#define SSB_EXTIF_WATCHDOG_MAX_TIMER_MS (SSB_EXTIF_WATCHDOG_MAX_TIMER \
157 / (SSB_EXTIF_WATCHDOG_CLK / 1000))
155 158
156 159
157#ifdef CONFIG_SSB_DRIVER_EXTIF 160#ifdef CONFIG_SSB_DRIVER_EXTIF
158 161
159struct ssb_extif { 162struct ssb_extif {
160 struct ssb_device *dev; 163 struct ssb_device *dev;
164 spinlock_t gpio_lock;
161}; 165};
162 166
163static inline bool ssb_extif_available(struct ssb_extif *extif) 167static inline bool ssb_extif_available(struct ssb_extif *extif)
@@ -171,8 +175,7 @@ extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
171extern void ssb_extif_timing_init(struct ssb_extif *extif, 175extern void ssb_extif_timing_init(struct ssb_extif *extif,
172 unsigned long ns); 176 unsigned long ns);
173 177
174extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 178extern u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks);
175 u32 ticks);
176 179
177/* Extif GPIO pin access */ 180/* Extif GPIO pin access */
178u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); 181u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
@@ -205,10 +208,52 @@ void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
205} 208}
206 209
207static inline 210static inline
208void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 211void ssb_extif_timing_init(struct ssb_extif *extif, unsigned long ns)
209 u32 ticks)
210{ 212{
211} 213}
212 214
215static inline
216u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks)
217{
218 return 0;
219}
220
221static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
222{
223 return 0;
224}
225
226static inline u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask,
227 u32 value)
228{
229 return 0;
230}
231
232static inline u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask,
233 u32 value)
234{
235 return 0;
236}
237
238static inline u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask,
239 u32 value)
240{
241 return 0;
242}
243
244static inline u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask,
245 u32 value)
246{
247 return 0;
248}
249
250#ifdef CONFIG_SSB_SERIAL
251static inline int ssb_extif_serial_init(struct ssb_extif *extif,
252 struct ssb_serial_port *ports)
253{
254 return 0;
255}
256#endif /* CONFIG_SSB_SERIAL */
257
213#endif /* CONFIG_SSB_DRIVER_EXTIF */ 258#endif /* CONFIG_SSB_DRIVER_EXTIF */
214#endif /* LINUX_SSB_EXTIFCORE_H_ */ 259#endif /* LINUX_SSB_EXTIFCORE_H_ */
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index 5f44e9740cd2..07a9c7a2e088 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -13,6 +13,12 @@ struct ssb_serial_port {
13 unsigned int reg_shift; 13 unsigned int reg_shift;
14}; 14};
15 15
16struct ssb_pflash {
17 bool present;
18 u8 buswidth;
19 u32 window;
20 u32 window_size;
21};
16 22
17struct ssb_mipscore { 23struct ssb_mipscore {
18 struct ssb_device *dev; 24 struct ssb_device *dev;
@@ -20,9 +26,7 @@ struct ssb_mipscore {
20 int nr_serial_ports; 26 int nr_serial_ports;
21 struct ssb_serial_port serial_ports[4]; 27 struct ssb_serial_port serial_ports[4];
22 28
23 u8 flash_buswidth; 29 struct ssb_pflash pflash;
24 u32 flash_window;
25 u32 flash_window_size;
26}; 30};
27 31
28extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 32extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index a0525019e1d1..6ecfa02ddbac 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -485,7 +485,7 @@
485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4 485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4
486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020 486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020
487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5 487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5
488#define SSB_SPROM8_TEMPDELTA 0x00BA 488#define SSB_SPROM8_TEMPDELTA 0x00BC
489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff 489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff
490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0 490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0
491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00 491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index a1547ea3920d..c1b3ed3fb787 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -61,7 +61,7 @@
61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */ 61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */
62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */ 62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */
63 63
64/* AXI DMA Burst length suported */ 64/* AXI DMA Burst length supported */
65#define DMA_AXI_BLEN_4 (1 << 1) 65#define DMA_AXI_BLEN_4 (1 << 1)
66#define DMA_AXI_BLEN_8 (1 << 2) 66#define DMA_AXI_BLEN_8 (1 << 2)
67#define DMA_AXI_BLEN_16 (1 << 3) 67#define DMA_AXI_BLEN_16 (1 << 3)
@@ -104,6 +104,7 @@ struct plat_stmmacenet_data {
104 int bugged_jumbo; 104 int bugged_jumbo;
105 int pmt; 105 int pmt;
106 int force_sf_dma_mode; 106 int force_sf_dma_mode;
107 int riwt_off;
107 void (*fix_mac_speed)(void *priv, unsigned int speed); 108 void (*fix_mac_speed)(void *priv, unsigned int speed);
108 void (*bus_setup)(void __iomem *ioaddr); 109 void (*bus_setup)(void __iomem *ioaddr);
109 int (*init)(struct platform_device *pdev); 110 int (*init)(struct platform_device *pdev);
diff --git a/include/linux/string.h b/include/linux/string.h
index 630125818ca8..ac889c5ea11b 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -143,4 +143,15 @@ static inline bool strstarts(const char *str, const char *prefix)
143 143
144extern size_t memweight(const void *ptr, size_t bytes); 144extern size_t memweight(const void *ptr, size_t bytes);
145 145
146/**
147 * kbasename - return the last part of a pathname.
148 *
149 * @path: path to extract the filename from.
150 */
151static inline const char *kbasename(const char *path)
152{
153 const char *tail = strrchr(path, '/');
154 return tail ? tail + 1 : path;
155}
156
146#endif /* _LINUX_STRING_H_ */ 157#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index f792794f6634..5dc9ee4d616e 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -217,6 +217,8 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
217static inline int get_int(char **bpp, int *anint) 217static inline int get_int(char **bpp, int *anint)
218{ 218{
219 char buf[50]; 219 char buf[50];
220 char *ep;
221 int rv;
220 int len = qword_get(bpp, buf, sizeof(buf)); 222 int len = qword_get(bpp, buf, sizeof(buf));
221 223
222 if (len < 0) 224 if (len < 0)
@@ -224,9 +226,11 @@ static inline int get_int(char **bpp, int *anint)
224 if (len == 0) 226 if (len == 0)
225 return -ENOENT; 227 return -ENOENT;
226 228
227 if (kstrtoint(buf, 0, anint)) 229 rv = simple_strtol(buf, &ep, 0);
230 if (*ep)
228 return -EINVAL; 231 return -EINVAL;
229 232
233 *anint = rv;
230 return 0; 234 return 0;
231} 235}
232 236
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index dc0c3cc3ada3..b64f8eb0b973 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -192,7 +192,6 @@ struct rpc_wait_queue {
192 pid_t owner; /* process id of last task serviced */ 192 pid_t owner; /* process id of last task serviced */
193 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ 193 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
194 unsigned char priority; /* current priority */ 194 unsigned char priority; /* current priority */
195 unsigned char count; /* # task groups remaining serviced so far */
196 unsigned char nr; /* # tasks remaining for cookie */ 195 unsigned char nr; /* # tasks remaining for cookie */
197 unsigned short qlen; /* total # tasks waiting in queue */ 196 unsigned short qlen; /* total # tasks waiting in queue */
198 struct rpc_timer timer_list; 197 struct rpc_timer timer_list;
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index d83db800fe02..676ddf53b3ee 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -243,6 +243,7 @@ struct svc_rqst {
243 struct page * rq_pages[RPCSVC_MAXPAGES]; 243 struct page * rq_pages[RPCSVC_MAXPAGES];
244 struct page * *rq_respages; /* points into rq_pages */ 244 struct page * *rq_respages; /* points into rq_pages */
245 int rq_resused; /* number of pages used for result */ 245 int rq_resused; /* number of pages used for result */
246 struct page * *rq_next_page; /* next reply page to use */
246 247
247 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
248 249
@@ -338,9 +339,8 @@ xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
338 339
339static inline void svc_free_res_pages(struct svc_rqst *rqstp) 340static inline void svc_free_res_pages(struct svc_rqst *rqstp)
340{ 341{
341 while (rqstp->rq_resused) { 342 while (rqstp->rq_next_page != rqstp->rq_respages) {
342 struct page **pp = (rqstp->rq_respages + 343 struct page **pp = --rqstp->rq_next_page;
343 --rqstp->rq_resused);
344 if (*pp) { 344 if (*pp) {
345 put_page(*pp); 345 put_page(*pp);
346 *pp = NULL; 346 *pp = NULL;
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 92ad02f0dcc0..62fd1b756e99 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -26,11 +26,28 @@ struct svc_sock {
26 void (*sk_owspace)(struct sock *); 26 void (*sk_owspace)(struct sock *);
27 27
28 /* private TCP part */ 28 /* private TCP part */
29 u32 sk_reclen; /* length of record */ 29 /* On-the-wire fragment header: */
30 u32 sk_tcplen; /* current read length */ 30 __be32 sk_reclen;
31 /* As we receive a record, this includes the length received so
32 * far (including the fragment header): */
33 u32 sk_tcplen;
34 /* Total length of the data (not including fragment headers)
35 * received so far in the fragments making up this rpc: */
36 u32 sk_datalen;
37
31 struct page * sk_pages[RPCSVC_MAXPAGES]; /* received data */ 38 struct page * sk_pages[RPCSVC_MAXPAGES]; /* received data */
32}; 39};
33 40
41static inline u32 svc_sock_reclen(struct svc_sock *svsk)
42{
43 return ntohl(svsk->sk_reclen) & RPC_FRAGMENT_SIZE_MASK;
44}
45
46static inline u32 svc_sock_final_rec(struct svc_sock *svsk)
47{
48 return ntohl(svsk->sk_reclen) & RPC_LAST_STREAM_FRAGMENT;
49}
50
34/* 51/*
35 * Function prototypes. 52 * Function prototypes.
36 */ 53 */
diff --git a/include/linux/sunxi_timer.h b/include/linux/sunxi_timer.h
new file mode 100644
index 000000000000..b9165bba6e61
--- /dev/null
+++ b/include/linux/sunxi_timer.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __SUNXI_TIMER_H
18#define __SUNXI_TIMER_H
19
20#include <asm/mach/time.h>
21
22extern struct sys_timer sunxi_timer;
23
24#endif
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 8d08b3ed406d..071d62c214a6 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -34,21 +34,25 @@ enum dma_sync_target {
34 SYNC_FOR_CPU = 0, 34 SYNC_FOR_CPU = 0,
35 SYNC_FOR_DEVICE = 1, 35 SYNC_FOR_DEVICE = 1,
36}; 36};
37extern void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
38 phys_addr_t phys, size_t size,
39 enum dma_data_direction dir);
40 37
41extern void swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, 38/* define the last possible byte of physical address space as a mapping error */
39#define SWIOTLB_MAP_ERROR (~(phys_addr_t)0x0)
40
41extern phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
42 dma_addr_t tbl_dma_addr,
43 phys_addr_t phys, size_t size,
44 enum dma_data_direction dir);
45
46extern void swiotlb_tbl_unmap_single(struct device *hwdev,
47 phys_addr_t tlb_addr,
42 size_t size, enum dma_data_direction dir); 48 size_t size, enum dma_data_direction dir);
43 49
44extern void swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, 50extern void swiotlb_tbl_sync_single(struct device *hwdev,
51 phys_addr_t tlb_addr,
45 size_t size, enum dma_data_direction dir, 52 size_t size, enum dma_data_direction dir,
46 enum dma_sync_target target); 53 enum dma_sync_target target);
47 54
48/* Accessory functions. */ 55/* Accessory functions. */
49extern void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
50 enum dma_data_direction dir);
51
52extern void 56extern void
53*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 57*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
54 dma_addr_t *dma_handle, gfp_t flags); 58 dma_addr_t *dma_handle, gfp_t flags);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 727f0cd73921..45e2db270255 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -63,6 +63,7 @@ struct getcpu_cache;
63struct old_linux_dirent; 63struct old_linux_dirent;
64struct perf_event_attr; 64struct perf_event_attr;
65struct file_handle; 65struct file_handle;
66struct sigaltstack;
66 67
67#include <linux/types.h> 68#include <linux/types.h>
68#include <linux/aio_abi.h> 69#include <linux/aio_abi.h>
@@ -299,6 +300,11 @@ asmlinkage long sys_personality(unsigned int personality);
299asmlinkage long sys_sigpending(old_sigset_t __user *set); 300asmlinkage long sys_sigpending(old_sigset_t __user *set);
300asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
301 old_sigset_t __user *oset); 302 old_sigset_t __user *oset);
303#ifdef CONFIG_GENERIC_SIGALTSTACK
304asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
305 struct sigaltstack __user *uoss);
306#endif
307
302asmlinkage long sys_getitimer(int which, struct itimerval __user *value); 308asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
303asmlinkage long sys_setitimer(int which, 309asmlinkage long sys_setitimer(int which,
304 struct itimerval __user *value, 310 struct itimerval __user *value,
@@ -560,10 +566,10 @@ asmlinkage long sys_utime(char __user *filename,
560asmlinkage long sys_utimes(char __user *filename, 566asmlinkage long sys_utimes(char __user *filename,
561 struct timeval __user *utimes); 567 struct timeval __user *utimes);
562asmlinkage long sys_lseek(unsigned int fd, off_t offset, 568asmlinkage long sys_lseek(unsigned int fd, off_t offset,
563 unsigned int origin); 569 unsigned int whence);
564asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 570asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
565 unsigned long offset_low, loff_t __user *result, 571 unsigned long offset_low, loff_t __user *result,
566 unsigned int origin); 572 unsigned int whence);
567asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count); 573asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
568asmlinkage long sys_readahead(int fd, loff_t offset, size_t count); 574asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
569asmlinkage long sys_readv(unsigned long fd, 575asmlinkage long sys_readv(unsigned long fd,
@@ -827,16 +833,19 @@ asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
827 const char __user *pathname); 833 const char __user *pathname);
828asmlinkage long sys_syncfs(int fd); 834asmlinkage long sys_syncfs(int fd);
829 835
830#ifndef CONFIG_GENERIC_KERNEL_EXECVE 836asmlinkage long sys_fork(void);
831int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 837asmlinkage long sys_vfork(void);
838#ifdef CONFIG_CLONE_BACKWARDS
839asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
840 int __user *);
832#else 841#else
833#define kernel_execve(filename, argv, envp) \ 842asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
834 do_execve(filename, \ 843 int __user *, int);
835 (const char __user *const __user *)argv, \
836 (const char __user *const __user *)envp, \
837 current_pt_regs())
838#endif 844#endif
839 845
846asmlinkage long sys_execve(const char __user *filename,
847 const char __user *const __user *argv,
848 const char __user *const __user *envp);
840 849
841asmlinkage long sys_perf_event_open( 850asmlinkage long sys_perf_event_open(
842 struct perf_event_attr __user *attr_uptr, 851 struct perf_event_attr __user *attr_uptr,
@@ -868,4 +877,5 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
868 877
869asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, 878asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
870 unsigned long idx1, unsigned long idx2); 879 unsigned long idx1, unsigned long idx2);
880asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
871#endif 881#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index cd844a6a8d5f..14a8ff2de11e 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -158,8 +158,7 @@ struct ctl_table_root {
158 struct ctl_table_set default_set; 158 struct ctl_table_set default_set;
159 struct ctl_table_set *(*lookup)(struct ctl_table_root *root, 159 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
160 struct nsproxy *namespaces); 160 struct nsproxy *namespaces);
161 int (*permissions)(struct ctl_table_root *root, 161 int (*permissions)(struct ctl_table_header *head, struct ctl_table *table);
162 struct nsproxy *namespaces, struct ctl_table *table);
163}; 162};
164 163
165/* struct ctl_path describes where in the hierarchy a table is added */ 164/* struct ctl_path describes where in the hierarchy a table is added */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 60b7aac15e0e..4e1d2283e3cc 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -35,6 +35,16 @@ static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
35 return tcp_hdr(skb)->doff * 4; 35 return tcp_hdr(skb)->doff * 4;
36} 36}
37 37
38static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb)
39{
40 return (struct tcphdr *)skb_inner_transport_header(skb);
41}
42
43static inline unsigned int inner_tcp_hdrlen(const struct sk_buff *skb)
44{
45 return inner_tcp_hdr(skb)->doff * 4;
46}
47
38static inline unsigned int tcp_optlen(const struct sk_buff *skb) 48static inline unsigned int tcp_optlen(const struct sk_buff *skb)
39{ 49{
40 return (tcp_hdr(skb)->doff - 5) * 4; 50 return (tcp_hdr(skb)->doff - 5) * 4;
diff --git a/include/linux/tegra-ahb.h b/include/linux/tegra-ahb.h
new file mode 100644
index 000000000000..f1cd075ceee1
--- /dev/null
+++ b/include/linux/tegra-ahb.h
@@ -0,0 +1,19 @@
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
14#ifndef __LINUX_AHB_H__
15#define __LINUX_AHB_H__
16
17extern int tegra_ahb_enable_smmu(struct device_node *ahb);
18
19#endif /* __LINUX_AHB_H__ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 91b34812cd84..fe82022478e7 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -29,6 +29,32 @@
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31 31
32#define THERMAL_TRIPS_NONE -1
33#define THERMAL_MAX_TRIPS 12
34#define THERMAL_NAME_LENGTH 20
35
36/* No upper/lower limit requirement */
37#define THERMAL_NO_LIMIT -1UL
38
39/* Unit conversion macros */
40#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
41 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
42#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
43
44/* Adding event notification support elements */
45#define THERMAL_GENL_FAMILY_NAME "thermal_event"
46#define THERMAL_GENL_VERSION 0x01
47#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group"
48
49/* Default Thermal Governor */
50#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
51#define DEFAULT_THERMAL_GOVERNOR "step_wise"
52#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
53#define DEFAULT_THERMAL_GOVERNOR "fair_share"
54#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
55#define DEFAULT_THERMAL_GOVERNOR "user_space"
56#endif
57
32struct thermal_zone_device; 58struct thermal_zone_device;
33struct thermal_cooling_device; 59struct thermal_cooling_device;
34 60
@@ -50,6 +76,30 @@ enum thermal_trend {
50 THERMAL_TREND_DROPPING, /* temperature is dropping */ 76 THERMAL_TREND_DROPPING, /* temperature is dropping */
51}; 77};
52 78
79/* Events supported by Thermal Netlink */
80enum events {
81 THERMAL_AUX0,
82 THERMAL_AUX1,
83 THERMAL_CRITICAL,
84 THERMAL_DEV_FAULT,
85};
86
87/* attributes of thermal_genl_family */
88enum {
89 THERMAL_GENL_ATTR_UNSPEC,
90 THERMAL_GENL_ATTR_EVENT,
91 __THERMAL_GENL_ATTR_MAX,
92};
93#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
94
95/* commands supported by the thermal_genl_family */
96enum {
97 THERMAL_GENL_CMD_UNSPEC,
98 THERMAL_GENL_CMD_EVENT,
99 __THERMAL_GENL_CMD_MAX,
100};
101#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
102
53struct thermal_zone_device_ops { 103struct thermal_zone_device_ops {
54 int (*bind) (struct thermal_zone_device *, 104 int (*bind) (struct thermal_zone_device *,
55 struct thermal_cooling_device *); 105 struct thermal_cooling_device *);
@@ -83,11 +133,6 @@ struct thermal_cooling_device_ops {
83 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); 133 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
84}; 134};
85 135
86#define THERMAL_NO_LIMIT -1UL /* no upper/lower limit requirement */
87
88#define THERMAL_TRIPS_NONE -1
89#define THERMAL_MAX_TRIPS 12
90#define THERMAL_NAME_LENGTH 20
91struct thermal_cooling_device { 136struct thermal_cooling_device {
92 int id; 137 int id;
93 char type[THERMAL_NAME_LENGTH]; 138 char type[THERMAL_NAME_LENGTH];
@@ -100,10 +145,6 @@ struct thermal_cooling_device {
100 struct list_head node; 145 struct list_head node;
101}; 146};
102 147
103#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
104 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
105#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
106
107struct thermal_attr { 148struct thermal_attr {
108 struct device_attribute attr; 149 struct device_attribute attr;
109 char name[THERMAL_NAME_LENGTH]; 150 char name[THERMAL_NAME_LENGTH];
@@ -125,46 +166,61 @@ struct thermal_zone_device {
125 int passive; 166 int passive;
126 unsigned int forced_passive; 167 unsigned int forced_passive;
127 const struct thermal_zone_device_ops *ops; 168 const struct thermal_zone_device_ops *ops;
169 const struct thermal_zone_params *tzp;
170 struct thermal_governor *governor;
128 struct list_head thermal_instances; 171 struct list_head thermal_instances;
129 struct idr idr; 172 struct idr idr;
130 struct mutex lock; /* protect thermal_instances list */ 173 struct mutex lock; /* protect thermal_instances list */
131 struct list_head node; 174 struct list_head node;
132 struct delayed_work poll_queue; 175 struct delayed_work poll_queue;
133}; 176};
134/* Adding event notification support elements */
135#define THERMAL_GENL_FAMILY_NAME "thermal_event"
136#define THERMAL_GENL_VERSION 0x01
137#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group"
138 177
139enum events { 178/* Structure that holds thermal governor information */
140 THERMAL_AUX0, 179struct thermal_governor {
141 THERMAL_AUX1, 180 char name[THERMAL_NAME_LENGTH];
142 THERMAL_CRITICAL, 181 int (*throttle)(struct thermal_zone_device *tz, int trip);
143 THERMAL_DEV_FAULT, 182 struct list_head governor_list;
183 struct module *owner;
144}; 184};
145 185
146struct thermal_genl_event { 186/* Structure that holds binding parameters for a zone */
147 u32 orig; 187struct thermal_bind_params {
148 enum events event; 188 struct thermal_cooling_device *cdev;
189
190 /*
191 * This is a measure of 'how effectively these devices can
192 * cool 'this' thermal zone. The shall be determined by platform
193 * characterization. This is on a 'percentage' scale.
194 * See Documentation/thermal/sysfs-api.txt for more information.
195 */
196 int weight;
197
198 /*
199 * This is a bit mask that gives the binding relation between this
200 * thermal zone and cdev, for a particular trip point.
201 * See Documentation/thermal/sysfs-api.txt for more information.
202 */
203 int trip_mask;
204 int (*match) (struct thermal_zone_device *tz,
205 struct thermal_cooling_device *cdev);
149}; 206};
150/* attributes of thermal_genl_family */ 207
151enum { 208/* Structure to define Thermal Zone parameters */
152 THERMAL_GENL_ATTR_UNSPEC, 209struct thermal_zone_params {
153 THERMAL_GENL_ATTR_EVENT, 210 char governor_name[THERMAL_NAME_LENGTH];
154 __THERMAL_GENL_ATTR_MAX, 211 int num_tbps; /* Number of tbp entries */
212 struct thermal_bind_params *tbp;
155}; 213};
156#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
157 214
158/* commands supported by the thermal_genl_family */ 215struct thermal_genl_event {
159enum { 216 u32 orig;
160 THERMAL_GENL_CMD_UNSPEC, 217 enum events event;
161 THERMAL_GENL_CMD_EVENT,
162 __THERMAL_GENL_CMD_MAX,
163}; 218};
164#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
165 219
220/* Function declarations */
166struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, 221struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
167 void *, const struct thermal_zone_device_ops *, int, int); 222 void *, const struct thermal_zone_device_ops *,
223 const struct thermal_zone_params *, int, int);
168void thermal_zone_device_unregister(struct thermal_zone_device *); 224void thermal_zone_device_unregister(struct thermal_zone_device *);
169 225
170int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 226int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
@@ -173,10 +229,20 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
173int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 229int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
174 struct thermal_cooling_device *); 230 struct thermal_cooling_device *);
175void thermal_zone_device_update(struct thermal_zone_device *); 231void thermal_zone_device_update(struct thermal_zone_device *);
232
176struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 233struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
177 const struct thermal_cooling_device_ops *); 234 const struct thermal_cooling_device_ops *);
178void thermal_cooling_device_unregister(struct thermal_cooling_device *); 235void thermal_cooling_device_unregister(struct thermal_cooling_device *);
179 236
237int get_tz_trend(struct thermal_zone_device *, int);
238struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
239 struct thermal_cooling_device *, int);
240void thermal_cdev_update(struct thermal_cooling_device *);
241void notify_thermal_framework(struct thermal_zone_device *, int);
242
243int thermal_register_governor(struct thermal_governor *);
244void thermal_unregister_governor(struct thermal_governor *);
245
180#ifdef CONFIG_NET 246#ifdef CONFIG_NET
181extern int thermal_generate_netlink_event(u32 orig, enum events event); 247extern int thermal_generate_netlink_event(u32 orig, enum events event);
182#else 248#else
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index ccc1899bd62e..e7e04736802f 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -61,6 +61,8 @@ extern long do_no_restart_syscall(struct restart_block *parm);
61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK) 61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
62#endif 62#endif
63 63
64#define THREADINFO_GFP_ACCOUNTED (THREADINFO_GFP | __GFP_KMEMCG)
65
64/* 66/*
65 * flag set/clear/test wrappers 67 * flag set/clear/test wrappers
66 * - pass TIF_xxxx constants to these functions 68 * - pass TIF_xxxx constants to these functions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index f37fceb69b73..1a6567b48492 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -142,4 +142,10 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
142static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } 142static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
143# endif /* !NO_HZ */ 143# endif /* !NO_HZ */
144 144
145# ifdef CONFIG_CPU_IDLE_GOV_MENU
146extern void menu_hrtimer_cancel(void);
147# else
148static inline void menu_hrtimer_cancel(void) {}
149# endif /* CONFIG_CPU_IDLE_GOV_MENU */
150
145#endif 151#endif
diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h
deleted file mode 100644
index 546e2234e4b3..000000000000
--- a/include/linux/timecompare.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Utility code which helps transforming between two different time
3 * bases, called "source" and "target" time in this code.
4 *
5 * Source time has to be provided via the timecounter API while target
6 * time is accessed via a function callback whose prototype
7 * intentionally matches ktime_get() and ktime_get_real(). These
8 * interfaces where chosen like this so that the code serves its
9 * initial purpose without additional glue code.
10 *
11 * This purpose is synchronizing a hardware clock in a NIC with system
12 * time, in order to implement the Precision Time Protocol (PTP,
13 * IEEE1588) with more accurate hardware assisted time stamping. In
14 * that context only synchronization against system time (=
15 * ktime_get_real()) is currently needed. But this utility code might
16 * become useful in other situations, which is why it was written as
17 * general purpose utility code.
18 *
19 * The source timecounter is assumed to return monotonically
20 * increasing time (but this code does its best to compensate if that
21 * is not the case) whereas target time may jump.
22 *
23 * The target time corresponding to a source time is determined by
24 * reading target time, reading source time, reading target time
25 * again, then assuming that average target time corresponds to source
26 * time. In other words, the assumption is that reading the source
27 * time is slow and involves equal time for sending the request and
28 * receiving the reply, whereas reading target time is assumed to be
29 * fast.
30 *
31 * Copyright (C) 2009 Intel Corporation.
32 * Author: Patrick Ohly <patrick.ohly@intel.com>
33 *
34 * This program is free software; you can redistribute it and/or modify it
35 * under the terms and conditions of the GNU General Public License,
36 * version 2, as published by the Free Software Foundation.
37 *
38 * This program is distributed in the hope it will be useful, but WITHOUT
39 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
40 * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
41 * more details.
42 *
43 * You should have received a copy of the GNU General Public License along with
44 * this program; if not, write to the Free Software Foundation, Inc.,
45 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
46 */
47#ifndef _LINUX_TIMECOMPARE_H
48#define _LINUX_TIMECOMPARE_H
49
50#include <linux/clocksource.h>
51#include <linux/ktime.h>
52
53/**
54 * struct timecompare - stores state and configuration for the two clocks
55 *
56 * Initialize to zero, then set source/target/num_samples.
57 *
58 * Transformation between source time and target time is done with:
59 * target_time = source_time + offset +
60 * (source_time - last_update) * skew /
61 * TIMECOMPARE_SKEW_RESOLUTION
62 *
63 * @source: used to get source time stamps via timecounter_read()
64 * @target: function returning target time (for example, ktime_get
65 * for monotonic time, or ktime_get_real for wall clock)
66 * @num_samples: number of times that source time and target time are to
67 * be compared when determining their offset
68 * @offset: (target time - source time) at the time of the last update
69 * @skew: average (target time - source time) / delta source time *
70 * TIMECOMPARE_SKEW_RESOLUTION
71 * @last_update: last source time stamp when time offset was measured
72 */
73struct timecompare {
74 struct timecounter *source;
75 ktime_t (*target)(void);
76 int num_samples;
77
78 s64 offset;
79 s64 skew;
80 u64 last_update;
81};
82
83/**
84 * timecompare_transform - transform source time stamp into target time base
85 * @sync: context for time sync
86 * @source_tstamp: the result of timecounter_read() or
87 * timecounter_cyc2time()
88 */
89extern ktime_t timecompare_transform(struct timecompare *sync,
90 u64 source_tstamp);
91
92/**
93 * timecompare_offset - measure current (target time - source time) offset
94 * @sync: context for time sync
95 * @offset: average offset during sample period returned here
96 * @source_tstamp: average source time during sample period returned here
97 *
98 * Returns number of samples used. Might be zero (= no result) in the
99 * unlikely case that target time was monotonically decreasing for all
100 * samples (= broken).
101 */
102extern int timecompare_offset(struct timecompare *sync,
103 s64 *offset,
104 u64 *source_tstamp);
105
106extern void __timecompare_update(struct timecompare *sync,
107 u64 source_tstamp);
108
109/**
110 * timecompare_update - update offset and skew by measuring current offset
111 * @sync: context for time sync
112 * @source_tstamp: the result of timecounter_read() or
113 * timecounter_cyc2time(), pass zero to force update
114 *
115 * Updates are only done at most once per second.
116 */
117static inline void timecompare_update(struct timecompare *sync,
118 u64 source_tstamp)
119{
120 if (!source_tstamp ||
121 (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC)
122 __timecompare_update(sync, source_tstamp);
123}
124
125#endif /* _LINUX_TIMECOMPARE_H */
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h
index 4eb490237d4c..d563f37e1a1d 100644
--- a/include/linux/trace_clock.h
+++ b/include/linux/trace_clock.h
@@ -12,6 +12,8 @@
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/types.h> 13#include <linux/types.h>
14 14
15#include <asm/trace_clock.h>
16
15extern u64 notrace trace_clock_local(void); 17extern u64 notrace trace_clock_local(void);
16extern u64 notrace trace_clock(void); 18extern u64 notrace trace_clock(void);
17extern u64 notrace trace_clock_global(void); 19extern u64 notrace trace_clock_global(void);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f0b4eb47297c..8db1b569c37a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -188,7 +188,9 @@ struct tty_port_operations {
188}; 188};
189 189
190struct tty_port { 190struct tty_port {
191 struct tty_bufhead buf; /* Locked internally */
191 struct tty_struct *tty; /* Back pointer */ 192 struct tty_struct *tty; /* Back pointer */
193 struct tty_struct *itty; /* internal back ptr */
192 const struct tty_port_operations *ops; /* Port operations */ 194 const struct tty_port_operations *ops; /* Port operations */
193 spinlock_t lock; /* Lock protecting tty field */ 195 spinlock_t lock; /* Lock protecting tty field */
194 int blocked_open; /* Waiting to open */ 196 int blocked_open; /* Waiting to open */
@@ -197,6 +199,9 @@ struct tty_port {
197 wait_queue_head_t close_wait; /* Close waiters */ 199 wait_queue_head_t close_wait; /* Close waiters */
198 wait_queue_head_t delta_msr_wait; /* Modem status change */ 200 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 unsigned long flags; /* TTY flags ASY_*/ 201 unsigned long flags; /* TTY flags ASY_*/
202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
200 unsigned char console:1; /* port is a console */ 205 unsigned char console:1; /* port is a console */
201 struct mutex mutex; /* Locking */ 206 struct mutex mutex; /* Locking */
202 struct mutex buf_mutex; /* Buffer alloc lock */ 207 struct mutex buf_mutex; /* Buffer alloc lock */
@@ -235,6 +240,7 @@ struct tty_struct {
235 struct mutex ldisc_mutex; 240 struct mutex ldisc_mutex;
236 struct tty_ldisc *ldisc; 241 struct tty_ldisc *ldisc;
237 242
243 struct mutex atomic_write_lock;
238 struct mutex legacy_mutex; 244 struct mutex legacy_mutex;
239 struct mutex termios_mutex; 245 struct mutex termios_mutex;
240 spinlock_t ctrl_lock; 246 spinlock_t ctrl_lock;
@@ -254,7 +260,6 @@ struct tty_struct {
254 260
255 struct tty_struct *link; 261 struct tty_struct *link;
256 struct fasync_struct *fasync; 262 struct fasync_struct *fasync;
257 struct tty_bufhead buf; /* Locked internally */
258 int alt_speed; /* For magic substitution of 38400 bps */ 263 int alt_speed; /* For magic substitution of 38400 bps */
259 wait_queue_head_t write_wait; 264 wait_queue_head_t write_wait;
260 wait_queue_head_t read_wait; 265 wait_queue_head_t read_wait;
@@ -265,37 +270,10 @@ struct tty_struct {
265 270
266#define N_TTY_BUF_SIZE 4096 271#define N_TTY_BUF_SIZE 4096
267 272
268 /*
269 * The following is data for the N_TTY line discipline. For
270 * historical reasons, this is included in the tty structure.
271 * Mostly locked by the BKL.
272 */
273 unsigned int column;
274 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
275 unsigned char closing:1; 273 unsigned char closing:1;
276 unsigned char echo_overrun:1;
277 unsigned short minimum_to_wake; 274 unsigned short minimum_to_wake;
278 unsigned long overrun_time;
279 int num_overrun;
280 unsigned long process_char_map[256/(8*sizeof(unsigned long))];
281 char *read_buf;
282 int read_head;
283 int read_tail;
284 int read_cnt;
285 unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
286 unsigned char *echo_buf;
287 unsigned int echo_pos;
288 unsigned int echo_cnt;
289 int canon_data;
290 unsigned long canon_head;
291 unsigned int canon_column;
292 struct mutex atomic_read_lock;
293 struct mutex atomic_write_lock;
294 struct mutex output_lock;
295 struct mutex echo_lock;
296 unsigned char *write_buf; 275 unsigned char *write_buf;
297 int write_cnt; 276 int write_cnt;
298 spinlock_t read_lock;
299 /* If the tty has a pending do_SAK, queue it here - akpm */ 277 /* If the tty has a pending do_SAK, queue it here - akpm */
300 struct work_struct SAK_work; 278 struct work_struct SAK_work;
301 struct tty_port *port; 279 struct tty_port *port;
@@ -335,8 +313,6 @@ struct tty_file_private {
335#define TTY_PTY_LOCK 16 /* pty private */ 313#define TTY_PTY_LOCK 16 /* pty private */
336#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 314#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
337#define TTY_HUPPED 18 /* Post driver->hangup() */ 315#define TTY_HUPPED 18 /* Post driver->hangup() */
338#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
339#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
340#define TTY_HUPPING 21 /* ->hangup() in progress */ 316#define TTY_HUPPING 21 /* ->hangup() in progress */
341 317
342#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 318#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
@@ -412,9 +388,9 @@ extern void disassociate_ctty(int priv);
412extern void no_tty(void); 388extern void no_tty(void);
413extern void tty_flip_buffer_push(struct tty_struct *tty); 389extern void tty_flip_buffer_push(struct tty_struct *tty);
414extern void tty_flush_to_ldisc(struct tty_struct *tty); 390extern void tty_flush_to_ldisc(struct tty_struct *tty);
415extern void tty_buffer_free_all(struct tty_struct *tty); 391extern void tty_buffer_free_all(struct tty_port *port);
416extern void tty_buffer_flush(struct tty_struct *tty); 392extern void tty_buffer_flush(struct tty_struct *tty);
417extern void tty_buffer_init(struct tty_struct *tty); 393extern void tty_buffer_init(struct tty_port *port);
418extern speed_t tty_get_baud_rate(struct tty_struct *tty); 394extern speed_t tty_get_baud_rate(struct tty_struct *tty);
419extern speed_t tty_termios_baud_rate(struct ktermios *termios); 395extern speed_t tty_termios_baud_rate(struct ktermios *termios);
420extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 396extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -479,6 +455,7 @@ extern struct device *tty_port_register_device_attr(struct tty_port *port,
479 const struct attribute_group **attr_grp); 455 const struct attribute_group **attr_grp);
480extern int tty_port_alloc_xmit_buf(struct tty_port *port); 456extern int tty_port_alloc_xmit_buf(struct tty_port *port);
481extern void tty_port_free_xmit_buf(struct tty_port *port); 457extern void tty_port_free_xmit_buf(struct tty_port *port);
458extern void tty_port_destroy(struct tty_port *port);
482extern void tty_port_put(struct tty_port *port); 459extern void tty_port_put(struct tty_port *port);
483 460
484static inline struct tty_port *tty_port_get(struct tty_port *port) 461static inline struct tty_port *tty_port_get(struct tty_port *port)
@@ -535,7 +512,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
535/* tty_audit.c */ 512/* tty_audit.c */
536#ifdef CONFIG_AUDIT 513#ifdef CONFIG_AUDIT
537extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, 514extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
538 size_t size); 515 size_t size, unsigned icanon);
539extern void tty_audit_exit(void); 516extern void tty_audit_exit(void);
540extern void tty_audit_fork(struct signal_struct *sig); 517extern void tty_audit_fork(struct signal_struct *sig);
541extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 518extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
@@ -544,7 +521,7 @@ extern int tty_audit_push_task(struct task_struct *tsk,
544 kuid_t loginuid, u32 sessionid); 521 kuid_t loginuid, u32 sessionid);
545#else 522#else
546static inline void tty_audit_add_data(struct tty_struct *tty, 523static inline void tty_audit_add_data(struct tty_struct *tty,
547 unsigned char *data, size_t size) 524 unsigned char *data, size_t size, unsigned icanon)
548{ 525{
549} 526}
550static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) 527static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 9239d033a0a3..2002344ed36a 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -11,7 +11,7 @@ void tty_schedule_flip(struct tty_struct *tty);
11static inline int tty_insert_flip_char(struct tty_struct *tty, 11static inline int tty_insert_flip_char(struct tty_struct *tty,
12 unsigned char ch, char flag) 12 unsigned char ch, char flag)
13{ 13{
14 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->port->buf.tail;
15 if (tb && tb->used < tb->size) { 15 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 16 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 17 tb->char_buf_ptr[tb->used++] = ch;
diff --git a/include/linux/types.h b/include/linux/types.h
index 1cc0e4b9a048..4d118ba11349 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -156,6 +156,7 @@ typedef u32 dma_addr_t;
156#endif 156#endif
157typedef unsigned __bitwise__ gfp_t; 157typedef unsigned __bitwise__ gfp_t;
158typedef unsigned __bitwise__ fmode_t; 158typedef unsigned __bitwise__ fmode_t;
159typedef unsigned __bitwise__ oom_flags_t;
159 160
160#ifdef CONFIG_PHYS_ADDR_T_64BIT 161#ifdef CONFIG_PHYS_ADDR_T_64BIT
161typedef u64 phys_addr_t; 162typedef u64 phys_addr_t;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 0b67d7793520..9d81de123c90 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -27,6 +27,11 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
27 return (struct udphdr *)skb_transport_header(skb); 27 return (struct udphdr *)skb_transport_header(skb);
28} 28}
29 29
30static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb)
31{
32 return (struct udphdr *)skb_inner_transport_header(skb);
33}
34
30#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) 35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
31 36
32static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) 37static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask)
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 24594571c5a3..4f628a6fc5b4 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -97,12 +97,12 @@ extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_con
97extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 97extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
98extern int uprobe_mmap(struct vm_area_struct *vma); 98extern int uprobe_mmap(struct vm_area_struct *vma);
99extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); 99extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
100extern void uprobe_start_dup_mmap(void);
101extern void uprobe_end_dup_mmap(void);
100extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 102extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
101extern void uprobe_free_utask(struct task_struct *t); 103extern void uprobe_free_utask(struct task_struct *t);
102extern void uprobe_copy_process(struct task_struct *t); 104extern void uprobe_copy_process(struct task_struct *t);
103extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
104extern void __weak arch_uprobe_enable_step(struct arch_uprobe *arch);
105extern void __weak arch_uprobe_disable_step(struct arch_uprobe *arch);
106extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 106extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
107extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 107extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
108extern void uprobe_notify_resume(struct pt_regs *regs); 108extern void uprobe_notify_resume(struct pt_regs *regs);
@@ -129,6 +129,12 @@ static inline void
129uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end) 129uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
130{ 130{
131} 131}
132static inline void uprobe_start_dup_mmap(void)
133{
134}
135static inline void uprobe_end_dup_mmap(void)
136{
137}
132static inline void 138static inline void
133uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm) 139uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
134{ 140{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 10278d18709c..689b14b26c8d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -482,6 +482,7 @@ struct usb3_lpm_parameters {
482 * @connect_time: time device was first connected 482 * @connect_time: time device was first connected
483 * @do_remote_wakeup: remote wakeup should be enabled 483 * @do_remote_wakeup: remote wakeup should be enabled
484 * @reset_resume: needs reset instead of resume 484 * @reset_resume: needs reset instead of resume
485 * @port_is_suspended: the upstream port is suspended (L2 or U3)
485 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 486 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
486 * specific data for the device. 487 * specific data for the device.
487 * @slot_id: Slot ID assigned by xHCI 488 * @slot_id: Slot ID assigned by xHCI
@@ -560,6 +561,7 @@ struct usb_device {
560 561
561 unsigned do_remote_wakeup:1; 562 unsigned do_remote_wakeup:1;
562 unsigned reset_resume:1; 563 unsigned reset_resume:1;
564 unsigned port_is_suspended:1;
563#endif 565#endif
564 struct wusb_dev *wusb_dev; 566 struct wusb_dev *wusb_dev;
565 int slot_id; 567 int slot_id;
@@ -588,8 +590,9 @@ extern struct usb_device *usb_hub_find_child(struct usb_device *hdev,
588 */ 590 */
589#define usb_hub_for_each_child(hdev, port1, child) \ 591#define usb_hub_for_each_child(hdev, port1, child) \
590 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \ 592 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \
591 port1 <= hdev->maxchild; \ 593 port1 <= hdev->maxchild; \
592 child = usb_hub_find_child(hdev, ++port1)) 594 child = usb_hub_find_child(hdev, ++port1)) \
595 if (!child) continue; else
593 596
594/* USB device locking */ 597/* USB device locking */
595#define usb_lock_device(udev) device_lock(&(udev)->dev) 598#define usb_lock_device(udev) device_lock(&(udev)->dev)
@@ -805,6 +808,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
805 .bcdDevice_hi = (hi) 808 .bcdDevice_hi = (hi)
806 809
807/** 810/**
811 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
812 * @vend: the 16 bit USB Vendor ID
813 * @prod: the 16 bit USB Product ID
814 * @cl: bInterfaceClass value
815 *
816 * This macro is used to create a struct usb_device_id that matches a
817 * specific interface class of devices.
818 */
819#define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \
820 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
821 USB_DEVICE_ID_MATCH_INT_CLASS, \
822 .idVendor = (vend), \
823 .idProduct = (prod), \
824 .bInterfaceClass = (cl)
825
826/**
808 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol 827 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
809 * @vend: the 16 bit USB Vendor ID 828 * @vend: the 16 bit USB Vendor ID
810 * @prod: the 16 bit USB Product ID 829 * @prod: the 16 bit USB Product ID
@@ -1129,8 +1148,8 @@ extern int usb_disabled(void);
1129 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). 1148 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
1130 */ 1149 */
1131#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 1150#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
1132#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 1151#define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired
1133 * ignored */ 1152 * slot in the schedule */
1134#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 1153#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
1135#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 1154#define URB_NO_FSBR 0x0020 /* UHCI-specific */
1136#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 1155#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
@@ -1309,15 +1328,20 @@ typedef void (*usb_complete_t)(struct urb *);
1309 * the transfer interval in the endpoint descriptor is logarithmic. 1328 * the transfer interval in the endpoint descriptor is logarithmic.
1310 * Device drivers must convert that value to linear units themselves.) 1329 * Device drivers must convert that value to linear units themselves.)
1311 * 1330 *
1312 * Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling 1331 * If an isochronous endpoint queue isn't already running, the host
1313 * the host controller to schedule the transfer as soon as bandwidth 1332 * controller will schedule a new URB to start as soon as bandwidth
1314 * utilization allows, and then set start_frame to reflect the actual frame 1333 * utilization allows. If the queue is running then a new URB will be
1315 * selected during submission. Otherwise drivers must specify the start_frame 1334 * scheduled to start in the first transfer slot following the end of the
1316 * and handle the case where the transfer can't begin then. However, drivers 1335 * preceding URB, if that slot has not already expired. If the slot has
1317 * won't know how bandwidth is currently allocated, and while they can 1336 * expired (which can happen when IRQ delivery is delayed for a long time),
1318 * find the current frame using usb_get_current_frame_number () they can't 1337 * the scheduling behavior depends on the URB_ISO_ASAP flag. If the flag
1319 * know the range for that frame number. (Ranges for frame counter values 1338 * is clear then the URB will be scheduled to start in the expired slot,
1320 * are HC-specific, and can go from 256 to 65536 frames from "now".) 1339 * implying that some of its packets will not be transferred; if the flag
1340 * is set then the URB will be scheduled in the first unexpired slot,
1341 * breaking the queue's synchronization. Upon URB completion, the
1342 * start_frame field will be set to the (micro)frame number in which the
1343 * transfer was scheduled. Ranges for frame counter values are HC-specific
1344 * and can go from as low as 256 to as high as 65536 frames.
1321 * 1345 *
1322 * Isochronous URBs have a different data transfer model, in part because 1346 * Isochronous URBs have a different data transfer model, in part because
1323 * the quality of service is only "best effort". Callers provide specially 1347 * the quality of service is only "best effort". Callers provide specially
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/usb/Kbuild
+++ /dev/null
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
new file mode 100644
index 000000000000..3b8f9d4fc3fe
--- /dev/null
+++ b/include/linux/usb/cdc_ncm.h
@@ -0,0 +1,134 @@
1/*
2 * Copyright (C) ST-Ericsson 2010-2012
3 * Contact: Alexey Orishko <alexey.orishko@stericsson.com>
4 * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com>
5 *
6 * USB Host Driver for Network Control Model (NCM)
7 * http://www.usb.org/developers/devclass_docs/NCM10.zip
8 *
9 * The NCM encoding, decoding and initialization logic
10 * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h
11 *
12 * This software is available to you under a choice of one of two
13 * licenses. You may choose this file to be licensed under the terms
14 * of the GNU General Public License (GPL) Version 2 or the 2-clause
15 * BSD license listed below:
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 */
38
39#define CDC_NCM_COMM_ALTSETTING_NCM 0
40#define CDC_NCM_COMM_ALTSETTING_MBIM 1
41
42#define CDC_NCM_DATA_ALTSETTING_NCM 1
43#define CDC_NCM_DATA_ALTSETTING_MBIM 2
44
45/* CDC NCM subclass 3.2.1 */
46#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
47
48/* Maximum NTB length */
49#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
50#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */
51
52/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
53#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */
54
55/* Minimum value for MaxDatagramSize, ch. 8.1.3 */
56#define CDC_MBIM_MIN_DATAGRAM_SIZE 2048 /* bytes */
57
58#define CDC_NCM_MIN_TX_PKT 512 /* bytes */
59
60/* Default value for MaxDatagramSize */
61#define CDC_NCM_MAX_DATAGRAM_SIZE 8192 /* bytes */
62
63/*
64 * Maximum amount of datagrams in NCM Datagram Pointer Table, not counting
65 * the last NULL entry.
66 */
67#define CDC_NCM_DPT_DATAGRAMS_MAX 40
68
69/* Restart the timer, if amount of datagrams is less than given value */
70#define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3
71#define CDC_NCM_TIMER_PENDING_CNT 2
72#define CDC_NCM_TIMER_INTERVAL (400UL * NSEC_PER_USEC)
73
74/* The following macro defines the minimum header space */
75#define CDC_NCM_MIN_HDR_SIZE \
76 (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \
77 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
78
79#define CDC_NCM_NDP_SIZE \
80 (sizeof(struct usb_cdc_ncm_ndp16) + \
81 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
82
83#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
84 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
85#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB)
86
87struct cdc_ncm_ctx {
88 struct usb_cdc_ncm_ntb_parameters ncm_parm;
89 struct hrtimer tx_timer;
90 struct tasklet_struct bh;
91
92 const struct usb_cdc_ncm_desc *func_desc;
93 const struct usb_cdc_mbim_desc *mbim_desc;
94 const struct usb_cdc_header_desc *header_desc;
95 const struct usb_cdc_union_desc *union_desc;
96 const struct usb_cdc_ether_desc *ether_desc;
97
98 struct net_device *netdev;
99 struct usb_device *udev;
100 struct usb_host_endpoint *in_ep;
101 struct usb_host_endpoint *out_ep;
102 struct usb_host_endpoint *status_ep;
103 struct usb_interface *intf;
104 struct usb_interface *control;
105 struct usb_interface *data;
106
107 struct sk_buff *tx_curr_skb;
108 struct sk_buff *tx_rem_skb;
109 __le32 tx_rem_sign;
110
111 spinlock_t mtx;
112 atomic_t stop;
113
114 u32 tx_timer_pending;
115 u32 tx_curr_frame_num;
116 u32 rx_speed;
117 u32 tx_speed;
118 u32 rx_max;
119 u32 tx_max;
120 u32 max_datagram_size;
121 u16 tx_max_datagrams;
122 u16 tx_remainder;
123 u16 tx_modulus;
124 u16 tx_ndp_modulus;
125 u16 tx_seq;
126 u16 rx_seq;
127 u16 connected;
128};
129
130extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
131extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
132extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign);
133extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
134extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index f8dda0621800..b09c37e04a91 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -38,6 +38,7 @@
38#include <linux/version.h> 38#include <linux/version.h>
39#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
40#include <linux/usb/gadget.h> 40#include <linux/usb/gadget.h>
41#include <linux/log2.h>
41 42
42/* 43/*
43 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they 44 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
@@ -51,6 +52,7 @@
51/* big enough to hold our biggest descriptor */ 52/* big enough to hold our biggest descriptor */
52#define USB_COMP_EP0_BUFSIZ 1024 53#define USB_COMP_EP0_BUFSIZ 1024
53 54
55#define USB_MS_TO_HS_INTERVAL(x) (ilog2((x * 1000 / 125)) + 1)
54struct usb_configuration; 56struct usb_configuration;
55 57
56/** 58/**
@@ -117,7 +119,7 @@ struct usb_configuration;
117struct usb_function { 119struct usb_function {
118 const char *name; 120 const char *name;
119 struct usb_gadget_strings **strings; 121 struct usb_gadget_strings **strings;
120 struct usb_descriptor_header **descriptors; 122 struct usb_descriptor_header **fs_descriptors;
121 struct usb_descriptor_header **hs_descriptors; 123 struct usb_descriptor_header **hs_descriptors;
122 struct usb_descriptor_header **ss_descriptors; 124 struct usb_descriptor_header **ss_descriptors;
123 125
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index c9d09f8b7ff2..99238b096f7e 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -29,6 +29,8 @@
29 * initialization. 29 * initialization.
30 * @port_power_off: set to 1 if the controller needs to be powered down 30 * @port_power_off: set to 1 if the controller needs to be powered down
31 * after initialization. 31 * after initialization.
32 * @no_io_watchdog: set to 1 if the controller does not need the I/O
33 * watchdog to run.
32 * 34 *
33 * These are general configuration options for the EHCI controller. All of 35 * These are general configuration options for the EHCI controller. All of
34 * these options are activating more or less workarounds for some hardware. 36 * these options are activating more or less workarounds for some hardware.
@@ -39,8 +41,7 @@ struct usb_ehci_pdata {
39 unsigned has_synopsys_hc_bug:1; 41 unsigned has_synopsys_hc_bug:1;
40 unsigned big_endian_desc:1; 42 unsigned big_endian_desc:1;
41 unsigned big_endian_mmio:1; 43 unsigned big_endian_mmio:1;
42 unsigned port_power_on:1; 44 unsigned no_io_watchdog:1;
43 unsigned port_power_off:1;
44 45
45 /* Turn on all power and clocks */ 46 /* Turn on all power and clocks */
46 int (*power_on)(struct platform_device *pdev); 47 int (*power_on)(struct platform_device *pdev);
diff --git a/include/linux/usb/ezusb.h b/include/linux/usb/ezusb.h
index fc618d8d1e92..639ee45779fb 100644
--- a/include/linux/usb/ezusb.h
+++ b/include/linux/usb/ezusb.h
@@ -1,16 +1,8 @@
1#ifndef __EZUSB_H 1#ifndef __EZUSB_H
2#define __EZUSB_H 2#define __EZUSB_H
3 3
4
5extern int ezusb_writememory(struct usb_device *dev, int address,
6 unsigned char *data, int length, __u8 bRequest);
7
8extern int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit); 4extern int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit);
9extern int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit);
10
11extern int ezusb_fx1_ihex_firmware_download(struct usb_device *dev, 5extern int ezusb_fx1_ihex_firmware_download(struct usb_device *dev,
12 const char *firmware_path); 6 const char *firmware_path);
13extern int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
14 const char *firmware_path);
15 7
16#endif /* __EZUSB_H */ 8#endif /* __EZUSB_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 5b6e50888248..0af6569b8cc6 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -939,6 +939,13 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
939 kfree(v); 939 kfree(v);
940} 940}
941 941
942struct usb_function;
943int usb_assign_descriptors(struct usb_function *f,
944 struct usb_descriptor_header **fs,
945 struct usb_descriptor_header **hs,
946 struct usb_descriptor_header **ss);
947void usb_free_all_descriptors(struct usb_function *f);
948
942/*-------------------------------------------------------------------------*/ 949/*-------------------------------------------------------------------------*/
943 950
944/* utility to simplify map/unmap of usb_requests to/from DMA */ 951/* utility to simplify map/unmap of usb_requests to/from DMA */
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
index 74e7755168b7..012f2b7eb2b6 100644
--- a/include/linux/usb/ohci_pdriver.h
+++ b/include/linux/usb/ohci_pdriver.h
@@ -25,6 +25,7 @@
25 * @big_endian_desc: BE descriptors 25 * @big_endian_desc: BE descriptors
26 * @big_endian_mmio: BE registers 26 * @big_endian_mmio: BE registers
27 * @no_big_frame_no: no big endian frame_no shift 27 * @no_big_frame_no: no big endian frame_no shift
28 * @num_ports: number of ports
28 * 29 *
29 * These are general configuration options for the OHCI controller. All of 30 * These are general configuration options for the OHCI controller. All of
30 * these options are activating more or less workarounds for some hardware. 31 * these options are activating more or less workarounds for some hardware.
@@ -33,6 +34,7 @@ struct usb_ohci_pdata {
33 unsigned big_endian_desc:1; 34 unsigned big_endian_desc:1;
34 unsigned big_endian_mmio:1; 35 unsigned big_endian_mmio:1;
35 unsigned no_big_frame_no:1; 36 unsigned no_big_frame_no:1;
37 unsigned int num_ports;
36 38
37 /* Turn on all power and clocks */ 39 /* Turn on all power and clocks */
38 int (*power_on)(struct platform_device *pdev); 40 int (*power_on)(struct platform_device *pdev);
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 06b5bae35b29..a29ae1eb9346 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -10,6 +10,7 @@
10#define __LINUX_USB_PHY_H 10#define __LINUX_USB_PHY_H
11 11
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/usb.h>
13 14
14enum usb_phy_events { 15enum usb_phy_events {
15 USB_EVENT_NONE, /* no events or cable disconnected */ 16 USB_EVENT_NONE, /* no events or cable disconnected */
@@ -99,8 +100,10 @@ struct usb_phy {
99 int suspend); 100 int suspend);
100 101
101 /* notify phy connect status change */ 102 /* notify phy connect status change */
102 int (*notify_connect)(struct usb_phy *x, int port); 103 int (*notify_connect)(struct usb_phy *x,
103 int (*notify_disconnect)(struct usb_phy *x, int port); 104 enum usb_device_speed speed);
105 int (*notify_disconnect)(struct usb_phy *x,
106 enum usb_device_speed speed);
104}; 107};
105 108
106 109
@@ -189,19 +192,19 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
189} 192}
190 193
191static inline int 194static inline int
192usb_phy_notify_connect(struct usb_phy *x, int port) 195usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
193{ 196{
194 if (x->notify_connect) 197 if (x->notify_connect)
195 return x->notify_connect(x, port); 198 return x->notify_connect(x, speed);
196 else 199 else
197 return 0; 200 return 0;
198} 201}
199 202
200static inline int 203static inline int
201usb_phy_notify_disconnect(struct usb_phy *x, int port) 204usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
202{ 205{
203 if (x->notify_disconnect) 206 if (x->notify_disconnect)
204 return x->notify_disconnect(x, port); 207 return x->notify_disconnect(x, speed);
205 else 208 else
206 return 0; 209 return 0;
207} 210}
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index ddbbb7de894b..bd45eb7bedc8 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -69,6 +69,7 @@ struct usbnet {
69# define EVENT_DEV_ASLEEP 6 69# define EVENT_DEV_ASLEEP 6
70# define EVENT_DEV_OPEN 7 70# define EVENT_DEV_OPEN 7
71# define EVENT_DEVICE_REPORT_IDLE 8 71# define EVENT_DEVICE_REPORT_IDLE 8
72# define EVENT_NO_RUNTIME_PM 9
72}; 73};
73 74
74static inline struct usb_driver *driver_of(struct usb_interface *intf) 75static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -163,6 +164,16 @@ extern int usbnet_resume(struct usb_interface *);
163extern void usbnet_disconnect(struct usb_interface *); 164extern void usbnet_disconnect(struct usb_interface *);
164extern void usbnet_device_suggests_idle(struct usbnet *dev); 165extern void usbnet_device_suggests_idle(struct usbnet *dev);
165 166
167extern int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
168 u16 value, u16 index, void *data, u16 size);
169extern int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
170 u16 value, u16 index, const void *data, u16 size);
171extern int usbnet_read_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
172 u16 value, u16 index, void *data, u16 size);
173extern int usbnet_write_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
174 u16 value, u16 index, const void *data, u16 size);
175extern int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
176 u16 value, u16 index, const void *data, u16 size);
166 177
167/* Drivers that reuse some of the standard USB CDC infrastructure 178/* Drivers that reuse some of the standard USB CDC infrastructure
168 * (notably, using multiple interfaces according to the CDC 179 * (notably, using multiple interfaces according to the CDC
@@ -230,4 +241,6 @@ extern void usbnet_set_msglevel(struct net_device *, u32);
230extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); 241extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
231extern int usbnet_nway_reset(struct net_device *net); 242extern int usbnet_nway_reset(struct net_device *net);
232 243
244extern int usbnet_manage_power(struct usbnet *, int);
245
233#endif /* __LINUX_USB_USBNET_H */ 246#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 95142cae446a..b9bd2e6c73cc 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -25,6 +25,7 @@ struct user_namespace {
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 kuid_t owner; 26 kuid_t owner;
27 kgid_t group; 27 kgid_t group;
28 unsigned int proc_inum;
28}; 29};
29 30
30extern struct user_namespace init_user_ns; 31extern struct user_namespace init_user_ns;
@@ -39,6 +40,7 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
39} 40}
40 41
41extern int create_user_ns(struct cred *new); 42extern int create_user_ns(struct cred *new);
43extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred);
42extern void free_user_ns(struct kref *kref); 44extern void free_user_ns(struct kref *kref);
43 45
44static inline void put_user_ns(struct user_namespace *ns) 46static inline void put_user_ns(struct user_namespace *ns)
@@ -66,6 +68,14 @@ static inline int create_user_ns(struct cred *new)
66 return -EINVAL; 68 return -EINVAL;
67} 69}
68 70
71static inline int unshare_userns(unsigned long unshare_flags,
72 struct cred **new_cred)
73{
74 if (unshare_flags & CLONE_NEWUSER)
75 return -EINVAL;
76 return 0;
77}
78
69static inline void put_user_ns(struct user_namespace *ns) 79static inline void put_user_ns(struct user_namespace *ns)
70{ 80{
71} 81}
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 2b345206722a..239e27733d6c 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -23,6 +23,7 @@ struct uts_namespace {
23 struct kref kref; 23 struct kref kref;
24 struct new_utsname name; 24 struct new_utsname name;
25 struct user_namespace *user_ns; 25 struct user_namespace *user_ns;
26 unsigned int proc_inum;
26}; 27};
27extern struct uts_namespace init_uts_ns; 28extern struct uts_namespace init_uts_ns;
28 29
@@ -33,7 +34,7 @@ static inline void get_uts_ns(struct uts_namespace *ns)
33} 34}
34 35
35extern struct uts_namespace *copy_utsname(unsigned long flags, 36extern struct uts_namespace *copy_utsname(unsigned long flags,
36 struct task_struct *tsk); 37 struct user_namespace *user_ns, struct uts_namespace *old_ns);
37extern void free_uts_ns(struct kref *kref); 38extern void free_uts_ns(struct kref *kref);
38 39
39static inline void put_uts_ns(struct uts_namespace *ns) 40static inline void put_uts_ns(struct uts_namespace *ns)
@@ -50,12 +51,12 @@ static inline void put_uts_ns(struct uts_namespace *ns)
50} 51}
51 52
52static inline struct uts_namespace *copy_utsname(unsigned long flags, 53static inline struct uts_namespace *copy_utsname(unsigned long flags,
53 struct task_struct *tsk) 54 struct user_namespace *user_ns, struct uts_namespace *old_ns)
54{ 55{
55 if (flags & CLONE_NEWUTS) 56 if (flags & CLONE_NEWUTS)
56 return ERR_PTR(-EINVAL); 57 return ERR_PTR(-EINVAL);
57 58
58 return tsk->nsproxy->uts_ns; 59 return old_ns;
59} 60}
60#endif 61#endif
61 62
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
new file mode 100644
index 000000000000..c52215ff4245
--- /dev/null
+++ b/include/linux/vexpress.h
@@ -0,0 +1,121 @@
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,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#ifndef _LINUX_VEXPRESS_H
15#define _LINUX_VEXPRESS_H
16
17#include <linux/device.h>
18
19#define VEXPRESS_SITE_MB 0
20#define VEXPRESS_SITE_DB1 1
21#define VEXPRESS_SITE_DB2 2
22#define VEXPRESS_SITE_MASTER 0xf
23
24#define VEXPRESS_CONFIG_STATUS_DONE 0
25#define VEXPRESS_CONFIG_STATUS_WAIT 1
26
27#define VEXPRESS_GPIO_MMC_CARDIN 0
28#define VEXPRESS_GPIO_MMC_WPROT 1
29#define VEXPRESS_GPIO_FLASH_WPn 2
30
31#define VEXPRESS_RES_FUNC(_site, _func) \
32{ \
33 .start = (_site), \
34 .end = (_func), \
35 .flags = IORESOURCE_BUS, \
36}
37
38/* Config bridge API */
39
40/**
41 * struct vexpress_config_bridge_info - description of the platform
42 * configuration infrastructure bridge.
43 *
44 * @name: Bridge name
45 *
46 * @func_get: Obtains pointer to a configuration function for a given
47 * device or a Device Tree node, to be used with @func_put
48 * and @func_exec. The node pointer should take precedence
49 * over device pointer when both are passed.
50 *
51 * @func_put: Tells the bridge that the function will not be used any
52 * more, so all allocated resources can be released.
53 *
54 * @func_exec: Executes a configuration function read or write operation.
55 * The offset selects a 32 bit word of the value accessed.
56 * Must return VEXPRESS_CONFIG_STATUS_DONE when operation
57 * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
58 * will be completed in some time or negative value in case
59 * of error.
60 */
61struct vexpress_config_bridge_info {
62 const char *name;
63 void *(*func_get)(struct device *dev, struct device_node *node);
64 void (*func_put)(void *func);
65 int (*func_exec)(void *func, int offset, bool write, u32 *data);
66};
67
68struct vexpress_config_bridge;
69
70struct vexpress_config_bridge *vexpress_config_bridge_register(
71 struct device_node *node,
72 struct vexpress_config_bridge_info *info);
73void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
74
75void vexpress_config_complete(struct vexpress_config_bridge *bridge,
76 int status);
77
78/* Config function API */
79
80struct vexpress_config_func;
81
82struct vexpress_config_func *__vexpress_config_func_get(struct device *dev,
83 struct device_node *node);
84#define vexpress_config_func_get_by_dev(dev) \
85 __vexpress_config_func_get(dev, NULL)
86#define vexpress_config_func_get_by_node(node) \
87 __vexpress_config_func_get(NULL, node)
88void vexpress_config_func_put(struct vexpress_config_func *func);
89
90/* Both may sleep! */
91int vexpress_config_read(struct vexpress_config_func *func, int offset,
92 u32 *data);
93int vexpress_config_write(struct vexpress_config_func *func, int offset,
94 u32 data);
95
96/* Platform control */
97
98u32 vexpress_get_procid(int site);
99u32 vexpress_get_hbi(int site);
100void *vexpress_get_24mhz_clock_base(void);
101void vexpress_flags_set(u32 data);
102
103#define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node)
104#define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL)
105unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
106
107void vexpress_sysreg_early_init(void __iomem *base);
108void vexpress_sysreg_of_early_init(void);
109
110void vexpress_power_off(void);
111void vexpress_restart(char str, const char *cmd);
112
113/* Clocks */
114
115struct clk *vexpress_osc_setup(struct device *dev);
116void vexpress_osc_of_setup(struct device_node *node);
117
118void vexpress_clk_init(void __iomem *sp810_base);
119void vexpress_clk_of_init(void);
120
121#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 0ee42d9acdc0..2c02f3a8d2ba 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -78,7 +78,7 @@ extern void vga_set_legacy_decoding(struct pci_dev *pdev,
78 * This function acquires VGA resources for the given 78 * This function acquires VGA resources for the given
79 * card and mark those resources locked. If the resource requested 79 * card and mark those resources locked. If the resource requested
80 * are "normal" (and not legacy) resources, the arbiter will first check 80 * are "normal" (and not legacy) resources, the arbiter will first check
81 * wether the card is doing legacy decoding for that type of resource. If 81 * whether the card is doing legacy decoding for that type of resource. If
82 * yes, the lock is "converted" into a legacy resource lock. 82 * yes, the lock is "converted" into a legacy resource lock.
83 * The arbiter will first look for all VGA cards that might conflict 83 * The arbiter will first look for all VGA cards that might conflict
84 * and disable their IOs and/or Memory access, including VGA forwarding 84 * and disable their IOs and/or Memory access, including VGA forwarding
@@ -89,7 +89,7 @@ extern void vga_set_legacy_decoding(struct pci_dev *pdev,
89 * This function will block if some conflicting card is already locking 89 * This function will block if some conflicting card is already locking
90 * one of the required resources (or any resource on a different bus 90 * one of the required resources (or any resource on a different bus
91 * segment, since P2P bridges don't differenciate VGA memory and IO 91 * segment, since P2P bridges don't differenciate VGA memory and IO
92 * afaik). You can indicate wether this blocking should be interruptible 92 * afaik). You can indicate whether this blocking should be interruptible
93 * by a signal (for userland interface) or not. 93 * by a signal (for userland interface) or not.
94 * Must not be called at interrupt time or in atomic context. 94 * Must not be called at interrupt time or in atomic context.
95 * If the card already owns the resources, the function succeeds. 95 * If the card already owns the resources, the function succeeds.
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 533b1157f22e..cf8adb1f5b2c 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -16,12 +16,20 @@
16 * @name: the name of this virtqueue (mainly for debugging) 16 * @name: the name of this virtqueue (mainly for debugging)
17 * @vdev: the virtio device this queue was created for. 17 * @vdev: the virtio device this queue was created for.
18 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
19 * @index: the zero-based ordinal number for this queue.
20 * @num_free: number of elements we expect to be able to fit.
21 *
22 * A note on @num_free: with indirect buffers, each buffer needs one
23 * element in the queue, otherwise a buffer will need one element per
24 * sg element.
19 */ 25 */
20struct virtqueue { 26struct virtqueue {
21 struct list_head list; 27 struct list_head list;
22 void (*callback)(struct virtqueue *vq); 28 void (*callback)(struct virtqueue *vq);
23 const char *name; 29 const char *name;
24 struct virtio_device *vdev; 30 struct virtio_device *vdev;
31 unsigned int index;
32 unsigned int num_free;
25 void *priv; 33 void *priv;
26}; 34};
27 35
@@ -50,7 +58,11 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
50 58
51unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 59unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
52 60
53int virtqueue_get_queue_index(struct virtqueue *vq); 61/* FIXME: Obsolete accessor, but required for virtio_net merge. */
62static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq)
63{
64 return vq->index;
65}
54 66
55/** 67/**
56 * virtio_device - representation of a device using virtio 68 * virtio_device - representation of a device using virtio
@@ -73,7 +85,11 @@ struct virtio_device {
73 void *priv; 85 void *priv;
74}; 86};
75 87
76#define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev) 88static inline struct virtio_device *dev_to_virtio(struct device *_dev)
89{
90 return container_of(_dev, struct virtio_device, dev);
91}
92
77int register_virtio_device(struct virtio_device *dev); 93int register_virtio_device(struct virtio_device *dev);
78void unregister_virtio_device(struct virtio_device *dev); 94void unregister_virtio_device(struct virtio_device *dev);
79 95
@@ -103,6 +119,11 @@ struct virtio_driver {
103#endif 119#endif
104}; 120};
105 121
122static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
123{
124 return container_of(drv, struct virtio_driver, driver);
125}
126
106int register_virtio_driver(struct virtio_driver *drv); 127int register_virtio_driver(struct virtio_driver *drv);
107void unregister_virtio_driver(struct virtio_driver *drv); 128void unregister_virtio_driver(struct virtio_driver *drv);
108#endif /* _LINUX_VIRTIO_H */ 129#endif /* _LINUX_VIRTIO_H */
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
index d6b4440387b7..4195b97a3def 100644
--- a/include/linux/virtio_scsi.h
+++ b/include/linux/virtio_scsi.h
@@ -1,7 +1,31 @@
1/*
2 * This header is BSD licensed so anyone can use the definitions to implement
3 * compatible drivers/servers.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
1#ifndef _LINUX_VIRTIO_SCSI_H 27#ifndef _LINUX_VIRTIO_SCSI_H
2#define _LINUX_VIRTIO_SCSI_H 28#define _LINUX_VIRTIO_SCSI_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
5 29
6#define VIRTIO_SCSI_CDB_SIZE 32 30#define VIRTIO_SCSI_CDB_SIZE 32
7#define VIRTIO_SCSI_SENSE_SIZE 96 31#define VIRTIO_SCSI_SENSE_SIZE 96
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 3d3114594370..fce0a2799d43 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -38,8 +38,18 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
39 KSWAPD_SKIP_CONGESTION_WAIT, 39 KSWAPD_SKIP_CONGESTION_WAIT,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 40 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_NUMA_BALANCING
42 NUMA_PTE_UPDATES,
43 NUMA_HINT_FAULTS,
44 NUMA_HINT_FAULTS_LOCAL,
45 NUMA_PAGE_MIGRATE,
46#endif
47#ifdef CONFIG_MIGRATION
48 PGMIGRATE_SUCCESS, PGMIGRATE_FAIL,
49#endif
41#ifdef CONFIG_COMPACTION 50#ifdef CONFIG_COMPACTION
42 COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED, 51 COMPACTMIGRATE_SCANNED, COMPACTFREE_SCANNED,
52 COMPACTISOLATED,
43 COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS, 53 COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
44#endif 54#endif
45#ifdef CONFIG_HUGETLB_PAGE 55#ifdef CONFIG_HUGETLB_PAGE
@@ -58,6 +68,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
58 THP_COLLAPSE_ALLOC, 68 THP_COLLAPSE_ALLOC,
59 THP_COLLAPSE_ALLOC_FAILED, 69 THP_COLLAPSE_ALLOC_FAILED,
60 THP_SPLIT, 70 THP_SPLIT,
71 THP_ZERO_PAGE_ALLOC,
72 THP_ZERO_PAGE_ALLOC_FAILED,
61#endif 73#endif
62 NR_VM_EVENT_ITEMS 74 NR_VM_EVENT_ITEMS
63}; 75};
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 92a86b2cce33..a13291f7da88 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -80,6 +80,14 @@ static inline void vm_events_fold_cpu(int cpu)
80 80
81#endif /* CONFIG_VM_EVENT_COUNTERS */ 81#endif /* CONFIG_VM_EVENT_COUNTERS */
82 82
83#ifdef CONFIG_NUMA_BALANCING
84#define count_vm_numa_event(x) count_vm_event(x)
85#define count_vm_numa_events(x, y) count_vm_events(x, y)
86#else
87#define count_vm_numa_event(x) do {} while (0)
88#define count_vm_numa_events(x, y) do {} while (0)
89#endif /* CONFIG_NUMA_BALANCING */
90
83#define __count_zone_vm_events(item, zone, delta) \ 91#define __count_zone_vm_events(item, zone, delta) \
84 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \ 92 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \
85 zone_idx(zone), delta) 93 zone_idx(zone), delta)
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
new file mode 100644
index 000000000000..ae30ab58431a
--- /dev/null
+++ b/include/linux/vtime.h
@@ -0,0 +1,48 @@
1#ifndef _LINUX_KERNEL_VTIME_H
2#define _LINUX_KERNEL_VTIME_H
3
4struct task_struct;
5
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7extern void vtime_task_switch(struct task_struct *prev);
8extern void vtime_account_system(struct task_struct *tsk);
9extern void vtime_account_system_irqsafe(struct task_struct *tsk);
10extern void vtime_account_idle(struct task_struct *tsk);
11extern void vtime_account_user(struct task_struct *tsk);
12extern void vtime_account(struct task_struct *tsk);
13#else
14static inline void vtime_task_switch(struct task_struct *prev) { }
15static inline void vtime_account_system(struct task_struct *tsk) { }
16static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { }
17static inline void vtime_account(struct task_struct *tsk) { }
18#endif
19
20#ifdef CONFIG_IRQ_TIME_ACCOUNTING
21extern void irqtime_account_irq(struct task_struct *tsk);
22#else
23static inline void irqtime_account_irq(struct task_struct *tsk) { }
24#endif
25
26static inline void vtime_account_irq_enter(struct task_struct *tsk)
27{
28 /*
29 * Hardirq can interrupt idle task anytime. So we need vtime_account()
30 * that performs the idle check in CONFIG_VIRT_CPU_ACCOUNTING.
31 * Softirq can also interrupt idle task directly if it calls
32 * local_bh_enable(). Such case probably don't exist but we never know.
33 * Ksoftirqd is not concerned because idle time is flushed on context
34 * switch. Softirqs in the end of hardirqs are also not a problem because
35 * the idle time is flushed on hardirq time already.
36 */
37 vtime_account(tsk);
38 irqtime_account_irq(tsk);
39}
40
41static inline void vtime_account_irq_exit(struct task_struct *tsk)
42{
43 /* On hard|softirq exit we always account to hard|softirq cputime */
44 vtime_account_system(tsk);
45 irqtime_account_irq(tsk);
46}
47
48#endif /* _LINUX_KERNEL_VTIME_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 168dfe122dd3..7cb64d4b499d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -550,6 +550,170 @@ do { \
550 __ret; \ 550 __ret; \
551}) 551})
552 552
553
554#define __wait_event_lock_irq(wq, condition, lock, cmd) \
555do { \
556 DEFINE_WAIT(__wait); \
557 \
558 for (;;) { \
559 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
560 if (condition) \
561 break; \
562 spin_unlock_irq(&lock); \
563 cmd; \
564 schedule(); \
565 spin_lock_irq(&lock); \
566 } \
567 finish_wait(&wq, &__wait); \
568} while (0)
569
570/**
571 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
572 * condition is checked under the lock. This
573 * is expected to be called with the lock
574 * taken.
575 * @wq: the waitqueue to wait on
576 * @condition: a C expression for the event to wait for
577 * @lock: a locked spinlock_t, which will be released before cmd
578 * and schedule() and reacquired afterwards.
579 * @cmd: a command which is invoked outside the critical section before
580 * sleep
581 *
582 * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
583 * @condition evaluates to true. The @condition is checked each time
584 * the waitqueue @wq is woken up.
585 *
586 * wake_up() has to be called after changing any variable that could
587 * change the result of the wait condition.
588 *
589 * This is supposed to be called while holding the lock. The lock is
590 * dropped before invoking the cmd and going to sleep and is reacquired
591 * afterwards.
592 */
593#define wait_event_lock_irq_cmd(wq, condition, lock, cmd) \
594do { \
595 if (condition) \
596 break; \
597 __wait_event_lock_irq(wq, condition, lock, cmd); \
598} while (0)
599
600/**
601 * wait_event_lock_irq - sleep until a condition gets true. The
602 * condition is checked under the lock. This
603 * is expected to be called with the lock
604 * taken.
605 * @wq: the waitqueue to wait on
606 * @condition: a C expression for the event to wait for
607 * @lock: a locked spinlock_t, which will be released before schedule()
608 * and reacquired afterwards.
609 *
610 * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
611 * @condition evaluates to true. The @condition is checked each time
612 * the waitqueue @wq is woken up.
613 *
614 * wake_up() has to be called after changing any variable that could
615 * change the result of the wait condition.
616 *
617 * This is supposed to be called while holding the lock. The lock is
618 * dropped before going to sleep and is reacquired afterwards.
619 */
620#define wait_event_lock_irq(wq, condition, lock) \
621do { \
622 if (condition) \
623 break; \
624 __wait_event_lock_irq(wq, condition, lock, ); \
625} while (0)
626
627
628#define __wait_event_interruptible_lock_irq(wq, condition, \
629 lock, ret, cmd) \
630do { \
631 DEFINE_WAIT(__wait); \
632 \
633 for (;;) { \
634 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
635 if (condition) \
636 break; \
637 if (signal_pending(current)) { \
638 ret = -ERESTARTSYS; \
639 break; \
640 } \
641 spin_unlock_irq(&lock); \
642 cmd; \
643 schedule(); \
644 spin_lock_irq(&lock); \
645 } \
646 finish_wait(&wq, &__wait); \
647} while (0)
648
649/**
650 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
651 * The condition is checked under the lock. This is expected to
652 * be called with the lock taken.
653 * @wq: the waitqueue to wait on
654 * @condition: a C expression for the event to wait for
655 * @lock: a locked spinlock_t, which will be released before cmd and
656 * schedule() and reacquired afterwards.
657 * @cmd: a command which is invoked outside the critical section before
658 * sleep
659 *
660 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
661 * @condition evaluates to true or a signal is received. The @condition is
662 * checked each time the waitqueue @wq is woken up.
663 *
664 * wake_up() has to be called after changing any variable that could
665 * change the result of the wait condition.
666 *
667 * This is supposed to be called while holding the lock. The lock is
668 * dropped before invoking the cmd and going to sleep and is reacquired
669 * afterwards.
670 *
671 * The macro will return -ERESTARTSYS if it was interrupted by a signal
672 * and 0 if @condition evaluated to true.
673 */
674#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \
675({ \
676 int __ret = 0; \
677 \
678 if (!(condition)) \
679 __wait_event_interruptible_lock_irq(wq, condition, \
680 lock, __ret, cmd); \
681 __ret; \
682})
683
684/**
685 * wait_event_interruptible_lock_irq - sleep until a condition gets true.
686 * The condition is checked under the lock. This is expected
687 * to be called with the lock taken.
688 * @wq: the waitqueue to wait on
689 * @condition: a C expression for the event to wait for
690 * @lock: a locked spinlock_t, which will be released before schedule()
691 * and reacquired afterwards.
692 *
693 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
694 * @condition evaluates to true or signal is received. The @condition is
695 * checked each time the waitqueue @wq is woken up.
696 *
697 * wake_up() has to be called after changing any variable that could
698 * change the result of the wait condition.
699 *
700 * This is supposed to be called while holding the lock. The lock is
701 * dropped before going to sleep and is reacquired afterwards.
702 *
703 * The macro will return -ERESTARTSYS if it was interrupted by a signal
704 * and 0 if @condition evaluated to true.
705 */
706#define wait_event_interruptible_lock_irq(wq, condition, lock) \
707({ \
708 int __ret = 0; \
709 \
710 if (!(condition)) \
711 __wait_event_interruptible_lock_irq(wq, condition, \
712 lock, __ret, ); \
713 __ret; \
714})
715
716
553/* 717/*
554 * These are the old interfaces to sleep waiting for an event. 718 * These are the old interfaces to sleep waiting for an event.
555 * They are racy. DO NOT use them, use the wait_event* interfaces above. 719 * They are racy. DO NOT use them, use the wait_event* interfaces above.
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index b7f45d48b2de..3a9df2f43be6 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -105,7 +105,7 @@ struct watchdog_device {
105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0 105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
106#endif 106#endif
107 107
108/* Use the following function to check wether or not the watchdog is active */ 108/* Use the following function to check whether or not the watchdog is active */
109static inline bool watchdog_active(struct watchdog_device *wdd) 109static inline bool watchdog_active(struct watchdog_device *wdd)
110{ 110{
111 return test_bit(WDOG_ACTIVE, &wdd->status); 111 return test_bit(WDOG_ACTIVE, &wdd->status);
@@ -129,7 +129,7 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
129 return wdd->driver_data; 129 return wdd->driver_data;
130} 130}
131 131
132/* drivers/watchdog/core/watchdog_core.c */ 132/* drivers/watchdog/watchdog_core.c */
133extern int watchdog_register_device(struct watchdog_device *); 133extern int watchdog_register_device(struct watchdog_device *);
134extern void watchdog_unregister_device(struct watchdog_device *); 134extern void watchdog_unregister_device(struct watchdog_device *);
135 135
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 50c3e8fa06a8..b82a83aba311 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -161,14 +161,7 @@ void __bdi_update_bandwidth(struct backing_dev_info *bdi,
161 unsigned long start_time); 161 unsigned long start_time);
162 162
163void page_writeback_init(void); 163void page_writeback_init(void);
164void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 164void balance_dirty_pages_ratelimited(struct address_space *mapping);
165 unsigned long nr_pages_dirtied);
166
167static inline void
168balance_dirty_pages_ratelimited(struct address_space *mapping)
169{
170 balance_dirty_pages_ratelimited_nr(mapping, 1);
171}
172 165
173typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, 166typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc,
174 void *data); 167 void *data);
diff --git a/include/media/adp1653.h b/include/media/adp1653.h
index 50a1af88aed0..1d9b48a3bd80 100644
--- a/include/media/adp1653.h
+++ b/include/media/adp1653.h
@@ -3,10 +3,10 @@
3 * 3 *
4 * Copyright (C) 2008--2011 Nokia Corporation 4 * Copyright (C) 2008--2011 Nokia Corporation
5 * 5 *
6 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 6 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 9 * Sakari Ailus <sakari.ailus@iki.fi>
10 * Tuukka Toivonen <tuukkat76@gmail.com> 10 * Tuukka Toivonen <tuukkat76@gmail.com>
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index 171b957db743..dc004bc926c9 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -40,14 +40,6 @@ enum adv7604_op_ch_sel {
40 ADV7604_OP_CH_SEL_RBG = 5, 40 ADV7604_OP_CH_SEL_RBG = 5,
41}; 41};
42 42
43/* Primary mode (IO register 0x01, [3:0]) */
44enum adv7604_prim_mode {
45 ADV7604_PRIM_MODE_COMP = 1,
46 ADV7604_PRIM_MODE_RGB = 2,
47 ADV7604_PRIM_MODE_HDMI_COMP = 5,
48 ADV7604_PRIM_MODE_HDMI_GR = 6,
49};
50
51/* Input Color Space (IO register 0x02, [7:4]) */ 43/* Input Color Space (IO register 0x02, [7:4]) */
52enum adv7604_inp_color_space { 44enum adv7604_inp_color_space {
53 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0, 45 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0,
@@ -103,9 +95,6 @@ struct adv7604_platform_data {
103 /* Bus rotation and reordering */ 95 /* Bus rotation and reordering */
104 enum adv7604_op_ch_sel op_ch_sel; 96 enum adv7604_op_ch_sel op_ch_sel;
105 97
106 /* Primary mode */
107 enum adv7604_prim_mode prim_mode;
108
109 /* Select output format */ 98 /* Select output format */
110 enum adv7604_op_format_sel op_format_sel; 99 enum adv7604_op_format_sel op_format_sel;
111 100
@@ -142,6 +131,16 @@ struct adv7604_platform_data {
142 u8 i2c_vdp; 131 u8 i2c_vdp;
143}; 132};
144 133
134/*
135 * Mode of operation.
136 * This is used as the input argument of the s_routing video op.
137 */
138enum adv7604_mode {
139 ADV7604_MODE_COMP,
140 ADV7604_MODE_GR,
141 ADV7604_MODE_HDMI,
142};
143
145#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000) 144#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
146#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001) 145#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
147#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002) 146#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h
index dbf6b37682cd..8dffffedbb59 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -16,7 +16,7 @@
16/* Header files */ 16/* Header files */
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/v4l2-common.h> 18#include <media/v4l2-common.h>
19#include <media/videobuf-dma-contig.h> 19#include <media/videobuf2-dma-contig.h>
20#include <media/davinci/vpbe_types.h> 20#include <media/davinci/vpbe_types.h>
21#include <media/davinci/vpbe_osd.h> 21#include <media/davinci/vpbe_osd.h>
22#include <media/davinci/vpbe.h> 22#include <media/davinci/vpbe.h>
@@ -62,6 +62,11 @@ struct display_layer_info {
62 enum osd_v_exp_ratio v_exp; 62 enum osd_v_exp_ratio v_exp;
63}; 63};
64 64
65struct vpbe_disp_buffer {
66 struct vb2_buffer vb;
67 struct list_head list;
68};
69
65/* vpbe display object structure */ 70/* vpbe display object structure */
66struct vpbe_layer { 71struct vpbe_layer {
67 /* number of buffers in fbuffers */ 72 /* number of buffers in fbuffers */
@@ -69,13 +74,15 @@ struct vpbe_layer {
69 /* Pointer to the vpbe_display */ 74 /* Pointer to the vpbe_display */
70 struct vpbe_display *disp_dev; 75 struct vpbe_display *disp_dev;
71 /* Pointer pointing to current v4l2_buffer */ 76 /* Pointer pointing to current v4l2_buffer */
72 struct videobuf_buffer *cur_frm; 77 struct vpbe_disp_buffer *cur_frm;
73 /* Pointer pointing to next v4l2_buffer */ 78 /* Pointer pointing to next v4l2_buffer */
74 struct videobuf_buffer *next_frm; 79 struct vpbe_disp_buffer *next_frm;
75 /* videobuf specific parameters 80 /* videobuf specific parameters
76 * Buffer queue used in video-buf 81 * Buffer queue used in video-buf
77 */ 82 */
78 struct videobuf_queue buffer_queue; 83 struct vb2_queue buffer_queue;
84 /* allocator-specific contexts for each plane */
85 struct vb2_alloc_ctx *alloc_ctx;
79 /* Queue of filled frames */ 86 /* Queue of filled frames */
80 struct list_head dma_queue; 87 struct list_head dma_queue;
81 /* Used in video-buf */ 88 /* Used in video-buf */
diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h
index d7e397a444e6..5ab0d8d41f68 100644
--- a/include/media/davinci/vpbe_osd.h
+++ b/include/media/davinci/vpbe_osd.h
@@ -357,7 +357,7 @@ struct osd_state {
357 spinlock_t lock; 357 spinlock_t lock;
358 struct device *dev; 358 struct device *dev;
359 dma_addr_t osd_base_phys; 359 dma_addr_t osd_base_phys;
360 unsigned long osd_base; 360 void __iomem *osd_base;
361 unsigned long osd_size; 361 unsigned long osd_size;
362 /* 1-->the isr will toggle the VID0 ping-pong buffer */ 362 /* 1-->the isr will toggle the VID0 ping-pong buffer */
363 int pingpong; 363 int pingpong;
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 768aa77925cd..e221bc74020b 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -37,7 +37,7 @@ enum ir_kbd_get_key_fn {
37struct IR_i2c_init_data { 37struct IR_i2c_init_data {
38 char *ir_codes; 38 char *ir_codes;
39 const char *name; 39 const char *name;
40 u64 type; /* RC_TYPE_RC5, etc */ 40 u64 type; /* RC_BIT_RC5, etc */
41 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ 41 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
42 42
43 /* 43 /*
diff --git a/include/media/mt9v022.h b/include/media/mt9v022.h
new file mode 100644
index 000000000000..40561801321a
--- /dev/null
+++ b/include/media/mt9v022.h
@@ -0,0 +1,16 @@
1/*
2 * mt9v022 sensor
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 __MT9V022_H__
10#define __MT9V022_H__
11
12struct mt9v022_platform_data {
13 unsigned short y_skip_top; /* Lines to skip at the top */
14};
15
16#endif
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index b0c494a69079..f03445f3c767 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -50,7 +50,7 @@ enum rc_driver_type {
50 * @input_dev: the input child device used to communicate events to userspace 50 * @input_dev: the input child device used to communicate events to userspace
51 * @driver_type: specifies if protocol decoding is done in hardware or software 51 * @driver_type: specifies if protocol decoding is done in hardware or software
52 * @idle: used to keep track of RX state 52 * @idle: used to keep track of RX state
53 * @allowed_protos: bitmask with the supported RC_TYPE_* protocols 53 * @allowed_protos: bitmask with the supported RC_BIT_* protocols
54 * @scanmask: some hardware decoders are not capable of providing the full 54 * @scanmask: some hardware decoders are not capable of providing the full
55 * scancode to the application. As this is a hardware limit, we can't do 55 * scancode to the application. As this is a hardware limit, we can't do
56 * anything with it. Yet, as the same keycode table can be used with other 56 * anything with it. Yet, as the same keycode table can be used with other
@@ -113,7 +113,7 @@ struct rc_dev {
113 u32 max_timeout; 113 u32 max_timeout;
114 u32 rx_resolution; 114 u32 rx_resolution;
115 u32 tx_resolution; 115 u32 tx_resolution;
116 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 116 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
117 int (*open)(struct rc_dev *dev); 117 int (*open)(struct rc_dev *dev);
118 void (*close)(struct rc_dev *dev); 118 void (*close)(struct rc_dev *dev);
119 int (*s_tx_mask)(struct rc_dev *dev, u32 mask); 119 int (*s_tx_mask)(struct rc_dev *dev, u32 mask);
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index cfd5163ff7f3..74f55a3f14eb 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -11,22 +11,54 @@
11 11
12#include <linux/input.h> 12#include <linux/input.h>
13 13
14#define RC_TYPE_UNKNOWN 0 14enum rc_type {
15#define RC_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ 15 RC_TYPE_UNKNOWN = 0, /* Protocol not known */
16#define RC_TYPE_NEC (1 << 1) 16 RC_TYPE_OTHER = 1, /* Protocol known but proprietary */
17#define RC_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ 17 RC_TYPE_LIRC = 2, /* Pass raw IR to lirc userspace */
18#define RC_TYPE_JVC (1 << 3) /* JVC protocol */ 18 RC_TYPE_RC5 = 3, /* Philips RC5 protocol */
19#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ 19 RC_TYPE_RC5X = 4, /* Philips RC5x protocol */
20#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ 20 RC_TYPE_RC5_SZ = 5, /* StreamZap variant of RC5 */
21#define RC_TYPE_SANYO (1 << 6) /* Sanyo protocol */ 21 RC_TYPE_JVC = 6, /* JVC protocol */
22#define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */ 22 RC_TYPE_SONY12 = 7, /* Sony 12 bit protocol */
23#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ 23 RC_TYPE_SONY15 = 8, /* Sony 15 bit protocol */
24#define RC_TYPE_OTHER (1u << 31) 24 RC_TYPE_SONY20 = 9, /* Sony 20 bit protocol */
25 RC_TYPE_NEC = 10, /* NEC protocol */
26 RC_TYPE_SANYO = 11, /* Sanyo protocol */
27 RC_TYPE_MCE_KBD = 12, /* RC6-ish MCE keyboard/mouse */
28 RC_TYPE_RC6_0 = 13, /* Philips RC6-0-16 protocol */
29 RC_TYPE_RC6_6A_20 = 14, /* Philips RC6-6A-20 protocol */
30 RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */
31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */
32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */
33};
34
35#define RC_BIT_NONE 0
36#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN)
37#define RC_BIT_OTHER (1 << RC_TYPE_OTHER)
38#define RC_BIT_LIRC (1 << RC_TYPE_LIRC)
39#define RC_BIT_RC5 (1 << RC_TYPE_RC5)
40#define RC_BIT_RC5X (1 << RC_TYPE_RC5X)
41#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ)
42#define RC_BIT_JVC (1 << RC_TYPE_JVC)
43#define RC_BIT_SONY12 (1 << RC_TYPE_SONY12)
44#define RC_BIT_SONY15 (1 << RC_TYPE_SONY15)
45#define RC_BIT_SONY20 (1 << RC_TYPE_SONY20)
46#define RC_BIT_NEC (1 << RC_TYPE_NEC)
47#define RC_BIT_SANYO (1 << RC_TYPE_SANYO)
48#define RC_BIT_MCE_KBD (1 << RC_TYPE_MCE_KBD)
49#define RC_BIT_RC6_0 (1 << RC_TYPE_RC6_0)
50#define RC_BIT_RC6_6A_20 (1 << RC_TYPE_RC6_6A_20)
51#define RC_BIT_RC6_6A_24 (1 << RC_TYPE_RC6_6A_24)
52#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32)
53#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE)
25 54
26#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ 55#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \
27 RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ 56 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
28 RC_TYPE_RC5_SZ | RC_TYPE_SANYO | RC_TYPE_MCE_KBD | \ 57 RC_BIT_JVC | \
29 RC_TYPE_OTHER) 58 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \
59 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \
60 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \
61 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)
30 62
31struct rc_map_table { 63struct rc_map_table {
32 u32 scancode; 64 u32 scancode;
@@ -38,7 +70,7 @@ struct rc_map {
38 unsigned int size; /* Max number of entries */ 70 unsigned int size; /* Max number of entries */
39 unsigned int len; /* Used number of entries */ 71 unsigned int len; /* Used number of entries */
40 unsigned int alloc; /* Size of *scan in bytes */ 72 unsigned int alloc; /* Size of *scan in bytes */
41 u64 rc_type; 73 enum rc_type rc_type;
42 const char *name; 74 const char *name;
43 spinlock_t lock; 75 spinlock_t lock;
44}; 76};
diff --git a/include/media/s3c_camif.h b/include/media/s3c_camif.h
new file mode 100644
index 000000000000..df96c2c789b4
--- /dev/null
+++ b/include/media/s3c_camif.h
@@ -0,0 +1,45 @@
1/*
2 * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver
3 *
4 * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef MEDIA_S3C_CAMIF_
12#define MEDIA_S3C_CAMIF_
13
14#include <linux/i2c.h>
15#include <media/v4l2-mediabus.h>
16
17/**
18 * struct s3c_camif_sensor_info - an image sensor description
19 * @i2c_board_info: pointer to an I2C sensor subdevice board info
20 * @clock_frequency: frequency of the clock the host provides to a sensor
21 * @mbus_type: media bus type
22 * @i2c_bus_num: i2c control bus id the sensor is attached to
23 * @flags: the parallel bus flags defining signals polarity (V4L2_MBUS_*)
24 * @use_field: 1 if parallel bus FIELD signal is used (only s3c64xx)
25 */
26struct s3c_camif_sensor_info {
27 struct i2c_board_info i2c_board_info;
28 unsigned long clock_frequency;
29 enum v4l2_mbus_type mbus_type;
30 u16 i2c_bus_num;
31 u16 flags;
32 u8 use_field;
33};
34
35struct s3c_camif_plat_data {
36 struct s3c_camif_sensor_info sensor;
37 int (*gpio_get)(void);
38 int (*gpio_put)(void);
39};
40
41/* Platform default helper functions */
42int s3c_camif_gpio_get(void);
43int s3c_camif_gpio_put(void);
44
45#endif /* MEDIA_S3C_CAMIF_ */
diff --git a/include/media/smiapp.h b/include/media/smiapp.h
index 9ab07fd45d5c..07f96a89e189 100644
--- a/include/media/smiapp.h
+++ b/include/media/smiapp.h
@@ -4,7 +4,7 @@
4 * Generic driver for SMIA/SMIA++ compliant camera modules 4 * Generic driver for SMIA/SMIA++ compliant camera modules
5 * 5 *
6 * Copyright (C) 2011--2012 Nokia Corporation 6 * Copyright (C) 2011--2012 Nokia Corporation
7 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 7 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index e7c5d170a9cd..eff85f934b24 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2009--2010 Nokia Corporation. 6 * Copyright (C) 2009--2010 Nokia Corporation.
7 * 7 *
8 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 8 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 52513c225c18..a62ee18cb7b7 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * Copyright (C) 2009--2010 Nokia Corporation. 7 * Copyright (C) 2009--2010 Nokia Corporation.
8 * 8 *
9 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 9 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e48b571ca37d..4118ad1324c9 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -111,6 +111,8 @@ struct v4l2_ioctl_ops {
111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); 111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
112 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); 112 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
113 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 113 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
114 int (*vidioc_expbuf) (struct file *file, void *fh,
115 struct v4l2_exportbuffer *e);
114 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 116 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
115 117
116 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b); 118 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 131cc4a53675..7e82d2b193d5 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -111,6 +111,9 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
111int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 111int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
112 struct v4l2_buffer *buf); 112 struct v4l2_buffer *buf);
113 113
114int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
115 struct v4l2_exportbuffer *eb);
116
114int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 117int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
115 enum v4l2_buf_type type); 118 enum v4l2_buf_type type);
116int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 119int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index e04252a9fea6..9cfd4ee9e56f 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/videodev2.h> 18#include <linux/videodev2.h>
19#include <linux/dma-buf.h>
19 20
20struct vb2_alloc_ctx; 21struct vb2_alloc_ctx;
21struct vb2_fileio_data; 22struct vb2_fileio_data;
@@ -41,6 +42,24 @@ struct vb2_fileio_data;
41 * argument to other ops in this structure 42 * argument to other ops in this structure
42 * @put_userptr: inform the allocator that a USERPTR buffer will no longer 43 * @put_userptr: inform the allocator that a USERPTR buffer will no longer
43 * be used 44 * be used
45 * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation;
46 * used for DMABUF memory types; alloc_ctx is the alloc context
47 * dbuf is the shared dma_buf; returns NULL on failure;
48 * allocator private per-buffer structure on success;
49 * this needs to be used for further accesses to the buffer
50 * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF
51 * buffer is no longer used; the buf_priv argument is the
52 * allocator private per-buffer structure previously returned
53 * from the attach_dmabuf callback
54 * @map_dmabuf: request for access to the dmabuf from allocator; the allocator
55 * of dmabuf is informed that this driver is going to use the
56 * dmabuf
57 * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified
58 * that this driver is done using the dmabuf for now
59 * @prepare: called every time the buffer is passed from userspace to the
60 * driver, useful for cache synchronisation, optional
61 * @finish: called every time the buffer is passed back from the driver
62 * to the userspace, also optional
44 * @vaddr: return a kernel virtual address to a given memory buffer 63 * @vaddr: return a kernel virtual address to a given memory buffer
45 * associated with the passed private structure or NULL if no 64 * associated with the passed private structure or NULL if no
46 * such mapping exists 65 * such mapping exists
@@ -56,15 +75,27 @@ struct vb2_fileio_data;
56 * Required ops for USERPTR types: get_userptr, put_userptr. 75 * Required ops for USERPTR types: get_userptr, put_userptr.
57 * Required ops for MMAP types: alloc, put, num_users, mmap. 76 * Required ops for MMAP types: alloc, put, num_users, mmap.
58 * Required ops for read/write access types: alloc, put, num_users, vaddr 77 * Required ops for read/write access types: alloc, put, num_users, vaddr
78 * Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf,
79 * unmap_dmabuf.
59 */ 80 */
60struct vb2_mem_ops { 81struct vb2_mem_ops {
61 void *(*alloc)(void *alloc_ctx, unsigned long size); 82 void *(*alloc)(void *alloc_ctx, unsigned long size);
62 void (*put)(void *buf_priv); 83 void (*put)(void *buf_priv);
84 struct dma_buf *(*get_dmabuf)(void *buf_priv);
63 85
64 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, 86 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
65 unsigned long size, int write); 87 unsigned long size, int write);
66 void (*put_userptr)(void *buf_priv); 88 void (*put_userptr)(void *buf_priv);
67 89
90 void (*prepare)(void *buf_priv);
91 void (*finish)(void *buf_priv);
92
93 void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf,
94 unsigned long size, int write);
95 void (*detach_dmabuf)(void *buf_priv);
96 int (*map_dmabuf)(void *buf_priv);
97 void (*unmap_dmabuf)(void *buf_priv);
98
68 void *(*vaddr)(void *buf_priv); 99 void *(*vaddr)(void *buf_priv);
69 void *(*cookie)(void *buf_priv); 100 void *(*cookie)(void *buf_priv);
70 101
@@ -75,6 +106,8 @@ struct vb2_mem_ops {
75 106
76struct vb2_plane { 107struct vb2_plane {
77 void *mem_priv; 108 void *mem_priv;
109 struct dma_buf *dbuf;
110 unsigned int dbuf_mapped;
78}; 111};
79 112
80/** 113/**
@@ -83,12 +116,14 @@ struct vb2_plane {
83 * @VB2_USERPTR: driver supports USERPTR with streaming API 116 * @VB2_USERPTR: driver supports USERPTR with streaming API
84 * @VB2_READ: driver supports read() style access 117 * @VB2_READ: driver supports read() style access
85 * @VB2_WRITE: driver supports write() style access 118 * @VB2_WRITE: driver supports write() style access
119 * @VB2_DMABUF: driver supports DMABUF with streaming API
86 */ 120 */
87enum vb2_io_modes { 121enum vb2_io_modes {
88 VB2_MMAP = (1 << 0), 122 VB2_MMAP = (1 << 0),
89 VB2_USERPTR = (1 << 1), 123 VB2_USERPTR = (1 << 1),
90 VB2_READ = (1 << 2), 124 VB2_READ = (1 << 2),
91 VB2_WRITE = (1 << 3), 125 VB2_WRITE = (1 << 3),
126 VB2_DMABUF = (1 << 4),
92}; 127};
93 128
94/** 129/**
@@ -329,6 +364,7 @@ int __must_check vb2_queue_init(struct vb2_queue *q);
329void vb2_queue_release(struct vb2_queue *q); 364void vb2_queue_release(struct vb2_queue *q);
330 365
331int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); 366int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
367int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb);
332int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); 368int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
333 369
334int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); 370int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
@@ -438,6 +474,8 @@ int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
438int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p); 474int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p);
439int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i); 475int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i);
440int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i); 476int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i);
477int vb2_ioctl_expbuf(struct file *file, void *priv,
478 struct v4l2_exportbuffer *p);
441 479
442/* struct v4l2_file_operations helpers */ 480/* struct v4l2_file_operations helpers */
443 481
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index 84e1f6c031c5..f05444ca8c0c 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -33,11 +33,6 @@ extern const struct vm_operations_struct vb2_common_vm_ops;
33int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, 33int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
34 struct vm_area_struct **res_vma, dma_addr_t *res_pa); 34 struct vm_area_struct **res_vma, dma_addr_t *res_pa);
35 35
36int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
37 unsigned long size,
38 const struct vm_operations_struct *vm_ops,
39 void *priv);
40
41struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma); 36struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
42void vb2_put_vma(struct vm_area_struct *vma); 37void vb2_put_vma(struct vm_area_struct *vma);
43 38
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 9e63e76b20e7..df4ef9453384 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -172,6 +172,9 @@ extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
172extern int register_inet6addr_notifier(struct notifier_block *nb); 172extern int register_inet6addr_notifier(struct notifier_block *nb);
173extern int unregister_inet6addr_notifier(struct notifier_block *nb); 173extern int unregister_inet6addr_notifier(struct notifier_block *nb);
174 174
175extern void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
176 struct ipv6_devconf *devconf);
177
175/** 178/**
176 * __in6_dev_get - get inet6_dev pointer from netdevice 179 * __in6_dev_get - get inet6_dev pointer from netdevice
177 * @dev: network device 180 * @dev: network device
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b5f8988e4283..0a996a3517ed 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -53,7 +53,6 @@ struct unix_sock {
53 struct path path; 53 struct path path;
54 struct mutex readlock; 54 struct mutex readlock;
55 struct sock *peer; 55 struct sock *peer;
56 struct sock *other;
57 struct list_head link; 56 struct list_head link;
58 atomic_long_t inflight; 57 atomic_long_t inflight;
59 spinlock_t lock; 58 spinlock_t lock;
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index 6a76e0a0705e..42f21766c538 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -19,13 +19,25 @@
19 19
20#define A2MP_FEAT_EXT 0x8000 20#define A2MP_FEAT_EXT 0x8000
21 21
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL,
26};
27
22struct amp_mgr { 28struct amp_mgr {
29 struct list_head list;
23 struct l2cap_conn *l2cap_conn; 30 struct l2cap_conn *l2cap_conn;
24 struct l2cap_chan *a2mp_chan; 31 struct l2cap_chan *a2mp_chan;
32 struct l2cap_chan *bredr_chan;
25 struct kref kref; 33 struct kref kref;
26 __u8 ident; 34 __u8 ident;
27 __u8 handle; 35 __u8 handle;
36 enum amp_mgr_state state;
28 unsigned long flags; 37 unsigned long flags;
38
39 struct list_head amp_ctrls;
40 struct mutex amp_ctrls_lock;
29}; 41};
30 42
31struct a2mp_cmd { 43struct a2mp_cmd {
@@ -118,9 +130,19 @@ struct a2mp_physlink_rsp {
118#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05 130#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
119#define A2MP_STATUS_SECURITY_VIOLATION 0x06 131#define A2MP_STATUS_SECURITY_VIOLATION 0x06
120 132
121void amp_mgr_get(struct amp_mgr *mgr); 133extern struct list_head amp_mgr_list;
134extern struct mutex amp_mgr_list_lock;
135
136struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
122int amp_mgr_put(struct amp_mgr *mgr); 137int amp_mgr_put(struct amp_mgr *mgr);
138u8 __next_ident(struct amp_mgr *mgr);
123struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, 139struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
124 struct sk_buff *skb); 140 struct sk_buff *skb);
141struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
142void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
143void a2mp_discover_amp(struct l2cap_chan *chan);
144void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
145void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
146void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
125 147
126#endif /* __A2MP_H */ 148#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
new file mode 100644
index 000000000000..7ea3db77ba89
--- /dev/null
+++ b/include/net/bluetooth/amp.h
@@ -0,0 +1,54 @@
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#ifndef __AMP_H
15#define __AMP_H
16
17struct amp_ctrl {
18 struct list_head list;
19 struct kref kref;
20 __u8 id;
21 __u16 assoc_len_so_far;
22 __u16 assoc_rem_len;
23 __u16 assoc_len;
24 __u8 *assoc;
25};
26
27int amp_ctrl_put(struct amp_ctrl *ctrl);
28void amp_ctrl_get(struct amp_ctrl *ctrl);
29struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
30struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id, bool out);
35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37
38void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
42 struct hci_conn *hcon);
43void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
44 struct hci_conn *hcon);
45void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon);
50void amp_create_logical_link(struct l2cap_chan *chan);
51void amp_disconnect_logical_link(struct hci_chan *hchan);
52void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
53
54#endif /* __AMP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index ede036977ae8..2554b3f5222a 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -180,7 +180,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
180} 180}
181 181
182void baswap(bdaddr_t *dst, bdaddr_t *src); 182void baswap(bdaddr_t *dst, bdaddr_t *src);
183char *batostr(bdaddr_t *ba);
184 183
185/* Common socket structures and functions */ 184/* Common socket structures and functions */
186 185
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 76b2b6bdcf36..45eee08157bb 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -33,6 +33,8 @@
33#define HCI_LINK_KEY_SIZE 16 33#define HCI_LINK_KEY_SIZE 16
34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 34#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE)
35 35
36#define HCI_MAX_AMP_ASSOC_SIZE 672
37
36/* HCI dev events */ 38/* HCI dev events */
37#define HCI_DEV_REG 1 39#define HCI_DEV_REG 1
38#define HCI_DEV_UNREG 2 40#define HCI_DEV_UNREG 2
@@ -113,6 +115,7 @@ enum {
113 HCI_SSP_ENABLED, 115 HCI_SSP_ENABLED,
114 HCI_HS_ENABLED, 116 HCI_HS_ENABLED,
115 HCI_LE_ENABLED, 117 HCI_LE_ENABLED,
118 HCI_LE_PERIPHERAL,
116 HCI_CONNECTABLE, 119 HCI_CONNECTABLE,
117 HCI_DISCOVERABLE, 120 HCI_DISCOVERABLE,
118 HCI_LINK_SECURITY, 121 HCI_LINK_SECURITY,
@@ -151,7 +154,7 @@ enum {
151#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 154#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
152#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 155#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
153#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ 156#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */
154#define HCI_CMD_TIMEOUT msecs_to_jiffies(1000) /* 1 second */ 157#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
155#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 158#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
156#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 159#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
157 160
@@ -196,6 +199,7 @@ enum {
196#define ACL_START_NO_FLUSH 0x00 199#define ACL_START_NO_FLUSH 0x00
197#define ACL_CONT 0x01 200#define ACL_CONT 0x01
198#define ACL_START 0x02 201#define ACL_START 0x02
202#define ACL_COMPLETE 0x03
199#define ACL_ACTIVE_BCAST 0x04 203#define ACL_ACTIVE_BCAST 0x04
200#define ACL_PICO_BCAST 0x08 204#define ACL_PICO_BCAST 0x08
201 205
@@ -205,6 +209,7 @@ enum {
205#define ESCO_LINK 0x02 209#define ESCO_LINK 0x02
206/* Low Energy links do not have defined link type. Use invented one */ 210/* Low Energy links do not have defined link type. Use invented one */
207#define LE_LINK 0x80 211#define LE_LINK 0x80
212#define AMP_LINK 0x81
208 213
209/* LMP features */ 214/* LMP features */
210#define LMP_3SLOT 0x01 215#define LMP_3SLOT 0x01
@@ -314,6 +319,9 @@ enum {
314#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 319#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
315#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 320#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
316 321
322/* The core spec defines 127 as the "not available" value */
323#define HCI_TX_POWER_INVALID 127
324
317/* Extended Inquiry Response field types */ 325/* Extended Inquiry Response field types */
318#define EIR_FLAGS 0x01 /* flags */ 326#define EIR_FLAGS 0x01 /* flags */
319#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 327#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
@@ -330,6 +338,13 @@ enum {
330#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ 338#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
331#define EIR_DEVICE_ID 0x10 /* device ID */ 339#define EIR_DEVICE_ID 0x10 /* device ID */
332 340
341/* Low Energy Advertising Flags */
342#define LE_AD_LIMITED 0x01 /* Limited Discoverable */
343#define LE_AD_GENERAL 0x02 /* General Discoverable */
344#define LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */
345#define LE_AD_SIM_LE_BREDR_CTRL 0x08 /* Simultaneous LE & BR/EDR Controller */
346#define LE_AD_SIM_LE_BREDR_HOST 0x10 /* Simultaneous LE & BR/EDR Host */
347
333/* ----- HCI Commands ---- */ 348/* ----- HCI Commands ---- */
334#define HCI_OP_NOP 0x0000 349#define HCI_OP_NOP 0x0000
335 350
@@ -556,12 +571,46 @@ struct hci_cp_accept_phy_link {
556 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 571 __u8 key[HCI_AMP_LINK_KEY_SIZE];
557} __packed; 572} __packed;
558 573
559#define HCI_OP_DISCONN_PHY_LINK 0x0437 574#define HCI_OP_DISCONN_PHY_LINK 0x0437
560struct hci_cp_disconn_phy_link { 575struct hci_cp_disconn_phy_link {
561 __u8 phy_handle; 576 __u8 phy_handle;
562 __u8 reason; 577 __u8 reason;
563} __packed; 578} __packed;
564 579
580struct ext_flow_spec {
581 __u8 id;
582 __u8 stype;
583 __le16 msdu;
584 __le32 sdu_itime;
585 __le32 acc_lat;
586 __le32 flush_to;
587} __packed;
588
589#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
590#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
591struct hci_cp_create_accept_logical_link {
592 __u8 phy_handle;
593 struct ext_flow_spec tx_flow_spec;
594 struct ext_flow_spec rx_flow_spec;
595} __packed;
596
597#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
598struct hci_cp_disconn_logical_link {
599 __le16 log_handle;
600} __packed;
601
602#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
603struct hci_cp_logical_link_cancel {
604 __u8 phy_handle;
605 __u8 flow_spec_id;
606} __packed;
607
608struct hci_rp_logical_link_cancel {
609 __u8 status;
610 __u8 phy_handle;
611 __u8 flow_spec_id;
612} __packed;
613
565#define HCI_OP_SNIFF_MODE 0x0803 614#define HCI_OP_SNIFF_MODE 0x0803
566struct hci_cp_sniff_mode { 615struct hci_cp_sniff_mode {
567 __le16 handle; 616 __le16 handle;
@@ -894,6 +943,22 @@ struct hci_rp_le_read_buffer_size {
894 __u8 le_max_pkt; 943 __u8 le_max_pkt;
895} __packed; 944} __packed;
896 945
946#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
947struct hci_rp_le_read_adv_tx_power {
948 __u8 status;
949 __s8 tx_power;
950} __packed;
951
952#define HCI_MAX_AD_LENGTH 31
953
954#define HCI_OP_LE_SET_ADV_DATA 0x2008
955struct hci_cp_le_set_adv_data {
956 __u8 length;
957 __u8 data[HCI_MAX_AD_LENGTH];
958} __packed;
959
960#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
961
897#define HCI_OP_LE_SET_SCAN_PARAM 0x200b 962#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
898struct hci_cp_le_set_scan_param { 963struct hci_cp_le_set_scan_param {
899 __u8 type; 964 __u8 type;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e7d454609881..014a2eaa5389 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -73,6 +73,7 @@ struct discovery_state {
73struct hci_conn_hash { 73struct hci_conn_hash {
74 struct list_head list; 74 struct list_head list;
75 unsigned int acl_num; 75 unsigned int acl_num;
76 unsigned int amp_num;
76 unsigned int sco_num; 77 unsigned int sco_num;
77 unsigned int le_num; 78 unsigned int le_num;
78}; 79};
@@ -124,6 +125,14 @@ struct le_scan_params {
124 125
125#define HCI_MAX_SHORT_NAME_LENGTH 10 126#define HCI_MAX_SHORT_NAME_LENGTH 10
126 127
128struct amp_assoc {
129 __u16 len;
130 __u16 offset;
131 __u16 rem_len;
132 __u16 len_so_far;
133 __u8 data[HCI_MAX_AMP_ASSOC_SIZE];
134};
135
127#define NUM_REASSEMBLY 4 136#define NUM_REASSEMBLY 4
128struct hci_dev { 137struct hci_dev {
129 struct list_head list; 138 struct list_head list;
@@ -177,6 +186,8 @@ struct hci_dev {
177 __u32 amp_max_flush_to; 186 __u32 amp_max_flush_to;
178 __u32 amp_be_flush_to; 187 __u32 amp_be_flush_to;
179 188
189 struct amp_assoc loc_assoc;
190
180 __u8 flow_ctl_mode; 191 __u8 flow_ctl_mode;
181 192
182 unsigned int auto_accept_delay; 193 unsigned int auto_accept_delay;
@@ -252,8 +263,6 @@ struct hci_dev {
252 263
253 struct sk_buff_head driver_init; 264 struct sk_buff_head driver_init;
254 265
255 void *core_data;
256
257 atomic_t promisc; 266 atomic_t promisc;
258 267
259 struct dentry *debugfs; 268 struct dentry *debugfs;
@@ -269,6 +278,10 @@ struct hci_dev {
269 struct work_struct le_scan; 278 struct work_struct le_scan;
270 struct le_scan_params le_scan_params; 279 struct le_scan_params le_scan_params;
271 280
281 __s8 adv_tx_power;
282 __u8 adv_data[HCI_MAX_AD_LENGTH];
283 __u8 adv_data_len;
284
272 int (*open)(struct hci_dev *hdev); 285 int (*open)(struct hci_dev *hdev);
273 int (*close)(struct hci_dev *hdev); 286 int (*close)(struct hci_dev *hdev);
274 int (*flush)(struct hci_dev *hdev); 287 int (*flush)(struct hci_dev *hdev);
@@ -277,6 +290,8 @@ struct hci_dev {
277 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 290 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
278}; 291};
279 292
293#define HCI_PHY_HANDLE(handle) (handle & 0xff)
294
280struct hci_conn { 295struct hci_conn {
281 struct list_head list; 296 struct list_head list;
282 297
@@ -310,6 +325,7 @@ struct hci_conn {
310 325
311 __u8 remote_cap; 326 __u8 remote_cap;
312 __u8 remote_auth; 327 __u8 remote_auth;
328 __u8 remote_id;
313 bool flush_key; 329 bool flush_key;
314 330
315 unsigned int sent; 331 unsigned int sent;
@@ -339,10 +355,11 @@ struct hci_conn {
339 355
340struct hci_chan { 356struct hci_chan {
341 struct list_head list; 357 struct list_head list;
342 358 __u16 handle;
343 struct hci_conn *conn; 359 struct hci_conn *conn;
344 struct sk_buff_head data_q; 360 struct sk_buff_head data_q;
345 unsigned int sent; 361 unsigned int sent;
362 __u8 state;
346}; 363};
347 364
348extern struct list_head hci_dev_list; 365extern struct list_head hci_dev_list;
@@ -359,7 +376,7 @@ extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
359extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 376extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
360 u16 flags); 377 u16 flags);
361 378
362extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 379extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
363extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); 380extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
364extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 381extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
365extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); 382extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
@@ -438,6 +455,9 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
438 case ACL_LINK: 455 case ACL_LINK:
439 h->acl_num++; 456 h->acl_num++;
440 break; 457 break;
458 case AMP_LINK:
459 h->amp_num++;
460 break;
441 case LE_LINK: 461 case LE_LINK:
442 h->le_num++; 462 h->le_num++;
443 break; 463 break;
@@ -459,6 +479,9 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
459 case ACL_LINK: 479 case ACL_LINK:
460 h->acl_num--; 480 h->acl_num--;
461 break; 481 break;
482 case AMP_LINK:
483 h->amp_num--;
484 break;
462 case LE_LINK: 485 case LE_LINK:
463 h->le_num--; 486 h->le_num--;
464 break; 487 break;
@@ -475,6 +498,8 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
475 switch (type) { 498 switch (type) {
476 case ACL_LINK: 499 case ACL_LINK:
477 return h->acl_num; 500 return h->acl_num;
501 case AMP_LINK:
502 return h->amp_num;
478 case LE_LINK: 503 case LE_LINK:
479 return h->le_num; 504 return h->le_num;
480 case SCO_LINK: 505 case SCO_LINK:
@@ -552,10 +577,12 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
552int hci_conn_del(struct hci_conn *conn); 577int hci_conn_del(struct hci_conn *conn);
553void hci_conn_hash_flush(struct hci_dev *hdev); 578void hci_conn_hash_flush(struct hci_dev *hdev);
554void hci_conn_check_pending(struct hci_dev *hdev); 579void hci_conn_check_pending(struct hci_dev *hdev);
580void hci_conn_accept(struct hci_conn *conn, int mask);
555 581
556struct hci_chan *hci_chan_create(struct hci_conn *conn); 582struct hci_chan *hci_chan_create(struct hci_conn *conn);
557void hci_chan_del(struct hci_chan *chan); 583void hci_chan_del(struct hci_chan *chan);
558void hci_chan_list_flush(struct hci_conn *conn); 584void hci_chan_list_flush(struct hci_conn *conn);
585struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
559 586
560struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 587struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
561 __u8 dst_type, __u8 sec_level, __u8 auth_type); 588 __u8 dst_type, __u8 sec_level, __u8 auth_type);
@@ -584,7 +611,10 @@ static inline void hci_conn_put(struct hci_conn *conn)
584 611
585 if (atomic_dec_and_test(&conn->refcnt)) { 612 if (atomic_dec_and_test(&conn->refcnt)) {
586 unsigned long timeo; 613 unsigned long timeo;
587 if (conn->type == ACL_LINK || conn->type == LE_LINK) { 614
615 switch (conn->type) {
616 case ACL_LINK:
617 case LE_LINK:
588 del_timer(&conn->idle_timer); 618 del_timer(&conn->idle_timer);
589 if (conn->state == BT_CONNECTED) { 619 if (conn->state == BT_CONNECTED) {
590 timeo = conn->disc_timeout; 620 timeo = conn->disc_timeout;
@@ -593,12 +623,20 @@ static inline void hci_conn_put(struct hci_conn *conn)
593 } else { 623 } else {
594 timeo = msecs_to_jiffies(10); 624 timeo = msecs_to_jiffies(10);
595 } 625 }
596 } else { 626 break;
627
628 case AMP_LINK:
629 timeo = conn->disc_timeout;
630 break;
631
632 default:
597 timeo = msecs_to_jiffies(10); 633 timeo = msecs_to_jiffies(10);
634 break;
598 } 635 }
636
599 cancel_delayed_work(&conn->disc_work); 637 cancel_delayed_work(&conn->disc_work);
600 queue_delayed_work(conn->hdev->workqueue, 638 queue_delayed_work(conn->hdev->workqueue,
601 &conn->disc_work, timeo); 639 &conn->disc_work, timeo);
602 } 640 }
603} 641}
604 642
@@ -650,7 +688,7 @@ static inline uint8_t __hci_num_ctrl(void)
650} 688}
651 689
652struct hci_dev *hci_dev_get(int index); 690struct hci_dev *hci_dev_get(int index);
653struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 691struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src);
654 692
655struct hci_dev *hci_alloc_dev(void); 693struct hci_dev *hci_alloc_dev(void);
656void hci_free_dev(struct hci_dev *hdev); 694void hci_free_dev(struct hci_dev *hdev);
@@ -699,6 +737,8 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
699 u8 *randomizer); 737 u8 *randomizer);
700int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 738int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
701 739
740int hci_update_ad(struct hci_dev *hdev);
741
702void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 742void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
703 743
704int hci_recv_frame(struct sk_buff *skb); 744int hci_recv_frame(struct sk_buff *skb);
@@ -715,22 +755,51 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
715#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) 755#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
716 756
717/* ----- LMP capabilities ----- */ 757/* ----- LMP capabilities ----- */
718#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
719#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) 758#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT)
759#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
760#define lmp_hold_capable(dev) ((dev)->features[0] & LMP_HOLD)
720#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) 761#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF)
721#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 762#define lmp_park_capable(dev) ((dev)->features[1] & LMP_PARK)
763#define lmp_inq_rssi_capable(dev) ((dev)->features[3] & LMP_RSSI_INQ)
722#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 764#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
765#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR))
766#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
767#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
768#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC)
769#define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ)
770#define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR)
723#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 771#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
724#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 772#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
725#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 773#define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO)
726#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) 774#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[7] & LMP_INQ_TX_PWR)
775#define lmp_ext_feat_capable(dev) ((dev)->features[7] & LMP_EXTFEATURES)
727 776
728/* ----- Extended LMP capabilities ----- */ 777/* ----- Extended LMP capabilities ----- */
729#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 778#define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP)
779#define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE)
780#define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR)
781
782/* returns true if at least one AMP active */
783static inline bool hci_amp_capable(void)
784{
785 struct hci_dev *hdev;
786 bool ret = false;
787
788 read_lock(&hci_dev_list_lock);
789 list_for_each_entry(hdev, &hci_dev_list, list)
790 if (hdev->amp_type == HCI_AMP &&
791 test_bit(HCI_UP, &hdev->flags))
792 ret = true;
793 read_unlock(&hci_dev_list_lock);
794
795 return ret;
796}
730 797
731/* ----- HCI protocols ----- */ 798/* ----- HCI protocols ----- */
799#define HCI_PROTO_DEFER 0x01
800
732static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, 801static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
733 __u8 type) 802 __u8 type, __u8 *flags)
734{ 803{
735 switch (type) { 804 switch (type) {
736 case ACL_LINK: 805 case ACL_LINK:
@@ -738,7 +807,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
738 807
739 case SCO_LINK: 808 case SCO_LINK:
740 case ESCO_LINK: 809 case ESCO_LINK:
741 return sco_connect_ind(hdev, bdaddr); 810 return sco_connect_ind(hdev, bdaddr, flags);
742 811
743 default: 812 default:
744 BT_ERR("unknown link type %d", type); 813 BT_ERR("unknown link type %d", type);
@@ -789,6 +858,10 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
789 sco_disconn_cfm(conn, reason); 858 sco_disconn_cfm(conn, reason);
790 break; 859 break;
791 860
861 /* L2CAP would be handled for BREDR chan */
862 case AMP_LINK:
863 break;
864
792 default: 865 default:
793 BT_ERR("unknown link type %d", conn->type); 866 BT_ERR("unknown link type %d", conn->type);
794 break; 867 break;
@@ -841,7 +914,7 @@ struct hci_cb {
841 914
842static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 915static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
843{ 916{
844 struct list_head *p; 917 struct hci_cb *cb;
845 __u8 encrypt; 918 __u8 encrypt;
846 919
847 hci_proto_auth_cfm(conn, status); 920 hci_proto_auth_cfm(conn, status);
@@ -852,8 +925,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
852 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 925 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
853 926
854 read_lock(&hci_cb_list_lock); 927 read_lock(&hci_cb_list_lock);
855 list_for_each(p, &hci_cb_list) { 928 list_for_each_entry(cb, &hci_cb_list, list) {
856 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
857 if (cb->security_cfm) 929 if (cb->security_cfm)
858 cb->security_cfm(conn, status, encrypt); 930 cb->security_cfm(conn, status, encrypt);
859 } 931 }
@@ -863,7 +935,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
863static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, 935static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
864 __u8 encrypt) 936 __u8 encrypt)
865{ 937{
866 struct list_head *p; 938 struct hci_cb *cb;
867 939
868 if (conn->sec_level == BT_SECURITY_SDP) 940 if (conn->sec_level == BT_SECURITY_SDP)
869 conn->sec_level = BT_SECURITY_LOW; 941 conn->sec_level = BT_SECURITY_LOW;
@@ -874,8 +946,7 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
874 hci_proto_encrypt_cfm(conn, status, encrypt); 946 hci_proto_encrypt_cfm(conn, status, encrypt);
875 947
876 read_lock(&hci_cb_list_lock); 948 read_lock(&hci_cb_list_lock);
877 list_for_each(p, &hci_cb_list) { 949 list_for_each_entry(cb, &hci_cb_list, list) {
878 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
879 if (cb->security_cfm) 950 if (cb->security_cfm)
880 cb->security_cfm(conn, status, encrypt); 951 cb->security_cfm(conn, status, encrypt);
881 } 952 }
@@ -884,11 +955,10 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
884 955
885static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) 956static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
886{ 957{
887 struct list_head *p; 958 struct hci_cb *cb;
888 959
889 read_lock(&hci_cb_list_lock); 960 read_lock(&hci_cb_list_lock);
890 list_for_each(p, &hci_cb_list) { 961 list_for_each_entry(cb, &hci_cb_list, list) {
891 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
892 if (cb->key_change_cfm) 962 if (cb->key_change_cfm)
893 cb->key_change_cfm(conn, status); 963 cb->key_change_cfm(conn, status);
894 } 964 }
@@ -898,11 +968,10 @@ static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
898static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, 968static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
899 __u8 role) 969 __u8 role)
900{ 970{
901 struct list_head *p; 971 struct hci_cb *cb;
902 972
903 read_lock(&hci_cb_list_lock); 973 read_lock(&hci_cb_list_lock);
904 list_for_each(p, &hci_cb_list) { 974 list_for_each_entry(cb, &hci_cb_list, list) {
905 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
906 if (cb->role_switch_cfm) 975 if (cb->role_switch_cfm)
907 cb->role_switch_cfm(conn, status, role); 976 cb->role_switch_cfm(conn, status, role);
908 } 977 }
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7ed8e356425a..7588ef44ebaf 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -32,13 +32,14 @@
32/* L2CAP defaults */ 32/* L2CAP defaults */
33#define L2CAP_DEFAULT_MTU 672 33#define L2CAP_DEFAULT_MTU 672
34#define L2CAP_DEFAULT_MIN_MTU 48 34#define L2CAP_DEFAULT_MIN_MTU 48
35#define L2CAP_DEFAULT_FLUSH_TO 0xffff 35#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
36#define L2CAP_EFS_DEFAULT_FLUSH_TO 0xFFFFFFFF
36#define L2CAP_DEFAULT_TX_WINDOW 63 37#define L2CAP_DEFAULT_TX_WINDOW 63
37#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF 38#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
38#define L2CAP_DEFAULT_MAX_TX 3 39#define L2CAP_DEFAULT_MAX_TX 3
39#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ 40#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 41#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 42#define L2CAP_DEFAULT_MAX_PDU_SIZE 1492 /* Sized for AMP packet */
42#define L2CAP_DEFAULT_ACK_TO 200 43#define L2CAP_DEFAULT_ACK_TO 200
43#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF 44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
44#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
@@ -51,6 +52,8 @@
51#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000) 52#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
52#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) 53#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
53#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) 54#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
55#define L2CAP_MOVE_TIMEOUT msecs_to_jiffies(4000)
56#define L2CAP_MOVE_ERTX_TIMEOUT msecs_to_jiffies(60000)
54 57
55#define L2CAP_A2MP_DEFAULT_MTU 670 58#define L2CAP_A2MP_DEFAULT_MTU 670
56 59
@@ -433,6 +436,8 @@ struct l2cap_chan {
433 struct sock *sk; 436 struct sock *sk;
434 437
435 struct l2cap_conn *conn; 438 struct l2cap_conn *conn;
439 struct hci_conn *hs_hcon;
440 struct hci_chan *hs_hchan;
436 struct kref kref; 441 struct kref kref;
437 442
438 __u8 state; 443 __u8 state;
@@ -476,6 +481,12 @@ struct l2cap_chan {
476 unsigned long conn_state; 481 unsigned long conn_state;
477 unsigned long flags; 482 unsigned long flags;
478 483
484 __u8 remote_amp_id;
485 __u8 local_amp_id;
486 __u8 move_id;
487 __u8 move_state;
488 __u8 move_role;
489
479 __u16 next_tx_seq; 490 __u16 next_tx_seq;
480 __u16 expected_ack_seq; 491 __u16 expected_ack_seq;
481 __u16 expected_tx_seq; 492 __u16 expected_tx_seq;
@@ -538,6 +549,7 @@ struct l2cap_ops {
538 void (*state_change) (struct l2cap_chan *chan, 549 void (*state_change) (struct l2cap_chan *chan,
539 int state); 550 int state);
540 void (*ready) (struct l2cap_chan *chan); 551 void (*ready) (struct l2cap_chan *chan);
552 void (*defer) (struct l2cap_chan *chan);
541 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 553 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
542 unsigned long len, int nb); 554 unsigned long len, int nb);
543}; 555};
@@ -599,7 +611,7 @@ enum {
599 CONF_MTU_DONE, 611 CONF_MTU_DONE,
600 CONF_MODE_DONE, 612 CONF_MODE_DONE,
601 CONF_CONNECT_PEND, 613 CONF_CONNECT_PEND,
602 CONF_NO_FCS_RECV, 614 CONF_RECV_NO_FCS,
603 CONF_STATE2_DEVICE, 615 CONF_STATE2_DEVICE,
604 CONF_EWS_RECV, 616 CONF_EWS_RECV,
605 CONF_LOC_CONF_PEND, 617 CONF_LOC_CONF_PEND,
@@ -640,6 +652,9 @@ enum {
640enum { 652enum {
641 L2CAP_RX_STATE_RECV, 653 L2CAP_RX_STATE_RECV,
642 L2CAP_RX_STATE_SREJ_SENT, 654 L2CAP_RX_STATE_SREJ_SENT,
655 L2CAP_RX_STATE_MOVE,
656 L2CAP_RX_STATE_WAIT_P,
657 L2CAP_RX_STATE_WAIT_F,
643}; 658};
644 659
645enum { 660enum {
@@ -670,6 +685,25 @@ enum {
670 L2CAP_EV_RECV_FRAME, 685 L2CAP_EV_RECV_FRAME,
671}; 686};
672 687
688enum {
689 L2CAP_MOVE_ROLE_NONE,
690 L2CAP_MOVE_ROLE_INITIATOR,
691 L2CAP_MOVE_ROLE_RESPONDER,
692};
693
694enum {
695 L2CAP_MOVE_STABLE,
696 L2CAP_MOVE_WAIT_REQ,
697 L2CAP_MOVE_WAIT_RSP,
698 L2CAP_MOVE_WAIT_RSP_SUCCESS,
699 L2CAP_MOVE_WAIT_CONFIRM,
700 L2CAP_MOVE_WAIT_CONFIRM_RSP,
701 L2CAP_MOVE_WAIT_LOGICAL_COMP,
702 L2CAP_MOVE_WAIT_LOGICAL_CFM,
703 L2CAP_MOVE_WAIT_LOCAL_BUSY,
704 L2CAP_MOVE_WAIT_PREPARE,
705};
706
673void l2cap_chan_hold(struct l2cap_chan *c); 707void l2cap_chan_hold(struct l2cap_chan *c);
674void l2cap_chan_put(struct l2cap_chan *c); 708void l2cap_chan_put(struct l2cap_chan *c);
675 709
@@ -745,6 +779,10 @@ static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
745{ 779{
746} 780}
747 781
782static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
783{
784}
785
748extern bool disable_ertm; 786extern bool disable_ertm;
749 787
750int l2cap_init_sockets(void); 788int l2cap_init_sockets(void);
@@ -767,6 +805,12 @@ int l2cap_chan_check_security(struct l2cap_chan *chan);
767void l2cap_chan_set_defaults(struct l2cap_chan *chan); 805void l2cap_chan_set_defaults(struct l2cap_chan *chan);
768int l2cap_ertm_init(struct l2cap_chan *chan); 806int l2cap_ertm_init(struct l2cap_chan *chan);
769void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 807void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
808void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
770void l2cap_chan_del(struct l2cap_chan *chan, int err); 809void l2cap_chan_del(struct l2cap_chan *chan, int err);
810void l2cap_send_conn_req(struct l2cap_chan *chan);
811void l2cap_move_start(struct l2cap_chan *chan);
812void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
813 u8 status);
814void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
771 815
772#endif /* __L2CAP_H */ 816#endif /* __L2CAP_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7d5b6000378b..8e6a6b73b9c9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -58,6 +58,8 @@
58 * structures here describe these capabilities in detail. 58 * structures here describe these capabilities in detail.
59 */ 59 */
60 60
61struct wiphy;
62
61/* 63/*
62 * wireless hardware capability structures 64 * wireless hardware capability structures
63 */ 65 */
@@ -306,6 +308,104 @@ struct key_params {
306}; 308};
307 309
308/** 310/**
311 * struct cfg80211_chan_def - channel definition
312 * @chan: the (control) channel
313 * @width: channel width
314 * @center_freq1: center frequency of first segment
315 * @center_freq2: center frequency of second segment
316 * (only with 80+80 MHz)
317 */
318struct cfg80211_chan_def {
319 struct ieee80211_channel *chan;
320 enum nl80211_chan_width width;
321 u32 center_freq1;
322 u32 center_freq2;
323};
324
325/**
326 * cfg80211_get_chandef_type - return old channel type from chandef
327 * @chandef: the channel definition
328 *
329 * Returns the old channel type (NOHT, HT20, HT40+/-) from a given
330 * chandef, which must have a bandwidth allowing this conversion.
331 */
332static inline enum nl80211_channel_type
333cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
334{
335 switch (chandef->width) {
336 case NL80211_CHAN_WIDTH_20_NOHT:
337 return NL80211_CHAN_NO_HT;
338 case NL80211_CHAN_WIDTH_20:
339 return NL80211_CHAN_HT20;
340 case NL80211_CHAN_WIDTH_40:
341 if (chandef->center_freq1 > chandef->chan->center_freq)
342 return NL80211_CHAN_HT40PLUS;
343 return NL80211_CHAN_HT40MINUS;
344 default:
345 WARN_ON(1);
346 return NL80211_CHAN_NO_HT;
347 }
348}
349
350/**
351 * cfg80211_chandef_create - create channel definition using channel type
352 * @chandef: the channel definition struct to fill
353 * @channel: the control channel
354 * @chantype: the channel type
355 *
356 * Given a channel type, create a channel definition.
357 */
358void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
359 struct ieee80211_channel *channel,
360 enum nl80211_channel_type chantype);
361
362/**
363 * cfg80211_chandef_identical - check if two channel definitions are identical
364 * @chandef1: first channel definition
365 * @chandef2: second channel definition
366 *
367 * Returns %true if the channels defined by the channel definitions are
368 * identical, %false otherwise.
369 */
370static inline bool
371cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
372 const struct cfg80211_chan_def *chandef2)
373{
374 return (chandef1->chan == chandef2->chan &&
375 chandef1->width == chandef2->width &&
376 chandef1->center_freq1 == chandef2->center_freq1 &&
377 chandef1->center_freq2 == chandef2->center_freq2);
378}
379
380/**
381 * cfg80211_chandef_compatible - check if two channel definitions are compatible
382 * @chandef1: first channel definition
383 * @chandef2: second channel definition
384 *
385 * Returns %NULL if the given channel definitions are incompatible,
386 * chandef1 or chandef2 otherwise.
387 */
388const struct cfg80211_chan_def *
389cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
390 const struct cfg80211_chan_def *chandef2);
391
392/**
393 * cfg80211_chandef_valid - check if a channel definition is valid
394 * @chandef: the channel definition to check
395 */
396bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
397
398/**
399 * cfg80211_chandef_usable - check if secondary channels can be used
400 * @wiphy: the wiphy to validate against
401 * @chandef: the channel definition to check
402 * @prohibited_flags: the regulatory chanenl flags that must not be set
403 */
404bool cfg80211_chandef_usable(struct wiphy *wiphy,
405 const struct cfg80211_chan_def *chandef,
406 u32 prohibited_flags);
407
408/**
309 * enum survey_info_flags - survey information flags 409 * enum survey_info_flags - survey information flags
310 * 410 *
311 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 411 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
@@ -426,8 +526,7 @@ struct cfg80211_beacon_data {
426 * 526 *
427 * Used to configure an AP interface. 527 * Used to configure an AP interface.
428 * 528 *
429 * @channel: the channel to start the AP on 529 * @chandef: defines the channel to use
430 * @channel_type: the channel type to use
431 * @beacon: beacon data 530 * @beacon: beacon data
432 * @beacon_interval: beacon interval 531 * @beacon_interval: beacon interval
433 * @dtim_period: DTIM period 532 * @dtim_period: DTIM period
@@ -439,10 +538,11 @@ struct cfg80211_beacon_data {
439 * @privacy: the BSS uses privacy 538 * @privacy: the BSS uses privacy
440 * @auth_type: Authentication type (algorithm) 539 * @auth_type: Authentication type (algorithm)
441 * @inactivity_timeout: time in seconds to determine station's inactivity. 540 * @inactivity_timeout: time in seconds to determine station's inactivity.
541 * @p2p_ctwindow: P2P CT Window
542 * @p2p_opp_ps: P2P opportunistic PS
442 */ 543 */
443struct cfg80211_ap_settings { 544struct cfg80211_ap_settings {
444 struct ieee80211_channel *channel; 545 struct cfg80211_chan_def chandef;
445 enum nl80211_channel_type channel_type;
446 546
447 struct cfg80211_beacon_data beacon; 547 struct cfg80211_beacon_data beacon;
448 548
@@ -454,6 +554,8 @@ struct cfg80211_ap_settings {
454 bool privacy; 554 bool privacy;
455 enum nl80211_auth_type auth_type; 555 enum nl80211_auth_type auth_type;
456 int inactivity_timeout; 556 int inactivity_timeout;
557 u8 p2p_ctwindow;
558 bool p2p_opp_ps;
457}; 559};
458 560
459/** 561/**
@@ -498,6 +600,7 @@ enum station_parameters_apply_mask {
498 * @plink_action: plink action to take 600 * @plink_action: plink action to take
499 * @plink_state: set the peer link state for a station 601 * @plink_state: set the peer link state for a station
500 * @ht_capa: HT capabilities of station 602 * @ht_capa: HT capabilities of station
603 * @vht_capa: VHT capabilities of station
501 * @uapsd_queues: bitmap of queues configured for uapsd. same format 604 * @uapsd_queues: bitmap of queues configured for uapsd. same format
502 * as the AC bitmap in the QoS info field 605 * as the AC bitmap in the QoS info field
503 * @max_sp: max Service Period. same format as the MAX_SP in the 606 * @max_sp: max Service Period. same format as the MAX_SP in the
@@ -517,6 +620,7 @@ struct station_parameters {
517 u8 plink_action; 620 u8 plink_action;
518 u8 plink_state; 621 u8 plink_state;
519 struct ieee80211_ht_cap *ht_capa; 622 struct ieee80211_ht_cap *ht_capa;
623 struct ieee80211_vht_cap *vht_capa;
520 u8 uapsd_queues; 624 u8 uapsd_queues;
521 u8 max_sp; 625 u8 max_sp;
522}; 626};
@@ -580,16 +684,24 @@ enum station_info_flags {
580 * Used by the driver to indicate the specific rate transmission 684 * Used by the driver to indicate the specific rate transmission
581 * type for 802.11n transmissions. 685 * type for 802.11n transmissions.
582 * 686 *
583 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 687 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
584 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 688 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
689 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
690 * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
691 * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
692 * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
585 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 693 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
586 * @RATE_INFO_FLAGS_60G: 60gHz MCS 694 * @RATE_INFO_FLAGS_60G: 60GHz MCS
587 */ 695 */
588enum rate_info_flags { 696enum rate_info_flags {
589 RATE_INFO_FLAGS_MCS = 1<<0, 697 RATE_INFO_FLAGS_MCS = BIT(0),
590 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 698 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
591 RATE_INFO_FLAGS_SHORT_GI = 1<<2, 699 RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2),
592 RATE_INFO_FLAGS_60G = 1<<3, 700 RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3),
701 RATE_INFO_FLAGS_80P80_MHZ_WIDTH = BIT(4),
702 RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(5),
703 RATE_INFO_FLAGS_SHORT_GI = BIT(6),
704 RATE_INFO_FLAGS_60G = BIT(7),
593}; 705};
594 706
595/** 707/**
@@ -600,11 +712,13 @@ enum rate_info_flags {
600 * @flags: bitflag of flags from &enum rate_info_flags 712 * @flags: bitflag of flags from &enum rate_info_flags
601 * @mcs: mcs index if struct describes a 802.11n bitrate 713 * @mcs: mcs index if struct describes a 802.11n bitrate
602 * @legacy: bitrate in 100kbit/s for 802.11abg 714 * @legacy: bitrate in 100kbit/s for 802.11abg
715 * @nss: number of streams (VHT only)
603 */ 716 */
604struct rate_info { 717struct rate_info {
605 u8 flags; 718 u8 flags;
606 u8 mcs; 719 u8 mcs;
607 u16 legacy; 720 u16 legacy;
721 u8 nss;
608}; 722};
609 723
610/** 724/**
@@ -803,6 +917,8 @@ struct mpath_info {
803 * @ap_isolate: do not forward packets between connected stations 917 * @ap_isolate: do not forward packets between connected stations
804 * @ht_opmode: HT Operation mode 918 * @ht_opmode: HT Operation mode
805 * (u16 = opmode, -1 = do not change) 919 * (u16 = opmode, -1 = do not change)
920 * @p2p_ctwindow: P2P CT Window (-1 = no change)
921 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
806 */ 922 */
807struct bss_parameters { 923struct bss_parameters {
808 int use_cts_prot; 924 int use_cts_prot;
@@ -812,6 +928,7 @@ struct bss_parameters {
812 u8 basic_rates_len; 928 u8 basic_rates_len;
813 int ap_isolate; 929 int ap_isolate;
814 int ht_opmode; 930 int ht_opmode;
931 s8 p2p_ctwindow, p2p_opp_ps;
815}; 932};
816 933
817/** 934/**
@@ -907,8 +1024,7 @@ struct mesh_config {
907 1024
908/** 1025/**
909 * struct mesh_setup - 802.11s mesh setup configuration 1026 * struct mesh_setup - 802.11s mesh setup configuration
910 * @channel: the channel to start the mesh network on 1027 * @chandef: defines the channel to use
911 * @channel_type: the channel type to use
912 * @mesh_id: the mesh ID 1028 * @mesh_id: the mesh ID
913 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 1029 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
914 * @sync_method: which synchronization method to use 1030 * @sync_method: which synchronization method to use
@@ -923,8 +1039,7 @@ struct mesh_config {
923 * These parameters are fixed when the mesh is created. 1039 * These parameters are fixed when the mesh is created.
924 */ 1040 */
925struct mesh_setup { 1041struct mesh_setup {
926 struct ieee80211_channel *channel; 1042 struct cfg80211_chan_def chandef;
927 enum nl80211_channel_type channel_type;
928 const u8 *mesh_id; 1043 const u8 *mesh_id;
929 u8 mesh_id_len; 1044 u8 mesh_id_len;
930 u8 sync_method; 1045 u8 sync_method;
@@ -955,9 +1070,6 @@ struct ieee80211_txq_params {
955 u8 aifs; 1070 u8 aifs;
956}; 1071};
957 1072
958/* from net/wireless.h */
959struct wiphy;
960
961/** 1073/**
962 * DOC: Scanning and BSS list handling 1074 * DOC: Scanning and BSS list handling
963 * 1075 *
@@ -1000,8 +1112,10 @@ struct cfg80211_ssid {
1000 * @n_channels: total number of channels to scan 1112 * @n_channels: total number of channels to scan
1001 * @ie: optional information element(s) to add into Probe Request or %NULL 1113 * @ie: optional information element(s) to add into Probe Request or %NULL
1002 * @ie_len: length of ie in octets 1114 * @ie_len: length of ie in octets
1115 * @flags: bit field of flags controlling operation
1003 * @rates: bitmap of rates to advertise for each band 1116 * @rates: bitmap of rates to advertise for each band
1004 * @wiphy: the wiphy this was for 1117 * @wiphy: the wiphy this was for
1118 * @scan_start: time (in jiffies) when the scan started
1005 * @wdev: the wireless device to scan for 1119 * @wdev: the wireless device to scan for
1006 * @aborted: (internal) scan request was notified as aborted 1120 * @aborted: (internal) scan request was notified as aborted
1007 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1121 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
@@ -1012,6 +1126,7 @@ struct cfg80211_scan_request {
1012 u32 n_channels; 1126 u32 n_channels;
1013 const u8 *ie; 1127 const u8 *ie;
1014 size_t ie_len; 1128 size_t ie_len;
1129 u32 flags;
1015 1130
1016 u32 rates[IEEE80211_NUM_BANDS]; 1131 u32 rates[IEEE80211_NUM_BANDS];
1017 1132
@@ -1019,6 +1134,7 @@ struct cfg80211_scan_request {
1019 1134
1020 /* internal */ 1135 /* internal */
1021 struct wiphy *wiphy; 1136 struct wiphy *wiphy;
1137 unsigned long scan_start;
1022 bool aborted; 1138 bool aborted;
1023 bool no_cck; 1139 bool no_cck;
1024 1140
@@ -1044,6 +1160,7 @@ struct cfg80211_match_set {
1044 * @interval: interval between each scheduled scan cycle 1160 * @interval: interval between each scheduled scan cycle
1045 * @ie: optional information element(s) to add into Probe Request or %NULL 1161 * @ie: optional information element(s) to add into Probe Request or %NULL
1046 * @ie_len: length of ie in octets 1162 * @ie_len: length of ie in octets
1163 * @flags: bit field of flags controlling operation
1047 * @match_sets: sets of parameters to be matched for a scan result 1164 * @match_sets: sets of parameters to be matched for a scan result
1048 * entry to be considered valid and to be passed to the host 1165 * entry to be considered valid and to be passed to the host
1049 * (others are filtered out). 1166 * (others are filtered out).
@@ -1061,6 +1178,7 @@ struct cfg80211_sched_scan_request {
1061 u32 interval; 1178 u32 interval;
1062 const u8 *ie; 1179 const u8 *ie;
1063 size_t ie_len; 1180 size_t ie_len;
1181 u32 flags;
1064 struct cfg80211_match_set *match_sets; 1182 struct cfg80211_match_set *match_sets;
1065 int n_match_sets; 1183 int n_match_sets;
1066 s32 rssi_thold; 1184 s32 rssi_thold;
@@ -1068,6 +1186,7 @@ struct cfg80211_sched_scan_request {
1068 /* internal */ 1186 /* internal */
1069 struct wiphy *wiphy; 1187 struct wiphy *wiphy;
1070 struct net_device *dev; 1188 struct net_device *dev;
1189 unsigned long scan_start;
1071 1190
1072 /* keep last */ 1191 /* keep last */
1073 struct ieee80211_channel *channels[0]; 1192 struct ieee80211_channel *channels[0];
@@ -1087,6 +1206,18 @@ enum cfg80211_signal_type {
1087}; 1206};
1088 1207
1089/** 1208/**
1209 * struct cfg80211_bss_ie_data - BSS entry IE data
1210 * @rcu_head: internal use, for freeing
1211 * @len: length of the IEs
1212 * @data: IE data
1213 */
1214struct cfg80211_bss_ies {
1215 struct rcu_head rcu_head;
1216 int len;
1217 u8 data[];
1218};
1219
1220/**
1090 * struct cfg80211_bss - BSS description 1221 * struct cfg80211_bss - BSS description
1091 * 1222 *
1092 * This structure describes a BSS (which may also be a mesh network) 1223 * This structure describes a BSS (which may also be a mesh network)
@@ -1097,36 +1228,34 @@ enum cfg80211_signal_type {
1097 * @tsf: timestamp of last received update 1228 * @tsf: timestamp of last received update
1098 * @beacon_interval: the beacon interval as from the frame 1229 * @beacon_interval: the beacon interval as from the frame
1099 * @capability: the capability field in host byte order 1230 * @capability: the capability field in host byte order
1100 * @information_elements: the information elements (Note that there 1231 * @ies: the information elements (Note that there
1101 * is no guarantee that these are well-formed!); this is a pointer to 1232 * is no guarantee that these are well-formed!); this is a pointer to
1102 * either the beacon_ies or proberesp_ies depending on whether Probe 1233 * either the beacon_ies or proberesp_ies depending on whether Probe
1103 * Response frame has been received 1234 * Response frame has been received
1104 * @len_information_elements: total length of the information elements
1105 * @beacon_ies: the information elements from the last Beacon frame 1235 * @beacon_ies: the information elements from the last Beacon frame
1106 * @len_beacon_ies: total length of the beacon_ies
1107 * @proberesp_ies: the information elements from the last Probe Response frame 1236 * @proberesp_ies: the information elements from the last Probe Response frame
1108 * @len_proberesp_ies: total length of the proberesp_ies
1109 * @signal: signal strength value (type depends on the wiphy's signal_type) 1237 * @signal: signal strength value (type depends on the wiphy's signal_type)
1110 * @free_priv: function pointer to free private data 1238 * @free_priv: function pointer to free private data
1111 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 1239 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
1112 */ 1240 */
1113struct cfg80211_bss { 1241struct cfg80211_bss {
1242 u64 tsf;
1243
1114 struct ieee80211_channel *channel; 1244 struct ieee80211_channel *channel;
1115 1245
1116 u8 bssid[ETH_ALEN]; 1246 const struct cfg80211_bss_ies __rcu *ies;
1117 u64 tsf; 1247 const struct cfg80211_bss_ies __rcu *beacon_ies;
1248 const struct cfg80211_bss_ies __rcu *proberesp_ies;
1249
1250 void (*free_priv)(struct cfg80211_bss *bss);
1251
1252 s32 signal;
1253
1118 u16 beacon_interval; 1254 u16 beacon_interval;
1119 u16 capability; 1255 u16 capability;
1120 u8 *information_elements;
1121 size_t len_information_elements;
1122 u8 *beacon_ies;
1123 size_t len_beacon_ies;
1124 u8 *proberesp_ies;
1125 size_t len_proberesp_ies;
1126 1256
1127 s32 signal; 1257 u8 bssid[ETH_ALEN];
1128 1258
1129 void (*free_priv)(struct cfg80211_bss *bss);
1130 u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 1259 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
1131}; 1260};
1132 1261
@@ -1134,6 +1263,9 @@ struct cfg80211_bss {
1134 * ieee80211_bss_get_ie - find IE with given ID 1263 * ieee80211_bss_get_ie - find IE with given ID
1135 * @bss: the bss to search 1264 * @bss: the bss to search
1136 * @ie: the IE ID 1265 * @ie: the IE ID
1266 *
1267 * Note that the return value is an RCU-protected pointer, so
1268 * rcu_read_lock() must be held when calling this function.
1137 * Returns %NULL if not found. 1269 * Returns %NULL if not found.
1138 */ 1270 */
1139const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 1271const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
@@ -1152,6 +1284,9 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1152 * @key_len: length of WEP key for shared key authentication 1284 * @key_len: length of WEP key for shared key authentication
1153 * @key_idx: index of WEP key for shared key authentication 1285 * @key_idx: index of WEP key for shared key authentication
1154 * @key: WEP key for shared key authentication 1286 * @key: WEP key for shared key authentication
1287 * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1288 * Authentication transaction sequence number field.
1289 * @sae_data_len: Length of sae_data buffer in octets
1155 */ 1290 */
1156struct cfg80211_auth_request { 1291struct cfg80211_auth_request {
1157 struct cfg80211_bss *bss; 1292 struct cfg80211_bss *bss;
@@ -1160,6 +1295,8 @@ struct cfg80211_auth_request {
1160 enum nl80211_auth_type auth_type; 1295 enum nl80211_auth_type auth_type;
1161 const u8 *key; 1296 const u8 *key;
1162 u8 key_len, key_idx; 1297 u8 key_len, key_idx;
1298 const u8 *sae_data;
1299 size_t sae_data_len;
1163}; 1300};
1164 1301
1165/** 1302/**
@@ -1252,8 +1389,7 @@ struct cfg80211_disassoc_request {
1252 * @ssid_len: The length of the SSID, will always be non-zero. 1389 * @ssid_len: The length of the SSID, will always be non-zero.
1253 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 1390 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
1254 * search for IBSSs with a different BSSID. 1391 * search for IBSSs with a different BSSID.
1255 * @channel: The channel to use if no IBSS can be found to join. 1392 * @chandef: defines the channel to use if no other IBSS to join can be found
1256 * @channel_type: channel type (HT mode)
1257 * @channel_fixed: The channel should be fixed -- do not search for 1393 * @channel_fixed: The channel should be fixed -- do not search for
1258 * IBSSs to join on other channels. 1394 * IBSSs to join on other channels.
1259 * @ie: information element(s) to include in the beacon 1395 * @ie: information element(s) to include in the beacon
@@ -1271,8 +1407,7 @@ struct cfg80211_disassoc_request {
1271struct cfg80211_ibss_params { 1407struct cfg80211_ibss_params {
1272 u8 *ssid; 1408 u8 *ssid;
1273 u8 *bssid; 1409 u8 *bssid;
1274 struct ieee80211_channel *channel; 1410 struct cfg80211_chan_def chandef;
1275 enum nl80211_channel_type channel_type;
1276 u8 *ie; 1411 u8 *ie;
1277 u8 ssid_len, ie_len; 1412 u8 ssid_len, ie_len;
1278 u16 beacon_interval; 1413 u16 beacon_interval;
@@ -1531,13 +1666,19 @@ struct cfg80211_gtk_rekey_data {
1531 * to a merge. 1666 * to a merge.
1532 * @leave_ibss: Leave the IBSS. 1667 * @leave_ibss: Leave the IBSS.
1533 * 1668 *
1669 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1670 * MESH mode)
1671 *
1534 * @set_wiphy_params: Notify that wiphy parameters have changed; 1672 * @set_wiphy_params: Notify that wiphy parameters have changed;
1535 * @changed bitfield (see &enum wiphy_params_flags) describes which values 1673 * @changed bitfield (see &enum wiphy_params_flags) describes which values
1536 * have changed. The actual parameter values are available in 1674 * have changed. The actual parameter values are available in
1537 * struct wiphy. If returning an error, no value should be changed. 1675 * struct wiphy. If returning an error, no value should be changed.
1538 * 1676 *
1539 * @set_tx_power: set the transmit power according to the parameters, 1677 * @set_tx_power: set the transmit power according to the parameters,
1540 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). 1678 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
1679 * wdev may be %NULL if power was set for the wiphy, and will
1680 * always be %NULL unless the driver supports per-vif TX power
1681 * (as advertised by the nl80211 feature flag.)
1541 * @get_tx_power: store the current TX power into the dbm variable; 1682 * @get_tx_power: store the current TX power into the dbm variable;
1542 * return 0 if successful 1683 * return 0 if successful
1543 * 1684 *
@@ -1708,8 +1849,7 @@ struct cfg80211_ops {
1708 struct ieee80211_channel *chan); 1849 struct ieee80211_channel *chan);
1709 1850
1710 int (*set_monitor_channel)(struct wiphy *wiphy, 1851 int (*set_monitor_channel)(struct wiphy *wiphy,
1711 struct ieee80211_channel *chan, 1852 struct cfg80211_chan_def *chandef);
1712 enum nl80211_channel_type channel_type);
1713 1853
1714 int (*scan)(struct wiphy *wiphy, 1854 int (*scan)(struct wiphy *wiphy,
1715 struct cfg80211_scan_request *request); 1855 struct cfg80211_scan_request *request);
@@ -1732,11 +1872,15 @@ struct cfg80211_ops {
1732 struct cfg80211_ibss_params *params); 1872 struct cfg80211_ibss_params *params);
1733 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1873 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1734 1874
1875 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
1876 int rate[IEEE80211_NUM_BANDS]);
1877
1735 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 1878 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
1736 1879
1737 int (*set_tx_power)(struct wiphy *wiphy, 1880 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1738 enum nl80211_tx_power_setting type, int mbm); 1881 enum nl80211_tx_power_setting type, int mbm);
1739 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1882 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
1883 int *dbm);
1740 1884
1741 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1885 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1742 const u8 *addr); 1886 const u8 *addr);
@@ -1767,7 +1911,6 @@ struct cfg80211_ops {
1767 int (*remain_on_channel)(struct wiphy *wiphy, 1911 int (*remain_on_channel)(struct wiphy *wiphy,
1768 struct wireless_dev *wdev, 1912 struct wireless_dev *wdev,
1769 struct ieee80211_channel *chan, 1913 struct ieee80211_channel *chan,
1770 enum nl80211_channel_type channel_type,
1771 unsigned int duration, 1914 unsigned int duration,
1772 u64 *cookie); 1915 u64 *cookie);
1773 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 1916 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
@@ -1776,10 +1919,8 @@ struct cfg80211_ops {
1776 1919
1777 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 1920 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1778 struct ieee80211_channel *chan, bool offchan, 1921 struct ieee80211_channel *chan, bool offchan,
1779 enum nl80211_channel_type channel_type, 1922 unsigned int wait, const u8 *buf, size_t len,
1780 bool channel_type_valid, unsigned int wait, 1923 bool no_cck, bool dont_wait_for_ack, u64 *cookie);
1781 const u8 *buf, size_t len, bool no_cck,
1782 bool dont_wait_for_ack, u64 *cookie);
1783 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1924 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1784 struct wireless_dev *wdev, 1925 struct wireless_dev *wdev,
1785 u64 cookie); 1926 u64 cookie);
@@ -1834,10 +1975,9 @@ struct cfg80211_ops {
1834 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev, 1975 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1835 u32 sset, u8 *data); 1976 u32 sset, u8 *data);
1836 1977
1837 struct ieee80211_channel * 1978 int (*get_channel)(struct wiphy *wiphy,
1838 (*get_channel)(struct wiphy *wiphy,
1839 struct wireless_dev *wdev, 1979 struct wireless_dev *wdev,
1840 enum nl80211_channel_type *type); 1980 struct cfg80211_chan_def *chandef);
1841 1981
1842 int (*start_p2p_device)(struct wiphy *wiphy, 1982 int (*start_p2p_device)(struct wiphy *wiphy,
1843 struct wireless_dev *wdev); 1983 struct wireless_dev *wdev);
@@ -2445,8 +2585,7 @@ struct wireless_dev {
2445 spinlock_t event_lock; 2585 spinlock_t event_lock;
2446 2586
2447 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2587 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2448 struct ieee80211_channel *preset_chan; 2588 struct cfg80211_chan_def preset_chandef;
2449 enum nl80211_channel_type preset_chantype;
2450 2589
2451 /* for AP and mesh channel tracking */ 2590 /* for AP and mesh channel tracking */
2452 struct ieee80211_channel *channel; 2591 struct ieee80211_channel *channel;
@@ -3326,14 +3465,12 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3326 * @wdev: wireless device 3465 * @wdev: wireless device
3327 * @cookie: the request cookie 3466 * @cookie: the request cookie
3328 * @chan: The current channel (from remain_on_channel request) 3467 * @chan: The current channel (from remain_on_channel request)
3329 * @channel_type: Channel type
3330 * @duration: Duration in milliseconds that the driver intents to remain on the 3468 * @duration: Duration in milliseconds that the driver intents to remain on the
3331 * channel 3469 * channel
3332 * @gfp: allocation flags 3470 * @gfp: allocation flags
3333 */ 3471 */
3334void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 3472void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3335 struct ieee80211_channel *chan, 3473 struct ieee80211_channel *chan,
3336 enum nl80211_channel_type channel_type,
3337 unsigned int duration, gfp_t gfp); 3474 unsigned int duration, gfp_t gfp);
3338 3475
3339/** 3476/**
@@ -3341,12 +3478,10 @@ void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3341 * @wdev: wireless device 3478 * @wdev: wireless device
3342 * @cookie: the request cookie 3479 * @cookie: the request cookie
3343 * @chan: The current channel (from remain_on_channel request) 3480 * @chan: The current channel (from remain_on_channel request)
3344 * @channel_type: Channel type
3345 * @gfp: allocation flags 3481 * @gfp: allocation flags
3346 */ 3482 */
3347void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 3483void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
3348 struct ieee80211_channel *chan, 3484 struct ieee80211_channel *chan,
3349 enum nl80211_channel_type channel_type,
3350 gfp_t gfp); 3485 gfp_t gfp);
3351 3486
3352 3487
@@ -3536,7 +3671,6 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3536 * @len: length of the frame 3671 * @len: length of the frame
3537 * @freq: frequency the frame was received on 3672 * @freq: frequency the frame was received on
3538 * @sig_dbm: signal strength in mBm, or 0 if unknown 3673 * @sig_dbm: signal strength in mBm, or 0 if unknown
3539 * @gfp: allocation flags
3540 * 3674 *
3541 * Use this function to report to userspace when a beacon was 3675 * Use this function to report to userspace when a beacon was
3542 * received. It is not useful to call this when there is no 3676 * received. It is not useful to call this when there is no
@@ -3544,31 +3678,47 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3544 */ 3678 */
3545void cfg80211_report_obss_beacon(struct wiphy *wiphy, 3679void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3546 const u8 *frame, size_t len, 3680 const u8 *frame, size_t len,
3547 int freq, int sig_dbm, gfp_t gfp); 3681 int freq, int sig_dbm);
3548 3682
3549/** 3683/**
3550 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3684 * cfg80211_reg_can_beacon - check if beaconing is allowed
3551 * @wiphy: the wiphy 3685 * @wiphy: the wiphy
3552 * @chan: main channel 3686 * @chandef: the channel definition
3553 * @channel_type: HT mode
3554 * 3687 *
3555 * This function returns true if there is no secondary channel or the secondary 3688 * This function returns true if there is no secondary channel or the secondary
3556 * channel can be used for beaconing (i.e. is not a radar channel etc.) 3689 * channel(s) can be used for beaconing (i.e. is not a radar channel etc.)
3557 */ 3690 */
3558bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, 3691bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
3559 struct ieee80211_channel *chan, 3692 struct cfg80211_chan_def *chandef);
3560 enum nl80211_channel_type channel_type);
3561 3693
3562/* 3694/*
3563 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 3695 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
3564 * @dev: the device which switched channels 3696 * @dev: the device which switched channels
3565 * @freq: new channel frequency (in MHz) 3697 * @chandef: the new channel definition
3566 * @type: channel type
3567 * 3698 *
3568 * Acquires wdev_lock, so must only be called from sleepable driver context! 3699 * Acquires wdev_lock, so must only be called from sleepable driver context!
3569 */ 3700 */
3570void cfg80211_ch_switch_notify(struct net_device *dev, int freq, 3701void cfg80211_ch_switch_notify(struct net_device *dev,
3571 enum nl80211_channel_type type); 3702 struct cfg80211_chan_def *chandef);
3703
3704/*
3705 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
3706 * @dev: the device on which the operation is requested
3707 * @peer: the MAC address of the peer device
3708 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
3709 * NL80211_TDLS_TEARDOWN)
3710 * @reason_code: the reason code for teardown request
3711 * @gfp: allocation flags
3712 *
3713 * This function is used to request userspace to perform TDLS operation that
3714 * requires knowledge of keys, i.e., link setup or teardown when the AP
3715 * connection uses encryption. This is optional mechanism for the driver to use
3716 * if it can automatically determine when a TDLS link could be useful (e.g.,
3717 * based on traffic and signal strength for a peer).
3718 */
3719void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
3720 enum nl80211_tdls_operation oper,
3721 u16 reason_code, gfp_t gfp);
3572 3722
3573/* 3723/*
3574 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 3724 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
@@ -3594,6 +3744,26 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);
3594 */ 3744 */
3595void cfg80211_unregister_wdev(struct wireless_dev *wdev); 3745void cfg80211_unregister_wdev(struct wireless_dev *wdev);
3596 3746
3747/**
3748 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
3749 * @ies: the input IE buffer
3750 * @len: the input length
3751 * @attr: the attribute ID to find
3752 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
3753 * if the function is only called to get the needed buffer size
3754 * @bufsize: size of the output buffer
3755 *
3756 * The function finds a given P2P attribute in the (vendor) IEs and
3757 * copies its contents to the given buffer.
3758 *
3759 * The return value is a negative error code (-%EILSEQ or -%ENOENT) if
3760 * the data is malformed or the attribute can't be found (respectively),
3761 * or the length of the found attribute (which can be zero).
3762 */
3763int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
3764 enum ieee80211_p2p_attr_id attr,
3765 u8 *buf, unsigned int bufsize);
3766
3597/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3767/* Logging, debugging and troubleshooting/diagnostic helpers. */
3598 3768
3599/* wiphy_printk helpers, similar to dev_printk */ 3769/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index b6a6eeb3905f..2581638f4a3d 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,12 +24,12 @@ struct cgroup_cls_state
24 u32 classid; 24 u32 classid;
25}; 25};
26 26
27extern void sock_update_classid(struct sock *sk); 27extern void sock_update_classid(struct sock *sk, struct task_struct *task);
28 28
29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP) 29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
30static inline u32 task_cls_classid(struct task_struct *p) 30static inline u32 task_cls_classid(struct task_struct *p)
31{ 31{
32 int classid; 32 u32 classid;
33 33
34 if (in_interrupt()) 34 if (in_interrupt())
35 return 0; 35 return 0;
@@ -61,7 +61,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
61} 61}
62#endif 62#endif
63#else /* !CGROUP_NET_CLS_CGROUP */ 63#else /* !CGROUP_NET_CLS_CGROUP */
64static inline void sock_update_classid(struct sock *sk) 64static inline void sock_update_classid(struct sock *sk, struct task_struct *task)
65{ 65{
66} 66}
67 67
diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h
index 4fd8a4b4b7ee..e5062c955ea6 100644
--- a/include/net/gro_cells.h
+++ b/include/net/gro_cells.h
@@ -17,7 +17,6 @@ struct gro_cells {
17 17
18static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb) 18static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
19{ 19{
20 unsigned long flags;
21 struct gro_cell *cell = gcells->cells; 20 struct gro_cell *cell = gcells->cells;
22 struct net_device *dev = skb->dev; 21 struct net_device *dev = skb->dev;
23 22
@@ -35,32 +34,37 @@ static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *s
35 return; 34 return;
36 } 35 }
37 36
38 spin_lock_irqsave(&cell->napi_skbs.lock, flags); 37 /* We run in BH context */
38 spin_lock(&cell->napi_skbs.lock);
39 39
40 __skb_queue_tail(&cell->napi_skbs, skb); 40 __skb_queue_tail(&cell->napi_skbs, skb);
41 if (skb_queue_len(&cell->napi_skbs) == 1) 41 if (skb_queue_len(&cell->napi_skbs) == 1)
42 napi_schedule(&cell->napi); 42 napi_schedule(&cell->napi);
43 43
44 spin_unlock_irqrestore(&cell->napi_skbs.lock, flags); 44 spin_unlock(&cell->napi_skbs.lock);
45} 45}
46 46
47/* called unser BH context */
47static inline int gro_cell_poll(struct napi_struct *napi, int budget) 48static inline int gro_cell_poll(struct napi_struct *napi, int budget)
48{ 49{
49 struct gro_cell *cell = container_of(napi, struct gro_cell, napi); 50 struct gro_cell *cell = container_of(napi, struct gro_cell, napi);
50 struct sk_buff *skb; 51 struct sk_buff *skb;
51 int work_done = 0; 52 int work_done = 0;
52 53
54 spin_lock(&cell->napi_skbs.lock);
53 while (work_done < budget) { 55 while (work_done < budget) {
54 skb = skb_dequeue(&cell->napi_skbs); 56 skb = __skb_dequeue(&cell->napi_skbs);
55 if (!skb) 57 if (!skb)
56 break; 58 break;
57 59 spin_unlock(&cell->napi_skbs.lock);
58 napi_gro_receive(napi, skb); 60 napi_gro_receive(napi, skb);
59 work_done++; 61 work_done++;
62 spin_lock(&cell->napi_skbs.lock);
60 } 63 }
61 64
62 if (work_done < budget) 65 if (work_done < budget)
63 napi_complete(napi); 66 napi_complete(napi);
67 spin_unlock(&cell->napi_skbs.lock);
64 return work_done; 68 return work_done;
65} 69}
66 70
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 7f0df133d119..c3999632e616 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -186,6 +186,10 @@ struct ieee80211_radiotap_header {
186 * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless 186 * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless
187 * 187 *
188 * Contains the AMPDU information for the subframe. 188 * Contains the AMPDU information for the subframe.
189 *
190 * IEEE80211_RADIOTAP_VHT u16, u8, u8, u8[4], u8, u8, u16
191 *
192 * Contains VHT information about this frame.
189 */ 193 */
190enum ieee80211_radiotap_type { 194enum ieee80211_radiotap_type {
191 IEEE80211_RADIOTAP_TSFT = 0, 195 IEEE80211_RADIOTAP_TSFT = 0,
@@ -209,6 +213,7 @@ enum ieee80211_radiotap_type {
209 213
210 IEEE80211_RADIOTAP_MCS = 19, 214 IEEE80211_RADIOTAP_MCS = 19,
211 IEEE80211_RADIOTAP_AMPDU_STATUS = 20, 215 IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
216 IEEE80211_RADIOTAP_VHT = 21,
212 217
213 /* valid in every it_present bitmap, even vendor namespaces */ 218 /* valid in every it_present bitmap, even vendor namespaces */
214 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, 219 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
@@ -282,6 +287,25 @@ enum ieee80211_radiotap_type {
282#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 287#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010
283#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020 288#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020
284 289
290/* For IEEE80211_RADIOTAP_VHT */
291#define IEEE80211_RADIOTAP_VHT_KNOWN_STBC 0x0001
292#define IEEE80211_RADIOTAP_VHT_KNOWN_TXOP_PS_NA 0x0002
293#define IEEE80211_RADIOTAP_VHT_KNOWN_GI 0x0004
294#define IEEE80211_RADIOTAP_VHT_KNOWN_SGI_NSYM_DIS 0x0008
295#define IEEE80211_RADIOTAP_VHT_KNOWN_LDPC_EXTRA_OFDM_SYM 0x0010
296#define IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED 0x0020
297#define IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH 0x0040
298#define IEEE80211_RADIOTAP_VHT_KNOWN_GROUP_ID 0x0080
299#define IEEE80211_RADIOTAP_VHT_KNOWN_PARTIAL_AID 0x0100
300
301#define IEEE80211_RADIOTAP_VHT_FLAG_STBC 0x01
302#define IEEE80211_RADIOTAP_VHT_FLAG_TXOP_PS_NA 0x02
303#define IEEE80211_RADIOTAP_VHT_FLAG_SGI 0x04
304#define IEEE80211_RADIOTAP_VHT_FLAG_SGI_NSYM_M10_9 0x08
305#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10
306#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20
307
308
285/* helpers */ 309/* helpers */
286static inline int ieee80211_get_radiotap_len(unsigned char *data) 310static inline int ieee80211_get_radiotap_len(unsigned char *data)
287{ 311{
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index ba1d3615acbb..183292722f6e 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -318,6 +318,7 @@ extern void inet_csk_reqsk_queue_prune(struct sock *parent,
318 const unsigned long max_rto); 318 const unsigned long max_rto);
319 319
320extern void inet_csk_destroy_sock(struct sock *sk); 320extern void inet_csk_destroy_sock(struct sock *sk);
321extern void inet_csk_prepare_forced_close(struct sock *sk);
321 322
322/* 323/*
323 * LISTEN is a special case for poll.. 324 * LISTEN is a special case for poll..
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 54be0287eb98..67a8fa098e3a 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -277,7 +277,6 @@ static inline struct sock *inet_lookup_listener(struct net *net,
277 On 64bit targets we combine comparisons with pair of adjacent __be32 277 On 64bit targets we combine comparisons with pair of adjacent __be32
278 fields in the same way. 278 fields in the same way.
279*/ 279*/
280typedef __u32 __bitwise __portpair;
281#ifdef __BIG_ENDIAN 280#ifdef __BIG_ENDIAN
282#define INET_COMBINED_PORTS(__sport, __dport) \ 281#define INET_COMBINED_PORTS(__sport, __dport) \
283 ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport))) 282 ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
@@ -287,7 +286,6 @@ typedef __u32 __bitwise __portpair;
287#endif 286#endif
288 287
289#if (BITS_PER_LONG == 64) 288#if (BITS_PER_LONG == 64)
290typedef __u64 __bitwise __addrpair;
291#ifdef __BIG_ENDIAN 289#ifdef __BIG_ENDIAN
292#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 290#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
293 const __addrpair __name = (__force __addrpair) ( \ 291 const __addrpair __name = (__force __addrpair) ( \
@@ -299,30 +297,34 @@ typedef __u64 __bitwise __addrpair;
299 (((__force __u64)(__be32)(__daddr)) << 32) | \ 297 (((__force __u64)(__be32)(__daddr)) << 32) | \
300 ((__force __u64)(__be32)(__saddr))); 298 ((__force __u64)(__be32)(__saddr)));
301#endif /* __BIG_ENDIAN */ 299#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 300#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
303 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 301 ((inet_sk(__sk)->inet_portpair == (__ports)) && \
304 ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie)) && \ 302 (inet_sk(__sk)->inet_addrpair == (__cookie)) && \
305 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ 303 (!(__sk)->sk_bound_dev_if || \
306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 304 ((__sk)->sk_bound_dev_if == (__dif))) && \
307#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 305 net_eq(sock_net(__sk), (__net)))
308 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 306#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif)\
309 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 307 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
310 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 308 (inet_twsk(__sk)->tw_addrpair == (__cookie)) && \
311 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 309 (!(__sk)->sk_bound_dev_if || \
310 ((__sk)->sk_bound_dev_if == (__dif))) && \
311 net_eq(sock_net(__sk), (__net)))
312#else /* 32-bit arch */ 312#else /* 32-bit arch */
313#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 313#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
314#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 314#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
315 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 315 ((inet_sk(__sk)->inet_portpair == (__ports)) && \
316 (inet_sk(__sk)->inet_daddr == (__saddr)) && \ 316 (inet_sk(__sk)->inet_daddr == (__saddr)) && \
317 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ 317 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \
318 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ 318 (!(__sk)->sk_bound_dev_if || \
319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 319 ((__sk)->sk_bound_dev_if == (__dif))) && \
320#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 320 net_eq(sock_net(__sk), (__net)))
321 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 321#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
322 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 322 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
323 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 323 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
324 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 324 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 325 (!(__sk)->sk_bound_dev_if || \
326 ((__sk)->sk_bound_dev_if == (__dif))) && \
327 net_eq(sock_net(__sk), (__net)))
326#endif /* 64-bit arch */ 328#endif /* 64-bit arch */
327 329
328/* 330/*
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 256c1ed2d69a..a4196cbc84ec 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -144,9 +144,11 @@ struct inet_sock {
144 /* Socket demultiplex comparisons on incoming packets. */ 144 /* Socket demultiplex comparisons on incoming packets. */
145#define inet_daddr sk.__sk_common.skc_daddr 145#define inet_daddr sk.__sk_common.skc_daddr
146#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr 146#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
147#define inet_addrpair sk.__sk_common.skc_addrpair
148#define inet_dport sk.__sk_common.skc_dport
149#define inet_num sk.__sk_common.skc_num
150#define inet_portpair sk.__sk_common.skc_portpair
147 151
148 __be16 inet_dport;
149 __u16 inet_num;
150 __be32 inet_saddr; 152 __be32 inet_saddr;
151 __s16 uc_ttl; 153 __s16 uc_ttl;
152 __u16 cmsg_flags; 154 __u16 cmsg_flags;
@@ -154,6 +156,7 @@ struct inet_sock {
154 __u16 inet_id; 156 __u16 inet_id;
155 157
156 struct ip_options_rcu __rcu *inet_opt; 158 struct ip_options_rcu __rcu *inet_opt;
159 int rx_dst_ifindex;
157 __u8 tos; 160 __u8 tos;
158 __u8 min_ttl; 161 __u8 min_ttl;
159 __u8 mc_ttl; 162 __u8 mc_ttl;
@@ -170,7 +173,6 @@ struct inet_sock {
170 int uc_index; 173 int uc_index;
171 int mc_index; 174 int mc_index;
172 __be32 mc_addr; 175 __be32 mc_addr;
173 int rx_dst_ifindex;
174 struct ip_mc_socklist __rcu *mc_list; 176 struct ip_mc_socklist __rcu *mc_list;
175 struct inet_cork_full cork; 177 struct inet_cork_full cork;
176}; 178};
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index ba52c830a7a5..7d658d577368 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -112,6 +112,11 @@ struct inet_timewait_sock {
112#define tw_net __tw_common.skc_net 112#define tw_net __tw_common.skc_net
113#define tw_daddr __tw_common.skc_daddr 113#define tw_daddr __tw_common.skc_daddr
114#define tw_rcv_saddr __tw_common.skc_rcv_saddr 114#define tw_rcv_saddr __tw_common.skc_rcv_saddr
115#define tw_addrpair __tw_common.skc_addrpair
116#define tw_dport __tw_common.skc_dport
117#define tw_num __tw_common.skc_num
118#define tw_portpair __tw_common.skc_portpair
119
115 int tw_timeout; 120 int tw_timeout;
116 volatile unsigned char tw_substate; 121 volatile unsigned char tw_substate;
117 unsigned char tw_rcv_wscale; 122 unsigned char tw_rcv_wscale;
@@ -119,8 +124,6 @@ struct inet_timewait_sock {
119 /* Socket demultiplex comparisons on incoming packets. */ 124 /* Socket demultiplex comparisons on incoming packets. */
120 /* these three are in inet_sock */ 125 /* these three are in inet_sock */
121 __be16 tw_sport; 126 __be16 tw_sport;
122 __be16 tw_dport;
123 __u16 tw_num;
124 kmemcheck_bitfield_begin(flags); 127 kmemcheck_bitfield_begin(flags);
125 /* And these are ours. */ 128 /* And these are ours. */
126 unsigned int tw_ipv6only : 1, 129 unsigned int tw_ipv6only : 1,
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index bc1b0fda2b04..652d3d309357 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -31,6 +31,8 @@
31#include <net/ip.h> 31#include <net/ip.h>
32#include <asm/checksum.h> 32#include <asm/checksum.h>
33#include <linux/in6.h> 33#include <linux/in6.h>
34#include <linux/tcp.h>
35#include <linux/ipv6.h>
34 36
35#ifndef _HAVE_ARCH_IPV6_CSUM 37#ifndef _HAVE_ARCH_IPV6_CSUM
36 38
@@ -91,4 +93,37 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
91} 93}
92 94
93#endif 95#endif
96
97static __inline__ __sum16 tcp_v6_check(int len,
98 const struct in6_addr *saddr,
99 const struct in6_addr *daddr,
100 __wsum base)
101{
102 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
103}
104
105static inline void __tcp_v6_send_check(struct sk_buff *skb,
106 const struct in6_addr *saddr,
107 const struct in6_addr *daddr)
108{
109 struct tcphdr *th = tcp_hdr(skb);
110
111 if (skb->ip_summed == CHECKSUM_PARTIAL) {
112 th->check = ~tcp_v6_check(skb->len, saddr, daddr, 0);
113 skb->csum_start = skb_transport_header(skb) - skb->head;
114 skb->csum_offset = offsetof(struct tcphdr, check);
115 } else {
116 th->check = tcp_v6_check(skb->len, saddr, daddr,
117 csum_partial(th, th->doff << 2,
118 skb->csum));
119 }
120}
121
122static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
123{
124 struct ipv6_pinfo *np = inet6_sk(sk);
125
126 __tcp_v6_send_check(skb, &np->saddr, &np->daddr);
127}
128
94#endif 129#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 8a2a203eb15d..fdc48a94a063 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -47,6 +47,8 @@ struct fib6_config {
47 unsigned long fc_expires; 47 unsigned long fc_expires;
48 struct nlattr *fc_mx; 48 struct nlattr *fc_mx;
49 int fc_mx_len; 49 int fc_mx_len;
50 int fc_mp_len;
51 struct nlattr *fc_mp;
50 52
51 struct nl_info fc_nlinfo; 53 struct nl_info fc_nlinfo;
52}; 54};
@@ -99,6 +101,14 @@ struct rt6_info {
99 101
100 struct in6_addr rt6i_gateway; 102 struct in6_addr rt6i_gateway;
101 103
104 /* Multipath routes:
105 * siblings is a list of rt6_info that have the the same metric/weight,
106 * destination, but not the same gateway. nsiblings is just a cache
107 * to speed up lookup.
108 */
109 struct list_head rt6i_siblings;
110 unsigned int rt6i_nsiblings;
111
102 atomic_t rt6i_ref; 112 atomic_t rt6i_ref;
103 113
104 /* These are in a separate cache line. */ 114 /* These are in a separate cache line. */
@@ -107,7 +117,6 @@ struct rt6_info {
107 struct rt6key rt6i_src; 117 struct rt6key rt6i_src;
108 struct rt6key rt6i_prefsrc; 118 struct rt6key rt6i_prefsrc;
109 u32 rt6i_metric; 119 u32 rt6i_metric;
110 u32 rt6i_peer_genid;
111 120
112 struct inet6_dev *rt6i_idev; 121 struct inet6_dev *rt6i_idev;
113 unsigned long _rt6i_peer; 122 unsigned long _rt6i_peer;
@@ -203,6 +212,15 @@ static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
203 dst_hold(new); 212 dst_hold(new);
204} 213}
205 214
215static inline void ip6_rt_put(struct rt6_info *rt)
216{
217 /* dst_release() accepts a NULL parameter.
218 * We rely on dst being first structure in struct rt6_info
219 */
220 BUILD_BUG_ON(offsetof(struct rt6_info, dst) != 0);
221 dst_release(&rt->dst);
222}
223
206struct fib6_walker_t { 224struct fib6_walker_t {
207 struct list_head lh; 225 struct list_head lh;
208 struct fib6_node *root, *node; 226 struct fib6_node *root, *node;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5fa2af00634a..27d83183e615 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -1,9 +1,6 @@
1#ifndef _NET_IP6_ROUTE_H 1#ifndef _NET_IP6_ROUTE_H
2#define _NET_IP6_ROUTE_H 2#define _NET_IP6_ROUTE_H
3 3
4#define IP6_RT_PRIO_USER 1024
5#define IP6_RT_PRIO_ADDRCONF 256
6
7struct route_info { 4struct route_info {
8 __u8 type; 5 __u8 type;
9 __u8 length; 6 __u8 length;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ee75ccdf5188..68c69d54d392 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -22,7 +22,10 @@
22#include <linux/ip.h> 22#include <linux/ip.h>
23#include <linux/ipv6.h> /* for struct ipv6hdr */ 23#include <linux/ipv6.h> /* for struct ipv6hdr */
24#include <net/ipv6.h> 24#include <net/ipv6.h>
25#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 25#if IS_ENABLED(CONFIG_IP_VS_IPV6)
26#include <linux/netfilter_ipv6/ip6_tables.h>
27#endif
28#if IS_ENABLED(CONFIG_NF_CONNTRACK)
26#include <net/netfilter/nf_conntrack.h> 29#include <net/netfilter/nf_conntrack.h>
27#endif 30#endif
28#include <net/net_namespace.h> /* Netw namespace */ 31#include <net/net_namespace.h> /* Netw namespace */
@@ -103,30 +106,117 @@ static inline struct net *seq_file_single_net(struct seq_file *seq)
103/* Connections' size value needed by ip_vs_ctl.c */ 106/* Connections' size value needed by ip_vs_ctl.c */
104extern int ip_vs_conn_tab_size; 107extern int ip_vs_conn_tab_size;
105 108
106
107struct ip_vs_iphdr { 109struct ip_vs_iphdr {
108 int len; 110 __u32 len; /* IPv4 simply where L4 starts
109 __u8 protocol; 111 IPv6 where L4 Transport Header starts */
112 __u32 thoff_reasm; /* Transport Header Offset in nfct_reasm skb */
113 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
114 __s16 protocol;
115 __s32 flags;
110 union nf_inet_addr saddr; 116 union nf_inet_addr saddr;
111 union nf_inet_addr daddr; 117 union nf_inet_addr daddr;
112}; 118};
113 119
120/* Dependency to module: nf_defrag_ipv6 */
121#if defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
122static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
123{
124 return skb->nfct_reasm;
125}
126static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
127 int len, void *buffer,
128 const struct ip_vs_iphdr *ipvsh)
129{
130 if (unlikely(ipvsh->fragoffs && skb_nfct_reasm(skb)))
131 return skb_header_pointer(skb_nfct_reasm(skb),
132 ipvsh->thoff_reasm, len, buffer);
133
134 return skb_header_pointer(skb, offset, len, buffer);
135}
136#else
137static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
138{
139 return NULL;
140}
141static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
142 int len, void *buffer,
143 const struct ip_vs_iphdr *ipvsh)
144{
145 return skb_header_pointer(skb, offset, len, buffer);
146}
147#endif
148
114static inline void 149static inline void
115ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr) 150ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr)
151{
152 const struct iphdr *iph = nh;
153
154 iphdr->len = iph->ihl * 4;
155 iphdr->fragoffs = 0;
156 iphdr->protocol = iph->protocol;
157 iphdr->saddr.ip = iph->saddr;
158 iphdr->daddr.ip = iph->daddr;
159}
160
161/* This function handles filling *ip_vs_iphdr, both for IPv4 and IPv6.
162 * IPv6 requires some extra work, as finding proper header position,
163 * depend on the IPv6 extension headers.
164 */
165static inline void
166ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
116{ 167{
117#ifdef CONFIG_IP_VS_IPV6 168#ifdef CONFIG_IP_VS_IPV6
118 if (af == AF_INET6) { 169 if (af == AF_INET6) {
119 const struct ipv6hdr *iph = nh; 170 const struct ipv6hdr *iph =
120 iphdr->len = sizeof(struct ipv6hdr); 171 (struct ipv6hdr *)skb_network_header(skb);
121 iphdr->protocol = iph->nexthdr;
122 iphdr->saddr.in6 = iph->saddr; 172 iphdr->saddr.in6 = iph->saddr;
123 iphdr->daddr.in6 = iph->daddr; 173 iphdr->daddr.in6 = iph->daddr;
174 /* ipv6_find_hdr() updates len, flags, thoff_reasm */
175 iphdr->thoff_reasm = 0;
176 iphdr->len = 0;
177 iphdr->flags = 0;
178 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
179 &iphdr->fragoffs,
180 &iphdr->flags);
181 /* get proto from re-assembled packet and it's offset */
182 if (skb_nfct_reasm(skb))
183 iphdr->protocol = ipv6_find_hdr(skb_nfct_reasm(skb),
184 &iphdr->thoff_reasm,
185 -1, NULL, NULL);
186
124 } else 187 } else
125#endif 188#endif
126 { 189 {
127 const struct iphdr *iph = nh; 190 const struct iphdr *iph =
128 iphdr->len = iph->ihl * 4; 191 (struct iphdr *)skb_network_header(skb);
129 iphdr->protocol = iph->protocol; 192 iphdr->len = iph->ihl * 4;
193 iphdr->fragoffs = 0;
194 iphdr->protocol = iph->protocol;
195 iphdr->saddr.ip = iph->saddr;
196 iphdr->daddr.ip = iph->daddr;
197 }
198}
199
200/* This function is a faster version of ip_vs_fill_iph_skb().
201 * Where we only populate {s,d}addr (and avoid calling ipv6_find_hdr()).
202 * This is used by the some of the ip_vs_*_schedule() functions.
203 * (Mostly done to avoid ABI breakage of external schedulers)
204 */
205static inline void
206ip_vs_fill_iph_addr_only(int af, const struct sk_buff *skb,
207 struct ip_vs_iphdr *iphdr)
208{
209#ifdef CONFIG_IP_VS_IPV6
210 if (af == AF_INET6) {
211 const struct ipv6hdr *iph =
212 (struct ipv6hdr *)skb_network_header(skb);
213 iphdr->saddr.in6 = iph->saddr;
214 iphdr->daddr.in6 = iph->daddr;
215 } else
216#endif
217 {
218 const struct iphdr *iph =
219 (struct iphdr *)skb_network_header(skb);
130 iphdr->saddr.ip = iph->saddr; 220 iphdr->saddr.ip = iph->saddr;
131 iphdr->daddr.ip = iph->daddr; 221 iphdr->daddr.ip = iph->daddr;
132 } 222 }
@@ -165,7 +255,7 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
165 int len; 255 int len;
166#ifdef CONFIG_IP_VS_IPV6 256#ifdef CONFIG_IP_VS_IPV6
167 if (af == AF_INET6) 257 if (af == AF_INET6)
168 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6]", 258 len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6c]",
169 &addr->in6) + 1; 259 &addr->in6) + 1;
170 else 260 else
171#endif 261#endif
@@ -398,27 +488,26 @@ struct ip_vs_protocol {
398 488
399 int (*conn_schedule)(int af, struct sk_buff *skb, 489 int (*conn_schedule)(int af, struct sk_buff *skb,
400 struct ip_vs_proto_data *pd, 490 struct ip_vs_proto_data *pd,
401 int *verdict, struct ip_vs_conn **cpp); 491 int *verdict, struct ip_vs_conn **cpp,
492 struct ip_vs_iphdr *iph);
402 493
403 struct ip_vs_conn * 494 struct ip_vs_conn *
404 (*conn_in_get)(int af, 495 (*conn_in_get)(int af,
405 const struct sk_buff *skb, 496 const struct sk_buff *skb,
406 const struct ip_vs_iphdr *iph, 497 const struct ip_vs_iphdr *iph,
407 unsigned int proto_off,
408 int inverse); 498 int inverse);
409 499
410 struct ip_vs_conn * 500 struct ip_vs_conn *
411 (*conn_out_get)(int af, 501 (*conn_out_get)(int af,
412 const struct sk_buff *skb, 502 const struct sk_buff *skb,
413 const struct ip_vs_iphdr *iph, 503 const struct ip_vs_iphdr *iph,
414 unsigned int proto_off,
415 int inverse); 504 int inverse);
416 505
417 int (*snat_handler)(struct sk_buff *skb, 506 int (*snat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
418 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 507 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph);
419 508
420 int (*dnat_handler)(struct sk_buff *skb, 509 int (*dnat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
421 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 510 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph);
422 511
423 int (*csum_check)(int af, struct sk_buff *skb, 512 int (*csum_check)(int af, struct sk_buff *skb,
424 struct ip_vs_protocol *pp); 513 struct ip_vs_protocol *pp);
@@ -518,7 +607,7 @@ struct ip_vs_conn {
518 NF_ACCEPT can be returned when destination is local. 607 NF_ACCEPT can be returned when destination is local.
519 */ 608 */
520 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, 609 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
521 struct ip_vs_protocol *pp); 610 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
522 611
523 /* Note: we can group the following members into a structure, 612 /* Note: we can group the following members into a structure,
524 in order to save more space, and the following members are 613 in order to save more space, and the following members are
@@ -769,13 +858,11 @@ struct ip_vs_app {
769 858
770 struct ip_vs_conn * 859 struct ip_vs_conn *
771 (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app, 860 (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app,
772 const struct iphdr *iph, unsigned int proto_off, 861 const struct iphdr *iph, int inverse);
773 int inverse);
774 862
775 struct ip_vs_conn * 863 struct ip_vs_conn *
776 (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app, 864 (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app,
777 const struct iphdr *iph, unsigned int proto_off, 865 const struct iphdr *iph, int inverse);
778 int inverse);
779 866
780 int (*state_transition)(struct ip_vs_conn *cp, int direction, 867 int (*state_transition)(struct ip_vs_conn *cp, int direction,
781 const struct sk_buff *skb, 868 const struct sk_buff *skb,
@@ -1074,14 +1161,12 @@ struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
1074 1161
1075struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, 1162struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
1076 const struct ip_vs_iphdr *iph, 1163 const struct ip_vs_iphdr *iph,
1077 unsigned int proto_off,
1078 int inverse); 1164 int inverse);
1079 1165
1080struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); 1166struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
1081 1167
1082struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, 1168struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
1083 const struct ip_vs_iphdr *iph, 1169 const struct ip_vs_iphdr *iph,
1084 unsigned int proto_off,
1085 int inverse); 1170 int inverse);
1086 1171
1087/* put back the conn without restarting its timer */ 1172/* put back the conn without restarting its timer */
@@ -1254,9 +1339,10 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1254extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1339extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1255extern struct ip_vs_conn * 1340extern struct ip_vs_conn *
1256ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1341ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1257 struct ip_vs_proto_data *pd, int *ignored); 1342 struct ip_vs_proto_data *pd, int *ignored,
1343 struct ip_vs_iphdr *iph);
1258extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1344extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1259 struct ip_vs_proto_data *pd); 1345 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1260 1346
1261extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1347extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1262 1348
@@ -1315,33 +1401,38 @@ extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1315/* 1401/*
1316 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1402 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1317 */ 1403 */
1318extern int ip_vs_null_xmit 1404extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1319(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1405 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1320extern int ip_vs_bypass_xmit 1406extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1321(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1407 struct ip_vs_protocol *pp,
1322extern int ip_vs_nat_xmit 1408 struct ip_vs_iphdr *iph);
1323(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1409extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1324extern int ip_vs_tunnel_xmit 1410 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1325(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1411extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1326extern int ip_vs_dr_xmit 1412 struct ip_vs_protocol *pp,
1327(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1413 struct ip_vs_iphdr *iph);
1328extern int ip_vs_icmp_xmit 1414extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1329(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, 1415 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1330 int offset, unsigned int hooknum); 1416extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1417 struct ip_vs_protocol *pp, int offset,
1418 unsigned int hooknum, struct ip_vs_iphdr *iph);
1331extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 1419extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
1332 1420
1333#ifdef CONFIG_IP_VS_IPV6 1421#ifdef CONFIG_IP_VS_IPV6
1334extern int ip_vs_bypass_xmit_v6 1422extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1335(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1423 struct ip_vs_protocol *pp,
1336extern int ip_vs_nat_xmit_v6 1424 struct ip_vs_iphdr *iph);
1337(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1425extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1338extern int ip_vs_tunnel_xmit_v6 1426 struct ip_vs_protocol *pp,
1339(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1427 struct ip_vs_iphdr *iph);
1340extern int ip_vs_dr_xmit_v6 1428extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1341(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1429 struct ip_vs_protocol *pp,
1342extern int ip_vs_icmp_xmit_v6 1430 struct ip_vs_iphdr *iph);
1343(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, 1431extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1344 int offset, unsigned int hooknum); 1432 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1433extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1434 struct ip_vs_protocol *pp, int offset,
1435 unsigned int hooknum, struct ip_vs_iphdr *iph);
1345#endif 1436#endif
1346 1437
1347#ifdef CONFIG_SYSCTL 1438#ifdef CONFIG_SYSCTL
diff --git a/include/net/ipip.h b/include/net/ipip.h
index ddc077c51f32..21947cf4fa46 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -48,25 +48,27 @@ struct ip_tunnel_prl_entry {
48 struct rcu_head rcu_head; 48 struct rcu_head rcu_head;
49}; 49};
50 50
51#define __IPTUNNEL_XMIT(stats1, stats2) do { \ 51static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
52 int err; \ 52{
53 int pkt_len = skb->len - skb_transport_offset(skb); \ 53 int err;
54 \ 54 struct iphdr *iph = ip_hdr(skb);
55 skb->ip_summed = CHECKSUM_NONE; \ 55 int pkt_len = skb->len - skb_transport_offset(skb);
56 ip_select_ident(iph, &rt->dst, NULL); \ 56 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
57 \
58 err = ip_local_out(skb); \
59 if (likely(net_xmit_eval(err) == 0)) { \
60 u64_stats_update_begin(&(stats1)->syncp); \
61 (stats1)->tx_bytes += pkt_len; \
62 (stats1)->tx_packets++; \
63 u64_stats_update_end(&(stats1)->syncp); \
64 } else { \
65 (stats2)->tx_errors++; \
66 (stats2)->tx_aborted_errors++; \
67 } \
68} while (0)
69 57
70#define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats) 58 nf_reset(skb);
59 skb->ip_summed = CHECKSUM_NONE;
60 ip_select_ident(iph, skb_dst(skb), NULL);
61
62 err = ip_local_out(skb);
63 if (likely(net_xmit_eval(err) == 0)) {
64 u64_stats_update_begin(&tstats->syncp);
65 tstats->tx_bytes += pkt_len;
66 tstats->tx_packets++;
67 u64_stats_update_end(&tstats->syncp);
68 } else {
69 dev->stats.tx_errors++;
70 dev->stats.tx_aborted_errors++;
71 }
72}
71 73
72#endif 74#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 979bf6c13141..5af66b26ebdd 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -271,6 +271,15 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
271 271
272extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 272extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
273 273
274static inline bool ipv6_accept_ra(struct inet6_dev *idev)
275{
276 /* If forwarding is enabled, RA are not accepted unless the special
277 * hybrid mode (accept_ra=2) is enabled.
278 */
279 return idev->cnf.forwarding ? idev->cnf.accept_ra == 2 :
280 idev->cnf.accept_ra;
281}
282
274#if IS_ENABLED(CONFIG_IPV6) 283#if IS_ENABLED(CONFIG_IPV6)
275static inline int ip6_frag_nqueues(struct net *net) 284static inline int ip6_frag_nqueues(struct net *net)
276{ 285{
@@ -630,6 +639,16 @@ extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
630 639
631extern bool ipv6_ext_hdr(u8 nexthdr); 640extern bool ipv6_ext_hdr(u8 nexthdr);
632 641
642enum {
643 IP6_FH_F_FRAG = (1 << 0),
644 IP6_FH_F_AUTH = (1 << 1),
645 IP6_FH_F_SKIP_RH = (1 << 2),
646};
647
648/* find specified header and get offset to it */
649extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
650 int target, unsigned short *fragoff, int *fragflg);
651
633extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 652extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
634 653
635extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, 654extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index fff11b7fe8a4..591f78631f13 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -134,7 +134,7 @@ typedef struct {
134} CACHE_ENTRY; 134} CACHE_ENTRY;
135 135
136/* 136/*
137 * Information about each registred IrLAP layer 137 * Information about each registered IrLAP layer
138 */ 138 */
139struct lap_cb { 139struct lap_cb {
140 irda_queue_t queue; /* Must be first */ 140 irda_queue_t queue; /* Must be first */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 82558c8decf8..ee50c5eba50c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -144,6 +144,39 @@ struct ieee80211_low_level_stats {
144}; 144};
145 145
146/** 146/**
147 * enum ieee80211_chanctx_change - change flag for channel context
148 * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
149 * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
150 */
151enum ieee80211_chanctx_change {
152 IEEE80211_CHANCTX_CHANGE_WIDTH = BIT(0),
153 IEEE80211_CHANCTX_CHANGE_RX_CHAINS = BIT(1),
154};
155
156/**
157 * struct ieee80211_chanctx_conf - channel context that vifs may be tuned to
158 *
159 * This is the driver-visible part. The ieee80211_chanctx
160 * that contains it is visible in mac80211 only.
161 *
162 * @def: the channel definition
163 * @rx_chains_static: The number of RX chains that must always be
164 * active on the channel to receive MIMO transmissions
165 * @rx_chains_dynamic: The number of RX chains that must be enabled
166 * after RTS/CTS handshake to receive SMPS MIMO transmissions;
167 * this will always be >= @rx_chains_static.
168 * @drv_priv: data area for driver use, will always be aligned to
169 * sizeof(void *), size is determined in hw information.
170 */
171struct ieee80211_chanctx_conf {
172 struct cfg80211_chan_def def;
173
174 u8 rx_chains_static, rx_chains_dynamic;
175
176 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
177};
178
179/**
147 * enum ieee80211_bss_change - BSS change notification flags 180 * enum ieee80211_bss_change - BSS change notification flags
148 * 181 *
149 * These flags are used with the bss_info_changed() callback 182 * These flags are used with the bss_info_changed() callback
@@ -172,6 +205,9 @@ struct ieee80211_low_level_stats {
172 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 205 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)
173 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) 206 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
174 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) 207 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
208 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
209 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
210 * changed (currently only in P2P client mode, GO mode will be later)
175 */ 211 */
176enum ieee80211_bss_change { 212enum ieee80211_bss_change {
177 BSS_CHANGED_ASSOC = 1<<0, 213 BSS_CHANGED_ASSOC = 1<<0,
@@ -192,6 +228,8 @@ enum ieee80211_bss_change {
192 BSS_CHANGED_SSID = 1<<15, 228 BSS_CHANGED_SSID = 1<<15,
193 BSS_CHANGED_AP_PROBE_RESP = 1<<16, 229 BSS_CHANGED_AP_PROBE_RESP = 1<<16,
194 BSS_CHANGED_PS = 1<<17, 230 BSS_CHANGED_PS = 1<<17,
231 BSS_CHANGED_TXPOWER = 1<<18,
232 BSS_CHANGED_P2P_PS = 1<<19,
195 233
196 /* when adding here, make sure to change ieee80211_reconfig */ 234 /* when adding here, make sure to change ieee80211_reconfig */
197}; 235};
@@ -223,6 +261,7 @@ enum ieee80211_rssi_event {
223 * @assoc: association status 261 * @assoc: association status
224 * @ibss_joined: indicates whether this station is part of an IBSS 262 * @ibss_joined: indicates whether this station is part of an IBSS
225 * or not 263 * or not
264 * @ibss_creator: indicates if a new IBSS network is being created
226 * @aid: association ID number, valid only when @assoc is true 265 * @aid: association ID number, valid only when @assoc is true
227 * @use_cts_prot: use CTS protection 266 * @use_cts_prot: use CTS protection
228 * @use_short_preamble: use 802.11b short preamble; 267 * @use_short_preamble: use 802.11b short preamble;
@@ -247,9 +286,8 @@ enum ieee80211_rssi_event {
247 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 286 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
248 * @bssid: The BSSID for this BSS 287 * @bssid: The BSSID for this BSS
249 * @enable_beacon: whether beaconing should be enabled or not 288 * @enable_beacon: whether beaconing should be enabled or not
250 * @channel_type: Channel type for this BSS -- the hardware might be 289 * @chandef: Channel definition for this BSS -- the hardware might be
251 * configured for HT40+ while this BSS only uses no-HT, for 290 * configured a higher bandwidth than this BSS uses, for example.
252 * example.
253 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation. 291 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
254 * This field is only valid when the channel type is one of the HT types. 292 * This field is only valid when the channel type is one of the HT types.
255 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value 293 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
@@ -273,11 +311,15 @@ enum ieee80211_rssi_event {
273 * @ssid: The SSID of the current vif. Only valid in AP-mode. 311 * @ssid: The SSID of the current vif. Only valid in AP-mode.
274 * @ssid_len: Length of SSID given in @ssid. 312 * @ssid_len: Length of SSID given in @ssid.
275 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. 313 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
314 * @txpower: TX power in dBm
315 * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces
316 * @p2p_oppps: P2P opportunistic PS is enabled
276 */ 317 */
277struct ieee80211_bss_conf { 318struct ieee80211_bss_conf {
278 const u8 *bssid; 319 const u8 *bssid;
279 /* association related data */ 320 /* association related data */
280 bool assoc, ibss_joined; 321 bool assoc, ibss_joined;
322 bool ibss_creator;
281 u16 aid; 323 u16 aid;
282 /* erp related data */ 324 /* erp related data */
283 bool use_cts_prot; 325 bool use_cts_prot;
@@ -294,7 +336,7 @@ struct ieee80211_bss_conf {
294 u16 ht_operation_mode; 336 u16 ht_operation_mode;
295 s32 cqm_rssi_thold; 337 s32 cqm_rssi_thold;
296 u32 cqm_rssi_hyst; 338 u32 cqm_rssi_hyst;
297 enum nl80211_channel_type channel_type; 339 struct cfg80211_chan_def chandef;
298 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; 340 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
299 u8 arp_addr_cnt; 341 u8 arp_addr_cnt;
300 bool arp_filter_enabled; 342 bool arp_filter_enabled;
@@ -304,6 +346,9 @@ struct ieee80211_bss_conf {
304 u8 ssid[IEEE80211_MAX_SSID_LEN]; 346 u8 ssid[IEEE80211_MAX_SSID_LEN];
305 size_t ssid_len; 347 size_t ssid_len;
306 bool hidden_ssid; 348 bool hidden_ssid;
349 int txpower;
350 u8 p2p_ctwindow;
351 bool p2p_oppps;
307}; 352};
308 353
309/** 354/**
@@ -454,9 +499,14 @@ enum mac80211_tx_control_flags {
454 * This is set if the current BSS requires ERP protection. 499 * This is set if the current BSS requires ERP protection.
455 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble. 500 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
456 * @IEEE80211_TX_RC_MCS: HT rate. 501 * @IEEE80211_TX_RC_MCS: HT rate.
502 * @IEEE80211_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is split
503 * into a higher 4 bits (Nss) and lower 4 bits (MCS number)
457 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in 504 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
458 * Greenfield mode. 505 * Greenfield mode.
459 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz. 506 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
507 * @IEEE80211_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
508 * @IEEE80211_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
509 * (80+80 isn't supported yet)
460 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the 510 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
461 * adjacent 20 MHz channels, if the current channel type is 511 * adjacent 20 MHz channels, if the current channel type is
462 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS. 512 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
@@ -467,12 +517,15 @@ enum mac80211_rate_control_flags {
467 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 517 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
468 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2), 518 IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2),
469 519
470 /* rate index is an MCS rate number instead of an index */ 520 /* rate index is an HT/VHT MCS instead of an index */
471 IEEE80211_TX_RC_MCS = BIT(3), 521 IEEE80211_TX_RC_MCS = BIT(3),
472 IEEE80211_TX_RC_GREEN_FIELD = BIT(4), 522 IEEE80211_TX_RC_GREEN_FIELD = BIT(4),
473 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5), 523 IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5),
474 IEEE80211_TX_RC_DUP_DATA = BIT(6), 524 IEEE80211_TX_RC_DUP_DATA = BIT(6),
475 IEEE80211_TX_RC_SHORT_GI = BIT(7), 525 IEEE80211_TX_RC_SHORT_GI = BIT(7),
526 IEEE80211_TX_RC_VHT_MCS = BIT(8),
527 IEEE80211_TX_RC_80_MHZ_WIDTH = BIT(9),
528 IEEE80211_TX_RC_160_MHZ_WIDTH = BIT(10),
476}; 529};
477 530
478 531
@@ -515,10 +568,32 @@ enum mac80211_rate_control_flags {
515 */ 568 */
516struct ieee80211_tx_rate { 569struct ieee80211_tx_rate {
517 s8 idx; 570 s8 idx;
518 u8 count; 571 u16 count:5,
519 u8 flags; 572 flags:11;
520} __packed; 573} __packed;
521 574
575#define IEEE80211_MAX_TX_RETRY 31
576
577static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
578 u8 mcs, u8 nss)
579{
580 WARN_ON(mcs & ~0xF);
581 WARN_ON(nss & ~0x7);
582 rate->idx = (nss << 4) | mcs;
583}
584
585static inline u8
586ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
587{
588 return rate->idx & 0xF;
589}
590
591static inline u8
592ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
593{
594 return rate->idx >> 4;
595}
596
522/** 597/**
523 * struct ieee80211_tx_info - skb transmit information 598 * struct ieee80211_tx_info - skb transmit information
524 * 599 *
@@ -663,13 +738,20 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
663 * the frame. 738 * the frame.
664 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on 739 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
665 * the frame. 740 * the frame.
666 * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime 741 * @RX_FLAG_MACTIME_START: The timestamp passed in the RX status (@mactime
667 * field) is valid and contains the time the first symbol of the MPDU 742 * field) is valid and contains the time the first symbol of the MPDU
668 * was received. This is useful in monitor mode and for proper IBSS 743 * was received. This is useful in monitor mode and for proper IBSS
669 * merging. 744 * merging.
745 * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
746 * field) is valid and contains the time the last symbol of the MPDU
747 * (including FCS) was received.
670 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 748 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
671 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 749 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
750 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
672 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 751 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
752 * @RX_FLAG_80MHZ: 80 MHz was used
753 * @RX_FLAG_80P80MHZ: 80+80 MHz was used
754 * @RX_FLAG_160MHZ: 160 MHz was used
673 * @RX_FLAG_SHORT_GI: Short guard interval was used 755 * @RX_FLAG_SHORT_GI: Short guard interval was used
674 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 756 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
675 * Valid only for data frames (mainly A-MPDU) 757 * Valid only for data frames (mainly A-MPDU)
@@ -697,7 +779,7 @@ enum mac80211_rx_flags {
697 RX_FLAG_IV_STRIPPED = BIT(4), 779 RX_FLAG_IV_STRIPPED = BIT(4),
698 RX_FLAG_FAILED_FCS_CRC = BIT(5), 780 RX_FLAG_FAILED_FCS_CRC = BIT(5),
699 RX_FLAG_FAILED_PLCP_CRC = BIT(6), 781 RX_FLAG_FAILED_PLCP_CRC = BIT(6),
700 RX_FLAG_MACTIME_MPDU = BIT(7), 782 RX_FLAG_MACTIME_START = BIT(7),
701 RX_FLAG_SHORTPRE = BIT(8), 783 RX_FLAG_SHORTPRE = BIT(8),
702 RX_FLAG_HT = BIT(9), 784 RX_FLAG_HT = BIT(9),
703 RX_FLAG_40MHZ = BIT(10), 785 RX_FLAG_40MHZ = BIT(10),
@@ -711,6 +793,11 @@ enum mac80211_rx_flags {
711 RX_FLAG_AMPDU_IS_LAST = BIT(18), 793 RX_FLAG_AMPDU_IS_LAST = BIT(18),
712 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), 794 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19),
713 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), 795 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20),
796 RX_FLAG_MACTIME_END = BIT(21),
797 RX_FLAG_VHT = BIT(22),
798 RX_FLAG_80MHZ = BIT(23),
799 RX_FLAG_80P80MHZ = BIT(24),
800 RX_FLAG_160MHZ = BIT(25),
714}; 801};
715 802
716/** 803/**
@@ -731,25 +818,39 @@ enum mac80211_rx_flags {
731 * @IEEE80211_HW_SIGNAL_* 818 * @IEEE80211_HW_SIGNAL_*
732 * @antenna: antenna used 819 * @antenna: antenna used
733 * @rate_idx: index of data rate into band's supported rates or MCS index if 820 * @rate_idx: index of data rate into band's supported rates or MCS index if
734 * HT rates are use (RX_FLAG_HT) 821 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
822 * @vht_nss: number of streams (VHT only)
735 * @flag: %RX_FLAG_* 823 * @flag: %RX_FLAG_*
736 * @rx_flags: internal RX flags for mac80211 824 * @rx_flags: internal RX flags for mac80211
737 * @ampdu_reference: A-MPDU reference number, must be a different value for 825 * @ampdu_reference: A-MPDU reference number, must be a different value for
738 * each A-MPDU but the same for each subframe within one A-MPDU 826 * each A-MPDU but the same for each subframe within one A-MPDU
739 * @ampdu_delimiter_crc: A-MPDU delimiter CRC 827 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
828 * @vendor_radiotap_bitmap: radiotap vendor namespace presence bitmap
829 * @vendor_radiotap_len: radiotap vendor namespace length
830 * @vendor_radiotap_align: radiotap vendor namespace alignment. Note
831 * that the actual data must be at the start of the SKB data
832 * already.
833 * @vendor_radiotap_oui: radiotap vendor namespace OUI
834 * @vendor_radiotap_subns: radiotap vendor sub namespace
740 */ 835 */
741struct ieee80211_rx_status { 836struct ieee80211_rx_status {
742 u64 mactime; 837 u64 mactime;
743 u32 device_timestamp; 838 u32 device_timestamp;
744 u32 ampdu_reference; 839 u32 ampdu_reference;
745 u32 flag; 840 u32 flag;
841 u32 vendor_radiotap_bitmap;
842 u16 vendor_radiotap_len;
746 u16 freq; 843 u16 freq;
747 u8 rate_idx; 844 u8 rate_idx;
845 u8 vht_nss;
748 u8 rx_flags; 846 u8 rx_flags;
749 u8 band; 847 u8 band;
750 u8 antenna; 848 u8 antenna;
751 s8 signal; 849 s8 signal;
752 u8 ampdu_delimiter_crc; 850 u8 ampdu_delimiter_crc;
851 u8 vendor_radiotap_align;
852 u8 vendor_radiotap_oui[3];
853 u8 vendor_radiotap_subns;
753}; 854};
754 855
755/** 856/**
@@ -794,6 +895,8 @@ enum ieee80211_conf_flags {
794 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 895 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
795 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 896 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
796 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed 897 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
898 * Note that this is only valid if channel contexts are not used,
899 * otherwise each channel context has the number of chains listed.
797 */ 900 */
798enum ieee80211_conf_changed { 901enum ieee80211_conf_changed {
799 IEEE80211_CONF_CHANGE_SMPS = BIT(1), 902 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
@@ -845,7 +948,8 @@ enum ieee80211_smps_mode {
845 * powersave documentation below. This variable is valid only when 948 * powersave documentation below. This variable is valid only when
846 * the CONF_PS flag is set. 949 * the CONF_PS flag is set.
847 * 950 *
848 * @power_level: requested transmit power (in dBm) 951 * @power_level: requested transmit power (in dBm), backward compatibility
952 * value only that is set to the minimum of all interfaces
849 * 953 *
850 * @channel: the channel to tune to 954 * @channel: the channel to tune to
851 * @channel_type: the channel (HT) type 955 * @channel_type: the channel (HT) type
@@ -859,7 +963,9 @@ enum ieee80211_smps_mode {
859 * 963 *
860 * @smps_mode: spatial multiplexing powersave mode; note that 964 * @smps_mode: spatial multiplexing powersave mode; note that
861 * %IEEE80211_SMPS_STATIC is used when the device is not 965 * %IEEE80211_SMPS_STATIC is used when the device is not
862 * configured for an HT channel 966 * configured for an HT channel.
967 * Note that this is only valid if channel contexts are not used,
968 * otherwise each channel context has the number of chains listed.
863 */ 969 */
864struct ieee80211_conf { 970struct ieee80211_conf {
865 u32 flags; 971 u32 flags;
@@ -931,6 +1037,11 @@ enum ieee80211_vif_flags {
931 * at runtime, mac80211 will never touch this field 1037 * at runtime, mac80211 will never touch this field
932 * @hw_queue: hardware queue for each AC 1038 * @hw_queue: hardware queue for each AC
933 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only 1039 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
1040 * @chanctx_conf: The channel context this interface is assigned to, or %NULL
1041 * when it is not assigned. This pointer is RCU-protected due to the TX
1042 * path needing to access it; even though the netdev carrier will always
1043 * be off when it is %NULL there can still be races and packets could be
1044 * processed after it switches back to %NULL.
934 * @drv_priv: data area for driver use, will always be aligned to 1045 * @drv_priv: data area for driver use, will always be aligned to
935 * sizeof(void *). 1046 * sizeof(void *).
936 */ 1047 */
@@ -943,6 +1054,8 @@ struct ieee80211_vif {
943 u8 cab_queue; 1054 u8 cab_queue;
944 u8 hw_queue[IEEE80211_NUM_ACS]; 1055 u8 hw_queue[IEEE80211_NUM_ACS];
945 1056
1057 struct ieee80211_chanctx_conf __rcu *chanctx_conf;
1058
946 u32 driver_flags; 1059 u32 driver_flags;
947 1060
948 /* must be last */ 1061 /* must be last */
@@ -1076,6 +1189,8 @@ enum ieee80211_sta_state {
1076 * @aid: AID we assigned to the station if we're an AP 1189 * @aid: AID we assigned to the station if we're an AP
1077 * @supp_rates: Bitmap of supported rates (per band) 1190 * @supp_rates: Bitmap of supported rates (per band)
1078 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities 1191 * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities
1192 * @vht_cap: VHT capabilities of this STA; Not restricting any capabilities
1193 * of remote STA. Taking as is.
1079 * @wme: indicates whether the STA supports WME. Only valid during AP-mode. 1194 * @wme: indicates whether the STA supports WME. Only valid during AP-mode.
1080 * @drv_priv: data area for driver use, will always be aligned to 1195 * @drv_priv: data area for driver use, will always be aligned to
1081 * sizeof(void *), size is determined in hw information. 1196 * sizeof(void *), size is determined in hw information.
@@ -1088,6 +1203,7 @@ struct ieee80211_sta {
1088 u8 addr[ETH_ALEN]; 1203 u8 addr[ETH_ALEN];
1089 u16 aid; 1204 u16 aid;
1090 struct ieee80211_sta_ht_cap ht_cap; 1205 struct ieee80211_sta_ht_cap ht_cap;
1206 struct ieee80211_sta_vht_cap vht_cap;
1091 bool wme; 1207 bool wme;
1092 u8 uapsd_queues; 1208 u8 uapsd_queues;
1093 u8 max_sp; 1209 u8 max_sp;
@@ -1253,6 +1369,10 @@ struct ieee80211_tx_control {
1253 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any 1369 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1254 * P2P Interface. This will be honoured even if more than one interface 1370 * P2P Interface. This will be honoured even if more than one interface
1255 * is supported. 1371 * is supported.
1372 *
1373 * @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session
1374 * should be tear down once BAR frame will not be acked.
1375 *
1256 */ 1376 */
1257enum ieee80211_hw_flags { 1377enum ieee80211_hw_flags {
1258 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1378 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1281,6 +1401,7 @@ enum ieee80211_hw_flags {
1281 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1401 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1282 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, 1402 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1283 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1403 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1404 IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL = 1<<26,
1284}; 1405};
1285 1406
1286/** 1407/**
@@ -1325,6 +1446,8 @@ enum ieee80211_hw_flags {
1325 * within &struct ieee80211_vif. 1446 * within &struct ieee80211_vif.
1326 * @sta_data_size: size (in bytes) of the drv_priv data area 1447 * @sta_data_size: size (in bytes) of the drv_priv data area
1327 * within &struct ieee80211_sta. 1448 * within &struct ieee80211_sta.
1449 * @chanctx_data_size: size (in bytes) of the drv_priv data area
1450 * within &struct ieee80211_chanctx_conf.
1328 * 1451 *
1329 * @max_rates: maximum number of alternate rate retry stages the hw 1452 * @max_rates: maximum number of alternate rate retry stages the hw
1330 * can handle. 1453 * can handle.
@@ -1355,6 +1478,10 @@ enum ieee80211_hw_flags {
1355 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only 1478 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
1356 * adding _BW is supported today. 1479 * adding _BW is supported today.
1357 * 1480 *
1481 * @radiotap_vht_details: lists which VHT MCS information the HW reports,
1482 * the default is _GI | _BANDWIDTH.
1483 * Use the %IEEE80211_RADIOTAP_VHT_KNOWN_* values.
1484 *
1358 * @netdev_features: netdev features to be set in each netdev created 1485 * @netdev_features: netdev features to be set in each netdev created
1359 * from this HW. Note only HW checksum features are currently 1486 * from this HW. Note only HW checksum features are currently
1360 * compatible with mac80211. Other feature bits will be rejected. 1487 * compatible with mac80211. Other feature bits will be rejected.
@@ -1369,6 +1496,7 @@ struct ieee80211_hw {
1369 int channel_change_time; 1496 int channel_change_time;
1370 int vif_data_size; 1497 int vif_data_size;
1371 int sta_data_size; 1498 int sta_data_size;
1499 int chanctx_data_size;
1372 int napi_weight; 1500 int napi_weight;
1373 u16 queues; 1501 u16 queues;
1374 u16 max_listen_interval; 1502 u16 max_listen_interval;
@@ -1380,6 +1508,7 @@ struct ieee80211_hw {
1380 u8 max_tx_aggregation_subframes; 1508 u8 max_tx_aggregation_subframes;
1381 u8 offchannel_tx_hw_queue; 1509 u8 offchannel_tx_hw_queue;
1382 u8 radiotap_mcs_details; 1510 u8 radiotap_mcs_details;
1511 u16 radiotap_vht_details;
1383 netdev_features_t netdev_features; 1512 netdev_features_t netdev_features;
1384}; 1513};
1385 1514
@@ -2126,6 +2255,14 @@ enum ieee80211_rate_control_changed {
2126 * @sta_remove: Notifies low level driver about removal of an associated 2255 * @sta_remove: Notifies low level driver about removal of an associated
2127 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. 2256 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
2128 * 2257 *
2258 * @sta_add_debugfs: Drivers can use this callback to add debugfs files
2259 * when a station is added to mac80211's station list. This callback
2260 * and @sta_remove_debugfs should be within a CONFIG_MAC80211_DEBUGFS
2261 * conditional. This callback can sleep.
2262 *
2263 * @sta_remove_debugfs: Remove the debugfs files which were added using
2264 * @sta_add_debugfs. This callback can sleep.
2265 *
2129 * @sta_notify: Notifies low level driver about power state transition of an 2266 * @sta_notify: Notifies low level driver about power state transition of an
2130 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating 2267 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
2131 * in AP mode, this callback will not be called when the flag 2268 * in AP mode, this callback will not be called when the flag
@@ -2317,6 +2454,27 @@ enum ieee80211_rate_control_changed {
2317 * The callback will be called before each transmission and upon return 2454 * The callback will be called before each transmission and upon return
2318 * mac80211 will transmit the frame right away. 2455 * mac80211 will transmit the frame right away.
2319 * The callback is optional and can (should!) sleep. 2456 * The callback is optional and can (should!) sleep.
2457 *
2458 * @add_chanctx: Notifies device driver about new channel context creation.
2459 * @remove_chanctx: Notifies device driver about channel context destruction.
2460 * @change_chanctx: Notifies device driver about channel context changes that
2461 * may happen when combining different virtual interfaces on the same
2462 * channel context with different settings
2463 * @assign_vif_chanctx: Notifies device driver about channel context being bound
2464 * to vif. Possible use is for hw queue remapping.
2465 * @unassign_vif_chanctx: Notifies device driver about channel context being
2466 * unbound from vif.
2467 * @start_ap: Start operation on the AP interface, this is called after all the
2468 * information in bss_conf is set and beacon can be retrieved. A channel
2469 * context is bound before this is called. Note that if the driver uses
2470 * software scan or ROC, this (and @stop_ap) isn't called when the AP is
2471 * just "paused" for scanning/ROC, which is indicated by the beacon being
2472 * disabled/enabled via @bss_info_changed.
2473 * @stop_ap: Stop operation on the AP interface.
2474 *
2475 * @restart_complete: Called after a call to ieee80211_restart_hw(), when the
2476 * reconfiguration has completed. This can help the driver implement the
2477 * reconfiguration step. This callback may sleep.
2320 */ 2478 */
2321struct ieee80211_ops { 2479struct ieee80211_ops {
2322 void (*tx)(struct ieee80211_hw *hw, 2480 void (*tx)(struct ieee80211_hw *hw,
@@ -2342,6 +2500,9 @@ struct ieee80211_ops {
2342 struct ieee80211_bss_conf *info, 2500 struct ieee80211_bss_conf *info,
2343 u32 changed); 2501 u32 changed);
2344 2502
2503 int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2504 void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2505
2345 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 2506 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
2346 struct netdev_hw_addr_list *mc_list); 2507 struct netdev_hw_addr_list *mc_list);
2347 void (*configure_filter)(struct ieee80211_hw *hw, 2508 void (*configure_filter)(struct ieee80211_hw *hw,
@@ -2383,6 +2544,16 @@ struct ieee80211_ops {
2383 struct ieee80211_sta *sta); 2544 struct ieee80211_sta *sta);
2384 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2545 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2385 struct ieee80211_sta *sta); 2546 struct ieee80211_sta *sta);
2547#ifdef CONFIG_MAC80211_DEBUGFS
2548 void (*sta_add_debugfs)(struct ieee80211_hw *hw,
2549 struct ieee80211_vif *vif,
2550 struct ieee80211_sta *sta,
2551 struct dentry *dir);
2552 void (*sta_remove_debugfs)(struct ieee80211_hw *hw,
2553 struct ieee80211_vif *vif,
2554 struct ieee80211_sta *sta,
2555 struct dentry *dir);
2556#endif
2386 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2557 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2387 enum sta_notify_cmd, struct ieee80211_sta *sta); 2558 enum sta_notify_cmd, struct ieee80211_sta *sta);
2388 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2559 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -2424,8 +2595,8 @@ struct ieee80211_ops {
2424 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 2595 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
2425 2596
2426 int (*remain_on_channel)(struct ieee80211_hw *hw, 2597 int (*remain_on_channel)(struct ieee80211_hw *hw,
2598 struct ieee80211_vif *vif,
2427 struct ieee80211_channel *chan, 2599 struct ieee80211_channel *chan,
2428 enum nl80211_channel_type channel_type,
2429 int duration); 2600 int duration);
2430 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); 2601 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
2431 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); 2602 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
@@ -2461,6 +2632,22 @@ struct ieee80211_ops {
2461 2632
2462 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 2633 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2463 struct ieee80211_vif *vif); 2634 struct ieee80211_vif *vif);
2635
2636 int (*add_chanctx)(struct ieee80211_hw *hw,
2637 struct ieee80211_chanctx_conf *ctx);
2638 void (*remove_chanctx)(struct ieee80211_hw *hw,
2639 struct ieee80211_chanctx_conf *ctx);
2640 void (*change_chanctx)(struct ieee80211_hw *hw,
2641 struct ieee80211_chanctx_conf *ctx,
2642 u32 changed);
2643 int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
2644 struct ieee80211_vif *vif,
2645 struct ieee80211_chanctx_conf *ctx);
2646 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
2647 struct ieee80211_vif *vif,
2648 struct ieee80211_chanctx_conf *ctx);
2649
2650 void (*restart_complete)(struct ieee80211_hw *hw);
2464}; 2651};
2465 2652
2466/** 2653/**
@@ -2962,8 +3149,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2962 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3149 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2963 * @ssid: SSID buffer 3150 * @ssid: SSID buffer
2964 * @ssid_len: length of SSID 3151 * @ssid_len: length of SSID
2965 * @ie: buffer containing all IEs except SSID for the template 3152 * @tailroom: tailroom to reserve at end of SKB for IEs
2966 * @ie_len: length of the IE buffer
2967 * 3153 *
2968 * Creates a Probe Request template which can, for example, be uploaded to 3154 * Creates a Probe Request template which can, for example, be uploaded to
2969 * hardware. 3155 * hardware.
@@ -2971,7 +3157,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2971struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3157struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2972 struct ieee80211_vif *vif, 3158 struct ieee80211_vif *vif,
2973 const u8 *ssid, size_t ssid_len, 3159 const u8 *ssid, size_t ssid_len,
2974 const u8 *ie, size_t ie_len); 3160 size_t tailroom);
2975 3161
2976/** 3162/**
2977 * ieee80211_rts_get - RTS frame generation function 3163 * ieee80211_rts_get - RTS frame generation function
@@ -3145,6 +3331,19 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
3145 struct sk_buff *skb, u8 *p2k); 3331 struct sk_buff *skb, u8 *p2k);
3146 3332
3147/** 3333/**
3334 * ieee80211_aes_cmac_calculate_k1_k2 - calculate the AES-CMAC sub keys
3335 *
3336 * This function computes the two AES-CMAC sub-keys, based on the
3337 * previously installed master key.
3338 *
3339 * @keyconf: the parameter passed with the set key
3340 * @k1: a buffer to be filled with the 1st sub-key
3341 * @k2: a buffer to be filled with the 2nd sub-key
3342 */
3343void ieee80211_aes_cmac_calculate_k1_k2(struct ieee80211_key_conf *keyconf,
3344 u8 *k1, u8 *k2);
3345
3346/**
3148 * struct ieee80211_key_seq - key sequence counter 3347 * struct ieee80211_key_seq - key sequence counter
3149 * 3348 *
3150 * @tkip: TKIP data, containing IV32 and IV16 in host byte order 3349 * @tkip: TKIP data, containing IV32 and IV16 in host byte order
@@ -3294,6 +3493,21 @@ void ieee80211_sched_scan_results(struct ieee80211_hw *hw);
3294void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); 3493void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
3295 3494
3296/** 3495/**
3496 * enum ieee80211_interface_iteration_flags - interface iteration flags
3497 * @IEEE80211_IFACE_ITER_NORMAL: Iterate over all interfaces that have
3498 * been added to the driver; However, note that during hardware
3499 * reconfiguration (after restart_hw) it will iterate over a new
3500 * interface and over all the existing interfaces even if they
3501 * haven't been re-added to the driver yet.
3502 * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
3503 * interfaces, even if they haven't been re-added to the driver yet.
3504 */
3505enum ieee80211_interface_iteration_flags {
3506 IEEE80211_IFACE_ITER_NORMAL = 0,
3507 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0),
3508};
3509
3510/**
3297 * ieee80211_iterate_active_interfaces - iterate active interfaces 3511 * ieee80211_iterate_active_interfaces - iterate active interfaces
3298 * 3512 *
3299 * This function iterates over the interfaces associated with a given 3513 * This function iterates over the interfaces associated with a given
@@ -3301,13 +3515,15 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
3301 * This function allows the iterator function to sleep, when the iterator 3515 * This function allows the iterator function to sleep, when the iterator
3302 * function is atomic @ieee80211_iterate_active_interfaces_atomic can 3516 * function is atomic @ieee80211_iterate_active_interfaces_atomic can
3303 * be used. 3517 * be used.
3304 * Does not iterate over a new interface during add_interface() 3518 * Does not iterate over a new interface during add_interface().
3305 * 3519 *
3306 * @hw: the hardware struct of which the interfaces should be iterated over 3520 * @hw: the hardware struct of which the interfaces should be iterated over
3521 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
3307 * @iterator: the iterator function to call 3522 * @iterator: the iterator function to call
3308 * @data: first argument of the iterator function 3523 * @data: first argument of the iterator function
3309 */ 3524 */
3310void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 3525void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
3526 u32 iter_flags,
3311 void (*iterator)(void *data, u8 *mac, 3527 void (*iterator)(void *data, u8 *mac,
3312 struct ieee80211_vif *vif), 3528 struct ieee80211_vif *vif),
3313 void *data); 3529 void *data);
@@ -3319,13 +3535,15 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
3319 * hardware that are currently active and calls the callback for them. 3535 * hardware that are currently active and calls the callback for them.
3320 * This function requires the iterator callback function to be atomic, 3536 * This function requires the iterator callback function to be atomic,
3321 * if that is not desired, use @ieee80211_iterate_active_interfaces instead. 3537 * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
3322 * Does not iterate over a new interface during add_interface() 3538 * Does not iterate over a new interface during add_interface().
3323 * 3539 *
3324 * @hw: the hardware struct of which the interfaces should be iterated over 3540 * @hw: the hardware struct of which the interfaces should be iterated over
3541 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
3325 * @iterator: the iterator function to call, cannot sleep 3542 * @iterator: the iterator function to call, cannot sleep
3326 * @data: first argument of the iterator function 3543 * @data: first argument of the iterator function
3327 */ 3544 */
3328void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, 3545void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
3546 u32 iter_flags,
3329 void (*iterator)(void *data, 3547 void (*iterator)(void *data,
3330 u8 *mac, 3548 u8 *mac,
3331 struct ieee80211_vif *vif), 3549 struct ieee80211_vif *vif),
@@ -3524,6 +3742,27 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw,
3524 void *iter_data); 3742 void *iter_data);
3525 3743
3526/** 3744/**
3745 * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
3746 * @hw: pointre obtained from ieee80211_alloc_hw().
3747 * @iter: iterator function
3748 * @iter_data: data passed to iterator function
3749 *
3750 * Iterate all active channel contexts. This function is atomic and
3751 * doesn't acquire any locks internally that might be held in other
3752 * places while calling into the driver.
3753 *
3754 * The iterator will not find a context that's being added (during
3755 * the driver callback to add it) but will find it while it's being
3756 * removed.
3757 */
3758void ieee80211_iter_chan_contexts_atomic(
3759 struct ieee80211_hw *hw,
3760 void (*iter)(struct ieee80211_hw *hw,
3761 struct ieee80211_chanctx_conf *chanctx_conf,
3762 void *data),
3763 void *iter_data);
3764
3765/**
3527 * ieee80211_ap_probereq_get - retrieve a Probe Request template 3766 * ieee80211_ap_probereq_get - retrieve a Probe Request template
3528 * @hw: pointer obtained from ieee80211_alloc_hw(). 3767 * @hw: pointer obtained from ieee80211_alloc_hw().
3529 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3768 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 980d263765cf..23b3a7c58783 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -78,6 +78,13 @@ struct ra_msg {
78 __be32 retrans_timer; 78 __be32 retrans_timer;
79}; 79};
80 80
81struct rd_msg {
82 struct icmp6hdr icmph;
83 struct in6_addr target;
84 struct in6_addr dest;
85 __u8 opt[0];
86};
87
81struct nd_opt_hdr { 88struct nd_opt_hdr {
82 __u8 nd_opt_type; 89 __u8 nd_opt_type;
83 __u8 nd_opt_len; 90 __u8 nd_opt_len;
@@ -190,21 +197,6 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
190extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 197extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
191 struct net_device *dev, int dir); 198 struct net_device *dev, int dir);
192 199
193extern struct sk_buff *ndisc_build_skb(struct net_device *dev,
194 const struct in6_addr *daddr,
195 const struct in6_addr *saddr,
196 struct icmp6hdr *icmp6h,
197 const struct in6_addr *target,
198 int llinfo);
199
200extern void ndisc_send_skb(struct sk_buff *skb,
201 struct net_device *dev,
202 struct neighbour *neigh,
203 const struct in6_addr *daddr,
204 const struct in6_addr *saddr,
205 struct icmp6hdr *icmp6h);
206
207
208 200
209/* 201/*
210 * IGMP 202 * IGMP
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 95e646641184..de644bcd8613 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -23,6 +23,7 @@
23#endif 23#endif
24#include <net/netns/xfrm.h> 24#include <net/netns/xfrm.h>
25 25
26struct user_namespace;
26struct proc_dir_entry; 27struct proc_dir_entry;
27struct net_device; 28struct net_device;
28struct sock; 29struct sock;
@@ -53,6 +54,10 @@ struct net {
53 struct list_head cleanup_list; /* namespaces on death row */ 54 struct list_head cleanup_list; /* namespaces on death row */
54 struct list_head exit_list; /* Use only net_mutex */ 55 struct list_head exit_list; /* Use only net_mutex */
55 56
57 struct user_namespace *user_ns; /* Owning user namespace */
58
59 unsigned int proc_inum;
60
56 struct proc_dir_entry *proc_net; 61 struct proc_dir_entry *proc_net;
57 struct proc_dir_entry *proc_net_stat; 62 struct proc_dir_entry *proc_net_stat;
58 63
@@ -126,16 +131,21 @@ struct net {
126/* Init's network namespace */ 131/* Init's network namespace */
127extern struct net init_net; 132extern struct net init_net;
128 133
129#ifdef CONFIG_NET 134#ifdef CONFIG_NET_NS
130extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); 135extern struct net *copy_net_ns(unsigned long flags,
131 136 struct user_namespace *user_ns, struct net *old_net);
132#else /* CONFIG_NET */ 137
133static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) 138#else /* CONFIG_NET_NS */
139#include <linux/sched.h>
140#include <linux/nsproxy.h>
141static inline struct net *copy_net_ns(unsigned long flags,
142 struct user_namespace *user_ns, struct net *old_net)
134{ 143{
135 /* There is nothing to copy so this is a noop */ 144 if (flags & CLONE_NEWNET)
136 return net_ns; 145 return ERR_PTR(-EINVAL);
146 return old_net;
137} 147}
138#endif /* CONFIG_NET */ 148#endif /* CONFIG_NET_NS */
139 149
140 150
141extern struct list_head net_namespace_list; 151extern struct list_head net_namespace_list;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index f1494feba79f..caca0c4d6b4b 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -182,7 +182,7 @@ __nf_conntrack_find(struct net *net, u16 zone,
182 182
183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct); 183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184extern void nf_ct_delete_from_lists(struct nf_conn *ct); 184extern void nf_ct_delete_from_lists(struct nf_conn *ct);
185extern void nf_ct_insert_dying_list(struct nf_conn *ct); 185extern void nf_ct_dying_timeout(struct nf_conn *ct);
186 186
187extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); 187extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report);
188 188
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index bd8eea720f2e..ad14a799fd2e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -68,4 +68,19 @@ static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
68#endif 68#endif
69} 69}
70 70
71static inline bool nf_nat_oif_changed(unsigned int hooknum,
72 enum ip_conntrack_info ctinfo,
73 struct nf_conn_nat *nat,
74 const struct net_device *out)
75{
76#if IS_ENABLED(CONFIG_IP_NF_TARGET_MASQUERADE) || \
77 IS_ENABLED(CONFIG_IP6_NF_TARGET_MASQUERADE)
78 return nat->masq_index && hooknum == NF_INET_POST_ROUTING &&
79 CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL &&
80 nat->masq_index != out->ifindex;
81#else
82 return false;
83#endif
84}
85
71#endif 86#endif
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index 252fd1010b77..fb1c0be38b6d 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -21,14 +21,10 @@ struct nf_queue_entry {
21struct nf_queue_handler { 21struct nf_queue_handler {
22 int (*outfn)(struct nf_queue_entry *entry, 22 int (*outfn)(struct nf_queue_entry *entry,
23 unsigned int queuenum); 23 unsigned int queuenum);
24 char *name;
25}; 24};
26 25
27extern int nf_register_queue_handler(u_int8_t pf, 26void nf_register_queue_handler(const struct nf_queue_handler *qh);
28 const struct nf_queue_handler *qh); 27void nf_unregister_queue_handler(void);
29extern int nf_unregister_queue_handler(u_int8_t pf,
30 const struct nf_queue_handler *qh);
31extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
32extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 28extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
33 29
34#endif /* _NF_QUEUE_H */ 30#endif /* _NF_QUEUE_H */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index a1d83cc8bf85..923cb20051ed 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -71,6 +71,7 @@ struct netns_ct {
71 struct hlist_head *expect_hash; 71 struct hlist_head *expect_hash;
72 struct hlist_nulls_head unconfirmed; 72 struct hlist_nulls_head unconfirmed;
73 struct hlist_nulls_head dying; 73 struct hlist_nulls_head dying;
74 struct hlist_nulls_head tmpl;
74 struct ip_conntrack_stat __percpu *stat; 75 struct ip_conntrack_stat __percpu *stat;
75 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 76 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
76 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 77 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index 5e5eb1f9f14b..3573a81815ad 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -62,6 +62,9 @@ struct netns_sctp {
62 /* Whether Cookie Preservative is enabled(1) or not(0) */ 62 /* Whether Cookie Preservative is enabled(1) or not(0) */
63 int cookie_preserve_enable; 63 int cookie_preserve_enable;
64 64
65 /* The namespace default hmac alg */
66 char *sctp_hmac_alg;
67
65 /* Valid.Cookie.Life - 60 seconds */ 68 /* Valid.Cookie.Life - 60 seconds */
66 unsigned int valid_cookie_life; 69 unsigned int valid_cookie_life;
67 70
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 591db7d657a3..c24060ee411e 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -8,6 +8,7 @@ struct ebt_table;
8 8
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 bool notrack_deprecated_warning;
11#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ 12#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
12 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) 13 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
13 struct ebt_table *broute_table; 14 struct ebt_table *broute_table;
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 2760f4f4ae9b..1d04b6f0fbd4 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -27,7 +27,6 @@ struct netprio_map {
27 27
28struct cgroup_netprio_state { 28struct cgroup_netprio_state {
29 struct cgroup_subsys_state css; 29 struct cgroup_subsys_state css;
30 u32 prioidx;
31}; 30};
32 31
33extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); 32extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
@@ -36,13 +35,12 @@ extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
36 35
37static inline u32 task_netprioidx(struct task_struct *p) 36static inline u32 task_netprioidx(struct task_struct *p)
38{ 37{
39 struct cgroup_netprio_state *state; 38 struct cgroup_subsys_state *css;
40 u32 idx; 39 u32 idx;
41 40
42 rcu_read_lock(); 41 rcu_read_lock();
43 state = container_of(task_subsys_state(p, net_prio_subsys_id), 42 css = task_subsys_state(p, net_prio_subsys_id);
44 struct cgroup_netprio_state, css); 43 idx = css->cgroup->id;
45 idx = state->prioidx;
46 rcu_read_unlock(); 44 rcu_read_unlock();
47 return idx; 45 return idx;
48} 46}
@@ -57,8 +55,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
57 rcu_read_lock(); 55 rcu_read_lock();
58 css = task_subsys_state(p, net_prio_subsys_id); 56 css = task_subsys_state(p, net_prio_subsys_id);
59 if (css) 57 if (css)
60 idx = container_of(css, 58 idx = css->cgroup->id;
61 struct cgroup_netprio_state, css)->prioidx;
62 rcu_read_unlock(); 59 rcu_read_unlock();
63 return idx; 60 return idx;
64} 61}
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index e900072950cb..671953e11575 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -24,6 +24,12 @@
24 24
25#include <net/nfc/nfc.h> 25#include <net/nfc/nfc.h>
26 26
27struct nfc_phy_ops {
28 int (*write)(void *dev_id, struct sk_buff *skb);
29 int (*enable)(void *dev_id);
30 void (*disable)(void *dev_id);
31};
32
27struct nfc_hci_dev; 33struct nfc_hci_dev;
28 34
29struct nfc_hci_ops { 35struct nfc_hci_ops {
@@ -38,15 +44,21 @@ struct nfc_hci_ops {
38 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); 44 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
39 int (*start_poll) (struct nfc_hci_dev *hdev, 45 int (*start_poll) (struct nfc_hci_dev *hdev,
40 u32 im_protocols, u32 tm_protocols); 46 u32 im_protocols, u32 tm_protocols);
47 int (*dep_link_up)(struct nfc_hci_dev *hdev, struct nfc_target *target,
48 u8 comm_mode, u8 *gb, size_t gb_len);
49 int (*dep_link_down)(struct nfc_hci_dev *hdev);
41 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate, 50 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
42 struct nfc_target *target); 51 struct nfc_target *target);
43 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, 52 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
44 struct nfc_target *target); 53 struct nfc_target *target);
45 int (*data_exchange) (struct nfc_hci_dev *hdev, 54 int (*im_transceive) (struct nfc_hci_dev *hdev,
46 struct nfc_target *target, struct sk_buff *skb, 55 struct nfc_target *target, struct sk_buff *skb,
47 data_exchange_cb_t cb, void *cb_context); 56 data_exchange_cb_t cb, void *cb_context);
57 int (*tm_send)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
48 int (*check_presence)(struct nfc_hci_dev *hdev, 58 int (*check_presence)(struct nfc_hci_dev *hdev,
49 struct nfc_target *target); 59 struct nfc_target *target);
60 void (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
61 struct sk_buff *skb);
50}; 62};
51 63
52/* Pipes */ 64/* Pipes */
@@ -114,6 +126,9 @@ struct nfc_hci_dev {
114 int async_cb_type; 126 int async_cb_type;
115 data_exchange_cb_t async_cb; 127 data_exchange_cb_t async_cb;
116 void *async_cb_context; 128 void *async_cb_context;
129
130 u8 *gb;
131 size_t gb_len;
117}; 132};
118 133
119/* hci device allocation */ 134/* hci device allocation */
@@ -134,6 +149,8 @@ void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
134 149
135void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err); 150void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err);
136 151
152int nfc_hci_result_to_errno(u8 result);
153
137/* Host IDs */ 154/* Host IDs */
138#define NFC_HCI_HOST_CONTROLLER_ID 0x00 155#define NFC_HCI_HOST_CONTROLLER_ID 0x00
139#define NFC_HCI_TERMINAL_HOST_ID 0x01 156#define NFC_HCI_TERMINAL_HOST_ID 0x01
@@ -219,5 +236,7 @@ int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
219 const u8 *param, size_t param_len); 236 const u8 *param, size_t param_len);
220int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, 237int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
221 const u8 *param, size_t param_len); 238 const u8 *param, size_t param_len);
239int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate);
240u32 nfc_hci_sak_to_protocol(u8 sak);
222 241
223#endif /* __NET_HCI_H */ 242#endif /* __NET_HCI_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index f05b10682c9d..fce80b2f9be7 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -95,7 +95,7 @@ struct nfc_genl_data {
95}; 95};
96 96
97struct nfc_dev { 97struct nfc_dev {
98 unsigned int idx; 98 int idx;
99 u32 target_next_idx; 99 u32 target_next_idx;
100 struct nfc_target *targets; 100 struct nfc_target *targets;
101 int n_targets; 101 int n_targets;
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 929528c73fe8..047c0476c0a0 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -25,9 +25,11 @@
25#define _PROTOCOL_H 25#define _PROTOCOL_H
26 26
27#include <linux/in6.h> 27#include <linux/in6.h>
28#include <linux/skbuff.h>
28#if IS_ENABLED(CONFIG_IPV6) 29#if IS_ENABLED(CONFIG_IPV6)
29#include <linux/ipv6.h> 30#include <linux/ipv6.h>
30#endif 31#endif
32#include <linux/netdevice.h>
31 33
32/* This is one larger than the largest protocol value that can be 34/* This is one larger than the largest protocol value that can be
33 * found in an ipv4 or ipv6 header. Since in both cases the protocol 35 * found in an ipv4 or ipv6 header. Since in both cases the protocol
@@ -40,12 +42,6 @@ struct net_protocol {
40 void (*early_demux)(struct sk_buff *skb); 42 void (*early_demux)(struct sk_buff *skb);
41 int (*handler)(struct sk_buff *skb); 43 int (*handler)(struct sk_buff *skb);
42 void (*err_handler)(struct sk_buff *skb, u32 info); 44 void (*err_handler)(struct sk_buff *skb, u32 info);
43 int (*gso_send_check)(struct sk_buff *skb);
44 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
45 netdev_features_t features);
46 struct sk_buff **(*gro_receive)(struct sk_buff **head,
47 struct sk_buff *skb);
48 int (*gro_complete)(struct sk_buff *skb);
49 unsigned int no_policy:1, 45 unsigned int no_policy:1,
50 netns_ok:1; 46 netns_ok:1;
51}; 47};
@@ -60,23 +56,20 @@ struct inet6_protocol {
60 struct inet6_skb_parm *opt, 56 struct inet6_skb_parm *opt,
61 u8 type, u8 code, int offset, 57 u8 type, u8 code, int offset,
62 __be32 info); 58 __be32 info);
63
64 int (*gso_send_check)(struct sk_buff *skb);
65 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
66 netdev_features_t features);
67 struct sk_buff **(*gro_receive)(struct sk_buff **head,
68 struct sk_buff *skb);
69 int (*gro_complete)(struct sk_buff *skb);
70
71 unsigned int flags; /* INET6_PROTO_xxx */ 59 unsigned int flags; /* INET6_PROTO_xxx */
72}; 60};
73 61
74#define INET6_PROTO_NOPOLICY 0x1 62#define INET6_PROTO_NOPOLICY 0x1
75#define INET6_PROTO_FINAL 0x2 63#define INET6_PROTO_FINAL 0x2
76/* This should be set for any extension header which is compatible with GSO. */
77#define INET6_PROTO_GSO_EXTHDR 0x4
78#endif 64#endif
79 65
66struct net_offload {
67 struct offload_callbacks callbacks;
68 unsigned int flags; /* Flags used by IPv6 for now */
69};
70/* This should be set for any extension header which is compatible with GSO. */
71#define INET6_PROTO_GSO_EXTHDR 0x1
72
80/* This is used to register socket interfaces for IP protocols. */ 73/* This is used to register socket interfaces for IP protocols. */
81struct inet_protosw { 74struct inet_protosw {
82 struct list_head list; 75 struct list_head list;
@@ -96,6 +89,8 @@ struct inet_protosw {
96#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ 89#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
97 90
98extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS]; 91extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS];
92extern const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS];
93extern const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS];
99 94
100#if IS_ENABLED(CONFIG_IPV6) 95#if IS_ENABLED(CONFIG_IPV6)
101extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS]; 96extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
@@ -103,6 +98,8 @@ extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
103 98
104extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); 99extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
105extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num); 100extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
101extern int inet_add_offload(const struct net_offload *prot, unsigned char num);
102extern int inet_del_offload(const struct net_offload *prot, unsigned char num);
106extern void inet_register_protosw(struct inet_protosw *p); 103extern void inet_register_protosw(struct inet_protosw *p);
107extern void inet_unregister_protosw(struct inet_protosw *p); 104extern void inet_unregister_protosw(struct inet_protosw *p);
108 105
@@ -112,5 +109,7 @@ extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char n
112extern int inet6_register_protosw(struct inet_protosw *p); 109extern int inet6_register_protosw(struct inet_protosw *p);
113extern void inet6_unregister_protosw(struct inet_protosw *p); 110extern void inet6_unregister_protosw(struct inet_protosw *p);
114#endif 111#endif
112extern int inet6_add_offload(const struct net_offload *prot, unsigned char num);
113extern int inet6_del_offload(const struct net_offload *prot, unsigned char num);
115 114
116#endif /* _PROTOCOL_H */ 115#endif /* _PROTOCOL_H */
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b01d8dd9ee7c..a51dbd17c2de 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -49,13 +49,16 @@ struct request_sock_ops {
49 struct request_sock *req); 49 struct request_sock *req);
50}; 50};
51 51
52extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
53
52/* struct request_sock - mini sock to represent a connection request 54/* struct request_sock - mini sock to represent a connection request
53 */ 55 */
54struct request_sock { 56struct request_sock {
55 struct request_sock *dl_next; /* Must be first member! */ 57 struct request_sock *dl_next; /* Must be first member! */
56 u16 mss; 58 u16 mss;
57 u8 retrans; 59 u8 num_retrans; /* number of retransmits */
58 u8 cookie_ts; /* syncookie: encode tcpopts in timestamp */ 60 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
61 u8 num_timeout:7; /* number of timeouts */
59 /* The following two fields can be easily recomputed I think -AK */ 62 /* The following two fields can be easily recomputed I think -AK */
60 u32 window_clamp; /* window clamp at creation time */ 63 u32 window_clamp; /* window clamp at creation time */
61 u32 rcv_wnd; /* rcv_wnd offered first time */ 64 u32 rcv_wnd; /* rcv_wnd offered first time */
@@ -231,7 +234,7 @@ static inline int reqsk_queue_removed(struct request_sock_queue *queue,
231{ 234{
232 struct listen_sock *lopt = queue->listen_opt; 235 struct listen_sock *lopt = queue->listen_opt;
233 236
234 if (req->retrans == 0) 237 if (req->num_timeout == 0)
235 --lopt->qlen_young; 238 --lopt->qlen_young;
236 239
237 return --lopt->qlen; 240 return --lopt->qlen;
@@ -269,7 +272,8 @@ static inline void reqsk_queue_hash_req(struct request_sock_queue *queue,
269 struct listen_sock *lopt = queue->listen_opt; 272 struct listen_sock *lopt = queue->listen_opt;
270 273
271 req->expires = jiffies + timeout; 274 req->expires = jiffies + timeout;
272 req->retrans = 0; 275 req->num_retrans = 0;
276 req->num_timeout = 0;
273 req->sk = NULL; 277 req->sk = NULL;
274 req->dl_next = lopt->syn_table[hash]; 278 req->dl_next = lopt->syn_table[hash];
275 279
diff --git a/include/net/route.h b/include/net/route.h
index bc40b633a5c4..2ea40c1b5e00 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -198,10 +198,13 @@ struct in_ifaddr;
198extern void fib_add_ifaddr(struct in_ifaddr *); 198extern void fib_add_ifaddr(struct in_ifaddr *);
199extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); 199extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
200 200
201static inline void ip_rt_put(struct rtable * rt) 201static inline void ip_rt_put(struct rtable *rt)
202{ 202{
203 if (rt) 203 /* dst_release() accepts a NULL parameter.
204 dst_release(&rt->dst); 204 * We rely on dst being first structure in struct rtable
205 */
206 BUILD_BUG_ON(offsetof(struct rtable, dst) != 0);
207 dst_release(&rt->dst);
205} 208}
206 209
207#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3) 210#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 6b00c4fc4291..5a15fabd6a75 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -125,7 +125,7 @@ extern void rtnl_af_unregister(struct rtnl_af_ops *ops);
125 125
126 126
127extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 127extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
128extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net, 128extern struct net_device *rtnl_create_link(struct net *net,
129 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]); 129 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
130extern int rtnl_configure_link(struct net_device *dev, 130extern int rtnl_configure_link(struct net_device *dev,
131 const struct ifinfomsg *ifm); 131 const struct ifinfomsg *ifm);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 4616f468d599..1540f9c2fcf4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -50,6 +50,13 @@ struct Qdisc {
50#define TCQ_F_INGRESS 2 50#define TCQ_F_INGRESS 2
51#define TCQ_F_CAN_BYPASS 4 51#define TCQ_F_CAN_BYPASS 4
52#define TCQ_F_MQROOT 8 52#define TCQ_F_MQROOT 8
53#define TCQ_F_ONETXQUEUE 0x10 /* dequeue_skb() can assume all skbs are for
54 * q->dev_queue : It can test
55 * netif_xmit_frozen_or_stopped() before
56 * dequeueing next packet.
57 * Its true for MQ/MQPRIO slaves, or non
58 * multiqueue device.
59 */
53#define TCQ_F_WARN_NONWC (1 << 16) 60#define TCQ_F_WARN_NONWC (1 << 16)
54 int padded; 61 int padded;
55 const struct Qdisc_ops *ops; 62 const struct Qdisc_ops *ops;
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 712b3bebeda7..35247271e557 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -130,8 +130,6 @@ typedef union {
130 __be16 err; 130 __be16 err;
131 sctp_state_t state; 131 sctp_state_t state;
132 sctp_event_timeout_t to; 132 sctp_event_timeout_t to;
133 unsigned long zero;
134 void *ptr;
135 struct sctp_chunk *chunk; 133 struct sctp_chunk *chunk;
136 struct sctp_association *asoc; 134 struct sctp_association *asoc;
137 struct sctp_transport *transport; 135 struct sctp_transport *transport;
@@ -154,23 +152,15 @@ typedef union {
154 * which takes an __s32 and returns a sctp_arg_t containing the 152 * which takes an __s32 and returns a sctp_arg_t containing the
155 * __s32. So, after foo = SCTP_I32(arg), foo.i32 == arg. 153 * __s32. So, after foo = SCTP_I32(arg), foo.i32 == arg.
156 */ 154 */
157static inline sctp_arg_t SCTP_NULL(void)
158{
159 sctp_arg_t retval; retval.ptr = NULL; return retval;
160}
161static inline sctp_arg_t SCTP_NOFORCE(void)
162{
163 sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 0; return retval;
164}
165static inline sctp_arg_t SCTP_FORCE(void)
166{
167 sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 1; return retval;
168}
169 155
170#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \ 156#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \
171static inline sctp_arg_t \ 157static inline sctp_arg_t \
172SCTP_## name (type arg) \ 158SCTP_## name (type arg) \
173{ sctp_arg_t retval = {.zero = 0UL}; retval.elt = arg; return retval; } 159{ sctp_arg_t retval;\
160 memset(&retval, 0, sizeof(sctp_arg_t));\
161 retval.elt = arg;\
162 return retval;\
163}
174 164
175SCTP_ARG_CONSTRUCTOR(I32, __s32, i32) 165SCTP_ARG_CONSTRUCTOR(I32, __s32, i32)
176SCTP_ARG_CONSTRUCTOR(U32, __u32, u32) 166SCTP_ARG_CONSTRUCTOR(U32, __u32, u32)
@@ -181,7 +171,6 @@ SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
181SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */ 171SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */
182SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 172SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
183SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 173SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
184SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
185SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) 174SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
186SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) 175SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc)
187SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport) 176SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport)
@@ -192,6 +181,23 @@ SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet)
192SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) 181SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh)
193SCTP_ARG_CONSTRUCTOR(DATAMSG, struct sctp_datamsg *, msg) 182SCTP_ARG_CONSTRUCTOR(DATAMSG, struct sctp_datamsg *, msg)
194 183
184static inline sctp_arg_t SCTP_FORCE(void)
185{
186 return SCTP_I32(1);
187}
188
189static inline sctp_arg_t SCTP_NOFORCE(void)
190{
191 return SCTP_I32(0);
192}
193
194static inline sctp_arg_t SCTP_NULL(void)
195{
196 sctp_arg_t retval;
197 memset(&retval, 0, sizeof(sctp_arg_t));
198 return retval;
199}
200
195typedef struct { 201typedef struct {
196 sctp_arg_t obj; 202 sctp_arg_t obj;
197 sctp_verb_t verb; 203 sctp_verb_t verb;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index d053d2e99876..c29707d654c0 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -312,14 +312,6 @@ enum { SCTP_MAX_GABS = 16 };
312 * functions simpler to write. 312 * functions simpler to write.
313 */ 313 */
314 314
315#if defined (CONFIG_SCTP_HMAC_MD5)
316#define SCTP_COOKIE_HMAC_ALG "hmac(md5)"
317#elif defined (CONFIG_SCTP_HMAC_SHA1)
318#define SCTP_COOKIE_HMAC_ALG "hmac(sha1)"
319#else
320#define SCTP_COOKIE_HMAC_ALG NULL
321#endif
322
323/* These return values describe the success or failure of a number of 315/* These return values describe the success or failure of a number of
324 * routines which form the lower interface to SCTP_outqueue. 316 * routines which form the lower interface to SCTP_outqueue.
325 */ 317 */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 9c6414f553f9..7fdf298a47ef 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -272,6 +272,18 @@ struct sctp_mib {
272 unsigned long mibs[SCTP_MIB_MAX]; 272 unsigned long mibs[SCTP_MIB_MAX];
273}; 273};
274 274
275/* helper function to track stats about max rto and related transport */
276static inline void sctp_max_rto(struct sctp_association *asoc,
277 struct sctp_transport *trans)
278{
279 if (asoc->stats.max_obs_rto < (__u64)trans->rto) {
280 asoc->stats.max_obs_rto = trans->rto;
281 memset(&asoc->stats.obs_rto_ipaddr, 0,
282 sizeof(struct sockaddr_storage));
283 memcpy(&asoc->stats.obs_rto_ipaddr, &trans->ipaddr,
284 trans->af_specific->sockaddr_len);
285 }
286}
275 287
276/* Print debugging messages. */ 288/* Print debugging messages. */
277#if SCTP_DEBUG 289#if SCTP_DEBUG
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index b5887e1677e4..2a82d1384706 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -234,6 +234,8 @@ struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
234struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *, 234struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *,
235 const struct sctp_chunk *, 235 const struct sctp_chunk *,
236 struct sctp_paramhdr *); 236 struct sctp_paramhdr *);
237struct sctp_chunk *sctp_make_violation_max_retrans(const struct sctp_association *,
238 const struct sctp_chunk *);
237struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, 239struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *,
238 const struct sctp_transport *); 240 const struct sctp_transport *);
239struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *, 241struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 64158aa1bb5f..fdeb85a970fc 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -177,6 +177,7 @@ struct sctp_sock {
177 177
178 /* Access to HMAC transform. */ 178 /* Access to HMAC transform. */
179 struct crypto_hash *hmac; 179 struct crypto_hash *hmac;
180 char *sctp_hmac_alg;
180 181
181 /* What is our base endpointer? */ 182 /* What is our base endpointer? */
182 struct sctp_endpoint *ep; 183 struct sctp_endpoint *ep;
@@ -948,6 +949,8 @@ struct sctp_transport {
948 949
949 /* 64-bit random number sent with heartbeat. */ 950 /* 64-bit random number sent with heartbeat. */
950 __u64 hb_nonce; 951 __u64 hb_nonce;
952
953 struct rcu_head rcu;
951}; 954};
952 955
953struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *, 956struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
@@ -1311,6 +1314,40 @@ struct sctp_inithdr_host {
1311 __u32 initial_tsn; 1314 __u32 initial_tsn;
1312}; 1315};
1313 1316
1317/* SCTP_GET_ASSOC_STATS counters */
1318struct sctp_priv_assoc_stats {
1319 /* Maximum observed rto in the association during subsequent
1320 * observations. Value is set to 0 if no RTO measurement took place
1321 * The transport where the max_rto was observed is returned in
1322 * obs_rto_ipaddr
1323 */
1324 struct sockaddr_storage obs_rto_ipaddr;
1325 __u64 max_obs_rto;
1326 /* Total In and Out SACKs received and sent */
1327 __u64 isacks;
1328 __u64 osacks;
1329 /* Total In and Out packets received and sent */
1330 __u64 opackets;
1331 __u64 ipackets;
1332 /* Total retransmitted chunks */
1333 __u64 rtxchunks;
1334 /* TSN received > next expected */
1335 __u64 outofseqtsns;
1336 /* Duplicate Chunks received */
1337 __u64 idupchunks;
1338 /* Gap Ack Blocks received */
1339 __u64 gapcnt;
1340 /* Unordered data chunks sent and received */
1341 __u64 ouodchunks;
1342 __u64 iuodchunks;
1343 /* Ordered data chunks sent and received */
1344 __u64 oodchunks;
1345 __u64 iodchunks;
1346 /* Control chunks sent and received */
1347 __u64 octrlchunks;
1348 __u64 ictrlchunks;
1349};
1350
1314/* RFC2960 1351/* RFC2960
1315 * 1352 *
1316 * 12. Recommended Transmission Control Block (TCB) Parameters 1353 * 12. Recommended Transmission Control Block (TCB) Parameters
@@ -1829,6 +1866,8 @@ struct sctp_association {
1829 1866
1830 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */ 1867 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
1831 temp:1; /* Is it a temporary association? */ 1868 temp:1; /* Is it a temporary association? */
1869
1870 struct sctp_priv_assoc_stats stats;
1832}; 1871};
1833 1872
1834 1873
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index 2e5ee0d8458d..ff1b8ba73ab1 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -72,7 +72,7 @@ int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
72void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); 72void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
73 73
74/* Perform partial delivery. */ 74/* Perform partial delivery. */
75void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); 75void sctp_ulpq_partial_delivery(struct sctp_ulpq *, gfp_t);
76 76
77/* Abort the partial delivery. */ 77/* Abort the partial delivery. */
78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); 78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 1b02d7ad453b..9a0ae091366d 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -107,6 +107,7 @@ typedef __s32 sctp_assoc_t;
107#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ 107#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */
108#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ 108#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
109#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ 109#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
110#define SCTP_GET_ASSOC_STATS 112 /* Read only */
110 111
111/* 112/*
112 * 5.2.1 SCTP Initiation Structure (SCTP_INIT) 113 * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
@@ -719,6 +720,32 @@ struct sctp_getaddrs {
719 __u8 addrs[0]; /*output, variable size*/ 720 __u8 addrs[0]; /*output, variable size*/
720}; 721};
721 722
723/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
724 * association stats. All stats are counts except sas_maxrto and
725 * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
726 * the last call. Will return 0 when RTO was not update since last call
727 */
728struct sctp_assoc_stats {
729 sctp_assoc_t sas_assoc_id; /* Input */
730 /* Transport of observed max RTO */
731 struct sockaddr_storage sas_obs_rto_ipaddr;
732 __u64 sas_maxrto; /* Maximum Observed RTO for period */
733 __u64 sas_isacks; /* SACKs received */
734 __u64 sas_osacks; /* SACKs sent */
735 __u64 sas_opackets; /* Packets sent */
736 __u64 sas_ipackets; /* Packets received */
737 __u64 sas_rtxchunks; /* Retransmitted Chunks */
738 __u64 sas_outofseqtsns;/* TSN received > next expected */
739 __u64 sas_idupchunks; /* Dups received (ordered+unordered) */
740 __u64 sas_gapcnt; /* Gap Acknowledgements Received */
741 __u64 sas_ouodchunks; /* Unordered data chunks sent */
742 __u64 sas_iuodchunks; /* Unordered data chunks received */
743 __u64 sas_oodchunks; /* Ordered data chunks sent */
744 __u64 sas_iodchunks; /* Ordered data chunks received */
745 __u64 sas_octrlchunks; /* Control chunks sent */
746 __u64 sas_ictrlchunks; /* Control chunks received */
747};
748
722/* These are bit fields for msghdr->msg_flags. See section 5.1. */ 749/* These are bit fields for msghdr->msg_flags. See section 5.1. */
723/* On user space Linux, these live in <bits/socket.h> as an enum. */ 750/* On user space Linux, these live in <bits/socket.h> as an enum. */
724enum sctp_msg_flags { 751enum sctp_msg_flags {
diff --git a/include/net/sock.h b/include/net/sock.h
index c945fba4f543..182ca99405ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -126,12 +126,17 @@ struct sock;
126struct proto; 126struct proto;
127struct net; 127struct net;
128 128
129typedef __u32 __bitwise __portpair;
130typedef __u64 __bitwise __addrpair;
131
129/** 132/**
130 * struct sock_common - minimal network layer representation of sockets 133 * struct sock_common - minimal network layer representation of sockets
131 * @skc_daddr: Foreign IPv4 addr 134 * @skc_daddr: Foreign IPv4 addr
132 * @skc_rcv_saddr: Bound local IPv4 addr 135 * @skc_rcv_saddr: Bound local IPv4 addr
133 * @skc_hash: hash value used with various protocol lookup tables 136 * @skc_hash: hash value used with various protocol lookup tables
134 * @skc_u16hashes: two u16 hash values used by UDP lookup tables 137 * @skc_u16hashes: two u16 hash values used by UDP lookup tables
138 * @skc_dport: placeholder for inet_dport/tw_dport
139 * @skc_num: placeholder for inet_num/tw_num
135 * @skc_family: network address family 140 * @skc_family: network address family
136 * @skc_state: Connection state 141 * @skc_state: Connection state
137 * @skc_reuse: %SO_REUSEADDR setting 142 * @skc_reuse: %SO_REUSEADDR setting
@@ -149,16 +154,29 @@ struct net;
149 * for struct sock and struct inet_timewait_sock. 154 * for struct sock and struct inet_timewait_sock.
150 */ 155 */
151struct sock_common { 156struct sock_common {
152 /* skc_daddr and skc_rcv_saddr must be grouped : 157 /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned
153 * cf INET_MATCH() and INET_TW_MATCH() 158 * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH()
154 */ 159 */
155 __be32 skc_daddr; 160 union {
156 __be32 skc_rcv_saddr; 161 __addrpair skc_addrpair;
157 162 struct {
163 __be32 skc_daddr;
164 __be32 skc_rcv_saddr;
165 };
166 };
158 union { 167 union {
159 unsigned int skc_hash; 168 unsigned int skc_hash;
160 __u16 skc_u16hashes[2]; 169 __u16 skc_u16hashes[2];
161 }; 170 };
171 /* skc_dport && skc_num must be grouped as well */
172 union {
173 __portpair skc_portpair;
174 struct {
175 __be16 skc_dport;
176 __u16 skc_num;
177 };
178 };
179
162 unsigned short skc_family; 180 unsigned short skc_family;
163 volatile unsigned char skc_state; 181 volatile unsigned char skc_state;
164 unsigned char skc_reuse; 182 unsigned char skc_reuse;
@@ -213,7 +231,7 @@ struct cg_proto;
213 * @sk_sndbuf: size of send buffer in bytes 231 * @sk_sndbuf: size of send buffer in bytes
214 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 232 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
215 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 233 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
216 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 234 * @sk_no_check: %SO_NO_CHECK setting, whether or not checkup packets
217 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 235 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
218 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) 236 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
219 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 237 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -349,7 +367,7 @@ struct sock {
349 unsigned short sk_ack_backlog; 367 unsigned short sk_ack_backlog;
350 unsigned short sk_max_ack_backlog; 368 unsigned short sk_max_ack_backlog;
351 __u32 sk_priority; 369 __u32 sk_priority;
352#ifdef CONFIG_CGROUPS 370#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
353 __u32 sk_cgrp_prioidx; 371 __u32 sk_cgrp_prioidx;
354#endif 372#endif
355 struct pid *sk_peer_pid; 373 struct pid *sk_peer_pid;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6feeccd83dd7..aed42c785153 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -369,7 +369,6 @@ extern void tcp_shutdown (struct sock *sk, int how);
369extern void tcp_v4_early_demux(struct sk_buff *skb); 369extern void tcp_v4_early_demux(struct sk_buff *skb);
370extern int tcp_v4_rcv(struct sk_buff *skb); 370extern int tcp_v4_rcv(struct sk_buff *skb);
371 371
372extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
373extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 372extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
374extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 373extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
375 size_t size); 374 size_t size);
@@ -525,6 +524,7 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
525extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 524extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
526 int nonagle); 525 int nonagle);
527extern bool tcp_may_send_now(struct sock *sk); 526extern bool tcp_may_send_now(struct sock *sk);
527extern int __tcp_retransmit_skb(struct sock *, struct sk_buff *);
528extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 528extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
529extern void tcp_retransmit_timer(struct sock *sk); 529extern void tcp_retransmit_timer(struct sock *sk);
530extern void tcp_xmit_retransmit_queue(struct sock *); 530extern void tcp_xmit_retransmit_queue(struct sock *);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 6f0ba01afe73..63445ede48bb 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1351,7 +1351,7 @@ struct xfrm6_tunnel {
1351}; 1351};
1352 1352
1353extern void xfrm_init(void); 1353extern void xfrm_init(void);
1354extern void xfrm4_init(int rt_hash_size); 1354extern void xfrm4_init(void);
1355extern int xfrm_state_init(struct net *net); 1355extern int xfrm_state_init(struct net *net);
1356extern void xfrm_state_fini(struct net *net); 1356extern void xfrm_state_fini(struct net *net);
1357extern void xfrm4_state_init(void); 1357extern void xfrm4_state_init(void);
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild
deleted file mode 100644
index ea56f76c0c22..000000000000
--- a/include/rdma/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
1header-y += ib_user_cm.h
2header-y += ib_user_mad.h
3header-y += ib_user_sa.h
4header-y += ib_user_verbs.h
5header-y += rdma_netlink.h
6header-y += rdma_user_cm.h
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index bd3d8b24b420..e38de79eeb48 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -1,41 +1,9 @@
1#ifndef _RDMA_NETLINK_H 1#ifndef _RDMA_NETLINK_H
2#define _RDMA_NETLINK_H 2#define _RDMA_NETLINK_H
3 3
4#include <linux/types.h>
5
6enum {
7 RDMA_NL_RDMA_CM = 1
8};
9
10#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
11#define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
12#define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
13
14enum {
15 RDMA_NL_RDMA_CM_ID_STATS = 0,
16 RDMA_NL_RDMA_CM_NUM_OPS
17};
18
19enum {
20 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
21 RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
22 RDMA_NL_RDMA_CM_NUM_ATTR,
23};
24
25struct rdma_cm_id_stats {
26 __u32 qp_num;
27 __u32 bound_dev_if;
28 __u32 port_space;
29 __s32 pid;
30 __u8 cm_state;
31 __u8 node_type;
32 __u8 port_num;
33 __u8 qp_type;
34};
35
36#ifdef __KERNEL__
37 4
38#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <uapi/rdma/rdma_netlink.h>
39 7
40struct ibnl_client_cbs { 8struct ibnl_client_cbs {
41 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb); 9 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
@@ -88,6 +56,4 @@ void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
88int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, 56int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
89 int len, void *data, int type); 57 int len, void *data, int type);
90 58
91#endif /* __KERNEL__ */
92
93#endif /* _RDMA_NETLINK_H */ 59#endif /* _RDMA_NETLINK_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 88fae8d20154..e65c62e82c5a 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -135,6 +135,9 @@ struct scsi_device {
135 * because we did a bus reset. */ 135 * because we did a bus reset. */
136 unsigned use_10_for_rw:1; /* first try 10-byte read / write */ 136 unsigned use_10_for_rw:1; /* first try 10-byte read / write */
137 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ 137 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
138 unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */
139 unsigned no_write_same:1; /* no WRITE SAME command */
140 unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */
138 unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ 141 unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
139 unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ 142 unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
140 unsigned skip_vpd_pages:1; /* do not read VPD pages */ 143 unsigned skip_vpd_pages:1; /* do not read VPD pages */
@@ -362,6 +365,8 @@ extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
362 int retries, struct scsi_sense_hdr *sshdr); 365 int retries, struct scsi_sense_hdr *sshdr);
363extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf, 366extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf,
364 int buf_len); 367 int buf_len);
368extern int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
369 unsigned int len, unsigned char opcode);
365extern int scsi_device_set_state(struct scsi_device *sdev, 370extern int scsi_device_set_state(struct scsi_device *sdev,
366 enum scsi_device_state state); 371 enum scsi_device_state state);
367extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, 372extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 98b3a20a0102..9b8e08879cfc 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -36,6 +36,7 @@ enum sas_linkrate {
36 SAS_LINK_RATE_3_0_GBPS = 9, 36 SAS_LINK_RATE_3_0_GBPS = 9,
37 SAS_LINK_RATE_G2 = SAS_LINK_RATE_3_0_GBPS, 37 SAS_LINK_RATE_G2 = SAS_LINK_RATE_3_0_GBPS,
38 SAS_LINK_RATE_6_0_GBPS = 10, 38 SAS_LINK_RATE_6_0_GBPS = 10,
39 SAS_LINK_RATE_12_0_GBPS = 11,
39 /* These are virtual to the transport class and may never 40 /* These are virtual to the transport class and may never
40 * be signalled normally since the standard defined field 41 * be signalled normally since the standard defined field
41 * is only 4 bits */ 42 * is only 4 bits */
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
index 9c60ca1c08c5..ff0f04ac91aa 100644
--- a/include/scsi/scsi_transport_srp.h
+++ b/include/scsi/scsi_transport_srp.h
@@ -14,13 +14,21 @@ struct srp_rport_identifiers {
14}; 14};
15 15
16struct srp_rport { 16struct srp_rport {
17 /* for initiator and target drivers */
18
17 struct device dev; 19 struct device dev;
18 20
19 u8 port_id[16]; 21 u8 port_id[16];
20 u8 roles; 22 u8 roles;
23
24 /* for initiator drivers */
25
26 void *lld_data; /* LLD private data */
21}; 27};
22 28
23struct srp_function_template { 29struct srp_function_template {
30 /* for initiator drivers */
31 void (*rport_delete)(struct srp_rport *rport);
24 /* for target drivers */ 32 /* for target drivers */
25 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); 33 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
26 int (* it_nexus_response)(struct Scsi_Host *, u64, int); 34 int (* it_nexus_response)(struct Scsi_Host *, u64, int);
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
deleted file mode 100644
index 6df30ed1581c..000000000000
--- a/include/sound/Kbuild
+++ /dev/null
@@ -1,10 +0,0 @@
1header-y += asequencer.h
2header-y += asound.h
3header-y += asound_fm.h
4header-y += emu10k1.h
5header-y += hdsp.h
6header-y += hdspm.h
7header-y += sb16_csp.h
8header-y += sfnt_info.h
9header-y += compress_params.h
10header-y += compress_offload.h
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 1505e6d5ef82..75935ce739c5 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -22,294 +22,9 @@
22#ifndef __SOUND_ASEQUENCER_H 22#ifndef __SOUND_ASEQUENCER_H
23#define __SOUND_ASEQUENCER_H 23#define __SOUND_ASEQUENCER_H
24 24
25#ifdef __KERNEL__
26#include <linux/ioctl.h> 25#include <linux/ioctl.h>
27#include <sound/asound.h> 26#include <sound/asound.h>
28#endif 27#include <uapi/sound/asequencer.h>
29
30/** version of the sequencer */
31#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
32
33/**
34 * definition of sequencer event types
35 */
36
37/** system messages
38 * event data type = #snd_seq_result
39 */
40#define SNDRV_SEQ_EVENT_SYSTEM 0
41#define SNDRV_SEQ_EVENT_RESULT 1
42
43/** note messages (channel specific)
44 * event data type = #snd_seq_ev_note
45 */
46#define SNDRV_SEQ_EVENT_NOTE 5
47#define SNDRV_SEQ_EVENT_NOTEON 6
48#define SNDRV_SEQ_EVENT_NOTEOFF 7
49#define SNDRV_SEQ_EVENT_KEYPRESS 8
50
51/** control messages (channel specific)
52 * event data type = #snd_seq_ev_ctrl
53 */
54#define SNDRV_SEQ_EVENT_CONTROLLER 10
55#define SNDRV_SEQ_EVENT_PGMCHANGE 11
56#define SNDRV_SEQ_EVENT_CHANPRESS 12
57#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
58#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
59#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
61
62/** synchronisation messages
63 * event data type = #snd_seq_ev_ctrl
64 */
65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
67#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
68#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
70
71/** timer messages
72 * event data type = snd_seq_ev_queue_control
73 */
74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
76#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
77#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
78#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
79#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
80#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
81#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
82#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
83
84/** others
85 * event data type = none
86 */
87#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
88#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
89#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
90
91/** echo back, kernel private messages
92 * event data type = any type
93 */
94#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
96
97/** system status messages (broadcast for subscribers)
98 * event data type = snd_seq_addr
99 */
100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
102#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
103#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
104#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
106
107/** port connection changes
108 * event data type = snd_seq_connect
109 */
110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
112
113/* 70-89: synthesizer events - obsoleted */
114
115/** user-defined events with fixed length
116 * event data type = any
117 */
118#define SNDRV_SEQ_EVENT_USR0 90
119#define SNDRV_SEQ_EVENT_USR1 91
120#define SNDRV_SEQ_EVENT_USR2 92
121#define SNDRV_SEQ_EVENT_USR3 93
122#define SNDRV_SEQ_EVENT_USR4 94
123#define SNDRV_SEQ_EVENT_USR5 95
124#define SNDRV_SEQ_EVENT_USR6 96
125#define SNDRV_SEQ_EVENT_USR7 97
126#define SNDRV_SEQ_EVENT_USR8 98
127#define SNDRV_SEQ_EVENT_USR9 99
128
129/* 100-118: instrument layer - obsoleted */
130/* 119-129: reserved */
131
132/* 130-139: variable length events
133 * event data type = snd_seq_ev_ext
134 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
135 */
136#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
137#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
138/* 132-134: reserved */
139#define SNDRV_SEQ_EVENT_USR_VAR0 135
140#define SNDRV_SEQ_EVENT_USR_VAR1 136
141#define SNDRV_SEQ_EVENT_USR_VAR2 137
142#define SNDRV_SEQ_EVENT_USR_VAR3 138
143#define SNDRV_SEQ_EVENT_USR_VAR4 139
144
145/* 150-151: kernel events with quote - DO NOT use in user clients */
146#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
147#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
148
149/* 152-191: reserved */
150
151/* 192-254: hardware specific events */
152
153/* 255: special event */
154#define SNDRV_SEQ_EVENT_NONE 255
155
156
157typedef unsigned char snd_seq_event_type_t;
158
159/** event address */
160struct snd_seq_addr {
161 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
162 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
163};
164
165/** port connection */
166struct snd_seq_connect {
167 struct snd_seq_addr sender;
168 struct snd_seq_addr dest;
169};
170
171
172#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
173#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
174#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
175#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
176
177 /* event mode flag - NOTE: only 8 bits available! */
178#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
179#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
180#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
181
182#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
183#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
184#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
185
186#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
187#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
188#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
189#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
190
191#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
192#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
193#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
194
195
196 /* note event */
197struct snd_seq_ev_note {
198 unsigned char channel;
199 unsigned char note;
200 unsigned char velocity;
201 unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
202 unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
203};
204
205 /* controller event */
206struct snd_seq_ev_ctrl {
207 unsigned char channel;
208 unsigned char unused1, unused2, unused3; /* pad */
209 unsigned int param;
210 signed int value;
211};
212
213 /* generic set of bytes (12x8 bit) */
214struct snd_seq_ev_raw8 {
215 unsigned char d[12]; /* 8 bit value */
216};
217
218 /* generic set of integers (3x32 bit) */
219struct snd_seq_ev_raw32 {
220 unsigned int d[3]; /* 32 bit value */
221};
222
223 /* external stored data */
224struct snd_seq_ev_ext {
225 unsigned int len; /* length of data */
226 void *ptr; /* pointer to data (note: maybe 64-bit) */
227} __attribute__((packed));
228
229struct snd_seq_result {
230 int event; /* processed event type */
231 int result;
232};
233
234
235struct snd_seq_real_time {
236 unsigned int tv_sec; /* seconds */
237 unsigned int tv_nsec; /* nanoseconds */
238};
239
240typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
241
242union snd_seq_timestamp {
243 snd_seq_tick_time_t tick;
244 struct snd_seq_real_time time;
245};
246
247struct snd_seq_queue_skew {
248 unsigned int value;
249 unsigned int base;
250};
251
252 /* queue timer control */
253struct snd_seq_ev_queue_control {
254 unsigned char queue; /* affected queue */
255 unsigned char pad[3]; /* reserved */
256 union {
257 signed int value; /* affected value (e.g. tempo) */
258 union snd_seq_timestamp time; /* time */
259 unsigned int position; /* sync position */
260 struct snd_seq_queue_skew skew;
261 unsigned int d32[2];
262 unsigned char d8[8];
263 } param;
264};
265
266 /* quoted event - inside the kernel only */
267struct snd_seq_ev_quote {
268 struct snd_seq_addr origin; /* original sender */
269 unsigned short value; /* optional data */
270 struct snd_seq_event *event; /* quoted event */
271} __attribute__((packed));
272
273
274 /* sequencer event */
275struct snd_seq_event {
276 snd_seq_event_type_t type; /* event type */
277 unsigned char flags; /* event flags */
278 char tag;
279
280 unsigned char queue; /* schedule queue */
281 union snd_seq_timestamp time; /* schedule time */
282
283
284 struct snd_seq_addr source; /* source address */
285 struct snd_seq_addr dest; /* destination address */
286
287 union { /* event data... */
288 struct snd_seq_ev_note note;
289 struct snd_seq_ev_ctrl control;
290 struct snd_seq_ev_raw8 raw8;
291 struct snd_seq_ev_raw32 raw32;
292 struct snd_seq_ev_ext ext;
293 struct snd_seq_ev_queue_control queue;
294 union snd_seq_timestamp time;
295 struct snd_seq_addr addr;
296 struct snd_seq_connect connect;
297 struct snd_seq_result result;
298 struct snd_seq_ev_quote quote;
299 } data;
300};
301
302
303/*
304 * bounce event - stored as variable size data
305 */
306struct snd_seq_event_bounce {
307 int err;
308 struct snd_seq_event event;
309 /* external data follows here. */
310};
311
312#ifdef __KERNEL__
313 28
314/* helper macro */ 29/* helper macro */
315#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce))) 30#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
@@ -368,311 +83,4 @@ struct snd_seq_event_bounce {
368/* queue sync port */ 83/* queue sync port */
369#define snd_seq_queue_sync_port(q) ((q) + 16) 84#define snd_seq_queue_sync_port(q) ((q) + 16)
370 85
371#endif /* __KERNEL__ */
372
373 /* system information */
374struct snd_seq_system_info {
375 int queues; /* maximum queues count */
376 int clients; /* maximum clients count */
377 int ports; /* maximum ports per client */
378 int channels; /* maximum channels per port */
379 int cur_clients; /* current clients */
380 int cur_queues; /* current queues */
381 char reserved[24];
382};
383
384
385 /* system running information */
386struct snd_seq_running_info {
387 unsigned char client; /* client id */
388 unsigned char big_endian; /* 1 = big-endian */
389 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
390 unsigned char pad; /* reserved */
391 unsigned char reserved[12];
392};
393
394
395 /* known client numbers */
396#define SNDRV_SEQ_CLIENT_SYSTEM 0
397 /* internal client numbers */
398#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
399#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
400
401
402 /* client types */
403typedef int __bitwise snd_seq_client_type_t;
404#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
405#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
406#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
407
408 /* event filter flags */
409#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
410#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
411#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
412#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
413
414struct snd_seq_client_info {
415 int client; /* client number to inquire */
416 snd_seq_client_type_t type; /* client type */
417 char name[64]; /* client name */
418 unsigned int filter; /* filter flags */
419 unsigned char multicast_filter[8]; /* multicast filter bitmap */
420 unsigned char event_filter[32]; /* event filter bitmap */
421 int num_ports; /* RO: number of ports */
422 int event_lost; /* number of lost events */
423 char reserved[64]; /* for future use */
424};
425
426
427/* client pool size */
428struct snd_seq_client_pool {
429 int client; /* client number to inquire */
430 int output_pool; /* outgoing (write) pool size */
431 int input_pool; /* incoming (read) pool size */
432 int output_room; /* minimum free pool size for select/blocking mode */
433 int output_free; /* unused size */
434 int input_free; /* unused size */
435 char reserved[64];
436};
437
438
439/* Remove events by specified criteria */
440
441#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
442#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
443#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
444#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
445#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
446#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
447#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
448#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
449#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
450#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
451
452struct snd_seq_remove_events {
453 unsigned int remove_mode; /* Flags that determine what gets removed */
454
455 union snd_seq_timestamp time;
456
457 unsigned char queue; /* Queue for REMOVE_DEST */
458 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
459 unsigned char channel; /* Channel for REMOVE_DEST */
460
461 int type; /* For REMOVE_EVENT_TYPE */
462 char tag; /* Tag for REMOVE_TAG */
463
464 int reserved[10]; /* To allow for future binary compatibility */
465
466};
467
468
469 /* known port numbers */
470#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
471#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
472
473 /* port capabilities (32 bits) */
474#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
475#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
476
477#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
478#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
479
480#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
481
482#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
483#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
484#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
485
486 /* port type */
487#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
488#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
489#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
490#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
491#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
492#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
493#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
494
495/* other standards...*/
496#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
497#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
498#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
499/*...*/
500#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
501#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
502#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
503#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
504#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
505
506/* misc. conditioning flags */
507#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
508#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
509#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
510
511struct snd_seq_port_info {
512 struct snd_seq_addr addr; /* client/port numbers */
513 char name[64]; /* port name */
514
515 unsigned int capability; /* port capability bits */
516 unsigned int type; /* port type bits */
517 int midi_channels; /* channels per MIDI port */
518 int midi_voices; /* voices per MIDI port */
519 int synth_voices; /* voices per SYNTH port */
520
521 int read_use; /* R/O: subscribers for output (from this port) */
522 int write_use; /* R/O: subscribers for input (to this port) */
523
524 void *kernel; /* reserved for kernel use (must be NULL) */
525 unsigned int flags; /* misc. conditioning */
526 unsigned char time_queue; /* queue # for timestamping */
527 char reserved[59]; /* for future use */
528};
529
530
531/* queue flags */
532#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
533
534/* queue information */
535struct snd_seq_queue_info {
536 int queue; /* queue id */
537
538 /*
539 * security settings, only owner of this queue can start/stop timer
540 * etc. if the queue is locked for other clients
541 */
542 int owner; /* client id for owner of the queue */
543 unsigned locked:1; /* timing queue locked for other queues */
544 char name[64]; /* name of this queue */
545 unsigned int flags; /* flags */
546 char reserved[60]; /* for future use */
547
548};
549
550/* queue info/status */
551struct snd_seq_queue_status {
552 int queue; /* queue id */
553 int events; /* read-only - queue size */
554 snd_seq_tick_time_t tick; /* current tick */
555 struct snd_seq_real_time time; /* current time */
556 int running; /* running state of queue */
557 int flags; /* various flags */
558 char reserved[64]; /* for the future */
559};
560
561
562/* queue tempo */
563struct snd_seq_queue_tempo {
564 int queue; /* sequencer queue */
565 unsigned int tempo; /* current tempo, us/tick */
566 int ppq; /* time resolution, ticks/quarter */
567 unsigned int skew_value; /* queue skew */
568 unsigned int skew_base; /* queue skew base */
569 char reserved[24]; /* for the future */
570};
571
572
573/* sequencer timer sources */
574#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
575#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
576#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
577
578/* queue timer info */
579struct snd_seq_queue_timer {
580 int queue; /* sequencer queue */
581 int type; /* source timer type */
582 union {
583 struct {
584 struct snd_timer_id id; /* ALSA's timer ID */
585 unsigned int resolution; /* resolution in Hz */
586 } alsa;
587 } u;
588 char reserved[64]; /* for the future use */
589};
590
591
592struct snd_seq_queue_client {
593 int queue; /* sequencer queue */
594 int client; /* sequencer client */
595 int used; /* queue is used with this client
596 (must be set for accepting events) */
597 /* per client watermarks */
598 char reserved[64]; /* for future use */
599};
600
601
602#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
603#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
604#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
605
606struct snd_seq_port_subscribe {
607 struct snd_seq_addr sender; /* sender address */
608 struct snd_seq_addr dest; /* destination address */
609 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
610 unsigned int flags; /* modes */
611 unsigned char queue; /* input time-stamp queue (optional) */
612 unsigned char pad[3]; /* reserved */
613 char reserved[64];
614};
615
616/* type of query subscription */
617#define SNDRV_SEQ_QUERY_SUBS_READ 0
618#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
619
620struct snd_seq_query_subs {
621 struct snd_seq_addr root; /* client/port id to be searched */
622 int type; /* READ or WRITE */
623 int index; /* 0..N-1 */
624 int num_subs; /* R/O: number of subscriptions on this port */
625 struct snd_seq_addr addr; /* R/O: result */
626 unsigned char queue; /* R/O: result */
627 unsigned int flags; /* R/O: result */
628 char reserved[64]; /* for future use */
629};
630
631
632/*
633 * IOCTL commands
634 */
635
636#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
637#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
638#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
639#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
640
641#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
642#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
643
644#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
645#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
646#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
647#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
648
649#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
650#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
651
652#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
653#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
654#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
655#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
656#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
657#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
658#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
659#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
660#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
661#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
662#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
663#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
664/* XXX
665#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
666#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
667*/
668#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
669#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
670#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
671#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
672#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
673#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
674#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
675#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
676#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
677
678#endif /* __SOUND_ASEQUENCER_H */ 86#endif /* __SOUND_ASEQUENCER_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index dfe7d441748c..c2dff5369d33 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -19,13 +19,9 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * 20 *
21 */ 21 */
22
23#ifndef __SOUND_ASOUND_H 22#ifndef __SOUND_ASOUND_H
24#define __SOUND_ASOUND_H 23#define __SOUND_ASOUND_H
25 24
26#include <linux/types.h>
27
28#ifdef __KERNEL__
29#include <linux/ioctl.h> 25#include <linux/ioctl.h>
30#include <linux/time.h> 26#include <linux/time.h>
31#include <asm/byteorder.h> 27#include <asm/byteorder.h>
@@ -40,934 +36,5 @@
40#endif 36#endif
41#endif 37#endif
42 38
43#endif /* __KERNEL__ **/ 39#include <uapi/sound/asound.h>
44
45/*
46 * protocol version
47 */
48
49#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
50#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
51#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
52#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
53#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
54 (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
55 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
56 SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
57
58/****************************************************************************
59 * *
60 * Digital audio interface *
61 * *
62 ****************************************************************************/
63
64struct snd_aes_iec958 {
65 unsigned char status[24]; /* AES/IEC958 channel status bits */
66 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
67 unsigned char pad; /* nothing */
68 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
69};
70
71/****************************************************************************
72 * *
73 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
74 * *
75 ****************************************************************************/
76
77struct snd_cea_861_aud_if {
78 unsigned char db1_ct_cc; /* coding type and channel count */
79 unsigned char db2_sf_ss; /* sample frequency and size */
80 unsigned char db3; /* not used, all zeros */
81 unsigned char db4_ca; /* channel allocation code */
82 unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
83};
84
85/****************************************************************************
86 * *
87 * Section for driver hardware dependent interface - /dev/snd/hw? *
88 * *
89 ****************************************************************************/
90
91#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
92
93enum {
94 SNDRV_HWDEP_IFACE_OPL2 = 0,
95 SNDRV_HWDEP_IFACE_OPL3,
96 SNDRV_HWDEP_IFACE_OPL4,
97 SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
98 SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
99 SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
100 SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
101 SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
102 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
103 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
104 SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
105 SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
106 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
107 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
108 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
109 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
110 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
111 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
112
113 /* Don't forget to change the following: */
114 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
115};
116
117struct snd_hwdep_info {
118 unsigned int device; /* WR: device number */
119 int card; /* R: card number */
120 unsigned char id[64]; /* ID (user selectable) */
121 unsigned char name[80]; /* hwdep name */
122 int iface; /* hwdep interface */
123 unsigned char reserved[64]; /* reserved for future */
124};
125
126/* generic DSP loader */
127struct snd_hwdep_dsp_status {
128 unsigned int version; /* R: driver-specific version */
129 unsigned char id[32]; /* R: driver-specific ID string */
130 unsigned int num_dsps; /* R: number of DSP images to transfer */
131 unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */
132 unsigned int chip_ready; /* R: 1 = initialization finished */
133 unsigned char reserved[16]; /* reserved for future use */
134};
135
136struct snd_hwdep_dsp_image {
137 unsigned int index; /* W: DSP index */
138 unsigned char name[64]; /* W: ID (e.g. file name) */
139 unsigned char __user *image; /* W: binary image */
140 size_t length; /* W: size of image in bytes */
141 unsigned long driver_data; /* W: driver-specific data */
142};
143
144#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
145#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
146#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
147#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
148
149/*****************************************************************************
150 * *
151 * Digital Audio (PCM) interface - /dev/snd/pcm?? *
152 * *
153 *****************************************************************************/
154
155#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10)
156
157typedef unsigned long snd_pcm_uframes_t;
158typedef signed long snd_pcm_sframes_t;
159
160enum {
161 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
162 SNDRV_PCM_CLASS_MULTI, /* multichannel device */
163 SNDRV_PCM_CLASS_MODEM, /* software modem class */
164 SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
165 /* Don't forget to change the following: */
166 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
167};
168
169enum {
170 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
171 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
172 /* Don't forget to change the following: */
173 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
174};
175
176enum {
177 SNDRV_PCM_STREAM_PLAYBACK = 0,
178 SNDRV_PCM_STREAM_CAPTURE,
179 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
180};
181
182typedef int __bitwise snd_pcm_access_t;
183#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
184#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
185#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
186#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
187#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
188#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
189
190typedef int __bitwise snd_pcm_format_t;
191#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
192#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
193#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
194#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
195#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
196#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
197#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
198#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
199#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
200#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
201#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
202#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
203#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
204#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
205#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
206#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
207#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
208#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
209#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
210#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
211#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
212#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
213#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
214#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
215#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
216#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
217#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
218#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
219#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
220#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
221#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
222#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
223#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
224#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
225#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
226#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
227#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
228#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
229#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
230#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
231#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
232#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
233#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B
234
235#ifdef SNDRV_LITTLE_ENDIAN
236#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
237#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
238#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
239#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
240#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
241#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
242#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
243#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
244#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
245#endif
246#ifdef SNDRV_BIG_ENDIAN
247#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
248#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
249#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
250#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
251#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
252#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
253#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
254#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
255#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
256#endif
257
258typedef int __bitwise snd_pcm_subformat_t;
259#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
260#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
261
262#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
263#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
264#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
265#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
266#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
267#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
268#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
269#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
270#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
271#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
272#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
273#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
274#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
275#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
276#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
277#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
278
279typedef int __bitwise snd_pcm_state_t;
280#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
281#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
282#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
283#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
284#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
285#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
286#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
287#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
288#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
289#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
290
291enum {
292 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
293 SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
294 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
295};
296
297union snd_pcm_sync_id {
298 unsigned char id[16];
299 unsigned short id16[8];
300 unsigned int id32[4];
301};
302
303struct snd_pcm_info {
304 unsigned int device; /* RO/WR (control): device number */
305 unsigned int subdevice; /* RO/WR (control): subdevice number */
306 int stream; /* RO/WR (control): stream direction */
307 int card; /* R: card number */
308 unsigned char id[64]; /* ID (user selectable) */
309 unsigned char name[80]; /* name of this device */
310 unsigned char subname[32]; /* subdevice name */
311 int dev_class; /* SNDRV_PCM_CLASS_* */
312 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
313 unsigned int subdevices_count;
314 unsigned int subdevices_avail;
315 union snd_pcm_sync_id sync; /* hardware synchronization ID */
316 unsigned char reserved[64]; /* reserved for future... */
317};
318
319typedef int snd_pcm_hw_param_t;
320#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
321#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
322#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
323#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
324#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
325
326#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
327#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
328#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
329#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
330#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
331 * interrupts in us
332 */
333#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
334 * interrupts
335 */
336#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
337 * interrupts
338 */
339#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
340 * buffer
341 */
342#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
343 * in us
344 */
345#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
346#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
347#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
348#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
349#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
350
351#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
352#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
353#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
354
355struct snd_interval {
356 unsigned int min, max;
357 unsigned int openmin:1,
358 openmax:1,
359 integer:1,
360 empty:1;
361};
362
363#define SNDRV_MASK_MAX 256
364
365struct snd_mask {
366 __u32 bits[(SNDRV_MASK_MAX+31)/32];
367};
368
369struct snd_pcm_hw_params {
370 unsigned int flags;
371 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
372 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
373 struct snd_mask mres[5]; /* reserved masks */
374 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
375 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
376 struct snd_interval ires[9]; /* reserved intervals */
377 unsigned int rmask; /* W: requested masks */
378 unsigned int cmask; /* R: changed masks */
379 unsigned int info; /* R: Info flags for returned setup */
380 unsigned int msbits; /* R: used most significant bits */
381 unsigned int rate_num; /* R: rate numerator */
382 unsigned int rate_den; /* R: rate denominator */
383 snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
384 unsigned char reserved[64]; /* reserved for future */
385};
386
387enum {
388 SNDRV_PCM_TSTAMP_NONE = 0,
389 SNDRV_PCM_TSTAMP_ENABLE,
390 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
391};
392
393struct snd_pcm_sw_params {
394 int tstamp_mode; /* timestamp mode */
395 unsigned int period_step;
396 unsigned int sleep_min; /* min ticks to sleep */
397 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
398 snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
399 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
400 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
401 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
402 snd_pcm_uframes_t silence_size; /* silence block size */
403 snd_pcm_uframes_t boundary; /* pointers wrap point */
404 unsigned char reserved[64]; /* reserved for future */
405};
406
407struct snd_pcm_channel_info {
408 unsigned int channel;
409 __kernel_off_t offset; /* mmap offset */
410 unsigned int first; /* offset to first sample in bits */
411 unsigned int step; /* samples distance in bits */
412};
413
414struct snd_pcm_status {
415 snd_pcm_state_t state; /* stream state */
416 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
417 struct timespec tstamp; /* reference timestamp */
418 snd_pcm_uframes_t appl_ptr; /* appl ptr */
419 snd_pcm_uframes_t hw_ptr; /* hw ptr */
420 snd_pcm_sframes_t delay; /* current delay in frames */
421 snd_pcm_uframes_t avail; /* number of frames available */
422 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
423 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
424 snd_pcm_state_t suspended_state; /* suspended stream state */
425 unsigned char reserved[60]; /* must be filled with zero */
426};
427
428struct snd_pcm_mmap_status {
429 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
430 int pad1; /* Needed for 64 bit alignment */
431 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
432 struct timespec tstamp; /* Timestamp */
433 snd_pcm_state_t suspended_state; /* RO: suspended stream state */
434};
435
436struct snd_pcm_mmap_control {
437 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
438 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
439};
440
441#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
442#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
443#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
444
445struct snd_pcm_sync_ptr {
446 unsigned int flags;
447 union {
448 struct snd_pcm_mmap_status status;
449 unsigned char reserved[64];
450 } s;
451 union {
452 struct snd_pcm_mmap_control control;
453 unsigned char reserved[64];
454 } c;
455};
456
457struct snd_xferi {
458 snd_pcm_sframes_t result;
459 void __user *buf;
460 snd_pcm_uframes_t frames;
461};
462
463struct snd_xfern {
464 snd_pcm_sframes_t result;
465 void __user * __user *bufs;
466 snd_pcm_uframes_t frames;
467};
468
469enum {
470 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
471 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
472 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
473};
474
475/* channel positions */
476enum {
477 SNDRV_CHMAP_UNKNOWN = 0,
478 SNDRV_CHMAP_NA, /* N/A, silent */
479 SNDRV_CHMAP_MONO, /* mono stream */
480 /* this follows the alsa-lib mixer channel value + 3 */
481 SNDRV_CHMAP_FL, /* front left */
482 SNDRV_CHMAP_FR, /* front right */
483 SNDRV_CHMAP_RL, /* rear left */
484 SNDRV_CHMAP_RR, /* rear right */
485 SNDRV_CHMAP_FC, /* front center */
486 SNDRV_CHMAP_LFE, /* LFE */
487 SNDRV_CHMAP_SL, /* side left */
488 SNDRV_CHMAP_SR, /* side right */
489 SNDRV_CHMAP_RC, /* rear center */
490 /* new definitions */
491 SNDRV_CHMAP_FLC, /* front left center */
492 SNDRV_CHMAP_FRC, /* front right center */
493 SNDRV_CHMAP_RLC, /* rear left center */
494 SNDRV_CHMAP_RRC, /* rear right center */
495 SNDRV_CHMAP_FLW, /* front left wide */
496 SNDRV_CHMAP_FRW, /* front right wide */
497 SNDRV_CHMAP_FLH, /* front left high */
498 SNDRV_CHMAP_FCH, /* front center high */
499 SNDRV_CHMAP_FRH, /* front right high */
500 SNDRV_CHMAP_TC, /* top center */
501 SNDRV_CHMAP_TFL, /* top front left */
502 SNDRV_CHMAP_TFR, /* top front right */
503 SNDRV_CHMAP_TFC, /* top front center */
504 SNDRV_CHMAP_TRL, /* top rear left */
505 SNDRV_CHMAP_TRR, /* top rear right */
506 SNDRV_CHMAP_TRC, /* top rear center */
507 SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC,
508};
509
510#define SNDRV_CHMAP_POSITION_MASK 0xffff
511#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
512#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
513
514#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
515#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
516#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
517#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
518#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
519#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
520#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
521#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
522#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
523#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
524#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
525#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
526#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
527#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
528#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
529#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
530#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
531#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
532#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
533#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
534#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
535#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
536#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
537#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
538#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
539#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
540#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
541#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
542#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
543
544/*****************************************************************************
545 * *
546 * MIDI v1.0 interface *
547 * *
548 *****************************************************************************/
549
550/*
551 * Raw MIDI section - /dev/snd/midi??
552 */
553
554#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
555
556enum {
557 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
558 SNDRV_RAWMIDI_STREAM_INPUT,
559 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
560};
561
562#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
563#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
564#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
565
566struct snd_rawmidi_info {
567 unsigned int device; /* RO/WR (control): device number */
568 unsigned int subdevice; /* RO/WR (control): subdevice number */
569 int stream; /* WR: stream */
570 int card; /* R: card number */
571 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
572 unsigned char id[64]; /* ID (user selectable) */
573 unsigned char name[80]; /* name of device */
574 unsigned char subname[32]; /* name of active or selected subdevice */
575 unsigned int subdevices_count;
576 unsigned int subdevices_avail;
577 unsigned char reserved[64]; /* reserved for future use */
578};
579
580struct snd_rawmidi_params {
581 int stream;
582 size_t buffer_size; /* queue size in bytes */
583 size_t avail_min; /* minimum avail bytes for wakeup */
584 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
585 unsigned char reserved[16]; /* reserved for future use */
586};
587
588struct snd_rawmidi_status {
589 int stream;
590 struct timespec tstamp; /* Timestamp */
591 size_t avail; /* available bytes */
592 size_t xruns; /* count of overruns since last status (in bytes) */
593 unsigned char reserved[16]; /* reserved for future use */
594};
595
596#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
597#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
598#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
599#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
600#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
601#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
602
603/*
604 * Timer section - /dev/snd/timer
605 */
606
607#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
608
609enum {
610 SNDRV_TIMER_CLASS_NONE = -1,
611 SNDRV_TIMER_CLASS_SLAVE = 0,
612 SNDRV_TIMER_CLASS_GLOBAL,
613 SNDRV_TIMER_CLASS_CARD,
614 SNDRV_TIMER_CLASS_PCM,
615 SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
616};
617
618/* slave timer classes */
619enum {
620 SNDRV_TIMER_SCLASS_NONE = 0,
621 SNDRV_TIMER_SCLASS_APPLICATION,
622 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
623 SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
624 SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
625};
626
627/* global timers (device member) */
628#define SNDRV_TIMER_GLOBAL_SYSTEM 0
629#define SNDRV_TIMER_GLOBAL_RTC 1
630#define SNDRV_TIMER_GLOBAL_HPET 2
631#define SNDRV_TIMER_GLOBAL_HRTIMER 3
632
633/* info flags */
634#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
635
636struct snd_timer_id {
637 int dev_class;
638 int dev_sclass;
639 int card;
640 int device;
641 int subdevice;
642};
643
644struct snd_timer_ginfo {
645 struct snd_timer_id tid; /* requested timer ID */
646 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
647 int card; /* card number */
648 unsigned char id[64]; /* timer identification */
649 unsigned char name[80]; /* timer name */
650 unsigned long reserved0; /* reserved for future use */
651 unsigned long resolution; /* average period resolution in ns */
652 unsigned long resolution_min; /* minimal period resolution in ns */
653 unsigned long resolution_max; /* maximal period resolution in ns */
654 unsigned int clients; /* active timer clients */
655 unsigned char reserved[32];
656};
657
658struct snd_timer_gparams {
659 struct snd_timer_id tid; /* requested timer ID */
660 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
661 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
662 unsigned char reserved[32];
663};
664
665struct snd_timer_gstatus {
666 struct snd_timer_id tid; /* requested timer ID */
667 unsigned long resolution; /* current period resolution in ns */
668 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
669 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
670 unsigned char reserved[32];
671};
672
673struct snd_timer_select {
674 struct snd_timer_id id; /* bind to timer ID */
675 unsigned char reserved[32]; /* reserved */
676};
677
678struct snd_timer_info {
679 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
680 int card; /* card number */
681 unsigned char id[64]; /* timer identificator */
682 unsigned char name[80]; /* timer name */
683 unsigned long reserved0; /* reserved for future use */
684 unsigned long resolution; /* average period resolution in ns */
685 unsigned char reserved[64]; /* reserved */
686};
687
688#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */
689#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
690#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
691
692struct snd_timer_params {
693 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
694 unsigned int ticks; /* requested resolution in ticks */
695 unsigned int queue_size; /* total size of queue (32-1024) */
696 unsigned int reserved0; /* reserved, was: failure locations */
697 unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
698 unsigned char reserved[60]; /* reserved */
699};
700
701struct snd_timer_status {
702 struct timespec tstamp; /* Timestamp - last update */
703 unsigned int resolution; /* current period resolution in ns */
704 unsigned int lost; /* counter of master tick lost */
705 unsigned int overrun; /* count of read queue overruns */
706 unsigned int queue; /* used queue size */
707 unsigned char reserved[64]; /* reserved */
708};
709
710#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
711#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
712#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
713#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
714#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
715#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
716#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
717#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
718#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
719#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
720/* The following four ioctls are changed since 1.0.9 due to confliction */
721#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
722#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
723#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
724#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
725
726struct snd_timer_read {
727 unsigned int resolution;
728 unsigned int ticks;
729};
730
731enum {
732 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
733 SNDRV_TIMER_EVENT_TICK, /* val = ticks */
734 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
735 SNDRV_TIMER_EVENT_STOP, /* val = 0 */
736 SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
737 SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
738 SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
739 SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
740 SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
741 /* master timer events for slave timer instances */
742 SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
743 SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
744 SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
745 SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
746 SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
747 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
748};
749
750struct snd_timer_tread {
751 int event;
752 struct timespec tstamp;
753 unsigned int val;
754};
755
756/****************************************************************************
757 * *
758 * Section for driver control interface - /dev/snd/control? *
759 * *
760 ****************************************************************************/
761
762#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
763
764struct snd_ctl_card_info {
765 int card; /* card number */
766 int pad; /* reserved for future (was type) */
767 unsigned char id[16]; /* ID of card (user selectable) */
768 unsigned char driver[16]; /* Driver name */
769 unsigned char name[32]; /* Short name of soundcard */
770 unsigned char longname[80]; /* name + info text about soundcard */
771 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
772 unsigned char mixername[80]; /* visual mixer identification */
773 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
774};
775
776typedef int __bitwise snd_ctl_elem_type_t;
777#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
778#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
779#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
780#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
781#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
782#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
783#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
784#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
785
786typedef int __bitwise snd_ctl_elem_iface_t;
787#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
788#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
789#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
790#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
791#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
792#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
793#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
794#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
795
796#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
797#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
798#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
799#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
800#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
801#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
802#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
803#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
804#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
805#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
806#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
807#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
808#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
809#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
810/* bits 30 and 31 are obsoleted (for indirect access) */
811
812/* for further details see the ACPI and PCI power management specification */
813#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
814#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
815#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
816#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
817#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
818#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
819
820struct snd_ctl_elem_id {
821 unsigned int numid; /* numeric identifier, zero = invalid */
822 snd_ctl_elem_iface_t iface; /* interface identifier */
823 unsigned int device; /* device/client number */
824 unsigned int subdevice; /* subdevice (substream) number */
825 unsigned char name[44]; /* ASCII name of item */
826 unsigned int index; /* index of item */
827};
828
829struct snd_ctl_elem_list {
830 unsigned int offset; /* W: first element ID to get */
831 unsigned int space; /* W: count of element IDs to get */
832 unsigned int used; /* R: count of element IDs set */
833 unsigned int count; /* R: count of all elements */
834 struct snd_ctl_elem_id __user *pids; /* R: IDs */
835 unsigned char reserved[50];
836};
837
838struct snd_ctl_elem_info {
839 struct snd_ctl_elem_id id; /* W: element ID */
840 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
841 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
842 unsigned int count; /* count of values */
843 __kernel_pid_t owner; /* owner's PID of this control */
844 union {
845 struct {
846 long min; /* R: minimum value */
847 long max; /* R: maximum value */
848 long step; /* R: step (0 variable) */
849 } integer;
850 struct {
851 long long min; /* R: minimum value */
852 long long max; /* R: maximum value */
853 long long step; /* R: step (0 variable) */
854 } integer64;
855 struct {
856 unsigned int items; /* R: number of items */
857 unsigned int item; /* W: item number */
858 char name[64]; /* R: value name */
859 __u64 names_ptr; /* W: names list (ELEM_ADD only) */
860 unsigned int names_length;
861 } enumerated;
862 unsigned char reserved[128];
863 } value;
864 union {
865 unsigned short d[4]; /* dimensions */
866 unsigned short *d_ptr; /* indirect - obsoleted */
867 } dimen;
868 unsigned char reserved[64-4*sizeof(unsigned short)];
869};
870
871struct snd_ctl_elem_value {
872 struct snd_ctl_elem_id id; /* W: element ID */
873 unsigned int indirect: 1; /* W: indirect access - obsoleted */
874 union {
875 union {
876 long value[128];
877 long *value_ptr; /* obsoleted */
878 } integer;
879 union {
880 long long value[64];
881 long long *value_ptr; /* obsoleted */
882 } integer64;
883 union {
884 unsigned int item[128];
885 unsigned int *item_ptr; /* obsoleted */
886 } enumerated;
887 union {
888 unsigned char data[512];
889 unsigned char *data_ptr; /* obsoleted */
890 } bytes;
891 struct snd_aes_iec958 iec958;
892 } value; /* RO */
893 struct timespec tstamp;
894 unsigned char reserved[128-sizeof(struct timespec)];
895};
896
897struct snd_ctl_tlv {
898 unsigned int numid; /* control element numeric identification */
899 unsigned int length; /* in bytes aligned to 4 */
900 unsigned int tlv[0]; /* first TLV */
901};
902
903#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
904#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
905#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
906#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
907#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
908#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
909#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
910#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
911#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
912#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
913#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
914#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
915#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
916#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
917#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
918#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
919#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
920#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
921#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
922#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
923#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
924#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
925#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
926#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
927#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
928
929/*
930 * Read interface.
931 */
932
933enum sndrv_ctl_event_type {
934 SNDRV_CTL_EVENT_ELEM = 0,
935 SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
936};
937
938#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
939#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
940#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
941#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
942#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
943
944struct snd_ctl_event {
945 int type; /* event type - SNDRV_CTL_EVENT_* */
946 union {
947 struct {
948 unsigned int mask;
949 struct snd_ctl_elem_id id;
950 } elem;
951 unsigned char data8[60];
952 } data;
953};
954
955/*
956 * Control names
957 */
958
959#define SNDRV_CTL_NAME_NONE ""
960#define SNDRV_CTL_NAME_PLAYBACK "Playback "
961#define SNDRV_CTL_NAME_CAPTURE "Capture "
962
963#define SNDRV_CTL_NAME_IEC958_NONE ""
964#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
965#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
966#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
967#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
968#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
969#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
970#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
971#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
972
973#endif /* __SOUND_ASOUND_H */ 40#endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/cs4271.h b/include/sound/cs4271.h
index 50a059e7d116..6d9e15ed1dcf 100644
--- a/include/sound/cs4271.h
+++ b/include/sound/cs4271.h
@@ -19,6 +19,7 @@
19 19
20struct cs4271_platform_data { 20struct cs4271_platform_data {
21 int gpio_nreset; /* GPIO driving Reset pin, if any */ 21 int gpio_nreset; /* GPIO driving Reset pin, if any */
22 int amutec_eq_bmutec:1; /* flag to enable AMUTEC=BMUTEC */
22}; 23};
23 24
24#endif /* __CS4271_H */ 25#endif /* __CS4271_H */
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 1a33f48ebe78..f841ba4bacb8 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1,8 +1,3 @@
1#ifndef __SOUND_EMU10K1_H
2#define __SOUND_EMU10K1_H
3
4#include <linux/types.h>
5
6/* 1/*
7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
8 * Creative Labs, Inc. 3 * Creative Labs, Inc.
@@ -24,8 +19,9 @@
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * 20 *
26 */ 21 */
22#ifndef __SOUND_EMU10K1_H
23#define __SOUND_EMU10K1_H
27 24
28#ifdef __KERNEL__
29 25
30#include <sound/pcm.h> 26#include <sound/pcm.h>
31#include <sound/rawmidi.h> 27#include <sound/rawmidi.h>
@@ -36,8 +32,10 @@
36#include <sound/timer.h> 32#include <sound/timer.h>
37#include <linux/interrupt.h> 33#include <linux/interrupt.h>
38#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/firmware.h>
39 36
40#include <asm/io.h> 37#include <asm/io.h>
38#include <uapi/sound/emu10k1.h>
41 39
42/* ------------------- DEFINES -------------------- */ 40/* ------------------- DEFINES -------------------- */
43 41
@@ -1788,6 +1786,8 @@ struct snd_emu10k1 {
1788 unsigned int efx_voices_mask[2]; 1786 unsigned int efx_voices_mask[2];
1789 unsigned int next_free_voice; 1787 unsigned int next_free_voice;
1790 1788
1789 const struct firmware *firmware;
1790
1791#ifdef CONFIG_PM_SLEEP 1791#ifdef CONFIG_PM_SLEEP
1792 unsigned int *saved_ptr; 1792 unsigned int *saved_ptr;
1793 unsigned int *saved_gpr; 1793 unsigned int *saved_gpr;
@@ -1796,6 +1796,7 @@ struct snd_emu10k1 {
1796 unsigned int *saved_icode; 1796 unsigned int *saved_icode;
1797 unsigned int *p16v_saved; 1797 unsigned int *p16v_saved;
1798 unsigned int saved_a_iocfg, saved_hcfg; 1798 unsigned int saved_a_iocfg, saved_hcfg;
1799 bool suspend;
1799#endif 1800#endif
1800 1801
1801}; 1802};
@@ -1899,350 +1900,4 @@ int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
1899int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu, 1900int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
1900 struct snd_emu10k1_fx8010_irq *irq); 1901 struct snd_emu10k1_fx8010_irq *irq);
1901 1902
1902#endif /* __KERNEL__ */
1903
1904/*
1905 * ---- FX8010 ----
1906 */
1907
1908#define EMU10K1_CARD_CREATIVE 0x00000000
1909#define EMU10K1_CARD_EMUAPS 0x00000001
1910
1911#define EMU10K1_FX8010_PCM_COUNT 8
1912
1913/* instruction set */
1914#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
1915#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
1916#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
1917#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
1918#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
1919#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
1920#define iACC3 0x06 /* R = A + X + Y ; saturation */
1921#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
1922#define iANDXOR 0x08 /* R = (A & X) ^ Y */
1923#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
1924#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
1925#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
1926#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
1927#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
1928#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
1929#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
1930
1931/* GPRs */
1932#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
1933#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
1934#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
1935#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
1936 /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
1937
1938#define C_00000000 0x40
1939#define C_00000001 0x41
1940#define C_00000002 0x42
1941#define C_00000003 0x43
1942#define C_00000004 0x44
1943#define C_00000008 0x45
1944#define C_00000010 0x46
1945#define C_00000020 0x47
1946#define C_00000100 0x48
1947#define C_00010000 0x49
1948#define C_00080000 0x4a
1949#define C_10000000 0x4b
1950#define C_20000000 0x4c
1951#define C_40000000 0x4d
1952#define C_80000000 0x4e
1953#define C_7fffffff 0x4f
1954#define C_ffffffff 0x50
1955#define C_fffffffe 0x51
1956#define C_c0000000 0x52
1957#define C_4f1bbcdc 0x53
1958#define C_5a7ef9db 0x54
1959#define C_00100000 0x55 /* ?? */
1960#define GPR_ACCU 0x56 /* ACCUM, accumulator */
1961#define GPR_COND 0x57 /* CCR, condition register */
1962#define GPR_NOISE0 0x58 /* noise source */
1963#define GPR_NOISE1 0x59 /* noise source */
1964#define GPR_IRQ 0x5a /* IRQ register */
1965#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
1966#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
1967#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
1968#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
1969#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
1970#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
1971
1972#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
1973#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
1974#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
1975#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
1976#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
1977#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
1978
1979#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */
1980#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */
1981#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
1982#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */
1983#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
1984#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
1985#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
1986#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
1987#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
1988#define A_GPR(x) (A_FXGPREGBASE + (x))
1989
1990/* cc_reg constants */
1991#define CC_REG_NORMALIZED C_00000001
1992#define CC_REG_BORROW C_00000002
1993#define CC_REG_MINUS C_00000004
1994#define CC_REG_ZERO C_00000008
1995#define CC_REG_SATURATE C_00000010
1996#define CC_REG_NONZERO C_00000100
1997
1998/* FX buses */
1999#define FXBUS_PCM_LEFT 0x00
2000#define FXBUS_PCM_RIGHT 0x01
2001#define FXBUS_PCM_LEFT_REAR 0x02
2002#define FXBUS_PCM_RIGHT_REAR 0x03
2003#define FXBUS_MIDI_LEFT 0x04
2004#define FXBUS_MIDI_RIGHT 0x05
2005#define FXBUS_PCM_CENTER 0x06
2006#define FXBUS_PCM_LFE 0x07
2007#define FXBUS_PCM_LEFT_FRONT 0x08
2008#define FXBUS_PCM_RIGHT_FRONT 0x09
2009#define FXBUS_MIDI_REVERB 0x0c
2010#define FXBUS_MIDI_CHORUS 0x0d
2011#define FXBUS_PCM_LEFT_SIDE 0x0e
2012#define FXBUS_PCM_RIGHT_SIDE 0x0f
2013#define FXBUS_PT_LEFT 0x14
2014#define FXBUS_PT_RIGHT 0x15
2015
2016/* Inputs */
2017#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
2018#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
2019#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
2020#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
2021#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
2022#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
2023#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
2024#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
2025#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
2026#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
2027#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
2028#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
2029#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
2030#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
2031
2032/* Outputs */
2033#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
2034#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
2035#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
2036#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
2037#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
2038#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
2039#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
2040#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
2041#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
2042#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
2043#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
2044#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
2045#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
2046#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
2047#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
2048#define EXTOUT_ACENTER 0x11 /* Analog Center */
2049#define EXTOUT_ALFE 0x12 /* Analog LFE */
2050
2051/* Audigy Inputs */
2052#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
2053#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
2054#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
2055#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
2056#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
2057#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
2058#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
2059#define A_EXTIN_LINE2_R 0x09 /* right */
2060#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
2061#define A_EXTIN_ADC_R 0x0b /* right */
2062#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
2063#define A_EXTIN_AUX2_R 0x0d /* - right */
2064
2065/* Audigiy Outputs */
2066#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
2067#define A_EXTOUT_FRONT_R 0x01 /* right */
2068#define A_EXTOUT_CENTER 0x02 /* digital front center */
2069#define A_EXTOUT_LFE 0x03 /* digital front lfe */
2070#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
2071#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
2072#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
2073#define A_EXTOUT_REAR_R 0x07 /* right */
2074#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
2075#define A_EXTOUT_AFRONT_R 0x09 /* right */
2076#define A_EXTOUT_ACENTER 0x0a /* analog center */
2077#define A_EXTOUT_ALFE 0x0b /* analog LFE */
2078#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
2079#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
2080#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
2081#define A_EXTOUT_AREAR_R 0x0f /* right */
2082#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
2083#define A_EXTOUT_AC97_R 0x11 /* right */
2084#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
2085#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
2086#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
2087
2088/* Audigy constants */
2089#define A_C_00000000 0xc0
2090#define A_C_00000001 0xc1
2091#define A_C_00000002 0xc2
2092#define A_C_00000003 0xc3
2093#define A_C_00000004 0xc4
2094#define A_C_00000008 0xc5
2095#define A_C_00000010 0xc6
2096#define A_C_00000020 0xc7
2097#define A_C_00000100 0xc8
2098#define A_C_00010000 0xc9
2099#define A_C_00000800 0xca
2100#define A_C_10000000 0xcb
2101#define A_C_20000000 0xcc
2102#define A_C_40000000 0xcd
2103#define A_C_80000000 0xce
2104#define A_C_7fffffff 0xcf
2105#define A_C_ffffffff 0xd0
2106#define A_C_fffffffe 0xd1
2107#define A_C_c0000000 0xd2
2108#define A_C_4f1bbcdc 0xd3
2109#define A_C_5a7ef9db 0xd4
2110#define A_C_00100000 0xd5
2111#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
2112#define A_GPR_COND 0xd7 /* CCR, condition register */
2113#define A_GPR_NOISE0 0xd8 /* noise source */
2114#define A_GPR_NOISE1 0xd9 /* noise source */
2115#define A_GPR_IRQ 0xda /* IRQ register */
2116#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
2117#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
2118
2119/* definitions for debug register */
2120#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
2121#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
2122#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
2123#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
2124#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
2125#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
2126#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
2127
2128/* tank memory address line */
2129#ifndef __KERNEL__
2130#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
2131#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
2132#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
2133#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
2134#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
2135#endif
2136
2137struct snd_emu10k1_fx8010_info {
2138 unsigned int internal_tram_size; /* in samples */
2139 unsigned int external_tram_size; /* in samples */
2140 char fxbus_names[16][32]; /* names of FXBUSes */
2141 char extin_names[16][32]; /* names of external inputs */
2142 char extout_names[32][32]; /* names of external outputs */
2143 unsigned int gpr_controls; /* count of GPR controls */
2144};
2145
2146#define EMU10K1_GPR_TRANSLATION_NONE 0
2147#define EMU10K1_GPR_TRANSLATION_TABLE100 1
2148#define EMU10K1_GPR_TRANSLATION_BASS 2
2149#define EMU10K1_GPR_TRANSLATION_TREBLE 3
2150#define EMU10K1_GPR_TRANSLATION_ONOFF 4
2151
2152struct snd_emu10k1_fx8010_control_gpr {
2153 struct snd_ctl_elem_id id; /* full control ID definition */
2154 unsigned int vcount; /* visible count */
2155 unsigned int count; /* count of GPR (1..16) */
2156 unsigned short gpr[32]; /* GPR number(s) */
2157 unsigned int value[32]; /* initial values */
2158 unsigned int min; /* minimum range */
2159 unsigned int max; /* maximum range */
2160 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
2161 const unsigned int *tlv;
2162};
2163
2164/* old ABI without TLV support */
2165struct snd_emu10k1_fx8010_control_old_gpr {
2166 struct snd_ctl_elem_id id;
2167 unsigned int vcount;
2168 unsigned int count;
2169 unsigned short gpr[32];
2170 unsigned int value[32];
2171 unsigned int min;
2172 unsigned int max;
2173 unsigned int translation;
2174};
2175
2176struct snd_emu10k1_fx8010_code {
2177 char name[128];
2178
2179 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
2180 __u32 __user *gpr_map; /* initializers */
2181
2182 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
2183 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
2184
2185 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
2186 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
2187
2188 unsigned int gpr_list_control_count; /* count of GPR controls to list */
2189 unsigned int gpr_list_control_total; /* total count of GPR controls */
2190 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
2191
2192 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
2193 __u32 __user *tram_data_map; /* data initializers */
2194 __u32 __user *tram_addr_map; /* map initializers */
2195
2196 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
2197 __u32 __user *code; /* one instruction - 64 bits */
2198};
2199
2200struct snd_emu10k1_fx8010_tram {
2201 unsigned int address; /* 31.bit == 1 -> external TRAM */
2202 unsigned int size; /* size in samples (4 bytes) */
2203 unsigned int *samples; /* pointer to samples (20-bit) */
2204 /* NULL->clear memory */
2205};
2206
2207struct snd_emu10k1_fx8010_pcm_rec {
2208 unsigned int substream; /* substream number */
2209 unsigned int res1; /* reserved */
2210 unsigned int channels; /* 16-bit channels count, zero = remove this substream */
2211 unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
2212 unsigned int buffer_size; /* count of buffered samples */
2213 unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
2214 unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
2215 unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
2216 unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
2217 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
2218 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
2219 unsigned char pad; /* reserved */
2220 unsigned char etram[32]; /* external TRAM address & data (one per channel) */
2221 unsigned int res2; /* reserved */
2222};
2223
2224#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
2225
2226#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
2227#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
2228#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
2229#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
2230#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
2231#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
2232#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
2233#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
2234#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
2235#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
2236#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
2237#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
2238#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
2239#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
2240
2241/* typedefs for compatibility to user-space */
2242typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
2243typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
2244typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
2245typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
2246typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
2247
2248#endif /* __SOUND_EMU10K1_H */ 1903#endif /* __SOUND_EMU10K1_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 6268a4192d5c..45c1981c9ca2 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -71,6 +71,8 @@ struct snd_pcm_ops {
71 int (*prepare)(struct snd_pcm_substream *substream); 71 int (*prepare)(struct snd_pcm_substream *substream);
72 int (*trigger)(struct snd_pcm_substream *substream, int cmd); 72 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
73 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); 73 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
74 int (*wall_clock)(struct snd_pcm_substream *substream,
75 struct timespec *audio_ts);
74 int (*copy)(struct snd_pcm_substream *substream, int channel, 76 int (*copy)(struct snd_pcm_substream *substream, int channel,
75 snd_pcm_uframes_t pos, 77 snd_pcm_uframes_t pos,
76 void __user *buf, snd_pcm_uframes_t count); 78 void __user *buf, snd_pcm_uframes_t count);
@@ -281,6 +283,7 @@ struct snd_pcm_runtime {
281 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ 283 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
282 unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */ 284 unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
283 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */ 285 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */
286 u64 hw_ptr_wrap; /* offset for hw_ptr due to boundary wrap-around */
284 287
285 /* -- HW params -- */ 288 /* -- HW params -- */
286 snd_pcm_access_t access; /* access mode */ 289 snd_pcm_access_t access; /* access mode */
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index 7e950560e591..c7c7788005e4 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -1,6 +1,3 @@
1#ifndef __SOUND_SB16_CSP_H
2#define __SOUND_SB16_CSP_H
3
4/* 1/*
5 * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si> 2 * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
6 * Takashi Iwai <tiwai@suse.de> 3 * Takashi Iwai <tiwai@suse.de>
@@ -22,106 +19,13 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * 20 *
24 */ 21 */
22#ifndef __SOUND_SB16_CSP_H
23#define __SOUND_SB16_CSP_H
25 24
26/* CSP modes */
27#define SNDRV_SB_CSP_MODE_NONE 0x00
28#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
29#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
30#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
31
32/* CSP load flags */
33#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
34#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
35
36/* CSP sample width */
37#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
38#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
39
40/* CSP channels */
41#define SNDRV_SB_CSP_MONO 0x01
42#define SNDRV_SB_CSP_STEREO 0x02
43
44/* CSP rates */
45#define SNDRV_SB_CSP_RATE_8000 0x01
46#define SNDRV_SB_CSP_RATE_11025 0x02
47#define SNDRV_SB_CSP_RATE_22050 0x04
48#define SNDRV_SB_CSP_RATE_44100 0x08
49#define SNDRV_SB_CSP_RATE_ALL 0x0f
50
51/* CSP running state */
52#define SNDRV_SB_CSP_ST_IDLE 0x00
53#define SNDRV_SB_CSP_ST_LOADED 0x01
54#define SNDRV_SB_CSP_ST_RUNNING 0x02
55#define SNDRV_SB_CSP_ST_PAUSED 0x04
56#define SNDRV_SB_CSP_ST_AUTO 0x08
57#define SNDRV_SB_CSP_ST_QSOUND 0x10
58
59/* maximum QSound value (180 degrees right) */
60#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
61
62/* maximum microcode RIFF file size */
63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
64
65/* microcode header */
66struct snd_sb_csp_mc_header {
67 char codec_name[16]; /* id name of codec */
68 unsigned short func_req; /* requested function */
69};
70
71/* microcode to be loaded */
72struct snd_sb_csp_microcode {
73 struct snd_sb_csp_mc_header info;
74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
75};
76
77/* start CSP with sample_width in mono/stereo */
78struct snd_sb_csp_start {
79 int sample_width; /* sample width, look above */
80 int channels; /* channels, look above */
81};
82
83/* CSP information */
84struct snd_sb_csp_info {
85 char codec_name[16]; /* id name of codec */
86 unsigned short func_nr; /* function number */
87 unsigned int acc_format; /* accepted PCM formats */
88 unsigned short acc_channels; /* accepted channels */
89 unsigned short acc_width; /* accepted sample width */
90 unsigned short acc_rates; /* accepted sample rates */
91 unsigned short csp_mode; /* CSP mode, see above */
92 unsigned short run_channels; /* current channels */
93 unsigned short run_width; /* current sample width */
94 unsigned short version; /* version id: 0x10 - 0x1f */
95 unsigned short state; /* state bits */
96};
97
98/* HWDEP controls */
99/* get CSP information */
100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
101/* load microcode to CSP */
102/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
103 * defined for some architectures like MIPS, and it leads to build errors.
104 * (x86 and co have 14-bit size, thus it's valid, though.)
105 * As a workaround for skipping the size-limit check, here we don't use the
106 * normal _IOW() macro but _IOC() with the manual argument.
107 */
108#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
109 _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
110/* unload microcode from CSP */
111#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
112/* start CSP */
113#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
114/* stop CSP */
115#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
116/* pause CSP and DMA transfer */
117#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
118/* restart CSP and DMA transfer */
119#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
120
121#ifdef __KERNEL__
122#include <sound/sb.h> 25#include <sound/sb.h>
123#include <sound/hwdep.h> 26#include <sound/hwdep.h>
124#include <linux/firmware.h> 27#include <linux/firmware.h>
28#include <uapi/sound/sb16_csp.h>
125 29
126struct snd_sb_csp; 30struct snd_sb_csp;
127 31
@@ -183,6 +87,4 @@ struct snd_sb_csp {
183}; 87};
184 88
185int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep); 89int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
186#endif
187
188#endif /* __SOUND_SB16_CSP */ 90#endif /* __SOUND_SB16_CSP */
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 906010344dd7..cc1c919c6436 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -26,6 +26,7 @@
26 * A: inversion 26 * A: inversion
27 * B: format mode 27 * B: format mode
28 * C: chip specific 28 * C: chip specific
29 * D: clock selecter if master mode
29 */ 30 */
30 31
31/* A: clock inversion */ 32/* A: clock inversion */
@@ -44,6 +45,11 @@
44#define SH_FSI_OPTION_MASK 0x00000F00 45#define SH_FSI_OPTION_MASK 0x00000F00
45#define SH_FSI_ENABLE_STREAM_MODE (1 << 8) /* for 16bit data */ 46#define SH_FSI_ENABLE_STREAM_MODE (1 << 8) /* for 16bit data */
46 47
48/* D: clock selecter if master mode */
49#define SH_FSI_CLK_MASK 0x0000F000
50#define SH_FSI_CLK_EXTERNAL (0 << 12)
51#define SH_FSI_CLK_CPG (1 << 12) /* FSIxCK + FSI-DIV */
52
47/* 53/*
48 * set_rate return value 54 * set_rate return value
49 * 55 *
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 628db7bca4fd..3953cea0ecfb 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -242,7 +242,6 @@ struct snd_soc_dai {
242 unsigned int symmetric_rates:1; 242 unsigned int symmetric_rates:1;
243 struct snd_pcm_runtime *runtime; 243 struct snd_pcm_runtime *runtime;
244 unsigned int active; 244 unsigned int active;
245 unsigned char pop_wait:1;
246 unsigned char probed:1; 245 unsigned char probed:1;
247 246
248 struct snd_soc_dapm_widget *playback_widget; 247 struct snd_soc_dapm_widget *playback_widget;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 91244a096c19..769e27c774a3 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1039,6 +1039,7 @@ struct snd_soc_pcm_runtime {
1039 struct snd_soc_dpcm_runtime dpcm[2]; 1039 struct snd_soc_dpcm_runtime dpcm[2];
1040 1040
1041 long pmdown_time; 1041 long pmdown_time;
1042 unsigned char pop_wait:1;
1042 1043
1043 /* runtime devices */ 1044 /* runtime devices */
1044 struct snd_pcm *pcm; 1045 struct snd_pcm *pcm;
diff --git a/include/sound/tlv320aic32x4.h b/include/sound/tlv320aic32x4.h
index c009f70b4029..24e5d991f148 100644
--- a/include/sound/tlv320aic32x4.h
+++ b/include/sound/tlv320aic32x4.h
@@ -26,6 +26,7 @@ struct aic32x4_pdata {
26 u32 power_cfg; 26 u32 power_cfg;
27 u32 micpga_routing; 27 u32 micpga_routing;
28 bool swapdacs; 28 bool swapdacs;
29 int rstn_gpio;
29}; 30};
30 31
31#endif 32#endif
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 4f67c762cd74..f634f8f85db5 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -27,12 +27,6 @@
27#include <sound/hwdep.h> 27#include <sound/hwdep.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29 29
30#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
31#if !defined(CONFIG_USE_VXLOADER) && !defined(CONFIG_SND_VX_LIB) /* built-in kernel */
32#define SND_VX_FW_LOADER /* use the standard firmware loader */
33#endif
34#endif
35
36struct firmware; 30struct firmware;
37struct device; 31struct device;
38 32
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 2acd54018b64..507910992c59 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -9,6 +9,8 @@ struct se_subsystem_api {
9 struct list_head sub_api_list; 9 struct list_head sub_api_list;
10 10
11 char name[16]; 11 char name[16];
12 char inquiry_prod[16];
13 char inquiry_rev[4];
12 struct module *owner; 14 struct module *owner;
13 15
14 u8 transport_type; 16 u8 transport_type;
@@ -16,46 +18,45 @@ struct se_subsystem_api {
16 int (*attach_hba)(struct se_hba *, u32); 18 int (*attach_hba)(struct se_hba *, u32);
17 void (*detach_hba)(struct se_hba *); 19 void (*detach_hba)(struct se_hba *);
18 int (*pmode_enable_hba)(struct se_hba *, unsigned long); 20 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
19 void *(*allocate_virtdevice)(struct se_hba *, const char *); 21
20 struct se_device *(*create_virtdevice)(struct se_hba *, 22 struct se_device *(*alloc_device)(struct se_hba *, const char *);
21 struct se_subsystem_dev *, void *); 23 int (*configure_device)(struct se_device *);
22 void (*free_device)(void *); 24 void (*free_device)(struct se_device *device);
25
26 ssize_t (*set_configfs_dev_params)(struct se_device *,
27 const char *, ssize_t);
28 ssize_t (*show_configfs_dev_params)(struct se_device *, char *);
29
23 void (*transport_complete)(struct se_cmd *cmd, 30 void (*transport_complete)(struct se_cmd *cmd,
24 struct scatterlist *, 31 struct scatterlist *,
25 unsigned char *); 32 unsigned char *);
26 33
27 int (*parse_cdb)(struct se_cmd *cmd); 34 sense_reason_t (*parse_cdb)(struct se_cmd *cmd);
28 ssize_t (*check_configfs_dev_params)(struct se_hba *,
29 struct se_subsystem_dev *);
30 ssize_t (*set_configfs_dev_params)(struct se_hba *,
31 struct se_subsystem_dev *, const char *, ssize_t);
32 ssize_t (*show_configfs_dev_params)(struct se_hba *,
33 struct se_subsystem_dev *, char *);
34 u32 (*get_device_rev)(struct se_device *);
35 u32 (*get_device_type)(struct se_device *); 35 u32 (*get_device_type)(struct se_device *);
36 sector_t (*get_blocks)(struct se_device *); 36 sector_t (*get_blocks)(struct se_device *);
37 unsigned char *(*get_sense_buffer)(struct se_cmd *); 37 unsigned char *(*get_sense_buffer)(struct se_cmd *);
38}; 38};
39 39
40struct spc_ops { 40struct sbc_ops {
41 int (*execute_rw)(struct se_cmd *cmd); 41 sense_reason_t (*execute_rw)(struct se_cmd *cmd);
42 int (*execute_sync_cache)(struct se_cmd *cmd); 42 sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd);
43 int (*execute_write_same)(struct se_cmd *cmd); 43 sense_reason_t (*execute_write_same)(struct se_cmd *cmd);
44 int (*execute_unmap)(struct se_cmd *cmd); 44 sense_reason_t (*execute_write_same_unmap)(struct se_cmd *cmd);
45 sense_reason_t (*execute_unmap)(struct se_cmd *cmd);
45}; 46};
46 47
47int transport_subsystem_register(struct se_subsystem_api *); 48int transport_subsystem_register(struct se_subsystem_api *);
48void transport_subsystem_release(struct se_subsystem_api *); 49void transport_subsystem_release(struct se_subsystem_api *);
49 50
50struct se_device *transport_add_device_to_core_hba(struct se_hba *,
51 struct se_subsystem_api *, struct se_subsystem_dev *, u32,
52 void *, struct se_dev_limits *, const char *, const char *);
53
54void target_complete_cmd(struct se_cmd *, u8); 51void target_complete_cmd(struct se_cmd *, u8);
55 52
56int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops); 53sense_reason_t spc_parse_cdb(struct se_cmd *cmd, unsigned int *size);
57int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size); 54sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd);
58int spc_get_write_same_sectors(struct se_cmd *cmd); 55sector_t spc_get_write_same_sectors(struct se_cmd *cmd);
56
57sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
58u32 sbc_get_device_rev(struct se_device *dev);
59u32 sbc_get_device_type(struct se_device *dev);
59 60
60void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 61void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
61int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 62int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 5be89373ceac..7cae2360221e 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -62,20 +62,6 @@
62 62
63#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ 63#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
64 64
65/*
66 * struct se_subsystem_dev->su_dev_flags
67*/
68#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001
69#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002
70#define SDF_USING_UDEV_PATH 0x00000004
71#define SDF_USING_ALIAS 0x00000008
72
73/*
74 * struct se_device->dev_flags
75 */
76#define DF_SPC2_RESERVATIONS 0x00000001
77#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000002
78
79/* struct se_dev_attrib sanity values */ 65/* struct se_dev_attrib sanity values */
80/* Default max_unmap_lba_count */ 66/* Default max_unmap_lba_count */
81#define DA_MAX_UNMAP_LBA_COUNT 0 67#define DA_MAX_UNMAP_LBA_COUNT 0
@@ -85,6 +71,8 @@
85#define DA_UNMAP_GRANULARITY_DEFAULT 0 71#define DA_UNMAP_GRANULARITY_DEFAULT 0
86/* Default unmap_granularity_alignment */ 72/* Default unmap_granularity_alignment */
87#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 73#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
74/* Default max_write_same_len, disabled by default */
75#define DA_MAX_WRITE_SAME_LEN 0
88/* Default max transfer length */ 76/* Default max transfer length */
89#define DA_FABRIC_MAX_SECTORS 8192 77#define DA_FABRIC_MAX_SECTORS 8192
90/* Emulation for Direct Page Out */ 78/* Emulation for Direct Page Out */
@@ -107,8 +95,6 @@
107 */ 95 */
108#define DA_EMULATE_TPWS 0 96#define DA_EMULATE_TPWS 0
109/* No Emulation for PSCSI by default */ 97/* No Emulation for PSCSI by default */
110#define DA_EMULATE_RESERVATIONS 0
111/* No Emulation for PSCSI by default */
112#define DA_EMULATE_ALUA 0 98#define DA_EMULATE_ALUA 0
113/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ 99/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
114#define DA_ENFORCE_PR_ISIDS 1 100#define DA_ENFORCE_PR_ISIDS 1
@@ -160,8 +146,6 @@ enum se_cmd_flags_table {
160 SCF_EMULATED_TASK_SENSE = 0x00000004, 146 SCF_EMULATED_TASK_SENSE = 0x00000004,
161 SCF_SCSI_DATA_CDB = 0x00000008, 147 SCF_SCSI_DATA_CDB = 0x00000008,
162 SCF_SCSI_TMR_CDB = 0x00000010, 148 SCF_SCSI_TMR_CDB = 0x00000010,
163 SCF_SCSI_CDB_EXCEPTION = 0x00000020,
164 SCF_SCSI_RESERVATION_CONFLICT = 0x00000040,
165 SCF_FUA = 0x00000080, 149 SCF_FUA = 0x00000080,
166 SCF_SE_LUN_CMD = 0x00000100, 150 SCF_SE_LUN_CMD = 0x00000100,
167 SCF_BIDI = 0x00000400, 151 SCF_BIDI = 0x00000400,
@@ -182,38 +166,33 @@ enum transport_lunflags_table {
182 TRANSPORT_LUNFLAGS_READ_WRITE = 0x04, 166 TRANSPORT_LUNFLAGS_READ_WRITE = 0x04,
183}; 167};
184 168
185/* struct se_device->dev_status */
186enum transport_device_status_table {
187 TRANSPORT_DEVICE_ACTIVATED = 0x01,
188 TRANSPORT_DEVICE_DEACTIVATED = 0x02,
189 TRANSPORT_DEVICE_QUEUE_FULL = 0x04,
190 TRANSPORT_DEVICE_SHUTDOWN = 0x08,
191 TRANSPORT_DEVICE_OFFLINE_ACTIVATED = 0x10,
192 TRANSPORT_DEVICE_OFFLINE_DEACTIVATED = 0x20,
193};
194
195/* 169/*
196 * Used by transport_send_check_condition_and_sense() and se_cmd->scsi_sense_reason 170 * Used by transport_send_check_condition_and_sense()
197 * to signal which ASC/ASCQ sense payload should be built. 171 * to signal which ASC/ASCQ sense payload should be built.
198 */ 172 */
173typedef unsigned __bitwise__ sense_reason_t;
174
199enum tcm_sense_reason_table { 175enum tcm_sense_reason_table {
200 TCM_NON_EXISTENT_LUN = 0x01, 176#define R(x) (__force sense_reason_t )(x)
201 TCM_UNSUPPORTED_SCSI_OPCODE = 0x02, 177 TCM_NON_EXISTENT_LUN = R(0x01),
202 TCM_INCORRECT_AMOUNT_OF_DATA = 0x03, 178 TCM_UNSUPPORTED_SCSI_OPCODE = R(0x02),
203 TCM_UNEXPECTED_UNSOLICITED_DATA = 0x04, 179 TCM_INCORRECT_AMOUNT_OF_DATA = R(0x03),
204 TCM_SERVICE_CRC_ERROR = 0x05, 180 TCM_UNEXPECTED_UNSOLICITED_DATA = R(0x04),
205 TCM_SNACK_REJECTED = 0x06, 181 TCM_SERVICE_CRC_ERROR = R(0x05),
206 TCM_SECTOR_COUNT_TOO_MANY = 0x07, 182 TCM_SNACK_REJECTED = R(0x06),
207 TCM_INVALID_CDB_FIELD = 0x08, 183 TCM_SECTOR_COUNT_TOO_MANY = R(0x07),
208 TCM_INVALID_PARAMETER_LIST = 0x09, 184 TCM_INVALID_CDB_FIELD = R(0x08),
209 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE = 0x0a, 185 TCM_INVALID_PARAMETER_LIST = R(0x09),
210 TCM_UNKNOWN_MODE_PAGE = 0x0b, 186 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE = R(0x0a),
211 TCM_WRITE_PROTECTED = 0x0c, 187 TCM_UNKNOWN_MODE_PAGE = R(0x0b),
212 TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, 188 TCM_WRITE_PROTECTED = R(0x0c),
213 TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, 189 TCM_CHECK_CONDITION_ABORT_CMD = R(0x0d),
214 TCM_CHECK_CONDITION_NOT_READY = 0x0f, 190 TCM_CHECK_CONDITION_UNIT_ATTENTION = R(0x0e),
215 TCM_RESERVATION_CONFLICT = 0x10, 191 TCM_CHECK_CONDITION_NOT_READY = R(0x0f),
216 TCM_ADDRESS_OUT_OF_RANGE = 0x11, 192 TCM_RESERVATION_CONFLICT = R(0x10),
193 TCM_ADDRESS_OUT_OF_RANGE = R(0x11),
194 TCM_OUT_OF_RESOURCES = R(0x12),
195#undef R
217}; 196};
218 197
219enum target_sc_flags_table { 198enum target_sc_flags_table {
@@ -246,30 +225,6 @@ enum tcm_tmrsp_table {
246 TMR_FUNCTION_REJECTED = 255, 225 TMR_FUNCTION_REJECTED = 255,
247}; 226};
248 227
249struct se_obj {
250 atomic_t obj_access_count;
251};
252
253/*
254 * Used by TCM Core internally to signal if ALUA emulation is enabled or
255 * disabled, or running in with TCM/pSCSI passthrough mode
256 */
257typedef enum {
258 SPC_ALUA_PASSTHROUGH,
259 SPC2_ALUA_DISABLED,
260 SPC3_ALUA_EMULATED
261} t10_alua_index_t;
262
263/*
264 * Used by TCM Core internally to signal if SAM Task Attribute emulation
265 * is enabled or disabled, or running in with TCM/pSCSI passthrough mode
266 */
267typedef enum {
268 SAM_TASK_ATTR_PASSTHROUGH,
269 SAM_TASK_ATTR_UNTAGGED,
270 SAM_TASK_ATTR_EMULATED
271} t10_task_attr_index_t;
272
273/* 228/*
274 * Used for target SCSI statistics 229 * Used for target SCSI statistics
275 */ 230 */
@@ -283,17 +238,15 @@ typedef enum {
283struct se_cmd; 238struct se_cmd;
284 239
285struct t10_alua { 240struct t10_alua {
286 t10_alua_index_t alua_type;
287 /* ALUA Target Port Group ID */ 241 /* ALUA Target Port Group ID */
288 u16 alua_tg_pt_gps_counter; 242 u16 alua_tg_pt_gps_counter;
289 u32 alua_tg_pt_gps_count; 243 u32 alua_tg_pt_gps_count;
290 spinlock_t tg_pt_gps_lock; 244 spinlock_t tg_pt_gps_lock;
291 struct se_subsystem_dev *t10_sub_dev; 245 struct se_device *t10_dev;
292 /* Used for default ALUA Target Port Group */ 246 /* Used for default ALUA Target Port Group */
293 struct t10_alua_tg_pt_gp *default_tg_pt_gp; 247 struct t10_alua_tg_pt_gp *default_tg_pt_gp;
294 /* Used for default ALUA Target Port Group ConfigFS group */ 248 /* Used for default ALUA Target Port Group ConfigFS group */
295 struct config_group alua_tg_pt_gps_group; 249 struct config_group alua_tg_pt_gps_group;
296 int (*alua_state_check)(struct se_cmd *, unsigned char *, u8 *);
297 struct list_head tg_pt_gps_list; 250 struct list_head tg_pt_gps_list;
298}; 251};
299 252
@@ -335,7 +288,7 @@ struct t10_alua_tg_pt_gp {
335 atomic_t tg_pt_gp_ref_cnt; 288 atomic_t tg_pt_gp_ref_cnt;
336 spinlock_t tg_pt_gp_lock; 289 spinlock_t tg_pt_gp_lock;
337 struct mutex tg_pt_gp_md_mutex; 290 struct mutex tg_pt_gp_md_mutex;
338 struct se_subsystem_dev *tg_pt_gp_su_dev; 291 struct se_device *tg_pt_gp_dev;
339 struct config_group tg_pt_gp_group; 292 struct config_group tg_pt_gp_group;
340 struct list_head tg_pt_gp_list; 293 struct list_head tg_pt_gp_list;
341 struct list_head tg_pt_gp_mem_list; 294 struct list_head tg_pt_gp_mem_list;
@@ -366,23 +319,11 @@ struct t10_wwn {
366 char revision[4]; 319 char revision[4];
367 char unit_serial[INQUIRY_VPD_SERIAL_LEN]; 320 char unit_serial[INQUIRY_VPD_SERIAL_LEN];
368 spinlock_t t10_vpd_lock; 321 spinlock_t t10_vpd_lock;
369 struct se_subsystem_dev *t10_sub_dev; 322 struct se_device *t10_dev;
370 struct config_group t10_wwn_group; 323 struct config_group t10_wwn_group;
371 struct list_head t10_vpd_list; 324 struct list_head t10_vpd_list;
372}; 325};
373 326
374
375/*
376 * Used by TCM Core internally to signal if >= SPC-3 persistent reservations
377 * emulation is enabled or disabled, or running in with TCM/pSCSI passthrough
378 * mode
379 */
380typedef enum {
381 SPC_PASSTHROUGH,
382 SPC2_RESERVATIONS,
383 SPC3_PERSISTENT_RESERVATIONS
384} t10_reservations_index_t;
385
386struct t10_pr_registration { 327struct t10_pr_registration {
387 /* Used for fabrics that contain WWN+ISID */ 328 /* Used for fabrics that contain WWN+ISID */
388#define PR_REG_ISID_LEN 16 329#define PR_REG_ISID_LEN 16
@@ -424,18 +365,6 @@ struct t10_pr_registration {
424 struct list_head pr_reg_atp_mem_list; 365 struct list_head pr_reg_atp_mem_list;
425}; 366};
426 367
427/*
428 * This set of function pointer ops is set based upon SPC3_PERSISTENT_RESERVATIONS,
429 * SPC2_RESERVATIONS or SPC_PASSTHROUGH in drivers/target/target_core_pr.c:
430 * core_setup_reservations()
431 */
432struct t10_reservation_ops {
433 int (*t10_reservation_check)(struct se_cmd *, u32 *);
434 int (*t10_seq_non_holder)(struct se_cmd *, unsigned char *, u32);
435 int (*t10_pr_register)(struct se_cmd *);
436 int (*t10_pr_clear)(struct se_cmd *);
437};
438
439struct t10_reservation { 368struct t10_reservation {
440 /* Reservation effects all target ports */ 369 /* Reservation effects all target ports */
441 int pr_all_tg_pt; 370 int pr_all_tg_pt;
@@ -446,7 +375,6 @@ struct t10_reservation {
446#define PR_APTPL_BUF_LEN 8192 375#define PR_APTPL_BUF_LEN 8192
447 u32 pr_aptpl_buf_len; 376 u32 pr_aptpl_buf_len;
448 u32 pr_generation; 377 u32 pr_generation;
449 t10_reservations_index_t res_type;
450 spinlock_t registration_lock; 378 spinlock_t registration_lock;
451 spinlock_t aptpl_reg_lock; 379 spinlock_t aptpl_reg_lock;
452 /* 380 /*
@@ -462,7 +390,6 @@ struct t10_reservation {
462 struct se_node_acl *pr_res_holder; 390 struct se_node_acl *pr_res_holder;
463 struct list_head registration_list; 391 struct list_head registration_list;
464 struct list_head aptpl_reg_list; 392 struct list_head aptpl_reg_list;
465 struct t10_reservation_ops pr_ops;
466}; 393};
467 394
468struct se_tmr_req { 395struct se_tmr_req {
@@ -485,7 +412,6 @@ struct se_cmd {
485 u8 scsi_status; 412 u8 scsi_status;
486 u8 scsi_asc; 413 u8 scsi_asc;
487 u8 scsi_ascq; 414 u8 scsi_ascq;
488 u8 scsi_sense_reason;
489 u16 scsi_sense_length; 415 u16 scsi_sense_length;
490 /* Delay for ALUA Active/NonOptimized state access in milliseconds */ 416 /* Delay for ALUA Active/NonOptimized state access in milliseconds */
491 int alua_nonop_delay; 417 int alua_nonop_delay;
@@ -523,7 +449,7 @@ struct se_cmd {
523 struct completion cmd_wait_comp; 449 struct completion cmd_wait_comp;
524 struct kref cmd_kref; 450 struct kref cmd_kref;
525 struct target_core_fabric_ops *se_tfo; 451 struct target_core_fabric_ops *se_tfo;
526 int (*execute_cmd)(struct se_cmd *); 452 sense_reason_t (*execute_cmd)(struct se_cmd *);
527 void (*transport_complete_callback)(struct se_cmd *); 453 void (*transport_complete_callback)(struct se_cmd *);
528 454
529 unsigned char *t_task_cdb; 455 unsigned char *t_task_cdb;
@@ -581,6 +507,8 @@ struct se_node_acl {
581 bool acl_stop:1; 507 bool acl_stop:1;
582 u32 queue_depth; 508 u32 queue_depth;
583 u32 acl_index; 509 u32 acl_index;
510#define MAX_ACL_TAG_SIZE 64
511 char acl_tag[MAX_ACL_TAG_SIZE];
584 u64 num_cmds; 512 u64 num_cmds;
585 u64 read_bytes; 513 u64 read_bytes;
586 u64 write_bytes; 514 u64 write_bytes;
@@ -662,15 +590,6 @@ struct se_dev_entry {
662 struct list_head ua_list; 590 struct list_head ua_list;
663}; 591};
664 592
665struct se_dev_limits {
666 /* Max supported HW queue depth */
667 u32 hw_queue_depth;
668 /* Max supported virtual queue depth */
669 u32 queue_depth;
670 /* From include/linux/blkdev.h for the other HW/SW limits. */
671 struct queue_limits limits;
672};
673
674struct se_dev_attrib { 593struct se_dev_attrib {
675 int emulate_dpo; 594 int emulate_dpo;
676 int emulate_fua_write; 595 int emulate_fua_write;
@@ -680,8 +599,6 @@ struct se_dev_attrib {
680 int emulate_tas; 599 int emulate_tas;
681 int emulate_tpu; 600 int emulate_tpu;
682 int emulate_tpws; 601 int emulate_tpws;
683 int emulate_reservations;
684 int emulate_alua;
685 int enforce_pr_isids; 602 int enforce_pr_isids;
686 int is_nonrot; 603 int is_nonrot;
687 int emulate_rest_reord; 604 int emulate_rest_reord;
@@ -696,7 +613,8 @@ struct se_dev_attrib {
696 u32 max_unmap_block_desc_count; 613 u32 max_unmap_block_desc_count;
697 u32 unmap_granularity; 614 u32 unmap_granularity;
698 u32 unmap_granularity_alignment; 615 u32 unmap_granularity_alignment;
699 struct se_subsystem_dev *da_sub_dev; 616 u32 max_write_same_len;
617 struct se_device *da_dev;
700 struct config_group da_group; 618 struct config_group da_group;
701}; 619};
702 620
@@ -707,48 +625,25 @@ struct se_dev_stat_grps {
707 struct config_group scsi_lu_group; 625 struct config_group scsi_lu_group;
708}; 626};
709 627
710struct se_subsystem_dev {
711/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */
712#define SE_DEV_ALIAS_LEN 512
713 unsigned char se_dev_alias[SE_DEV_ALIAS_LEN];
714/* Used for struct se_subsystem_dev->se_dev_udev_path[], must be less than PAGE_SIZE */
715#define SE_UDEV_PATH_LEN 512
716 unsigned char se_dev_udev_path[SE_UDEV_PATH_LEN];
717 u32 su_dev_flags;
718 struct se_hba *se_dev_hba;
719 struct se_device *se_dev_ptr;
720 struct se_dev_attrib se_dev_attrib;
721 /* T10 Asymmetric Logical Unit Assignment for Target Ports */
722 struct t10_alua t10_alua;
723 /* T10 Inquiry and VPD WWN Information */
724 struct t10_wwn t10_wwn;
725 /* T10 SPC-2 + SPC-3 Reservations */
726 struct t10_reservation t10_pr;
727 spinlock_t se_dev_lock;
728 void *se_dev_su_ptr;
729 struct config_group se_dev_group;
730 /* For T10 Reservations */
731 struct config_group se_dev_pr_group;
732 /* For target_core_stat.c groups */
733 struct se_dev_stat_grps dev_stat_grps;
734};
735
736struct se_device { 628struct se_device {
629#define SE_DEV_LINK_MAGIC 0xfeeddeef
630 u32 dev_link_magic;
737 /* RELATIVE TARGET PORT IDENTIFER Counter */ 631 /* RELATIVE TARGET PORT IDENTIFER Counter */
738 u16 dev_rpti_counter; 632 u16 dev_rpti_counter;
739 /* Used for SAM Task Attribute ordering */ 633 /* Used for SAM Task Attribute ordering */
740 u32 dev_cur_ordered_id; 634 u32 dev_cur_ordered_id;
741 u32 dev_flags; 635 u32 dev_flags;
636#define DF_CONFIGURED 0x00000001
637#define DF_FIRMWARE_VPD_UNIT_SERIAL 0x00000002
638#define DF_EMULATED_VPD_UNIT_SERIAL 0x00000004
639#define DF_USING_UDEV_PATH 0x00000008
640#define DF_USING_ALIAS 0x00000010
742 u32 dev_port_count; 641 u32 dev_port_count;
743 /* See transport_device_status_table */
744 u32 dev_status;
745 /* Physical device queue depth */ 642 /* Physical device queue depth */
746 u32 queue_depth; 643 u32 queue_depth;
747 /* Used for SPC-2 reservations enforce of ISIDs */ 644 /* Used for SPC-2 reservations enforce of ISIDs */
748 u64 dev_res_bin_isid; 645 u64 dev_res_bin_isid;
749 t10_task_attr_index_t dev_task_attr_type;
750 /* Pointer to transport specific device structure */ 646 /* Pointer to transport specific device structure */
751 void *dev_ptr;
752 u32 dev_index; 647 u32 dev_index;
753 u64 creation_time; 648 u64 creation_time;
754 u32 num_resets; 649 u32 num_resets;
@@ -761,13 +656,13 @@ struct se_device {
761 atomic_t dev_ordered_id; 656 atomic_t dev_ordered_id;
762 atomic_t dev_ordered_sync; 657 atomic_t dev_ordered_sync;
763 atomic_t dev_qf_count; 658 atomic_t dev_qf_count;
764 struct se_obj dev_obj; 659 int export_count;
765 struct se_obj dev_access_obj;
766 struct se_obj dev_export_obj;
767 spinlock_t delayed_cmd_lock; 660 spinlock_t delayed_cmd_lock;
768 spinlock_t execute_task_lock; 661 spinlock_t execute_task_lock;
769 spinlock_t dev_reservation_lock; 662 spinlock_t dev_reservation_lock;
770 spinlock_t dev_status_lock; 663 unsigned int dev_reservation_flags;
664#define DRF_SPC2_RESERVATIONS 0x00000001
665#define DRF_SPC2_RESERVATIONS_WITH_ISID 0x00000002
771 spinlock_t se_port_lock; 666 spinlock_t se_port_lock;
772 spinlock_t se_tmr_lock; 667 spinlock_t se_tmr_lock;
773 spinlock_t qf_cmd_lock; 668 spinlock_t qf_cmd_lock;
@@ -786,7 +681,20 @@ struct se_device {
786 struct list_head qf_cmd_list; 681 struct list_head qf_cmd_list;
787 /* Pointer to associated SE HBA */ 682 /* Pointer to associated SE HBA */
788 struct se_hba *se_hba; 683 struct se_hba *se_hba;
789 struct se_subsystem_dev *se_sub_dev; 684 /* T10 Inquiry and VPD WWN Information */
685 struct t10_wwn t10_wwn;
686 /* T10 Asymmetric Logical Unit Assignment for Target Ports */
687 struct t10_alua t10_alua;
688 /* T10 SPC-2 + SPC-3 Reservations */
689 struct t10_reservation t10_pr;
690 struct se_dev_attrib dev_attrib;
691 struct config_group dev_group;
692 struct config_group dev_pr_group;
693 struct se_dev_stat_grps dev_stat_grps;
694#define SE_DEV_ALIAS_LEN 512 /* must be less than PAGE_SIZE */
695 unsigned char dev_alias[SE_DEV_ALIAS_LEN];
696#define SE_UDEV_PATH_LEN 512 /* must be less than PAGE_SIZE */
697 unsigned char udev_path[SE_UDEV_PATH_LEN];
790 /* Pointer to template of function pointers for transport */ 698 /* Pointer to template of function pointers for transport */
791 struct se_subsystem_api *transport; 699 struct se_subsystem_api *transport;
792 /* Linked list for struct se_hba struct se_device list */ 700 /* Linked list for struct se_hba struct se_device list */
@@ -803,8 +711,6 @@ struct se_hba {
803 u32 hba_index; 711 u32 hba_index;
804 /* Pointer to transport specific host structure. */ 712 /* Pointer to transport specific host structure. */
805 void *hba_ptr; 713 void *hba_ptr;
806 /* Linked list for struct se_device */
807 struct list_head hba_dev_list;
808 struct list_head hba_node; 714 struct list_head hba_node;
809 spinlock_t device_lock; 715 spinlock_t device_lock;
810 struct config_group hba_group; 716 struct config_group hba_group;
@@ -820,6 +726,8 @@ struct se_port_stat_grps {
820}; 726};
821 727
822struct se_lun { 728struct se_lun {
729#define SE_LUN_LINK_MAGIC 0xffff7771
730 u32 lun_link_magic;
823 /* See transport_lun_status_table */ 731 /* See transport_lun_status_table */
824 enum transport_lun_status_table lun_status; 732 enum transport_lun_status_table lun_status;
825 u32 lun_access; 733 u32 lun_access;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 81ddb4ae6c3f..aaa1ee6ab391 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -98,8 +98,8 @@ void transport_deregister_session(struct se_session *);
98 98
99void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 99void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
100 struct se_session *, u32, int, int, unsigned char *); 100 struct se_session *, u32, int, int, unsigned char *);
101int transport_lookup_cmd_lun(struct se_cmd *, u32); 101sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32);
102int target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); 102sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
103int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *, 103int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *,
104 unsigned char *, unsigned char *, u32, u32, int, int, int, 104 unsigned char *, unsigned char *, u32, u32, int, int, int,
105 struct scatterlist *, u32, struct scatterlist *, u32); 105 struct scatterlist *, u32, struct scatterlist *, u32);
@@ -110,9 +110,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
110 void *fabric_tmr_ptr, unsigned char tm_type, 110 void *fabric_tmr_ptr, unsigned char tm_type,
111 gfp_t, unsigned int, int); 111 gfp_t, unsigned int, int);
112int transport_handle_cdb_direct(struct se_cmd *); 112int transport_handle_cdb_direct(struct se_cmd *);
113int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, 113sense_reason_t transport_generic_new_cmd(struct se_cmd *);
114 struct scatterlist *, u32, struct scatterlist *, u32);
115int transport_generic_new_cmd(struct se_cmd *);
116 114
117void target_execute_cmd(struct se_cmd *cmd); 115void target_execute_cmd(struct se_cmd *cmd);
118 116
@@ -120,7 +118,8 @@ void transport_generic_free_cmd(struct se_cmd *, int);
120 118
121bool transport_wait_for_tasks(struct se_cmd *); 119bool transport_wait_for_tasks(struct se_cmd *);
122int transport_check_aborted_status(struct se_cmd *, int); 120int transport_check_aborted_status(struct se_cmd *, int);
123int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); 121int transport_send_check_condition_and_sense(struct se_cmd *,
122 sense_reason_t, int);
124 123
125int target_put_sess_cmd(struct se_session *, struct se_cmd *); 124int target_put_sess_cmd(struct se_session *, struct se_cmd *);
126void target_sess_cmd_list_set_waiting(struct se_session *); 125void target_sess_cmd_list_set_waiting(struct se_session *);
@@ -131,7 +130,7 @@ int core_alua_check_nonop_delay(struct se_cmd *);
131int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); 130int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
132void core_tmr_release_req(struct se_tmr_req *); 131void core_tmr_release_req(struct se_tmr_req *);
133int transport_generic_handle_tmr(struct se_cmd *); 132int transport_generic_handle_tmr(struct se_cmd *);
134void transport_generic_request_failure(struct se_cmd *); 133void transport_generic_request_failure(struct se_cmd *, sense_reason_t);
135int transport_lookup_tmr_lun(struct se_cmd *, u32); 134int transport_lookup_tmr_lun(struct se_cmd *, u32);
136 135
137struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, 136struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
@@ -143,6 +142,8 @@ int core_tpg_del_initiator_node_acl(struct se_portal_group *,
143 struct se_node_acl *, int); 142 struct se_node_acl *, int);
144int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, 143int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
145 unsigned char *, u32, int); 144 unsigned char *, u32, int);
145int core_tpg_set_initiator_node_tag(struct se_portal_group *,
146 struct se_node_acl *, const char *);
146int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, 147int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *,
147 struct se_portal_group *, void *, int); 148 struct se_portal_group *, void *, int);
148int core_tpg_deregister(struct se_portal_group *); 149int core_tpg_deregister(struct se_portal_group *);
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 54fab041b22a..ea546a4e9609 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -45,7 +45,8 @@ struct extent_buffer;
45 45
46#define show_root_type(obj) \ 46#define show_root_type(obj) \
47 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 47 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
48 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-" 48 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
49 obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
49 50
50#define BTRFS_GROUP_FLAGS \ 51#define BTRFS_GROUP_FLAGS \
51 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 52 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index d49b285385e8..7e8c36bc7082 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -15,6 +15,7 @@ struct ext4_inode_info;
15struct mpage_da_data; 15struct mpage_da_data;
16struct ext4_map_blocks; 16struct ext4_map_blocks;
17struct ext4_extent; 17struct ext4_extent;
18struct extent_status;
18 19
19#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode)) 20#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
20 21
@@ -450,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage,
450 TP_ARGS(page) 451 TP_ARGS(page)
451); 452);
452 453
453TRACE_EVENT(ext4_invalidatepage, 454DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
454 TP_PROTO(struct page *page, unsigned long offset), 455 TP_PROTO(struct page *page, unsigned long offset),
455 456
456 TP_ARGS(page, offset), 457 TP_ARGS(page, offset),
@@ -476,6 +477,18 @@ TRACE_EVENT(ext4_invalidatepage,
476 (unsigned long) __entry->index, __entry->offset) 477 (unsigned long) __entry->index, __entry->offset)
477); 478);
478 479
480DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
481 TP_PROTO(struct page *page, unsigned long offset),
482
483 TP_ARGS(page, offset)
484);
485
486DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
487 TP_PROTO(struct page *page, unsigned long offset),
488
489 TP_ARGS(page, offset)
490);
491
479TRACE_EVENT(ext4_discard_blocks, 492TRACE_EVENT(ext4_discard_blocks,
480 TP_PROTO(struct super_block *sb, unsigned long long blk, 493 TP_PROTO(struct super_block *sb, unsigned long long blk,
481 unsigned long long count), 494 unsigned long long count),
@@ -1519,10 +1532,9 @@ DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1519); 1532);
1520 1533
1521DECLARE_EVENT_CLASS(ext4__map_blocks_exit, 1534DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1522 TP_PROTO(struct inode *inode, ext4_lblk_t lblk, 1535 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret),
1523 ext4_fsblk_t pblk, unsigned int len, int ret),
1524 1536
1525 TP_ARGS(inode, lblk, pblk, len, ret), 1537 TP_ARGS(inode, map, ret),
1526 1538
1527 TP_STRUCT__entry( 1539 TP_STRUCT__entry(
1528 __field( dev_t, dev ) 1540 __field( dev_t, dev )
@@ -1530,37 +1542,37 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1530 __field( ext4_fsblk_t, pblk ) 1542 __field( ext4_fsblk_t, pblk )
1531 __field( ext4_lblk_t, lblk ) 1543 __field( ext4_lblk_t, lblk )
1532 __field( unsigned int, len ) 1544 __field( unsigned int, len )
1545 __field( unsigned int, flags )
1533 __field( int, ret ) 1546 __field( int, ret )
1534 ), 1547 ),
1535 1548
1536 TP_fast_assign( 1549 TP_fast_assign(
1537 __entry->dev = inode->i_sb->s_dev; 1550 __entry->dev = inode->i_sb->s_dev;
1538 __entry->ino = inode->i_ino; 1551 __entry->ino = inode->i_ino;
1539 __entry->pblk = pblk; 1552 __entry->pblk = map->m_pblk;
1540 __entry->lblk = lblk; 1553 __entry->lblk = map->m_lblk;
1541 __entry->len = len; 1554 __entry->len = map->m_len;
1555 __entry->flags = map->m_flags;
1542 __entry->ret = ret; 1556 __entry->ret = ret;
1543 ), 1557 ),
1544 1558
1545 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d", 1559 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d",
1546 MAJOR(__entry->dev), MINOR(__entry->dev), 1560 MAJOR(__entry->dev), MINOR(__entry->dev),
1547 (unsigned long) __entry->ino, 1561 (unsigned long) __entry->ino,
1548 __entry->lblk, __entry->pblk, 1562 __entry->lblk, __entry->pblk,
1549 __entry->len, __entry->ret) 1563 __entry->len, __entry->flags, __entry->ret)
1550); 1564);
1551 1565
1552DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit, 1566DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1553 TP_PROTO(struct inode *inode, ext4_lblk_t lblk, 1567 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret),
1554 ext4_fsblk_t pblk, unsigned len, int ret),
1555 1568
1556 TP_ARGS(inode, lblk, pblk, len, ret) 1569 TP_ARGS(inode, map, ret)
1557); 1570);
1558 1571
1559DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit, 1572DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1560 TP_PROTO(struct inode *inode, ext4_lblk_t lblk, 1573 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret),
1561 ext4_fsblk_t pblk, unsigned len, int ret),
1562 1574
1563 TP_ARGS(inode, lblk, pblk, len, ret) 1575 TP_ARGS(inode, map, ret)
1564); 1576);
1565 1577
1566TRACE_EVENT(ext4_ext_load_extent, 1578TRACE_EVENT(ext4_ext_load_extent,
@@ -1680,10 +1692,10 @@ DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1680); 1692);
1681 1693
1682TRACE_EVENT(ext4_ext_handle_uninitialized_extents, 1694TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1683 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, 1695 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1684 unsigned int allocated, ext4_fsblk_t newblock), 1696 unsigned int allocated, ext4_fsblk_t newblock),
1685 1697
1686 TP_ARGS(inode, map, allocated, newblock), 1698 TP_ARGS(inode, map, flags, allocated, newblock),
1687 1699
1688 TP_STRUCT__entry( 1700 TP_STRUCT__entry(
1689 __field( dev_t, dev ) 1701 __field( dev_t, dev )
@@ -1699,7 +1711,7 @@ TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1699 TP_fast_assign( 1711 TP_fast_assign(
1700 __entry->dev = inode->i_sb->s_dev; 1712 __entry->dev = inode->i_sb->s_dev;
1701 __entry->ino = inode->i_ino; 1713 __entry->ino = inode->i_ino;
1702 __entry->flags = map->m_flags; 1714 __entry->flags = flags;
1703 __entry->lblk = map->m_lblk; 1715 __entry->lblk = map->m_lblk;
1704 __entry->pblk = map->m_pblk; 1716 __entry->pblk = map->m_pblk;
1705 __entry->len = map->m_len; 1717 __entry->len = map->m_len;
@@ -1707,7 +1719,7 @@ TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1707 __entry->newblk = newblock; 1719 __entry->newblk = newblock;
1708 ), 1720 ),
1709 1721
1710 TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %d" 1722 TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %x "
1711 "allocated %d newblock %llu", 1723 "allocated %d newblock %llu",
1712 MAJOR(__entry->dev), MINOR(__entry->dev), 1724 MAJOR(__entry->dev), MINOR(__entry->dev),
1713 (unsigned long) __entry->ino, 1725 (unsigned long) __entry->ino,
@@ -2055,6 +2067,106 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2055 (unsigned short) __entry->eh_entries) 2067 (unsigned short) __entry->eh_entries)
2056); 2068);
2057 2069
2070TRACE_EVENT(ext4_es_insert_extent,
2071 TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t len),
2072
2073 TP_ARGS(inode, start, len),
2074
2075 TP_STRUCT__entry(
2076 __field( dev_t, dev )
2077 __field( ino_t, ino )
2078 __field( loff_t, start )
2079 __field( loff_t, len )
2080 ),
2081
2082 TP_fast_assign(
2083 __entry->dev = inode->i_sb->s_dev;
2084 __entry->ino = inode->i_ino;
2085 __entry->start = start;
2086 __entry->len = len;
2087 ),
2088
2089 TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2090 MAJOR(__entry->dev), MINOR(__entry->dev),
2091 (unsigned long) __entry->ino,
2092 __entry->start, __entry->len)
2093);
2094
2095TRACE_EVENT(ext4_es_remove_extent,
2096 TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t len),
2097
2098 TP_ARGS(inode, start, len),
2099
2100 TP_STRUCT__entry(
2101 __field( dev_t, dev )
2102 __field( ino_t, ino )
2103 __field( loff_t, start )
2104 __field( loff_t, len )
2105 ),
2106
2107 TP_fast_assign(
2108 __entry->dev = inode->i_sb->s_dev;
2109 __entry->ino = inode->i_ino;
2110 __entry->start = start;
2111 __entry->len = len;
2112 ),
2113
2114 TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2115 MAJOR(__entry->dev), MINOR(__entry->dev),
2116 (unsigned long) __entry->ino,
2117 __entry->start, __entry->len)
2118);
2119
2120TRACE_EVENT(ext4_es_find_extent_enter,
2121 TP_PROTO(struct inode *inode, ext4_lblk_t start),
2122
2123 TP_ARGS(inode, start),
2124
2125 TP_STRUCT__entry(
2126 __field( dev_t, dev )
2127 __field( ino_t, ino )
2128 __field( ext4_lblk_t, start )
2129 ),
2130
2131 TP_fast_assign(
2132 __entry->dev = inode->i_sb->s_dev;
2133 __entry->ino = inode->i_ino;
2134 __entry->start = start;
2135 ),
2136
2137 TP_printk("dev %d,%d ino %lu start %u",
2138 MAJOR(__entry->dev), MINOR(__entry->dev),
2139 (unsigned long) __entry->ino, __entry->start)
2140);
2141
2142TRACE_EVENT(ext4_es_find_extent_exit,
2143 TP_PROTO(struct inode *inode, struct extent_status *es,
2144 ext4_lblk_t ret),
2145
2146 TP_ARGS(inode, es, ret),
2147
2148 TP_STRUCT__entry(
2149 __field( dev_t, dev )
2150 __field( ino_t, ino )
2151 __field( ext4_lblk_t, start )
2152 __field( ext4_lblk_t, len )
2153 __field( ext4_lblk_t, ret )
2154 ),
2155
2156 TP_fast_assign(
2157 __entry->dev = inode->i_sb->s_dev;
2158 __entry->ino = inode->i_ino;
2159 __entry->start = es->start;
2160 __entry->len = es->len;
2161 __entry->ret = ret;
2162 ),
2163
2164 TP_printk("dev %d,%d ino %lu es [%u/%u) ret %u",
2165 MAJOR(__entry->dev), MINOR(__entry->dev),
2166 (unsigned long) __entry->ino,
2167 __entry->start, __entry->len, __entry->ret)
2168);
2169
2058#endif /* _TRACE_EXT4_H */ 2170#endif /* _TRACE_EXT4_H */
2059 2171
2060/* This part must be outside protection */ 2172/* This part must be outside protection */
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index 9391706e9254..1eddbf1557f2 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -34,8 +34,10 @@
34 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \ 34 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
35 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \ 35 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
37 {(unsigned long)__GFP_KMEMCG, "GFP_KMEMCG"}, \
37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 38 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 39 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
40 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
39 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ 41 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \
40 ) : "GFP_NOWAIT" 42 ) : "GFP_NOWAIT"
41 43
diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
new file mode 100644
index 000000000000..ec2a6ccfd7e5
--- /dev/null
+++ b/include/trace/events/migrate.h
@@ -0,0 +1,51 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM migrate
3
4#if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_MIGRATE_H
6
7#define MIGRATE_MODE \
8 {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \
9 {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \
10 {MIGRATE_SYNC, "MIGRATE_SYNC"}
11
12#define MIGRATE_REASON \
13 {MR_COMPACTION, "compaction"}, \
14 {MR_MEMORY_FAILURE, "memory_failure"}, \
15 {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \
16 {MR_SYSCALL, "syscall_or_cpuset"}, \
17 {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \
18 {MR_CMA, "cma"}
19
20TRACE_EVENT(mm_migrate_pages,
21
22 TP_PROTO(unsigned long succeeded, unsigned long failed,
23 enum migrate_mode mode, int reason),
24
25 TP_ARGS(succeeded, failed, mode, reason),
26
27 TP_STRUCT__entry(
28 __field( unsigned long, succeeded)
29 __field( unsigned long, failed)
30 __field( enum migrate_mode, mode)
31 __field( int, reason)
32 ),
33
34 TP_fast_assign(
35 __entry->succeeded = succeeded;
36 __entry->failed = failed;
37 __entry->mode = mode;
38 __entry->reason = reason;
39 ),
40
41 TP_printk("nr_succeeded=%lu nr_failed=%lu mode=%s reason=%s",
42 __entry->succeeded,
43 __entry->failed,
44 __print_symbolic(__entry->mode, MIGRATE_MODE),
45 __print_symbolic(__entry->reason, MIGRATE_REASON))
46);
47
48#endif /* _TRACE_MIGRATE_H */
49
50/* This part must be outside protection */
51#include <trace/define_trace.h>
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index dd4ba3b92002..1e974983757e 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -14,7 +14,7 @@ TRACE_EVENT(oom_score_adj_update,
14 TP_STRUCT__entry( 14 TP_STRUCT__entry(
15 __field( pid_t, pid) 15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN ) 16 __array( char, comm, TASK_COMM_LEN )
17 __field( int, oom_score_adj) 17 __field( short, oom_score_adj)
18 ), 18 ),
19 19
20 TP_fast_assign( 20 TP_fast_assign(
@@ -23,7 +23,7 @@ TRACE_EVENT(oom_score_adj_update,
23 __entry->oom_score_adj = task->signal->oom_score_adj; 23 __entry->oom_score_adj = task->signal->oom_score_adj;
24 ), 24 ),
25 25
26 TP_printk("pid=%d comm=%s oom_score_adj=%d", 26 TP_printk("pid=%d comm=%s oom_score_adj=%hd",
27 __entry->pid, __entry->comm, __entry->oom_score_adj) 27 __entry->pid, __entry->comm, __entry->oom_score_adj)
28); 28);
29 29
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 5bde94d8585b..d4f559b1ec34 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -549,6 +549,7 @@ TRACE_EVENT(rcu_torture_read,
549 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit. 549 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
550 * "Inc1": rcu_barrier_callback() piggyback check counter incremented. 550 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
551 * "Offline": rcu_barrier_callback() found offline CPU 551 * "Offline": rcu_barrier_callback() found offline CPU
552 * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU.
552 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks. 553 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
553 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks. 554 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
554 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. 555 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index b53add02e929..102a646e1996 100644
--- a/include/trace/events/task.h
+++ b/include/trace/events/task.h
@@ -15,7 +15,7 @@ TRACE_EVENT(task_newtask,
15 __field( pid_t, pid) 15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN) 16 __array( char, comm, TASK_COMM_LEN)
17 __field( unsigned long, clone_flags) 17 __field( unsigned long, clone_flags)
18 __field( int, oom_score_adj) 18 __field( short, oom_score_adj)
19 ), 19 ),
20 20
21 TP_fast_assign( 21 TP_fast_assign(
@@ -25,7 +25,7 @@ TRACE_EVENT(task_newtask,
25 __entry->oom_score_adj = task->signal->oom_score_adj; 25 __entry->oom_score_adj = task->signal->oom_score_adj;
26 ), 26 ),
27 27
28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%d", 28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd",
29 __entry->pid, __entry->comm, 29 __entry->pid, __entry->comm,
30 __entry->clone_flags, __entry->oom_score_adj) 30 __entry->clone_flags, __entry->oom_score_adj)
31); 31);
@@ -40,7 +40,7 @@ TRACE_EVENT(task_rename,
40 __field( pid_t, pid) 40 __field( pid_t, pid)
41 __array( char, oldcomm, TASK_COMM_LEN) 41 __array( char, oldcomm, TASK_COMM_LEN)
42 __array( char, newcomm, TASK_COMM_LEN) 42 __array( char, newcomm, TASK_COMM_LEN)
43 __field( int, oom_score_adj) 43 __field( short, oom_score_adj)
44 ), 44 ),
45 45
46 TP_fast_assign( 46 TP_fast_assign(
@@ -50,7 +50,7 @@ TRACE_EVENT(task_rename,
50 __entry->oom_score_adj = task->signal->oom_score_adj; 50 __entry->oom_score_adj = task->signal->oom_score_adj;
51 ), 51 ),
52 52
53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%d", 53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%hd",
54 __entry->pid, __entry->oldcomm, 54 __entry->pid, __entry->oldcomm,
55 __entry->newcomm, __entry->oom_score_adj) 55 __entry->newcomm, __entry->oom_score_adj)
56); 56);
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index a763888a36f9..40dc5e8fe340 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -545,8 +545,7 @@ ftrace_raw_event_##call(void *__data, proto) \
545 { assign; } \ 545 { assign; } \
546 \ 546 \
547 if (!filter_current_check_discard(buffer, event_call, entry, event)) \ 547 if (!filter_current_check_discard(buffer, event_call, entry, event)) \
548 trace_nowake_buffer_unlock_commit(buffer, \ 548 trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \
549 event, irq_flags, pc); \
550} 549}
551/* 550/*
552 * The ftrace_test_probe is compiled out, it is only here as a build time check 551 * The ftrace_test_probe is compiled out, it is only here as a build time check
@@ -620,79 +619,6 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
620 619
621#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 620#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
622 621
623/*
624 * Define the insertion callback to perf events
625 *
626 * The job is very similar to ftrace_raw_event_<call> except that we don't
627 * insert in the ring buffer but in a perf counter.
628 *
629 * static void ftrace_perf_<call>(proto)
630 * {
631 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
632 * struct ftrace_event_call *event_call = &event_<call>;
633 * extern void perf_tp_event(int, u64, u64, void *, int);
634 * struct ftrace_raw_##call *entry;
635 * struct perf_trace_buf *trace_buf;
636 * u64 __addr = 0, __count = 1;
637 * unsigned long irq_flags;
638 * struct trace_entry *ent;
639 * int __entry_size;
640 * int __data_size;
641 * int __cpu
642 * int pc;
643 *
644 * pc = preempt_count();
645 *
646 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
647 *
648 * // Below we want to get the aligned size by taking into account
649 * // the u32 field that will later store the buffer size
650 * __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),
651 * sizeof(u64));
652 * __entry_size -= sizeof(u32);
653 *
654 * // Protect the non nmi buffer
655 * // This also protects the rcu read side
656 * local_irq_save(irq_flags);
657 * __cpu = smp_processor_id();
658 *
659 * if (in_nmi())
660 * trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
661 * else
662 * trace_buf = rcu_dereference_sched(perf_trace_buf);
663 *
664 * if (!trace_buf)
665 * goto end;
666 *
667 * trace_buf = per_cpu_ptr(trace_buf, __cpu);
668 *
669 * // Avoid recursion from perf that could mess up the buffer
670 * if (trace_buf->recursion++)
671 * goto end_recursion;
672 *
673 * raw_data = trace_buf->buf;
674 *
675 * // Make recursion update visible before entering perf_tp_event
676 * // so that we protect from perf recursions.
677 *
678 * barrier();
679 *
680 * //zero dead bytes from alignment to avoid stack leak to userspace:
681 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
682 * entry = (struct ftrace_raw_<call> *)raw_data;
683 * ent = &entry->ent;
684 * tracing_generic_entry_update(ent, irq_flags, pc);
685 * ent->type = event_call->id;
686 *
687 * <tstruct> <- do some jobs with dynamic arrays
688 *
689 * <assign> <- affect our values
690 *
691 * perf_tp_event(event_call->id, __addr, __count, entry,
692 * __entry_size); <- submit them to perf counter
693 *
694 * }
695 */
696 622
697#ifdef CONFIG_PERF_EVENTS 623#ifdef CONFIG_PERF_EVENTS
698 624
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 31966a4fb8cc..84bc4197e736 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -31,27 +31,4 @@ struct syscall_metadata {
31 struct ftrace_event_call *exit_event; 31 struct ftrace_event_call *exit_event;
32}; 32};
33 33
34#ifdef CONFIG_FTRACE_SYSCALLS
35extern unsigned long arch_syscall_addr(int nr);
36extern int init_syscall_trace(struct ftrace_event_call *call);
37
38extern int reg_event_syscall_enter(struct ftrace_event_call *call);
39extern void unreg_event_syscall_enter(struct ftrace_event_call *call);
40extern int reg_event_syscall_exit(struct ftrace_event_call *call);
41extern void unreg_event_syscall_exit(struct ftrace_event_call *call);
42extern int
43ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
44enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags,
45 struct trace_event *event);
46enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags,
47 struct trace_event *event);
48#endif
49
50#ifdef CONFIG_PERF_EVENTS
51int perf_sysenter_enable(struct ftrace_event_call *call);
52void perf_sysenter_disable(struct ftrace_event_call *call);
53int perf_sysexit_enable(struct ftrace_event_call *call);
54void perf_sysexit_disable(struct ftrace_event_call *call);
55#endif
56
57#endif /* _TRACE_SYSCALL_H */ 34#endif /* _TRACE_SYSCALL_H */
diff --git a/include/uapi/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h
index 199975fac395..143dacbb7d9a 100644
--- a/include/uapi/asm-generic/ioctls.h
+++ b/include/uapi/asm-generic/ioctls.h
@@ -74,6 +74,9 @@
74#define TCSETXW 0x5435 74#define TCSETXW 0x5435
75#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ 75#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
76#define TIOCVHANGUP 0x5437 76#define TIOCVHANGUP 0x5437
77#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
78#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
79#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
77 80
78#define FIONCLEX 0x5450 81#define FIONCLEX 0x5450
79#define FIOCLEX 0x5451 82#define FIOCLEX 0x5451
diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index d030d2c2647a..4164529a94f9 100644
--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -55,4 +55,15 @@
55/* compatibility flags */ 55/* compatibility flags */
56#define MAP_FILE 0 56#define MAP_FILE 0
57 57
58/*
59 * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
60 * This gives us 6 bits, which is enough until someone invents 128 bit address
61 * spaces.
62 *
63 * Assume these are all power of twos.
64 * When 0 use the default page size.
65 */
66#define MAP_HUGE_SHIFT 26
67#define MAP_HUGE_MASK 0x3f
68
58#endif /* __ASM_GENERIC_MMAN_COMMON_H */ 69#endif /* __ASM_GENERIC_MMAN_COMMON_H */
diff --git a/include/uapi/asm-generic/mman.h b/include/uapi/asm-generic/mman.h
index 32c8bd6a196d..e9fe6fd2a074 100644
--- a/include/uapi/asm-generic/mman.h
+++ b/include/uapi/asm-generic/mman.h
@@ -13,6 +13,8 @@
13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ 13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
14#define MAP_HUGETLB 0x40000 /* create a huge page mapping */ 14#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
15 15
16/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
17
16#define MCL_CURRENT 1 /* lock all current mappings */ 18#define MCL_CURRENT 1 /* lock all current mappings */
17#define MCL_FUTURE 2 /* lock all future mappings */ 19#define MCL_FUTURE 2 /* lock all future mappings */
18 20
diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
index 0a78028984de..6fae30fd16ab 100644
--- a/include/uapi/asm-generic/signal.h
+++ b/include/uapi/asm-generic/signal.h
@@ -80,12 +80,6 @@
80 * SA_RESTORER 0x04000000 80 * SA_RESTORER 0x04000000
81 */ 81 */
82 82
83/*
84 * sigaltstack controls
85 */
86#define SS_ONSTACK 1
87#define SS_DISABLE 2
88
89#define MINSIGSTKSZ 2048 83#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192 84#define SIGSTKSZ 8192
91 85
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index b1bea03274d5..2d32d073a6f9 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -43,6 +43,7 @@
43/* Socket filtering */ 43/* Socket filtering */
44#define SO_ATTACH_FILTER 26 44#define SO_ATTACH_FILTER 26
45#define SO_DETACH_FILTER 27 45#define SO_DETACH_FILTER 27
46#define SO_GET_FILTER SO_ATTACH_FILTER
46 47
47#define SO_PEERNAME 28 48#define SO_PEERNAME 28
48#define SO_TIMESTAMP 29 49#define SO_TIMESTAMP 29
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 6e595ba545f4..2c531f478410 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -690,9 +690,11 @@ __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
690 compat_sys_process_vm_writev) 690 compat_sys_process_vm_writev)
691#define __NR_kcmp 272 691#define __NR_kcmp 272
692__SYSCALL(__NR_kcmp, sys_kcmp) 692__SYSCALL(__NR_kcmp, sys_kcmp)
693#define __NR_finit_module 273
694__SYSCALL(__NR_finit_module, sys_finit_module)
693 695
694#undef __NR_syscalls 696#undef __NR_syscalls
695#define __NR_syscalls 273 697#define __NR_syscalls 274
696 698
697/* 699/*
698 * All syscalls below here should go away really, 700 * All syscalls below here should go away really,
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index c0494d586e23..d5844122ff32 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _UAPI_EXYNOS_DRM_H_ 15#ifndef _UAPI_EXYNOS_DRM_H_
@@ -133,17 +119,26 @@ struct drm_exynos_g2d_cmd {
133 __u32 data; 119 __u32 data;
134}; 120};
135 121
122enum drm_exynos_g2d_buf_type {
123 G2D_BUF_USERPTR = 1 << 31,
124};
125
136enum drm_exynos_g2d_event_type { 126enum drm_exynos_g2d_event_type {
137 G2D_EVENT_NOT, 127 G2D_EVENT_NOT,
138 G2D_EVENT_NONSTOP, 128 G2D_EVENT_NONSTOP,
139 G2D_EVENT_STOP, /* not yet */ 129 G2D_EVENT_STOP, /* not yet */
140}; 130};
141 131
132struct drm_exynos_g2d_userptr {
133 unsigned long userptr;
134 unsigned long size;
135};
136
142struct drm_exynos_g2d_set_cmdlist { 137struct drm_exynos_g2d_set_cmdlist {
143 __u64 cmd; 138 __u64 cmd;
144 __u64 cmd_gem; 139 __u64 cmd_buf;
145 __u32 cmd_nr; 140 __u32 cmd_nr;
146 __u32 cmd_gem_nr; 141 __u32 cmd_buf_nr;
147 142
148 /* for g2d event */ 143 /* for g2d event */
149 __u64 event_type; 144 __u64 event_type;
@@ -154,6 +149,172 @@ struct drm_exynos_g2d_exec {
154 __u64 async; 149 __u64 async;
155}; 150};
156 151
152enum drm_exynos_ops_id {
153 EXYNOS_DRM_OPS_SRC,
154 EXYNOS_DRM_OPS_DST,
155 EXYNOS_DRM_OPS_MAX,
156};
157
158struct drm_exynos_sz {
159 __u32 hsize;
160 __u32 vsize;
161};
162
163struct drm_exynos_pos {
164 __u32 x;
165 __u32 y;
166 __u32 w;
167 __u32 h;
168};
169
170enum drm_exynos_flip {
171 EXYNOS_DRM_FLIP_NONE = (0 << 0),
172 EXYNOS_DRM_FLIP_VERTICAL = (1 << 0),
173 EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1),
174 EXYNOS_DRM_FLIP_BOTH = EXYNOS_DRM_FLIP_VERTICAL |
175 EXYNOS_DRM_FLIP_HORIZONTAL,
176};
177
178enum drm_exynos_degree {
179 EXYNOS_DRM_DEGREE_0,
180 EXYNOS_DRM_DEGREE_90,
181 EXYNOS_DRM_DEGREE_180,
182 EXYNOS_DRM_DEGREE_270,
183};
184
185enum drm_exynos_planer {
186 EXYNOS_DRM_PLANAR_Y,
187 EXYNOS_DRM_PLANAR_CB,
188 EXYNOS_DRM_PLANAR_CR,
189 EXYNOS_DRM_PLANAR_MAX,
190};
191
192/**
193 * A structure for ipp supported property list.
194 *
195 * @version: version of this structure.
196 * @ipp_id: id of ipp driver.
197 * @count: count of ipp driver.
198 * @writeback: flag of writeback supporting.
199 * @flip: flag of flip supporting.
200 * @degree: flag of degree information.
201 * @csc: flag of csc supporting.
202 * @crop: flag of crop supporting.
203 * @scale: flag of scale supporting.
204 * @refresh_min: min hz of refresh.
205 * @refresh_max: max hz of refresh.
206 * @crop_min: crop min resolution.
207 * @crop_max: crop max resolution.
208 * @scale_min: scale min resolution.
209 * @scale_max: scale max resolution.
210 */
211struct drm_exynos_ipp_prop_list {
212 __u32 version;
213 __u32 ipp_id;
214 __u32 count;
215 __u32 writeback;
216 __u32 flip;
217 __u32 degree;
218 __u32 csc;
219 __u32 crop;
220 __u32 scale;
221 __u32 refresh_min;
222 __u32 refresh_max;
223 __u32 reserved;
224 struct drm_exynos_sz crop_min;
225 struct drm_exynos_sz crop_max;
226 struct drm_exynos_sz scale_min;
227 struct drm_exynos_sz scale_max;
228};
229
230/**
231 * A structure for ipp config.
232 *
233 * @ops_id: property of operation directions.
234 * @flip: property of mirror, flip.
235 * @degree: property of rotation degree.
236 * @fmt: property of image format.
237 * @sz: property of image size.
238 * @pos: property of image position(src-cropped,dst-scaler).
239 */
240struct drm_exynos_ipp_config {
241 enum drm_exynos_ops_id ops_id;
242 enum drm_exynos_flip flip;
243 enum drm_exynos_degree degree;
244 __u32 fmt;
245 struct drm_exynos_sz sz;
246 struct drm_exynos_pos pos;
247};
248
249enum drm_exynos_ipp_cmd {
250 IPP_CMD_NONE,
251 IPP_CMD_M2M,
252 IPP_CMD_WB,
253 IPP_CMD_OUTPUT,
254 IPP_CMD_MAX,
255};
256
257/**
258 * A structure for ipp property.
259 *
260 * @config: source, destination config.
261 * @cmd: definition of command.
262 * @ipp_id: id of ipp driver.
263 * @prop_id: id of property.
264 * @refresh_rate: refresh rate.
265 */
266struct drm_exynos_ipp_property {
267 struct drm_exynos_ipp_config config[EXYNOS_DRM_OPS_MAX];
268 enum drm_exynos_ipp_cmd cmd;
269 __u32 ipp_id;
270 __u32 prop_id;
271 __u32 refresh_rate;
272};
273
274enum drm_exynos_ipp_buf_type {
275 IPP_BUF_ENQUEUE,
276 IPP_BUF_DEQUEUE,
277};
278
279/**
280 * A structure for ipp buffer operations.
281 *
282 * @ops_id: operation directions.
283 * @buf_type: definition of buffer.
284 * @prop_id: id of property.
285 * @buf_id: id of buffer.
286 * @handle: Y, Cb, Cr each planar handle.
287 * @user_data: user data.
288 */
289struct drm_exynos_ipp_queue_buf {
290 enum drm_exynos_ops_id ops_id;
291 enum drm_exynos_ipp_buf_type buf_type;
292 __u32 prop_id;
293 __u32 buf_id;
294 __u32 handle[EXYNOS_DRM_PLANAR_MAX];
295 __u32 reserved;
296 __u64 user_data;
297};
298
299enum drm_exynos_ipp_ctrl {
300 IPP_CTRL_PLAY,
301 IPP_CTRL_STOP,
302 IPP_CTRL_PAUSE,
303 IPP_CTRL_RESUME,
304 IPP_CTRL_MAX,
305};
306
307/**
308 * A structure for ipp start/stop operations.
309 *
310 * @prop_id: id of property.
311 * @ctrl: definition of control.
312 */
313struct drm_exynos_ipp_cmd_ctrl {
314 __u32 prop_id;
315 enum drm_exynos_ipp_ctrl ctrl;
316};
317
157#define DRM_EXYNOS_GEM_CREATE 0x00 318#define DRM_EXYNOS_GEM_CREATE 0x00
158#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 319#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
159#define DRM_EXYNOS_GEM_MMAP 0x02 320#define DRM_EXYNOS_GEM_MMAP 0x02
@@ -166,6 +327,12 @@ struct drm_exynos_g2d_exec {
166#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21 327#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
167#define DRM_EXYNOS_G2D_EXEC 0x22 328#define DRM_EXYNOS_G2D_EXEC 0x22
168 329
330/* IPP - Image Post Processing */
331#define DRM_EXYNOS_IPP_GET_PROPERTY 0x30
332#define DRM_EXYNOS_IPP_SET_PROPERTY 0x31
333#define DRM_EXYNOS_IPP_QUEUE_BUF 0x32
334#define DRM_EXYNOS_IPP_CMD_CTRL 0x33
335
169#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 336#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
170 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 337 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
171 338
@@ -188,8 +355,18 @@ struct drm_exynos_g2d_exec {
188#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \ 355#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
189 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec) 356 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
190 357
358#define DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
359 DRM_EXYNOS_IPP_GET_PROPERTY, struct drm_exynos_ipp_prop_list)
360#define DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
361 DRM_EXYNOS_IPP_SET_PROPERTY, struct drm_exynos_ipp_property)
362#define DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF DRM_IOWR(DRM_COMMAND_BASE + \
363 DRM_EXYNOS_IPP_QUEUE_BUF, struct drm_exynos_ipp_queue_buf)
364#define DRM_IOCTL_EXYNOS_IPP_CMD_CTRL DRM_IOWR(DRM_COMMAND_BASE + \
365 DRM_EXYNOS_IPP_CMD_CTRL, struct drm_exynos_ipp_cmd_ctrl)
366
191/* EXYNOS specific events */ 367/* EXYNOS specific events */
192#define DRM_EXYNOS_G2D_EVENT 0x80000000 368#define DRM_EXYNOS_G2D_EVENT 0x80000000
369#define DRM_EXYNOS_IPP_EVENT 0x80000001
193 370
194struct drm_exynos_g2d_event { 371struct drm_exynos_g2d_event {
195 struct drm_event base; 372 struct drm_event base;
@@ -200,4 +377,14 @@ struct drm_exynos_g2d_event {
200 __u32 reserved; 377 __u32 reserved;
201}; 378};
202 379
380struct drm_exynos_ipp_event {
381 struct drm_event base;
382 __u64 user_data;
383 __u32 tv_sec;
384 __u32 tv_usec;
385 __u32 prop_id;
386 __u32 reserved;
387 __u32 buf_id[EXYNOS_DRM_OPS_MAX];
388};
389
203#endif /* _UAPI_EXYNOS_DRM_H_ */ 390#endif /* _UAPI_EXYNOS_DRM_H_ */
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index b746a3cf5fa9..c4d2e9c74002 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -307,6 +307,7 @@ typedef struct drm_i915_irq_wait {
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22 308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22
309#define I915_PARAM_HAS_SECURE_BATCHES 23 309#define I915_PARAM_HAS_SECURE_BATCHES 23
310#define I915_PARAM_HAS_PINNED_BATCHES 24
310 311
311typedef struct drm_i915_getparam { 312typedef struct drm_i915_getparam {
312 int param; 313 int param;
@@ -677,6 +678,15 @@ struct drm_i915_gem_execbuffer2 {
677 */ 678 */
678#define I915_EXEC_SECURE (1<<9) 679#define I915_EXEC_SECURE (1<<9)
679 680
681/** Inform the kernel that the batch is and will always be pinned. This
682 * negates the requirement for a workaround to be performed to avoid
683 * an incoherent CS (such as can be found on 830/845). If this flag is
684 * not passed, the kernel will endeavour to make sure the batch is
685 * coherent with the CS before execution. If this flag is passed,
686 * userspace assumes the responsibility for ensuring the same.
687 */
688#define I915_EXEC_IS_PINNED (1<<10)
689
680#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 690#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
681#define i915_execbuffer2_set_context_id(eb2, context) \ 691#define i915_execbuffer2_set_context_id(eb2, context) \
682 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK 692 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index 4766c0f6a838..eeda91774c8a 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -913,9 +913,11 @@ struct drm_radeon_gem_va {
913/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ 913/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
914#define RADEON_CS_KEEP_TILING_FLAGS 0x01 914#define RADEON_CS_KEEP_TILING_FLAGS 0x01
915#define RADEON_CS_USE_VM 0x02 915#define RADEON_CS_USE_VM 0x02
916#define RADEON_CS_END_OF_FRAME 0x04 /* a hint from userspace which CS is the last one */
916/* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */ 917/* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */
917#define RADEON_CS_RING_GFX 0 918#define RADEON_CS_RING_GFX 0
918#define RADEON_CS_RING_COMPUTE 1 919#define RADEON_CS_RING_COMPUTE 1
920#define RADEON_CS_RING_DMA 2
919/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ 921/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
920/* 0 = normal, + = higher priority, - = lower priority */ 922/* 0 = normal, + = higher priority, - = lower priority */
921 923
@@ -966,6 +968,10 @@ struct drm_radeon_cs {
966#define RADEON_INFO_MAX_PIPES 0x10 968#define RADEON_INFO_MAX_PIPES 0x10
967/* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */ 969/* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */
968#define RADEON_INFO_TIMESTAMP 0x11 970#define RADEON_INFO_TIMESTAMP 0x11
971/* max shader engines (SE) - needed for geometry shaders, etc. */
972#define RADEON_INFO_MAX_SE 0x12
973/* max SH per SE */
974#define RADEON_INFO_MAX_SH_PER_SE 0x13
969 975
970struct drm_radeon_info { 976struct drm_radeon_info {
971 uint32_t request; 977 uint32_t request;
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index e194387ef784..4e67194fd2c3 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -258,6 +258,7 @@ header-y += neighbour.h
258header-y += net.h 258header-y += net.h
259header-y += net_dropmon.h 259header-y += net_dropmon.h
260header-y += net_tstamp.h 260header-y += net_tstamp.h
261header-y += netconf.h
261header-y += netdevice.h 262header-y += netdevice.h
262header-y += netfilter.h 263header-y += netfilter.h
263header-y += netfilter_arp.h 264header-y += netfilter_arp.h
@@ -415,3 +416,4 @@ header-y += wireless.h
415header-y += x25.h 416header-y += x25.h
416header-y += xattr.h 417header-y += xattr.h
417header-y += xfrm.h 418header-y += xfrm.h
419header-y += hw_breakpoint.h
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 91e3a360f611..539b179b349c 100644
--- a/include/uapi/linux/dm-ioctl.h
+++ b/include/uapi/linux/dm-ioctl.h
@@ -268,8 +268,8 @@ enum {
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 23 270#define DM_VERSION_MINOR 23
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 1
272#define DM_VERSION_EXTRA "-ioctl (2012-07-25)" 272#define DM_VERSION_EXTRA "-ioctl (2012-12-18)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index d3eaaaf1009e..0c9b44871df0 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -500,13 +500,26 @@ union ethtool_flow_union {
500 struct ethtool_ah_espip4_spec esp_ip4_spec; 500 struct ethtool_ah_espip4_spec esp_ip4_spec;
501 struct ethtool_usrip4_spec usr_ip4_spec; 501 struct ethtool_usrip4_spec usr_ip4_spec;
502 struct ethhdr ether_spec; 502 struct ethhdr ether_spec;
503 __u8 hdata[60]; 503 __u8 hdata[52];
504}; 504};
505 505
506/**
507 * struct ethtool_flow_ext - additional RX flow fields
508 * @h_dest: destination MAC address
509 * @vlan_etype: VLAN EtherType
510 * @vlan_tci: VLAN tag control information
511 * @data: user defined data
512 *
513 * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
514 * is set in &struct ethtool_rx_flow_spec @flow_type.
515 * @h_dest is valid if %FLOW_MAC_EXT is set.
516 */
506struct ethtool_flow_ext { 517struct ethtool_flow_ext {
507 __be16 vlan_etype; 518 __u8 padding[2];
508 __be16 vlan_tci; 519 unsigned char h_dest[ETH_ALEN];
509 __be32 data[2]; 520 __be16 vlan_etype;
521 __be16 vlan_tci;
522 __be32 data[2];
510}; 523};
511 524
512/** 525/**
@@ -517,7 +530,8 @@ struct ethtool_flow_ext {
517 * @m_u: Masks for flow field bits to be matched 530 * @m_u: Masks for flow field bits to be matched
518 * @m_ext: Masks for additional field bits to be matched 531 * @m_ext: Masks for additional field bits to be matched
519 * Note, all additional fields must be ignored unless @flow_type 532 * Note, all additional fields must be ignored unless @flow_type
520 * includes the %FLOW_EXT flag. 533 * includes the %FLOW_EXT or %FLOW_MAC_EXT flag
534 * (see &struct ethtool_flow_ext description).
521 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC 535 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
522 * if packets should be discarded 536 * if packets should be discarded
523 * @location: Location of rule in the table. Locations must be 537 * @location: Location of rule in the table. Locations must be
@@ -1027,6 +1041,7 @@ enum ethtool_sfeatures_retval_bits {
1027#define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 1041#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
1028/* Flag to enable additional fields in struct ethtool_rx_flow_spec */ 1042/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1029#define FLOW_EXT 0x80000000 1043#define FLOW_EXT 0x80000000
1044#define FLOW_MAC_EXT 0x40000000
1030 1045
1031/* L3-L4 network traffic flow hash options */ 1046/* L3-L4 network traffic flow hash options */
1032#define RXH_L2DA (1 << 1) 1047#define RXH_L2DA (1 << 1)
diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h
index 8c99ce7202c5..2c267bcbb85c 100644
--- a/include/uapi/linux/eventpoll.h
+++ b/include/uapi/linux/eventpoll.h
@@ -25,7 +25,6 @@
25#define EPOLL_CTL_ADD 1 25#define EPOLL_CTL_ADD 1
26#define EPOLL_CTL_DEL 2 26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3 27#define EPOLL_CTL_MOD 3
28#define EPOLL_CTL_DISABLE 4
29 28
30/* 29/*
31 * Request the handling of system wakeup events so as to prevent system suspends 30 * Request the handling of system wakeup events so as to prevent system suspends
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 3d7922433aba..9cfde6941099 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -127,7 +127,9 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
127#define SKF_AD_RXHASH 32 127#define SKF_AD_RXHASH 32
128#define SKF_AD_CPU 36 128#define SKF_AD_CPU 36
129#define SKF_AD_ALU_XOR_X 40 129#define SKF_AD_ALU_XOR_X 40
130#define SKF_AD_MAX 44 130#define SKF_AD_VLAN_TAG 44
131#define SKF_AD_VLAN_TAG_PRESENT 48
132#define SKF_AD_MAX 52
131#define SKF_NET_OFF (-0x100000) 133#define SKF_NET_OFF (-0x100000)
132#define SKF_LL_OFF (-0x200000) 134#define SKF_LL_OFF (-0x200000)
133 135
diff --git a/include/uapi/linux/hdlc/Kbuild b/include/uapi/linux/hdlc/Kbuild
index aafaa5aa54d4..8c1d2cb75e33 100644
--- a/include/uapi/linux/hdlc/Kbuild
+++ b/include/uapi/linux/hdlc/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ioctl.h
diff --git a/include/linux/hdlc/ioctl.h b/include/uapi/linux/hdlc/ioctl.h
index 583972364357..04bc0274a189 100644
--- a/include/linux/hdlc/ioctl.h
+++ b/include/uapi/linux/hdlc/ioctl.h
@@ -34,13 +34,15 @@
34#define LMI_CCITT 3 /* ITU-T Annex A */ 34#define LMI_CCITT 3 /* ITU-T Annex A */
35#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ 35#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
36 36
37typedef struct { 37#ifndef __ASSEMBLY__
38
39typedef struct {
38 unsigned int clock_rate; /* bits per second */ 40 unsigned int clock_rate; /* bits per second */
39 unsigned int clock_type; /* internal, external, TX-internal etc. */ 41 unsigned int clock_type; /* internal, external, TX-internal etc. */
40 unsigned short loopback; 42 unsigned short loopback;
41} sync_serial_settings; /* V.35, V.24, X.21 */ 43} sync_serial_settings; /* V.35, V.24, X.21 */
42 44
43typedef struct { 45typedef struct {
44 unsigned int clock_rate; /* bits per second */ 46 unsigned int clock_rate; /* bits per second */
45 unsigned int clock_type; /* internal, external, TX-internal etc. */ 47 unsigned int clock_type; /* internal, external, TX-internal etc. */
46 unsigned short loopback; 48 unsigned short loopback;
@@ -78,4 +80,5 @@ typedef struct {
78 80
79/* PPP doesn't need any info now - supply length = 0 to ioctl */ 81/* PPP doesn't need any info now - supply length = 0 to ioctl */
80 82
83#endif /* __ASSEMBLY__ */
81#endif /* __HDLC_IOCTL_H__ */ 84#endif /* __HDLC_IOCTL_H__ */
diff --git a/include/uapi/linux/hw_breakpoint.h b/include/uapi/linux/hw_breakpoint.h
new file mode 100644
index 000000000000..b04000a2296a
--- /dev/null
+++ b/include/uapi/linux/hw_breakpoint.h
@@ -0,0 +1,30 @@
1#ifndef _UAPI_LINUX_HW_BREAKPOINT_H
2#define _UAPI_LINUX_HW_BREAKPOINT_H
3
4enum {
5 HW_BREAKPOINT_LEN_1 = 1,
6 HW_BREAKPOINT_LEN_2 = 2,
7 HW_BREAKPOINT_LEN_4 = 4,
8 HW_BREAKPOINT_LEN_8 = 8,
9};
10
11enum {
12 HW_BREAKPOINT_EMPTY = 0,
13 HW_BREAKPOINT_R = 1,
14 HW_BREAKPOINT_W = 2,
15 HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
16 HW_BREAKPOINT_X = 4,
17 HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
18};
19
20enum bp_type_idx {
21 TYPE_INST = 0,
22#ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
23 TYPE_DATA = 0,
24#else
25 TYPE_DATA = 1,
26#endif
27 TYPE_MAX
28};
29
30#endif /* _UAPI_LINUX_HW_BREAKPOINT_H */
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index a8fe9549ddbc..5db297514aec 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -97,5 +97,89 @@ struct __fdb_entry {
97 __u16 unused; 97 __u16 unused;
98}; 98};
99 99
100/* Bridge Flags */
101#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */
102#define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */
103
104#define BRIDGE_MODE_VEB 0 /* Default loopback mode */
105#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
106
107/* Bridge management nested attributes
108 * [IFLA_AF_SPEC] = {
109 * [IFLA_BRIDGE_FLAGS]
110 * [IFLA_BRIDGE_MODE]
111 * }
112 */
113enum {
114 IFLA_BRIDGE_FLAGS,
115 IFLA_BRIDGE_MODE,
116 __IFLA_BRIDGE_MAX,
117};
118#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
119
120/* Bridge multicast database attributes
121 * [MDBA_MDB] = {
122 * [MDBA_MDB_ENTRY] = {
123 * [MDBA_MDB_ENTRY_INFO]
124 * }
125 * }
126 * [MDBA_ROUTER] = {
127 * [MDBA_ROUTER_PORT]
128 * }
129 */
130enum {
131 MDBA_UNSPEC,
132 MDBA_MDB,
133 MDBA_ROUTER,
134 __MDBA_MAX,
135};
136#define MDBA_MAX (__MDBA_MAX - 1)
137
138enum {
139 MDBA_MDB_UNSPEC,
140 MDBA_MDB_ENTRY,
141 __MDBA_MDB_MAX,
142};
143#define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
144
145enum {
146 MDBA_MDB_ENTRY_UNSPEC,
147 MDBA_MDB_ENTRY_INFO,
148 __MDBA_MDB_ENTRY_MAX,
149};
150#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
151
152enum {
153 MDBA_ROUTER_UNSPEC,
154 MDBA_ROUTER_PORT,
155 __MDBA_ROUTER_MAX,
156};
157#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
158
159struct br_port_msg {
160 __u8 family;
161 __u32 ifindex;
162};
163
164struct br_mdb_entry {
165 __u32 ifindex;
166#define MDB_TEMPORARY 0
167#define MDB_PERMANENT 1
168 __u8 state;
169 struct {
170 union {
171 __be32 ip4;
172 struct in6_addr ip6;
173 } u;
174 __be16 proto;
175 } addr;
176};
177
178enum {
179 MDBA_SET_ENTRY_UNSPEC,
180 MDBA_SET_ENTRY,
181 __MDBA_SET_ENTRY_MAX,
182};
183#define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
100 184
101#endif /* _UAPI_LINUX_IF_BRIDGE_H */ 185#endif /* _UAPI_LINUX_IF_BRIDGE_H */
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 0343e1f0582c..67fb87ca1094 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -48,6 +48,7 @@
48#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ 48#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */
49#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ 49#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
50#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ 50#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
51#define ETH_P_BATMAN 0x4305 /* B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ] */
51#define ETH_P_DEC 0x6000 /* DEC Assigned proto */ 52#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
52#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ 53#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
53#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ 54#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 5c80cb11518b..60f3b6b90602 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -205,6 +205,24 @@ enum {
205 205
206#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) 206#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
207 207
208enum {
209 BRIDGE_MODE_UNSPEC,
210 BRIDGE_MODE_HAIRPIN,
211};
212
213enum {
214 IFLA_BRPORT_UNSPEC,
215 IFLA_BRPORT_STATE, /* Spanning tree state */
216 IFLA_BRPORT_PRIORITY, /* " priority */
217 IFLA_BRPORT_COST, /* " cost */
218 IFLA_BRPORT_MODE, /* mode (hairpin) */
219 IFLA_BRPORT_GUARD, /* bpdu guard */
220 IFLA_BRPORT_PROTECT, /* root port protection */
221 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */
222 __IFLA_BRPORT_MAX
223};
224#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
225
208struct ifla_cacheinfo { 226struct ifla_cacheinfo {
209 __u32 max_reasm_len; 227 __u32 max_reasm_len;
210 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ 228 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
@@ -285,6 +303,10 @@ enum {
285 IFLA_VXLAN_AGEING, 303 IFLA_VXLAN_AGEING,
286 IFLA_VXLAN_LIMIT, 304 IFLA_VXLAN_LIMIT,
287 IFLA_VXLAN_PORT_RANGE, 305 IFLA_VXLAN_PORT_RANGE,
306 IFLA_VXLAN_PROXY,
307 IFLA_VXLAN_RSC,
308 IFLA_VXLAN_L2MISS,
309 IFLA_VXLAN_L3MISS,
288 __IFLA_VXLAN_MAX 310 __IFLA_VXLAN_MAX
289}; 311};
290#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 312#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
index f3799295d231..f9a60375f0d0 100644
--- a/include/uapi/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
@@ -50,6 +50,7 @@ struct sockaddr_ll {
50#define PACKET_TX_TIMESTAMP 16 50#define PACKET_TX_TIMESTAMP 16
51#define PACKET_TIMESTAMP 17 51#define PACKET_TIMESTAMP 17
52#define PACKET_FANOUT 18 52#define PACKET_FANOUT 18
53#define PACKET_TX_HAS_OFF 19
53 54
54#define PACKET_FANOUT_HASH 0 55#define PACKET_FANOUT_HASH 0
55#define PACKET_FANOUT_LB 1 56#define PACKET_FANOUT_LB 1
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 25a585ce23e6..2835b85fd46d 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -31,9 +31,11 @@
31#define TUN_FASYNC 0x0010 31#define TUN_FASYNC 0x0010
32#define TUN_NOCHECKSUM 0x0020 32#define TUN_NOCHECKSUM 0x0020
33#define TUN_NO_PI 0x0040 33#define TUN_NO_PI 0x0040
34/* This flag has no real effect */
34#define TUN_ONE_QUEUE 0x0080 35#define TUN_ONE_QUEUE 0x0080
35#define TUN_PERSIST 0x0100 36#define TUN_PERSIST 0x0100
36#define TUN_VNET_HDR 0x0200 37#define TUN_VNET_HDR 0x0200
38#define TUN_TAP_MQ 0x0400
37 39
38/* Ioctl defines */ 40/* Ioctl defines */
39#define TUNSETNOCSUM _IOW('T', 200, int) 41#define TUNSETNOCSUM _IOW('T', 200, int)
@@ -53,14 +55,19 @@
53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) 55#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
54#define TUNGETVNETHDRSZ _IOR('T', 215, int) 56#define TUNGETVNETHDRSZ _IOR('T', 215, int)
55#define TUNSETVNETHDRSZ _IOW('T', 216, int) 57#define TUNSETVNETHDRSZ _IOW('T', 216, int)
58#define TUNSETQUEUE _IOW('T', 217, int)
56 59
57/* TUNSETIFF ifr flags */ 60/* TUNSETIFF ifr flags */
58#define IFF_TUN 0x0001 61#define IFF_TUN 0x0001
59#define IFF_TAP 0x0002 62#define IFF_TAP 0x0002
60#define IFF_NO_PI 0x1000 63#define IFF_NO_PI 0x1000
64/* This flag has no real effect */
61#define IFF_ONE_QUEUE 0x2000 65#define IFF_ONE_QUEUE 0x2000
62#define IFF_VNET_HDR 0x4000 66#define IFF_VNET_HDR 0x4000
63#define IFF_TUN_EXCL 0x8000 67#define IFF_TUN_EXCL 0x8000
68#define IFF_MULTI_QUEUE 0x0100
69#define IFF_ATTACH_QUEUE 0x0200
70#define IFF_DETACH_QUEUE 0x0400
64 71
65/* Features for GSO (TUNSETOFFLOAD). */ 72/* Features for GSO (TUNSETOFFLOAD). */
66#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ 73#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 5db5942575fe..aee73d0611fb 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -37,6 +37,26 @@ struct ip_tunnel_parm {
37 struct iphdr iph; 37 struct iphdr iph;
38}; 38};
39 39
40enum {
41 IFLA_IPTUN_UNSPEC,
42 IFLA_IPTUN_LINK,
43 IFLA_IPTUN_LOCAL,
44 IFLA_IPTUN_REMOTE,
45 IFLA_IPTUN_TTL,
46 IFLA_IPTUN_TOS,
47 IFLA_IPTUN_ENCAP_LIMIT,
48 IFLA_IPTUN_FLOWINFO,
49 IFLA_IPTUN_FLAGS,
50 IFLA_IPTUN_PROTO,
51 IFLA_IPTUN_PMTUDISC,
52 IFLA_IPTUN_6RD_PREFIX,
53 IFLA_IPTUN_6RD_RELAY_PREFIX,
54 IFLA_IPTUN_6RD_PREFIXLEN,
55 IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
56 __IFLA_IPTUN_MAX,
57};
58#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
59
40/* SIT-mode i_flags */ 60/* SIT-mode i_flags */
41#define SIT_ISATAP 0x0001 61#define SIT_ISATAP 0x0001
42 62
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index 1e3159989958..f79c3721da6e 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -240,6 +240,7 @@ struct in6_flowlabel_req {
240 * 240 *
241 * IP6T_SO_GET_REVISION_MATCH 68 241 * IP6T_SO_GET_REVISION_MATCH 68
242 * IP6T_SO_GET_REVISION_TARGET 69 242 * IP6T_SO_GET_REVISION_TARGET 69
243 * IP6T_SO_ORIGINAL_DST 80
243 */ 244 */
244 245
245/* RFC5014: Source address selection */ 246/* RFC5014: Source address selection */
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index 8c469af939aa..bbde90fa5838 100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -109,9 +109,10 @@ enum {
109 INET_DIAG_TOS, 109 INET_DIAG_TOS,
110 INET_DIAG_TCLASS, 110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO, 111 INET_DIAG_SKMEMINFO,
112 INET_DIAG_SHUTDOWN,
112}; 113};
113 114
114#define INET_DIAG_MAX INET_DIAG_SKMEMINFO 115#define INET_DIAG_MAX INET_DIAG_SHUTDOWN
115 116
116 117
117/* INET_DIAG_MEM */ 118/* INET_DIAG_MEM */
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 558828590a69..935119c698ac 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -851,6 +851,7 @@ struct input_keymap_entry {
851#define MSC_GESTURE 0x02 851#define MSC_GESTURE 0x02
852#define MSC_RAW 0x03 852#define MSC_RAW 0x03
853#define MSC_SCAN 0x04 853#define MSC_SCAN 0x04
854#define MSC_TIMESTAMP 0x05
854#define MSC_MAX 0x07 855#define MSC_MAX 0x07
855#define MSC_CNT (MSC_MAX+1) 856#define MSC_CNT (MSC_MAX+1)
856 857
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index a6d7d1c536c3..5a2991cf0251 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -157,6 +157,7 @@ enum {
157 DEVCONF_DISABLE_IPV6, 157 DEVCONF_DISABLE_IPV6,
158 DEVCONF_ACCEPT_DAD, 158 DEVCONF_ACCEPT_DAD,
159 DEVCONF_FORCE_TLLAO, 159 DEVCONF_FORCE_TLLAO,
160 DEVCONF_NDISC_NOTIFY,
160 DEVCONF_MAX 161 DEVCONF_MAX
161}; 162};
162 163
diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h
index 0459664c2636..2be7bd174751 100644
--- a/include/uapi/linux/ipv6_route.h
+++ b/include/uapi/linux/ipv6_route.h
@@ -55,4 +55,7 @@ struct in6_rtmsg {
55#define RTMSG_NEWROUTE 0x21 55#define RTMSG_NEWROUTE 0x21
56#define RTMSG_DELROUTE 0x22 56#define RTMSG_DELROUTE 0x22
57 57
58#define IP6_RT_PRIO_USER 1024
59#define IP6_RT_PRIO_ADDRCONF 256
60
58#endif /* _UAPI_LINUX_IPV6_ROUTE_H */ 61#endif /* _UAPI_LINUX_IPV6_ROUTE_H */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 0a6d6ba44c85..e6e5d4b13708 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -167,10 +167,15 @@ struct kvm_pit_config {
167#define KVM_EXIT_OSI 18 167#define KVM_EXIT_OSI 18
168#define KVM_EXIT_PAPR_HCALL 19 168#define KVM_EXIT_PAPR_HCALL 19
169#define KVM_EXIT_S390_UCONTROL 20 169#define KVM_EXIT_S390_UCONTROL 20
170#define KVM_EXIT_WATCHDOG 21
170 171
171/* For KVM_EXIT_INTERNAL_ERROR */ 172/* For KVM_EXIT_INTERNAL_ERROR */
172#define KVM_INTERNAL_ERROR_EMULATION 1 173/* Emulate instruction failed. */
173#define KVM_INTERNAL_ERROR_SIMUL_EX 2 174#define KVM_INTERNAL_ERROR_EMULATION 1
175/* Encounter unexpected simultaneous exceptions. */
176#define KVM_INTERNAL_ERROR_SIMUL_EX 2
177/* Encounter unexpected vm-exit due to delivery event. */
178#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
174 179
175/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 180/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
176struct kvm_run { 181struct kvm_run {
@@ -477,6 +482,8 @@ struct kvm_ppc_smmu_info {
477 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; 482 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
478}; 483};
479 484
485#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0)
486
480#define KVMIO 0xAE 487#define KVMIO 0xAE
481 488
482/* machine type bits, to be used as argument to KVM_CREATE_VM */ 489/* machine type bits, to be used as argument to KVM_CREATE_VM */
@@ -626,6 +633,8 @@ struct kvm_ppc_smmu_info {
626#define KVM_CAP_READONLY_MEM 81 633#define KVM_CAP_READONLY_MEM 81
627#endif 634#endif
628#define KVM_CAP_IRQFD_RESAMPLE 82 635#define KVM_CAP_IRQFD_RESAMPLE 82
636#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
637#define KVM_CAP_PPC_HTAB_FD 84
629 638
630#ifdef KVM_CAP_IRQ_ROUTING 639#ifdef KVM_CAP_IRQ_ROUTING
631 640
@@ -848,6 +857,11 @@ struct kvm_s390_ucas_mapping {
848#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) 857#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
849/* Available with KVM_CAP_PPC_ALLOC_HTAB */ 858/* Available with KVM_CAP_PPC_ALLOC_HTAB */
850#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) 859#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
860#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
861/* Available with KVM_CAP_RMA */
862#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
863/* Available with KVM_CAP_PPC_HTAB_FD */
864#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
851 865
852/* 866/*
853 * ioctls for vcpu fds 867 * ioctls for vcpu fds
@@ -911,9 +925,6 @@ struct kvm_s390_ucas_mapping {
911/* Available with KVM_CAP_XCRS */ 925/* Available with KVM_CAP_XCRS */
912#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) 926#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
913#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) 927#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
914#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
915/* Available with KVM_CAP_RMA */
916#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
917/* Available with KVM_CAP_SW_TLB */ 928/* Available with KVM_CAP_SW_TLB */
918#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) 929#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
919/* Available with KVM_CAP_ONE_REG */ 930/* Available with KVM_CAP_ONE_REG */
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index e15192cb9cf4..873e086ce3a1 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -23,10 +23,12 @@
23#define EXT4_SUPER_MAGIC 0xEF53 23#define EXT4_SUPER_MAGIC 0xEF53
24#define BTRFS_SUPER_MAGIC 0x9123683E 24#define BTRFS_SUPER_MAGIC 0x9123683E
25#define NILFS_SUPER_MAGIC 0x3434 25#define NILFS_SUPER_MAGIC 0x3434
26#define F2FS_SUPER_MAGIC 0xF2F52010
26#define HPFS_SUPER_MAGIC 0xf995e849 27#define HPFS_SUPER_MAGIC 0xf995e849
27#define ISOFS_SUPER_MAGIC 0x9660 28#define ISOFS_SUPER_MAGIC 0x9660
28#define JFFS2_SUPER_MAGIC 0x72b6 29#define JFFS2_SUPER_MAGIC 0x72b6
29#define PSTOREFS_MAGIC 0x6165676C 30#define PSTOREFS_MAGIC 0x6165676C
31#define EFIVARFS_MAGIC 0xde5e81e4
30 32
31#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ 33#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */
32#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */ 34#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */
diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
index 23e62e0537e2..0d11c3dcd3a1 100644
--- a/include/uapi/linux/mempolicy.h
+++ b/include/uapi/linux/mempolicy.h
@@ -20,6 +20,7 @@ enum {
20 MPOL_PREFERRED, 20 MPOL_PREFERRED,
21 MPOL_BIND, 21 MPOL_BIND,
22 MPOL_INTERLEAVE, 22 MPOL_INTERLEAVE,
23 MPOL_LOCAL,
23 MPOL_MAX, /* always last member of enum */ 24 MPOL_MAX, /* always last member of enum */
24}; 25};
25 26
@@ -47,9 +48,15 @@ enum mpol_rebind_step {
47 48
48/* Flags for mbind */ 49/* Flags for mbind */
49#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 50#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
50#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */ 51#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform
51#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ 52 to policy */
52#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */ 53#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */
54#define MPOL_MF_LAZY (1<<3) /* Modifies '_MOVE: lazy migrate on fault */
55#define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */
56
57#define MPOL_MF_VALID (MPOL_MF_STRICT | \
58 MPOL_MF_MOVE | \
59 MPOL_MF_MOVE_ALL)
53 60
54/* 61/*
55 * Internal flags that share the struct mempolicy flags word with 62 * Internal flags that share the struct mempolicy flags word with
@@ -59,6 +66,8 @@ enum mpol_rebind_step {
59#define MPOL_F_SHARED (1 << 0) /* identify shared policies */ 66#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
60#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */ 67#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
61#define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */ 68#define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */
69#define MPOL_F_MOF (1 << 3) /* this policy wants migrate on fault */
70#define MPOL_F_MORON (1 << 4) /* Migrate On pte_numa Reference On Node */
62 71
63 72
64#endif /* _UAPI_LINUX_MEMPOLICY_H */ 73#endif /* _UAPI_LINUX_MEMPOLICY_H */
diff --git a/include/uapi/linux/module.h b/include/uapi/linux/module.h
new file mode 100644
index 000000000000..38da4258b12f
--- /dev/null
+++ b/include/uapi/linux/module.h
@@ -0,0 +1,8 @@
1#ifndef _UAPI_LINUX_MODULE_H
2#define _UAPI_LINUX_MODULE_H
3
4/* Flags for sys_finit_module: */
5#define MODULE_INIT_IGNORE_MODVERSIONS 1
6#define MODULE_INIT_IGNORE_VERMAGIC 2
7
8#endif /* _UAPI_LINUX_MODULE_H */
diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
index 78dbd2f996a3..22d95c6854e0 100644
--- a/include/uapi/linux/msg.h
+++ b/include/uapi/linux/msg.h
@@ -10,6 +10,7 @@
10/* msgrcv options */ 10/* msgrcv options */
11#define MSG_NOERROR 010000 /* no error if message is too big */ 11#define MSG_NOERROR 010000 /* no error if message is too big */
12#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ 12#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
13#define MSG_COPY 040000 /* copy (not remove) all queue messages */
13 14
14/* Obsolete, used only for backwards compatibility and libc5 compiles */ 15/* Obsolete, used only for backwards compatibility and libc5 compiles */
15struct msqid_ds { 16struct msqid_ds {
diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h
new file mode 100644
index 000000000000..64804a798b0c
--- /dev/null
+++ b/include/uapi/linux/netconf.h
@@ -0,0 +1,24 @@
1#ifndef _UAPI_LINUX_NETCONF_H_
2#define _UAPI_LINUX_NETCONF_H_
3
4#include <linux/types.h>
5#include <linux/netlink.h>
6
7struct netconfmsg {
8 __u8 ncm_family;
9};
10
11enum {
12 NETCONFA_UNSPEC,
13 NETCONFA_IFINDEX,
14 NETCONFA_FORWARDING,
15 NETCONFA_RP_FILTER,
16 NETCONFA_MC_FORWARDING,
17 __NETCONFA_MAX
18};
19#define NETCONFA_MAX (__NETCONFA_MAX - 1)
20
21#define NETCONFA_IFINDEX_ALL -1
22#define NETCONFA_IFINDEX_DEFAULT -2
23
24#endif /* _UAPI_LINUX_NETCONF_H_ */
diff --git a/include/uapi/linux/netfilter/nfnetlink_conntrack.h b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
index 43bfe3e1685b..86e930cf3dfb 100644
--- a/include/uapi/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
@@ -9,6 +9,8 @@ enum cntl_msg_types {
9 IPCTNL_MSG_CT_GET_CTRZERO, 9 IPCTNL_MSG_CT_GET_CTRZERO,
10 IPCTNL_MSG_CT_GET_STATS_CPU, 10 IPCTNL_MSG_CT_GET_STATS_CPU,
11 IPCTNL_MSG_CT_GET_STATS, 11 IPCTNL_MSG_CT_GET_STATS,
12 IPCTNL_MSG_CT_GET_DYING,
13 IPCTNL_MSG_CT_GET_UNCONFIRMED,
12 14
13 IPCTNL_MSG_MAX 15 IPCTNL_MSG_MAX
14}; 16};
diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h
index bf1ef65cc582..649c68062dca 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h
@@ -178,6 +178,9 @@ struct ip6t_error {
178#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) 178#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
179#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET 179#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
180 180
181/* obtain original address if REDIRECT'd connection */
182#define IP6T_SO_ORIGINAL_DST 80
183
181/* ICMP matching stuff */ 184/* ICMP matching stuff */
182struct ip6t_icmp { 185struct ip6t_icmp {
183 __u8 type; /* type to match */ 186 __u8 type; /* type to match */
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index d908d17da56d..0e63cee8d810 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -60,6 +60,13 @@
60 * target mode. 60 * target mode.
61 * @NFC_EVENT_DEVICE_DEACTIVATED: event emitted when the adapter is deactivated 61 * @NFC_EVENT_DEVICE_DEACTIVATED: event emitted when the adapter is deactivated
62 * from target mode. 62 * from target mode.
63 * @NFC_CMD_LLC_GET_PARAMS: request LTO, RW, and MIUX parameters for a device
64 * @NFC_CMD_LLC_SET_PARAMS: set one or more of LTO, RW, and MIUX parameters for
65 * a device. LTO must be set before the link is up otherwise -EINPROGRESS
66 * is returned. RW and MIUX can be set at anytime and will be passed in
67 * subsequent CONNECT and CC messages.
68 * If one of the passed parameters is wrong none is set and -EINVAL is
69 * returned.
63 */ 70 */
64enum nfc_commands { 71enum nfc_commands {
65 NFC_CMD_UNSPEC, 72 NFC_CMD_UNSPEC,
@@ -77,6 +84,8 @@ enum nfc_commands {
77 NFC_EVENT_TARGET_LOST, 84 NFC_EVENT_TARGET_LOST,
78 NFC_EVENT_TM_ACTIVATED, 85 NFC_EVENT_TM_ACTIVATED,
79 NFC_EVENT_TM_DEACTIVATED, 86 NFC_EVENT_TM_DEACTIVATED,
87 NFC_CMD_LLC_GET_PARAMS,
88 NFC_CMD_LLC_SET_PARAMS,
80/* private: internal use only */ 89/* private: internal use only */
81 __NFC_CMD_AFTER_LAST 90 __NFC_CMD_AFTER_LAST
82}; 91};
@@ -102,6 +111,9 @@ enum nfc_commands {
102 * @NFC_ATTR_RF_MODE: Initiator or target 111 * @NFC_ATTR_RF_MODE: Initiator or target
103 * @NFC_ATTR_IM_PROTOCOLS: Initiator mode protocols to poll for 112 * @NFC_ATTR_IM_PROTOCOLS: Initiator mode protocols to poll for
104 * @NFC_ATTR_TM_PROTOCOLS: Target mode protocols to listen for 113 * @NFC_ATTR_TM_PROTOCOLS: Target mode protocols to listen for
114 * @NFC_ATTR_LLC_PARAM_LTO: Link TimeOut parameter
115 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter
116 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter
105 */ 117 */
106enum nfc_attrs { 118enum nfc_attrs {
107 NFC_ATTR_UNSPEC, 119 NFC_ATTR_UNSPEC,
@@ -119,6 +131,9 @@ enum nfc_attrs {
119 NFC_ATTR_DEVICE_POWERED, 131 NFC_ATTR_DEVICE_POWERED,
120 NFC_ATTR_IM_PROTOCOLS, 132 NFC_ATTR_IM_PROTOCOLS,
121 NFC_ATTR_TM_PROTOCOLS, 133 NFC_ATTR_TM_PROTOCOLS,
134 NFC_ATTR_LLC_PARAM_LTO,
135 NFC_ATTR_LLC_PARAM_RW,
136 NFC_ATTR_LLC_PARAM_MIUX,
122/* private: internal use only */ 137/* private: internal use only */
123 __NFC_ATTR_AFTER_LAST 138 __NFC_ATTR_AFTER_LAST
124}; 139};
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 7df9b500c804..e3e19f8b16f2 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -118,8 +118,9 @@
118 * to get a list of all present wiphys. 118 * to get a list of all present wiphys.
119 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or 119 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
120 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, 120 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
121 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, 121 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ (and the
122 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, 122 * attributes determining the channel width; this is used for setting
123 * monitor mode channel), %NL80211_ATTR_WIPHY_RETRY_SHORT,
123 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, 124 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
124 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. 125 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
125 * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL 126 * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
@@ -171,7 +172,7 @@
171 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, 172 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
172 * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT. 173 * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT.
173 * The channel to use can be set on the interface or be given using the 174 * The channel to use can be set on the interface or be given using the
174 * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_CHANNEL_TYPE attrs. 175 * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width.
175 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP 176 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
176 * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface 177 * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
177 * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP 178 * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
@@ -401,8 +402,7 @@
401 * a response while being associated to an AP on another channel. 402 * a response while being associated to an AP on another channel.
402 * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus 403 * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
403 * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the 404 * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
404 * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be 405 * frequency for the operation.
405 * optionally used to specify additional channel parameters.
406 * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds 406 * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds
407 * to remain on the channel. This command is also used as an event to 407 * to remain on the channel. This command is also used as an event to
408 * notify when the requested duration starts (it may take a while for the 408 * notify when the requested duration starts (it may take a while for the
@@ -440,12 +440,11 @@
440 * as an event indicating reception of a frame that was not processed in 440 * as an event indicating reception of a frame that was not processed in
441 * kernel code, but is for us (i.e., which may need to be processed in a 441 * kernel code, but is for us (i.e., which may need to be processed in a
442 * user space application). %NL80211_ATTR_FRAME is used to specify the 442 * user space application). %NL80211_ATTR_FRAME is used to specify the
443 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and 443 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used
444 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on 444 * to indicate on which channel the frame is to be transmitted or was
445 * which channel the frame is to be transmitted or was received. If this 445 * received. If this channel is not the current channel (remain-on-channel
446 * channel is not the current channel (remain-on-channel or the 446 * or the operational channel) the device will switch to the given channel
447 * operational channel) the device will switch to the given channel and 447 * and transmit the frame, optionally waiting for a response for the time
448 * transmit the frame, optionally waiting for a response for the time
449 * specified using %NL80211_ATTR_DURATION. When called, this operation 448 * specified using %NL80211_ATTR_DURATION. When called, this operation
450 * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the 449 * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
451 * TX status event pertaining to the TX request. 450 * TX status event pertaining to the TX request.
@@ -473,8 +472,8 @@
473 * command is used as an event to indicate the that a trigger level was 472 * command is used as an event to indicate the that a trigger level was
474 * reached. 473 * reached.
475 * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ 474 * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
476 * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed 475 * and the attributes determining channel width) the given interface
477 * by %NL80211_ATTR_IFINDEX) shall operate on. 476 * (identifed by %NL80211_ATTR_IFINDEX) shall operate on.
478 * In case multiple channels are supported by the device, the mechanism 477 * In case multiple channels are supported by the device, the mechanism
479 * with which it switches channels is implementation-defined. 478 * with which it switches channels is implementation-defined.
480 * When a monitor interface is given, it can only switch channel while 479 * When a monitor interface is given, it can only switch channel while
@@ -526,6 +525,12 @@
526 * of PMKSA caching dandidates. 525 * of PMKSA caching dandidates.
527 * 526 *
528 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). 527 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
528 * In addition, this can be used as an event to request userspace to take
529 * actions on TDLS links (set up a new link or tear down an existing one).
530 * In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested
531 * operation, %NL80211_ATTR_MAC contains the peer MAC address, and
532 * %NL80211_ATTR_REASON_CODE the reason code to be used (only with
533 * %NL80211_TDLS_TEARDOWN).
529 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. 534 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
530 * 535 *
531 * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP 536 * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
@@ -562,8 +567,8 @@
562 * 567 *
563 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels 568 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
564 * independently of the userspace SME, send this event indicating 569 * independently of the userspace SME, send this event indicating
565 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with 570 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
566 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. 571 * attributes determining channel width.
567 * 572 *
568 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by 573 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
569 * its %NL80211_ATTR_WDEV identifier. It must have been created with 574 * its %NL80211_ATTR_WDEV identifier. It must have been created with
@@ -578,6 +583,9 @@
578 * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON 583 * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
579 * is used for this. 584 * is used for this.
580 * 585 *
586 * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames
587 * for IBSS or MESH vif.
588 *
581 * @NL80211_CMD_MAX: highest used command number 589 * @NL80211_CMD_MAX: highest used command number
582 * @__NL80211_CMD_AFTER_LAST: internal use 590 * @__NL80211_CMD_AFTER_LAST: internal use
583 */ 591 */
@@ -726,6 +734,8 @@ enum nl80211_commands {
726 734
727 NL80211_CMD_CONN_FAILED, 735 NL80211_CMD_CONN_FAILED,
728 736
737 NL80211_CMD_SET_MCAST_RATE,
738
729 /* add new commands above here */ 739 /* add new commands above here */
730 740
731 /* used to define NL80211_CMD_MAX below */ 741 /* used to define NL80211_CMD_MAX below */
@@ -762,14 +772,26 @@ enum nl80211_commands {
762 * /sys/class/ieee80211/<phyname>/index 772 * /sys/class/ieee80211/<phyname>/index
763 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) 773 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
764 * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters 774 * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
765 * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz 775 * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz,
776 * defines the channel together with the (deprecated)
777 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE attribute or the attributes
778 * %NL80211_ATTR_CHANNEL_WIDTH and if needed %NL80211_ATTR_CENTER_FREQ1
779 * and %NL80211_ATTR_CENTER_FREQ2
780 * @NL80211_ATTR_CHANNEL_WIDTH: u32 attribute containing one of the values
781 * of &enum nl80211_chan_width, describing the channel width. See the
782 * documentation of the enum for more information.
783 * @NL80211_ATTR_CENTER_FREQ1: Center frequency of the first part of the
784 * channel, used for anything but 20 MHz bandwidth
785 * @NL80211_ATTR_CENTER_FREQ2: Center frequency of the second part of the
786 * channel, used only for 80+80 MHz bandwidth
766 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ 787 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
767 * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included): 788 * if HT20 or HT40 are to be used (i.e., HT disabled if not included):
768 * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including 789 * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including
769 * this attribute) 790 * this attribute)
770 * NL80211_CHAN_HT20 = HT20 only 791 * NL80211_CHAN_HT20 = HT20 only
771 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel 792 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
772 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel 793 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
794 * This attribute is now deprecated.
773 * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is 795 * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is
774 * less than or equal to the RTS threshold; allowed range: 1..255; 796 * less than or equal to the RTS threshold; allowed range: 1..255;
775 * dot11ShortRetryLimit; u8 797 * dot11ShortRetryLimit; u8
@@ -1273,6 +1295,21 @@ enum nl80211_commands {
1273 * the connection request from a station. nl80211_connect_failed_reason 1295 * the connection request from a station. nl80211_connect_failed_reason
1274 * enum has different reasons of connection failure. 1296 * enum has different reasons of connection failure.
1275 * 1297 *
1298 * @NL80211_ATTR_SAE_DATA: SAE elements in Authentication frames. This starts
1299 * with the Authentication transaction sequence number field.
1300 *
1301 * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
1302 * association request when used with NL80211_CMD_NEW_STATION)
1303 *
1304 * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32)
1305 *
1306 * @NL80211_ATTR_P2P_CTWINDOW: P2P GO Client Traffic Window (u8), used with
1307 * the START_AP and SET_BSS commands
1308 * @NL80211_ATTR_P2P_OPPPS: P2P GO opportunistic PS (u8), used with the
1309 * START_AP and SET_BSS commands. This can have the values 0 or 1;
1310 * if not given in START_AP 0 is assumed, if not given in SET_BSS
1311 * no change is made.
1312 *
1276 * @NL80211_ATTR_MAX: highest attribute number currently defined 1313 * @NL80211_ATTR_MAX: highest attribute number currently defined
1277 * @__NL80211_ATTR_AFTER_LAST: internal use 1314 * @__NL80211_ATTR_AFTER_LAST: internal use
1278 */ 1315 */
@@ -1530,6 +1567,19 @@ enum nl80211_attrs {
1530 1567
1531 NL80211_ATTR_CONN_FAILED_REASON, 1568 NL80211_ATTR_CONN_FAILED_REASON,
1532 1569
1570 NL80211_ATTR_SAE_DATA,
1571
1572 NL80211_ATTR_VHT_CAPABILITY,
1573
1574 NL80211_ATTR_SCAN_FLAGS,
1575
1576 NL80211_ATTR_CHANNEL_WIDTH,
1577 NL80211_ATTR_CENTER_FREQ1,
1578 NL80211_ATTR_CENTER_FREQ2,
1579
1580 NL80211_ATTR_P2P_CTWINDOW,
1581 NL80211_ATTR_P2P_OPPPS,
1582
1533 /* add attributes here, update the policy in nl80211.c */ 1583 /* add attributes here, update the policy in nl80211.c */
1534 1584
1535 __NL80211_ATTR_AFTER_LAST, 1585 __NL80211_ATTR_AFTER_LAST,
@@ -1573,6 +1623,7 @@ enum nl80211_attrs {
1573#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 1623#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
1574#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 1624#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
1575#define NL80211_HT_CAPABILITY_LEN 26 1625#define NL80211_HT_CAPABILITY_LEN 26
1626#define NL80211_VHT_CAPABILITY_LEN 12
1576 1627
1577#define NL80211_MAX_NR_CIPHER_SUITES 5 1628#define NL80211_MAX_NR_CIPHER_SUITES 5
1578#define NL80211_MAX_NR_AKM_SUITES 2 1629#define NL80211_MAX_NR_AKM_SUITES 2
@@ -1693,10 +1744,15 @@ struct nl80211_sta_flag_update {
1693 * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved 1744 * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
1694 * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s) 1745 * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
1695 * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8) 1746 * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
1696 * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate 1747 * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 MHz dualchannel bitrate
1697 * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval 1748 * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
1698 * @NL80211_RATE_INFO_BITRATE32: total bitrate (u32, 100kbit/s) 1749 * @NL80211_RATE_INFO_BITRATE32: total bitrate (u32, 100kbit/s)
1699 * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined 1750 * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
1751 * @NL80211_RATE_INFO_VHT_MCS: MCS index for VHT (u8)
1752 * @NL80211_RATE_INFO_VHT_NSS: number of streams in VHT (u8)
1753 * @NL80211_RATE_INFO_80_MHZ_WIDTH: 80 MHz VHT rate
1754 * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: 80+80 MHz VHT rate
1755 * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate
1700 * @__NL80211_RATE_INFO_AFTER_LAST: internal use 1756 * @__NL80211_RATE_INFO_AFTER_LAST: internal use
1701 */ 1757 */
1702enum nl80211_rate_info { 1758enum nl80211_rate_info {
@@ -1706,6 +1762,11 @@ enum nl80211_rate_info {
1706 NL80211_RATE_INFO_40_MHZ_WIDTH, 1762 NL80211_RATE_INFO_40_MHZ_WIDTH,
1707 NL80211_RATE_INFO_SHORT_GI, 1763 NL80211_RATE_INFO_SHORT_GI,
1708 NL80211_RATE_INFO_BITRATE32, 1764 NL80211_RATE_INFO_BITRATE32,
1765 NL80211_RATE_INFO_VHT_MCS,
1766 NL80211_RATE_INFO_VHT_NSS,
1767 NL80211_RATE_INFO_80_MHZ_WIDTH,
1768 NL80211_RATE_INFO_80P80_MHZ_WIDTH,
1769 NL80211_RATE_INFO_160_MHZ_WIDTH,
1709 1770
1710 /* keep last */ 1771 /* keep last */
1711 __NL80211_RATE_INFO_AFTER_LAST, 1772 __NL80211_RATE_INFO_AFTER_LAST,
@@ -2414,6 +2475,15 @@ enum nl80211_ac {
2414#define NL80211_TXQ_Q_BE NL80211_AC_BE 2475#define NL80211_TXQ_Q_BE NL80211_AC_BE
2415#define NL80211_TXQ_Q_BK NL80211_AC_BK 2476#define NL80211_TXQ_Q_BK NL80211_AC_BK
2416 2477
2478/**
2479 * enum nl80211_channel_type - channel type
2480 * @NL80211_CHAN_NO_HT: 20 MHz, non-HT channel
2481 * @NL80211_CHAN_HT20: 20 MHz HT channel
2482 * @NL80211_CHAN_HT40MINUS: HT40 channel, secondary channel
2483 * below the control channel
2484 * @NL80211_CHAN_HT40PLUS: HT40 channel, secondary channel
2485 * above the control channel
2486 */
2417enum nl80211_channel_type { 2487enum nl80211_channel_type {
2418 NL80211_CHAN_NO_HT, 2488 NL80211_CHAN_NO_HT,
2419 NL80211_CHAN_HT20, 2489 NL80211_CHAN_HT20,
@@ -2422,6 +2492,32 @@ enum nl80211_channel_type {
2422}; 2492};
2423 2493
2424/** 2494/**
2495 * enum nl80211_chan_width - channel width definitions
2496 *
2497 * These values are used with the %NL80211_ATTR_CHANNEL_WIDTH
2498 * attribute.
2499 *
2500 * @NL80211_CHAN_WIDTH_20_NOHT: 20 MHz, non-HT channel
2501 * @NL80211_CHAN_WIDTH_20: 20 MHz HT channel
2502 * @NL80211_CHAN_WIDTH_40: 40 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
2503 * attribute must be provided as well
2504 * @NL80211_CHAN_WIDTH_80: 80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
2505 * attribute must be provided as well
2506 * @NL80211_CHAN_WIDTH_80P80: 80+80 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
2507 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well
2508 * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
2509 * attribute must be provided as well
2510 */
2511enum nl80211_chan_width {
2512 NL80211_CHAN_WIDTH_20_NOHT,
2513 NL80211_CHAN_WIDTH_20,
2514 NL80211_CHAN_WIDTH_40,
2515 NL80211_CHAN_WIDTH_80,
2516 NL80211_CHAN_WIDTH_80P80,
2517 NL80211_CHAN_WIDTH_160,
2518};
2519
2520/**
2425 * enum nl80211_bss - netlink attributes for a BSS 2521 * enum nl80211_bss - netlink attributes for a BSS
2426 * 2522 *
2427 * @__NL80211_BSS_INVALID: invalid 2523 * @__NL80211_BSS_INVALID: invalid
@@ -2489,6 +2585,7 @@ enum nl80211_bss_status {
2489 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) 2585 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
2490 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) 2586 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
2491 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) 2587 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
2588 * @NL80211_AUTHTYPE_SAE: Simultaneous authentication of equals
2492 * @__NL80211_AUTHTYPE_NUM: internal 2589 * @__NL80211_AUTHTYPE_NUM: internal
2493 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm 2590 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
2494 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by 2591 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
@@ -2500,6 +2597,7 @@ enum nl80211_auth_type {
2500 NL80211_AUTHTYPE_SHARED_KEY, 2597 NL80211_AUTHTYPE_SHARED_KEY,
2501 NL80211_AUTHTYPE_FT, 2598 NL80211_AUTHTYPE_FT,
2502 NL80211_AUTHTYPE_NETWORK_EAP, 2599 NL80211_AUTHTYPE_NETWORK_EAP,
2600 NL80211_AUTHTYPE_SAE,
2503 2601
2504 /* keep last */ 2602 /* keep last */
2505 __NL80211_AUTHTYPE_NUM, 2603 __NL80211_AUTHTYPE_NUM,
@@ -3028,6 +3126,20 @@ enum nl80211_ap_sme_features {
3028 * in the interface combinations, even when it's only used for scan 3126 * in the interface combinations, even when it's only used for scan
3029 * and remain-on-channel. This could be due to, for example, the 3127 * and remain-on-channel. This could be due to, for example, the
3030 * remain-on-channel implementation requiring a channel context. 3128 * remain-on-channel implementation requiring a channel context.
3129 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
3130 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
3131 * mode
3132 * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan
3133 * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported
3134 * @NL80211_FEATURE_AP_SCAN: Support scanning using an AP vif
3135 * @NL80211_FEATURE_VIF_TXPOWER: The driver supports per-vif TX power setting
3136 * @NL80211_FEATURE_NEED_OBSS_SCAN: The driver expects userspace to perform
3137 * OBSS scans and generate 20/40 BSS coex reports. This flag is used only
3138 * for drivers implementing the CONNECT API, for AUTH/ASSOC it is implied.
3139 * @NL80211_FEATURE_P2P_GO_CTWIN: P2P GO implementation supports CT Window
3140 * setting
3141 * @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic
3142 * powersave
3031 */ 3143 */
3032enum nl80211_feature_flags { 3144enum nl80211_feature_flags {
3033 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3145 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3035,6 +3147,14 @@ enum nl80211_feature_flags {
3035 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, 3147 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
3036 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, 3148 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
3037 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, 3149 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4,
3150 NL80211_FEATURE_SAE = 1 << 5,
3151 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6,
3152 NL80211_FEATURE_SCAN_FLUSH = 1 << 7,
3153 NL80211_FEATURE_AP_SCAN = 1 << 8,
3154 NL80211_FEATURE_VIF_TXPOWER = 1 << 9,
3155 NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10,
3156 NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11,
3157 NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12,
3038}; 3158};
3039 3159
3040/** 3160/**
@@ -3069,4 +3189,25 @@ enum nl80211_connect_failed_reason {
3069 NL80211_CONN_FAIL_BLOCKED_CLIENT, 3189 NL80211_CONN_FAIL_BLOCKED_CLIENT,
3070}; 3190};
3071 3191
3192/**
3193 * enum nl80211_scan_flags - scan request control flags
3194 *
3195 * Scan request control flags are used to control the handling
3196 * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
3197 * requests.
3198 *
3199 * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
3200 * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
3201 * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured
3202 * as AP and the beaconing has already been configured. This attribute is
3203 * dangerous because will destroy stations performance as a lot of frames
3204 * will be lost while scanning off-channel, therefore it must be used only
3205 * when really needed
3206 */
3207enum nl80211_scan_flags {
3208 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
3209 NL80211_SCAN_FLAG_FLUSH = 1<<1,
3210 NL80211_SCAN_FLAG_AP = 1<<2,
3211};
3212
3072#endif /* __LINUX_NL80211_H */ 3213#endif /* __LINUX_NL80211_H */
diff --git a/include/uapi/linux/oom.h b/include/uapi/linux/oom.h
index a49c4afc7060..b29272d621ce 100644
--- a/include/uapi/linux/oom.h
+++ b/include/uapi/linux/oom.h
@@ -8,4 +8,13 @@
8#define OOM_SCORE_ADJ_MIN (-1000) 8#define OOM_SCORE_ADJ_MIN (-1000)
9#define OOM_SCORE_ADJ_MAX 1000 9#define OOM_SCORE_ADJ_MAX 1000
10 10
11/*
12 * /proc/<pid>/oom_adj set to -17 protects from the oom killer for legacy
13 * purposes.
14 */
15#define OOM_DISABLE (-17)
16/* inclusive */
17#define OOM_ADJUST_MIN (-16)
18#define OOM_ADJUST_MAX 15
19
11#endif /* _UAPI__INCLUDE_LINUX_OOM_H */ 20#endif /* _UAPI__INCLUDE_LINUX_OOM_H */
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 20ae747ddf34..ebfadc56d1b4 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -349,7 +349,7 @@
349#define PCI_AF_STATUS_TP 0x01 349#define PCI_AF_STATUS_TP 0x01
350#define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ 350#define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */
351 351
352/* PCI-X registers */ 352/* PCI-X registers (Type 0 (non-bridge) devices) */
353 353
354#define PCI_X_CMD 2 /* Modes & Features */ 354#define PCI_X_CMD 2 /* Modes & Features */
355#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ 355#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */
@@ -389,6 +389,19 @@
389#define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ 389#define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */
390#define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ 390#define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */
391 391
392/* PCI-X registers (Type 1 (bridge) devices) */
393
394#define PCI_X_BRIDGE_SSTATUS 2 /* Secondary Status */
395#define PCI_X_SSTATUS_64BIT 0x0001 /* Secondary AD interface is 64 bits */
396#define PCI_X_SSTATUS_133MHZ 0x0002 /* 133 MHz capable */
397#define PCI_X_SSTATUS_FREQ 0x03c0 /* Secondary Bus Mode and Frequency */
398#define PCI_X_SSTATUS_VERS 0x3000 /* PCI-X Capability Version */
399#define PCI_X_SSTATUS_V1 0x1000 /* Mode 2, not Mode 1 */
400#define PCI_X_SSTATUS_V2 0x2000 /* Mode 1 or Modes 1 and 2 */
401#define PCI_X_SSTATUS_266MHZ 0x4000 /* 266 MHz capable */
402#define PCI_X_SSTATUS_533MHZ 0x8000 /* 533 MHz capable */
403#define PCI_X_BRIDGE_STATUS 4 /* Bridge Status */
404
392/* PCI Bridge Subsystem ID registers */ 405/* PCI Bridge Subsystem ID registers */
393 406
394#define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */ 407#define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */
@@ -445,6 +458,8 @@
445#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 458#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
446#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 459#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
447#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ 460#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
461#define PCI_EXP_LNKCAP_SLS_2_5GB 0x1 /* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */
462#define PCI_EXP_LNKCAP_SLS_5_0GB 0x2 /* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */
448#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ 463#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
449#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ 464#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
450#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ 465#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
@@ -456,6 +471,8 @@
456#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */ 471#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */
457#define PCI_EXP_LNKCTL 16 /* Link Control */ 472#define PCI_EXP_LNKCTL 16 /* Link Control */
458#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */ 473#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */
474#define PCI_EXP_LNKCTL_ASPM_L0S 0x01 /* L0s Enable */
475#define PCI_EXP_LNKCTL_ASPM_L1 0x02 /* L1 Enable */
459#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */ 476#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */
460#define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */ 477#define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */
461#define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */ 478#define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */
@@ -544,9 +561,9 @@
544#define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ 561#define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */
545#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints end here */ 562#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints end here */
546#define PCI_EXP_LNKCAP2 44 /* Link Capability 2 */ 563#define PCI_EXP_LNKCAP2 44 /* Link Capability 2 */
547#define PCI_EXP_LNKCAP2_SLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */ 564#define PCI_EXP_LNKCAP2_SLS_2_5GB 0x02 /* Supported Link Speed 2.5GT/s */
548#define PCI_EXP_LNKCAP2_SLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */ 565#define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */
549#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x04 /* Current Link Speed 8.0GT/s */ 566#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */
550#define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */ 567#define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */
551#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ 568#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
552#define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ 569#define PCI_EXP_LNKSTA2 50 /* Link Status 2 */
diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
index 94e981f810a2..b65c834f83e9 100644
--- a/include/uapi/linux/ptp_clock.h
+++ b/include/uapi/linux/ptp_clock.h
@@ -67,12 +67,26 @@ struct ptp_perout_request {
67 unsigned int rsv[4]; /* Reserved for future use. */ 67 unsigned int rsv[4]; /* Reserved for future use. */
68}; 68};
69 69
70#define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */
71
72struct ptp_sys_offset {
73 unsigned int n_samples; /* Desired number of measurements. */
74 unsigned int rsv[3]; /* Reserved for future use. */
75 /*
76 * Array of interleaved system/phc time stamps. The kernel
77 * will provide 2*n_samples + 1 time stamps, with the last
78 * one as a system time stamp.
79 */
80 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
81};
82
70#define PTP_CLK_MAGIC '=' 83#define PTP_CLK_MAGIC '='
71 84
72#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) 85#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
73#define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request) 86#define PTP_EXTTS_REQUEST _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request)
74#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) 87#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
75#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) 88#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int)
89#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)
76 90
77struct ptp_extts_event { 91struct ptp_extts_event {
78 struct ptp_clock_time t; /* Time event occured. */ 92 struct ptp_clock_time t; /* Time event occured. */
diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
index 1ef6c056a9e4..022ab186a812 100644
--- a/include/uapi/linux/ptrace.h
+++ b/include/uapi/linux/ptrace.h
@@ -73,7 +73,10 @@
73#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) 73#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
74#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP) 74#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
75 75
76#define PTRACE_O_MASK 0x000000ff 76/* eventless options */
77#define PTRACE_O_EXITKILL (1 << 20)
78
79#define PTRACE_O_MASK (0x000000ff | PTRACE_O_EXITKILL)
77 80
78#include <asm/ptrace.h> 81#include <asm/ptrace.h>
79 82
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index fcd768b09f6e..7a5eb196ade9 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -120,6 +120,18 @@ enum {
120 RTM_SETDCB, 120 RTM_SETDCB,
121#define RTM_SETDCB RTM_SETDCB 121#define RTM_SETDCB RTM_SETDCB
122 122
123 RTM_NEWNETCONF = 80,
124#define RTM_NEWNETCONF RTM_NEWNETCONF
125 RTM_GETNETCONF = 82,
126#define RTM_GETNETCONF RTM_GETNETCONF
127
128 RTM_NEWMDB = 84,
129#define RTM_NEWMDB RTM_NEWMDB
130 RTM_DELMDB = 85,
131#define RTM_DELMDB RTM_DELMDB
132 RTM_GETMDB = 86,
133#define RTM_GETMDB RTM_GETMDB
134
123 __RTM_MAX, 135 __RTM_MAX,
124#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 136#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
125}; 137};
@@ -222,6 +234,7 @@ enum {
222#define RTPROT_XORP 14 /* XORP */ 234#define RTPROT_XORP 14 /* XORP */
223#define RTPROT_NTK 15 /* Netsukuku */ 235#define RTPROT_NTK 15 /* Netsukuku */
224#define RTPROT_DHCP 16 /* DHCP client */ 236#define RTPROT_DHCP 16 /* DHCP client */
237#define RTPROT_MROUTED 17 /* Multicast daemon */
225 238
226/* rtm_scope 239/* rtm_scope
227 240
@@ -283,6 +296,7 @@ enum rtattr_type_t {
283 RTA_MP_ALGO, /* no longer used */ 296 RTA_MP_ALGO, /* no longer used */
284 RTA_TABLE, 297 RTA_TABLE,
285 RTA_MARK, 298 RTA_MARK,
299 RTA_MFC_STATS,
286 __RTA_MAX 300 __RTA_MAX
287}; 301};
288 302
@@ -403,6 +417,12 @@ struct rta_session {
403 } u; 417 } u;
404}; 418};
405 419
420struct rta_mfc_stats {
421 __u64 mfcs_packets;
422 __u64 mfcs_bytes;
423 __u64 mfcs_wrong_if;
424};
425
406/**** 426/****
407 * General form of address family dependent message. 427 * General form of address family dependent message.
408 ****/ 428 ****/
@@ -587,6 +607,12 @@ enum rtnetlink_groups {
587#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE 607#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
588 RTNLGRP_DCB, 608 RTNLGRP_DCB,
589#define RTNLGRP_DCB RTNLGRP_DCB 609#define RTNLGRP_DCB RTNLGRP_DCB
610 RTNLGRP_IPV4_NETCONF,
611#define RTNLGRP_IPV4_NETCONF RTNLGRP_IPV4_NETCONF
612 RTNLGRP_IPV6_NETCONF,
613#define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF
614 RTNLGRP_MDB,
615#define RTNLGRP_MDB RTNLGRP_MDB
590 __RTNLGRP_MAX 616 __RTNLGRP_MAX
591}; 617};
592#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 618#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 7e1ab20adc03..78f99d97475b 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -49,7 +49,8 @@
49#define PORT_XR17D15X 21 /* Exar XR17D15x UART */ 49#define PORT_XR17D15X 21 /* Exar XR17D15x UART */
50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ 50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ 51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_MAX_8250 23 /* max port ID */ 52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
53#define PORT_MAX_8250 24 /* max port ID */
53 54
54/* 55/*
55 * ARM specific type numbers. These are not currently guaranteed 56 * ARM specific type numbers. These are not currently guaranteed
@@ -215,5 +216,7 @@
215/* Energy Micro efm32 SoC */ 216/* Energy Micro efm32 SoC */
216#define PORT_EFMUART 100 217#define PORT_EFMUART 100
217 218
219/* ARC (Synopsys) on-chip UART */
220#define PORT_ARC 101
218 221
219#endif /* _UAPILINUX_SERIAL_CORE_H */ 222#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index 5ed325e88a81..e6322605b138 100644
--- a/include/uapi/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
@@ -367,5 +367,23 @@
367#define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */ 367#define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */
368#define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */ 368#define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */
369 369
370/*
371 * These are definitions for the Exar XR17V35X and XR17(C|D)15X
372 */
373#define UART_EXAR_8XMODE 0x88 /* 8X sampling rate select */
374#define UART_EXAR_SLEEP 0x8b /* Sleep mode */
375#define UART_EXAR_DVID 0x8d /* Device identification */
376
377#define UART_EXAR_FCTR 0x08 /* Feature Control Register */
378#define UART_FCTR_EXAR_IRDA 0x08 /* IrDa data encode select */
379#define UART_FCTR_EXAR_485 0x10 /* Auto 485 half duplex dir ctl */
380#define UART_FCTR_EXAR_TRGA 0x00 /* FIFO trigger table A */
381#define UART_FCTR_EXAR_TRGB 0x60 /* FIFO trigger table B */
382#define UART_FCTR_EXAR_TRGC 0x80 /* FIFO trigger table C */
383#define UART_FCTR_EXAR_TRGD 0xc0 /* FIFO trigger table D programmable */
384
385#define UART_EXAR_TXTRG 0x0a /* Tx FIFO trigger level write-only */
386#define UART_EXAR_RXTRG 0x0b /* Rx FIFO trigger level write-only */
387
370#endif /* _LINUX_SERIAL_REG_H */ 388#endif /* _LINUX_SERIAL_REG_H */
371 389
diff --git a/include/uapi/linux/signal.h b/include/uapi/linux/signal.h
index dff452ed6d00..e1bd50c29ded 100644
--- a/include/uapi/linux/signal.h
+++ b/include/uapi/linux/signal.h
@@ -4,5 +4,7 @@
4#include <asm/signal.h> 4#include <asm/signal.h>
5#include <asm/siginfo.h> 5#include <asm/siginfo.h>
6 6
7#define SS_ONSTACK 1
8#define SS_DISABLE 2
7 9
8#endif /* _UAPI_LINUX_SIGNAL_H */ 10#endif /* _UAPI_LINUX_SIGNAL_H */
diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index e811474724c2..0e011eb91b5d 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -45,7 +45,9 @@
45 45
46static inline __attribute_const__ __u16 __fswab16(__u16 val) 46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{ 47{
48#ifdef __arch_swab16 48#ifdef __HAVE_BUILTIN_BSWAP16__
49 return __builtin_bswap16(val);
50#elif defined (__arch_swab16)
49 return __arch_swab16(val); 51 return __arch_swab16(val);
50#else 52#else
51 return ___constant_swab16(val); 53 return ___constant_swab16(val);
@@ -54,7 +56,9 @@ static inline __attribute_const__ __u16 __fswab16(__u16 val)
54 56
55static inline __attribute_const__ __u32 __fswab32(__u32 val) 57static inline __attribute_const__ __u32 __fswab32(__u32 val)
56{ 58{
57#ifdef __arch_swab32 59#ifdef __HAVE_BUILTIN_BSWAP32__
60 return __builtin_bswap32(val);
61#elif defined(__arch_swab32)
58 return __arch_swab32(val); 62 return __arch_swab32(val);
59#else 63#else
60 return ___constant_swab32(val); 64 return ___constant_swab32(val);
@@ -63,7 +67,9 @@ static inline __attribute_const__ __u32 __fswab32(__u32 val)
63 67
64static inline __attribute_const__ __u64 __fswab64(__u64 val) 68static inline __attribute_const__ __u64 __fswab64(__u64 val)
65{ 69{
66#ifdef __arch_swab64 70#ifdef __HAVE_BUILTIN_BSWAP64__
71 return __builtin_bswap64(val);
72#elif defined (__arch_swab64)
67 return __arch_swab64(val); 73 return __arch_swab64(val);
68#elif defined(__SWAB_64_THRU_32__) 74#elif defined(__SWAB_64_THRU_32__)
69 __u32 h = val >> 32; 75 __u32 h = val >> 32;
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h
index b1d2bf16b33c..b8a24941db21 100644
--- a/include/uapi/linux/unix_diag.h
+++ b/include/uapi/linux/unix_diag.h
@@ -37,6 +37,7 @@ enum {
37 UNIX_DIAG_ICONS, 37 UNIX_DIAG_ICONS,
38 UNIX_DIAG_RQLEN, 38 UNIX_DIAG_RQLEN,
39 UNIX_DIAG_MEMINFO, 39 UNIX_DIAG_MEMINFO,
40 UNIX_DIAG_SHUTDOWN,
40 41
41 UNIX_DIAG_MAX, 42 UNIX_DIAG_MAX,
42}; 43};
diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index 81a927930bfd..f35aa0a338c7 100644
--- a/include/uapi/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
@@ -19,6 +19,7 @@
19#define USB_CDC_SUBCLASS_OBEX 0x0b 19#define USB_CDC_SUBCLASS_OBEX 0x0b
20#define USB_CDC_SUBCLASS_EEM 0x0c 20#define USB_CDC_SUBCLASS_EEM 0x0c
21#define USB_CDC_SUBCLASS_NCM 0x0d 21#define USB_CDC_SUBCLASS_NCM 0x0d
22#define USB_CDC_SUBCLASS_MBIM 0x0e
22 23
23#define USB_CDC_PROTO_NONE 0 24#define USB_CDC_PROTO_NONE 0
24 25
@@ -33,6 +34,7 @@
33#define USB_CDC_PROTO_EEM 7 34#define USB_CDC_PROTO_EEM 7
34 35
35#define USB_CDC_NCM_PROTO_NTB 1 36#define USB_CDC_NCM_PROTO_NTB 1
37#define USB_CDC_MBIM_PROTO_NTB 2
36 38
37/*-------------------------------------------------------------------------*/ 39/*-------------------------------------------------------------------------*/
38 40
@@ -53,6 +55,7 @@
53#define USB_CDC_DMM_TYPE 0x14 55#define USB_CDC_DMM_TYPE 0x14
54#define USB_CDC_OBEX_TYPE 0x15 56#define USB_CDC_OBEX_TYPE 0x15
55#define USB_CDC_NCM_TYPE 0x1a 57#define USB_CDC_NCM_TYPE 0x1a
58#define USB_CDC_MBIM_TYPE 0x1b
56 59
57/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ 60/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
58struct usb_cdc_header_desc { 61struct usb_cdc_header_desc {
@@ -187,6 +190,21 @@ struct usb_cdc_ncm_desc {
187 __le16 bcdNcmVersion; 190 __le16 bcdNcmVersion;
188 __u8 bmNetworkCapabilities; 191 __u8 bmNetworkCapabilities;
189} __attribute__ ((packed)); 192} __attribute__ ((packed));
193
194/* "MBIM Control Model Functional Descriptor" */
195struct usb_cdc_mbim_desc {
196 __u8 bLength;
197 __u8 bDescriptorType;
198 __u8 bDescriptorSubType;
199
200 __le16 bcdMBIMVersion;
201 __le16 wMaxControlMessage;
202 __u8 bNumberFilters;
203 __u8 bMaxFilterSize;
204 __le16 wMaxSegmentSize;
205 __u8 bmNetworkCapabilities;
206} __attribute__ ((packed));
207
190/*-------------------------------------------------------------------------*/ 208/*-------------------------------------------------------------------------*/
191 209
192/* 210/*
@@ -332,6 +350,11 @@ struct usb_cdc_ncm_nth32 {
332#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ 350#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
333#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ 351#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
334 352
353#define USB_CDC_MBIM_NDP16_IPS_SIGN 0x00535049 /* IPS<sessionID> : IPS0 for now */
354#define USB_CDC_MBIM_NDP32_IPS_SIGN 0x00737069 /* ips<sessionID> : ips0 for now */
355#define USB_CDC_MBIM_NDP16_DSS_SIGN 0x00535344 /* DSS<sessionID> */
356#define USB_CDC_MBIM_NDP32_DSS_SIGN 0x00737364 /* dss<sessionID> */
357
335/* 16-bit NCM Datagram Pointer Entry */ 358/* 16-bit NCM Datagram Pointer Entry */
336struct usb_cdc_ncm_dpe16 { 359struct usb_cdc_ncm_dpe16 {
337 __le16 wDatagramIndex; 360 __le16 wDatagramIndex;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 57bfa59cda74..3cf3e946e331 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -186,6 +186,7 @@ enum v4l2_memory {
186 V4L2_MEMORY_MMAP = 1, 186 V4L2_MEMORY_MMAP = 1,
187 V4L2_MEMORY_USERPTR = 2, 187 V4L2_MEMORY_USERPTR = 2,
188 V4L2_MEMORY_OVERLAY = 3, 188 V4L2_MEMORY_OVERLAY = 3,
189 V4L2_MEMORY_DMABUF = 4,
189}; 190};
190 191
191/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ 192/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
@@ -602,6 +603,8 @@ struct v4l2_requestbuffers {
602 * should be passed to mmap() called on the video node) 603 * should be passed to mmap() called on the video node)
603 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer 604 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
604 * pointing to this plane 605 * pointing to this plane
606 * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file
607 * descriptor associated with this plane
605 * @data_offset: offset in the plane to the start of data; usually 0, 608 * @data_offset: offset in the plane to the start of data; usually 0,
606 * unless there is a header in front of the data 609 * unless there is a header in front of the data
607 * 610 *
@@ -616,6 +619,7 @@ struct v4l2_plane {
616 union { 619 union {
617 __u32 mem_offset; 620 __u32 mem_offset;
618 unsigned long userptr; 621 unsigned long userptr;
622 __s32 fd;
619 } m; 623 } m;
620 __u32 data_offset; 624 __u32 data_offset;
621 __u32 reserved[11]; 625 __u32 reserved[11];
@@ -640,6 +644,8 @@ struct v4l2_plane {
640 * (or a "cookie" that should be passed to mmap() as offset) 644 * (or a "cookie" that should be passed to mmap() as offset)
641 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; 645 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
642 * a userspace pointer pointing to this buffer 646 * a userspace pointer pointing to this buffer
647 * @fd: for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF;
648 * a userspace file descriptor associated with this buffer
643 * @planes: for multiplanar buffers; userspace pointer to the array of plane 649 * @planes: for multiplanar buffers; userspace pointer to the array of plane
644 * info structs for this buffer 650 * info structs for this buffer
645 * @length: size in bytes of the buffer (NOT its payload) for single-plane 651 * @length: size in bytes of the buffer (NOT its payload) for single-plane
@@ -666,6 +672,7 @@ struct v4l2_buffer {
666 __u32 offset; 672 __u32 offset;
667 unsigned long userptr; 673 unsigned long userptr;
668 struct v4l2_plane *planes; 674 struct v4l2_plane *planes;
675 __s32 fd;
669 } m; 676 } m;
670 __u32 length; 677 __u32 length;
671 __u32 reserved2; 678 __u32 reserved2;
@@ -687,6 +694,33 @@ struct v4l2_buffer {
687#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 694#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
688#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 695#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
689 696
697/**
698 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
699 *
700 * @index: id number of the buffer
701 * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for
702 * multiplanar buffers);
703 * @plane: index of the plane to be exported, 0 for single plane queues
704 * @flags: flags for newly created file, currently only O_CLOEXEC is
705 * supported, refer to manual of open syscall for more details
706 * @fd: file descriptor associated with DMABUF (set by driver)
707 *
708 * Contains data used for exporting a video buffer as DMABUF file descriptor.
709 * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF
710 * (identical to the cookie used to mmap() the buffer to userspace). All
711 * reserved fields must be set to zero. The field reserved0 is expected to
712 * become a structure 'type' allowing an alternative layout of the structure
713 * content. Therefore this field should not be used for any other extensions.
714 */
715struct v4l2_exportbuffer {
716 __u32 type; /* enum v4l2_buf_type */
717 __u32 index;
718 __u32 plane;
719 __u32 flags;
720 __s32 fd;
721 __u32 reserved[11];
722};
723
690/* 724/*
691 * O V E R L A Y P R E V I E W 725 * O V E R L A Y P R E V I E W
692 */ 726 */
@@ -737,7 +771,7 @@ struct v4l2_window {
737struct v4l2_captureparm { 771struct v4l2_captureparm {
738 __u32 capability; /* Supported modes */ 772 __u32 capability; /* Supported modes */
739 __u32 capturemode; /* Current mode */ 773 __u32 capturemode; /* Current mode */
740 struct v4l2_fract timeperframe; /* Time per frame in .1us units */ 774 struct v4l2_fract timeperframe; /* Time per frame in seconds */
741 __u32 extendedmode; /* Driver-specific extensions */ 775 __u32 extendedmode; /* Driver-specific extensions */
742 __u32 readbuffers; /* # of buffers for read */ 776 __u32 readbuffers; /* # of buffers for read */
743 __u32 reserved[4]; 777 __u32 reserved[4];
@@ -1888,6 +1922,7 @@ struct v4l2_create_buffers {
1888#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) 1922#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
1889#define VIDIOC_OVERLAY _IOW('V', 14, int) 1923#define VIDIOC_OVERLAY _IOW('V', 14, int)
1890#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) 1924#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
1925#define VIDIOC_EXPBUF _IOWR('V', 16, struct v4l2_exportbuffer)
1891#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) 1926#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
1892#define VIDIOC_STREAMON _IOW('V', 18, int) 1927#define VIDIOC_STREAMON _IOW('V', 18, int)
1893#define VIDIOC_STREAMOFF _IOW('V', 19, int) 1928#define VIDIOC_STREAMOFF _IOW('V', 19, int)
diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
index 270fb22c5811..a7630d04029f 100644
--- a/include/uapi/linux/virtio_ids.h
+++ b/include/uapi/linux/virtio_ids.h
@@ -37,5 +37,6 @@
37#define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ 37#define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */
38#define VIRTIO_ID_SCSI 8 /* virtio scsi */ 38#define VIRTIO_ID_SCSI 8 /* virtio scsi */
39#define VIRTIO_ID_9P 9 /* 9p virtio console */ 39#define VIRTIO_ID_9P 9 /* 9p virtio console */
40#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
40 41
41#endif /* _LINUX_VIRTIO_IDS_H */ 42#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 2470f541af50..848e3584d7c8 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -51,6 +51,8 @@
51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ 51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
52#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the 52#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the
53 * network */ 53 * network */
54#define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
55 * Steering */
54 56
55#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 57#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
56#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ 58#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
@@ -60,6 +62,11 @@ struct virtio_net_config {
60 __u8 mac[6]; 62 __u8 mac[6];
61 /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ 63 /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
62 __u16 status; 64 __u16 status;
65 /* Maximum number of each of transmit and receive queues;
66 * see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ.
67 * Legal values are between 1 and 0x8000
68 */
69 __u16 max_virtqueue_pairs;
63} __attribute__((packed)); 70} __attribute__((packed));
64 71
65/* This is the first element of the scatter-gather list. If you don't 72/* This is the first element of the scatter-gather list. If you don't
@@ -166,4 +173,24 @@ struct virtio_net_ctrl_mac {
166#define VIRTIO_NET_CTRL_ANNOUNCE 3 173#define VIRTIO_NET_CTRL_ANNOUNCE 3
167 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0 174 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
168 175
176/*
177 * Control Receive Flow Steering
178 *
179 * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
180 * enables Receive Flow Steering, specifying the number of the transmit and
181 * receive queues that will be used. After the command is consumed and acked by
182 * the device, the device will not steer new packets on receive virtqueues
183 * other than specified nor read from transmit virtqueues other than specified.
184 * Accordingly, driver should not transmit new packets on virtqueues other than
185 * specified.
186 */
187struct virtio_net_ctrl_mq {
188 u16 virtqueue_pairs;
189};
190
191#define VIRTIO_NET_CTRL_MQ 4
192 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
193 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
194 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
195
169#endif /* _LINUX_VIRTIO_NET_H */ 196#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/uapi/rdma/Kbuild b/include/uapi/rdma/Kbuild
index aafaa5aa54d4..687ae332200f 100644
--- a/include/uapi/rdma/Kbuild
+++ b/include/uapi/rdma/Kbuild
@@ -1 +1,7 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ib_user_cm.h
3header-y += ib_user_mad.h
4header-y += ib_user_sa.h
5header-y += ib_user_verbs.h
6header-y += rdma_netlink.h
7header-y += rdma_user_cm.h
diff --git a/include/rdma/ib_user_cm.h b/include/uapi/rdma/ib_user_cm.h
index f79014aa28f9..f79014aa28f9 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/uapi/rdma/ib_user_cm.h
diff --git a/include/rdma/ib_user_mad.h b/include/uapi/rdma/ib_user_mad.h
index d6fce1cbdb90..d6fce1cbdb90 100644
--- a/include/rdma/ib_user_mad.h
+++ b/include/uapi/rdma/ib_user_mad.h
diff --git a/include/rdma/ib_user_sa.h b/include/uapi/rdma/ib_user_sa.h
index cfc7c9ba781e..cfc7c9ba781e 100644
--- a/include/rdma/ib_user_sa.h
+++ b/include/uapi/rdma/ib_user_sa.h
diff --git a/include/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 81aba3a73aa3..81aba3a73aa3 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
new file mode 100644
index 000000000000..8297285b6288
--- /dev/null
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -0,0 +1,37 @@
1#ifndef _UAPI_RDMA_NETLINK_H
2#define _UAPI_RDMA_NETLINK_H
3
4#include <linux/types.h>
5
6enum {
7 RDMA_NL_RDMA_CM = 1
8};
9
10#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
11#define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
12#define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
13
14enum {
15 RDMA_NL_RDMA_CM_ID_STATS = 0,
16 RDMA_NL_RDMA_CM_NUM_OPS
17};
18
19enum {
20 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
21 RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
22 RDMA_NL_RDMA_CM_NUM_ATTR,
23};
24
25struct rdma_cm_id_stats {
26 __u32 qp_num;
27 __u32 bound_dev_if;
28 __u32 port_space;
29 __s32 pid;
30 __u8 cm_state;
31 __u8 node_type;
32 __u8 port_num;
33 __u8 qp_type;
34};
35
36
37#endif /* _UAPI_RDMA_NETLINK_H */
diff --git a/include/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
index 1ee9239ff8c2..1ee9239ff8c2 100644
--- a/include/rdma/rdma_user_cm.h
+++ b/include/uapi/rdma/rdma_user_cm.h
diff --git a/include/uapi/sound/Kbuild b/include/uapi/sound/Kbuild
index aafaa5aa54d4..0f7d279ebde3 100644
--- a/include/uapi/sound/Kbuild
+++ b/include/uapi/sound/Kbuild
@@ -1 +1,11 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += asequencer.h
3header-y += asound.h
4header-y += asound_fm.h
5header-y += compress_offload.h
6header-y += compress_params.h
7header-y += emu10k1.h
8header-y += hdsp.h
9header-y += hdspm.h
10header-y += sb16_csp.h
11header-y += sfnt_info.h
diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
new file mode 100644
index 000000000000..09c8a00ea503
--- /dev/null
+++ b/include/uapi/sound/asequencer.h
@@ -0,0 +1,614 @@
1/*
2 * Main header file for the ALSA sequencer
3 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
4 * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef _UAPI__SOUND_ASEQUENCER_H
23#define _UAPI__SOUND_ASEQUENCER_H
24
25
26/** version of the sequencer */
27#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
28
29/**
30 * definition of sequencer event types
31 */
32
33/** system messages
34 * event data type = #snd_seq_result
35 */
36#define SNDRV_SEQ_EVENT_SYSTEM 0
37#define SNDRV_SEQ_EVENT_RESULT 1
38
39/** note messages (channel specific)
40 * event data type = #snd_seq_ev_note
41 */
42#define SNDRV_SEQ_EVENT_NOTE 5
43#define SNDRV_SEQ_EVENT_NOTEON 6
44#define SNDRV_SEQ_EVENT_NOTEOFF 7
45#define SNDRV_SEQ_EVENT_KEYPRESS 8
46
47/** control messages (channel specific)
48 * event data type = #snd_seq_ev_ctrl
49 */
50#define SNDRV_SEQ_EVENT_CONTROLLER 10
51#define SNDRV_SEQ_EVENT_PGMCHANGE 11
52#define SNDRV_SEQ_EVENT_CHANPRESS 12
53#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
54#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
55#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
56#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
57
58/** synchronisation messages
59 * event data type = #snd_seq_ev_ctrl
60 */
61#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
62#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
63#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
64#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
65#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
66
67/** timer messages
68 * event data type = snd_seq_ev_queue_control
69 */
70#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
71#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
72#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
73#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
74#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
75#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
76#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
77#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
78#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
79
80/** others
81 * event data type = none
82 */
83#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
84#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
85#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
86
87/** echo back, kernel private messages
88 * event data type = any type
89 */
90#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
91#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
92
93/** system status messages (broadcast for subscribers)
94 * event data type = snd_seq_addr
95 */
96#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
97#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
98#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
99#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
100#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
101#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
102
103/** port connection changes
104 * event data type = snd_seq_connect
105 */
106#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
107#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
108
109/* 70-89: synthesizer events - obsoleted */
110
111/** user-defined events with fixed length
112 * event data type = any
113 */
114#define SNDRV_SEQ_EVENT_USR0 90
115#define SNDRV_SEQ_EVENT_USR1 91
116#define SNDRV_SEQ_EVENT_USR2 92
117#define SNDRV_SEQ_EVENT_USR3 93
118#define SNDRV_SEQ_EVENT_USR4 94
119#define SNDRV_SEQ_EVENT_USR5 95
120#define SNDRV_SEQ_EVENT_USR6 96
121#define SNDRV_SEQ_EVENT_USR7 97
122#define SNDRV_SEQ_EVENT_USR8 98
123#define SNDRV_SEQ_EVENT_USR9 99
124
125/* 100-118: instrument layer - obsoleted */
126/* 119-129: reserved */
127
128/* 130-139: variable length events
129 * event data type = snd_seq_ev_ext
130 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
131 */
132#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
133#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
134/* 132-134: reserved */
135#define SNDRV_SEQ_EVENT_USR_VAR0 135
136#define SNDRV_SEQ_EVENT_USR_VAR1 136
137#define SNDRV_SEQ_EVENT_USR_VAR2 137
138#define SNDRV_SEQ_EVENT_USR_VAR3 138
139#define SNDRV_SEQ_EVENT_USR_VAR4 139
140
141/* 150-151: kernel events with quote - DO NOT use in user clients */
142#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
143#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
144
145/* 152-191: reserved */
146
147/* 192-254: hardware specific events */
148
149/* 255: special event */
150#define SNDRV_SEQ_EVENT_NONE 255
151
152
153typedef unsigned char snd_seq_event_type_t;
154
155/** event address */
156struct snd_seq_addr {
157 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
158 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
159};
160
161/** port connection */
162struct snd_seq_connect {
163 struct snd_seq_addr sender;
164 struct snd_seq_addr dest;
165};
166
167
168#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
169#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
170#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
171#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
172
173 /* event mode flag - NOTE: only 8 bits available! */
174#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
175#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
176#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
177
178#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
179#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
180#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
181
182#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
183#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
184#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
185#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
186
187#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
188#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
189#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
190
191
192 /* note event */
193struct snd_seq_ev_note {
194 unsigned char channel;
195 unsigned char note;
196 unsigned char velocity;
197 unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
198 unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
199};
200
201 /* controller event */
202struct snd_seq_ev_ctrl {
203 unsigned char channel;
204 unsigned char unused1, unused2, unused3; /* pad */
205 unsigned int param;
206 signed int value;
207};
208
209 /* generic set of bytes (12x8 bit) */
210struct snd_seq_ev_raw8 {
211 unsigned char d[12]; /* 8 bit value */
212};
213
214 /* generic set of integers (3x32 bit) */
215struct snd_seq_ev_raw32 {
216 unsigned int d[3]; /* 32 bit value */
217};
218
219 /* external stored data */
220struct snd_seq_ev_ext {
221 unsigned int len; /* length of data */
222 void *ptr; /* pointer to data (note: maybe 64-bit) */
223} __attribute__((packed));
224
225struct snd_seq_result {
226 int event; /* processed event type */
227 int result;
228};
229
230
231struct snd_seq_real_time {
232 unsigned int tv_sec; /* seconds */
233 unsigned int tv_nsec; /* nanoseconds */
234};
235
236typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
237
238union snd_seq_timestamp {
239 snd_seq_tick_time_t tick;
240 struct snd_seq_real_time time;
241};
242
243struct snd_seq_queue_skew {
244 unsigned int value;
245 unsigned int base;
246};
247
248 /* queue timer control */
249struct snd_seq_ev_queue_control {
250 unsigned char queue; /* affected queue */
251 unsigned char pad[3]; /* reserved */
252 union {
253 signed int value; /* affected value (e.g. tempo) */
254 union snd_seq_timestamp time; /* time */
255 unsigned int position; /* sync position */
256 struct snd_seq_queue_skew skew;
257 unsigned int d32[2];
258 unsigned char d8[8];
259 } param;
260};
261
262 /* quoted event - inside the kernel only */
263struct snd_seq_ev_quote {
264 struct snd_seq_addr origin; /* original sender */
265 unsigned short value; /* optional data */
266 struct snd_seq_event *event; /* quoted event */
267} __attribute__((packed));
268
269
270 /* sequencer event */
271struct snd_seq_event {
272 snd_seq_event_type_t type; /* event type */
273 unsigned char flags; /* event flags */
274 char tag;
275
276 unsigned char queue; /* schedule queue */
277 union snd_seq_timestamp time; /* schedule time */
278
279
280 struct snd_seq_addr source; /* source address */
281 struct snd_seq_addr dest; /* destination address */
282
283 union { /* event data... */
284 struct snd_seq_ev_note note;
285 struct snd_seq_ev_ctrl control;
286 struct snd_seq_ev_raw8 raw8;
287 struct snd_seq_ev_raw32 raw32;
288 struct snd_seq_ev_ext ext;
289 struct snd_seq_ev_queue_control queue;
290 union snd_seq_timestamp time;
291 struct snd_seq_addr addr;
292 struct snd_seq_connect connect;
293 struct snd_seq_result result;
294 struct snd_seq_ev_quote quote;
295 } data;
296};
297
298
299/*
300 * bounce event - stored as variable size data
301 */
302struct snd_seq_event_bounce {
303 int err;
304 struct snd_seq_event event;
305 /* external data follows here. */
306};
307
308
309 /* system information */
310struct snd_seq_system_info {
311 int queues; /* maximum queues count */
312 int clients; /* maximum clients count */
313 int ports; /* maximum ports per client */
314 int channels; /* maximum channels per port */
315 int cur_clients; /* current clients */
316 int cur_queues; /* current queues */
317 char reserved[24];
318};
319
320
321 /* system running information */
322struct snd_seq_running_info {
323 unsigned char client; /* client id */
324 unsigned char big_endian; /* 1 = big-endian */
325 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
326 unsigned char pad; /* reserved */
327 unsigned char reserved[12];
328};
329
330
331 /* known client numbers */
332#define SNDRV_SEQ_CLIENT_SYSTEM 0
333 /* internal client numbers */
334#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
335#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
336
337
338 /* client types */
339typedef int __bitwise snd_seq_client_type_t;
340#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
341#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
342#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
343
344 /* event filter flags */
345#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
346#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
347#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
348#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
349
350struct snd_seq_client_info {
351 int client; /* client number to inquire */
352 snd_seq_client_type_t type; /* client type */
353 char name[64]; /* client name */
354 unsigned int filter; /* filter flags */
355 unsigned char multicast_filter[8]; /* multicast filter bitmap */
356 unsigned char event_filter[32]; /* event filter bitmap */
357 int num_ports; /* RO: number of ports */
358 int event_lost; /* number of lost events */
359 char reserved[64]; /* for future use */
360};
361
362
363/* client pool size */
364struct snd_seq_client_pool {
365 int client; /* client number to inquire */
366 int output_pool; /* outgoing (write) pool size */
367 int input_pool; /* incoming (read) pool size */
368 int output_room; /* minimum free pool size for select/blocking mode */
369 int output_free; /* unused size */
370 int input_free; /* unused size */
371 char reserved[64];
372};
373
374
375/* Remove events by specified criteria */
376
377#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
378#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
379#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
380#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
381#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
382#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
383#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
384#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
385#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
386#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
387
388struct snd_seq_remove_events {
389 unsigned int remove_mode; /* Flags that determine what gets removed */
390
391 union snd_seq_timestamp time;
392
393 unsigned char queue; /* Queue for REMOVE_DEST */
394 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
395 unsigned char channel; /* Channel for REMOVE_DEST */
396
397 int type; /* For REMOVE_EVENT_TYPE */
398 char tag; /* Tag for REMOVE_TAG */
399
400 int reserved[10]; /* To allow for future binary compatibility */
401
402};
403
404
405 /* known port numbers */
406#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
407#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
408
409 /* port capabilities (32 bits) */
410#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
411#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
412
413#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
414#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
415
416#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
417
418#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
419#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
420#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
421
422 /* port type */
423#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
424#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
425#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
426#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
427#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
428#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
429#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
430
431/* other standards...*/
432#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
433#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
434#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
435/*...*/
436#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
437#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
438#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
439#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
440#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
441
442/* misc. conditioning flags */
443#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
444#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
445#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
446
447struct snd_seq_port_info {
448 struct snd_seq_addr addr; /* client/port numbers */
449 char name[64]; /* port name */
450
451 unsigned int capability; /* port capability bits */
452 unsigned int type; /* port type bits */
453 int midi_channels; /* channels per MIDI port */
454 int midi_voices; /* voices per MIDI port */
455 int synth_voices; /* voices per SYNTH port */
456
457 int read_use; /* R/O: subscribers for output (from this port) */
458 int write_use; /* R/O: subscribers for input (to this port) */
459
460 void *kernel; /* reserved for kernel use (must be NULL) */
461 unsigned int flags; /* misc. conditioning */
462 unsigned char time_queue; /* queue # for timestamping */
463 char reserved[59]; /* for future use */
464};
465
466
467/* queue flags */
468#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
469
470/* queue information */
471struct snd_seq_queue_info {
472 int queue; /* queue id */
473
474 /*
475 * security settings, only owner of this queue can start/stop timer
476 * etc. if the queue is locked for other clients
477 */
478 int owner; /* client id for owner of the queue */
479 unsigned locked:1; /* timing queue locked for other queues */
480 char name[64]; /* name of this queue */
481 unsigned int flags; /* flags */
482 char reserved[60]; /* for future use */
483
484};
485
486/* queue info/status */
487struct snd_seq_queue_status {
488 int queue; /* queue id */
489 int events; /* read-only - queue size */
490 snd_seq_tick_time_t tick; /* current tick */
491 struct snd_seq_real_time time; /* current time */
492 int running; /* running state of queue */
493 int flags; /* various flags */
494 char reserved[64]; /* for the future */
495};
496
497
498/* queue tempo */
499struct snd_seq_queue_tempo {
500 int queue; /* sequencer queue */
501 unsigned int tempo; /* current tempo, us/tick */
502 int ppq; /* time resolution, ticks/quarter */
503 unsigned int skew_value; /* queue skew */
504 unsigned int skew_base; /* queue skew base */
505 char reserved[24]; /* for the future */
506};
507
508
509/* sequencer timer sources */
510#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
511#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
512#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
513
514/* queue timer info */
515struct snd_seq_queue_timer {
516 int queue; /* sequencer queue */
517 int type; /* source timer type */
518 union {
519 struct {
520 struct snd_timer_id id; /* ALSA's timer ID */
521 unsigned int resolution; /* resolution in Hz */
522 } alsa;
523 } u;
524 char reserved[64]; /* for the future use */
525};
526
527
528struct snd_seq_queue_client {
529 int queue; /* sequencer queue */
530 int client; /* sequencer client */
531 int used; /* queue is used with this client
532 (must be set for accepting events) */
533 /* per client watermarks */
534 char reserved[64]; /* for future use */
535};
536
537
538#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
539#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
540#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
541
542struct snd_seq_port_subscribe {
543 struct snd_seq_addr sender; /* sender address */
544 struct snd_seq_addr dest; /* destination address */
545 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
546 unsigned int flags; /* modes */
547 unsigned char queue; /* input time-stamp queue (optional) */
548 unsigned char pad[3]; /* reserved */
549 char reserved[64];
550};
551
552/* type of query subscription */
553#define SNDRV_SEQ_QUERY_SUBS_READ 0
554#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
555
556struct snd_seq_query_subs {
557 struct snd_seq_addr root; /* client/port id to be searched */
558 int type; /* READ or WRITE */
559 int index; /* 0..N-1 */
560 int num_subs; /* R/O: number of subscriptions on this port */
561 struct snd_seq_addr addr; /* R/O: result */
562 unsigned char queue; /* R/O: result */
563 unsigned int flags; /* R/O: result */
564 char reserved[64]; /* for future use */
565};
566
567
568/*
569 * IOCTL commands
570 */
571
572#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
573#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
574#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
575#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
576
577#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
578#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
579
580#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
581#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
582#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
583#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
584
585#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
586#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
587
588#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
589#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
590#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
591#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
592#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
593#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
594#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
595#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
596#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
597#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
598#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
599#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
600/* XXX
601#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
602#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
603*/
604#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
605#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
606#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
607#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
608#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
609#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
610#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
611#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
612#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
613
614#endif /* _UAPI__SOUND_ASEQUENCER_H */
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
new file mode 100644
index 000000000000..1774a5c3ef10
--- /dev/null
+++ b/include/uapi/sound/asound.h
@@ -0,0 +1,971 @@
1/*
2 * Advanced Linux Sound Architecture - ALSA - Driver
3 * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
4 * Abramo Bagnara <abramo@alsa-project.org>
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef _UAPI__SOUND_ASOUND_H
24#define _UAPI__SOUND_ASOUND_H
25
26#include <linux/types.h>
27
28
29/*
30 * protocol version
31 */
32
33#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
34#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
35#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
36#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
37#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
38 (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
39 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
40 SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
41
42/****************************************************************************
43 * *
44 * Digital audio interface *
45 * *
46 ****************************************************************************/
47
48struct snd_aes_iec958 {
49 unsigned char status[24]; /* AES/IEC958 channel status bits */
50 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
51 unsigned char pad; /* nothing */
52 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
53};
54
55/****************************************************************************
56 * *
57 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
58 * *
59 ****************************************************************************/
60
61struct snd_cea_861_aud_if {
62 unsigned char db1_ct_cc; /* coding type and channel count */
63 unsigned char db2_sf_ss; /* sample frequency and size */
64 unsigned char db3; /* not used, all zeros */
65 unsigned char db4_ca; /* channel allocation code */
66 unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
67};
68
69/****************************************************************************
70 * *
71 * Section for driver hardware dependent interface - /dev/snd/hw? *
72 * *
73 ****************************************************************************/
74
75#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
76
77enum {
78 SNDRV_HWDEP_IFACE_OPL2 = 0,
79 SNDRV_HWDEP_IFACE_OPL3,
80 SNDRV_HWDEP_IFACE_OPL4,
81 SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
82 SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
83 SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
84 SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
85 SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
86 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
87 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
88 SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
89 SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
90 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
91 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
92 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
93 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
94 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
95 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
96
97 /* Don't forget to change the following: */
98 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
99};
100
101struct snd_hwdep_info {
102 unsigned int device; /* WR: device number */
103 int card; /* R: card number */
104 unsigned char id[64]; /* ID (user selectable) */
105 unsigned char name[80]; /* hwdep name */
106 int iface; /* hwdep interface */
107 unsigned char reserved[64]; /* reserved for future */
108};
109
110/* generic DSP loader */
111struct snd_hwdep_dsp_status {
112 unsigned int version; /* R: driver-specific version */
113 unsigned char id[32]; /* R: driver-specific ID string */
114 unsigned int num_dsps; /* R: number of DSP images to transfer */
115 unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */
116 unsigned int chip_ready; /* R: 1 = initialization finished */
117 unsigned char reserved[16]; /* reserved for future use */
118};
119
120struct snd_hwdep_dsp_image {
121 unsigned int index; /* W: DSP index */
122 unsigned char name[64]; /* W: ID (e.g. file name) */
123 unsigned char __user *image; /* W: binary image */
124 size_t length; /* W: size of image in bytes */
125 unsigned long driver_data; /* W: driver-specific data */
126};
127
128#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
129#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
130#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
131#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
132
133/*****************************************************************************
134 * *
135 * Digital Audio (PCM) interface - /dev/snd/pcm?? *
136 * *
137 *****************************************************************************/
138
139#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 11)
140
141typedef unsigned long snd_pcm_uframes_t;
142typedef signed long snd_pcm_sframes_t;
143
144enum {
145 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
146 SNDRV_PCM_CLASS_MULTI, /* multichannel device */
147 SNDRV_PCM_CLASS_MODEM, /* software modem class */
148 SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
149 /* Don't forget to change the following: */
150 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
151};
152
153enum {
154 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
155 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
156 /* Don't forget to change the following: */
157 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
158};
159
160enum {
161 SNDRV_PCM_STREAM_PLAYBACK = 0,
162 SNDRV_PCM_STREAM_CAPTURE,
163 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
164};
165
166typedef int __bitwise snd_pcm_access_t;
167#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
168#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
169#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
170#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
171#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
172#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
173
174typedef int __bitwise snd_pcm_format_t;
175#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
176#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
177#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
178#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
179#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
180#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
181#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
182#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
183#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
184#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
185#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
186#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
187#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
188#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
189#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
190#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
191#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
192#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
193#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
194#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
195#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
196#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
197#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
198#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
199#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
200#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
201#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
202#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
203#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
204#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
205#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
206#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
207#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
208#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
209#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
210#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
211#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
212#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
213#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
214#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
215#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
216#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
217#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B
218
219#ifdef SNDRV_LITTLE_ENDIAN
220#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
221#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
222#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
223#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
224#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
225#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
226#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
227#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
228#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
229#endif
230#ifdef SNDRV_BIG_ENDIAN
231#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
232#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
233#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
234#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
235#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
236#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
237#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
238#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
239#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
240#endif
241
242typedef int __bitwise snd_pcm_subformat_t;
243#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
244#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
245
246#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
247#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
248#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
249#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
250#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
251#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
252#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
253#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
254#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
255#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
256#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
257#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
258#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
259#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
260#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
261#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* has audio wall clock for audio/system time sync */
262#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
263
264typedef int __bitwise snd_pcm_state_t;
265#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
266#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
267#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
268#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
269#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
270#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
271#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
272#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
273#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
274#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
275
276enum {
277 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
278 SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
279 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
280};
281
282union snd_pcm_sync_id {
283 unsigned char id[16];
284 unsigned short id16[8];
285 unsigned int id32[4];
286};
287
288struct snd_pcm_info {
289 unsigned int device; /* RO/WR (control): device number */
290 unsigned int subdevice; /* RO/WR (control): subdevice number */
291 int stream; /* RO/WR (control): stream direction */
292 int card; /* R: card number */
293 unsigned char id[64]; /* ID (user selectable) */
294 unsigned char name[80]; /* name of this device */
295 unsigned char subname[32]; /* subdevice name */
296 int dev_class; /* SNDRV_PCM_CLASS_* */
297 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
298 unsigned int subdevices_count;
299 unsigned int subdevices_avail;
300 union snd_pcm_sync_id sync; /* hardware synchronization ID */
301 unsigned char reserved[64]; /* reserved for future... */
302};
303
304typedef int snd_pcm_hw_param_t;
305#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
306#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
307#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
308#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
309#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
310
311#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
312#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
313#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
314#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
315#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
316 * interrupts in us
317 */
318#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
319 * interrupts
320 */
321#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
322 * interrupts
323 */
324#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
325 * buffer
326 */
327#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
328 * in us
329 */
330#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
331#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
332#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
333#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
334#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
335
336#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
337#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
338#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
339
340struct snd_interval {
341 unsigned int min, max;
342 unsigned int openmin:1,
343 openmax:1,
344 integer:1,
345 empty:1;
346};
347
348#define SNDRV_MASK_MAX 256
349
350struct snd_mask {
351 __u32 bits[(SNDRV_MASK_MAX+31)/32];
352};
353
354struct snd_pcm_hw_params {
355 unsigned int flags;
356 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
357 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
358 struct snd_mask mres[5]; /* reserved masks */
359 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
360 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
361 struct snd_interval ires[9]; /* reserved intervals */
362 unsigned int rmask; /* W: requested masks */
363 unsigned int cmask; /* R: changed masks */
364 unsigned int info; /* R: Info flags for returned setup */
365 unsigned int msbits; /* R: used most significant bits */
366 unsigned int rate_num; /* R: rate numerator */
367 unsigned int rate_den; /* R: rate denominator */
368 snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
369 unsigned char reserved[64]; /* reserved for future */
370};
371
372enum {
373 SNDRV_PCM_TSTAMP_NONE = 0,
374 SNDRV_PCM_TSTAMP_ENABLE,
375 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
376};
377
378struct snd_pcm_sw_params {
379 int tstamp_mode; /* timestamp mode */
380 unsigned int period_step;
381 unsigned int sleep_min; /* min ticks to sleep */
382 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
383 snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
384 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
385 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
386 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
387 snd_pcm_uframes_t silence_size; /* silence block size */
388 snd_pcm_uframes_t boundary; /* pointers wrap point */
389 unsigned char reserved[64]; /* reserved for future */
390};
391
392struct snd_pcm_channel_info {
393 unsigned int channel;
394 __kernel_off_t offset; /* mmap offset */
395 unsigned int first; /* offset to first sample in bits */
396 unsigned int step; /* samples distance in bits */
397};
398
399struct snd_pcm_status {
400 snd_pcm_state_t state; /* stream state */
401 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
402 struct timespec tstamp; /* reference timestamp */
403 snd_pcm_uframes_t appl_ptr; /* appl ptr */
404 snd_pcm_uframes_t hw_ptr; /* hw ptr */
405 snd_pcm_sframes_t delay; /* current delay in frames */
406 snd_pcm_uframes_t avail; /* number of frames available */
407 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
408 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
409 snd_pcm_state_t suspended_state; /* suspended stream state */
410 __u32 reserved_alignment; /* must be filled with zero */
411 struct timespec audio_tstamp; /* from sample counter or wall clock */
412 unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */
413};
414
415struct snd_pcm_mmap_status {
416 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
417 int pad1; /* Needed for 64 bit alignment */
418 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
419 struct timespec tstamp; /* Timestamp */
420 snd_pcm_state_t suspended_state; /* RO: suspended stream state */
421 struct timespec audio_tstamp; /* from sample counter or wall clock */
422};
423
424struct snd_pcm_mmap_control {
425 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
426 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
427};
428
429#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
430#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
431#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
432
433struct snd_pcm_sync_ptr {
434 unsigned int flags;
435 union {
436 struct snd_pcm_mmap_status status;
437 unsigned char reserved[64];
438 } s;
439 union {
440 struct snd_pcm_mmap_control control;
441 unsigned char reserved[64];
442 } c;
443};
444
445struct snd_xferi {
446 snd_pcm_sframes_t result;
447 void __user *buf;
448 snd_pcm_uframes_t frames;
449};
450
451struct snd_xfern {
452 snd_pcm_sframes_t result;
453 void __user * __user *bufs;
454 snd_pcm_uframes_t frames;
455};
456
457enum {
458 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
459 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
460 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
461};
462
463/* channel positions */
464enum {
465 SNDRV_CHMAP_UNKNOWN = 0,
466 SNDRV_CHMAP_NA, /* N/A, silent */
467 SNDRV_CHMAP_MONO, /* mono stream */
468 /* this follows the alsa-lib mixer channel value + 3 */
469 SNDRV_CHMAP_FL, /* front left */
470 SNDRV_CHMAP_FR, /* front right */
471 SNDRV_CHMAP_RL, /* rear left */
472 SNDRV_CHMAP_RR, /* rear right */
473 SNDRV_CHMAP_FC, /* front center */
474 SNDRV_CHMAP_LFE, /* LFE */
475 SNDRV_CHMAP_SL, /* side left */
476 SNDRV_CHMAP_SR, /* side right */
477 SNDRV_CHMAP_RC, /* rear center */
478 /* new definitions */
479 SNDRV_CHMAP_FLC, /* front left center */
480 SNDRV_CHMAP_FRC, /* front right center */
481 SNDRV_CHMAP_RLC, /* rear left center */
482 SNDRV_CHMAP_RRC, /* rear right center */
483 SNDRV_CHMAP_FLW, /* front left wide */
484 SNDRV_CHMAP_FRW, /* front right wide */
485 SNDRV_CHMAP_FLH, /* front left high */
486 SNDRV_CHMAP_FCH, /* front center high */
487 SNDRV_CHMAP_FRH, /* front right high */
488 SNDRV_CHMAP_TC, /* top center */
489 SNDRV_CHMAP_TFL, /* top front left */
490 SNDRV_CHMAP_TFR, /* top front right */
491 SNDRV_CHMAP_TFC, /* top front center */
492 SNDRV_CHMAP_TRL, /* top rear left */
493 SNDRV_CHMAP_TRR, /* top rear right */
494 SNDRV_CHMAP_TRC, /* top rear center */
495 /* new definitions for UAC2 */
496 SNDRV_CHMAP_TFLC, /* top front left center */
497 SNDRV_CHMAP_TFRC, /* top front right center */
498 SNDRV_CHMAP_TSL, /* top side left */
499 SNDRV_CHMAP_TSR, /* top side right */
500 SNDRV_CHMAP_LLFE, /* left LFE */
501 SNDRV_CHMAP_RLFE, /* right LFE */
502 SNDRV_CHMAP_BC, /* bottom center */
503 SNDRV_CHMAP_BLC, /* bottom left center */
504 SNDRV_CHMAP_BRC, /* bottom right center */
505 SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC,
506};
507
508#define SNDRV_CHMAP_POSITION_MASK 0xffff
509#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
510#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
511
512#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
513#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
514#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
515#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
516#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
517#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
518#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
519#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
520#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
521#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
522#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
523#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
524#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
525#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
526#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
527#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
528#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
529#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
530#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
531#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
532#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
533#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
534#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
535#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
536#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
537#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
538#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
539#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
540#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
541
542/*****************************************************************************
543 * *
544 * MIDI v1.0 interface *
545 * *
546 *****************************************************************************/
547
548/*
549 * Raw MIDI section - /dev/snd/midi??
550 */
551
552#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
553
554enum {
555 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
556 SNDRV_RAWMIDI_STREAM_INPUT,
557 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
558};
559
560#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
561#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
562#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
563
564struct snd_rawmidi_info {
565 unsigned int device; /* RO/WR (control): device number */
566 unsigned int subdevice; /* RO/WR (control): subdevice number */
567 int stream; /* WR: stream */
568 int card; /* R: card number */
569 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
570 unsigned char id[64]; /* ID (user selectable) */
571 unsigned char name[80]; /* name of device */
572 unsigned char subname[32]; /* name of active or selected subdevice */
573 unsigned int subdevices_count;
574 unsigned int subdevices_avail;
575 unsigned char reserved[64]; /* reserved for future use */
576};
577
578struct snd_rawmidi_params {
579 int stream;
580 size_t buffer_size; /* queue size in bytes */
581 size_t avail_min; /* minimum avail bytes for wakeup */
582 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
583 unsigned char reserved[16]; /* reserved for future use */
584};
585
586struct snd_rawmidi_status {
587 int stream;
588 struct timespec tstamp; /* Timestamp */
589 size_t avail; /* available bytes */
590 size_t xruns; /* count of overruns since last status (in bytes) */
591 unsigned char reserved[16]; /* reserved for future use */
592};
593
594#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
595#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
596#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
597#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
598#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
599#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
600
601/*
602 * Timer section - /dev/snd/timer
603 */
604
605#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
606
607enum {
608 SNDRV_TIMER_CLASS_NONE = -1,
609 SNDRV_TIMER_CLASS_SLAVE = 0,
610 SNDRV_TIMER_CLASS_GLOBAL,
611 SNDRV_TIMER_CLASS_CARD,
612 SNDRV_TIMER_CLASS_PCM,
613 SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
614};
615
616/* slave timer classes */
617enum {
618 SNDRV_TIMER_SCLASS_NONE = 0,
619 SNDRV_TIMER_SCLASS_APPLICATION,
620 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
621 SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
622 SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
623};
624
625/* global timers (device member) */
626#define SNDRV_TIMER_GLOBAL_SYSTEM 0
627#define SNDRV_TIMER_GLOBAL_RTC 1
628#define SNDRV_TIMER_GLOBAL_HPET 2
629#define SNDRV_TIMER_GLOBAL_HRTIMER 3
630
631/* info flags */
632#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
633
634struct snd_timer_id {
635 int dev_class;
636 int dev_sclass;
637 int card;
638 int device;
639 int subdevice;
640};
641
642struct snd_timer_ginfo {
643 struct snd_timer_id tid; /* requested timer ID */
644 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
645 int card; /* card number */
646 unsigned char id[64]; /* timer identification */
647 unsigned char name[80]; /* timer name */
648 unsigned long reserved0; /* reserved for future use */
649 unsigned long resolution; /* average period resolution in ns */
650 unsigned long resolution_min; /* minimal period resolution in ns */
651 unsigned long resolution_max; /* maximal period resolution in ns */
652 unsigned int clients; /* active timer clients */
653 unsigned char reserved[32];
654};
655
656struct snd_timer_gparams {
657 struct snd_timer_id tid; /* requested timer ID */
658 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
659 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
660 unsigned char reserved[32];
661};
662
663struct snd_timer_gstatus {
664 struct snd_timer_id tid; /* requested timer ID */
665 unsigned long resolution; /* current period resolution in ns */
666 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
667 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
668 unsigned char reserved[32];
669};
670
671struct snd_timer_select {
672 struct snd_timer_id id; /* bind to timer ID */
673 unsigned char reserved[32]; /* reserved */
674};
675
676struct snd_timer_info {
677 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
678 int card; /* card number */
679 unsigned char id[64]; /* timer identificator */
680 unsigned char name[80]; /* timer name */
681 unsigned long reserved0; /* reserved for future use */
682 unsigned long resolution; /* average period resolution in ns */
683 unsigned char reserved[64]; /* reserved */
684};
685
686#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */
687#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
688#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
689
690struct snd_timer_params {
691 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
692 unsigned int ticks; /* requested resolution in ticks */
693 unsigned int queue_size; /* total size of queue (32-1024) */
694 unsigned int reserved0; /* reserved, was: failure locations */
695 unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
696 unsigned char reserved[60]; /* reserved */
697};
698
699struct snd_timer_status {
700 struct timespec tstamp; /* Timestamp - last update */
701 unsigned int resolution; /* current period resolution in ns */
702 unsigned int lost; /* counter of master tick lost */
703 unsigned int overrun; /* count of read queue overruns */
704 unsigned int queue; /* used queue size */
705 unsigned char reserved[64]; /* reserved */
706};
707
708#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
709#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
710#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
711#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
712#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
713#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
714#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
715#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
716#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
717#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
718/* The following four ioctls are changed since 1.0.9 due to confliction */
719#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
720#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
721#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
722#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
723
724struct snd_timer_read {
725 unsigned int resolution;
726 unsigned int ticks;
727};
728
729enum {
730 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
731 SNDRV_TIMER_EVENT_TICK, /* val = ticks */
732 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
733 SNDRV_TIMER_EVENT_STOP, /* val = 0 */
734 SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
735 SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
736 SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
737 SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
738 SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
739 /* master timer events for slave timer instances */
740 SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
741 SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
742 SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
743 SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
744 SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
745 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
746};
747
748struct snd_timer_tread {
749 int event;
750 struct timespec tstamp;
751 unsigned int val;
752};
753
754/****************************************************************************
755 * *
756 * Section for driver control interface - /dev/snd/control? *
757 * *
758 ****************************************************************************/
759
760#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
761
762struct snd_ctl_card_info {
763 int card; /* card number */
764 int pad; /* reserved for future (was type) */
765 unsigned char id[16]; /* ID of card (user selectable) */
766 unsigned char driver[16]; /* Driver name */
767 unsigned char name[32]; /* Short name of soundcard */
768 unsigned char longname[80]; /* name + info text about soundcard */
769 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
770 unsigned char mixername[80]; /* visual mixer identification */
771 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
772};
773
774typedef int __bitwise snd_ctl_elem_type_t;
775#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
776#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
777#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
778#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
779#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
780#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
781#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
782#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
783
784typedef int __bitwise snd_ctl_elem_iface_t;
785#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
786#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
787#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
788#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
789#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
790#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
791#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
792#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
793
794#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
795#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
796#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
797#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
798#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
799#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
800#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
801#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
802#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
803#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
804#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
805#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
806#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
807#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
808/* bits 30 and 31 are obsoleted (for indirect access) */
809
810/* for further details see the ACPI and PCI power management specification */
811#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
812#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
813#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
814#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
815#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
816#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
817
818struct snd_ctl_elem_id {
819 unsigned int numid; /* numeric identifier, zero = invalid */
820 snd_ctl_elem_iface_t iface; /* interface identifier */
821 unsigned int device; /* device/client number */
822 unsigned int subdevice; /* subdevice (substream) number */
823 unsigned char name[44]; /* ASCII name of item */
824 unsigned int index; /* index of item */
825};
826
827struct snd_ctl_elem_list {
828 unsigned int offset; /* W: first element ID to get */
829 unsigned int space; /* W: count of element IDs to get */
830 unsigned int used; /* R: count of element IDs set */
831 unsigned int count; /* R: count of all elements */
832 struct snd_ctl_elem_id __user *pids; /* R: IDs */
833 unsigned char reserved[50];
834};
835
836struct snd_ctl_elem_info {
837 struct snd_ctl_elem_id id; /* W: element ID */
838 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
839 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
840 unsigned int count; /* count of values */
841 __kernel_pid_t owner; /* owner's PID of this control */
842 union {
843 struct {
844 long min; /* R: minimum value */
845 long max; /* R: maximum value */
846 long step; /* R: step (0 variable) */
847 } integer;
848 struct {
849 long long min; /* R: minimum value */
850 long long max; /* R: maximum value */
851 long long step; /* R: step (0 variable) */
852 } integer64;
853 struct {
854 unsigned int items; /* R: number of items */
855 unsigned int item; /* W: item number */
856 char name[64]; /* R: value name */
857 __u64 names_ptr; /* W: names list (ELEM_ADD only) */
858 unsigned int names_length;
859 } enumerated;
860 unsigned char reserved[128];
861 } value;
862 union {
863 unsigned short d[4]; /* dimensions */
864 unsigned short *d_ptr; /* indirect - obsoleted */
865 } dimen;
866 unsigned char reserved[64-4*sizeof(unsigned short)];
867};
868
869struct snd_ctl_elem_value {
870 struct snd_ctl_elem_id id; /* W: element ID */
871 unsigned int indirect: 1; /* W: indirect access - obsoleted */
872 union {
873 union {
874 long value[128];
875 long *value_ptr; /* obsoleted */
876 } integer;
877 union {
878 long long value[64];
879 long long *value_ptr; /* obsoleted */
880 } integer64;
881 union {
882 unsigned int item[128];
883 unsigned int *item_ptr; /* obsoleted */
884 } enumerated;
885 union {
886 unsigned char data[512];
887 unsigned char *data_ptr; /* obsoleted */
888 } bytes;
889 struct snd_aes_iec958 iec958;
890 } value; /* RO */
891 struct timespec tstamp;
892 unsigned char reserved[128-sizeof(struct timespec)];
893};
894
895struct snd_ctl_tlv {
896 unsigned int numid; /* control element numeric identification */
897 unsigned int length; /* in bytes aligned to 4 */
898 unsigned int tlv[0]; /* first TLV */
899};
900
901#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
902#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
903#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
904#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
905#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
906#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
907#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
908#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
909#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
910#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
911#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
912#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
913#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
914#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
915#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
916#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
917#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
918#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
919#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
920#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
921#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
922#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
923#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
924#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
925#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
926
927/*
928 * Read interface.
929 */
930
931enum sndrv_ctl_event_type {
932 SNDRV_CTL_EVENT_ELEM = 0,
933 SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
934};
935
936#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
937#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
938#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
939#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
940#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
941
942struct snd_ctl_event {
943 int type; /* event type - SNDRV_CTL_EVENT_* */
944 union {
945 struct {
946 unsigned int mask;
947 struct snd_ctl_elem_id id;
948 } elem;
949 unsigned char data8[60];
950 } data;
951};
952
953/*
954 * Control names
955 */
956
957#define SNDRV_CTL_NAME_NONE ""
958#define SNDRV_CTL_NAME_PLAYBACK "Playback "
959#define SNDRV_CTL_NAME_CAPTURE "Capture "
960
961#define SNDRV_CTL_NAME_IEC958_NONE ""
962#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
963#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
964#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
965#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
966#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
967#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
968#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
969#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
970
971#endif /* _UAPI__SOUND_ASOUND_H */
diff --git a/include/sound/asound_fm.h b/include/uapi/sound/asound_fm.h
index c2a4b967d5be..c2a4b967d5be 100644
--- a/include/sound/asound_fm.h
+++ b/include/uapi/sound/asound_fm.h
diff --git a/include/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 05341a43fedf..05341a43fedf 100644
--- a/include/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
diff --git a/include/sound/compress_params.h b/include/uapi/sound/compress_params.h
index 602dc6c45d1a..602dc6c45d1a 100644
--- a/include/sound/compress_params.h
+++ b/include/uapi/sound/compress_params.h
diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
new file mode 100644
index 000000000000..d1bbaf78457a
--- /dev/null
+++ b/include/uapi/sound/emu10k1.h
@@ -0,0 +1,373 @@
1/*
2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
3 * Creative Labs, Inc.
4 * Definitions for EMU10K1 (SB Live!) chips
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef _UAPI__SOUND_EMU10K1_H
23#define _UAPI__SOUND_EMU10K1_H
24
25#include <linux/types.h>
26
27
28
29/*
30 * ---- FX8010 ----
31 */
32
33#define EMU10K1_CARD_CREATIVE 0x00000000
34#define EMU10K1_CARD_EMUAPS 0x00000001
35
36#define EMU10K1_FX8010_PCM_COUNT 8
37
38/* instruction set */
39#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
40#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
41#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
42#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
43#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
44#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
45#define iACC3 0x06 /* R = A + X + Y ; saturation */
46#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
47#define iANDXOR 0x08 /* R = (A & X) ^ Y */
48#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
49#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
50#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
51#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
52#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
53#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
54#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
55
56/* GPRs */
57#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
58#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
59#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
60#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
61 /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
62
63#define C_00000000 0x40
64#define C_00000001 0x41
65#define C_00000002 0x42
66#define C_00000003 0x43
67#define C_00000004 0x44
68#define C_00000008 0x45
69#define C_00000010 0x46
70#define C_00000020 0x47
71#define C_00000100 0x48
72#define C_00010000 0x49
73#define C_00080000 0x4a
74#define C_10000000 0x4b
75#define C_20000000 0x4c
76#define C_40000000 0x4d
77#define C_80000000 0x4e
78#define C_7fffffff 0x4f
79#define C_ffffffff 0x50
80#define C_fffffffe 0x51
81#define C_c0000000 0x52
82#define C_4f1bbcdc 0x53
83#define C_5a7ef9db 0x54
84#define C_00100000 0x55 /* ?? */
85#define GPR_ACCU 0x56 /* ACCUM, accumulator */
86#define GPR_COND 0x57 /* CCR, condition register */
87#define GPR_NOISE0 0x58 /* noise source */
88#define GPR_NOISE1 0x59 /* noise source */
89#define GPR_IRQ 0x5a /* IRQ register */
90#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
91#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
92#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
93#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
94#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
95#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
96
97#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
98#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
99#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
100#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
101#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
102#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
103
104#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */
105#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */
106#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
107#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */
108#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
109#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
110#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
111#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
112#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
113#define A_GPR(x) (A_FXGPREGBASE + (x))
114
115/* cc_reg constants */
116#define CC_REG_NORMALIZED C_00000001
117#define CC_REG_BORROW C_00000002
118#define CC_REG_MINUS C_00000004
119#define CC_REG_ZERO C_00000008
120#define CC_REG_SATURATE C_00000010
121#define CC_REG_NONZERO C_00000100
122
123/* FX buses */
124#define FXBUS_PCM_LEFT 0x00
125#define FXBUS_PCM_RIGHT 0x01
126#define FXBUS_PCM_LEFT_REAR 0x02
127#define FXBUS_PCM_RIGHT_REAR 0x03
128#define FXBUS_MIDI_LEFT 0x04
129#define FXBUS_MIDI_RIGHT 0x05
130#define FXBUS_PCM_CENTER 0x06
131#define FXBUS_PCM_LFE 0x07
132#define FXBUS_PCM_LEFT_FRONT 0x08
133#define FXBUS_PCM_RIGHT_FRONT 0x09
134#define FXBUS_MIDI_REVERB 0x0c
135#define FXBUS_MIDI_CHORUS 0x0d
136#define FXBUS_PCM_LEFT_SIDE 0x0e
137#define FXBUS_PCM_RIGHT_SIDE 0x0f
138#define FXBUS_PT_LEFT 0x14
139#define FXBUS_PT_RIGHT 0x15
140
141/* Inputs */
142#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
143#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
144#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
145#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
146#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
147#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
148#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
149#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
150#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
151#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
152#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
153#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
154#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
155#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
156
157/* Outputs */
158#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
159#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
160#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
161#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
162#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
163#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
164#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
165#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
166#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
167#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
168#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
169#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
170#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
171#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
172#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
173#define EXTOUT_ACENTER 0x11 /* Analog Center */
174#define EXTOUT_ALFE 0x12 /* Analog LFE */
175
176/* Audigy Inputs */
177#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
178#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
179#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
180#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
181#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
182#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
183#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
184#define A_EXTIN_LINE2_R 0x09 /* right */
185#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
186#define A_EXTIN_ADC_R 0x0b /* right */
187#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
188#define A_EXTIN_AUX2_R 0x0d /* - right */
189
190/* Audigiy Outputs */
191#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
192#define A_EXTOUT_FRONT_R 0x01 /* right */
193#define A_EXTOUT_CENTER 0x02 /* digital front center */
194#define A_EXTOUT_LFE 0x03 /* digital front lfe */
195#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
196#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
197#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
198#define A_EXTOUT_REAR_R 0x07 /* right */
199#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
200#define A_EXTOUT_AFRONT_R 0x09 /* right */
201#define A_EXTOUT_ACENTER 0x0a /* analog center */
202#define A_EXTOUT_ALFE 0x0b /* analog LFE */
203#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
204#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
205#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
206#define A_EXTOUT_AREAR_R 0x0f /* right */
207#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
208#define A_EXTOUT_AC97_R 0x11 /* right */
209#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
210#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
211#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
212
213/* Audigy constants */
214#define A_C_00000000 0xc0
215#define A_C_00000001 0xc1
216#define A_C_00000002 0xc2
217#define A_C_00000003 0xc3
218#define A_C_00000004 0xc4
219#define A_C_00000008 0xc5
220#define A_C_00000010 0xc6
221#define A_C_00000020 0xc7
222#define A_C_00000100 0xc8
223#define A_C_00010000 0xc9
224#define A_C_00000800 0xca
225#define A_C_10000000 0xcb
226#define A_C_20000000 0xcc
227#define A_C_40000000 0xcd
228#define A_C_80000000 0xce
229#define A_C_7fffffff 0xcf
230#define A_C_ffffffff 0xd0
231#define A_C_fffffffe 0xd1
232#define A_C_c0000000 0xd2
233#define A_C_4f1bbcdc 0xd3
234#define A_C_5a7ef9db 0xd4
235#define A_C_00100000 0xd5
236#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
237#define A_GPR_COND 0xd7 /* CCR, condition register */
238#define A_GPR_NOISE0 0xd8 /* noise source */
239#define A_GPR_NOISE1 0xd9 /* noise source */
240#define A_GPR_IRQ 0xda /* IRQ register */
241#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
242#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
243
244/* definitions for debug register */
245#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
246#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
247#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
248#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
249#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
250#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
251#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
252
253/* tank memory address line */
254#ifndef __KERNEL__
255#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
256#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
257#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
258#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
259#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
260#endif
261
262struct snd_emu10k1_fx8010_info {
263 unsigned int internal_tram_size; /* in samples */
264 unsigned int external_tram_size; /* in samples */
265 char fxbus_names[16][32]; /* names of FXBUSes */
266 char extin_names[16][32]; /* names of external inputs */
267 char extout_names[32][32]; /* names of external outputs */
268 unsigned int gpr_controls; /* count of GPR controls */
269};
270
271#define EMU10K1_GPR_TRANSLATION_NONE 0
272#define EMU10K1_GPR_TRANSLATION_TABLE100 1
273#define EMU10K1_GPR_TRANSLATION_BASS 2
274#define EMU10K1_GPR_TRANSLATION_TREBLE 3
275#define EMU10K1_GPR_TRANSLATION_ONOFF 4
276
277struct snd_emu10k1_fx8010_control_gpr {
278 struct snd_ctl_elem_id id; /* full control ID definition */
279 unsigned int vcount; /* visible count */
280 unsigned int count; /* count of GPR (1..16) */
281 unsigned short gpr[32]; /* GPR number(s) */
282 unsigned int value[32]; /* initial values */
283 unsigned int min; /* minimum range */
284 unsigned int max; /* maximum range */
285 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
286 const unsigned int *tlv;
287};
288
289/* old ABI without TLV support */
290struct snd_emu10k1_fx8010_control_old_gpr {
291 struct snd_ctl_elem_id id;
292 unsigned int vcount;
293 unsigned int count;
294 unsigned short gpr[32];
295 unsigned int value[32];
296 unsigned int min;
297 unsigned int max;
298 unsigned int translation;
299};
300
301struct snd_emu10k1_fx8010_code {
302 char name[128];
303
304 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
305 __u32 __user *gpr_map; /* initializers */
306
307 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
308 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
309
310 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
311 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
312
313 unsigned int gpr_list_control_count; /* count of GPR controls to list */
314 unsigned int gpr_list_control_total; /* total count of GPR controls */
315 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
316
317 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
318 __u32 __user *tram_data_map; /* data initializers */
319 __u32 __user *tram_addr_map; /* map initializers */
320
321 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
322 __u32 __user *code; /* one instruction - 64 bits */
323};
324
325struct snd_emu10k1_fx8010_tram {
326 unsigned int address; /* 31.bit == 1 -> external TRAM */
327 unsigned int size; /* size in samples (4 bytes) */
328 unsigned int *samples; /* pointer to samples (20-bit) */
329 /* NULL->clear memory */
330};
331
332struct snd_emu10k1_fx8010_pcm_rec {
333 unsigned int substream; /* substream number */
334 unsigned int res1; /* reserved */
335 unsigned int channels; /* 16-bit channels count, zero = remove this substream */
336 unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
337 unsigned int buffer_size; /* count of buffered samples */
338 unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
339 unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
340 unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
341 unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
342 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
343 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
344 unsigned char pad; /* reserved */
345 unsigned char etram[32]; /* external TRAM address & data (one per channel) */
346 unsigned int res2; /* reserved */
347};
348
349#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
350
351#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
352#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
353#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
354#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
355#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
356#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
357#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
358#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
359#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
360#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
361#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
362#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
363#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
364#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
365
366/* typedefs for compatibility to user-space */
367typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
368typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
369typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
370typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
371typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
372
373#endif /* _UAPI__SOUND_EMU10K1_H */
diff --git a/include/sound/hdsp.h b/include/uapi/sound/hdsp.h
index 0909a3843479..0909a3843479 100644
--- a/include/sound/hdsp.h
+++ b/include/uapi/sound/hdsp.h
diff --git a/include/sound/hdspm.h b/include/uapi/sound/hdspm.h
index 1f59ea2a4a76..1f59ea2a4a76 100644
--- a/include/sound/hdspm.h
+++ b/include/uapi/sound/hdspm.h
diff --git a/include/uapi/sound/sb16_csp.h b/include/uapi/sound/sb16_csp.h
new file mode 100644
index 000000000000..3b96907e2afb
--- /dev/null
+++ b/include/uapi/sound/sb16_csp.h
@@ -0,0 +1,122 @@
1/*
2 * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
3 * Takashi Iwai <tiwai@suse.de>
4 *
5 * SB16ASP/AWE32 CSP control
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef _UAPI__SOUND_SB16_CSP_H
23#define _UAPI__SOUND_SB16_CSP_H
24
25
26/* CSP modes */
27#define SNDRV_SB_CSP_MODE_NONE 0x00
28#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
29#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
30#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
31
32/* CSP load flags */
33#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
34#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
35
36/* CSP sample width */
37#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
38#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
39
40/* CSP channels */
41#define SNDRV_SB_CSP_MONO 0x01
42#define SNDRV_SB_CSP_STEREO 0x02
43
44/* CSP rates */
45#define SNDRV_SB_CSP_RATE_8000 0x01
46#define SNDRV_SB_CSP_RATE_11025 0x02
47#define SNDRV_SB_CSP_RATE_22050 0x04
48#define SNDRV_SB_CSP_RATE_44100 0x08
49#define SNDRV_SB_CSP_RATE_ALL 0x0f
50
51/* CSP running state */
52#define SNDRV_SB_CSP_ST_IDLE 0x00
53#define SNDRV_SB_CSP_ST_LOADED 0x01
54#define SNDRV_SB_CSP_ST_RUNNING 0x02
55#define SNDRV_SB_CSP_ST_PAUSED 0x04
56#define SNDRV_SB_CSP_ST_AUTO 0x08
57#define SNDRV_SB_CSP_ST_QSOUND 0x10
58
59/* maximum QSound value (180 degrees right) */
60#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
61
62/* maximum microcode RIFF file size */
63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
64
65/* microcode header */
66struct snd_sb_csp_mc_header {
67 char codec_name[16]; /* id name of codec */
68 unsigned short func_req; /* requested function */
69};
70
71/* microcode to be loaded */
72struct snd_sb_csp_microcode {
73 struct snd_sb_csp_mc_header info;
74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
75};
76
77/* start CSP with sample_width in mono/stereo */
78struct snd_sb_csp_start {
79 int sample_width; /* sample width, look above */
80 int channels; /* channels, look above */
81};
82
83/* CSP information */
84struct snd_sb_csp_info {
85 char codec_name[16]; /* id name of codec */
86 unsigned short func_nr; /* function number */
87 unsigned int acc_format; /* accepted PCM formats */
88 unsigned short acc_channels; /* accepted channels */
89 unsigned short acc_width; /* accepted sample width */
90 unsigned short acc_rates; /* accepted sample rates */
91 unsigned short csp_mode; /* CSP mode, see above */
92 unsigned short run_channels; /* current channels */
93 unsigned short run_width; /* current sample width */
94 unsigned short version; /* version id: 0x10 - 0x1f */
95 unsigned short state; /* state bits */
96};
97
98/* HWDEP controls */
99/* get CSP information */
100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
101/* load microcode to CSP */
102/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
103 * defined for some architectures like MIPS, and it leads to build errors.
104 * (x86 and co have 14-bit size, thus it's valid, though.)
105 * As a workaround for skipping the size-limit check, here we don't use the
106 * normal _IOW() macro but _IOC() with the manual argument.
107 */
108#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
109 _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
110/* unload microcode from CSP */
111#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
112/* start CSP */
113#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
114/* stop CSP */
115#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
116/* pause CSP and DMA transfer */
117#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
118/* restart CSP and DMA transfer */
119#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
120
121
122#endif /* _UAPI__SOUND_SB16_CSP_H */
diff --git a/include/sound/sfnt_info.h b/include/uapi/sound/sfnt_info.h
index 1bce7fd1725f..1bce7fd1725f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/uapi/sound/sfnt_info.h
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h
index 5a0e4f9efb53..f88825928dd1 100644
--- a/include/video/da8xx-fb.h
+++ b/include/video/da8xx-fb.h
@@ -12,10 +12,6 @@
12#ifndef DA8XX_FB_H 12#ifndef DA8XX_FB_H
13#define DA8XX_FB_H 13#define DA8XX_FB_H
14 14
15enum panel_type {
16 QVGA = 0
17};
18
19enum panel_shade { 15enum panel_shade {
20 MONOCHROME = 0, 16 MONOCHROME = 0,
21 COLOR_ACTIVE, 17 COLOR_ACTIVE,
@@ -27,13 +23,6 @@ enum raster_load_mode {
27 LOAD_PALETTE, 23 LOAD_PALETTE,
28}; 24};
29 25
30struct display_panel {
31 enum panel_type panel_type; /* QVGA */
32 int max_bpp;
33 int min_bpp;
34 enum panel_shade panel_shade;
35};
36
37struct da8xx_lcdc_platform_data { 26struct da8xx_lcdc_platform_data {
38 const char manu_name[10]; 27 const char manu_name[10];
39 void *controller_data; 28 void *controller_data;
@@ -42,7 +31,7 @@ struct da8xx_lcdc_platform_data {
42}; 31};
43 32
44struct lcd_ctrl_config { 33struct lcd_ctrl_config {
45 const struct display_panel *p_disp_panel; 34 enum panel_shade panel_shade;
46 35
47 /* AC Bias Pin Frequency */ 36 /* AC Bias Pin Frequency */
48 int ac_bias; 37 int ac_bias;
@@ -68,18 +57,9 @@ struct lcd_ctrl_config {
68 /* Mono 8-bit Mode: 1=D0-D7 or 0=D0-D3 */ 57 /* Mono 8-bit Mode: 1=D0-D7 or 0=D0-D3 */
69 unsigned char mono_8bit_mode; 58 unsigned char mono_8bit_mode;
70 59
71 /* Invert line clock */
72 unsigned char invert_line_clock;
73
74 /* Invert frame clock */
75 unsigned char invert_frm_clock;
76
77 /* Horizontal and Vertical Sync Edge: 0=rising 1=falling */ 60 /* Horizontal and Vertical Sync Edge: 0=rising 1=falling */
78 unsigned char sync_edge; 61 unsigned char sync_edge;
79 62
80 /* Horizontal and Vertical Sync: Control: 0=ignore */
81 unsigned char sync_ctrl;
82
83 /* Raster Data Order Select: 1=Most-to-least 0=Least-to-most */ 63 /* Raster Data Order Select: 1=Most-to-least 0=Least-to-most */
84 unsigned char raster_order; 64 unsigned char raster_order;
85 65
@@ -103,5 +83,8 @@ struct lcd_sync_arg {
103#define FBIPUT_HSYNC _IOW('F', 9, int) 83#define FBIPUT_HSYNC _IOW('F', 9, int)
104#define FBIPUT_VSYNC _IOW('F', 10, int) 84#define FBIPUT_VSYNC _IOW('F', 10, int)
105 85
86/* Proprietary FB_SYNC_ flags */
87#define FB_SYNC_CLK_INVERT 0x40000000
88
106#endif /* ifndef DA8XX_FB_H */ 89#endif /* ifndef DA8XX_FB_H */
107 90
diff --git a/include/video/omap-panel-tfp410.h b/include/video/omap-panel-tfp410.h
index 68c31d79c571..aef35e48bc7e 100644
--- a/include/video/omap-panel-tfp410.h
+++ b/include/video/omap-panel-tfp410.h
@@ -28,7 +28,7 @@ struct omap_dss_device;
28 * @power_down_gpio: gpio number for PD pin (or -1 if not available) 28 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
29 */ 29 */
30struct tfp410_platform_data { 30struct tfp410_platform_data {
31 u16 i2c_bus_num; 31 int i2c_bus_num;
32 int power_down_gpio; 32 int power_down_gpio;
33}; 33};
34 34
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 3729173b7fbc..caefa093337d 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -21,6 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/interrupt.h>
24 25
25#define DISPC_IRQ_FRAMEDONE (1 << 0) 26#define DISPC_IRQ_FRAMEDONE (1 << 0)
26#define DISPC_IRQ_VSYNC (1 << 1) 27#define DISPC_IRQ_VSYNC (1 << 1)
@@ -55,6 +56,7 @@
55 56
56struct omap_dss_device; 57struct omap_dss_device;
57struct omap_overlay_manager; 58struct omap_overlay_manager;
59struct dss_lcd_mgr_config;
58struct snd_aes_iec958; 60struct snd_aes_iec958;
59struct snd_cea_861_aud_if; 61struct snd_cea_861_aud_if;
60 62
@@ -158,7 +160,6 @@ enum omap_display_caps {
158enum omap_dss_display_state { 160enum omap_dss_display_state {
159 OMAP_DSS_DISPLAY_DISABLED = 0, 161 OMAP_DSS_DISPLAY_DISABLED = 0,
160 OMAP_DSS_DISPLAY_ACTIVE, 162 OMAP_DSS_DISPLAY_ACTIVE,
161 OMAP_DSS_DISPLAY_SUSPENDED,
162}; 163};
163 164
164enum omap_dss_audio_state { 165enum omap_dss_audio_state {
@@ -314,6 +315,19 @@ int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
314int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel); 315int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
315void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel); 316void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
316 317
318enum omapdss_version {
319 OMAPDSS_VER_UNKNOWN = 0,
320 OMAPDSS_VER_OMAP24xx,
321 OMAPDSS_VER_OMAP34xx_ES1, /* OMAP3430 ES1.0, 2.0 */
322 OMAPDSS_VER_OMAP34xx_ES3, /* OMAP3430 ES3.0+ */
323 OMAPDSS_VER_OMAP3630,
324 OMAPDSS_VER_AM35xx,
325 OMAPDSS_VER_OMAP4430_ES1, /* OMAP4430 ES1.0 */
326 OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */
327 OMAPDSS_VER_OMAP4, /* All other OMAP4s */
328 OMAPDSS_VER_OMAP5,
329};
330
317/* Board specific data */ 331/* Board specific data */
318struct omap_dss_board_info { 332struct omap_dss_board_info {
319 int (*get_context_loss_count)(struct device *dev); 333 int (*get_context_loss_count)(struct device *dev);
@@ -323,6 +337,7 @@ struct omap_dss_board_info {
323 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); 337 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
324 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); 338 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
325 int (*set_min_bus_tput)(struct device *dev, unsigned long r); 339 int (*set_min_bus_tput)(struct device *dev, unsigned long r);
340 enum omapdss_version version;
326}; 341};
327 342
328/* Init with the board info */ 343/* Init with the board info */
@@ -607,10 +622,6 @@ struct omap_dss_device {
607 struct { 622 struct {
608 struct omap_video_timings timings; 623 struct omap_video_timings timings;
609 624
610 int acbi; /* ac-bias pin transitions per interrupt */
611 /* Unit: line clocks */
612 int acb; /* ac-bias pin frequency */
613
614 enum omap_dss_dsi_pixel_format dsi_pix_fmt; 625 enum omap_dss_dsi_pixel_format dsi_pix_fmt;
615 enum omap_dss_dsi_mode dsi_mode; 626 enum omap_dss_dsi_mode dsi_mode;
616 struct omap_dss_dsi_videomode_timings dsi_vm_timings; 627 struct omap_dss_dsi_videomode_timings dsi_vm_timings;
@@ -672,8 +683,6 @@ struct omap_dss_driver {
672 683
673 int (*enable)(struct omap_dss_device *display); 684 int (*enable)(struct omap_dss_device *display);
674 void (*disable)(struct omap_dss_device *display); 685 void (*disable)(struct omap_dss_device *display);
675 int (*suspend)(struct omap_dss_device *display);
676 int (*resume)(struct omap_dss_device *display);
677 int (*run_test)(struct omap_dss_device *display, int test); 686 int (*run_test)(struct omap_dss_device *display, int test);
678 687
679 int (*update)(struct omap_dss_device *dssdev, 688 int (*update)(struct omap_dss_device *dssdev,
@@ -731,6 +740,8 @@ struct omap_dss_driver {
731 740
732}; 741};
733 742
743enum omapdss_version omapdss_get_version(void);
744
734int omap_dss_register_driver(struct omap_dss_driver *); 745int omap_dss_register_driver(struct omap_dss_driver *);
735void omap_dss_unregister_driver(struct omap_dss_driver *); 746void omap_dss_unregister_driver(struct omap_dss_driver *);
736 747
@@ -740,10 +751,19 @@ void omap_dss_put_device(struct omap_dss_device *dssdev);
740struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from); 751struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
741struct omap_dss_device *omap_dss_find_device(void *data, 752struct omap_dss_device *omap_dss_find_device(void *data,
742 int (*match)(struct omap_dss_device *dssdev, void *data)); 753 int (*match)(struct omap_dss_device *dssdev, void *data));
754const char *omapdss_get_default_display_name(void);
743 755
744int omap_dss_start_device(struct omap_dss_device *dssdev); 756int omap_dss_start_device(struct omap_dss_device *dssdev);
745void omap_dss_stop_device(struct omap_dss_device *dssdev); 757void omap_dss_stop_device(struct omap_dss_device *dssdev);
746 758
759int dss_feat_get_num_mgrs(void);
760int dss_feat_get_num_ovls(void);
761enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel);
762enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel);
763enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane);
764
765
766
747int omap_dss_get_num_overlay_managers(void); 767int omap_dss_get_num_overlay_managers(void);
748struct omap_overlay_manager *omap_dss_get_overlay_manager(int num); 768struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
749 769
@@ -765,9 +785,43 @@ typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
765int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask); 785int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
766int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask); 786int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
767 787
768int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout); 788u32 dispc_read_irqstatus(void);
769int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask, 789void dispc_clear_irqstatus(u32 mask);
770 unsigned long timeout); 790u32 dispc_read_irqenable(void);
791void dispc_write_irqenable(u32 mask);
792
793int dispc_request_irq(irq_handler_t handler, void *dev_id);
794void dispc_free_irq(void *dev_id);
795
796int dispc_runtime_get(void);
797void dispc_runtime_put(void);
798
799void dispc_mgr_enable(enum omap_channel channel, bool enable);
800bool dispc_mgr_is_enabled(enum omap_channel channel);
801u32 dispc_mgr_get_vsync_irq(enum omap_channel channel);
802u32 dispc_mgr_get_framedone_irq(enum omap_channel channel);
803u32 dispc_mgr_get_sync_lost_irq(enum omap_channel channel);
804bool dispc_mgr_go_busy(enum omap_channel channel);
805void dispc_mgr_go(enum omap_channel channel);
806void dispc_mgr_set_lcd_config(enum omap_channel channel,
807 const struct dss_lcd_mgr_config *config);
808void dispc_mgr_set_timings(enum omap_channel channel,
809 const struct omap_video_timings *timings);
810void dispc_mgr_setup(enum omap_channel channel,
811 const struct omap_overlay_manager_info *info);
812
813int dispc_ovl_check(enum omap_plane plane, enum omap_channel channel,
814 const struct omap_overlay_info *oi,
815 const struct omap_video_timings *timings,
816 int *x_predecim, int *y_predecim);
817
818int dispc_ovl_enable(enum omap_plane plane, bool enable);
819bool dispc_ovl_enabled(enum omap_plane plane);
820void dispc_ovl_set_channel_out(enum omap_plane plane,
821 enum omap_channel channel);
822int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
823 bool replication, const struct omap_video_timings *mgr_timings,
824 bool mem_to_mem);
771 825
772#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver) 826#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
773#define to_dss_device(x) container_of((x), struct omap_dss_device, dev) 827#define to_dss_device(x) container_of((x), struct omap_dss_device, dev)
@@ -826,4 +880,35 @@ void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev,
826void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev, 880void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev,
827 struct rfbi_timings *timings); 881 struct rfbi_timings *timings);
828 882
883int omapdss_compat_init(void);
884void omapdss_compat_uninit(void);
885
886struct dss_mgr_ops {
887 void (*start_update)(struct omap_overlay_manager *mgr);
888 int (*enable)(struct omap_overlay_manager *mgr);
889 void (*disable)(struct omap_overlay_manager *mgr);
890 void (*set_timings)(struct omap_overlay_manager *mgr,
891 const struct omap_video_timings *timings);
892 void (*set_lcd_config)(struct omap_overlay_manager *mgr,
893 const struct dss_lcd_mgr_config *config);
894 int (*register_framedone_handler)(struct omap_overlay_manager *mgr,
895 void (*handler)(void *), void *data);
896 void (*unregister_framedone_handler)(struct omap_overlay_manager *mgr,
897 void (*handler)(void *), void *data);
898};
899
900int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
901void dss_uninstall_mgr_ops(void);
902
903void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
904 const struct omap_video_timings *timings);
905void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
906 const struct dss_lcd_mgr_config *config);
907int dss_mgr_enable(struct omap_overlay_manager *mgr);
908void dss_mgr_disable(struct omap_overlay_manager *mgr);
909void dss_mgr_start_update(struct omap_overlay_manager *mgr);
910int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr,
911 void (*handler)(void *), void *data);
912void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr,
913 void (*handler)(void *), void *data);
829#endif 914#endif
diff --git a/include/video/omapvrfb.h b/include/video/omapvrfb.h
new file mode 100644
index 000000000000..bb0bd89f8bc6
--- /dev/null
+++ b/include/video/omapvrfb.h
@@ -0,0 +1,68 @@
1/*
2 * VRFB Rotation Engine
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.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 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __OMAP_VRFB_H__
22#define __OMAP_VRFB_H__
23
24#define OMAP_VRFB_LINE_LEN 2048
25
26struct vrfb {
27 u8 context;
28 void __iomem *vaddr[4];
29 unsigned long paddr[4];
30 u16 xres;
31 u16 yres;
32 u16 xoffset;
33 u16 yoffset;
34 u8 bytespp;
35 bool yuv_mode;
36};
37
38#ifdef CONFIG_OMAP2_VRFB
39extern bool omap_vrfb_supported(void);
40extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
41extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
42extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
43 u8 bytespp);
44extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
45extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
46extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
47 u16 width, u16 height,
48 unsigned bytespp, bool yuv_mode);
49extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
50extern void omap_vrfb_restore_context(void);
51
52#else
53static inline bool omap_vrfb_supported(void) { return false; }
54static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; }
55static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {}
56static inline void omap_vrfb_adjust_size(u16 *width, u16 *height,
57 u8 bytespp) {}
58static inline u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp)
59 { return 0; }
60static inline u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp)
61 { return 0; }
62static inline void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
63 u16 width, u16 height, unsigned bytespp, bool yuv_mode) {}
64static inline int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot)
65 { return 0; }
66static inline void omap_vrfb_restore_context(void) {}
67#endif
68#endif /* __VRFB_H */
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index 7ae6c07f2ef8..e7554486a2b7 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -24,12 +24,15 @@
24 24
25#define VIDCON0 (0x00) 25#define VIDCON0 (0x00)
26#define VIDCON0_INTERLACE (1 << 29) 26#define VIDCON0_INTERLACE (1 << 29)
27#define VIDCON0_VIDOUT_MASK (0x3 << 26) 27#define VIDCON0_VIDOUT_MASK (0x7 << 26)
28#define VIDCON0_VIDOUT_SHIFT (26) 28#define VIDCON0_VIDOUT_SHIFT (26)
29#define VIDCON0_VIDOUT_RGB (0x0 << 26) 29#define VIDCON0_VIDOUT_RGB (0x0 << 26)
30#define VIDCON0_VIDOUT_TV (0x1 << 26) 30#define VIDCON0_VIDOUT_TV (0x1 << 26)
31#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26) 31#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26)
32#define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26) 32#define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26)
33#define VIDCON0_VIDOUT_WB_RGB (0x4 << 26)
34#define VIDCON0_VIDOUT_WB_I80_LDI0 (0x6 << 26)
35#define VIDCON0_VIDOUT_WB_I80_LDI1 (0x7 << 26)
33 36
34#define VIDCON0_L1_DATA_MASK (0x7 << 23) 37#define VIDCON0_L1_DATA_MASK (0x7 << 23)
35#define VIDCON0_L1_DATA_SHIFT (23) 38#define VIDCON0_L1_DATA_SHIFT (23)
@@ -77,6 +80,7 @@
77#define VIDCON1_LINECNT_MASK (0x7ff << 16) 80#define VIDCON1_LINECNT_MASK (0x7ff << 16)
78#define VIDCON1_LINECNT_SHIFT (16) 81#define VIDCON1_LINECNT_SHIFT (16)
79#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff) 82#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff)
83#define VIDCON1_FSTATUS_EVEN (1 << 15)
80#define VIDCON1_VSTATUS_MASK (0x3 << 13) 84#define VIDCON1_VSTATUS_MASK (0x3 << 13)
81#define VIDCON1_VSTATUS_SHIFT (13) 85#define VIDCON1_VSTATUS_SHIFT (13)
82#define VIDCON1_VSTATUS_VSYNC (0x0 << 13) 86#define VIDCON1_VSTATUS_VSYNC (0x0 << 13)
@@ -116,6 +120,7 @@
116 120
117/* VIDTCON0 */ 121/* VIDTCON0 */
118 122
123#define VIDTCON0 (0x10)
119#define VIDTCON0_VBPDE_MASK (0xff << 24) 124#define VIDTCON0_VBPDE_MASK (0xff << 24)
120#define VIDTCON0_VBPDE_SHIFT (24) 125#define VIDTCON0_VBPDE_SHIFT (24)
121#define VIDTCON0_VBPDE_LIMIT (0xff) 126#define VIDTCON0_VBPDE_LIMIT (0xff)
@@ -138,6 +143,7 @@
138 143
139/* VIDTCON1 */ 144/* VIDTCON1 */
140 145
146#define VIDTCON1 (0x14)
141#define VIDTCON1_VFPDE_MASK (0xff << 24) 147#define VIDTCON1_VFPDE_MASK (0xff << 24)
142#define VIDTCON1_VFPDE_SHIFT (24) 148#define VIDTCON1_VFPDE_SHIFT (24)
143#define VIDTCON1_VFPDE_LIMIT (0xff) 149#define VIDTCON1_VFPDE_LIMIT (0xff)
@@ -159,6 +165,7 @@
159#define VIDTCON1_HSPW(_x) ((_x) << 0) 165#define VIDTCON1_HSPW(_x) ((_x) << 0)
160 166
161#define VIDTCON2 (0x18) 167#define VIDTCON2 (0x18)
168#define VIDTCON2 (0x18)
162#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23) 169#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23)
163#define VIDTCON2_LINEVAL_MASK (0x7ff << 11) 170#define VIDTCON2_LINEVAL_MASK (0x7ff << 11)
164#define VIDTCON2_LINEVAL_SHIFT (11) 171#define VIDTCON2_LINEVAL_SHIFT (11)
@@ -173,18 +180,27 @@
173 180
174/* WINCONx */ 181/* WINCONx */
175 182
176 183#define WINCON(_win) (0x20 + ((_win) * 4))
184#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
185#define WINCONx_CSCWIDTH_SHIFT (26)
186#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
187#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
188#define WINCONx_ENLOCAL (1 << 22)
189#define WINCONx_BUFSTATUS (1 << 21)
190#define WINCONx_BUFSEL (1 << 20)
191#define WINCONx_BUFAUTOEN (1 << 19)
177#define WINCONx_BITSWP (1 << 18) 192#define WINCONx_BITSWP (1 << 18)
178#define WINCONx_BYTSWP (1 << 17) 193#define WINCONx_BYTSWP (1 << 17)
179#define WINCONx_HAWSWP (1 << 16) 194#define WINCONx_HAWSWP (1 << 16)
180#define WINCONx_WSWP (1 << 15) 195#define WINCONx_WSWP (1 << 15)
196#define WINCONx_YCbCr (1 << 13)
181#define WINCONx_BURSTLEN_MASK (0x3 << 9) 197#define WINCONx_BURSTLEN_MASK (0x3 << 9)
182#define WINCONx_BURSTLEN_SHIFT (9) 198#define WINCONx_BURSTLEN_SHIFT (9)
183#define WINCONx_BURSTLEN_16WORD (0x0 << 9) 199#define WINCONx_BURSTLEN_16WORD (0x0 << 9)
184#define WINCONx_BURSTLEN_8WORD (0x1 << 9) 200#define WINCONx_BURSTLEN_8WORD (0x1 << 9)
185#define WINCONx_BURSTLEN_4WORD (0x2 << 9) 201#define WINCONx_BURSTLEN_4WORD (0x2 << 9)
186
187#define WINCONx_ENWIN (1 << 0) 202#define WINCONx_ENWIN (1 << 0)
203
188#define WINCON0_BPPMODE_MASK (0xf << 2) 204#define WINCON0_BPPMODE_MASK (0xf << 2)
189#define WINCON0_BPPMODE_SHIFT (2) 205#define WINCON0_BPPMODE_SHIFT (2)
190#define WINCON0_BPPMODE_1BPP (0x0 << 2) 206#define WINCON0_BPPMODE_1BPP (0x0 << 2)
@@ -196,9 +212,8 @@
196#define WINCON0_BPPMODE_18BPP_666 (0x8 << 2) 212#define WINCON0_BPPMODE_18BPP_666 (0x8 << 2)
197#define WINCON0_BPPMODE_24BPP_888 (0xb << 2) 213#define WINCON0_BPPMODE_24BPP_888 (0xb << 2)
198 214
215#define WINCON1_LOCALSEL_CAMIF (1 << 23)
199#define WINCON1_BLD_PIX (1 << 6) 216#define WINCON1_BLD_PIX (1 << 6)
200
201#define WINCON1_ALPHA_SEL (1 << 1)
202#define WINCON1_BPPMODE_MASK (0xf << 2) 217#define WINCON1_BPPMODE_MASK (0xf << 2)
203#define WINCON1_BPPMODE_SHIFT (2) 218#define WINCON1_BPPMODE_SHIFT (2)
204#define WINCON1_BPPMODE_1BPP (0x0 << 2) 219#define WINCON1_BPPMODE_1BPP (0x0 << 2)
@@ -216,6 +231,7 @@
216#define WINCON1_BPPMODE_24BPP_A1887 (0xc << 2) 231#define WINCON1_BPPMODE_24BPP_A1887 (0xc << 2)
217#define WINCON1_BPPMODE_25BPP_A1888 (0xd << 2) 232#define WINCON1_BPPMODE_25BPP_A1888 (0xd << 2)
218#define WINCON1_BPPMODE_28BPP_A4888 (0xd << 2) 233#define WINCON1_BPPMODE_28BPP_A4888 (0xd << 2)
234#define WINCON1_ALPHA_SEL (1 << 1)
219 235
220/* S5PV210 */ 236/* S5PV210 */
221#define SHADOWCON (0x34) 237#define SHADOWCON (0x34)
@@ -225,6 +241,9 @@
225/* Local input channels (windows 0-2) */ 241/* Local input channels (windows 0-2) */
226#define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win))) 242#define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win)))
227 243
244/* VIDOSDx */
245
246#define VIDOSD_BASE (0x40)
228#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23) 247#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
229#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11) 248#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11)
230#define VIDOSDxA_TOPLEFT_X_SHIFT (11) 249#define VIDOSDxA_TOPLEFT_X_SHIFT (11)
@@ -293,6 +312,7 @@
293 312
294/* Interrupt controls and status */ 313/* Interrupt controls and status */
295 314
315#define VIDINTCON0 (0x130)
296#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20) 316#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20)
297#define VIDINTCON0_FIFOINTERVAL_SHIFT (20) 317#define VIDINTCON0_FIFOINTERVAL_SHIFT (20)
298#define VIDINTCON0_FIFOINTERVAL_LIMIT (0x3f) 318#define VIDINTCON0_FIFOINTERVAL_LIMIT (0x3f)
@@ -321,6 +341,9 @@
321#define VIDINTCON0_FIFIOSEL_SHIFT (5) 341#define VIDINTCON0_FIFIOSEL_SHIFT (5)
322#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5) 342#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5)
323#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5) 343#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5)
344#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
345#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
346#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
324 347
325#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2) 348#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2)
326#define VIDINTCON0_FIFOLEVEL_SHIFT (2) 349#define VIDINTCON0_FIFOLEVEL_SHIFT (2)
@@ -357,16 +380,39 @@
357#define WxKEYCON1_COLVAL_LIMIT (0xffffff) 380#define WxKEYCON1_COLVAL_LIMIT (0xffffff)
358#define WxKEYCON1_COLVAL(_x) ((_x) << 0) 381#define WxKEYCON1_COLVAL(_x) ((_x) << 0)
359 382
383/* Dithering control */
384#define DITHMODE (0x170)
385#define DITHMODE_R_POS_MASK (0x3 << 5)
386#define DITHMODE_R_POS_SHIFT (5)
387#define DITHMODE_R_POS_8BIT (0x0 << 5)
388#define DITHMODE_R_POS_6BIT (0x1 << 5)
389#define DITHMODE_R_POS_5BIT (0x2 << 5)
390#define DITHMODE_G_POS_MASK (0x3 << 3)
391#define DITHMODE_G_POS_SHIFT (3)
392#define DITHMODE_G_POS_8BIT (0x0 << 3)
393#define DITHMODE_G_POS_6BIT (0x1 << 3)
394#define DITHMODE_G_POS_5BIT (0x2 << 3)
395#define DITHMODE_B_POS_MASK (0x3 << 1)
396#define DITHMODE_B_POS_SHIFT (1)
397#define DITHMODE_B_POS_8BIT (0x0 << 1)
398#define DITHMODE_B_POS_6BIT (0x1 << 1)
399#define DITHMODE_B_POS_5BIT (0x2 << 1)
400#define DITHMODE_DITH_EN (1 << 0)
360 401
361/* Window blanking (MAP) */ 402/* Window blanking (MAP) */
362 403#define WINxMAP(_win) (0x180 + ((_win) * 4))
363#define WINxMAP_MAP (1 << 24) 404#define WINxMAP_MAP (1 << 24)
364#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0) 405#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0)
365#define WINxMAP_MAP_COLOUR_SHIFT (0) 406#define WINxMAP_MAP_COLOUR_SHIFT (0)
366#define WINxMAP_MAP_COLOUR_LIMIT (0xffffff) 407#define WINxMAP_MAP_COLOUR_LIMIT (0xffffff)
367#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0) 408#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0)
368 409
410/* Winodw palette control */
411#define WPALCON (0x1A0)
369#define WPALCON_PAL_UPDATE (1 << 9) 412#define WPALCON_PAL_UPDATE (1 << 9)
413#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
414#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
415#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
370#define WPALCON_W1PAL_MASK (0x7 << 3) 416#define WPALCON_W1PAL_MASK (0x7 << 3)
371#define WPALCON_W1PAL_SHIFT (3) 417#define WPALCON_W1PAL_SHIFT (3)
372#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3) 418#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3)
@@ -376,7 +422,6 @@
376#define WPALCON_W1PAL_18BPP (0x4 << 3) 422#define WPALCON_W1PAL_18BPP (0x4 << 3)
377#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3) 423#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3)
378#define WPALCON_W1PAL_16BPP_565 (0x6 << 3) 424#define WPALCON_W1PAL_16BPP_565 (0x6 << 3)
379
380#define WPALCON_W0PAL_MASK (0x7 << 0) 425#define WPALCON_W0PAL_MASK (0x7 << 0)
381#define WPALCON_W0PAL_SHIFT (0) 426#define WPALCON_W0PAL_SHIFT (0)
382#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0) 427#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0)
@@ -394,115 +439,6 @@
394#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0) 439#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
395 440
396#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */ 441#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
397#define VIDCON1_FSTATUS_EVEN (1 << 15)
398
399/* Video timing controls */
400#define VIDTCON0 (0x10)
401#define VIDTCON1 (0x14)
402#define VIDTCON2 (0x18)
403
404/* Window position controls */
405
406#define WINCON(_win) (0x20 + ((_win) * 4))
407
408/* OSD1 and OSD4 do not have register D */
409
410#define VIDOSD_BASE (0x40)
411
412#define VIDINTCON0 (0x130)
413
414/* WINCONx */
415
416#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
417#define WINCONx_CSCWIDTH_SHIFT (26)
418#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
419#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
420
421#define WINCONx_ENLOCAL (1 << 22)
422#define WINCONx_BUFSTATUS (1 << 21)
423#define WINCONx_BUFSEL (1 << 20)
424#define WINCONx_BUFAUTOEN (1 << 19)
425#define WINCONx_YCbCr (1 << 13)
426
427#define WINCON1_LOCALSEL_CAMIF (1 << 23)
428
429#define WINCON2_LOCALSEL_CAMIF (1 << 23)
430#define WINCON2_BLD_PIX (1 << 6)
431
432#define WINCON2_ALPHA_SEL (1 << 1)
433#define WINCON2_BPPMODE_MASK (0xf << 2)
434#define WINCON2_BPPMODE_SHIFT (2)
435#define WINCON2_BPPMODE_1BPP (0x0 << 2)
436#define WINCON2_BPPMODE_2BPP (0x1 << 2)
437#define WINCON2_BPPMODE_4BPP (0x2 << 2)
438#define WINCON2_BPPMODE_8BPP_1232 (0x4 << 2)
439#define WINCON2_BPPMODE_16BPP_565 (0x5 << 2)
440#define WINCON2_BPPMODE_16BPP_A1555 (0x6 << 2)
441#define WINCON2_BPPMODE_16BPP_I1555 (0x7 << 2)
442#define WINCON2_BPPMODE_18BPP_666 (0x8 << 2)
443#define WINCON2_BPPMODE_18BPP_A1665 (0x9 << 2)
444#define WINCON2_BPPMODE_19BPP_A1666 (0xa << 2)
445#define WINCON2_BPPMODE_24BPP_888 (0xb << 2)
446#define WINCON2_BPPMODE_24BPP_A1887 (0xc << 2)
447#define WINCON2_BPPMODE_25BPP_A1888 (0xd << 2)
448#define WINCON2_BPPMODE_28BPP_A4888 (0xd << 2)
449
450#define WINCON3_BLD_PIX (1 << 6)
451
452#define WINCON3_ALPHA_SEL (1 << 1)
453#define WINCON3_BPPMODE_MASK (0xf << 2)
454#define WINCON3_BPPMODE_SHIFT (2)
455#define WINCON3_BPPMODE_1BPP (0x0 << 2)
456#define WINCON3_BPPMODE_2BPP (0x1 << 2)
457#define WINCON3_BPPMODE_4BPP (0x2 << 2)
458#define WINCON3_BPPMODE_16BPP_565 (0x5 << 2)
459#define WINCON3_BPPMODE_16BPP_A1555 (0x6 << 2)
460#define WINCON3_BPPMODE_16BPP_I1555 (0x7 << 2)
461#define WINCON3_BPPMODE_18BPP_666 (0x8 << 2)
462#define WINCON3_BPPMODE_18BPP_A1665 (0x9 << 2)
463#define WINCON3_BPPMODE_19BPP_A1666 (0xa << 2)
464#define WINCON3_BPPMODE_24BPP_888 (0xb << 2)
465#define WINCON3_BPPMODE_24BPP_A1887 (0xc << 2)
466#define WINCON3_BPPMODE_25BPP_A1888 (0xd << 2)
467#define WINCON3_BPPMODE_28BPP_A4888 (0xd << 2)
468
469#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
470#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
471#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
472
473#define DITHMODE (0x170)
474#define WINxMAP(_win) (0x180 + ((_win) * 4))
475
476
477#define DITHMODE_R_POS_MASK (0x3 << 5)
478#define DITHMODE_R_POS_SHIFT (5)
479#define DITHMODE_R_POS_8BIT (0x0 << 5)
480#define DITHMODE_R_POS_6BIT (0x1 << 5)
481#define DITHMODE_R_POS_5BIT (0x2 << 5)
482
483#define DITHMODE_G_POS_MASK (0x3 << 3)
484#define DITHMODE_G_POS_SHIFT (3)
485#define DITHMODE_G_POS_8BIT (0x0 << 3)
486#define DITHMODE_G_POS_6BIT (0x1 << 3)
487#define DITHMODE_G_POS_5BIT (0x2 << 3)
488
489#define DITHMODE_B_POS_MASK (0x3 << 1)
490#define DITHMODE_B_POS_SHIFT (1)
491#define DITHMODE_B_POS_8BIT (0x0 << 1)
492#define DITHMODE_B_POS_6BIT (0x1 << 1)
493#define DITHMODE_B_POS_5BIT (0x2 << 1)
494
495#define DITHMODE_DITH_EN (1 << 0)
496
497#define WPALCON (0x1A0)
498
499/* Palette control */
500/* Note for S5PC100: you can still use those macros on WPALCON (aka WPALCON_L),
501 * but make sure that WPALCON_H W2PAL-W4PAL entries are zeroed out */
502#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
503#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
504#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
505
506 442
507/* Notes on per-window bpp settings 443/* Notes on per-window bpp settings
508 * 444 *
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 06c67fbc4eee..a01f197e6ac1 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -25,8 +25,6 @@ enum sh_mipi_dsi_data_fmt {
25 MIPI_YUV420, 25 MIPI_YUV420,
26}; 26};
27 27
28struct sh_mobile_lcdc_chan_cfg;
29
30#define SH_MIPI_DSI_HSABM (1 << 0) 28#define SH_MIPI_DSI_HSABM (1 << 0)
31#define SH_MIPI_DSI_HBPBM (1 << 1) 29#define SH_MIPI_DSI_HBPBM (1 << 1)
32#define SH_MIPI_DSI_HFPBM (1 << 2) 30#define SH_MIPI_DSI_HFPBM (1 << 2)
@@ -47,7 +45,7 @@ struct sh_mobile_lcdc_chan_cfg;
47 45
48struct sh_mipi_dsi_info { 46struct sh_mipi_dsi_info {
49 enum sh_mipi_dsi_data_fmt data_format; 47 enum sh_mipi_dsi_data_fmt data_format;
50 struct sh_mobile_lcdc_chan_cfg *lcd_chan; 48 int channel;
51 int lane; 49 int lane;
52 unsigned long flags; 50 unsigned long flags;
53 u32 clksrc; 51 u32 clksrc;
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index ff43ffc1aab2..2605fa8adb9c 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -163,7 +163,6 @@ struct sh_mobile_lcdc_bl_info {
163 const char *name; 163 const char *name;
164 int max_brightness; 164 int max_brightness;
165 int (*set_brightness)(int brightness); 165 int (*set_brightness)(int brightness);
166 int (*get_brightness)(void);
167}; 166};
168 167
169struct sh_mobile_lcdc_overlay_cfg { 168struct sh_mobile_lcdc_overlay_cfg {
diff --git a/include/xen/hvm.h b/include/xen/hvm.h
index b193fa2f9fdd..13e43e41637d 100644
--- a/include/xen/hvm.h
+++ b/include/xen/hvm.h
@@ -5,6 +5,36 @@
5#include <xen/interface/hvm/params.h> 5#include <xen/interface/hvm/params.h>
6#include <asm/xen/hypercall.h> 6#include <asm/xen/hypercall.h>
7 7
8static const char *param_name(int op)
9{
10#define PARAM(x) [HVM_PARAM_##x] = #x
11 static const char *const names[] = {
12 PARAM(CALLBACK_IRQ),
13 PARAM(STORE_PFN),
14 PARAM(STORE_EVTCHN),
15 PARAM(PAE_ENABLED),
16 PARAM(IOREQ_PFN),
17 PARAM(BUFIOREQ_PFN),
18 PARAM(TIMER_MODE),
19 PARAM(HPET_ENABLED),
20 PARAM(IDENT_PT),
21 PARAM(DM_DOMAIN),
22 PARAM(ACPI_S_STATE),
23 PARAM(VM86_TSS),
24 PARAM(VPT_ALIGN),
25 PARAM(CONSOLE_PFN),
26 PARAM(CONSOLE_EVTCHN),
27 };
28#undef PARAM
29
30 if (op >= ARRAY_SIZE(names))
31 return "unknown";
32
33 if (!names[op])
34 return "reserved";
35
36 return names[op];
37}
8static inline int hvm_get_parameter(int idx, uint64_t *value) 38static inline int hvm_get_parameter(int idx, uint64_t *value)
9{ 39{
10 struct xen_hvm_param xhv; 40 struct xen_hvm_param xhv;
@@ -14,8 +44,8 @@ static inline int hvm_get_parameter(int idx, uint64_t *value)
14 xhv.index = idx; 44 xhv.index = idx;
15 r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); 45 r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
16 if (r < 0) { 46 if (r < 0) {
17 printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n", 47 printk(KERN_ERR "Cannot get hvm parameter %s (%d): %d!\n",
18 idx, r); 48 param_name(idx), idx, r);
19 return r; 49 return r;
20 } 50 }
21 *value = xhv.value; 51 *value = xhv.value;
diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h
index 2090881c3650..f4942921e202 100644
--- a/include/xen/interface/event_channel.h
+++ b/include/xen/interface/event_channel.h
@@ -177,6 +177,19 @@ struct evtchn_unmask {
177 evtchn_port_t port; 177 evtchn_port_t port;
178}; 178};
179 179
180/*
181 * EVTCHNOP_reset: Close all event channels associated with specified domain.
182 * NOTES:
183 * 1. <dom> may be specified as DOMID_SELF.
184 * 2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
185 */
186#define EVTCHNOP_reset 10
187struct evtchn_reset {
188 /* IN parameters. */
189 domid_t dom;
190};
191typedef struct evtchn_reset evtchn_reset_t;
192
180struct evtchn_op { 193struct evtchn_op {
181 uint32_t cmd; /* EVTCHNOP_* */ 194 uint32_t cmd; /* EVTCHNOP_* */
182 union { 195 union {
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index 90712e2072d5..b40a4315cb8b 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -153,6 +153,14 @@ struct xen_machphys_mapping {
153}; 153};
154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t); 154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t);
155 155
156#define XENMAPSPACE_shared_info 0 /* shared info page */
157#define XENMAPSPACE_grant_table 1 /* grant table page */
158#define XENMAPSPACE_gmfn 2 /* GMFN */
159#define XENMAPSPACE_gmfn_range 3 /* GMFN range, XENMEM_add_to_physmap only. */
160#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom,
161 * XENMEM_add_to_physmap_range only.
162 */
163
156/* 164/*
157 * Sets the GPFN at which a particular page appears in the specified guest's 165 * Sets the GPFN at which a particular page appears in the specified guest's
158 * pseudophysical address space. 166 * pseudophysical address space.
@@ -167,8 +175,6 @@ struct xen_add_to_physmap {
167 uint16_t size; 175 uint16_t size;
168 176
169 /* Source mapping space. */ 177 /* Source mapping space. */
170#define XENMAPSPACE_shared_info 0 /* shared info page */
171#define XENMAPSPACE_grant_table 1 /* grant table page */
172 unsigned int space; 178 unsigned int space;
173 179
174 /* Index into source mapping space. */ 180 /* Index into source mapping space. */
@@ -182,6 +188,24 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
182/*** REMOVED ***/ 188/*** REMOVED ***/
183/*#define XENMEM_translate_gpfn_list 8*/ 189/*#define XENMEM_translate_gpfn_list 8*/
184 190
191#define XENMEM_add_to_physmap_range 23
192struct xen_add_to_physmap_range {
193 /* Which domain to change the mapping for. */
194 domid_t domid;
195 uint16_t space; /* => enum phys_map_space */
196
197 /* Number of pages to go through */
198 uint16_t size;
199 domid_t foreign_domid; /* IFF gmfn_foreign */
200
201 /* Indexes into space being mapped. */
202 GUEST_HANDLE(xen_ulong_t) idxs;
203
204 /* GPFN in domid where the source mapping page should appear. */
205 GUEST_HANDLE(xen_pfn_t) gpfns;
206};
207DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range);
208
185/* 209/*
186 * Returns the pseudo-physical memory map as it was when the domain 210 * Returns the pseudo-physical memory map as it was when the domain
187 * was started (specified by XENMEM_set_memory_map). 211 * was started (specified by XENMEM_set_memory_map).
@@ -217,4 +241,20 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);
217 * during a driver critical region. 241 * during a driver critical region.
218 */ 242 */
219extern spinlock_t xen_reservation_lock; 243extern spinlock_t xen_reservation_lock;
244
245/*
246 * Unmaps the page appearing at a particular GPFN from the specified guest's
247 * pseudophysical address space.
248 * arg == addr of xen_remove_from_physmap_t.
249 */
250#define XENMEM_remove_from_physmap 15
251struct xen_remove_from_physmap {
252 /* Which domain to change the mapping for. */
253 domid_t domid;
254
255 /* GPFN of the current mapping of the page. */
256 xen_pfn_t gpfn;
257};
258DEFINE_GUEST_HANDLE_STRUCT(xen_remove_from_physmap);
259
220#endif /* __XEN_PUBLIC_MEMORY_H__ */ 260#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index 4755b5fac9c7..5e36932ab407 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -324,6 +324,22 @@ struct xenpf_cpu_ol {
324}; 324};
325DEFINE_GUEST_HANDLE_STRUCT(xenpf_cpu_ol); 325DEFINE_GUEST_HANDLE_STRUCT(xenpf_cpu_ol);
326 326
327/*
328 * CMD 58 and 59 are reserved for cpu hotadd and memory hotadd,
329 * which are already occupied at Xen hypervisor side.
330 */
331#define XENPF_core_parking 60
332struct xenpf_core_parking {
333 /* IN variables */
334#define XEN_CORE_PARKING_SET 1
335#define XEN_CORE_PARKING_GET 2
336 uint32_t type;
337 /* IN variables: set cpu nums expected to be idled */
338 /* OUT variables: get cpu nums actually be idled */
339 uint32_t idle_nums;
340};
341DEFINE_GUEST_HANDLE_STRUCT(xenpf_core_parking);
342
327struct xen_platform_op { 343struct xen_platform_op {
328 uint32_t cmd; 344 uint32_t cmd;
329 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ 345 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -341,6 +357,7 @@ struct xen_platform_op {
341 struct xenpf_set_processor_pminfo set_pminfo; 357 struct xenpf_set_processor_pminfo set_pminfo;
342 struct xenpf_pcpuinfo pcpu_info; 358 struct xenpf_pcpuinfo pcpu_info;
343 struct xenpf_cpu_ol cpu_ol; 359 struct xenpf_cpu_ol cpu_ol;
360 struct xenpf_core_parking core_parking;
344 uint8_t pad[128]; 361 uint8_t pad[128];
345 } u; 362 } u;
346}; 363};
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 6a198e46ab6e..d6fe062cad6b 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -2,6 +2,7 @@
2#define INCLUDE_XEN_OPS_H 2#define INCLUDE_XEN_OPS_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <asm/xen/interface.h>
5 6
6DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 7DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
7 8
@@ -26,7 +27,11 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
26struct vm_area_struct; 27struct vm_area_struct;
27int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 28int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
28 unsigned long addr, 29 unsigned long addr,
29 unsigned long mfn, int nr, 30 xen_pfn_t mfn, int nr,
30 pgprot_t prot, unsigned domid); 31 pgprot_t prot, unsigned domid,
32 struct page **pages);
33int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
34 int numpgs, struct page **pages);
31 35
36bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
32#endif /* INCLUDE_XEN_OPS_H */ 37#endif /* INCLUDE_XEN_OPS_H */