aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/apei.h4
-rw-r--r--include/asm-generic/cputime.h64
-rw-r--r--include/asm-generic/gpio.h10
-rw-r--r--include/asm-generic/io.h6
-rw-r--r--include/asm-generic/iomap.h9
-rw-r--r--include/asm-generic/page.h10
-rw-r--r--include/asm-generic/pci_iomap.h25
-rw-r--r--include/asm-generic/socket.h3
-rw-r--r--include/asm-generic/tlb.h14
-rw-r--r--include/asm-generic/types.h6
-rw-r--r--include/asm-generic/uaccess.h7
-rw-r--r--include/crypto/algapi.h1
-rw-r--r--include/crypto/lrw.h43
-rw-r--r--include/crypto/serpent.h27
-rw-r--r--include/crypto/twofish.h2
-rw-r--r--include/crypto/xts.h27
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drm.h4
-rw-r--r--include/drm/drmP.h12
-rw-r--r--include/drm/drm_crtc.h214
-rw-r--r--include/drm/drm_crtc_helper.h5
-rw-r--r--include/drm/drm_fourcc.h137
-rw-r--r--include/drm/drm_mode.h74
-rw-r--r--include/drm/drm_pciids.h10
-rw-r--r--include/drm/drm_sman.h176
-rw-r--r--include/drm/exynos_drm.h37
-rw-r--r--include/drm/gma_drm.h91
-rw-r--r--include/drm/i915_drm.h40
-rw-r--r--include/drm/radeon_drm.h36
-rw-r--r--include/drm/sis_drm.h4
-rw-r--r--include/drm/ttm/ttm_bo_api.h24
-rw-r--r--include/drm/ttm/ttm_bo_driver.h203
-rw-r--r--include/drm/ttm/ttm_page_alloc.h77
-rw-r--r--include/drm/via_drm.h4
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/acpi.h4
-rw-r--r--include/linux/ahci_platform.h2
-rw-r--r--include/linux/amba/bus.h7
-rw-r--r--include/linux/amba/mmci.h2
-rw-r--r--include/linux/amba/pl022.h4
-rw-r--r--include/linux/amba/pl061.h2
-rw-r--r--include/linux/amba/pl330.h15
-rw-r--r--include/linux/amd-iommu.h138
-rw-r--r--include/linux/ata_platform.h3
-rw-r--r--include/linux/atmdev.h10
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/bcma/bcma.h55
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h1
-rw-r--r--include/linux/bitops.h10
-rw-r--r--include/linux/blkdev.h6
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/can/platform/cc770.h33
-rw-r--r--include/linux/cgroup.h33
-rw-r--r--include/linux/cgroup_subsys.h8
-rw-r--r--include/linux/clk.h22
-rw-r--r--include/linux/clocksource.h11
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/configfs.h2
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/cordic.h4
-rw-r--r--include/linux/cpu.h19
-rw-r--r--include/linux/cpuidle.h2
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/debugfs.h72
-rw-r--r--include/linux/debugobjects.h6
-rw-r--r--include/linux/device.h114
-rw-r--r--include/linux/digsig.h64
-rw-r--r--include/linux/display.h61
-rw-r--r--include/linux/dlm.h71
-rw-r--r--include/linux/dma-buf.h176
-rw-r--r--include/linux/dma_remapping.h2
-rw-r--r--include/linux/dynamic_queue_limits.h97
-rw-r--r--include/linux/edac.h8
-rw-r--r--include/linux/eeprom_93cx6.h8
-rw-r--r--include/linux/efi.h136
-rw-r--r--include/linux/elf-em.h1
-rw-r--r--include/linux/errqueue.h7
-rw-r--r--include/linux/ethtool.h116
-rw-r--r--include/linux/eventpoll.h1
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fb.h14
-rw-r--r--include/linux/freezer.h159
-rw-r--r--include/linux/fs.h121
-rw-r--r--include/linux/fuse.h16
-rw-r--r--include/linux/genetlink.h24
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfp.h23
-rw-r--r--include/linux/gfs2_ondisk.h2
-rw-r--r--include/linux/gpio-pxa.h16
-rw-r--r--include/linux/hardirq.h21
-rw-r--r--include/linux/hid.h21
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/hyperv.h2
-rw-r--r--include/linux/i2c.h13
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h32
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_team.h242
-rw-r--r--include/linux/if_vlan.h80
-rw-r--r--include/linux/inet_diag.h41
-rw-r--r--include/linux/init.h3
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/input/auo-pixcir-ts.h56
-rw-r--r--include/linux/input/gp2ap002a00f.h22
-rw-r--r--include/linux/input/gpio_tilt.h73
-rw-r--r--include/linux/input/pixcir_ts.h10
-rw-r--r--include/linux/input/samsung-keypad.h43
-rw-r--r--include/linux/input/tca8418_keypad.h44
-rw-r--r--include/linux/iommu.h33
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/irqdomain.h3
-rw-r--r--include/linux/iscsi_boot_sysfs.h8
-rw-r--r--include/linux/jbd.h5
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/jump_label.h27
-rw-r--r--include/linux/kernel.h30
-rw-r--r--include/linux/kernel_stat.h36
-rw-r--r--include/linux/key-type.h1
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kmsg_dump.h1
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kref.h77
-rw-r--r--include/linux/kthread.h1
-rw-r--r--include/linux/kvm.h1
-rw-r--r--include/linux/kvm_host.h39
-rw-r--r--include/linux/kvm_para.h1
-rw-r--r--include/linux/latencytop.h3
-rw-r--r--include/linux/leds-tca6507.h34
-rw-r--r--include/linux/lglock.h36
-rw-r--r--include/linux/linkage.h4
-rw-r--r--include/linux/lockd/lockd.h8
-rw-r--r--include/linux/lockdep.h4
-rw-r--r--include/linux/log2.h1
-rwxr-xr-xinclude/linux/lp8727.h51
-rw-r--r--include/linux/mbus.h13
-rw-r--r--include/linux/mdio-bitbang.h2
-rw-r--r--include/linux/mdio-gpio.h2
-rw-r--r--include/linux/memblock.h170
-rw-r--r--include/linux/memcontrol.h126
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/mempolicy.h10
-rw-r--r--include/linux/mfd/88pm860x.h3
-rw-r--r--include/linux/mfd/abx500/ab5500.h (renamed from include/linux/mfd/ab5500/ab5500.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-gpadc.h (renamed from include/linux/mfd/ab8500/gpadc.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h (renamed from include/linux/mfd/ab8500/gpio.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h (renamed from include/linux/mfd/ab8500/sysctrl.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500.h (renamed from include/linux/mfd/ab8500.h)0
-rw-r--r--include/linux/mfd/da9052/da9052.h131
-rw-r--r--include/linux/mfd/da9052/pdata.h40
-rw-r--r--include/linux/mfd/da9052/reg.h749
-rw-r--r--include/linux/mfd/max8925.h9
-rw-r--r--include/linux/mfd/max8997.h83
-rw-r--r--include/linux/mfd/mc13xxx.h9
-rw-r--r--include/linux/mfd/mcp.h7
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h373
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h100
-rw-r--r--include/linux/mfd/s5m87xx/s5m-rtc.h84
-rw-r--r--include/linux/mfd/stmpe.h16
-rw-r--r--include/linux/mfd/tps65910.h30
-rw-r--r--include/linux/mfd/ucb1x00.h5
-rw-r--r--include/linux/mfd/wm8994/core.h7
-rw-r--r--include/linux/mfd/wm8994/pdata.h31
-rw-r--r--include/linux/mfd/wm8994/registers.h112
-rw-r--r--include/linux/migrate.h23
-rw-r--r--include/linux/mii.h200
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mlx4/cmd.h51
-rw-r--r--include/linux/mlx4/device.h80
-rw-r--r--include/linux/mlx4/qp.h28
-rw-r--r--include/linux/mm.h73
-rw-r--r--include/linux/mm_inline.h44
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/card.h29
-rw-r--r--include/linux/mmc/cd-gpio.h19
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/dw_mmc.h1
-rw-r--r--include/linux/mmc/host.h27
-rw-r--r--include/linux/mmc/mmc.h72
-rw-r--r--include/linux/mmc/sdhci-pci-data.h18
-rw-r--r--include/linux/mmc/sdhci.h3
-rw-r--r--include/linux/mmc/sdio.h29
-rw-r--r--include/linux/mmzone.h42
-rw-r--r--include/linux/mnt_namespace.h31
-rw-r--r--include/linux/mod_devicetable.h29
-rw-r--r--include/linux/module.h21
-rw-r--r--include/linux/moduleparam.h17
-rw-r--r--include/linux/mount.h39
-rw-r--r--include/linux/mpi.h146
-rw-r--r--include/linux/msi.h3
-rw-r--r--include/linux/mtd/cfi.h16
-rw-r--r--include/linux/mtd/cfi_endian.h76
-rw-r--r--include/linux/mtd/map.h3
-rw-r--r--include/linux/mtd/mtd.h334
-rw-r--r--include/linux/mtd/nand.h1
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/neighbour.h1
-rw-r--r--include/linux/netdev_features.h146
-rw-r--r--include/linux/netdevice.h352
-rw-r--r--include/linux/netfilter.h26
-rw-r--r--include/linux/netfilter/Kbuild4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h27
-rw-r--r--include/linux/netfilter/nf_nat.h25
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h36
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_CT.h3
-rw-r--r--include/linux/netfilter/xt_ecn.h35
-rw-r--r--include/linux/netfilter/xt_nfacct.h13
-rw-r--r--include/linux/netfilter/xt_rpfilter.h23
-rw-r--r--include/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h38
-rw-r--r--include/linux/netfilter_ipv4/nf_nat.h58
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/nfc.h31
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_idmap.h8
-rw-r--r--include/linux/nfs_xdr.h22
-rw-r--r--include/linux/nl80211.h171
-rw-r--r--include/linux/nls.h5
-rw-r--r--include/linux/node.h6
-rw-r--r--include/linux/of.h44
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_gpio.h10
-rw-r--r--include/linux/oom.h2
-rw-r--r--include/linux/openvswitch.h452
-rw-r--r--include/linux/page-debug-flags.h4
-rw-r--r--include/linux/page_cgroup.h46
-rw-r--r--include/linux/pagevec.h19
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h51
-rw-r--r--include/linux/pci_ids.h23
-rw-r--r--include/linux/pci_regs.h36
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu.h190
-rw-r--r--include/linux/perf_event.h8
-rw-r--r--include/linux/phonet.h2
-rw-r--r--include/linux/phy.h7
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pinctrl/machine.h30
-rw-r--r--include/linux/pinctrl/pinconf.h97
-rw-r--r--include/linux/pinctrl/pinctrl.h15
-rw-r--r--include/linux/pinctrl/pinmux.h29
-rw-r--r--include/linux/pkt_sched.h52
-rw-r--r--include/linux/platform_data/macb.h17
-rw-r--r--include/linux/platform_data/mv_usb.h18
-rw-r--r--include/linux/platform_data/s3c-hsudc.h34
-rw-r--r--include/linux/platform_device.h44
-rw-r--r--include/linux/pm.h15
-rw-r--r--include/linux/pm_domain.h103
-rw-r--r--include/linux/pm_qos.h8
-rw-r--r--include/linux/pm_runtime.h5
-rw-r--r--include/linux/poison.h6
-rw-r--r--include/linux/power/charger-manager.h147
-rw-r--r--include/linux/power/sbs-battery.h (renamed from include/linux/power/bq20z75.h)10
-rw-r--r--include/linux/power_supply.h11
-rw-r--r--include/linux/prctl.h12
-rw-r--r--include/linux/proc_fs.h26
-rw-r--r--include/linux/pstore.h12
-rw-r--r--include/linux/radix-tree.h3
-rw-r--r--include/linux/raid/md_p.h7
-rw-r--r--include/linux/raid/pq.h2
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcupdate.h115
-rw-r--r--include/linux/regmap.h59
-rw-r--r--include/linux/regulator/consumer.h13
-rw-r--r--include/linux/regulator/driver.h4
-rw-r--r--include/linux/regulator/of_regulator.h22
-rw-r--r--include/linux/reiserfs_fs.h9
-rw-r--r--include/linux/reiserfs_fs_sb.h4
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/rmap.h5
-rw-r--r--include/linux/s3c_adc_battery.h4
-rw-r--r--include/linux/sched.h111
-rw-r--r--include/linux/security.h72
-rw-r--r--include/linux/seq_file.h10
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h104
-rw-r--r--include/linux/serial_sci.h22
-rw-r--r--include/linux/sh_clk.h10
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/sh_pfc.h22
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/sigma.h55
-rw-r--r--include/linux/signal.h1
-rw-r--r--include/linux/skbuff.h86
-rw-r--r--include/linux/slab_def.h2
-rw-r--r--include/linux/smscphy.h25
-rw-r--r--include/linux/sock_diag.h48
-rw-r--r--include/linux/spi/spi.h11
-rw-r--r--include/linux/srcu.h87
-rw-r--r--include/linux/ssb/ssb.h9
-rw-r--r--include/linux/ssb/ssb_regs.h17
-rw-r--r--include/linux/sunrpc/auth.h3
-rw-r--r--include/linux/sunrpc/auth_gss.h2
-rw-r--r--include/linux/sunrpc/cache.h2
-rw-r--r--include/linux/sunrpc/clnt.h8
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xdr.h2
-rw-r--r--include/linux/suspend.h35
-rw-r--r--include/linux/swap.h1
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/syscalls.h24
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h8
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/tick.h11
-rw-r--r--include/linux/types.h3
-rw-r--r--include/linux/ucb1400.h6
-rw-r--r--include/linux/unix_diag.h54
-rw-r--r--include/linux/usb.h28
-rw-r--r--include/linux/usb/ch11.h31
-rw-r--r--include/linux/usb/ch9.h20
-rw-r--r--include/linux/usb/gadget.h26
-rw-r--r--include/linux/usb/hcd.h2
-rw-r--r--include/linux/usb/renesas_usbhs.h10
-rw-r--r--include/linux/usb/serial.h11
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/linux/virtio.h75
-rw-r--r--include/linux/virtio_config.h14
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--include/linux/wait.h4
-rw-r--r--include/linux/wanrouter.h2
-rw-r--r--include/linux/watchdog.h21
-rw-r--r--include/linux/wl12xx.h5
-rw-r--r--include/linux/workqueue.h47
-rw-r--r--include/linux/writeback.h12
-rw-r--r--include/linux/zorro_ids.h4
-rw-r--r--include/media/davinci/vpif_types.h71
-rw-r--r--include/media/soc_camera.h7
-rw-r--r--include/mtd/mtd-abi.h3
-rw-r--r--include/net/9p/9p.h28
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/af_unix.h6
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/atmclip.h7
-rw-r--r--include/net/bluetooth/bluetooth.h56
-rw-r--r--include/net/bluetooth/hci.h83
-rw-r--r--include/net/bluetooth/hci_core.h370
-rw-r--r--include/net/bluetooth/l2cap.h457
-rw-r--r--include/net/bluetooth/mgmt.h251
-rw-r--r--include/net/bluetooth/smp.h6
-rw-r--r--include/net/caif/caif_dev.h21
-rw-r--r--include/net/caif/caif_layer.h4
-rw-r--r--include/net/caif/caif_spi.h4
-rw-r--r--include/net/caif/cfcnfg.h23
-rw-r--r--include/net/caif/cfserl.h4
-rw-r--r--include/net/cfg80211.h269
-rw-r--r--include/net/dsa.h144
-rw-r--r--include/net/dst.h7
-rw-r--r--include/net/flow.h6
-rw-r--r--include/net/flow_keys.h16
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/icmp.h4
-rw-r--r--include/net/ieee80211_radiotap.h8
-rw-r--r--include/net/ieee802154.h6
-rw-r--r--include/net/inet6_hashtables.h4
-rw-r--r--include/net/inet_connection_sock.h6
-rw-r--r--include/net/inet_sock.h6
-rw-r--r--include/net/inet_timewait_sock.h12
-rw-r--r--include/net/inetpeer.h2
-rw-r--r--include/net/ip.h8
-rw-r--r--include/net/ip6_fib.h7
-rw-r--r--include/net/ip6_route.h6
-rw-r--r--include/net/ip_vs.h10
-rw-r--r--include/net/ipv6.h22
-rw-r--r--include/net/iucv/af_iucv.h2
-rw-r--r--include/net/mac80211.h64
-rw-r--r--include/net/ndisc.h45
-rw-r--r--include/net/neighbour.h17
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h4
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h1
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h1
-rw-r--r--include/net/netfilter/nf_nat.h10
-rw-r--r--include/net/netfilter/nf_nat_core.h2
-rw-r--r--include/net/netfilter/nf_nat_protocol.h17
-rw-r--r--include/net/netfilter/nf_tproxy_core.h2
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--include/net/netns/mib.h6
-rw-r--r--include/net/netns/xfrm.h2
-rw-r--r--include/net/netprio_cgroup.h57
-rw-r--r--include/net/nfc/nci.h178
-rw-r--r--include/net/nfc/nci_core.h13
-rw-r--r--include/net/nfc/nfc.h24
-rw-r--r--include/net/protocol.h12
-rw-r--r--include/net/red.h190
-rw-r--r--include/net/regulatory.h6
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sctp/structs.h9
-rw-r--r--include/net/snmp.h18
-rw-r--r--include/net/sock.h281
-rw-r--r--include/net/tcp.h25
-rw-r--r--include/net/tcp_memcontrol.h19
-rw-r--r--include/net/udp.h13
-rw-r--r--include/net/xfrm.h12
-rw-r--r--include/rdma/ib_addr.h2
-rw-r--r--include/rdma/ib_cm.h3
-rw-r--r--include/scsi/libfcoe.h3
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_host.h3
-rw-r--r--include/scsi/scsi_transport_iscsi.h7
-rw-r--r--include/sound/Kbuild2
-rw-r--r--include/sound/compress_driver.h167
-rw-r--r--include/sound/compress_offload.h161
-rw-r--r--include/sound/compress_params.h397
-rw-r--r--include/sound/control.h8
-rw-r--r--include/sound/core.h1
-rw-r--r--include/sound/info.h2
-rw-r--r--include/sound/minors.h4
-rw-r--r--include/sound/saif.h4
-rw-r--r--include/sound/sh_fsi.h12
-rw-r--r--include/sound/soc-dapm.h5
-rw-r--r--include/sound/soc.h27
-rw-r--r--include/sound/sta32x.h35
-rw-r--r--include/sound/wm8903.h7
-rw-r--r--include/trace/events/ext4.h6
-rw-r--r--include/trace/events/kmem.h4
-rw-r--r--include/trace/events/oom.h33
-rw-r--r--include/trace/events/rcu.h122
-rw-r--r--include/trace/events/regmap.h9
-rw-r--r--include/trace/events/sched.h57
-rw-r--r--include/trace/events/task.h61
-rw-r--r--include/trace/events/vmscan.h22
-rw-r--r--include/trace/events/writeback.h29
-rw-r--r--include/video/omapdss.h58
-rw-r--r--include/video/sh_mipi_dsi.h21
-rw-r--r--include/video/sh_mobile_lcdc.h4
-rw-r--r--include/xen/balloon.h6
-rw-r--r--include/xen/events.h7
-rw-r--r--include/xen/grant_table.h37
-rw-r--r--include/xen/interface/grant_table.h167
-rw-r--r--include/xen/interface/io/xs_wire.h6
-rw-r--r--include/xen/interface/xen.h2
-rw-r--r--include/xen/xenbus.h31
-rw-r--r--include/xen/xenbus_dev.h41
447 files changed, 13049 insertions, 3469 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index f554a9313b43..7762bc2d8404 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -66,7 +66,7 @@ extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_use_default_register_widths; 66extern u8 acpi_gbl_use_default_register_widths;
67extern acpi_name acpi_gbl_trace_method_name; 67extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags; 68extern u32 acpi_gbl_trace_flags;
69extern u32 acpi_gbl_enable_aml_debug_object; 69extern bool acpi_gbl_enable_aml_debug_object;
70extern u8 acpi_gbl_copy_dsdt_locally; 70extern u8 acpi_gbl_copy_dsdt_locally;
71extern u8 acpi_gbl_truncate_io_addresses; 71extern u8 acpi_gbl_truncate_io_addresses;
72extern u8 acpi_gbl_disable_auto_repair; 72extern u8 acpi_gbl_disable_auto_repair;
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
index 51a527d24a8a..04f349d8da73 100644
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -16,10 +16,10 @@
16 16
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18 18
19extern int hest_disable; 19extern bool hest_disable;
20extern int erst_disable; 20extern int erst_disable;
21#ifdef CONFIG_ACPI_APEI_GHES 21#ifdef CONFIG_ACPI_APEI_GHES
22extern int ghes_disable; 22extern bool ghes_disable;
23#else 23#else
24#define ghes_disable 1 24#define ghes_disable 1
25#endif 25#endif
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 62ce6823c0f2..9a62937c56ca 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -4,70 +4,66 @@
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/jiffies.h> 5#include <linux/jiffies.h>
6 6
7typedef unsigned long cputime_t; 7typedef unsigned long __nocast cputime_t;
8 8
9#define cputime_zero (0UL)
10#define cputime_one_jiffy jiffies_to_cputime(1) 9#define cputime_one_jiffy jiffies_to_cputime(1)
11#define cputime_max ((~0UL >> 1) - 1) 10#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct)
12#define cputime_add(__a, __b) ((__a) + (__b))
13#define cputime_sub(__a, __b) ((__a) - (__b))
14#define cputime_div(__a, __n) ((__a) / (__n))
15#define cputime_halve(__a) ((__a) >> 1)
16#define cputime_eq(__a, __b) ((__a) == (__b))
17#define cputime_gt(__a, __b) ((__a) > (__b))
18#define cputime_ge(__a, __b) ((__a) >= (__b))
19#define cputime_lt(__a, __b) ((__a) < (__b))
20#define cputime_le(__a, __b) ((__a) <= (__b))
21#define cputime_to_jiffies(__ct) (__ct)
22#define cputime_to_scaled(__ct) (__ct) 11#define cputime_to_scaled(__ct) (__ct)
23#define jiffies_to_cputime(__hz) (__hz) 12#define jiffies_to_cputime(__hz) (__force cputime_t)(__hz)
24 13
25typedef u64 cputime64_t; 14typedef u64 __nocast cputime64_t;
26 15
27#define cputime64_zero (0ULL) 16#define cputime64_to_jiffies64(__ct) (__force u64)(__ct)
28#define cputime64_add(__a, __b) ((__a) + (__b)) 17#define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif)
29#define cputime64_sub(__a, __b) ((__a) - (__b))
30#define cputime64_to_jiffies64(__ct) (__ct)
31#define jiffies64_to_cputime64(__jif) (__jif)
32#define cputime_to_cputime64(__ct) ((u64) __ct)
33#define cputime64_gt(__a, __b) ((__a) > (__b))
34 18
35#define nsecs_to_cputime64(__ct) nsecs_to_jiffies64(__ct) 19#define nsecs_to_cputime64(__ct) \
20 jiffies64_to_cputime64(nsecs_to_jiffies64(__ct))
36 21
37 22
38/* 23/*
39 * Convert cputime to microseconds and back. 24 * Convert cputime to microseconds and back.
40 */ 25 */
41#define cputime_to_usecs(__ct) jiffies_to_usecs(__ct) 26#define cputime_to_usecs(__ct) \
42#define usecs_to_cputime(__msecs) usecs_to_jiffies(__msecs) 27 jiffies_to_usecs(cputime_to_jiffies(__ct))
28#define usecs_to_cputime(__usec) \
29 jiffies_to_cputime(usecs_to_jiffies(__usec))
30#define usecs_to_cputime64(__usec) \
31 jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000))
43 32
44/* 33/*
45 * Convert cputime to seconds and back. 34 * Convert cputime to seconds and back.
46 */ 35 */
47#define cputime_to_secs(jif) ((jif) / HZ) 36#define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ)
48#define secs_to_cputime(sec) ((sec) * HZ) 37#define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ)
49 38
50/* 39/*
51 * Convert cputime to timespec and back. 40 * Convert cputime to timespec and back.
52 */ 41 */
53#define timespec_to_cputime(__val) timespec_to_jiffies(__val) 42#define timespec_to_cputime(__val) \
54#define cputime_to_timespec(__ct,__val) jiffies_to_timespec(__ct,__val) 43 jiffies_to_cputime(timespec_to_jiffies(__val))
44#define cputime_to_timespec(__ct,__val) \
45 jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
55 46
56/* 47/*
57 * Convert cputime to timeval and back. 48 * Convert cputime to timeval and back.
58 */ 49 */
59#define timeval_to_cputime(__val) timeval_to_jiffies(__val) 50#define timeval_to_cputime(__val) \
60#define cputime_to_timeval(__ct,__val) jiffies_to_timeval(__ct,__val) 51 jiffies_to_cputime(timeval_to_jiffies(__val))
52#define cputime_to_timeval(__ct,__val) \
53 jiffies_to_timeval(cputime_to_jiffies(__ct),__val)
61 54
62/* 55/*
63 * Convert cputime to clock and back. 56 * Convert cputime to clock and back.
64 */ 57 */
65#define cputime_to_clock_t(__ct) jiffies_to_clock_t(__ct) 58#define cputime_to_clock_t(__ct) \
66#define clock_t_to_cputime(__x) clock_t_to_jiffies(__x) 59 jiffies_to_clock_t(cputime_to_jiffies(__ct))
60#define clock_t_to_cputime(__x) \
61 jiffies_to_cputime(clock_t_to_jiffies(__x))
67 62
68/* 63/*
69 * Convert cputime64 to clock. 64 * Convert cputime64 to clock.
70 */ 65 */
71#define cputime64_to_clock_t(__ct) jiffies_64_to_clock_t(__ct) 66#define cputime64_to_clock_t(__ct) \
67 jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct))
72 68
73#endif 69#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 8c8621097fa0..1ff4e221cb4d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -4,6 +4,7 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
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 8
8#ifdef CONFIG_GPIOLIB 9#ifdef CONFIG_GPIOLIB
9 10
@@ -128,13 +129,14 @@ struct gpio_chip {
128 */ 129 */
129 struct device_node *of_node; 130 struct device_node *of_node;
130 int of_gpio_n_cells; 131 int of_gpio_n_cells;
131 int (*of_xlate)(struct gpio_chip *gc, struct device_node *np, 132 int (*of_xlate)(struct gpio_chip *gc,
132 const void *gpio_spec, u32 *flags); 133 const struct of_phandle_args *gpiospec, u32 *flags);
133#endif 134#endif
134}; 135};
135 136
136extern const char *gpiochip_is_requested(struct gpio_chip *chip, 137extern const char *gpiochip_is_requested(struct gpio_chip *chip,
137 unsigned offset); 138 unsigned offset);
139extern struct gpio_chip *gpio_to_chip(unsigned gpio);
138extern int __must_check gpiochip_reserve(int start, int ngpio); 140extern int __must_check gpiochip_reserve(int start, int ngpio);
139 141
140/* add/remove chips */ 142/* add/remove chips */
@@ -175,6 +177,10 @@ extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *labe
175extern int gpio_request_array(const struct gpio *array, size_t num); 177extern int gpio_request_array(const struct gpio *array, size_t num);
176extern void gpio_free_array(const struct gpio *array, size_t num); 178extern void gpio_free_array(const struct gpio *array, size_t num);
177 179
180/* bindings for managed devices that want to request gpios */
181int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
182void devm_gpio_free(struct device *dev, unsigned int gpio);
183
178#ifdef CONFIG_GPIO_SYSFS 184#ifdef CONFIG_GPIO_SYSFS
179 185
180/* 186/*
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 912088773a69..448303bdb85f 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -19,6 +19,8 @@
19#include <asm-generic/iomap.h> 19#include <asm-generic/iomap.h>
20#endif 20#endif
21 21
22#include <asm-generic/pci_iomap.h>
23
22#ifndef mmiowb 24#ifndef mmiowb
23#define mmiowb() do {} while (0) 25#define mmiowb() do {} while (0)
24#endif 26#endif
@@ -283,9 +285,7 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
283#define __io_virt(x) ((void __force *) (x)) 285#define __io_virt(x) ((void __force *) (x))
284 286
285#ifndef CONFIG_GENERIC_IOMAP 287#ifndef CONFIG_GENERIC_IOMAP
286/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
287struct pci_dev; 288struct pci_dev;
288extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
289static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 289static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
290{ 290{
291} 291}
@@ -327,7 +327,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
327#define ioremap_wc ioremap_nocache 327#define ioremap_wc ioremap_nocache
328#endif 328#endif
329 329
330static inline void iounmap(void *addr) 330static inline void iounmap(void __iomem *addr)
331{ 331{
332} 332}
333#endif /* CONFIG_MMU */ 333#endif /* CONFIG_MMU */
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 98dcd76ce836..8a3d4fde2604 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -67,18 +67,15 @@ extern void ioport_unmap(void __iomem *);
67#endif 67#endif
68 68
69#ifdef CONFIG_PCI 69#ifdef CONFIG_PCI
70/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
71struct pci_dev; 71struct pci_dev;
72extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
73extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 72extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
74#else 73#else
75struct pci_dev; 74struct pci_dev;
76static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
77{
78 return NULL;
79}
80static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
81{ } 76{ }
82#endif 77#endif
83 78
79#include <asm-generic/pci_iomap.h>
80
84#endif 81#endif
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index 351889d1de19..37d1fe28960a 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -71,10 +71,14 @@ extern unsigned long memory_end;
71#define PAGE_OFFSET (0) 71#define PAGE_OFFSET (0)
72#endif 72#endif
73 73
74#ifndef ARCH_PFN_OFFSET
75#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
76#endif
77
74#ifndef __ASSEMBLY__ 78#ifndef __ASSEMBLY__
75 79
76#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) 80#define __va(x) ((void *)((unsigned long) (x)))
77#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 81#define __pa(x) ((unsigned long) (x))
78 82
79#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 83#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
80#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 84#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
@@ -86,7 +90,7 @@ extern unsigned long memory_end;
86#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 90#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
87#endif 91#endif
88 92
89#define pfn_valid(pfn) ((pfn) < max_mapnr) 93#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
90 94
91#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 95#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
92 ((void *)(kaddr) < (void *)memory_end)) 96 ((void *)(kaddr) < (void *)memory_end))
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
new file mode 100644
index 000000000000..8de4b73e19e2
--- /dev/null
+++ b/include/asm-generic/pci_iomap.h
@@ -0,0 +1,25 @@
1/* Generic I/O port emulation, based on MN10300 code
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef __ASM_GENERIC_PCI_IOMAP_H
12#define __ASM_GENERIC_PCI_IOMAP_H
13
14struct pci_dev;
15#ifdef CONFIG_PCI
16/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
17extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
18#else
19static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
20{
21 return NULL;
22}
23#endif
24
25#endif /* __ASM_GENERIC_IO_H */
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index 9a6115e7cf63..49c1704173e7 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -64,4 +64,7 @@
64#define SO_DOMAIN 39 64#define SO_DOMAIN 39
65 65
66#define SO_RXQ_OVFL 40 66#define SO_RXQ_OVFL 40
67
68#define SO_WIFI_STATUS 41
69#define SCM_WIFI_STATUS SO_WIFI_STATUS
67#endif /* __ASM_GENERIC_SOCKET_H */ 70#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index e58fa777fa09..f96a5b58a975 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -139,6 +139,20 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
139 __tlb_remove_tlb_entry(tlb, ptep, address); \ 139 __tlb_remove_tlb_entry(tlb, ptep, address); \
140 } while (0) 140 } while (0)
141 141
142/**
143 * tlb_remove_pmd_tlb_entry - remember a pmd mapping for later tlb invalidation
144 * This is a nop so far, because only x86 needs it.
145 */
146#ifndef __tlb_remove_pmd_tlb_entry
147#define __tlb_remove_pmd_tlb_entry(tlb, pmdp, address) do {} while (0)
148#endif
149
150#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
151 do { \
152 tlb->need_flush = 1; \
153 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
154 } while (0)
155
142#define pte_free_tlb(tlb, ptep, address) \ 156#define pte_free_tlb(tlb, ptep, address) \
143 do { \ 157 do { \
144 tlb->need_flush = 1; \ 158 tlb->need_flush = 1; \
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
index 7a0f69e6c618..bd39806013b5 100644
--- a/include/asm-generic/types.h
+++ b/include/asm-generic/types.h
@@ -6,10 +6,4 @@
6 */ 6 */
7#include <asm-generic/int-ll64.h> 7#include <asm-generic/int-ll64.h>
8 8
9#ifndef __ASSEMBLY__
10
11typedef unsigned short umode_t;
12
13#endif /* __ASSEMBLY__ */
14
15#endif /* _ASM_GENERIC_TYPES_H */ 9#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index ac68c999b6c2..9788568f7978 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -289,9 +289,14 @@ strncpy_from_user(char *dst, const char __user *src, long count)
289 * Return 0 on exception, a value greater than N if too long 289 * Return 0 on exception, a value greater than N if too long
290 */ 290 */
291#ifndef __strnlen_user 291#ifndef __strnlen_user
292#define __strnlen_user strnlen 292#define __strnlen_user(s, n) (strnlen((s), (n)) + 1)
293#endif 293#endif
294 294
295/*
296 * Unlike strnlen, strnlen_user includes the nul terminator in
297 * its returned count. Callers should check for a returned value
298 * greater than N as an indication the string is too long.
299 */
295static inline long strnlen_user(const char __user *src, long n) 300static inline long strnlen_user(const char __user *src, long n)
296{ 301{
297 if (!access_ok(VERIFY_READ, src, 1)) 302 if (!access_ok(VERIFY_READ, src, 1))
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index ecc721def10c..418d270e1806 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -134,6 +134,7 @@ struct crypto_template *crypto_lookup_template(const char *name);
134 134
135int crypto_register_instance(struct crypto_template *tmpl, 135int crypto_register_instance(struct crypto_template *tmpl,
136 struct crypto_instance *inst); 136 struct crypto_instance *inst);
137int crypto_unregister_instance(struct crypto_alg *alg);
137 138
138int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 139int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
139 struct crypto_instance *inst, u32 mask); 140 struct crypto_instance *inst, u32 mask);
diff --git a/include/crypto/lrw.h b/include/crypto/lrw.h
new file mode 100644
index 000000000000..25a2c8716375
--- /dev/null
+++ b/include/crypto/lrw.h
@@ -0,0 +1,43 @@
1#ifndef _CRYPTO_LRW_H
2#define _CRYPTO_LRW_H
3
4#include <crypto/b128ops.h>
5
6struct scatterlist;
7struct gf128mul_64k;
8struct blkcipher_desc;
9
10#define LRW_BLOCK_SIZE 16
11
12struct lrw_table_ctx {
13 /* optimizes multiplying a random (non incrementing, as at the
14 * start of a new sector) value with key2, we could also have
15 * used 4k optimization tables or no optimization at all. In the
16 * latter case we would have to store key2 here */
17 struct gf128mul_64k *table;
18 /* stores:
19 * key2*{ 0,0,...0,0,0,0,1 }, key2*{ 0,0,...0,0,0,1,1 },
20 * key2*{ 0,0,...0,0,1,1,1 }, key2*{ 0,0,...0,1,1,1,1 }
21 * key2*{ 0,0,...1,1,1,1,1 }, etc
22 * needed for optimized multiplication of incrementing values
23 * with key2 */
24 be128 mulinc[128];
25};
26
27int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak);
28void lrw_free_table(struct lrw_table_ctx *ctx);
29
30struct lrw_crypt_req {
31 be128 *tbuf;
32 unsigned int tbuflen;
33
34 struct lrw_table_ctx *table_ctx;
35 void *crypt_ctx;
36 void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes);
37};
38
39int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
40 struct scatterlist *src, unsigned int nbytes,
41 struct lrw_crypt_req *req);
42
43#endif /* _CRYPTO_LRW_H */
diff --git a/include/crypto/serpent.h b/include/crypto/serpent.h
new file mode 100644
index 000000000000..b7e0941eb6fc
--- /dev/null
+++ b/include/crypto/serpent.h
@@ -0,0 +1,27 @@
1/*
2 * Common values for serpent algorithms
3 */
4
5#ifndef _CRYPTO_SERPENT_H
6#define _CRYPTO_SERPENT_H
7
8#include <linux/types.h>
9#include <linux/crypto.h>
10
11#define SERPENT_MIN_KEY_SIZE 0
12#define SERPENT_MAX_KEY_SIZE 32
13#define SERPENT_EXPKEY_WORDS 132
14#define SERPENT_BLOCK_SIZE 16
15
16struct serpent_ctx {
17 u32 expkey[SERPENT_EXPKEY_WORDS];
18};
19
20int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key,
21 unsigned int keylen);
22int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
23
24void __serpent_encrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src);
25void __serpent_decrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src);
26
27#endif
diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h
index c408522595c6..095c901a8af3 100644
--- a/include/crypto/twofish.h
+++ b/include/crypto/twofish.h
@@ -17,6 +17,8 @@ struct twofish_ctx {
17 u32 s[4][256], w[8], k[32]; 17 u32 s[4][256], w[8], k[32];
18}; 18};
19 19
20int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key,
21 unsigned int key_len, u32 *flags);
20int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); 22int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len);
21 23
22#endif 24#endif
diff --git a/include/crypto/xts.h b/include/crypto/xts.h
new file mode 100644
index 000000000000..72c09eb56437
--- /dev/null
+++ b/include/crypto/xts.h
@@ -0,0 +1,27 @@
1#ifndef _CRYPTO_XTS_H
2#define _CRYPTO_XTS_H
3
4#include <crypto/b128ops.h>
5
6struct scatterlist;
7struct blkcipher_desc;
8
9#define XTS_BLOCK_SIZE 16
10
11struct xts_crypt_req {
12 be128 *tbuf;
13 unsigned int tbuflen;
14
15 void *tweak_ctx;
16 void (*tweak_fn)(void *ctx, u8* dst, const u8* src);
17 void *crypt_ctx;
18 void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes);
19};
20
21#define XTS_TWEAK_CAST(x) ((void (*)(void *, u8*, const u8*))(x))
22
23int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
24 struct scatterlist *src, unsigned int nbytes,
25 struct xts_crypt_req *req);
26
27#endif /* _CRYPTO_XTS_H */
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index 3a60ac889520..a5c0e10fd47d 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,4 +1,5 @@
1header-y += drm.h 1header-y += drm.h
2header-y += drm_fourcc.h
2header-y += drm_mode.h 3header-y += drm_mode.h
3header-y += drm_sarea.h 4header-y += drm_sarea.h
4header-y += i810_drm.h 5header-y += i810_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4ca2f8..49d94ede2ec2 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -714,6 +714,10 @@ struct drm_get_cap {
714#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 714#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
715#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 715#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)
716#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) 716#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
717#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
718#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)
719#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)
720#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
717 721
718/** 722/**
719 * Device specific ioctls should only be in their respective headers 723 * Device specific ioctls should only be in their respective headers
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1f9e9516e2b7..76caa67c22e2 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -820,7 +820,7 @@ struct drm_driver {
820 * Specifically, the timestamp in @vblank_time should correspond as 820 * Specifically, the timestamp in @vblank_time should correspond as
821 * closely as possible to the time when the first video scanline of 821 * closely as possible to the time when the first video scanline of
822 * the video frame after the end of VBLANK will start scanning out, 822 * the video frame after the end of VBLANK will start scanning out,
823 * the time immmediately after end of the VBLANK interval. If the 823 * the time immediately after end of the VBLANK interval. If the
824 * @crtc is currently inside VBLANK, this will be a time in the future. 824 * @crtc is currently inside VBLANK, this will be a time in the future.
825 * If the @crtc is currently scanning out a frame, this will be the 825 * If the @crtc is currently scanning out a frame, this will be the
826 * past start time of the current scanout. This is meant to adhere 826 * past start time of the current scanout. This is meant to adhere
@@ -918,7 +918,7 @@ struct drm_driver {
918 int dev_priv_size; 918 int dev_priv_size;
919 struct drm_ioctl_desc *ioctls; 919 struct drm_ioctl_desc *ioctls;
920 int num_ioctls; 920 int num_ioctls;
921 struct file_operations fops; 921 const struct file_operations *fops;
922 union { 922 union {
923 struct pci_driver *pci; 923 struct pci_driver *pci;
924 struct platform_device *platform_device; 924 struct platform_device *platform_device;
@@ -1696,5 +1696,13 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_device
1696extern int drm_get_platform_dev(struct platform_device *pdev, 1696extern int drm_get_platform_dev(struct platform_device *pdev,
1697 struct drm_driver *driver); 1697 struct drm_driver *driver);
1698 1698
1699/* returns true if currently okay to sleep */
1700static __inline__ bool drm_can_sleep(void)
1701{
1702 if (in_atomic() || in_dbg_master() || irqs_disabled())
1703 return false;
1704 return true;
1705}
1706
1699#endif /* __KERNEL__ */ 1707#endif /* __KERNEL__ */
1700#endif 1708#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 802079809282..4cd4be26722c 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -29,9 +29,10 @@
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/idr.h> 31#include <linux/idr.h>
32
33#include <linux/fb.h> 32#include <linux/fb.h>
34 33
34#include <drm/drm_fourcc.h>
35
35struct drm_device; 36struct drm_device;
36struct drm_mode_set; 37struct drm_mode_set;
37struct drm_framebuffer; 38struct drm_framebuffer;
@@ -44,6 +45,7 @@ struct drm_framebuffer;
44#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 45#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
45#define DRM_MODE_OBJECT_FB 0xfbfbfbfb 46#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
46#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 47#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
48#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
47 49
48struct drm_mode_object { 50struct drm_mode_object {
49 uint32_t id; 51 uint32_t id;
@@ -118,7 +120,6 @@ struct drm_display_mode {
118 120
119 char name[DRM_DISPLAY_MODE_LEN]; 121 char name[DRM_DISPLAY_MODE_LEN];
120 122
121 int connector_count;
122 enum drm_mode_status status; 123 enum drm_mode_status status;
123 int type; 124 int type;
124 125
@@ -238,13 +239,15 @@ struct drm_framebuffer {
238 struct list_head head; 239 struct list_head head;
239 struct drm_mode_object base; 240 struct drm_mode_object base;
240 const struct drm_framebuffer_funcs *funcs; 241 const struct drm_framebuffer_funcs *funcs;
241 unsigned int pitch; 242 unsigned int pitches[4];
243 unsigned int offsets[4];
242 unsigned int width; 244 unsigned int width;
243 unsigned int height; 245 unsigned int height;
244 /* depth can be 15 or 16 */ 246 /* depth can be 15 or 16 */
245 unsigned int depth; 247 unsigned int depth;
246 int bits_per_pixel; 248 int bits_per_pixel;
247 int flags; 249 int flags;
250 uint32_t pixel_format; /* fourcc format */
248 struct list_head filp_head; 251 struct list_head filp_head;
249 /* if you are using the helper */ 252 /* if you are using the helper */
250 void *helper_private; 253 void *helper_private;
@@ -278,6 +281,7 @@ struct drm_crtc;
278struct drm_connector; 281struct drm_connector;
279struct drm_encoder; 282struct drm_encoder;
280struct drm_pending_vblank_event; 283struct drm_pending_vblank_event;
284struct drm_plane;
281 285
282/** 286/**
283 * drm_crtc_funcs - control CRTCs for a given device 287 * drm_crtc_funcs - control CRTCs for a given device
@@ -341,10 +345,21 @@ struct drm_crtc_funcs {
341 345
342/** 346/**
343 * drm_crtc - central CRTC control structure 347 * drm_crtc - central CRTC control structure
348 * @dev: parent DRM device
349 * @head: list management
350 * @base: base KMS object for ID tracking etc.
344 * @enabled: is this CRTC enabled? 351 * @enabled: is this CRTC enabled?
352 * @mode: current mode timings
353 * @hwmode: mode timings as programmed to hw regs
345 * @x: x position on screen 354 * @x: x position on screen
346 * @y: y position on screen 355 * @y: y position on screen
347 * @funcs: CRTC control functions 356 * @funcs: CRTC control functions
357 * @gamma_size: size of gamma ramp
358 * @gamma_store: gamma ramp values
359 * @framedur_ns: precise frame timing
360 * @framedur_ns: precise line timing
361 * @pixeldur_ns: precise pixel timing
362 * @helper_private: mid-layer private data
348 * 363 *
349 * Each CRTC may have one or more connectors associated with it. This structure 364 * Each CRTC may have one or more connectors associated with it. This structure
350 * allows the CRTC to be controlled. 365 * allows the CRTC to be controlled.
@@ -423,6 +438,13 @@ struct drm_connector_funcs {
423 void (*force)(struct drm_connector *connector); 438 void (*force)(struct drm_connector *connector);
424}; 439};
425 440
441/**
442 * drm_encoder_funcs - encoder controls
443 * @reset: reset state (e.g. at init or resume time)
444 * @destroy: cleanup and free associated data
445 *
446 * Encoders sit between CRTCs and connectors.
447 */
426struct drm_encoder_funcs { 448struct drm_encoder_funcs {
427 void (*reset)(struct drm_encoder *encoder); 449 void (*reset)(struct drm_encoder *encoder);
428 void (*destroy)(struct drm_encoder *encoder); 450 void (*destroy)(struct drm_encoder *encoder);
@@ -431,10 +453,22 @@ struct drm_encoder_funcs {
431#define DRM_CONNECTOR_MAX_UMODES 16 453#define DRM_CONNECTOR_MAX_UMODES 16
432#define DRM_CONNECTOR_MAX_PROPERTY 16 454#define DRM_CONNECTOR_MAX_PROPERTY 16
433#define DRM_CONNECTOR_LEN 32 455#define DRM_CONNECTOR_LEN 32
434#define DRM_CONNECTOR_MAX_ENCODER 2 456#define DRM_CONNECTOR_MAX_ENCODER 3
435 457
436/** 458/**
437 * drm_encoder - central DRM encoder structure 459 * drm_encoder - central DRM encoder structure
460 * @dev: parent DRM device
461 * @head: list management
462 * @base: base KMS object
463 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h
464 * @possible_crtcs: bitmask of potential CRTC bindings
465 * @possible_clones: bitmask of potential sibling encoders for cloning
466 * @crtc: currently bound CRTC
467 * @funcs: control functions
468 * @helper_private: mid-layer private data
469 *
470 * CRTCs drive pixels to encoders, which convert them into signals
471 * appropriate for a given connector or set of connectors.
438 */ 472 */
439struct drm_encoder { 473struct drm_encoder {
440 struct drm_device *dev; 474 struct drm_device *dev;
@@ -470,14 +504,37 @@ enum drm_connector_force {
470 504
471/** 505/**
472 * drm_connector - central DRM connector control structure 506 * drm_connector - central DRM connector control structure
473 * @crtc: CRTC this connector is currently connected to, NULL if none 507 * @dev: parent DRM device
508 * @kdev: kernel device for sysfs attributes
509 * @attr: sysfs attributes
510 * @head: list management
511 * @base: base KMS object
512 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
513 * @connector_type_id: index into connector type enum
474 * @interlace_allowed: can this connector handle interlaced modes? 514 * @interlace_allowed: can this connector handle interlaced modes?
475 * @doublescan_allowed: can this connector handle doublescan? 515 * @doublescan_allowed: can this connector handle doublescan?
476 * @available_modes: modes available on this connector (from get_modes() + user) 516 * @modes: modes available on this connector (from fill_modes() + user)
477 * @initial_x: initial x position for this connector 517 * @status: one of the drm_connector_status enums (connected, not, or unknown)
478 * @initial_y: initial y position for this connector 518 * @probed_modes: list of modes derived directly from the display
479 * @status: connector connected? 519 * @display_info: information about attached display (e.g. from EDID)
480 * @funcs: connector control functions 520 * @funcs: connector control functions
521 * @user_modes: user added mode list
522 * @edid_blob_ptr: DRM property containing EDID if present
523 * @property_ids: property tracking for this connector
524 * @property_values: value pointers or data for properties
525 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
526 * @dpms: current dpms state
527 * @helper_private: mid-layer private data
528 * @force: a %DRM_FORCE_<foo> state for forced mode sets
529 * @encoder_ids: valid encoders for this connector
530 * @encoder: encoder driving this connector, if any
531 * @eld: EDID-like data, if present
532 * @dvi_dual: dual link DVI, if found
533 * @max_tmds_clock: max clock rate, if found
534 * @latency_present: AV delay info from ELD, if found
535 * @video_latency: video latency info from ELD, if found
536 * @audio_latency: audio latency info from ELD, if found
537 * @null_edid_counter: track sinks that give us all zeros for the EDID
481 * 538 *
482 * Each connector may be connected to one or more CRTCs, or may be clonable by 539 * Each connector may be connected to one or more CRTCs, or may be clonable by
483 * another connector if they can share a CRTC. Each connector also has a specific 540 * another connector if they can share a CRTC. Each connector also has a specific
@@ -498,7 +555,6 @@ struct drm_connector {
498 bool doublescan_allowed; 555 bool doublescan_allowed;
499 struct list_head modes; /* list of modes on this connector */ 556 struct list_head modes; /* list of modes on this connector */
500 557
501 int initial_x, initial_y;
502 enum drm_connector_status status; 558 enum drm_connector_status status;
503 559
504 /* these are modes added by probing with DDC or the BIOS */ 560 /* these are modes added by probing with DDC or the BIOS */
@@ -522,7 +578,6 @@ struct drm_connector {
522 /* forced on connector */ 578 /* forced on connector */
523 enum drm_connector_force force; 579 enum drm_connector_force force;
524 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 580 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
525 uint32_t force_encoder_id;
526 struct drm_encoder *encoder; /* currently active encoder */ 581 struct drm_encoder *encoder; /* currently active encoder */
527 582
528 /* EDID bits */ 583 /* EDID bits */
@@ -536,7 +591,71 @@ struct drm_connector {
536}; 591};
537 592
538/** 593/**
539 * struct drm_mode_set 594 * drm_plane_funcs - driver plane control functions
595 * @update_plane: update the plane configuration
596 * @disable_plane: shut down the plane
597 * @destroy: clean up plane resources
598 */
599struct drm_plane_funcs {
600 int (*update_plane)(struct drm_plane *plane,
601 struct drm_crtc *crtc, struct drm_framebuffer *fb,
602 int crtc_x, int crtc_y,
603 unsigned int crtc_w, unsigned int crtc_h,
604 uint32_t src_x, uint32_t src_y,
605 uint32_t src_w, uint32_t src_h);
606 int (*disable_plane)(struct drm_plane *plane);
607 void (*destroy)(struct drm_plane *plane);
608};
609
610/**
611 * drm_plane - central DRM plane control structure
612 * @dev: DRM device this plane belongs to
613 * @head: for list management
614 * @base: base mode object
615 * @possible_crtcs: pipes this plane can be bound to
616 * @format_types: array of formats supported by this plane
617 * @format_count: number of formats supported
618 * @crtc: currently bound CRTC
619 * @fb: currently bound fb
620 * @gamma_size: size of gamma table
621 * @gamma_store: gamma correction table
622 * @enabled: enabled flag
623 * @funcs: helper functions
624 * @helper_private: storage for drver layer
625 */
626struct drm_plane {
627 struct drm_device *dev;
628 struct list_head head;
629
630 struct drm_mode_object base;
631
632 uint32_t possible_crtcs;
633 uint32_t *format_types;
634 uint32_t format_count;
635
636 struct drm_crtc *crtc;
637 struct drm_framebuffer *fb;
638
639 /* CRTC gamma size for reporting to userspace */
640 uint32_t gamma_size;
641 uint16_t *gamma_store;
642
643 bool enabled;
644
645 const struct drm_plane_funcs *funcs;
646 void *helper_private;
647};
648
649/**
650 * drm_mode_set - new values for a CRTC config change
651 * @head: list management
652 * @fb: framebuffer to use for new config
653 * @crtc: CRTC whose configuration we're about to change
654 * @mode: mode timings to use
655 * @x: position of this CRTC relative to @fb
656 * @y: position of this CRTC relative to @fb
657 * @connectors: array of connectors to drive with this CRTC if possible
658 * @num_connectors: size of @connectors array
540 * 659 *
541 * Represents a single crtc the connectors that it drives with what mode 660 * Represents a single crtc the connectors that it drives with what mode
542 * and from which framebuffer it scans out from. 661 * and from which framebuffer it scans out from.
@@ -558,13 +677,33 @@ struct drm_mode_set {
558}; 677};
559 678
560/** 679/**
561 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout 680 * struct drm_mode_config_funcs - basic driver provided mode setting functions
681 * @fb_create: create a new framebuffer object
682 * @output_poll_changed: function to handle output configuration changes
683 *
684 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
685 * involve drivers.
562 */ 686 */
563struct drm_mode_config_funcs { 687struct drm_mode_config_funcs {
564 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); 688 struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
689 struct drm_file *file_priv,
690 struct drm_mode_fb_cmd2 *mode_cmd);
565 void (*output_poll_changed)(struct drm_device *dev); 691 void (*output_poll_changed)(struct drm_device *dev);
566}; 692};
567 693
694/**
695 * drm_mode_group - group of mode setting resources for potential sub-grouping
696 * @num_crtcs: CRTC count
697 * @num_encoders: encoder count
698 * @num_connectors: connector count
699 * @id_list: list of KMS object IDs in this group
700 *
701 * Currently this simply tracks the global mode setting state. But in the
702 * future it could allow groups of objects to be set aside into independent
703 * control groups for use by different user level processes (e.g. two X servers
704 * running simultaneously on different heads, each with their own mode
705 * configuration and freedom of mode setting).
706 */
568struct drm_mode_group { 707struct drm_mode_group {
569 uint32_t num_crtcs; 708 uint32_t num_crtcs;
570 uint32_t num_encoders; 709 uint32_t num_encoders;
@@ -576,7 +715,30 @@ struct drm_mode_group {
576 715
577/** 716/**
578 * drm_mode_config - Mode configuration control structure 717 * drm_mode_config - Mode configuration control structure
718 * @mutex: mutex protecting KMS related lists and structures
719 * @idr_mutex: mutex for KMS ID allocation and management
720 * @crtc_idr: main KMS ID tracking object
721 * @num_fb: number of fbs available
722 * @fb_list: list of framebuffers available
723 * @num_connector: number of connectors on this device
724 * @connector_list: list of connector objects
725 * @num_encoder: number of encoders on this device
726 * @encoder_list: list of encoder objects
727 * @num_crtc: number of CRTCs on this device
728 * @crtc_list: list of CRTC objects
729 * @min_width: minimum pixel width on this device
730 * @min_height: minimum pixel height on this device
731 * @max_width: maximum pixel width on this device
732 * @max_height: maximum pixel height on this device
733 * @funcs: core driver provided mode setting functions
734 * @fb_base: base address of the framebuffer
735 * @poll_enabled: track polling status for this device
736 * @output_poll_work: delayed work for polling in process context
737 * @*_property: core property tracking
579 * 738 *
739 * Core mode resource tracking structure. All CRTC, encoders, and connectors
740 * enumerated by the driver are added here, as are global properties. Some
741 * global restrictions are also here, e.g. dimension restrictions.
580 */ 742 */
581struct drm_mode_config { 743struct drm_mode_config {
582 struct mutex mutex; /* protects configuration (mode lists etc.) */ 744 struct mutex mutex; /* protects configuration (mode lists etc.) */
@@ -589,6 +751,8 @@ struct drm_mode_config {
589 struct list_head connector_list; 751 struct list_head connector_list;
590 int num_encoder; 752 int num_encoder;
591 struct list_head encoder_list; 753 struct list_head encoder_list;
754 int num_plane;
755 struct list_head plane_list;
592 756
593 int num_crtc; 757 int num_crtc;
594 struct list_head crtc_list; 758 struct list_head crtc_list;
@@ -641,6 +805,7 @@ struct drm_mode_config {
641#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) 805#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
642#define obj_to_property(x) container_of(x, struct drm_property, base) 806#define obj_to_property(x) container_of(x, struct drm_property, base)
643#define obj_to_blob(x) container_of(x, struct drm_property_blob, base) 807#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
808#define obj_to_plane(x) container_of(x, struct drm_plane, base)
644 809
645 810
646extern void drm_crtc_init(struct drm_device *dev, 811extern void drm_crtc_init(struct drm_device *dev,
@@ -660,6 +825,14 @@ extern void drm_encoder_init(struct drm_device *dev,
660 const struct drm_encoder_funcs *funcs, 825 const struct drm_encoder_funcs *funcs,
661 int encoder_type); 826 int encoder_type);
662 827
828extern int drm_plane_init(struct drm_device *dev,
829 struct drm_plane *plane,
830 unsigned long possible_crtcs,
831 const struct drm_plane_funcs *funcs,
832 const uint32_t *formats, uint32_t format_count,
833 bool priv);
834extern void drm_plane_cleanup(struct drm_plane *plane);
835
663extern void drm_encoder_cleanup(struct drm_encoder *encoder); 836extern void drm_encoder_cleanup(struct drm_encoder *encoder);
664 837
665extern char *drm_get_connector_name(struct drm_connector *connector); 838extern char *drm_get_connector_name(struct drm_connector *connector);
@@ -753,17 +926,25 @@ extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
753/* IOCTLs */ 926/* IOCTLs */
754extern int drm_mode_getresources(struct drm_device *dev, 927extern int drm_mode_getresources(struct drm_device *dev,
755 void *data, struct drm_file *file_priv); 928 void *data, struct drm_file *file_priv);
756 929extern int drm_mode_getplane_res(struct drm_device *dev, void *data,
930 struct drm_file *file_priv);
757extern int drm_mode_getcrtc(struct drm_device *dev, 931extern int drm_mode_getcrtc(struct drm_device *dev,
758 void *data, struct drm_file *file_priv); 932 void *data, struct drm_file *file_priv);
759extern int drm_mode_getconnector(struct drm_device *dev, 933extern int drm_mode_getconnector(struct drm_device *dev,
760 void *data, struct drm_file *file_priv); 934 void *data, struct drm_file *file_priv);
761extern int drm_mode_setcrtc(struct drm_device *dev, 935extern int drm_mode_setcrtc(struct drm_device *dev,
762 void *data, struct drm_file *file_priv); 936 void *data, struct drm_file *file_priv);
937extern int drm_mode_getplane(struct drm_device *dev,
938 void *data, struct drm_file *file_priv);
939extern int drm_mode_setplane(struct drm_device *dev,
940 void *data, struct drm_file *file_priv);
763extern int drm_mode_cursor_ioctl(struct drm_device *dev, 941extern int drm_mode_cursor_ioctl(struct drm_device *dev,
764 void *data, struct drm_file *file_priv); 942 void *data, struct drm_file *file_priv);
765extern int drm_mode_addfb(struct drm_device *dev, 943extern int drm_mode_addfb(struct drm_device *dev,
766 void *data, struct drm_file *file_priv); 944 void *data, struct drm_file *file_priv);
945extern int drm_mode_addfb2(struct drm_device *dev,
946 void *data, struct drm_file *file_priv);
947extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
767extern int drm_mode_rmfb(struct drm_device *dev, 948extern int drm_mode_rmfb(struct drm_device *dev,
768 void *data, struct drm_file *file_priv); 949 void *data, struct drm_file *file_priv);
769extern int drm_mode_getfb(struct drm_device *dev, 950extern int drm_mode_getfb(struct drm_device *dev,
@@ -824,4 +1005,7 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
824 void *data, struct drm_file *file_priv); 1005 void *data, struct drm_file *file_priv);
825extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 1006extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
826 void *data, struct drm_file *file_priv); 1007 void *data, struct drm_file *file_priv);
1008
1009extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1010 int *bpp);
827#endif /* __DRM_CRTC_H__ */ 1011#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 73b071203dcc..37515d1afab3 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -117,7 +117,7 @@ extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
118 118
119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
120 struct drm_mode_fb_cmd *mode_cmd); 120 struct drm_mode_fb_cmd2 *mode_cmd);
121 121
122static inline void drm_crtc_helper_add(struct drm_crtc *crtc, 122static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
123 const struct drm_crtc_helper_funcs *funcs) 123 const struct drm_crtc_helper_funcs *funcs)
@@ -144,4 +144,7 @@ extern void drm_helper_hpd_irq_event(struct drm_device *dev);
144 144
145extern void drm_kms_helper_poll_disable(struct drm_device *dev); 145extern void drm_kms_helper_poll_disable(struct drm_device *dev);
146extern void drm_kms_helper_poll_enable(struct drm_device *dev); 146extern void drm_kms_helper_poll_enable(struct drm_device *dev);
147
148extern int drm_format_num_planes(uint32_t format);
149
147#endif 150#endif
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
new file mode 100644
index 000000000000..bdf0152cbbe9
--- /dev/null
+++ b/include/drm/drm_fourcc.h
@@ -0,0 +1,137 @@
1/*
2 * Copyright 2011 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef DRM_FOURCC_H
25#define DRM_FOURCC_H
26
27#include <linux/types.h>
28
29#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
30 ((__u32)(c) << 16) | ((__u32)(d) << 24))
31
32#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
33
34/* color index */
35#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
36
37/* 8 bpp RGB */
38#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
39#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
40
41/* 16 bpp RGB */
42#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
43#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
44#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
45#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
46
47#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
48#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
49#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
50#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
51
52#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
53#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
54#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
55#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
56
57#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
58#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
59#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
60#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
61
62#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
63#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
64
65/* 24 bpp RGB */
66#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
67#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
68
69/* 32 bpp RGB */
70#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
71#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
72#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
73#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
74
75#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
76#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
77#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
78#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
79
80#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
81#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
82#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
83#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
84
85#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
86#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
87#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
88#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
89
90/* packed YCbCr */
91#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
92#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
93#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
94#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
95
96#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
97
98/*
99 * 2 plane YCbCr
100 * index 0 = Y plane, [7:0] Y
101 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
102 * or
103 * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
104 */
105#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
106#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
107#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
108#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
109
110/* 2 non contiguous plane YCbCr */
111#define DRM_FORMAT_NV12M fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */
112#define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
113
114/*
115 * 3 plane YCbCr
116 * index 0: Y plane, [7:0] Y
117 * index 1: Cb plane, [7:0] Cb
118 * index 2: Cr plane, [7:0] Cr
119 * or
120 * index 1: Cr plane, [7:0] Cr
121 * index 2: Cb plane, [7:0] Cb
122 */
123#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
124#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
125#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
126#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
127#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
128#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
129#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
130#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
131#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
132#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
133
134/* 3 non contiguous plane YCbCr */
135#define DRM_FORMAT_YUV420M fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
136
137#endif /* DRM_FOURCC_H */
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index ddd46db65b57..2a2acda8b437 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -120,11 +120,48 @@ struct drm_mode_crtc {
120 struct drm_mode_modeinfo mode; 120 struct drm_mode_modeinfo mode;
121}; 121};
122 122
123#define DRM_MODE_ENCODER_NONE 0 123#define DRM_MODE_PRESENT_TOP_FIELD (1<<0)
124#define DRM_MODE_ENCODER_DAC 1 124#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1)
125#define DRM_MODE_ENCODER_TMDS 2 125
126#define DRM_MODE_ENCODER_LVDS 3 126/* Planes blend with or override other bits on the CRTC */
127#define DRM_MODE_ENCODER_TVDAC 4 127struct drm_mode_set_plane {
128 __u32 plane_id;
129 __u32 crtc_id;
130 __u32 fb_id; /* fb object contains surface format type */
131 __u32 flags; /* see above flags */
132
133 /* Signed dest location allows it to be partially off screen */
134 __s32 crtc_x, crtc_y;
135 __u32 crtc_w, crtc_h;
136
137 /* Source values are 16.16 fixed point */
138 __u32 src_x, src_y;
139 __u32 src_h, src_w;
140};
141
142struct drm_mode_get_plane {
143 __u32 plane_id;
144
145 __u32 crtc_id;
146 __u32 fb_id;
147
148 __u32 possible_crtcs;
149 __u32 gamma_size;
150
151 __u32 count_format_types;
152 __u64 format_type_ptr;
153};
154
155struct drm_mode_get_plane_res {
156 __u64 plane_id_ptr;
157 __u32 count_planes;
158};
159
160#define DRM_MODE_ENCODER_NONE 0
161#define DRM_MODE_ENCODER_DAC 1
162#define DRM_MODE_ENCODER_TMDS 2
163#define DRM_MODE_ENCODER_LVDS 3
164#define DRM_MODE_ENCODER_TVDAC 4
128#define DRM_MODE_ENCODER_VIRTUAL 5 165#define DRM_MODE_ENCODER_VIRTUAL 5
129 166
130struct drm_mode_get_encoder { 167struct drm_mode_get_encoder {
@@ -231,6 +268,33 @@ struct drm_mode_fb_cmd {
231 __u32 handle; 268 __u32 handle;
232}; 269};
233 270
271#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
272
273struct drm_mode_fb_cmd2 {
274 __u32 fb_id;
275 __u32 width, height;
276 __u32 pixel_format; /* fourcc code from drm_fourcc.h */
277 __u32 flags; /* see above flags */
278
279 /*
280 * In case of planar formats, this ioctl allows up to 4
281 * buffer objects with offets and pitches per plane.
282 * The pitch and offset order is dictated by the fourcc,
283 * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
284 *
285 * YUV 4:2:0 image with a plane of 8 bit Y samples
286 * followed by an interleaved U/V plane containing
287 * 8 bit 2x2 subsampled colour difference samples.
288 *
289 * So it would consist of Y as offset[0] and UV as
290 * offeset[1]. Note that offset[0] will generally
291 * be 0.
292 */
293 __u32 handles[4];
294 __u32 pitches[4]; /* pitch for each plane */
295 __u32 offsets[4]; /* offset of each plane */
296};
297
234#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 298#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
235#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 299#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
236#define DRM_MODE_FB_DIRTY_FLAGS 0x03 300#define DRM_MODE_FB_DIRTY_FLAGS 0x03
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 4e4fbb820e20..14b6cd022284 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -182,8 +182,11 @@
182 {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 182 {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
183 {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 183 {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
184 {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 184 {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
185 {0x1002, 0x6751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
185 {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 186 {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
186 {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 187 {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
188 {0x1002, 0x675B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
189 {0x1002, 0x675D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
187 {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 190 {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
188 {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 191 {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
189 {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 192 {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -195,8 +198,10 @@
195 {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 198 {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
196 {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 199 {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
197 {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 200 {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
201 {0x1002, 0x6772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
198 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 202 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
199 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 203 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
204 {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
200 {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 205 {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
201 {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 206 {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
202 {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 207 {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -246,6 +251,7 @@
246 {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 251 {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
247 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 252 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
248 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 253 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
254 {0x1002, 0x68fa, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
249 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 255 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
250 {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ 256 {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
251 {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 257 {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -488,6 +494,8 @@
488 {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ 494 {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
489 {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ 495 {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
490 {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 496 {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
497 {0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
498 {0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
491 {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ 499 {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
492 {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ 500 {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
493 {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 501 {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
@@ -502,6 +510,8 @@
502 {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 510 {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
503 {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 511 {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
504 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 512 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
513 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
514 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
505 {0, 0, 0} 515 {0, 0, 0}
506 516
507#define r128_PCI_IDS \ 517#define r128_PCI_IDS \
diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h
deleted file mode 100644
index 08ecf83ad5d4..000000000000
--- a/include/drm/drm_sman.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/**************************************************************************
2 *
3 * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 **************************************************************************/
28/*
29 * Simple memory MANager interface that keeps track on allocate regions on a
30 * per "owner" basis. All regions associated with an "owner" can be released
31 * with a simple call. Typically if the "owner" exists. The owner is any
32 * "unsigned long" identifier. Can typically be a pointer to a file private
33 * struct or a context identifier.
34 *
35 * Authors:
36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
37 */
38
39#ifndef DRM_SMAN_H
40#define DRM_SMAN_H
41
42#include "drmP.h"
43#include "drm_hashtab.h"
44
45/*
46 * A class that is an abstration of a simple memory allocator.
47 * The sman implementation provides a default such allocator
48 * using the drm_mm.c implementation. But the user can replace it.
49 * See the SiS implementation, which may use the SiS FB kernel module
50 * for memory management.
51 */
52
53struct drm_sman_mm {
54 /* private info. If allocated, needs to be destroyed by the destroy
55 function */
56 void *private;
57
58 /* Allocate a memory block with given size and alignment.
59 Return an opaque reference to the memory block */
60
61 void *(*allocate) (void *private, unsigned long size,
62 unsigned alignment);
63
64 /* Free a memory block. "ref" is the opaque reference that we got from
65 the "alloc" function */
66
67 void (*free) (void *private, void *ref);
68
69 /* Free all resources associated with this allocator */
70
71 void (*destroy) (void *private);
72
73 /* Return a memory offset from the opaque reference returned from the
74 "alloc" function */
75
76 unsigned long (*offset) (void *private, void *ref);
77};
78
79struct drm_memblock_item {
80 struct list_head owner_list;
81 struct drm_hash_item user_hash;
82 void *mm_info;
83 struct drm_sman_mm *mm;
84 struct drm_sman *sman;
85};
86
87struct drm_sman {
88 struct drm_sman_mm *mm;
89 int num_managers;
90 struct drm_open_hash owner_hash_tab;
91 struct drm_open_hash user_hash_tab;
92 struct list_head owner_items;
93};
94
95/*
96 * Take down a memory manager. This function should only be called after a
97 * successful init and after a call to drm_sman_cleanup.
98 */
99
100extern void drm_sman_takedown(struct drm_sman * sman);
101
102/*
103 * Allocate structures for a manager.
104 * num_managers are the number of memory pools to manage. (VRAM, AGP, ....)
105 * user_order is the log2 of the number of buckets in the user hash table.
106 * set this to approximately log2 of the max number of memory regions
107 * that will be allocated for _all_ pools together.
108 * owner_order is the log2 of the number of buckets in the owner hash table.
109 * set this to approximately log2 of
110 * the number of client file connections that will
111 * be using the manager.
112 *
113 */
114
115extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
116 unsigned int user_order, unsigned int owner_order);
117
118/*
119 * Initialize a drm_mm.c allocator. Should be called only once for each
120 * manager unless a customized allogator is used.
121 */
122
123extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size);
125
126/*
127 * Initialize a customized allocator for one of the managers.
128 * (See the SiS module). The object pointed to by "allocator" is copied,
129 * so it can be destroyed after this call.
130 */
131
132extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
133 struct drm_sman_mm * allocator);
134
135/*
136 * Allocate a memory block. Aligment is not implemented yet.
137 */
138
139extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
140 unsigned int manager,
141 unsigned long size,
142 unsigned alignment,
143 unsigned long owner);
144/*
145 * Free a memory block identified by its user hash key.
146 */
147
148extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
149
150/*
151 * returns 1 iff there are no stale memory blocks associated with this owner.
152 * Typically called to determine if we need to idle the hardware and call
153 * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes all
154 * resources associated with owner.
155 */
156
157extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
158
159/*
160 * Frees all stale memory blocks associated with this owner. Note that this
161 * requires that the hardware is finished with all blocks, so the graphics engine
162 * should be idled before this call is made. This function also frees
163 * any resources associated with "owner" and should be called when owner
164 * is not going to be referenced anymore.
165 */
166
167extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
168
169/*
170 * Frees all stale memory blocks associated with the memory manager.
171 * See idling above.
172 */
173
174extern void drm_sman_cleanup(struct drm_sman * sman);
175
176#endif
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 12050434d57a..5e120f1c5cd9 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -74,9 +74,16 @@ struct drm_exynos_gem_mmap {
74 uint64_t mapped; 74 uint64_t mapped;
75}; 75};
76 76
77struct drm_exynos_plane_set_zpos {
78 __u32 plane_id;
79 __s32 zpos;
80};
81
77#define DRM_EXYNOS_GEM_CREATE 0x00 82#define DRM_EXYNOS_GEM_CREATE 0x00
78#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 83#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
79#define DRM_EXYNOS_GEM_MMAP 0x02 84#define DRM_EXYNOS_GEM_MMAP 0x02
85/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
86#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
80 87
81#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 88#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
82 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 89 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
@@ -87,6 +94,9 @@ struct drm_exynos_gem_mmap {
87#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ 94#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
88 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) 95 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
89 96
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99
90/** 100/**
91 * Platform Specific Structure for DRM based FIMD. 101 * Platform Specific Structure for DRM based FIMD.
92 * 102 *
@@ -102,4 +112,31 @@ struct exynos_drm_fimd_pdata {
102 unsigned int bpp; 112 unsigned int bpp;
103}; 113};
104 114
115/**
116 * Platform Specific Structure for DRM based HDMI.
117 *
118 * @hdmi_dev: device point to specific hdmi driver.
119 * @mixer_dev: device point to specific mixer driver.
120 *
121 * this structure is used for common hdmi driver and each device object
122 * would be used to access specific device driver(hdmi or mixer driver)
123 */
124struct exynos_drm_common_hdmi_pd {
125 struct device *hdmi_dev;
126 struct device *mixer_dev;
127};
128
129/**
130 * Platform Specific Structure for DRM based HDMI core.
131 *
132 * @timing: default video mode for initializing
133 * @default_win: default window layer number to be used for UI.
134 * @bpp: default bit per pixel.
135 */
136struct exynos_drm_hdmi_pdata {
137 struct fb_videomode timing;
138 unsigned int default_win;
139 unsigned int bpp;
140};
141
105#endif 142#endif
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h
new file mode 100644
index 000000000000..113686785717
--- /dev/null
+++ b/include/drm/gma_drm.h
@@ -0,0 +1,91 @@
1/**************************************************************************
2 * Copyright (c) 2007-2011, Intel Corporation.
3 * All Rights Reserved.
4 * Copyright (c) 2008, Tungsten Graphics Inc. Cedar Park, TX., USA.
5 * All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope 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, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 **************************************************************************/
21
22#ifndef _PSB_DRM_H_
23#define _PSB_DRM_H_
24
25/*
26 * Manage the LUT for an output
27 */
28struct drm_psb_dpst_lut_arg {
29 uint8_t lut[256];
30 int output_id;
31};
32
33/*
34 * Validate modes
35 */
36struct drm_psb_mode_operation_arg {
37 u32 obj_id;
38 u16 operation;
39 struct drm_mode_modeinfo mode;
40 u64 data;
41};
42
43/*
44 * Query the stolen memory for smarter management of
45 * memory by the server
46 */
47struct drm_psb_stolen_memory_arg {
48 u32 base;
49 u32 size;
50};
51
52struct drm_psb_get_pipe_from_crtc_id_arg {
53 /** ID of CRTC being requested **/
54 u32 crtc_id;
55 /** pipe of requested CRTC **/
56 u32 pipe;
57};
58
59struct drm_psb_gem_create {
60 __u64 size;
61 __u32 handle;
62 __u32 flags;
63#define GMA_GEM_CREATE_STOLEN 1 /* Stolen memory can be used */
64};
65
66struct drm_psb_gem_mmap {
67 __u32 handle;
68 __u32 pad;
69 /**
70 * Fake offset to use for subsequent mmap call
71 *
72 * This is a fixed-size type for 32/64 compatibility.
73 */
74 __u64 offset;
75};
76
77/* Controlling the kernel modesetting buffers */
78
79#define DRM_GMA_GEM_CREATE 0x00 /* Create a GEM object */
80#define DRM_GMA_GEM_MMAP 0x01 /* Map GEM memory */
81#define DRM_GMA_STOLEN_MEMORY 0x02 /* Report stolen memory */
82#define DRM_GMA_2D_OP 0x03 /* Will be merged later */
83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */
84#define DRM_GMA_ADB 0x05 /* Get backlight */
85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */
86#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */
87#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */
88#define PSB_MODE_OPERATION_MODE_VALID 0x01
89
90
91#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 28c0d114cb52..924f6a454fed 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -198,6 +198,8 @@ typedef struct _drm_i915_sarea {
198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27 198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
199#define DRM_I915_OVERLAY_ATTRS 0x28 199#define DRM_I915_OVERLAY_ATTRS 0x28
200#define DRM_I915_GEM_EXECBUFFER2 0x29 200#define DRM_I915_GEM_EXECBUFFER2 0x29
201#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
202#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
201 203
202#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 204#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
203#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 205#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -239,6 +241,8 @@ typedef struct _drm_i915_sarea {
239#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 241#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
240#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 242#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
241#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 243#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
244#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
245#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
242 246
243/* Allow drivers to submit batchbuffers directly to hardware, relying 247/* Allow drivers to submit batchbuffers directly to hardware, relying
244 * on the security mechanisms provided by hardware. 248 * on the security mechanisms provided by hardware.
@@ -291,6 +295,7 @@ typedef struct drm_i915_irq_wait {
291#define I915_PARAM_HAS_COHERENT_RINGS 13 295#define I915_PARAM_HAS_COHERENT_RINGS 13
292#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
293#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
294 299
295typedef struct drm_i915_getparam { 300typedef struct drm_i915_getparam {
296 int param; 301 int param;
@@ -653,6 +658,9 @@ struct drm_i915_gem_execbuffer2 {
653 __u64 rsvd2; 658 __u64 rsvd2;
654}; 659};
655 660
661/** Resets the SO write offset registers for transform feedback on gen7. */
662#define I915_EXEC_GEN7_SOL_RESET (1<<8)
663
656struct drm_i915_gem_pin { 664struct drm_i915_gem_pin {
657 /** Handle of the buffer to be pinned. */ 665 /** Handle of the buffer to be pinned. */
658 __u32 handle; 666 __u32 handle;
@@ -844,4 +852,36 @@ struct drm_intel_overlay_attrs {
844 __u32 gamma5; 852 __u32 gamma5;
845}; 853};
846 854
855/*
856 * Intel sprite handling
857 *
858 * Color keying works with a min/mask/max tuple. Both source and destination
859 * color keying is allowed.
860 *
861 * Source keying:
862 * Sprite pixels within the min & max values, masked against the color channels
863 * specified in the mask field, will be transparent. All other pixels will
864 * be displayed on top of the primary plane. For RGB surfaces, only the min
865 * and mask fields will be used; ranged compares are not allowed.
866 *
867 * Destination keying:
868 * Primary plane pixels that match the min value, masked against the color
869 * channels specified in the mask field, will be replaced by corresponding
870 * pixels from the sprite plane.
871 *
872 * Note that source & destination keying are exclusive; only one can be
873 * active on a given plane.
874 */
875
876#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
877#define I915_SET_COLORKEY_DESTINATION (1<<1)
878#define I915_SET_COLORKEY_SOURCE (1<<2)
879struct drm_intel_sprite_colorkey {
880 __u32 plane_id;
881 __u32 min_value;
882 __u32 channel_mask;
883 __u32 max_value;
884 __u32 flags;
885};
886
847#endif /* _I915_DRM_H_ */ 887#endif /* _I915_DRM_H_ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index be94be6d6f17..b55da40953fd 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -509,6 +509,7 @@ typedef struct {
509#define DRM_RADEON_GEM_SET_TILING 0x28 509#define DRM_RADEON_GEM_SET_TILING 0x28
510#define DRM_RADEON_GEM_GET_TILING 0x29 510#define DRM_RADEON_GEM_GET_TILING 0x29
511#define DRM_RADEON_GEM_BUSY 0x2a 511#define DRM_RADEON_GEM_BUSY 0x2a
512#define DRM_RADEON_GEM_VA 0x2b
512 513
513#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 514#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
514#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 515#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -550,6 +551,7 @@ typedef struct {
550#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) 551#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
551#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) 552#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
552#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) 553#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
554#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
553 555
554typedef struct drm_radeon_init { 556typedef struct drm_radeon_init {
555 enum { 557 enum {
@@ -872,12 +874,39 @@ struct drm_radeon_gem_pwrite {
872 uint64_t data_ptr; 874 uint64_t data_ptr;
873}; 875};
874 876
877#define RADEON_VA_MAP 1
878#define RADEON_VA_UNMAP 2
879
880#define RADEON_VA_RESULT_OK 0
881#define RADEON_VA_RESULT_ERROR 1
882#define RADEON_VA_RESULT_VA_EXIST 2
883
884#define RADEON_VM_PAGE_VALID (1 << 0)
885#define RADEON_VM_PAGE_READABLE (1 << 1)
886#define RADEON_VM_PAGE_WRITEABLE (1 << 2)
887#define RADEON_VM_PAGE_SYSTEM (1 << 3)
888#define RADEON_VM_PAGE_SNOOPED (1 << 4)
889
890struct drm_radeon_gem_va {
891 uint32_t handle;
892 uint32_t operation;
893 uint32_t vm_id;
894 uint32_t flags;
895 uint64_t offset;
896};
897
875#define RADEON_CHUNK_ID_RELOCS 0x01 898#define RADEON_CHUNK_ID_RELOCS 0x01
876#define RADEON_CHUNK_ID_IB 0x02 899#define RADEON_CHUNK_ID_IB 0x02
877#define RADEON_CHUNK_ID_FLAGS 0x03 900#define RADEON_CHUNK_ID_FLAGS 0x03
878 901
879/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ 902/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
880#define RADEON_CS_KEEP_TILING_FLAGS 0x01 903#define RADEON_CS_KEEP_TILING_FLAGS 0x01
904#define RADEON_CS_USE_VM 0x02
905/* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */
906#define RADEON_CS_RING_GFX 0
907#define RADEON_CS_RING_COMPUTE 1
908/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
909/* 0 = normal, + = higher priority, - = lower priority */
881 910
882struct drm_radeon_cs_chunk { 911struct drm_radeon_cs_chunk {
883 uint32_t chunk_id; 912 uint32_t chunk_id;
@@ -885,6 +914,9 @@ struct drm_radeon_cs_chunk {
885 uint64_t chunk_data; 914 uint64_t chunk_data;
886}; 915};
887 916
917/* drm_radeon_cs_reloc.flags */
918#define RADEON_RELOC_DONT_SYNC 0x01
919
888struct drm_radeon_cs_reloc { 920struct drm_radeon_cs_reloc {
889 uint32_t handle; 921 uint32_t handle;
890 uint32_t read_domains; 922 uint32_t read_domains;
@@ -916,6 +948,10 @@ struct drm_radeon_cs {
916#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ 948#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */
917#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ 949#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */
918#define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ 950#define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */
951/* virtual address start, va < start are reserved by the kernel */
952#define RADEON_INFO_VA_START 0x0e
953/* maximum size of ib using the virtual memory cs */
954#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
919 955
920struct drm_radeon_info { 956struct drm_radeon_info {
921 uint32_t request; 957 uint32_t request;
diff --git a/include/drm/sis_drm.h b/include/drm/sis_drm.h
index 30f7b3827466..035b804dda6d 100644
--- a/include/drm/sis_drm.h
+++ b/include/drm/sis_drm.h
@@ -64,4 +64,8 @@ typedef struct {
64 unsigned int offset, size; 64 unsigned int offset, size;
65} drm_sis_fb_t; 65} drm_sis_fb_t;
66 66
67struct sis_file_private {
68 struct list_head obj_list;
69};
70
67#endif /* __SIS_DRM_H__ */ 71#endif /* __SIS_DRM_H__ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 42e346985186..974c8f801c39 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -122,17 +122,12 @@ struct ttm_mem_reg {
122 * be mmapped by user space. Each of these bos occupy a slot in the 122 * be mmapped by user space. Each of these bos occupy a slot in the
123 * device address space, that can be used for normal vm operations. 123 * device address space, that can be used for normal vm operations.
124 * 124 *
125 * @ttm_bo_type_user: These are user-space memory areas that are made
126 * available to the GPU by mapping the buffer pages into the GPU aperture
127 * space. These buffers cannot be mmaped from the device address space.
128 *
129 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, 125 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
130 * but they cannot be accessed from user-space. For kernel-only use. 126 * but they cannot be accessed from user-space. For kernel-only use.
131 */ 127 */
132 128
133enum ttm_bo_type { 129enum ttm_bo_type {
134 ttm_bo_type_device, 130 ttm_bo_type_device,
135 ttm_bo_type_user,
136 ttm_bo_type_kernel 131 ttm_bo_type_kernel
137}; 132};
138 133
@@ -434,9 +429,9 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
434 * -EBUSY if the buffer is busy and no_wait is true. 429 * -EBUSY if the buffer is busy and no_wait is true.
435 * -ERESTARTSYS if interrupted by a signal. 430 * -ERESTARTSYS if interrupted by a signal.
436 */ 431 */
437
438extern int 432extern int
439ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); 433ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
434
440/** 435/**
441 * ttm_bo_synccpu_write_release: 436 * ttm_bo_synccpu_write_release:
442 * 437 *
@@ -447,6 +442,22 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
447extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); 442extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
448 443
449/** 444/**
445 * ttm_bo_acc_size
446 *
447 * @bdev: Pointer to a ttm_bo_device struct.
448 * @bo_size: size of the buffer object in byte.
449 * @struct_size: size of the structure holding buffer object datas
450 *
451 * Returns size to account for a buffer object
452 */
453size_t ttm_bo_acc_size(struct ttm_bo_device *bdev,
454 unsigned long bo_size,
455 unsigned struct_size);
456size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
457 unsigned long bo_size,
458 unsigned struct_size);
459
460/**
450 * ttm_bo_init 461 * ttm_bo_init
451 * 462 *
452 * @bdev: Pointer to a ttm_bo_device struct. 463 * @bdev: Pointer to a ttm_bo_device struct.
@@ -493,6 +504,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
493 struct file *persistent_swap_storage, 504 struct file *persistent_swap_storage,
494 size_t acc_size, 505 size_t acc_size,
495 void (*destroy) (struct ttm_buffer_object *)); 506 void (*destroy) (struct ttm_buffer_object *));
507
496/** 508/**
497 * ttm_bo_synccpu_object_init 509 * ttm_bo_synccpu_object_init
498 * 510 *
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 94eb1434316e..d43e892307ff 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -43,36 +43,9 @@ struct ttm_backend;
43 43
44struct ttm_backend_func { 44struct ttm_backend_func {
45 /** 45 /**
46 * struct ttm_backend_func member populate
47 *
48 * @backend: Pointer to a struct ttm_backend.
49 * @num_pages: Number of pages to populate.
50 * @pages: Array of pointers to ttm pages.
51 * @dummy_read_page: Page to be used instead of NULL pages in the
52 * array @pages.
53 * @dma_addrs: Array of DMA (bus) address of the ttm pages.
54 *
55 * Populate the backend with ttm pages. Depending on the backend,
56 * it may or may not copy the @pages array.
57 */
58 int (*populate) (struct ttm_backend *backend,
59 unsigned long num_pages, struct page **pages,
60 struct page *dummy_read_page,
61 dma_addr_t *dma_addrs);
62 /**
63 * struct ttm_backend_func member clear
64 *
65 * @backend: Pointer to a struct ttm_backend.
66 *
67 * This is an "unpopulate" function. Release all resources
68 * allocated with populate.
69 */
70 void (*clear) (struct ttm_backend *backend);
71
72 /**
73 * struct ttm_backend_func member bind 46 * struct ttm_backend_func member bind
74 * 47 *
75 * @backend: Pointer to a struct ttm_backend. 48 * @ttm: Pointer to a struct ttm_tt.
76 * @bo_mem: Pointer to a struct ttm_mem_reg describing the 49 * @bo_mem: Pointer to a struct ttm_mem_reg describing the
77 * memory type and location for binding. 50 * memory type and location for binding.
78 * 51 *
@@ -80,46 +53,29 @@ struct ttm_backend_func {
80 * indicated by @bo_mem. This function should be able to handle 53 * indicated by @bo_mem. This function should be able to handle
81 * differences between aperture and system page sizes. 54 * differences between aperture and system page sizes.
82 */ 55 */
83 int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem); 56 int (*bind) (struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
84 57
85 /** 58 /**
86 * struct ttm_backend_func member unbind 59 * struct ttm_backend_func member unbind
87 * 60 *
88 * @backend: Pointer to a struct ttm_backend. 61 * @ttm: Pointer to a struct ttm_tt.
89 * 62 *
90 * Unbind previously bound backend pages. This function should be 63 * Unbind previously bound backend pages. This function should be
91 * able to handle differences between aperture and system page sizes. 64 * able to handle differences between aperture and system page sizes.
92 */ 65 */
93 int (*unbind) (struct ttm_backend *backend); 66 int (*unbind) (struct ttm_tt *ttm);
94 67
95 /** 68 /**
96 * struct ttm_backend_func member destroy 69 * struct ttm_backend_func member destroy
97 * 70 *
98 * @backend: Pointer to a struct ttm_backend. 71 * @ttm: Pointer to a struct ttm_tt.
99 * 72 *
100 * Destroy the backend. 73 * Destroy the backend. This will be call back from ttm_tt_destroy so
74 * don't call ttm_tt_destroy from the callback or infinite loop.
101 */ 75 */
102 void (*destroy) (struct ttm_backend *backend); 76 void (*destroy) (struct ttm_tt *ttm);
103};
104
105/**
106 * struct ttm_backend
107 *
108 * @bdev: Pointer to a struct ttm_bo_device.
109 * @flags: For driver use.
110 * @func: Pointer to a struct ttm_backend_func that describes
111 * the backend methods.
112 *
113 */
114
115struct ttm_backend {
116 struct ttm_bo_device *bdev;
117 uint32_t flags;
118 struct ttm_backend_func *func;
119}; 77};
120 78
121#define TTM_PAGE_FLAG_USER (1 << 1)
122#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
123#define TTM_PAGE_FLAG_WRITE (1 << 3) 79#define TTM_PAGE_FLAG_WRITE (1 << 3)
124#define TTM_PAGE_FLAG_SWAPPED (1 << 4) 80#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
125#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) 81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
@@ -135,23 +91,18 @@ enum ttm_caching_state {
135/** 91/**
136 * struct ttm_tt 92 * struct ttm_tt
137 * 93 *
94 * @bdev: Pointer to a struct ttm_bo_device.
95 * @func: Pointer to a struct ttm_backend_func that describes
96 * the backend methods.
138 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL 97 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
139 * pointer. 98 * pointer.
140 * @pages: Array of pages backing the data. 99 * @pages: Array of pages backing the data.
141 * @first_himem_page: Himem pages are put last in the page array, which
142 * enables us to run caching attribute changes on only the first part
143 * of the page array containing lomem pages. This is the index of the
144 * first himem page.
145 * @last_lomem_page: Index of the last lomem page in the page array.
146 * @num_pages: Number of pages in the page array. 100 * @num_pages: Number of pages in the page array.
147 * @bdev: Pointer to the current struct ttm_bo_device. 101 * @bdev: Pointer to the current struct ttm_bo_device.
148 * @be: Pointer to the ttm backend. 102 * @be: Pointer to the ttm backend.
149 * @tsk: The task for user ttm.
150 * @start: virtual address for user ttm.
151 * @swap_storage: Pointer to shmem struct file for swap storage. 103 * @swap_storage: Pointer to shmem struct file for swap storage.
152 * @caching_state: The current caching state of the pages. 104 * @caching_state: The current caching state of the pages.
153 * @state: The current binding state of the pages. 105 * @state: The current binding state of the pages.
154 * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
155 * 106 *
156 * This is a structure holding the pages, caching- and aperture binding 107 * This is a structure holding the pages, caching- and aperture binding
157 * status for a buffer object that isn't backed by fixed (VRAM / AGP) 108 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -159,16 +110,14 @@ enum ttm_caching_state {
159 */ 110 */
160 111
161struct ttm_tt { 112struct ttm_tt {
113 struct ttm_bo_device *bdev;
114 struct ttm_backend_func *func;
162 struct page *dummy_read_page; 115 struct page *dummy_read_page;
163 struct page **pages; 116 struct page **pages;
164 long first_himem_page;
165 long last_lomem_page;
166 uint32_t page_flags; 117 uint32_t page_flags;
167 unsigned long num_pages; 118 unsigned long num_pages;
168 struct ttm_bo_global *glob; 119 struct ttm_bo_global *glob;
169 struct ttm_backend *be; 120 struct ttm_backend *be;
170 struct task_struct *tsk;
171 unsigned long start;
172 struct file *swap_storage; 121 struct file *swap_storage;
173 enum ttm_caching_state caching_state; 122 enum ttm_caching_state caching_state;
174 enum { 123 enum {
@@ -176,7 +125,23 @@ struct ttm_tt {
176 tt_unbound, 125 tt_unbound,
177 tt_unpopulated, 126 tt_unpopulated,
178 } state; 127 } state;
128};
129
130/**
131 * struct ttm_dma_tt
132 *
133 * @ttm: Base ttm_tt struct.
134 * @dma_address: The DMA (bus) addresses of the pages
135 * @pages_list: used by some page allocation backend
136 *
137 * This is a structure holding the pages, caching- and aperture binding
138 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
139 * memory.
140 */
141struct ttm_dma_tt {
142 struct ttm_tt ttm;
179 dma_addr_t *dma_address; 143 dma_addr_t *dma_address;
144 struct list_head pages_list;
180}; 145};
181 146
182#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 147#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
@@ -351,15 +316,42 @@ struct ttm_mem_type_manager {
351 316
352struct ttm_bo_driver { 317struct ttm_bo_driver {
353 /** 318 /**
354 * struct ttm_bo_driver member create_ttm_backend_entry 319 * ttm_tt_create
355 * 320 *
356 * @bdev: The buffer object device. 321 * @bdev: pointer to a struct ttm_bo_device:
322 * @size: Size of the data needed backing.
323 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
324 * @dummy_read_page: See struct ttm_bo_device.
357 * 325 *
358 * Create a driver specific struct ttm_backend. 326 * Create a struct ttm_tt to back data with system memory pages.
327 * No pages are actually allocated.
328 * Returns:
329 * NULL: Out of memory.
359 */ 330 */
331 struct ttm_tt *(*ttm_tt_create)(struct ttm_bo_device *bdev,
332 unsigned long size,
333 uint32_t page_flags,
334 struct page *dummy_read_page);
360 335
361 struct ttm_backend *(*create_ttm_backend_entry) 336 /**
362 (struct ttm_bo_device *bdev); 337 * ttm_tt_populate
338 *
339 * @ttm: The struct ttm_tt to contain the backing pages.
340 *
341 * Allocate all backing pages
342 * Returns:
343 * -ENOMEM: Out of memory.
344 */
345 int (*ttm_tt_populate)(struct ttm_tt *ttm);
346
347 /**
348 * ttm_tt_unpopulate
349 *
350 * @ttm: The struct ttm_tt to contain the backing pages.
351 *
352 * Free all backing page
353 */
354 void (*ttm_tt_unpopulate)(struct ttm_tt *ttm);
363 355
364 /** 356 /**
365 * struct ttm_bo_driver member invalidate_caches 357 * struct ttm_bo_driver member invalidate_caches
@@ -477,9 +469,6 @@ struct ttm_bo_global_ref {
477 * @dummy_read_page: Pointer to a dummy page used for mapping requests 469 * @dummy_read_page: Pointer to a dummy page used for mapping requests
478 * of unpopulated pages. 470 * of unpopulated pages.
479 * @shrink: A shrink callback object used for buffer object swap. 471 * @shrink: A shrink callback object used for buffer object swap.
480 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
481 * used by a buffer object. This is excluding page arrays and backing pages.
482 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
483 * @device_list_mutex: Mutex protecting the device list. 472 * @device_list_mutex: Mutex protecting the device list.
484 * This mutex is held while traversing the device list for pm options. 473 * This mutex is held while traversing the device list for pm options.
485 * @lru_lock: Spinlock protecting the bo subsystem lru lists. 474 * @lru_lock: Spinlock protecting the bo subsystem lru lists.
@@ -497,8 +486,6 @@ struct ttm_bo_global {
497 struct ttm_mem_global *mem_glob; 486 struct ttm_mem_global *mem_glob;
498 struct page *dummy_read_page; 487 struct page *dummy_read_page;
499 struct ttm_mem_shrink shrink; 488 struct ttm_mem_shrink shrink;
500 size_t ttm_bo_extra_size;
501 size_t ttm_bo_size;
502 struct mutex device_list_mutex; 489 struct mutex device_list_mutex;
503 spinlock_t lru_lock; 490 spinlock_t lru_lock;
504 491
@@ -600,8 +587,9 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
600} 587}
601 588
602/** 589/**
603 * ttm_tt_create 590 * ttm_tt_init
604 * 591 *
592 * @ttm: The struct ttm_tt.
605 * @bdev: pointer to a struct ttm_bo_device: 593 * @bdev: pointer to a struct ttm_bo_device:
606 * @size: Size of the data needed backing. 594 * @size: Size of the data needed backing.
607 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. 595 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
@@ -612,28 +600,22 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
612 * Returns: 600 * Returns:
613 * NULL: Out of memory. 601 * NULL: Out of memory.
614 */ 602 */
615extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, 603extern int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev,
616 unsigned long size, 604 unsigned long size, uint32_t page_flags,
617 uint32_t page_flags, 605 struct page *dummy_read_page);
618 struct page *dummy_read_page); 606extern int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev,
607 unsigned long size, uint32_t page_flags,
608 struct page *dummy_read_page);
619 609
620/** 610/**
621 * ttm_tt_set_user: 611 * ttm_tt_fini
622 * 612 *
623 * @ttm: The struct ttm_tt to populate. 613 * @ttm: the ttm_tt structure.
624 * @tsk: A struct task_struct for which @start is a valid user-space address.
625 * @start: A valid user-space address.
626 * @num_pages: Size in pages of the user memory area.
627 * 614 *
628 * Populate a struct ttm_tt with a user-space memory area after first pinning 615 * Free memory of ttm_tt structure
629 * the pages backing it.
630 * Returns:
631 * !0: Error.
632 */ 616 */
633 617extern void ttm_tt_fini(struct ttm_tt *ttm);
634extern int ttm_tt_set_user(struct ttm_tt *ttm, 618extern void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);
635 struct task_struct *tsk,
636 unsigned long start, unsigned long num_pages);
637 619
638/** 620/**
639 * ttm_ttm_bind: 621 * ttm_ttm_bind:
@@ -646,20 +628,11 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm,
646extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); 628extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
647 629
648/** 630/**
649 * ttm_tt_populate:
650 *
651 * @ttm: The struct ttm_tt to contain the backing pages.
652 *
653 * Add backing pages to all of @ttm
654 */
655extern int ttm_tt_populate(struct ttm_tt *ttm);
656
657/**
658 * ttm_ttm_destroy: 631 * ttm_ttm_destroy:
659 * 632 *
660 * @ttm: The struct ttm_tt. 633 * @ttm: The struct ttm_tt.
661 * 634 *
662 * Unbind, unpopulate and destroy a struct ttm_tt. 635 * Unbind, unpopulate and destroy common struct ttm_tt.
663 */ 636 */
664extern void ttm_tt_destroy(struct ttm_tt *ttm); 637extern void ttm_tt_destroy(struct ttm_tt *ttm);
665 638
@@ -673,19 +646,13 @@ extern void ttm_tt_destroy(struct ttm_tt *ttm);
673extern void ttm_tt_unbind(struct ttm_tt *ttm); 646extern void ttm_tt_unbind(struct ttm_tt *ttm);
674 647
675/** 648/**
676 * ttm_ttm_destroy: 649 * ttm_tt_swapin:
677 * 650 *
678 * @ttm: The struct ttm_tt. 651 * @ttm: The struct ttm_tt.
679 * @index: Index of the desired page.
680 *
681 * Return a pointer to the struct page backing @ttm at page
682 * index @index. If the page is unpopulated, one will be allocated to
683 * populate that index.
684 * 652 *
685 * Returns: 653 * Swap in a previously swap out ttm_tt.
686 * NULL on OOM.
687 */ 654 */
688extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index); 655extern int ttm_tt_swapin(struct ttm_tt *ttm);
689 656
690/** 657/**
691 * ttm_tt_cache_flush: 658 * ttm_tt_cache_flush:
@@ -1046,17 +1013,25 @@ extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
1046#include <linux/agp_backend.h> 1013#include <linux/agp_backend.h>
1047 1014
1048/** 1015/**
1049 * ttm_agp_backend_init 1016 * ttm_agp_tt_create
1050 * 1017 *
1051 * @bdev: Pointer to a struct ttm_bo_device. 1018 * @bdev: Pointer to a struct ttm_bo_device.
1052 * @bridge: The agp bridge this device is sitting on. 1019 * @bridge: The agp bridge this device is sitting on.
1020 * @size: Size of the data needed backing.
1021 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
1022 * @dummy_read_page: See struct ttm_bo_device.
1023 *
1053 * 1024 *
1054 * Create a TTM backend that uses the indicated AGP bridge as an aperture 1025 * Create a TTM backend that uses the indicated AGP bridge as an aperture
1055 * for TT memory. This function uses the linux agpgart interface to 1026 * for TT memory. This function uses the linux agpgart interface to
1056 * bind and unbind memory backing a ttm_tt. 1027 * bind and unbind memory backing a ttm_tt.
1057 */ 1028 */
1058extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev, 1029extern struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
1059 struct agp_bridge_data *bridge); 1030 struct agp_bridge_data *bridge,
1031 unsigned long size, uint32_t page_flags,
1032 struct page *dummy_read_page);
1033int ttm_agp_tt_populate(struct ttm_tt *ttm);
1034void ttm_agp_tt_unpopulate(struct ttm_tt *ttm);
1060#endif 1035#endif
1061 1036
1062#endif 1037#endif
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 129de12353f1..5fe27400d176 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -30,45 +30,70 @@
30#include "ttm_memory.h" 30#include "ttm_memory.h"
31 31
32/** 32/**
33 * Get count number of pages from pool to pages list. 33 * Initialize pool allocator.
34 */
35int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
36/**
37 * Free pool allocator.
38 */
39void ttm_page_alloc_fini(void);
40
41/**
42 * ttm_pool_populate:
43 *
44 * @ttm: The struct ttm_tt to contain the backing pages.
34 * 45 *
35 * @pages: head of empty linked list where pages are filled. 46 * Add backing pages to all of @ttm
36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate.
39 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
40 */ 47 */
41int ttm_get_pages(struct list_head *pages, 48extern int ttm_pool_populate(struct ttm_tt *ttm);
42 int flags, 49
43 enum ttm_caching_state cstate,
44 unsigned count,
45 dma_addr_t *dma_address);
46/** 50/**
47 * Put linked list of pages to pool. 51 * ttm_pool_unpopulate:
52 *
53 * @ttm: The struct ttm_tt which to free backing pages.
48 * 54 *
49 * @pages: list of pages to free. 55 * Free all pages of @ttm
50 * @page_count: number of pages in the list. Zero can be passed for unknown
51 * count.
52 * @flags: ttm flags for page allocation.
53 * @cstate: ttm caching state.
54 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
55 */ 56 */
56void ttm_put_pages(struct list_head *pages, 57extern void ttm_pool_unpopulate(struct ttm_tt *ttm);
57 unsigned page_count, 58
58 int flags, 59/**
59 enum ttm_caching_state cstate, 60 * Output the state of pools to debugfs file
60 dma_addr_t *dma_address); 61 */
62extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
63
64
65#ifdef CONFIG_SWIOTLB
61/** 66/**
62 * Initialize pool allocator. 67 * Initialize pool allocator.
63 */ 68 */
64int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); 69int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
70
65/** 71/**
66 * Free pool allocator. 72 * Free pool allocator.
67 */ 73 */
68void ttm_page_alloc_fini(void); 74void ttm_dma_page_alloc_fini(void);
69 75
70/** 76/**
71 * Output the state of pools to debugfs file 77 * Output the state of pools to debugfs file
72 */ 78 */
73extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); 79extern int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
80
81extern int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev);
82extern void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
83
84#else
85static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
86 unsigned max_pages)
87{
88 return -ENODEV;
89}
90
91static inline void ttm_dma_page_alloc_fini(void) { return; }
92
93static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
94{
95 return 0;
96}
97#endif
98
74#endif 99#endif
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index fd11a5bd892d..79b3b6e0f6b3 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -274,4 +274,8 @@ typedef struct drm_via_dmablit {
274 drm_via_blitsync_t sync; 274 drm_via_blitsync_t sync;
275} drm_via_dmablit_t; 275} drm_via_dmablit_t;
276 276
277struct via_file_private {
278 struct list_head obj_list;
279};
280
277#endif /* _VIA_DRM_H_ */ 281#endif /* _VIA_DRM_H_ */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 619b5657af77..c94e71781b79 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -185,6 +185,7 @@ header-y += if_pppol2tp.h
185header-y += if_pppox.h 185header-y += if_pppox.h
186header-y += if_slip.h 186header-y += if_slip.h
187header-y += if_strip.h 187header-y += if_strip.h
188header-y += if_team.h
188header-y += if_tr.h 189header-y += if_tr.h
189header-y += if_tun.h 190header-y += if_tun.h
190header-y += if_tunnel.h 191header-y += if_tunnel.h
@@ -194,7 +195,9 @@ header-y += igmp.h
194header-y += in.h 195header-y += in.h
195header-y += in6.h 196header-y += in6.h
196header-y += in_route.h 197header-y += in_route.h
198header-y += sock_diag.h
197header-y += inet_diag.h 199header-y += inet_diag.h
200header-y += unix_diag.h
198header-y += inotify.h 201header-y += inotify.h
199header-y += input.h 202header-y += input.h
200header-y += ioctl.h 203header-y += ioctl.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6001b4da39dd..627a3a42e4d8 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -302,6 +302,10 @@ extern bool osc_sb_apei_support_acked;
302 OSC_PCI_EXPRESS_PME_CONTROL | \ 302 OSC_PCI_EXPRESS_PME_CONTROL | \
303 OSC_PCI_EXPRESS_AER_CONTROL | \ 303 OSC_PCI_EXPRESS_AER_CONTROL | \
304 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) 304 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
305
306#define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
307 OSC_SHPC_NATIVE_HP_CONTROL)
308
305extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 309extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
306 u32 *mask, u32 req); 310 u32 *mask, u32 req);
307extern void acpi_early_init(void); 311extern void acpi_early_init(void);
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index be3d9a77d6ed..73a25005d88a 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -23,6 +23,8 @@ struct ata_port_info;
23struct ahci_platform_data { 23struct ahci_platform_data {
24 int (*init)(struct device *dev, void __iomem *addr); 24 int (*init)(struct device *dev, void __iomem *addr);
25 void (*exit)(struct device *dev); 25 void (*exit)(struct device *dev);
26 int (*suspend)(struct device *dev);
27 int (*resume)(struct device *dev);
26 const struct ata_port_info *ata_port_info; 28 const struct ata_port_info *ata_port_info;
27 unsigned int force_port_map; 29 unsigned int force_port_map;
28 unsigned int mask_port_map; 30 unsigned int mask_port_map;
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index fcbbe71a3cc1..724c69c40bb8 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/mod_devicetable.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/resource.h> 21#include <linux/resource.h>
21#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
@@ -35,12 +36,6 @@ struct amba_device {
35 unsigned int irq[AMBA_NR_IRQS]; 36 unsigned int irq[AMBA_NR_IRQS];
36}; 37};
37 38
38struct amba_id {
39 unsigned int id;
40 unsigned int mask;
41 void *data;
42};
43
44struct amba_driver { 39struct amba_driver {
45 struct device_driver drv; 40 struct device_driver drv;
46 int (*probe)(struct amba_device *, const struct amba_id *); 41 int (*probe)(struct amba_device *, const struct amba_id *);
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 21114810c7c0..0101e9c17fa1 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -30,6 +30,7 @@ struct dma_chan;
30 * @cd_invert: true if the gpio_cd pin value is active low 30 * @cd_invert: true if the gpio_cd pin value is active low
31 * @capabilities: the capabilities of the block as implemented in 31 * @capabilities: the capabilities of the block as implemented in
32 * this platform, signify anything MMC_CAP_* from mmc/host.h 32 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
33 * @dma_filter: function used to select an appropriate RX and TX 34 * @dma_filter: function used to select an appropriate RX and TX
34 * DMA channel to be used for DMA, if and only if you're deploying the 35 * DMA channel to be used for DMA, if and only if you're deploying the
35 * generic DMA engine 36 * generic DMA engine
@@ -52,6 +53,7 @@ struct mmci_platform_data {
52 int gpio_cd; 53 int gpio_cd;
53 bool cd_invert; 54 bool cd_invert;
54 unsigned long capabilities; 55 unsigned long capabilities;
56 unsigned long capabilities2;
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 57 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param; 58 void *dma_rx_param;
57 void *dma_tx_param; 59 void *dma_tx_param;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 4ce98f54186b..572f637299c9 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -238,6 +238,9 @@ struct dma_chan;
238 * @enable_dma: if true enables DMA driven transfers. 238 * @enable_dma: if true enables DMA driven transfers.
239 * @dma_rx_param: parameter to locate an RX DMA channel. 239 * @dma_rx_param: parameter to locate an RX DMA channel.
240 * @dma_tx_param: parameter to locate a TX DMA channel. 240 * @dma_tx_param: parameter to locate a TX DMA channel.
241 * @autosuspend_delay: delay in ms following transfer completion before the
242 * runtime power management system suspends the device. A setting of 0
243 * indicates no delay and the device will be suspended immediately.
241 */ 244 */
242struct pl022_ssp_controller { 245struct pl022_ssp_controller {
243 u16 bus_id; 246 u16 bus_id;
@@ -246,6 +249,7 @@ struct pl022_ssp_controller {
246 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 249 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
247 void *dma_rx_param; 250 void *dma_rx_param;
248 void *dma_tx_param; 251 void *dma_tx_param;
252 int autosuspend_delay;
249}; 253};
250 254
251/** 255/**
diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
index 2412af944f1f..fb83c0453489 100644
--- a/include/linux/amba/pl061.h
+++ b/include/linux/amba/pl061.h
@@ -7,7 +7,7 @@ struct pl061_platform_data {
7 unsigned gpio_base; 7 unsigned gpio_base;
8 8
9 /* number of the first IRQ. 9 /* number of the first IRQ.
10 * If the IRQ functionality in not desired this must be set to NO_IRQ. 10 * If the IRQ functionality in not desired this must be set to 0.
11 */ 11 */
12 unsigned irq_base; 12 unsigned irq_base;
13 13
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
index d12f077a6daf..12e023c19ac1 100644
--- a/include/linux/amba/pl330.h
+++ b/include/linux/amba/pl330.h
@@ -12,17 +12,9 @@
12#ifndef __AMBA_PL330_H_ 12#ifndef __AMBA_PL330_H_
13#define __AMBA_PL330_H_ 13#define __AMBA_PL330_H_
14 14
15#include <linux/dmaengine.h>
15#include <asm/hardware/pl330.h> 16#include <asm/hardware/pl330.h>
16 17
17struct dma_pl330_peri {
18 /*
19 * Peri_Req i/f of the DMAC that is
20 * peripheral could be reached from.
21 */
22 u8 peri_id; /* specific dma id */
23 enum pl330_reqtype rqtype;
24};
25
26struct dma_pl330_platdata { 18struct dma_pl330_platdata {
27 /* 19 /*
28 * Number of valid peripherals connected to DMAC. 20 * Number of valid peripherals connected to DMAC.
@@ -33,9 +25,12 @@ struct dma_pl330_platdata {
33 */ 25 */
34 u8 nr_valid_peri; 26 u8 nr_valid_peri;
35 /* Array of valid peripherals */ 27 /* Array of valid peripherals */
36 struct dma_pl330_peri *peri; 28 u8 *peri_id;
29 /* Operational capabilities */
30 dma_cap_mask_t cap_mask;
37 /* Bytes to allocate for MC buffer */ 31 /* Bytes to allocate for MC buffer */
38 unsigned mcbuf_sz; 32 unsigned mcbuf_sz;
39}; 33};
40 34
35extern bool pl330_filter(struct dma_chan *chan, void *param);
41#endif /* __AMBA_PL330_H_ */ 36#endif /* __AMBA_PL330_H_ */
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index a6863a2dec1f..ef00610837d4 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -20,12 +20,148 @@
20#ifndef _ASM_X86_AMD_IOMMU_H 20#ifndef _ASM_X86_AMD_IOMMU_H
21#define _ASM_X86_AMD_IOMMU_H 21#define _ASM_X86_AMD_IOMMU_H
22 22
23#include <linux/irqreturn.h> 23#include <linux/types.h>
24 24
25#ifdef CONFIG_AMD_IOMMU 25#ifdef CONFIG_AMD_IOMMU
26 26
27struct task_struct;
28struct pci_dev;
29
27extern int amd_iommu_detect(void); 30extern int amd_iommu_detect(void);
28 31
32
33/**
34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device
35 * in the IOMMUv2 driver
36 * @pdev: The PCI device the workaround is necessary for
37 * @erratum: The erratum workaround to enable
38 *
39 * The function needs to be called before amd_iommu_init_device().
40 * Possible values for the erratum number are for now:
41 * - AMD_PRI_DEV_ERRATUM_ENABLE_RESET - Reset PRI capability when PRI
42 * is enabled
43 * - AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE - Limit number of outstanding PRI
44 * requests to one
45 */
46#define AMD_PRI_DEV_ERRATUM_ENABLE_RESET 0
47#define AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE 1
48
49extern void amd_iommu_enable_device_erratum(struct pci_dev *pdev, u32 erratum);
50
51/**
52 * amd_iommu_init_device() - Init device for use with IOMMUv2 driver
53 * @pdev: The PCI device to initialize
54 * @pasids: Number of PASIDs to support for this device
55 *
56 * This function does all setup for the device pdev so that it can be
57 * used with IOMMUv2.
58 * Returns 0 on success or negative value on error.
59 */
60extern int amd_iommu_init_device(struct pci_dev *pdev, int pasids);
61
62/**
63 * amd_iommu_free_device() - Free all IOMMUv2 related device resources
64 * and disable IOMMUv2 usage for this device
65 * @pdev: The PCI device to disable IOMMUv2 usage for'
66 */
67extern void amd_iommu_free_device(struct pci_dev *pdev);
68
69/**
70 * amd_iommu_bind_pasid() - Bind a given task to a PASID on a device
71 * @pdev: The PCI device to bind the task to
72 * @pasid: The PASID on the device the task should be bound to
73 * @task: the task to bind
74 *
75 * The function returns 0 on success or a negative value on error.
76 */
77extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
78 struct task_struct *task);
79
80/**
81 * amd_iommu_unbind_pasid() - Unbind a PASID from its task on
82 * a device
83 * @pdev: The device of the PASID
84 * @pasid: The PASID to unbind
85 *
86 * When this function returns the device is no longer using the PASID
87 * and the PASID is no longer bound to its task.
88 */
89extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid);
90
91/**
92 * amd_iommu_set_invalid_ppr_cb() - Register a call-back for failed
93 * PRI requests
94 * @pdev: The PCI device the call-back should be registered for
95 * @cb: The call-back function
96 *
97 * The IOMMUv2 driver invokes this call-back when it is unable to
98 * successfully handle a PRI request. The device driver can then decide
99 * which PRI response the device should see. Possible return values for
100 * the call-back are:
101 *
102 * - AMD_IOMMU_INV_PRI_RSP_SUCCESS - Send SUCCESS back to the device
103 * - AMD_IOMMU_INV_PRI_RSP_INVALID - Send INVALID back to the device
104 * - AMD_IOMMU_INV_PRI_RSP_FAIL - Send Failure back to the device,
105 * the device is required to disable
106 * PRI when it receives this response
107 *
108 * The function returns 0 on success or negative value on error.
109 */
110#define AMD_IOMMU_INV_PRI_RSP_SUCCESS 0
111#define AMD_IOMMU_INV_PRI_RSP_INVALID 1
112#define AMD_IOMMU_INV_PRI_RSP_FAIL 2
113
114typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev,
115 int pasid,
116 unsigned long address,
117 u16);
118
119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev,
120 amd_iommu_invalid_ppr_cb cb);
121
122/**
123 * amd_iommu_device_info() - Get information about IOMMUv2 support of a
124 * PCI device
125 * @pdev: PCI device to query information from
126 * @info: A pointer to an amd_iommu_device_info structure which will contain
127 * the information about the PCI device
128 *
129 * Returns 0 on success, negative value on error
130 */
131
132#define AMD_IOMMU_DEVICE_FLAG_ATS_SUP 0x1 /* ATS feature supported */
133#define AMD_IOMMU_DEVICE_FLAG_PRI_SUP 0x2 /* PRI feature supported */
134#define AMD_IOMMU_DEVICE_FLAG_PASID_SUP 0x4 /* PASID context supported */
135#define AMD_IOMMU_DEVICE_FLAG_EXEC_SUP 0x8 /* Device may request execution
136 on memory pages */
137#define AMD_IOMMU_DEVICE_FLAG_PRIV_SUP 0x10 /* Device may request
138 super-user privileges */
139
140struct amd_iommu_device_info {
141 int max_pasids;
142 u32 flags;
143};
144
145extern int amd_iommu_device_info(struct pci_dev *pdev,
146 struct amd_iommu_device_info *info);
147
148/**
149 * amd_iommu_set_invalidate_ctx_cb() - Register a call-back for invalidating
150 * a pasid context. This call-back is
151 * invoked when the IOMMUv2 driver needs to
152 * invalidate a PASID context, for example
153 * because the task that is bound to that
154 * context is about to exit.
155 *
156 * @pdev: The PCI device the call-back should be registered for
157 * @cb: The call-back function
158 */
159
160typedef void (*amd_iommu_invalidate_ctx)(struct pci_dev *pdev, int pasid);
161
162extern int amd_iommu_set_invalidate_ctx_cb(struct pci_dev *pdev,
163 amd_iommu_invalidate_ctx cb);
164
29#else 165#else
30 166
31static inline int amd_iommu_detect(void) { return -ENODEV; } 167static inline int amd_iommu_detect(void) { return -ENODEV; }
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index 9a26c83a2c9e..b856a2a590d9 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -27,10 +27,7 @@ extern int __devexit __pata_platform_remove(struct device *dev);
27/* 27/*
28 * Marvell SATA private data 28 * Marvell SATA private data
29 */ 29 */
30struct mbus_dram_target_info;
31
32struct mv_sata_platform_data { 30struct mv_sata_platform_data {
33 struct mbus_dram_target_info *dram;
34 int n_ports; /* number of sata ports */ 31 int n_ports; /* number of sata ports */
35}; 32};
36 33
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 49a83ca900ba..f4ff882cb2da 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -445,16 +445,6 @@ void vcc_insert_socket(struct sock *sk);
445 445
446void atm_dev_release_vccs(struct atm_dev *dev); 446void atm_dev_release_vccs(struct atm_dev *dev);
447 447
448/*
449 * This is approximately the algorithm used by alloc_skb.
450 *
451 */
452
453static inline int atm_guess_pdu2truesize(int size)
454{
455 return SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info);
456}
457
458 448
459static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) 449static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
460{ 450{
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 2f81c6f3b630..426ab9f4dd85 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -468,13 +468,13 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
468#define audit_get_sessionid(t) ((t)->sessionid) 468#define audit_get_sessionid(t) ((t)->sessionid)
469extern void audit_log_task_context(struct audit_buffer *ab); 469extern void audit_log_task_context(struct audit_buffer *ab);
470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
472extern int audit_bprm(struct linux_binprm *bprm); 472extern int audit_bprm(struct linux_binprm *bprm);
473extern void audit_socketcall(int nargs, unsigned long *args); 473extern void audit_socketcall(int nargs, unsigned long *args);
474extern int audit_sockaddr(int len, void *addr); 474extern int audit_sockaddr(int len, void *addr);
475extern void __audit_fd_pair(int fd1, int fd2); 475extern void __audit_fd_pair(int fd1, int fd2);
476extern int audit_set_macxattr(const char *name); 476extern int audit_set_macxattr(const char *name);
477extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr); 477extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout); 478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification); 479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 480extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
@@ -494,12 +494,12 @@ static inline void audit_fd_pair(int fd1, int fd2)
494 if (unlikely(!audit_dummy_context())) 494 if (unlikely(!audit_dummy_context()))
495 __audit_fd_pair(fd1, fd2); 495 __audit_fd_pair(fd1, fd2);
496} 496}
497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 497static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
498{ 498{
499 if (unlikely(!audit_dummy_context())) 499 if (unlikely(!audit_dummy_context()))
500 __audit_ipc_set_perm(qbytes, uid, gid, mode); 500 __audit_ipc_set_perm(qbytes, uid, gid, mode);
501} 501}
502static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) 502static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
503{ 503{
504 if (unlikely(!audit_dummy_context())) 504 if (unlikely(!audit_dummy_context()))
505 __audit_mq_open(oflag, mode, attr); 505 __audit_mq_open(oflag, mode, attr);
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 4d4b59de9467..f4b8346b1a33 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -205,61 +205,82 @@ struct bcma_bus {
205 struct ssb_sprom sprom; 205 struct ssb_sprom sprom;
206}; 206};
207 207
208extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) 208static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
209{ 209{
210 return core->bus->ops->read8(core, offset); 210 return core->bus->ops->read8(core, offset);
211} 211}
212extern inline u32 bcma_read16(struct bcma_device *core, u16 offset) 212static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
213{ 213{
214 return core->bus->ops->read16(core, offset); 214 return core->bus->ops->read16(core, offset);
215} 215}
216extern inline u32 bcma_read32(struct bcma_device *core, u16 offset) 216static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
217{ 217{
218 return core->bus->ops->read32(core, offset); 218 return core->bus->ops->read32(core, offset);
219} 219}
220extern inline 220static inline
221void bcma_write8(struct bcma_device *core, u16 offset, u32 value) 221void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
222{ 222{
223 core->bus->ops->write8(core, offset, value); 223 core->bus->ops->write8(core, offset, value);
224} 224}
225extern inline 225static inline
226void bcma_write16(struct bcma_device *core, u16 offset, u32 value) 226void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
227{ 227{
228 core->bus->ops->write16(core, offset, value); 228 core->bus->ops->write16(core, offset, value);
229} 229}
230extern inline 230static inline
231void bcma_write32(struct bcma_device *core, u16 offset, u32 value) 231void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
232{ 232{
233 core->bus->ops->write32(core, offset, value); 233 core->bus->ops->write32(core, offset, value);
234} 234}
235#ifdef CONFIG_BCMA_BLOCKIO 235#ifdef CONFIG_BCMA_BLOCKIO
236extern inline void bcma_block_read(struct bcma_device *core, void *buffer, 236static inline void bcma_block_read(struct bcma_device *core, void *buffer,
237 size_t count, u16 offset, u8 reg_width) 237 size_t count, u16 offset, u8 reg_width)
238{ 238{
239 core->bus->ops->block_read(core, buffer, count, offset, reg_width); 239 core->bus->ops->block_read(core, buffer, count, offset, reg_width);
240} 240}
241extern inline void bcma_block_write(struct bcma_device *core, const void *buffer, 241static inline void bcma_block_write(struct bcma_device *core,
242 size_t count, u16 offset, u8 reg_width) 242 const void *buffer, size_t count,
243 u16 offset, u8 reg_width)
243{ 244{
244 core->bus->ops->block_write(core, buffer, count, offset, reg_width); 245 core->bus->ops->block_write(core, buffer, count, offset, reg_width);
245} 246}
246#endif 247#endif
247extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) 248static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
248{ 249{
249 return core->bus->ops->aread32(core, offset); 250 return core->bus->ops->aread32(core, offset);
250} 251}
251extern inline 252static inline
252void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) 253void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
253{ 254{
254 core->bus->ops->awrite32(core, offset, value); 255 core->bus->ops->awrite32(core, offset, value);
255} 256}
256 257
257#define bcma_mask32(cc, offset, mask) \ 258static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
258 bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) 259{
259#define bcma_set32(cc, offset, set) \ 260 bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
260 bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) 261}
261#define bcma_maskset32(cc, offset, mask, set) \ 262static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
262 bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) 263{
264 bcma_write32(cc, offset, bcma_read32(cc, offset) | set);
265}
266static inline void bcma_maskset32(struct bcma_device *cc,
267 u16 offset, u32 mask, u32 set)
268{
269 bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set);
270}
271static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
272{
273 bcma_write16(cc, offset, bcma_read16(cc, offset) & mask);
274}
275static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
276{
277 bcma_write16(cc, offset, bcma_read16(cc, offset) | set);
278}
279static inline void bcma_maskset16(struct bcma_device *cc,
280 u16 offset, u16 mask, u16 set)
281{
282 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
283}
263 284
264extern bool bcma_core_is_enabled(struct bcma_device *core); 285extern bool bcma_core_is_enabled(struct bcma_device *core);
265extern void bcma_core_disable(struct bcma_device *core, u32 flags); 286extern void bcma_core_disable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1526d965ed06..a33086a7530b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -203,6 +203,7 @@
203#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ 203#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
204#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ 204#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
205#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 205#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
206#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400
206#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ 207#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
207#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ 208#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
208#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ 209#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a3ef66a2a083..3c1063acb2ab 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -22,8 +22,14 @@ extern unsigned long __sw_hweight64(__u64 w);
22#include <asm/bitops.h> 22#include <asm/bitops.h>
23 23
24#define for_each_set_bit(bit, addr, size) \ 24#define for_each_set_bit(bit, addr, size) \
25 for ((bit) = find_first_bit((addr), (size)); \ 25 for ((bit) = find_first_bit((addr), (size)); \
26 (bit) < (size); \ 26 (bit) < (size); \
27 (bit) = find_next_bit((addr), (size), (bit) + 1))
28
29/* same as for_each_set_bit() but use bit as value to start with */
30#define for_each_set_bit_cont(bit, addr, size) \
31 for ((bit) = find_next_bit((addr), (size), (bit)); \
32 (bit) < (size); \
27 (bit) = find_next_bit((addr), (size), (bit) + 1)) 33 (bit) = find_next_bit((addr), (size), (bit) + 1))
28 34
29static __inline__ int get_bitmask_order(unsigned int count) 35static __inline__ int get_bitmask_order(unsigned int count)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c7a6d3b5bc7b..0ed1eb062313 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -675,6 +675,9 @@ extern int blk_insert_cloned_request(struct request_queue *q,
675 struct request *rq); 675 struct request *rq);
676extern void blk_delay_queue(struct request_queue *, unsigned long); 676extern void blk_delay_queue(struct request_queue *, unsigned long);
677extern void blk_recount_segments(struct request_queue *, struct bio *); 677extern void blk_recount_segments(struct request_queue *, struct bio *);
678extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int);
679extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t,
680 unsigned int, void __user *);
678extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, 681extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
679 unsigned int, void __user *); 682 unsigned int, void __user *);
680extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, 683extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
@@ -805,9 +808,6 @@ extern void blk_unprep_request(struct request *);
805 */ 808 */
806extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, 809extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
807 spinlock_t *lock, int node_id); 810 spinlock_t *lock, int node_id);
808extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
809 request_fn_proc *,
810 spinlock_t *, int node_id);
811extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); 811extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
812extern struct request_queue *blk_init_allocated_queue(struct request_queue *, 812extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
813 request_fn_proc *, spinlock_t *); 813 request_fn_proc *, spinlock_t *);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index ab344a521105..66d3e954eb6c 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -44,7 +44,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long endpfn); 44 unsigned long endpfn);
45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46 46
47unsigned long free_all_memory_core_early(int nodeid); 47extern unsigned long free_low_memory_core_early(int nodeid);
48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); 48extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
49extern unsigned long free_all_bootmem(void); 49extern unsigned long free_all_bootmem(void);
50 50
diff --git a/include/linux/can/platform/cc770.h b/include/linux/can/platform/cc770.h
new file mode 100644
index 000000000000..7702641f87ee
--- /dev/null
+++ b/include/linux/can/platform/cc770.h
@@ -0,0 +1,33 @@
1#ifndef _CAN_PLATFORM_CC770_H_
2#define _CAN_PLATFORM_CC770_H_
3
4/* CPU Interface Register (0x02) */
5#define CPUIF_CEN 0x01 /* Clock Out Enable */
6#define CPUIF_MUX 0x04 /* Multiplex */
7#define CPUIF_SLP 0x08 /* Sleep */
8#define CPUIF_PWD 0x10 /* Power Down Mode */
9#define CPUIF_DMC 0x20 /* Divide Memory Clock */
10#define CPUIF_DSC 0x40 /* Divide System Clock */
11#define CPUIF_RST 0x80 /* Hardware Reset Status */
12
13/* Clock Out Register (0x1f) */
14#define CLKOUT_CD_MASK 0x0f /* Clock Divider mask */
15#define CLKOUT_SL_MASK 0x30 /* Slew Rate mask */
16#define CLKOUT_SL_SHIFT 4
17
18/* Bus Configuration Register (0x2f) */
19#define BUSCFG_DR0 0x01 /* Disconnect RX0 Input / Select RX input */
20#define BUSCFG_DR1 0x02 /* Disconnect RX1 Input / Silent mode */
21#define BUSCFG_DT1 0x08 /* Disconnect TX1 Output */
22#define BUSCFG_POL 0x20 /* Polarity dominant or recessive */
23#define BUSCFG_CBY 0x40 /* Input Comparator Bypass */
24
25struct cc770_platform_data {
26 u32 osc_freq; /* CAN bus oscillator frequency in Hz */
27
28 u8 cir; /* CPU Interface Register */
29 u8 cor; /* Clock Out Register */
30 u8 bcr; /* Bus Configuration Register */
31};
32
33#endif /* !_CAN_PLATFORM_CC770_H_ */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1b7f9d525013..e9b602151caf 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -319,7 +319,7 @@ struct cftype {
319 * If not 0, file mode is set to this value, otherwise it will 319 * If not 0, file mode is set to this value, otherwise it will
320 * be figured out automatically 320 * be figured out automatically
321 */ 321 */
322 mode_t mode; 322 umode_t mode;
323 323
324 /* 324 /*
325 * If non-zero, defines the maximum length of string that can 325 * If non-zero, defines the maximum length of string that can
@@ -457,6 +457,28 @@ void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css); 457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
458 458
459/* 459/*
460 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
461 * methods.
462 */
463struct cgroup_taskset;
464struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
465struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
466struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset);
467int cgroup_taskset_size(struct cgroup_taskset *tset);
468
469/**
470 * cgroup_taskset_for_each - iterate cgroup_taskset
471 * @task: the loop cursor
472 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all
473 * @tset: taskset to iterate
474 */
475#define cgroup_taskset_for_each(task, skip_cgrp, tset) \
476 for ((task) = cgroup_taskset_first((tset)); (task); \
477 (task) = cgroup_taskset_next((tset))) \
478 if (!(skip_cgrp) || \
479 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp))
480
481/*
460 * Control Group subsystem type. 482 * Control Group subsystem type.
461 * See Documentation/cgroups/cgroups.txt for details 483 * See Documentation/cgroups/cgroups.txt for details
462 */ 484 */
@@ -467,14 +489,11 @@ struct cgroup_subsys {
467 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 489 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
468 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 490 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
469 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 491 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
470 struct task_struct *tsk); 492 struct cgroup_taskset *tset);
471 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
472 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 493 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
473 struct task_struct *tsk); 494 struct cgroup_taskset *tset);
474 void (*pre_attach)(struct cgroup *cgrp);
475 void (*attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
476 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 495 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
477 struct cgroup *old_cgrp, struct task_struct *tsk); 496 struct cgroup_taskset *tset);
478 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 497 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
479 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, 498 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp,
480 struct cgroup *old_cgrp, struct task_struct *task); 499 struct cgroup *old_cgrp, struct task_struct *task);
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ac663c18776c..0bd390ce98b2 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -59,8 +59,16 @@ SUBSYS(net_cls)
59SUBSYS(blkio) 59SUBSYS(blkio)
60#endif 60#endif
61 61
62/* */
63
62#ifdef CONFIG_CGROUP_PERF 64#ifdef CONFIG_CGROUP_PERF
63SUBSYS(perf) 65SUBSYS(perf)
64#endif 66#endif
65 67
66/* */ 68/* */
69
70#ifdef CONFIG_NETPRIO_CGROUP
71SUBSYS(net_prio)
72#endif
73
74/* */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 7213b52b2c0e..b9d46fa154b4 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk)
107} 107}
108#endif 108#endif
109 109
110/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
111static inline int clk_prepare_enable(struct clk *clk)
112{
113 int ret;
114
115 ret = clk_prepare(clk);
116 if (ret)
117 return ret;
118 ret = clk_enable(clk);
119 if (ret)
120 clk_unprepare(clk);
121
122 return ret;
123}
124
125/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
126static inline void clk_disable_unprepare(struct clk *clk)
127{
128 clk_disable(clk);
129 clk_unprepare(clk);
130}
131
110/** 132/**
111 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. 133 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
112 * This is only valid once the clock source has been enabled. 134 * This is only valid once the clock source has been enabled.
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c86c940d1de3..081147da0564 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -71,7 +71,7 @@ struct timecounter {
71 71
72/** 72/**
73 * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds 73 * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds
74 * @tc: Pointer to cycle counter. 74 * @cc: Pointer to cycle counter.
75 * @cycles: Cycles 75 * @cycles: Cycles
76 * 76 *
77 * XXX - This could use some mult_lxl_ll() asm optimization. Same code 77 * XXX - This could use some mult_lxl_ll() asm optimization. Same code
@@ -114,7 +114,7 @@ extern u64 timecounter_read(struct timecounter *tc);
114 * time base as values returned by 114 * time base as values returned by
115 * timecounter_read() 115 * timecounter_read()
116 * @tc: Pointer to time counter. 116 * @tc: Pointer to time counter.
117 * @cycle: a value returned by tc->cc->read() 117 * @cycle_tstamp: a value returned by tc->cc->read()
118 * 118 *
119 * Cycle counts that are converted correctly as long as they 119 * Cycle counts that are converted correctly as long as they
120 * fall into the interval [-1/2 max cycle count, +1/2 max cycle count], 120 * fall into the interval [-1/2 max cycle count, +1/2 max cycle count],
@@ -156,11 +156,12 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
156 * @mult: cycle to nanosecond multiplier 156 * @mult: cycle to nanosecond multiplier
157 * @shift: cycle to nanosecond divisor (power of two) 157 * @shift: cycle to nanosecond divisor (power of two)
158 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 158 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
159 * @maxadj maximum adjustment value to mult (~11%) 159 * @maxadj: maximum adjustment value to mult (~11%)
160 * @flags: flags describing special properties 160 * @flags: flags describing special properties
161 * @archdata: arch-specific data 161 * @archdata: arch-specific data
162 * @suspend: suspend function for the clocksource, if necessary 162 * @suspend: suspend function for the clocksource, if necessary
163 * @resume: resume function for the clocksource, if necessary 163 * @resume: resume function for the clocksource, if necessary
164 * @cycle_last: most recent cycle counter value seen by ::read()
164 */ 165 */
165struct clocksource { 166struct clocksource {
166 /* 167 /*
@@ -187,6 +188,7 @@ struct clocksource {
187 void (*suspend)(struct clocksource *cs); 188 void (*suspend)(struct clocksource *cs);
188 void (*resume)(struct clocksource *cs); 189 void (*resume)(struct clocksource *cs);
189 190
191 /* private: */
190#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 192#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
191 /* Watchdog related data, used by the framework */ 193 /* Watchdog related data, used by the framework */
192 struct list_head wd_list; 194 struct list_head wd_list;
@@ -261,6 +263,9 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
261 263
262/** 264/**
263 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds 265 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
266 * @cycles: cycles
267 * @mult: cycle to nanosecond multiplier
268 * @shift: cycle to nanosecond divisor (power of two)
264 * 269 *
265 * Converts cycles to nanoseconds, using the given mult and shift. 270 * Converts cycles to nanoseconds, using the given mult and shift.
266 * 271 *
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 66ed067fb729..41c9f6515f46 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -422,9 +422,9 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 422asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
423 unsigned int nr_segs, unsigned int flags); 423 unsigned int nr_segs, unsigned int flags);
424asmlinkage long compat_sys_open(const char __user *filename, int flags, 424asmlinkage long compat_sys_open(const char __user *filename, int flags,
425 int mode); 425 umode_t mode);
426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 426asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
427 int flags, int mode); 427 int flags, umode_t mode);
428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 428asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
429 struct file_handle __user *handle, 429 struct file_handle __user *handle,
430 int flags); 430 int flags);
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index dfadc96e9d63..2f4079175afb 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -29,6 +29,7 @@
29 the kernel context */ 29 the kernel context */
30#define __cold __attribute__((__cold__)) 30#define __cold __attribute__((__cold__))
31 31
32#define __linktime_error(message) __attribute__((__error__(message)))
32 33
33#if __GNUC_MINOR__ >= 5 34#if __GNUC_MINOR__ >= 5
34/* 35/*
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 320d6c94ff84..4a243546d142 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -293,7 +293,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
293#ifndef __compiletime_error 293#ifndef __compiletime_error
294# define __compiletime_error(message) 294# define __compiletime_error(message)
295#endif 295#endif
296 296#ifndef __linktime_error
297# define __linktime_error(message)
298#endif
297/* 299/*
298 * Prevent the compiler from merging or refetching accesses. The compiler 300 * Prevent the compiler from merging or refetching accesses. The compiler
299 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 301 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 3081c58d696e..34025df61829 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -124,7 +124,7 @@ extern struct config_item *config_group_find_item(struct config_group *,
124struct configfs_attribute { 124struct configfs_attribute {
125 const char *ca_name; 125 const char *ca_name;
126 struct module *ca_owner; 126 struct module *ca_owner;
127 mode_t ca_mode; 127 umode_t ca_mode;
128}; 128};
129 129
130/* 130/*
diff --git a/include/linux/console.h b/include/linux/console.h
index 7453cfd593c8..7201ce4280ca 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -152,7 +152,7 @@ extern int braille_register_console(struct console *, int index,
152 char *console_options, char *braille_options); 152 char *console_options, char *braille_options);
153extern int braille_unregister_console(struct console *); 153extern int braille_unregister_console(struct console *);
154extern void console_sysfs_notify(void); 154extern void console_sysfs_notify(void);
155extern int console_suspend_enabled; 155extern bool console_suspend_enabled;
156 156
157/* Suspend and resume console messages over PM events */ 157/* Suspend and resume console messages over PM events */
158extern void suspend_console(void); 158extern void suspend_console(void);
diff --git a/include/linux/cordic.h b/include/linux/cordic.h
index f932093e20c2..cf68ca4a508c 100644
--- a/include/linux/cordic.h
+++ b/include/linux/cordic.h
@@ -35,8 +35,8 @@ struct cordic_iq {
35 * @theta: angle in degrees for which i/q coordinate is to be calculated. 35 * @theta: angle in degrees for which i/q coordinate is to be calculated.
36 * @coord: function output parameter holding the i/q coordinate. 36 * @coord: function output parameter holding the i/q coordinate.
37 * 37 *
38 * The function calculates the i/q coordinate for a given angle using 38 * The function calculates the i/q coordinate for a given angle using the
39 * cordic algorithm. The coordinate consists of a real (i) and an 39 * CORDIC algorithm. The coordinate consists of a real (i) and an
40 * imaginary (q) part. The real part is essentially the cosine of the 40 * imaginary (q) part. The real part is essentially the cosine of the
41 * angle and the imaginary part is the sine of the angle. The returned 41 * angle and the imaginary part is the sine of the angle. The returned
42 * values are scaled by 2^16 for precision. The range for theta is 42 * values are scaled by 2^16 for precision. The range for theta is
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 6cb60fd2ea84..1f6587590a1a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -14,7 +14,7 @@
14#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
15#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/node.h> 18#include <linux/node.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/cpumask.h> 20#include <linux/cpumask.h>
@@ -22,19 +22,20 @@
22struct cpu { 22struct cpu {
23 int node_id; /* The node which contains the CPU */ 23 int node_id; /* The node which contains the CPU */
24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 24 int hotpluggable; /* creates sysfs control file if hotpluggable */
25 struct sys_device sysdev; 25 struct device dev;
26}; 26};
27 27
28extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
29extern struct sys_device *get_cpu_sysdev(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu);
30 31
31extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); 32extern int cpu_add_dev_attr(struct device_attribute *attr);
32extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); 33extern void cpu_remove_dev_attr(struct device_attribute *attr);
33 34
34extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 35extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
35extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 36extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
36 37
37extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 38extern int sched_create_sysfs_power_savings_entries(struct device *dev);
38 39
39#ifdef CONFIG_HOTPLUG_CPU 40#ifdef CONFIG_HOTPLUG_CPU
40extern void unregister_cpu(struct cpu *cpu); 41extern void unregister_cpu(struct cpu *cpu);
@@ -160,7 +161,7 @@ static inline void cpu_maps_update_done(void)
160} 161}
161 162
162#endif /* CONFIG_SMP */ 163#endif /* CONFIG_SMP */
163extern struct sysdev_class cpu_sysdev_class; 164extern struct bus_type cpu_subsys;
164 165
165#ifdef CONFIG_HOTPLUG_CPU 166#ifdef CONFIG_HOTPLUG_CPU
166/* Stop CPUs going up and down. */ 167/* Stop CPUs going up and down. */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 7408af843b8a..23f81de51829 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -130,7 +130,6 @@ struct cpuidle_driver {
130#ifdef CONFIG_CPU_IDLE 130#ifdef CONFIG_CPU_IDLE
131extern void disable_cpuidle(void); 131extern void disable_cpuidle(void);
132extern int cpuidle_idle_call(void); 132extern int cpuidle_idle_call(void);
133
134extern int cpuidle_register_driver(struct cpuidle_driver *drv); 133extern int cpuidle_register_driver(struct cpuidle_driver *drv);
135struct cpuidle_driver *cpuidle_get_driver(void); 134struct cpuidle_driver *cpuidle_get_driver(void);
136extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); 135extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
@@ -145,7 +144,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
145#else 144#else
146static inline void disable_cpuidle(void) { } 145static inline void disable_cpuidle(void) { }
147static inline int cpuidle_idle_call(void) { return -ENODEV; } 146static inline int cpuidle_idle_call(void) { return -ENODEV; }
148
149static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 147static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
150{return -ENODEV; } 148{return -ENODEV; }
151static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } 149static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 5c4abce94ad1..b936763f2236 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -5,6 +5,7 @@
5#include <linux/kexec.h> 5#include <linux/kexec.h>
6#include <linux/device.h> 6#include <linux/device.h>
7#include <linux/proc_fs.h> 7#include <linux/proc_fs.h>
8#include <linux/elf.h>
8 9
9#define ELFCORE_ADDR_MAX (-1ULL) 10#define ELFCORE_ADDR_MAX (-1ULL)
10#define ELFCORE_ADDR_ERR (-2ULL) 11#define ELFCORE_ADDR_ERR (-2ULL)
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index ed9f74f6c519..d64a55b23afd 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -203,6 +203,7 @@ struct dentry_operations {
203 203
204#define DCACHE_CANT_MOUNT 0x0100 204#define DCACHE_CANT_MOUNT 0x0100
205#define DCACHE_GENOCIDE 0x0200 205#define DCACHE_GENOCIDE 0x0200
206#define DCACHE_SHRINK_LIST 0x0400
206 207
207#define DCACHE_NFSFS_RENAMED 0x1000 208#define DCACHE_NFSFS_RENAMED 0x1000
208 /* this dentry has been "silly renamed" and has to be deleted on the last 209 /* this dentry has been "silly renamed" and has to be deleted on the last
@@ -241,6 +242,7 @@ extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
241extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *); 242extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
242extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 243extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
243extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 244extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
245extern struct dentry *d_find_any_alias(struct inode *inode);
244extern struct dentry * d_obtain_alias(struct inode *); 246extern struct dentry * d_obtain_alias(struct inode *);
245extern void shrink_dcache_sb(struct super_block *); 247extern void shrink_dcache_sb(struct super_block *);
246extern void shrink_dcache_parent(struct dentry *); 248extern void shrink_dcache_parent(struct dentry *);
@@ -249,6 +251,7 @@ extern int d_invalidate(struct dentry *);
249 251
250/* only used at mount-time */ 252/* only used at mount-time */
251extern struct dentry * d_alloc_root(struct inode *); 253extern struct dentry * d_alloc_root(struct inode *);
254extern struct dentry * d_make_root(struct inode *);
252 255
253/* <clickety>-<click> the ramfs-type tree */ 256/* <clickety>-<click> the ramfs-type tree */
254extern void d_genocide(struct dentry *); 257extern void d_genocide(struct dentry *);
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e7d9b20ddc5b..6169c26fd8c8 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -16,6 +16,7 @@
16#define _DEBUGFS_H_ 16#define _DEBUGFS_H_
17 17
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/seq_file.h>
19 20
20#include <linux/types.h> 21#include <linux/types.h>
21 22
@@ -26,6 +27,17 @@ struct debugfs_blob_wrapper {
26 unsigned long size; 27 unsigned long size;
27}; 28};
28 29
30struct debugfs_reg32 {
31 char *name;
32 unsigned long offset;
33};
34
35struct debugfs_regset32 {
36 struct debugfs_reg32 *regs;
37 int nregs;
38 void __iomem *base;
39};
40
29extern struct dentry *arch_debugfs_dir; 41extern struct dentry *arch_debugfs_dir;
30 42
31#if defined(CONFIG_DEBUG_FS) 43#if defined(CONFIG_DEBUG_FS)
@@ -34,7 +46,7 @@ extern struct dentry *arch_debugfs_dir;
34extern const struct file_operations debugfs_file_operations; 46extern const struct file_operations debugfs_file_operations;
35extern const struct inode_operations debugfs_link_operations; 47extern const struct inode_operations debugfs_link_operations;
36 48
37struct dentry *debugfs_create_file(const char *name, mode_t mode, 49struct dentry *debugfs_create_file(const char *name, umode_t mode,
38 struct dentry *parent, void *data, 50 struct dentry *parent, void *data,
39 const struct file_operations *fops); 51 const struct file_operations *fops);
40 52
@@ -49,31 +61,38 @@ void debugfs_remove_recursive(struct dentry *dentry);
49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 61struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
50 struct dentry *new_dir, const char *new_name); 62 struct dentry *new_dir, const char *new_name);
51 63
52struct dentry *debugfs_create_u8(const char *name, mode_t mode, 64struct dentry *debugfs_create_u8(const char *name, umode_t mode,
53 struct dentry *parent, u8 *value); 65 struct dentry *parent, u8 *value);
54struct dentry *debugfs_create_u16(const char *name, mode_t mode, 66struct dentry *debugfs_create_u16(const char *name, umode_t mode,
55 struct dentry *parent, u16 *value); 67 struct dentry *parent, u16 *value);
56struct dentry *debugfs_create_u32(const char *name, mode_t mode, 68struct dentry *debugfs_create_u32(const char *name, umode_t mode,
57 struct dentry *parent, u32 *value); 69 struct dentry *parent, u32 *value);
58struct dentry *debugfs_create_u64(const char *name, mode_t mode, 70struct dentry *debugfs_create_u64(const char *name, umode_t mode,
59 struct dentry *parent, u64 *value); 71 struct dentry *parent, u64 *value);
60struct dentry *debugfs_create_x8(const char *name, mode_t mode, 72struct dentry *debugfs_create_x8(const char *name, umode_t mode,
61 struct dentry *parent, u8 *value); 73 struct dentry *parent, u8 *value);
62struct dentry *debugfs_create_x16(const char *name, mode_t mode, 74struct dentry *debugfs_create_x16(const char *name, umode_t mode,
63 struct dentry *parent, u16 *value); 75 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 76struct dentry *debugfs_create_x32(const char *name, umode_t mode,
65 struct dentry *parent, u32 *value); 77 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_x64(const char *name, mode_t mode, 78struct dentry *debugfs_create_x64(const char *name, umode_t mode,
67 struct dentry *parent, u64 *value); 79 struct dentry *parent, u64 *value);
68struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 80struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
69 struct dentry *parent, size_t *value); 81 struct dentry *parent, size_t *value);
70struct dentry *debugfs_create_bool(const char *name, mode_t mode, 82struct dentry *debugfs_create_bool(const char *name, umode_t mode,
71 struct dentry *parent, u32 *value); 83 struct dentry *parent, u32 *value);
72 84
73struct dentry *debugfs_create_blob(const char *name, mode_t mode, 85struct dentry *debugfs_create_blob(const char *name, umode_t mode,
74 struct dentry *parent, 86 struct dentry *parent,
75 struct debugfs_blob_wrapper *blob); 87 struct debugfs_blob_wrapper *blob);
76 88
89struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
90 struct dentry *parent,
91 struct debugfs_regset32 *regset);
92
93int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
94 int nregs, void __iomem *base, char *prefix);
95
77bool debugfs_initialized(void); 96bool debugfs_initialized(void);
78 97
79#else 98#else
@@ -86,7 +105,7 @@ bool debugfs_initialized(void);
86 * want to duplicate the design decision mistakes of procfs and devfs again. 105 * want to duplicate the design decision mistakes of procfs and devfs again.
87 */ 106 */
88 107
89static inline struct dentry *debugfs_create_file(const char *name, mode_t mode, 108static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
90 struct dentry *parent, void *data, 109 struct dentry *parent, void *data,
91 const struct file_operations *fops) 110 const struct file_operations *fops)
92{ 111{
@@ -118,76 +137,83 @@ static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentr
118 return ERR_PTR(-ENODEV); 137 return ERR_PTR(-ENODEV);
119} 138}
120 139
121static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, 140static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
122 struct dentry *parent, 141 struct dentry *parent,
123 u8 *value) 142 u8 *value)
124{ 143{
125 return ERR_PTR(-ENODEV); 144 return ERR_PTR(-ENODEV);
126} 145}
127 146
128static inline struct dentry *debugfs_create_u16(const char *name, mode_t mode, 147static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
129 struct dentry *parent, 148 struct dentry *parent,
130 u16 *value) 149 u16 *value)
131{ 150{
132 return ERR_PTR(-ENODEV); 151 return ERR_PTR(-ENODEV);
133} 152}
134 153
135static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, 154static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
136 struct dentry *parent, 155 struct dentry *parent,
137 u32 *value) 156 u32 *value)
138{ 157{
139 return ERR_PTR(-ENODEV); 158 return ERR_PTR(-ENODEV);
140} 159}
141 160
142static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, 161static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
143 struct dentry *parent, 162 struct dentry *parent,
144 u64 *value) 163 u64 *value)
145{ 164{
146 return ERR_PTR(-ENODEV); 165 return ERR_PTR(-ENODEV);
147} 166}
148 167
149static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode, 168static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
150 struct dentry *parent, 169 struct dentry *parent,
151 u8 *value) 170 u8 *value)
152{ 171{
153 return ERR_PTR(-ENODEV); 172 return ERR_PTR(-ENODEV);
154} 173}
155 174
156static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode, 175static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
157 struct dentry *parent, 176 struct dentry *parent,
158 u16 *value) 177 u16 *value)
159{ 178{
160 return ERR_PTR(-ENODEV); 179 return ERR_PTR(-ENODEV);
161} 180}
162 181
163static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode, 182static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
164 struct dentry *parent, 183 struct dentry *parent,
165 u32 *value) 184 u32 *value)
166{ 185{
167 return ERR_PTR(-ENODEV); 186 return ERR_PTR(-ENODEV);
168} 187}
169 188
170static inline struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 189static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
171 struct dentry *parent, 190 struct dentry *parent,
172 size_t *value) 191 size_t *value)
173{ 192{
174 return ERR_PTR(-ENODEV); 193 return ERR_PTR(-ENODEV);
175} 194}
176 195
177static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 196static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
178 struct dentry *parent, 197 struct dentry *parent,
179 u32 *value) 198 u32 *value)
180{ 199{
181 return ERR_PTR(-ENODEV); 200 return ERR_PTR(-ENODEV);
182} 201}
183 202
184static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, 203static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
185 struct dentry *parent, 204 struct dentry *parent,
186 struct debugfs_blob_wrapper *blob) 205 struct debugfs_blob_wrapper *blob)
187{ 206{
188 return ERR_PTR(-ENODEV); 207 return ERR_PTR(-ENODEV);
189} 208}
190 209
210static inline struct dentry *debugfs_create_regset32(const char *name,
211 mode_t mode, struct dentry *parent,
212 struct debugfs_regset32 *regset)
213{
214 return ERR_PTR(-ENODEV);
215}
216
191static inline bool debugfs_initialized(void) 217static inline bool debugfs_initialized(void)
192{ 218{
193 return false; 219 return false;
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 65970b811e22..0e5f5785d9f2 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -46,6 +46,8 @@ struct debug_obj {
46 * fails 46 * fails
47 * @fixup_free: fixup function, which is called when the free check 47 * @fixup_free: fixup function, which is called when the free check
48 * fails 48 * fails
49 * @fixup_assert_init: fixup function, which is called when the assert_init
50 * check fails
49 */ 51 */
50struct debug_obj_descr { 52struct debug_obj_descr {
51 const char *name; 53 const char *name;
@@ -54,6 +56,7 @@ struct debug_obj_descr {
54 int (*fixup_activate) (void *addr, enum debug_obj_state state); 56 int (*fixup_activate) (void *addr, enum debug_obj_state state);
55 int (*fixup_destroy) (void *addr, enum debug_obj_state state); 57 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
56 int (*fixup_free) (void *addr, enum debug_obj_state state); 58 int (*fixup_free) (void *addr, enum debug_obj_state state);
59 int (*fixup_assert_init)(void *addr, enum debug_obj_state state);
57}; 60};
58 61
59#ifdef CONFIG_DEBUG_OBJECTS 62#ifdef CONFIG_DEBUG_OBJECTS
@@ -64,6 +67,7 @@ extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
64extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); 67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
65extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
66extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 69extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
70extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr);
67 71
68/* 72/*
69 * Active state: 73 * Active state:
@@ -89,6 +93,8 @@ static inline void
89debug_object_destroy (void *addr, struct debug_obj_descr *descr) { } 93debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
90static inline void 94static inline void
91debug_object_free (void *addr, struct debug_obj_descr *descr) { } 95debug_object_free (void *addr, struct debug_obj_descr *descr) { }
96static inline void
97debug_object_assert_init(void *addr, struct debug_obj_descr *descr) { }
92 98
93static inline void debug_objects_early_init(void) { } 99static inline void debug_objects_early_init(void) { }
94static inline void debug_objects_mem_init(void) { } 100static inline void debug_objects_mem_init(void) { }
diff --git a/include/linux/device.h b/include/linux/device.h
index 3136ede5a1e1..5b3adb8f9588 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
53 * struct bus_type - The bus type of the device 53 * struct bus_type - The bus type of the device
54 * 54 *
55 * @name: The name of the bus. 55 * @name: The name of the bus.
56 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
57 * @dev_root: Default device to use as the parent.
56 * @bus_attrs: Default attributes of the bus. 58 * @bus_attrs: Default attributes of the bus.
57 * @dev_attrs: Default attributes of the devices on the bus. 59 * @dev_attrs: Default attributes of the devices on the bus.
58 * @drv_attrs: Default attributes of the device drivers on the bus. 60 * @drv_attrs: Default attributes of the device drivers on the bus.
@@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
86 */ 88 */
87struct bus_type { 89struct bus_type {
88 const char *name; 90 const char *name;
91 const char *dev_name;
92 struct device *dev_root;
89 struct bus_attribute *bus_attrs; 93 struct bus_attribute *bus_attrs;
90 struct device_attribute *dev_attrs; 94 struct device_attribute *dev_attrs;
91 struct driver_attribute *drv_attrs; 95 struct driver_attribute *drv_attrs;
@@ -106,12 +110,30 @@ struct bus_type {
106 struct subsys_private *p; 110 struct subsys_private *p;
107}; 111};
108 112
109extern int __must_check bus_register(struct bus_type *bus); 113/* This is a #define to keep the compiler from merging different
114 * instances of the __key variable */
115#define bus_register(subsys) \
116({ \
117 static struct lock_class_key __key; \
118 __bus_register(subsys, &__key); \
119})
120extern int __must_check __bus_register(struct bus_type *bus,
121 struct lock_class_key *key);
110extern void bus_unregister(struct bus_type *bus); 122extern void bus_unregister(struct bus_type *bus);
111 123
112extern int __must_check bus_rescan_devices(struct bus_type *bus); 124extern int __must_check bus_rescan_devices(struct bus_type *bus);
113 125
114/* iterator helpers for buses */ 126/* iterator helpers for buses */
127struct subsys_dev_iter {
128 struct klist_iter ki;
129 const struct device_type *type;
130};
131void subsys_dev_iter_init(struct subsys_dev_iter *iter,
132 struct bus_type *subsys,
133 struct device *start,
134 const struct device_type *type);
135struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
136void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
115 137
116int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 138int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
117 int (*fn)(struct device *dev, void *data)); 139 int (*fn)(struct device *dev, void *data));
@@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start,
121struct device *bus_find_device_by_name(struct bus_type *bus, 143struct device *bus_find_device_by_name(struct bus_type *bus,
122 struct device *start, 144 struct device *start,
123 const char *name); 145 const char *name);
124 146struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
147 struct device *hint);
125int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 148int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
126 void *data, int (*fn)(struct device_driver *, void *)); 149 void *data, int (*fn)(struct device_driver *, void *));
127
128void bus_sort_breadthfirst(struct bus_type *bus, 150void bus_sort_breadthfirst(struct bus_type *bus,
129 int (*compare)(const struct device *a, 151 int (*compare)(const struct device *a,
130 const struct device *b)); 152 const struct device *b));
@@ -256,6 +278,33 @@ struct device *driver_find_device(struct device_driver *drv,
256 int (*match)(struct device *dev, void *data)); 278 int (*match)(struct device *dev, void *data));
257 279
258/** 280/**
281 * struct subsys_interface - interfaces to device functions
282 * @name name of the device function
283 * @subsystem subsytem of the devices to attach to
284 * @node the list of functions registered at the subsystem
285 * @add device hookup to device function handler
286 * @remove device hookup to device function handler
287 *
288 * Simple interfaces attached to a subsystem. Multiple interfaces can
289 * attach to a subsystem and its devices. Unlike drivers, they do not
290 * exclusively claim or control devices. Interfaces usually represent
291 * a specific functionality of a subsystem/class of devices.
292 */
293struct subsys_interface {
294 const char *name;
295 struct bus_type *subsys;
296 struct list_head node;
297 int (*add_dev)(struct device *dev, struct subsys_interface *sif);
298 int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
299};
300
301int subsys_interface_register(struct subsys_interface *sif);
302void subsys_interface_unregister(struct subsys_interface *sif);
303
304int subsys_system_register(struct bus_type *subsys,
305 const struct attribute_group **groups);
306
307/**
259 * struct class - device classes 308 * struct class - device classes
260 * @name: Name of the class. 309 * @name: Name of the class.
261 * @owner: The module owner. 310 * @owner: The module owner.
@@ -294,7 +343,7 @@ struct class {
294 struct kobject *dev_kobj; 343 struct kobject *dev_kobj;
295 344
296 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 345 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
297 char *(*devnode)(struct device *dev, mode_t *mode); 346 char *(*devnode)(struct device *dev, umode_t *mode);
298 347
299 void (*class_release)(struct class *class); 348 void (*class_release)(struct class *class);
300 void (*dev_release)(struct device *dev); 349 void (*dev_release)(struct device *dev);
@@ -423,7 +472,7 @@ struct device_type {
423 const char *name; 472 const char *name;
424 const struct attribute_group **groups; 473 const struct attribute_group **groups;
425 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 474 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
426 char *(*devnode)(struct device *dev, mode_t *mode); 475 char *(*devnode)(struct device *dev, umode_t *mode);
427 void (*release)(struct device *dev); 476 void (*release)(struct device *dev);
428 477
429 const struct dev_pm_ops *pm; 478 const struct dev_pm_ops *pm;
@@ -438,11 +487,31 @@ struct device_attribute {
438 const char *buf, size_t count); 487 const char *buf, size_t count);
439}; 488};
440 489
441#define DEVICE_ATTR(_name, _mode, _show, _store) \ 490struct dev_ext_attribute {
442struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 491 struct device_attribute attr;
492 void *var;
493};
494
495ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
496 char *buf);
497ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
498 const char *buf, size_t count);
499ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
500 char *buf);
501ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 const char *buf, size_t count);
443 503
444extern int __must_check device_create_file(struct device *device, 504#define DEVICE_ATTR(_name, _mode, _show, _store) \
445 const struct device_attribute *entry); 505 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
506#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
507 struct dev_ext_attribute dev_attr_##_name = \
508 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
509#define DEVICE_INT_ATTR(_name, _mode, _var) \
510 struct dev_ext_attribute dev_attr_##_name = \
511 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
512
513extern int device_create_file(struct device *device,
514 const struct device_attribute *entry);
446extern void device_remove_file(struct device *dev, 515extern void device_remove_file(struct device *dev,
447 const struct device_attribute *attr); 516 const struct device_attribute *attr);
448extern int __must_check device_create_bin_file(struct device *dev, 517extern int __must_check device_create_bin_file(struct device *dev,
@@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id);
490extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 559extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
491extern void devm_kfree(struct device *dev, void *p); 560extern void devm_kfree(struct device *dev, void *p);
492 561
562void __iomem *devm_request_and_ioremap(struct device *dev,
563 struct resource *res);
564
493struct device_dma_parameters { 565struct device_dma_parameters {
494 /* 566 /*
495 * a low level driver may set these to teach IOMMU code about 567 * a low level driver may set these to teach IOMMU code about
@@ -600,6 +672,7 @@ struct device {
600 struct device_node *of_node; /* associated device tree node */ 672 struct device_node *of_node; /* associated device tree node */
601 673
602 dev_t devt; /* dev_t, creates the sysfs "dev" */ 674 dev_t devt; /* dev_t, creates the sysfs "dev" */
675 u32 id; /* device instance */
603 676
604 spinlock_t devres_lock; 677 spinlock_t devres_lock;
605 struct list_head devres_head; 678 struct list_head devres_head;
@@ -720,7 +793,7 @@ extern int device_rename(struct device *dev, const char *new_name);
720extern int device_move(struct device *dev, struct device *new_parent, 793extern int device_move(struct device *dev, struct device *new_parent,
721 enum dpm_order dpm_order); 794 enum dpm_order dpm_order);
722extern const char *device_get_devnode(struct device *dev, 795extern const char *device_get_devnode(struct device *dev,
723 mode_t *mode, const char **tmp); 796 umode_t *mode, const char **tmp);
724extern void *dev_get_drvdata(const struct device *dev); 797extern void *dev_get_drvdata(const struct device *dev);
725extern int dev_set_drvdata(struct device *dev, void *data); 798extern int dev_set_drvdata(struct device *dev, void *data);
726 799
@@ -924,4 +997,25 @@ extern long sysfs_deprecated;
924#define sysfs_deprecated 0 997#define sysfs_deprecated 0
925#endif 998#endif
926 999
1000/**
1001 * module_driver() - Helper macro for drivers that don't do anything
1002 * special in module init/exit. This eliminates a lot of boilerplate.
1003 * Each module may only use this macro once, and calling it replaces
1004 * module_init() and module_exit().
1005 *
1006 * Use this macro to construct bus specific macros for registering
1007 * drivers, and do not use it on its own.
1008 */
1009#define module_driver(__driver, __register, __unregister) \
1010static int __init __driver##_init(void) \
1011{ \
1012 return __register(&(__driver)); \
1013} \
1014module_init(__driver##_init); \
1015static void __exit __driver##_exit(void) \
1016{ \
1017 __unregister(&(__driver)); \
1018} \
1019module_exit(__driver##_exit);
1020
927#endif /* _DEVICE_H_ */ 1021#endif /* _DEVICE_H_ */
diff --git a/include/linux/digsig.h b/include/linux/digsig.h
new file mode 100644
index 000000000000..efae755017d7
--- /dev/null
+++ b/include/linux/digsig.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2011 Nokia Corporation
3 * Copyright (C) 2011 Intel Corporation
4 *
5 * Author:
6 * Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
7 * <dmitry.kasatkin@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, version 2 of the License.
12 *
13 */
14
15#ifndef _DIGSIG_H
16#define _DIGSIG_H
17
18#include <linux/key.h>
19
20enum pubkey_algo {
21 PUBKEY_ALGO_RSA,
22 PUBKEY_ALGO_MAX,
23};
24
25enum digest_algo {
26 DIGEST_ALGO_SHA1,
27 DIGEST_ALGO_SHA256,
28 DIGEST_ALGO_MAX
29};
30
31struct pubkey_hdr {
32 uint8_t version; /* key format version */
33 time_t timestamp; /* key made, always 0 for now */
34 uint8_t algo;
35 uint8_t nmpi;
36 char mpi[0];
37} __packed;
38
39struct signature_hdr {
40 uint8_t version; /* signature format version */
41 time_t timestamp; /* signature made */
42 uint8_t algo;
43 uint8_t hash;
44 uint8_t keyid[8];
45 uint8_t nmpi;
46 char mpi[0];
47} __packed;
48
49#if defined(CONFIG_DIGSIG) || defined(CONFIG_DIGSIG_MODULE)
50
51int digsig_verify(struct key *keyring, const char *sig, int siglen,
52 const char *digest, int digestlen);
53
54#else
55
56static inline int digsig_verify(struct key *keyring, const char *sig,
57 int siglen, const char *digest, int digestlen)
58{
59 return -EOPNOTSUPP;
60}
61
62#endif /* CONFIG_DIGSIG */
63
64#endif /* _DIGSIG_H */
diff --git a/include/linux/display.h b/include/linux/display.h
deleted file mode 100644
index 3bf70d639728..000000000000
--- a/include/linux/display.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Copyright (C) 2006 James Simmons <jsimmons@infradead.org>
3 *
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
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 */
22
23#ifndef _LINUX_DISPLAY_H
24#define _LINUX_DISPLAY_H
25
26#include <linux/device.h>
27
28struct display_device;
29
30/* This structure defines all the properties of a Display. */
31struct display_driver {
32 int (*set_contrast)(struct display_device *, unsigned int);
33 int (*get_contrast)(struct display_device *);
34 void (*suspend)(struct display_device *, pm_message_t state);
35 void (*resume)(struct display_device *);
36 int (*probe)(struct display_device *, void *);
37 int (*remove)(struct display_device *);
38 int max_contrast;
39};
40
41struct display_device {
42 struct module *owner; /* Owner module */
43 struct display_driver *driver;
44 struct device *parent; /* This is the parent */
45 struct device *dev; /* This is this display device */
46 struct mutex lock;
47 void *priv_data;
48 char type[16];
49 char *name;
50 int idx;
51};
52
53extern struct display_device *display_device_register(struct display_driver *driver,
54 struct device *dev, void *devdata);
55extern void display_device_unregister(struct display_device *dev);
56
57extern int probe_edid(struct display_device *dev, void *devdata);
58
59#define to_display_device(obj) container_of(obj, struct display_device, class_dev)
60
61#endif
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index d4e02f5353a0..6c7f6e9546c7 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -74,15 +74,76 @@ struct dlm_lksb {
74 74
75#ifdef __KERNEL__ 75#ifdef __KERNEL__
76 76
77struct dlm_slot {
78 int nodeid; /* 1 to MAX_INT */
79 int slot; /* 1 to MAX_INT */
80};
81
82/*
83 * recover_prep: called before the dlm begins lock recovery.
84 * Notfies lockspace user that locks from failed members will be granted.
85 * recover_slot: called after recover_prep and before recover_done.
86 * Identifies a failed lockspace member.
87 * recover_done: called after the dlm completes lock recovery.
88 * Identifies lockspace members and lockspace generation number.
89 */
90
91struct dlm_lockspace_ops {
92 void (*recover_prep) (void *ops_arg);
93 void (*recover_slot) (void *ops_arg, struct dlm_slot *slot);
94 void (*recover_done) (void *ops_arg, struct dlm_slot *slots,
95 int num_slots, int our_slot, uint32_t generation);
96};
97
77/* 98/*
78 * dlm_new_lockspace 99 * dlm_new_lockspace
79 * 100 *
80 * Starts a lockspace with the given name. If the named lockspace exists in 101 * Create/join a lockspace.
81 * the cluster, the calling node joins it. 102 *
103 * name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not
104 * including terminating null).
105 *
106 * cluster: cluster name, null terminated, up to DLM_LOCKSPACE_LEN (not
107 * including terminating null). Optional. When cluster is null, it
108 * is not used. When set, dlm_new_lockspace() returns -EBADR if cluster
109 * is not equal to the dlm cluster name.
110 *
111 * flags:
112 * DLM_LSFL_NODIR
113 * The dlm should not use a resource directory, but statically assign
114 * resource mastery to nodes based on the name hash that is otherwise
115 * used to select the directory node. Must be the same on all nodes.
116 * DLM_LSFL_TIMEWARN
117 * The dlm should emit netlink messages if locks have been waiting
118 * for a configurable amount of time. (Unused.)
119 * DLM_LSFL_FS
120 * The lockspace user is in the kernel (i.e. filesystem). Enables
121 * direct bast/cast callbacks.
122 * DLM_LSFL_NEWEXCL
123 * dlm_new_lockspace() should return -EEXIST if the lockspace exists.
124 *
125 * lvblen: length of lvb in bytes. Must be multiple of 8.
126 * dlm_new_lockspace() returns an error if this does not match
127 * what other nodes are using.
128 *
129 * ops: callbacks that indicate lockspace recovery points so the
130 * caller can coordinate its recovery and know lockspace members.
131 * This is only used by the initial dlm_new_lockspace() call.
132 * Optional.
133 *
134 * ops_arg: arg for ops callbacks.
135 *
136 * ops_result: tells caller if the ops callbacks (if provided) will
137 * be used or not. 0: will be used, -EXXX will not be used.
138 * -EOPNOTSUPP: the dlm does not have recovery_callbacks enabled.
139 *
140 * lockspace: handle for dlm functions
82 */ 141 */
83 142
84int dlm_new_lockspace(const char *name, int namelen, 143int dlm_new_lockspace(const char *name, const char *cluster,
85 dlm_lockspace_t **lockspace, uint32_t flags, int lvblen); 144 uint32_t flags, int lvblen,
145 const struct dlm_lockspace_ops *ops, void *ops_arg,
146 int *ops_result, dlm_lockspace_t **lockspace);
86 147
87/* 148/*
88 * dlm_release_lockspace 149 * dlm_release_lockspace
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644
index 000000000000..f8ac076afa52
--- /dev/null
+++ b/include/linux/dma-buf.h
@@ -0,0 +1,176 @@
1/*
2 * Header file for dma buffer sharing framework.
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Author: Sumit Semwal <sumit.semwal@ti.com>
6 *
7 * Many thanks to linaro-mm-sig list, and specially
8 * Arnd Bergmann <arnd@arndb.de>, Rob Clark <rob@ti.com> and
9 * Daniel Vetter <daniel@ffwll.ch> for their support in creation and
10 * refining of this idea.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published by
14 * the Free Software Foundation.
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 with
22 * this program. If not, see <http://www.gnu.org/licenses/>.
23 */
24#ifndef __DMA_BUF_H__
25#define __DMA_BUF_H__
26
27#include <linux/file.h>
28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/scatterlist.h>
31#include <linux/list.h>
32#include <linux/dma-mapping.h>
33
34struct dma_buf;
35struct dma_buf_attachment;
36
37/**
38 * struct dma_buf_ops - operations possible on struct dma_buf
39 * @attach: [optional] allows different devices to 'attach' themselves to the
40 * given buffer. It might return -EBUSY to signal that backing storage
41 * is already allocated and incompatible with the requirements
42 * of requesting device.
43 * @detach: [optional] detach a given device from this buffer.
44 * @map_dma_buf: returns list of scatter pages allocated, increases usecount
45 * of the buffer. Requires atleast one attach to be called
46 * before. Returned sg list should already be mapped into
47 * _device_ address space. This call may sleep. May also return
48 * -EINTR. Should return -EINVAL if attach hasn't been called yet.
49 * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
50 * pages.
51 * @release: release this buffer; to be called after the last dma_buf_put.
52 */
53struct dma_buf_ops {
54 int (*attach)(struct dma_buf *, struct device *,
55 struct dma_buf_attachment *);
56
57 void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
58
59 /* For {map,unmap}_dma_buf below, any specific buffer attributes
60 * required should get added to device_dma_parameters accessible
61 * via dev->dma_params.
62 */
63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
64 enum dma_data_direction);
65 void (*unmap_dma_buf)(struct dma_buf_attachment *,
66 struct sg_table *);
67 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
68 * if the call would block.
69 */
70
71 /* after final dma_buf_put() */
72 void (*release)(struct dma_buf *);
73
74};
75
76/**
77 * struct dma_buf - shared buffer object
78 * @size: size of the buffer
79 * @file: file pointer used for sharing buffers across, and for refcounting.
80 * @attachments: list of dma_buf_attachment that denotes all devices attached.
81 * @ops: dma_buf_ops associated with this buffer object.
82 * @priv: exporter specific private data for this buffer object.
83 */
84struct dma_buf {
85 size_t size;
86 struct file *file;
87 struct list_head attachments;
88 const struct dma_buf_ops *ops;
89 /* mutex to serialize list manipulation and other ops */
90 struct mutex lock;
91 void *priv;
92};
93
94/**
95 * struct dma_buf_attachment - holds device-buffer attachment data
96 * @dmabuf: buffer for this attachment.
97 * @dev: device attached to the buffer.
98 * @node: list of dma_buf_attachment.
99 * @priv: exporter specific attachment data.
100 *
101 * This structure holds the attachment information between the dma_buf buffer
102 * and its user device(s). The list contains one attachment struct per device
103 * attached to the buffer.
104 */
105struct dma_buf_attachment {
106 struct dma_buf *dmabuf;
107 struct device *dev;
108 struct list_head node;
109 void *priv;
110};
111
112#ifdef CONFIG_DMA_SHARED_BUFFER
113struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
114 struct device *dev);
115void dma_buf_detach(struct dma_buf *dmabuf,
116 struct dma_buf_attachment *dmabuf_attach);
117struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops,
118 size_t size, int flags);
119int dma_buf_fd(struct dma_buf *dmabuf);
120struct dma_buf *dma_buf_get(int fd);
121void dma_buf_put(struct dma_buf *dmabuf);
122
123struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
124 enum dma_data_direction);
125void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
126#else
127
128static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
129 struct device *dev)
130{
131 return ERR_PTR(-ENODEV);
132}
133
134static inline void dma_buf_detach(struct dma_buf *dmabuf,
135 struct dma_buf_attachment *dmabuf_attach)
136{
137 return;
138}
139
140static inline struct dma_buf *dma_buf_export(void *priv,
141 struct dma_buf_ops *ops,
142 size_t size, int flags)
143{
144 return ERR_PTR(-ENODEV);
145}
146
147static inline int dma_buf_fd(struct dma_buf *dmabuf)
148{
149 return -ENODEV;
150}
151
152static inline struct dma_buf *dma_buf_get(int fd)
153{
154 return ERR_PTR(-ENODEV);
155}
156
157static inline void dma_buf_put(struct dma_buf *dmabuf)
158{
159 return;
160}
161
162static inline struct sg_table *dma_buf_map_attachment(
163 struct dma_buf_attachment *attach, enum dma_data_direction write)
164{
165 return ERR_PTR(-ENODEV);
166}
167
168static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
169 struct sg_table *sg)
170{
171 return;
172}
173
174#endif /* CONFIG_DMA_SHARED_BUFFER */
175
176#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index ef90cbd8e173..57c9a8ae4f2d 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -31,6 +31,7 @@ extern void free_dmar_iommu(struct intel_iommu *iommu);
31extern int iommu_calculate_agaw(struct intel_iommu *iommu); 31extern int iommu_calculate_agaw(struct intel_iommu *iommu);
32extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); 32extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
33extern int dmar_disabled; 33extern int dmar_disabled;
34extern int intel_iommu_enabled;
34#else 35#else
35static inline int iommu_calculate_agaw(struct intel_iommu *iommu) 36static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
36{ 37{
@@ -44,6 +45,7 @@ static inline void free_dmar_iommu(struct intel_iommu *iommu)
44{ 45{
45} 46}
46#define dmar_disabled (1) 47#define dmar_disabled (1)
48#define intel_iommu_enabled (0)
47#endif 49#endif
48 50
49 51
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
new file mode 100644
index 000000000000..5621547d631b
--- /dev/null
+++ b/include/linux/dynamic_queue_limits.h
@@ -0,0 +1,97 @@
1/*
2 * Dynamic queue limits (dql) - Definitions
3 *
4 * Copyright (c) 2011, Tom Herbert <therbert@google.com>
5 *
6 * This header file contains the definitions for dynamic queue limits (dql).
7 * dql would be used in conjunction with a producer/consumer type queue
8 * (possibly a HW queue). Such a queue would have these general properties:
9 *
10 * 1) Objects are queued up to some limit specified as number of objects.
11 * 2) Periodically a completion process executes which retires consumed
12 * objects.
13 * 3) Starvation occurs when limit has been reached, all queued data has
14 * actually been consumed, but completion processing has not yet run
15 * so queuing new data is blocked.
16 * 4) Minimizing the amount of queued data is desirable.
17 *
18 * The goal of dql is to calculate the limit as the minimum number of objects
19 * needed to prevent starvation.
20 *
21 * The primary functions of dql are:
22 * dql_queued - called when objects are enqueued to record number of objects
23 * dql_avail - returns how many objects are available to be queued based
24 * on the object limit and how many objects are already enqueued
25 * dql_completed - called at completion time to indicate how many objects
26 * were retired from the queue
27 *
28 * The dql implementation does not implement any locking for the dql data
29 * structures, the higher layer should provide this. dql_queued should
30 * be serialized to prevent concurrent execution of the function; this
31 * is also true for dql_completed. However, dql_queued and dlq_completed can
32 * be executed concurrently (i.e. they can be protected by different locks).
33 */
34
35#ifndef _LINUX_DQL_H
36#define _LINUX_DQL_H
37
38#ifdef __KERNEL__
39
40struct dql {
41 /* Fields accessed in enqueue path (dql_queued) */
42 unsigned int num_queued; /* Total ever queued */
43 unsigned int adj_limit; /* limit + num_completed */
44 unsigned int last_obj_cnt; /* Count at last queuing */
45
46 /* Fields accessed only by completion path (dql_completed) */
47
48 unsigned int limit ____cacheline_aligned_in_smp; /* Current limit */
49 unsigned int num_completed; /* Total ever completed */
50
51 unsigned int prev_ovlimit; /* Previous over limit */
52 unsigned int prev_num_queued; /* Previous queue total */
53 unsigned int prev_last_obj_cnt; /* Previous queuing cnt */
54
55 unsigned int lowest_slack; /* Lowest slack found */
56 unsigned long slack_start_time; /* Time slacks seen */
57
58 /* Configuration */
59 unsigned int max_limit; /* Max limit */
60 unsigned int min_limit; /* Minimum limit */
61 unsigned int slack_hold_time; /* Time to measure slack */
62};
63
64/* Set some static maximums */
65#define DQL_MAX_OBJECT (UINT_MAX / 16)
66#define DQL_MAX_LIMIT ((UINT_MAX / 2) - DQL_MAX_OBJECT)
67
68/*
69 * Record number of objects queued. Assumes that caller has already checked
70 * availability in the queue with dql_avail.
71 */
72static inline void dql_queued(struct dql *dql, unsigned int count)
73{
74 BUG_ON(count > DQL_MAX_OBJECT);
75
76 dql->num_queued += count;
77 dql->last_obj_cnt = count;
78}
79
80/* Returns how many objects can be queued, < 0 indicates over limit. */
81static inline int dql_avail(const struct dql *dql)
82{
83 return dql->adj_limit - dql->num_queued;
84}
85
86/* Record number of completed objects and recalculate the limit. */
87void dql_completed(struct dql *dql, unsigned int count);
88
89/* Reset dql state */
90void dql_reset(struct dql *dql);
91
92/* Initialize dql state */
93int dql_init(struct dql *dql, unsigned hold_time);
94
95#endif /* _KERNEL_ */
96
97#endif /* _LINUX_DQL_H */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 055b248bdd53..1cd3947987e5 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,7 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#define EDAC_OPSTATE_INVAL -1 18#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 19#define EDAC_OPSTATE_POLL 0
@@ -23,12 +23,12 @@
23extern int edac_op_state; 23extern int edac_op_state;
24extern int edac_err_assert; 24extern int edac_err_assert;
25extern atomic_t edac_handlers; 25extern atomic_t edac_handlers;
26extern struct sysdev_class edac_class; 26extern struct bus_type edac_subsys;
27 27
28extern int edac_handler_set(void); 28extern int edac_handler_set(void);
29extern void edac_atomic_assert_error(void); 29extern void edac_atomic_assert_error(void);
30extern struct sysdev_class *edac_get_sysfs_class(void); 30extern struct bus_type *edac_get_sysfs_subsys(void);
31extern void edac_put_sysfs_class(void); 31extern void edac_put_sysfs_subsys(void);
32 32
33static inline void opstate_init(void) 33static inline void opstate_init(void)
34{ 34{
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index c4627cbdb8e0..e50f98b0297a 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -33,6 +33,7 @@
33#define PCI_EEPROM_WIDTH_93C86 8 33#define PCI_EEPROM_WIDTH_93C86 8
34#define PCI_EEPROM_WIDTH_OPCODE 3 34#define PCI_EEPROM_WIDTH_OPCODE 3
35#define PCI_EEPROM_WRITE_OPCODE 0x05 35#define PCI_EEPROM_WRITE_OPCODE 0x05
36#define PCI_EEPROM_ERASE_OPCODE 0x07
36#define PCI_EEPROM_READ_OPCODE 0x06 37#define PCI_EEPROM_READ_OPCODE 0x06
37#define PCI_EEPROM_EWDS_OPCODE 0x10 38#define PCI_EEPROM_EWDS_OPCODE 0x10
38#define PCI_EEPROM_EWEN_OPCODE 0x13 39#define PCI_EEPROM_EWEN_OPCODE 0x13
@@ -46,6 +47,7 @@
46 * @register_write(struct eeprom_93cx6 *eeprom): handler to 47 * @register_write(struct eeprom_93cx6 *eeprom): handler to
47 * write to the eeprom register by using all reg_* fields. 48 * write to the eeprom register by using all reg_* fields.
48 * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines 49 * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
50 * @drive_data: Set if we're driving the data line.
49 * @reg_data_in: register field to indicate data input 51 * @reg_data_in: register field to indicate data input
50 * @reg_data_out: register field to indicate data output 52 * @reg_data_out: register field to indicate data output
51 * @reg_data_clock: register field to set the data clock 53 * @reg_data_clock: register field to set the data clock
@@ -62,6 +64,7 @@ struct eeprom_93cx6 {
62 64
63 int width; 65 int width;
64 66
67 char drive_data;
65 char reg_data_in; 68 char reg_data_in;
66 char reg_data_out; 69 char reg_data_out;
67 char reg_data_clock; 70 char reg_data_clock;
@@ -72,3 +75,8 @@ extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
72 const u8 word, u16 *data); 75 const u8 word, u16 *data);
73extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, 76extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
74 const u8 word, __le16 *data, const u16 words); 77 const u8 word, __le16 *data, const u16 words);
78
79extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
80
81extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
82 u8 addr, u16 data);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2362a0bc7f0d..37c300712e02 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -109,6 +109,14 @@ typedef struct {
109 u32 imagesize; 109 u32 imagesize;
110} efi_capsule_header_t; 110} efi_capsule_header_t;
111 111
112/*
113 * Allocation types for calls to boottime->allocate_pages.
114 */
115#define EFI_ALLOCATE_ANY_PAGES 0
116#define EFI_ALLOCATE_MAX_ADDRESS 1
117#define EFI_ALLOCATE_ADDRESS 2
118#define EFI_MAX_ALLOCATE_TYPE 3
119
112typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); 120typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
113 121
114/* 122/*
@@ -139,6 +147,57 @@ typedef struct {
139} efi_time_cap_t; 147} efi_time_cap_t;
140 148
141/* 149/*
150 * EFI Boot Services table
151 */
152typedef struct {
153 efi_table_hdr_t hdr;
154 void *raise_tpl;
155 void *restore_tpl;
156 void *allocate_pages;
157 void *free_pages;
158 void *get_memory_map;
159 void *allocate_pool;
160 void *free_pool;
161 void *create_event;
162 void *set_timer;
163 void *wait_for_event;
164 void *signal_event;
165 void *close_event;
166 void *check_event;
167 void *install_protocol_interface;
168 void *reinstall_protocol_interface;
169 void *uninstall_protocol_interface;
170 void *handle_protocol;
171 void *__reserved;
172 void *register_protocol_notify;
173 void *locate_handle;
174 void *locate_device_path;
175 void *install_configuration_table;
176 void *load_image;
177 void *start_image;
178 void *exit;
179 void *unload_image;
180 void *exit_boot_services;
181 void *get_next_monotonic_count;
182 void *stall;
183 void *set_watchdog_timer;
184 void *connect_controller;
185 void *disconnect_controller;
186 void *open_protocol;
187 void *close_protocol;
188 void *open_protocol_information;
189 void *protocols_per_handle;
190 void *locate_handle_buffer;
191 void *locate_protocol;
192 void *install_multiple_protocol_interfaces;
193 void *uninstall_multiple_protocol_interfaces;
194 void *calculate_crc32;
195 void *copy_mem;
196 void *set_mem;
197 void *create_event_ex;
198} efi_boot_services_t;
199
200/*
142 * Types and defines for EFI ResetSystem 201 * Types and defines for EFI ResetSystem
143 */ 202 */
144#define EFI_RESET_COLD 0 203#define EFI_RESET_COLD 0
@@ -236,6 +295,24 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
236#define LINUX_EFI_CRASH_GUID \ 295#define LINUX_EFI_CRASH_GUID \
237 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 ) 296 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
238 297
298#define LOADED_IMAGE_PROTOCOL_GUID \
299 EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
300
301#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
302 EFI_GUID( 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a )
303
304#define EFI_UGA_PROTOCOL_GUID \
305 EFI_GUID( 0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 )
306
307#define EFI_PCI_IO_PROTOCOL_GUID \
308 EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
309
310#define EFI_FILE_INFO_ID \
311 EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
312
313#define EFI_FILE_SYSTEM_GUID \
314 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
315
239typedef struct { 316typedef struct {
240 efi_guid_t guid; 317 efi_guid_t guid;
241 unsigned long table; 318 unsigned long table;
@@ -261,7 +338,7 @@ typedef struct {
261 unsigned long stderr_handle; 338 unsigned long stderr_handle;
262 unsigned long stderr; 339 unsigned long stderr;
263 efi_runtime_services_t *runtime; 340 efi_runtime_services_t *runtime;
264 unsigned long boottime; 341 efi_boot_services_t *boottime;
265 unsigned long nr_tables; 342 unsigned long nr_tables;
266 unsigned long tables; 343 unsigned long tables;
267} efi_system_table_t; 344} efi_system_table_t;
@@ -275,6 +352,56 @@ struct efi_memory_map {
275 unsigned long desc_size; 352 unsigned long desc_size;
276}; 353};
277 354
355typedef struct {
356 u32 revision;
357 void *parent_handle;
358 efi_system_table_t *system_table;
359 void *device_handle;
360 void *file_path;
361 void *reserved;
362 u32 load_options_size;
363 void *load_options;
364 void *image_base;
365 __aligned_u64 image_size;
366 unsigned int image_code_type;
367 unsigned int image_data_type;
368 unsigned long unload;
369} efi_loaded_image_t;
370
371typedef struct {
372 u64 revision;
373 void *open_volume;
374} efi_file_io_interface_t;
375
376typedef struct {
377 u64 size;
378 u64 file_size;
379 u64 phys_size;
380 efi_time_t create_time;
381 efi_time_t last_access_time;
382 efi_time_t modification_time;
383 __aligned_u64 attribute;
384 efi_char16_t filename[1];
385} efi_file_info_t;
386
387typedef struct {
388 u64 revision;
389 void *open;
390 void *close;
391 void *delete;
392 void *read;
393 void *write;
394 void *get_position;
395 void *set_position;
396 void *get_info;
397 void *set_info;
398 void *flush;
399} efi_file_handle_t;
400
401#define EFI_FILE_MODE_READ 0x0000000000000001
402#define EFI_FILE_MODE_WRITE 0x0000000000000002
403#define EFI_FILE_MODE_CREATE 0x8000000000000000
404
278#define EFI_INVALID_TABLE_ADDR (~0UL) 405#define EFI_INVALID_TABLE_ADDR (~0UL)
279 406
280/* 407/*
@@ -385,6 +512,13 @@ extern int __init efi_setup_pcdp_console(char *);
385#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 512#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
386 513
387/* 514/*
515 * The type of search to perform when calling boottime->locate_handle
516 */
517#define EFI_LOCATE_ALL_HANDLES 0
518#define EFI_LOCATE_BY_REGISTER_NOTIFY 1
519#define EFI_LOCATE_BY_PROTOCOL 2
520
521/*
388 * EFI Device Path information 522 * EFI Device Path information
389 */ 523 */
390#define EFI_DEV_HW 0x01 524#define EFI_DEV_HW 0x01
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 18bea78fe47b..8e2b7bac4378 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -33,6 +33,7 @@
33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
36#define EM_TI_C6000 140 /* TI C6X DSPs */
36#define EM_FRV 0x5441 /* Fujitsu FR-V */ 37#define EM_FRV 0x5441 /* Fujitsu FR-V */
37#define EM_AVR32 0x18ad /* Atmel AVR32 */ 38#define EM_AVR32 0x18ad /* Atmel AVR32 */
38 39
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index 034072cea853..fd0628be45ce 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -17,14 +17,15 @@ struct sock_extended_err {
17#define SO_EE_ORIGIN_LOCAL 1 17#define SO_EE_ORIGIN_LOCAL 1
18#define SO_EE_ORIGIN_ICMP 2 18#define SO_EE_ORIGIN_ICMP 2
19#define SO_EE_ORIGIN_ICMP6 3 19#define SO_EE_ORIGIN_ICMP6 3
20#define SO_EE_ORIGIN_TIMESTAMPING 4 20#define SO_EE_ORIGIN_TXSTATUS 4
21#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
21 22
22#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
23 24
24#ifdef __KERNEL__ 25#ifdef __KERNEL__
25 26
26#include <net/ip.h> 27#include <net/ip.h>
27#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 28#if IS_ENABLED(CONFIG_IPV6)
28#include <linux/ipv6.h> 29#include <linux/ipv6.h>
29#endif 30#endif
30 31
@@ -33,7 +34,7 @@ struct sock_extended_err {
33struct sock_exterr_skb { 34struct sock_exterr_skb {
34 union { 35 union {
35 struct inet_skb_parm h4; 36 struct inet_skb_parm h4;
36#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 37#if IS_ENABLED(CONFIG_IPV6)
37 struct inet6_skb_parm h6; 38 struct inet6_skb_parm h6;
38#endif 39#endif
39 } header; 40 } header;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index de33de1e2052..da5b2de99ae4 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -489,7 +489,10 @@ struct ethtool_rx_flow_spec {
489 * on return. 489 * on return.
490 * 490 *
491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
492 * rules on return. 492 * rules on return. If @data is non-zero on return then it is the
493 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
494 * driver supports any special location values. If that flag is not
495 * set in @data then special location values should not be used.
493 * 496 *
494 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 497 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
495 * existing rule on entry and @fs contains the rule on return. 498 * existing rule on entry and @fs contains the rule on return.
@@ -501,10 +504,23 @@ struct ethtool_rx_flow_spec {
501 * must use the second parameter to get_rxnfc() instead of @rule_locs. 504 * must use the second parameter to get_rxnfc() instead of @rule_locs.
502 * 505 *
503 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 506 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
504 * @fs.@location specifies the location to use and must not be ignored. 507 * @fs.@location either specifies the location to use or is a special
508 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
509 * @fs.@location is the actual rule location.
505 * 510 *
506 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 511 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
507 * existing rule on entry. 512 * existing rule on entry.
513 *
514 * A driver supporting the special location values for
515 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
516 * location, and may remove a rule at a later location (lower
517 * priority) that matches exactly the same set of flows. The special
518 * values are: %RX_CLS_LOC_ANY, selecting any location;
519 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
520 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
521 * location (minimum priority). Additional special values may be
522 * defined in future and drivers must return -%EINVAL for any
523 * unrecognised value.
508 */ 524 */
509struct ethtool_rxnfc { 525struct ethtool_rxnfc {
510 __u32 cmd; 526 __u32 cmd;
@@ -543,9 +559,15 @@ struct compat_ethtool_rxnfc {
543/** 559/**
544 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 560 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
545 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 561 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
546 * @size: On entry, the array size of the user buffer. On return from 562 * @size: On entry, the array size of the user buffer, which may be zero.
547 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table. 563 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
564 * indirection table.
548 * @ring_index: RX ring/queue index for each hash value 565 * @ring_index: RX ring/queue index for each hash value
566 *
567 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
568 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
569 * the table should be reset to default values. This last feature
570 * is not supported by the original implementations.
549 */ 571 */
550struct ethtool_rxfh_indir { 572struct ethtool_rxfh_indir {
551 __u32 cmd; 573 __u32 cmd;
@@ -724,9 +746,6 @@ enum ethtool_sfeatures_retval_bits {
724 746
725#include <linux/rculist.h> 747#include <linux/rculist.h>
726 748
727/* needed by dev_disable_lro() */
728extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
729
730extern int __ethtool_get_settings(struct net_device *dev, 749extern int __ethtool_get_settings(struct net_device *dev,
731 struct ethtool_cmd *cmd); 750 struct ethtool_cmd *cmd);
732 751
@@ -750,19 +769,18 @@ struct net_device;
750 769
751/* Some generic methods drivers may use in their ethtool_ops */ 770/* Some generic methods drivers may use in their ethtool_ops */
752u32 ethtool_op_get_link(struct net_device *dev); 771u32 ethtool_op_get_link(struct net_device *dev);
753u32 ethtool_op_get_tx_csum(struct net_device *dev); 772
754int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 773/**
755int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 774 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
756int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data); 775 * @index: Index in RX flow hash indirection table
757u32 ethtool_op_get_sg(struct net_device *dev); 776 * @n_rx_rings: Number of RX rings to use
758int ethtool_op_set_sg(struct net_device *dev, u32 data); 777 *
759u32 ethtool_op_get_tso(struct net_device *dev); 778 * This function provides the default policy for RX flow hash indirection.
760int ethtool_op_set_tso(struct net_device *dev, u32 data); 779 */
761u32 ethtool_op_get_ufo(struct net_device *dev); 780static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
762int ethtool_op_set_ufo(struct net_device *dev, u32 data); 781{
763u32 ethtool_op_get_flags(struct net_device *dev); 782 return index % n_rx_rings;
764int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 783}
765bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
766 784
767/** 785/**
768 * struct ethtool_ops - optional netdev operations 786 * struct ethtool_ops - optional netdev operations
@@ -807,22 +825,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
807 * @get_pauseparam: Report pause parameters 825 * @get_pauseparam: Report pause parameters
808 * @set_pauseparam: Set pause parameters. Returns a negative error code 826 * @set_pauseparam: Set pause parameters. Returns a negative error code
809 * or zero. 827 * or zero.
810 * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
811 * Report whether receive checksums are turned on or off.
812 * @set_rx_csum: Deprecated in favour of generic netdev features. Turn
813 * receive checksum on or off. Returns a negative error code or zero.
814 * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
815 * are turned on or off.
816 * @set_tx_csum: Deprecated in favour of generic netdev features. Turn
817 * transmit checksums on or off. Returns a negative error code or zero.
818 * @get_sg: Deprecated as redundant. Report whether scatter-gather is
819 * enabled.
820 * @set_sg: Deprecated in favour of generic netdev features. Turn
821 * scatter-gather on or off. Returns a negative error code or zero.
822 * @get_tso: Deprecated as redundant. Report whether TCP segmentation
823 * offload is enabled.
824 * @set_tso: Deprecated in favour of generic netdev features. Turn TCP
825 * segmentation offload on or off. Returns a negative error code or zero.
826 * @self_test: Run specified self-tests 828 * @self_test: Run specified self-tests
827 * @get_strings: Return a set of strings that describe the requested objects 829 * @get_strings: Return a set of strings that describe the requested objects
828 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED 830 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED
@@ -844,15 +846,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
844 * negative error code or zero. 846 * negative error code or zero.
845 * @complete: Function to be called after any other operation except 847 * @complete: Function to be called after any other operation except
846 * @begin. Will be called even if the other operation failed. 848 * @begin. Will be called even if the other operation failed.
847 * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
848 * offload is enabled.
849 * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
850 * fragmentation offload on or off. Returns a negative error code or zero.
851 * @get_flags: Deprecated as redundant. Report features included in
852 * &enum ethtool_flags that are enabled.
853 * @set_flags: Deprecated in favour of generic netdev features. Turn
854 * features included in &enum ethtool_flags on or off. Returns a
855 * negative error code or zero.
856 * @get_priv_flags: Report driver-specific feature flags. 849 * @get_priv_flags: Report driver-specific feature flags.
857 * @set_priv_flags: Set driver-specific feature flags. Returns a negative 850 * @set_priv_flags: Set driver-specific feature flags. Returns a negative
858 * error code or zero. 851 * error code or zero.
@@ -866,11 +859,13 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
866 * @reset: Reset (part of) the device, as specified by a bitmask of 859 * @reset: Reset (part of) the device, as specified by a bitmask of
867 * flags from &enum ethtool_reset_flags. Returns a negative 860 * flags from &enum ethtool_reset_flags. Returns a negative
868 * error code or zero. 861 * error code or zero.
869 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code 862 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
870 * or zero. 863 * Returns zero if not supported for this specific device.
871 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 864 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
865 * Will not be called if @get_rxfh_indir_size returns zero.
872 * Returns a negative error code or zero. 866 * Returns a negative error code or zero.
873 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 867 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
868 * Will not be called if @get_rxfh_indir_size returns zero.
874 * Returns a negative error code or zero. 869 * Returns a negative error code or zero.
875 * @get_channels: Get number of channels. 870 * @get_channels: Get number of channels.
876 * @set_channels: Set number of channels. Returns a negative error code or 871 * @set_channels: Set number of channels. Returns a negative error code or
@@ -917,14 +912,6 @@ struct ethtool_ops {
917 struct ethtool_pauseparam*); 912 struct ethtool_pauseparam*);
918 int (*set_pauseparam)(struct net_device *, 913 int (*set_pauseparam)(struct net_device *,
919 struct ethtool_pauseparam*); 914 struct ethtool_pauseparam*);
920 u32 (*get_rx_csum)(struct net_device *);
921 int (*set_rx_csum)(struct net_device *, u32);
922 u32 (*get_tx_csum)(struct net_device *);
923 int (*set_tx_csum)(struct net_device *, u32);
924 u32 (*get_sg)(struct net_device *);
925 int (*set_sg)(struct net_device *, u32);
926 u32 (*get_tso)(struct net_device *);
927 int (*set_tso)(struct net_device *, u32);
928 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 915 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
929 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 916 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
930 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); 917 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
@@ -932,10 +919,6 @@ struct ethtool_ops {
932 struct ethtool_stats *, u64 *); 919 struct ethtool_stats *, u64 *);
933 int (*begin)(struct net_device *); 920 int (*begin)(struct net_device *);
934 void (*complete)(struct net_device *); 921 void (*complete)(struct net_device *);
935 u32 (*get_ufo)(struct net_device *);
936 int (*set_ufo)(struct net_device *, u32);
937 u32 (*get_flags)(struct net_device *);
938 int (*set_flags)(struct net_device *, u32);
939 u32 (*get_priv_flags)(struct net_device *); 922 u32 (*get_priv_flags)(struct net_device *);
940 int (*set_priv_flags)(struct net_device *, u32); 923 int (*set_priv_flags)(struct net_device *, u32);
941 int (*get_sset_count)(struct net_device *, int); 924 int (*get_sset_count)(struct net_device *, int);
@@ -944,12 +927,9 @@ struct ethtool_ops {
944 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 927 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
945 int (*flash_device)(struct net_device *, struct ethtool_flash *); 928 int (*flash_device)(struct net_device *, struct ethtool_flash *);
946 int (*reset)(struct net_device *, u32 *); 929 int (*reset)(struct net_device *, u32 *);
947 int (*set_rx_ntuple)(struct net_device *, 930 u32 (*get_rxfh_indir_size)(struct net_device *);
948 struct ethtool_rx_ntuple *); 931 int (*get_rxfh_indir)(struct net_device *, u32 *);
949 int (*get_rxfh_indir)(struct net_device *, 932 int (*set_rxfh_indir)(struct net_device *, const u32 *);
950 struct ethtool_rxfh_indir *);
951 int (*set_rxfh_indir)(struct net_device *,
952 const struct ethtool_rxfh_indir *);
953 void (*get_channels)(struct net_device *, struct ethtool_channels *); 933 void (*get_channels)(struct net_device *, struct ethtool_channels *);
954 int (*set_channels)(struct net_device *, struct ethtool_channels *); 934 int (*set_channels)(struct net_device *, struct ethtool_channels *);
955 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 935 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
@@ -1173,6 +1153,12 @@ struct ethtool_ops {
1173 1153
1174#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 1154#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1175 1155
1156/* Special RX classification rule insert location values */
1157#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1158#define RX_CLS_LOC_ANY 0xffffffff
1159#define RX_CLS_LOC_FIRST 0xfffffffe
1160#define RX_CLS_LOC_LAST 0xfffffffd
1161
1176/* Reset flags */ 1162/* Reset flags */
1177/* The reset() operation must clear the flags for the components which 1163/* The reset() operation must clear the flags for the components which
1178 * were actually reset. On successful return, the flags indicate the 1164 * were actually reset. On successful return, the flags indicate the
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f362733186a5..657ab55beda0 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -61,6 +61,7 @@ struct file;
61static inline void eventpoll_init_file(struct file *file) 61static inline void eventpoll_init_file(struct file *file)
62{ 62{
63 INIT_LIST_HEAD(&file->f_ep_links); 63 INIT_LIST_HEAD(&file->f_ep_links);
64 INIT_LIST_HEAD(&file->f_tfile_llink);
64} 65}
65 66
66 67
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index dec99116a0e4..f957085d40ed 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -884,7 +884,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct
884 884
885/* ialloc.c */ 885/* ialloc.c */
886extern struct inode * ext3_new_inode (handle_t *, struct inode *, 886extern struct inode * ext3_new_inode (handle_t *, struct inode *,
887 const struct qstr *, int); 887 const struct qstr *, umode_t);
888extern void ext3_free_inode (handle_t *, struct inode *); 888extern void ext3_free_inode (handle_t *, struct inode *);
889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); 889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
890extern unsigned long ext3_count_free_inodes (struct super_block *); 890extern unsigned long ext3_count_free_inodes (struct super_block *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d6836c498dd..c18122f40543 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -45,6 +45,7 @@
45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ 45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
46#define FB_TYPE_TEXT 3 /* Text/attributes */ 46#define FB_TYPE_TEXT 3 /* Text/attributes */
47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ 47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
48#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
48 49
49#define FB_AUX_TEXT_MDA 0 /* Monochrome text */ 50#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
50#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ 51#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
@@ -69,6 +70,7 @@
69#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ 70#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
70#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ 71#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
71#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ 72#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
73#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
72 74
73#define FB_ACCEL_NONE 0 /* no hardware accelerator */ 75#define FB_ACCEL_NONE 0 /* no hardware accelerator */
74#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ 76#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
@@ -154,6 +156,8 @@
154 156
155#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */ 157#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
156 158
159#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
160
157struct fb_fix_screeninfo { 161struct fb_fix_screeninfo {
158 char id[16]; /* identification string eg "TT Builtin" */ 162 char id[16]; /* identification string eg "TT Builtin" */
159 unsigned long smem_start; /* Start of frame buffer mem */ 163 unsigned long smem_start; /* Start of frame buffer mem */
@@ -171,7 +175,8 @@ struct fb_fix_screeninfo {
171 __u32 mmio_len; /* Length of Memory Mapped I/O */ 175 __u32 mmio_len; /* Length of Memory Mapped I/O */
172 __u32 accel; /* Indicate to driver which */ 176 __u32 accel; /* Indicate to driver which */
173 /* specific chip/card we have */ 177 /* specific chip/card we have */
174 __u16 reserved[3]; /* Reserved for future compatibility */ 178 __u16 capabilities; /* see FB_CAP_* */
179 __u16 reserved[2]; /* Reserved for future compatibility */
175}; 180};
176 181
177/* Interpretation of offset for color fields: All offsets are from the right, 182/* Interpretation of offset for color fields: All offsets are from the right,
@@ -246,8 +251,8 @@ struct fb_var_screeninfo {
246 __u32 yoffset; /* resolution */ 251 __u32 yoffset; /* resolution */
247 252
248 __u32 bits_per_pixel; /* guess what */ 253 __u32 bits_per_pixel; /* guess what */
249 __u32 grayscale; /* != 0 Graylevels instead of colors */ 254 __u32 grayscale; /* 0 = color, 1 = grayscale, */
250 255 /* >1 = FOURCC */
251 struct fb_bitfield red; /* bitfield in fb mem if true color, */ 256 struct fb_bitfield red; /* bitfield in fb mem if true color, */
252 struct fb_bitfield green; /* else only length is significant */ 257 struct fb_bitfield green; /* else only length is significant */
253 struct fb_bitfield blue; 258 struct fb_bitfield blue;
@@ -273,7 +278,8 @@ struct fb_var_screeninfo {
273 __u32 sync; /* see FB_SYNC_* */ 278 __u32 sync; /* see FB_SYNC_* */
274 __u32 vmode; /* see FB_VMODE_* */ 279 __u32 vmode; /* see FB_VMODE_* */
275 __u32 rotate; /* angle we rotate counter clockwise */ 280 __u32 rotate; /* angle we rotate counter clockwise */
276 __u32 reserved[5]; /* Reserved for future compatibility */ 281 __u32 colorspace; /* colorspace for FOURCC-based modes */
282 __u32 reserved[4]; /* Reserved for future compatibility */
277}; 283};
278 284
279struct fb_cmap { 285struct fb_cmap {
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index a5386e3ee756..0ab54e16a91f 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -5,71 +5,58 @@
5 5
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/wait.h> 7#include <linux/wait.h>
8#include <linux/atomic.h>
8 9
9#ifdef CONFIG_FREEZER 10#ifdef CONFIG_FREEZER
11extern atomic_t system_freezing_cnt; /* nr of freezing conds in effect */
12extern bool pm_freezing; /* PM freezing in effect */
13extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
14
10/* 15/*
11 * Check if a process has been frozen 16 * Check if a process has been frozen
12 */ 17 */
13static inline int frozen(struct task_struct *p) 18static inline bool frozen(struct task_struct *p)
14{ 19{
15 return p->flags & PF_FROZEN; 20 return p->flags & PF_FROZEN;
16} 21}
17 22
18/* 23extern bool freezing_slow_path(struct task_struct *p);
19 * Check if there is a request to freeze a process
20 */
21static inline int freezing(struct task_struct *p)
22{
23 return test_tsk_thread_flag(p, TIF_FREEZE);
24}
25
26/*
27 * Request that a process be frozen
28 */
29static inline void set_freeze_flag(struct task_struct *p)
30{
31 set_tsk_thread_flag(p, TIF_FREEZE);
32}
33 24
34/* 25/*
35 * Sometimes we may need to cancel the previous 'freeze' request 26 * Check if there is a request to freeze a process
36 */ 27 */
37static inline void clear_freeze_flag(struct task_struct *p) 28static inline bool freezing(struct task_struct *p)
38{
39 clear_tsk_thread_flag(p, TIF_FREEZE);
40}
41
42static inline bool should_send_signal(struct task_struct *p)
43{ 29{
44 return !(p->flags & PF_FREEZER_NOSIG); 30 if (likely(!atomic_read(&system_freezing_cnt)))
31 return false;
32 return freezing_slow_path(p);
45} 33}
46 34
47/* Takes and releases task alloc lock using task_lock() */ 35/* Takes and releases task alloc lock using task_lock() */
48extern int thaw_process(struct task_struct *p); 36extern void __thaw_task(struct task_struct *t);
49 37
50extern void refrigerator(void); 38extern bool __refrigerator(bool check_kthr_stop);
51extern int freeze_processes(void); 39extern int freeze_processes(void);
52extern int freeze_kernel_threads(void); 40extern int freeze_kernel_threads(void);
53extern void thaw_processes(void); 41extern void thaw_processes(void);
54 42
55static inline int try_to_freeze(void) 43static inline bool try_to_freeze(void)
56{ 44{
57 if (freezing(current)) { 45 might_sleep();
58 refrigerator(); 46 if (likely(!freezing(current)))
59 return 1; 47 return false;
60 } else 48 return __refrigerator(false);
61 return 0;
62} 49}
63 50
64extern bool freeze_task(struct task_struct *p, bool sig_only); 51extern bool freeze_task(struct task_struct *p);
65extern void cancel_freezing(struct task_struct *p); 52extern bool set_freezable(void);
66 53
67#ifdef CONFIG_CGROUP_FREEZER 54#ifdef CONFIG_CGROUP_FREEZER
68extern int cgroup_freezing_or_frozen(struct task_struct *task); 55extern bool cgroup_freezing(struct task_struct *task);
69#else /* !CONFIG_CGROUP_FREEZER */ 56#else /* !CONFIG_CGROUP_FREEZER */
70static inline int cgroup_freezing_or_frozen(struct task_struct *task) 57static inline bool cgroup_freezing(struct task_struct *task)
71{ 58{
72 return 0; 59 return false;
73} 60}
74#endif /* !CONFIG_CGROUP_FREEZER */ 61#endif /* !CONFIG_CGROUP_FREEZER */
75 62
@@ -80,33 +67,27 @@ static inline int cgroup_freezing_or_frozen(struct task_struct *task)
80 * appropriately in case the child has exited before the freezing of tasks is 67 * appropriately in case the child has exited before the freezing of tasks is
81 * complete. However, we don't want kernel threads to be frozen in unexpected 68 * complete. However, we don't want kernel threads to be frozen in unexpected
82 * places, so we allow them to block freeze_processes() instead or to set 69 * places, so we allow them to block freeze_processes() instead or to set
83 * PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork 70 * PF_NOFREEZE if needed. Fortunately, in the ____call_usermodehelper() case the
84 * parents. Fortunately, in the ____call_usermodehelper() case the parent won't 71 * parent won't really block freeze_processes(), since ____call_usermodehelper()
85 * really block freeze_processes(), since ____call_usermodehelper() (the child) 72 * (the child) does a little before exec/exit and it can't be frozen before
86 * does a little before exec/exit and it can't be frozen before waking up the 73 * waking up the parent.
87 * parent.
88 */ 74 */
89 75
90/* 76
91 * If the current task is a user space one, tell the freezer not to count it as 77/* Tell the freezer not to count the current task as freezable. */
92 * freezable.
93 */
94static inline void freezer_do_not_count(void) 78static inline void freezer_do_not_count(void)
95{ 79{
96 if (current->mm) 80 current->flags |= PF_FREEZER_SKIP;
97 current->flags |= PF_FREEZER_SKIP;
98} 81}
99 82
100/* 83/*
101 * If the current task is a user space one, tell the freezer to count it as 84 * Tell the freezer to count the current task as freezable again and try to
102 * freezable again and try to freeze it. 85 * freeze it.
103 */ 86 */
104static inline void freezer_count(void) 87static inline void freezer_count(void)
105{ 88{
106 if (current->mm) { 89 current->flags &= ~PF_FREEZER_SKIP;
107 current->flags &= ~PF_FREEZER_SKIP; 90 try_to_freeze();
108 try_to_freeze();
109 }
110} 91}
111 92
112/* 93/*
@@ -118,21 +99,29 @@ static inline int freezer_should_skip(struct task_struct *p)
118} 99}
119 100
120/* 101/*
121 * Tell the freezer that the current task should be frozen by it 102 * These macros are intended to be used whenever you want allow a task that's
103 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
104 * that neither return any clear indication of whether a freeze event happened
105 * while in this function.
122 */ 106 */
123static inline void set_freezable(void)
124{
125 current->flags &= ~PF_NOFREEZE;
126}
127 107
128/* 108/* Like schedule(), but should not block the freezer. */
129 * Tell the freezer that the current task should be frozen by it and that it 109#define freezable_schedule() \
130 * should send a fake signal to the task to freeze it. 110({ \
131 */ 111 freezer_do_not_count(); \
132static inline void set_freezable_with_signal(void) 112 schedule(); \
133{ 113 freezer_count(); \
134 current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG); 114})
135} 115
116/* Like schedule_timeout_killable(), but should not block the freezer. */
117#define freezable_schedule_timeout_killable(timeout) \
118({ \
119 long __retval; \
120 freezer_do_not_count(); \
121 __retval = schedule_timeout_killable(timeout); \
122 freezer_count(); \
123 __retval; \
124})
136 125
137/* 126/*
138 * Freezer-friendly wrappers around wait_event_interruptible(), 127 * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -152,47 +141,51 @@ static inline void set_freezable_with_signal(void)
152#define wait_event_freezable(wq, condition) \ 141#define wait_event_freezable(wq, condition) \
153({ \ 142({ \
154 int __retval; \ 143 int __retval; \
155 do { \ 144 for (;;) { \
156 __retval = wait_event_interruptible(wq, \ 145 __retval = wait_event_interruptible(wq, \
157 (condition) || freezing(current)); \ 146 (condition) || freezing(current)); \
158 if (__retval && !freezing(current)) \ 147 if (__retval || (condition)) \
159 break; \ 148 break; \
160 else if (!(condition)) \ 149 try_to_freeze(); \
161 __retval = -ERESTARTSYS; \ 150 } \
162 } while (try_to_freeze()); \
163 __retval; \ 151 __retval; \
164}) 152})
165 153
166
167#define wait_event_freezable_timeout(wq, condition, timeout) \ 154#define wait_event_freezable_timeout(wq, condition, timeout) \
168({ \ 155({ \
169 long __retval = timeout; \ 156 long __retval = timeout; \
170 do { \ 157 for (;;) { \
171 __retval = wait_event_interruptible_timeout(wq, \ 158 __retval = wait_event_interruptible_timeout(wq, \
172 (condition) || freezing(current), \ 159 (condition) || freezing(current), \
173 __retval); \ 160 __retval); \
174 } while (try_to_freeze()); \ 161 if (__retval <= 0 || (condition)) \
162 break; \
163 try_to_freeze(); \
164 } \
175 __retval; \ 165 __retval; \
176}) 166})
167
177#else /* !CONFIG_FREEZER */ 168#else /* !CONFIG_FREEZER */
178static inline int frozen(struct task_struct *p) { return 0; } 169static inline bool frozen(struct task_struct *p) { return false; }
179static inline int freezing(struct task_struct *p) { return 0; } 170static inline bool freezing(struct task_struct *p) { return false; }
180static inline void set_freeze_flag(struct task_struct *p) {} 171static inline void __thaw_task(struct task_struct *t) {}
181static inline void clear_freeze_flag(struct task_struct *p) {}
182static inline int thaw_process(struct task_struct *p) { return 1; }
183 172
184static inline void refrigerator(void) {} 173static inline bool __refrigerator(bool check_kthr_stop) { return false; }
185static inline int freeze_processes(void) { return -ENOSYS; } 174static inline int freeze_processes(void) { return -ENOSYS; }
186static inline int freeze_kernel_threads(void) { return -ENOSYS; } 175static inline int freeze_kernel_threads(void) { return -ENOSYS; }
187static inline void thaw_processes(void) {} 176static inline void thaw_processes(void) {}
188 177
189static inline int try_to_freeze(void) { return 0; } 178static inline bool try_to_freeze(void) { return false; }
190 179
191static inline void freezer_do_not_count(void) {} 180static inline void freezer_do_not_count(void) {}
192static inline void freezer_count(void) {} 181static inline void freezer_count(void) {}
193static inline int freezer_should_skip(struct task_struct *p) { return 0; } 182static inline int freezer_should_skip(struct task_struct *p) { return 0; }
194static inline void set_freezable(void) {} 183static inline void set_freezable(void) {}
195static inline void set_freezable_with_signal(void) {} 184
185#define freezable_schedule() schedule()
186
187#define freezable_schedule_timeout_killable(timeout) \
188 schedule_timeout_killable(timeout)
196 189
197#define wait_event_freezable(wq, condition) \ 190#define wait_event_freezable(wq, condition) \
198 wait_event_interruptible(wq, condition) 191 wait_event_interruptible(wq, condition)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e0bc4ffb8e7f..4bc8169fb5a1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -525,6 +525,7 @@ enum positive_aop_returns {
525struct page; 525struct page;
526struct address_space; 526struct address_space;
527struct writeback_control; 527struct writeback_control;
528enum migrate_mode;
528 529
529struct iov_iter { 530struct iov_iter {
530 const struct iovec *iov; 531 const struct iovec *iov;
@@ -609,9 +610,12 @@ struct address_space_operations {
609 loff_t offset, unsigned long nr_segs); 610 loff_t offset, unsigned long nr_segs);
610 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 611 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
611 void **, unsigned long *); 612 void **, unsigned long *);
612 /* migrate the contents of a page to the specified target */ 613 /*
614 * migrate the contents of a page to the specified target. If sync
615 * is false, it must not block.
616 */
613 int (*migratepage) (struct address_space *, 617 int (*migratepage) (struct address_space *,
614 struct page *, struct page *); 618 struct page *, struct page *, enum migrate_mode);
615 int (*launder_page) (struct page *); 619 int (*launder_page) (struct page *);
616 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 620 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
617 unsigned long); 621 unsigned long);
@@ -656,6 +660,7 @@ struct address_space {
656 * must be enforced here for CRIS, to let the least significant bit 660 * must be enforced here for CRIS, to let the least significant bit
657 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. 661 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
658 */ 662 */
663struct request_queue;
659 664
660struct block_device { 665struct block_device {
661 dev_t bd_dev; /* not a kdev_t - it's a search key */ 666 dev_t bd_dev; /* not a kdev_t - it's a search key */
@@ -678,6 +683,7 @@ struct block_device {
678 unsigned bd_part_count; 683 unsigned bd_part_count;
679 int bd_invalidated; 684 int bd_invalidated;
680 struct gendisk * bd_disk; 685 struct gendisk * bd_disk;
686 struct request_queue * bd_queue;
681 struct list_head bd_list; 687 struct list_head bd_list;
682 /* 688 /*
683 * Private data. You must have bd_claim'ed the block_device 689 * Private data. You must have bd_claim'ed the block_device
@@ -1001,6 +1007,7 @@ struct file {
1001#ifdef CONFIG_EPOLL 1007#ifdef CONFIG_EPOLL
1002 /* Used by fs/eventpoll.c to link all the hooks to this file */ 1008 /* Used by fs/eventpoll.c to link all the hooks to this file */
1003 struct list_head f_ep_links; 1009 struct list_head f_ep_links;
1010 struct list_head f_tfile_llink;
1004#endif /* #ifdef CONFIG_EPOLL */ 1011#endif /* #ifdef CONFIG_EPOLL */
1005 struct address_space *f_mapping; 1012 struct address_space *f_mapping;
1006#ifdef CONFIG_DEBUG_WRITECOUNT 1013#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1428,6 +1435,7 @@ struct super_block {
1428#else 1435#else
1429 struct list_head s_files; 1436 struct list_head s_files;
1430#endif 1437#endif
1438 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1431 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ 1439 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1432 struct list_head s_dentry_lru; /* unused dentry lru */ 1440 struct list_head s_dentry_lru; /* unused dentry lru */
1433 int s_nr_dentry_unused; /* # of dentry on lru */ 1441 int s_nr_dentry_unused; /* # of dentry on lru */
@@ -1440,7 +1448,7 @@ struct super_block {
1440 struct block_device *s_bdev; 1448 struct block_device *s_bdev;
1441 struct backing_dev_info *s_bdi; 1449 struct backing_dev_info *s_bdi;
1442 struct mtd_info *s_mtd; 1450 struct mtd_info *s_mtd;
1443 struct list_head s_instances; 1451 struct hlist_node s_instances;
1444 struct quota_info s_dquot; /* Diskquota specific options */ 1452 struct quota_info s_dquot; /* Diskquota specific options */
1445 1453
1446 int s_frozen; 1454 int s_frozen;
@@ -1481,6 +1489,12 @@ struct super_block {
1481 int cleancache_poolid; 1489 int cleancache_poolid;
1482 1490
1483 struct shrinker s_shrink; /* per-sb shrinker handle */ 1491 struct shrinker s_shrink; /* per-sb shrinker handle */
1492
1493 /* Number of inodes with nlink == 0 but still referenced */
1494 atomic_long_t s_remove_count;
1495
1496 /* Being remounted read-only */
1497 int s_readonly_remount;
1484}; 1498};
1485 1499
1486/* superblock cache pruning functions */ 1500/* superblock cache pruning functions */
@@ -1516,9 +1530,9 @@ extern void unlock_super(struct super_block *);
1516/* 1530/*
1517 * VFS helper functions.. 1531 * VFS helper functions..
1518 */ 1532 */
1519extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1533extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
1520extern int vfs_mkdir(struct inode *, struct dentry *, int); 1534extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
1521extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1535extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
1522extern int vfs_symlink(struct inode *, struct dentry *, const char *); 1536extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1523extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1537extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1524extern int vfs_rmdir(struct inode *, struct dentry *); 1538extern int vfs_rmdir(struct inode *, struct dentry *);
@@ -1534,7 +1548,7 @@ extern void dentry_unhash(struct dentry *dentry);
1534 * VFS file helper functions. 1548 * VFS file helper functions.
1535 */ 1549 */
1536extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1550extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1537 mode_t mode); 1551 umode_t mode);
1538/* 1552/*
1539 * VFS FS_IOC_FIEMAP helper definitions. 1553 * VFS FS_IOC_FIEMAP helper definitions.
1540 */ 1554 */
@@ -1619,13 +1633,13 @@ struct inode_operations {
1619 int (*readlink) (struct dentry *, char __user *,int); 1633 int (*readlink) (struct dentry *, char __user *,int);
1620 void (*put_link) (struct dentry *, struct nameidata *, void *); 1634 void (*put_link) (struct dentry *, struct nameidata *, void *);
1621 1635
1622 int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 1636 int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
1623 int (*link) (struct dentry *,struct inode *,struct dentry *); 1637 int (*link) (struct dentry *,struct inode *,struct dentry *);
1624 int (*unlink) (struct inode *,struct dentry *); 1638 int (*unlink) (struct inode *,struct dentry *);
1625 int (*symlink) (struct inode *,struct dentry *,const char *); 1639 int (*symlink) (struct inode *,struct dentry *,const char *);
1626 int (*mkdir) (struct inode *,struct dentry *,int); 1640 int (*mkdir) (struct inode *,struct dentry *,umode_t);
1627 int (*rmdir) (struct inode *,struct dentry *); 1641 int (*rmdir) (struct inode *,struct dentry *);
1628 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1642 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1629 int (*rename) (struct inode *, struct dentry *, 1643 int (*rename) (struct inode *, struct dentry *,
1630 struct inode *, struct dentry *); 1644 struct inode *, struct dentry *);
1631 void (*truncate) (struct inode *); 1645 void (*truncate) (struct inode *);
@@ -1672,10 +1686,10 @@ struct super_operations {
1672 int (*remount_fs) (struct super_block *, int *, char *); 1686 int (*remount_fs) (struct super_block *, int *, char *);
1673 void (*umount_begin) (struct super_block *); 1687 void (*umount_begin) (struct super_block *);
1674 1688
1675 int (*show_options)(struct seq_file *, struct vfsmount *); 1689 int (*show_options)(struct seq_file *, struct dentry *);
1676 int (*show_devname)(struct seq_file *, struct vfsmount *); 1690 int (*show_devname)(struct seq_file *, struct dentry *);
1677 int (*show_path)(struct seq_file *, struct vfsmount *); 1691 int (*show_path)(struct seq_file *, struct dentry *);
1678 int (*show_stats)(struct seq_file *, struct vfsmount *); 1692 int (*show_stats)(struct seq_file *, struct dentry *);
1679#ifdef CONFIG_QUOTA 1693#ifdef CONFIG_QUOTA
1680 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1694 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1681 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1695 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@ -1764,31 +1778,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1764 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1778 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1765} 1779}
1766 1780
1767/** 1781extern void inc_nlink(struct inode *inode);
1768 * set_nlink - directly set an inode's link count 1782extern void drop_nlink(struct inode *inode);
1769 * @inode: inode 1783extern void clear_nlink(struct inode *inode);
1770 * @nlink: new nlink (should be non-zero) 1784extern void set_nlink(struct inode *inode, unsigned int nlink);
1771 *
1772 * This is a low-level filesystem helper to replace any
1773 * direct filesystem manipulation of i_nlink.
1774 */
1775static inline void set_nlink(struct inode *inode, unsigned int nlink)
1776{
1777 inode->__i_nlink = nlink;
1778}
1779
1780/**
1781 * inc_nlink - directly increment an inode's link count
1782 * @inode: inode
1783 *
1784 * This is a low-level filesystem helper to replace any
1785 * direct filesystem manipulation of i_nlink. Currently,
1786 * it is only here for parity with dec_nlink().
1787 */
1788static inline void inc_nlink(struct inode *inode)
1789{
1790 inode->__i_nlink++;
1791}
1792 1785
1793static inline void inode_inc_link_count(struct inode *inode) 1786static inline void inode_inc_link_count(struct inode *inode)
1794{ 1787{
@@ -1796,35 +1789,6 @@ static inline void inode_inc_link_count(struct inode *inode)
1796 mark_inode_dirty(inode); 1789 mark_inode_dirty(inode);
1797} 1790}
1798 1791
1799/**
1800 * drop_nlink - directly drop an inode's link count
1801 * @inode: inode
1802 *
1803 * This is a low-level filesystem helper to replace any
1804 * direct filesystem manipulation of i_nlink. In cases
1805 * where we are attempting to track writes to the
1806 * filesystem, a decrement to zero means an imminent
1807 * write when the file is truncated and actually unlinked
1808 * on the filesystem.
1809 */
1810static inline void drop_nlink(struct inode *inode)
1811{
1812 inode->__i_nlink--;
1813}
1814
1815/**
1816 * clear_nlink - directly zero an inode's link count
1817 * @inode: inode
1818 *
1819 * This is a low-level filesystem helper to replace any
1820 * direct filesystem manipulation of i_nlink. See
1821 * drop_nlink() for why we care about i_nlink hitting zero.
1822 */
1823static inline void clear_nlink(struct inode *inode)
1824{
1825 inode->__i_nlink = 0;
1826}
1827
1828static inline void inode_dec_link_count(struct inode *inode) 1792static inline void inode_dec_link_count(struct inode *inode)
1829{ 1793{
1830 drop_nlink(inode); 1794 drop_nlink(inode);
@@ -1864,7 +1828,7 @@ struct file_system_type {
1864 void (*kill_sb) (struct super_block *); 1828 void (*kill_sb) (struct super_block *);
1865 struct module *owner; 1829 struct module *owner;
1866 struct file_system_type * next; 1830 struct file_system_type * next;
1867 struct list_head fs_supers; 1831 struct hlist_head fs_supers;
1868 1832
1869 struct lock_class_key s_lock_key; 1833 struct lock_class_key s_lock_key;
1870 struct lock_class_key s_umount_key; 1834 struct lock_class_key s_umount_key;
@@ -1939,7 +1903,7 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1939extern int vfs_statfs(struct path *, struct kstatfs *); 1903extern int vfs_statfs(struct path *, struct kstatfs *);
1940extern int user_statfs(const char __user *, struct kstatfs *); 1904extern int user_statfs(const char __user *, struct kstatfs *);
1941extern int fd_statfs(int, struct kstatfs *); 1905extern int fd_statfs(int, struct kstatfs *);
1942extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1906extern int vfs_ustat(dev_t, struct kstatfs *);
1943extern int freeze_super(struct super_block *super); 1907extern int freeze_super(struct super_block *super);
1944extern int thaw_super(struct super_block *super); 1908extern int thaw_super(struct super_block *super);
1945extern bool our_mnt(struct vfsmount *mnt); 1909extern bool our_mnt(struct vfsmount *mnt);
@@ -2054,8 +2018,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2054extern int do_fallocate(struct file *file, int mode, loff_t offset, 2018extern int do_fallocate(struct file *file, int mode, loff_t offset,
2055 loff_t len); 2019 loff_t len);
2056extern long do_sys_open(int dfd, const char __user *filename, int flags, 2020extern long do_sys_open(int dfd, const char __user *filename, int flags,
2057 int mode); 2021 umode_t mode);
2058extern struct file *filp_open(const char *, int, int); 2022extern struct file *filp_open(const char *, int, umode_t);
2059extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2023extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2060 const char *, int); 2024 const char *, int);
2061extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 2025extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
@@ -2092,6 +2056,7 @@ extern void bd_forget(struct inode *inode);
2092extern void bdput(struct block_device *); 2056extern void bdput(struct block_device *);
2093extern void invalidate_bdev(struct block_device *); 2057extern void invalidate_bdev(struct block_device *);
2094extern int sync_blockdev(struct block_device *bdev); 2058extern int sync_blockdev(struct block_device *bdev);
2059extern void kill_bdev(struct block_device *);
2095extern struct super_block *freeze_bdev(struct block_device *); 2060extern struct super_block *freeze_bdev(struct block_device *);
2096extern void emergency_thaw_all(void); 2061extern void emergency_thaw_all(void);
2097extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2062extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
@@ -2099,6 +2064,7 @@ extern int fsync_bdev(struct block_device *);
2099#else 2064#else
2100static inline void bd_forget(struct inode *inode) {} 2065static inline void bd_forget(struct inode *inode) {}
2101static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2066static inline int sync_blockdev(struct block_device *bdev) { return 0; }
2067static inline void kill_bdev(struct block_device *bdev) {}
2102static inline void invalidate_bdev(struct block_device *bdev) {} 2068static inline void invalidate_bdev(struct block_device *bdev) {}
2103 2069
2104static inline struct super_block *freeze_bdev(struct block_device *sb) 2070static inline struct super_block *freeze_bdev(struct block_device *sb)
@@ -2191,8 +2157,6 @@ extern const struct file_operations read_pipefifo_fops;
2191extern const struct file_operations write_pipefifo_fops; 2157extern const struct file_operations write_pipefifo_fops;
2192extern const struct file_operations rdwr_pipefifo_fops; 2158extern const struct file_operations rdwr_pipefifo_fops;
2193 2159
2194extern int fs_may_remount_ro(struct super_block *);
2195
2196#ifdef CONFIG_BLOCK 2160#ifdef CONFIG_BLOCK
2197/* 2161/*
2198 * return READ, READA, or WRITE 2162 * return READ, READA, or WRITE
@@ -2415,6 +2379,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2415 unsigned long nr_segs, loff_t pos); 2379 unsigned long nr_segs, loff_t pos);
2416extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2380extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2417 int datasync); 2381 int datasync);
2382extern void block_sync_page(struct page *page);
2418 2383
2419/* fs/splice.c */ 2384/* fs/splice.c */
2420extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2385extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2531,7 +2496,6 @@ extern void put_filesystem(struct file_system_type *fs);
2531extern struct file_system_type *get_fs_type(const char *name); 2496extern struct file_system_type *get_fs_type(const char *name);
2532extern struct super_block *get_super(struct block_device *); 2497extern struct super_block *get_super(struct block_device *);
2533extern struct super_block *get_active_super(struct block_device *bdev); 2498extern struct super_block *get_active_super(struct block_device *bdev);
2534extern struct super_block *user_get_super(dev_t);
2535extern void drop_super(struct super_block *sb); 2499extern void drop_super(struct super_block *sb);
2536extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2500extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2537extern void iterate_supers_type(struct file_system_type *, 2501extern void iterate_supers_type(struct file_system_type *,
@@ -2579,7 +2543,8 @@ extern int generic_check_addressable(unsigned, u64);
2579 2543
2580#ifdef CONFIG_MIGRATION 2544#ifdef CONFIG_MIGRATION
2581extern int buffer_migrate_page(struct address_space *, 2545extern int buffer_migrate_page(struct address_space *,
2582 struct page *, struct page *); 2546 struct page *, struct page *,
2547 enum migrate_mode);
2583#else 2548#else
2584#define buffer_migrate_page NULL 2549#define buffer_migrate_page NULL
2585#endif 2550#endif
@@ -2590,7 +2555,7 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2590 2555
2591extern void file_update_time(struct file *file); 2556extern void file_update_time(struct file *file);
2592 2557
2593extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); 2558extern int generic_show_options(struct seq_file *m, struct dentry *root);
2594extern void save_mount_options(struct super_block *sb, char *options); 2559extern void save_mount_options(struct super_block *sb, char *options);
2595extern void replace_mount_options(struct super_block *sb, char *options); 2560extern void replace_mount_options(struct super_block *sb, char *options);
2596 2561
@@ -2691,7 +2656,7 @@ int __init get_filesystem_list(char *buf);
2691#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2656#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2692 (flag & __FMODE_NONOTIFY))) 2657 (flag & __FMODE_NONOTIFY)))
2693 2658
2694static inline int is_sxid(mode_t mode) 2659static inline int is_sxid(umode_t mode)
2695{ 2660{
2696 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2661 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2697} 2662}
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 464cff526860..8ba2c9460b28 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -50,6 +50,10 @@
50 * 50 *
51 * 7.17 51 * 7.17
52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
53 *
54 * 7.18
55 * - add FUSE_IOCTL_DIR flag
56 * - add FUSE_NOTIFY_DELETE
53 */ 57 */
54 58
55#ifndef _LINUX_FUSE_H 59#ifndef _LINUX_FUSE_H
@@ -81,7 +85,7 @@
81#define FUSE_KERNEL_VERSION 7 85#define FUSE_KERNEL_VERSION 7
82 86
83/** Minor version number of this interface */ 87/** Minor version number of this interface */
84#define FUSE_KERNEL_MINOR_VERSION 17 88#define FUSE_KERNEL_MINOR_VERSION 18
85 89
86/** The node ID of the root inode */ 90/** The node ID of the root inode */
87#define FUSE_ROOT_ID 1 91#define FUSE_ROOT_ID 1
@@ -214,6 +218,7 @@ struct fuse_file_lock {
214 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 218 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
215 * FUSE_IOCTL_RETRY: retry with new iovecs 219 * FUSE_IOCTL_RETRY: retry with new iovecs
216 * FUSE_IOCTL_32BIT: 32bit ioctl 220 * FUSE_IOCTL_32BIT: 32bit ioctl
221 * FUSE_IOCTL_DIR: is a directory
217 * 222 *
218 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 223 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
219 */ 224 */
@@ -221,6 +226,7 @@ struct fuse_file_lock {
221#define FUSE_IOCTL_UNRESTRICTED (1 << 1) 226#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
222#define FUSE_IOCTL_RETRY (1 << 2) 227#define FUSE_IOCTL_RETRY (1 << 2)
223#define FUSE_IOCTL_32BIT (1 << 3) 228#define FUSE_IOCTL_32BIT (1 << 3)
229#define FUSE_IOCTL_DIR (1 << 4)
224 230
225#define FUSE_IOCTL_MAX_IOV 256 231#define FUSE_IOCTL_MAX_IOV 256
226 232
@@ -283,6 +289,7 @@ enum fuse_notify_code {
283 FUSE_NOTIFY_INVAL_ENTRY = 3, 289 FUSE_NOTIFY_INVAL_ENTRY = 3,
284 FUSE_NOTIFY_STORE = 4, 290 FUSE_NOTIFY_STORE = 4,
285 FUSE_NOTIFY_RETRIEVE = 5, 291 FUSE_NOTIFY_RETRIEVE = 5,
292 FUSE_NOTIFY_DELETE = 6,
286 FUSE_NOTIFY_CODE_MAX, 293 FUSE_NOTIFY_CODE_MAX,
287}; 294};
288 295
@@ -606,6 +613,13 @@ struct fuse_notify_inval_entry_out {
606 __u32 padding; 613 __u32 padding;
607}; 614};
608 615
616struct fuse_notify_delete_out {
617 __u64 parent;
618 __u64 child;
619 __u32 namelen;
620 __u32 padding;
621};
622
609struct fuse_notify_store_out { 623struct fuse_notify_store_out {
610 __u64 nodeid; 624 __u64 nodeid;
611 __u64 offset; 625 __u64 offset;
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 61549b26ad6f..73c28dea10ae 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -85,6 +85,30 @@ enum {
85/* All generic netlink requests are serialized by a global lock. */ 85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void); 86extern void genl_lock(void);
87extern void genl_unlock(void); 87extern void genl_unlock(void);
88#ifdef CONFIG_PROVE_LOCKING
89extern int lockdep_genl_is_held(void);
90#endif
91
92/**
93 * rcu_dereference_genl - rcu_dereference with debug checking
94 * @p: The pointer to read, prior to dereferencing
95 *
96 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
97 * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
98 */
99#define rcu_dereference_genl(p) \
100 rcu_dereference_check(p, lockdep_genl_is_held())
101
102/**
103 * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
104 * @p: The pointer to read, prior to dereferencing
105 *
106 * Return the value of the specified RCU-protected pointer, but omit
107 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
108 * caller holds genl mutex.
109 */
110#define genl_dereference(p) \
111 rcu_dereference_protected(p, lockdep_genl_is_held())
88 112
89#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
90 114
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6d18f3531f18..fe23ee768589 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -163,7 +163,7 @@ struct gendisk {
163 * disks that can't be partitioned. */ 163 * disks that can't be partitioned. */
164 164
165 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 165 char disk_name[DISK_NAME_LEN]; /* name of major driver */
166 char *(*devnode)(struct gendisk *gd, mode_t *mode); 166 char *(*devnode)(struct gendisk *gd, umode_t *mode);
167 167
168 unsigned int events; /* supported events */ 168 unsigned int events; /* supported events */
169 unsigned int async_events; /* async events, subset of all */ 169 unsigned int async_events; /* async events, subset of all */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 3a76faf6a3ee..581e74b7df95 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -36,6 +36,7 @@ struct vm_area_struct;
36#endif 36#endif
37#define ___GFP_NO_KSWAPD 0x400000u 37#define ___GFP_NO_KSWAPD 0x400000u
38#define ___GFP_OTHER_NODE 0x800000u 38#define ___GFP_OTHER_NODE 0x800000u
39#define ___GFP_WRITE 0x1000000u
39 40
40/* 41/*
41 * GFP bitmasks.. 42 * GFP bitmasks..
@@ -85,6 +86,7 @@ struct vm_area_struct;
85 86
86#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 87#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
87#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
88 90
89/* 91/*
90 * This may seem redundant, but it's a way of annotating false positives vs. 92 * This may seem redundant, but it's a way of annotating false positives vs.
@@ -92,7 +94,7 @@ struct vm_area_struct;
92 */ 94 */
93#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 95#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
94 96
95#define __GFP_BITS_SHIFT 24 /* Room for N __GFP_FOO bits */ 97#define __GFP_BITS_SHIFT 25 /* Room for N __GFP_FOO bits */
96#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 98#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
97 99
98/* This equals 0, but use constants in case they ever change */ 100/* This equals 0, but use constants in case they ever change */
@@ -313,7 +315,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
313static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask, 315static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
314 unsigned int order) 316 unsigned int order)
315{ 317{
316 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); 318 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES || !node_online(nid));
317 319
318 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); 320 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
319} 321}
@@ -358,6 +360,7 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
358extern void __free_pages(struct page *page, unsigned int order); 360extern void __free_pages(struct page *page, unsigned int order);
359extern void free_pages(unsigned long addr, unsigned int order); 361extern void free_pages(unsigned long addr, unsigned int order);
360extern void free_hot_cold_page(struct page *page, int cold); 362extern void free_hot_cold_page(struct page *page, int cold);
363extern void free_hot_cold_page_list(struct list_head *list, int cold);
361 364
362#define __free_page(page) __free_pages((page), 0) 365#define __free_page(page) __free_pages((page), 0)
363#define free_page(addr) free_pages((addr), 0) 366#define free_page(addr) free_pages((addr), 0)
@@ -367,9 +370,25 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
367void drain_all_pages(void); 370void drain_all_pages(void);
368void drain_local_pages(void *dummy); 371void drain_local_pages(void *dummy);
369 372
373/*
374 * gfp_allowed_mask is set to GFP_BOOT_MASK during early boot to restrict what
375 * GFP flags are used before interrupts are enabled. Once interrupts are
376 * enabled, it is set to __GFP_BITS_MASK while the system is running. During
377 * hibernation, it is used by PM to avoid I/O during memory allocation while
378 * devices are suspended.
379 */
370extern gfp_t gfp_allowed_mask; 380extern gfp_t gfp_allowed_mask;
371 381
372extern void pm_restrict_gfp_mask(void); 382extern void pm_restrict_gfp_mask(void);
373extern void pm_restore_gfp_mask(void); 383extern void pm_restore_gfp_mask(void);
374 384
385#ifdef CONFIG_PM_SLEEP
386extern bool pm_suspended_storage(void);
387#else
388static inline bool pm_suspended_storage(void)
389{
390 return false;
391}
392#endif /* CONFIG_PM_SLEEP */
393
375#endif /* __LINUX_GFP_H */ 394#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index 4f4462974c14..b148087f49a6 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -22,6 +22,8 @@
22#define GFS2_LIVE_LOCK 1 22#define GFS2_LIVE_LOCK 1
23#define GFS2_TRANS_LOCK 2 23#define GFS2_TRANS_LOCK 2
24#define GFS2_RENAME_LOCK 3 24#define GFS2_RENAME_LOCK 3
25#define GFS2_CONTROL_LOCK 4
26#define GFS2_MOUNTED_LOCK 5
25 27
26/* Format numbers for various metadata types */ 28/* Format numbers for various metadata types */
27 29
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
new file mode 100644
index 000000000000..05071ee34c3f
--- /dev/null
+++ b/include/linux/gpio-pxa.h
@@ -0,0 +1,16 @@
1#ifndef __GPIO_PXA_H
2#define __GPIO_PXA_H
3
4#define GPIO_bit(x) (1 << ((x) & 0x1f))
5
6#define gpio_to_bank(gpio) ((gpio) >> 5)
7
8/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
9 * Those cases currently cause holes in the GPIO number space, the
10 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
11 */
12extern int pxa_last_gpio;
13
14extern int pxa_irq_to_gpio(int irq);
15
16#endif /* __GPIO_PXA_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index f743883f769e..bb7f30971858 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -139,20 +139,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
139extern void account_system_vtime(struct task_struct *tsk); 139extern void account_system_vtime(struct task_struct *tsk);
140#endif 140#endif
141 141
142#if defined(CONFIG_NO_HZ)
143#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
144extern void rcu_enter_nohz(void);
145extern void rcu_exit_nohz(void);
146
147static inline void rcu_irq_enter(void)
148{
149 rcu_exit_nohz();
150}
151
152static inline void rcu_irq_exit(void)
153{
154 rcu_enter_nohz();
155}
156 143
157static inline void rcu_nmi_enter(void) 144static inline void rcu_nmi_enter(void)
158{ 145{
@@ -163,17 +150,9 @@ static inline void rcu_nmi_exit(void)
163} 150}
164 151
165#else 152#else
166extern void rcu_irq_enter(void);
167extern void rcu_irq_exit(void);
168extern void rcu_nmi_enter(void); 153extern void rcu_nmi_enter(void);
169extern void rcu_nmi_exit(void); 154extern void rcu_nmi_exit(void);
170#endif 155#endif
171#else
172# define rcu_irq_enter() do { } while (0)
173# define rcu_irq_exit() do { } while (0)
174# define rcu_nmi_enter() do { } while (0)
175# define rcu_nmi_exit() do { } while (0)
176#endif /* #if defined(CONFIG_NO_HZ) */
177 156
178/* 157/*
179 * It is safe to do non-atomic ops on ->hardirq_context, 158 * It is safe to do non-atomic ops on ->hardirq_context,
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c235e4e8767c..3a95da60fd3e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -72,6 +72,7 @@
72#include <linux/workqueue.h> 72#include <linux/workqueue.h>
73#include <linux/input.h> 73#include <linux/input.h>
74#include <linux/semaphore.h> 74#include <linux/semaphore.h>
75#include <linux/power_supply.h>
75 76
76/* 77/*
77 * We parse each description item into this structure. Short items data 78 * We parse each description item into this structure. Short items data
@@ -190,6 +191,7 @@ struct hid_item {
190#define HID_UP_UNDEFINED 0x00000000 191#define HID_UP_UNDEFINED 0x00000000
191#define HID_UP_GENDESK 0x00010000 192#define HID_UP_GENDESK 0x00010000
192#define HID_UP_SIMULATION 0x00020000 193#define HID_UP_SIMULATION 0x00020000
194#define HID_UP_GENDEVCTRLS 0x00060000
193#define HID_UP_KEYBOARD 0x00070000 195#define HID_UP_KEYBOARD 0x00070000
194#define HID_UP_LED 0x00080000 196#define HID_UP_LED 0x00080000
195#define HID_UP_BUTTON 0x00090000 197#define HID_UP_BUTTON 0x00090000
@@ -239,6 +241,8 @@ struct hid_item {
239#define HID_GD_RIGHT 0x00010092 241#define HID_GD_RIGHT 0x00010092
240#define HID_GD_LEFT 0x00010093 242#define HID_GD_LEFT 0x00010093
241 243
244#define HID_DC_BATTERYSTRENGTH 0x00060020
245
242#define HID_DG_DIGITIZER 0x000d0001 246#define HID_DG_DIGITIZER 0x000d0001
243#define HID_DG_PEN 0x000d0002 247#define HID_DG_PEN 0x000d0002
244#define HID_DG_LIGHTPEN 0x000d0003 248#define HID_DG_LIGHTPEN 0x000d0003
@@ -482,6 +486,19 @@ struct hid_device { /* device report descriptor */
482 struct hid_driver *driver; 486 struct hid_driver *driver;
483 struct hid_ll_driver *ll_driver; 487 struct hid_ll_driver *ll_driver;
484 488
489#ifdef CONFIG_HID_BATTERY_STRENGTH
490 /*
491 * Power supply information for HID devices which report
492 * battery strength. power_supply is registered iff
493 * battery.name is non-NULL.
494 */
495 struct power_supply battery;
496 __s32 battery_min;
497 __s32 battery_max;
498 __s32 battery_report_type;
499 __s32 battery_report_id;
500#endif
501
485 unsigned int status; /* see STAT flags above */ 502 unsigned int status; /* see STAT flags above */
486 unsigned claimed; /* Claimed by hidinput, hiddev? */ 503 unsigned claimed; /* Claimed by hidinput, hiddev? */
487 unsigned quirks; /* Various quirks the device can pull on us */ 504 unsigned quirks; /* Various quirks the device can pull on us */
@@ -712,6 +729,8 @@ extern void hidinput_disconnect(struct hid_device *);
712int hid_set_field(struct hid_field *, unsigned, __s32); 729int hid_set_field(struct hid_field *, unsigned, __s32);
713int hid_input_report(struct hid_device *, int type, u8 *, int, int); 730int hid_input_report(struct hid_device *, int type, u8 *, int, int);
714int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 731int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
732struct hid_field *hidinput_get_led_field(struct hid_device *hid);
733unsigned int hidinput_count_leds(struct hid_device *hid);
715void hid_output_report(struct hid_report *report, __u8 *data); 734void hid_output_report(struct hid_report *report, __u8 *data);
716struct hid_device *hid_allocate_device(void); 735struct hid_device *hid_allocate_device(void);
717struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 736struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -719,6 +738,8 @@ int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
719int hid_check_keys_pressed(struct hid_device *hid); 738int hid_check_keys_pressed(struct hid_device *hid);
720int hid_connect(struct hid_device *hid, unsigned int connect_mask); 739int hid_connect(struct hid_device *hid, unsigned int connect_mask);
721void hid_disconnect(struct hid_device *hid); 740void hid_disconnect(struct hid_device *hid);
741const struct hid_device_id *hid_match_id(struct hid_device *hdev,
742 const struct hid_device_id *id);
722 743
723/** 744/**
724 * hid_map_usage - map usage input bits 745 * hid_map_usage - map usage input bits
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a9ace9c32507..1b921299abc4 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -18,7 +18,7 @@ extern struct page *follow_trans_huge_pmd(struct mm_struct *mm,
18 unsigned int flags); 18 unsigned int flags);
19extern int zap_huge_pmd(struct mmu_gather *tlb, 19extern int zap_huge_pmd(struct mmu_gather *tlb,
20 struct vm_area_struct *vma, 20 struct vm_area_struct *vma,
21 pmd_t *pmd); 21 pmd_t *pmd, unsigned long addr);
22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
23 unsigned long addr, unsigned long end, 23 unsigned long addr, unsigned long end,
24 unsigned char *vec); 24 unsigned char *vec);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 12ec328481de..62b908e0e591 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -35,7 +35,7 @@
35#include <linux/mod_devicetable.h> 35#include <linux/mod_devicetable.h>
36 36
37 37
38#define MAX_PAGE_BUFFER_COUNT 16 38#define MAX_PAGE_BUFFER_COUNT 18
39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
40 40
41#pragma pack(push, 1) 41#pragma pack(push, 1)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 07d103a06d64..8e25a9167f13 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -482,6 +482,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
482{ 482{
483 return adap->nr; 483 return adap->nr;
484} 484}
485
486/**
487 * module_i2c_driver() - Helper macro for registering a I2C driver
488 * @__i2c_driver: i2c_driver struct
489 *
490 * Helper macro for I2C drivers which do not do anything special in module
491 * init/exit. This eliminates a lot of boilerplate. Each module may only
492 * use this macro once, and calling it replaces module_init() and module_exit()
493 */
494#define module_i2c_driver(__i2c_driver) \
495 module_driver(__i2c_driver, i2c_add_driver, \
496 i2c_del_driver)
497
485#endif /* I2C */ 498#endif /* I2C */
486#endif /* __KERNEL__ */ 499#endif /* __KERNEL__ */
487 500
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 114c0f6fc63d..78d3465251d6 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -652,10 +652,12 @@ struct twl4030_power_data {
652 unsigned num; 652 unsigned num;
653 struct twl4030_resconfig *resource_config; 653 struct twl4030_resconfig *resource_config;
654#define TWL4030_RESCONFIG_UNDEF ((u8)-1) 654#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
655 bool use_poweroff; /* Board is wired for TWL poweroff */
655}; 656};
656 657
657extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 658extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
658extern int twl4030_remove_script(u8 flags); 659extern int twl4030_remove_script(u8 flags);
660extern void twl4030_power_off(void);
659 661
660struct twl4030_codec_data { 662struct twl4030_codec_data {
661 unsigned int digimic_delay; /* in ms */ 663 unsigned int digimic_delay; /* in ms */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 42557851b12e..501370b61ee5 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -920,7 +920,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
920 920
921typedef struct { 921typedef struct {
922 const char *name; 922 const char *name;
923 mode_t mode; 923 umode_t mode;
924 const struct file_operations *proc_fops; 924 const struct file_operations *proc_fops;
925} ide_proc_entry_t; 925} ide_proc_entry_t;
926 926
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48363c3c40f8..210e2c325534 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -128,6 +128,7 @@
128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020 128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040 129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060 130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
131#define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
131/* A-MSDU 802.11n */ 132/* A-MSDU 802.11n */
132#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080 133#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
133/* Mesh Control 802.11s */ 134/* Mesh Control 802.11s */
@@ -543,6 +544,15 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
543 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); 544 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
544} 545}
545 546
547/**
548 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
549 * @seq_ctrl: frame sequence control bytes in little-endian byteorder
550 */
551static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
552{
553 return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
554}
555
546struct ieee80211s_hdr { 556struct ieee80211s_hdr {
547 u8 flags; 557 u8 flags;
548 u8 ttl; 558 u8 ttl;
@@ -770,6 +780,9 @@ struct ieee80211_mgmt {
770 } u; 780 } u;
771} __attribute__ ((packed)); 781} __attribute__ ((packed));
772 782
783/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
784#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
785
773/* mgmt header + 1 byte category code */ 786/* mgmt header + 1 byte category code */
774#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 787#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
775 788
@@ -1552,6 +1565,8 @@ enum ieee80211_sa_query_action {
1552#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1565#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1553#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 1566#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1554 1567
1568#define WLAN_CIPHER_SUITE_SMS4 0x00147201
1569
1555/* AKM suite selectors */ 1570/* AKM suite selectors */
1556#define WLAN_AKM_SUITE_8021X 0x000FAC01 1571#define WLAN_AKM_SUITE_8021X 0x000FAC01
1557#define WLAN_AKM_SUITE_PSK 0x000FAC02 1572#define WLAN_AKM_SUITE_PSK 0x000FAC02
@@ -1689,6 +1704,23 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1689} 1704}
1690 1705
1691/** 1706/**
1707 * ieee80211_is_public_action - check if frame is a public action frame
1708 * @hdr: the frame
1709 * @len: length of the frame
1710 */
1711static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
1712 size_t len)
1713{
1714 struct ieee80211_mgmt *mgmt = (void *)hdr;
1715
1716 if (len < IEEE80211_MIN_ACTION_SIZE)
1717 return false;
1718 if (!ieee80211_is_action(hdr->frame_control))
1719 return false;
1720 return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
1721}
1722
1723/**
1692 * ieee80211_fhss_chan_to_freq - get channel frequency 1724 * ieee80211_fhss_chan_to_freq - get channel frequency
1693 * @channel: the FHSS channel 1725 * @channel: the FHSS channel
1694 * 1726 *
diff --git a/include/linux/if.h b/include/linux/if.h
index db20bd4fd16b..06b6ef60c821 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -79,6 +79,7 @@
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing 79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
80 * skbs on transmit */ 80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ 81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
82 83
83#define IF_GET_IFACE 0x0001 /* for querying only */ 84#define IF_GET_IFACE 0x0001 /* for querying only */
84#define IF_GET_PROTO 0x0002 85#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index e473003e4bda..56d907a2c804 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -79,6 +79,7 @@
79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ 81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
82#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
82#define ETH_P_TIPC 0x88CA /* TIPC */ 83#define ETH_P_TIPC 0x88CA /* TIPC */
83#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ 84#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
84#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 85#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
new file mode 100644
index 000000000000..828181fbad5d
--- /dev/null
+++ b/include/linux/if_team.h
@@ -0,0 +1,242 @@
1/*
2 * include/linux/if_team.h - Network team device driver header
3 * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef _LINUX_IF_TEAM_H_
12#define _LINUX_IF_TEAM_H_
13
14#ifdef __KERNEL__
15
16struct team_pcpu_stats {
17 u64 rx_packets;
18 u64 rx_bytes;
19 u64 rx_multicast;
20 u64 tx_packets;
21 u64 tx_bytes;
22 struct u64_stats_sync syncp;
23 u32 rx_dropped;
24 u32 tx_dropped;
25};
26
27struct team;
28
29struct team_port {
30 struct net_device *dev;
31 struct hlist_node hlist; /* node in hash list */
32 struct list_head list; /* node in ordinary list */
33 struct team *team;
34 int index;
35
36 /*
37 * A place for storing original values of the device before it
38 * become a port.
39 */
40 struct {
41 unsigned char dev_addr[MAX_ADDR_LEN];
42 unsigned int mtu;
43 } orig;
44
45 bool linkup;
46 u32 speed;
47 u8 duplex;
48
49 struct rcu_head rcu;
50};
51
52struct team_mode_ops {
53 int (*init)(struct team *team);
54 void (*exit)(struct team *team);
55 rx_handler_result_t (*receive)(struct team *team,
56 struct team_port *port,
57 struct sk_buff *skb);
58 bool (*transmit)(struct team *team, struct sk_buff *skb);
59 int (*port_enter)(struct team *team, struct team_port *port);
60 void (*port_leave)(struct team *team, struct team_port *port);
61 void (*port_change_mac)(struct team *team, struct team_port *port);
62};
63
64enum team_option_type {
65 TEAM_OPTION_TYPE_U32,
66 TEAM_OPTION_TYPE_STRING,
67};
68
69struct team_option {
70 struct list_head list;
71 const char *name;
72 enum team_option_type type;
73 int (*getter)(struct team *team, void *arg);
74 int (*setter)(struct team *team, void *arg);
75};
76
77struct team_mode {
78 struct list_head list;
79 const char *kind;
80 struct module *owner;
81 size_t priv_size;
82 const struct team_mode_ops *ops;
83};
84
85#define TEAM_PORT_HASHBITS 4
86#define TEAM_PORT_HASHENTRIES (1 << TEAM_PORT_HASHBITS)
87
88#define TEAM_MODE_PRIV_LONGS 4
89#define TEAM_MODE_PRIV_SIZE (sizeof(long) * TEAM_MODE_PRIV_LONGS)
90
91struct team {
92 struct net_device *dev; /* associated netdevice */
93 struct team_pcpu_stats __percpu *pcpu_stats;
94
95 struct mutex lock; /* used for overall locking, e.g. port lists write */
96
97 /*
98 * port lists with port count
99 */
100 int port_count;
101 struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES];
102 struct list_head port_list;
103
104 struct list_head option_list;
105
106 const struct team_mode *mode;
107 struct team_mode_ops ops;
108 long mode_priv[TEAM_MODE_PRIV_LONGS];
109};
110
111static inline struct hlist_head *team_port_index_hash(struct team *team,
112 int port_index)
113{
114 return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
115}
116
117static inline struct team_port *team_get_port_by_index(struct team *team,
118 int port_index)
119{
120 struct hlist_node *p;
121 struct team_port *port;
122 struct hlist_head *head = team_port_index_hash(team, port_index);
123
124 hlist_for_each_entry(port, p, head, hlist)
125 if (port->index == port_index)
126 return port;
127 return NULL;
128}
129static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
130 int port_index)
131{
132 struct hlist_node *p;
133 struct team_port *port;
134 struct hlist_head *head = team_port_index_hash(team, port_index);
135
136 hlist_for_each_entry_rcu(port, p, head, hlist)
137 if (port->index == port_index)
138 return port;
139 return NULL;
140}
141
142extern int team_port_set_team_mac(struct team_port *port);
143extern int team_options_register(struct team *team,
144 const struct team_option *option,
145 size_t option_count);
146extern void team_options_unregister(struct team *team,
147 const struct team_option *option,
148 size_t option_count);
149extern int team_mode_register(struct team_mode *mode);
150extern int team_mode_unregister(struct team_mode *mode);
151
152#endif /* __KERNEL__ */
153
154#define TEAM_STRING_MAX_LEN 32
155
156/**********************************
157 * NETLINK_GENERIC netlink family.
158 **********************************/
159
160enum {
161 TEAM_CMD_NOOP,
162 TEAM_CMD_OPTIONS_SET,
163 TEAM_CMD_OPTIONS_GET,
164 TEAM_CMD_PORT_LIST_GET,
165
166 __TEAM_CMD_MAX,
167 TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
168};
169
170enum {
171 TEAM_ATTR_UNSPEC,
172 TEAM_ATTR_TEAM_IFINDEX, /* u32 */
173 TEAM_ATTR_LIST_OPTION, /* nest */
174 TEAM_ATTR_LIST_PORT, /* nest */
175
176 __TEAM_ATTR_MAX,
177 TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
178};
179
180/* Nested layout of get/set msg:
181 *
182 * [TEAM_ATTR_LIST_OPTION]
183 * [TEAM_ATTR_ITEM_OPTION]
184 * [TEAM_ATTR_OPTION_*], ...
185 * [TEAM_ATTR_ITEM_OPTION]
186 * [TEAM_ATTR_OPTION_*], ...
187 * ...
188 * [TEAM_ATTR_LIST_PORT]
189 * [TEAM_ATTR_ITEM_PORT]
190 * [TEAM_ATTR_PORT_*], ...
191 * [TEAM_ATTR_ITEM_PORT]
192 * [TEAM_ATTR_PORT_*], ...
193 * ...
194 */
195
196enum {
197 TEAM_ATTR_ITEM_OPTION_UNSPEC,
198 TEAM_ATTR_ITEM_OPTION, /* nest */
199
200 __TEAM_ATTR_ITEM_OPTION_MAX,
201 TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
202};
203
204enum {
205 TEAM_ATTR_OPTION_UNSPEC,
206 TEAM_ATTR_OPTION_NAME, /* string */
207 TEAM_ATTR_OPTION_CHANGED, /* flag */
208 TEAM_ATTR_OPTION_TYPE, /* u8 */
209 TEAM_ATTR_OPTION_DATA, /* dynamic */
210
211 __TEAM_ATTR_OPTION_MAX,
212 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
213};
214
215enum {
216 TEAM_ATTR_ITEM_PORT_UNSPEC,
217 TEAM_ATTR_ITEM_PORT, /* nest */
218
219 __TEAM_ATTR_ITEM_PORT_MAX,
220 TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
221};
222
223enum {
224 TEAM_ATTR_PORT_UNSPEC,
225 TEAM_ATTR_PORT_IFINDEX, /* u32 */
226 TEAM_ATTR_PORT_CHANGED, /* flag */
227 TEAM_ATTR_PORT_LINKUP, /* flag */
228 TEAM_ATTR_PORT_SPEED, /* u32 */
229 TEAM_ATTR_PORT_DUPLEX, /* u8 */
230
231 __TEAM_ATTR_PORT_MAX,
232 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
233};
234
235/*
236 * NETLINK_GENERIC related info
237 */
238#define TEAM_GENL_NAME "team"
239#define TEAM_GENL_VERSION 0x1
240#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
241
242#endif /* _LINUX_IF_TEAM_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 12d5543b14f2..13aff1e2183b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -74,22 +74,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
74/* found in socket.c */ 74/* found in socket.c */
75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 76
77/* if this changes, algorithm will have to be reworked because this 77struct vlan_info;
78 * depends on completely exhausting the VLAN identifier space. Thus
79 * it gives constant time look-up, but in many cases it wastes memory.
80 */
81#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
82#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS)
83
84struct vlan_group {
85 struct net_device *real_dev; /* The ethernet(like) device
86 * the vlan is attached to.
87 */
88 unsigned int nr_vlans;
89 struct hlist_node hlist; /* linked list */
90 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
91 struct rcu_head rcu;
92};
93 78
94static inline int is_vlan_dev(struct net_device *dev) 79static inline int is_vlan_dev(struct net_device *dev)
95{ 80{
@@ -109,6 +94,13 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
109extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler); 94extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
110extern struct sk_buff *vlan_untag(struct sk_buff *skb); 95extern struct sk_buff *vlan_untag(struct sk_buff *skb);
111 96
97extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
98extern void vlan_vid_del(struct net_device *dev, unsigned short vid);
99
100extern int vlan_vids_add_by_dev(struct net_device *dev,
101 const struct net_device *by_dev);
102extern void vlan_vids_del_by_dev(struct net_device *dev,
103 const struct net_device *by_dev);
112#else 104#else
113static inline struct net_device * 105static inline struct net_device *
114__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) 106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
@@ -139,6 +131,26 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
139{ 131{
140 return skb; 132 return skb;
141} 133}
134
135static inline int vlan_vid_add(struct net_device *dev, unsigned short vid)
136{
137 return 0;
138}
139
140static inline void vlan_vid_del(struct net_device *dev, unsigned short vid)
141{
142}
143
144static inline int vlan_vids_add_by_dev(struct net_device *dev,
145 const struct net_device *by_dev)
146{
147 return 0;
148}
149
150static inline void vlan_vids_del_by_dev(struct net_device *dev,
151 const struct net_device *by_dev)
152{
153}
142#endif 154#endif
143 155
144/** 156/**
@@ -310,6 +322,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
310 322
311 return protocol; 323 return protocol;
312} 324}
325
326static inline void vlan_set_encap_proto(struct sk_buff *skb,
327 struct vlan_hdr *vhdr)
328{
329 __be16 proto;
330 unsigned char *rawp;
331
332 /*
333 * Was a VLAN packet, grab the encapsulated protocol, which the layer
334 * three protocols care about.
335 */
336
337 proto = vhdr->h_vlan_encapsulated_proto;
338 if (ntohs(proto) >= 1536) {
339 skb->protocol = proto;
340 return;
341 }
342
343 rawp = skb->data;
344 if (*(unsigned short *) rawp == 0xFFFF)
345 /*
346 * This is a magic hack to spot IPX packets. Older Novell
347 * breaks the protocol design and runs IPX over 802.3 without
348 * an 802.2 LLC layer. We look for FFFF which isn't a used
349 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
350 * but does for the rest.
351 */
352 skb->protocol = htons(ETH_P_802_3);
353 else
354 /*
355 * Real 802.2 LLC
356 */
357 skb->protocol = htons(ETH_P_802_2);
358}
313#endif /* __KERNEL__ */ 359#endif /* __KERNEL__ */
314 360
315/* VLAN IOCTLs are found in sockios.h */ 361/* VLAN IOCTLs are found in sockios.h */
@@ -352,7 +398,7 @@ struct vlan_ioctl_args {
352 unsigned int skb_priority; 398 unsigned int skb_priority;
353 unsigned int name_type; 399 unsigned int name_type;
354 unsigned int bind_type; 400 unsigned int bind_type;
355 unsigned int flag; /* Matches vlan_dev_info flags */ 401 unsigned int flag; /* Matches vlan_dev_priv flags */
356 } u; 402 } u;
357 403
358 short vlan_qos; 404 short vlan_qos;
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index abf5028db981..f1362b5447fc 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -34,6 +34,15 @@ struct inet_diag_req {
34 __u32 idiag_dbs; /* Tables to dump (NI) */ 34 __u32 idiag_dbs; /* Tables to dump (NI) */
35}; 35};
36 36
37struct inet_diag_req_v2 {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
37enum { 46enum {
38 INET_DIAG_REQ_NONE, 47 INET_DIAG_REQ_NONE,
39 INET_DIAG_REQ_BYTECODE, 48 INET_DIAG_REQ_BYTECODE,
@@ -99,9 +108,10 @@ enum {
99 INET_DIAG_CONG, 108 INET_DIAG_CONG,
100 INET_DIAG_TOS, 109 INET_DIAG_TOS,
101 INET_DIAG_TCLASS, 110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO,
102}; 112};
103 113
104#define INET_DIAG_MAX INET_DIAG_TCLASS 114#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
105 115
106 116
107/* INET_DIAG_MEM */ 117/* INET_DIAG_MEM */
@@ -125,16 +135,41 @@ struct tcpvegas_info {
125#ifdef __KERNEL__ 135#ifdef __KERNEL__
126struct sock; 136struct sock;
127struct inet_hashinfo; 137struct inet_hashinfo;
138struct nlattr;
139struct nlmsghdr;
140struct sk_buff;
141struct netlink_callback;
128 142
129struct inet_diag_handler { 143struct inet_diag_handler {
130 struct inet_hashinfo *idiag_hashinfo; 144 void (*dump)(struct sk_buff *skb,
145 struct netlink_callback *cb,
146 struct inet_diag_req_v2 *r,
147 struct nlattr *bc);
148
149 int (*dump_one)(struct sk_buff *in_skb,
150 const struct nlmsghdr *nlh,
151 struct inet_diag_req_v2 *req);
152
131 void (*idiag_get_info)(struct sock *sk, 153 void (*idiag_get_info)(struct sock *sk,
132 struct inet_diag_msg *r, 154 struct inet_diag_msg *r,
133 void *info); 155 void *info);
134 __u16 idiag_info_size;
135 __u16 idiag_type; 156 __u16 idiag_type;
136}; 157};
137 158
159struct inet_connection_sock;
160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req_v2 *req,
162 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh);
164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
165 struct netlink_callback *cb, struct inet_diag_req_v2 *r,
166 struct nlattr *bc);
167int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
168 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
169 struct inet_diag_req_v2 *req);
170
171int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
172
138extern int inet_diag_register(const struct inet_diag_handler *handler); 173extern int inet_diag_register(const struct inet_diag_handler *handler);
139extern void inet_diag_unregister(const struct inet_diag_handler *handler); 174extern void inet_diag_unregister(const struct inet_diag_handler *handler);
140#endif /* __KERNEL__ */ 175#endif /* __KERNEL__ */
diff --git a/include/linux/init.h b/include/linux/init.h
index 9146f39cdddf..6b951095a42f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,6 +2,7 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
6/* These macros are used to mark some functions or 7/* These macros are used to mark some functions or
7 * initialized data (doesn't apply to uninitialized data) 8 * initialized data (doesn't apply to uninitialized data)
@@ -156,7 +157,7 @@ void prepare_namespace(void);
156 157
157extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
158 159
159extern int initcall_debug; 160extern bool initcall_debug;
160 161
161#endif 162#endif
162 163
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 32574eef9394..9c66b1ada9d7 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -23,11 +23,10 @@ extern struct files_struct init_files;
23extern struct fs_struct init_fs; 23extern struct fs_struct init_fs;
24 24
25#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
26#define INIT_THREADGROUP_FORK_LOCK(sig) \ 26#define INIT_GROUP_RWSEM(sig) \
27 .threadgroup_fork_lock = \ 27 .group_rwsem = __RWSEM_INITIALIZER(sig.group_rwsem),
28 __RWSEM_INITIALIZER(sig.threadgroup_fork_lock),
29#else 28#else
30#define INIT_THREADGROUP_FORK_LOCK(sig) 29#define INIT_GROUP_RWSEM(sig)
31#endif 30#endif
32 31
33#define INIT_SIGNALS(sig) { \ 32#define INIT_SIGNALS(sig) { \
@@ -46,7 +45,7 @@ extern struct fs_struct init_fs;
46 }, \ 45 }, \
47 .cred_guard_mutex = \ 46 .cred_guard_mutex = \
48 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ 47 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
49 INIT_THREADGROUP_FORK_LOCK(sig) \ 48 INIT_GROUP_RWSEM(sig) \
50} 49}
51 50
52extern struct nsproxy init_nsproxy; 51extern struct nsproxy init_nsproxy;
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h
new file mode 100644
index 000000000000..75d4be717714
--- /dev/null
+++ b/include/linux/input/auo-pixcir-ts.h
@@ -0,0 +1,56 @@
1/*
2 * Driver for AUO in-cell touchscreens
3 *
4 * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
5 *
6 * based on auo_touch.h from Dell Streak kernel
7 *
8 * Copyright (c) 2008 QUALCOMM Incorporated.
9 * Copyright (c) 2008 QUALCOMM USA, INC.
10 *
11 *
12 * This software is licensed under the terms of the GNU General Public
13 * License version 2, as published by the Free Software Foundation, and
14 * may be copied, distributed, and modified under those terms.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 */
22
23#ifndef __AUO_PIXCIR_TS_H__
24#define __AUO_PIXCIR_TS_H__
25
26/*
27 * Interrupt modes:
28 * periodical: interrupt is asserted periodicaly
29 * compare coordinates: interrupt is asserted when coordinates change
30 * indicate touch: interrupt is asserted during touch
31 */
32#define AUO_PIXCIR_INT_PERIODICAL 0x00
33#define AUO_PIXCIR_INT_COMP_COORD 0x01
34#define AUO_PIXCIR_INT_TOUCH_IND 0x02
35
36/*
37 * @gpio_int interrupt gpio
38 * @int_setting one of AUO_PIXCIR_INT_*
39 * @init_hw hardwarespecific init
40 * @exit_hw hardwarespecific shutdown
41 * @x_max x-resolution
42 * @y_max y-resolution
43 */
44struct auo_pixcir_ts_platdata {
45 int gpio_int;
46
47 int int_setting;
48
49 void (*init_hw)(struct i2c_client *);
50 void (*exit_hw)(struct i2c_client *);
51
52 unsigned int x_max;
53 unsigned int y_max;
54};
55
56#endif
diff --git a/include/linux/input/gp2ap002a00f.h b/include/linux/input/gp2ap002a00f.h
new file mode 100644
index 000000000000..aad2fd44a61a
--- /dev/null
+++ b/include/linux/input/gp2ap002a00f.h
@@ -0,0 +1,22 @@
1#ifndef _GP2AP002A00F_H_
2#define _GP2AP002A00F_H_
3
4#include <linux/i2c.h>
5
6#define GP2A_I2C_NAME "gp2ap002a00f"
7
8/**
9 * struct gp2a_platform_data - Sharp gp2ap002a00f proximity platform data
10 * @vout_gpio: The gpio connected to the object detected pin (VOUT)
11 * @wakeup: Set to true if the proximity can wake the device from suspend
12 * @hw_setup: Callback for setting up hardware such as gpios and vregs
13 * @hw_shutdown: Callback for properly shutting down hardware
14 */
15struct gp2a_platform_data {
16 int vout_gpio;
17 bool wakeup;
18 int (*hw_setup)(struct i2c_client *client);
19 int (*hw_shutdown)(struct i2c_client *client);
20};
21
22#endif
diff --git a/include/linux/input/gpio_tilt.h b/include/linux/input/gpio_tilt.h
new file mode 100644
index 000000000000..c1cc52d380e0
--- /dev/null
+++ b/include/linux/input/gpio_tilt.h
@@ -0,0 +1,73 @@
1#ifndef _INPUT_GPIO_TILT_H
2#define _INPUT_GPIO_TILT_H
3
4/**
5 * struct gpio_tilt_axis - Axis used by the tilt switch
6 * @axis: Constant describing the axis, e.g. ABS_X
7 * @min: minimum value for abs_param
8 * @max: maximum value for abs_param
9 * @fuzz: fuzz value for abs_param
10 * @flat: flat value for abs_param
11 */
12struct gpio_tilt_axis {
13 int axis;
14 int min;
15 int max;
16 int fuzz;
17 int flat;
18};
19
20/**
21 * struct gpio_tilt_state - state description
22 * @gpios: bitfield of gpio target-states for the value
23 * @axes: array containing the axes settings for the gpio state
24 * The array indizes must correspond to the axes defined
25 * in platform_data
26 *
27 * This structure describes a supported axis settings
28 * and the necessary gpio-state which represent it.
29 *
30 * The n-th bit in the bitfield describes the state of the n-th GPIO
31 * from the gpios-array defined in gpio_regulator_config below.
32 */
33struct gpio_tilt_state {
34 int gpios;
35 int *axes;
36};
37
38/**
39 * struct gpio_tilt_platform_data
40 * @gpios: Array containing the gpios determining the tilt state
41 * @nr_gpios: Number of gpios
42 * @axes: Array of gpio_tilt_axis descriptions
43 * @nr_axes: Number of axes
44 * @states: Array of gpio_tilt_state entries describing
45 * the gpio state for specific tilts
46 * @nr_states: Number of states available
47 * @debounce_interval: debounce ticks interval in msecs
48 * @poll_interval: polling interval in msecs - for polling driver only
49 * @enable: callback to enable the tilt switch
50 * @disable: callback to disable the tilt switch
51 *
52 * This structure contains gpio-tilt-switch configuration
53 * information that must be passed by platform code to the
54 * gpio-tilt input driver.
55 */
56struct gpio_tilt_platform_data {
57 struct gpio *gpios;
58 int nr_gpios;
59
60 struct gpio_tilt_axis *axes;
61 int nr_axes;
62
63 struct gpio_tilt_state *states;
64 int nr_states;
65
66 int debounce_interval;
67
68 unsigned int poll_interval;
69 int (*enable)(struct device *dev);
70 void (*disable)(struct device *dev);
71};
72
73#endif
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
new file mode 100644
index 000000000000..7163d91c0373
--- /dev/null
+++ b/include/linux/input/pixcir_ts.h
@@ -0,0 +1,10 @@
1#ifndef _PIXCIR_I2C_TS_H
2#define _PIXCIR_I2C_TS_H
3
4struct pixcir_ts_platform_data {
5 int (*attb_read_val)(void);
6 int x_max;
7 int y_max;
8};
9
10#endif
diff --git a/include/linux/input/samsung-keypad.h b/include/linux/input/samsung-keypad.h
new file mode 100644
index 000000000000..f25619bfd8a8
--- /dev/null
+++ b/include/linux/input/samsung-keypad.h
@@ -0,0 +1,43 @@
1/*
2 * Samsung Keypad platform data definitions
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __SAMSUNG_KEYPAD_H
14#define __SAMSUNG_KEYPAD_H
15
16#include <linux/input/matrix_keypad.h>
17
18#define SAMSUNG_MAX_ROWS 8
19#define SAMSUNG_MAX_COLS 8
20
21/**
22 * struct samsung_keypad_platdata - Platform device data for Samsung Keypad.
23 * @keymap_data: pointer to &matrix_keymap_data.
24 * @rows: number of keypad row supported.
25 * @cols: number of keypad col supported.
26 * @no_autorepeat: disable key autorepeat.
27 * @wakeup: controls whether the device should be set up as wakeup source.
28 * @cfg_gpio: configure the GPIO.
29 *
30 * Initialisation data specific to either the machine or the platform
31 * for the device driver to use or call-back when configuring gpio.
32 */
33struct samsung_keypad_platdata {
34 const struct matrix_keymap_data *keymap_data;
35 unsigned int rows;
36 unsigned int cols;
37 bool no_autorepeat;
38 bool wakeup;
39
40 void (*cfg_gpio)(unsigned int rows, unsigned int cols);
41};
42
43#endif /* __SAMSUNG_KEYPAD_H */
diff --git a/include/linux/input/tca8418_keypad.h b/include/linux/input/tca8418_keypad.h
new file mode 100644
index 000000000000..e71a85dc2cbd
--- /dev/null
+++ b/include/linux/input/tca8418_keypad.h
@@ -0,0 +1,44 @@
1/*
2 * TCA8418 keypad platform support
3 *
4 * Copyright (C) 2011 Fuel7, Inc. All rights reserved.
5 *
6 * Author: Kyle Manna <kyle.manna@fuel7.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
10 * License v2 as published by the Free Software Foundation.
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 GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 021110-1307, USA.
21 *
22 * If you can't comply with GPLv2, alternative licensing terms may be
23 * arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary
24 * alternative licensing inquiries.
25 */
26
27#ifndef _TCA8418_KEYPAD_H
28#define _TCA8418_KEYPAD_H
29
30#include <linux/types.h>
31#include <linux/input/matrix_keypad.h>
32
33#define TCA8418_I2C_ADDR 0x34
34#define TCA8418_NAME "tca8418_keypad"
35
36struct tca8418_keypad_platform_data {
37 const struct matrix_keymap_data *keymap_data;
38 unsigned rows;
39 unsigned cols;
40 bool rep;
41 bool irq_is_gpio;
42};
43
44#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 432acc4c054d..d937580417ba 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -48,19 +48,34 @@ struct iommu_domain {
48 48
49#ifdef CONFIG_IOMMU_API 49#ifdef CONFIG_IOMMU_API
50 50
51/**
52 * struct iommu_ops - iommu ops and capabilities
53 * @domain_init: init iommu domain
54 * @domain_destroy: destroy iommu domain
55 * @attach_dev: attach device to an iommu domain
56 * @detach_dev: detach device from an iommu domain
57 * @map: map a physically contiguous memory region to an iommu domain
58 * @unmap: unmap a physically contiguous memory region from an iommu domain
59 * @iova_to_phys: translate iova to physical address
60 * @domain_has_cap: domain capabilities query
61 * @commit: commit iommu domain
62 * @pgsize_bitmap: bitmap of supported page sizes
63 */
51struct iommu_ops { 64struct iommu_ops {
52 int (*domain_init)(struct iommu_domain *domain); 65 int (*domain_init)(struct iommu_domain *domain);
53 void (*domain_destroy)(struct iommu_domain *domain); 66 void (*domain_destroy)(struct iommu_domain *domain);
54 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 67 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
55 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 68 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
56 int (*map)(struct iommu_domain *domain, unsigned long iova, 69 int (*map)(struct iommu_domain *domain, unsigned long iova,
57 phys_addr_t paddr, int gfp_order, int prot); 70 phys_addr_t paddr, size_t size, int prot);
58 int (*unmap)(struct iommu_domain *domain, unsigned long iova, 71 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
59 int gfp_order); 72 size_t size);
60 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 73 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
61 unsigned long iova); 74 unsigned long iova);
62 int (*domain_has_cap)(struct iommu_domain *domain, 75 int (*domain_has_cap)(struct iommu_domain *domain,
63 unsigned long cap); 76 unsigned long cap);
77 int (*device_group)(struct device *dev, unsigned int *groupid);
78 unsigned long pgsize_bitmap;
64}; 79};
65 80
66extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); 81extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
@@ -72,15 +87,16 @@ extern int iommu_attach_device(struct iommu_domain *domain,
72extern void iommu_detach_device(struct iommu_domain *domain, 87extern void iommu_detach_device(struct iommu_domain *domain,
73 struct device *dev); 88 struct device *dev);
74extern int iommu_map(struct iommu_domain *domain, unsigned long iova, 89extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
75 phys_addr_t paddr, int gfp_order, int prot); 90 phys_addr_t paddr, size_t size, int prot);
76extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova, 91extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
77 int gfp_order); 92 size_t size);
78extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 93extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
79 unsigned long iova); 94 unsigned long iova);
80extern int iommu_domain_has_cap(struct iommu_domain *domain, 95extern int iommu_domain_has_cap(struct iommu_domain *domain,
81 unsigned long cap); 96 unsigned long cap);
82extern void iommu_set_fault_handler(struct iommu_domain *domain, 97extern void iommu_set_fault_handler(struct iommu_domain *domain,
83 iommu_fault_handler_t handler); 98 iommu_fault_handler_t handler);
99extern int iommu_device_group(struct device *dev, unsigned int *groupid);
84 100
85/** 101/**
86 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework 102 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
@@ -179,6 +195,11 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain,
179{ 195{
180} 196}
181 197
198static inline int iommu_device_group(struct device *dev, unsigned int *groupid)
199{
200 return -ENODEV;
201}
202
182#endif /* CONFIG_IOMMU_API */ 203#endif /* CONFIG_IOMMU_API */
183 204
184#endif /* __LINUX_IOMMU_H */ 205#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 3b1594d662b0..30e816148df4 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -93,7 +93,7 @@ struct kern_ipc_perm
93 gid_t gid; 93 gid_t gid;
94 uid_t cuid; 94 uid_t cuid;
95 gid_t cgid; 95 gid_t cgid;
96 mode_t mode; 96 umode_t mode;
97 unsigned long seq; 97 unsigned long seq;
98 void *security; 98 void *security;
99}; 99};
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 0c997767429a..6318268dcaf5 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -404,7 +404,7 @@ struct tcp6_sock {
404 404
405extern int inet6_sk_rebuild_header(struct sock *sk); 405extern int inet6_sk_rebuild_header(struct sock *sk);
406 406
407#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 407#if IS_ENABLED(CONFIG_IPV6)
408static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 408static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
409{ 409{
410 return inet_sk(__sk)->pinet6; 410 return inet_sk(__sk)->pinet6;
@@ -515,7 +515,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
515#define inet6_rcv_saddr(__sk) NULL 515#define inet6_rcv_saddr(__sk) NULL
516#define tcp_twsk_ipv6only(__sk) 0 516#define tcp_twsk_ipv6only(__sk) 0
517#define inet_v6_ipv6only(__sk) 0 517#define inet_v6_ipv6only(__sk) 0
518#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 518#endif /* IS_ENABLED(CONFIG_IPV6) */
519 519
520#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 520#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
521 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 521 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 99834e581b9e..bd4272b61a14 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -91,10 +91,11 @@ static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
91 91
92extern void irq_domain_add(struct irq_domain *domain); 92extern void irq_domain_add(struct irq_domain *domain);
93extern void irq_domain_del(struct irq_domain *domain); 93extern void irq_domain_del(struct irq_domain *domain);
94
95extern struct irq_domain_ops irq_domain_simple_ops;
94#endif /* CONFIG_IRQ_DOMAIN */ 96#endif /* CONFIG_IRQ_DOMAIN */
95 97
96#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) 98#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
97extern struct irq_domain_ops irq_domain_simple_ops;
98extern void irq_domain_add_simple(struct device_node *controller, int irq_base); 99extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
99extern void irq_domain_generate_simple(const struct of_device_id *match, 100extern void irq_domain_generate_simple(const struct of_device_id *match,
100 u64 phys_base, unsigned int irq_start); 101 u64 phys_base, unsigned int irq_start);
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index f0a2f8b0aa13..2a8b1659bf35 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -91,7 +91,7 @@ struct iscsi_boot_kobj {
91 * The enum of the type. This can be any value of the above 91 * The enum of the type. This can be any value of the above
92 * properties. 92 * properties.
93 */ 93 */
94 mode_t (*is_visible) (void *data, int type); 94 umode_t (*is_visible) (void *data, int type);
95 95
96 /* 96 /*
97 * Driver specific release function. 97 * Driver specific release function.
@@ -110,20 +110,20 @@ struct iscsi_boot_kobj *
110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, 110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
111 void *data, 111 void *data,
112 ssize_t (*show) (void *data, int type, char *buf), 112 ssize_t (*show) (void *data, int type, char *buf),
113 mode_t (*is_visible) (void *data, int type), 113 umode_t (*is_visible) (void *data, int type),
114 void (*release) (void *data)); 114 void (*release) (void *data));
115 115
116struct iscsi_boot_kobj * 116struct iscsi_boot_kobj *
117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, 117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
118 void *data, 118 void *data,
119 ssize_t (*show) (void *data, int type, char *buf), 119 ssize_t (*show) (void *data, int type, char *buf),
120 mode_t (*is_visible) (void *data, int type), 120 umode_t (*is_visible) (void *data, int type),
121 void (*release) (void *data)); 121 void (*release) (void *data));
122struct iscsi_boot_kobj * 122struct iscsi_boot_kobj *
123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, 123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
124 void *data, 124 void *data,
125 ssize_t (*show) (void *data, int type, char *buf), 125 ssize_t (*show) (void *data, int type, char *buf),
126 mode_t (*is_visible) (void *data, int type), 126 umode_t (*is_visible) (void *data, int type),
127 void (*release) (void *data)); 127 void (*release) (void *data));
128 128
129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name); 129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c7acdde3243d..d211732b9e99 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -497,7 +497,6 @@ struct transaction_s
497 * @j_format_version: Version of the superblock format 497 * @j_format_version: Version of the superblock format
498 * @j_state_lock: Protect the various scalars in the journal 498 * @j_state_lock: Protect the various scalars in the journal
499 * @j_barrier_count: Number of processes waiting to create a barrier lock 499 * @j_barrier_count: Number of processes waiting to create a barrier lock
500 * @j_barrier: The barrier lock itself
501 * @j_running_transaction: The current running transaction.. 500 * @j_running_transaction: The current running transaction..
502 * @j_committing_transaction: the transaction we are pushing to disk 501 * @j_committing_transaction: the transaction we are pushing to disk
503 * @j_checkpoint_transactions: a linked circular list of all transactions 502 * @j_checkpoint_transactions: a linked circular list of all transactions
@@ -580,9 +579,6 @@ struct journal_s
580 */ 579 */
581 int j_barrier_count; 580 int j_barrier_count;
582 581
583 /* The barrier lock itself */
584 struct mutex j_barrier;
585
586 /* 582 /*
587 * Transactions: The current running transaction... 583 * Transactions: The current running transaction...
588 * [j_state_lock] [caller holding open handle] 584 * [j_state_lock] [caller holding open handle]
@@ -913,6 +909,7 @@ extern int journal_set_revoke(journal_t *, unsigned int, tid_t);
913extern int journal_test_revoke(journal_t *, unsigned int, tid_t); 909extern int journal_test_revoke(journal_t *, unsigned int, tid_t);
914extern void journal_clear_revoke(journal_t *); 910extern void journal_clear_revoke(journal_t *);
915extern void journal_switch_revoke_table(journal_t *journal); 911extern void journal_switch_revoke_table(journal_t *journal);
912extern void journal_clear_buffer_revoked_flags(journal_t *journal);
916 913
917/* 914/*
918 * The log thread user interface: 915 * The log thread user interface:
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 2092ea21e469..5557baefed60 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1151,6 +1151,7 @@ extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
1151extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t); 1151extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
1152extern void jbd2_journal_clear_revoke(journal_t *); 1152extern void jbd2_journal_clear_revoke(journal_t *);
1153extern void jbd2_journal_switch_revoke_table(journal_t *journal); 1153extern void jbd2_journal_switch_revoke_table(journal_t *journal);
1154extern void jbd2_clear_buffer_revoked_flags(journal_t *journal);
1154 1155
1155/* 1156/*
1156 * The log thread user interface: 1157 * The log thread user interface:
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 388b0d425b50..5ce8b140428f 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <linux/workqueue.h>
6 7
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 8#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8 9
@@ -14,6 +15,12 @@ struct jump_label_key {
14#endif 15#endif
15}; 16};
16 17
18struct jump_label_key_deferred {
19 struct jump_label_key key;
20 unsigned long timeout;
21 struct delayed_work work;
22};
23
17# include <asm/jump_label.h> 24# include <asm/jump_label.h>
18# define HAVE_JUMP_LABEL 25# define HAVE_JUMP_LABEL
19#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 26#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
@@ -51,8 +58,11 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
51extern int jump_label_text_reserved(void *start, void *end); 58extern int jump_label_text_reserved(void *start, void *end);
52extern void jump_label_inc(struct jump_label_key *key); 59extern void jump_label_inc(struct jump_label_key *key);
53extern void jump_label_dec(struct jump_label_key *key); 60extern void jump_label_dec(struct jump_label_key *key);
61extern void jump_label_dec_deferred(struct jump_label_key_deferred *key);
54extern bool jump_label_enabled(struct jump_label_key *key); 62extern bool jump_label_enabled(struct jump_label_key *key);
55extern void jump_label_apply_nops(struct module *mod); 63extern void jump_label_apply_nops(struct module *mod);
64extern void jump_label_rate_limit(struct jump_label_key_deferred *key,
65 unsigned long rl);
56 66
57#else /* !HAVE_JUMP_LABEL */ 67#else /* !HAVE_JUMP_LABEL */
58 68
@@ -68,6 +78,10 @@ static __always_inline void jump_label_init(void)
68{ 78{
69} 79}
70 80
81struct jump_label_key_deferred {
82 struct jump_label_key key;
83};
84
71static __always_inline bool static_branch(struct jump_label_key *key) 85static __always_inline bool static_branch(struct jump_label_key *key)
72{ 86{
73 if (unlikely(atomic_read(&key->enabled))) 87 if (unlikely(atomic_read(&key->enabled)))
@@ -85,6 +99,11 @@ static inline void jump_label_dec(struct jump_label_key *key)
85 atomic_dec(&key->enabled); 99 atomic_dec(&key->enabled);
86} 100}
87 101
102static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key)
103{
104 jump_label_dec(&key->key);
105}
106
88static inline int jump_label_text_reserved(void *start, void *end) 107static inline int jump_label_text_reserved(void *start, void *end)
89{ 108{
90 return 0; 109 return 0;
@@ -102,6 +121,14 @@ static inline int jump_label_apply_nops(struct module *mod)
102{ 121{
103 return 0; 122 return 0;
104} 123}
124
125static inline void jump_label_rate_limit(struct jump_label_key_deferred *key,
126 unsigned long rl)
127{
128}
105#endif /* HAVE_JUMP_LABEL */ 129#endif /* HAVE_JUMP_LABEL */
106 130
131#define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), })
132#define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), })
133
107#endif /* _LINUX_JUMP_LABEL_H */ 134#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e8b1597b5cf2..e8343422240a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -185,16 +185,17 @@ static inline void might_fault(void)
185 185
186extern struct atomic_notifier_head panic_notifier_list; 186extern struct atomic_notifier_head panic_notifier_list;
187extern long (*panic_blink)(int state); 187extern long (*panic_blink)(int state);
188NORET_TYPE void panic(const char * fmt, ...) 188__printf(1, 2)
189 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; 189void panic(const char *fmt, ...)
190 __noreturn __cold;
190extern void oops_enter(void); 191extern void oops_enter(void);
191extern void oops_exit(void); 192extern void oops_exit(void);
192void print_oops_end_marker(void); 193void print_oops_end_marker(void);
193extern int oops_may_print(void); 194extern int oops_may_print(void);
194NORET_TYPE void do_exit(long error_code) 195void do_exit(long error_code)
195 ATTRIB_NORET; 196 __noreturn;
196NORET_TYPE void complete_and_exit(struct completion *, long) 197void complete_and_exit(struct completion *, long)
197 ATTRIB_NORET; 198 __noreturn;
198 199
199/* Internal, do not use. */ 200/* Internal, do not use. */
200int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); 201int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
@@ -341,6 +342,7 @@ extern int panic_timeout;
341extern int panic_on_oops; 342extern int panic_on_oops;
342extern int panic_on_unrecovered_nmi; 343extern int panic_on_unrecovered_nmi;
343extern int panic_on_io_nmi; 344extern int panic_on_io_nmi;
345extern int sysctl_panic_on_stackoverflow;
344extern const char *print_tainted(void); 346extern const char *print_tainted(void);
345extern void add_taint(unsigned flag); 347extern void add_taint(unsigned flag);
346extern int test_taint(unsigned flag); 348extern int test_taint(unsigned flag);
@@ -665,6 +667,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
665#define BUILD_BUG_ON_ZERO(e) (0) 667#define BUILD_BUG_ON_ZERO(e) (0)
666#define BUILD_BUG_ON_NULL(e) ((void*)0) 668#define BUILD_BUG_ON_NULL(e) ((void*)0)
667#define BUILD_BUG_ON(condition) 669#define BUILD_BUG_ON(condition)
670#define BUILD_BUG() (0)
668#else /* __CHECKER__ */ 671#else /* __CHECKER__ */
669 672
670/* Force a compilation error if a constant expression is not a power of 2 */ 673/* Force a compilation error if a constant expression is not a power of 2 */
@@ -703,6 +706,21 @@ extern int __build_bug_on_failed;
703 if (condition) __build_bug_on_failed = 1; \ 706 if (condition) __build_bug_on_failed = 1; \
704 } while(0) 707 } while(0)
705#endif 708#endif
709
710/**
711 * BUILD_BUG - break compile if used.
712 *
713 * If you have some code that you expect the compiler to eliminate at
714 * build time, you should use BUILD_BUG to detect if it is
715 * unexpectedly used.
716 */
717#define BUILD_BUG() \
718 do { \
719 extern void __build_bug_failed(void) \
720 __linktime_error("BUILD_BUG failed"); \
721 __build_bug_failed(); \
722 } while (0)
723
706#endif /* __CHECKER__ */ 724#endif /* __CHECKER__ */
707 725
708/* Trap pasters of __FUNCTION__ at compile-time */ 726/* Trap pasters of __FUNCTION__ at compile-time */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 0cce2db580c3..2fbd9053c2df 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -6,6 +6,7 @@
6#include <linux/percpu.h> 6#include <linux/percpu.h>
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 <asm/irq.h> 10#include <asm/irq.h>
10#include <asm/cputime.h> 11#include <asm/cputime.h>
11 12
@@ -15,21 +16,25 @@
15 * used by rstatd/perfmeter 16 * used by rstatd/perfmeter
16 */ 17 */
17 18
18struct cpu_usage_stat { 19enum cpu_usage_stat {
19 cputime64_t user; 20 CPUTIME_USER,
20 cputime64_t nice; 21 CPUTIME_NICE,
21 cputime64_t system; 22 CPUTIME_SYSTEM,
22 cputime64_t softirq; 23 CPUTIME_SOFTIRQ,
23 cputime64_t irq; 24 CPUTIME_IRQ,
24 cputime64_t idle; 25 CPUTIME_IDLE,
25 cputime64_t iowait; 26 CPUTIME_IOWAIT,
26 cputime64_t steal; 27 CPUTIME_STEAL,
27 cputime64_t guest; 28 CPUTIME_GUEST,
28 cputime64_t guest_nice; 29 CPUTIME_GUEST_NICE,
30 NR_STATS,
31};
32
33struct kernel_cpustat {
34 u64 cpustat[NR_STATS];
29}; 35};
30 36
31struct kernel_stat { 37struct kernel_stat {
32 struct cpu_usage_stat cpustat;
33#ifndef CONFIG_GENERIC_HARDIRQS 38#ifndef CONFIG_GENERIC_HARDIRQS
34 unsigned int irqs[NR_IRQS]; 39 unsigned int irqs[NR_IRQS];
35#endif 40#endif
@@ -38,10 +43,13 @@ struct kernel_stat {
38}; 43};
39 44
40DECLARE_PER_CPU(struct kernel_stat, kstat); 45DECLARE_PER_CPU(struct kernel_stat, kstat);
46DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
41 47
42#define kstat_cpu(cpu) per_cpu(kstat, cpu)
43/* Must have preemption disabled for this to be meaningful. */ 48/* Must have preemption disabled for this to be meaningful. */
44#define kstat_this_cpu __get_cpu_var(kstat) 49#define kstat_this_cpu (&__get_cpu_var(kstat))
50#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat))
51#define kstat_cpu(cpu) per_cpu(kstat, cpu)
52#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
45 53
46extern unsigned long long nr_context_switches(void); 54extern unsigned long long nr_context_switches(void);
47 55
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 9efd081bb31e..39e3c082c49d 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -92,6 +92,7 @@ struct key_type {
92 92
93 /* internal fields */ 93 /* internal fields */
94 struct list_head link; /* link in types list */ 94 struct list_head link; /* link in types list */
95 struct lock_class_key lock_class; /* key->sem lock class */
95}; 96};
96 97
97extern struct key_type key_type_keyring; 98extern struct key_type key_type_keyring;
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index b16f65390734..722f477c4ef7 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -117,5 +117,7 @@ extern void usermodehelper_init(void);
117extern int usermodehelper_disable(void); 117extern int usermodehelper_disable(void);
118extern void usermodehelper_enable(void); 118extern void usermodehelper_enable(void);
119extern bool usermodehelper_is_disabled(void); 119extern bool usermodehelper_is_disabled(void);
120extern void read_lock_usermodehelper(void);
121extern void read_unlock_usermodehelper(void);
120 122
121#endif /* __LINUX_KMOD_H__ */ 123#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index ee0c952188de..fee66317e071 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -18,7 +18,6 @@
18enum kmsg_dump_reason { 18enum kmsg_dump_reason {
19 KMSG_DUMP_OOPS, 19 KMSG_DUMP_OOPS,
20 KMSG_DUMP_PANIC, 20 KMSG_DUMP_PANIC,
21 KMSG_DUMP_KEXEC,
22 KMSG_DUMP_RESTART, 21 KMSG_DUMP_RESTART,
23 KMSG_DUMP_HALT, 22 KMSG_DUMP_HALT,
24 KMSG_DUMP_POWEROFF, 23 KMSG_DUMP_POWEROFF,
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index ad81e1c51487..fc615a97e2d3 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
191} 191}
192 192
193extern struct kobject *kset_find_obj(struct kset *, const char *); 193extern struct kobject *kset_find_obj(struct kset *, const char *);
194extern struct kobject *kset_find_obj_hinted(struct kset *, const char *,
195 struct kobject *);
196 194
197/* The global /sys/kernel/ kobject for people to chain off of */ 195/* The global /sys/kernel/ kobject for people to chain off of */
198extern struct kobject *kernel_kobj; 196extern struct kobject *kernel_kobj;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index d4a62ab2ee5e..abc0120b09b7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -15,16 +15,81 @@
15#ifndef _KREF_H_ 15#ifndef _KREF_H_
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#include <linux/types.h> 18#include <linux/bug.h>
19#include <linux/atomic.h>
19 20
20struct kref { 21struct kref {
21 atomic_t refcount; 22 atomic_t refcount;
22}; 23};
23 24
24void kref_init(struct kref *kref); 25/**
25void kref_get(struct kref *kref); 26 * kref_init - initialize object.
26int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 27 * @kref: object in question.
27int kref_sub(struct kref *kref, unsigned int count, 28 */
28 void (*release) (struct kref *kref)); 29static inline void kref_init(struct kref *kref)
30{
31 atomic_set(&kref->refcount, 1);
32}
33
34/**
35 * kref_get - increment refcount for object.
36 * @kref: object.
37 */
38static inline void kref_get(struct kref *kref)
39{
40 WARN_ON(!atomic_read(&kref->refcount));
41 atomic_inc(&kref->refcount);
42}
29 43
44/**
45 * kref_sub - subtract a number of refcounts for object.
46 * @kref: object.
47 * @count: Number of recounts to subtract.
48 * @release: pointer to the function that will clean up the object when the
49 * last reference to the object is released.
50 * This pointer is required, and it is not acceptable to pass kfree
51 * in as this function. If the caller does pass kfree to this
52 * function, you will be publicly mocked mercilessly by the kref
53 * maintainer, and anyone else who happens to notice it. You have
54 * been warned.
55 *
56 * Subtract @count from the refcount, and if 0, call release().
57 * Return 1 if the object was removed, otherwise return 0. Beware, if this
58 * function returns 0, you still can not count on the kref from remaining in
59 * memory. Only use the return value if you want to see if the kref is now
60 * gone, not present.
61 */
62static inline int kref_sub(struct kref *kref, unsigned int count,
63 void (*release)(struct kref *kref))
64{
65 WARN_ON(release == NULL);
66
67 if (atomic_sub_and_test((int) count, &kref->refcount)) {
68 release(kref);
69 return 1;
70 }
71 return 0;
72}
73
74/**
75 * kref_put - decrement refcount for object.
76 * @kref: object.
77 * @release: pointer to the function that will clean up the object when the
78 * last reference to the object is released.
79 * This pointer is required, and it is not acceptable to pass kfree
80 * in as this function. If the caller does pass kfree to this
81 * function, you will be publicly mocked mercilessly by the kref
82 * maintainer, and anyone else who happens to notice it. You have
83 * been warned.
84 *
85 * Decrement the refcount, and if 0, call release().
86 * Return 1 if the object was removed, otherwise return 0. Beware, if this
87 * function returns 0, you still can not count on the kref from remaining in
88 * memory. Only use the return value if you want to see if the kref is now
89 * gone, not present.
90 */
91static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
92{
93 return kref_sub(kref, 1, release);
94}
30#endif /* _KREF_H_ */ 95#endif /* _KREF_H_ */
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 5cac19b3a266..0714b24c0e45 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -35,6 +35,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
35void kthread_bind(struct task_struct *k, unsigned int cpu); 35void kthread_bind(struct task_struct *k, unsigned int cpu);
36int kthread_stop(struct task_struct *k); 36int kthread_stop(struct task_struct *k);
37int kthread_should_stop(void); 37int kthread_should_stop(void);
38bool kthread_freezable_should_stop(bool *was_frozen);
38void *kthread_data(struct task_struct *k); 39void *kthread_data(struct task_struct *k);
39 40
40int kthreadd(void *unused); 41int kthreadd(void *unused);
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index c3892fc1d538..68e67e50d028 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -557,6 +557,7 @@ struct kvm_ppc_pvinfo {
557#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ 557#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
558#define KVM_CAP_PPC_PAPR 68 558#define KVM_CAP_PPC_PAPR 68
559#define KVM_CAP_S390_GMAP 71 559#define KVM_CAP_S390_GMAP 71
560#define KVM_CAP_TSC_DEADLINE_TIMER 72
560 561
561#ifdef KVM_CAP_IRQ_ROUTING 562#ifdef KVM_CAP_IRQ_ROUTING
562 563
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d52623199978..900c76337e8f 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -14,6 +14,7 @@
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/mmu_notifier.h>
17#include <linux/preempt.h> 18#include <linux/preempt.h>
18#include <linux/msi.h> 19#include <linux/msi.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
@@ -50,6 +51,9 @@
50#define KVM_REQ_APF_HALT 12 51#define KVM_REQ_APF_HALT 12
51#define KVM_REQ_STEAL_UPDATE 13 52#define KVM_REQ_STEAL_UPDATE 13
52#define KVM_REQ_NMI 14 53#define KVM_REQ_NMI 14
54#define KVM_REQ_IMMEDIATE_EXIT 15
55#define KVM_REQ_PMU 16
56#define KVM_REQ_PMI 17
53 57
54#define KVM_USERSPACE_IRQ_SOURCE_ID 0 58#define KVM_USERSPACE_IRQ_SOURCE_ID 0
55 59
@@ -179,6 +183,7 @@ struct kvm_memory_slot {
179 unsigned long *rmap; 183 unsigned long *rmap;
180 unsigned long *dirty_bitmap; 184 unsigned long *dirty_bitmap;
181 unsigned long *dirty_bitmap_head; 185 unsigned long *dirty_bitmap_head;
186 unsigned long nr_dirty_pages;
182 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; 187 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
183 unsigned long userspace_addr; 188 unsigned long userspace_addr;
184 int user_alloc; 189 int user_alloc;
@@ -224,11 +229,20 @@ struct kvm_irq_routing_table {};
224 229
225#endif 230#endif
226 231
232#ifndef KVM_MEM_SLOTS_NUM
233#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
234#endif
235
236/*
237 * Note:
238 * memslots are not sorted by id anymore, please use id_to_memslot()
239 * to get the memslot by its id.
240 */
227struct kvm_memslots { 241struct kvm_memslots {
228 int nmemslots;
229 u64 generation; 242 u64 generation;
230 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 243 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
231 KVM_PRIVATE_MEM_SLOTS]; 244 /* The mapping table from slot id to the index in memslots[]. */
245 int id_to_index[KVM_MEM_SLOTS_NUM];
232}; 246};
233 247
234struct kvm { 248struct kvm {
@@ -239,7 +253,6 @@ struct kvm {
239 struct srcu_struct srcu; 253 struct srcu_struct srcu;
240#ifdef CONFIG_KVM_APIC_ARCHITECTURE 254#ifdef CONFIG_KVM_APIC_ARCHITECTURE
241 u32 bsp_vcpu_id; 255 u32 bsp_vcpu_id;
242 struct kvm_vcpu *bsp_vcpu;
243#endif 256#endif
244 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 257 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
245 atomic_t online_vcpus; 258 atomic_t online_vcpus;
@@ -302,6 +315,11 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
302 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ 315 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
303 idx++) 316 idx++)
304 317
318#define kvm_for_each_memslot(memslot, slots) \
319 for (memslot = &slots->memslots[0]; \
320 memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\
321 memslot++)
322
305int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 323int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
306void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 324void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
307 325
@@ -314,6 +332,7 @@ void kvm_exit(void);
314 332
315void kvm_get_kvm(struct kvm *kvm); 333void kvm_get_kvm(struct kvm *kvm);
316void kvm_put_kvm(struct kvm *kvm); 334void kvm_put_kvm(struct kvm *kvm);
335void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new);
317 336
318static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) 337static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
319{ 338{
@@ -322,6 +341,18 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
322 || lockdep_is_held(&kvm->slots_lock)); 341 || lockdep_is_held(&kvm->slots_lock));
323} 342}
324 343
344static inline struct kvm_memory_slot *
345id_to_memslot(struct kvm_memslots *slots, int id)
346{
347 int index = slots->id_to_index[id];
348 struct kvm_memory_slot *slot;
349
350 slot = &slots->memslots[index];
351
352 WARN_ON(slot->id != id);
353 return slot;
354}
355
325#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 356#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
326#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 357#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
327static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 358static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 47a070b0520e..ff476ddaf310 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -35,4 +35,3 @@ static inline int kvm_para_has_feature(unsigned int feature)
35} 35}
36#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
37#endif /* __LINUX_KVM_PARA_H */ 37#endif /* __LINUX_KVM_PARA_H */
38
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
index b0e99898527c..e23121f9d82a 100644
--- a/include/linux/latencytop.h
+++ b/include/linux/latencytop.h
@@ -10,6 +10,8 @@
10#define _INCLUDE_GUARD_LATENCYTOP_H_ 10#define _INCLUDE_GUARD_LATENCYTOP_H_
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13struct task_struct;
14
13#ifdef CONFIG_LATENCYTOP 15#ifdef CONFIG_LATENCYTOP
14 16
15#define LT_SAVECOUNT 32 17#define LT_SAVECOUNT 32
@@ -23,7 +25,6 @@ struct latency_record {
23}; 25};
24 26
25 27
26struct task_struct;
27 28
28extern int latencytop_enabled; 29extern int latencytop_enabled;
29void __account_scheduler_latency(struct task_struct *task, int usecs, int inter); 30void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
diff --git a/include/linux/leds-tca6507.h b/include/linux/leds-tca6507.h
new file mode 100644
index 000000000000..dcabf4fa2aef
--- /dev/null
+++ b/include/linux/leds-tca6507.h
@@ -0,0 +1,34 @@
1/*
2 * TCA6507 LED chip driver.
3 *
4 * Copyright (C) 2011 Neil Brown <neil@brown.name>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 */
20
21#ifndef __LINUX_TCA6507_H
22#define __LINUX_TCA6507_H
23#include <linux/leds.h>
24
25struct tca6507_platform_data {
26 struct led_platform_data leds;
27#ifdef CONFIG_GPIOLIB
28 int gpio_base;
29 void (*setup)(unsigned gpio_base, unsigned ngpio);
30#endif
31};
32
33#define TCA6507_MAKE_GPIO 1
34#endif /* __LINUX_TCA6507_H*/
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index f549056fb20b..87f402ccec55 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/lockdep.h> 23#include <linux/lockdep.h>
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/cpu.h>
25 26
26/* can make br locks by using local lock for read side, global lock for write */ 27/* can make br locks by using local lock for read side, global lock for write */
27#define br_lock_init(name) name##_lock_init() 28#define br_lock_init(name) name##_lock_init()
@@ -72,9 +73,31 @@
72 73
73#define DEFINE_LGLOCK(name) \ 74#define DEFINE_LGLOCK(name) \
74 \ 75 \
76 DEFINE_SPINLOCK(name##_cpu_lock); \
77 cpumask_t name##_cpus __read_mostly; \
75 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ 78 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \
76 DEFINE_LGLOCK_LOCKDEP(name); \ 79 DEFINE_LGLOCK_LOCKDEP(name); \
77 \ 80 \
81 static int \
82 name##_lg_cpu_callback(struct notifier_block *nb, \
83 unsigned long action, void *hcpu) \
84 { \
85 switch (action & ~CPU_TASKS_FROZEN) { \
86 case CPU_UP_PREPARE: \
87 spin_lock(&name##_cpu_lock); \
88 cpu_set((unsigned long)hcpu, name##_cpus); \
89 spin_unlock(&name##_cpu_lock); \
90 break; \
91 case CPU_UP_CANCELED: case CPU_DEAD: \
92 spin_lock(&name##_cpu_lock); \
93 cpu_clear((unsigned long)hcpu, name##_cpus); \
94 spin_unlock(&name##_cpu_lock); \
95 } \
96 return NOTIFY_OK; \
97 } \
98 static struct notifier_block name##_lg_cpu_notifier = { \
99 .notifier_call = name##_lg_cpu_callback, \
100 }; \
78 void name##_lock_init(void) { \ 101 void name##_lock_init(void) { \
79 int i; \ 102 int i; \
80 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ 103 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \
@@ -83,6 +106,11 @@
83 lock = &per_cpu(name##_lock, i); \ 106 lock = &per_cpu(name##_lock, i); \
84 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ 107 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
85 } \ 108 } \
109 register_hotcpu_notifier(&name##_lg_cpu_notifier); \
110 get_online_cpus(); \
111 for_each_online_cpu(i) \
112 cpu_set(i, name##_cpus); \
113 put_online_cpus(); \
86 } \ 114 } \
87 EXPORT_SYMBOL(name##_lock_init); \ 115 EXPORT_SYMBOL(name##_lock_init); \
88 \ 116 \
@@ -124,9 +152,9 @@
124 \ 152 \
125 void name##_global_lock_online(void) { \ 153 void name##_global_lock_online(void) { \
126 int i; \ 154 int i; \
127 preempt_disable(); \ 155 spin_lock(&name##_cpu_lock); \
128 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ 156 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
129 for_each_online_cpu(i) { \ 157 for_each_cpu(i, &name##_cpus) { \
130 arch_spinlock_t *lock; \ 158 arch_spinlock_t *lock; \
131 lock = &per_cpu(name##_lock, i); \ 159 lock = &per_cpu(name##_lock, i); \
132 arch_spin_lock(lock); \ 160 arch_spin_lock(lock); \
@@ -137,12 +165,12 @@
137 void name##_global_unlock_online(void) { \ 165 void name##_global_unlock_online(void) { \
138 int i; \ 166 int i; \
139 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ 167 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
140 for_each_online_cpu(i) { \ 168 for_each_cpu(i, &name##_cpus) { \
141 arch_spinlock_t *lock; \ 169 arch_spinlock_t *lock; \
142 lock = &per_cpu(name##_lock, i); \ 170 lock = &per_cpu(name##_lock, i); \
143 arch_spin_unlock(lock); \ 171 arch_spin_unlock(lock); \
144 } \ 172 } \
145 preempt_enable(); \ 173 spin_unlock(&name##_cpu_lock); \
146 } \ 174 } \
147 EXPORT_SYMBOL(name##_global_unlock_online); \ 175 EXPORT_SYMBOL(name##_global_unlock_online); \
148 \ 176 \
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 3f46aedea42f..807f1e533226 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -88,8 +88,4 @@
88 88
89#endif 89#endif
90 90
91#define NORET_TYPE /**/
92#define ATTRIB_NORET __attribute__((noreturn))
93#define NORET_AND noreturn,
94
95#endif 91#endif
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ff9abff55aa0..88a114fce477 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -195,7 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
195#endif 195#endif
196extern int nlmsvc_grace_period; 196extern int nlmsvc_grace_period;
197extern unsigned long nlmsvc_timeout; 197extern unsigned long nlmsvc_timeout;
198extern int nsm_use_hostnames; 198extern bool nsm_use_hostnames;
199extern u32 nsm_local_state; 199extern u32 nsm_local_state;
200 200
201/* 201/*
@@ -301,7 +301,7 @@ static inline int __nlm_privileged_request4(const struct sockaddr *sap)
301 return ipv4_is_loopback(sin->sin_addr.s_addr); 301 return ipv4_is_loopback(sin->sin_addr.s_addr);
302} 302}
303 303
304#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 304#if IS_ENABLED(CONFIG_IPV6)
305static inline int __nlm_privileged_request6(const struct sockaddr *sap) 305static inline int __nlm_privileged_request6(const struct sockaddr *sap)
306{ 306{
307 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; 307 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
@@ -314,12 +314,12 @@ static inline int __nlm_privileged_request6(const struct sockaddr *sap)
314 314
315 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK; 315 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
316} 316}
317#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 317#else /* IS_ENABLED(CONFIG_IPV6) */
318static inline int __nlm_privileged_request6(const struct sockaddr *sap) 318static inline int __nlm_privileged_request6(const struct sockaddr *sap)
319{ 319{
320 return 0; 320 return 0;
321} 321}
322#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 322#endif /* IS_ENABLED(CONFIG_IPV6) */
323 323
324/* 324/*
325 * Ensure incoming requests are from local privileged callers. 325 * Ensure incoming requests are from local privileged callers.
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index b6a56e37284c..d36619ead3ba 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -343,6 +343,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
343 343
344#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) 344#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
345 345
346#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
347
346#else /* !LOCKDEP */ 348#else /* !LOCKDEP */
347 349
348static inline void lockdep_off(void) 350static inline void lockdep_off(void)
@@ -392,6 +394,8 @@ struct lock_class_key { };
392 394
393#define lockdep_assert_held(l) do { } while (0) 395#define lockdep_assert_held(l) do { } while (0)
394 396
397#define lockdep_recursing(tsk) (0)
398
395#endif /* !LOCKDEP */ 399#endif /* !LOCKDEP */
396 400
397#ifdef CONFIG_LOCK_STAT 401#ifdef CONFIG_LOCK_STAT
diff --git a/include/linux/log2.h b/include/linux/log2.h
index 25b808631cd9..fd7ff3d91e6a 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
185#define rounddown_pow_of_two(n) \ 185#define rounddown_pow_of_two(n) \
186( \ 186( \
187 __builtin_constant_p(n) ? ( \ 187 __builtin_constant_p(n) ? ( \
188 (n == 1) ? 0 : \
189 (1UL << ilog2(n))) : \ 188 (1UL << ilog2(n))) : \
190 __rounddown_pow_of_two(n) \ 189 __rounddown_pow_of_two(n) \
191 ) 190 )
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h
new file mode 100755
index 000000000000..d21fa2865bf4
--- /dev/null
+++ b/include/linux/lp8727.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2011 National Semiconductor
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 _LP8727_H
10#define _LP8727_H
11
12enum lp8727_eoc_level {
13 EOC_5P,
14 EOC_10P,
15 EOC_16P,
16 EOC_20P,
17 EOC_25P,
18 EOC_33P,
19 EOC_50P,
20};
21
22enum lp8727_ichg {
23 ICHG_90mA,
24 ICHG_100mA,
25 ICHG_400mA,
26 ICHG_450mA,
27 ICHG_500mA,
28 ICHG_600mA,
29 ICHG_700mA,
30 ICHG_800mA,
31 ICHG_900mA,
32 ICHG_1000mA,
33};
34
35struct lp8727_chg_param {
36 /* end of charge level setting */
37 enum lp8727_eoc_level eoc_level;
38 /* charging current */
39 enum lp8727_ichg ichg;
40};
41
42struct lp8727_platform_data {
43 u8 (*get_batt_present)(void);
44 u16 (*get_batt_level)(void);
45 u8 (*get_batt_capacity)(void);
46 u8 (*get_batt_temp)(void);
47 struct lp8727_chg_param ac;
48 struct lp8727_chg_param usb;
49};
50
51#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index c11ff2932549..efa1a6d7aca8 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -32,5 +32,16 @@ struct mbus_dram_target_info
32 } cs[4]; 32 } cs[4];
33}; 33};
34 34
35 35/*
36 * The Marvell mbus is to be found only on SOCs from the Orion family
37 * at the moment. Provide a dummy stub for other architectures.
38 */
39#ifdef CONFIG_PLAT_ORION
40extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
41#else
42static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
43{
44 return NULL;
45}
46#endif
36#endif 47#endif
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h
index 0fe00cd4c93c..76f52bbbb2f4 100644
--- a/include/linux/mdio-bitbang.h
+++ b/include/linux/mdio-bitbang.h
@@ -32,6 +32,8 @@ struct mdiobb_ops {
32 32
33struct mdiobb_ctrl { 33struct mdiobb_ctrl {
34 const struct mdiobb_ops *ops; 34 const struct mdiobb_ops *ops;
35 /* reset callback */
36 int (*reset)(struct mii_bus *bus);
35}; 37};
36 38
37/* The returned bus is not yet registered with the phy layer. */ 39/* The returned bus is not yet registered with the phy layer. */
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
index e9d3fdfe41d7..7c9fe3c2be73 100644
--- a/include/linux/mdio-gpio.h
+++ b/include/linux/mdio-gpio.h
@@ -20,6 +20,8 @@ struct mdio_gpio_platform_data {
20 20
21 unsigned int phy_mask; 21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR]; 22 int irqs[PHY_MAX_ADDR];
23 /* reset callback */
24 int (*reset)(struct mii_bus *bus);
23}; 25};
24 26
25#endif /* __LINUX_MDIO_GPIO_H */ 27#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e6b843e16e81..a6bb10235148 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -2,8 +2,6 @@
2#define _LINUX_MEMBLOCK_H 2#define _LINUX_MEMBLOCK_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#define MEMBLOCK_ERROR 0
6
7#ifdef CONFIG_HAVE_MEMBLOCK 5#ifdef CONFIG_HAVE_MEMBLOCK
8/* 6/*
9 * Logical memory blocks. 7 * Logical memory blocks.
@@ -19,81 +17,161 @@
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/mm.h> 18#include <linux/mm.h>
21 19
22#include <asm/memblock.h>
23
24#define INIT_MEMBLOCK_REGIONS 128 20#define INIT_MEMBLOCK_REGIONS 128
25 21
26struct memblock_region { 22struct memblock_region {
27 phys_addr_t base; 23 phys_addr_t base;
28 phys_addr_t size; 24 phys_addr_t size;
25#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
26 int nid;
27#endif
29}; 28};
30 29
31struct memblock_type { 30struct memblock_type {
32 unsigned long cnt; /* number of regions */ 31 unsigned long cnt; /* number of regions */
33 unsigned long max; /* size of the allocated array */ 32 unsigned long max; /* size of the allocated array */
33 phys_addr_t total_size; /* size of all regions */
34 struct memblock_region *regions; 34 struct memblock_region *regions;
35}; 35};
36 36
37struct memblock { 37struct memblock {
38 phys_addr_t current_limit; 38 phys_addr_t current_limit;
39 phys_addr_t memory_size; /* Updated by memblock_analyze() */
40 struct memblock_type memory; 39 struct memblock_type memory;
41 struct memblock_type reserved; 40 struct memblock_type reserved;
42}; 41};
43 42
44extern struct memblock memblock; 43extern struct memblock memblock;
45extern int memblock_debug; 44extern int memblock_debug;
46extern int memblock_can_resize;
47 45
48#define memblock_dbg(fmt, ...) \ 46#define memblock_dbg(fmt, ...) \
49 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 47 if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
50 48
51u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align); 49phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end,
50 phys_addr_t size, phys_addr_t align, int nid);
51phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
52 phys_addr_t size, phys_addr_t align);
52int memblock_free_reserved_regions(void); 53int memblock_free_reserved_regions(void);
53int memblock_reserve_reserved_regions(void); 54int memblock_reserve_reserved_regions(void);
54 55
55extern void memblock_init(void); 56void memblock_allow_resize(void);
56extern void memblock_analyze(void); 57int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
57extern long memblock_add(phys_addr_t base, phys_addr_t size); 58int memblock_add(phys_addr_t base, phys_addr_t size);
58extern long memblock_remove(phys_addr_t base, phys_addr_t size); 59int memblock_remove(phys_addr_t base, phys_addr_t size);
59extern long memblock_free(phys_addr_t base, phys_addr_t size); 60int memblock_free(phys_addr_t base, phys_addr_t size);
60extern long memblock_reserve(phys_addr_t base, phys_addr_t size); 61int memblock_reserve(phys_addr_t base, phys_addr_t size);
62
63#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
64void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
65 unsigned long *out_end_pfn, int *out_nid);
66
67/**
68 * for_each_mem_pfn_range - early memory pfn range iterator
69 * @i: an integer used as loop variable
70 * @nid: node selector, %MAX_NUMNODES for all nodes
71 * @p_start: ptr to ulong for start pfn of the range, can be %NULL
72 * @p_end: ptr to ulong for end pfn of the range, can be %NULL
73 * @p_nid: ptr to int for nid of the range, can be %NULL
74 *
75 * Walks over configured memory ranges. Available after early_node_map is
76 * populated.
77 */
78#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \
79 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
80 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
81#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
82
83void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
84 phys_addr_t *out_end, int *out_nid);
85
86/**
87 * for_each_free_mem_range - iterate through free memblock areas
88 * @i: u64 used as loop variable
89 * @nid: node selector, %MAX_NUMNODES for all nodes
90 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
91 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
92 * @p_nid: ptr to int for nid of the range, can be %NULL
93 *
94 * Walks over free (memory && !reserved) areas of memblock. Available as
95 * soon as memblock is initialized.
96 */
97#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \
98 for (i = 0, \
99 __next_free_mem_range(&i, nid, p_start, p_end, p_nid); \
100 i != (u64)ULLONG_MAX; \
101 __next_free_mem_range(&i, nid, p_start, p_end, p_nid))
102
103void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
104 phys_addr_t *out_end, int *out_nid);
61 105
62/* The numa aware allocator is only available if 106/**
63 * CONFIG_ARCH_POPULATES_NODE_MAP is set 107 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas
108 * @i: u64 used as loop variable
109 * @nid: node selector, %MAX_NUMNODES for all nodes
110 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
111 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
112 * @p_nid: ptr to int for nid of the range, can be %NULL
113 *
114 * Walks over free (memory && !reserved) areas of memblock in reverse
115 * order. Available as soon as memblock is initialized.
64 */ 116 */
65extern phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, 117#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \
66 int nid); 118 for (i = (u64)ULLONG_MAX, \
67extern phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, 119 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid); \
68 int nid); 120 i != (u64)ULLONG_MAX; \
121 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
69 122
70extern phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align); 123#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
124int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
125
126static inline void memblock_set_region_node(struct memblock_region *r, int nid)
127{
128 r->nid = nid;
129}
130
131static inline int memblock_get_region_node(const struct memblock_region *r)
132{
133 return r->nid;
134}
135#else
136static inline void memblock_set_region_node(struct memblock_region *r, int nid)
137{
138}
139
140static inline int memblock_get_region_node(const struct memblock_region *r)
141{
142 return 0;
143}
144#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
145
146phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
147phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
148
149phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
71 150
72/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ 151/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
73#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 152#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
74#define MEMBLOCK_ALLOC_ACCESSIBLE 0 153#define MEMBLOCK_ALLOC_ACCESSIBLE 0
75 154
76extern phys_addr_t memblock_alloc_base(phys_addr_t size, 155phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
77 phys_addr_t align, 156 phys_addr_t max_addr);
78 phys_addr_t max_addr); 157phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
79extern phys_addr_t __memblock_alloc_base(phys_addr_t size, 158 phys_addr_t max_addr);
80 phys_addr_t align, 159phys_addr_t memblock_phys_mem_size(void);
81 phys_addr_t max_addr); 160phys_addr_t memblock_start_of_DRAM(void);
82extern phys_addr_t memblock_phys_mem_size(void); 161phys_addr_t memblock_end_of_DRAM(void);
83extern phys_addr_t memblock_start_of_DRAM(void); 162void memblock_enforce_memory_limit(phys_addr_t memory_limit);
84extern phys_addr_t memblock_end_of_DRAM(void); 163int memblock_is_memory(phys_addr_t addr);
85extern void memblock_enforce_memory_limit(phys_addr_t memory_limit); 164int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
86extern int memblock_is_memory(phys_addr_t addr); 165int memblock_is_reserved(phys_addr_t addr);
87extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); 166int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
88extern int memblock_is_reserved(phys_addr_t addr); 167
89extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); 168extern void __memblock_dump_all(void);
90 169
91extern void memblock_dump_all(void); 170static inline void memblock_dump_all(void)
92 171{
93/* Provided by the architecture */ 172 if (memblock_debug)
94extern phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid); 173 __memblock_dump_all();
95extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1, 174}
96 phys_addr_t addr2, phys_addr_t size2);
97 175
98/** 176/**
99 * memblock_set_current_limit - Set the current allocation limit to allow 177 * memblock_set_current_limit - Set the current allocation limit to allow
@@ -101,7 +179,7 @@ extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
101 * accessible during boot 179 * accessible during boot
102 * @limit: New limit value (physical address) 180 * @limit: New limit value (physical address)
103 */ 181 */
104extern void memblock_set_current_limit(phys_addr_t limit); 182void memblock_set_current_limit(phys_addr_t limit);
105 183
106 184
107/* 185/*
@@ -154,9 +232,9 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
154 region++) 232 region++)
155 233
156 234
157#ifdef ARCH_DISCARD_MEMBLOCK 235#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
158#define __init_memblock __init 236#define __init_memblock __meminit
159#define __initdata_memblock __initdata 237#define __initdata_memblock __meminitdata
160#else 238#else
161#define __init_memblock 239#define __init_memblock
162#define __initdata_memblock 240#define __initdata_memblock
@@ -165,7 +243,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
165#else 243#else
166static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align) 244static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
167{ 245{
168 return MEMBLOCK_ERROR; 246 return 0;
169} 247}
170 248
171#endif /* CONFIG_HAVE_MEMBLOCK */ 249#endif /* CONFIG_HAVE_MEMBLOCK */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b87068a1a09e..4d34356fe644 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -32,13 +32,11 @@ enum mem_cgroup_page_stat_item {
32 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ 32 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */
33}; 33};
34 34
35extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 35struct mem_cgroup_reclaim_cookie {
36 struct list_head *dst, 36 struct zone *zone;
37 unsigned long *scanned, int order, 37 int priority;
38 isolate_mode_t mode, 38 unsigned int generation;
39 struct zone *z, 39};
40 struct mem_cgroup *mem_cont,
41 int active, int file);
42 40
43#ifdef CONFIG_CGROUP_MEM_RES_CTLR 41#ifdef CONFIG_CGROUP_MEM_RES_CTLR
44/* 42/*
@@ -56,20 +54,21 @@ extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm,
56 gfp_t gfp_mask); 54 gfp_t gfp_mask);
57/* for swap handling */ 55/* for swap handling */
58extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 56extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
59 struct page *page, gfp_t mask, struct mem_cgroup **ptr); 57 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
60extern void mem_cgroup_commit_charge_swapin(struct page *page, 58extern void mem_cgroup_commit_charge_swapin(struct page *page,
61 struct mem_cgroup *ptr); 59 struct mem_cgroup *memcg);
62extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr); 60extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
63 61
64extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 62extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
65 gfp_t gfp_mask); 63 gfp_t gfp_mask);
66extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); 64
67extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); 65struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
68extern void mem_cgroup_rotate_reclaimable_page(struct page *page); 66struct lruvec *mem_cgroup_lru_add_list(struct zone *, struct page *,
69extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); 67 enum lru_list);
70extern void mem_cgroup_del_lru(struct page *page); 68void mem_cgroup_lru_del_list(struct page *, enum lru_list);
71extern void mem_cgroup_move_lists(struct page *page, 69void mem_cgroup_lru_del(struct page *);
72 enum lru_list from, enum lru_list to); 70struct lruvec *mem_cgroup_lru_move_lists(struct zone *, struct page *,
71 enum lru_list, enum lru_list);
73 72
74/* For coalescing uncharge for reducing memcg' overhead*/ 73/* For coalescing uncharge for reducing memcg' overhead*/
75extern void mem_cgroup_uncharge_start(void); 74extern void mem_cgroup_uncharge_start(void);
@@ -85,6 +84,9 @@ extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
85extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 84extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
86extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 85extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
87 86
87extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
88extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
89
88static inline 90static inline
89int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 91int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
90{ 92{
@@ -99,10 +101,15 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
99 101
100extern int 102extern int
101mem_cgroup_prepare_migration(struct page *page, 103mem_cgroup_prepare_migration(struct page *page,
102 struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask); 104 struct page *newpage, struct mem_cgroup **memcgp, gfp_t gfp_mask);
103extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, 105extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
104 struct page *oldpage, struct page *newpage, bool migration_ok); 106 struct page *oldpage, struct page *newpage, bool migration_ok);
105 107
108struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
109 struct mem_cgroup *,
110 struct mem_cgroup_reclaim_cookie *);
111void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
112
106/* 113/*
107 * For memory reclaim. 114 * For memory reclaim.
108 */ 115 */
@@ -119,7 +126,10 @@ struct zone_reclaim_stat*
119mem_cgroup_get_reclaim_stat_from_page(struct page *page); 126mem_cgroup_get_reclaim_stat_from_page(struct page *page);
120extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 127extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
121 struct task_struct *p); 128 struct task_struct *p);
129extern void mem_cgroup_replace_page_cache(struct page *oldpage,
130 struct page *newpage);
122 131
132extern void mem_cgroup_reset_owner(struct page *page);
123#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 133#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
124extern int do_swap_account; 134extern int do_swap_account;
125#endif 135#endif
@@ -154,7 +164,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg);
154 164
155void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); 165void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
156#ifdef CONFIG_TRANSPARENT_HUGEPAGE 166#ifdef CONFIG_TRANSPARENT_HUGEPAGE
157void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); 167void mem_cgroup_split_huge_fixup(struct page *head);
158#endif 168#endif
159 169
160#ifdef CONFIG_DEBUG_VM 170#ifdef CONFIG_DEBUG_VM
@@ -177,17 +187,17 @@ static inline int mem_cgroup_cache_charge(struct page *page,
177} 187}
178 188
179static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 189static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
180 struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr) 190 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp)
181{ 191{
182 return 0; 192 return 0;
183} 193}
184 194
185static inline void mem_cgroup_commit_charge_swapin(struct page *page, 195static inline void mem_cgroup_commit_charge_swapin(struct page *page,
186 struct mem_cgroup *ptr) 196 struct mem_cgroup *memcg)
187{ 197{
188} 198}
189 199
190static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr) 200static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
191{ 201{
192} 202}
193 203
@@ -207,33 +217,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
207{ 217{
208} 218}
209 219
210static inline void mem_cgroup_add_lru_list(struct page *page, int lru) 220static inline struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,
221 struct mem_cgroup *memcg)
211{ 222{
223 return &zone->lruvec;
212} 224}
213 225
214static inline void mem_cgroup_del_lru_list(struct page *page, int lru) 226static inline struct lruvec *mem_cgroup_lru_add_list(struct zone *zone,
227 struct page *page,
228 enum lru_list lru)
215{ 229{
216 return ; 230 return &zone->lruvec;
217} 231}
218 232
219static inline void mem_cgroup_rotate_reclaimable_page(struct page *page) 233static inline void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
220{ 234{
221 return ;
222} 235}
223 236
224static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) 237static inline void mem_cgroup_lru_del(struct page *page)
225{ 238{
226 return ;
227} 239}
228 240
229static inline void mem_cgroup_del_lru(struct page *page) 241static inline struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone,
230{ 242 struct page *page,
231 return ; 243 enum lru_list from,
232} 244 enum lru_list to)
233
234static inline void
235mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to)
236{ 245{
246 return &zone->lruvec;
237} 247}
238 248
239static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) 249static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
@@ -266,7 +276,7 @@ static inline struct cgroup_subsys_state
266 276
267static inline int 277static inline int
268mem_cgroup_prepare_migration(struct page *page, struct page *newpage, 278mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
269 struct mem_cgroup **ptr, gfp_t gfp_mask) 279 struct mem_cgroup **memcgp, gfp_t gfp_mask)
270{ 280{
271 return 0; 281 return 0;
272} 282}
@@ -276,6 +286,19 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
276{ 286{
277} 287}
278 288
289static inline struct mem_cgroup *
290mem_cgroup_iter(struct mem_cgroup *root,
291 struct mem_cgroup *prev,
292 struct mem_cgroup_reclaim_cookie *reclaim)
293{
294 return NULL;
295}
296
297static inline void mem_cgroup_iter_break(struct mem_cgroup *root,
298 struct mem_cgroup *prev)
299{
300}
301
279static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) 302static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg)
280{ 303{
281 return 0; 304 return 0;
@@ -357,8 +380,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
357 return 0; 380 return 0;
358} 381}
359 382
360static inline void mem_cgroup_split_huge_fixup(struct page *head, 383static inline void mem_cgroup_split_huge_fixup(struct page *head)
361 struct page *tail)
362{ 384{
363} 385}
364 386
@@ -366,6 +388,14 @@ static inline
366void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 388void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
367{ 389{
368} 390}
391static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
392 struct page *newpage)
393{
394}
395
396static inline void mem_cgroup_reset_owner(struct page *page)
397{
398}
369#endif /* CONFIG_CGROUP_MEM_CONT */ 399#endif /* CONFIG_CGROUP_MEM_CONT */
370 400
371#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) 401#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
@@ -381,5 +411,23 @@ mem_cgroup_print_bad_page(struct page *page)
381} 411}
382#endif 412#endif
383 413
414enum {
415 UNDER_LIMIT,
416 SOFT_LIMIT,
417 OVER_LIMIT,
418};
419
420struct sock;
421#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
422void sock_update_memcg(struct sock *sk);
423void sock_release_memcg(struct sock *sk);
424#else
425static inline void sock_update_memcg(struct sock *sk)
426{
427}
428static inline void sock_release_memcg(struct sock *sk)
429{
430}
431#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
384#endif /* _LINUX_MEMCONTROL_H */ 432#endif /* _LINUX_MEMCONTROL_H */
385 433
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 935699b30b7c..1ac7f6e405f9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -15,7 +15,6 @@
15#ifndef _LINUX_MEMORY_H_ 15#ifndef _LINUX_MEMORY_H_
16#define _LINUX_MEMORY_H_ 16#define _LINUX_MEMORY_H_
17 17
18#include <linux/sysdev.h>
19#include <linux/node.h> 18#include <linux/node.h>
20#include <linux/compiler.h> 19#include <linux/compiler.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
@@ -38,7 +37,7 @@ struct memory_block {
38 int phys_device; /* to which fru does this belong? */ 37 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 38 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 39 int (*phys_callback)(struct memory_block *);
41 struct sys_device sysdev; 40 struct device dev;
42}; 41};
43 42
44int arch_get_memory_phys_device(unsigned long start_pfn); 43int arch_get_memory_phys_device(unsigned long start_pfn);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 7978eec1b7d9..7c727a90d70d 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -164,11 +164,11 @@ static inline void mpol_get(struct mempolicy *pol)
164 atomic_inc(&pol->refcnt); 164 atomic_inc(&pol->refcnt);
165} 165}
166 166
167extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b); 167extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b);
168static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) 168static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
169{ 169{
170 if (a == b) 170 if (a == b)
171 return 1; 171 return true;
172 return __mpol_equal(a, b); 172 return __mpol_equal(a, b);
173} 173}
174 174
@@ -257,9 +257,9 @@ static inline int vma_migratable(struct vm_area_struct *vma)
257 257
258struct mempolicy {}; 258struct mempolicy {};
259 259
260static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) 260static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
261{ 261{
262 return 1; 262 return true;
263} 263}
264 264
265static inline void mpol_put(struct mempolicy *p) 265static inline void mpol_put(struct mempolicy *p)
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 63b4fb8e3b6f..92be3476c9f5 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -297,10 +297,11 @@ enum {
297 297
298struct pm860x_chip { 298struct pm860x_chip {
299 struct device *dev; 299 struct device *dev;
300 struct mutex io_lock;
301 struct mutex irq_lock; 300 struct mutex irq_lock;
302 struct i2c_client *client; 301 struct i2c_client *client;
303 struct i2c_client *companion; /* companion chip client */ 302 struct i2c_client *companion; /* companion chip client */
303 struct regmap *regmap;
304 struct regmap *regmap_companion;
304 305
305 int buck3_double; /* DVC ramp slope double */ 306 int buck3_double; /* DVC ramp slope double */
306 unsigned short companion_addr; 307 unsigned short companion_addr;
diff --git a/include/linux/mfd/ab5500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
index a720051ae933..a720051ae933 100644
--- a/include/linux/mfd/ab5500/ab5500.h
+++ b/include/linux/mfd/abx500/ab5500.h
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h
index 252966769d93..252966769d93 100644
--- a/include/linux/mfd/ab8500/gpadc.h
+++ b/include/linux/mfd/abx500/ab8500-gpadc.h
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 488a8c920a29..488a8c920a29 100644
--- a/include/linux/mfd/ab8500/gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10da0291f8f8..10da0291f8f8 100644
--- a/include/linux/mfd/ab8500/sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 838c6b487cc5..838c6b487cc5 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
new file mode 100644
index 000000000000..5702d1be13b4
--- /dev/null
+++ b/include/linux/mfd/da9052/da9052.h
@@ -0,0 +1,131 @@
1/*
2 * da9052 declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_DA9052_H
25#define __MFD_DA9052_DA9052_H
26
27#include <linux/interrupt.h>
28#include <linux/regmap.h>
29#include <linux/slab.h>
30#include <linux/completion.h>
31#include <linux/list.h>
32#include <linux/mfd/core.h>
33
34#include <linux/mfd/da9052/reg.h>
35
36#define DA9052_IRQ_DCIN 0
37#define DA9052_IRQ_VBUS 1
38#define DA9052_IRQ_DCINREM 2
39#define DA9052_IRQ_VBUSREM 3
40#define DA9052_IRQ_VDDLOW 4
41#define DA9052_IRQ_ALARM 5
42#define DA9052_IRQ_SEQRDY 6
43#define DA9052_IRQ_COMP1V2 7
44#define DA9052_IRQ_NONKEY 8
45#define DA9052_IRQ_IDFLOAT 9
46#define DA9052_IRQ_IDGND 10
47#define DA9052_IRQ_CHGEND 11
48#define DA9052_IRQ_TBAT 12
49#define DA9052_IRQ_ADC_EOM 13
50#define DA9052_IRQ_PENDOWN 14
51#define DA9052_IRQ_TSIREADY 15
52#define DA9052_IRQ_GPI0 16
53#define DA9052_IRQ_GPI1 17
54#define DA9052_IRQ_GPI2 18
55#define DA9052_IRQ_GPI3 19
56#define DA9052_IRQ_GPI4 20
57#define DA9052_IRQ_GPI5 21
58#define DA9052_IRQ_GPI6 22
59#define DA9052_IRQ_GPI7 23
60#define DA9052_IRQ_GPI8 24
61#define DA9052_IRQ_GPI9 25
62#define DA9052_IRQ_GPI10 26
63#define DA9052_IRQ_GPI11 27
64#define DA9052_IRQ_GPI12 28
65#define DA9052_IRQ_GPI13 29
66#define DA9052_IRQ_GPI14 30
67#define DA9052_IRQ_GPI15 31
68
69enum da9052_chip_id {
70 DA9052,
71 DA9053_AA,
72 DA9053_BA,
73 DA9053_BB,
74};
75
76struct da9052_pdata;
77
78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev;
82 struct regmap *regmap;
83
84 int irq_base;
85 u8 chip_id;
86
87 int chip_irq;
88};
89
90/* Device I/O API */
91static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
92{
93 int val, ret;
94
95 ret = regmap_read(da9052->regmap, reg, &val);
96 if (ret < 0)
97 return ret;
98 return val;
99}
100
101static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
102 unsigned char val)
103{
104 return regmap_write(da9052->regmap, reg, val);
105}
106
107static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
108 unsigned reg_cnt, unsigned char *val)
109{
110 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
111}
112
113static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
114 unsigned reg_cnt, unsigned char *val)
115{
116 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
117}
118
119static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
120 unsigned char bit_mask,
121 unsigned char reg_val)
122{
123 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
124}
125
126int da9052_device_init(struct da9052 *da9052, u8 chip_id);
127void da9052_device_exit(struct da9052 *da9052);
128
129extern struct regmap_config da9052_regmap_config;
130
131#endif /* __MFD_DA9052_DA9052_H */
diff --git a/include/linux/mfd/da9052/pdata.h b/include/linux/mfd/da9052/pdata.h
new file mode 100644
index 000000000000..62c5c3c2992e
--- /dev/null
+++ b/include/linux/mfd/da9052/pdata.h
@@ -0,0 +1,40 @@
1/*
2 * Platform data declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_PDATA_H__
25#define __MFD_DA9052_PDATA_H__
26
27#define DA9052_MAX_REGULATORS 14
28
29struct da9052;
30
31struct da9052_pdata {
32 struct led_platform_data *pled;
33 int (*init) (struct da9052 *da9052);
34 int irq_base;
35 int gpio_base;
36 int use_for_apm;
37 struct regulator_init_data *regulators[DA9052_MAX_REGULATORS];
38};
39
40#endif
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
new file mode 100644
index 000000000000..b97f7309d7f6
--- /dev/null
+++ b/include/linux/mfd/da9052/reg.h
@@ -0,0 +1,749 @@
1/*
2 * Register declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __LINUX_MFD_DA9052_REG_H
25#define __LINUX_MFD_DA9052_REG_H
26
27/* PAGE REGISTERS */
28#define DA9052_PAGE0_CON_REG 0
29#define DA9052_PAGE1_CON_REG 128
30
31/* STATUS REGISTERS */
32#define DA9052_STATUS_A_REG 1
33#define DA9052_STATUS_B_REG 2
34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4
36
37/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6
40#define DA9052_EVENT_C_REG 7
41#define DA9052_EVENT_D_REG 8
42#define DA9052_FAULTLOG_REG 9
43
44/* IRQ REGISTERS */
45#define DA9052_IRQ_MASK_A_REG 10
46#define DA9052_IRQ_MASK_B_REG 11
47#define DA9052_IRQ_MASK_C_REG 12
48#define DA9052_IRQ_MASK_D_REG 13
49
50/* CONTROL REGISTERS */
51#define DA9052_CONTROL_A_REG 14
52#define DA9052_CONTROL_B_REG 15
53#define DA9052_CONTROL_C_REG 16
54#define DA9052_CONTROL_D_REG 17
55
56#define DA9052_PDDIS_REG 18
57#define DA9052_INTERFACE_REG 19
58#define DA9052_RESET_REG 20
59
60/* GPIO REGISTERS */
61#define DA9052_GPIO_0_1_REG 21
62#define DA9052_GPIO_2_3_REG 22
63#define DA9052_GPIO_4_5_REG 23
64#define DA9052_GPIO_6_7_REG 24
65#define DA9052_GPIO_14_15_REG 28
66
67/* POWER SEQUENCER CONTROL REGISTERS */
68#define DA9052_ID_0_1_REG 29
69#define DA9052_ID_2_3_REG 30
70#define DA9052_ID_4_5_REG 31
71#define DA9052_ID_6_7_REG 32
72#define DA9052_ID_8_9_REG 33
73#define DA9052_ID_10_11_REG 34
74#define DA9052_ID_12_13_REG 35
75#define DA9052_ID_14_15_REG 36
76#define DA9052_ID_16_17_REG 37
77#define DA9052_ID_18_19_REG 38
78#define DA9052_ID_20_21_REG 39
79#define DA9052_SEQ_STATUS_REG 40
80#define DA9052_SEQ_A_REG 41
81#define DA9052_SEQ_B_REG 42
82#define DA9052_SEQ_TIMER_REG 43
83
84/* LDO AND BUCK REGISTERS */
85#define DA9052_BUCKA_REG 44
86#define DA9052_BUCKB_REG 45
87#define DA9052_BUCKCORE_REG 46
88#define DA9052_BUCKPRO_REG 47
89#define DA9052_BUCKMEM_REG 48
90#define DA9052_BUCKPERI_REG 49
91#define DA9052_LDO1_REG 50
92#define DA9052_LDO2_REG 51
93#define DA9052_LDO3_REG 52
94#define DA9052_LDO4_REG 53
95#define DA9052_LDO5_REG 54
96#define DA9052_LDO6_REG 55
97#define DA9052_LDO7_REG 56
98#define DA9052_LDO8_REG 57
99#define DA9052_LDO9_REG 58
100#define DA9052_LDO10_REG 59
101#define DA9052_SUPPLY_REG 60
102#define DA9052_PULLDOWN_REG 61
103#define DA9052_CHGBUCK_REG 62
104#define DA9052_WAITCONT_REG 63
105#define DA9052_ISET_REG 64
106#define DA9052_BATCHG_REG 65
107
108/* BATTERY CONTROL REGISTRS */
109#define DA9052_CHG_CONT_REG 66
110#define DA9052_INPUT_CONT_REG 67
111#define DA9052_CHG_TIME_REG 68
112#define DA9052_BBAT_CONT_REG 69
113
114/* LED CONTROL REGISTERS */
115#define DA9052_BOOST_REG 70
116#define DA9052_LED_CONT_REG 71
117#define DA9052_LEDMIN123_REG 72
118#define DA9052_LED1_CONF_REG 73
119#define DA9052_LED2_CONF_REG 74
120#define DA9052_LED3_CONF_REG 75
121#define DA9052_LED1CONT_REG 76
122#define DA9052_LED2CONT_REG 77
123#define DA9052_LED3CONT_REG 78
124#define DA9052_LED_CONT_4_REG 79
125#define DA9052_LED_CONT_5_REG 80
126
127/* ADC CONTROL REGISTERS */
128#define DA9052_ADC_MAN_REG 81
129#define DA9052_ADC_CONT_REG 82
130#define DA9052_ADC_RES_L_REG 83
131#define DA9052_ADC_RES_H_REG 84
132#define DA9052_VDD_RES_REG 85
133#define DA9052_VDD_MON_REG 86
134
135#define DA9052_ICHG_AV_REG 87
136#define DA9052_ICHG_THD_REG 88
137#define DA9052_ICHG_END_REG 89
138#define DA9052_TBAT_RES_REG 90
139#define DA9052_TBAT_HIGHP_REG 91
140#define DA9052_TBAT_HIGHN_REG 92
141#define DA9052_TBAT_LOW_REG 93
142#define DA9052_T_OFFSET_REG 94
143
144#define DA9052_ADCIN4_RES_REG 95
145#define DA9052_AUTO4_HIGH_REG 96
146#define DA9052_AUTO4_LOW_REG 97
147#define DA9052_ADCIN5_RES_REG 98
148#define DA9052_AUTO5_HIGH_REG 99
149#define DA9052_AUTO5_LOW_REG 100
150#define DA9052_ADCIN6_RES_REG 101
151#define DA9052_AUTO6_HIGH_REG 102
152#define DA9052_AUTO6_LOW_REG 103
153
154#define DA9052_TJUNC_RES_REG 104
155
156/* TSI CONTROL REGISTERS */
157#define DA9052_TSI_CONT_A_REG 105
158#define DA9052_TSI_CONT_B_REG 106
159#define DA9052_TSI_X_MSB_REG 107
160#define DA9052_TSI_Y_MSB_REG 108
161#define DA9052_TSI_LSB_REG 109
162#define DA9052_TSI_Z_MSB_REG 110
163
164/* RTC COUNT REGISTERS */
165#define DA9052_COUNT_S_REG 111
166#define DA9052_COUNT_MI_REG 112
167#define DA9052_COUNT_H_REG 113
168#define DA9052_COUNT_D_REG 114
169#define DA9052_COUNT_MO_REG 115
170#define DA9052_COUNT_Y_REG 116
171
172/* RTC CONTROL REGISTERS */
173#define DA9052_ALARM_MI_REG 117
174#define DA9052_ALARM_H_REG 118
175#define DA9052_ALARM_D_REG 119
176#define DA9052_ALARM_MO_REG 120
177#define DA9052_ALARM_Y_REG 121
178#define DA9052_SECOND_A_REG 122
179#define DA9052_SECOND_B_REG 123
180#define DA9052_SECOND_C_REG 124
181#define DA9052_SECOND_D_REG 125
182
183/* PAGE CONFIGURATION BIT */
184#define DA9052_PAGE_CONF 0X80
185
186/* STATUS REGISTER A BITS */
187#define DA9052_STATUSA_VDATDET 0X80
188#define DA9052_STATUSA_VBUSSEL 0X40
189#define DA9052_STATUSA_DCINSEL 0X20
190#define DA9052_STATUSA_VBUSDET 0X10
191#define DA9052_STATUSA_DCINDET 0X08
192#define DA9052_STATUSA_IDGND 0X04
193#define DA9052_STATUSA_IDFLOAT 0X02
194#define DA9052_STATUSA_NONKEY 0X01
195
196/* STATUS REGISTER B BITS */
197#define DA9052_STATUSB_COMPDET 0X80
198#define DA9052_STATUSB_SEQUENCING 0X40
199#define DA9052_STATUSB_GPFB2 0X20
200#define DA9052_STATUSB_CHGTO 0X10
201#define DA9052_STATUSB_CHGEND 0X08
202#define DA9052_STATUSB_CHGLIM 0X04
203#define DA9052_STATUSB_CHGPRE 0X02
204#define DA9052_STATUSB_CHGATT 0X01
205
206/* STATUS REGISTER C BITS */
207#define DA9052_STATUSC_GPI7 0X80
208#define DA9052_STATUSC_GPI6 0X40
209#define DA9052_STATUSC_GPI5 0X20
210#define DA9052_STATUSC_GPI4 0X10
211#define DA9052_STATUSC_GPI3 0X08
212#define DA9052_STATUSC_GPI2 0X04
213#define DA9052_STATUSC_GPI1 0X02
214#define DA9052_STATUSC_GPI0 0X01
215
216/* STATUS REGISTER D BITS */
217#define DA9052_STATUSD_GPI15 0X80
218#define DA9052_STATUSD_GPI14 0X40
219#define DA9052_STATUSD_GPI13 0X20
220#define DA9052_STATUSD_GPI12 0X10
221#define DA9052_STATUSD_GPI11 0X08
222#define DA9052_STATUSD_GPI10 0X04
223#define DA9052_STATUSD_GPI9 0X02
224#define DA9052_STATUSD_GPI8 0X01
225
226/* EVENT REGISTER A BITS */
227#define DA9052_EVENTA_ECOMP1V2 0X80
228#define DA9052_EVENTA_ESEQRDY 0X40
229#define DA9052_EVENTA_EALRAM 0X20
230#define DA9052_EVENTA_EVDDLOW 0X10
231#define DA9052_EVENTA_EVBUSREM 0X08
232#define DA9052_EVENTA_EDCINREM 0X04
233#define DA9052_EVENTA_EVBUSDET 0X02
234#define DA9052_EVENTA_EDCINDET 0X01
235
236/* EVENT REGISTER B BITS */
237#define DA9052_EVENTB_ETSIREADY 0X80
238#define DA9052_EVENTB_EPENDOWN 0X40
239#define DA9052_EVENTB_EADCEOM 0X20
240#define DA9052_EVENTB_ETBAT 0X10
241#define DA9052_EVENTB_ECHGEND 0X08
242#define DA9052_EVENTB_EIDGND 0X04
243#define DA9052_EVENTB_EIDFLOAT 0X02
244#define DA9052_EVENTB_ENONKEY 0X01
245
246/* EVENT REGISTER C BITS */
247#define DA9052_EVENTC_EGPI7 0X80
248#define DA9052_EVENTC_EGPI6 0X40
249#define DA9052_EVENTC_EGPI5 0X20
250#define DA9052_EVENTC_EGPI4 0X10
251#define DA9052_EVENTC_EGPI3 0X08
252#define DA9052_EVENTC_EGPI2 0X04
253#define DA9052_EVENTC_EGPI1 0X02
254#define DA9052_EVENTC_EGPI0 0X01
255
256/* EVENT REGISTER D BITS */
257#define DA9052_EVENTD_EGPI15 0X80
258#define DA9052_EVENTD_EGPI14 0X40
259#define DA9052_EVENTD_EGPI13 0X20
260#define DA9052_EVENTD_EGPI12 0X10
261#define DA9052_EVENTD_EGPI11 0X08
262#define DA9052_EVENTD_EGPI10 0X04
263#define DA9052_EVENTD_EGPI9 0X02
264#define DA9052_EVENTD_EGPI8 0X01
265
266/* IRQ MASK REGISTERS BITS */
267#define DA9052_M_NONKEY 0X0100
268
269/* TSI EVENT REGISTERS BITS */
270#define DA9052_E_PEN_DOWN 0X4000
271#define DA9052_E_TSI_READY 0X8000
272
273/* FAULT LOG REGISTER BITS */
274#define DA9052_FAULTLOG_WAITSET 0X80
275#define DA9052_FAULTLOG_NSDSET 0X40
276#define DA9052_FAULTLOG_KEYSHUT 0X20
277#define DA9052_FAULTLOG_TEMPOVER 0X08
278#define DA9052_FAULTLOG_VDDSTART 0X04
279#define DA9052_FAULTLOG_VDDFAULT 0X02
280#define DA9052_FAULTLOG_TWDERROR 0X01
281
282/* CONTROL REGISTER A BITS */
283#define DA9052_CONTROLA_GPIV 0X80
284#define DA9052_CONTROLA_PMOTYPE 0X20
285#define DA9052_CONTROLA_PMOV 0X10
286#define DA9052_CONTROLA_PMIV 0X08
287#define DA9052_CONTROLA_PMIFV 0X08
288#define DA9052_CONTROLA_PWR1EN 0X04
289#define DA9052_CONTROLA_PWREN 0X02
290#define DA9052_CONTROLA_SYSEN 0X01
291
292/* CONTROL REGISTER B BITS */
293#define DA9052_CONTROLB_SHUTDOWN 0X80
294#define DA9052_CONTROLB_DEEPSLEEP 0X40
295#define DA9052_CONTROL_B_WRITEMODE 0X20
296#define DA9052_CONTROLB_BBATEN 0X10
297#define DA9052_CONTROLB_OTPREADEN 0X08
298#define DA9052_CONTROLB_AUTOBOOT 0X04
299#define DA9052_CONTROLB_ACTDIODE 0X02
300#define DA9052_CONTROLB_BUCKMERGE 0X01
301
302/* CONTROL REGISTER C BITS */
303#define DA9052_CONTROLC_BLINKDUR 0X80
304#define DA9052_CONTROLC_BLINKFRQ 0X60
305#define DA9052_CONTROLC_DEBOUNCING 0X1C
306#define DA9052_CONTROLC_PMFB2PIN 0X02
307#define DA9052_CONTROLC_PMFB1PIN 0X01
308
309/* CONTROL REGISTER D BITS */
310#define DA9052_CONTROLD_WATCHDOG 0X80
311#define DA9052_CONTROLD_ACCDETEN 0X40
312#define DA9052_CONTROLD_GPI1415SD 0X20
313#define DA9052_CONTROLD_NONKEYSD 0X10
314#define DA9052_CONTROLD_KEEPACTEN 0X08
315#define DA9052_CONTROLD_TWDSCALE 0X07
316
317/* POWER DOWN DISABLE REGISTER BITS */
318#define DA9052_PDDIS_PMCONTPD 0X80
319#define DA9052_PDDIS_OUT32KPD 0X40
320#define DA9052_PDDIS_CHGBBATPD 0X20
321#define DA9052_PDDIS_CHGPD 0X10
322#define DA9052_PDDIS_HS2WIREPD 0X08
323#define DA9052_PDDIS_PMIFPD 0X04
324#define DA9052_PDDIS_GPADCPD 0X02
325#define DA9052_PDDIS_GPIOPD 0X01
326
327/* CONTROL REGISTER D BITS */
328#define DA9052_INTERFACE_IFBASEADDR 0XE0
329#define DA9052_INTERFACE_NCSPOL 0X10
330#define DA9052_INTERFACE_RWPOL 0X08
331#define DA9052_INTERFACE_CPHA 0X04
332#define DA9052_INTERFACE_CPOL 0X02
333#define DA9052_INTERFACE_IFTYPE 0X01
334
335/* CONTROL REGISTER D BITS */
336#define DA9052_RESET_RESETEVENT 0XC0
337#define DA9052_RESET_RESETTIMER 0X3F
338
339/* GPIO REGISTERS */
340/* GPIO CONTROL REGISTER BITS */
341#define DA9052_GPIO_EVEN_PORT_PIN 0X03
342#define DA9052_GPIO_EVEN_PORT_TYPE 0X04
343#define DA9052_GPIO_EVEN_PORT_MODE 0X08
344
345#define DA9052_GPIO_ODD_PORT_PIN 0X30
346#define DA9052_GPIO_ODD_PORT_TYPE 0X40
347#define DA9052_GPIO_ODD_PORT_MODE 0X80
348
349/*POWER SEQUENCER REGISTER BITS */
350/* SEQ CONTROL REGISTER BITS FOR ID 0 AND 1 */
351#define DA9052_ID01_LDO1STEP 0XF0
352#define DA9052_ID01_SYSPRE 0X04
353#define DA9052_ID01_DEFSUPPLY 0X02
354#define DA9052_ID01_NRESMODE 0X01
355
356/* SEQ CONTROL REGISTER BITS FOR ID 2 AND 3 */
357#define DA9052_ID23_LDO3STEP 0XF0
358#define DA9052_ID23_LDO2STEP 0X0F
359
360/* SEQ CONTROL REGISTER BITS FOR ID 4 AND 5 */
361#define DA9052_ID45_LDO5STEP 0XF0
362#define DA9052_ID45_LDO4STEP 0X0F
363
364/* SEQ CONTROL REGISTER BITS FOR ID 6 AND 7 */
365#define DA9052_ID67_LDO7STEP 0XF0
366#define DA9052_ID67_LDO6STEP 0X0F
367
368/* SEQ CONTROL REGISTER BITS FOR ID 8 AND 9 */
369#define DA9052_ID89_LDO9STEP 0XF0
370#define DA9052_ID89_LDO8STEP 0X0F
371
372/* SEQ CONTROL REGISTER BITS FOR ID 10 AND 11 */
373#define DA9052_ID1011_PDDISSTEP 0XF0
374#define DA9052_ID1011_LDO10STEP 0X0F
375
376/* SEQ CONTROL REGISTER BITS FOR ID 12 AND 13 */
377#define DA9052_ID1213_VMEMSWSTEP 0XF0
378#define DA9052_ID1213_VPERISWSTEP 0X0F
379
380/* SEQ CONTROL REGISTER BITS FOR ID 14 AND 15 */
381#define DA9052_ID1415_BUCKPROSTEP 0XF0
382#define DA9052_ID1415_BUCKCORESTEP 0X0F
383
384/* SEQ CONTROL REGISTER BITS FOR ID 16 AND 17 */
385#define DA9052_ID1617_BUCKPERISTEP 0XF0
386#define DA9052_ID1617_BUCKMEMSTEP 0X0F
387
388/* SEQ CONTROL REGISTER BITS FOR ID 18 AND 19 */
389#define DA9052_ID1819_GPRISE2STEP 0XF0
390#define DA9052_ID1819_GPRISE1STEP 0X0F
391
392/* SEQ CONTROL REGISTER BITS FOR ID 20 AND 21 */
393#define DA9052_ID2021_GPFALL2STEP 0XF0
394#define DA9052_ID2021_GPFALL1STEP 0X0F
395
396/* POWER SEQ STATUS REGISTER BITS */
397#define DA9052_SEQSTATUS_SEQPOINTER 0XF0
398#define DA9052_SEQSTATUS_WAITSTEP 0X0F
399
400/* POWER SEQ A REGISTER BITS */
401#define DA9052_SEQA_POWEREND 0XF0
402#define DA9052_SEQA_SYSTEMEND 0X0F
403
404/* POWER SEQ B REGISTER BITS */
405#define DA9052_SEQB_PARTDOWN 0XF0
406#define DA9052_SEQB_MAXCOUNT 0X0F
407
408/* POWER SEQ TIMER REGISTER BITS */
409#define DA9052_SEQTIMER_SEQDUMMY 0XF0
410#define DA9052_SEQTIMER_SEQTIME 0X0F
411
412/*POWER SUPPLY CONTROL REGISTER BITS */
413/* BUCK REGISTER A BITS */
414#define DA9052_BUCKA_BPROILIM 0XC0
415#define DA9052_BUCKA_BPROMODE 0X30
416#define DA9052_BUCKA_BCOREILIM 0X0C
417#define DA9052_BUCKA_BCOREMODE 0X03
418
419/* BUCK REGISTER B BITS */
420#define DA9052_BUCKB_BERIILIM 0XC0
421#define DA9052_BUCKB_BPERIMODE 0X30
422#define DA9052_BUCKB_BMEMILIM 0X0C
423#define DA9052_BUCKB_BMEMMODE 0X03
424
425/* BUCKCORE REGISTER BITS */
426#define DA9052_BUCKCORE_BCORECONF 0X80
427#define DA9052_BUCKCORE_BCOREEN 0X40
428#define DA9052_BUCKCORE_VBCORE 0X3F
429
430/* BUCKPRO REGISTER BITS */
431#define DA9052_BUCKPRO_BPROCONF 0X80
432#define DA9052_BUCKPRO_BPROEN 0X40
433#define DA9052_BUCKPRO_VBPRO 0X3F
434
435/* BUCKMEM REGISTER BITS */
436#define DA9052_BUCKMEM_BMEMCONF 0X80
437#define DA9052_BUCKMEM_BMEMEN 0X40
438#define DA9052_BUCKMEM_VBMEM 0X3F
439
440/* BUCKPERI REGISTER BITS */
441#define DA9052_BUCKPERI_BPERICONF 0X80
442#define DA9052_BUCKPERI_BPERIEN 0X40
443#define DA9052_BUCKPERI_BPERIHS 0X20
444#define DA9052_BUCKPERI_VBPERI 0X1F
445
446/* LDO1 REGISTER BITS */
447#define DA9052_LDO1_LDO1CONF 0X80
448#define DA9052_LDO1_LDO1EN 0X40
449#define DA9052_LDO1_VLDO1 0X1F
450
451/* LDO2 REGISTER BITS */
452#define DA9052_LDO2_LDO2CONF 0X80
453#define DA9052_LDO2_LDO2EN 0X40
454#define DA9052_LDO2_VLDO2 0X3F
455
456/* LDO3 REGISTER BITS */
457#define DA9052_LDO3_LDO3CONF 0X80
458#define DA9052_LDO3_LDO3EN 0X40
459#define DA9052_LDO3_VLDO3 0X3F
460
461/* LDO4 REGISTER BITS */
462#define DA9052_LDO4_LDO4CONF 0X80
463#define DA9052_LDO4_LDO4EN 0X40
464#define DA9052_LDO4_VLDO4 0X3F
465
466/* LDO5 REGISTER BITS */
467#define DA9052_LDO5_LDO5CONF 0X80
468#define DA9052_LDO5_LDO5EN 0X40
469#define DA9052_LDO5_VLDO5 0X3F
470
471/* LDO6 REGISTER BITS */
472#define DA9052_LDO6_LDO6CONF 0X80
473#define DA9052_LDO6_LDO6EN 0X40
474#define DA9052_LDO6_VLDO6 0X3F
475
476/* LDO7 REGISTER BITS */
477#define DA9052_LDO7_LDO7CONF 0X80
478#define DA9052_LDO7_LDO7EN 0X40
479#define DA9052_LDO7_VLDO7 0X3F
480
481/* LDO8 REGISTER BITS */
482#define DA9052_LDO8_LDO8CONF 0X80
483#define DA9052_LDO8_LDO8EN 0X40
484#define DA9052_LDO8_VLDO8 0X3F
485
486/* LDO9 REGISTER BITS */
487#define DA9052_LDO9_LDO9CONF 0X80
488#define DA9052_LDO9_LDO9EN 0X40
489#define DA9052_LDO9_VLDO9 0X3F
490
491/* LDO10 REGISTER BITS */
492#define DA9052_LDO10_LDO10CONF 0X80
493#define DA9052_LDO10_LDO10EN 0X40
494#define DA9052_LDO10_VLDO10 0X3F
495
496/* SUPPLY REGISTER BITS */
497#define DA9052_SUPPLY_VLOCK 0X80
498#define DA9052_SUPPLY_VMEMSWEN 0X40
499#define DA9052_SUPPLY_VPERISWEN 0X20
500#define DA9052_SUPPLY_VLDO3GO 0X10
501#define DA9052_SUPPLY_VLDO2GO 0X08
502#define DA9052_SUPPLY_VBMEMGO 0X04
503#define DA9052_SUPPLY_VBPROGO 0X02
504#define DA9052_SUPPLY_VBCOREGO 0X01
505
506/* PULLDOWN REGISTER BITS */
507#define DA9052_PULLDOWN_LDO5PDDIS 0X20
508#define DA9052_PULLDOWN_LDO2PDDIS 0X10
509#define DA9052_PULLDOWN_LDO1PDDIS 0X08
510#define DA9052_PULLDOWN_MEMPDDIS 0X04
511#define DA9052_PULLDOWN_PROPDDIS 0X02
512#define DA9052_PULLDOWN_COREPDDIS 0X01
513
514/* BAT CHARGER REGISTER BITS */
515/* CHARGER BUCK REGISTER BITS */
516#define DA9052_CHGBUCK_CHGTEMP 0X80
517#define DA9052_CHGBUCK_CHGUSBILIM 0X40
518#define DA9052_CHGBUCK_CHGBUCKLP 0X20
519#define DA9052_CHGBUCK_CHGBUCKEN 0X10
520#define DA9052_CHGBUCK_ISETBUCK 0X0F
521
522/* WAIT COUNTER REGISTER BITS */
523#define DA9052_WAITCONT_WAITDIR 0X80
524#define DA9052_WAITCONT_RTCCLOCK 0X40
525#define DA9052_WAITCONT_WAITMODE 0X20
526#define DA9052_WAITCONT_EN32KOUT 0X10
527#define DA9052_WAITCONT_DELAYTIME 0X0F
528
529/* ISET CONTROL REGISTER BITS */
530#define DA9052_ISET_ISETDCIN 0XF0
531#define DA9052_ISET_ISETVBUS 0X0F
532
533/* BATTERY CHARGER CONTROL REGISTER BITS */
534#define DA9052_BATCHG_ICHGPRE 0XC0
535#define DA9052_BATCHG_ICHGBAT 0X3F
536
537/* CHARGER COUNTER REGISTER BITS */
538#define DA9052_CHG_CONT_VCHG_BAT 0XF8
539#define DA9052_CHG_CONT_TCTR 0X07
540
541/* INPUT CONTROL REGISTER BITS */
542#define DA9052_INPUT_CONT_TCTR_MODE 0X80
543#define DA9052_INPUT_CONT_VBUS_SUSP 0X10
544#define DA9052_INPUT_CONT_DCIN_SUSP 0X08
545
546/* CHARGING TIME REGISTER BITS */
547#define DA9052_CHGTIME_CHGTIME 0XFF
548
549/* BACKUP BATTERY CONTROL REGISTER BITS */
550#define DA9052_BBATCONT_BCHARGERISET 0XF0
551#define DA9052_BBATCONT_BCHARGERVSET 0X0F
552
553/* LED REGISTERS BITS */
554/* LED BOOST REGISTER BITS */
555#define DA9052_BOOST_EBFAULT 0X80
556#define DA9052_BOOST_MBFAULT 0X40
557#define DA9052_BOOST_BOOSTFRQ 0X20
558#define DA9052_BOOST_BOOSTILIM 0X10
559#define DA9052_BOOST_LED3INEN 0X08
560#define DA9052_BOOST_LED2INEN 0X04
561#define DA9052_BOOST_LED1INEN 0X02
562#define DA9052_BOOST_BOOSTEN 0X01
563
564/* LED CONTROL REGISTER BITS */
565#define DA9052_LEDCONT_SELLEDMODE 0X80
566#define DA9052_LEDCONT_LED3ICONT 0X40
567#define DA9052_LEDCONT_LED3RAMP 0X20
568#define DA9052_LEDCONT_LED3EN 0X10
569#define DA9052_LEDCONT_LED2RAMP 0X08
570#define DA9052_LEDCONT_LED2EN 0X04
571#define DA9052_LEDCONT_LED1RAMP 0X02
572#define DA9052_LEDCONT_LED1EN 0X01
573
574/* LEDMIN123 REGISTER BIT */
575#define DA9052_LEDMIN123_LEDMINCURRENT 0XFF
576
577/* LED1CONF REGISTER BIT */
578#define DA9052_LED1CONF_LED1CURRENT 0XFF
579
580/* LED2CONF REGISTER BIT */
581#define DA9052_LED2CONF_LED2CURRENT 0XFF
582
583/* LED3CONF REGISTER BIT */
584#define DA9052_LED3CONF_LED3CURRENT 0XFF
585
586/* LED COUNT REGISTER BIT */
587#define DA9052_LED_CONT_DIM 0X80
588
589/* ADC MAN REGISTERS BITS */
590#define DA9052_ADC_MAN_MAN_CONV 0X10
591#define DA9052_ADC_MAN_MUXSEL_VDDOUT 0X00
592#define DA9052_ADC_MAN_MUXSEL_ICH 0X01
593#define DA9052_ADC_MAN_MUXSEL_TBAT 0X02
594#define DA9052_ADC_MAN_MUXSEL_VBAT 0X03
595#define DA9052_ADC_MAN_MUXSEL_AD4 0X04
596#define DA9052_ADC_MAN_MUXSEL_AD5 0X05
597#define DA9052_ADC_MAN_MUXSEL_AD6 0X06
598#define DA9052_ADC_MAN_MUXSEL_VBBAT 0X09
599
600/* ADC CONTROL REGSISTERS BITS */
601#define DA9052_ADCCONT_COMP1V2EN 0X80
602#define DA9052_ADCCONT_ADCMODE 0X40
603#define DA9052_ADCCONT_TBATISRCEN 0X20
604#define DA9052_ADCCONT_AD4ISRCEN 0X10
605#define DA9052_ADCCONT_AUTOAD6EN 0X08
606#define DA9052_ADCCONT_AUTOAD5EN 0X04
607#define DA9052_ADCCONT_AUTOAD4EN 0X02
608#define DA9052_ADCCONT_AUTOVDDEN 0X01
609
610/* ADC 10 BIT MANUAL CONVERSION RESULT LOW REGISTER */
611#define DA9052_ADC_RES_LSB 0X03
612
613/* ADC 10 BIT MANUAL CONVERSION RESULT HIGH REGISTER */
614#define DA9052_ADCRESH_ADCRESMSB 0XFF
615
616/* VDD RES REGSISTER BIT*/
617#define DA9052_VDDRES_VDDOUTRES 0XFF
618
619/* VDD MON REGSISTER BIT */
620#define DA9052_VDDMON_VDDOUTMON 0XFF
621
622/* ICHG_AV REGSISTER BIT */
623#define DA9052_ICHGAV_ICHGAV 0XFF
624
625/* ICHG_THD REGSISTER BIT */
626#define DA9052_ICHGTHD_ICHGTHD 0XFF
627
628/* ICHG_END REGSISTER BIT */
629#define DA9052_ICHGEND_ICHGEND 0XFF
630
631/* TBAT_RES REGSISTER BIT */
632#define DA9052_TBATRES_TBATRES 0XFF
633
634/* TBAT_HIGHP REGSISTER BIT */
635#define DA9052_TBATHIGHP_TBATHIGHP 0XFF
636
637/* TBAT_HIGHN REGSISTER BIT */
638#define DA9052_TBATHIGHN_TBATHIGHN 0XFF
639
640/* TBAT_LOW REGSISTER BIT */
641#define DA9052_TBATLOW_TBATLOW 0XFF
642
643/* T_OFFSET REGSISTER BIT */
644#define DA9052_TOFFSET_TOFFSET 0XFF
645
646/* ADCIN4_RES REGSISTER BIT */
647#define DA9052_ADCIN4RES_ADCIN4RES 0XFF
648
649/* ADCIN4_HIGH REGSISTER BIT */
650#define DA9052_AUTO4HIGH_AUTO4HIGH 0XFF
651
652/* ADCIN4_LOW REGSISTER BIT */
653#define DA9052_AUTO4LOW_AUTO4LOW 0XFF
654
655/* ADCIN5_RES REGSISTER BIT */
656#define DA9052_ADCIN5RES_ADCIN5RES 0XFF
657
658/* ADCIN5_HIGH REGSISTER BIT */
659#define DA9052_AUTO5HIGH_AUTOHIGH 0XFF
660
661/* ADCIN5_LOW REGSISTER BIT */
662#define DA9052_AUTO5LOW_AUTO5LOW 0XFF
663
664/* ADCIN6_RES REGSISTER BIT */
665#define DA9052_ADCIN6RES_ADCIN6RES 0XFF
666
667/* ADCIN6_HIGH REGSISTER BIT */
668#define DA9052_AUTO6HIGH_AUTO6HIGH 0XFF
669
670/* ADCIN6_LOW REGSISTER BIT */
671#define DA9052_AUTO6LOW_AUTO6LOW 0XFF
672
673/* TJUNC_RES REGSISTER BIT*/
674#define DA9052_TJUNCRES_TJUNCRES 0XFF
675
676/* TSI REGISTER */
677/* TSI CONTROL REGISTER A BITS */
678#define DA9052_TSICONTA_TSIDELAY 0XC0
679#define DA9052_TSICONTA_TSISKIP 0X38
680#define DA9052_TSICONTA_TSIMODE 0X04
681#define DA9052_TSICONTA_PENDETEN 0X02
682#define DA9052_TSICONTA_AUTOTSIEN 0X01
683
684/* TSI CONTROL REGISTER B BITS */
685#define DA9052_TSICONTB_ADCREF 0X80
686#define DA9052_TSICONTB_TSIMAN 0X40
687#define DA9052_TSICONTB_TSIMUX 0X30
688#define DA9052_TSICONTB_TSISEL3 0X08
689#define DA9052_TSICONTB_TSISEL2 0X04
690#define DA9052_TSICONTB_TSISEL1 0X02
691#define DA9052_TSICONTB_TSISEL0 0X01
692
693/* TSI X CO-ORDINATE MSB RESULT REGISTER BITS */
694#define DA9052_TSIXMSB_TSIXM 0XFF
695
696/* TSI Y CO-ORDINATE MSB RESULT REGISTER BITS */
697#define DA9052_TSIYMSB_TSIYM 0XFF
698
699/* TSI CO-ORDINATE LSB RESULT REGISTER BITS */
700#define DA9052_TSILSB_PENDOWN 0X40
701#define DA9052_TSILSB_TSIZL 0X30
702#define DA9052_TSILSB_TSIYL 0X0C
703#define DA9052_TSILSB_TSIXL 0X03
704
705/* TSI Z MEASUREMENT MSB RESULT REGISTER BIT */
706#define DA9052_TSIZMSB_TSIZM 0XFF
707
708/* RTC REGISTER */
709/* RTC TIMER SECONDS REGISTER BITS */
710#define DA9052_COUNTS_MONITOR 0X40
711#define DA9052_RTC_SEC 0X3F
712
713/* RTC TIMER MINUTES REGISTER BIT */
714#define DA9052_RTC_MIN 0X3F
715
716/* RTC TIMER HOUR REGISTER BIT */
717#define DA9052_RTC_HOUR 0X1F
718
719/* RTC TIMER DAYS REGISTER BIT */
720#define DA9052_RTC_DAY 0X1F
721
722/* RTC TIMER MONTHS REGISTER BIT */
723#define DA9052_RTC_MONTH 0X0F
724
725/* RTC TIMER YEARS REGISTER BIT */
726#define DA9052_RTC_YEAR 0X3F
727
728/* RTC ALARM MINUTES REGISTER BITS */
729#define DA9052_ALARMM_I_TICK_TYPE 0X80
730#define DA9052_ALARMMI_ALARMTYPE 0X40
731
732/* RTC ALARM YEARS REGISTER BITS */
733#define DA9052_ALARM_Y_TICK_ON 0X80
734#define DA9052_ALARM_Y_ALARM_ON 0X40
735
736/* RTC SECONDS REGISTER A BITS */
737#define DA9052_SECONDA_SECONDSA 0XFF
738
739/* RTC SECONDS REGISTER B BITS */
740#define DA9052_SECONDB_SECONDSB 0XFF
741
742/* RTC SECONDS REGISTER C BITS */
743#define DA9052_SECONDC_SECONDSC 0XFF
744
745/* RTC SECONDS REGISTER D BITS */
746#define DA9052_SECONDD_SECONDSD 0XFF
747
748#endif
749/* __LINUX_MFD_DA9052_REG_H */
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 5259dfe8c585..15b2392a56fb 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -167,9 +167,6 @@ enum {
167 MAX8925_IRQ_VCHG_DC_OVP, 167 MAX8925_IRQ_VCHG_DC_OVP,
168 MAX8925_IRQ_VCHG_DC_F, 168 MAX8925_IRQ_VCHG_DC_F,
169 MAX8925_IRQ_VCHG_DC_R, 169 MAX8925_IRQ_VCHG_DC_R,
170 MAX8925_IRQ_VCHG_USB_OVP,
171 MAX8925_IRQ_VCHG_USB_F,
172 MAX8925_IRQ_VCHG_USB_R,
173 MAX8925_IRQ_VCHG_THM_OK_R, 170 MAX8925_IRQ_VCHG_THM_OK_R,
174 MAX8925_IRQ_VCHG_THM_OK_F, 171 MAX8925_IRQ_VCHG_THM_OK_F,
175 MAX8925_IRQ_VCHG_SYSLOW_F, 172 MAX8925_IRQ_VCHG_SYSLOW_F,
@@ -206,6 +203,8 @@ struct max8925_chip {
206 int irq_base; 203 int irq_base;
207 int core_irq; 204 int core_irq;
208 int tsc_irq; 205 int tsc_irq;
206
207 unsigned int wakeup_flag;
209}; 208};
210 209
211struct max8925_backlight_pdata { 210struct max8925_backlight_pdata {
@@ -223,6 +222,10 @@ struct max8925_power_pdata {
223 unsigned batt_detect:1; 222 unsigned batt_detect:1;
224 unsigned topoff_threshold:2; 223 unsigned topoff_threshold:2;
225 unsigned fast_charge:3; /* charge current */ 224 unsigned fast_charge:3; /* charge current */
225 unsigned no_temp_support:1; /* set if no temperature detect */
226 unsigned no_insert_detect:1; /* set if no ac insert detect */
227 char **supplied_to;
228 int num_supplicants;
226}; 229};
227 230
228/* 231/*
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 0bbd13dbe336..fff590521e50 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -77,6 +77,82 @@ struct max8997_regulator_data {
77 struct regulator_init_data *initdata; 77 struct regulator_init_data *initdata;
78}; 78};
79 79
80enum max8997_muic_usb_type {
81 MAX8997_USB_HOST,
82 MAX8997_USB_DEVICE,
83};
84
85enum max8997_muic_charger_type {
86 MAX8997_CHARGER_TYPE_NONE = 0,
87 MAX8997_CHARGER_TYPE_USB,
88 MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
89 MAX8997_CHARGER_TYPE_DEDICATED_CHG,
90 MAX8997_CHARGER_TYPE_500MA,
91 MAX8997_CHARGER_TYPE_1A,
92 MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
93};
94
95struct max8997_muic_reg_data {
96 u8 addr;
97 u8 data;
98};
99
100/**
101 * struct max8997_muic_platform_data
102 * @usb_callback: callback function for USB
103 * inform callee of USB type (HOST or DEVICE)
104 * and attached state(true or false)
105 * @charger_callback: callback function for charger
106 * inform callee of charger_type
107 * and attached state(true or false)
108 * @deskdock_callback: callback function for desk dock
109 * inform callee of attached state(true or false)
110 * @cardock_callback: callback function for car dock
111 * inform callee of attached state(true or false)
112 * @mhl_callback: callback function for MHL (Mobile High-definition Link)
113 * inform callee of attached state(true or false)
114 * @uart_callback: callback function for JIG UART
115 * inform callee of attached state(true or false)
116 * @init_data: array of max8997_muic_reg_data
117 * used for initializing registers of MAX8997 MUIC device
118 * @num_init_data: array size of init_data
119 */
120struct max8997_muic_platform_data {
121 void (*usb_callback)(enum max8997_muic_usb_type usb_type,
122 bool attached);
123 void (*charger_callback)(bool attached,
124 enum max8997_muic_charger_type charger_type);
125 void (*deskdock_callback) (bool attached);
126 void (*cardock_callback) (bool attached);
127 void (*mhl_callback) (bool attached);
128 void (*uart_callback) (bool attached);
129
130 struct max8997_muic_reg_data *init_data;
131 int num_init_data;
132};
133
134enum max8997_led_mode {
135 MAX8997_NONE,
136 MAX8997_FLASH_MODE,
137 MAX8997_MOVIE_MODE,
138 MAX8997_FLASH_PIN_CONTROL_MODE,
139 MAX8997_MOVIE_PIN_CONTROL_MODE,
140};
141
142/**
143 * struct max8997_led_platform_data
144 * The number of LED devices for MAX8997 is two
145 * @mode: LED mode for each LED device
146 * @brightness: initial brightness for each LED device
147 * range:
148 * [0 - 31]: MAX8997_FLASH_MODE and MAX8997_FLASH_PIN_CONTROL_MODE
149 * [0 - 15]: MAX8997_MOVIE_MODE and MAX8997_MOVIE_PIN_CONTROL_MODE
150 */
151struct max8997_led_platform_data {
152 enum max8997_led_mode mode[2];
153 u8 brightness[2];
154};
155
80struct max8997_platform_data { 156struct max8997_platform_data {
81 /* IRQ */ 157 /* IRQ */
82 int irq_base; 158 int irq_base;
@@ -113,10 +189,13 @@ struct max8997_platform_data {
113 /* charge Full Timeout */ 189 /* charge Full Timeout */
114 int timeout; /* 0 (no timeout), 5, 6, 7 hours */ 190 int timeout; /* 0 (no timeout), 5, 6, 7 hours */
115 191
116 /* MUIC: Not implemented */ 192 /* ---- MUIC ---- */
193 struct max8997_muic_platform_data *muic_pdata;
194
117 /* HAPTIC: Not implemented */ 195 /* HAPTIC: Not implemented */
118 /* RTC: Not implemented */ 196 /* RTC: Not implemented */
119 /* Flash: Not implemented */ 197 /* ---- LED ---- */
198 struct max8997_led_platform_data *led_pdata;
120}; 199};
121 200
122#endif /* __LINUX_MFD_MAX8998_H */ 201#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 3816c2fac0ad..b86ee45c8b03 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -69,6 +69,7 @@ struct regulator_init_data;
69struct mc13xxx_regulator_init_data { 69struct mc13xxx_regulator_init_data {
70 int id; 70 int id;
71 struct regulator_init_data *init_data; 71 struct regulator_init_data *init_data;
72 struct device_node *node;
72}; 73};
73 74
74struct mc13xxx_regulator_platform_data { 75struct mc13xxx_regulator_platform_data {
@@ -173,6 +174,9 @@ struct mc13xxx_platform_data {
173#define MC13XXX_ADC_MODE_MULT_CHAN 3 174#define MC13XXX_ADC_MODE_MULT_CHAN 3
174 175
175#define MC13XXX_ADC0 43 176#define MC13XXX_ADC0 43
177#define MC13XXX_ADC0_LICELLCON (1 << 0)
178#define MC13XXX_ADC0_CHRGICON (1 << 1)
179#define MC13XXX_ADC0_BATICON (1 << 2)
176#define MC13XXX_ADC0_ADREFEN (1 << 10) 180#define MC13XXX_ADC0_ADREFEN (1 << 10)
177#define MC13XXX_ADC0_TSMOD0 (1 << 12) 181#define MC13XXX_ADC0_TSMOD0 (1 << 12)
178#define MC13XXX_ADC0_TSMOD1 (1 << 13) 182#define MC13XXX_ADC0_TSMOD1 (1 << 13)
@@ -184,4 +188,9 @@ struct mc13xxx_platform_data {
184 MC13XXX_ADC0_TSMOD1 | \ 188 MC13XXX_ADC0_TSMOD1 | \
185 MC13XXX_ADC0_TSMOD2) 189 MC13XXX_ADC0_TSMOD2)
186 190
191#define MC13XXX_ADC0_CONFIG_MASK (MC13XXX_ADC0_TSMOD_MASK | \
192 MC13XXX_ADC0_LICELLCON | \
193 MC13XXX_ADC0_CHRGICON | \
194 MC13XXX_ADC0_BATICON)
195
187#endif /* ifndef __LINUX_MFD_MC13XXX_H */ 196#endif /* ifndef __LINUX_MFD_MC13XXX_H */
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index ee496708e38b..1515e64e3663 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,6 +10,7 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <linux/mod_devicetable.h>
13#include <mach/dma.h> 14#include <mach/dma.h>
14 15
15struct mcp_ops; 16struct mcp_ops;
@@ -26,7 +27,7 @@ struct mcp {
26 dma_device_t dma_telco_rd; 27 dma_device_t dma_telco_rd;
27 dma_device_t dma_telco_wr; 28 dma_device_t dma_telco_wr;
28 struct device attached_device; 29 struct device attached_device;
29 int gpio_base; 30 const char *codec;
30}; 31};
31 32
32struct mcp_ops { 33struct mcp_ops {
@@ -44,10 +45,11 @@ void mcp_reg_write(struct mcp *, unsigned int, unsigned int);
44unsigned int mcp_reg_read(struct mcp *, unsigned int); 45unsigned int mcp_reg_read(struct mcp *, unsigned int);
45void mcp_enable(struct mcp *); 46void mcp_enable(struct mcp *);
46void mcp_disable(struct mcp *); 47void mcp_disable(struct mcp *);
48const struct mcp_device_id *mcp_get_device_id(const struct mcp *mcp);
47#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 49#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
48 50
49struct mcp *mcp_host_alloc(struct device *, size_t); 51struct mcp *mcp_host_alloc(struct device *, size_t);
50int mcp_host_register(struct mcp *); 52int mcp_host_register(struct mcp *, void *);
51void mcp_host_unregister(struct mcp *); 53void mcp_host_unregister(struct mcp *);
52 54
53struct mcp_driver { 55struct mcp_driver {
@@ -56,6 +58,7 @@ struct mcp_driver {
56 void (*remove)(struct mcp *); 58 void (*remove)(struct mcp *);
57 int (*suspend)(struct mcp *, pm_message_t); 59 int (*suspend)(struct mcp *, pm_message_t);
58 int (*resume)(struct mcp *); 60 int (*resume)(struct mcp *);
61 const struct mcp_device_id *id_table;
59}; 62};
60 63
61int mcp_driver_register(struct mcp_driver *); 64int mcp_driver_register(struct mcp_driver *);
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
new file mode 100644
index 000000000000..a7480b57f92d
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -0,0 +1,373 @@
1/*
2 * s5m-core.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_S5M_CORE_H
15#define __LINUX_MFD_S5M_CORE_H
16
17#define NUM_IRQ_REGS 4
18
19enum s5m_device_type {
20 S5M8751X,
21 S5M8763X,
22 S5M8767X,
23};
24
25/* S5M8767 registers */
26enum s5m8767_reg {
27 S5M8767_REG_ID,
28 S5M8767_REG_INT1,
29 S5M8767_REG_INT2,
30 S5M8767_REG_INT3,
31 S5M8767_REG_INT1M,
32 S5M8767_REG_INT2M,
33 S5M8767_REG_INT3M,
34 S5M8767_REG_STATUS1,
35 S5M8767_REG_STATUS2,
36 S5M8767_REG_STATUS3,
37 S5M8767_REG_CTRL1,
38 S5M8767_REG_CTRL2,
39 S5M8767_REG_LOWBAT1,
40 S5M8767_REG_LOWBAT2,
41 S5M8767_REG_BUCHG,
42 S5M8767_REG_DVSRAMP,
43 S5M8767_REG_DVSTIMER2 = 0x10,
44 S5M8767_REG_DVSTIMER3,
45 S5M8767_REG_DVSTIMER4,
46 S5M8767_REG_LDO1,
47 S5M8767_REG_LDO2,
48 S5M8767_REG_LDO3,
49 S5M8767_REG_LDO4,
50 S5M8767_REG_LDO5,
51 S5M8767_REG_LDO6,
52 S5M8767_REG_LDO7,
53 S5M8767_REG_LDO8,
54 S5M8767_REG_LDO9,
55 S5M8767_REG_LDO10,
56 S5M8767_REG_LDO11,
57 S5M8767_REG_LDO12,
58 S5M8767_REG_LDO13,
59 S5M8767_REG_LDO14 = 0x20,
60 S5M8767_REG_LDO15,
61 S5M8767_REG_LDO16,
62 S5M8767_REG_LDO17,
63 S5M8767_REG_LDO18,
64 S5M8767_REG_LDO19,
65 S5M8767_REG_LDO20,
66 S5M8767_REG_LDO21,
67 S5M8767_REG_LDO22,
68 S5M8767_REG_LDO23,
69 S5M8767_REG_LDO24,
70 S5M8767_REG_LDO25,
71 S5M8767_REG_LDO26,
72 S5M8767_REG_LDO27,
73 S5M8767_REG_LDO28,
74 S5M8767_REG_UVLO = 0x31,
75 S5M8767_REG_BUCK1CTRL1,
76 S5M8767_REG_BUCK1CTRL2,
77 S5M8767_REG_BUCK2CTRL,
78 S5M8767_REG_BUCK2DVS1,
79 S5M8767_REG_BUCK2DVS2,
80 S5M8767_REG_BUCK2DVS3,
81 S5M8767_REG_BUCK2DVS4,
82 S5M8767_REG_BUCK2DVS5,
83 S5M8767_REG_BUCK2DVS6,
84 S5M8767_REG_BUCK2DVS7,
85 S5M8767_REG_BUCK2DVS8,
86 S5M8767_REG_BUCK3CTRL,
87 S5M8767_REG_BUCK3DVS1,
88 S5M8767_REG_BUCK3DVS2,
89 S5M8767_REG_BUCK3DVS3,
90 S5M8767_REG_BUCK3DVS4,
91 S5M8767_REG_BUCK3DVS5,
92 S5M8767_REG_BUCK3DVS6,
93 S5M8767_REG_BUCK3DVS7,
94 S5M8767_REG_BUCK3DVS8,
95 S5M8767_REG_BUCK4CTRL,
96 S5M8767_REG_BUCK4DVS1,
97 S5M8767_REG_BUCK4DVS2,
98 S5M8767_REG_BUCK4DVS3,
99 S5M8767_REG_BUCK4DVS4,
100 S5M8767_REG_BUCK4DVS5,
101 S5M8767_REG_BUCK4DVS6,
102 S5M8767_REG_BUCK4DVS7,
103 S5M8767_REG_BUCK4DVS8,
104 S5M8767_REG_BUCK5CTRL1,
105 S5M8767_REG_BUCK5CTRL2,
106 S5M8767_REG_BUCK5CTRL3,
107 S5M8767_REG_BUCK5CTRL4,
108 S5M8767_REG_BUCK5CTRL5,
109 S5M8767_REG_BUCK6CTRL1,
110 S5M8767_REG_BUCK6CTRL2,
111 S5M8767_REG_BUCK7CTRL1,
112 S5M8767_REG_BUCK7CTRL2,
113 S5M8767_REG_BUCK8CTRL1,
114 S5M8767_REG_BUCK8CTRL2,
115 S5M8767_REG_BUCK9CTRL1,
116 S5M8767_REG_BUCK9CTRL2,
117 S5M8767_REG_LDO1CTRL,
118 S5M8767_REG_LDO2_1CTRL,
119 S5M8767_REG_LDO2_2CTRL,
120 S5M8767_REG_LDO2_3CTRL,
121 S5M8767_REG_LDO2_4CTRL,
122 S5M8767_REG_LDO3CTRL,
123 S5M8767_REG_LDO4CTRL,
124 S5M8767_REG_LDO5CTRL,
125 S5M8767_REG_LDO6CTRL,
126 S5M8767_REG_LDO7CTRL,
127 S5M8767_REG_LDO8CTRL,
128 S5M8767_REG_LDO9CTRL,
129 S5M8767_REG_LDO10CTRL,
130 S5M8767_REG_LDO11CTRL,
131 S5M8767_REG_LDO12CTRL,
132 S5M8767_REG_LDO13CTRL,
133 S5M8767_REG_LDO14CTRL,
134 S5M8767_REG_LDO15CTRL,
135 S5M8767_REG_LDO16CTRL,
136 S5M8767_REG_LDO17CTRL,
137 S5M8767_REG_LDO18CTRL,
138 S5M8767_REG_LDO19CTRL,
139 S5M8767_REG_LDO20CTRL,
140 S5M8767_REG_LDO21CTRL,
141 S5M8767_REG_LDO22CTRL,
142 S5M8767_REG_LDO23CTRL,
143 S5M8767_REG_LDO24CTRL,
144 S5M8767_REG_LDO25CTRL,
145 S5M8767_REG_LDO26CTRL,
146 S5M8767_REG_LDO27CTRL,
147 S5M8767_REG_LDO28CTRL,
148};
149
150/* S5M8763 registers */
151enum s5m8763_reg {
152 S5M8763_REG_IRQ1,
153 S5M8763_REG_IRQ2,
154 S5M8763_REG_IRQ3,
155 S5M8763_REG_IRQ4,
156 S5M8763_REG_IRQM1,
157 S5M8763_REG_IRQM2,
158 S5M8763_REG_IRQM3,
159 S5M8763_REG_IRQM4,
160 S5M8763_REG_STATUS1,
161 S5M8763_REG_STATUS2,
162 S5M8763_REG_STATUSM1,
163 S5M8763_REG_STATUSM2,
164 S5M8763_REG_CHGR1,
165 S5M8763_REG_CHGR2,
166 S5M8763_REG_LDO_ACTIVE_DISCHARGE1,
167 S5M8763_REG_LDO_ACTIVE_DISCHARGE2,
168 S5M8763_REG_BUCK_ACTIVE_DISCHARGE3,
169 S5M8763_REG_ONOFF1,
170 S5M8763_REG_ONOFF2,
171 S5M8763_REG_ONOFF3,
172 S5M8763_REG_ONOFF4,
173 S5M8763_REG_BUCK1_VOLTAGE1,
174 S5M8763_REG_BUCK1_VOLTAGE2,
175 S5M8763_REG_BUCK1_VOLTAGE3,
176 S5M8763_REG_BUCK1_VOLTAGE4,
177 S5M8763_REG_BUCK2_VOLTAGE1,
178 S5M8763_REG_BUCK2_VOLTAGE2,
179 S5M8763_REG_BUCK3,
180 S5M8763_REG_BUCK4,
181 S5M8763_REG_LDO1_LDO2,
182 S5M8763_REG_LDO3,
183 S5M8763_REG_LDO4,
184 S5M8763_REG_LDO5,
185 S5M8763_REG_LDO6,
186 S5M8763_REG_LDO7,
187 S5M8763_REG_LDO7_LDO8,
188 S5M8763_REG_LDO9_LDO10,
189 S5M8763_REG_LDO11,
190 S5M8763_REG_LDO12,
191 S5M8763_REG_LDO13,
192 S5M8763_REG_LDO14,
193 S5M8763_REG_LDO15,
194 S5M8763_REG_LDO16,
195 S5M8763_REG_BKCHR,
196 S5M8763_REG_LBCNFG1,
197 S5M8763_REG_LBCNFG2,
198};
199
200enum s5m8767_irq {
201 S5M8767_IRQ_PWRR,
202 S5M8767_IRQ_PWRF,
203 S5M8767_IRQ_PWR1S,
204 S5M8767_IRQ_JIGR,
205 S5M8767_IRQ_JIGF,
206 S5M8767_IRQ_LOWBAT2,
207 S5M8767_IRQ_LOWBAT1,
208
209 S5M8767_IRQ_MRB,
210 S5M8767_IRQ_DVSOK2,
211 S5M8767_IRQ_DVSOK3,
212 S5M8767_IRQ_DVSOK4,
213
214 S5M8767_IRQ_RTC60S,
215 S5M8767_IRQ_RTCA1,
216 S5M8767_IRQ_RTCA2,
217 S5M8767_IRQ_SMPL,
218 S5M8767_IRQ_RTC1S,
219 S5M8767_IRQ_WTSR,
220
221 S5M8767_IRQ_NR,
222};
223
224#define S5M8767_IRQ_PWRR_MASK (1 << 0)
225#define S5M8767_IRQ_PWRF_MASK (1 << 1)
226#define S5M8767_IRQ_PWR1S_MASK (1 << 3)
227#define S5M8767_IRQ_JIGR_MASK (1 << 4)
228#define S5M8767_IRQ_JIGF_MASK (1 << 5)
229#define S5M8767_IRQ_LOWBAT2_MASK (1 << 6)
230#define S5M8767_IRQ_LOWBAT1_MASK (1 << 7)
231
232#define S5M8767_IRQ_MRB_MASK (1 << 2)
233#define S5M8767_IRQ_DVSOK2_MASK (1 << 3)
234#define S5M8767_IRQ_DVSOK3_MASK (1 << 4)
235#define S5M8767_IRQ_DVSOK4_MASK (1 << 5)
236
237#define S5M8767_IRQ_RTC60S_MASK (1 << 0)
238#define S5M8767_IRQ_RTCA1_MASK (1 << 1)
239#define S5M8767_IRQ_RTCA2_MASK (1 << 2)
240#define S5M8767_IRQ_SMPL_MASK (1 << 3)
241#define S5M8767_IRQ_RTC1S_MASK (1 << 4)
242#define S5M8767_IRQ_WTSR_MASK (1 << 5)
243
244enum s5m8763_irq {
245 S5M8763_IRQ_DCINF,
246 S5M8763_IRQ_DCINR,
247 S5M8763_IRQ_JIGF,
248 S5M8763_IRQ_JIGR,
249 S5M8763_IRQ_PWRONF,
250 S5M8763_IRQ_PWRONR,
251
252 S5M8763_IRQ_WTSREVNT,
253 S5M8763_IRQ_SMPLEVNT,
254 S5M8763_IRQ_ALARM1,
255 S5M8763_IRQ_ALARM0,
256
257 S5M8763_IRQ_ONKEY1S,
258 S5M8763_IRQ_TOPOFFR,
259 S5M8763_IRQ_DCINOVPR,
260 S5M8763_IRQ_CHGRSTF,
261 S5M8763_IRQ_DONER,
262 S5M8763_IRQ_CHGFAULT,
263
264 S5M8763_IRQ_LOBAT1,
265 S5M8763_IRQ_LOBAT2,
266
267 S5M8763_IRQ_NR,
268};
269
270#define S5M8763_IRQ_DCINF_MASK (1 << 2)
271#define S5M8763_IRQ_DCINR_MASK (1 << 3)
272#define S5M8763_IRQ_JIGF_MASK (1 << 4)
273#define S5M8763_IRQ_JIGR_MASK (1 << 5)
274#define S5M8763_IRQ_PWRONF_MASK (1 << 6)
275#define S5M8763_IRQ_PWRONR_MASK (1 << 7)
276
277#define S5M8763_IRQ_WTSREVNT_MASK (1 << 0)
278#define S5M8763_IRQ_SMPLEVNT_MASK (1 << 1)
279#define S5M8763_IRQ_ALARM1_MASK (1 << 2)
280#define S5M8763_IRQ_ALARM0_MASK (1 << 3)
281
282#define S5M8763_IRQ_ONKEY1S_MASK (1 << 0)
283#define S5M8763_IRQ_TOPOFFR_MASK (1 << 2)
284#define S5M8763_IRQ_DCINOVPR_MASK (1 << 3)
285#define S5M8763_IRQ_CHGRSTF_MASK (1 << 4)
286#define S5M8763_IRQ_DONER_MASK (1 << 5)
287#define S5M8763_IRQ_CHGFAULT_MASK (1 << 7)
288
289#define S5M8763_IRQ_LOBAT1_MASK (1 << 0)
290#define S5M8763_IRQ_LOBAT2_MASK (1 << 1)
291
292#define S5M8763_ENRAMP (1 << 4)
293
294/**
295 * struct s5m87xx_dev - s5m87xx master device for sub-drivers
296 * @dev: master device of the chip (can be used to access platform data)
297 * @i2c: i2c client private data for regulator
298 * @rtc: i2c client private data for rtc
299 * @iolock: mutex for serializing io access
300 * @irqlock: mutex for buslock
301 * @irq_base: base IRQ number for s5m87xx, required for IRQs
302 * @irq: generic IRQ number for s5m87xx
303 * @ono: power onoff IRQ number for s5m87xx
304 * @irq_masks_cur: currently active value
305 * @irq_masks_cache: cached hardware value
306 * @type: indicate which s5m87xx "variant" is used
307 */
308struct s5m87xx_dev {
309 struct device *dev;
310 struct regmap *regmap;
311 struct i2c_client *i2c;
312 struct i2c_client *rtc;
313 struct mutex iolock;
314 struct mutex irqlock;
315
316 int device_type;
317 int irq_base;
318 int irq;
319 int ono;
320 u8 irq_masks_cur[NUM_IRQ_REGS];
321 u8 irq_masks_cache[NUM_IRQ_REGS];
322 int type;
323 bool wakeup;
324};
325
326int s5m_irq_init(struct s5m87xx_dev *s5m87xx);
327void s5m_irq_exit(struct s5m87xx_dev *s5m87xx);
328int s5m_irq_resume(struct s5m87xx_dev *s5m87xx);
329
330extern int s5m_reg_read(struct s5m87xx_dev *s5m87xx, u8 reg, void *dest);
331extern int s5m_bulk_read(struct s5m87xx_dev *s5m87xx, u8 reg, int count, u8 *buf);
332extern int s5m_reg_write(struct s5m87xx_dev *s5m87xx, u8 reg, u8 value);
333extern int s5m_bulk_write(struct s5m87xx_dev *s5m87xx, u8 reg, int count, u8 *buf);
334extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335
336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators;
338 int device_type;
339 int num_regulators;
340
341 int irq_base;
342 int (*cfg_pmic_irq)(void);
343
344 int ono;
345 bool wakeup;
346 bool buck_voltage_lock;
347
348 int buck_gpios[3];
349 int buck2_voltage[8];
350 bool buck2_gpiodvs;
351 int buck3_voltage[8];
352 bool buck3_gpiodvs;
353 int buck4_voltage[8];
354 bool buck4_gpiodvs;
355
356 int buck_set1;
357 int buck_set2;
358 int buck_set3;
359 int buck2_enable;
360 int buck3_enable;
361 int buck4_enable;
362 int buck_default_idx;
363 int buck2_default_idx;
364 int buck3_default_idx;
365 int buck4_default_idx;
366
367 int buck_ramp_delay;
368 bool buck2_ramp_enable;
369 bool buck3_ramp_enable;
370 bool buck4_ramp_enable;
371};
372
373#endif /* __LINUX_MFD_S5M_CORE_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
new file mode 100644
index 000000000000..a72a5d27e62e
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -0,0 +1,100 @@
1/* s5m87xx.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __LINUX_MFD_S5M_PMIC_H
12#define __LINUX_MFD_S5M_PMIC_H
13
14#include <linux/regulator/machine.h>
15
16/* S5M8767 regulator ids */
17enum s5m8767_regulators {
18 S5M8767_LDO1,
19 S5M8767_LDO2,
20 S5M8767_LDO3,
21 S5M8767_LDO4,
22 S5M8767_LDO5,
23 S5M8767_LDO6,
24 S5M8767_LDO7,
25 S5M8767_LDO8,
26 S5M8767_LDO9,
27 S5M8767_LDO10,
28 S5M8767_LDO11,
29 S5M8767_LDO12,
30 S5M8767_LDO13,
31 S5M8767_LDO14,
32 S5M8767_LDO15,
33 S5M8767_LDO16,
34 S5M8767_LDO17,
35 S5M8767_LDO18,
36 S5M8767_LDO19,
37 S5M8767_LDO20,
38 S5M8767_LDO21,
39 S5M8767_LDO22,
40 S5M8767_LDO23,
41 S5M8767_LDO24,
42 S5M8767_LDO25,
43 S5M8767_LDO26,
44 S5M8767_LDO27,
45 S5M8767_LDO28,
46 S5M8767_BUCK1,
47 S5M8767_BUCK2,
48 S5M8767_BUCK3,
49 S5M8767_BUCK4,
50 S5M8767_BUCK5,
51 S5M8767_BUCK6,
52 S5M8767_BUCK7,
53 S5M8767_BUCK8,
54 S5M8767_BUCK9,
55 S5M8767_AP_EN32KHZ,
56 S5M8767_CP_EN32KHZ,
57
58 S5M8767_REG_MAX,
59};
60
61/* S5M8763 regulator ids */
62enum s5m8763_regulators {
63 S5M8763_LDO1,
64 S5M8763_LDO2,
65 S5M8763_LDO3,
66 S5M8763_LDO4,
67 S5M8763_LDO5,
68 S5M8763_LDO6,
69 S5M8763_LDO7,
70 S5M8763_LDO8,
71 S5M8763_LDO9,
72 S5M8763_LDO10,
73 S5M8763_LDO11,
74 S5M8763_LDO12,
75 S5M8763_LDO13,
76 S5M8763_LDO14,
77 S5M8763_LDO15,
78 S5M8763_LDO16,
79 S5M8763_BUCK1,
80 S5M8763_BUCK2,
81 S5M8763_BUCK3,
82 S5M8763_BUCK4,
83 S5M8763_AP_EN32KHZ,
84 S5M8763_CP_EN32KHZ,
85 S5M8763_ENCHGVI,
86 S5M8763_ESAFEUSB1,
87 S5M8763_ESAFEUSB2,
88};
89
90/**
91 * s5m87xx_regulator_data - regulator data
92 * @id: regulator id
93 * @initdata: regulator init data (contraints, supplies, ...)
94 */
95struct s5m_regulator_data {
96 int id;
97 struct regulator_init_data *initdata;
98};
99
100#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-rtc.h b/include/linux/mfd/s5m87xx/s5m-rtc.h
new file mode 100644
index 000000000000..6ce8da264cec
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-rtc.h
@@ -0,0 +1,84 @@
1/*
2 * s5m-rtc.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_S5M_RTC_H
15#define __LINUX_MFD_S5M_RTC_H
16
17enum s5m87xx_rtc_reg {
18 S5M87XX_RTC_SEC,
19 S5M87XX_RTC_MIN,
20 S5M87XX_RTC_HOUR,
21 S5M87XX_RTC_WEEKDAY,
22 S5M87XX_RTC_DATE,
23 S5M87XX_RTC_MONTH,
24 S5M87XX_RTC_YEAR1,
25 S5M87XX_RTC_YEAR2,
26 S5M87XX_ALARM0_SEC,
27 S5M87XX_ALARM0_MIN,
28 S5M87XX_ALARM0_HOUR,
29 S5M87XX_ALARM0_WEEKDAY,
30 S5M87XX_ALARM0_DATE,
31 S5M87XX_ALARM0_MONTH,
32 S5M87XX_ALARM0_YEAR1,
33 S5M87XX_ALARM0_YEAR2,
34 S5M87XX_ALARM1_SEC,
35 S5M87XX_ALARM1_MIN,
36 S5M87XX_ALARM1_HOUR,
37 S5M87XX_ALARM1_WEEKDAY,
38 S5M87XX_ALARM1_DATE,
39 S5M87XX_ALARM1_MONTH,
40 S5M87XX_ALARM1_YEAR1,
41 S5M87XX_ALARM1_YEAR2,
42 S5M87XX_ALARM0_CONF,
43 S5M87XX_ALARM1_CONF,
44 S5M87XX_RTC_STATUS,
45 S5M87XX_WTSR_SMPL_CNTL,
46 S5M87XX_RTC_UDR_CON,
47};
48
49#define RTC_I2C_ADDR (0x0C >> 1)
50
51#define HOUR_12 (1 << 7)
52#define HOUR_AMPM (1 << 6)
53#define HOUR_PM (1 << 5)
54#define ALARM0_STATUS (1 << 1)
55#define ALARM1_STATUS (1 << 2)
56#define UPDATE_AD (1 << 0)
57
58/* RTC Control Register */
59#define BCD_EN_SHIFT 0
60#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
61#define MODEL24_SHIFT 1
62#define MODEL24_MASK (1 << MODEL24_SHIFT)
63/* RTC Update Register1 */
64#define RTC_UDR_SHIFT 0
65#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
66/* RTC Hour register */
67#define HOUR_PM_SHIFT 6
68#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
69/* RTC Alarm Enable */
70#define ALARM_ENABLE_SHIFT 7
71#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
72
73enum {
74 RTC_SEC = 0,
75 RTC_MIN,
76 RTC_HOUR,
77 RTC_WEEKDAY,
78 RTC_DATE,
79 RTC_MONTH,
80 RTC_YEAR1,
81 RTC_YEAR2,
82};
83
84#endif /* __LINUX_MFD_S5M_RTC_H */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index be1af7c42e57..ca1d7a347600 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -20,6 +20,8 @@ enum stmpe_block {
20}; 20};
21 21
22enum stmpe_partnum { 22enum stmpe_partnum {
23 STMPE610,
24 STMPE801,
23 STMPE811, 25 STMPE811,
24 STMPE1601, 26 STMPE1601,
25 STMPE2401, 27 STMPE2401,
@@ -50,17 +52,20 @@ enum {
50 52
51 53
52struct stmpe_variant_info; 54struct stmpe_variant_info;
55struct stmpe_client_info;
53 56
54/** 57/**
55 * struct stmpe - STMPE MFD structure 58 * struct stmpe - STMPE MFD structure
56 * @lock: lock protecting I/O operations 59 * @lock: lock protecting I/O operations
57 * @irq_lock: IRQ bus lock 60 * @irq_lock: IRQ bus lock
58 * @dev: device, mostly for dev_dbg() 61 * @dev: device, mostly for dev_dbg()
59 * @i2c: i2c client 62 * @client: client - i2c or spi
63 * @ci: client specific information
60 * @partnum: part number 64 * @partnum: part number
61 * @variant: the detected STMPE model number 65 * @variant: the detected STMPE model number
62 * @regs: list of addresses of registers which are at different addresses on 66 * @regs: list of addresses of registers which are at different addresses on
63 * different variants. Indexed by one of STMPE_IDX_*. 67 * different variants. Indexed by one of STMPE_IDX_*.
68 * @irq: irq number for stmpe
64 * @irq_base: starting IRQ number for internal IRQs 69 * @irq_base: starting IRQ number for internal IRQs
65 * @num_gpios: number of gpios, differs for variants 70 * @num_gpios: number of gpios, differs for variants
66 * @ier: cache of IER registers for bus_lock 71 * @ier: cache of IER registers for bus_lock
@@ -71,11 +76,13 @@ struct stmpe {
71 struct mutex lock; 76 struct mutex lock;
72 struct mutex irq_lock; 77 struct mutex irq_lock;
73 struct device *dev; 78 struct device *dev;
74 struct i2c_client *i2c; 79 void *client;
80 struct stmpe_client_info *ci;
75 enum stmpe_partnum partnum; 81 enum stmpe_partnum partnum;
76 struct stmpe_variant_info *variant; 82 struct stmpe_variant_info *variant;
77 const u8 *regs; 83 const u8 *regs;
78 84
85 int irq;
79 int irq_base; 86 int irq_base;
80 int num_gpios; 87 int num_gpios;
81 u8 ier[2]; 88 u8 ier[2];
@@ -183,6 +190,9 @@ struct stmpe_ts_platform_data {
183 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 190 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
184 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or 191 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
185 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used. 192 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
193 * @irq_over_gpio: true if gpio is used to get irq
194 * @irq_gpio: gpio number over which irq will be requested (significant only if
195 * irq_over_gpio is true)
186 * @gpio: GPIO-specific platform data 196 * @gpio: GPIO-specific platform data
187 * @keypad: keypad-specific platform data 197 * @keypad: keypad-specific platform data
188 * @ts: touchscreen-specific platform data 198 * @ts: touchscreen-specific platform data
@@ -194,6 +204,8 @@ struct stmpe_platform_data {
194 unsigned int irq_trigger; 204 unsigned int irq_trigger;
195 bool irq_invert_polarity; 205 bool irq_invert_polarity;
196 bool autosleep; 206 bool autosleep;
207 bool irq_over_gpio;
208 int irq_gpio;
197 int autosleep_timeout; 209 int autosleep_timeout;
198 210
199 struct stmpe_gpio_platform_data *gpio; 211 struct stmpe_gpio_platform_data *gpio;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 8bf2cb9502dd..d0cb12eba402 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -740,6 +740,34 @@
740#define TPS65910_GPIO_STS BIT(1) 740#define TPS65910_GPIO_STS BIT(1)
741#define TPS65910_GPIO_SET BIT(0) 741#define TPS65910_GPIO_SET BIT(0)
742 742
743/* Regulator Index Definitions */
744#define TPS65910_REG_VRTC 0
745#define TPS65910_REG_VIO 1
746#define TPS65910_REG_VDD1 2
747#define TPS65910_REG_VDD2 3
748#define TPS65910_REG_VDD3 4
749#define TPS65910_REG_VDIG1 5
750#define TPS65910_REG_VDIG2 6
751#define TPS65910_REG_VPLL 7
752#define TPS65910_REG_VDAC 8
753#define TPS65910_REG_VAUX1 9
754#define TPS65910_REG_VAUX2 10
755#define TPS65910_REG_VAUX33 11
756#define TPS65910_REG_VMMC 12
757
758#define TPS65911_REG_VDDCTRL 4
759#define TPS65911_REG_LDO1 5
760#define TPS65911_REG_LDO2 6
761#define TPS65911_REG_LDO3 7
762#define TPS65911_REG_LDO4 8
763#define TPS65911_REG_LDO5 9
764#define TPS65911_REG_LDO6 10
765#define TPS65911_REG_LDO7 11
766#define TPS65911_REG_LDO8 12
767
768/* Max number of TPS65910/11 regulators */
769#define TPS65910_NUM_REGS 13
770
743/** 771/**
744 * struct tps65910_board 772 * struct tps65910_board
745 * Board platform data may be used to initialize regulators. 773 * Board platform data may be used to initialize regulators.
@@ -751,7 +779,7 @@ struct tps65910_board {
751 int irq_base; 779 int irq_base;
752 int vmbch_threshold; 780 int vmbch_threshold;
753 int vmbch2_threshold; 781 int vmbch2_threshold;
754 struct regulator_init_data *tps65910_pmic_init_data; 782 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
755}; 783};
756 784
757/** 785/**
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 4321f044d1e4..bc19e5fb7ea8 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -104,6 +104,9 @@
104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12) 104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12)
105#define UCB_MODE_AUD_OFF_CAN (1 << 13) 105#define UCB_MODE_AUD_OFF_CAN (1 << 13)
106 106
107struct ucb1x00_plat_data {
108 int gpio_base;
109};
107 110
108struct ucb1x00_irq { 111struct ucb1x00_irq {
109 void *devid; 112 void *devid;
@@ -116,7 +119,7 @@ struct ucb1x00 {
116 unsigned int irq; 119 unsigned int irq;
117 struct semaphore adc_sem; 120 struct semaphore adc_sem;
118 spinlock_t io_lock; 121 spinlock_t io_lock;
119 u16 id; 122 const struct mcp_device_id *id;
120 u16 io_dir; 123 u16 io_dir;
121 u16 io_out; 124 u16 io_out;
122 u16 adc_cr; 125 u16 adc_cr;
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index f44bdb7273bd..9eff2a351ec5 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -15,6 +15,7 @@
15#ifndef __MFD_WM8994_CORE_H__ 15#ifndef __MFD_WM8994_CORE_H__
16#define __MFD_WM8994_CORE_H__ 16#define __MFD_WM8994_CORE_H__
17 17
18#include <linux/mutex.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19 20
20enum wm8994_type { 21enum wm8994_type {
@@ -55,6 +56,7 @@ struct wm8994 {
55 struct mutex irq_lock; 56 struct mutex irq_lock;
56 57
57 enum wm8994_type type; 58 enum wm8994_type type;
59 int revision;
58 60
59 struct device *dev; 61 struct device *dev;
60 struct regmap *regmap; 62 struct regmap *regmap;
@@ -65,13 +67,10 @@ struct wm8994 {
65 int irq_base; 67 int irq_base;
66 68
67 int irq; 69 int irq;
68 u16 irq_masks_cur[WM8994_NUM_IRQ_REGS]; 70 struct regmap_irq_chip_data *irq_data;
69 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
70 71
71 /* Used over suspend/resume */ 72 /* Used over suspend/resume */
72 bool suspended; 73 bool suspended;
73 u16 ldo_regs[WM8994_NUM_LDO_REGS];
74 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
75 74
76 struct regulator_dev *dbvdd; 75 struct regulator_dev *dbvdd;
77 int num_supplies; 76 int num_supplies;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index ea32f306dca6..3fb1f407d5e6 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -23,7 +23,7 @@ struct wm8994_ldo_pdata {
23 int enable; 23 int enable;
24 24
25 const char *supply; 25 const char *supply;
26 struct regulator_init_data *init_data; 26 const struct regulator_init_data *init_data;
27}; 27};
28 28
29#define WM8994_CONFIGURE_GPIO 0x10000 29#define WM8994_CONFIGURE_GPIO 0x10000
@@ -113,6 +113,23 @@ struct wm8958_enh_eq_cfg {
113 u16 regs[WM8958_ENH_EQ_REGS]; 113 u16 regs[WM8958_ENH_EQ_REGS];
114}; 114};
115 115
116/**
117 * Microphone detection rates, used to tune response rates and power
118 * consumption for WM8958/WM1811 microphone detection.
119 *
120 * @sysclk: System clock rate to use this configuration for.
121 * @idle: True if this configuration should use when no accessory is detected,
122 * false otherwise.
123 * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
124 * @rate: Value for MICD_RATE register field (not shifted).
125 */
126struct wm8958_micd_rate {
127 int sysclk;
128 bool idle;
129 int start;
130 int rate;
131};
132
116struct wm8994_pdata { 133struct wm8994_pdata {
117 int gpio_base; 134 int gpio_base;
118 135
@@ -144,6 +161,9 @@ struct wm8994_pdata {
144 int num_enh_eq_cfgs; 161 int num_enh_eq_cfgs;
145 struct wm8958_enh_eq_cfg *enh_eq_cfgs; 162 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
146 163
164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates;
166
147 /* LINEOUT can be differential or single ended */ 167 /* LINEOUT can be differential or single ended */
148 unsigned int lineout1_diff:1; 168 unsigned int lineout1_diff:1;
149 unsigned int lineout2_diff:1; 169 unsigned int lineout2_diff:1;
@@ -168,12 +188,21 @@ struct wm8994_pdata {
168 /* WM8958 microphone bias configuration */ 188 /* WM8958 microphone bias configuration */
169 int micbias[2]; 189 int micbias[2];
170 190
191 /* WM8958 microphone detection ranges */
192 u16 micd_lvl_sel;
193
171 /* Disable the internal pull downs on the LDOs if they are 194 /* Disable the internal pull downs on the LDOs if they are
172 * always driven (eg, connected to an always on supply or 195 * always driven (eg, connected to an always on supply or
173 * GPIO that always drives an output. If they float power 196 * GPIO that always drives an output. If they float power
174 * consumption will rise. 197 * consumption will rise.
175 */ 198 */
176 bool ldo_ena_always_driven; 199 bool ldo_ena_always_driven;
200
201 /*
202 * SPKMODE must be pulled internally by the device on this
203 * system.
204 */
205 bool spkmode_pu;
177}; 206};
178 207
179#endif 208#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index 83a9caec0e43..86e6a032a078 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -95,11 +95,15 @@
95#define WM8994_FLL1_CONTROL_3 0x222 95#define WM8994_FLL1_CONTROL_3 0x222
96#define WM8994_FLL1_CONTROL_4 0x223 96#define WM8994_FLL1_CONTROL_4 0x223
97#define WM8994_FLL1_CONTROL_5 0x224 97#define WM8994_FLL1_CONTROL_5 0x224
98#define WM8958_FLL1_EFS_1 0x226
99#define WM8958_FLL1_EFS_2 0x227
98#define WM8994_FLL2_CONTROL_1 0x240 100#define WM8994_FLL2_CONTROL_1 0x240
99#define WM8994_FLL2_CONTROL_2 0x241 101#define WM8994_FLL2_CONTROL_2 0x241
100#define WM8994_FLL2_CONTROL_3 0x242 102#define WM8994_FLL2_CONTROL_3 0x242
101#define WM8994_FLL2_CONTROL_4 0x243 103#define WM8994_FLL2_CONTROL_4 0x243
102#define WM8994_FLL2_CONTROL_5 0x244 104#define WM8994_FLL2_CONTROL_5 0x244
105#define WM8958_FLL2_EFS_1 0x246
106#define WM8958_FLL2_EFS_2 0x247
103#define WM8994_AIF1_CONTROL_1 0x300 107#define WM8994_AIF1_CONTROL_1 0x300
104#define WM8994_AIF1_CONTROL_2 0x301 108#define WM8994_AIF1_CONTROL_2 0x301
105#define WM8994_AIF1_MASTER_SLAVE 0x302 109#define WM8994_AIF1_MASTER_SLAVE 0x302
@@ -116,6 +120,7 @@
116#define WM8994_AIF2DAC_LRCLK 0x315 120#define WM8994_AIF2DAC_LRCLK 0x315
117#define WM8994_AIF2DAC_DATA 0x316 121#define WM8994_AIF2DAC_DATA 0x316
118#define WM8994_AIF2ADC_DATA 0x317 122#define WM8994_AIF2ADC_DATA 0x317
123#define WM1811_AIF2TX_CONTROL 0x318
119#define WM8958_AIF3_CONTROL_1 0x320 124#define WM8958_AIF3_CONTROL_1 0x320
120#define WM8958_AIF3_CONTROL_2 0x321 125#define WM8958_AIF3_CONTROL_2 0x321
121#define WM8958_AIF3DAC_DATA 0x322 126#define WM8958_AIF3DAC_DATA 0x322
@@ -166,6 +171,7 @@
166#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491 171#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491
167#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492 172#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492
168#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493 173#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493
174#define WM8994_AIF1_DAC1_EQ_BAND_1_C 0x494
169#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0 175#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0
170#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1 176#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1
171#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2 177#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2
@@ -186,6 +192,7 @@
186#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1 192#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1
187#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2 193#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2
188#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3 194#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3
195#define WM8994_AIF1_DAC2_EQ_BAND_1_C 0x4B4
189#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500 196#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500
190#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501 197#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501
191#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502 198#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502
@@ -219,6 +226,7 @@
219#define WM8994_AIF2_EQ_BAND_5_A 0x591 226#define WM8994_AIF2_EQ_BAND_5_A 0x591
220#define WM8994_AIF2_EQ_BAND_5_B 0x592 227#define WM8994_AIF2_EQ_BAND_5_B 0x592
221#define WM8994_AIF2_EQ_BAND_5_PG 0x593 228#define WM8994_AIF2_EQ_BAND_5_PG 0x593
229#define WM8994_AIF2_EQ_BAND_1_C 0x594
222#define WM8994_DAC1_MIXER_VOLUMES 0x600 230#define WM8994_DAC1_MIXER_VOLUMES 0x600
223#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601 231#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601
224#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602 232#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602
@@ -242,6 +250,7 @@
242#define WM8994_GPIO_4 0x703 250#define WM8994_GPIO_4 0x703
243#define WM8994_GPIO_5 0x704 251#define WM8994_GPIO_5 0x704
244#define WM8994_GPIO_6 0x705 252#define WM8994_GPIO_6 0x705
253#define WM1811_JACKDET_CTRL 0x705
245#define WM8994_GPIO_7 0x706 254#define WM8994_GPIO_7 0x706
246#define WM8994_GPIO_8 0x707 255#define WM8994_GPIO_8 0x707
247#define WM8994_GPIO_9 0x708 256#define WM8994_GPIO_9 0x708
@@ -264,7 +273,43 @@
264#define WM8958_DSP2_RELEASETIME 0xA03 273#define WM8958_DSP2_RELEASETIME 0xA03
265#define WM8958_DSP2_VERMAJMIN 0xA04 274#define WM8958_DSP2_VERMAJMIN 0xA04
266#define WM8958_DSP2_VERBUILD 0xA05 275#define WM8958_DSP2_VERBUILD 0xA05
276#define WM8958_DSP2_TESTREG 0xA06
277#define WM8958_DSP2_XORREG 0xA07
278#define WM8958_DSP2_SHIFTMAXX 0xA08
279#define WM8958_DSP2_SHIFTMAXY 0xA09
280#define WM8958_DSP2_SHIFTMAXZ 0xA0A
281#define WM8958_DSP2_SHIFTMAXEXTLO 0xA0B
282#define WM8958_DSP2_AESSELECT 0xA0C
267#define WM8958_DSP2_EXECCONTROL 0xA0D 283#define WM8958_DSP2_EXECCONTROL 0xA0D
284#define WM8958_DSP2_SAMPLEBREAK 0xA0E
285#define WM8958_DSP2_COUNTBREAK 0xA0F
286#define WM8958_DSP2_INTSTATUS 0xA10
287#define WM8958_DSP2_EVENTSTATUS 0xA11
288#define WM8958_DSP2_INTMASK 0xA12
289#define WM8958_DSP2_CONFIGDWIDTH 0xA13
290#define WM8958_DSP2_CONFIGINSTR 0xA14
291#define WM8958_DSP2_CONFIGDMEM 0xA15
292#define WM8958_DSP2_CONFIGDELAYS 0xA16
293#define WM8958_DSP2_CONFIGNUMIO 0xA17
294#define WM8958_DSP2_CONFIGEXTDEPTH 0xA18
295#define WM8958_DSP2_CONFIGMULTIPLIER 0xA19
296#define WM8958_DSP2_CONFIGCTRLDWIDTH 0xA1A
297#define WM8958_DSP2_CONFIGPIPELINE 0xA1B
298#define WM8958_DSP2_SHIFTMAXEXTHI 0xA1C
299#define WM8958_DSP2_SWVERSIONREG 0xA1D
300#define WM8958_DSP2_CONFIGXMEM 0xA1E
301#define WM8958_DSP2_CONFIGYMEM 0xA1F
302#define WM8958_DSP2_CONFIGZMEM 0xA20
303#define WM8958_FW_BUILD_1 0x2000
304#define WM8958_FW_BUILD_0 0x2001
305#define WM8958_FW_ID_1 0x2002
306#define WM8958_FW_ID_0 0x2003
307#define WM8958_FW_MAJOR_1 0x2004
308#define WM8958_FW_MAJOR_0 0x2005
309#define WM8958_FW_MINOR_1 0x2006
310#define WM8958_FW_MINOR_0 0x2007
311#define WM8958_FW_PATCH_1 0x2008
312#define WM8958_FW_PATCH_0 0x2009
268#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200 313#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200
269#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201 314#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201
270#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202 315#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202
@@ -333,6 +378,14 @@
333#define WM8958_MBC_B2_PG2_2 0x242D 378#define WM8958_MBC_B2_PG2_2 0x242D
334#define WM8958_MBC_B1_PG2_1 0x242E 379#define WM8958_MBC_B1_PG2_1 0x242E
335#define WM8958_MBC_B1_PG2_2 0x242F 380#define WM8958_MBC_B1_PG2_2 0x242F
381#define WM8958_MBC_CROSSOVER_1 0x2600
382#define WM8958_MBC_CROSSOVER_2 0x2601
383#define WM8958_MBC_HPF_1 0x2602
384#define WM8958_MBC_HPF_2 0x2603
385#define WM8958_MBC_LPF_1 0x2606
386#define WM8958_MBC_LPF_2 0x2607
387#define WM8958_MBC_RMS_LIMIT_1 0x260A
388#define WM8958_MBC_RMS_LIMIT_2 0x260B
336#define WM8994_WRITE_SEQUENCER_0 0x3000 389#define WM8994_WRITE_SEQUENCER_0 0x3000
337#define WM8994_WRITE_SEQUENCER_1 0x3001 390#define WM8994_WRITE_SEQUENCER_1 0x3001
338#define WM8994_WRITE_SEQUENCER_2 0x3002 391#define WM8994_WRITE_SEQUENCER_2 0x3002
@@ -1852,6 +1905,9 @@
1852/* 1905/*
1853 * R57 (0x39) - AntiPOP (2) 1906 * R57 (0x39) - AntiPOP (2)
1854 */ 1907 */
1908#define WM1811_JACKDET_MODE_MASK 0x0180 /* JACKDET_MODE - [8:7] */
1909#define WM1811_JACKDET_MODE_SHIFT 7 /* JACKDET_MODE - [8:7] */
1910#define WM1811_JACKDET_MODE_WIDTH 2 /* JACKDET_MODE - [8:7] */
1855#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */ 1911#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */
1856#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */ 1912#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */
1857#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */ 1913#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */
@@ -2389,6 +2445,10 @@
2389/* 2445/*
2390 * R548 (0x224) - FLL1 Control (5) 2446 * R548 (0x224) - FLL1 Control (5)
2391 */ 2447 */
2448#define WM8958_FLL1_BYP 0x8000 /* FLL1_BYP */
2449#define WM8958_FLL1_BYP_MASK 0x8000 /* FLL1_BYP */
2450#define WM8958_FLL1_BYP_SHIFT 15 /* FLL1_BYP */
2451#define WM8958_FLL1_BYP_WIDTH 1 /* FLL1_BYP */
2392#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */ 2452#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */
2393#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */ 2453#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */
2394#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */ 2454#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */
@@ -2404,6 +2464,24 @@
2404#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */ 2464#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */
2405 2465
2406/* 2466/*
2467 * R550 (0x226) - FLL1 EFS 1
2468 */
2469#define WM8958_FLL1_LAMBDA_MASK 0xFFFF /* FLL1_LAMBDA - [15:0] */
2470#define WM8958_FLL1_LAMBDA_SHIFT 0 /* FLL1_LAMBDA - [15:0] */
2471#define WM8958_FLL1_LAMBDA_WIDTH 16 /* FLL1_LAMBDA - [15:0] */
2472
2473/*
2474 * R551 (0x227) - FLL1 EFS 2
2475 */
2476#define WM8958_FLL1_LFSR_SEL_MASK 0x0006 /* FLL1_LFSR_SEL - [2:1] */
2477#define WM8958_FLL1_LFSR_SEL_SHIFT 1 /* FLL1_LFSR_SEL - [2:1] */
2478#define WM8958_FLL1_LFSR_SEL_WIDTH 2 /* FLL1_LFSR_SEL - [2:1] */
2479#define WM8958_FLL1_EFS_ENA 0x0001 /* FLL1_EFS_ENA */
2480#define WM8958_FLL1_EFS_ENA_MASK 0x0001 /* FLL1_EFS_ENA */
2481#define WM8958_FLL1_EFS_ENA_SHIFT 0 /* FLL1_EFS_ENA */
2482#define WM8958_FLL1_EFS_ENA_WIDTH 1 /* FLL1_EFS_ENA */
2483
2484/*
2407 * R576 (0x240) - FLL2 Control (1) 2485 * R576 (0x240) - FLL2 Control (1)
2408 */ 2486 */
2409#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */ 2487#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */
@@ -2452,6 +2530,10 @@
2452/* 2530/*
2453 * R580 (0x244) - FLL2 Control (5) 2531 * R580 (0x244) - FLL2 Control (5)
2454 */ 2532 */
2533#define WM8958_FLL2_BYP 0x8000 /* FLL2_BYP */
2534#define WM8958_FLL2_BYP_MASK 0x8000 /* FLL2_BYP */
2535#define WM8958_FLL2_BYP_SHIFT 15 /* FLL2_BYP */
2536#define WM8958_FLL2_BYP_WIDTH 1 /* FLL2_BYP */
2455#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */ 2537#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */
2456#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */ 2538#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */
2457#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */ 2539#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */
@@ -2467,6 +2549,24 @@
2467#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */ 2549#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */
2468 2550
2469/* 2551/*
2552 * R582 (0x246) - FLL2 EFS 1
2553 */
2554#define WM8958_FLL2_LAMBDA_MASK 0xFFFF /* FLL2_LAMBDA - [15:0] */
2555#define WM8958_FLL2_LAMBDA_SHIFT 0 /* FLL2_LAMBDA - [15:0] */
2556#define WM8958_FLL2_LAMBDA_WIDTH 16 /* FLL2_LAMBDA - [15:0] */
2557
2558/*
2559 * R583 (0x247) - FLL2 EFS 2
2560 */
2561#define WM8958_FLL2_LFSR_SEL_MASK 0x0006 /* FLL2_LFSR_SEL - [2:1] */
2562#define WM8958_FLL2_LFSR_SEL_SHIFT 1 /* FLL2_LFSR_SEL - [2:1] */
2563#define WM8958_FLL2_LFSR_SEL_WIDTH 2 /* FLL2_LFSR_SEL - [2:1] */
2564#define WM8958_FLL2_EFS_ENA 0x0001 /* FLL2_EFS_ENA */
2565#define WM8958_FLL2_EFS_ENA_MASK 0x0001 /* FLL2_EFS_ENA */
2566#define WM8958_FLL2_EFS_ENA_SHIFT 0 /* FLL2_EFS_ENA */
2567#define WM8958_FLL2_EFS_ENA_WIDTH 1 /* FLL2_EFS_ENA */
2568
2569/*
2470 * R768 (0x300) - AIF1 Control (1) 2570 * R768 (0x300) - AIF1 Control (1)
2471 */ 2571 */
2472#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */ 2572#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */
@@ -4187,6 +4287,18 @@
4187#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */ 4287#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */
4188 4288
4189/* 4289/*
4290 * R1797 (0x705) - JACKDET Ctrl
4291 */
4292#define WM1811_JACKDET_DB 0x0100 /* JACKDET_DB */
4293#define WM1811_JACKDET_DB_MASK 0x0100 /* JACKDET_DB */
4294#define WM1811_JACKDET_DB_SHIFT 8 /* JACKDET_DB */
4295#define WM1811_JACKDET_DB_WIDTH 1 /* JACKDET_DB */
4296#define WM1811_JACKDET_LVL 0x0040 /* JACKDET_LVL */
4297#define WM1811_JACKDET_LVL_MASK 0x0040 /* JACKDET_LVL */
4298#define WM1811_JACKDET_LVL_SHIFT 6 /* JACKDET_LVL */
4299#define WM1811_JACKDET_LVL_WIDTH 1 /* JACKDET_LVL */
4300
4301/*
4190 * R1824 (0x720) - Pull Control (1) 4302 * R1824 (0x720) - Pull Control (1)
4191 */ 4303 */
4192#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */ 4304#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index e39aeecfe9a2..eaf867412f7a 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -6,18 +6,31 @@
6 6
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 7typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 8
9/*
10 * MIGRATE_ASYNC means never block
11 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
12 * on most operations but not ->writepage as the potential stall time
13 * is too significant
14 * MIGRATE_SYNC will block when migrating pages
15 */
16enum migrate_mode {
17 MIGRATE_ASYNC,
18 MIGRATE_SYNC_LIGHT,
19 MIGRATE_SYNC,
20};
21
9#ifdef CONFIG_MIGRATION 22#ifdef CONFIG_MIGRATION
10#define PAGE_MIGRATION 1 23#define PAGE_MIGRATION 1
11 24
12extern void putback_lru_pages(struct list_head *l); 25extern void putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 26extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 27 struct page *, struct page *, enum migrate_mode);
15extern int migrate_pages(struct list_head *l, new_page_t x, 28extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, bool offlining, 29 unsigned long private, bool offlining,
17 bool sync); 30 enum migrate_mode mode);
18extern int migrate_huge_pages(struct list_head *l, new_page_t x, 31extern int migrate_huge_pages(struct list_head *l, new_page_t x,
19 unsigned long private, bool offlining, 32 unsigned long private, bool offlining,
20 bool sync); 33 enum migrate_mode mode);
21 34
22extern int fail_migrate_page(struct address_space *, 35extern int fail_migrate_page(struct address_space *,
23 struct page *, struct page *); 36 struct page *, struct page *);
@@ -36,10 +49,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
36static inline void putback_lru_pages(struct list_head *l) {} 49static inline void putback_lru_pages(struct list_head *l) {}
37static inline int migrate_pages(struct list_head *l, new_page_t x, 50static inline int migrate_pages(struct list_head *l, new_page_t x,
38 unsigned long private, bool offlining, 51 unsigned long private, bool offlining,
39 bool sync) { return -ENOSYS; } 52 enum migrate_mode mode) { return -ENOSYS; }
40static inline int migrate_huge_pages(struct list_head *l, new_page_t x, 53static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
41 unsigned long private, bool offlining, 54 unsigned long private, bool offlining,
42 bool sync) { return -ENOSYS; } 55 enum migrate_mode mode) { return -ENOSYS; }
43 56
44static inline int migrate_prep(void) { return -ENOSYS; } 57static inline int migrate_prep(void) { return -ENOSYS; }
45static inline int migrate_prep_local(void) { return -ENOSYS; } 58static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 27748230aa69..2783eca629a0 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -9,6 +9,7 @@
9#define __LINUX_MII_H__ 9#define __LINUX_MII_H__
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ethtool.h>
12 13
13/* Generic MII registers. */ 14/* Generic MII registers. */
14#define MII_BMCR 0x00 /* Basic mode control register */ 15#define MII_BMCR 0x00 /* Basic mode control register */
@@ -240,6 +241,205 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
240} 241}
241 242
242/** 243/**
244 * ethtool_adv_to_mii_adv_t
245 * @ethadv: the ethtool advertisement settings
246 *
247 * A small helper function that translates ethtool advertisement
248 * settings to phy autonegotiation advertisements for the
249 * MII_ADVERTISE register.
250 */
251static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv)
252{
253 u32 result = 0;
254
255 if (ethadv & ADVERTISED_10baseT_Half)
256 result |= ADVERTISE_10HALF;
257 if (ethadv & ADVERTISED_10baseT_Full)
258 result |= ADVERTISE_10FULL;
259 if (ethadv & ADVERTISED_100baseT_Half)
260 result |= ADVERTISE_100HALF;
261 if (ethadv & ADVERTISED_100baseT_Full)
262 result |= ADVERTISE_100FULL;
263 if (ethadv & ADVERTISED_Pause)
264 result |= ADVERTISE_PAUSE_CAP;
265 if (ethadv & ADVERTISED_Asym_Pause)
266 result |= ADVERTISE_PAUSE_ASYM;
267
268 return result;
269}
270
271/**
272 * mii_adv_to_ethtool_adv_t
273 * @adv: value of the MII_ADVERTISE register
274 *
275 * A small helper function that translates MII_ADVERTISE bits
276 * to ethtool advertisement settings.
277 */
278static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
279{
280 u32 result = 0;
281
282 if (adv & ADVERTISE_10HALF)
283 result |= ADVERTISED_10baseT_Half;
284 if (adv & ADVERTISE_10FULL)
285 result |= ADVERTISED_10baseT_Full;
286 if (adv & ADVERTISE_100HALF)
287 result |= ADVERTISED_100baseT_Half;
288 if (adv & ADVERTISE_100FULL)
289 result |= ADVERTISED_100baseT_Full;
290 if (adv & ADVERTISE_PAUSE_CAP)
291 result |= ADVERTISED_Pause;
292 if (adv & ADVERTISE_PAUSE_ASYM)
293 result |= ADVERTISED_Asym_Pause;
294
295 return result;
296}
297
298/**
299 * ethtool_adv_to_mii_ctrl1000_t
300 * @ethadv: the ethtool advertisement settings
301 *
302 * A small helper function that translates ethtool advertisement
303 * settings to phy autonegotiation advertisements for the
304 * MII_CTRL1000 register when in 1000T mode.
305 */
306static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv)
307{
308 u32 result = 0;
309
310 if (ethadv & ADVERTISED_1000baseT_Half)
311 result |= ADVERTISE_1000HALF;
312 if (ethadv & ADVERTISED_1000baseT_Full)
313 result |= ADVERTISE_1000FULL;
314
315 return result;
316}
317
318/**
319 * mii_ctrl1000_to_ethtool_adv_t
320 * @adv: value of the MII_CTRL1000 register
321 *
322 * A small helper function that translates MII_CTRL1000
323 * bits, when in 1000Base-T mode, to ethtool
324 * advertisement settings.
325 */
326static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv)
327{
328 u32 result = 0;
329
330 if (adv & ADVERTISE_1000HALF)
331 result |= ADVERTISED_1000baseT_Half;
332 if (adv & ADVERTISE_1000FULL)
333 result |= ADVERTISED_1000baseT_Full;
334
335 return result;
336}
337
338/**
339 * mii_lpa_to_ethtool_lpa_t
340 * @adv: value of the MII_LPA register
341 *
342 * A small helper function that translates MII_LPA
343 * bits, when in 1000Base-T mode, to ethtool
344 * LP advertisement settings.
345 */
346static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
347{
348 u32 result = 0;
349
350 if (lpa & LPA_LPACK)
351 result |= ADVERTISED_Autoneg;
352
353 return result | mii_adv_to_ethtool_adv_t(lpa);
354}
355
356/**
357 * mii_stat1000_to_ethtool_lpa_t
358 * @adv: value of the MII_STAT1000 register
359 *
360 * A small helper function that translates MII_STAT1000
361 * bits, when in 1000Base-T mode, to ethtool
362 * advertisement settings.
363 */
364static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
365{
366 u32 result = 0;
367
368 if (lpa & LPA_1000HALF)
369 result |= ADVERTISED_1000baseT_Half;
370 if (lpa & LPA_1000FULL)
371 result |= ADVERTISED_1000baseT_Full;
372
373 return result;
374}
375
376/**
377 * ethtool_adv_to_mii_adv_x
378 * @ethadv: the ethtool advertisement settings
379 *
380 * A small helper function that translates ethtool advertisement
381 * settings to phy autonegotiation advertisements for the
382 * MII_CTRL1000 register when in 1000Base-X mode.
383 */
384static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv)
385{
386 u32 result = 0;
387
388 if (ethadv & ADVERTISED_1000baseT_Half)
389 result |= ADVERTISE_1000XHALF;
390 if (ethadv & ADVERTISED_1000baseT_Full)
391 result |= ADVERTISE_1000XFULL;
392 if (ethadv & ADVERTISED_Pause)
393 result |= ADVERTISE_1000XPAUSE;
394 if (ethadv & ADVERTISED_Asym_Pause)
395 result |= ADVERTISE_1000XPSE_ASYM;
396
397 return result;
398}
399
400/**
401 * mii_adv_to_ethtool_adv_x
402 * @adv: value of the MII_CTRL1000 register
403 *
404 * A small helper function that translates MII_CTRL1000
405 * bits, when in 1000Base-X mode, to ethtool
406 * advertisement settings.
407 */
408static inline u32 mii_adv_to_ethtool_adv_x(u32 adv)
409{
410 u32 result = 0;
411
412 if (adv & ADVERTISE_1000XHALF)
413 result |= ADVERTISED_1000baseT_Half;
414 if (adv & ADVERTISE_1000XFULL)
415 result |= ADVERTISED_1000baseT_Full;
416 if (adv & ADVERTISE_1000XPAUSE)
417 result |= ADVERTISED_Pause;
418 if (adv & ADVERTISE_1000XPSE_ASYM)
419 result |= ADVERTISED_Asym_Pause;
420
421 return result;
422}
423
424/**
425 * mii_lpa_to_ethtool_lpa_x
426 * @adv: value of the MII_LPA register
427 *
428 * A small helper function that translates MII_LPA
429 * bits, when in 1000Base-X mode, to ethtool
430 * LP advertisement settings.
431 */
432static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
433{
434 u32 result = 0;
435
436 if (lpa & LPA_LPACK)
437 result |= ADVERTISED_Autoneg;
438
439 return result | mii_adv_to_ethtool_adv_x(lpa);
440}
441
442/**
243 * mii_advertise_flowctrl - get flow control advertisement flags 443 * mii_advertise_flowctrl - get flow control advertisement flags
244 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) 444 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
245 */ 445 */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index c41d7270c6c6..32085249e9cb 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -54,7 +54,7 @@ struct miscdevice {
54 struct device *parent; 54 struct device *parent;
55 struct device *this_device; 55 struct device *this_device;
56 const char *nodename; 56 const char *nodename;
57 mode_t mode; 57 umode_t mode;
58}; 58};
59 59
60extern int misc_register(struct miscdevice * misc); 60extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index b56e4587208d..9958ff2cad3c 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -59,12 +59,15 @@ enum {
59 MLX4_CMD_HW_HEALTH_CHECK = 0x50, 59 MLX4_CMD_HW_HEALTH_CHECK = 0x50,
60 MLX4_CMD_SET_PORT = 0xc, 60 MLX4_CMD_SET_PORT = 0xc,
61 MLX4_CMD_SET_NODE = 0x5a, 61 MLX4_CMD_SET_NODE = 0x5a,
62 MLX4_CMD_QUERY_FUNC = 0x56,
62 MLX4_CMD_ACCESS_DDR = 0x2e, 63 MLX4_CMD_ACCESS_DDR = 0x2e,
63 MLX4_CMD_MAP_ICM = 0xffa, 64 MLX4_CMD_MAP_ICM = 0xffa,
64 MLX4_CMD_UNMAP_ICM = 0xff9, 65 MLX4_CMD_UNMAP_ICM = 0xff9,
65 MLX4_CMD_MAP_ICM_AUX = 0xffc, 66 MLX4_CMD_MAP_ICM_AUX = 0xffc,
66 MLX4_CMD_UNMAP_ICM_AUX = 0xffb, 67 MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
67 MLX4_CMD_SET_ICM_SIZE = 0xffd, 68 MLX4_CMD_SET_ICM_SIZE = 0xffd,
69 /*master notify fw on finish for slave's flr*/
70 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
68 71
69 /* TPT commands */ 72 /* TPT commands */
70 MLX4_CMD_SW2HW_MPT = 0xd, 73 MLX4_CMD_SW2HW_MPT = 0xd,
@@ -119,6 +122,26 @@ enum {
119 /* miscellaneous commands */ 122 /* miscellaneous commands */
120 MLX4_CMD_DIAG_RPRT = 0x30, 123 MLX4_CMD_DIAG_RPRT = 0x30,
121 MLX4_CMD_NOP = 0x31, 124 MLX4_CMD_NOP = 0x31,
125 MLX4_CMD_ACCESS_MEM = 0x2e,
126 MLX4_CMD_SET_VEP = 0x52,
127
128 /* Ethernet specific commands */
129 MLX4_CMD_SET_VLAN_FLTR = 0x47,
130 MLX4_CMD_SET_MCAST_FLTR = 0x48,
131 MLX4_CMD_DUMP_ETH_STATS = 0x49,
132
133 /* Communication channel commands */
134 MLX4_CMD_ARM_COMM_CHANNEL = 0x57,
135 MLX4_CMD_GEN_EQE = 0x58,
136
137 /* virtual commands */
138 MLX4_CMD_ALLOC_RES = 0xf00,
139 MLX4_CMD_FREE_RES = 0xf01,
140 MLX4_CMD_MCAST_ATTACH = 0xf05,
141 MLX4_CMD_UCAST_ATTACH = 0xf06,
142 MLX4_CMD_PROMISC = 0xf08,
143 MLX4_CMD_QUERY_FUNC_CAP = 0xf0a,
144 MLX4_CMD_QP_ATTACH = 0xf0b,
122 145
123 /* debug commands */ 146 /* debug commands */
124 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a, 147 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
@@ -126,6 +149,7 @@ enum {
126 149
127 /* statistics commands */ 150 /* statistics commands */
128 MLX4_CMD_QUERY_IF_STAT = 0X54, 151 MLX4_CMD_QUERY_IF_STAT = 0X54,
152 MLX4_CMD_SET_IF_STAT = 0X55,
129}; 153};
130 154
131enum { 155enum {
@@ -135,7 +159,8 @@ enum {
135}; 159};
136 160
137enum { 161enum {
138 MLX4_MAILBOX_SIZE = 4096 162 MLX4_MAILBOX_SIZE = 4096,
163 MLX4_ACCESS_MEM_ALIGN = 256,
139}; 164};
140 165
141enum { 166enum {
@@ -148,6 +173,11 @@ enum {
148 MLX4_SET_PORT_GID_TABLE = 0x5, 173 MLX4_SET_PORT_GID_TABLE = 0x5,
149}; 174};
150 175
176enum {
177 MLX4_CMD_WRAPPED,
178 MLX4_CMD_NATIVE
179};
180
151struct mlx4_dev; 181struct mlx4_dev;
152 182
153struct mlx4_cmd_mailbox { 183struct mlx4_cmd_mailbox {
@@ -157,23 +187,24 @@ struct mlx4_cmd_mailbox {
157 187
158int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param, 188int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
159 int out_is_imm, u32 in_modifier, u8 op_modifier, 189 int out_is_imm, u32 in_modifier, u8 op_modifier,
160 u16 op, unsigned long timeout); 190 u16 op, unsigned long timeout, int native);
161 191
162/* Invoke a command with no output parameter */ 192/* Invoke a command with no output parameter */
163static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier, 193static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier,
164 u8 op_modifier, u16 op, unsigned long timeout) 194 u8 op_modifier, u16 op, unsigned long timeout,
195 int native)
165{ 196{
166 return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier, 197 return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier,
167 op_modifier, op, timeout); 198 op_modifier, op, timeout, native);
168} 199}
169 200
170/* Invoke a command with an output mailbox */ 201/* Invoke a command with an output mailbox */
171static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param, 202static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param,
172 u32 in_modifier, u8 op_modifier, u16 op, 203 u32 in_modifier, u8 op_modifier, u16 op,
173 unsigned long timeout) 204 unsigned long timeout, int native)
174{ 205{
175 return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier, 206 return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier,
176 op_modifier, op, timeout); 207 op_modifier, op, timeout, native);
177} 208}
178 209
179/* 210/*
@@ -183,13 +214,17 @@ static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param
183 */ 214 */
184static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param, 215static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
185 u32 in_modifier, u8 op_modifier, u16 op, 216 u32 in_modifier, u8 op_modifier, u16 op,
186 unsigned long timeout) 217 unsigned long timeout, int native)
187{ 218{
188 return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier, 219 return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier,
189 op_modifier, op, timeout); 220 op_modifier, op, timeout, native);
190} 221}
191 222
192struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); 223struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
193void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); 224void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
194 225
226u32 mlx4_comm_get_version(void);
227
228#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
229
195#endif /* MLX4_CMD_H */ 230#endif /* MLX4_CMD_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 84b0b1848f17..5c4fe8e5bfe5 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -47,6 +47,9 @@
47enum { 47enum {
48 MLX4_FLAG_MSI_X = 1 << 0, 48 MLX4_FLAG_MSI_X = 1 << 0,
49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
50 MLX4_FLAG_MASTER = 1 << 2,
51 MLX4_FLAG_SLAVE = 1 << 3,
52 MLX4_FLAG_SRIOV = 1 << 4,
50}; 53};
51 54
52enum { 55enum {
@@ -58,6 +61,15 @@ enum {
58}; 61};
59 62
60enum { 63enum {
64 MLX4_MAX_NUM_PF = 16,
65 MLX4_MAX_NUM_VF = 64,
66 MLX4_MFUNC_MAX = 80,
67 MLX4_MFUNC_EQ_NUM = 4,
68 MLX4_MFUNC_MAX_EQES = 8,
69 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1)
70};
71
72enum {
61 MLX4_DEV_CAP_FLAG_RC = 1LL << 0, 73 MLX4_DEV_CAP_FLAG_RC = 1LL << 0,
62 MLX4_DEV_CAP_FLAG_UC = 1LL << 1, 74 MLX4_DEV_CAP_FLAG_UC = 1LL << 1,
63 MLX4_DEV_CAP_FLAG_UD = 1LL << 2, 75 MLX4_DEV_CAP_FLAG_UD = 1LL << 2,
@@ -77,11 +89,13 @@ enum {
77 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, 89 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30,
78 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, 90 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32,
79 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34, 91 MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34,
80 MLX4_DEV_CAP_FLAG_WOL = 1LL << 38, 92 MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37,
93 MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38,
81 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, 94 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40,
82 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 95 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
83 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 96 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
84 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48 97 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
85}; 99};
86 100
87#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
@@ -116,7 +130,11 @@ enum mlx4_event {
116 MLX4_EVENT_TYPE_PORT_CHANGE = 0x09, 130 MLX4_EVENT_TYPE_PORT_CHANGE = 0x09,
117 MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f, 131 MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f,
118 MLX4_EVENT_TYPE_ECC_DETECT = 0x0e, 132 MLX4_EVENT_TYPE_ECC_DETECT = 0x0e,
119 MLX4_EVENT_TYPE_CMD = 0x0a 133 MLX4_EVENT_TYPE_CMD = 0x0a,
134 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
135 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
136 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
137 MLX4_EVENT_TYPE_NONE = 0xff,
120}; 138};
121 139
122enum { 140enum {
@@ -183,6 +201,7 @@ enum mlx4_qp_region {
183}; 201};
184 202
185enum mlx4_port_type { 203enum mlx4_port_type {
204 MLX4_PORT_TYPE_NONE = 0,
186 MLX4_PORT_TYPE_IB = 1, 205 MLX4_PORT_TYPE_IB = 1,
187 MLX4_PORT_TYPE_ETH = 2, 206 MLX4_PORT_TYPE_ETH = 2,
188 MLX4_PORT_TYPE_AUTO = 3 207 MLX4_PORT_TYPE_AUTO = 3
@@ -215,6 +234,7 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
215 234
216struct mlx4_caps { 235struct mlx4_caps {
217 u64 fw_ver; 236 u64 fw_ver;
237 u32 function;
218 int num_ports; 238 int num_ports;
219 int vl_cap[MLX4_MAX_PORTS + 1]; 239 int vl_cap[MLX4_MAX_PORTS + 1];
220 int ib_mtu_cap[MLX4_MAX_PORTS + 1]; 240 int ib_mtu_cap[MLX4_MAX_PORTS + 1];
@@ -229,6 +249,7 @@ struct mlx4_caps {
229 u64 trans_code[MLX4_MAX_PORTS + 1]; 249 u64 trans_code[MLX4_MAX_PORTS + 1];
230 int local_ca_ack_delay; 250 int local_ca_ack_delay;
231 int num_uars; 251 int num_uars;
252 u32 uar_page_size;
232 int bf_reg_size; 253 int bf_reg_size;
233 int bf_regs_per_page; 254 int bf_regs_per_page;
234 int max_sq_sg; 255 int max_sq_sg;
@@ -252,8 +273,7 @@ struct mlx4_caps {
252 int num_comp_vectors; 273 int num_comp_vectors;
253 int comp_pool; 274 int comp_pool;
254 int num_mpts; 275 int num_mpts;
255 int num_mtt_segs; 276 int num_mtts;
256 int mtts_per_seg;
257 int fmr_reserved_mtts; 277 int fmr_reserved_mtts;
258 int reserved_mtts; 278 int reserved_mtts;
259 int reserved_mrws; 279 int reserved_mrws;
@@ -283,7 +303,9 @@ struct mlx4_caps {
283 int log_num_prios; 303 int log_num_prios;
284 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 304 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
285 u8 supported_type[MLX4_MAX_PORTS + 1]; 305 u8 supported_type[MLX4_MAX_PORTS + 1];
286 u32 port_mask; 306 u8 suggested_type[MLX4_MAX_PORTS + 1];
307 u8 default_sense[MLX4_MAX_PORTS + 1];
308 u32 port_mask[MLX4_MAX_PORTS + 1];
287 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 309 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
288 u32 max_counters; 310 u32 max_counters;
289 u8 ext_port_cap[MLX4_MAX_PORTS + 1]; 311 u8 ext_port_cap[MLX4_MAX_PORTS + 1];
@@ -303,7 +325,7 @@ struct mlx4_buf {
303}; 325};
304 326
305struct mlx4_mtt { 327struct mlx4_mtt {
306 u32 first_seg; 328 u32 offset;
307 int order; 329 int order;
308 int page_shift; 330 int page_shift;
309}; 331};
@@ -465,10 +487,12 @@ struct mlx4_counter {
465struct mlx4_dev { 487struct mlx4_dev {
466 struct pci_dev *pdev; 488 struct pci_dev *pdev;
467 unsigned long flags; 489 unsigned long flags;
490 unsigned long num_slaves;
468 struct mlx4_caps caps; 491 struct mlx4_caps caps;
469 struct radix_tree_root qp_table_tree; 492 struct radix_tree_root qp_table_tree;
470 u8 rev_id; 493 u8 rev_id;
471 char board_id[MLX4_BOARD_ID_LEN]; 494 char board_id[MLX4_BOARD_ID_LEN];
495 int num_vfs;
472}; 496};
473 497
474struct mlx4_init_port_param { 498struct mlx4_init_port_param {
@@ -487,14 +511,32 @@ struct mlx4_init_port_param {
487 511
488#define mlx4_foreach_port(port, dev, type) \ 512#define mlx4_foreach_port(port, dev, type) \
489 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 513 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
490 if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ 514 if ((type) == (dev)->caps.port_mask[(port)])
491 ~(dev)->caps.port_mask) & 1 << ((port) - 1))
492 515
493#define mlx4_foreach_ib_transport_port(port, dev) \ 516#define mlx4_foreach_ib_transport_port(port, dev) \
494 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 517 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
495 if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \ 518 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
496 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) 519 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
497 520
521static inline int mlx4_is_master(struct mlx4_dev *dev)
522{
523 return dev->flags & MLX4_FLAG_MASTER;
524}
525
526static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
527{
528 return (qpn < dev->caps.sqp_start + 8);
529}
530
531static inline int mlx4_is_mfunc(struct mlx4_dev *dev)
532{
533 return dev->flags & (MLX4_FLAG_SLAVE | MLX4_FLAG_MASTER);
534}
535
536static inline int mlx4_is_slave(struct mlx4_dev *dev)
537{
538 return dev->flags & MLX4_FLAG_SLAVE;
539}
498 540
499int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 541int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
500 struct mlx4_buf *buf); 542 struct mlx4_buf *buf);
@@ -560,6 +602,10 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm
560int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); 602int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
561int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 603int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
562 604
605int mlx4_unicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
606 int block_mcast_loopback, enum mlx4_protocol prot);
607int mlx4_unicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
608 enum mlx4_protocol prot);
563int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 609int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
564 int block_mcast_loopback, enum mlx4_protocol protocol); 610 int block_mcast_loopback, enum mlx4_protocol protocol);
565int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 611int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
@@ -570,9 +616,11 @@ int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
570int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); 616int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
571int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); 617int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
572 618
573int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap); 619int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
574void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn); 620void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
575int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap); 621int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn);
623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
576 624
577int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 625int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
578int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 626int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 48cc4cb97858..bee8fa231276 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -97,6 +97,33 @@ enum {
97 MLX4_QP_BIT_RIC = 1 << 4, 97 MLX4_QP_BIT_RIC = 1 << 4,
98}; 98};
99 99
100enum {
101 MLX4_RSS_HASH_XOR = 0,
102 MLX4_RSS_HASH_TOP = 1,
103
104 MLX4_RSS_UDP_IPV6 = 1 << 0,
105 MLX4_RSS_UDP_IPV4 = 1 << 1,
106 MLX4_RSS_TCP_IPV6 = 1 << 2,
107 MLX4_RSS_IPV6 = 1 << 3,
108 MLX4_RSS_TCP_IPV4 = 1 << 4,
109 MLX4_RSS_IPV4 = 1 << 5,
110
111 /* offset of mlx4_rss_context within mlx4_qp_context.pri_path */
112 MLX4_RSS_OFFSET_IN_QPC_PRI_PATH = 0x24,
113 /* offset of being RSS indirection QP within mlx4_qp_context.flags */
114 MLX4_RSS_QPC_FLAG_OFFSET = 13,
115};
116
117struct mlx4_rss_context {
118 __be32 base_qpn;
119 __be32 default_qpn;
120 u16 reserved;
121 u8 hash_fn;
122 u8 flags;
123 __be32 rss_key[10];
124 __be32 base_qpn_udp;
125};
126
100struct mlx4_qp_path { 127struct mlx4_qp_path {
101 u8 fl; 128 u8 fl;
102 u8 reserved1[2]; 129 u8 reserved1[2];
@@ -183,6 +210,7 @@ struct mlx4_wqe_ctrl_seg {
183 * [4] IP checksum 210 * [4] IP checksum
184 * [3:2] C (generate completion queue entry) 211 * [3:2] C (generate completion queue entry)
185 * [1] SE (solicited event) 212 * [1] SE (solicited event)
213 * [0] FL (force loopback)
186 */ 214 */
187 __be32 srcrb_flags; 215 __be32 srcrb_flags;
188 /* 216 /*
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 4baadd18f4ad..17b27cd269c4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1253,41 +1253,34 @@ static inline void pgtable_page_dtor(struct page *page)
1253extern void free_area_init(unsigned long * zones_size); 1253extern void free_area_init(unsigned long * zones_size);
1254extern void free_area_init_node(int nid, unsigned long * zones_size, 1254extern void free_area_init_node(int nid, unsigned long * zones_size,
1255 unsigned long zone_start_pfn, unsigned long *zholes_size); 1255 unsigned long zone_start_pfn, unsigned long *zholes_size);
1256#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 1256#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1257/* 1257/*
1258 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its 1258 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
1259 * zones, allocate the backing mem_map and account for memory holes in a more 1259 * zones, allocate the backing mem_map and account for memory holes in a more
1260 * architecture independent manner. This is a substitute for creating the 1260 * architecture independent manner. This is a substitute for creating the
1261 * zone_sizes[] and zholes_size[] arrays and passing them to 1261 * zone_sizes[] and zholes_size[] arrays and passing them to
1262 * free_area_init_node() 1262 * free_area_init_node()
1263 * 1263 *
1264 * An architecture is expected to register range of page frames backed by 1264 * An architecture is expected to register range of page frames backed by
1265 * physical memory with add_active_range() before calling 1265 * physical memory with memblock_add[_node]() before calling
1266 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic 1266 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
1267 * usage, an architecture is expected to do something like 1267 * usage, an architecture is expected to do something like
1268 * 1268 *
1269 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn, 1269 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
1270 * max_highmem_pfn}; 1270 * max_highmem_pfn};
1271 * for_each_valid_physical_page_range() 1271 * for_each_valid_physical_page_range()
1272 * add_active_range(node_id, start_pfn, end_pfn) 1272 * memblock_add_node(base, size, nid)
1273 * free_area_init_nodes(max_zone_pfns); 1273 * free_area_init_nodes(max_zone_pfns);
1274 * 1274 *
1275 * If the architecture guarantees that there are no holes in the ranges 1275 * free_bootmem_with_active_regions() calls free_bootmem_node() for each
1276 * registered with add_active_range(), free_bootmem_active_regions() 1276 * registered physical page range. Similarly
1277 * will call free_bootmem_node() for each registered physical page range. 1277 * sparse_memory_present_with_active_regions() calls memory_present() for
1278 * Similarly sparse_memory_present_with_active_regions() calls 1278 * each range when SPARSEMEM is enabled.
1279 * memory_present() for each range when SPARSEMEM is enabled.
1280 * 1279 *
1281 * See mm/page_alloc.c for more information on each function exposed by 1280 * See mm/page_alloc.c for more information on each function exposed by
1282 * CONFIG_ARCH_POPULATES_NODE_MAP 1281 * CONFIG_HAVE_MEMBLOCK_NODE_MAP.
1283 */ 1282 */
1284extern void free_area_init_nodes(unsigned long *max_zone_pfn); 1283extern void free_area_init_nodes(unsigned long *max_zone_pfn);
1285extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1286 unsigned long end_pfn);
1287extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1288 unsigned long end_pfn);
1289extern void remove_all_active_ranges(void);
1290void sort_node_map(void);
1291unsigned long node_map_pfn_alignment(void); 1284unsigned long node_map_pfn_alignment(void);
1292unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, 1285unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
1293 unsigned long end_pfn); 1286 unsigned long end_pfn);
@@ -1300,14 +1293,11 @@ extern void free_bootmem_with_active_regions(int nid,
1300 unsigned long max_low_pfn); 1293 unsigned long max_low_pfn);
1301int add_from_early_node_map(struct range *range, int az, 1294int add_from_early_node_map(struct range *range, int az,
1302 int nr_range, int nid); 1295 int nr_range, int nid);
1303u64 __init find_memory_core_early(int nid, u64 size, u64 align,
1304 u64 goal, u64 limit);
1305typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1306extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1307extern void sparse_memory_present_with_active_regions(int nid); 1296extern void sparse_memory_present_with_active_regions(int nid);
1308#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
1309 1297
1310#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ 1298#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
1299
1300#if !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) && \
1311 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) 1301 !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
1312static inline int __early_pfn_to_nid(unsigned long pfn) 1302static inline int __early_pfn_to_nid(unsigned long pfn)
1313{ 1303{
@@ -1492,6 +1482,18 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1492 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1482 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1493} 1483}
1494 1484
1485/* Look up the first VMA which exactly match the interval vm_start ... vm_end */
1486static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
1487 unsigned long vm_start, unsigned long vm_end)
1488{
1489 struct vm_area_struct *vma = find_vma(mm, vm_start);
1490
1491 if (vma && (vma->vm_start != vm_start || vma->vm_end != vm_end))
1492 vma = NULL;
1493
1494 return vma;
1495}
1496
1495#ifdef CONFIG_MMU 1497#ifdef CONFIG_MMU
1496pgprot_t vm_get_page_prot(unsigned long vm_flags); 1498pgprot_t vm_get_page_prot(unsigned long vm_flags);
1497#else 1499#else
@@ -1538,23 +1540,13 @@ static inline void vm_stat_account(struct mm_struct *mm,
1538#endif /* CONFIG_PROC_FS */ 1540#endif /* CONFIG_PROC_FS */
1539 1541
1540#ifdef CONFIG_DEBUG_PAGEALLOC 1542#ifdef CONFIG_DEBUG_PAGEALLOC
1541extern int debug_pagealloc_enabled;
1542
1543extern void kernel_map_pages(struct page *page, int numpages, int enable); 1543extern void kernel_map_pages(struct page *page, int numpages, int enable);
1544
1545static inline void enable_debug_pagealloc(void)
1546{
1547 debug_pagealloc_enabled = 1;
1548}
1549#ifdef CONFIG_HIBERNATION 1544#ifdef CONFIG_HIBERNATION
1550extern bool kernel_page_present(struct page *page); 1545extern bool kernel_page_present(struct page *page);
1551#endif /* CONFIG_HIBERNATION */ 1546#endif /* CONFIG_HIBERNATION */
1552#else 1547#else
1553static inline void 1548static inline void
1554kernel_map_pages(struct page *page, int numpages, int enable) {} 1549kernel_map_pages(struct page *page, int numpages, int enable) {}
1555static inline void enable_debug_pagealloc(void)
1556{
1557}
1558#ifdef CONFIG_HIBERNATION 1550#ifdef CONFIG_HIBERNATION
1559static inline bool kernel_page_present(struct page *page) { return true; } 1551static inline bool kernel_page_present(struct page *page) { return true; }
1560#endif /* CONFIG_HIBERNATION */ 1552#endif /* CONFIG_HIBERNATION */
@@ -1628,5 +1620,22 @@ extern void copy_user_huge_page(struct page *dst, struct page *src,
1628 unsigned int pages_per_huge_page); 1620 unsigned int pages_per_huge_page);
1629#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ 1621#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
1630 1622
1623#ifdef CONFIG_DEBUG_PAGEALLOC
1624extern unsigned int _debug_guardpage_minorder;
1625
1626static inline unsigned int debug_guardpage_minorder(void)
1627{
1628 return _debug_guardpage_minorder;
1629}
1630
1631static inline bool page_is_guard(struct page *page)
1632{
1633 return test_bit(PAGE_DEBUG_FLAG_GUARD, &page->debug_flags);
1634}
1635#else
1636static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1637static inline bool page_is_guard(struct page *page) { return false; }
1638#endif /* CONFIG_DEBUG_PAGEALLOC */
1639
1631#endif /* __KERNEL__ */ 1640#endif /* __KERNEL__ */
1632#endif /* _LINUX_MM_H */ 1641#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8f7d24712dc1..227fd3e9a9c9 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -22,26 +22,21 @@ static inline int page_is_file_cache(struct page *page)
22} 22}
23 23
24static inline void 24static inline void
25__add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l, 25add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
26 struct list_head *head)
27{ 26{
28 list_add(&page->lru, head); 27 struct lruvec *lruvec;
29 __mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page));
30 mem_cgroup_add_lru_list(page, l);
31}
32 28
33static inline void 29 lruvec = mem_cgroup_lru_add_list(zone, page, lru);
34add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) 30 list_add(&page->lru, &lruvec->lists[lru]);
35{ 31 __mod_zone_page_state(zone, NR_LRU_BASE + lru, hpage_nr_pages(page));
36 __add_page_to_lru_list(zone, page, l, &zone->lru[l].list);
37} 32}
38 33
39static inline void 34static inline void
40del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) 35del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
41{ 36{
37 mem_cgroup_lru_del_list(page, lru);
42 list_del(&page->lru); 38 list_del(&page->lru);
43 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); 39 __mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
44 mem_cgroup_del_lru_list(page, l);
45} 40}
46 41
47/** 42/**
@@ -59,24 +54,28 @@ static inline enum lru_list page_lru_base_type(struct page *page)
59 return LRU_INACTIVE_ANON; 54 return LRU_INACTIVE_ANON;
60} 55}
61 56
62static inline void 57/**
63del_page_from_lru(struct zone *zone, struct page *page) 58 * page_off_lru - which LRU list was page on? clearing its lru flags.
59 * @page: the page to test
60 *
61 * Returns the LRU list a page was on, as an index into the array of LRU
62 * lists; and clears its Unevictable or Active flags, ready for freeing.
63 */
64static inline enum lru_list page_off_lru(struct page *page)
64{ 65{
65 enum lru_list l; 66 enum lru_list lru;
66 67
67 list_del(&page->lru);
68 if (PageUnevictable(page)) { 68 if (PageUnevictable(page)) {
69 __ClearPageUnevictable(page); 69 __ClearPageUnevictable(page);
70 l = LRU_UNEVICTABLE; 70 lru = LRU_UNEVICTABLE;
71 } else { 71 } else {
72 l = page_lru_base_type(page); 72 lru = page_lru_base_type(page);
73 if (PageActive(page)) { 73 if (PageActive(page)) {
74 __ClearPageActive(page); 74 __ClearPageActive(page);
75 l += LRU_ACTIVE; 75 lru += LRU_ACTIVE;
76 } 76 }
77 } 77 }
78 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); 78 return lru;
79 mem_cgroup_del_lru_list(page, l);
80} 79}
81 80
82/** 81/**
@@ -97,7 +96,6 @@ static inline enum lru_list page_lru(struct page *page)
97 if (PageActive(page)) 96 if (PageActive(page))
98 lru += LRU_ACTIVE; 97 lru += LRU_ACTIVE;
99 } 98 }
100
101 return lru; 99 return lru;
102} 100}
103 101
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5b42f1b34eb7..3cc3062b3767 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -151,12 +151,11 @@ struct page {
151#endif 151#endif
152} 152}
153/* 153/*
154 * If another subsystem starts using the double word pairing for atomic 154 * The struct page can be forced to be double word aligned so that atomic ops
155 * operations on struct page then it must change the #if to ensure 155 * on double words work. The SLUB allocator can make use of such a feature.
156 * proper alignment of the page struct.
157 */ 156 */
158#if defined(CONFIG_SLUB) && defined(CONFIG_CMPXCHG_LOCAL) 157#ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE
159 __attribute__((__aligned__(2*sizeof(unsigned long)))) 158 __aligned(2 * sizeof(unsigned long))
160#endif 159#endif
161; 160;
162 161
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 415f2db414e1..9f22ba572de0 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -71,6 +71,8 @@ struct mmc_ext_csd {
71 bool hpi_en; /* HPI enablebit */ 71 bool hpi_en; /* HPI enablebit */
72 bool hpi; /* HPI support bit */ 72 bool hpi; /* HPI support bit */
73 unsigned int hpi_cmd; /* cmd used as HPI */ 73 unsigned int hpi_cmd; /* cmd used as HPI */
74 unsigned int boot_ro_lock; /* ro lock support */
75 bool boot_ro_lockable;
74 u8 raw_partition_support; /* 160 */ 76 u8 raw_partition_support; /* 160 */
75 u8 raw_erased_mem_count; /* 181 */ 77 u8 raw_erased_mem_count; /* 181 */
76 u8 raw_ext_csd_structure; /* 194 */ 78 u8 raw_ext_csd_structure; /* 194 */
@@ -110,6 +112,7 @@ struct sd_ssr {
110struct sd_switch_caps { 112struct sd_switch_caps {
111 unsigned int hs_max_dtr; 113 unsigned int hs_max_dtr;
112 unsigned int uhs_max_dtr; 114 unsigned int uhs_max_dtr;
115#define HIGH_SPEED_MAX_DTR 50000000
113#define UHS_SDR104_MAX_DTR 208000000 116#define UHS_SDR104_MAX_DTR 208000000
114#define UHS_SDR50_MAX_DTR 100000000 117#define UHS_SDR50_MAX_DTR 100000000
115#define UHS_DDR50_MAX_DTR 50000000 118#define UHS_DDR50_MAX_DTR 50000000
@@ -117,11 +120,13 @@ struct sd_switch_caps {
117#define UHS_SDR12_MAX_DTR 25000000 120#define UHS_SDR12_MAX_DTR 25000000
118 unsigned int sd3_bus_mode; 121 unsigned int sd3_bus_mode;
119#define UHS_SDR12_BUS_SPEED 0 122#define UHS_SDR12_BUS_SPEED 0
123#define HIGH_SPEED_BUS_SPEED 1
120#define UHS_SDR25_BUS_SPEED 1 124#define UHS_SDR25_BUS_SPEED 1
121#define UHS_SDR50_BUS_SPEED 2 125#define UHS_SDR50_BUS_SPEED 2
122#define UHS_SDR104_BUS_SPEED 3 126#define UHS_SDR104_BUS_SPEED 3
123#define UHS_DDR50_BUS_SPEED 4 127#define UHS_DDR50_BUS_SPEED 4
124 128
129#define SD_MODE_HIGH_SPEED (1 << HIGH_SPEED_BUS_SPEED)
125#define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED) 130#define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED)
126#define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED) 131#define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED)
127#define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED) 132#define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED)
@@ -184,6 +189,10 @@ struct mmc_part {
184 unsigned int part_cfg; /* partition type */ 189 unsigned int part_cfg; /* partition type */
185 char name[MAX_MMC_PART_NAME_LEN]; 190 char name[MAX_MMC_PART_NAME_LEN];
186 bool force_ro; /* to make boot parts RO by default */ 191 bool force_ro; /* to make boot parts RO by default */
192 unsigned int area_type;
193#define MMC_BLK_DATA_AREA_MAIN (1<<0)
194#define MMC_BLK_DATA_AREA_BOOT (1<<1)
195#define MMC_BLK_DATA_AREA_GP (1<<2)
187}; 196};
188 197
189/* 198/*
@@ -206,6 +215,8 @@ struct mmc_card {
206#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 215#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
207#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 216#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
208#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
219#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
209 unsigned int quirks; /* card quirks */ 220 unsigned int quirks; /* card quirks */
210#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 221#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
211#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 222#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -218,6 +229,7 @@ struct mmc_card {
218#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ 229#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
219#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ 230#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
220#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ 231#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
232#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
221 /* byte mode */ 233 /* byte mode */
222 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ 234 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
223#define MMC_NO_POWER_NOTIFICATION 0 235#define MMC_NO_POWER_NOTIFICATION 0
@@ -260,12 +272,14 @@ struct mmc_card {
260 * This function fill contents in mmc_part. 272 * This function fill contents in mmc_part.
261 */ 273 */
262static inline void mmc_part_add(struct mmc_card *card, unsigned int size, 274static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
263 unsigned int part_cfg, char *name, int idx, bool ro) 275 unsigned int part_cfg, char *name, int idx, bool ro,
276 int area_type)
264{ 277{
265 card->part[card->nr_parts].size = size; 278 card->part[card->nr_parts].size = size;
266 card->part[card->nr_parts].part_cfg = part_cfg; 279 card->part[card->nr_parts].part_cfg = part_cfg;
267 sprintf(card->part[card->nr_parts].name, name, idx); 280 sprintf(card->part[card->nr_parts].name, name, idx);
268 card->part[card->nr_parts].force_ro = ro; 281 card->part[card->nr_parts].force_ro = ro;
282 card->part[card->nr_parts].area_type = area_type;
269 card->nr_parts++; 283 card->nr_parts++;
270} 284}
271 285
@@ -361,18 +375,24 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
361#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 375#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
362#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 376#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
363#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 377#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
378#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
364#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 379#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
365#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 380#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
366#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 381#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
382#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
367#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 383#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
384#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
368 385
369#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 386#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
370#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 387#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
371#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 388#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
389#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
372#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 390#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
373#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) 391#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
392#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
374#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 393#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
375#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 394#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
395#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
376 396
377/* 397/*
378 * Quirk add/remove for MMC products. 398 * Quirk add/remove for MMC products.
@@ -433,6 +453,11 @@ static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
433 return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; 453 return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
434} 454}
435 455
456static inline int mmc_card_long_read_time(const struct mmc_card *c)
457{
458 return c->quirks & MMC_QUIRK_LONG_READ_TIME;
459}
460
436#define mmc_card_name(c) ((c)->cid.prod_name) 461#define mmc_card_name(c) ((c)->cid.prod_name)
437#define mmc_card_id(c) (dev_name(&(c)->dev)) 462#define mmc_card_id(c) (dev_name(&(c)->dev))
438 463
diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h
new file mode 100644
index 000000000000..a8e469783318
--- /dev/null
+++ b/include/linux/mmc/cd-gpio.h
@@ -0,0 +1,19 @@
1/*
2 * Generic GPIO card-detect helper header
3 *
4 * Copyright (C) 2011, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef MMC_CD_GPIO_H
12#define MMC_CD_GPIO_H
13
14struct mmc_host;
15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
16 unsigned int irq, unsigned long flags);
17void mmc_cd_gpio_free(struct mmc_host *host);
18
19#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 174a844a5dda..87a976cc5654 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -180,6 +180,8 @@ extern int mmc_try_claim_host(struct mmc_host *host);
180 180
181extern int mmc_flush_cache(struct mmc_card *); 181extern int mmc_flush_cache(struct mmc_card *);
182 182
183extern int mmc_detect_card_removed(struct mmc_host *host);
184
183/** 185/**
184 * mmc_claim_host - exclusively claim a host 186 * mmc_claim_host - exclusively claim a host
185 * @host: mmc host to claim 187 * @host: mmc host to claim
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 6dc9b80568a0..e8779c6d1759 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -214,6 +214,7 @@ struct dw_mci_board {
214 unsigned int bus_hz; /* Bus speed */ 214 unsigned int bus_hz; /* Bus speed */
215 215
216 unsigned int caps; /* Capabilities */ 216 unsigned int caps; /* Capabilities */
217 unsigned int caps2; /* More capabilities */
217 /* 218 /*
218 * Override fifo depth. If 0, autodetect it from the FIFOTH register, 219 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
219 * but note that this may not be reliable after a bootloader has used 220 * 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 a3ac9c48e5de..0beba1e5e1ed 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -56,10 +56,13 @@ struct mmc_ios {
56#define MMC_TIMING_UHS_SDR50 3 56#define MMC_TIMING_UHS_SDR50 3
57#define MMC_TIMING_UHS_SDR104 4 57#define MMC_TIMING_UHS_SDR104 4
58#define MMC_TIMING_UHS_DDR50 5 58#define MMC_TIMING_UHS_DDR50 5
59#define MMC_TIMING_MMC_HS200 6
59 60
60#define MMC_SDR_MODE 0 61#define MMC_SDR_MODE 0
61#define MMC_1_2V_DDR_MODE 1 62#define MMC_1_2V_DDR_MODE 1
62#define MMC_1_8V_DDR_MODE 2 63#define MMC_1_8V_DDR_MODE 2
64#define MMC_1_2V_SDR_MODE 3
65#define MMC_1_8V_SDR_MODE 4
63 66
64 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 67 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
65 68
@@ -148,7 +151,9 @@ struct mmc_host_ops {
148 void (*init_card)(struct mmc_host *host, struct mmc_card *card); 151 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
149 152
150 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 153 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
151 int (*execute_tuning)(struct mmc_host *host); 154
155 /* The tuning command opcode value is different for SD and eMMC cards */
156 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
152 void (*enable_preset_value)(struct mmc_host *host, bool enable); 157 void (*enable_preset_value)(struct mmc_host *host, bool enable);
153 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 158 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
154 void (*hw_reset)(struct mmc_host *host); 159 void (*hw_reset)(struct mmc_host *host);
@@ -167,6 +172,11 @@ struct mmc_async_req {
167 int (*err_check) (struct mmc_card *, struct mmc_async_req *); 172 int (*err_check) (struct mmc_card *, struct mmc_async_req *);
168}; 173};
169 174
175struct mmc_hotplug {
176 unsigned int irq;
177 void *handler_priv;
178};
179
170struct mmc_host { 180struct mmc_host {
171 struct device *parent; 181 struct device *parent;
172 struct device class_dev; 182 struct device class_dev;
@@ -242,6 +252,11 @@ struct mmc_host {
242#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 252#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
243#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 253#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
244#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 254#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
255#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
256#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
257#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
259 MMC_CAP2_HS200_1_2V_SDR)
245 260
246 mmc_pm_flag_t pm_caps; /* supported pm features */ 261 mmc_pm_flag_t pm_caps; /* supported pm features */
247 unsigned int power_notify_type; 262 unsigned int power_notify_type;
@@ -253,10 +268,12 @@ struct mmc_host {
253 int clk_requests; /* internal reference counter */ 268 int clk_requests; /* internal reference counter */
254 unsigned int clk_delay; /* number of MCI clk hold cycles */ 269 unsigned int clk_delay; /* number of MCI clk hold cycles */
255 bool clk_gated; /* clock gated */ 270 bool clk_gated; /* clock gated */
256 struct work_struct clk_gate_work; /* delayed clock gate */ 271 struct delayed_work clk_gate_work; /* delayed clock gate */
257 unsigned int clk_old; /* old clock value cache */ 272 unsigned int clk_old; /* old clock value cache */
258 spinlock_t clk_lock; /* lock for clk fields */ 273 spinlock_t clk_lock; /* lock for clk fields */
259 struct mutex clk_gate_mutex; /* mutex for clock gating */ 274 struct mutex clk_gate_mutex; /* mutex for clock gating */
275 struct device_attribute clkgate_delay_attr;
276 unsigned long clkgate_delay;
260#endif 277#endif
261 278
262 /* host specific block data */ 279 /* host specific block data */
@@ -297,6 +314,8 @@ struct mmc_host {
297 int claim_cnt; /* "claim" nesting count */ 314 int claim_cnt; /* "claim" nesting count */
298 315
299 struct delayed_work detect; 316 struct delayed_work detect;
317 int detect_change; /* card detect flag */
318 struct mmc_hotplug hotplug;
300 319
301 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 320 const struct mmc_bus_ops *bus_ops; /* current bus driver */
302 unsigned int bus_refs; /* reference counter */ 321 unsigned int bus_refs; /* reference counter */
@@ -323,6 +342,8 @@ struct mmc_host {
323 struct fault_attr fail_mmc_request; 342 struct fault_attr fail_mmc_request;
324#endif 343#endif
325 344
345 unsigned int actual_clock; /* Actual HC clock rate */
346
326 unsigned long private[0] ____cacheline_aligned; 347 unsigned long private[0] ____cacheline_aligned;
327}; 348};
328 349
@@ -396,7 +417,7 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
396} 417}
397 418
398/* Module parameter */ 419/* Module parameter */
399extern int mmc_assume_removable; 420extern bool mmc_assume_removable;
400 421
401static inline int mmc_card_is_removable(struct mmc_host *host) 422static inline int mmc_card_is_removable(struct mmc_host *host)
402{ 423{
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 0e7135697d11..fb9f6e116e1c 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -51,6 +51,7 @@
51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */ 51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */ 52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
54 55
55 /* class 3 */ 56 /* class 3 */
56#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
@@ -280,6 +281,7 @@ struct _mmc_csd {
280#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ 281#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
281#define EXT_CSD_SANITIZE_START 165 /* W */ 282#define EXT_CSD_SANITIZE_START 165 /* W */
282#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 283#define EXT_CSD_WR_REL_PARAM 166 /* RO */
284#define EXT_CSD_BOOT_WP 173 /* R/W */
283#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 285#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
284#define EXT_CSD_PART_CONFIG 179 /* R/W */ 286#define EXT_CSD_PART_CONFIG 179 /* R/W */
285#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 287#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
@@ -321,6 +323,11 @@ struct _mmc_csd {
321 323
322#define EXT_CSD_WR_REL_PARAM_EN (1<<2) 324#define EXT_CSD_WR_REL_PARAM_EN (1<<2)
323 325
326#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40)
327#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10)
328#define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04)
329#define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01)
330
324#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) 331#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7)
325#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) 332#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
326#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 333#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
@@ -333,13 +340,76 @@ struct _mmc_csd {
333 340
334#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 341#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
335#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 342#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
336#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */ 343#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */
337#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 344#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
338 /* DDR mode @1.8V or 3V I/O */ 345 /* DDR mode @1.8V or 3V I/O */
339#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 346#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
340 /* DDR mode @1.2V I/O */ 347 /* DDR mode @1.2V I/O */
341#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 348#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
342 | EXT_CSD_CARD_TYPE_DDR_1_2V) 349 | EXT_CSD_CARD_TYPE_DDR_1_2V)
350#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */
351#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
352 /* SDR mode @1.2V I/O */
353
354#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
355 EXT_CSD_CARD_TYPE_SDR_1_2V)
356
357#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
358 EXT_CSD_CARD_TYPE_52 | \
359 EXT_CSD_CARD_TYPE_26)
360
361#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
362 EXT_CSD_CARD_TYPE_52 | \
363 EXT_CSD_CARD_TYPE_26)
364
365#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
366 EXT_CSD_CARD_TYPE_52 | \
367 EXT_CSD_CARD_TYPE_26)
368
369#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
370 EXT_CSD_CARD_TYPE_DDR_1_8V | \
371 EXT_CSD_CARD_TYPE_52 | \
372 EXT_CSD_CARD_TYPE_26)
373
374#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
375 EXT_CSD_CARD_TYPE_DDR_1_8V | \
376 EXT_CSD_CARD_TYPE_52 | \
377 EXT_CSD_CARD_TYPE_26)
378
379#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
380 EXT_CSD_CARD_TYPE_DDR_1_2V | \
381 EXT_CSD_CARD_TYPE_52 | \
382 EXT_CSD_CARD_TYPE_26)
383
384#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
385 EXT_CSD_CARD_TYPE_DDR_1_2V | \
386 EXT_CSD_CARD_TYPE_52 | \
387 EXT_CSD_CARD_TYPE_26)
388
389#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
390 EXT_CSD_CARD_TYPE_DDR_52 | \
391 EXT_CSD_CARD_TYPE_52 | \
392 EXT_CSD_CARD_TYPE_26)
393
394#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
395 EXT_CSD_CARD_TYPE_DDR_52 | \
396 EXT_CSD_CARD_TYPE_52 | \
397 EXT_CSD_CARD_TYPE_26)
398
399#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
400 EXT_CSD_CARD_TYPE_DDR_1_8V | \
401 EXT_CSD_CARD_TYPE_52 | \
402 EXT_CSD_CARD_TYPE_26)
403
404#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
405 EXT_CSD_CARD_TYPE_DDR_1_2V | \
406 EXT_CSD_CARD_TYPE_52 | \
407 EXT_CSD_CARD_TYPE_26)
408
409#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
410 EXT_CSD_CARD_TYPE_DDR_52 | \
411 EXT_CSD_CARD_TYPE_52 | \
412 EXT_CSD_CARD_TYPE_26)
343 413
344#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 414#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
345#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 415#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
diff --git a/include/linux/mmc/sdhci-pci-data.h b/include/linux/mmc/sdhci-pci-data.h
new file mode 100644
index 000000000000..8959604a13d3
--- /dev/null
+++ b/include/linux/mmc/sdhci-pci-data.h
@@ -0,0 +1,18 @@
1#ifndef LINUX_MMC_SDHCI_PCI_DATA_H
2#define LINUX_MMC_SDHCI_PCI_DATA_H
3
4struct pci_dev;
5
6struct sdhci_pci_data {
7 struct pci_dev *pdev;
8 int slotno;
9 int rst_n_gpio; /* Set to -EINVAL if unused */
10 int cd_gpio; /* Set to -EINVAL if unused */
11 int (*setup)(struct sdhci_pci_data *data);
12 void (*cleanup)(struct sdhci_pci_data *data);
13};
14
15extern struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev,
16 int slotno);
17
18#endif
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e4b69353678d..c750f85177d9 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -90,8 +90,6 @@ struct sdhci_host {
90 90
91 unsigned int quirks2; /* More deviations from spec. */ 91 unsigned int quirks2; /* More deviations from spec. */
92 92
93#define SDHCI_QUIRK2_OWN_CARD_DETECTION (1<<0)
94
95 int irq; /* Device IRQ */ 93 int irq; /* Device IRQ */
96 void __iomem *ioaddr; /* Mapped address */ 94 void __iomem *ioaddr; /* Mapped address */
97 95
@@ -121,6 +119,7 @@ struct sdhci_host {
121#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 119#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
122#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 120#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
123#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 121#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
122#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */
124 123
125 unsigned int version; /* SDHCI spec. version */ 124 unsigned int version; /* SDHCI spec. version */
126 125
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index e0b1123497b9..c9fe66c58f8f 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -38,6 +38,7 @@
38 * [8:0] Byte/block count 38 * [8:0] Byte/block count
39 */ 39 */
40 40
41#define R4_18V_PRESENT (1<<24)
41#define R4_MEMORY_PRESENT (1 << 27) 42#define R4_MEMORY_PRESENT (1 << 27)
42 43
43/* 44/*
@@ -85,6 +86,7 @@
85#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */ 86#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
86#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */ 87#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
87#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */ 88#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
89#define SDIO_SD_REV_3_00 3 /* SD Physical Spev Version 3.00 */
88 90
89#define SDIO_CCCR_IOEx 0x02 91#define SDIO_CCCR_IOEx 0x02
90#define SDIO_CCCR_IORx 0x03 92#define SDIO_CCCR_IORx 0x03
@@ -134,8 +136,31 @@
134#define SDIO_CCCR_SPEED 0x13 136#define SDIO_CCCR_SPEED 0x13
135 137
136#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ 138#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
137#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ 139#define SDIO_SPEED_BSS_SHIFT 1
138 140#define SDIO_SPEED_BSS_MASK (7<<SDIO_SPEED_BSS_SHIFT)
141#define SDIO_SPEED_SDR12 (0<<SDIO_SPEED_BSS_SHIFT)
142#define SDIO_SPEED_SDR25 (1<<SDIO_SPEED_BSS_SHIFT)
143#define SDIO_SPEED_SDR50 (2<<SDIO_SPEED_BSS_SHIFT)
144#define SDIO_SPEED_SDR104 (3<<SDIO_SPEED_BSS_SHIFT)
145#define SDIO_SPEED_DDR50 (4<<SDIO_SPEED_BSS_SHIFT)
146#define SDIO_SPEED_EHS SDIO_SPEED_SDR25 /* Enable High-Speed */
147
148#define SDIO_CCCR_UHS 0x14
149#define SDIO_UHS_SDR50 0x01
150#define SDIO_UHS_SDR104 0x02
151#define SDIO_UHS_DDR50 0x04
152
153#define SDIO_CCCR_DRIVE_STRENGTH 0x15
154#define SDIO_SDTx_MASK 0x07
155#define SDIO_DRIVE_SDTA (1<<0)
156#define SDIO_DRIVE_SDTC (1<<1)
157#define SDIO_DRIVE_SDTD (1<<2)
158#define SDIO_DRIVE_DTSx_MASK 0x03
159#define SDIO_DRIVE_DTSx_SHIFT 4
160#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
161#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
162#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
163#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
139/* 164/*
140 * Function Basic Registers (FBR) 165 * Function Basic Registers (FBR)
141 */ 166 */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 188cb2ffe8db..650ba2fb3301 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -140,25 +140,29 @@ enum lru_list {
140 NR_LRU_LISTS 140 NR_LRU_LISTS
141}; 141};
142 142
143#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) 143#define for_each_lru(lru) for (lru = 0; lru < NR_LRU_LISTS; lru++)
144 144
145#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++) 145#define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
146 146
147static inline int is_file_lru(enum lru_list l) 147static inline int is_file_lru(enum lru_list lru)
148{ 148{
149 return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE); 149 return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
150} 150}
151 151
152static inline int is_active_lru(enum lru_list l) 152static inline int is_active_lru(enum lru_list lru)
153{ 153{
154 return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE); 154 return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
155} 155}
156 156
157static inline int is_unevictable_lru(enum lru_list l) 157static inline int is_unevictable_lru(enum lru_list lru)
158{ 158{
159 return (l == LRU_UNEVICTABLE); 159 return (lru == LRU_UNEVICTABLE);
160} 160}
161 161
162struct lruvec {
163 struct list_head lists[NR_LRU_LISTS];
164};
165
162/* Mask used at gathering information at once (see memcontrol.c) */ 166/* Mask used at gathering information at once (see memcontrol.c) */
163#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) 167#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))
164#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) 168#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))
@@ -173,6 +177,8 @@ static inline int is_unevictable_lru(enum lru_list l)
173#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4) 177#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4)
174/* Isolate unmapped file */ 178/* Isolate unmapped file */
175#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8) 179#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8)
180/* Isolate for asynchronous migration */
181#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x10)
176 182
177/* LRU Isolation modes. */ 183/* LRU Isolation modes. */
178typedef unsigned __bitwise__ isolate_mode_t; 184typedef unsigned __bitwise__ isolate_mode_t;
@@ -317,6 +323,12 @@ struct zone {
317 */ 323 */
318 unsigned long lowmem_reserve[MAX_NR_ZONES]; 324 unsigned long lowmem_reserve[MAX_NR_ZONES];
319 325
326 /*
327 * This is a per-zone reserve of pages that should not be
328 * considered dirtyable memory.
329 */
330 unsigned long dirty_balance_reserve;
331
320#ifdef CONFIG_NUMA 332#ifdef CONFIG_NUMA
321 int node; 333 int node;
322 /* 334 /*
@@ -358,10 +370,8 @@ struct zone {
358 ZONE_PADDING(_pad1_) 370 ZONE_PADDING(_pad1_)
359 371
360 /* Fields commonly accessed by the page reclaim scanner */ 372 /* Fields commonly accessed by the page reclaim scanner */
361 spinlock_t lru_lock; 373 spinlock_t lru_lock;
362 struct zone_lru { 374 struct lruvec lruvec;
363 struct list_head list;
364 } lru[NR_LRU_LISTS];
365 375
366 struct zone_reclaim_stat reclaim_stat; 376 struct zone_reclaim_stat reclaim_stat;
367 377
@@ -598,13 +608,13 @@ struct zonelist {
598#endif 608#endif
599}; 609};
600 610
601#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 611#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
602struct node_active_region { 612struct node_active_region {
603 unsigned long start_pfn; 613 unsigned long start_pfn;
604 unsigned long end_pfn; 614 unsigned long end_pfn;
605 int nid; 615 int nid;
606}; 616};
607#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 617#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
608 618
609#ifndef CONFIG_DISCONTIGMEM 619#ifndef CONFIG_DISCONTIGMEM
610/* The array of struct pages - for discontigmem use pgdat->lmem_map */ 620/* The array of struct pages - for discontigmem use pgdat->lmem_map */
@@ -720,7 +730,7 @@ extern int movable_zone;
720 730
721static inline int zone_movable_is_highmem(void) 731static inline int zone_movable_is_highmem(void)
722{ 732{
723#if defined(CONFIG_HIGHMEM) && defined(CONFIG_ARCH_POPULATES_NODE_MAP) 733#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE)
724 return movable_zone == ZONE_HIGHMEM; 734 return movable_zone == ZONE_HIGHMEM;
725#else 735#else
726 return 0; 736 return 0;
@@ -938,7 +948,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
938#endif 948#endif
939 949
940#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 950#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
941 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 951 !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
942static inline unsigned long early_pfn_to_nid(unsigned long pfn) 952static inline unsigned long early_pfn_to_nid(unsigned long pfn)
943{ 953{
944 return 0; 954 return 0;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 29304855652d..5a8e3903d770 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -2,39 +2,16 @@
2#define _NAMESPACE_H_ 2#define _NAMESPACE_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/path.h> 5struct mnt_namespace;
6#include <linux/seq_file.h>
7#include <linux/wait.h>
8
9struct mnt_namespace {
10 atomic_t count;
11 struct vfsmount * root;
12 struct list_head list;
13 wait_queue_head_t poll;
14 int event;
15};
16
17struct proc_mounts {
18 struct seq_file m; /* must be the first element */
19 struct mnt_namespace *ns;
20 struct path root;
21};
22
23struct fs_struct; 6struct fs_struct;
24 7
25extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
26extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 8extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
27 struct fs_struct *); 9 struct fs_struct *);
28extern void put_mnt_ns(struct mnt_namespace *ns); 10extern void put_mnt_ns(struct mnt_namespace *ns);
29static inline void get_mnt_ns(struct mnt_namespace *ns)
30{
31 atomic_inc(&ns->count);
32}
33 11
34extern const struct seq_operations mounts_op; 12extern const struct file_operations proc_mounts_operations;
35extern const struct seq_operations mountinfo_op; 13extern const struct file_operations proc_mountinfo_operations;
36extern const struct seq_operations mountstats_op; 14extern const struct file_operations proc_mountstats_operations;
37extern int mnt_had_events(struct proc_mounts *);
38 15
39#endif 16#endif
40#endif 17#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 468819cdde87..b29e7f6f8fa5 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -436,6 +436,17 @@ struct spi_device_id {
436 __attribute__((aligned(sizeof(kernel_ulong_t)))); 436 __attribute__((aligned(sizeof(kernel_ulong_t))));
437}; 437};
438 438
439/* mcp */
440
441#define MCP_NAME_SIZE 20
442#define MCP_MODULE_PREFIX "mcp:"
443
444struct mcp_device_id {
445 char name[MCP_NAME_SIZE];
446 kernel_ulong_t driver_data /* Data private to the driver */
447 __attribute__((aligned(sizeof(kernel_ulong_t))));
448};
449
439/* dmi */ 450/* dmi */
440enum dmi_field { 451enum dmi_field {
441 DMI_NONE, 452 DMI_NONE,
@@ -542,4 +553,22 @@ struct isapnp_device_id {
542 kernel_ulong_t driver_data; /* data private to the driver */ 553 kernel_ulong_t driver_data; /* data private to the driver */
543}; 554};
544 555
556/**
557 * struct amba_id - identifies a device on an AMBA bus
558 * @id: The significant bits if the hardware device ID
559 * @mask: Bitmask specifying which bits of the id field are significant when
560 * matching. A driver binds to a device when ((hardware device ID) & mask)
561 * == id.
562 * @data: Private data used by the driver.
563 */
564struct amba_id {
565 unsigned int id;
566 unsigned int mask;
567#ifndef __KERNEL__
568 kernel_ulong_t data;
569#else
570 void *data;
571#endif
572};
573
545#endif /* LINUX_MOD_DEVICETABLE_H */ 574#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 3cb7839a60b9..4598bf03e98b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -205,6 +205,20 @@ enum module_state
205 MODULE_STATE_GOING, 205 MODULE_STATE_GOING,
206}; 206};
207 207
208/**
209 * struct module_ref - per cpu module reference counts
210 * @incs: number of module get on this cpu
211 * @decs: number of module put on this cpu
212 *
213 * We force an alignment on 8 or 16 bytes, so that alloc_percpu()
214 * put @incs/@decs in same cache line, with no extra memory cost,
215 * since alloc_percpu() is fine grained.
216 */
217struct module_ref {
218 unsigned long incs;
219 unsigned long decs;
220} __attribute((aligned(2 * sizeof(unsigned long))));
221
208struct module 222struct module
209{ 223{
210 enum module_state state; 224 enum module_state state;
@@ -347,10 +361,7 @@ struct module
347 /* Destruction function. */ 361 /* Destruction function. */
348 void (*exit)(void); 362 void (*exit)(void);
349 363
350 struct module_ref { 364 struct module_ref __percpu *refptr;
351 unsigned int incs;
352 unsigned int decs;
353 } __percpu *refptr;
354#endif 365#endif
355 366
356#ifdef CONFIG_CONSTRUCTORS 367#ifdef CONFIG_CONSTRUCTORS
@@ -434,7 +445,7 @@ extern void __module_put_and_exit(struct module *mod, long code)
434#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); 445#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
435 446
436#ifdef CONFIG_MODULE_UNLOAD 447#ifdef CONFIG_MODULE_UNLOAD
437unsigned int module_refcount(struct module *mod); 448unsigned long module_refcount(struct module *mod);
438void __symbol_put(const char *symbol); 449void __symbol_put(const char *symbol);
439#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) 450#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
440void symbol_put_addr(void *addr); 451void symbol_put_addr(void *addr);
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 7939f636c8ba..c47f4d60db0b 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -350,23 +350,23 @@ extern int param_set_charp(const char *val, const struct kernel_param *kp);
350extern int param_get_charp(char *buffer, const struct kernel_param *kp); 350extern int param_get_charp(char *buffer, const struct kernel_param *kp);
351#define param_check_charp(name, p) __param_check(name, p, char *) 351#define param_check_charp(name, p) __param_check(name, p, char *)
352 352
353/* For historical reasons "bool" parameters can be (unsigned) "int". */ 353/* We used to allow int as well as bool. We're taking that away! */
354extern struct kernel_param_ops param_ops_bool; 354extern struct kernel_param_ops param_ops_bool;
355extern int param_set_bool(const char *val, const struct kernel_param *kp); 355extern int param_set_bool(const char *val, const struct kernel_param *kp);
356extern int param_get_bool(char *buffer, const struct kernel_param *kp); 356extern int param_get_bool(char *buffer, const struct kernel_param *kp);
357#define param_check_bool(name, p) \ 357#define param_check_bool(name, p) __param_check(name, p, bool)
358 static inline void __check_##name(void) \
359 { \
360 BUILD_BUG_ON(!__same_type((p), bool *) && \
361 !__same_type((p), unsigned int *) && \
362 !__same_type((p), int *)); \
363 }
364 358
365extern struct kernel_param_ops param_ops_invbool; 359extern struct kernel_param_ops param_ops_invbool;
366extern int param_set_invbool(const char *val, const struct kernel_param *kp); 360extern int param_set_invbool(const char *val, const struct kernel_param *kp);
367extern int param_get_invbool(char *buffer, const struct kernel_param *kp); 361extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
368#define param_check_invbool(name, p) __param_check(name, p, bool) 362#define param_check_invbool(name, p) __param_check(name, p, bool)
369 363
364/* An int, which can only be set like a bool (though it shows as an int). */
365extern struct kernel_param_ops param_ops_bint;
366extern int param_set_bint(const char *val, const struct kernel_param *kp);
367#define param_get_bint param_get_int
368#define param_check_bint param_check_int
369
370/** 370/**
371 * module_param_array - a parameter which is an array of some type 371 * module_param_array - a parameter which is an array of some type
372 * @name: the name of the array variable 372 * @name: the name of the array variable
@@ -395,6 +395,7 @@ extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
395 * module_param_named() for why this might be necessary. 395 * module_param_named() for why this might be necessary.
396 */ 396 */
397#define module_param_array_named(name, array, type, nump, perm) \ 397#define module_param_array_named(name, array, type, nump, perm) \
398 param_check_##type(name, &(array)[0]); \
398 static const struct kparam_array __param_arr_##name \ 399 static const struct kparam_array __param_arr_##name \
399 = { .max = ARRAY_SIZE(array), .num = nump, \ 400 = { .max = ARRAY_SIZE(array), .num = nump, \
400 .ops = &param_ops_##type, \ 401 .ops = &param_ops_##type, \
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 33fe53d78110..d7029f4a191a 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -47,45 +47,10 @@ struct mnt_namespace;
47 47
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50struct mnt_pcp {
51 int mnt_count;
52 int mnt_writers;
53};
54
55struct vfsmount { 50struct vfsmount {
56 struct list_head mnt_hash;
57 struct vfsmount *mnt_parent; /* fs we are mounted on */
58 struct dentry *mnt_mountpoint; /* dentry of mountpoint */
59 struct dentry *mnt_root; /* root of the mounted tree */ 51 struct dentry *mnt_root; /* root of the mounted tree */
60 struct super_block *mnt_sb; /* pointer to superblock */ 52 struct super_block *mnt_sb; /* pointer to superblock */
61#ifdef CONFIG_SMP
62 struct mnt_pcp __percpu *mnt_pcp;
63 atomic_t mnt_longterm; /* how many of the refs are longterm */
64#else
65 int mnt_count;
66 int mnt_writers;
67#endif
68 struct list_head mnt_mounts; /* list of children, anchored here */
69 struct list_head mnt_child; /* and going through their mnt_child */
70 int mnt_flags; 53 int mnt_flags;
71 /* 4 bytes hole on 64bits arches without fsnotify */
72#ifdef CONFIG_FSNOTIFY
73 __u32 mnt_fsnotify_mask;
74 struct hlist_head mnt_fsnotify_marks;
75#endif
76 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
77 struct list_head mnt_list;
78 struct list_head mnt_expire; /* link in fs-specific expiry list */
79 struct list_head mnt_share; /* circular list of shared mounts */
80 struct list_head mnt_slave_list;/* list of slave mounts */
81 struct list_head mnt_slave; /* slave list entry */
82 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
83 struct mnt_namespace *mnt_ns; /* containing namespace */
84 int mnt_id; /* mount identifier */
85 int mnt_group_id; /* peer group identifier */
86 int mnt_expiry_mark; /* true if marked for expiry */
87 int mnt_pinned;
88 int mnt_ghosts;
89}; 54};
90 55
91struct file; /* forward dec */ 56struct file; /* forward dec */
@@ -94,15 +59,13 @@ extern int mnt_want_write(struct vfsmount *mnt);
94extern int mnt_want_write_file(struct file *file); 59extern int mnt_want_write_file(struct file *file);
95extern int mnt_clone_write(struct vfsmount *mnt); 60extern int mnt_clone_write(struct vfsmount *mnt);
96extern void mnt_drop_write(struct vfsmount *mnt); 61extern void mnt_drop_write(struct vfsmount *mnt);
62extern void mnt_drop_write_file(struct file *file);
97extern void mntput(struct vfsmount *mnt); 63extern void mntput(struct vfsmount *mnt);
98extern struct vfsmount *mntget(struct vfsmount *mnt); 64extern struct vfsmount *mntget(struct vfsmount *mnt);
99extern void mnt_pin(struct vfsmount *mnt); 65extern void mnt_pin(struct vfsmount *mnt);
100extern void mnt_unpin(struct vfsmount *mnt); 66extern void mnt_unpin(struct vfsmount *mnt);
101extern int __mnt_is_readonly(struct vfsmount *mnt); 67extern int __mnt_is_readonly(struct vfsmount *mnt);
102 68
103extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
104 const char *name, void *data);
105
106struct file_system_type; 69struct file_system_type;
107extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 70extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
108 int flags, const char *name, 71 int flags, const char *name,
diff --git a/include/linux/mpi.h b/include/linux/mpi.h
new file mode 100644
index 000000000000..06f88994ccaa
--- /dev/null
+++ b/include/linux/mpi.h
@@ -0,0 +1,146 @@
1/* mpi.h - Multi Precision Integers
2 * Copyright (C) 1994, 1996, 1998, 1999,
3 * 2000, 2001 Free Software Foundation, Inc.
4 *
5 * This file is part of GNUPG.
6 *
7 * GNUPG 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 * GNUPG 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 * Note: This code is heavily based on the GNU MP Library.
22 * Actually it's the same code with only minor changes in the
23 * way the data is stored; this is to support the abstraction
24 * of an optional secure memory allocation which may be used
25 * to avoid revealing of sensitive data due to paging etc.
26 * The GNU MP Library itself is published under the LGPL;
27 * however I decided to publish this code under the plain GPL.
28 */
29
30#ifndef G10_MPI_H
31#define G10_MPI_H
32
33#include <linux/types.h>
34
35/* DSI defines */
36
37#define SHA1_DIGEST_LENGTH 20
38
39/*end of DSI defines */
40
41#define BYTES_PER_MPI_LIMB (BITS_PER_LONG / 8)
42#define BITS_PER_MPI_LIMB BITS_PER_LONG
43
44typedef unsigned long int mpi_limb_t;
45typedef signed long int mpi_limb_signed_t;
46
47struct gcry_mpi {
48 int alloced; /* array size (# of allocated limbs) */
49 int nlimbs; /* number of valid limbs */
50 int nbits; /* the real number of valid bits (info only) */
51 int sign; /* indicates a negative number */
52 unsigned flags; /* bit 0: array must be allocated in secure memory space */
53 /* bit 1: not used */
54 /* bit 2: the limb is a pointer to some m_alloced data */
55 mpi_limb_t *d; /* array with the limbs */
56};
57
58typedef struct gcry_mpi *MPI;
59
60#define MPI_NULL NULL
61
62#define mpi_get_nlimbs(a) ((a)->nlimbs)
63#define mpi_is_neg(a) ((a)->sign)
64
65/*-- mpiutil.c --*/
66MPI mpi_alloc(unsigned nlimbs);
67MPI mpi_alloc_secure(unsigned nlimbs);
68MPI mpi_alloc_like(MPI a);
69void mpi_free(MPI a);
70int mpi_resize(MPI a, unsigned nlimbs);
71int mpi_copy(MPI *copy, const MPI a);
72void mpi_clear(MPI a);
73int mpi_set(MPI w, MPI u);
74int mpi_set_ui(MPI w, ulong u);
75MPI mpi_alloc_set_ui(unsigned long u);
76void mpi_m_check(MPI a);
77void mpi_swap(MPI a, MPI b);
78
79/*-- mpicoder.c --*/
80MPI do_encode_md(const void *sha_buffer, unsigned nbits);
81MPI mpi_read_from_buffer(const void *buffer, unsigned *ret_nread);
82int mpi_fromstr(MPI val, const char *str);
83u32 mpi_get_keyid(MPI a, u32 *keyid);
84void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign);
85void *mpi_get_secure_buffer(MPI a, unsigned *nbytes, int *sign);
86int mpi_set_buffer(MPI a, const void *buffer, unsigned nbytes, int sign);
87
88#define log_mpidump g10_log_mpidump
89
90/*-- mpi-add.c --*/
91int mpi_add_ui(MPI w, MPI u, ulong v);
92int mpi_add(MPI w, MPI u, MPI v);
93int mpi_addm(MPI w, MPI u, MPI v, MPI m);
94int mpi_sub_ui(MPI w, MPI u, ulong v);
95int mpi_sub(MPI w, MPI u, MPI v);
96int mpi_subm(MPI w, MPI u, MPI v, MPI m);
97
98/*-- mpi-mul.c --*/
99int mpi_mul_ui(MPI w, MPI u, ulong v);
100int mpi_mul_2exp(MPI w, MPI u, ulong cnt);
101int mpi_mul(MPI w, MPI u, MPI v);
102int mpi_mulm(MPI w, MPI u, MPI v, MPI m);
103
104/*-- mpi-div.c --*/
105ulong mpi_fdiv_r_ui(MPI rem, MPI dividend, ulong divisor);
106int mpi_fdiv_r(MPI rem, MPI dividend, MPI divisor);
107int mpi_fdiv_q(MPI quot, MPI dividend, MPI divisor);
108int mpi_fdiv_qr(MPI quot, MPI rem, MPI dividend, MPI divisor);
109int mpi_tdiv_r(MPI rem, MPI num, MPI den);
110int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den);
111int mpi_tdiv_q_2exp(MPI w, MPI u, unsigned count);
112int mpi_divisible_ui(const MPI dividend, ulong divisor);
113
114/*-- mpi-gcd.c --*/
115int mpi_gcd(MPI g, const MPI a, const MPI b);
116
117/*-- mpi-pow.c --*/
118int mpi_pow(MPI w, MPI u, MPI v);
119int mpi_powm(MPI res, MPI base, MPI exp, MPI mod);
120
121/*-- mpi-mpow.c --*/
122int mpi_mulpowm(MPI res, MPI *basearray, MPI *exparray, MPI mod);
123
124/*-- mpi-cmp.c --*/
125int mpi_cmp_ui(MPI u, ulong v);
126int mpi_cmp(MPI u, MPI v);
127
128/*-- mpi-scan.c --*/
129int mpi_getbyte(MPI a, unsigned idx);
130void mpi_putbyte(MPI a, unsigned idx, int value);
131unsigned mpi_trailing_zeros(MPI a);
132
133/*-- mpi-bit.c --*/
134void mpi_normalize(MPI a);
135unsigned mpi_get_nbits(MPI a);
136int mpi_test_bit(MPI a, unsigned n);
137int mpi_set_bit(MPI a, unsigned n);
138int mpi_set_highbit(MPI a, unsigned n);
139void mpi_clear_highbit(MPI a, unsigned n);
140void mpi_clear_bit(MPI a, unsigned n);
141int mpi_rshift(MPI x, MPI a, unsigned n);
142
143/*-- mpi-inv.c --*/
144int mpi_invm(MPI x, MPI u, MPI v);
145
146#endif /*G10_MPI_H */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 05acced439a3..ce93a341337d 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -1,6 +1,7 @@
1#ifndef LINUX_MSI_H 1#ifndef LINUX_MSI_H
2#define LINUX_MSI_H 2#define LINUX_MSI_H
3 3
4#include <linux/kobject.h>
4#include <linux/list.h> 5#include <linux/list.h>
5 6
6struct msi_msg { 7struct msi_msg {
@@ -44,6 +45,8 @@ struct msi_desc {
44 45
45 /* Last set MSI message */ 46 /* Last set MSI message */
46 struct msi_msg msg; 47 struct msi_msg msg;
48
49 struct kobject kobj;
47}; 50};
48 51
49/* 52/*
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d24925492972..d5d2ec6494bb 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -354,10 +354,10 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf
354 onecmd = cmd; 354 onecmd = cmd;
355 break; 355 break;
356 case 2: 356 case 2:
357 onecmd = cpu_to_cfi16(cmd); 357 onecmd = cpu_to_cfi16(map, cmd);
358 break; 358 break;
359 case 4: 359 case 4:
360 onecmd = cpu_to_cfi32(cmd); 360 onecmd = cpu_to_cfi32(map, cmd);
361 break; 361 break;
362 } 362 }
363 363
@@ -437,10 +437,10 @@ static inline unsigned long cfi_merge_status(map_word val, struct map_info *map,
437 case 1: 437 case 1:
438 break; 438 break;
439 case 2: 439 case 2:
440 res = cfi16_to_cpu(res); 440 res = cfi16_to_cpu(map, res);
441 break; 441 break;
442 case 4: 442 case 4:
443 res = cfi32_to_cpu(res); 443 res = cfi32_to_cpu(map, res);
444 break; 444 break;
445 default: BUG(); 445 default: BUG();
446 } 446 }
@@ -480,12 +480,12 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr)
480 if (map_bankwidth_is_1(map)) { 480 if (map_bankwidth_is_1(map)) {
481 return val.x[0]; 481 return val.x[0];
482 } else if (map_bankwidth_is_2(map)) { 482 } else if (map_bankwidth_is_2(map)) {
483 return cfi16_to_cpu(val.x[0]); 483 return cfi16_to_cpu(map, val.x[0]);
484 } else { 484 } else {
485 /* No point in a 64-bit byteswap since that would just be 485 /* No point in a 64-bit byteswap since that would just be
486 swapping the responses from different chips, and we are 486 swapping the responses from different chips, and we are
487 only interested in one chip (a representative sample) */ 487 only interested in one chip (a representative sample) */
488 return cfi32_to_cpu(val.x[0]); 488 return cfi32_to_cpu(map, val.x[0]);
489 } 489 }
490} 490}
491 491
@@ -496,12 +496,12 @@ static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr)
496 if (map_bankwidth_is_1(map)) { 496 if (map_bankwidth_is_1(map)) {
497 return val.x[0] & 0xff; 497 return val.x[0] & 0xff;
498 } else if (map_bankwidth_is_2(map)) { 498 } else if (map_bankwidth_is_2(map)) {
499 return cfi16_to_cpu(val.x[0]); 499 return cfi16_to_cpu(map, val.x[0]);
500 } else { 500 } else {
501 /* No point in a 64-bit byteswap since that would just be 501 /* No point in a 64-bit byteswap since that would just be
502 swapping the responses from different chips, and we are 502 swapping the responses from different chips, and we are
503 only interested in one chip (a representative sample) */ 503 only interested in one chip (a representative sample) */
504 return cfi32_to_cpu(val.x[0]); 504 return cfi32_to_cpu(map, val.x[0]);
505 } 505 }
506} 506}
507 507
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index 51cc3f5917a8..b97a625071f8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -19,53 +19,35 @@
19 19
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21 21
22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#define CFI_HOST_ENDIAN 1
23 23#define CFI_LITTLE_ENDIAN 2
24#define CFI_HOST_ENDIAN 24#define CFI_BIG_ENDIAN 3
25 25
26#else 26#if !defined(CONFIG_MTD_CFI_ADV_OPTIONS) || defined(CONFIG_MTD_CFI_NOSWAP)
27 27#define CFI_DEFAULT_ENDIAN CFI_HOST_ENDIAN
28#ifdef CONFIG_MTD_CFI_NOSWAP 28#elif defined(CONFIG_MTD_CFI_LE_BYTE_SWAP)
29#define CFI_HOST_ENDIAN 29#define CFI_DEFAULT_ENDIAN CFI_LITTLE_ENDIAN
30#endif 30#elif defined(CONFIG_MTD_CFI_BE_BYTE_SWAP)
31 31#define CFI_DEFAULT_ENDIAN CFI_BIG_ENDIAN
32#ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP
33#define CFI_LITTLE_ENDIAN
34#endif
35
36#ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP
37#define CFI_BIG_ENDIAN
38#endif
39
40#endif
41
42#if defined(CFI_LITTLE_ENDIAN)
43#define cpu_to_cfi8(x) (x)
44#define cfi8_to_cpu(x) (x)
45#define cpu_to_cfi16(x) cpu_to_le16(x)
46#define cpu_to_cfi32(x) cpu_to_le32(x)
47#define cpu_to_cfi64(x) cpu_to_le64(x)
48#define cfi16_to_cpu(x) le16_to_cpu(x)
49#define cfi32_to_cpu(x) le32_to_cpu(x)
50#define cfi64_to_cpu(x) le64_to_cpu(x)
51#elif defined (CFI_BIG_ENDIAN)
52#define cpu_to_cfi8(x) (x)
53#define cfi8_to_cpu(x) (x)
54#define cpu_to_cfi16(x) cpu_to_be16(x)
55#define cpu_to_cfi32(x) cpu_to_be32(x)
56#define cpu_to_cfi64(x) cpu_to_be64(x)
57#define cfi16_to_cpu(x) be16_to_cpu(x)
58#define cfi32_to_cpu(x) be32_to_cpu(x)
59#define cfi64_to_cpu(x) be64_to_cpu(x)
60#elif defined (CFI_HOST_ENDIAN)
61#define cpu_to_cfi8(x) (x)
62#define cfi8_to_cpu(x) (x)
63#define cpu_to_cfi16(x) (x)
64#define cpu_to_cfi32(x) (x)
65#define cpu_to_cfi64(x) (x)
66#define cfi16_to_cpu(x) (x)
67#define cfi32_to_cpu(x) (x)
68#define cfi64_to_cpu(x) (x)
69#else 32#else
70#error No CFI endianness defined 33#error No CFI endianness defined
71#endif 34#endif
35
36#define cfi_default(s) ((s)?:CFI_DEFAULT_ENDIAN)
37#define cfi_be(s) (cfi_default(s) == CFI_BIG_ENDIAN)
38#define cfi_le(s) (cfi_default(s) == CFI_LITTLE_ENDIAN)
39#define cfi_host(s) (cfi_default(s) == CFI_HOST_ENDIAN)
40
41#define cpu_to_cfi8(map, x) (x)
42#define cfi8_to_cpu(map, x) (x)
43#define cpu_to_cfi16(map, x) _cpu_to_cfi(16, (map)->swap, (x))
44#define cpu_to_cfi32(map, x) _cpu_to_cfi(32, (map)->swap, (x))
45#define cpu_to_cfi64(map, x) _cpu_to_cfi(64, (map)->swap, (x))
46#define cfi16_to_cpu(map, x) _cfi_to_cpu(16, (map)->swap, (x))
47#define cfi32_to_cpu(map, x) _cfi_to_cpu(32, (map)->swap, (x))
48#define cfi64_to_cpu(map, x) _cfi_to_cpu(64, (map)->swap, (x))
49
50#define _cpu_to_cfi(w, s, x) (cfi_host(s)?(x):_swap_to_cfi(w, s, x))
51#define _cfi_to_cpu(w, s, x) (cfi_host(s)?(x):_swap_to_cpu(w, s, x))
52#define _swap_to_cfi(w, s, x) (cfi_be(s)?cpu_to_be##w(x):cpu_to_le##w(x))
53#define _swap_to_cpu(w, s, x) (cfi_be(s)?be##w##_to_cpu(x):le##w##_to_cpu(x))
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9e6ba46865e..94e924e2ecd5 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -26,7 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/string.h> 27#include <linux/string.h>
28#include <linux/bug.h> 28#include <linux/bug.h>
29 29#include <linux/kernel.h>
30 30
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32#include <asm/system.h> 32#include <asm/system.h>
@@ -214,6 +214,7 @@ struct map_info {
214 void __iomem *virt; 214 void __iomem *virt;
215 void *cached; 215 void *cached;
216 216
217 int swap; /* this mapping's byte-swapping requirement */
217 int bankwidth; /* in octets. This isn't necessarily the width 218 int bankwidth; /* in octets. This isn't necessarily the width
218 of actual bus cycles -- it's the repeat interval 219 of actual bus cycles -- it's the repeat interval
219 in bytes, before you are talking to the first chip again. 220 in bytes, before you are talking to the first chip again.
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9f5b312af783..1a81fde8f333 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -171,87 +171,60 @@ struct mtd_info {
171 struct mtd_erase_region_info *eraseregions; 171 struct mtd_erase_region_info *eraseregions;
172 172
173 /* 173 /*
174 * Erase is an asynchronous operation. Device drivers are supposed 174 * Do not call via these pointers, use corresponding mtd_*()
175 * to call instr->callback() whenever the operation completes, even 175 * wrappers instead.
176 * if it completes with a failure.
177 * Callers are supposed to pass a callback function and wait for it
178 * to be called before writing to the block.
179 */ 176 */
180 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 177 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
181
182 /* This stuff for eXecute-In-Place */
183 /* phys is optional and may be set to NULL */
184 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, 178 int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
185 size_t *retlen, void **virt, resource_size_t *phys); 179 size_t *retlen, void **virt, resource_size_t *phys);
186
187 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
188 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 180 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
189
190 /* Allow NOMMU mmap() to directly map the device (if not NULL)
191 * - return the address to which the offset maps
192 * - return -ENOSYS to indicate refusal to do the mapping
193 */
194 unsigned long (*get_unmapped_area) (struct mtd_info *mtd, 181 unsigned long (*get_unmapped_area) (struct mtd_info *mtd,
195 unsigned long len, 182 unsigned long len,
196 unsigned long offset, 183 unsigned long offset,
197 unsigned long flags); 184 unsigned long flags);
198 185 int (*read) (struct mtd_info *mtd, loff_t from, size_t len,
199 /* Backing device capabilities for this device 186 size_t *retlen, u_char *buf);
200 * - provides mmap capabilities 187 int (*write) (struct mtd_info *mtd, loff_t to, size_t len,
201 */ 188 size_t *retlen, const u_char *buf);
202 struct backing_dev_info *backing_dev_info; 189 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
203 190 size_t *retlen, const u_char *buf);
204
205 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
206 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
207
208 /* In blackbox flight recorder like scenarios we want to make successful
209 writes in interrupt context. panic_write() is only intended to be
210 called when its known the kernel is about to panic and we need the
211 write to succeed. Since the kernel is not going to be running for much
212 longer, this function can break locks and delay to ensure the write
213 succeeds (but not sleep). */
214
215 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
216
217 int (*read_oob) (struct mtd_info *mtd, loff_t from, 191 int (*read_oob) (struct mtd_info *mtd, loff_t from,
218 struct mtd_oob_ops *ops); 192 struct mtd_oob_ops *ops);
219 int (*write_oob) (struct mtd_info *mtd, loff_t to, 193 int (*write_oob) (struct mtd_info *mtd, loff_t to,
220 struct mtd_oob_ops *ops); 194 struct mtd_oob_ops *ops);
221 195 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
222 /* 196 size_t len);
223 * Methods to access the protection register area, present in some 197 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
224 * flash devices. The user data is one time programmable but the 198 size_t len, size_t *retlen, u_char *buf);
225 * factory data is read only. 199 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
226 */ 200 size_t len);
227 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 201 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
228 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 202 size_t len, size_t *retlen, u_char *buf);
229 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 203 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len,
230 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 204 size_t *retlen, u_char *buf);
231 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 205 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
232 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); 206 size_t len);
233 207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs,
234 /* kvec-based read/write methods. 208 unsigned long count, loff_t to, size_t *retlen);
235 NB: The 'count' parameter is the number of _vectors_, each of
236 which contains an (ofs, len) tuple.
237 */
238 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);
239
240 /* Sync */
241 void (*sync) (struct mtd_info *mtd); 209 void (*sync) (struct mtd_info *mtd);
242
243 /* Chip-supported device locking */
244 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
245 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
246 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 212 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
247 213 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
248 /* Power Management functions */ 214 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
249 int (*suspend) (struct mtd_info *mtd); 215 int (*suspend) (struct mtd_info *mtd);
250 void (*resume) (struct mtd_info *mtd); 216 void (*resume) (struct mtd_info *mtd);
217 /*
218 * If the driver is something smart, like UBI, it may need to maintain
219 * its own reference counting. The below functions are only for driver.
220 */
221 int (*get_device) (struct mtd_info *mtd);
222 void (*put_device) (struct mtd_info *mtd);
251 223
252 /* Bad block management functions */ 224 /* Backing device capabilities for this device
253 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 225 * - provides mmap capabilities
254 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 226 */
227 struct backing_dev_info *backing_dev_info;
255 228
256 struct notifier_block reboot_notifier; /* default mode before reboot */ 229 struct notifier_block reboot_notifier; /* default mode before reboot */
257 230
@@ -265,18 +238,218 @@ struct mtd_info {
265 struct module *owner; 238 struct module *owner;
266 struct device dev; 239 struct device dev;
267 int usecount; 240 int usecount;
268
269 /* If the driver is something smart, like UBI, it may need to maintain
270 * its own reference counting. The below functions are only for driver.
271 * The driver may register its callbacks. These callbacks are not
272 * supposed to be called by MTD users */
273 int (*get_device) (struct mtd_info *mtd);
274 void (*put_device) (struct mtd_info *mtd);
275}; 241};
276 242
277static inline struct mtd_info *dev_to_mtd(struct device *dev) 243/*
244 * Erase is an asynchronous operation. Device drivers are supposed
245 * to call instr->callback() whenever the operation completes, even
246 * if it completes with a failure.
247 * Callers are supposed to pass a callback function and wait for it
248 * to be called before writing to the block.
249 */
250static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
251{
252 return mtd->erase(mtd, instr);
253}
254
255/*
256 * This stuff for eXecute-In-Place. phys is optional and may be set to NULL.
257 */
258static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len,
259 size_t *retlen, void **virt, resource_size_t *phys)
260{
261 *retlen = 0;
262 if (!mtd->point)
263 return -EOPNOTSUPP;
264 return mtd->point(mtd, from, len, retlen, virt, phys);
265}
266
267/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
268static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
278{ 269{
279 return dev ? dev_get_drvdata(dev) : NULL; 270 return mtd->unpoint(mtd, from, len);
271}
272
273/*
274 * Allow NOMMU mmap() to directly map the device (if not NULL)
275 * - return the address to which the offset maps
276 * - return -ENOSYS to indicate refusal to do the mapping
277 */
278static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd,
279 unsigned long len,
280 unsigned long offset,
281 unsigned long flags)
282{
283 if (!mtd->get_unmapped_area)
284 return -EOPNOTSUPP;
285 return mtd->get_unmapped_area(mtd, len, offset, flags);
286}
287
288static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
289 size_t *retlen, u_char *buf)
290{
291 return mtd->read(mtd, from, len, retlen, buf);
292}
293
294static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
295 size_t *retlen, const u_char *buf)
296{
297 *retlen = 0;
298 if (!mtd->write)
299 return -EROFS;
300 return mtd->write(mtd, to, len, retlen, buf);
301}
302
303/*
304 * In blackbox flight recorder like scenarios we want to make successful writes
305 * in interrupt context. panic_write() is only intended to be called when its
306 * known the kernel is about to panic and we need the write to succeed. Since
307 * the kernel is not going to be running for much longer, this function can
308 * break locks and delay to ensure the write succeeds (but not sleep).
309 */
310static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
311 size_t *retlen, const u_char *buf)
312{
313 *retlen = 0;
314 if (!mtd->panic_write)
315 return -EOPNOTSUPP;
316 return mtd->panic_write(mtd, to, len, retlen, buf);
317}
318
319static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
320 struct mtd_oob_ops *ops)
321{
322 ops->retlen = ops->oobretlen = 0;
323 if (!mtd->read_oob)
324 return -EOPNOTSUPP;
325 return mtd->read_oob(mtd, from, ops);
326}
327
328static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
329 struct mtd_oob_ops *ops)
330{
331 ops->retlen = ops->oobretlen = 0;
332 if (!mtd->write_oob)
333 return -EOPNOTSUPP;
334 return mtd->write_oob(mtd, to, ops);
335}
336
337/*
338 * Method to access the protection register area, present in some flash
339 * devices. The user data is one time programmable but the factory data is read
340 * only.
341 */
342static inline int mtd_get_fact_prot_info(struct mtd_info *mtd,
343 struct otp_info *buf, size_t len)
344{
345 if (!mtd->get_fact_prot_info)
346 return -EOPNOTSUPP;
347 return mtd->get_fact_prot_info(mtd, buf, len);
348}
349
350static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
351 size_t len, size_t *retlen,
352 u_char *buf)
353{
354 *retlen = 0;
355 if (!mtd->read_fact_prot_reg)
356 return -EOPNOTSUPP;
357 return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf);
358}
359
360static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
361 struct otp_info *buf,
362 size_t len)
363{
364 if (!mtd->get_user_prot_info)
365 return -EOPNOTSUPP;
366 return mtd->get_user_prot_info(mtd, buf, len);
367}
368
369static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
370 size_t len, size_t *retlen,
371 u_char *buf)
372{
373 *retlen = 0;
374 if (!mtd->read_user_prot_reg)
375 return -EOPNOTSUPP;
376 return mtd->read_user_prot_reg(mtd, from, len, retlen, buf);
377}
378
379static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
380 size_t len, size_t *retlen,
381 u_char *buf)
382{
383 *retlen = 0;
384 if (!mtd->write_user_prot_reg)
385 return -EOPNOTSUPP;
386 return mtd->write_user_prot_reg(mtd, to, len, retlen, buf);
387}
388
389static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
390 size_t len)
391{
392 if (!mtd->lock_user_prot_reg)
393 return -EOPNOTSUPP;
394 return mtd->lock_user_prot_reg(mtd, from, len);
395}
396
397int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
398 unsigned long count, loff_t to, size_t *retlen);
399
400static inline void mtd_sync(struct mtd_info *mtd)
401{
402 if (mtd->sync)
403 mtd->sync(mtd);
404}
405
406/* Chip-supported device locking */
407static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
408{
409 if (!mtd->lock)
410 return -EOPNOTSUPP;
411 return mtd->lock(mtd, ofs, len);
412}
413
414static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
415{
416 if (!mtd->unlock)
417 return -EOPNOTSUPP;
418 return mtd->unlock(mtd, ofs, len);
419}
420
421static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
422{
423 if (!mtd->is_locked)
424 return -EOPNOTSUPP;
425 return mtd->is_locked(mtd, ofs, len);
426}
427
428static inline int mtd_suspend(struct mtd_info *mtd)
429{
430 if (!mtd->suspend)
431 return -EOPNOTSUPP;
432 return mtd->suspend(mtd);
433}
434
435static inline void mtd_resume(struct mtd_info *mtd)
436{
437 if (mtd->resume)
438 mtd->resume(mtd);
439}
440
441static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
442{
443 if (!mtd->block_isbad)
444 return -EOPNOTSUPP;
445 return mtd->block_isbad(mtd, ofs);
446}
447
448static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
449{
450 if (!mtd->block_markbad)
451 return -EOPNOTSUPP;
452 return mtd->block_markbad(mtd, ofs);
280} 453}
281 454
282static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) 455static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
@@ -309,6 +482,16 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
309 return do_div(sz, mtd->writesize); 482 return do_div(sz, mtd->writesize);
310} 483}
311 484
485static inline int mtd_has_oob(const struct mtd_info *mtd)
486{
487 return mtd->read_oob && mtd->write_oob;
488}
489
490static inline int mtd_can_have_bb(const struct mtd_info *mtd)
491{
492 return !!mtd->block_isbad;
493}
494
312 /* Kernel-side ioctl definitions */ 495 /* Kernel-side ioctl definitions */
313 496
314struct mtd_partition; 497struct mtd_partition;
@@ -338,13 +521,6 @@ struct mtd_notifier {
338 521
339extern void register_mtd_user (struct mtd_notifier *new); 522extern void register_mtd_user (struct mtd_notifier *new);
340extern int unregister_mtd_user (struct mtd_notifier *old); 523extern int unregister_mtd_user (struct mtd_notifier *old);
341
342int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
343 unsigned long count, loff_t to, size_t *retlen);
344
345int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
346 unsigned long count, loff_t from, size_t *retlen);
347
348void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); 524void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
349 525
350void mtd_erase_callback(struct erase_info *instr); 526void mtd_erase_callback(struct erase_info *instr);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 904131bab501..63b5a8b6dfbd 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -555,6 +555,7 @@ struct nand_chip {
555#define NAND_MFR_HYNIX 0xad 555#define NAND_MFR_HYNIX 0xad
556#define NAND_MFR_MICRON 0x2c 556#define NAND_MFR_MICRON 0x2c
557#define NAND_MFR_AMD 0x01 557#define NAND_MFR_AMD 0x01
558#define NAND_MFR_MACRONIX 0xc2
558 559
559/** 560/**
560 * struct nand_flash_dev - NAND Flash Device ID Structure 561 * struct nand_flash_dev - NAND Flash Device ID Structure
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 04e018160e2b..d2887e76b7f6 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -30,6 +30,7 @@ struct physmap_flash_data {
30 unsigned int pfow_base; 30 unsigned int pfow_base;
31 char *probe_type; 31 char *probe_type;
32 struct mtd_partition *parts; 32 struct mtd_partition *parts;
33 const char **part_probe_types;
33}; 34};
34 35
35#endif /* __LINUX_MTD_PHYSMAP__ */ 36#endif /* __LINUX_MTD_PHYSMAP__ */
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index a7003b7a695d..b188f68a08c9 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -116,6 +116,7 @@ enum {
116 NDTPA_PROXY_DELAY, /* u64, msecs */ 116 NDTPA_PROXY_DELAY, /* u64, msecs */
117 NDTPA_PROXY_QLEN, /* u32 */ 117 NDTPA_PROXY_QLEN, /* u32 */
118 NDTPA_LOCKTIME, /* u64, msecs */ 118 NDTPA_LOCKTIME, /* u64, msecs */
119 NDTPA_QUEUE_LENBYTES, /* u32 */
119 __NDTPA_MAX 120 __NDTPA_MAX
120}; 121};
121#define NDTPA_MAX (__NDTPA_MAX - 1) 122#define NDTPA_MAX (__NDTPA_MAX - 1)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
new file mode 100644
index 000000000000..77f5202977ce
--- /dev/null
+++ b/include/linux/netdev_features.h
@@ -0,0 +1,146 @@
1/*
2 * Network device features.
3 *
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10#ifndef _LINUX_NETDEV_FEATURES_H
11#define _LINUX_NETDEV_FEATURES_H
12
13#include <linux/types.h>
14
15typedef u64 netdev_features_t;
16
17enum {
18 NETIF_F_SG_BIT, /* Scatter/gather IO. */
19 NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */
20 __UNUSED_NETIF_F_1,
21 NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */
22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
25 NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */
26 NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */
27 NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */
28 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
29 NETIF_F_GSO_BIT, /* Enable software GSO. */
30 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
31 /* do not use LLTX in new drivers */
32 NETIF_F_NETNS_LOCAL_BIT, /* Does not change network namespaces */
33 NETIF_F_GRO_BIT, /* Generic receive offload */
34 NETIF_F_LRO_BIT, /* large receive offload */
35
36 /**/NETIF_F_GSO_SHIFT, /* keep the order of SKB_GSO_* bits */
37 NETIF_F_TSO_BIT /* ... TCPv4 segmentation */
38 = NETIF_F_GSO_SHIFT,
39 NETIF_F_UFO_BIT, /* ... UDPv4 fragmentation */
40 NETIF_F_GSO_ROBUST_BIT, /* ... ->SKB_GSO_DODGY */
41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */
45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
47 = NETIF_F_GSO_LAST,
48
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
51 NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
52 NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
53 NETIF_F_RXHASH_BIT, /* Receive hashing offload */
54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */
57
58 /*
59 * Add your fresh new feature above and remember to update
60 * netdev_features_strings[] in net/core/ethtool.c and maybe
61 * some feature mask #defines below. Please also describe it
62 * in Documentation/networking/netdev-features.txt.
63 */
64
65 /**/NETDEV_FEATURE_COUNT
66};
67
68/* copy'n'paste compression ;) */
69#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit))
70#define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
71
72#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC)
73#define NETIF_F_FCOE_MTU __NETIF_F(FCOE_MTU)
74#define NETIF_F_FRAGLIST __NETIF_F(FRAGLIST)
75#define NETIF_F_FSO __NETIF_F(FSO)
76#define NETIF_F_GRO __NETIF_F(GRO)
77#define NETIF_F_GSO __NETIF_F(GSO)
78#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST)
79#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA)
80#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM)
81#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER)
82#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX)
83#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX)
84#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM)
85#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM)
86#define NETIF_F_LLTX __NETIF_F(LLTX)
87#define NETIF_F_LOOPBACK __NETIF_F(LOOPBACK)
88#define NETIF_F_LRO __NETIF_F(LRO)
89#define NETIF_F_NETNS_LOCAL __NETIF_F(NETNS_LOCAL)
90#define NETIF_F_NOCACHE_COPY __NETIF_F(NOCACHE_COPY)
91#define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
92#define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
93#define NETIF_F_RXHASH __NETIF_F(RXHASH)
94#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM)
95#define NETIF_F_SG __NETIF_F(SG)
96#define NETIF_F_TSO6 __NETIF_F(TSO6)
97#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN)
98#define NETIF_F_TSO __NETIF_F(TSO)
99#define NETIF_F_UFO __NETIF_F(UFO)
100#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
101
102/* Features valid for ethtool to change */
103/* = all defined minus driver/device-class-related */
104#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
105 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
106
107/* remember that ((t)1 << t_BITS) is undefined in C99 */
108#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \
109 (__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \
110 ~NETIF_F_NEVER_CHANGE)
111
112/* Segmentation offload feature mask */
113#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
114 __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
115
116/* List of features with software fallbacks. */
117#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
118 NETIF_F_TSO6 | NETIF_F_UFO)
119
120#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM
121#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
122#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
123#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
124
125#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
126
127#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
128 NETIF_F_FSO)
129
130/*
131 * If one device supports one of these features, then enable them
132 * for all in netdev_increment_features.
133 */
134#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
135 NETIF_F_SG | NETIF_F_HIGHDMA | \
136 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
137/*
138 * If one device doesn't support one of these features, then disable it
139 * for all in netdev_increment_features.
140 */
141#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
142
143/* changeable features with no special hardware requirements */
144#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
145
146#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a82ad4dd306a..0eac07c95255 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,7 @@
43#include <linux/rculist.h> 43#include <linux/rculist.h>
44#include <linux/dmaengine.h> 44#include <linux/dmaengine.h>
45#include <linux/workqueue.h> 45#include <linux/workqueue.h>
46#include <linux/dynamic_queue_limits.h>
46 47
47#include <linux/ethtool.h> 48#include <linux/ethtool.h>
48#include <net/net_namespace.h> 49#include <net/net_namespace.h>
@@ -50,8 +51,10 @@
50#ifdef CONFIG_DCB 51#ifdef CONFIG_DCB
51#include <net/dcbnl.h> 52#include <net/dcbnl.h>
52#endif 53#endif
54#include <net/netprio_cgroup.h>
55
56#include <linux/netdev_features.h>
53 57
54struct vlan_group;
55struct netpoll_info; 58struct netpoll_info;
56struct phy_device; 59struct phy_device;
57/* 802.11 specific */ 60/* 802.11 specific */
@@ -141,22 +144,20 @@ static inline bool dev_xmit_complete(int rc)
141 * used. 144 * used.
142 */ 145 */
143 146
144#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 147#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
145# if defined(CONFIG_MAC80211_MESH) 148# if defined(CONFIG_MAC80211_MESH)
146# define LL_MAX_HEADER 128 149# define LL_MAX_HEADER 128
147# else 150# else
148# define LL_MAX_HEADER 96 151# define LL_MAX_HEADER 96
149# endif 152# endif
150#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE) 153#elif IS_ENABLED(CONFIG_TR)
151# define LL_MAX_HEADER 48 154# define LL_MAX_HEADER 48
152#else 155#else
153# define LL_MAX_HEADER 32 156# define LL_MAX_HEADER 32
154#endif 157#endif
155 158
156#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \ 159#if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \
157 !defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \ 160 !IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL)
158 !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
159 !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
160#define MAX_HEADER LL_MAX_HEADER 161#define MAX_HEADER LL_MAX_HEADER
161#else 162#else
162#define MAX_HEADER (LL_MAX_HEADER + 48) 163#define MAX_HEADER (LL_MAX_HEADER + 48)
@@ -212,6 +213,11 @@ enum {
212#include <linux/cache.h> 213#include <linux/cache.h>
213#include <linux/skbuff.h> 214#include <linux/skbuff.h>
214 215
216#ifdef CONFIG_RPS
217#include <linux/jump_label.h>
218extern struct jump_label_key rps_needed;
219#endif
220
215struct neighbour; 221struct neighbour;
216struct neigh_parms; 222struct neigh_parms;
217struct sk_buff; 223struct sk_buff;
@@ -272,16 +278,11 @@ struct hh_cache {
272 * 278 *
273 * We could use other alignment values, but we must maintain the 279 * We could use other alignment values, but we must maintain the
274 * relationship HH alignment <= LL alignment. 280 * relationship HH alignment <= LL alignment.
275 *
276 * LL_ALLOCATED_SPACE also takes into account the tailroom the device
277 * may need.
278 */ 281 */
279#define LL_RESERVED_SPACE(dev) \ 282#define LL_RESERVED_SPACE(dev) \
280 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 283 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
281#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 284#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
282 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 285 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
283#define LL_ALLOCATED_SPACE(dev) \
284 ((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
285 286
286struct header_ops { 287struct header_ops {
287 int (*create) (struct sk_buff *skb, struct net_device *dev, 288 int (*create) (struct sk_buff *skb, struct net_device *dev,
@@ -516,11 +517,23 @@ static inline void napi_synchronize(const struct napi_struct *n)
516#endif 517#endif
517 518
518enum netdev_queue_state_t { 519enum netdev_queue_state_t {
519 __QUEUE_STATE_XOFF, 520 __QUEUE_STATE_DRV_XOFF,
521 __QUEUE_STATE_STACK_XOFF,
520 __QUEUE_STATE_FROZEN, 522 __QUEUE_STATE_FROZEN,
521#define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \ 523#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
522 (1 << __QUEUE_STATE_FROZEN)) 524 (1 << __QUEUE_STATE_STACK_XOFF))
525#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
526 (1 << __QUEUE_STATE_FROZEN))
523}; 527};
528/*
529 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
530 * netif_tx_* functions below are used to manipulate this flag. The
531 * __QUEUE_STATE_STACK_XOFF flag is used by the stack to stop the transmit
532 * queue independently. The netif_xmit_*stopped functions below are called
533 * to check if the queue has been stopped by the driver or stack (either
534 * of the XOFF bits are set in the state). Drivers should not need to call
535 * netif_xmit*stopped functions, they should only be using netif_tx_*.
536 */
524 537
525struct netdev_queue { 538struct netdev_queue {
526/* 539/*
@@ -528,9 +541,8 @@ struct netdev_queue {
528 */ 541 */
529 struct net_device *dev; 542 struct net_device *dev;
530 struct Qdisc *qdisc; 543 struct Qdisc *qdisc;
531 unsigned long state;
532 struct Qdisc *qdisc_sleeping; 544 struct Qdisc *qdisc_sleeping;
533#if defined(CONFIG_RPS) || defined(CONFIG_XPS) 545#ifdef CONFIG_SYSFS
534 struct kobject kobj; 546 struct kobject kobj;
535#endif 547#endif
536#if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 548#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
@@ -545,6 +557,18 @@ struct netdev_queue {
545 * please use this field instead of dev->trans_start 557 * please use this field instead of dev->trans_start
546 */ 558 */
547 unsigned long trans_start; 559 unsigned long trans_start;
560
561 /*
562 * Number of TX timeouts for this queue
563 * (/sys/class/net/DEV/Q/trans_timeout)
564 */
565 unsigned long trans_timeout;
566
567 unsigned long state;
568
569#ifdef CONFIG_BQL
570 struct dql dql;
571#endif
548} ____cacheline_aligned_in_smp; 572} ____cacheline_aligned_in_smp;
549 573
550static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 574static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -573,7 +597,7 @@ struct rps_map {
573 struct rcu_head rcu; 597 struct rcu_head rcu;
574 u16 cpus[0]; 598 u16 cpus[0];
575}; 599};
576#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 600#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))
577 601
578/* 602/*
579 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the 603 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the
@@ -597,7 +621,7 @@ struct rps_dev_flow_table {
597 struct rps_dev_flow flows[0]; 621 struct rps_dev_flow flows[0];
598}; 622};
599#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ 623#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
600 (_num * sizeof(struct rps_dev_flow))) 624 ((_num) * sizeof(struct rps_dev_flow)))
601 625
602/* 626/*
603 * The rps_sock_flow_table contains mappings of flows to the last CPU 627 * The rps_sock_flow_table contains mappings of flows to the last CPU
@@ -608,7 +632,7 @@ struct rps_sock_flow_table {
608 u16 ents[0]; 632 u16 ents[0];
609}; 633};
610#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \ 634#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
611 (_num * sizeof(u16))) 635 ((_num) * sizeof(u16)))
612 636
613#define RPS_NO_CPU 0xffff 637#define RPS_NO_CPU 0xffff
614 638
@@ -660,7 +684,7 @@ struct xps_map {
660 struct rcu_head rcu; 684 struct rcu_head rcu;
661 u16 queues[0]; 685 u16 queues[0];
662}; 686};
663#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16))) 687#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
664#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \ 688#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
665 / sizeof(u16)) 689 / sizeof(u16))
666 690
@@ -683,6 +707,23 @@ struct netdev_tc_txq {
683 u16 offset; 707 u16 offset;
684}; 708};
685 709
710#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
711/*
712 * This structure is to hold information about the device
713 * configured to run FCoE protocol stack.
714 */
715struct netdev_fcoe_hbainfo {
716 char manufacturer[64];
717 char serial_number[64];
718 char hardware_version[64];
719 char driver_version[64];
720 char optionrom_version[64];
721 char firmware_version[64];
722 char model[256];
723 char model_description[256];
724};
725#endif
726
686/* 727/*
687 * This structure defines the management hooks for network devices. 728 * This structure defines the management hooks for network devices.
688 * The following hooks can be defined; unless noted otherwise, they are 729 * The following hooks can be defined; unless noted otherwise, they are
@@ -767,11 +808,11 @@ struct netdev_tc_txq {
767 * 3. Update dev->stats asynchronously and atomically, and define 808 * 3. Update dev->stats asynchronously and atomically, and define
768 * neither operation. 809 * neither operation.
769 * 810 *
770 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 811 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
771 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 812 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
772 * this function is called when a VLAN id is registered. 813 * this function is called when a VLAN id is registered.
773 * 814 *
774 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 815 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
775 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 816 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
776 * this function is called when a VLAN id is unregistered. 817 * this function is called when a VLAN id is unregistered.
777 * 818 *
@@ -823,6 +864,13 @@ struct netdev_tc_txq {
823 * perform necessary setup and returns 1 to indicate the device is set up 864 * perform necessary setup and returns 1 to indicate the device is set up
824 * successfully to perform DDP on this I/O, otherwise this returns 0. 865 * successfully to perform DDP on this I/O, otherwise this returns 0.
825 * 866 *
867 * int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
868 * struct netdev_fcoe_hbainfo *hbainfo);
869 * Called when the FCoE Protocol stack wants information on the underlying
870 * device. This information is utilized by the FCoE protocol stack to
871 * register attributes with Fiber Channel management service as per the
872 * FC-GS Fabric Device Management Information(FDMI) specification.
873 *
826 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type); 874 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
827 * Called when the underlying device wants to override default World Wide 875 * Called when the underlying device wants to override default World Wide
828 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own 876 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own
@@ -845,12 +893,13 @@ struct netdev_tc_txq {
845 * Called to release previously enslaved netdev. 893 * Called to release previously enslaved netdev.
846 * 894 *
847 * Feature/offload setting functions. 895 * Feature/offload setting functions.
848 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); 896 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
897 * netdev_features_t features);
849 * Adjusts the requested feature flags according to device-specific 898 * Adjusts the requested feature flags according to device-specific
850 * constraints, and returns the resulting flags. Must not modify 899 * constraints, and returns the resulting flags. Must not modify
851 * the device state. 900 * the device state.
852 * 901 *
853 * int (*ndo_set_features)(struct net_device *dev, u32 features); 902 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
854 * Called to update device configuration to new features. Passed 903 * Called to update device configuration to new features. Passed
855 * feature set might be less than what was returned by ndo_fix_features()). 904 * feature set might be less than what was returned by ndo_fix_features()).
856 * Must return >0 or -errno if it changed dev->features itself. 905 * Must return >0 or -errno if it changed dev->features itself.
@@ -885,9 +934,9 @@ struct net_device_ops {
885 struct rtnl_link_stats64 *storage); 934 struct rtnl_link_stats64 *storage);
886 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 935 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
887 936
888 void (*ndo_vlan_rx_add_vid)(struct net_device *dev, 937 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
889 unsigned short vid); 938 unsigned short vid);
890 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 939 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
891 unsigned short vid); 940 unsigned short vid);
892#ifdef CONFIG_NET_POLL_CONTROLLER 941#ifdef CONFIG_NET_POLL_CONTROLLER
893 void (*ndo_poll_controller)(struct net_device *dev); 942 void (*ndo_poll_controller)(struct net_device *dev);
@@ -912,7 +961,7 @@ struct net_device_ops {
912 int (*ndo_get_vf_port)(struct net_device *dev, 961 int (*ndo_get_vf_port)(struct net_device *dev,
913 int vf, struct sk_buff *skb); 962 int vf, struct sk_buff *skb);
914 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 963 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
915#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 964#if IS_ENABLED(CONFIG_FCOE)
916 int (*ndo_fcoe_enable)(struct net_device *dev); 965 int (*ndo_fcoe_enable)(struct net_device *dev);
917 int (*ndo_fcoe_disable)(struct net_device *dev); 966 int (*ndo_fcoe_disable)(struct net_device *dev);
918 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 967 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
@@ -925,9 +974,11 @@ struct net_device_ops {
925 u16 xid, 974 u16 xid,
926 struct scatterlist *sgl, 975 struct scatterlist *sgl,
927 unsigned int sgc); 976 unsigned int sgc);
977 int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
978 struct netdev_fcoe_hbainfo *hbainfo);
928#endif 979#endif
929 980
930#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE) 981#if IS_ENABLED(CONFIG_LIBFCOE)
931#define NETDEV_FCOE_WWNN 0 982#define NETDEV_FCOE_WWNN 0
932#define NETDEV_FCOE_WWPN 1 983#define NETDEV_FCOE_WWPN 1
933 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 984 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
@@ -944,10 +995,12 @@ struct net_device_ops {
944 struct net_device *slave_dev); 995 struct net_device *slave_dev);
945 int (*ndo_del_slave)(struct net_device *dev, 996 int (*ndo_del_slave)(struct net_device *dev,
946 struct net_device *slave_dev); 997 struct net_device *slave_dev);
947 u32 (*ndo_fix_features)(struct net_device *dev, 998 netdev_features_t (*ndo_fix_features)(struct net_device *dev,
948 u32 features); 999 netdev_features_t features);
949 int (*ndo_set_features)(struct net_device *dev, 1000 int (*ndo_set_features)(struct net_device *dev,
950 u32 features); 1001 netdev_features_t features);
1002 int (*ndo_neigh_construct)(struct neighbour *n);
1003 void (*ndo_neigh_destroy)(struct neighbour *n);
951}; 1004};
952 1005
953/* 1006/*
@@ -997,91 +1050,13 @@ struct net_device {
997 struct list_head unreg_list; 1050 struct list_head unreg_list;
998 1051
999 /* currently active device features */ 1052 /* currently active device features */
1000 u32 features; 1053 netdev_features_t features;
1001 /* user-changeable features */ 1054 /* user-changeable features */
1002 u32 hw_features; 1055 netdev_features_t hw_features;
1003 /* user-requested features */ 1056 /* user-requested features */
1004 u32 wanted_features; 1057 netdev_features_t wanted_features;
1005 /* mask of features inheritable by VLAN devices */ 1058 /* mask of features inheritable by VLAN devices */
1006 u32 vlan_features; 1059 netdev_features_t vlan_features;
1007
1008 /* Net device feature bits; if you change something,
1009 * also update netdev_features_strings[] in ethtool.c */
1010
1011#define NETIF_F_SG 1 /* Scatter/gather IO. */
1012#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
1013#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
1014#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
1015#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */
1016#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
1017#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
1018#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
1019#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
1020#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
1021#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
1022#define NETIF_F_GSO 2048 /* Enable software GSO. */
1023#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
1024 /* do not use LLTX in new drivers */
1025#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
1026#define NETIF_F_GRO 16384 /* Generic receive offload */
1027#define NETIF_F_LRO 32768 /* large receive offload */
1028
1029/* the GSO_MASK reserves bits 16 through 23 */
1030#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
1031#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
1032#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
1033#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
1034#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
1035#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
1036#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */
1037#define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */
1038
1039 /* Segmentation offload features */
1040#define NETIF_F_GSO_SHIFT 16
1041#define NETIF_F_GSO_MASK 0x00ff0000
1042#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
1043#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
1044#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
1045#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
1046#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
1047#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
1048
1049 /* Features valid for ethtool to change */
1050 /* = all defined minus driver/device-class-related */
1051#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
1052 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
1053#define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE)
1054
1055 /* List of features with software fallbacks. */
1056#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
1057 NETIF_F_TSO6 | NETIF_F_UFO)
1058
1059
1060#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
1061#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
1062#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
1063#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
1064
1065#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1066
1067#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
1068 NETIF_F_FSO)
1069
1070 /*
1071 * If one device supports one of these features, then enable them
1072 * for all in netdev_increment_features.
1073 */
1074#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
1075 NETIF_F_SG | NETIF_F_HIGHDMA | \
1076 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
1077 /*
1078 * If one device doesn't support one of these features, then disable it
1079 * for all in netdev_increment_features.
1080 */
1081#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
1082
1083 /* changeable features with no special hardware requirements */
1084#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
1085 1060
1086 /* Interface index. Unique device identifier */ 1061 /* Interface index. Unique device identifier */
1087 int ifindex; 1062 int ifindex;
@@ -1132,6 +1107,7 @@ struct net_device {
1132 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 1107 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
1133 unsigned char addr_assign_type; /* hw address assignment type */ 1108 unsigned char addr_assign_type; /* hw address assignment type */
1134 unsigned char addr_len; /* hardware address length */ 1109 unsigned char addr_len; /* hardware address length */
1110 unsigned char neigh_priv_len;
1135 unsigned short dev_id; /* for shared network cards */ 1111 unsigned short dev_id; /* for shared network cards */
1136 1112
1137 spinlock_t addr_list_lock; 1113 spinlock_t addr_list_lock;
@@ -1144,11 +1120,11 @@ struct net_device {
1144 1120
1145 /* Protocol specific pointers */ 1121 /* Protocol specific pointers */
1146 1122
1147#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 1123#if IS_ENABLED(CONFIG_VLAN_8021Q)
1148 struct vlan_group __rcu *vlgrp; /* VLAN group */ 1124 struct vlan_info __rcu *vlan_info; /* VLAN info */
1149#endif 1125#endif
1150#ifdef CONFIG_NET_DSA 1126#if IS_ENABLED(CONFIG_NET_DSA)
1151 void *dsa_ptr; /* dsa specific data */ 1127 struct dsa_switch_tree *dsa_ptr; /* dsa specific data */
1152#endif 1128#endif
1153 void *atalk_ptr; /* AppleTalk link */ 1129 void *atalk_ptr; /* AppleTalk link */
1154 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1130 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
@@ -1184,9 +1160,11 @@ struct net_device {
1184 1160
1185 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1161 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1186 1162
1187#if defined(CONFIG_RPS) || defined(CONFIG_XPS) 1163#ifdef CONFIG_SYSFS
1188 struct kset *queues_kset; 1164 struct kset *queues_kset;
1165#endif
1189 1166
1167#ifdef CONFIG_RPS
1190 struct netdev_rx_queue *_rx; 1168 struct netdev_rx_queue *_rx;
1191 1169
1192 /* Number of RX queues allocated at register_netdev() time */ 1170 /* Number of RX queues allocated at register_netdev() time */
@@ -1308,10 +1286,13 @@ struct net_device {
1308 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]; 1286 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1309 u8 prio_tc_map[TC_BITMASK + 1]; 1287 u8 prio_tc_map[TC_BITMASK + 1];
1310 1288
1311#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 1289#if IS_ENABLED(CONFIG_FCOE)
1312 /* max exchange id for FCoE LRO by ddp */ 1290 /* max exchange id for FCoE LRO by ddp */
1313 unsigned int fcoe_ddp_xid; 1291 unsigned int fcoe_ddp_xid;
1314#endif 1292#endif
1293#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
1294 struct netprio_map __rcu *priomap;
1295#endif
1315 /* phy device may attach itself for hardware timestamping */ 1296 /* phy device may attach itself for hardware timestamping */
1316 struct phy_device *phydev; 1297 struct phy_device *phydev;
1317 1298
@@ -1515,7 +1496,7 @@ struct packet_type {
1515 struct packet_type *, 1496 struct packet_type *,
1516 struct net_device *); 1497 struct net_device *);
1517 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1498 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1518 u32 features); 1499 netdev_features_t features);
1519 int (*gso_send_check)(struct sk_buff *skb); 1500 int (*gso_send_check)(struct sk_buff *skb);
1520 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1501 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1521 struct sk_buff *skb); 1502 struct sk_buff *skb);
@@ -1783,7 +1764,7 @@ extern void __netif_schedule(struct Qdisc *q);
1783 1764
1784static inline void netif_schedule_queue(struct netdev_queue *txq) 1765static inline void netif_schedule_queue(struct netdev_queue *txq)
1785{ 1766{
1786 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) 1767 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
1787 __netif_schedule(txq->qdisc); 1768 __netif_schedule(txq->qdisc);
1788} 1769}
1789 1770
@@ -1797,7 +1778,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev)
1797 1778
1798static inline void netif_tx_start_queue(struct netdev_queue *dev_queue) 1779static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
1799{ 1780{
1800 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1781 clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1801} 1782}
1802 1783
1803/** 1784/**
@@ -1829,7 +1810,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
1829 return; 1810 return;
1830 } 1811 }
1831#endif 1812#endif
1832 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state)) 1813 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
1833 __netif_schedule(dev_queue->qdisc); 1814 __netif_schedule(dev_queue->qdisc);
1834} 1815}
1835 1816
@@ -1861,7 +1842,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1861 pr_info("netif_stop_queue() cannot be called before register_netdev()\n"); 1842 pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
1862 return; 1843 return;
1863 } 1844 }
1864 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1845 set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1865} 1846}
1866 1847
1867/** 1848/**
@@ -1888,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
1888 1869
1889static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 1870static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1890{ 1871{
1891 return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1872 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1892} 1873}
1893 1874
1894/** 1875/**
@@ -1902,9 +1883,68 @@ static inline int netif_queue_stopped(const struct net_device *dev)
1902 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1883 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1903} 1884}
1904 1885
1905static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue) 1886static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue)
1906{ 1887{
1907 return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN; 1888 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
1889}
1890
1891static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
1892{
1893 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
1894}
1895
1896static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
1897 unsigned int bytes)
1898{
1899#ifdef CONFIG_BQL
1900 dql_queued(&dev_queue->dql, bytes);
1901 if (unlikely(dql_avail(&dev_queue->dql) < 0)) {
1902 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1903 if (unlikely(dql_avail(&dev_queue->dql) >= 0))
1904 clear_bit(__QUEUE_STATE_STACK_XOFF,
1905 &dev_queue->state);
1906 }
1907#endif
1908}
1909
1910static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1911{
1912 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
1913}
1914
1915static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1916 unsigned pkts, unsigned bytes)
1917{
1918#ifdef CONFIG_BQL
1919 if (likely(bytes)) {
1920 dql_completed(&dev_queue->dql, bytes);
1921 if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF,
1922 &dev_queue->state) &&
1923 dql_avail(&dev_queue->dql) >= 0)) {
1924 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF,
1925 &dev_queue->state))
1926 netif_schedule_queue(dev_queue);
1927 }
1928 }
1929#endif
1930}
1931
1932static inline void netdev_completed_queue(struct net_device *dev,
1933 unsigned pkts, unsigned bytes)
1934{
1935 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1936}
1937
1938static inline void netdev_tx_reset_queue(struct netdev_queue *q)
1939{
1940#ifdef CONFIG_BQL
1941 dql_reset(&q->dql);
1942#endif
1943}
1944
1945static inline void netdev_reset_queue(struct net_device *dev_queue)
1946{
1947 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
1908} 1948}
1909 1949
1910/** 1950/**
@@ -1991,7 +2031,7 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
1991 if (netpoll_trap()) 2031 if (netpoll_trap())
1992 return; 2032 return;
1993#endif 2033#endif
1994 if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state)) 2034 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
1995 __netif_schedule(txq->qdisc); 2035 __netif_schedule(txq->qdisc);
1996} 2036}
1997 2037
@@ -2115,7 +2155,7 @@ extern void netdev_run_todo(void);
2115 */ 2155 */
2116static inline void dev_put(struct net_device *dev) 2156static inline void dev_put(struct net_device *dev)
2117{ 2157{
2118 irqsafe_cpu_dec(*dev->pcpu_refcnt); 2158 this_cpu_dec(*dev->pcpu_refcnt);
2119} 2159}
2120 2160
2121/** 2161/**
@@ -2126,7 +2166,7 @@ static inline void dev_put(struct net_device *dev)
2126 */ 2166 */
2127static inline void dev_hold(struct net_device *dev) 2167static inline void dev_hold(struct net_device *dev)
2128{ 2168{
2129 irqsafe_cpu_inc(*dev->pcpu_refcnt); 2169 this_cpu_inc(*dev->pcpu_refcnt);
2130} 2170}
2131 2171
2132/* Carrier loss detection, dial on demand. The functions netif_carrier_on 2172/* Carrier loss detection, dial on demand. The functions netif_carrier_on
@@ -2410,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev)
2410 spin_lock(&dev->addr_list_lock); 2450 spin_lock(&dev->addr_list_lock);
2411} 2451}
2412 2452
2453static inline void netif_addr_lock_nested(struct net_device *dev)
2454{
2455 spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING);
2456}
2457
2413static inline void netif_addr_lock_bh(struct net_device *dev) 2458static inline void netif_addr_lock_bh(struct net_device *dev)
2414{ 2459{
2415 spin_lock_bh(&dev->addr_list_lock); 2460 spin_lock_bh(&dev->addr_list_lock);
@@ -2520,7 +2565,8 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master)
2520extern int netdev_set_bond_master(struct net_device *dev, 2565extern int netdev_set_bond_master(struct net_device *dev,
2521 struct net_device *master); 2566 struct net_device *master);
2522extern int skb_checksum_help(struct sk_buff *skb); 2567extern int skb_checksum_help(struct sk_buff *skb);
2523extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); 2568extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
2569 netdev_features_t features);
2524#ifdef CONFIG_BUG 2570#ifdef CONFIG_BUG
2525extern void netdev_rx_csum_fault(struct net_device *dev); 2571extern void netdev_rx_csum_fault(struct net_device *dev);
2526#else 2572#else
@@ -2549,11 +2595,13 @@ extern const char *netdev_drivername(const struct net_device *dev);
2549 2595
2550extern void linkwatch_run_queue(void); 2596extern void linkwatch_run_queue(void);
2551 2597
2552static inline u32 netdev_get_wanted_features(struct net_device *dev) 2598static inline netdev_features_t netdev_get_wanted_features(
2599 struct net_device *dev)
2553{ 2600{
2554 return (dev->features & ~dev->hw_features) | dev->wanted_features; 2601 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2555} 2602}
2556u32 netdev_increment_features(u32 all, u32 one, u32 mask); 2603netdev_features_t netdev_increment_features(netdev_features_t all,
2604 netdev_features_t one, netdev_features_t mask);
2557int __netdev_update_features(struct net_device *dev); 2605int __netdev_update_features(struct net_device *dev);
2558void netdev_update_features(struct net_device *dev); 2606void netdev_update_features(struct net_device *dev);
2559void netdev_change_features(struct net_device *dev); 2607void netdev_change_features(struct net_device *dev);
@@ -2561,21 +2609,31 @@ void netdev_change_features(struct net_device *dev);
2561void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2609void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2562 struct net_device *dev); 2610 struct net_device *dev);
2563 2611
2564u32 netif_skb_features(struct sk_buff *skb); 2612netdev_features_t netif_skb_features(struct sk_buff *skb);
2565 2613
2566static inline int net_gso_ok(u32 features, int gso_type) 2614static inline int net_gso_ok(netdev_features_t features, int gso_type)
2567{ 2615{
2568 int feature = gso_type << NETIF_F_GSO_SHIFT; 2616 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
2617
2618 /* check flags correspondence */
2619 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
2620 BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT));
2621 BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
2622 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
2623 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
2624 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
2625
2569 return (features & feature) == feature; 2626 return (features & feature) == feature;
2570} 2627}
2571 2628
2572static inline int skb_gso_ok(struct sk_buff *skb, u32 features) 2629static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
2573{ 2630{
2574 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2631 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2575 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2632 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2576} 2633}
2577 2634
2578static inline int netif_needs_gso(struct sk_buff *skb, int features) 2635static inline int netif_needs_gso(struct sk_buff *skb,
2636 netdev_features_t features)
2579{ 2637{
2580 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 2638 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2581 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2639 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
@@ -2594,22 +2652,6 @@ static inline int netif_is_bond_slave(struct net_device *dev)
2594 2652
2595extern struct pernet_operations __net_initdata loopback_net_ops; 2653extern struct pernet_operations __net_initdata loopback_net_ops;
2596 2654
2597static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2598{
2599 if (dev->features & NETIF_F_RXCSUM)
2600 return 1;
2601 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2602 return 0;
2603 return dev->ethtool_ops->get_rx_csum(dev);
2604}
2605
2606static inline u32 dev_ethtool_get_flags(struct net_device *dev)
2607{
2608 if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
2609 return 0;
2610 return dev->ethtool_ops->get_flags(dev);
2611}
2612
2613/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2655/* Logging, debugging and troubleshooting/diagnostic helpers. */
2614 2656
2615/* netdev_printk helpers, similar to dev_printk */ 2657/* netdev_printk helpers, similar to dev_printk */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 857f5026ced6..b809265607d0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -162,6 +162,24 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
162 162
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 164
165#if defined(CONFIG_JUMP_LABEL)
166#include <linux/jump_label.h>
167extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
169{
170 if (__builtin_constant_p(pf) &&
171 __builtin_constant_p(hook))
172 return static_branch(&nf_hooks_needed[pf][hook]);
173
174 return !list_empty(&nf_hooks[pf][hook]);
175}
176#else
177static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
178{
179 return !list_empty(&nf_hooks[pf][hook]);
180}
181#endif
182
165int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 183int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
166 struct net_device *indev, struct net_device *outdev, 184 struct net_device *indev, struct net_device *outdev,
167 int (*okfn)(struct sk_buff *), int thresh); 185 int (*okfn)(struct sk_buff *), int thresh);
@@ -179,11 +197,9 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
179 struct net_device *outdev, 197 struct net_device *outdev,
180 int (*okfn)(struct sk_buff *), int thresh) 198 int (*okfn)(struct sk_buff *), int thresh)
181{ 199{
182#ifndef CONFIG_NETFILTER_DEBUG 200 if (nf_hooks_active(pf, hook))
183 if (list_empty(&nf_hooks[pf][hook])) 201 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
184 return 1; 202 return 1;
185#endif
186 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
187} 203}
188 204
189static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 205static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index a1b410c76fc3..e144f54185c0 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -5,7 +5,9 @@ header-y += nf_conntrack_ftp.h
5header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
6header-y += nf_conntrack_tcp.h 6header-y += nf_conntrack_tcp.h
7header-y += nf_conntrack_tuple_common.h 7header-y += nf_conntrack_tuple_common.h
8header-y += nf_nat.h
8header-y += nfnetlink.h 9header-y += nfnetlink.h
10header-y += nfnetlink_acct.h
9header-y += nfnetlink_compat.h 11header-y += nfnetlink_compat.h
10header-y += nfnetlink_conntrack.h 12header-y += nfnetlink_conntrack.h
11header-y += nfnetlink_log.h 13header-y += nfnetlink_log.h
@@ -21,6 +23,7 @@ header-y += xt_DSCP.h
21header-y += xt_IDLETIMER.h 23header-y += xt_IDLETIMER.h
22header-y += xt_LED.h 24header-y += xt_LED.h
23header-y += xt_MARK.h 25header-y += xt_MARK.h
26header-y += xt_nfacct.h
24header-y += xt_NFLOG.h 27header-y += xt_NFLOG.h
25header-y += xt_NFQUEUE.h 28header-y += xt_NFQUEUE.h
26header-y += xt_RATEEST.h 29header-y += xt_RATEEST.h
@@ -40,6 +43,7 @@ header-y += xt_cpu.h
40header-y += xt_dccp.h 43header-y += xt_dccp.h
41header-y += xt_devgroup.h 44header-y += xt_devgroup.h
42header-y += xt_dscp.h 45header-y += xt_dscp.h
46header-y += xt_ecn.h
43header-y += xt_esp.h 47header-y += xt_esp.h
44header-y += xt_hashlimit.h 48header-y += xt_hashlimit.h
45header-y += xt_helper.h 49header-y += xt_helper.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 0d3dd66322ec..9e3a2838291b 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -83,6 +83,10 @@ enum ip_conntrack_status {
83 /* Conntrack is a fake untracked entry */ 83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12, 84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), 85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack has a userspace helper. */
88 IPS_USERSPACE_HELPER_BIT = 13,
89 IPS_USERSPACE_HELPER = (1 << IPS_USERSPACE_HELPER_BIT),
86}; 90};
87 91
88/* Connection tracking event types */ 92/* Connection tracking event types */
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
index 2ea22b018a87..2f6bbc5b8125 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -7,6 +7,33 @@ enum ip_conntrack_dir {
7 IP_CT_DIR_MAX 7 IP_CT_DIR_MAX
8}; 8};
9 9
10/* The protocol-specific manipulable parts of the tuple: always in
11 * network order
12 */
13union nf_conntrack_man_proto {
14 /* Add other protocols here. */
15 __be16 all;
16
17 struct {
18 __be16 port;
19 } tcp;
20 struct {
21 __be16 port;
22 } udp;
23 struct {
24 __be16 id;
25 } icmp;
26 struct {
27 __be16 port;
28 } dccp;
29 struct {
30 __be16 port;
31 } sctp;
32 struct {
33 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
34 } gre;
35};
36
10#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) 37#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
11 38
12#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */ 39#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
diff --git a/include/linux/netfilter/nf_nat.h b/include/linux/netfilter/nf_nat.h
new file mode 100644
index 000000000000..8df2d13730b2
--- /dev/null
+++ b/include/linux/netfilter/nf_nat.h
@@ -0,0 +1,25 @@
1#ifndef _NETFILTER_NF_NAT_H
2#define _NETFILTER_NF_NAT_H
3
4#include <linux/netfilter.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7#define NF_NAT_RANGE_MAP_IPS 1
8#define NF_NAT_RANGE_PROTO_SPECIFIED 2
9#define NF_NAT_RANGE_PROTO_RANDOM 4
10#define NF_NAT_RANGE_PERSISTENT 8
11
12struct nf_nat_ipv4_range {
13 unsigned int flags;
14 __be32 min_ip;
15 __be32 max_ip;
16 union nf_conntrack_man_proto min;
17 union nf_conntrack_man_proto max;
18};
19
20struct nf_nat_ipv4_multi_range_compat {
21 unsigned int rangesize;
22 struct nf_nat_ipv4_range range[1];
23};
24
25#endif /* _NETFILTER_NF_NAT_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 74d33861473c..b64454c2f79f 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -48,7 +48,8 @@ struct nfgenmsg {
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_COUNT 7 51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_COUNT 8
52 53
53#ifdef __KERNEL__ 54#ifdef __KERNEL__
54 55
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
new file mode 100644
index 000000000000..7c4279b4ae7a
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -0,0 +1,36 @@
1#ifndef _NFNL_ACCT_H_
2#define _NFNL_ACCT_H_
3
4#ifndef NFACCT_NAME_MAX
5#define NFACCT_NAME_MAX 32
6#endif
7
8enum nfnl_acct_msg_types {
9 NFNL_MSG_ACCT_NEW,
10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_MAX
14};
15
16enum nfnl_acct_type {
17 NFACCT_UNSPEC,
18 NFACCT_NAME,
19 NFACCT_PKTS,
20 NFACCT_BYTES,
21 NFACCT_USE,
22 __NFACCT_MAX
23};
24#define NFACCT_MAX (__NFACCT_MAX - 1)
25
26#ifdef __KERNEL__
27
28struct nf_acct;
29
30extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
31extern void nfnl_acct_put(struct nf_acct *acct);
32extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
33
34#endif /* __KERNEL__ */
35
36#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 32cddf78b13e..8d674a786744 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -471,7 +471,7 @@ DECLARE_PER_CPU(seqcount_t, xt_recseq);
471 * 471 *
472 * Begin packet processing : all readers must wait the end 472 * Begin packet processing : all readers must wait the end
473 * 1) Must be called with preemption disabled 473 * 1) Must be called with preemption disabled
474 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add()) 474 * 2) softirqs must be disabled too (or we should use this_cpu_add())
475 * Returns : 475 * Returns :
476 * 1 if no recursion on this cpu 476 * 1 if no recursion on this cpu
477 * 0 if recursion detected 477 * 0 if recursion detected
@@ -503,7 +503,7 @@ static inline unsigned int xt_write_recseq_begin(void)
503 * 503 *
504 * End packet processing : all readers can proceed 504 * End packet processing : all readers can proceed
505 * 1) Must be called with preemption disabled 505 * 1) Must be called with preemption disabled
506 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add()) 506 * 2) softirqs must be disabled too (or we should use this_cpu_add())
507 */ 507 */
508static inline void xt_write_recseq_end(unsigned int addend) 508static inline void xt_write_recseq_end(unsigned int addend)
509{ 509{
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index b56e76811c04..6390f0992f36 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -3,7 +3,8 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_CT_NOTRACK 0x1 6#define XT_CT_NOTRACK 0x1
7#define XT_CT_USERSPACE_HELPER 0x2
7 8
8struct xt_ct_target_info { 9struct xt_ct_target_info {
9 __u16 flags; 10 __u16 flags;
diff --git a/include/linux/netfilter/xt_ecn.h b/include/linux/netfilter/xt_ecn.h
new file mode 100644
index 000000000000..7158fca364f2
--- /dev/null
+++ b/include/linux/netfilter/xt_ecn.h
@@ -0,0 +1,35 @@
1/* iptables module for matching the ECN header in IPv4 and TCP header
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8*/
9#ifndef _XT_ECN_H
10#define _XT_ECN_H
11
12#include <linux/types.h>
13#include <linux/netfilter/xt_dscp.h>
14
15#define XT_ECN_IP_MASK (~XT_DSCP_MASK)
16
17#define XT_ECN_OP_MATCH_IP 0x01
18#define XT_ECN_OP_MATCH_ECE 0x10
19#define XT_ECN_OP_MATCH_CWR 0x20
20
21#define XT_ECN_OP_MATCH_MASK 0xce
22
23/* match info */
24struct xt_ecn_info {
25 __u8 operation;
26 __u8 invert;
27 __u8 ip_ect;
28 union {
29 struct {
30 __u8 ect;
31 } tcp;
32 } proto;
33};
34
35#endif /* _XT_ECN_H */
diff --git a/include/linux/netfilter/xt_nfacct.h b/include/linux/netfilter/xt_nfacct.h
new file mode 100644
index 000000000000..3e19c8a86576
--- /dev/null
+++ b/include/linux/netfilter/xt_nfacct.h
@@ -0,0 +1,13 @@
1#ifndef _XT_NFACCT_MATCH_H
2#define _XT_NFACCT_MATCH_H
3
4#include <linux/netfilter/nfnetlink_acct.h>
5
6struct nf_acct;
7
8struct xt_nfacct_match_info {
9 char name[NFACCT_NAME_MAX];
10 struct nf_acct *nfacct;
11};
12
13#endif /* _XT_NFACCT_MATCH_H */
diff --git a/include/linux/netfilter/xt_rpfilter.h b/include/linux/netfilter/xt_rpfilter.h
new file mode 100644
index 000000000000..8358d4f71952
--- /dev/null
+++ b/include/linux/netfilter/xt_rpfilter.h
@@ -0,0 +1,23 @@
1#ifndef _XT_RPATH_H
2#define _XT_RPATH_H
3
4#include <linux/types.h>
5
6enum {
7 XT_RPFILTER_LOOSE = 1 << 0,
8 XT_RPFILTER_VALID_MARK = 1 << 1,
9 XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
10 XT_RPFILTER_INVERT = 1 << 3,
11#ifdef __KERNEL__
12 XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
13 XT_RPFILTER_VALID_MARK |
14 XT_RPFILTER_ACCEPT_LOCAL |
15 XT_RPFILTER_INVERT,
16#endif
17};
18
19struct xt_rpfilter_info {
20 __u8 flags;
21};
22
23#endif
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index c3b45480ecf7..f9930c87fff3 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -12,4 +12,3 @@ header-y += ipt_ah.h
12header-y += ipt_ecn.h 12header-y += ipt_ecn.h
13header-y += ipt_realm.h 13header-y += ipt_realm.h
14header-y += ipt_ttl.h 14header-y += ipt_ttl.h
15header-y += nf_nat.h
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index eabf95fb7d3e..0e0c063dbf60 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -1,35 +1,15 @@
1/* iptables module for matching the ECN header in IPv4 and TCP header
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8*/
9#ifndef _IPT_ECN_H 1#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 2#define _IPT_ECN_H
11 3
12#include <linux/types.h> 4#include <linux/netfilter/xt_ecn.h>
13#include <linux/netfilter/xt_dscp.h> 5#define ipt_ecn_info xt_ecn_info
14 6
15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 7enum {
16 8 IPT_ECN_IP_MASK = XT_ECN_IP_MASK,
17#define IPT_ECN_OP_MATCH_IP 0x01 9 IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP,
18#define IPT_ECN_OP_MATCH_ECE 0x10 10 IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE,
19#define IPT_ECN_OP_MATCH_CWR 0x20 11 IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR,
20 12 IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK,
21#define IPT_ECN_OP_MATCH_MASK 0xce
22
23/* match info */
24struct ipt_ecn_info {
25 __u8 operation;
26 __u8 invert;
27 __u8 ip_ect;
28 union {
29 struct {
30 __u8 ect;
31 } tcp;
32 } proto;
33}; 13};
34 14
35#endif /* _IPT_ECN_H */ 15#endif /* IPT_ECN_H */
diff --git a/include/linux/netfilter_ipv4/nf_nat.h b/include/linux/netfilter_ipv4/nf_nat.h
deleted file mode 100644
index 7a861d09fc86..000000000000
--- a/include/linux/netfilter_ipv4/nf_nat.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _LINUX_NF_NAT_H
2#define _LINUX_NF_NAT_H
3
4#include <linux/types.h>
5
6#define IP_NAT_RANGE_MAP_IPS 1
7#define IP_NAT_RANGE_PROTO_SPECIFIED 2
8#define IP_NAT_RANGE_PROTO_RANDOM 4
9#define IP_NAT_RANGE_PERSISTENT 8
10
11/* The protocol-specific manipulable parts of the tuple. */
12union nf_conntrack_man_proto {
13 /* Add other protocols here. */
14 __be16 all;
15
16 struct {
17 __be16 port;
18 } tcp;
19 struct {
20 __be16 port;
21 } udp;
22 struct {
23 __be16 id;
24 } icmp;
25 struct {
26 __be16 port;
27 } dccp;
28 struct {
29 __be16 port;
30 } sctp;
31 struct {
32 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
33 } gre;
34};
35
36/* Single range specification. */
37struct nf_nat_range {
38 /* Set to OR of flags above. */
39 unsigned int flags;
40
41 /* Inclusive: network order. */
42 __be32 min_ip, max_ip;
43
44 /* Inclusive: network order */
45 union nf_conntrack_man_proto min, max;
46};
47
48/* For backwards compat: don't use in modern code. */
49struct nf_nat_multi_range_compat {
50 unsigned int rangesize; /* Must be 1. */
51
52 /* hangs off end. */
53 struct nf_nat_range range[1];
54};
55
56#define nf_nat_multi_range nf_nat_multi_range_compat
57
58#endif
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 8374d2967362..52e48959cfa1 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -8,7 +8,7 @@
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -27,6 +27,8 @@
27#define NETLINK_RDMA 20 27#define NETLINK_RDMA 20
28#define NETLINK_CRYPTO 21 /* Crypto layer */ 28#define NETLINK_CRYPTO 21 /* Crypto layer */
29 29
30#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31
30#define MAX_LINKS 32 32#define MAX_LINKS 32
31 33
32struct sockaddr_nl { 34struct sockaddr_nl {
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 36cb955b05cc..01d4e5d60325 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -62,6 +62,8 @@ enum nfc_commands {
62 NFC_CMD_GET_DEVICE, 62 NFC_CMD_GET_DEVICE,
63 NFC_CMD_DEV_UP, 63 NFC_CMD_DEV_UP,
64 NFC_CMD_DEV_DOWN, 64 NFC_CMD_DEV_DOWN,
65 NFC_CMD_DEP_LINK_UP,
66 NFC_CMD_DEP_LINK_DOWN,
65 NFC_CMD_START_POLL, 67 NFC_CMD_START_POLL,
66 NFC_CMD_STOP_POLL, 68 NFC_CMD_STOP_POLL,
67 NFC_CMD_GET_TARGET, 69 NFC_CMD_GET_TARGET,
@@ -86,6 +88,9 @@ enum nfc_commands {
86 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID 88 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID
87 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the 89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
88 * target is not NFC-Forum compliant) 90 * target is not NFC-Forum compliant)
91 * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes
92 * @NFC_ATTR_COMM_MODE: Passive or active mode
93 * @NFC_ATTR_RF_MODE: Initiator or target
89 */ 94 */
90enum nfc_attrs { 95enum nfc_attrs {
91 NFC_ATTR_UNSPEC, 96 NFC_ATTR_UNSPEC,
@@ -95,6 +100,9 @@ enum nfc_attrs {
95 NFC_ATTR_TARGET_INDEX, 100 NFC_ATTR_TARGET_INDEX,
96 NFC_ATTR_TARGET_SENS_RES, 101 NFC_ATTR_TARGET_SENS_RES,
97 NFC_ATTR_TARGET_SEL_RES, 102 NFC_ATTR_TARGET_SEL_RES,
103 NFC_ATTR_TARGET_NFCID1,
104 NFC_ATTR_COMM_MODE,
105 NFC_ATTR_RF_MODE,
98/* private: internal use only */ 106/* private: internal use only */
99 __NFC_ATTR_AFTER_LAST 107 __NFC_ATTR_AFTER_LAST
100}; 108};
@@ -111,6 +119,14 @@ enum nfc_attrs {
111 119
112#define NFC_PROTO_MAX 6 120#define NFC_PROTO_MAX 6
113 121
122/* NFC communication modes */
123#define NFC_COMM_ACTIVE 0
124#define NFC_COMM_PASSIVE 1
125
126/* NFC RF modes */
127#define NFC_RF_INITIATOR 0
128#define NFC_RF_TARGET 1
129
114/* NFC protocols masks used in bitsets */ 130/* NFC protocols masks used in bitsets */
115#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) 131#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
116#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) 132#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE)
@@ -125,9 +141,22 @@ struct sockaddr_nfc {
125 __u32 nfc_protocol; 141 __u32 nfc_protocol;
126}; 142};
127 143
144#define NFC_LLCP_MAX_SERVICE_NAME 63
145struct sockaddr_nfc_llcp {
146 sa_family_t sa_family;
147 __u32 dev_idx;
148 __u32 target_idx;
149 __u32 nfc_protocol;
150 __u8 dsap; /* Destination SAP, if known */
151 __u8 ssap; /* Source SAP to be bound to */
152 char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
153 size_t service_name_len;
154};
155
128/* NFC socket protocols */ 156/* NFC socket protocols */
129#define NFC_SOCKPROTO_RAW 0 157#define NFC_SOCKPROTO_RAW 0
130#define NFC_SOCKPROTO_MAX 1 158#define NFC_SOCKPROTO_LLCP 1
159#define NFC_SOCKPROTO_MAX 2
131 160
132#define NFC_HEADER_SIZE 1 161#define NFC_HEADER_SIZE 1
133 162
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 92ecf5585fac..8c29950d2fa5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -373,7 +373,7 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
374extern void put_nfs_open_context(struct nfs_open_context *ctx); 374extern void put_nfs_open_context(struct nfs_open_context *ctx);
375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode); 376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b5479df8378d..ba4d7656ecfd 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -153,6 +153,7 @@ struct nfs_server {
153 struct rb_root openowner_id; 153 struct rb_root openowner_id;
154 struct rb_root lockowner_id; 154 struct rb_root lockowner_id;
155#endif 155#endif
156 struct list_head state_owners_lru;
156 struct list_head layouts; 157 struct list_head layouts;
157 struct list_head delegations; 158 struct list_head delegations;
158 void (*destroy)(struct nfs_server *); 159 void (*destroy)(struct nfs_server *);
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index ae7d6a380dae..308c18877018 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -66,6 +66,8 @@ struct idmap_msg {
66/* Forward declaration to make this header independent of others */ 66/* Forward declaration to make this header independent of others */
67struct nfs_client; 67struct nfs_client;
68struct nfs_server; 68struct nfs_server;
69struct nfs_fattr;
70struct nfs4_string;
69 71
70#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 72#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
71 73
@@ -97,6 +99,12 @@ void nfs_idmap_delete(struct nfs_client *);
97 99
98#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ 100#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
99 101
102void nfs_fattr_init_names(struct nfs_fattr *fattr,
103 struct nfs4_string *owner_name,
104 struct nfs4_string *group_name);
105void nfs_fattr_free_names(struct nfs_fattr *);
106void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
107
100int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); 108int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *);
101int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); 109int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *);
102int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); 110int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 2a7c533be5dd..a764cef06b73 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -18,6 +18,11 @@
18/* Forward declaration for NFS v3 */ 18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors; 19struct nfs4_secinfo_flavors;
20 20
21struct nfs4_string {
22 unsigned int len;
23 char *data;
24};
25
21struct nfs_fsid { 26struct nfs_fsid {
22 uint64_t major; 27 uint64_t major;
23 uint64_t minor; 28 uint64_t minor;
@@ -61,6 +66,8 @@ struct nfs_fattr {
61 struct timespec pre_ctime; /* pre_op_attr.ctime */ 66 struct timespec pre_ctime; /* pre_op_attr.ctime */
62 unsigned long time_start; 67 unsigned long time_start;
63 unsigned long gencount; 68 unsigned long gencount;
69 struct nfs4_string *owner_name;
70 struct nfs4_string *group_name;
64}; 71};
65 72
66#define NFS_ATTR_FATTR_TYPE (1U << 0) 73#define NFS_ATTR_FATTR_TYPE (1U << 0)
@@ -85,6 +92,8 @@ struct nfs_fattr {
85#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
86#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ 93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
87#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) 94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21)
95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 22)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 23)
88 97
89#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
90 | NFS_ATTR_FATTR_MODE \ 99 | NFS_ATTR_FATTR_MODE \
@@ -324,6 +333,7 @@ struct nfs_openargs {
324 const struct qstr * name; 333 const struct qstr * name;
325 const struct nfs_server *server; /* Needed for ID mapping */ 334 const struct nfs_server *server; /* Needed for ID mapping */
326 const u32 * bitmask; 335 const u32 * bitmask;
336 const u32 * dir_bitmask;
327 __u32 claim; 337 __u32 claim;
328 struct nfs4_sequence_args seq_args; 338 struct nfs4_sequence_args seq_args;
329}; 339};
@@ -342,6 +352,8 @@ struct nfs_openres {
342 __u32 do_recall; 352 __u32 do_recall;
343 __u64 maxsize; 353 __u64 maxsize;
344 __u32 attrset[NFS4_BITMAP_SIZE]; 354 __u32 attrset[NFS4_BITMAP_SIZE];
355 struct nfs4_string *owner;
356 struct nfs4_string *group_owner;
345 struct nfs4_sequence_res seq_res; 357 struct nfs4_sequence_res seq_res;
346}; 358};
347 359
@@ -602,11 +614,16 @@ struct nfs_getaclargs {
602 size_t acl_len; 614 size_t acl_len;
603 unsigned int acl_pgbase; 615 unsigned int acl_pgbase;
604 struct page ** acl_pages; 616 struct page ** acl_pages;
617 struct page * acl_scratch;
605 struct nfs4_sequence_args seq_args; 618 struct nfs4_sequence_args seq_args;
606}; 619};
607 620
621/* getxattr ACL interface flags */
622#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
608struct nfs_getaclres { 623struct nfs_getaclres {
609 size_t acl_len; 624 size_t acl_len;
625 size_t acl_data_offset;
626 int acl_flags;
610 struct nfs4_sequence_res seq_res; 627 struct nfs4_sequence_res seq_res;
611}; 628};
612 629
@@ -773,11 +790,6 @@ struct nfs3_getaclres {
773 struct posix_acl * acl_default; 790 struct posix_acl * acl_default;
774}; 791};
775 792
776struct nfs4_string {
777 unsigned int len;
778 char *data;
779};
780
781#ifdef CONFIG_NFS_V4 793#ifdef CONFIG_NFS_V4
782 794
783typedef u64 clientid4; 795typedef u64 clientid4;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8049bf77d799..0f5ff3739820 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -509,6 +509,38 @@
509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). 509 * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. 510 * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
511 * 511 *
512 * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
513 * (or GO) interface (i.e. hostapd) to ask for unexpected frames to
514 * implement sending deauth to stations that send unexpected class 3
515 * frames. Also used as the event sent by the kernel when such a frame
516 * is received.
517 * For the event, the %NL80211_ATTR_MAC attribute carries the TA and
518 * other attributes like the interface index are present.
519 * If used as the command it must have an interface index and you can
520 * only unsubscribe from the event by closing the socket. Subscription
521 * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
522 *
523 * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
524 * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
525 * and wasn't already in a 4-addr VLAN. The event will be sent similarly
526 * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
527 *
528 * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface
529 * by sending a null data frame to it and reporting when the frame is
530 * acknowleged. This is used to allow timing out inactive clients. Uses
531 * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a
532 * direct reply with an %NL80211_ATTR_COOKIE that is later used to match
533 * up the event with the request. The event includes the same data and
534 * has %NL80211_ATTR_ACK set if the frame was ACKed.
535 *
536 * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
537 * other BSSes when any interfaces are in AP mode. This helps implement
538 * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
539 * messages. Note that per PHY only one application may register.
540 *
541 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
542 * No Acknowledgement Policy should be applied.
543 *
512 * @NL80211_CMD_MAX: highest used command number 544 * @NL80211_CMD_MAX: highest used command number
513 * @__NL80211_CMD_AFTER_LAST: internal use 545 * @__NL80211_CMD_AFTER_LAST: internal use
514 */ 546 */
@@ -638,6 +670,16 @@ enum nl80211_commands {
638 NL80211_CMD_TDLS_OPER, 670 NL80211_CMD_TDLS_OPER,
639 NL80211_CMD_TDLS_MGMT, 671 NL80211_CMD_TDLS_MGMT,
640 672
673 NL80211_CMD_UNEXPECTED_FRAME,
674
675 NL80211_CMD_PROBE_CLIENT,
676
677 NL80211_CMD_REGISTER_BEACONS,
678
679 NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
680
681 NL80211_CMD_SET_NOACK_MAP,
682
641 /* add new commands above here */ 683 /* add new commands above here */
642 684
643 /* used to define NL80211_CMD_MAX below */ 685 /* used to define NL80211_CMD_MAX below */
@@ -658,6 +700,8 @@ enum nl80211_commands {
658#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 700#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
659#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT 701#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
660 702
703#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
704
661/* source-level API compatibility */ 705/* source-level API compatibility */
662#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG 706#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
663#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG 707#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
@@ -1109,6 +1153,46 @@ enum nl80211_commands {
1109 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be 1153 * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
1110 * used for asking the driver to perform a TDLS operation. 1154 * used for asking the driver to perform a TDLS operation.
1111 * 1155 *
1156 * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices
1157 * that have AP support to indicate that they have the AP SME integrated
1158 * with support for the features listed in this attribute, see
1159 * &enum nl80211_ap_sme_features.
1160 *
1161 * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
1162 * the driver to not wait for an acknowledgement. Note that due to this,
1163 * it will also not give a status callback nor return a cookie. This is
1164 * mostly useful for probe responses to save airtime.
1165 *
1166 * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from
1167 * &enum nl80211_feature_flags and is advertised in wiphy information.
1168 * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe
1169 *
1170 * requests while operating in AP-mode.
1171 * This attribute holds a bitmap of the supported protocols for
1172 * offloading (see &enum nl80211_probe_resp_offload_support_attr).
1173 *
1174 * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire
1175 * probe-response frame. The DA field in the 802.11 header is zero-ed out,
1176 * to be filled by the FW.
1177 * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable
1178 * this feature. Currently, only supported in mac80211 drivers.
1179 * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
1180 * ATTR_HT_CAPABILITY to which attention should be paid.
1181 * Currently, only mac80211 NICs support this feature.
1182 * The values that may be configured are:
1183 * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
1184 * AMPDU density and AMPDU factor.
1185 * All values are treated as suggestions and may be ignored
1186 * by the driver as required. The actual values may be seen in
1187 * the station debugfs ht_caps file.
1188 *
1189 * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country
1190 * abides to when initiating radiation on DFS channels. A country maps
1191 * to one DFS region.
1192 *
1193 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
1194 * up to 16 TIDs.
1195 *
1112 * @NL80211_ATTR_MAX: highest attribute number currently defined 1196 * @NL80211_ATTR_MAX: highest attribute number currently defined
1113 * @__NL80211_ATTR_AFTER_LAST: internal use 1197 * @__NL80211_ATTR_AFTER_LAST: internal use
1114 */ 1198 */
@@ -1337,6 +1421,23 @@ enum nl80211_attrs {
1337 NL80211_ATTR_TDLS_SUPPORT, 1421 NL80211_ATTR_TDLS_SUPPORT,
1338 NL80211_ATTR_TDLS_EXTERNAL_SETUP, 1422 NL80211_ATTR_TDLS_EXTERNAL_SETUP,
1339 1423
1424 NL80211_ATTR_DEVICE_AP_SME,
1425
1426 NL80211_ATTR_DONT_WAIT_FOR_ACK,
1427
1428 NL80211_ATTR_FEATURE_FLAGS,
1429
1430 NL80211_ATTR_PROBE_RESP_OFFLOAD,
1431
1432 NL80211_ATTR_PROBE_RESP,
1433
1434 NL80211_ATTR_DFS_REGION,
1435
1436 NL80211_ATTR_DISABLE_HT,
1437 NL80211_ATTR_HT_CAPABILITY_MASK,
1438
1439 NL80211_ATTR_NOACK_MAP,
1440
1340 /* add attributes here, update the policy in nl80211.c */ 1441 /* add attributes here, update the policy in nl80211.c */
1341 1442
1342 __NL80211_ATTR_AFTER_LAST, 1443 __NL80211_ATTR_AFTER_LAST,
@@ -1371,6 +1472,7 @@ enum nl80211_attrs {
1371#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES 1472#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
1372#define NL80211_ATTR_KEY NL80211_ATTR_KEY 1473#define NL80211_ATTR_KEY NL80211_ATTR_KEY
1373#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS 1474#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
1475#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
1374 1476
1375#define NL80211_MAX_SUPP_RATES 32 1477#define NL80211_MAX_SUPP_RATES 32
1376#define NL80211_MAX_SUPP_REG_RULES 32 1478#define NL80211_MAX_SUPP_REG_RULES 32
@@ -1434,7 +1536,11 @@ enum nl80211_iftype {
1434 * @NL80211_STA_FLAG_WME: station is WME/QoS capable 1536 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
1435 * @NL80211_STA_FLAG_MFP: station uses management frame protection 1537 * @NL80211_STA_FLAG_MFP: station uses management frame protection
1436 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated 1538 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
1437 * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer 1539 * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should
1540 * only be used in managed mode (even in the flags mask). Note that the
1541 * flag can't be changed, it is only valid while adding a station, and
1542 * attempts to change it will silently be ignored (rather than rejected
1543 * as errors.)
1438 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined 1544 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
1439 * @__NL80211_STA_FLAG_AFTER_LAST: internal use 1545 * @__NL80211_STA_FLAG_AFTER_LAST: internal use
1440 */ 1546 */
@@ -1549,6 +1655,7 @@ enum nl80211_sta_bss_param {
1549 * containing info as possible, see &enum nl80211_sta_bss_param 1655 * containing info as possible, see &enum nl80211_sta_bss_param
1550 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected 1656 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1551 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1657 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1658 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1552 * @__NL80211_STA_INFO_AFTER_LAST: internal 1659 * @__NL80211_STA_INFO_AFTER_LAST: internal
1553 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1660 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1554 */ 1661 */
@@ -1571,6 +1678,7 @@ enum nl80211_sta_info {
1571 NL80211_STA_INFO_BSS_PARAM, 1678 NL80211_STA_INFO_BSS_PARAM,
1572 NL80211_STA_INFO_CONNECTED_TIME, 1679 NL80211_STA_INFO_CONNECTED_TIME,
1573 NL80211_STA_INFO_STA_FLAGS, 1680 NL80211_STA_INFO_STA_FLAGS,
1681 NL80211_STA_INFO_BEACON_LOSS,
1574 1682
1575 /* keep last */ 1683 /* keep last */
1576 __NL80211_STA_INFO_AFTER_LAST, 1684 __NL80211_STA_INFO_AFTER_LAST,
@@ -1845,6 +1953,21 @@ enum nl80211_reg_rule_flags {
1845}; 1953};
1846 1954
1847/** 1955/**
1956 * enum nl80211_dfs_regions - regulatory DFS regions
1957 *
1958 * @NL80211_DFS_UNSET: Country has no DFS master region specified
1959 * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC
1960 * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI
1961 * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec
1962 */
1963enum nl80211_dfs_regions {
1964 NL80211_DFS_UNSET = 0,
1965 NL80211_DFS_FCC = 1,
1966 NL80211_DFS_ETSI = 2,
1967 NL80211_DFS_JP = 3,
1968};
1969
1970/**
1848 * enum nl80211_survey_info - survey information 1971 * enum nl80211_survey_info - survey information
1849 * 1972 *
1850 * These attribute types are used with %NL80211_ATTR_SURVEY_INFO 1973 * These attribute types are used with %NL80211_ATTR_SURVEY_INFO
@@ -1977,6 +2100,10 @@ enum nl80211_mntr_flags {
1977 * access to a broader network beyond the MBSS. This is done via Root 2100 * access to a broader network beyond the MBSS. This is done via Root
1978 * Announcement frames. 2101 * Announcement frames.
1979 * 2102 *
2103 * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in
2104 * TUs) during which a mesh STA can send only one Action frame containing a
2105 * PERR element.
2106 *
1980 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2107 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
1981 * 2108 *
1982 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2109 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -2000,6 +2127,7 @@ enum nl80211_meshconf_params {
2000 NL80211_MESHCONF_ELEMENT_TTL, 2127 NL80211_MESHCONF_ELEMENT_TTL,
2001 NL80211_MESHCONF_HWMP_RANN_INTERVAL, 2128 NL80211_MESHCONF_HWMP_RANN_INTERVAL,
2002 NL80211_MESHCONF_GATE_ANNOUNCEMENTS, 2129 NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
2130 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2003 2131
2004 /* keep last */ 2132 /* keep last */
2005 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2133 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2650,4 +2778,45 @@ enum nl80211_tdls_operation {
2650 NL80211_TDLS_DISABLE_LINK, 2778 NL80211_TDLS_DISABLE_LINK,
2651}; 2779};
2652 2780
2781/*
2782 * enum nl80211_ap_sme_features - device-integrated AP features
2783 * Reserved for future use, no bits are defined in
2784 * NL80211_ATTR_DEVICE_AP_SME yet.
2785enum nl80211_ap_sme_features {
2786};
2787 */
2788
2789/**
2790 * enum nl80211_feature_flags - device/driver features
2791 * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back
2792 * TX status to the socket error queue when requested with the
2793 * socket option.
2794 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
2795 */
2796enum nl80211_feature_flags {
2797 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
2798 NL80211_FEATURE_HT_IBSS = 1 << 1,
2799};
2800
2801/**
2802 * enum nl80211_probe_resp_offload_support_attr - optional supported
2803 * protocols for probe-response offloading by the driver/FW.
2804 * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.
2805 * Each enum value represents a bit in the bitmap of supported
2806 * protocols. Typically a subset of probe-requests belonging to a
2807 * supported protocol will be excluded from offload and uploaded
2808 * to the host.
2809 *
2810 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1
2811 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2
2812 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P
2813 * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u
2814 */
2815enum nl80211_probe_resp_offload_support_attr {
2816 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0,
2817 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1,
2818 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2,
2819 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,
2820};
2821
2653#endif /* __LINUX_NL80211_H */ 2822#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nls.h b/include/linux/nls.h
index d47beef08dfd..5dc635f8d79e 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -43,7 +43,7 @@ enum utf16_endian {
43 UTF16_BIG_ENDIAN 43 UTF16_BIG_ENDIAN
44}; 44};
45 45
46/* nls.c */ 46/* nls_base.c */
47extern int register_nls(struct nls_table *); 47extern int register_nls(struct nls_table *);
48extern int unregister_nls(struct nls_table *); 48extern int unregister_nls(struct nls_table *);
49extern struct nls_table *load_nls(char *); 49extern struct nls_table *load_nls(char *);
@@ -52,7 +52,8 @@ extern struct nls_table *load_nls_default(void);
52 52
53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu); 53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen); 54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
55extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs); 55extern int utf8s_to_utf16s(const u8 *s, int len,
56 enum utf16_endian endian, wchar_t *pwcs, int maxlen);
56extern int utf16s_to_utf8s(const wchar_t *pwcs, int len, 57extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
57 enum utf16_endian endian, u8 *s, int maxlen); 58 enum utf16_endian endian, u8 *s, int maxlen);
58 59
diff --git a/include/linux/node.h b/include/linux/node.h
index 92370e22343c..624e53cecc02 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -14,12 +14,12 @@
14#ifndef _LINUX_NODE_H_ 14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_ 15#define _LINUX_NODE_H_
16 16
17#include <linux/sysdev.h> 17#include <linux/device.h>
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
21struct node { 21struct node {
22 struct sys_device sysdev; 22 struct device dev;
23 23
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work; 25 struct work_struct node_work;
@@ -80,6 +80,6 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
80} 80}
81#endif 81#endif
82 82
83#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 83#define to_node(device) container_of(device, struct node, dev)
84 84
85#endif /* _LINUX_NODE_H_ */ 85#endif /* _LINUX_NODE_H_ */
diff --git a/include/linux/of.h b/include/linux/of.h
index 4948552d60f5..a75a831e2057 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -65,6 +65,27 @@ struct device_node {
65#endif 65#endif
66}; 66};
67 67
68#define MAX_PHANDLE_ARGS 8
69struct of_phandle_args {
70 struct device_node *np;
71 int args_count;
72 uint32_t args[MAX_PHANDLE_ARGS];
73};
74
75#if defined(CONFIG_SPARC) || !defined(CONFIG_OF)
76/* Dummy ref counting routines - to be implemented later */
77static inline struct device_node *of_node_get(struct device_node *node)
78{
79 return node;
80}
81static inline void of_node_put(struct device_node *node)
82{
83}
84#else
85extern struct device_node *of_node_get(struct device_node *node);
86extern void of_node_put(struct device_node *node);
87#endif
88
68#ifdef CONFIG_OF 89#ifdef CONFIG_OF
69 90
70/* Pointer for first entry in chain of all nodes. */ 91/* Pointer for first entry in chain of all nodes. */
@@ -95,21 +116,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
95 116
96extern struct device_node *of_find_all_nodes(struct device_node *prev); 117extern struct device_node *of_find_all_nodes(struct device_node *prev);
97 118
98#if defined(CONFIG_SPARC)
99/* Dummy ref counting routines - to be implemented later */
100static inline struct device_node *of_node_get(struct device_node *node)
101{
102 return node;
103}
104static inline void of_node_put(struct device_node *node)
105{
106}
107
108#else
109extern struct device_node *of_node_get(struct device_node *node);
110extern void of_node_put(struct device_node *node);
111#endif
112
113/* 119/*
114 * OF address retrieval & translation 120 * OF address retrieval & translation
115 */ 121 */
@@ -219,8 +225,8 @@ extern int of_device_is_available(const struct device_node *device);
219extern const void *of_get_property(const struct device_node *node, 225extern const void *of_get_property(const struct device_node *node,
220 const char *name, 226 const char *name,
221 int *lenp); 227 int *lenp);
222#define for_each_property(pp, properties) \ 228#define for_each_property_of_node(dn, pp) \
223 for (pp = properties; pp != NULL; pp = pp->next) 229 for (pp = dn->properties; pp != NULL; pp = pp->next)
224 230
225extern int of_n_addr_cells(struct device_node *np); 231extern int of_n_addr_cells(struct device_node *np);
226extern int of_n_size_cells(struct device_node *np); 232extern int of_n_size_cells(struct device_node *np);
@@ -230,9 +236,9 @@ extern int of_modalias_node(struct device_node *node, char *modalias, int len);
230extern struct device_node *of_parse_phandle(struct device_node *np, 236extern struct device_node *of_parse_phandle(struct device_node *np,
231 const char *phandle_name, 237 const char *phandle_name,
232 int index); 238 int index);
233extern int of_parse_phandles_with_args(struct device_node *np, 239extern int of_parse_phandle_with_args(struct device_node *np,
234 const char *list_name, const char *cells_name, int index, 240 const char *list_name, const char *cells_name, int index,
235 struct device_node **out_node, const void **out_args); 241 struct of_phandle_args *out_args);
236 242
237extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 243extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
238extern int of_alias_get_id(struct device_node *np, const char *stem); 244extern int of_alias_get_id(struct device_node *np, const char *stem);
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index c84d900fbbb3..ed136ad698ce 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,7 +71,7 @@ extern int of_fdt_is_compatible(struct boot_param_header *blob,
71 unsigned long node, 71 unsigned long node,
72 const char *compat); 72 const char *compat);
73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node, 73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node,
74 const char **compat); 74 const char *const *compat);
75extern void of_fdt_unflatten_tree(unsigned long *blob, 75extern void of_fdt_unflatten_tree(unsigned long *blob,
76 struct device_node **mynodes); 76 struct device_node **mynodes);
77 77
@@ -88,7 +88,7 @@ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
88extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 88extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
89 unsigned long *size); 89 unsigned long *size);
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 90extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char **matches); 91extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 92extern unsigned long of_get_flat_dt_root(void);
93 93
94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 52280a2b5e63..b254052a49d7 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/of.h>
21 22
22struct device_node; 23struct device_node;
23 24
@@ -57,8 +58,9 @@ extern int of_mm_gpiochip_add(struct device_node *np,
57extern void of_gpiochip_add(struct gpio_chip *gc); 58extern void of_gpiochip_add(struct gpio_chip *gc);
58extern void of_gpiochip_remove(struct gpio_chip *gc); 59extern void of_gpiochip_remove(struct gpio_chip *gc);
59extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); 60extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
60extern int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np, 61extern int of_gpio_simple_xlate(struct gpio_chip *gc,
61 const void *gpio_spec, u32 *flags); 62 const struct of_phandle_args *gpiospec,
63 u32 *flags);
62 64
63#else /* CONFIG_OF_GPIO */ 65#else /* CONFIG_OF_GPIO */
64 66
@@ -75,8 +77,8 @@ static inline unsigned int of_gpio_count(struct device_node *np)
75} 77}
76 78
77static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 79static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
78 struct device_node *np, 80 const struct of_phandle_args *gpiospec,
79 const void *gpio_spec, u32 *flags) 81 u32 *flags)
80{ 82{
81 return -ENOSYS; 83 return -ENOSYS;
82} 84}
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 6f9d04a85336..552fba9c7d5a 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -43,7 +43,7 @@ enum oom_constraint {
43extern void compare_swap_oom_score_adj(int old_val, int new_val); 43extern void compare_swap_oom_score_adj(int old_val, int new_val);
44extern int test_set_oom_score_adj(int new_val); 44extern int test_set_oom_score_adj(int new_val);
45 45
46extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, 46extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
47 const nodemask_t *nodemask, unsigned long totalpages); 47 const nodemask_t *nodemask, unsigned long totalpages);
48extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 48extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
new file mode 100644
index 000000000000..eb1efa54fe84
--- /dev/null
+++ b/include/linux/openvswitch.h
@@ -0,0 +1,452 @@
1/*
2 * Copyright (c) 2007-2011 Nicira Networks.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301, USA
17 */
18
19#ifndef _LINUX_OPENVSWITCH_H
20#define _LINUX_OPENVSWITCH_H 1
21
22#include <linux/types.h>
23
24/**
25 * struct ovs_header - header for OVS Generic Netlink messages.
26 * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
27 * specific to a datapath).
28 *
29 * Attributes following the header are specific to a particular OVS Generic
30 * Netlink family, but all of the OVS families use this header.
31 */
32
33struct ovs_header {
34 int dp_ifindex;
35};
36
37/* Datapaths. */
38
39#define OVS_DATAPATH_FAMILY "ovs_datapath"
40#define OVS_DATAPATH_MCGROUP "ovs_datapath"
41#define OVS_DATAPATH_VERSION 0x1
42
43enum ovs_datapath_cmd {
44 OVS_DP_CMD_UNSPEC,
45 OVS_DP_CMD_NEW,
46 OVS_DP_CMD_DEL,
47 OVS_DP_CMD_GET,
48 OVS_DP_CMD_SET
49};
50
51/**
52 * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
53 * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
54 * port". This is the name of the network device whose dp_ifindex is given in
55 * the &struct ovs_header. Always present in notifications. Required in
56 * %OVS_DP_NEW requests. May be used as an alternative to specifying
57 * dp_ifindex in other requests (with a dp_ifindex of 0).
58 * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
59 * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
60 * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
61 * not be sent.
62 * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
63 * datapath. Always present in notifications.
64 *
65 * These attributes follow the &struct ovs_header within the Generic Netlink
66 * payload for %OVS_DP_* commands.
67 */
68enum ovs_datapath_attr {
69 OVS_DP_ATTR_UNSPEC,
70 OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
71 OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
72 OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
73 __OVS_DP_ATTR_MAX
74};
75
76#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
77
78struct ovs_dp_stats {
79 __u64 n_hit; /* Number of flow table matches. */
80 __u64 n_missed; /* Number of flow table misses. */
81 __u64 n_lost; /* Number of misses not sent to userspace. */
82 __u64 n_flows; /* Number of flows present */
83};
84
85struct ovs_vport_stats {
86 __u64 rx_packets; /* total packets received */
87 __u64 tx_packets; /* total packets transmitted */
88 __u64 rx_bytes; /* total bytes received */
89 __u64 tx_bytes; /* total bytes transmitted */
90 __u64 rx_errors; /* bad packets received */
91 __u64 tx_errors; /* packet transmit problems */
92 __u64 rx_dropped; /* no space in linux buffers */
93 __u64 tx_dropped; /* no space available in linux */
94};
95
96/* Fixed logical ports. */
97#define OVSP_LOCAL ((__u16)0)
98
99/* Packet transfer. */
100
101#define OVS_PACKET_FAMILY "ovs_packet"
102#define OVS_PACKET_VERSION 0x1
103
104enum ovs_packet_cmd {
105 OVS_PACKET_CMD_UNSPEC,
106
107 /* Kernel-to-user notifications. */
108 OVS_PACKET_CMD_MISS, /* Flow table miss. */
109 OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
110
111 /* Userspace commands. */
112 OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
113};
114
115/**
116 * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
117 * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
118 * packet as received, from the start of the Ethernet header onward. For
119 * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
120 * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
121 * the flow key extracted from the packet as originally received.
122 * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
123 * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
124 * userspace to adapt its flow setup strategy by comparing its notion of the
125 * flow key against the kernel's.
126 * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
127 * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
128 * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
129 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
130 * %OVS_USERSPACE_ATTR_USERDATA attribute.
131 *
132 * These attributes follow the &struct ovs_header within the Generic Netlink
133 * payload for %OVS_PACKET_* commands.
134 */
135enum ovs_packet_attr {
136 OVS_PACKET_ATTR_UNSPEC,
137 OVS_PACKET_ATTR_PACKET, /* Packet data. */
138 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
139 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
140 OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
141 __OVS_PACKET_ATTR_MAX
142};
143
144#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
145
146/* Virtual ports. */
147
148#define OVS_VPORT_FAMILY "ovs_vport"
149#define OVS_VPORT_MCGROUP "ovs_vport"
150#define OVS_VPORT_VERSION 0x1
151
152enum ovs_vport_cmd {
153 OVS_VPORT_CMD_UNSPEC,
154 OVS_VPORT_CMD_NEW,
155 OVS_VPORT_CMD_DEL,
156 OVS_VPORT_CMD_GET,
157 OVS_VPORT_CMD_SET
158};
159
160enum ovs_vport_type {
161 OVS_VPORT_TYPE_UNSPEC,
162 OVS_VPORT_TYPE_NETDEV, /* network device */
163 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
164 __OVS_VPORT_TYPE_MAX
165};
166
167#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
168
169/**
170 * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
171 * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
172 * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
173 * of vport.
174 * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
175 * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
176 * plus a null terminator.
177 * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
178 * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
179 * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
180 * this port. A value of zero indicates that upcalls should not be sent.
181 * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
182 * packets sent or received through the vport.
183 *
184 * These attributes follow the &struct ovs_header within the Generic Netlink
185 * payload for %OVS_VPORT_* commands.
186 *
187 * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
188 * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
189 * optional; if not specified a free port number is automatically selected.
190 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
191 * of vport.
192 * and other attributes are ignored.
193 *
194 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
195 * look up the vport to operate on; otherwise dp_idx from the &struct
196 * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
197 */
198enum ovs_vport_attr {
199 OVS_VPORT_ATTR_UNSPEC,
200 OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
201 OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
202 OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
203 OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
204 OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
205 OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
206 __OVS_VPORT_ATTR_MAX
207};
208
209#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
210
211/* Flows. */
212
213#define OVS_FLOW_FAMILY "ovs_flow"
214#define OVS_FLOW_MCGROUP "ovs_flow"
215#define OVS_FLOW_VERSION 0x1
216
217enum ovs_flow_cmd {
218 OVS_FLOW_CMD_UNSPEC,
219 OVS_FLOW_CMD_NEW,
220 OVS_FLOW_CMD_DEL,
221 OVS_FLOW_CMD_GET,
222 OVS_FLOW_CMD_SET
223};
224
225struct ovs_flow_stats {
226 __u64 n_packets; /* Number of matched packets. */
227 __u64 n_bytes; /* Number of matched bytes. */
228};
229
230enum ovs_key_attr {
231 OVS_KEY_ATTR_UNSPEC,
232 OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
233 OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
234 OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
235 OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
236 OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
237 OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
238 OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
239 OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
240 OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
241 OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
242 OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
246 __OVS_KEY_ATTR_MAX
247};
248
249#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
250
251/**
252 * enum ovs_frag_type - IPv4 and IPv6 fragment type
253 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
254 * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
255 * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
256 *
257 * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
258 * ovs_key_ipv6.
259 */
260enum ovs_frag_type {
261 OVS_FRAG_TYPE_NONE,
262 OVS_FRAG_TYPE_FIRST,
263 OVS_FRAG_TYPE_LATER,
264 __OVS_FRAG_TYPE_MAX
265};
266
267#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
268
269struct ovs_key_ethernet {
270 __u8 eth_src[6];
271 __u8 eth_dst[6];
272};
273
274struct ovs_key_ipv4 {
275 __be32 ipv4_src;
276 __be32 ipv4_dst;
277 __u8 ipv4_proto;
278 __u8 ipv4_tos;
279 __u8 ipv4_ttl;
280 __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
281};
282
283struct ovs_key_ipv6 {
284 __be32 ipv6_src[4];
285 __be32 ipv6_dst[4];
286 __be32 ipv6_label; /* 20-bits in least-significant bits. */
287 __u8 ipv6_proto;
288 __u8 ipv6_tclass;
289 __u8 ipv6_hlimit;
290 __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
291};
292
293struct ovs_key_tcp {
294 __be16 tcp_src;
295 __be16 tcp_dst;
296};
297
298struct ovs_key_udp {
299 __be16 udp_src;
300 __be16 udp_dst;
301};
302
303struct ovs_key_icmp {
304 __u8 icmp_type;
305 __u8 icmp_code;
306};
307
308struct ovs_key_icmpv6 {
309 __u8 icmpv6_type;
310 __u8 icmpv6_code;
311};
312
313struct ovs_key_arp {
314 __be32 arp_sip;
315 __be32 arp_tip;
316 __be16 arp_op;
317 __u8 arp_sha[6];
318 __u8 arp_tha[6];
319};
320
321struct ovs_key_nd {
322 __u32 nd_target[4];
323 __u8 nd_sll[6];
324 __u8 nd_tll[6];
325};
326
327/**
328 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
329 * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
330 * key. Always present in notifications. Required for all requests (except
331 * dumps).
332 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
333 * the actions to take for packets that match the key. Always present in
334 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
335 * %OVS_FLOW_CMD_SET requests.
336 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
337 * flow. Present in notifications if the stats would be nonzero. Ignored in
338 * requests.
339 * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
340 * TCP flags seen on packets in this flow. Only present in notifications for
341 * TCP flows, and only if it would be nonzero. Ignored in requests.
342 * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
343 * the system monotonic clock, at which a packet was last processed for this
344 * flow. Only present in notifications if a packet has been processed for this
345 * flow. Ignored in requests.
346 * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
347 * last-used time, accumulated TCP flags, and statistics for this flow.
348 * Otherwise ignored in requests. Never present in notifications.
349 *
350 * These attributes follow the &struct ovs_header within the Generic Netlink
351 * payload for %OVS_FLOW_* commands.
352 */
353enum ovs_flow_attr {
354 OVS_FLOW_ATTR_UNSPEC,
355 OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
356 OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
357 OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
358 OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
359 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
360 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
361 __OVS_FLOW_ATTR_MAX
362};
363
364#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
365
366/**
367 * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
368 * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
369 * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
370 * %UINT32_MAX samples all packets and intermediate values sample intermediate
371 * fractions of packets.
372 * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
373 * Actions are passed as nested attributes.
374 *
375 * Executes the specified actions with the given probability on a per-packet
376 * basis.
377 */
378enum ovs_sample_attr {
379 OVS_SAMPLE_ATTR_UNSPEC,
380 OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
381 OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
382 __OVS_SAMPLE_ATTR_MAX,
383};
384
385#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
386
387/**
388 * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
389 * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
390 * message should be sent. Required.
391 * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the
392 * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA,
393 */
394enum ovs_userspace_attr {
395 OVS_USERSPACE_ATTR_UNSPEC,
396 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
397 OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */
398 __OVS_USERSPACE_ATTR_MAX
399};
400
401#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
402
403/**
404 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
405 * @vlan_tpid: Tag protocol identifier (TPID) to push.
406 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
407 * (but it will not be set in the 802.1Q header that is pushed).
408 *
409 * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID
410 * values are those that the kernel module also parses as 802.1Q headers, to
411 * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN
412 * from having surprising results.
413 */
414struct ovs_action_push_vlan {
415 __be16 vlan_tpid; /* 802.1Q TPID. */
416 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
417};
418
419/**
420 * enum ovs_action_attr - Action types.
421 *
422 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
423 * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
424 * %OVS_USERSPACE_ATTR_* attributes.
425 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
426 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
427 * value.
428 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
429 * packet.
430 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
431 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
432 * the nested %OVS_SAMPLE_ATTR_* attributes.
433 *
434 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
435 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
436 * type may not be changed.
437 */
438
439enum ovs_action_attr {
440 OVS_ACTION_ATTR_UNSPEC,
441 OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
442 OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
443 OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
444 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
445 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
446 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
447 __OVS_ACTION_ATTR_MAX
448};
449
450#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
451
452#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
index b0638fd91e92..22691f614043 100644
--- a/include/linux/page-debug-flags.h
+++ b/include/linux/page-debug-flags.h
@@ -13,6 +13,7 @@
13 13
14enum page_debug_flags { 14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */ 15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16 PAGE_DEBUG_FLAG_GUARD,
16}; 17};
17 18
18/* 19/*
@@ -21,7 +22,8 @@ enum page_debug_flags {
21 */ 22 */
22 23
23#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS 24#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
24#if !defined(CONFIG_PAGE_POISONING) \ 25#if !defined(CONFIG_PAGE_POISONING) && \
26 !defined(CONFIG_PAGE_GUARD) \
25/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */ 27/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
26#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features! 28#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
27#endif 29#endif
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 961ecc7d30bc..a2d11771c84b 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -10,8 +10,6 @@ enum {
10 /* flags for mem_cgroup and file and I/O status */ 10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ 11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */ 12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 /* No lock in page_cgroup */
14 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
15 __NR_PCG_FLAGS, 13 __NR_PCG_FLAGS,
16}; 14};
17 15
@@ -31,7 +29,6 @@ enum {
31struct page_cgroup { 29struct page_cgroup {
32 unsigned long flags; 30 unsigned long flags;
33 struct mem_cgroup *mem_cgroup; 31 struct mem_cgroup *mem_cgroup;
34 struct list_head lru; /* per cgroup LRU list */
35}; 32};
36 33
37void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 34void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat);
@@ -76,12 +73,6 @@ TESTPCGFLAG(Used, USED)
76CLEARPCGFLAG(Used, USED) 73CLEARPCGFLAG(Used, USED)
77SETPCGFLAG(Used, USED) 74SETPCGFLAG(Used, USED)
78 75
79SETPCGFLAG(AcctLRU, ACCT_LRU)
80CLEARPCGFLAG(AcctLRU, ACCT_LRU)
81TESTPCGFLAG(AcctLRU, ACCT_LRU)
82TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
83
84
85SETPCGFLAG(FileMapped, FILE_MAPPED) 76SETPCGFLAG(FileMapped, FILE_MAPPED)
86CLEARPCGFLAG(FileMapped, FILE_MAPPED) 77CLEARPCGFLAG(FileMapped, FILE_MAPPED)
87TESTPCGFLAG(FileMapped, FILE_MAPPED) 78TESTPCGFLAG(FileMapped, FILE_MAPPED)
@@ -122,39 +113,6 @@ static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
122 local_irq_restore(*flags); 113 local_irq_restore(*flags);
123} 114}
124 115
125#ifdef CONFIG_SPARSEMEM
126#define PCG_ARRAYID_WIDTH SECTIONS_SHIFT
127#else
128#define PCG_ARRAYID_WIDTH NODES_SHIFT
129#endif
130
131#if (PCG_ARRAYID_WIDTH > BITS_PER_LONG - NR_PCG_FLAGS)
132#error Not enough space left in pc->flags to store page_cgroup array IDs
133#endif
134
135/* pc->flags: ARRAY-ID | FLAGS */
136
137#define PCG_ARRAYID_MASK ((1UL << PCG_ARRAYID_WIDTH) - 1)
138
139#define PCG_ARRAYID_OFFSET (BITS_PER_LONG - PCG_ARRAYID_WIDTH)
140/*
141 * Zero the shift count for non-existent fields, to prevent compiler
142 * warnings and ensure references are optimized away.
143 */
144#define PCG_ARRAYID_SHIFT (PCG_ARRAYID_OFFSET * (PCG_ARRAYID_WIDTH != 0))
145
146static inline void set_page_cgroup_array_id(struct page_cgroup *pc,
147 unsigned long id)
148{
149 pc->flags &= ~(PCG_ARRAYID_MASK << PCG_ARRAYID_SHIFT);
150 pc->flags |= (id & PCG_ARRAYID_MASK) << PCG_ARRAYID_SHIFT;
151}
152
153static inline unsigned long page_cgroup_array_id(struct page_cgroup *pc)
154{
155 return (pc->flags >> PCG_ARRAYID_SHIFT) & PCG_ARRAYID_MASK;
156}
157
158#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 116#else /* CONFIG_CGROUP_MEM_RES_CTLR */
159struct page_cgroup; 117struct page_cgroup;
160 118
@@ -183,7 +141,7 @@ static inline void __init page_cgroup_init_flatmem(void)
183extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, 141extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
184 unsigned short old, unsigned short new); 142 unsigned short old, unsigned short new);
185extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 143extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
186extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 144extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
187extern int swap_cgroup_swapon(int type, unsigned long max_pages); 145extern int swap_cgroup_swapon(int type, unsigned long max_pages);
188extern void swap_cgroup_swapoff(int type); 146extern void swap_cgroup_swapoff(int type);
189#else 147#else
@@ -195,7 +153,7 @@ unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
195} 153}
196 154
197static inline 155static inline
198unsigned short lookup_swap_cgroup(swp_entry_t ent) 156unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
199{ 157{
200 return 0; 158 return 0;
201} 159}
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index bab82f4c571c..2aa12b8499c0 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,9 +21,7 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_free(struct pagevec *pvec); 24void __pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
26void pagevec_strip(struct pagevec *pvec);
27unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
28 pgoff_t start, unsigned nr_pages); 26 pgoff_t start, unsigned nr_pages);
29unsigned pagevec_lookup_tag(struct pagevec *pvec, 27unsigned pagevec_lookup_tag(struct pagevec *pvec,
@@ -60,37 +58,30 @@ static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page)
60 return pagevec_space(pvec); 58 return pagevec_space(pvec);
61} 59}
62 60
63
64static inline void pagevec_release(struct pagevec *pvec) 61static inline void pagevec_release(struct pagevec *pvec)
65{ 62{
66 if (pagevec_count(pvec)) 63 if (pagevec_count(pvec))
67 __pagevec_release(pvec); 64 __pagevec_release(pvec);
68} 65}
69 66
70static inline void pagevec_free(struct pagevec *pvec)
71{
72 if (pagevec_count(pvec))
73 __pagevec_free(pvec);
74}
75
76static inline void __pagevec_lru_add_anon(struct pagevec *pvec) 67static inline void __pagevec_lru_add_anon(struct pagevec *pvec)
77{ 68{
78 ____pagevec_lru_add(pvec, LRU_INACTIVE_ANON); 69 __pagevec_lru_add(pvec, LRU_INACTIVE_ANON);
79} 70}
80 71
81static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec) 72static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec)
82{ 73{
83 ____pagevec_lru_add(pvec, LRU_ACTIVE_ANON); 74 __pagevec_lru_add(pvec, LRU_ACTIVE_ANON);
84} 75}
85 76
86static inline void __pagevec_lru_add_file(struct pagevec *pvec) 77static inline void __pagevec_lru_add_file(struct pagevec *pvec)
87{ 78{
88 ____pagevec_lru_add(pvec, LRU_INACTIVE_FILE); 79 __pagevec_lru_add(pvec, LRU_INACTIVE_FILE);
89} 80}
90 81
91static inline void __pagevec_lru_add_active_file(struct pagevec *pvec) 82static inline void __pagevec_lru_add_active_file(struct pagevec *pvec)
92{ 83{
93 ____pagevec_lru_add(pvec, LRU_ACTIVE_FILE); 84 __pagevec_lru_add(pvec, LRU_ACTIVE_FILE);
94} 85}
95 86
96static inline void pagevec_lru_add_file(struct pagevec *pvec) 87static inline void pagevec_lru_add_file(struct pagevec *pvec)
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 7cea7b6c1413..c8320144fe79 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -29,7 +29,7 @@ extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32extern void pcie_clear_aspm(void); 32extern void pcie_clear_aspm(struct pci_bus *bus);
33extern void pcie_no_aspm(void); 33extern void pcie_no_aspm(void);
34#else 34#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
@@ -47,7 +47,7 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
47static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 47static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
48{ 48{
49} 49}
50static inline void pcie_clear_aspm(void) 50static inline void pcie_clear_aspm(struct pci_bus *bus)
51{ 51{
52} 52}
53static inline void pcie_no_aspm(void) 53static inline void pcie_no_aspm(void)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7cda65b5f798..a16b1df3deff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -111,7 +111,7 @@ enum {
111 PCI_NUM_RESOURCES, 111 PCI_NUM_RESOURCES,
112 112
113 /* preserve this for compatibility */ 113 /* preserve this for compatibility */
114 DEVICE_COUNT_RESOURCE 114 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES,
115}; 115};
116 116
117typedef int __bitwise pci_power_t; 117typedef int __bitwise pci_power_t;
@@ -308,7 +308,7 @@ struct pci_dev {
308 unsigned int is_added:1; 308 unsigned int is_added:1;
309 unsigned int is_busmaster:1; /* device is busmaster */ 309 unsigned int is_busmaster:1; /* device is busmaster */
310 unsigned int no_msi:1; /* device may not use msi */ 310 unsigned int no_msi:1; /* device may not use msi */
311 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 311 unsigned int block_cfg_access:1; /* config space access is blocked */
312 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 312 unsigned int broken_parity_status:1; /* Device generates false positive parity */
313 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 313 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
314 unsigned int msi_enabled:1; 314 unsigned int msi_enabled:1;
@@ -336,6 +336,7 @@ struct pci_dev {
336 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ 336 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
337#ifdef CONFIG_PCI_MSI 337#ifdef CONFIG_PCI_MSI
338 struct list_head msi_list; 338 struct list_head msi_list;
339 struct kset *msi_kset;
339#endif 340#endif
340 struct pci_vpd *vpd; 341 struct pci_vpd *vpd;
341#ifdef CONFIG_PCI_ATS 342#ifdef CONFIG_PCI_ATS
@@ -660,17 +661,13 @@ extern struct pci_bus *pci_find_bus(int domain, int busnr);
660void pci_bus_add_devices(const struct pci_bus *bus); 661void pci_bus_add_devices(const struct pci_bus *bus);
661struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 662struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
662 struct pci_ops *ops, void *sysdata); 663 struct pci_ops *ops, void *sysdata);
663static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 664struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
664 void *sysdata) 665struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
665{ 666 struct pci_ops *ops, void *sysdata,
666 struct pci_bus *root_bus; 667 struct list_head *resources);
667 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); 668struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
668 if (root_bus) 669 struct pci_ops *ops, void *sysdata,
669 pci_bus_add_devices(root_bus); 670 struct list_head *resources);
670 return root_bus;
671}
672struct pci_bus *pci_create_bus(struct device *parent, int bus,
673 struct pci_ops *ops, void *sysdata);
674struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 671struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
675 int busnr); 672 int busnr);
676void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); 673void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
@@ -794,8 +791,11 @@ static inline int pci_is_managed(struct pci_dev *pdev)
794} 791}
795 792
796void pci_disable_device(struct pci_dev *dev); 793void pci_disable_device(struct pci_dev *dev);
794
795extern unsigned int pcibios_max_latency;
797void pci_set_master(struct pci_dev *dev); 796void pci_set_master(struct pci_dev *dev);
798void pci_clear_master(struct pci_dev *dev); 797void pci_clear_master(struct pci_dev *dev);
798
799int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 799int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
800int pci_set_cacheline_size(struct pci_dev *dev); 800int pci_set_cacheline_size(struct pci_dev *dev);
801#define HAVE_PCI_SET_MWI 801#define HAVE_PCI_SET_MWI
@@ -803,6 +803,9 @@ int __must_check pci_set_mwi(struct pci_dev *dev);
803int pci_try_set_mwi(struct pci_dev *dev); 803int pci_try_set_mwi(struct pci_dev *dev);
804void pci_clear_mwi(struct pci_dev *dev); 804void pci_clear_mwi(struct pci_dev *dev);
805void pci_intx(struct pci_dev *dev, int enable); 805void pci_intx(struct pci_dev *dev, int enable);
806bool pci_intx_mask_supported(struct pci_dev *dev);
807bool pci_check_and_mask_intx(struct pci_dev *dev);
808bool pci_check_and_unmask_intx(struct pci_dev *dev);
806void pci_msi_off(struct pci_dev *dev); 809void pci_msi_off(struct pci_dev *dev);
807int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 810int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
808int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 811int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
@@ -910,6 +913,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
910void pci_release_selected_regions(struct pci_dev *, int); 913void pci_release_selected_regions(struct pci_dev *, int);
911 914
912/* drivers/pci/bus.c */ 915/* drivers/pci/bus.c */
916void pci_add_resource(struct list_head *resources, struct resource *res);
917void pci_free_resource_list(struct list_head *resources);
913void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); 918void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
914struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); 919struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
915void pci_bus_remove_resources(struct pci_bus *bus); 920void pci_bus_remove_resources(struct pci_bus *bus);
@@ -1084,8 +1089,9 @@ int ht_create_irq(struct pci_dev *dev, int idx);
1084void ht_destroy_irq(unsigned int irq); 1089void ht_destroy_irq(unsigned int irq);
1085#endif /* CONFIG_HT_IRQ */ 1090#endif /* CONFIG_HT_IRQ */
1086 1091
1087extern void pci_block_user_cfg_access(struct pci_dev *dev); 1092extern void pci_cfg_access_lock(struct pci_dev *dev);
1088extern void pci_unblock_user_cfg_access(struct pci_dev *dev); 1093extern bool pci_cfg_access_trylock(struct pci_dev *dev);
1094extern void pci_cfg_access_unlock(struct pci_dev *dev);
1089 1095
1090/* 1096/*
1091 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1097 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
@@ -1282,10 +1288,13 @@ static inline void pci_release_regions(struct pci_dev *dev)
1282 1288
1283#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 1289#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
1284 1290
1285static inline void pci_block_user_cfg_access(struct pci_dev *dev) 1291static inline void pci_block_cfg_access(struct pci_dev *dev)
1286{ } 1292{ }
1287 1293
1288static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) 1294static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev)
1295{ return 0; }
1296
1297static inline void pci_unblock_cfg_access(struct pci_dev *dev)
1289{ } 1298{ }
1290 1299
1291static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 1300static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
@@ -1423,10 +1432,10 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
1423void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1432void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
1424void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1433void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
1425void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); 1434void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
1426int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 1435int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
1427int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask, 1436int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
1428 const char *name); 1437 const char *name);
1429void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); 1438void pcim_iounmap_regions(struct pci_dev *pdev, int mask);
1430 1439
1431extern int pci_pci_problems; 1440extern int pci_pci_problems;
1432#define PCIPCI_FAIL 1 /* No PCI PCI DMA */ 1441#define PCIPCI_FAIL 1 /* No PCI PCI DMA */
@@ -1445,8 +1454,10 @@ extern u8 pci_cache_line_size;
1445extern unsigned long pci_hotplug_io_size; 1454extern unsigned long pci_hotplug_io_size;
1446extern unsigned long pci_hotplug_mem_size; 1455extern unsigned long pci_hotplug_mem_size;
1447 1456
1457/* Architecture specific versions may override these (weak) */
1448int pcibios_add_platform_entries(struct pci_dev *dev); 1458int pcibios_add_platform_entries(struct pci_dev *dev);
1449void pcibios_disable_device(struct pci_dev *dev); 1459void pcibios_disable_device(struct pci_dev *dev);
1460void pcibios_set_master(struct pci_dev *dev);
1450int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1461int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1451 enum pcie_reset_state state); 1462 enum pcie_reset_state state);
1452 1463
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2aaee0ca9da8..31d77af2ef42 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -776,6 +776,29 @@
776#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 776#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
777 777
778#define PCI_VENDOR_ID_STMICRO 0x104A 778#define PCI_VENDOR_ID_STMICRO 0x104A
779#define PCI_DEVICE_ID_STMICRO_USB_HOST 0xCC00
780#define PCI_DEVICE_ID_STMICRO_USB_OHCI 0xCC01
781#define PCI_DEVICE_ID_STMICRO_USB_OTG 0xCC02
782#define PCI_DEVICE_ID_STMICRO_UART_HWFC 0xCC03
783#define PCI_DEVICE_ID_STMICRO_UART_NO_HWFC 0xCC04
784#define PCI_DEVICE_ID_STMICRO_SOC_DMA 0xCC05
785#define PCI_DEVICE_ID_STMICRO_SATA 0xCC06
786#define PCI_DEVICE_ID_STMICRO_I2C 0xCC07
787#define PCI_DEVICE_ID_STMICRO_SPI_HS 0xCC08
788#define PCI_DEVICE_ID_STMICRO_MAC 0xCC09
789#define PCI_DEVICE_ID_STMICRO_SDIO_EMMC 0xCC0A
790#define PCI_DEVICE_ID_STMICRO_SDIO 0xCC0B
791#define PCI_DEVICE_ID_STMICRO_GPIO 0xCC0C
792#define PCI_DEVICE_ID_STMICRO_VIP 0xCC0D
793#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_DMA 0xCC0E
794#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_SRCS 0xCC0F
795#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_MSPS 0xCC10
796#define PCI_DEVICE_ID_STMICRO_CAN 0xCC11
797#define PCI_DEVICE_ID_STMICRO_MLB 0xCC12
798#define PCI_DEVICE_ID_STMICRO_DBP 0xCC13
799#define PCI_DEVICE_ID_STMICRO_SATA_PHY 0xCC14
800#define PCI_DEVICE_ID_STMICRO_ESRAM 0xCC15
801#define PCI_DEVICE_ID_STMICRO_VIC 0xCC16
779 802
780#define PCI_VENDOR_ID_BUSLOGIC 0x104B 803#define PCI_VENDOR_ID_BUSLOGIC 0x104B
781#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 804#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index b5d9657f3100..e41a10f5ae83 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -392,7 +392,7 @@
392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ 394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
395#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */ 395#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
397#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ 397#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
398#define PCI_EXP_DEVCAP 4 /* Device capabilities */ 398#define PCI_EXP_DEVCAP 4 /* Device capabilities */
@@ -537,7 +537,9 @@
537#define PCI_EXT_CAP_ID_ARI 14 537#define PCI_EXT_CAP_ID_ARI 14
538#define PCI_EXT_CAP_ID_ATS 15 538#define PCI_EXT_CAP_ID_ATS 15
539#define PCI_EXT_CAP_ID_SRIOV 16 539#define PCI_EXT_CAP_ID_SRIOV 16
540#define PCI_EXT_CAP_ID_PRI 19
540#define PCI_EXT_CAP_ID_LTR 24 541#define PCI_EXT_CAP_ID_LTR 24
542#define PCI_EXT_CAP_ID_PASID 27
541 543
542/* Advanced Error Reporting */ 544/* Advanced Error Reporting */
543#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 545#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -664,24 +666,24 @@
664#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ 666#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */
665 667
666/* Page Request Interface */ 668/* Page Request Interface */
667#define PCI_PRI_CAP 0x13 /* PRI capability ID */ 669#define PCI_PRI_CTRL 0x04 /* PRI control register */
668#define PCI_PRI_CONTROL_OFF 0x04 /* Offset of control register */ 670#define PCI_PRI_CTRL_ENABLE 0x01 /* Enable */
669#define PCI_PRI_STATUS_OFF 0x06 /* Offset of status register */ 671#define PCI_PRI_CTRL_RESET 0x02 /* Reset */
670#define PCI_PRI_ENABLE 0x0001 /* Enable mask */ 672#define PCI_PRI_STATUS 0x06 /* PRI status register */
671#define PCI_PRI_RESET 0x0002 /* Reset bit mask */ 673#define PCI_PRI_STATUS_RF 0x001 /* Response Failure */
672#define PCI_PRI_STATUS_RF 0x0001 /* Request Failure */ 674#define PCI_PRI_STATUS_UPRGI 0x002 /* Unexpected PRG index */
673#define PCI_PRI_STATUS_UPRGI 0x0002 /* Unexpected PRG index */ 675#define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */
674#define PCI_PRI_STATUS_STOPPED 0x0100 /* PRI Stopped */ 676#define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */
675#define PCI_PRI_MAX_REQ_OFF 0x08 /* Cap offset for max reqs supported */ 677#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */
676#define PCI_PRI_ALLOC_REQ_OFF 0x0c /* Cap offset for max reqs allowed */
677 678
678/* PASID capability */ 679/* PASID capability */
679#define PCI_PASID_CAP 0x1b /* PASID capability ID */ 680#define PCI_PASID_CAP 0x04 /* PASID feature register */
680#define PCI_PASID_CAP_OFF 0x04 /* PASID feature register */ 681#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */
681#define PCI_PASID_CONTROL_OFF 0x06 /* PASID control register */ 682#define PCI_PASID_CAP_PRIV 0x04 /* Priviledge Mode Supported */
682#define PCI_PASID_ENABLE 0x01 /* Enable/Supported bit */ 683#define PCI_PASID_CTRL 0x06 /* PASID control register */
683#define PCI_PASID_EXEC 0x02 /* Exec permissions Enable/Supported */ 684#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */
684#define PCI_PASID_PRIV 0x04 /* Priviledge Mode Enable/Support */ 685#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */
686#define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */
685 687
686/* Single Root I/O Virtualization */ 688/* Single Root I/O Virtualization */
687#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ 689#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index c9e4d814ff77..2bb62bf296ac 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -35,6 +35,8 @@ struct pda_power_pdata {
35 unsigned int polling_interval; /* msecs, default is 2000 */ 35 unsigned int polling_interval; /* msecs, default is 2000 */
36 36
37 unsigned long ac_max_uA; /* current to draw when on AC */ 37 unsigned long ac_max_uA; /* current to draw when on AC */
38
39 bool use_otg_notifier;
38}; 40};
39 41
40#endif /* __PDA_POWER_H__ */ 42#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 9ca008f0c542..32cd1f67462e 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -172,10 +172,10 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
172 * equal char, int or long. percpu_read() evaluates to a lvalue and 172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void. 173 * all others to void.
174 * 174 *
175 * These operations are guaranteed to be atomic w.r.t. preemption. 175 * These operations are guaranteed to be atomic.
176 * The generic versions use plain get/put_cpu_var(). Archs are 176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't 177 * encouraged to implement single-instruction alternatives which don't
178 * require preemption protection. 178 * require protection.
179 */ 179 */
180#ifndef percpu_read 180#ifndef percpu_read
181# define percpu_read(var) \ 181# define percpu_read(var) \
@@ -347,9 +347,10 @@ do { \
347 347
348#define _this_cpu_generic_to_op(pcp, val, op) \ 348#define _this_cpu_generic_to_op(pcp, val, op) \
349do { \ 349do { \
350 preempt_disable(); \ 350 unsigned long flags; \
351 local_irq_save(flags); \
351 *__this_cpu_ptr(&(pcp)) op val; \ 352 *__this_cpu_ptr(&(pcp)) op val; \
352 preempt_enable(); \ 353 local_irq_restore(flags); \
353} while (0) 354} while (0)
354 355
355#ifndef this_cpu_write 356#ifndef this_cpu_write
@@ -447,10 +448,11 @@ do { \
447#define _this_cpu_generic_add_return(pcp, val) \ 448#define _this_cpu_generic_add_return(pcp, val) \
448({ \ 449({ \
449 typeof(pcp) ret__; \ 450 typeof(pcp) ret__; \
450 preempt_disable(); \ 451 unsigned long flags; \
452 local_irq_save(flags); \
451 __this_cpu_add(pcp, val); \ 453 __this_cpu_add(pcp, val); \
452 ret__ = __this_cpu_read(pcp); \ 454 ret__ = __this_cpu_read(pcp); \
453 preempt_enable(); \ 455 local_irq_restore(flags); \
454 ret__; \ 456 ret__; \
455}) 457})
456 458
@@ -476,10 +478,11 @@ do { \
476 478
477#define _this_cpu_generic_xchg(pcp, nval) \ 479#define _this_cpu_generic_xchg(pcp, nval) \
478({ typeof(pcp) ret__; \ 480({ typeof(pcp) ret__; \
479 preempt_disable(); \ 481 unsigned long flags; \
482 local_irq_save(flags); \
480 ret__ = __this_cpu_read(pcp); \ 483 ret__ = __this_cpu_read(pcp); \
481 __this_cpu_write(pcp, nval); \ 484 __this_cpu_write(pcp, nval); \
482 preempt_enable(); \ 485 local_irq_restore(flags); \
483 ret__; \ 486 ret__; \
484}) 487})
485 488
@@ -501,12 +504,14 @@ do { \
501#endif 504#endif
502 505
503#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \ 506#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
504({ typeof(pcp) ret__; \ 507({ \
505 preempt_disable(); \ 508 typeof(pcp) ret__; \
509 unsigned long flags; \
510 local_irq_save(flags); \
506 ret__ = __this_cpu_read(pcp); \ 511 ret__ = __this_cpu_read(pcp); \
507 if (ret__ == (oval)) \ 512 if (ret__ == (oval)) \
508 __this_cpu_write(pcp, nval); \ 513 __this_cpu_write(pcp, nval); \
509 preempt_enable(); \ 514 local_irq_restore(flags); \
510 ret__; \ 515 ret__; \
511}) 516})
512 517
@@ -538,10 +543,11 @@ do { \
538#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 543#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
539({ \ 544({ \
540 int ret__; \ 545 int ret__; \
541 preempt_disable(); \ 546 unsigned long flags; \
547 local_irq_save(flags); \
542 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ 548 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
543 oval1, oval2, nval1, nval2); \ 549 oval1, oval2, nval1, nval2); \
544 preempt_enable(); \ 550 local_irq_restore(flags); \
545 ret__; \ 551 ret__; \
546}) 552})
547 553
@@ -567,9 +573,9 @@ do { \
567#endif 573#endif
568 574
569/* 575/*
570 * Generic percpu operations that do not require preemption handling. 576 * Generic percpu operations for context that are safe from preemption/interrupts.
571 * Either we do not care about races or the caller has the 577 * Either we do not care about races or the caller has the
572 * responsibility of handling preemptions issues. Arch code can still 578 * responsibility of handling preemption/interrupt issues. Arch code can still
573 * override these instructions since the arch per cpu code may be more 579 * override these instructions since the arch per cpu code may be more
574 * efficient and may actually get race freeness for free (that is the 580 * efficient and may actually get race freeness for free (that is the
575 * case for x86 for example). 581 * case for x86 for example).
@@ -802,156 +808,4 @@ do { \
802 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 808 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
803#endif 809#endif
804 810
805/*
806 * IRQ safe versions of the per cpu RMW operations. Note that these operations
807 * are *not* safe against modification of the same variable from another
808 * processors (which one gets when using regular atomic operations)
809 * They are guaranteed to be atomic vs. local interrupts and
810 * preemption only.
811 */
812#define irqsafe_cpu_generic_to_op(pcp, val, op) \
813do { \
814 unsigned long flags; \
815 local_irq_save(flags); \
816 *__this_cpu_ptr(&(pcp)) op val; \
817 local_irq_restore(flags); \
818} while (0)
819
820#ifndef irqsafe_cpu_add
821# ifndef irqsafe_cpu_add_1
822# define irqsafe_cpu_add_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
823# endif
824# ifndef irqsafe_cpu_add_2
825# define irqsafe_cpu_add_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
826# endif
827# ifndef irqsafe_cpu_add_4
828# define irqsafe_cpu_add_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
829# endif
830# ifndef irqsafe_cpu_add_8
831# define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
832# endif
833# define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val))
834#endif
835
836#ifndef irqsafe_cpu_sub
837# define irqsafe_cpu_sub(pcp, val) irqsafe_cpu_add((pcp), -(val))
838#endif
839
840#ifndef irqsafe_cpu_inc
841# define irqsafe_cpu_inc(pcp) irqsafe_cpu_add((pcp), 1)
842#endif
843
844#ifndef irqsafe_cpu_dec
845# define irqsafe_cpu_dec(pcp) irqsafe_cpu_sub((pcp), 1)
846#endif
847
848#ifndef irqsafe_cpu_and
849# ifndef irqsafe_cpu_and_1
850# define irqsafe_cpu_and_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
851# endif
852# ifndef irqsafe_cpu_and_2
853# define irqsafe_cpu_and_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
854# endif
855# ifndef irqsafe_cpu_and_4
856# define irqsafe_cpu_and_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
857# endif
858# ifndef irqsafe_cpu_and_8
859# define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
860# endif
861# define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val))
862#endif
863
864#ifndef irqsafe_cpu_or
865# ifndef irqsafe_cpu_or_1
866# define irqsafe_cpu_or_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
867# endif
868# ifndef irqsafe_cpu_or_2
869# define irqsafe_cpu_or_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
870# endif
871# ifndef irqsafe_cpu_or_4
872# define irqsafe_cpu_or_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
873# endif
874# ifndef irqsafe_cpu_or_8
875# define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
876# endif
877# define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val))
878#endif
879
880#ifndef irqsafe_cpu_xor
881# ifndef irqsafe_cpu_xor_1
882# define irqsafe_cpu_xor_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
883# endif
884# ifndef irqsafe_cpu_xor_2
885# define irqsafe_cpu_xor_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
886# endif
887# ifndef irqsafe_cpu_xor_4
888# define irqsafe_cpu_xor_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
889# endif
890# ifndef irqsafe_cpu_xor_8
891# define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
892# endif
893# define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
894#endif
895
896#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval) \
897({ \
898 typeof(pcp) ret__; \
899 unsigned long flags; \
900 local_irq_save(flags); \
901 ret__ = __this_cpu_read(pcp); \
902 if (ret__ == (oval)) \
903 __this_cpu_write(pcp, nval); \
904 local_irq_restore(flags); \
905 ret__; \
906})
907
908#ifndef irqsafe_cpu_cmpxchg
909# ifndef irqsafe_cpu_cmpxchg_1
910# define irqsafe_cpu_cmpxchg_1(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
911# endif
912# ifndef irqsafe_cpu_cmpxchg_2
913# define irqsafe_cpu_cmpxchg_2(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
914# endif
915# ifndef irqsafe_cpu_cmpxchg_4
916# define irqsafe_cpu_cmpxchg_4(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
917# endif
918# ifndef irqsafe_cpu_cmpxchg_8
919# define irqsafe_cpu_cmpxchg_8(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
920# endif
921# define irqsafe_cpu_cmpxchg(pcp, oval, nval) \
922 __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval)
923#endif
924
925#define irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
926({ \
927 int ret__; \
928 unsigned long flags; \
929 local_irq_save(flags); \
930 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
931 oval1, oval2, nval1, nval2); \
932 local_irq_restore(flags); \
933 ret__; \
934})
935
936#ifndef irqsafe_cpu_cmpxchg_double
937# ifndef irqsafe_cpu_cmpxchg_double_1
938# define irqsafe_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
939 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
940# endif
941# ifndef irqsafe_cpu_cmpxchg_double_2
942# define irqsafe_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
943 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
944# endif
945# ifndef irqsafe_cpu_cmpxchg_double_4
946# define irqsafe_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
947 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
948# endif
949# ifndef irqsafe_cpu_cmpxchg_double_8
950# define irqsafe_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
951 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
952# endif
953# define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
954 __pcpu_double_call_return_bool(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
955#endif
956
957#endif /* __LINUX_PERCPU_H */ 811#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index b1f89122bf6a..08855613ceb3 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -54,6 +54,7 @@ enum perf_hw_id {
54 PERF_COUNT_HW_BUS_CYCLES = 6, 54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, 55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, 56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
57 PERF_COUNT_HW_REF_CPU_CYCLES = 9,
57 58
58 PERF_COUNT_HW_MAX, /* non-ABI */ 59 PERF_COUNT_HW_MAX, /* non-ABI */
59}; 60};
@@ -890,6 +891,7 @@ struct perf_event_context {
890 int nr_active; 891 int nr_active;
891 int is_active; 892 int is_active;
892 int nr_stat; 893 int nr_stat;
894 int nr_freq;
893 int rotate_disable; 895 int rotate_disable;
894 atomic_t refcount; 896 atomic_t refcount;
895 struct task_struct *task; 897 struct task_struct *task;
@@ -1063,12 +1065,12 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1063 } 1065 }
1064} 1066}
1065 1067
1066extern struct jump_label_key perf_sched_events; 1068extern struct jump_label_key_deferred perf_sched_events;
1067 1069
1068static inline void perf_event_task_sched_in(struct task_struct *prev, 1070static inline void perf_event_task_sched_in(struct task_struct *prev,
1069 struct task_struct *task) 1071 struct task_struct *task)
1070{ 1072{
1071 if (static_branch(&perf_sched_events)) 1073 if (static_branch(&perf_sched_events.key))
1072 __perf_event_task_sched_in(prev, task); 1074 __perf_event_task_sched_in(prev, task);
1073} 1075}
1074 1076
@@ -1077,7 +1079,7 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
1077{ 1079{
1078 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); 1080 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1079 1081
1080 if (static_branch(&perf_sched_events)) 1082 if (static_branch(&perf_sched_events.key))
1081 __perf_event_task_sched_out(prev, next); 1083 __perf_event_task_sched_out(prev, next);
1082} 1084}
1083 1085
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index f53a4167c5f4..f48bfc80cb4b 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -38,6 +38,7 @@
38#define PNPIPE_ENCAP 1 38#define PNPIPE_ENCAP 1
39#define PNPIPE_IFINDEX 2 39#define PNPIPE_IFINDEX 2
40#define PNPIPE_HANDLE 3 40#define PNPIPE_HANDLE 3
41#define PNPIPE_INITSTATE 4
41 42
42#define PNADDR_ANY 0 43#define PNADDR_ANY 0
43#define PNADDR_BROADCAST 0xFC 44#define PNADDR_BROADCAST 0xFC
@@ -49,6 +50,7 @@
49 50
50/* ioctls */ 51/* ioctls */
51#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) 52#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
53#define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13)
52#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14) 54#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14)
53#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15) 55#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15)
54 56
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 79f337c47388..c599f7eca1e7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -129,7 +129,12 @@ struct mii_bus {
129}; 129};
130#define to_mii_bus(d) container_of(d, struct mii_bus, dev) 130#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
131 131
132struct mii_bus *mdiobus_alloc(void); 132struct mii_bus *mdiobus_alloc_size(size_t);
133static inline struct mii_bus *mdiobus_alloc(void)
134{
135 return mdiobus_alloc_size(0);
136}
137
133int mdiobus_register(struct mii_bus *bus); 138int mdiobus_register(struct mii_bus *bus);
134void mdiobus_unregister(struct mii_bus *bus); 139void mdiobus_unregister(struct mii_bus *bus);
135void mdiobus_free(struct mii_bus *bus); 140void mdiobus_free(struct mii_bus *bus);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 38d10326246a..e7cf6669ac34 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -30,6 +30,8 @@ struct pid_namespace {
30#ifdef CONFIG_BSD_PROCESS_ACCT 30#ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct; 31 struct bsd_acct_struct *bacct;
32#endif 32#endif
33 gid_t pid_gid;
34 int hide_pid;
33}; 35};
34 36
35extern struct pid_namespace init_pid_ns; 37extern struct pid_namespace init_pid_ns;
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index 88863531d862..d0aecb7f6fb9 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -48,7 +48,7 @@ struct pinmux_map {
48 const char *group; 48 const char *group;
49 struct device *dev; 49 struct device *dev;
50 const char *dev_name; 50 const char *dev_name;
51 const bool hog_on_boot; 51 bool hog_on_boot;
52}; 52};
53 53
54/* 54/*
@@ -66,30 +66,22 @@ struct pinmux_map {
66 { .name = a, .ctrl_dev_name = b, .function = c } 66 { .name = a, .ctrl_dev_name = b, .function = c }
67 67
68/* 68/*
69 * Convenience macro to map a function onto the primary device pinctrl device 69 * Convenience macro to map a system function onto a certain pinctrl device,
70 * this is especially helpful on systems that have only one pin controller 70 * to be hogged by the pinmux core until the system shuts down.
71 * or need to set up a lot of mappings on the primary controller.
72 */
73#define PINMUX_MAP_PRIMARY(a, b, c) \
74 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \
75 .dev_name = c }
76
77/*
78 * Convenience macro to map a system function onto the primary pinctrl device.
79 * System functions are not assigned to a particular device.
80 */ 71 */
81#define PINMUX_MAP_PRIMARY_SYS(a, b) \ 72#define PINMUX_MAP_SYS_HOG(a, b, c) \
82 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b } 73 { .name = a, .ctrl_dev_name = b, .function = c, \
74 .hog_on_boot = true }
83 75
84/* 76/*
85 * Convenience macro to map a system function onto the primary pinctrl device, 77 * Convenience macro to map a system function onto a certain pinctrl device
86 * to be hogged by the pinmux core until the system shuts down. 78 * using a specified group, to be hogged by the pinmux core until the system
79 * shuts down.
87 */ 80 */
88#define PINMUX_MAP_PRIMARY_SYS_HOG(a, b) \ 81#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \
89 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \ 82 { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \
90 .hog_on_boot = true } 83 .hog_on_boot = true }
91 84
92
93#ifdef CONFIG_PINMUX 85#ifdef CONFIG_PINMUX
94 86
95extern int pinmux_register_mappings(struct pinmux_map const *map, 87extern int pinmux_register_mappings(struct pinmux_map const *map,
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
new file mode 100644
index 000000000000..477922cf043a
--- /dev/null
+++ b/include/linux/pinctrl/pinconf.h
@@ -0,0 +1,97 @@
1/*
2 * Interface the pinconfig portions of the pinctrl subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * This interface is used in the core to keep track of pins.
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_PINCONF_H
13#define __LINUX_PINCTRL_PINCONF_H
14
15#ifdef CONFIG_PINCONF
16
17struct pinctrl_dev;
18struct seq_file;
19
20/**
21 * struct pinconf_ops - pin config operations, to be implemented by
22 * pin configuration capable drivers.
23 * @pin_config_get: get the config of a certain pin, if the requested config
24 * is not available on this controller this should return -ENOTSUPP
25 * and if it is available but disabled it should return -EINVAL
26 * @pin_config_get: get the config of a certain pin
27 * @pin_config_set: configure an individual pin
28 * @pin_config_group_get: get configurations for an entire pin group
29 * @pin_config_group_set: configure all pins in a group
30 * @pin_config_dbg_show: optional debugfs display hook that will provide
31 * per-device info for a certain pin in debugfs
32 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
33 * per-device info for a certain group in debugfs
34 */
35struct pinconf_ops {
36 int (*pin_config_get) (struct pinctrl_dev *pctldev,
37 unsigned pin,
38 unsigned long *config);
39 int (*pin_config_set) (struct pinctrl_dev *pctldev,
40 unsigned pin,
41 unsigned long config);
42 int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
43 unsigned selector,
44 unsigned long *config);
45 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
46 unsigned selector,
47 unsigned long config);
48 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
49 struct seq_file *s,
50 unsigned offset);
51 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
52 struct seq_file *s,
53 unsigned selector);
54};
55
56extern int pin_config_get(const char *dev_name, const char *name,
57 unsigned long *config);
58extern int pin_config_set(const char *dev_name, const char *name,
59 unsigned long config);
60extern int pin_config_group_get(const char *dev_name,
61 const char *pin_group,
62 unsigned long *config);
63extern int pin_config_group_set(const char *dev_name,
64 const char *pin_group,
65 unsigned long config);
66
67#else
68
69static inline int pin_config_get(const char *dev_name, const char *name,
70 unsigned long *config)
71{
72 return 0;
73}
74
75static inline int pin_config_set(const char *dev_name, const char *name,
76 unsigned long config)
77{
78 return 0;
79}
80
81static inline int pin_config_group_get(const char *dev_name,
82 const char *pin_group,
83 unsigned long *config)
84{
85 return 0;
86}
87
88static inline int pin_config_group_set(const char *dev_name,
89 const char *pin_group,
90 unsigned long config)
91{
92 return 0;
93}
94
95#endif
96
97#endif /* __LINUX_PINCTRL_PINCONF_H */
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 04c011038f32..8bd22ee7aa09 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,6 +21,7 @@
21 21
22struct pinctrl_dev; 22struct pinctrl_dev;
23struct pinmux_ops; 23struct pinmux_ops;
24struct pinconf_ops;
24struct gpio_chip; 25struct gpio_chip;
25 26
26/** 27/**
@@ -45,6 +46,7 @@ struct pinctrl_pin_desc {
45 * @name: a name for the chip in this range 46 * @name: a name for the chip in this range
46 * @id: an ID number for the chip in this range 47 * @id: an ID number for the chip in this range
47 * @base: base offset of the GPIO range 48 * @base: base offset of the GPIO range
49 * @pin_base: base pin number of the GPIO range
48 * @npins: number of pins in the GPIO range, including the base number 50 * @npins: number of pins in the GPIO range, including the base number
49 * @gc: an optional pointer to a gpio_chip 51 * @gc: an optional pointer to a gpio_chip
50 */ 52 */
@@ -53,6 +55,7 @@ struct pinctrl_gpio_range {
53 const char *name; 55 const char *name;
54 unsigned int id; 56 unsigned int id;
55 unsigned int base; 57 unsigned int base;
58 unsigned int pin_base;
56 unsigned int npins; 59 unsigned int npins;
57 struct gpio_chip *gc; 60 struct gpio_chip *gc;
58}; 61};
@@ -89,22 +92,20 @@ struct pinctrl_ops {
89 * this pin controller 92 * this pin controller
90 * @npins: number of descriptors in the array, usually just ARRAY_SIZE() 93 * @npins: number of descriptors in the array, usually just ARRAY_SIZE()
91 * of the pins field above 94 * of the pins field above
92 * @maxpin: since pin spaces may be sparse, there can he "holes" in the
93 * pin range, this attribute gives the maximum pin number in the
94 * total range. This should not be lower than npins for example,
95 * but may be equal to npins if you have no holes in the pin range.
96 * @pctlops: pin control operation vtable, to support global concepts like 95 * @pctlops: pin control operation vtable, to support global concepts like
97 * grouping of pins, this is optional. 96 * grouping of pins, this is optional.
98 * @pmxops: pinmux operation vtable, if you support pinmuxing in your driver 97 * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver
98 * @confops: pin config operations vtable, if you support pin configuration in
99 * your driver
99 * @owner: module providing the pin controller, used for refcounting 100 * @owner: module providing the pin controller, used for refcounting
100 */ 101 */
101struct pinctrl_desc { 102struct pinctrl_desc {
102 const char *name; 103 const char *name;
103 struct pinctrl_pin_desc const *pins; 104 struct pinctrl_pin_desc const *pins;
104 unsigned int npins; 105 unsigned int npins;
105 unsigned int maxpin;
106 struct pinctrl_ops *pctlops; 106 struct pinctrl_ops *pctlops;
107 struct pinmux_ops *pmxops; 107 struct pinmux_ops *pmxops;
108 struct pinconf_ops *confops;
108 struct module *owner; 109 struct module *owner;
109}; 110};
110 111
@@ -123,7 +124,7 @@ extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
123 124
124struct pinctrl_dev; 125struct pinctrl_dev;
125 126
126/* Sufficiently stupid default function when pinctrl is not in use */ 127/* Sufficiently stupid default functions when pinctrl is not in use */
127static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) 128static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin)
128{ 129{
129 return pin >= 0; 130 return pin >= 0;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 3c430e797efc..937b3e2fa36f 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -52,9 +52,15 @@ struct pinctrl_dev;
52 * @disable: disable a certain muxing selector with a certain pin group 52 * @disable: disable a certain muxing selector with a certain pin group
53 * @gpio_request_enable: requests and enables GPIO on a certain pin. 53 * @gpio_request_enable: requests and enables GPIO on a certain pin.
54 * Implement this only if you can mux every pin individually as GPIO. The 54 * Implement this only if you can mux every pin individually as GPIO. The
55 * affected GPIO range is passed along with an offset into that 55 * affected GPIO range is passed along with an offset(pin number) into that
56 * specific GPIO range - function selectors and pin groups are orthogonal 56 * specific GPIO range - function selectors and pin groups are orthogonal
57 * to this, the core will however make sure the pins do not collide 57 * to this, the core will however make sure the pins do not collide.
58 * @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of
59 * @gpio_request_enable
60 * @gpio_set_direction: Since controllers may need different configurations
61 * depending on whether the GPIO is configured as input or output,
62 * a direction selector function may be implemented as a backing
63 * to the GPIO controllers that need pin muxing.
58 */ 64 */
59struct pinmux_ops { 65struct pinmux_ops {
60 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 66 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
@@ -73,11 +79,20 @@ struct pinmux_ops {
73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 79 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
74 struct pinctrl_gpio_range *range, 80 struct pinctrl_gpio_range *range,
75 unsigned offset); 81 unsigned offset);
82 void (*gpio_disable_free) (struct pinctrl_dev *pctldev,
83 struct pinctrl_gpio_range *range,
84 unsigned offset);
85 int (*gpio_set_direction) (struct pinctrl_dev *pctldev,
86 struct pinctrl_gpio_range *range,
87 unsigned offset,
88 bool input);
76}; 89};
77 90
78/* External interface to pinmux */ 91/* External interface to pinmux */
79extern int pinmux_request_gpio(unsigned gpio); 92extern int pinmux_request_gpio(unsigned gpio);
80extern void pinmux_free_gpio(unsigned gpio); 93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
81extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); 96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
82extern void pinmux_put(struct pinmux *pmx); 97extern void pinmux_put(struct pinmux *pmx);
83extern int pinmux_enable(struct pinmux *pmx); 98extern int pinmux_enable(struct pinmux *pmx);
@@ -94,6 +109,16 @@ static inline void pinmux_free_gpio(unsigned gpio)
94{ 109{
95} 110}
96 111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
97static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) 122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
98{ 123{
99 return NULL; 124 return NULL;
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 7281d5acf2f9..0d5b79365d03 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -162,25 +162,44 @@ struct tc_sfq_qopt {
162 unsigned flows; /* Maximal number of flows */ 162 unsigned flows; /* Maximal number of flows */
163}; 163};
164 164
165struct tc_sfqred_stats {
166 __u32 prob_drop; /* Early drops, below max threshold */
167 __u32 forced_drop; /* Early drops, after max threshold */
168 __u32 prob_mark; /* Marked packets, below max threshold */
169 __u32 forced_mark; /* Marked packets, after max threshold */
170 __u32 prob_mark_head; /* Marked packets, below max threshold */
171 __u32 forced_mark_head;/* Marked packets, after max threshold */
172};
173
174struct tc_sfq_qopt_v1 {
175 struct tc_sfq_qopt v0;
176 unsigned int depth; /* max number of packets per flow */
177 unsigned int headdrop;
178/* SFQRED parameters */
179 __u32 limit; /* HARD maximal flow queue length (bytes) */
180 __u32 qth_min; /* Min average length threshold (bytes) */
181 __u32 qth_max; /* Max average length threshold (bytes) */
182 unsigned char Wlog; /* log(W) */
183 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
184 unsigned char Scell_log; /* cell size for idle damping */
185 unsigned char flags;
186 __u32 max_P; /* probability, high resolution */
187/* SFQRED stats */
188 struct tc_sfqred_stats stats;
189};
190
191
165struct tc_sfq_xstats { 192struct tc_sfq_xstats {
166 __s32 allot; 193 __s32 allot;
167}; 194};
168 195
169/*
170 * NOTE: limit, divisor and flows are hardwired to code at the moment.
171 *
172 * limit=flows=128, divisor=1024;
173 *
174 * The only reason for this is efficiency, it is possible
175 * to change these parameters in compile time.
176 */
177
178/* RED section */ 196/* RED section */
179 197
180enum { 198enum {
181 TCA_RED_UNSPEC, 199 TCA_RED_UNSPEC,
182 TCA_RED_PARMS, 200 TCA_RED_PARMS,
183 TCA_RED_STAB, 201 TCA_RED_STAB,
202 TCA_RED_MAX_P,
184 __TCA_RED_MAX, 203 __TCA_RED_MAX,
185}; 204};
186 205
@@ -194,8 +213,9 @@ struct tc_red_qopt {
194 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 213 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
195 unsigned char Scell_log; /* cell size for idle damping */ 214 unsigned char Scell_log; /* cell size for idle damping */
196 unsigned char flags; 215 unsigned char flags;
197#define TC_RED_ECN 1 216#define TC_RED_ECN 1
198#define TC_RED_HARDDROP 2 217#define TC_RED_HARDDROP 2
218#define TC_RED_ADAPTATIVE 4
199}; 219};
200 220
201struct tc_red_xstats { 221struct tc_red_xstats {
@@ -214,6 +234,7 @@ enum {
214 TCA_GRED_PARMS, 234 TCA_GRED_PARMS,
215 TCA_GRED_STAB, 235 TCA_GRED_STAB,
216 TCA_GRED_DPS, 236 TCA_GRED_DPS,
237 TCA_GRED_MAX_P,
217 __TCA_GRED_MAX, 238 __TCA_GRED_MAX,
218}; 239};
219 240
@@ -253,6 +274,7 @@ enum {
253 TCA_CHOKE_UNSPEC, 274 TCA_CHOKE_UNSPEC,
254 TCA_CHOKE_PARMS, 275 TCA_CHOKE_PARMS,
255 TCA_CHOKE_STAB, 276 TCA_CHOKE_STAB,
277 TCA_CHOKE_MAX_P,
256 __TCA_CHOKE_MAX, 278 __TCA_CHOKE_MAX,
257}; 279};
258 280
@@ -465,6 +487,7 @@ enum {
465 TCA_NETEM_REORDER, 487 TCA_NETEM_REORDER,
466 TCA_NETEM_CORRUPT, 488 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS, 489 TCA_NETEM_LOSS,
490 TCA_NETEM_RATE,
468 __TCA_NETEM_MAX, 491 __TCA_NETEM_MAX,
469}; 492};
470 493
@@ -495,6 +518,13 @@ struct tc_netem_corrupt {
495 __u32 correlation; 518 __u32 correlation;
496}; 519};
497 520
521struct tc_netem_rate {
522 __u32 rate; /* byte/s */
523 __s32 packet_overhead;
524 __u32 cell_size;
525 __s32 cell_overhead;
526};
527
498enum { 528enum {
499 NETEM_LOSS_UNSPEC, 529 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */ 530 NETEM_LOSS_GI, /* General Intuitive - 4 state model */
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 000000000000..b081c7245ec8
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __MACB_PDATA_H__
9#define __MACB_PDATA_H__
10
11struct macb_platform_data {
12 u32 phy_mask;
13 int phy_irq_pin; /* PHY IRQ */
14 u8 is_rmii; /* using RMII interface? */
15};
16
17#endif /* __MACB_PDATA_H__ */
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h
index e9d9149ddf38..d94804aca764 100644
--- a/include/linux/platform_data/mv_usb.h
+++ b/include/linux/platform_data/mv_usb.h
@@ -42,9 +42,23 @@ struct mv_usb_platform_data {
42 /* only valid for HCD. OTG or Host only*/ 42 /* only valid for HCD. OTG or Host only*/
43 unsigned int mode; 43 unsigned int mode;
44 44
45 int (*phy_init)(unsigned int regbase); 45 /* This flag is used for that needs id pin checked by otg */
46 void (*phy_deinit)(unsigned int regbase); 46 unsigned int disable_otg_clock_gating:1;
47 /* Force a_bus_req to be asserted */
48 unsigned int otg_force_a_bus_req:1;
49
50 int (*phy_init)(void __iomem *regbase);
51 void (*phy_deinit)(void __iomem *regbase);
47 int (*set_vbus)(unsigned int vbus); 52 int (*set_vbus)(unsigned int vbus);
53 int (*private_init)(void __iomem *opregs, void __iomem *phyregs);
48}; 54};
49 55
56#ifndef CONFIG_HAVE_CLK
57/* Dummy stub for clk framework */
58#define clk_get(dev, id) NULL
59#define clk_put(clock) do {} while (0)
60#define clk_enable(clock) do {} while (0)
61#define clk_disable(clock) do {} while (0)
62#endif
63
50#endif 64#endif
diff --git a/include/linux/platform_data/s3c-hsudc.h b/include/linux/platform_data/s3c-hsudc.h
new file mode 100644
index 000000000000..6fa109339bf9
--- /dev/null
+++ b/include/linux/platform_data/s3c-hsudc.h
@@ -0,0 +1,34 @@
1/*
2 * S3C24XX USB 2.0 High-speed USB controller gadget driver
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * The S3C24XX USB 2.0 high-speed USB controller supports upto 9 endpoints.
8 * Each endpoint can be configured as either in or out endpoint. Endpoints
9 * can be configured for Bulk or Interrupt transfer mode.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __LINUX_USB_S3C_HSUDC_H
17#define __LINUX_USB_S3C_HSUDC_H
18
19/**
20 * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller.
21 * @epnum: Number of endpoints to be instantiated by the controller driver.
22 * @gpio_init: Platform specific USB related GPIO initialization.
23 * @gpio_uninit: Platform specific USB releted GPIO uninitialzation.
24 *
25 * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget
26 * controllers.
27 */
28struct s3c24xx_hsudc_platdata {
29 unsigned int epnum;
30 void (*gpio_init)(void);
31 void (*gpio_uninit)(void);
32};
33
34#endif /* __LINUX_USB_S3C_HSUDC_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 2a23f7d1a825..60e9994ef405 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -63,7 +63,7 @@ struct platform_device_info {
63 u64 dma_mask; 63 u64 dma_mask;
64}; 64};
65extern struct platform_device *platform_device_register_full( 65extern struct platform_device *platform_device_register_full(
66 struct platform_device_info *pdevinfo); 66 const struct platform_device_info *pdevinfo);
67 67
68/** 68/**
69 * platform_device_register_resndata - add a platform-level device with 69 * platform_device_register_resndata - add a platform-level device with
@@ -196,16 +196,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
196 * calling it replaces module_init() and module_exit() 196 * calling it replaces module_init() and module_exit()
197 */ 197 */
198#define module_platform_driver(__platform_driver) \ 198#define module_platform_driver(__platform_driver) \
199static int __init __platform_driver##_init(void) \ 199 module_driver(__platform_driver, platform_driver_register, \
200{ \ 200 platform_driver_unregister)
201 return platform_driver_register(&(__platform_driver)); \
202} \
203module_init(__platform_driver##_init); \
204static void __exit __platform_driver##_exit(void) \
205{ \
206 platform_driver_unregister(&(__platform_driver)); \
207} \
208module_exit(__platform_driver##_exit);
209 201
210extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 202extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
211 int (*probe)(struct platform_device *), 203 int (*probe)(struct platform_device *),
@@ -264,62 +256,34 @@ static inline char *early_platform_driver_setup_func(void) \
264} 256}
265#endif /* MODULE */ 257#endif /* MODULE */
266 258
267#ifdef CONFIG_PM_SLEEP
268extern int platform_pm_prepare(struct device *dev);
269extern void platform_pm_complete(struct device *dev);
270#else
271#define platform_pm_prepare NULL
272#define platform_pm_complete NULL
273#endif
274
275#ifdef CONFIG_SUSPEND 259#ifdef CONFIG_SUSPEND
276extern int platform_pm_suspend(struct device *dev); 260extern int platform_pm_suspend(struct device *dev);
277extern int platform_pm_suspend_noirq(struct device *dev);
278extern int platform_pm_resume(struct device *dev); 261extern int platform_pm_resume(struct device *dev);
279extern int platform_pm_resume_noirq(struct device *dev);
280#else 262#else
281#define platform_pm_suspend NULL 263#define platform_pm_suspend NULL
282#define platform_pm_resume NULL 264#define platform_pm_resume NULL
283#define platform_pm_suspend_noirq NULL
284#define platform_pm_resume_noirq NULL
285#endif 265#endif
286 266
287#ifdef CONFIG_HIBERNATE_CALLBACKS 267#ifdef CONFIG_HIBERNATE_CALLBACKS
288extern int platform_pm_freeze(struct device *dev); 268extern int platform_pm_freeze(struct device *dev);
289extern int platform_pm_freeze_noirq(struct device *dev);
290extern int platform_pm_thaw(struct device *dev); 269extern int platform_pm_thaw(struct device *dev);
291extern int platform_pm_thaw_noirq(struct device *dev);
292extern int platform_pm_poweroff(struct device *dev); 270extern int platform_pm_poweroff(struct device *dev);
293extern int platform_pm_poweroff_noirq(struct device *dev);
294extern int platform_pm_restore(struct device *dev); 271extern int platform_pm_restore(struct device *dev);
295extern int platform_pm_restore_noirq(struct device *dev);
296#else 272#else
297#define platform_pm_freeze NULL 273#define platform_pm_freeze NULL
298#define platform_pm_thaw NULL 274#define platform_pm_thaw NULL
299#define platform_pm_poweroff NULL 275#define platform_pm_poweroff NULL
300#define platform_pm_restore NULL 276#define platform_pm_restore NULL
301#define platform_pm_freeze_noirq NULL
302#define platform_pm_thaw_noirq NULL
303#define platform_pm_poweroff_noirq NULL
304#define platform_pm_restore_noirq NULL
305#endif 277#endif
306 278
307#ifdef CONFIG_PM_SLEEP 279#ifdef CONFIG_PM_SLEEP
308#define USE_PLATFORM_PM_SLEEP_OPS \ 280#define USE_PLATFORM_PM_SLEEP_OPS \
309 .prepare = platform_pm_prepare, \
310 .complete = platform_pm_complete, \
311 .suspend = platform_pm_suspend, \ 281 .suspend = platform_pm_suspend, \
312 .resume = platform_pm_resume, \ 282 .resume = platform_pm_resume, \
313 .freeze = platform_pm_freeze, \ 283 .freeze = platform_pm_freeze, \
314 .thaw = platform_pm_thaw, \ 284 .thaw = platform_pm_thaw, \
315 .poweroff = platform_pm_poweroff, \ 285 .poweroff = platform_pm_poweroff, \
316 .restore = platform_pm_restore, \ 286 .restore = platform_pm_restore,
317 .suspend_noirq = platform_pm_suspend_noirq, \
318 .resume_noirq = platform_pm_resume_noirq, \
319 .freeze_noirq = platform_pm_freeze_noirq, \
320 .thaw_noirq = platform_pm_thaw_noirq, \
321 .poweroff_noirq = platform_pm_poweroff_noirq, \
322 .restore_noirq = platform_pm_restore_noirq,
323#else 287#else
324#define USE_PLATFORM_PM_SLEEP_OPS 288#define USE_PLATFORM_PM_SLEEP_OPS
325#endif 289#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 3f3ed83a9aa5..e4982ac3fbbc 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -300,19 +300,6 @@ const struct dev_pm_ops name = { \
300 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ 300 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
301} 301}
302 302
303/*
304 * Use this for subsystems (bus types, device types, device classes) that don't
305 * need any special suspend/resume handling in addition to invoking the PM
306 * callbacks provided by device drivers supporting both the system sleep PM and
307 * runtime PM, make the pm member point to generic_subsys_pm_ops.
308 */
309#ifdef CONFIG_PM
310extern struct dev_pm_ops generic_subsys_pm_ops;
311#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
312#else
313#define GENERIC_SUBSYS_PM_OPS NULL
314#endif
315
316/** 303/**
317 * PM_EVENT_ messages 304 * PM_EVENT_ messages
318 * 305 *
@@ -521,6 +508,8 @@ struct dev_pm_info {
521 unsigned long active_jiffies; 508 unsigned long active_jiffies;
522 unsigned long suspended_jiffies; 509 unsigned long suspended_jiffies;
523 unsigned long accounting_timestamp; 510 unsigned long accounting_timestamp;
511 ktime_t suspend_time;
512 s64 max_time_suspended_ns;
524#endif 513#endif
525 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 514 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
526 struct pm_qos_constraints *constraints; 515 struct pm_qos_constraints *constraints;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 65633e5a2bc0..a03a0ad998b8 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,6 +10,7 @@
10#define _LINUX_PM_DOMAIN_H 10#define _LINUX_PM_DOMAIN_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/err.h>
13 14
14enum gpd_status { 15enum gpd_status {
15 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 16 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -21,6 +22,23 @@ enum gpd_status {
21 22
22struct dev_power_governor { 23struct dev_power_governor {
23 bool (*power_down_ok)(struct dev_pm_domain *domain); 24 bool (*power_down_ok)(struct dev_pm_domain *domain);
25 bool (*stop_ok)(struct device *dev);
26};
27
28struct gpd_dev_ops {
29 int (*start)(struct device *dev);
30 int (*stop)(struct device *dev);
31 int (*save_state)(struct device *dev);
32 int (*restore_state)(struct device *dev);
33 int (*suspend)(struct device *dev);
34 int (*suspend_late)(struct device *dev);
35 int (*resume_early)(struct device *dev);
36 int (*resume)(struct device *dev);
37 int (*freeze)(struct device *dev);
38 int (*freeze_late)(struct device *dev);
39 int (*thaw_early)(struct device *dev);
40 int (*thaw)(struct device *dev);
41 bool (*active_wakeup)(struct device *dev);
24}; 42};
25 43
26struct generic_pm_domain { 44struct generic_pm_domain {
@@ -32,6 +50,7 @@ struct generic_pm_domain {
32 struct mutex lock; 50 struct mutex lock;
33 struct dev_power_governor *gov; 51 struct dev_power_governor *gov;
34 struct work_struct power_off_work; 52 struct work_struct power_off_work;
53 char *name;
35 unsigned int in_progress; /* Number of devices being suspended now */ 54 unsigned int in_progress; /* Number of devices being suspended now */
36 atomic_t sd_count; /* Number of subdomains with power "on" */ 55 atomic_t sd_count; /* Number of subdomains with power "on" */
37 enum gpd_status status; /* Current state of the domain */ 56 enum gpd_status status; /* Current state of the domain */
@@ -44,10 +63,13 @@ struct generic_pm_domain {
44 bool suspend_power_off; /* Power status before system suspend */ 63 bool suspend_power_off; /* Power status before system suspend */
45 bool dev_irq_safe; /* Device callbacks are IRQ-safe */ 64 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
46 int (*power_off)(struct generic_pm_domain *domain); 65 int (*power_off)(struct generic_pm_domain *domain);
66 s64 power_off_latency_ns;
47 int (*power_on)(struct generic_pm_domain *domain); 67 int (*power_on)(struct generic_pm_domain *domain);
48 int (*start_device)(struct device *dev); 68 s64 power_on_latency_ns;
49 int (*stop_device)(struct device *dev); 69 struct gpd_dev_ops dev_ops;
50 bool (*active_wakeup)(struct device *dev); 70 s64 break_even_ns; /* Power break even for the entire domain. */
71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
72 ktime_t power_off_time;
51}; 73};
52 74
53static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 75static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -62,8 +84,18 @@ struct gpd_link {
62 struct list_head slave_node; 84 struct list_head slave_node;
63}; 85};
64 86
87struct gpd_timing_data {
88 s64 stop_latency_ns;
89 s64 start_latency_ns;
90 s64 save_state_latency_ns;
91 s64 restore_state_latency_ns;
92 s64 break_even_ns;
93};
94
65struct generic_pm_domain_data { 95struct generic_pm_domain_data {
66 struct pm_domain_data base; 96 struct pm_domain_data base;
97 struct gpd_dev_ops ops;
98 struct gpd_timing_data td;
67 bool need_restore; 99 bool need_restore;
68}; 100};
69 101
@@ -73,18 +105,54 @@ static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *
73} 105}
74 106
75#ifdef CONFIG_PM_GENERIC_DOMAINS 107#ifdef CONFIG_PM_GENERIC_DOMAINS
76extern int pm_genpd_add_device(struct generic_pm_domain *genpd, 108static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
77 struct device *dev); 109{
110 return to_gpd_data(dev->power.subsys_data->domain_data);
111}
112
113extern struct dev_power_governor simple_qos_governor;
114
115extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
116extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
117 struct device *dev,
118 struct gpd_timing_data *td);
119
120static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
121 struct device *dev)
122{
123 return __pm_genpd_add_device(genpd, dev, NULL);
124}
125
78extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 126extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
79 struct device *dev); 127 struct device *dev);
80extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 128extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
81 struct generic_pm_domain *new_subdomain); 129 struct generic_pm_domain *new_subdomain);
82extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 130extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
83 struct generic_pm_domain *target); 131 struct generic_pm_domain *target);
132extern int pm_genpd_add_callbacks(struct device *dev,
133 struct gpd_dev_ops *ops,
134 struct gpd_timing_data *td);
135extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
84extern void pm_genpd_init(struct generic_pm_domain *genpd, 136extern void pm_genpd_init(struct generic_pm_domain *genpd,
85 struct dev_power_governor *gov, bool is_off); 137 struct dev_power_governor *gov, bool is_off);
138
86extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 139extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
140
141extern bool default_stop_ok(struct device *dev);
142
143extern struct dev_power_governor pm_domain_always_on_gov;
87#else 144#else
145
146static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
147{
148 return ERR_PTR(-ENOSYS);
149}
150static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
151 struct device *dev,
152 struct gpd_timing_data *td)
153{
154 return -ENOSYS;
155}
88static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 156static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
89 struct device *dev) 157 struct device *dev)
90{ 158{
@@ -105,14 +173,35 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
105{ 173{
106 return -ENOSYS; 174 return -ENOSYS;
107} 175}
108static inline void pm_genpd_init(struct generic_pm_domain *genpd, 176static inline int pm_genpd_add_callbacks(struct device *dev,
109 struct dev_power_governor *gov, bool is_off) {} 177 struct gpd_dev_ops *ops,
178 struct gpd_timing_data *td)
179{
180 return -ENOSYS;
181}
182static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
183{
184 return -ENOSYS;
185}
186static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off)
187{
188}
110static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 189static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
111{ 190{
112 return -ENOSYS; 191 return -ENOSYS;
113} 192}
193static inline bool default_stop_ok(struct device *dev)
194{
195 return false;
196}
197#define pm_domain_always_on_gov NULL
114#endif 198#endif
115 199
200static inline int pm_genpd_remove_callbacks(struct device *dev)
201{
202 return __pm_genpd_remove_callbacks(dev, true);
203}
204
116#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 205#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
117extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); 206extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
118extern void pm_genpd_poweroff_unused(void); 207extern void pm_genpd_poweroff_unused(void);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 83b0ea302a80..e5bbcbaa6f57 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -78,6 +78,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
78int pm_qos_request_active(struct pm_qos_request *req); 78int pm_qos_request_active(struct pm_qos_request *req);
79s32 pm_qos_read_value(struct pm_qos_constraints *c); 79s32 pm_qos_read_value(struct pm_qos_constraints *c);
80 80
81s32 __dev_pm_qos_read_value(struct device *dev);
81s32 dev_pm_qos_read_value(struct device *dev); 82s32 dev_pm_qos_read_value(struct device *dev);
82int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 83int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
83 s32 value); 84 s32 value);
@@ -91,6 +92,8 @@ int dev_pm_qos_add_global_notifier(struct notifier_block *notifier);
91int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier); 92int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
92void dev_pm_qos_constraints_init(struct device *dev); 93void dev_pm_qos_constraints_init(struct device *dev);
93void dev_pm_qos_constraints_destroy(struct device *dev); 94void dev_pm_qos_constraints_destroy(struct device *dev);
95int dev_pm_qos_add_ancestor_request(struct device *dev,
96 struct dev_pm_qos_request *req, s32 value);
94#else 97#else
95static inline int pm_qos_update_target(struct pm_qos_constraints *c, 98static inline int pm_qos_update_target(struct pm_qos_constraints *c,
96 struct plist_node *node, 99 struct plist_node *node,
@@ -119,6 +122,8 @@ static inline int pm_qos_request_active(struct pm_qos_request *req)
119static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) 122static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
120 { return 0; } 123 { return 0; }
121 124
125static inline s32 __dev_pm_qos_read_value(struct device *dev)
126 { return 0; }
122static inline s32 dev_pm_qos_read_value(struct device *dev) 127static inline s32 dev_pm_qos_read_value(struct device *dev)
123 { return 0; } 128 { return 0; }
124static inline int dev_pm_qos_add_request(struct device *dev, 129static inline int dev_pm_qos_add_request(struct device *dev,
@@ -150,6 +155,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
150{ 155{
151 dev->power.power_state = PMSG_INVALID; 156 dev->power.power_state = PMSG_INVALID;
152} 157}
158static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
159 struct dev_pm_qos_request *req, s32 value)
160 { return 0; }
153#endif 161#endif
154 162
155#endif 163#endif
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d3085e72a0ee..609daae7a014 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -45,6 +45,8 @@ extern void pm_runtime_irq_safe(struct device *dev);
45extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); 45extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
46extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); 46extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
48extern void pm_runtime_update_max_time_suspended(struct device *dev,
49 s64 delta_ns);
48 50
49static inline bool pm_children_suspended(struct device *dev) 51static inline bool pm_children_suspended(struct device *dev)
50{ 52{
@@ -148,6 +150,9 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
148static inline unsigned long pm_runtime_autosuspend_expiration( 150static inline unsigned long pm_runtime_autosuspend_expiration(
149 struct device *dev) { return 0; } 151 struct device *dev) { return 0; }
150 152
153static inline void pm_runtime_update_max_time_suspended(struct device *dev,
154 s64 delta_ns) {}
155
151#endif /* !CONFIG_PM_RUNTIME */ 156#endif /* !CONFIG_PM_RUNTIME */
152 157
153static inline int pm_runtime_idle(struct device *dev) 158static inline int pm_runtime_idle(struct device *dev)
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 79159de0e341..2110a81c5e2a 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -40,12 +40,6 @@
40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */ 40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */
41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */ 41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */
42 42
43#ifdef CONFIG_PHYS_ADDR_T_64BIT
44#define MEMBLOCK_INACTIVE 0x3a84fb0144c9e71bULL
45#else
46#define MEMBLOCK_INACTIVE 0x44c9e71bUL
47#endif
48
49#define SLUB_RED_INACTIVE 0xbb 43#define SLUB_RED_INACTIVE 0xbb
50#define SLUB_RED_ACTIVE 0xcc 44#define SLUB_RED_ACTIVE 0xcc
51 45
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
new file mode 100644
index 000000000000..4f75e531c112
--- /dev/null
+++ b/include/linux/power/charger-manager.h
@@ -0,0 +1,147 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 * MyungJoo.Ham <myungjoo.ham@samsung.com>
4 *
5 * Charger Manager.
6 * This framework enables to control and multiple chargers and to
7 * monitor charging even in the context of suspend-to-RAM with
8 * an interface combining the chargers.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13**/
14
15#ifndef _CHARGER_MANAGER_H
16#define _CHARGER_MANAGER_H
17
18#include <linux/power_supply.h>
19
20enum data_source {
21 CM_FUEL_GAUGE,
22 CM_CHARGER_STAT,
23};
24
25enum polling_modes {
26 CM_POLL_DISABLE = 0,
27 CM_POLL_ALWAYS,
28 CM_POLL_EXTERNAL_POWER_ONLY,
29 CM_POLL_CHARGING_ONLY,
30};
31
32/**
33 * struct charger_global_desc
34 * @rtc_name: the name of RTC used to wake up the system from suspend.
35 * @rtc_only_wakeup:
36 * If the system is woken up by waekup-sources other than the RTC or
37 * callbacks, Charger Manager should recognize with
38 * rtc_only_wakeup() returning false.
39 * If the RTC given to CM is the only wakeup reason,
40 * rtc_only_wakeup should return true.
41 */
42struct charger_global_desc {
43 char *rtc_name;
44
45 bool (*rtc_only_wakeup)(void);
46};
47
48/**
49 * struct charger_desc
50 * @psy_name: the name of power-supply-class for charger manager
51 * @polling_mode:
52 * Determine which polling mode will be used
53 * @fullbatt_uV: voltage in microvolt
54 * If it is not being charged and VBATT >= fullbatt_uV,
55 * it is assumed to be full.
56 * @polling_interval_ms: interval in millisecond at which
57 * charger manager will monitor battery health
58 * @battery_present:
59 * Specify where information for existance of battery can be obtained
60 * @psy_charger_stat: the names of power-supply for chargers
61 * @num_charger_regulator: the number of entries in charger_regulators
62 * @charger_regulators: array of regulator_bulk_data for chargers
63 * @psy_fuel_gauge: the name of power-supply for fuel gauge
64 * @temperature_out_of_range:
65 * Determine whether the status is overheat or cold or normal.
66 * return_value > 0: overheat
67 * return_value == 0: normal
68 * return_value < 0: cold
69 * @measure_battery_temp:
70 * true: measure battery temperature
71 * false: measure ambient temperature
72 */
73struct charger_desc {
74 char *psy_name;
75
76 enum polling_modes polling_mode;
77 unsigned int polling_interval_ms;
78
79 unsigned int fullbatt_uV;
80
81 enum data_source battery_present;
82
83 char **psy_charger_stat;
84
85 int num_charger_regulators;
86 struct regulator_bulk_data *charger_regulators;
87
88 char *psy_fuel_gauge;
89
90 int (*temperature_out_of_range)(int *mC);
91 bool measure_battery_temp;
92};
93
94#define PSY_NAME_MAX 30
95
96/**
97 * struct charger_manager
98 * @entry: entry for list
99 * @dev: device pointer
100 * @desc: instance of charger_desc
101 * @fuel_gauge: power_supply for fuel gauge
102 * @charger_stat: array of power_supply for chargers
103 * @charger_enabled: the state of charger
104 * @emergency_stop:
105 * When setting true, stop charging
106 * @last_temp_mC: the measured temperature in milli-Celsius
107 * @psy_name_buf: the name of power-supply-class for charger manager
108 * @charger_psy: power_supply for charger manager
109 * @status_save_ext_pwr_inserted:
110 * saved status of external power before entering suspend-to-RAM
111 * @status_save_batt:
112 * saved status of battery before entering suspend-to-RAM
113 */
114struct charger_manager {
115 struct list_head entry;
116 struct device *dev;
117 struct charger_desc *desc;
118
119 struct power_supply *fuel_gauge;
120 struct power_supply **charger_stat;
121
122 bool charger_enabled;
123
124 int emergency_stop;
125 int last_temp_mC;
126
127 char psy_name_buf[PSY_NAME_MAX + 1];
128 struct power_supply charger_psy;
129
130 bool status_save_ext_pwr_inserted;
131 bool status_save_batt;
132};
133
134#ifdef CONFIG_CHARGER_MANAGER
135extern int setup_charger_manager(struct charger_global_desc *gd);
136extern bool cm_suspend_again(void);
137#else
138static void __maybe_unused setup_charger_manager(struct charger_global_desc *gd)
139{ }
140
141static bool __maybe_unused cm_suspend_again(void)
142{
143 return false;
144}
145#endif
146
147#endif /* _CHARGER_MANAGER_H */
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/sbs-battery.h
index 1398eb004e83..2b0a9d9ff57e 100644
--- a/include/linux/power/bq20z75.h
+++ b/include/linux/power/sbs-battery.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Gas Gauge driver for TI's BQ20Z75 2 * Gas Gauge driver for SBS Compliant Gas Gauges
3 * 3 *
4 * Copyright (c) 2010, NVIDIA Corporation. 4 * Copyright (c) 2010, NVIDIA Corporation.
5 * 5 *
@@ -18,21 +18,21 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21#ifndef __LINUX_POWER_BQ20Z75_H_ 21#ifndef __LINUX_POWER_SBS_BATTERY_H_
22#define __LINUX_POWER_BQ20Z75_H_ 22#define __LINUX_POWER_SBS_BATTERY_H_
23 23
24#include <linux/power_supply.h> 24#include <linux/power_supply.h>
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27/** 27/**
28 * struct bq20z75_platform_data - platform data for bq20z75 devices 28 * struct sbs_platform_data - platform data for sbs devices
29 * @battery_detect: GPIO which is used to detect battery presence 29 * @battery_detect: GPIO which is used to detect battery presence
30 * @battery_detect_present: gpio state when battery is present (0 / 1) 30 * @battery_detect_present: gpio state when battery is present (0 / 1)
31 * @i2c_retry_count: # of times to retry on i2c IO failure 31 * @i2c_retry_count: # of times to retry on i2c IO failure
32 * @poll_retry_count: # of times to retry looking for new status after 32 * @poll_retry_count: # of times to retry looking for new status after
33 * external change notification 33 * external change notification
34 */ 34 */
35struct bq20z75_platform_data { 35struct sbs_platform_data {
36 int battery_detect; 36 int battery_detect;
37 int battery_detect_present; 37 int battery_detect_present;
38 int i2c_retry_count; 38 int i2c_retry_count;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 204c18dfdc9e..fa9b962aec12 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -74,6 +74,12 @@ enum {
74 POWER_SUPPLY_CAPACITY_LEVEL_FULL, 74 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
75}; 75};
76 76
77enum {
78 POWER_SUPPLY_SCOPE_UNKNOWN = 0,
79 POWER_SUPPLY_SCOPE_SYSTEM,
80 POWER_SUPPLY_SCOPE_DEVICE,
81};
82
77enum power_supply_property { 83enum power_supply_property {
78 /* Properties of type `int' */ 84 /* Properties of type `int' */
79 POWER_SUPPLY_PROP_STATUS = 0, 85 POWER_SUPPLY_PROP_STATUS = 0,
@@ -116,6 +122,7 @@ enum power_supply_property {
116 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, 122 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
117 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 123 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
118 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 124 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
125 POWER_SUPPLY_PROP_SCOPE,
119 /* Properties of type `const char *' */ 126 /* Properties of type `const char *' */
120 POWER_SUPPLY_PROP_MODEL_NAME, 127 POWER_SUPPLY_PROP_MODEL_NAME,
121 POWER_SUPPLY_PROP_MANUFACTURER, 128 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -123,7 +130,8 @@ enum power_supply_property {
123}; 130};
124 131
125enum power_supply_type { 132enum power_supply_type {
126 POWER_SUPPLY_TYPE_BATTERY = 0, 133 POWER_SUPPLY_TYPE_UNKNOWN = 0,
134 POWER_SUPPLY_TYPE_BATTERY,
127 POWER_SUPPLY_TYPE_UPS, 135 POWER_SUPPLY_TYPE_UPS,
128 POWER_SUPPLY_TYPE_MAINS, 136 POWER_SUPPLY_TYPE_MAINS,
129 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */ 137 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */
@@ -211,6 +219,7 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
211extern int power_supply_register(struct device *parent, 219extern int power_supply_register(struct device *parent,
212 struct power_supply *psy); 220 struct power_supply *psy);
213extern void power_supply_unregister(struct power_supply *psy); 221extern void power_supply_unregister(struct power_supply *psy);
222extern int power_supply_powers(struct power_supply *psy, struct device *dev);
214 223
215/* For APM emulation, think legacy userspace. */ 224/* For APM emulation, think legacy userspace. */
216extern struct class *power_supply_class; 225extern struct class *power_supply_class;
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index a3baeb2c2161..7ddc7f1b480f 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -102,4 +102,16 @@
102 102
103#define PR_MCE_KILL_GET 34 103#define PR_MCE_KILL_GET 34
104 104
105/*
106 * Tune up process memory map specifics.
107 */
108#define PR_SET_MM 35
109# define PR_SET_MM_START_CODE 1
110# define PR_SET_MM_END_CODE 2
111# define PR_SET_MM_START_DATA 3
112# define PR_SET_MM_END_DATA 4
113# define PR_SET_MM_START_STACK 5
114# define PR_SET_MM_START_BRK 6
115# define PR_SET_MM_BRK 7
116
105#endif /* _LINUX_PRCTL_H */ 117#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 643b96c7a94f..85c507306239 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 mode_t mode; 53 umode_t mode;
54 nlink_t nlink; 54 nlink_t nlink;
55 uid_t uid; 55 uid_t uid;
56 gid_t gid; 56 gid_t gid;
@@ -106,9 +106,9 @@ extern void proc_root_init(void);
106 106
107void proc_flush_task(struct task_struct *task); 107void proc_flush_task(struct task_struct *task);
108 108
109extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 109extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
110 struct proc_dir_entry *parent); 110 struct proc_dir_entry *parent);
111struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, 111struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
112 struct proc_dir_entry *parent, 112 struct proc_dir_entry *parent,
113 const struct file_operations *proc_fops, 113 const struct file_operations *proc_fops,
114 void *data); 114 void *data);
@@ -146,17 +146,17 @@ extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
146extern struct proc_dir_entry *proc_symlink(const char *, 146extern struct proc_dir_entry *proc_symlink(const char *,
147 struct proc_dir_entry *, const char *); 147 struct proc_dir_entry *, const char *);
148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 148extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, 149extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
150 struct proc_dir_entry *parent); 150 struct proc_dir_entry *parent);
151 151
152static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode, 152static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
153 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 153 struct proc_dir_entry *parent, const struct file_operations *proc_fops)
154{ 154{
155 return proc_create_data(name, mode, parent, proc_fops, NULL); 155 return proc_create_data(name, mode, parent, proc_fops, NULL);
156} 156}
157 157
158static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 158static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
159 mode_t mode, struct proc_dir_entry *base, 159 umode_t mode, struct proc_dir_entry *base,
160 read_proc_t *read_proc, void * data) 160 read_proc_t *read_proc, void * data)
161{ 161{
162 struct proc_dir_entry *res=create_proc_entry(name,mode,base); 162 struct proc_dir_entry *res=create_proc_entry(name,mode,base);
@@ -168,7 +168,7 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
168} 168}
169 169
170extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 170extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
171 const char *name, mode_t mode, const struct file_operations *fops); 171 const char *name, umode_t mode, const struct file_operations *fops);
172extern void proc_net_remove(struct net *net, const char *name); 172extern void proc_net_remove(struct net *net, const char *name);
173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 173extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 174 struct proc_dir_entry *parent);
@@ -185,15 +185,15 @@ static inline void proc_flush_task(struct task_struct *task)
185} 185}
186 186
187static inline struct proc_dir_entry *create_proc_entry(const char *name, 187static inline struct proc_dir_entry *create_proc_entry(const char *name,
188 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 188 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
189static inline struct proc_dir_entry *proc_create(const char *name, 189static inline struct proc_dir_entry *proc_create(const char *name,
190 mode_t mode, struct proc_dir_entry *parent, 190 umode_t mode, struct proc_dir_entry *parent,
191 const struct file_operations *proc_fops) 191 const struct file_operations *proc_fops)
192{ 192{
193 return NULL; 193 return NULL;
194} 194}
195static inline struct proc_dir_entry *proc_create_data(const char *name, 195static inline struct proc_dir_entry *proc_create_data(const char *name,
196 mode_t mode, struct proc_dir_entry *parent, 196 umode_t mode, struct proc_dir_entry *parent,
197 const struct file_operations *proc_fops, void *data) 197 const struct file_operations *proc_fops, void *data)
198{ 198{
199 return NULL; 199 return NULL;
@@ -205,10 +205,10 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
205static inline struct proc_dir_entry *proc_mkdir(const char *name, 205static inline struct proc_dir_entry *proc_mkdir(const char *name,
206 struct proc_dir_entry *parent) {return NULL;} 206 struct proc_dir_entry *parent) {return NULL;}
207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 207static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
208 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 208 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
209 209
210static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 210static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
211 mode_t mode, struct proc_dir_entry *base, 211 umode_t mode, struct proc_dir_entry *base,
212 read_proc_t *read_proc, void * data) { return NULL; } 212 read_proc_t *read_proc, void * data) { return NULL; }
213 213
214struct tty_driver; 214struct tty_driver;
@@ -253,7 +253,7 @@ extern const struct proc_ns_operations utsns_operations;
253extern const struct proc_ns_operations ipcns_operations; 253extern const struct proc_ns_operations ipcns_operations;
254 254
255union proc_op { 255union proc_op {
256 int (*proc_get_link)(struct inode *, struct path *); 256 int (*proc_get_link)(struct dentry *, struct path *);
257 int (*proc_read)(struct task_struct *task, char *page); 257 int (*proc_read)(struct task_struct *task, char *page);
258 int (*proc_show)(struct seq_file *m, 258 int (*proc_show)(struct seq_file *m,
259 struct pid_namespace *ns, struct pid *pid, 259 struct pid_namespace *ns, struct pid *pid,
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 2ca8cde5459d..e1461e143be2 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -22,6 +22,9 @@
22#ifndef _LINUX_PSTORE_H 22#ifndef _LINUX_PSTORE_H
23#define _LINUX_PSTORE_H 23#define _LINUX_PSTORE_H
24 24
25#include <linux/time.h>
26#include <linux/kmsg_dump.h>
27
25/* types */ 28/* types */
26enum pstore_type_id { 29enum pstore_type_id {
27 PSTORE_TYPE_DMESG = 0, 30 PSTORE_TYPE_DMESG = 0,
@@ -41,7 +44,8 @@ struct pstore_info {
41 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 44 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
42 struct timespec *time, char **buf, 45 struct timespec *time, char **buf,
43 struct pstore_info *psi); 46 struct pstore_info *psi);
44 int (*write)(enum pstore_type_id type, u64 *id, 47 int (*write)(enum pstore_type_id type,
48 enum kmsg_dump_reason reason, u64 *id,
45 unsigned int part, size_t size, struct pstore_info *psi); 49 unsigned int part, size_t size, struct pstore_info *psi);
46 int (*erase)(enum pstore_type_id type, u64 id, 50 int (*erase)(enum pstore_type_id type, u64 id,
47 struct pstore_info *psi); 51 struct pstore_info *psi);
@@ -50,18 +54,12 @@ struct pstore_info {
50 54
51#ifdef CONFIG_PSTORE 55#ifdef CONFIG_PSTORE
52extern int pstore_register(struct pstore_info *); 56extern int pstore_register(struct pstore_info *);
53extern int pstore_write(enum pstore_type_id type, char *buf, size_t size);
54#else 57#else
55static inline int 58static inline int
56pstore_register(struct pstore_info *psi) 59pstore_register(struct pstore_info *psi)
57{ 60{
58 return -ENODEV; 61 return -ENODEV;
59} 62}
60static inline int
61pstore_write(enum pstore_type_id type, char *buf, size_t size)
62{
63 return -ENODEV;
64}
65#endif 63#endif
66 64
67#endif /*_LINUX_PSTORE_H*/ 65#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9d4539c52e53..07e360b1b282 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -49,9 +49,6 @@
49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2 49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2
50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2 50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2
51 51
52#define radix_tree_indirect_to_ptr(ptr) \
53 radix_tree_indirect_to_ptr((void __force *)(ptr))
54
55static inline int radix_tree_is_indirect_ptr(void *ptr) 52static inline int radix_tree_is_indirect_ptr(void *ptr)
56{ 53{
57 return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR); 54 return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR);
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 9e65d9e20662..6f6df86f1ae5 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -277,7 +277,10 @@ struct mdp_superblock_1 {
277 */ 277 */
278#define MD_FEATURE_RESHAPE_ACTIVE 4 278#define MD_FEATURE_RESHAPE_ACTIVE 4
279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ 279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */
280 280#define MD_FEATURE_REPLACEMENT 16 /* This device is replacing an
281#define MD_FEATURE_ALL (1|2|4|8) 281 * active device with same 'role'.
282 * 'recovery_offset' is also set.
283 */
284#define MD_FEATURE_ALL (1|2|4|8|16)
282 285
283#endif 286#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 2b59cc824395..53272e9860a7 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -132,7 +132,7 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
132 PROT_READ|PROT_WRITE, \ 132 PROT_READ|PROT_WRITE, \
133 MAP_PRIVATE|MAP_ANONYMOUS,\ 133 MAP_PRIVATE|MAP_ANONYMOUS,\
134 0, 0)) 134 0, 0))
135# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE) 135# define free_pages(x, y) munmap((void *)(x), PAGE_SIZE << (y))
136 136
137static inline void cpu_relax(void) 137static inline void cpu_relax(void)
138{ 138{
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 3a8f0c9b2933..5bf5500db83d 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -2,7 +2,7 @@
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev); 5 umode_t mode, dev_t dev);
6extern struct dentry *ramfs_mount(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data); 7 int flags, const char *dev_name, void *data);
8 8
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 2cf4226ade7e..81c04f4348ec 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -51,6 +51,8 @@ extern int rcutorture_runnable; /* for sysctl */
51#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 51#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
52extern void rcutorture_record_test_transition(void); 52extern void rcutorture_record_test_transition(void);
53extern void rcutorture_record_progress(unsigned long vernum); 53extern void rcutorture_record_progress(unsigned long vernum);
54extern void do_trace_rcu_torture_read(char *rcutorturename,
55 struct rcu_head *rhp);
54#else 56#else
55static inline void rcutorture_record_test_transition(void) 57static inline void rcutorture_record_test_transition(void)
56{ 58{
@@ -58,6 +60,12 @@ static inline void rcutorture_record_test_transition(void)
58static inline void rcutorture_record_progress(unsigned long vernum) 60static inline void rcutorture_record_progress(unsigned long vernum)
59{ 61{
60} 62}
63#ifdef CONFIG_RCU_TRACE
64extern void do_trace_rcu_torture_read(char *rcutorturename,
65 struct rcu_head *rhp);
66#else
67#define do_trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)
68#endif
61#endif 69#endif
62 70
63#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b)) 71#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b))
@@ -177,23 +185,10 @@ extern void rcu_sched_qs(int cpu);
177extern void rcu_bh_qs(int cpu); 185extern void rcu_bh_qs(int cpu);
178extern void rcu_check_callbacks(int cpu, int user); 186extern void rcu_check_callbacks(int cpu, int user);
179struct notifier_block; 187struct notifier_block;
180 188extern void rcu_idle_enter(void);
181#ifdef CONFIG_NO_HZ 189extern void rcu_idle_exit(void);
182 190extern void rcu_irq_enter(void);
183extern void rcu_enter_nohz(void); 191extern void rcu_irq_exit(void);
184extern void rcu_exit_nohz(void);
185
186#else /* #ifdef CONFIG_NO_HZ */
187
188static inline void rcu_enter_nohz(void)
189{
190}
191
192static inline void rcu_exit_nohz(void)
193{
194}
195
196#endif /* #else #ifdef CONFIG_NO_HZ */
197 192
198/* 193/*
199 * Infrastructure to implement the synchronize_() primitives in 194 * Infrastructure to implement the synchronize_() primitives in
@@ -233,22 +228,30 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
233 228
234#ifdef CONFIG_DEBUG_LOCK_ALLOC 229#ifdef CONFIG_DEBUG_LOCK_ALLOC
235 230
236extern struct lockdep_map rcu_lock_map; 231#ifdef CONFIG_PROVE_RCU
237# define rcu_read_acquire() \ 232extern int rcu_is_cpu_idle(void);
238 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 233#else /* !CONFIG_PROVE_RCU */
239# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 234static inline int rcu_is_cpu_idle(void)
235{
236 return 0;
237}
238#endif /* else !CONFIG_PROVE_RCU */
240 239
241extern struct lockdep_map rcu_bh_lock_map; 240static inline void rcu_lock_acquire(struct lockdep_map *map)
242# define rcu_read_acquire_bh() \ 241{
243 lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 242 WARN_ON_ONCE(rcu_is_cpu_idle());
244# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_) 243 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_);
244}
245 245
246extern struct lockdep_map rcu_sched_lock_map; 246static inline void rcu_lock_release(struct lockdep_map *map)
247# define rcu_read_acquire_sched() \ 247{
248 lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 248 WARN_ON_ONCE(rcu_is_cpu_idle());
249# define rcu_read_release_sched() \ 249 lock_release(map, 1, _THIS_IP_);
250 lock_release(&rcu_sched_lock_map, 1, _THIS_IP_) 250}
251 251
252extern struct lockdep_map rcu_lock_map;
253extern struct lockdep_map rcu_bh_lock_map;
254extern struct lockdep_map rcu_sched_lock_map;
252extern int debug_lockdep_rcu_enabled(void); 255extern int debug_lockdep_rcu_enabled(void);
253 256
254/** 257/**
@@ -262,11 +265,18 @@ extern int debug_lockdep_rcu_enabled(void);
262 * 265 *
263 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot 266 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
264 * and while lockdep is disabled. 267 * and while lockdep is disabled.
268 *
269 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
270 * occur in the same context, for example, it is illegal to invoke
271 * rcu_read_unlock() in process context if the matching rcu_read_lock()
272 * was invoked from within an irq handler.
265 */ 273 */
266static inline int rcu_read_lock_held(void) 274static inline int rcu_read_lock_held(void)
267{ 275{
268 if (!debug_lockdep_rcu_enabled()) 276 if (!debug_lockdep_rcu_enabled())
269 return 1; 277 return 1;
278 if (rcu_is_cpu_idle())
279 return 0;
270 return lock_is_held(&rcu_lock_map); 280 return lock_is_held(&rcu_lock_map);
271} 281}
272 282
@@ -290,6 +300,19 @@ extern int rcu_read_lock_bh_held(void);
290 * 300 *
291 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot 301 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
292 * and while lockdep is disabled. 302 * and while lockdep is disabled.
303 *
304 * Note that if the CPU is in the idle loop from an RCU point of
305 * view (ie: that we are in the section between rcu_idle_enter() and
306 * rcu_idle_exit()) then rcu_read_lock_held() returns false even if the CPU
307 * did an rcu_read_lock(). The reason for this is that RCU ignores CPUs
308 * that are in such a section, considering these as in extended quiescent
309 * state, so such a CPU is effectively never in an RCU read-side critical
310 * section regardless of what RCU primitives it invokes. This state of
311 * affairs is required --- we need to keep an RCU-free window in idle
312 * where the CPU may possibly enter into low power mode. This way we can
313 * notice an extended quiescent state to other CPUs that started a grace
314 * period. Otherwise we would delay any grace period as long as we run in
315 * the idle task.
293 */ 316 */
294#ifdef CONFIG_PREEMPT_COUNT 317#ifdef CONFIG_PREEMPT_COUNT
295static inline int rcu_read_lock_sched_held(void) 318static inline int rcu_read_lock_sched_held(void)
@@ -298,6 +321,8 @@ static inline int rcu_read_lock_sched_held(void)
298 321
299 if (!debug_lockdep_rcu_enabled()) 322 if (!debug_lockdep_rcu_enabled())
300 return 1; 323 return 1;
324 if (rcu_is_cpu_idle())
325 return 0;
301 if (debug_locks) 326 if (debug_locks)
302 lockdep_opinion = lock_is_held(&rcu_sched_lock_map); 327 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
303 return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); 328 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
@@ -311,12 +336,8 @@ static inline int rcu_read_lock_sched_held(void)
311 336
312#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 337#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
313 338
314# define rcu_read_acquire() do { } while (0) 339# define rcu_lock_acquire(a) do { } while (0)
315# define rcu_read_release() do { } while (0) 340# define rcu_lock_release(a) do { } while (0)
316# define rcu_read_acquire_bh() do { } while (0)
317# define rcu_read_release_bh() do { } while (0)
318# define rcu_read_acquire_sched() do { } while (0)
319# define rcu_read_release_sched() do { } while (0)
320 341
321static inline int rcu_read_lock_held(void) 342static inline int rcu_read_lock_held(void)
322{ 343{
@@ -637,7 +658,7 @@ static inline void rcu_read_lock(void)
637{ 658{
638 __rcu_read_lock(); 659 __rcu_read_lock();
639 __acquire(RCU); 660 __acquire(RCU);
640 rcu_read_acquire(); 661 rcu_lock_acquire(&rcu_lock_map);
641} 662}
642 663
643/* 664/*
@@ -657,7 +678,7 @@ static inline void rcu_read_lock(void)
657 */ 678 */
658static inline void rcu_read_unlock(void) 679static inline void rcu_read_unlock(void)
659{ 680{
660 rcu_read_release(); 681 rcu_lock_release(&rcu_lock_map);
661 __release(RCU); 682 __release(RCU);
662 __rcu_read_unlock(); 683 __rcu_read_unlock();
663} 684}
@@ -673,12 +694,17 @@ static inline void rcu_read_unlock(void)
673 * critical sections in interrupt context can use just rcu_read_lock(), 694 * critical sections in interrupt context can use just rcu_read_lock(),
674 * though this should at least be commented to avoid confusing people 695 * though this should at least be commented to avoid confusing people
675 * reading the code. 696 * reading the code.
697 *
698 * Note that rcu_read_lock_bh() and the matching rcu_read_unlock_bh()
699 * must occur in the same context, for example, it is illegal to invoke
700 * rcu_read_unlock_bh() from one task if the matching rcu_read_lock_bh()
701 * was invoked from some other task.
676 */ 702 */
677static inline void rcu_read_lock_bh(void) 703static inline void rcu_read_lock_bh(void)
678{ 704{
679 local_bh_disable(); 705 local_bh_disable();
680 __acquire(RCU_BH); 706 __acquire(RCU_BH);
681 rcu_read_acquire_bh(); 707 rcu_lock_acquire(&rcu_bh_lock_map);
682} 708}
683 709
684/* 710/*
@@ -688,7 +714,7 @@ static inline void rcu_read_lock_bh(void)
688 */ 714 */
689static inline void rcu_read_unlock_bh(void) 715static inline void rcu_read_unlock_bh(void)
690{ 716{
691 rcu_read_release_bh(); 717 rcu_lock_release(&rcu_bh_lock_map);
692 __release(RCU_BH); 718 __release(RCU_BH);
693 local_bh_enable(); 719 local_bh_enable();
694} 720}
@@ -700,12 +726,17 @@ static inline void rcu_read_unlock_bh(void)
700 * are being done using call_rcu_sched() or synchronize_rcu_sched(). 726 * are being done using call_rcu_sched() or synchronize_rcu_sched().
701 * Read-side critical sections can also be introduced by anything that 727 * Read-side critical sections can also be introduced by anything that
702 * disables preemption, including local_irq_disable() and friends. 728 * disables preemption, including local_irq_disable() and friends.
729 *
730 * Note that rcu_read_lock_sched() and the matching rcu_read_unlock_sched()
731 * must occur in the same context, for example, it is illegal to invoke
732 * rcu_read_unlock_sched() from process context if the matching
733 * rcu_read_lock_sched() was invoked from an NMI handler.
703 */ 734 */
704static inline void rcu_read_lock_sched(void) 735static inline void rcu_read_lock_sched(void)
705{ 736{
706 preempt_disable(); 737 preempt_disable();
707 __acquire(RCU_SCHED); 738 __acquire(RCU_SCHED);
708 rcu_read_acquire_sched(); 739 rcu_lock_acquire(&rcu_sched_lock_map);
709} 740}
710 741
711/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 742/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -722,7 +753,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
722 */ 753 */
723static inline void rcu_read_unlock_sched(void) 754static inline void rcu_read_unlock_sched(void)
724{ 755{
725 rcu_read_release_sched(); 756 rcu_lock_release(&rcu_sched_lock_map);
726 __release(RCU_SCHED); 757 __release(RCU_SCHED);
727 preempt_enable(); 758 preempt_enable();
728} 759}
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 690276a642cf..eb93921cdd30 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,9 +23,8 @@ struct spi_device;
23/* An enum of all the supported cache types */ 23/* An enum of all the supported cache types */
24enum regcache_type { 24enum regcache_type {
25 REGCACHE_NONE, 25 REGCACHE_NONE,
26 REGCACHE_INDEXED,
27 REGCACHE_RBTREE, 26 REGCACHE_RBTREE,
28 REGCACHE_LZO 27 REGCACHE_COMPRESSED
29}; 28};
30 29
31/** 30/**
@@ -83,7 +82,7 @@ struct regmap_config {
83 bool (*precious_reg)(struct device *dev, unsigned int reg); 82 bool (*precious_reg)(struct device *dev, unsigned int reg);
84 83
85 unsigned int max_register; 84 unsigned int max_register;
86 struct reg_default *reg_defaults; 85 const struct reg_default *reg_defaults;
87 unsigned int num_reg_defaults; 86 unsigned int num_reg_defaults;
88 enum regcache_type cache_type; 87 enum regcache_type cache_type;
89 const void *reg_defaults_raw; 88 const void *reg_defaults_raw;
@@ -129,6 +128,8 @@ struct regmap *regmap_init_spi(struct spi_device *dev,
129 const struct regmap_config *config); 128 const struct regmap_config *config);
130 129
131void regmap_exit(struct regmap *map); 130void regmap_exit(struct regmap *map);
131int regmap_reinit_cache(struct regmap *map,
132 const struct regmap_config *config);
132int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 133int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
133int regmap_raw_write(struct regmap *map, unsigned int reg, 134int regmap_raw_write(struct regmap *map, unsigned int reg,
134 const void *val, size_t val_len); 135 const void *val, size_t val_len);
@@ -139,9 +140,61 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
139 size_t val_count); 140 size_t val_count);
140int regmap_update_bits(struct regmap *map, unsigned int reg, 141int regmap_update_bits(struct regmap *map, unsigned int reg,
141 unsigned int mask, unsigned int val); 142 unsigned int mask, unsigned int val);
143int regmap_update_bits_check(struct regmap *map, unsigned int reg,
144 unsigned int mask, unsigned int val,
145 bool *change);
142 146
143int regcache_sync(struct regmap *map); 147int regcache_sync(struct regmap *map);
144void regcache_cache_only(struct regmap *map, bool enable); 148void regcache_cache_only(struct regmap *map, bool enable);
145void regcache_cache_bypass(struct regmap *map, bool enable); 149void regcache_cache_bypass(struct regmap *map, bool enable);
150void regcache_mark_dirty(struct regmap *map);
151
152/**
153 * Description of an IRQ for the generic regmap irq_chip.
154 *
155 * @reg_offset: Offset of the status/mask register within the bank
156 * @mask: Mask used to flag/control the register.
157 */
158struct regmap_irq {
159 unsigned int reg_offset;
160 unsigned int mask;
161};
162
163/**
164 * Description of a generic regmap irq_chip. This is not intended to
165 * handle every possible interrupt controller, but it should handle a
166 * substantial proportion of those that are found in the wild.
167 *
168 * @name: Descriptive name for IRQ controller.
169 *
170 * @status_base: Base status register address.
171 * @mask_base: Base mask register address.
172 * @ack_base: Base ack address. If zero then the chip is clear on read.
173 *
174 * @num_regs: Number of registers in each control bank.
175 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
176 * assigned based on the index in the array of the interrupt.
177 * @num_irqs: Number of descriptors.
178 */
179struct regmap_irq_chip {
180 const char *name;
181
182 unsigned int status_base;
183 unsigned int mask_base;
184 unsigned int ack_base;
185
186 int num_regs;
187
188 const struct regmap_irq *irqs;
189 int num_irqs;
190};
191
192struct regmap_irq_chip_data;
193
194int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
195 int irq_base, struct regmap_irq_chip *chip,
196 struct regmap_irq_chip_data **data);
197void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
198int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
146 199
147#endif 200#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f7756d146c61..f2698a0edfc4 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -149,6 +149,8 @@ int regulator_bulk_enable(int num_consumers,
149 struct regulator_bulk_data *consumers); 149 struct regulator_bulk_data *consumers);
150int regulator_bulk_disable(int num_consumers, 150int regulator_bulk_disable(int num_consumers,
151 struct regulator_bulk_data *consumers); 151 struct regulator_bulk_data *consumers);
152int regulator_bulk_force_disable(int num_consumers,
153 struct regulator_bulk_data *consumers);
152void regulator_bulk_free(int num_consumers, 154void regulator_bulk_free(int num_consumers,
153 struct regulator_bulk_data *consumers); 155 struct regulator_bulk_data *consumers);
154 156
@@ -212,6 +214,11 @@ static inline int regulator_disable(struct regulator *regulator)
212 return 0; 214 return 0;
213} 215}
214 216
217static inline int regulator_force_disable(struct regulator *regulator)
218{
219 return 0;
220}
221
215static inline int regulator_disable_deferred(struct regulator *regulator, 222static inline int regulator_disable_deferred(struct regulator *regulator,
216 int ms) 223 int ms)
217{ 224{
@@ -242,6 +249,12 @@ static inline int regulator_bulk_disable(int num_consumers,
242 return 0; 249 return 0;
243} 250}
244 251
252static inline int regulator_bulk_force_disable(int num_consumers,
253 struct regulator_bulk_data *consumers)
254{
255 return 0;
256}
257
245static inline void regulator_bulk_free(int num_consumers, 258static inline void regulator_bulk_free(int num_consumers,
246 struct regulator_bulk_data *consumers) 259 struct regulator_bulk_data *consumers)
247{ 260{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 52c89ae32f64..4214b9a9d1c9 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -154,6 +154,7 @@ enum regulator_type {
154 * this type. 154 * this type.
155 * 155 *
156 * @name: Identifying name for the regulator. 156 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply
157 * @id: Numerical identifier for the regulator. 158 * @id: Numerical identifier for the regulator.
158 * @n_voltages: Number of selectors available for ops.list_voltage(). 159 * @n_voltages: Number of selectors available for ops.list_voltage().
159 * @ops: Regulator operations table. 160 * @ops: Regulator operations table.
@@ -163,6 +164,7 @@ enum regulator_type {
163 */ 164 */
164struct regulator_desc { 165struct regulator_desc {
165 const char *name; 166 const char *name;
167 const char *supply_name;
166 int id; 168 int id;
167 unsigned n_voltages; 169 unsigned n_voltages;
168 struct regulator_ops *ops; 170 struct regulator_ops *ops;
@@ -212,7 +214,7 @@ struct regulator_dev {
212 214
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 215struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
214 struct device *dev, const struct regulator_init_data *init_data, 216 struct device *dev, const struct regulator_init_data *init_data,
215 void *driver_data); 217 void *driver_data, struct device_node *of_node);
216void regulator_unregister(struct regulator_dev *rdev); 218void regulator_unregister(struct regulator_dev *rdev);
217 219
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 220int regulator_notifier_call_chain(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
new file mode 100644
index 000000000000..769704f296e5
--- /dev/null
+++ b/include/linux/regulator/of_regulator.h
@@ -0,0 +1,22 @@
1/*
2 * OpenFirmware regulator support routines
3 *
4 */
5
6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H
8
9#if defined(CONFIG_OF)
10extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node);
13#else
14static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev,
16 struct device_node *node)
17{
18 return NULL;
19}
20#endif /* CONFIG_OF */
21
22#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 96d465f8d3e6..2213ddcce20c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1759,13 +1759,14 @@ struct reiserfs_journal_header {
1759 REISERFS_QUOTA_TRANS_BLOCKS(sb))) 1759 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1760 1760
1761#ifdef CONFIG_QUOTA 1761#ifdef CONFIG_QUOTA
1762#define REISERFS_QUOTA_OPTS ((1 << REISERFS_USRQUOTA) | (1 << REISERFS_GRPQUOTA))
1762/* We need to update data and inode (atime) */ 1763/* We need to update data and inode (atime) */
1763#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) 1764#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? 2 : 0)
1764/* 1 balancing, 1 bitmap, 1 data per write + stat data update */ 1765/* 1 balancing, 1 bitmap, 1 data per write + stat data update */
1765#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ 1766#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1766(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) 1767(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0)
1767/* same as with INIT */ 1768/* same as with INIT */
1768#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? \ 1769#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1769(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) 1770(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0)
1770#else 1771#else
1771#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 1772#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0
@@ -2056,7 +2057,7 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
2056 2057
2057struct reiserfs_security_handle; 2058struct reiserfs_security_handle;
2058int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 2059int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
2059 struct inode *dir, int mode, 2060 struct inode *dir, umode_t mode,
2060 const char *symname, loff_t i_size, 2061 const char *symname, loff_t i_size,
2061 struct dentry *dentry, struct inode *inode, 2062 struct dentry *dentry, struct inode *inode,
2062 struct reiserfs_security_handle *security); 2063 struct reiserfs_security_handle *security);
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 52c83b6a758a..8c9e85c64b46 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -417,6 +417,7 @@ struct reiserfs_sb_info {
417 char *s_qf_names[MAXQUOTAS]; 417 char *s_qf_names[MAXQUOTAS];
418 int s_jquota_fmt; 418 int s_jquota_fmt;
419#endif 419#endif
420 char *s_jdev; /* Stored jdev for mount option showing */
420#ifdef CONFIG_REISERFS_CHECK 421#ifdef CONFIG_REISERFS_CHECK
421 422
422 struct tree_balance *cur_tb; /* 423 struct tree_balance *cur_tb; /*
@@ -482,7 +483,8 @@ enum reiserfs_mount_options {
482 REISERFS_ERROR_RO, 483 REISERFS_ERROR_RO,
483 REISERFS_ERROR_CONTINUE, 484 REISERFS_ERROR_CONTINUE,
484 485
485 REISERFS_QUOTA, /* Some quota option specified */ 486 REISERFS_USRQUOTA, /* User quota option specified */
487 REISERFS_GRPQUOTA, /* Group quota option specified */
486 488
487 REISERFS_TEST1, 489 REISERFS_TEST1,
488 REISERFS_TEST2, 490 REISERFS_TEST2,
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 14a86bc7102b..a822fd71fd64 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -144,7 +144,7 @@ struct rchan_callbacks
144 */ 144 */
145 struct dentry *(*create_buf_file)(const char *filename, 145 struct dentry *(*create_buf_file)(const char *filename,
146 struct dentry *parent, 146 struct dentry *parent,
147 int mode, 147 umode_t mode,
148 struct rchan_buf *buf, 148 struct rchan_buf *buf,
149 int *is_global); 149 int *is_global);
150 150
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 2148b122779b..1cdd62a2788a 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -120,6 +120,7 @@ void anon_vma_init(void); /* create anon_vma_cachep */
120int anon_vma_prepare(struct vm_area_struct *); 120int anon_vma_prepare(struct vm_area_struct *);
121void unlink_anon_vmas(struct vm_area_struct *); 121void unlink_anon_vmas(struct vm_area_struct *);
122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
123void anon_vma_moveto_tail(struct vm_area_struct *);
123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
124void __anon_vma_link(struct vm_area_struct *); 125void __anon_vma_link(struct vm_area_struct *);
125 126
@@ -157,7 +158,7 @@ static inline void page_dup_rmap(struct page *page)
157 * Called from mm/vmscan.c to handle paging out 158 * Called from mm/vmscan.c to handle paging out
158 */ 159 */
159int page_referenced(struct page *, int is_locked, 160int page_referenced(struct page *, int is_locked,
160 struct mem_cgroup *cnt, unsigned long *vm_flags); 161 struct mem_cgroup *memcg, unsigned long *vm_flags);
161int page_referenced_one(struct page *, struct vm_area_struct *, 162int page_referenced_one(struct page *, struct vm_area_struct *,
162 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); 163 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
163 164
@@ -235,7 +236,7 @@ int rmap_walk(struct page *page, int (*rmap_one)(struct page *,
235#define anon_vma_link(vma) do {} while (0) 236#define anon_vma_link(vma) do {} while (0)
236 237
237static inline int page_referenced(struct page *page, int is_locked, 238static inline int page_referenced(struct page *page, int is_locked,
238 struct mem_cgroup *cnt, 239 struct mem_cgroup *memcg,
239 unsigned long *vm_flags) 240 unsigned long *vm_flags)
240{ 241{
241 *vm_flags = 0; 242 *vm_flags = 0;
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h
index fbe58b7e63eb..99dadbffdd4f 100644
--- a/include/linux/s3c_adc_battery.h
+++ b/include/linux/s3c_adc_battery.h
@@ -25,6 +25,10 @@ struct s3c_adc_bat_pdata {
25 const unsigned int current_channel; 25 const unsigned int current_channel;
26 const unsigned int backup_volt_channel; 26 const unsigned int backup_volt_channel;
27 27
28 const unsigned int volt_samples;
29 const unsigned int current_samples;
30 const unsigned int backup_volt_samples;
31
28 const unsigned int volt_mult; 32 const unsigned int volt_mult;
29 const unsigned int current_mult; 33 const unsigned int current_mult;
30 const unsigned int backup_volt_mult; 34 const unsigned int backup_volt_mult;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1c4f3e9b9bc5..4032ec1cf836 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -220,7 +220,7 @@ extern char ___assert_task_state[1 - 2*!!(
220 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 220 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
221#define task_contributes_to_load(task) \ 221#define task_contributes_to_load(task) \
222 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ 222 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
223 (task->flags & PF_FREEZING) == 0) 223 (task->flags & PF_FROZEN) == 0)
224 224
225#define __set_task_state(tsk, state_value) \ 225#define __set_task_state(tsk, state_value) \
226 do { (tsk)->state = (state_value); } while (0) 226 do { (tsk)->state = (state_value); } while (0)
@@ -273,9 +273,11 @@ extern int runqueue_is_locked(int cpu);
273 273
274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
275extern void select_nohz_load_balancer(int stop_tick); 275extern void select_nohz_load_balancer(int stop_tick);
276extern void set_cpu_sd_state_idle(void);
276extern int get_nohz_timer_target(void); 277extern int get_nohz_timer_target(void);
277#else 278#else
278static inline void select_nohz_load_balancer(int stop_tick) { } 279static inline void select_nohz_load_balancer(int stop_tick) { }
280static inline void set_cpu_sd_state_idle(void) { }
279#endif 281#endif
280 282
281/* 283/*
@@ -483,8 +485,8 @@ struct task_cputime {
483 485
484#define INIT_CPUTIME \ 486#define INIT_CPUTIME \
485 (struct task_cputime) { \ 487 (struct task_cputime) { \
486 .utime = cputime_zero, \ 488 .utime = 0, \
487 .stime = cputime_zero, \ 489 .stime = 0, \
488 .sum_exec_runtime = 0, \ 490 .sum_exec_runtime = 0, \
489 } 491 }
490 492
@@ -635,13 +637,15 @@ struct signal_struct {
635#endif 637#endif
636#ifdef CONFIG_CGROUPS 638#ifdef CONFIG_CGROUPS
637 /* 639 /*
638 * The threadgroup_fork_lock prevents threads from forking with 640 * group_rwsem prevents new tasks from entering the threadgroup and
639 * CLONE_THREAD while held for writing. Use this for fork-sensitive 641 * member tasks from exiting,a more specifically, setting of
640 * threadgroup-wide operations. It's taken for reading in fork.c in 642 * PF_EXITING. fork and exit paths are protected with this rwsem
641 * copy_process(). 643 * using threadgroup_change_begin/end(). Users which require
642 * Currently only needed write-side by cgroups. 644 * threadgroup to remain stable should use threadgroup_[un]lock()
645 * which also takes care of exec path. Currently, cgroup is the
646 * only user.
643 */ 647 */
644 struct rw_semaphore threadgroup_fork_lock; 648 struct rw_semaphore group_rwsem;
645#endif 649#endif
646 650
647 int oom_adj; /* OOM kill score adjustment (bit shift) */ 651 int oom_adj; /* OOM kill score adjustment (bit shift) */
@@ -901,6 +905,10 @@ struct sched_group_power {
901 * single CPU. 905 * single CPU.
902 */ 906 */
903 unsigned int power, power_orig; 907 unsigned int power, power_orig;
908 /*
909 * Number of busy cpus in this group.
910 */
911 atomic_t nr_busy_cpus;
904}; 912};
905 913
906struct sched_group { 914struct sched_group {
@@ -925,6 +933,15 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
925 return to_cpumask(sg->cpumask); 933 return to_cpumask(sg->cpumask);
926} 934}
927 935
936/**
937 * group_first_cpu - Returns the first cpu in the cpumask of a sched_group.
938 * @group: The group whose first cpu is to be returned.
939 */
940static inline unsigned int group_first_cpu(struct sched_group *group)
941{
942 return cpumask_first(sched_group_cpus(group));
943}
944
928struct sched_domain_attr { 945struct sched_domain_attr {
929 int relax_domain_level; 946 int relax_domain_level;
930}; 947};
@@ -1315,8 +1332,8 @@ struct task_struct {
1315 * older sibling, respectively. (p->father can be replaced with 1332 * older sibling, respectively. (p->father can be replaced with
1316 * p->real_parent->pid) 1333 * p->real_parent->pid)
1317 */ 1334 */
1318 struct task_struct *real_parent; /* real parent process */ 1335 struct task_struct __rcu *real_parent; /* real parent process */
1319 struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */ 1336 struct task_struct __rcu *parent; /* recipient of SIGCHLD, wait4() reports */
1320 /* 1337 /*
1321 * children/sibling forms the list of my natural children 1338 * children/sibling forms the list of my natural children
1322 */ 1339 */
@@ -1527,6 +1544,7 @@ struct task_struct {
1527 */ 1544 */
1528 int nr_dirtied; 1545 int nr_dirtied;
1529 int nr_dirtied_pause; 1546 int nr_dirtied_pause;
1547 unsigned long dirty_paused_when; /* start of a write-and-pause period */
1530 1548
1531#ifdef CONFIG_LATENCYTOP 1549#ifdef CONFIG_LATENCYTOP
1532 int latency_record_count; 1550 int latency_record_count;
@@ -1772,7 +1790,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1772#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1790#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1773#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */ 1791#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1774#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1792#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1775#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1776#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1793#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
1777#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1794#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1778#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1795#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
@@ -1788,7 +1805,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1788#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1805#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1789#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1806#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1790#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1807#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1791#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
1792 1808
1793/* 1809/*
1794 * Only the _current_ task can read/write to tsk->flags, but other 1810 * Only the _current_ task can read/write to tsk->flags, but other
@@ -2070,6 +2086,14 @@ extern int sched_setscheduler(struct task_struct *, int,
2070extern int sched_setscheduler_nocheck(struct task_struct *, int, 2086extern int sched_setscheduler_nocheck(struct task_struct *, int,
2071 const struct sched_param *); 2087 const struct sched_param *);
2072extern struct task_struct *idle_task(int cpu); 2088extern struct task_struct *idle_task(int cpu);
2089/**
2090 * is_idle_task - is the specified task an idle task?
2091 * @tsk: the task in question.
2092 */
2093static inline bool is_idle_task(struct task_struct *p)
2094{
2095 return p->pid == 0;
2096}
2073extern struct task_struct *curr_task(int cpu); 2097extern struct task_struct *curr_task(int cpu);
2074extern void set_curr_task(int cpu, struct task_struct *p); 2098extern void set_curr_task(int cpu, struct task_struct *p);
2075 2099
@@ -2251,7 +2275,7 @@ extern void __cleanup_sighand(struct sighand_struct *);
2251extern void exit_itimers(struct signal_struct *); 2275extern void exit_itimers(struct signal_struct *);
2252extern void flush_itimer_signals(void); 2276extern void flush_itimer_signals(void);
2253 2277
2254extern NORET_TYPE void do_group_exit(int); 2278extern void do_group_exit(int);
2255 2279
2256extern void daemonize(const char *, ...); 2280extern void daemonize(const char *, ...);
2257extern int allow_signal(int); 2281extern int allow_signal(int);
@@ -2373,29 +2397,62 @@ static inline void unlock_task_sighand(struct task_struct *tsk,
2373 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); 2397 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
2374} 2398}
2375 2399
2376/* See the declaration of threadgroup_fork_lock in signal_struct. */
2377#ifdef CONFIG_CGROUPS 2400#ifdef CONFIG_CGROUPS
2378static inline void threadgroup_fork_read_lock(struct task_struct *tsk) 2401static inline void threadgroup_change_begin(struct task_struct *tsk)
2379{ 2402{
2380 down_read(&tsk->signal->threadgroup_fork_lock); 2403 down_read(&tsk->signal->group_rwsem);
2381} 2404}
2382static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) 2405static inline void threadgroup_change_end(struct task_struct *tsk)
2383{ 2406{
2384 up_read(&tsk->signal->threadgroup_fork_lock); 2407 up_read(&tsk->signal->group_rwsem);
2385} 2408}
2386static inline void threadgroup_fork_write_lock(struct task_struct *tsk) 2409
2410/**
2411 * threadgroup_lock - lock threadgroup
2412 * @tsk: member task of the threadgroup to lock
2413 *
2414 * Lock the threadgroup @tsk belongs to. No new task is allowed to enter
2415 * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
2416 * perform exec. This is useful for cases where the threadgroup needs to
2417 * stay stable across blockable operations.
2418 *
2419 * fork and exit paths explicitly call threadgroup_change_{begin|end}() for
2420 * synchronization. While held, no new task will be added to threadgroup
2421 * and no existing live task will have its PF_EXITING set.
2422 *
2423 * During exec, a task goes and puts its thread group through unusual
2424 * changes. After de-threading, exclusive access is assumed to resources
2425 * which are usually shared by tasks in the same group - e.g. sighand may
2426 * be replaced with a new one. Also, the exec'ing task takes over group
2427 * leader role including its pid. Exclude these changes while locked by
2428 * grabbing cred_guard_mutex which is used to synchronize exec path.
2429 */
2430static inline void threadgroup_lock(struct task_struct *tsk)
2387{ 2431{
2388 down_write(&tsk->signal->threadgroup_fork_lock); 2432 /*
2433 * exec uses exit for de-threading nesting group_rwsem inside
2434 * cred_guard_mutex. Grab cred_guard_mutex first.
2435 */
2436 mutex_lock(&tsk->signal->cred_guard_mutex);
2437 down_write(&tsk->signal->group_rwsem);
2389} 2438}
2390static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) 2439
2440/**
2441 * threadgroup_unlock - unlock threadgroup
2442 * @tsk: member task of the threadgroup to unlock
2443 *
2444 * Reverse threadgroup_lock().
2445 */
2446static inline void threadgroup_unlock(struct task_struct *tsk)
2391{ 2447{
2392 up_write(&tsk->signal->threadgroup_fork_lock); 2448 up_write(&tsk->signal->group_rwsem);
2449 mutex_unlock(&tsk->signal->cred_guard_mutex);
2393} 2450}
2394#else 2451#else
2395static inline void threadgroup_fork_read_lock(struct task_struct *tsk) {} 2452static inline void threadgroup_change_begin(struct task_struct *tsk) {}
2396static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) {} 2453static inline void threadgroup_change_end(struct task_struct *tsk) {}
2397static inline void threadgroup_fork_write_lock(struct task_struct *tsk) {} 2454static inline void threadgroup_lock(struct task_struct *tsk) {}
2398static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) {} 2455static inline void threadgroup_unlock(struct task_struct *tsk) {}
2399#endif 2456#endif
2400 2457
2401#ifndef __HAVE_THREAD_FUNCTIONS 2458#ifndef __HAVE_THREAD_FUNCTIONS
diff --git a/include/linux/security.h b/include/linux/security.h
index 19d8e04e1688..0ccceb9b1046 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -186,7 +186,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
186 * Security module identifier. 186 * Security module identifier.
187 * 187 *
188 * @name: 188 * @name:
189 * A string that acts as a unique identifeir for the LSM with max number 189 * A string that acts as a unique identifier for the LSM with max number
190 * of characters = SECURITY_NAME_MAX. 190 * of characters = SECURITY_NAME_MAX.
191 * 191 *
192 * Security hooks for program execution operations. 192 * Security hooks for program execution operations.
@@ -275,7 +275,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
275 * @copy copied data which will be passed to the security module. 275 * @copy copied data which will be passed to the security module.
276 * Returns 0 if the copy was successful. 276 * Returns 0 if the copy was successful.
277 * @sb_remount: 277 * @sb_remount:
278 * Extracts security system specifc mount options and verifys no changes 278 * Extracts security system specific mount options and verifies no changes
279 * are being made to those options. 279 * are being made to those options.
280 * @sb superblock being remounted 280 * @sb superblock being remounted
281 * @data contains the filesystem-specific data. 281 * @data contains the filesystem-specific data.
@@ -380,15 +380,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
380 * Return 0 if permission is granted. 380 * Return 0 if permission is granted.
381 * @inode_mkdir: 381 * @inode_mkdir:
382 * Check permissions to create a new directory in the existing directory 382 * Check permissions to create a new directory in the existing directory
383 * associated with inode strcture @dir. 383 * associated with inode structure @dir.
384 * @dir containst the inode structure of parent of the directory to be created. 384 * @dir contains the inode structure of parent of the directory to be created.
385 * @dentry contains the dentry structure of new directory. 385 * @dentry contains the dentry structure of new directory.
386 * @mode contains the mode of new directory. 386 * @mode contains the mode of new directory.
387 * Return 0 if permission is granted. 387 * Return 0 if permission is granted.
388 * @path_mkdir: 388 * @path_mkdir:
389 * Check permissions to create a new directory in the existing directory 389 * Check permissions to create a new directory in the existing directory
390 * associated with path strcture @path. 390 * associated with path structure @path.
391 * @dir containst the path structure of parent of the directory 391 * @dir contains the path structure of parent of the directory
392 * to be created. 392 * to be created.
393 * @dentry contains the dentry structure of new directory. 393 * @dentry contains the dentry structure of new directory.
394 * @mode contains the mode of new directory. 394 * @mode contains the mode of new directory.
@@ -578,7 +578,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
578 * @file contains the file structure. 578 * @file contains the file structure.
579 * @cmd contains the operation to perform. 579 * @cmd contains the operation to perform.
580 * @arg contains the operational arguments. 580 * @arg contains the operational arguments.
581 * Check permission for an ioctl operation on @file. Note that @arg can 581 * Check permission for an ioctl operation on @file. Note that @arg
582 * sometimes represents a user space pointer; in other cases, it may be a 582 * sometimes represents a user space pointer; in other cases, it may be a
583 * simple integer value. When @arg represents a user space pointer, it 583 * simple integer value. When @arg represents a user space pointer, it
584 * should never be used by the security module. 584 * should never be used by the security module.
@@ -590,6 +590,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
590 * @reqprot contains the protection requested by the application. 590 * @reqprot contains the protection requested by the application.
591 * @prot contains the protection that will be applied by the kernel. 591 * @prot contains the protection that will be applied by the kernel.
592 * @flags contains the operational flags. 592 * @flags contains the operational flags.
593 * @addr contains virtual address that will be used for the operation.
594 * @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1.
593 * Return 0 if permission is granted. 595 * Return 0 if permission is granted.
594 * @file_mprotect: 596 * @file_mprotect:
595 * Check permissions before changing memory access permissions. 597 * Check permissions before changing memory access permissions.
@@ -606,7 +608,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
606 * Return 0 if permission is granted. 608 * Return 0 if permission is granted.
607 * @file_fcntl: 609 * @file_fcntl:
608 * Check permission before allowing the file operation specified by @cmd 610 * Check permission before allowing the file operation specified by @cmd
609 * from being performed on the file @file. Note that @arg can sometimes 611 * from being performed on the file @file. Note that @arg sometimes
610 * represents a user space pointer; in other cases, it may be a simple 612 * represents a user space pointer; in other cases, it may be a simple
611 * integer value. When @arg represents a user space pointer, it should 613 * integer value. When @arg represents a user space pointer, it should
612 * never be used by the security module. 614 * never be used by the security module.
@@ -793,7 +795,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
793 * information can be saved using the eff_cap field of the 795 * information can be saved using the eff_cap field of the
794 * netlink_skb_parms structure. Also may be used to provide fine 796 * netlink_skb_parms structure. Also may be used to provide fine
795 * grained control over message transmission. 797 * grained control over message transmission.
796 * @sk associated sock of task sending the message., 798 * @sk associated sock of task sending the message.
797 * @skb contains the sk_buff structure for the netlink message. 799 * @skb contains the sk_buff structure for the netlink message.
798 * Return 0 if the information was successfully saved and message 800 * Return 0 if the information was successfully saved and message
799 * is allowed to be transmitted. 801 * is allowed to be transmitted.
@@ -1080,9 +1082,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1080 * should free it. 1082 * should free it.
1081 * @key points to the key to be queried. 1083 * @key points to the key to be queried.
1082 * @_buffer points to a pointer that should be set to point to the 1084 * @_buffer points to a pointer that should be set to point to the
1083 * resulting string (if no label or an error occurs). 1085 * resulting string (if no label or an error occurs).
1084 * Return the length of the string (including terminating NUL) or -ve if 1086 * Return the length of the string (including terminating NUL) or -ve if
1085 * an error. 1087 * an error.
1086 * May also return 0 (and a NULL buffer pointer) if there is no label. 1088 * May also return 0 (and a NULL buffer pointer) if there is no label.
1087 * 1089 *
1088 * Security hooks affecting all System V IPC operations. 1090 * Security hooks affecting all System V IPC operations.
@@ -1268,7 +1270,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1268 * credentials. 1270 * credentials.
1269 * @tsk contains the task_struct for the process. 1271 * @tsk contains the task_struct for the process.
1270 * @cred contains the credentials to use. 1272 * @cred contains the credentials to use.
1271 * @ns contains the user namespace we want the capability in 1273 * @ns contains the user namespace we want the capability in
1272 * @cap contains the capability <include/linux/capability.h>. 1274 * @cap contains the capability <include/linux/capability.h>.
1273 * @audit: Whether to write an audit message or not 1275 * @audit: Whether to write an audit message or not
1274 * Return 0 if the capability is granted for @tsk. 1276 * Return 0 if the capability is granted for @tsk.
@@ -1370,7 +1372,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1370 * @ctxlen contains the length of @ctx. 1372 * @ctxlen contains the length of @ctx.
1371 * 1373 *
1372 * @inode_getsecctx: 1374 * @inode_getsecctx:
1373 * Returns a string containing all relavent security context information 1375 * Returns a string containing all relevant security context information
1374 * 1376 *
1375 * @inode we wish to get the security context of. 1377 * @inode we wish to get the security context of.
1376 * @ctx is a pointer in which to place the allocated security context. 1378 * @ctx is a pointer in which to place the allocated security context.
@@ -1424,9 +1426,9 @@ struct security_operations {
1424 1426
1425#ifdef CONFIG_SECURITY_PATH 1427#ifdef CONFIG_SECURITY_PATH
1426 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1428 int (*path_unlink) (struct path *dir, struct dentry *dentry);
1427 int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode); 1429 int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode);
1428 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1430 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1429 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1431 int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode,
1430 unsigned int dev); 1432 unsigned int dev);
1431 int (*path_truncate) (struct path *path); 1433 int (*path_truncate) (struct path *path);
1432 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1434 int (*path_symlink) (struct path *dir, struct dentry *dentry,
@@ -1435,8 +1437,7 @@ struct security_operations {
1435 struct dentry *new_dentry); 1437 struct dentry *new_dentry);
1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, 1438 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1437 struct path *new_dir, struct dentry *new_dentry); 1439 struct path *new_dir, struct dentry *new_dentry);
1438 int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt, 1440 int (*path_chmod) (struct path *path, umode_t mode);
1439 mode_t mode);
1440 int (*path_chown) (struct path *path, uid_t uid, gid_t gid); 1441 int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
1441 int (*path_chroot) (struct path *path); 1442 int (*path_chroot) (struct path *path);
1442#endif 1443#endif
@@ -1447,16 +1448,16 @@ struct security_operations {
1447 const struct qstr *qstr, char **name, 1448 const struct qstr *qstr, char **name,
1448 void **value, size_t *len); 1449 void **value, size_t *len);
1449 int (*inode_create) (struct inode *dir, 1450 int (*inode_create) (struct inode *dir,
1450 struct dentry *dentry, int mode); 1451 struct dentry *dentry, umode_t mode);
1451 int (*inode_link) (struct dentry *old_dentry, 1452 int (*inode_link) (struct dentry *old_dentry,
1452 struct inode *dir, struct dentry *new_dentry); 1453 struct inode *dir, struct dentry *new_dentry);
1453 int (*inode_unlink) (struct inode *dir, struct dentry *dentry); 1454 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1454 int (*inode_symlink) (struct inode *dir, 1455 int (*inode_symlink) (struct inode *dir,
1455 struct dentry *dentry, const char *old_name); 1456 struct dentry *dentry, const char *old_name);
1456 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); 1457 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode);
1457 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); 1458 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1458 int (*inode_mknod) (struct inode *dir, struct dentry *dentry, 1459 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1459 int mode, dev_t dev); 1460 umode_t mode, dev_t dev);
1460 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, 1461 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1461 struct inode *new_dir, struct dentry *new_dentry); 1462 struct inode *new_dir, struct dentry *new_dentry);
1462 int (*inode_readlink) (struct dentry *dentry); 1463 int (*inode_readlink) (struct dentry *dentry);
@@ -1716,15 +1717,15 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1716int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1717int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1717 const struct qstr *qstr, char **name, 1718 const struct qstr *qstr, char **name,
1718 void **value, size_t *len); 1719 void **value, size_t *len);
1719int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); 1720int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1720int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1721int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1721 struct dentry *new_dentry); 1722 struct dentry *new_dentry);
1722int security_inode_unlink(struct inode *dir, struct dentry *dentry); 1723int security_inode_unlink(struct inode *dir, struct dentry *dentry);
1723int security_inode_symlink(struct inode *dir, struct dentry *dentry, 1724int security_inode_symlink(struct inode *dir, struct dentry *dentry,
1724 const char *old_name); 1725 const char *old_name);
1725int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); 1726int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
1726int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1727int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1727int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); 1728int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1728int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1729int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1729 struct inode *new_dir, struct dentry *new_dentry); 1730 struct inode *new_dir, struct dentry *new_dentry);
1730int security_inode_readlink(struct dentry *dentry); 1731int security_inode_readlink(struct dentry *dentry);
@@ -2044,7 +2045,7 @@ static inline void security_inode_free(struct inode *inode)
2044static inline int security_inode_init_security(struct inode *inode, 2045static inline int security_inode_init_security(struct inode *inode,
2045 struct inode *dir, 2046 struct inode *dir,
2046 const struct qstr *qstr, 2047 const struct qstr *qstr,
2047 initxattrs initxattrs, 2048 const initxattrs initxattrs,
2048 void *fs_data) 2049 void *fs_data)
2049{ 2050{
2050 return 0; 2051 return 0;
@@ -2056,12 +2057,12 @@ static inline int security_old_inode_init_security(struct inode *inode,
2056 char **name, void **value, 2057 char **name, void **value,
2057 size_t *len) 2058 size_t *len)
2058{ 2059{
2059 return 0; 2060 return -EOPNOTSUPP;
2060} 2061}
2061 2062
2062static inline int security_inode_create(struct inode *dir, 2063static inline int security_inode_create(struct inode *dir,
2063 struct dentry *dentry, 2064 struct dentry *dentry,
2064 int mode) 2065 umode_t mode)
2065{ 2066{
2066 return 0; 2067 return 0;
2067} 2068}
@@ -2855,9 +2856,9 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2855 2856
2856#ifdef CONFIG_SECURITY_PATH 2857#ifdef CONFIG_SECURITY_PATH
2857int security_path_unlink(struct path *dir, struct dentry *dentry); 2858int security_path_unlink(struct path *dir, struct dentry *dentry);
2858int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode); 2859int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode);
2859int security_path_rmdir(struct path *dir, struct dentry *dentry); 2860int security_path_rmdir(struct path *dir, struct dentry *dentry);
2860int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2861int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
2861 unsigned int dev); 2862 unsigned int dev);
2862int security_path_truncate(struct path *path); 2863int security_path_truncate(struct path *path);
2863int security_path_symlink(struct path *dir, struct dentry *dentry, 2864int security_path_symlink(struct path *dir, struct dentry *dentry,
@@ -2866,8 +2867,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2866 struct dentry *new_dentry); 2867 struct dentry *new_dentry);
2867int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2868int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2868 struct path *new_dir, struct dentry *new_dentry); 2869 struct path *new_dir, struct dentry *new_dentry);
2869int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt, 2870int security_path_chmod(struct path *path, umode_t mode);
2870 mode_t mode);
2871int security_path_chown(struct path *path, uid_t uid, gid_t gid); 2871int security_path_chown(struct path *path, uid_t uid, gid_t gid);
2872int security_path_chroot(struct path *path); 2872int security_path_chroot(struct path *path);
2873#else /* CONFIG_SECURITY_PATH */ 2873#else /* CONFIG_SECURITY_PATH */
@@ -2877,7 +2877,7 @@ static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
2877} 2877}
2878 2878
2879static inline int security_path_mkdir(struct path *dir, struct dentry *dentry, 2879static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
2880 int mode) 2880 umode_t mode)
2881{ 2881{
2882 return 0; 2882 return 0;
2883} 2883}
@@ -2888,7 +2888,7 @@ static inline int security_path_rmdir(struct path *dir, struct dentry *dentry)
2888} 2888}
2889 2889
2890static inline int security_path_mknod(struct path *dir, struct dentry *dentry, 2890static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2891 int mode, unsigned int dev) 2891 umode_t mode, unsigned int dev)
2892{ 2892{
2893 return 0; 2893 return 0;
2894} 2894}
@@ -2919,9 +2919,7 @@ static inline int security_path_rename(struct path *old_dir,
2919 return 0; 2919 return 0;
2920} 2920}
2921 2921
2922static inline int security_path_chmod(struct dentry *dentry, 2922static inline int security_path_chmod(struct path *path, umode_t mode)
2923 struct vfsmount *mnt,
2924 mode_t mode)
2925{ 2923{
2926 return 0; 2924 return 0;
2927} 2925}
@@ -3010,7 +3008,7 @@ static inline void security_audit_rule_free(void *lsmrule)
3010 3008
3011#ifdef CONFIG_SECURITYFS 3009#ifdef CONFIG_SECURITYFS
3012 3010
3013extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 3011extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
3014 struct dentry *parent, void *data, 3012 struct dentry *parent, void *data,
3015 const struct file_operations *fops); 3013 const struct file_operations *fops);
3016extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 3014extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
@@ -3025,7 +3023,7 @@ static inline struct dentry *securityfs_create_dir(const char *name,
3025} 3023}
3026 3024
3027static inline struct dentry *securityfs_create_file(const char *name, 3025static inline struct dentry *securityfs_create_file(const char *name,
3028 mode_t mode, 3026 umode_t mode,
3029 struct dentry *parent, 3027 struct dentry *parent,
3030 void *data, 3028 void *data,
3031 const struct file_operations *fops) 3029 const struct file_operations *fops)
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 0b69a4684216..44f1514b00ba 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -74,7 +74,7 @@ static inline void seq_commit(struct seq_file *m, int num)
74 } 74 }
75} 75}
76 76
77char *mangle_path(char *s, char *p, char *esc); 77char *mangle_path(char *s, const char *p, const char *esc);
78int seq_open(struct file *, const struct seq_operations *); 78int seq_open(struct file *, const struct seq_operations *);
79ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 79ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
80loff_t seq_lseek(struct file *, loff_t, int); 80loff_t seq_lseek(struct file *, loff_t, int);
@@ -86,10 +86,10 @@ int seq_write(struct seq_file *seq, const void *data, size_t len);
86 86
87__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...); 87__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
88 88
89int seq_path(struct seq_file *, struct path *, char *); 89int seq_path(struct seq_file *, const struct path *, const char *);
90int seq_dentry(struct seq_file *, struct dentry *, char *); 90int seq_dentry(struct seq_file *, struct dentry *, const char *);
91int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 91int seq_path_root(struct seq_file *m, const struct path *path,
92 char *esc); 92 const struct path *root, const char *esc);
93int seq_bitmap(struct seq_file *m, const unsigned long *bits, 93int seq_bitmap(struct seq_file *m, const unsigned long *bits,
94 unsigned int nr_bits); 94 unsigned int nr_bits);
95static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) 95static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 1f05bbeac01e..8f012f8ac8e9 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -66,6 +66,7 @@ enum {
66 * dependent on the 8250 driver. 66 * dependent on the 8250 driver.
67 */ 67 */
68struct uart_port; 68struct uart_port;
69struct uart_8250_port;
69 70
70int serial8250_register_port(struct uart_port *); 71int serial8250_register_port(struct uart_port *);
71void serial8250_unregister_port(int line); 72void serial8250_unregister_port(int line);
@@ -81,7 +82,11 @@ extern void serial8250_do_set_termios(struct uart_port *port,
81 struct ktermios *termios, struct ktermios *old); 82 struct ktermios *termios, struct ktermios *old);
82extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 83extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
83 unsigned int oldstate); 84 unsigned int oldstate);
85extern int fsl8250_handle_irq(struct uart_port *port);
84int serial8250_handle_irq(struct uart_port *port, unsigned int iir); 86int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
87unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr);
88void serial8250_tx_chars(struct uart_8250_port *up);
89unsigned int serial8250_modem_status(struct uart_8250_port *up);
85 90
86extern void serial8250_set_isa_configurator(void (*v) 91extern void serial8250_set_isa_configurator(void (*v)
87 (int port, struct uart_port *up, 92 (int port, struct uart_port *up,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index eadf33d0abba..c91ace70c21d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -207,6 +207,10 @@
207/* Xilinx PSS UART */ 207/* Xilinx PSS UART */
208#define PORT_XUARTPS 98 208#define PORT_XUARTPS 98
209 209
210/* Atheros AR933X SoC */
211#define PORT_AR933X 99
212
213
210#ifdef __KERNEL__ 214#ifdef __KERNEL__
211 215
212#include <linux/compiler.h> 216#include <linux/compiler.h>
@@ -351,6 +355,7 @@ struct uart_port {
351#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 355#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
352#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 356#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
353#define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) 357#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
358#define UPF_IIR_ONCE ((__force upf_t) (1 << 26))
354/* The exact UART type is known and should not be probed. */ 359/* The exact UART type is known and should not be probed. */
355#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) 360#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))
356#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) 361#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
@@ -483,10 +488,19 @@ static inline int uart_tx_stopped(struct uart_port *port)
483/* 488/*
484 * The following are helper functions for the low level drivers. 489 * The following are helper functions for the low level drivers.
485 */ 490 */
491
492extern void uart_handle_dcd_change(struct uart_port *uport,
493 unsigned int status);
494extern void uart_handle_cts_change(struct uart_port *uport,
495 unsigned int status);
496
497extern void uart_insert_char(struct uart_port *port, unsigned int status,
498 unsigned int overrun, unsigned int ch, unsigned int flag);
499
500#ifdef SUPPORT_SYSRQ
486static inline int 501static inline int
487uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 502uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
488{ 503{
489#ifdef SUPPORT_SYSRQ
490 if (port->sysrq) { 504 if (port->sysrq) {
491 if (ch && time_before(jiffies, port->sysrq)) { 505 if (ch && time_before(jiffies, port->sysrq)) {
492 handle_sysrq(ch); 506 handle_sysrq(ch);
@@ -495,11 +509,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
495 } 509 }
496 port->sysrq = 0; 510 port->sysrq = 0;
497 } 511 }
498#endif
499 return 0; 512 return 0;
500} 513}
501#ifndef SUPPORT_SYSRQ 514#else
502#define uart_handle_sysrq_char(port,ch) uart_handle_sysrq_char(port, 0) 515#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; })
503#endif 516#endif
504 517
505/* 518/*
@@ -522,89 +535,6 @@ static inline int uart_handle_break(struct uart_port *port)
522 return 0; 535 return 0;
523} 536}
524 537
525/**
526 * uart_handle_dcd_change - handle a change of carrier detect state
527 * @uport: uart_port structure for the open port
528 * @status: new carrier detect status, nonzero if active
529 */
530static inline void
531uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
532{
533 struct uart_state *state = uport->state;
534 struct tty_port *port = &state->port;
535 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
536 struct pps_event_time ts;
537
538 if (ld && ld->ops->dcd_change)
539 pps_get_ts(&ts);
540
541 uport->icount.dcd++;
542#ifdef CONFIG_HARD_PPS
543 if ((uport->flags & UPF_HARDPPS_CD) && status)
544 hardpps();
545#endif
546
547 if (port->flags & ASYNC_CHECK_CD) {
548 if (status)
549 wake_up_interruptible(&port->open_wait);
550 else if (port->tty)
551 tty_hangup(port->tty);
552 }
553
554 if (ld && ld->ops->dcd_change)
555 ld->ops->dcd_change(port->tty, status, &ts);
556 if (ld)
557 tty_ldisc_deref(ld);
558}
559
560/**
561 * uart_handle_cts_change - handle a change of clear-to-send state
562 * @uport: uart_port structure for the open port
563 * @status: new clear to send status, nonzero if active
564 */
565static inline void
566uart_handle_cts_change(struct uart_port *uport, unsigned int status)
567{
568 struct tty_port *port = &uport->state->port;
569 struct tty_struct *tty = port->tty;
570
571 uport->icount.cts++;
572
573 if (port->flags & ASYNC_CTS_FLOW) {
574 if (tty->hw_stopped) {
575 if (status) {
576 tty->hw_stopped = 0;
577 uport->ops->start_tx(uport);
578 uart_write_wakeup(uport);
579 }
580 } else {
581 if (!status) {
582 tty->hw_stopped = 1;
583 uport->ops->stop_tx(uport);
584 }
585 }
586 }
587}
588
589#include <linux/tty_flip.h>
590
591static inline void
592uart_insert_char(struct uart_port *port, unsigned int status,
593 unsigned int overrun, unsigned int ch, unsigned int flag)
594{
595 struct tty_struct *tty = port->state->port.tty;
596
597 if ((status & port->ignore_status_mask & ~overrun) == 0)
598 tty_insert_flip_char(tty, ch, flag);
599
600 /*
601 * Overrun is special. Since it's reported immediately,
602 * it doesn't affect the current character.
603 */
604 if (status & ~port->ignore_status_mask & overrun)
605 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
606}
607
608/* 538/*
609 * UART_ENABLE_MS - determine if port should enable modem status irqs 539 * UART_ENABLE_MS - determine if port should enable modem status irqs
610 */ 540 */
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 369273a52679..78779074f6e8 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -49,6 +49,10 @@ enum {
49 49
50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) 50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
51 51
52/* SCSPTR, optional */
53#define SCSPTR_RTSIO (1 << 7)
54#define SCSPTR_CTSIO (1 << 5)
55
52/* Offsets into the sci_port->irqs array */ 56/* Offsets into the sci_port->irqs array */
53enum { 57enum {
54 SCIx_ERI_IRQ, 58 SCIx_ERI_IRQ,
@@ -60,6 +64,17 @@ enum {
60 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ 64 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */
61}; 65};
62 66
67/* Offsets into the sci_port->gpios array */
68enum {
69 SCIx_SCK,
70 SCIx_RXD,
71 SCIx_TXD,
72 SCIx_CTS,
73 SCIx_RTS,
74
75 SCIx_NR_FNS,
76};
77
63enum { 78enum {
64 SCIx_PROBE_REGTYPE, 79 SCIx_PROBE_REGTYPE,
65 80
@@ -109,13 +124,20 @@ struct plat_sci_port_ops {
109}; 124};
110 125
111/* 126/*
127 * Port-specific capabilities
128 */
129#define SCIx_HAVE_RTSCTS (1 << 0)
130
131/*
112 * Platform device specific platform_data struct 132 * Platform device specific platform_data struct
113 */ 133 */
114struct plat_sci_port { 134struct plat_sci_port {
115 unsigned long mapbase; /* resource base */ 135 unsigned long mapbase; /* resource base */
116 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 136 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
137 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */
117 unsigned int type; /* SCI / SCIF / IRDA */ 138 unsigned int type; /* SCI / SCIF / IRDA */
118 upf_t flags; /* UPF_* flags */ 139 upf_t flags; /* UPF_* flags */
140 unsigned long capabilities; /* Port features/capabilities */
119 141
120 unsigned int scbrr_algo_id; /* SCBRR calculation algo */ 142 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
121 unsigned int scscr; /* SCSCR initialization */ 143 unsigned int scscr; /* SCSCR initialization */
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index a20831cf336a..54341d811685 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -49,6 +49,7 @@ struct clk {
49 49
50 void __iomem *enable_reg; 50 void __iomem *enable_reg;
51 unsigned int enable_bit; 51 unsigned int enable_bit;
52 void __iomem *mapped_reg;
52 53
53 unsigned long arch_flags; 54 unsigned long arch_flags;
54 void *priv; 55 void *priv;
@@ -131,10 +132,9 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
131int sh_clk_div4_reparent_register(struct clk *clks, int nr, 132int sh_clk_div4_reparent_register(struct clk *clks, int nr,
132 struct clk_div4_table *table); 133 struct clk_div4_table *table);
133 134
134#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \ 135#define SH_CLK_DIV6_EXT(_reg, _flags, _parents, \
135 _num_parents, _src_shift, _src_width) \ 136 _num_parents, _src_shift, _src_width) \
136{ \ 137{ \
137 .parent = _parent, \
138 .enable_reg = (void __iomem *)_reg, \ 138 .enable_reg = (void __iomem *)_reg, \
139 .flags = _flags, \ 139 .flags = _flags, \
140 .parent_table = _parents, \ 140 .parent_table = _parents, \
@@ -144,7 +144,11 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
144} 144}
145 145
146#define SH_CLK_DIV6(_parent, _reg, _flags) \ 146#define SH_CLK_DIV6(_parent, _reg, _flags) \
147 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0) 147{ \
148 .parent = _parent, \
149 .enable_reg = (void __iomem *)_reg, \
150 .flags = _flags, \
151}
148 152
149int sh_clk_div6_register(struct clk *clks, int nr); 153int sh_clk_div6_register(struct clk *clks, int nr);
150int sh_clk_div6_reparent_register(struct clk *clks, int nr); 154int sh_clk_div6_reparent_register(struct clk *clks, int nr);
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 5812fefbcedf..b160645f5599 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -95,6 +95,7 @@ struct intc_desc {
95 unsigned int num_resources; 95 unsigned int num_resources;
96 intc_enum force_enable; 96 intc_enum force_enable;
97 intc_enum force_disable; 97 intc_enum force_disable;
98 bool skip_syscore_suspend;
98 struct intc_hw_desc hw; 99 struct intc_hw_desc hw;
99}; 100};
100 101
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index 8446789216e5..5c15aed9c4b2 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -45,16 +45,24 @@ struct pinmux_cfg_reg {
45 unsigned long reg, reg_width, field_width; 45 unsigned long reg, reg_width, field_width;
46 unsigned long *cnt; 46 unsigned long *cnt;
47 pinmux_enum_t *enum_ids; 47 pinmux_enum_t *enum_ids;
48 unsigned long *var_field_width;
48}; 49};
49 50
50#define PINMUX_CFG_REG(name, r, r_width, f_width) \ 51#define PINMUX_CFG_REG(name, r, r_width, f_width) \
51 .reg = r, .reg_width = r_width, .field_width = f_width, \ 52 .reg = r, .reg_width = r_width, .field_width = f_width, \
52 .cnt = (unsigned long [r_width / f_width]) {}, \ 53 .cnt = (unsigned long [r_width / f_width]) {}, \
53 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ 54 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
55
56#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
57 .reg = r, .reg_width = r_width, \
58 .cnt = (unsigned long [r_width]) {}, \
59 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
60 .enum_ids = (pinmux_enum_t [])
54 61
55struct pinmux_data_reg { 62struct pinmux_data_reg {
56 unsigned long reg, reg_width, reg_shadow; 63 unsigned long reg, reg_width, reg_shadow;
57 pinmux_enum_t *enum_ids; 64 pinmux_enum_t *enum_ids;
65 void __iomem *mapped_reg;
58}; 66};
59 67
60#define PINMUX_DATA_REG(name, r, r_width) \ 68#define PINMUX_DATA_REG(name, r, r_width) \
@@ -75,6 +83,12 @@ struct pinmux_range {
75 pinmux_enum_t force; 83 pinmux_enum_t force;
76}; 84};
77 85
86struct pfc_window {
87 phys_addr_t phys;
88 void __iomem *virt;
89 unsigned long size;
90};
91
78struct pinmux_info { 92struct pinmux_info {
79 char *name; 93 char *name;
80 pinmux_enum_t reserved_id; 94 pinmux_enum_t reserved_id;
@@ -98,6 +112,12 @@ struct pinmux_info {
98 struct pinmux_irq *gpio_irq; 112 struct pinmux_irq *gpio_irq;
99 unsigned int gpio_irq_size; 113 unsigned int gpio_irq_size;
100 114
115 struct resource *resource;
116 unsigned int num_resources;
117 struct pfc_window *window;
118
119 unsigned long unlock_reg;
120
101 struct gpio_chip chip; 121 struct gpio_chip chip;
102}; 122};
103 123
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9291ac3cc627..e4c711c6f321 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -30,7 +30,7 @@ struct shmem_sb_info {
30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
31 uid_t uid; /* Mount uid for root directory */ 31 uid_t uid; /* Mount uid for root directory */
32 gid_t gid; /* Mount gid for root directory */ 32 gid_t gid; /* Mount gid for root directory */
33 mode_t mode; /* Mount mode for root directory */ 33 umode_t mode; /* Mount mode for root directory */
34 struct mempolicy *mpol; /* default memory policy for mappings */ 34 struct mempolicy *mpol; /* default memory policy for mappings */
35}; 35};
36 36
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
deleted file mode 100644
index d0de882c0d96..000000000000
--- a/include/linux/sigma.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/firmware.h>
13#include <linux/types.h>
14
15struct i2c_client;
16
17#define SIGMA_MAGIC "ADISIGM"
18
19struct sigma_firmware {
20 const struct firmware *fw;
21 size_t pos;
22};
23
24struct sigma_firmware_header {
25 unsigned char magic[7];
26 u8 version;
27 __le32 crc;
28};
29
30enum {
31 SIGMA_ACTION_WRITEXBYTES = 0,
32 SIGMA_ACTION_WRITESINGLE,
33 SIGMA_ACTION_WRITESAFELOAD,
34 SIGMA_ACTION_DELAY,
35 SIGMA_ACTION_PLLWAIT,
36 SIGMA_ACTION_NOOP,
37 SIGMA_ACTION_END,
38};
39
40struct sigma_action {
41 u8 instr;
42 u8 len_hi;
43 __le16 len;
44 __be16 addr;
45 unsigned char payload[];
46};
47
48static inline u32 sigma_action_len(struct sigma_action *sa)
49{
50 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
51}
52
53extern int process_sigma_firmware(struct i2c_client *client, const char *name);
54
55#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index a822300a253b..7987ce74874b 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -254,6 +254,7 @@ extern void set_current_blocked(const sigset_t *);
254extern int show_unhandled_signals; 254extern int show_unhandled_signals;
255 255
256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
257extern void block_sigmask(struct k_sigaction *ka, int signr);
257extern void exit_signals(struct task_struct *tsk); 258extern void exit_signals(struct task_struct *tsk);
258 259
259extern struct kmem_cache *sighand_cachep; 260extern struct kmem_cache *sighand_cachep;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fe864885c1ed..50db9b04a552 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -30,6 +30,7 @@
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/netdev_features.h>
33 34
34/* Don't change this without changing skb_csum_unnecessary! */ 35/* Don't change this without changing skb_csum_unnecessary! */
35#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
@@ -87,7 +88,6 @@
87 * at device setup time. 88 * at device setup time.
88 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum 89 * NETIF_F_HW_CSUM - it is clever device, it is able to checksum
89 * everything. 90 * everything.
90 * NETIF_F_NO_CSUM - loopback or reliable single hop media.
91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only 91 * NETIF_F_IP_CSUM - device is dumb. It is able to csum only
92 * TCP/UDP over IPv4. Sigh. Vendors like this 92 * TCP/UDP over IPv4. Sigh. Vendors like this
93 * way by an unknown reason. Though, see comment above 93 * way by an unknown reason. Though, see comment above
@@ -128,13 +128,17 @@ struct sk_buff_head {
128 128
129struct sk_buff; 129struct sk_buff;
130 130
131/* To allow 64K frame to be packed as single skb without frag_list. Since 131/* To allow 64K frame to be packed as single skb without frag_list we
132 * GRO uses frags we allocate at least 16 regardless of page size. 132 * require 64K/PAGE_SIZE pages plus 1 additional page to allow for
133 * buffers which do not start on a page boundary.
134 *
135 * Since GRO uses frags we allocate at least 16 regardless of page
136 * size.
133 */ 137 */
134#if (65536/PAGE_SIZE + 2) < 16 138#if (65536/PAGE_SIZE + 1) < 16
135#define MAX_SKB_FRAGS 16UL 139#define MAX_SKB_FRAGS 16UL
136#else 140#else
137#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) 141#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
138#endif 142#endif
139 143
140typedef struct skb_frag_struct skb_frag_t; 144typedef struct skb_frag_struct skb_frag_t;
@@ -218,6 +222,9 @@ enum {
218 222
219 /* device driver supports TX zero-copy buffers */ 223 /* device driver supports TX zero-copy buffers */
220 SKBTX_DEV_ZEROCOPY = 1 << 4, 224 SKBTX_DEV_ZEROCOPY = 1 << 4,
225
226 /* generate wifi status information (where possible) */
227 SKBTX_WIFI_STATUS = 1 << 5,
221}; 228};
222 229
223/* 230/*
@@ -235,15 +242,15 @@ struct ubuf_info {
235 * the end of the header data, ie. at skb->end. 242 * the end of the header data, ie. at skb->end.
236 */ 243 */
237struct skb_shared_info { 244struct skb_shared_info {
238 unsigned short nr_frags; 245 unsigned char nr_frags;
246 __u8 tx_flags;
239 unsigned short gso_size; 247 unsigned short gso_size;
240 /* Warning: this field is not always filled in (UFO)! */ 248 /* Warning: this field is not always filled in (UFO)! */
241 unsigned short gso_segs; 249 unsigned short gso_segs;
242 unsigned short gso_type; 250 unsigned short gso_type;
243 __be32 ip6_frag_id;
244 __u8 tx_flags;
245 struct sk_buff *frag_list; 251 struct sk_buff *frag_list;
246 struct skb_shared_hwtstamps hwtstamps; 252 struct skb_shared_hwtstamps hwtstamps;
253 __be32 ip6_frag_id;
247 254
248 /* 255 /*
249 * Warning : all fields before dataref are cleared in __alloc_skb() 256 * Warning : all fields before dataref are cleared in __alloc_skb()
@@ -352,6 +359,8 @@ typedef unsigned char *sk_buff_data_t;
352 * @ooo_okay: allow the mapping of a socket to a queue to be changed 359 * @ooo_okay: allow the mapping of a socket to a queue to be changed
353 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 360 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport
354 * ports. 361 * ports.
362 * @wifi_acked_valid: wifi_acked was set
363 * @wifi_acked: whether frame was acked on wifi or not
355 * @dma_cookie: a cookie to one of several possible DMA operations 364 * @dma_cookie: a cookie to one of several possible DMA operations
356 * done by skb DMA functions 365 * done by skb DMA functions
357 * @secmark: security marking 366 * @secmark: security marking
@@ -445,10 +454,11 @@ struct sk_buff {
445#endif 454#endif
446 __u8 ooo_okay:1; 455 __u8 ooo_okay:1;
447 __u8 l4_rxhash:1; 456 __u8 l4_rxhash:1;
457 __u8 wifi_acked_valid:1;
458 __u8 wifi_acked:1;
459 /* 10/12 bit hole (depending on ndisc_nodetype presence) */
448 kmemcheck_bitfield_end(flags2); 460 kmemcheck_bitfield_end(flags2);
449 461
450 /* 0/13 bit hole */
451
452#ifdef CONFIG_NET_DMA 462#ifdef CONFIG_NET_DMA
453 dma_cookie_t dma_cookie; 463 dma_cookie_t dma_cookie;
454#endif 464#endif
@@ -540,6 +550,7 @@ extern void consume_skb(struct sk_buff *skb);
540extern void __kfree_skb(struct sk_buff *skb); 550extern void __kfree_skb(struct sk_buff *skb);
541extern struct sk_buff *__alloc_skb(unsigned int size, 551extern struct sk_buff *__alloc_skb(unsigned int size,
542 gfp_t priority, int fclone, int node); 552 gfp_t priority, int fclone, int node);
553extern struct sk_buff *build_skb(void *data);
543static inline struct sk_buff *alloc_skb(unsigned int size, 554static inline struct sk_buff *alloc_skb(unsigned int size,
544 gfp_t priority) 555 gfp_t priority)
545{ 556{
@@ -561,8 +572,9 @@ extern struct sk_buff *skb_clone(struct sk_buff *skb,
561 gfp_t priority); 572 gfp_t priority);
562extern struct sk_buff *skb_copy(const struct sk_buff *skb, 573extern struct sk_buff *skb_copy(const struct sk_buff *skb,
563 gfp_t priority); 574 gfp_t priority);
564extern struct sk_buff *pskb_copy(struct sk_buff *skb, 575extern struct sk_buff *__pskb_copy(struct sk_buff *skb,
565 gfp_t gfp_mask); 576 int headroom, gfp_t gfp_mask);
577
566extern int pskb_expand_head(struct sk_buff *skb, 578extern int pskb_expand_head(struct sk_buff *skb,
567 int nhead, int ntail, 579 int nhead, int ntail,
568 gfp_t gfp_mask); 580 gfp_t gfp_mask);
@@ -1662,38 +1674,6 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1662} 1674}
1663 1675
1664/** 1676/**
1665 * __netdev_alloc_page - allocate a page for ps-rx on a specific device
1666 * @dev: network device to receive on
1667 * @gfp_mask: alloc_pages_node mask
1668 *
1669 * Allocate a new page. dev currently unused.
1670 *
1671 * %NULL is returned if there is no free memory.
1672 */
1673static inline struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask)
1674{
1675 return alloc_pages_node(NUMA_NO_NODE, gfp_mask, 0);
1676}
1677
1678/**
1679 * netdev_alloc_page - allocate a page for ps-rx on a specific device
1680 * @dev: network device to receive on
1681 *
1682 * Allocate a new page. dev currently unused.
1683 *
1684 * %NULL is returned if there is no free memory.
1685 */
1686static inline struct page *netdev_alloc_page(struct net_device *dev)
1687{
1688 return __netdev_alloc_page(dev, GFP_ATOMIC);
1689}
1690
1691static inline void netdev_free_page(struct net_device *dev, struct page *page)
1692{
1693 __free_page(page);
1694}
1695
1696/**
1697 * skb_frag_page - retrieve the page refered to by a paged fragment 1677 * skb_frag_page - retrieve the page refered to by a paged fragment
1698 * @frag: the paged fragment 1678 * @frag: the paged fragment
1699 * 1679 *
@@ -1824,6 +1804,12 @@ static inline dma_addr_t skb_frag_dma_map(struct device *dev,
1824 frag->page_offset + offset, size, dir); 1804 frag->page_offset + offset, size, dir);
1825} 1805}
1826 1806
1807static inline struct sk_buff *pskb_copy(struct sk_buff *skb,
1808 gfp_t gfp_mask)
1809{
1810 return __pskb_copy(skb, skb_headroom(skb), gfp_mask);
1811}
1812
1827/** 1813/**
1828 * skb_clone_writable - is the header of a clone writable 1814 * skb_clone_writable - is the header of a clone writable
1829 * @skb: buffer to check 1815 * @skb: buffer to check
@@ -2105,7 +2091,8 @@ extern void skb_split(struct sk_buff *skb,
2105extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2091extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2106 int shiftlen); 2092 int shiftlen);
2107 2093
2108extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features); 2094extern struct sk_buff *skb_segment(struct sk_buff *skb,
2095 netdev_features_t features);
2109 2096
2110static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2097static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2111 int len, void *buffer) 2098 int len, void *buffer)
@@ -2263,6 +2250,15 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
2263 sw_tx_timestamp(skb); 2250 sw_tx_timestamp(skb);
2264} 2251}
2265 2252
2253/**
2254 * skb_complete_wifi_ack - deliver skb with wifi status
2255 *
2256 * @skb: the original outgoing packet
2257 * @acked: ack status
2258 *
2259 */
2260void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2261
2266extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2262extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2267extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2263extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
2268 2264
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index d00e0bacda93..fbd1117fdfde 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -15,8 +15,6 @@
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17 17
18#include <trace/events/kmem.h>
19
20/* 18/*
21 * struct kmem_cache 19 * struct kmem_cache
22 * 20 *
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
new file mode 100644
index 000000000000..ce718cbce435
--- /dev/null
+++ b/include/linux/smscphy.h
@@ -0,0 +1,25 @@
1#ifndef __LINUX_SMSCPHY_H__
2#define __LINUX_SMSCPHY_H__
3
4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
5#define MII_LAN83C185_IM 30 /* Interrupt Mask */
6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
7
8#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_INT3 (1<<3) /* Auto-Negotiation LP Ack */
11#define MII_LAN83C185_ISF_INT4 (1<<4) /* Link Down */
12#define MII_LAN83C185_ISF_INT5 (1<<5) /* Remote Fault Detected */
13#define MII_LAN83C185_ISF_INT6 (1<<6) /* Auto-Negotiation complete */
14#define MII_LAN83C185_ISF_INT7 (1<<7) /* ENERGYON */
15
16#define MII_LAN83C185_ISF_INT_ALL (0x0e)
17
18#define MII_LAN83C185_ISF_INT_PHYLIB_EVENTS \
19 (MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4 | \
20 MII_LAN83C185_ISF_INT7)
21
22#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
23#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */
24
25#endif /* __LINUX_SMSCPHY_H__ */
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
new file mode 100644
index 000000000000..251729a47880
--- /dev/null
+++ b/include/linux/sock_diag.h
@@ -0,0 +1,48 @@
1#ifndef __SOCK_DIAG_H__
2#define __SOCK_DIAG_H__
3
4#include <linux/types.h>
5
6#define SOCK_DIAG_BY_FAMILY 20
7
8struct sock_diag_req {
9 __u8 sdiag_family;
10 __u8 sdiag_protocol;
11};
12
13enum {
14 SK_MEMINFO_RMEM_ALLOC,
15 SK_MEMINFO_RCVBUF,
16 SK_MEMINFO_WMEM_ALLOC,
17 SK_MEMINFO_SNDBUF,
18 SK_MEMINFO_FWD_ALLOC,
19 SK_MEMINFO_WMEM_QUEUED,
20 SK_MEMINFO_OPTMEM,
21
22 SK_MEMINFO_VARS,
23};
24
25#ifdef __KERNEL__
26struct sk_buff;
27struct nlmsghdr;
28struct sock;
29
30struct sock_diag_handler {
31 __u8 family;
32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
33};
34
35int sock_diag_register(struct sock_diag_handler *h);
36void sock_diag_unregister(struct sock_diag_handler *h);
37
38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
40
41int sock_diag_check_cookie(void *sk, __u32 *cookie);
42void sock_diag_save_cookie(void *sk, __u32 *cookie);
43
44int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
45
46extern struct sock *sock_diag_nlsk;
47#endif /* KERNEL */
48#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index bb4f5fbbbd8e..176fce9cc6b1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -200,6 +200,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
200 driver_unregister(&sdrv->driver); 200 driver_unregister(&sdrv->driver);
201} 201}
202 202
203/**
204 * module_spi_driver() - Helper macro for registering a SPI driver
205 * @__spi_driver: spi_driver struct
206 *
207 * Helper macro for SPI drivers which do not do anything special in module
208 * init/exit. This eliminates a lot of boilerplate. Each module may only
209 * use this macro once, and calling it replaces module_init() and module_exit()
210 */
211#define module_spi_driver(__spi_driver) \
212 module_driver(__spi_driver, spi_register_driver, \
213 spi_unregister_driver)
203 214
204/** 215/**
205 * struct spi_master - interface to SPI master controller 216 * struct spi_master - interface to SPI master controller
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 58971e891f48..e1b005918bbb 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -28,6 +28,7 @@
28#define _LINUX_SRCU_H 28#define _LINUX_SRCU_H
29 29
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/rcupdate.h>
31 32
32struct srcu_struct_array { 33struct srcu_struct_array {
33 int c[2]; 34 int c[2];
@@ -60,18 +61,10 @@ int __init_srcu_struct(struct srcu_struct *sp, const char *name,
60 __init_srcu_struct((sp), #sp, &__srcu_key); \ 61 __init_srcu_struct((sp), #sp, &__srcu_key); \
61}) 62})
62 63
63# define srcu_read_acquire(sp) \
64 lock_acquire(&(sp)->dep_map, 0, 0, 2, 1, NULL, _THIS_IP_)
65# define srcu_read_release(sp) \
66 lock_release(&(sp)->dep_map, 1, _THIS_IP_)
67
68#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 64#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
69 65
70int init_srcu_struct(struct srcu_struct *sp); 66int init_srcu_struct(struct srcu_struct *sp);
71 67
72# define srcu_read_acquire(sp) do { } while (0)
73# define srcu_read_release(sp) do { } while (0)
74
75#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 68#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
76 69
77void cleanup_srcu_struct(struct srcu_struct *sp); 70void cleanup_srcu_struct(struct srcu_struct *sp);
@@ -90,12 +83,32 @@ long srcu_batches_completed(struct srcu_struct *sp);
90 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC, 83 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
91 * this assumes we are in an SRCU read-side critical section unless it can 84 * this assumes we are in an SRCU read-side critical section unless it can
92 * prove otherwise. 85 * prove otherwise.
86 *
87 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
88 * and while lockdep is disabled.
89 *
90 * Note that if the CPU is in the idle loop from an RCU point of view
91 * (ie: that we are in the section between rcu_idle_enter() and
92 * rcu_idle_exit()) then srcu_read_lock_held() returns false even if
93 * the CPU did an srcu_read_lock(). The reason for this is that RCU
94 * ignores CPUs that are in such a section, considering these as in
95 * extended quiescent state, so such a CPU is effectively never in an
96 * RCU read-side critical section regardless of what RCU primitives it
97 * invokes. This state of affairs is required --- we need to keep an
98 * RCU-free window in idle where the CPU may possibly enter into low
99 * power mode. This way we can notice an extended quiescent state to
100 * other CPUs that started a grace period. Otherwise we would delay any
101 * grace period as long as we run in the idle task.
93 */ 102 */
94static inline int srcu_read_lock_held(struct srcu_struct *sp) 103static inline int srcu_read_lock_held(struct srcu_struct *sp)
95{ 104{
96 if (debug_locks) 105 if (rcu_is_cpu_idle())
97 return lock_is_held(&sp->dep_map); 106 return 0;
98 return 1; 107
108 if (!debug_lockdep_rcu_enabled())
109 return 1;
110
111 return lock_is_held(&sp->dep_map);
99} 112}
100 113
101#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 114#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
@@ -145,12 +158,17 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
145 * one way to indirectly wait on an SRCU grace period is to acquire 158 * one way to indirectly wait on an SRCU grace period is to acquire
146 * a mutex that is held elsewhere while calling synchronize_srcu() or 159 * a mutex that is held elsewhere while calling synchronize_srcu() or
147 * synchronize_srcu_expedited(). 160 * synchronize_srcu_expedited().
161 *
162 * Note that srcu_read_lock() and the matching srcu_read_unlock() must
163 * occur in the same context, for example, it is illegal to invoke
164 * srcu_read_unlock() in an irq handler if the matching srcu_read_lock()
165 * was invoked in process context.
148 */ 166 */
149static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) 167static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
150{ 168{
151 int retval = __srcu_read_lock(sp); 169 int retval = __srcu_read_lock(sp);
152 170
153 srcu_read_acquire(sp); 171 rcu_lock_acquire(&(sp)->dep_map);
154 return retval; 172 return retval;
155} 173}
156 174
@@ -164,8 +182,51 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
164static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 182static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
165 __releases(sp) 183 __releases(sp)
166{ 184{
167 srcu_read_release(sp); 185 rcu_lock_release(&(sp)->dep_map);
186 __srcu_read_unlock(sp, idx);
187}
188
189/**
190 * srcu_read_lock_raw - register a new reader for an SRCU-protected structure.
191 * @sp: srcu_struct in which to register the new reader.
192 *
193 * Enter an SRCU read-side critical section. Similar to srcu_read_lock(),
194 * but avoids the RCU-lockdep checking. This means that it is legal to
195 * use srcu_read_lock_raw() in one context, for example, in an exception
196 * handler, and then have the matching srcu_read_unlock_raw() in another
197 * context, for example in the task that took the exception.
198 *
199 * However, the entire SRCU read-side critical section must reside within a
200 * single task. For example, beware of using srcu_read_lock_raw() in
201 * a device interrupt handler and srcu_read_unlock() in the interrupted
202 * task: This will not work if interrupts are threaded.
203 */
204static inline int srcu_read_lock_raw(struct srcu_struct *sp)
205{
206 unsigned long flags;
207 int ret;
208
209 local_irq_save(flags);
210 ret = __srcu_read_lock(sp);
211 local_irq_restore(flags);
212 return ret;
213}
214
215/**
216 * srcu_read_unlock_raw - unregister reader from an SRCU-protected structure.
217 * @sp: srcu_struct in which to unregister the old reader.
218 * @idx: return value from corresponding srcu_read_lock_raw().
219 *
220 * Exit an SRCU read-side critical section without lockdep-RCU checking.
221 * See srcu_read_lock_raw() for more details.
222 */
223static inline void srcu_read_unlock_raw(struct srcu_struct *sp, int idx)
224{
225 unsigned long flags;
226
227 local_irq_save(flags);
168 __srcu_read_unlock(sp, idx); 228 __srcu_read_unlock(sp, idx);
229 local_irq_restore(flags);
169} 230}
170 231
171#endif 232#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 061e560251b4..dcf35b0f303a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -94,6 +94,15 @@ struct ssb_sprom {
94 } ghz5; /* 5GHz band */ 94 } ghz5; /* 5GHz band */
95 } antenna_gain; 95 } antenna_gain;
96 96
97 struct {
98 struct {
99 u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
100 } ghz2;
101 struct {
102 u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
103 } ghz5;
104 } fem;
105
97 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ 106 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
98}; 107};
99 108
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 98941203a27f..c814ae6eeb22 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -432,6 +432,23 @@
432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
434#define SSB_SPROM8_RXPO5G_SHIFT 8 434#define SSB_SPROM8_RXPO5G_SHIFT 8
435#define SSB_SPROM8_FEM2G 0x00AE
436#define SSB_SPROM8_FEM5G 0x00B0
437#define SSB_SROM8_FEM_TSSIPOS 0x0001
438#define SSB_SROM8_FEM_TSSIPOS_SHIFT 0
439#define SSB_SROM8_FEM_EXTPA_GAIN 0x0006
440#define SSB_SROM8_FEM_EXTPA_GAIN_SHIFT 1
441#define SSB_SROM8_FEM_PDET_RANGE 0x00F8
442#define SSB_SROM8_FEM_PDET_RANGE_SHIFT 3
443#define SSB_SROM8_FEM_TR_ISO 0x0700
444#define SSB_SROM8_FEM_TR_ISO_SHIFT 8
445#define SSB_SROM8_FEM_ANTSWLUT 0xF800
446#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
447#define SSB_SPROM8_THERMAL 0x00B2
448#define SSB_SPROM8_MPWR_RAWTS 0x00B4
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA
435#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ 452#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
436#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 453#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
437#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 454#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index febc4dbec2ca..7874a8a56638 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -26,6 +26,7 @@ struct auth_cred {
26 uid_t uid; 26 uid_t uid;
27 gid_t gid; 27 gid_t gid;
28 struct group_info *group_info; 28 struct group_info *group_info;
29 const char *principal;
29 unsigned char machine_cred : 1; 30 unsigned char machine_cred : 1;
30}; 31};
31 32
@@ -127,7 +128,7 @@ void rpc_destroy_generic_auth(void);
127void rpc_destroy_authunix(void); 128void rpc_destroy_authunix(void);
128 129
129struct rpc_cred * rpc_lookup_cred(void); 130struct rpc_cred * rpc_lookup_cred(void);
130struct rpc_cred * rpc_lookup_machine_cred(void); 131struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
131int rpcauth_register(const struct rpc_authops *); 132int rpcauth_register(const struct rpc_authops *);
132int rpcauth_unregister(const struct rpc_authops *); 133int rpcauth_unregister(const struct rpc_authops *);
133struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 134struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 8eee9dbbfe7a..f1cfd4c85cd0 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -82,8 +82,8 @@ struct gss_cred {
82 enum rpc_gss_svc gc_service; 82 enum rpc_gss_svc gc_service;
83 struct gss_cl_ctx __rcu *gc_ctx; 83 struct gss_cl_ctx __rcu *gc_ctx;
84 struct gss_upcall_msg *gc_upcall; 84 struct gss_upcall_msg *gc_upcall;
85 const char *gc_principal;
85 unsigned long gc_upcall_timestamp; 86 unsigned long gc_upcall_timestamp;
86 unsigned char gc_machine_cred : 1;
87}; 87};
88 88
89#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5efd8cef389e..57531f8e5956 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -203,7 +203,7 @@ extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net); 203extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
204 204
205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
206 mode_t, struct cache_detail *); 206 umode_t, struct cache_detail *);
207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); 207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
208 208
209extern void qword_add(char **bpp, int *lp, char *str); 209extern void qword_add(char **bpp, int *lp, char *str);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 3d8f9c44e27d..2c5993a17c33 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -215,7 +215,7 @@ static inline bool __rpc_copy_addr4(struct sockaddr *dst,
215 return true; 215 return true;
216} 216}
217 217
218#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 218#if IS_ENABLED(CONFIG_IPV6)
219static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1, 219static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
220 const struct sockaddr *sap2) 220 const struct sockaddr *sap2)
221{ 221{
@@ -237,10 +237,10 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
237 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst; 237 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
238 238
239 dsin6->sin6_family = ssin6->sin6_family; 239 dsin6->sin6_family = ssin6->sin6_family;
240 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr); 240 dsin6->sin6_addr = ssin6->sin6_addr;
241 return true; 241 return true;
242} 242}
243#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */ 243#else /* !(IS_ENABLED(CONFIG_IPV6) */
244static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1, 244static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
245 const struct sockaddr *sap2) 245 const struct sockaddr *sap2)
246{ 246{
@@ -252,7 +252,7 @@ static inline bool __rpc_copy_addr6(struct sockaddr *dst,
252{ 252{
253 return false; 253 return false;
254} 254}
255#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */ 255#endif /* !(IS_ENABLED(CONFIG_IPV6) */
256 256
257/** 257/**
258 * rpc_cmp_addr - compare the address portion of two sockaddrs. 258 * rpc_cmp_addr - compare the address portion of two sockaddrs.
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index e4ea43058d8f..2bb03d77375a 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -55,7 +55,7 @@ extern int rpc_remove_client_dir(struct dentry *);
55struct cache_detail; 55struct cache_detail;
56extern struct dentry *rpc_create_cache_dir(struct dentry *, 56extern struct dentry *rpc_create_cache_dir(struct dentry *,
57 struct qstr *, 57 struct qstr *,
58 mode_t umode, 58 umode_t umode,
59 struct cache_detail *); 59 struct cache_detail *);
60extern void rpc_remove_cache_dir(struct dentry *); 60extern void rpc_remove_cache_dir(struct dentry *);
61 61
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 8620f79658d4..dfa900948af7 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -109,7 +109,7 @@ static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u
109 109
110int svc_reg_xprt_class(struct svc_xprt_class *); 110int svc_reg_xprt_class(struct svc_xprt_class *);
111void svc_unreg_xprt_class(struct svc_xprt_class *); 111void svc_unreg_xprt_class(struct svc_xprt_class *);
112void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 112void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
113 struct svc_serv *); 113 struct svc_serv *);
114int svc_create_xprt(struct svc_serv *, const char *, struct net *, 114int svc_create_xprt(struct svc_serv *, const char *, struct net *,
115 const int, const unsigned short, int); 115 const int, const unsigned short, int);
@@ -118,7 +118,6 @@ void svc_xprt_received(struct svc_xprt *);
118void svc_xprt_put(struct svc_xprt *xprt); 118void svc_xprt_put(struct svc_xprt *xprt);
119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt); 119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
120void svc_close_xprt(struct svc_xprt *xprt); 120void svc_close_xprt(struct svc_xprt *xprt);
121void svc_delete_xprt(struct svc_xprt *xprt);
122int svc_port_is_privileged(struct sockaddr *sin); 121int svc_port_is_privileged(struct sockaddr *sin);
123int svc_print_xprts(char *buf, int maxlen); 122int svc_print_xprts(char *buf, int maxlen);
124struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, 123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 85c50b40759d..c84e9741cb2a 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -34,7 +34,7 @@ struct svc_sock {
34/* 34/*
35 * Function prototypes. 35 * Function prototypes.
36 */ 36 */
37void svc_close_all(struct list_head *); 37void svc_close_all(struct svc_serv *);
38int svc_recv(struct svc_rqst *, long); 38int svc_recv(struct svc_rqst *, long);
39int svc_send(struct svc_rqst *); 39int svc_send(struct svc_rqst *);
40void svc_drop(struct svc_rqst *); 40void svc_drop(struct svc_rqst *);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index a20970ef9e4e..af70af333546 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -191,6 +191,8 @@ extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
191 struct xdr_array2_desc *desc); 191 struct xdr_array2_desc *desc);
192extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, 192extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
193 struct xdr_array2_desc *desc); 193 struct xdr_array2_desc *desc);
194extern void _copy_from_pages(char *p, struct page **pages, size_t pgbase,
195 size_t len);
194 196
195/* 197/*
196 * Provide some simple tools for XDR buffer overflow-checking etc. 198 * Provide some simple tools for XDR buffer overflow-checking etc.
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 57a692432f8a..95040cc33107 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -6,6 +6,7 @@
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/freezer.h>
9#include <asm/errno.h> 10#include <asm/errno.h>
10 11
11#ifdef CONFIG_VT 12#ifdef CONFIG_VT
@@ -331,6 +332,8 @@ static inline bool system_entering_hibernation(void) { return false; }
331#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ 332#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
332#define PM_POST_RESTORE 0x0006 /* Restore failed */ 333#define PM_POST_RESTORE 0x0006 /* Restore failed */
333 334
335extern struct mutex pm_mutex;
336
334#ifdef CONFIG_PM_SLEEP 337#ifdef CONFIG_PM_SLEEP
335void save_processor_state(void); 338void save_processor_state(void);
336void restore_processor_state(void); 339void restore_processor_state(void);
@@ -351,6 +354,19 @@ extern bool events_check_enabled;
351extern bool pm_wakeup_pending(void); 354extern bool pm_wakeup_pending(void);
352extern bool pm_get_wakeup_count(unsigned int *count); 355extern bool pm_get_wakeup_count(unsigned int *count);
353extern bool pm_save_wakeup_count(unsigned int count); 356extern bool pm_save_wakeup_count(unsigned int count);
357
358static inline void lock_system_sleep(void)
359{
360 freezer_do_not_count();
361 mutex_lock(&pm_mutex);
362}
363
364static inline void unlock_system_sleep(void)
365{
366 mutex_unlock(&pm_mutex);
367 freezer_count();
368}
369
354#else /* !CONFIG_PM_SLEEP */ 370#else /* !CONFIG_PM_SLEEP */
355 371
356static inline int register_pm_notifier(struct notifier_block *nb) 372static inline int register_pm_notifier(struct notifier_block *nb)
@@ -366,28 +382,11 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
366#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 382#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
367 383
368static inline bool pm_wakeup_pending(void) { return false; } 384static inline bool pm_wakeup_pending(void) { return false; }
369#endif /* !CONFIG_PM_SLEEP */
370
371extern struct mutex pm_mutex;
372 385
373#ifndef CONFIG_HIBERNATE_CALLBACKS
374static inline void lock_system_sleep(void) {} 386static inline void lock_system_sleep(void) {}
375static inline void unlock_system_sleep(void) {} 387static inline void unlock_system_sleep(void) {}
376 388
377#else 389#endif /* !CONFIG_PM_SLEEP */
378
379/* Let some subsystems like memory hotadd exclude hibernation */
380
381static inline void lock_system_sleep(void)
382{
383 mutex_lock(&pm_mutex);
384}
385
386static inline void unlock_system_sleep(void)
387{
388 mutex_unlock(&pm_mutex);
389}
390#endif
391 390
392#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS 391#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
393/* 392/*
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1e22e126d2ac..06061a7f8e69 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -207,6 +207,7 @@ struct swap_list_t {
207/* linux/mm/page_alloc.c */ 207/* linux/mm/page_alloc.c */
208extern unsigned long totalram_pages; 208extern unsigned long totalram_pages;
209extern unsigned long totalreserve_pages; 209extern unsigned long totalreserve_pages;
210extern unsigned long dirty_balance_reserve;
210extern unsigned int nr_free_buffer_pages(void); 211extern unsigned int nr_free_buffer_pages(void);
211extern unsigned int nr_free_pagecache_pages(void); 212extern unsigned int nr_free_pagecache_pages(void);
212 213
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 445702c60d04..e872526fdc5f 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -24,7 +24,7 @@ extern int swiotlb_force;
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swioltb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28 28
29/* 29/*
30 * Enumeration for sync targets 30 * Enumeration for sync targets
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 86a24b1166d1..515669fa3c1d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -475,7 +475,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,
475asmlinkage long sys_pivot_root(const char __user *new_root, 475asmlinkage long sys_pivot_root(const char __user *new_root,
476 const char __user *put_old); 476 const char __user *put_old);
477asmlinkage long sys_chroot(const char __user *filename); 477asmlinkage long sys_chroot(const char __user *filename);
478asmlinkage long sys_mknod(const char __user *filename, int mode, 478asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
479 unsigned dev); 479 unsigned dev);
480asmlinkage long sys_link(const char __user *oldname, 480asmlinkage long sys_link(const char __user *oldname,
481 const char __user *newname); 481 const char __user *newname);
@@ -483,8 +483,8 @@ asmlinkage long sys_symlink(const char __user *old, const char __user *new);
483asmlinkage long sys_unlink(const char __user *pathname); 483asmlinkage long sys_unlink(const char __user *pathname);
484asmlinkage long sys_rename(const char __user *oldname, 484asmlinkage long sys_rename(const char __user *oldname,
485 const char __user *newname); 485 const char __user *newname);
486asmlinkage long sys_chmod(const char __user *filename, mode_t mode); 486asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
487asmlinkage long sys_fchmod(unsigned int fd, mode_t mode); 487asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
488 488
489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); 489asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
490#if BITS_PER_LONG == 32 490#if BITS_PER_LONG == 32
@@ -517,9 +517,9 @@ asmlinkage long sys_sendfile64(int out_fd, int in_fd,
517 loff_t __user *offset, size_t count); 517 loff_t __user *offset, size_t count);
518asmlinkage long sys_readlink(const char __user *path, 518asmlinkage long sys_readlink(const char __user *path,
519 char __user *buf, int bufsiz); 519 char __user *buf, int bufsiz);
520asmlinkage long sys_creat(const char __user *pathname, int mode); 520asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
521asmlinkage long sys_open(const char __user *filename, 521asmlinkage long sys_open(const char __user *filename,
522 int flags, int mode); 522 int flags, umode_t mode);
523asmlinkage long sys_close(unsigned int fd); 523asmlinkage long sys_close(unsigned int fd);
524asmlinkage long sys_access(const char __user *filename, int mode); 524asmlinkage long sys_access(const char __user *filename, int mode);
525asmlinkage long sys_vhangup(void); 525asmlinkage long sys_vhangup(void);
@@ -582,7 +582,7 @@ asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, 582asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h); 583 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
584asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 584asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
585asmlinkage long sys_mkdir(const char __user *pathname, int mode); 585asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
586asmlinkage long sys_chdir(const char __user *filename); 586asmlinkage long sys_chdir(const char __user *filename);
587asmlinkage long sys_fchdir(unsigned int fd); 587asmlinkage long sys_fchdir(unsigned int fd);
588asmlinkage long sys_rmdir(const char __user *pathname); 588asmlinkage long sys_rmdir(const char __user *pathname);
@@ -679,7 +679,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, 679asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
680 unsigned long third, void __user *ptr, long fifth); 680 unsigned long third, void __user *ptr, long fifth);
681 681
682asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 682asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
683asmlinkage long sys_mq_unlink(const char __user *name); 683asmlinkage long sys_mq_unlink(const char __user *name);
684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 684asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 685asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
@@ -753,11 +753,11 @@ asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 753asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
754 __u32 __user *ustatus); 754 __u32 __user *ustatus);
755asmlinkage long sys_spu_create(const char __user *name, 755asmlinkage long sys_spu_create(const char __user *name,
756 unsigned int flags, mode_t mode, int fd); 756 unsigned int flags, umode_t mode, int fd);
757 757
758asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode, 758asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
759 unsigned dev); 759 unsigned dev);
760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, int mode); 760asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag); 761asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
762asmlinkage long sys_symlinkat(const char __user * oldname, 762asmlinkage long sys_symlinkat(const char __user * oldname,
763 int newdfd, const char __user * newname); 763 int newdfd, const char __user * newname);
@@ -769,11 +769,11 @@ asmlinkage long sys_futimesat(int dfd, const char __user *filename,
769 struct timeval __user *utimes); 769 struct timeval __user *utimes);
770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 770asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
771asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 771asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
772 mode_t mode); 772 umode_t mode);
773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 773asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
774 gid_t group, int flag); 774 gid_t group, int flag);
775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 775asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
776 int mode); 776 umode_t mode);
777asmlinkage long sys_newfstatat(int dfd, const char __user *filename, 777asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
778 struct stat __user *statbuf, int flag); 778 struct stat __user *statbuf, int flag);
779asmlinkage long sys_fstatat64(int dfd, const char __user *filename, 779asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 703cfa33a3ca..bb9127dd814b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1038,7 +1038,7 @@ struct ctl_table
1038 const char *procname; /* Text ID for /proc/sys, or zero */ 1038 const char *procname; /* Text ID for /proc/sys, or zero */
1039 void *data; 1039 void *data;
1040 int maxlen; 1040 int maxlen;
1041 mode_t mode; 1041 umode_t mode;
1042 struct ctl_table *child; 1042 struct ctl_table *child;
1043 struct ctl_table *parent; /* Automatically set */ 1043 struct ctl_table *parent; /* Automatically set */
1044 proc_handler *proc_handler; /* Callback for text formatting */ 1044 proc_handler *proc_handler; /* Callback for text formatting */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index dac0859e6440..0010009b2f00 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -25,7 +25,7 @@ enum kobj_ns_type;
25 25
26struct attribute { 26struct attribute {
27 const char *name; 27 const char *name;
28 mode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lock_class_key *key; 30 struct lock_class_key *key;
31 struct lock_class_key skey; 31 struct lock_class_key skey;
@@ -55,7 +55,7 @@ do { \
55 55
56struct attribute_group { 56struct attribute_group {
57 const char *name; 57 const char *name;
58 mode_t (*is_visible)(struct kobject *, 58 umode_t (*is_visible)(struct kobject *,
59 struct attribute *, int); 59 struct attribute *, int);
60 struct attribute **attrs; 60 struct attribute **attrs;
61}; 61};
@@ -133,7 +133,7 @@ int __must_check sysfs_create_file(struct kobject *kobj,
133int __must_check sysfs_create_files(struct kobject *kobj, 133int __must_check sysfs_create_files(struct kobject *kobj,
134 const struct attribute **attr); 134 const struct attribute **attr);
135int __must_check sysfs_chmod_file(struct kobject *kobj, 135int __must_check sysfs_chmod_file(struct kobject *kobj,
136 const struct attribute *attr, mode_t mode); 136 const struct attribute *attr, umode_t mode);
137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 137void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 138void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
139 139
@@ -221,7 +221,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
221} 221}
222 222
223static inline int sysfs_chmod_file(struct kobject *kobj, 223static inline int sysfs_chmod_file(struct kobject *kobj,
224 const struct attribute *attr, mode_t mode) 224 const struct attribute *attr, umode_t mode)
225{ 225{
226 return 0; 226 return 0;
227} 227}
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7f59ee946983..46a85c9e1f25 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -238,6 +238,11 @@ struct tcp_sack_block {
238 u32 end_seq; 238 u32 end_seq;
239}; 239};
240 240
241/*These are used to set the sack_ok field in struct tcp_options_received */
242#define TCP_SACK_SEEN (1 << 0) /*1 = peer is SACK capable, */
243#define TCP_FACK_ENABLED (1 << 1) /*1 = FACK is enabled locally*/
244#define TCP_DSACK_SEEN (1 << 2) /*1 = DSACK was received from peer*/
245
241struct tcp_options_received { 246struct tcp_options_received {
242/* PAWS/RTTM data */ 247/* PAWS/RTTM data */
243 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 248 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b232ccc0ee29..ab8be90b5cc9 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -7,6 +7,7 @@
7#define _LINUX_TICK_H 7#define _LINUX_TICK_H
8 8
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/irqflags.h>
10 11
11#ifdef CONFIG_GENERIC_CLOCKEVENTS 12#ifdef CONFIG_GENERIC_CLOCKEVENTS
12 13
@@ -121,14 +122,16 @@ static inline int tick_oneshot_mode_active(void) { return 0; }
121#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 122#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
122 123
123# ifdef CONFIG_NO_HZ 124# ifdef CONFIG_NO_HZ
124extern void tick_nohz_stop_sched_tick(int inidle); 125extern void tick_nohz_idle_enter(void);
125extern void tick_nohz_restart_sched_tick(void); 126extern void tick_nohz_idle_exit(void);
127extern void tick_nohz_irq_exit(void);
126extern ktime_t tick_nohz_get_sleep_length(void); 128extern ktime_t tick_nohz_get_sleep_length(void);
127extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 129extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
128extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 130extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
129# else 131# else
130static inline void tick_nohz_stop_sched_tick(int inidle) { } 132static inline void tick_nohz_idle_enter(void) { }
131static inline void tick_nohz_restart_sched_tick(void) { } 133static inline void tick_nohz_idle_exit(void) { }
134
132static inline ktime_t tick_nohz_get_sleep_length(void) 135static inline ktime_t tick_nohz_get_sleep_length(void)
133{ 136{
134 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ }; 137 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
diff --git a/include/linux/types.h b/include/linux/types.h
index 57a97234bec1..e5fa50345516 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -24,6 +24,7 @@ typedef __kernel_fd_set fd_set;
24typedef __kernel_dev_t dev_t; 24typedef __kernel_dev_t dev_t;
25typedef __kernel_ino_t ino_t; 25typedef __kernel_ino_t ino_t;
26typedef __kernel_mode_t mode_t; 26typedef __kernel_mode_t mode_t;
27typedef unsigned short umode_t;
27typedef __kernel_nlink_t nlink_t; 28typedef __kernel_nlink_t nlink_t;
28typedef __kernel_off_t off_t; 29typedef __kernel_off_t off_t;
29typedef __kernel_pid_t pid_t; 30typedef __kernel_pid_t pid_t;
@@ -188,7 +189,7 @@ typedef __u32 __bitwise __wsum;
188 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid 189 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
189 * common 32/64-bit compat problems. 190 * common 32/64-bit compat problems.
190 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other 191 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
191 * architectures) and to 8-byte boundaries on 64-bit architetures. The new 192 * architectures) and to 8-byte boundaries on 64-bit architectures. The new
192 * aligned_64 type enforces 8-byte alignment so that structs containing 193 * aligned_64 type enforces 8-byte alignment so that structs containing
193 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. 194 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
194 * No conversions are necessary between 32-bit user-space and a 64-bit kernel. 195 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 5c75153f9441..d21b33c4c6ca 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -96,13 +96,11 @@ struct ucb1400_gpio {
96 96
97struct ucb1400_ts { 97struct ucb1400_ts {
98 struct input_dev *ts_idev; 98 struct input_dev *ts_idev;
99 struct task_struct *ts_task;
100 int id; 99 int id;
101 wait_queue_head_t ts_wait;
102 unsigned int ts_restart:1;
103 int irq; 100 int irq;
104 unsigned int irq_pending; /* not bit field shared */
105 struct snd_ac97 *ac97; 101 struct snd_ac97 *ac97;
102 wait_queue_head_t ts_wait;
103 bool stopped;
106}; 104};
107 105
108struct ucb1400 { 106struct ucb1400 {
diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
new file mode 100644
index 000000000000..b1d2bf16b33c
--- /dev/null
+++ b/include/linux/unix_diag.h
@@ -0,0 +1,54 @@
1#ifndef __UNIX_DIAG_H__
2#define __UNIX_DIAG_H__
3
4#include <linux/types.h>
5
6struct unix_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 udiag_states;
11 __u32 udiag_ino;
12 __u32 udiag_show;
13 __u32 udiag_cookie[2];
14};
15
16#define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */
17#define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */
18#define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */
19#define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */
20#define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */
21#define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */
22
23struct unix_diag_msg {
24 __u8 udiag_family;
25 __u8 udiag_type;
26 __u8 udiag_state;
27 __u8 pad;
28
29 __u32 udiag_ino;
30 __u32 udiag_cookie[2];
31};
32
33enum {
34 UNIX_DIAG_NAME,
35 UNIX_DIAG_VFS,
36 UNIX_DIAG_PEER,
37 UNIX_DIAG_ICONS,
38 UNIX_DIAG_RQLEN,
39 UNIX_DIAG_MEMINFO,
40
41 UNIX_DIAG_MAX,
42};
43
44struct unix_diag_vfs {
45 __u32 udiag_vfs_ino;
46 __u32 udiag_vfs_dev;
47};
48
49struct unix_diag_rqlen {
50 __u32 udiag_rqueue;
51 __u32 udiag_wqueue;
52};
53
54#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d3d0c1374334..27a4e16d2bf1 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -935,7 +935,7 @@ extern struct bus_type usb_bus_type;
935 */ 935 */
936struct usb_class_driver { 936struct usb_class_driver {
937 char *name; 937 char *name;
938 char *(*devnode)(struct device *dev, mode_t *mode); 938 char *(*devnode)(struct device *dev, umode_t *mode);
939 const struct file_operations *fops; 939 const struct file_operations *fops;
940 int minor_base; 940 int minor_base;
941}; 941};
@@ -953,6 +953,18 @@ extern int usb_register_driver(struct usb_driver *, struct module *,
953 953
954extern void usb_deregister(struct usb_driver *); 954extern void usb_deregister(struct usb_driver *);
955 955
956/**
957 * module_usb_driver() - Helper macro for registering a USB driver
958 * @__usb_driver: usb_driver struct
959 *
960 * Helper macro for USB drivers which do not do anything special in module
961 * init/exit. This eliminates a lot of boilerplate. Each module may only
962 * use this macro once, and calling it replaces module_init() and module_exit()
963 */
964#define module_usb_driver(__usb_driver) \
965 module_driver(__usb_driver, usb_register, \
966 usb_deregister)
967
956extern int usb_register_device_driver(struct usb_device_driver *, 968extern int usb_register_device_driver(struct usb_device_driver *,
957 struct module *); 969 struct module *);
958extern void usb_deregister_device_driver(struct usb_device_driver *); 970extern void usb_deregister_device_driver(struct usb_device_driver *);
@@ -1221,6 +1233,7 @@ struct urb {
1221 void *transfer_buffer; /* (in) associated data buffer */ 1233 void *transfer_buffer; /* (in) associated data buffer */
1222 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1234 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1223 struct scatterlist *sg; /* (in) scatter gather buffer list */ 1235 struct scatterlist *sg; /* (in) scatter gather buffer list */
1236 int num_mapped_sgs; /* (internal) mapped sg entries */
1224 int num_sgs; /* (in) number of entries in the sg list */ 1237 int num_sgs; /* (in) number of entries in the sg list */
1225 u32 transfer_buffer_length; /* (in) data buffer length */ 1238 u32 transfer_buffer_length; /* (in) data buffer length */
1226 u32 actual_length; /* (return) actual transfer length */ 1239 u32 actual_length; /* (return) actual transfer length */
@@ -1598,6 +1611,19 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
1598 1611
1599/* ----------------------------------------------------------------------- */ 1612/* ----------------------------------------------------------------------- */
1600 1613
1614/* translate USB error codes to codes user space understands */
1615static inline int usb_translate_errors(int error_code)
1616{
1617 switch (error_code) {
1618 case 0:
1619 case -ENOMEM:
1620 case -ENODEV:
1621 return error_code;
1622 default:
1623 return -EIO;
1624 }
1625}
1626
1601/* Events from the usb core */ 1627/* Events from the usb core */
1602#define USB_DEVICE_ADD 0x0001 1628#define USB_DEVICE_ADD 0x0001
1603#define USB_DEVICE_REMOVE 0x0002 1629#define USB_DEVICE_REMOVE 0x0002
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 4ebaf0824179..31fdb4c6ee3d 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -26,7 +26,6 @@
26#define HUB_RESET_TT 9 26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10 27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11 28#define HUB_STOP_TT 11
29#define HUB_SET_DEPTH 12
30 29
31/* 30/*
32 * Hub class additional requests defined by USB 3.0 spec 31 * Hub class additional requests defined by USB 3.0 spec
@@ -165,11 +164,20 @@ struct usb_port_status {
165 * wHubCharacteristics (masks) 164 * wHubCharacteristics (masks)
166 * See USB 2.0 spec Table 11-13, offset 3 165 * See USB 2.0 spec Table 11-13, offset 3
167 */ 166 */
168#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ 167#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */
169#define HUB_CHAR_COMPOUND 0x0004 /* D2 */ 168#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */
170#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ 169#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */
171#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ 170#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
172#define HUB_CHAR_PORTIND 0x0080 /* D7 */ 171
172#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
173
174#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */
175#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */
176#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */
177#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */
178
179#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */
180#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */
173 181
174struct usb_hub_status { 182struct usb_hub_status {
175 __le16 wHubStatus; 183 __le16 wHubStatus;
@@ -198,6 +206,17 @@ struct usb_hub_status {
198#define USB_DT_HUB_NONVAR_SIZE 7 206#define USB_DT_HUB_NONVAR_SIZE 7
199#define USB_DT_SS_HUB_SIZE 12 207#define USB_DT_SS_HUB_SIZE 12
200 208
209/*
210 * Hub Device descriptor
211 * USB Hub class device protocols
212 */
213
214#define USB_HUB_PR_FS 0 /* Full speed hub */
215#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
216#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
217#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
218#define USB_HUB_PR_SS 3 /* Super speed hub */
219
201struct usb_hub_descriptor { 220struct usb_hub_descriptor {
202 __u8 bDescLength; 221 __u8 bDescLength;
203 __u8 bDescriptorType; 222 __u8 bDescriptorType;
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index d5da6c68c250..61b29057b054 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -605,8 +605,26 @@ struct usb_ss_ep_comp_descriptor {
605} __attribute__ ((packed)); 605} __attribute__ ((packed));
606 606
607#define USB_DT_SS_EP_COMP_SIZE 6 607#define USB_DT_SS_EP_COMP_SIZE 6
608
608/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 609/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
609#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) 610static inline int
611usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
612{
613 int max_streams;
614
615 if (!comp)
616 return 0;
617
618 max_streams = comp->bmAttributes & 0x1f;
619
620 if (!max_streams)
621 return 0;
622
623 max_streams = 1 << max_streams;
624
625 return max_streams;
626}
627
610/* Bits 1:0 of bmAttributes if this is an isoc endpoint */ 628/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
611#define USB_SS_MULT(p) (1 + ((p) & 0x3)) 629#define USB_SS_MULT(p) (1 + ((p) & 0x3))
612 630
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 1d3a67523ffc..da653b5c7134 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h>
23#include <linux/types.h> 24#include <linux/types.h>
24#include <linux/usb/ch9.h> 25#include <linux/usb/ch9.h>
25 26
@@ -32,6 +33,9 @@ struct usb_ep;
32 * @dma: DMA address corresponding to 'buf'. If you don't set this 33 * @dma: DMA address corresponding to 'buf'. If you don't set this
33 * field, and the usb controller needs one, it is responsible 34 * field, and the usb controller needs one, it is responsible
34 * for mapping and unmapping the buffer. 35 * for mapping and unmapping the buffer.
36 * @sg: a scatterlist for SG-capable controllers.
37 * @num_sgs: number of SG entries
38 * @num_mapped_sgs: number of SG entries mapped to DMA (internal)
35 * @length: Length of that data 39 * @length: Length of that data
36 * @stream_id: The stream id, when USB3.0 bulk streams are being used 40 * @stream_id: The stream id, when USB3.0 bulk streams are being used
37 * @no_interrupt: If true, hints that no completion irq is needed. 41 * @no_interrupt: If true, hints that no completion irq is needed.
@@ -88,6 +92,10 @@ struct usb_request {
88 unsigned length; 92 unsigned length;
89 dma_addr_t dma; 93 dma_addr_t dma;
90 94
95 struct scatterlist *sg;
96 unsigned num_sgs;
97 unsigned num_mapped_sgs;
98
91 unsigned stream_id:16; 99 unsigned stream_id:16;
92 unsigned no_interrupt:1; 100 unsigned no_interrupt:1;
93 unsigned zero:1; 101 unsigned zero:1;
@@ -164,7 +172,7 @@ struct usb_ep {
164 unsigned maxpacket:16; 172 unsigned maxpacket:16;
165 unsigned max_streams:16; 173 unsigned max_streams:16;
166 unsigned mult:2; 174 unsigned mult:2;
167 unsigned maxburst:4; 175 unsigned maxburst:5;
168 u8 address; 176 u8 address;
169 const struct usb_endpoint_descriptor *desc; 177 const struct usb_endpoint_descriptor *desc;
170 const struct usb_ss_ep_comp_descriptor *comp_desc; 178 const struct usb_ss_ep_comp_descriptor *comp_desc;
@@ -477,8 +485,9 @@ struct usb_gadget_ops {
477 * driver setup() requests 485 * driver setup() requests
478 * @ep_list: List of other endpoints supported by the device. 486 * @ep_list: List of other endpoints supported by the device.
479 * @speed: Speed of current connection to USB host. 487 * @speed: Speed of current connection to USB host.
480 * @is_dualspeed: True if the controller supports both high and full speed 488 * @max_speed: Maximal speed the UDC can handle. UDC must support this
481 * operation. If it does, the gadget driver must also support both. 489 * and all slower speeds.
490 * @sg_supported: true if we can handle scatter-gather
482 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 491 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
483 * gadget driver must provide a USB OTG descriptor. 492 * gadget driver must provide a USB OTG descriptor.
484 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable 493 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
@@ -518,7 +527,8 @@ struct usb_gadget {
518 struct usb_ep *ep0; 527 struct usb_ep *ep0;
519 struct list_head ep_list; /* of usb_ep */ 528 struct list_head ep_list; /* of usb_ep */
520 enum usb_device_speed speed; 529 enum usb_device_speed speed;
521 unsigned is_dualspeed:1; 530 enum usb_device_speed max_speed;
531 unsigned sg_supported:1;
522 unsigned is_otg:1; 532 unsigned is_otg:1;
523 unsigned is_a_peripheral:1; 533 unsigned is_a_peripheral:1;
524 unsigned b_hnp_enable:1; 534 unsigned b_hnp_enable:1;
@@ -549,7 +559,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
549static inline int gadget_is_dualspeed(struct usb_gadget *g) 559static inline int gadget_is_dualspeed(struct usb_gadget *g)
550{ 560{
551#ifdef CONFIG_USB_GADGET_DUALSPEED 561#ifdef CONFIG_USB_GADGET_DUALSPEED
552 /* runtime test would check "g->is_dualspeed" ... that might be 562 /* runtime test would check "g->max_speed" ... that might be
553 * useful to work around hardware bugs, but is mostly pointless 563 * useful to work around hardware bugs, but is mostly pointless
554 */ 564 */
555 return 1; 565 return 1;
@@ -567,7 +577,7 @@ static inline int gadget_is_superspeed(struct usb_gadget *g)
567{ 577{
568#ifdef CONFIG_USB_GADGET_SUPERSPEED 578#ifdef CONFIG_USB_GADGET_SUPERSPEED
569 /* 579 /*
570 * runtime test would check "g->is_superspeed" ... that might be 580 * runtime test would check "g->max_speed" ... that might be
571 * useful to work around hardware bugs, but is mostly pointless 581 * useful to work around hardware bugs, but is mostly pointless
572 */ 582 */
573 return 1; 583 return 1;
@@ -760,7 +770,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
760/** 770/**
761 * struct usb_gadget_driver - driver for usb 'slave' devices 771 * struct usb_gadget_driver - driver for usb 'slave' devices
762 * @function: String describing the gadget's function 772 * @function: String describing the gadget's function
763 * @speed: Highest speed the driver handles. 773 * @max_speed: Highest speed the driver handles.
764 * @setup: Invoked for ep0 control requests that aren't handled by 774 * @setup: Invoked for ep0 control requests that aren't handled by
765 * the hardware level driver. Most calls must be handled by 775 * the hardware level driver. Most calls must be handled by
766 * the gadget driver, including descriptor and configuration 776 * the gadget driver, including descriptor and configuration
@@ -824,7 +834,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
824 */ 834 */
825struct usb_gadget_driver { 835struct usb_gadget_driver {
826 char *function; 836 char *function;
827 enum usb_device_speed speed; 837 enum usb_device_speed max_speed;
828 void (*unbind)(struct usb_gadget *); 838 void (*unbind)(struct usb_gadget *);
829 int (*setup)(struct usb_gadget *, 839 int (*setup)(struct usb_gadget *,
830 const struct usb_ctrlrequest *); 840 const struct usb_ctrlrequest *);
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 03354d557b79..b2f62f3a32af 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -99,7 +99,6 @@ struct usb_hcd {
99 */ 99 */
100 unsigned long flags; 100 unsigned long flags;
101#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */ 101#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
102#define HCD_FLAG_SAW_IRQ 1
103#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ 102#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
104#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ 103#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
105#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 104#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
@@ -110,7 +109,6 @@ struct usb_hcd {
110 * be slightly faster than test_bit(). 109 * be slightly faster than test_bit().
111 */ 110 */
112#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE)) 111#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
113#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
114#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) 112#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
115#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) 113#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
116#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) 114#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index e5a40c318548..0d3f98879256 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -67,6 +67,14 @@ struct renesas_usbhs_platform_callback {
67 /* 67 /*
68 * option: 68 * option:
69 * 69 *
70 * for board specific clock control
71 */
72 void (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable);
74
75 /*
76 * option:
77 *
70 * Phy reset for platform 78 * Phy reset for platform
71 */ 79 */
72 void (*phy_reset)(struct platform_device *pdev); 80 void (*phy_reset)(struct platform_device *pdev);
@@ -118,7 +126,7 @@ struct renesas_usbhs_driver_param {
118 * 126 *
119 * delay time from notify_hotplug callback 127 * delay time from notify_hotplug callback
120 */ 128 */
121 int detection_delay; 129 int detection_delay; /* msec */
122 130
123 /* 131 /*
124 * option: 132 * option:
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b29f70b2ecae..4267a9c717ba 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -58,11 +58,13 @@ enum port_dev_state {
58 * @read_urb: pointer to the bulk in struct urb for this port. 58 * @read_urb: pointer to the bulk in struct urb for this port.
59 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this 59 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
60 * port. 60 * port.
61 * @bulk_in_buffers: pointers to the bulk in buffers for this port
62 * @read_urbs: pointers to the bulk in urbs for this port
63 * @read_urbs_free: status bitmap the for bulk in urbs
61 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 64 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
62 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 65 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
63 * @write_urb: pointer to the bulk out struct urb for this port. 66 * @write_urb: pointer to the bulk out struct urb for this port.
64 * @write_fifo: kfifo used to buffer outgoing data 67 * @write_fifo: kfifo used to buffer outgoing data
65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port 68 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port 69 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs 70 * @write_urbs_free: status bitmap the for bulk out urbs
@@ -99,11 +101,14 @@ struct usb_serial_port {
99 struct urb *read_urb; 101 struct urb *read_urb;
100 __u8 bulk_in_endpointAddress; 102 __u8 bulk_in_endpointAddress;
101 103
104 unsigned char *bulk_in_buffers[2];
105 struct urb *read_urbs[2];
106 unsigned long read_urbs_free;
107
102 unsigned char *bulk_out_buffer; 108 unsigned char *bulk_out_buffer;
103 int bulk_out_size; 109 int bulk_out_size;
104 struct urb *write_urb; 110 struct urb *write_urb;
105 struct kfifo write_fifo; 111 struct kfifo write_fifo;
106 int write_urb_busy;
107 112
108 unsigned char *bulk_out_buffers[2]; 113 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2]; 114 struct urb *write_urbs[2];
@@ -340,7 +345,7 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
340extern void usb_serial_generic_release(struct usb_serial *serial); 345extern void usb_serial_generic_release(struct usb_serial *serial);
341extern int usb_serial_generic_register(int debug); 346extern int usb_serial_generic_register(int debug);
342extern void usb_serial_generic_deregister(void); 347extern void usb_serial_generic_deregister(void);
343extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, 348extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port,
344 gfp_t mem_flags); 349 gfp_t mem_flags);
345extern void usb_serial_generic_process_read_urb(struct urb *urb); 350extern void usb_serial_generic_process_read_urb(struct urb *urb);
346extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, 351extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 4b752d5ee80e..d2f74f8e3fe3 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -343,6 +343,8 @@ struct v4l2_pix_format {
343#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ 343#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
344#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 344#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
346#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
347#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
346 348
347/* two non contiguous planes - one Y, one Cr + Cb interleaved */ 349/* two non contiguous planes - one Y, one Cr + Cb interleaved */
348#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ 350#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 4c069d8bd740..d0018d27c281 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -25,70 +25,18 @@ struct virtqueue {
25 void *priv; 25 void *priv;
26}; 26};
27 27
28/** 28int virtqueue_add_buf(struct virtqueue *vq,
29 * operations for virtqueue 29 struct scatterlist sg[],
30 * virtqueue_add_buf: expose buffer to other end 30 unsigned int out_num,
31 * vq: the struct virtqueue we're talking about. 31 unsigned int in_num,
32 * sg: the description of the buffer(s). 32 void *data,
33 * out_num: the number of sg readable by other side 33 gfp_t gfp);
34 * in_num: the number of sg which are writable (after readable ones)
35 * data: the token identifying the buffer.
36 * gfp: how to do memory allocations (if necessary).
37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * virtqueue_kick: update after add_buf
39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side.
41 * virtqueue_get_buf: get the next used buffer
42 * vq: the struct virtqueue we're talking about.
43 * len: the length written into the buffer
44 * Returns NULL or the "data" token handed to add_buf.
45 * virtqueue_disable_cb: disable callbacks
46 * vq: the struct virtqueue we're talking about.
47 * Note that this is not necessarily synchronous, hence unreliable and only
48 * useful as an optimization.
49 * virtqueue_enable_cb: restart callbacks after disable_cb.
50 * vq: the struct virtqueue we're talking about.
51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks.
54 * virtqueue_enable_cb_delayed: restart callbacks after disable_cb.
55 * vq: the struct virtqueue we're talking about.
56 * This re-enables callbacks but hints to the other side to delay
57 * interrupts until most of the available buffers have been processed;
58 * it returns "false" if there are many pending buffers in the queue,
59 * to detect a possible race between the driver checking for more work,
60 * and enabling callbacks.
61 * virtqueue_detach_unused_buf: detach first unused buffer
62 * vq: the struct virtqueue we're talking about.
63 * Returns NULL or the "data" token handed to add_buf
64 * virtqueue_get_vring_size: return the size of the virtqueue's vring
65 * vq: the struct virtqueue containing the vring of interest.
66 * Returns the size of the vring.
67 *
68 * Locking rules are straightforward: the driver is responsible for
69 * locking. No two operations may be invoked simultaneously, with the exception
70 * of virtqueue_disable_cb.
71 *
72 * All operations can be called in any context.
73 */
74 34
75int virtqueue_add_buf_gfp(struct virtqueue *vq, 35void virtqueue_kick(struct virtqueue *vq);
76 struct scatterlist sg[],
77 unsigned int out_num,
78 unsigned int in_num,
79 void *data,
80 gfp_t gfp);
81 36
82static inline int virtqueue_add_buf(struct virtqueue *vq, 37bool virtqueue_kick_prepare(struct virtqueue *vq);
83 struct scatterlist sg[],
84 unsigned int out_num,
85 unsigned int in_num,
86 void *data)
87{
88 return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC);
89}
90 38
91void virtqueue_kick(struct virtqueue *vq); 39void virtqueue_notify(struct virtqueue *vq);
92 40
93void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); 41void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
94 42
@@ -146,6 +94,11 @@ struct virtio_driver {
146 int (*probe)(struct virtio_device *dev); 94 int (*probe)(struct virtio_device *dev);
147 void (*remove)(struct virtio_device *dev); 95 void (*remove)(struct virtio_device *dev);
148 void (*config_changed)(struct virtio_device *dev); 96 void (*config_changed)(struct virtio_device *dev);
97#ifdef CONFIG_PM
98 int (*freeze)(struct virtio_device *dev);
99 int (*thaw)(struct virtio_device *dev);
100 int (*restore)(struct virtio_device *dev);
101#endif
149}; 102};
150 103
151int register_virtio_driver(struct virtio_driver *drv); 104int register_virtio_driver(struct virtio_driver *drv);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e9e72bda1b72..5206d6541da5 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -102,6 +102,10 @@
102 * vdev: the virtio_device 102 * vdev: the virtio_device
103 * This gives the final feature bits for the device: it can change 103 * This gives the final feature bits for the device: it can change
104 * the dev->feature bits if it wants. 104 * the dev->feature bits if it wants.
105 * @bus_name: return the bus name associated with the device
106 * vdev: the virtio_device
107 * This returns a pointer to the bus name a la pci_name from which
108 * the caller can then copy.
105 */ 109 */
106typedef void vq_callback_t(struct virtqueue *); 110typedef void vq_callback_t(struct virtqueue *);
107struct virtio_config_ops { 111struct virtio_config_ops {
@@ -119,6 +123,7 @@ struct virtio_config_ops {
119 void (*del_vqs)(struct virtio_device *); 123 void (*del_vqs)(struct virtio_device *);
120 u32 (*get_features)(struct virtio_device *vdev); 124 u32 (*get_features)(struct virtio_device *vdev);
121 void (*finalize_features)(struct virtio_device *vdev); 125 void (*finalize_features)(struct virtio_device *vdev);
126 const char *(*bus_name)(struct virtio_device *vdev);
122}; 127};
123 128
124/* If driver didn't advertise the feature, it will never appear. */ 129/* If driver didn't advertise the feature, it will never appear. */
@@ -184,5 +189,14 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
184 return ERR_PTR(err); 189 return ERR_PTR(err);
185 return vq; 190 return vq;
186} 191}
192
193static inline
194const char *virtio_bus_name(struct virtio_device *vdev)
195{
196 if (!vdev->config->bus_name)
197 return "virtio";
198 return vdev->config->bus_name(vdev);
199}
200
187#endif /* __KERNEL__ */ 201#endif /* __KERNEL__ */
188#endif /* _LINUX_VIRTIO_CONFIG_H */ 202#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 36be0f6e18a9..e338730c2660 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -168,6 +168,7 @@ struct virtqueue;
168struct virtqueue *vring_new_virtqueue(unsigned int num, 168struct virtqueue *vring_new_virtqueue(unsigned int num,
169 unsigned int vring_align, 169 unsigned int vring_align,
170 struct virtio_device *vdev, 170 struct virtio_device *vdev,
171 bool weak_barriers,
171 void *pages, 172 void *pages,
172 void (*notify)(struct virtqueue *vq), 173 void (*notify)(struct virtqueue *vq),
173 void (*callback)(struct virtqueue *vq), 174 void (*callback)(struct virtqueue *vq),
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4bde182fcf93..dcdfc2bda922 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -131,6 +131,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
131 */ 131 */
132extern rwlock_t vmlist_lock; 132extern rwlock_t vmlist_lock;
133extern struct vm_struct *vmlist; 133extern struct vm_struct *vmlist;
134extern __init void vm_area_add_early(struct vm_struct *vm);
134extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 135extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
135 136
136#ifdef CONFIG_SMP 137#ifdef CONFIG_SMP
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 3efc9f3f43a0..a9ce45e8501c 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -77,13 +77,13 @@ struct task_struct;
77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 77#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
78 { .flags = word, .bit_nr = bit, } 78 { .flags = word, .bit_nr = bit, }
79 79
80extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *); 80extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
81 81
82#define init_waitqueue_head(q) \ 82#define init_waitqueue_head(q) \
83 do { \ 83 do { \
84 static struct lock_class_key __key; \ 84 static struct lock_class_key __key; \
85 \ 85 \
86 __init_waitqueue_head((q), &__key); \ 86 __init_waitqueue_head((q), #q, &__key); \
87 } while (0) 87 } while (0)
88 88
89#ifdef CONFIG_LOCKDEP 89#ifdef CONFIG_LOCKDEP
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index e0aa39612eba..3157cc1fada6 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -309,7 +309,7 @@ typedef struct wandev_conf
309#define WANOPT_EVEN 2 309#define WANOPT_EVEN 2
310 310
311/* CHDLC Protocol Options */ 311/* CHDLC Protocol Options */
312/* DF Commmented out for now. 312/* DF Commented out for now.
313 313
314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT 314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT 315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 111843f88b2a..43ba5b3ce2a3 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -53,11 +53,7 @@ struct watchdog_info {
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#ifdef CONFIG_WATCHDOG_NOWAYOUT 56#include <linux/bitops.h>
57#define WATCHDOG_NOWAYOUT 1
58#else
59#define WATCHDOG_NOWAYOUT 0
60#endif
61 57
62struct watchdog_ops; 58struct watchdog_ops;
63struct watchdog_device; 59struct watchdog_device;
@@ -122,6 +118,21 @@ struct watchdog_device {
122#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ 118#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
123}; 119};
124 120
121#ifdef CONFIG_WATCHDOG_NOWAYOUT
122#define WATCHDOG_NOWAYOUT 1
123#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
124#else
125#define WATCHDOG_NOWAYOUT 0
126#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
127#endif
128
129/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
131{
132 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
134}
135
125/* Use the following functions to manipulate watchdog driver specific data */ 136/* Use the following functions to manipulate watchdog driver specific data */
126static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 137static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
127{ 138{
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4b697395326e..0d6373195d32 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -54,6 +54,9 @@ struct wl12xx_platform_data {
54 int board_ref_clock; 54 int board_ref_clock;
55 int board_tcxo_clock; 55 int board_tcxo_clock;
56 unsigned long platform_quirks; 56 unsigned long platform_quirks;
57 bool pwr_in_suspend;
58
59 struct wl1271_if_operations *ops;
57}; 60};
58 61
59/* Platform does not support level trigger interrupts */ 62/* Platform does not support level trigger interrupts */
@@ -73,6 +76,6 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
73 76
74#endif 77#endif
75 78
76const struct wl12xx_platform_data *wl12xx_get_platform_data(void); 79struct wl12xx_platform_data *wl12xx_get_platform_data(void);
77 80
78#endif 81#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 0d556deb497b..eb8b9f15f2e0 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -297,32 +297,50 @@ extern struct workqueue_struct *system_unbound_wq;
297extern struct workqueue_struct *system_freezable_wq; 297extern struct workqueue_struct *system_freezable_wq;
298 298
299extern struct workqueue_struct * 299extern struct workqueue_struct *
300__alloc_workqueue_key(const char *name, unsigned int flags, int max_active, 300__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
301 struct lock_class_key *key, const char *lock_name); 301 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6);
302 302
303/**
304 * alloc_workqueue - allocate a workqueue
305 * @fmt: printf format for the name of the workqueue
306 * @flags: WQ_* flags
307 * @max_active: max in-flight work items, 0 for default
308 * @args: args for @fmt
309 *
310 * Allocate a workqueue with the specified parameters. For detailed
311 * information on WQ_* flags, please refer to Documentation/workqueue.txt.
312 *
313 * The __lock_name macro dance is to guarantee that single lock_class_key
314 * doesn't end up with different namesm, which isn't allowed by lockdep.
315 *
316 * RETURNS:
317 * Pointer to the allocated workqueue on success, %NULL on failure.
318 */
303#ifdef CONFIG_LOCKDEP 319#ifdef CONFIG_LOCKDEP
304#define alloc_workqueue(name, flags, max_active) \ 320#define alloc_workqueue(fmt, flags, max_active, args...) \
305({ \ 321({ \
306 static struct lock_class_key __key; \ 322 static struct lock_class_key __key; \
307 const char *__lock_name; \ 323 const char *__lock_name; \
308 \ 324 \
309 if (__builtin_constant_p(name)) \ 325 if (__builtin_constant_p(fmt)) \
310 __lock_name = (name); \ 326 __lock_name = (fmt); \
311 else \ 327 else \
312 __lock_name = #name; \ 328 __lock_name = #fmt; \
313 \ 329 \
314 __alloc_workqueue_key((name), (flags), (max_active), \ 330 __alloc_workqueue_key((fmt), (flags), (max_active), \
315 &__key, __lock_name); \ 331 &__key, __lock_name, ##args); \
316}) 332})
317#else 333#else
318#define alloc_workqueue(name, flags, max_active) \ 334#define alloc_workqueue(fmt, flags, max_active, args...) \
319 __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL) 335 __alloc_workqueue_key((fmt), (flags), (max_active), \
336 NULL, NULL, ##args)
320#endif 337#endif
321 338
322/** 339/**
323 * alloc_ordered_workqueue - allocate an ordered workqueue 340 * alloc_ordered_workqueue - allocate an ordered workqueue
324 * @name: name of the workqueue 341 * @fmt: printf format for the name of the workqueue
325 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful) 342 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
343 * @args: args for @fmt
326 * 344 *
327 * Allocate an ordered workqueue. An ordered workqueue executes at 345 * Allocate an ordered workqueue. An ordered workqueue executes at
328 * most one work item at any given time in the queued order. They are 346 * most one work item at any given time in the queued order. They are
@@ -331,11 +349,8 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
331 * RETURNS: 349 * RETURNS:
332 * Pointer to the allocated workqueue on success, %NULL on failure. 350 * Pointer to the allocated workqueue on success, %NULL on failure.
333 */ 351 */
334static inline struct workqueue_struct * 352#define alloc_ordered_workqueue(fmt, flags, args...) \
335alloc_ordered_workqueue(const char *name, unsigned int flags) 353 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args)
336{
337 return alloc_workqueue(name, WQ_UNBOUND | flags, 1);
338}
339 354
340#define create_workqueue(name) \ 355#define create_workqueue(name) \
341 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 356 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a378c295851f..995b8bf630ac 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -7,6 +7,8 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/fs.h> 8#include <linux/fs.h>
9 9
10DECLARE_PER_CPU(int, dirty_throttle_leaks);
11
10/* 12/*
11 * The 1/4 region under the global dirty thresh is for smooth dirty throttling: 13 * The 1/4 region under the global dirty thresh is for smooth dirty throttling:
12 * 14 *
@@ -23,11 +25,6 @@
23#define DIRTY_SCOPE 8 25#define DIRTY_SCOPE 8
24#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2) 26#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2)
25 27
26/*
27 * 4MB minimal write chunk size
28 */
29#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10))
30
31struct backing_dev_info; 28struct backing_dev_info;
32 29
33/* 30/*
@@ -124,6 +121,7 @@ void laptop_mode_timer_fn(unsigned long data);
124static inline void laptop_sync_completion(void) { } 121static inline void laptop_sync_completion(void) { }
125#endif 122#endif
126void throttle_vm_writeout(gfp_t gfp_mask); 123void throttle_vm_writeout(gfp_t gfp_mask);
124bool zone_dirty_ok(struct zone *zone);
127 125
128extern unsigned long global_dirty_limit; 126extern unsigned long global_dirty_limit;
129 127
@@ -138,8 +136,6 @@ extern int vm_highmem_is_dirtyable;
138extern int block_dump; 136extern int block_dump;
139extern int laptop_mode; 137extern int laptop_mode;
140 138
141extern unsigned long determine_dirtyable_memory(void);
142
143extern int dirty_background_ratio_handler(struct ctl_table *table, int write, 139extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
144 void __user *buffer, size_t *lenp, 140 void __user *buffer, size_t *lenp,
145 loff_t *ppos); 141 loff_t *ppos);
@@ -195,6 +191,8 @@ void writeback_set_ratelimit(void);
195void tag_pages_for_writeback(struct address_space *mapping, 191void tag_pages_for_writeback(struct address_space *mapping,
196 pgoff_t start, pgoff_t end); 192 pgoff_t start, pgoff_t end);
197 193
194void account_page_redirty(struct page *page);
195
198/* pdflush.c */ 196/* pdflush.c */
199extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 197extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
200 read-only. */ 198 read-only. */
diff --git a/include/linux/zorro_ids.h b/include/linux/zorro_ids.h
index 7e749088910d..74bc53bcfdcf 100644
--- a/include/linux/zorro_ids.h
+++ b/include/linux/zorro_ids.h
@@ -360,8 +360,8 @@
360#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0) 360#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0)
361#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0) 361#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0)
362#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0) 362#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0)
363#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0) 363#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0)
364#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0) 364#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0)
365#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0) 365#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0)
366#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0) 366#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0)
367#define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0) 367#define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0)
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h
new file mode 100644
index 000000000000..9929b05cff3a
--- /dev/null
+++ b/include/media/davinci/vpif_types.h
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17#ifndef _VPIF_TYPES_H
18#define _VPIF_TYPES_H
19
20#define VPIF_CAPTURE_MAX_CHANNELS 2
21
22enum vpif_if_type {
23 VPIF_IF_BT656,
24 VPIF_IF_BT1120,
25 VPIF_IF_RAW_BAYER
26};
27
28struct vpif_interface {
29 enum vpif_if_type if_type;
30 unsigned hd_pol:1;
31 unsigned vd_pol:1;
32 unsigned fid_pol:1;
33};
34
35struct vpif_subdev_info {
36 const char *name;
37 struct i2c_board_info board_info;
38 u32 input;
39 u32 output;
40 unsigned can_route:1;
41 struct vpif_interface vpif_if;
42};
43
44struct vpif_display_config {
45 int (*set_clock)(int, int);
46 struct vpif_subdev_info *subdevinfo;
47 int subdev_count;
48 const char **output;
49 int output_count;
50 const char *card_name;
51};
52
53struct vpif_input {
54 struct v4l2_input input;
55 const char *subdev_name;
56};
57
58struct vpif_capture_chan_config {
59 const struct vpif_input *inputs;
60 int input_count;
61};
62
63struct vpif_capture_config {
64 int (*setup_input_channel_mode)(int);
65 int (*setup_input_path)(int, const char *);
66 struct vpif_capture_chan_config chan_config[VPIF_CAPTURE_MAX_CHANNELS];
67 struct vpif_subdev_info *subdev_info;
68 int subdev_count;
69 const char *card_name;
70};
71#endif /* _VPIF_TYPES_H */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index b1377b931eb7..5fb2c3d10c05 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -254,7 +254,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
254static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) 254static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
255{ 255{
256 struct v4l2_subdev *sd = i2c_get_clientdata(client); 256 struct v4l2_subdev *sd = i2c_get_clientdata(client);
257 struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; 257 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
258 return icd ? icd->vdev : NULL; 258 return icd ? icd->vdev : NULL;
259} 259}
260 260
@@ -279,6 +279,11 @@ static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobu
279 return container_of(vq, struct soc_camera_device, vb_vidq); 279 return container_of(vq, struct soc_camera_device, vb_vidq);
280} 280}
281 281
282static inline u32 soc_camera_grp_id(const struct soc_camera_device *icd)
283{
284 return (icd->iface << 8) | (icd->devnum + 1);
285}
286
282void soc_camera_lock(struct vb2_queue *vq); 287void soc_camera_lock(struct vb2_queue *vq);
283void soc_camera_unlock(struct vb2_queue *vq); 288void soc_camera_unlock(struct vb2_queue *vq);
284 289
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 1a7e1d20adf9..36eace03b2ac 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -198,7 +198,8 @@ struct otp_info {
198#define MEMISLOCKED _IOR('M', 23, struct erase_info_user) 198#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
199/* 199/*
200 * Most generic write interface; can write in-band and/or out-of-band in various 200 * Most generic write interface; can write in-band and/or out-of-band in various
201 * modes (see "struct mtd_write_req") 201 * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes
202 * without OOB, e.g., NOR flash.
202 */ 203 */
203#define MEMWRITE _IOWR('M', 24, struct mtd_write_req) 204#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
204 205
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 2d70b95b3b55..7184853ca360 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -63,30 +63,16 @@ enum p9_debug_flags {
63 63
64#ifdef CONFIG_NET_9P_DEBUG 64#ifdef CONFIG_NET_9P_DEBUG
65extern unsigned int p9_debug_level; 65extern unsigned int p9_debug_level;
66 66__printf(3, 4)
67#define P9_DPRINTK(level, format, arg...) \ 67void _p9_debug(enum p9_debug_flags level, const char *func,
68do { \ 68 const char *fmt, ...);
69 if ((p9_debug_level & level) == level) {\ 69#define p9_debug(level, fmt, ...) \
70 if (level == P9_DEBUG_9P) \ 70 _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
71 printk(KERN_NOTICE "(%8.8d) " \
72 format , task_pid_nr(current) , ## arg); \
73 else \
74 printk(KERN_NOTICE "-- %s (%d): " \
75 format , __func__, task_pid_nr(current) , ## arg); \
76 } \
77} while (0)
78
79#else 71#else
80#define P9_DPRINTK(level, format, arg...) do { } while (0) 72#define p9_debug(level, fmt, ...) \
73 no_printk(fmt, ##__VA_ARGS__)
81#endif 74#endif
82 75
83
84#define P9_EPRINTK(level, format, arg...) \
85do { \
86 printk(level "9p: %s (%d): " \
87 format , __func__, task_pid_nr(current), ## arg); \
88} while (0)
89
90/** 76/**
91 * enum p9_msg_t - 9P message types 77 * enum p9_msg_t - 9P message types
92 * @P9_TLERROR: not used 78 * @P9_TLERROR: not used
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index cbc6bb0a6838..f68dce2d8d88 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -151,7 +151,8 @@ extern int ipv6_chk_mcast_addr(struct net_device *dev,
151 const struct in6_addr *src_addr); 151 const struct in6_addr *src_addr);
152extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); 152extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr);
153 153
154extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); 154extern void addrconf_prefix_rcv(struct net_device *dev,
155 u8 *opt, int len, bool sllao);
155 156
156/* 157/*
157 * anycast prototypes (anycast.c) 158 * anycast prototypes (anycast.c)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 91ab5b01678a..5a4e29b168c9 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -11,10 +11,13 @@ extern void unix_notinflight(struct file *fp);
11extern void unix_gc(void); 11extern void unix_gc(void);
12extern void wait_for_unix_gc(void); 12extern void wait_for_unix_gc(void);
13extern struct sock *unix_get_socket(struct file *filp); 13extern struct sock *unix_get_socket(struct file *filp);
14extern struct sock *unix_peer_get(struct sock *);
14 15
15#define UNIX_HASH_SIZE 256 16#define UNIX_HASH_SIZE 256
16 17
17extern unsigned int unix_tot_inflight; 18extern unsigned int unix_tot_inflight;
19extern spinlock_t unix_table_lock;
20extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
18 21
19struct unix_address { 22struct unix_address {
20 atomic_t refcnt; 23 atomic_t refcnt;
@@ -63,6 +66,9 @@ struct unix_sock {
63 66
64#define peer_wait peer_wq.wait 67#define peer_wait peer_wq.wait
65 68
69long unix_inq_len(struct sock *sk);
70long unix_outq_len(struct sock *sk);
71
66#ifdef CONFIG_SYSCTL 72#ifdef CONFIG_SYSCTL
67extern int unix_sysctl_register(struct net *net); 73extern int unix_sysctl_register(struct net *net);
68extern void unix_sysctl_unregister(struct net *net); 74extern void unix_sysctl_unregister(struct net *net);
diff --git a/include/net/arp.h b/include/net/arp.h
index 4979af8b1559..0013dc87940b 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -23,7 +23,7 @@ static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, str
23 23
24 rcu_read_lock_bh(); 24 rcu_read_lock_bh();
25 nht = rcu_dereference_bh(tbl->nht); 25 nht = rcu_dereference_bh(tbl->nht);
26 hash_val = arp_hashfn(key, dev, nht->hash_rnd) >> (32 - nht->hash_shift); 26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); 27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
28 n != NULL; 28 n != NULL;
29 n = rcu_dereference_bh(n->next)) { 29 n = rcu_dereference_bh(n->next)) {
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 497ef6444a7a..5865924d4aac 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -15,7 +15,6 @@
15 15
16 16
17#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) 17#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back))
18#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key)
19 18
20struct sk_buff; 19struct sk_buff;
21 20
@@ -36,24 +35,18 @@ struct clip_vcc {
36 35
37 36
38struct atmarp_entry { 37struct atmarp_entry {
39 __be32 ip; /* IP address */
40 struct clip_vcc *vccs; /* active VCCs; NULL if resolution is 38 struct clip_vcc *vccs; /* active VCCs; NULL if resolution is
41 pending */ 39 pending */
42 unsigned long expires; /* entry expiration time */ 40 unsigned long expires; /* entry expiration time */
43 struct neighbour *neigh; /* neighbour back-pointer */ 41 struct neighbour *neigh; /* neighbour back-pointer */
44}; 42};
45 43
46
47#define PRIV(dev) ((struct clip_priv *) netdev_priv(dev)) 44#define PRIV(dev) ((struct clip_priv *) netdev_priv(dev))
48 45
49
50struct clip_priv { 46struct clip_priv {
51 int number; /* for convenience ... */ 47 int number; /* for convenience ... */
52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */ 48 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */
53 struct net_device *next; /* next CLIP interface */ 49 struct net_device *next; /* next CLIP interface */
54}; 50};
55 51
56
57extern struct neigh_table *clip_tbl_hook;
58
59#endif 52#endif
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index e86af08293a8..abaad6ed9b83 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -36,6 +36,11 @@
36#define PF_BLUETOOTH AF_BLUETOOTH 36#define PF_BLUETOOTH AF_BLUETOOTH
37#endif 37#endif
38 38
39/* Bluetooth versions */
40#define BLUETOOTH_VER_1_1 1
41#define BLUETOOTH_VER_1_2 2
42#define BLUETOOTH_VER_2_0 3
43
39/* Reserv for core and drivers use */ 44/* Reserv for core and drivers use */
40#define BT_SKB_RESERVE 8 45#define BT_SKB_RESERVE 8
41 46
@@ -77,6 +82,33 @@ struct bt_power {
77#define BT_POWER_FORCE_ACTIVE_OFF 0 82#define BT_POWER_FORCE_ACTIVE_OFF 0
78#define BT_POWER_FORCE_ACTIVE_ON 1 83#define BT_POWER_FORCE_ACTIVE_ON 1
79 84
85#define BT_CHANNEL_POLICY 10
86
87/* BR/EDR only (default policy)
88 * AMP controllers cannot be used.
89 * Channel move requests from the remote device are denied.
90 * If the L2CAP channel is currently using AMP, move the channel to BR/EDR.
91 */
92#define BT_CHANNEL_POLICY_BREDR_ONLY 0
93
94/* BR/EDR Preferred
95 * Allow use of AMP controllers.
96 * If the L2CAP channel is currently on AMP, move it to BR/EDR.
97 * Channel move requests from the remote device are allowed.
98 */
99#define BT_CHANNEL_POLICY_BREDR_PREFERRED 1
100
101/* AMP Preferred
102 * Allow use of AMP controllers
103 * If the L2CAP channel is currently on BR/EDR and AMP controller
104 * resources are available, initiate a channel move to AMP.
105 * Channel move requests from the remote device are allowed.
106 * If the L2CAP socket has not been connected yet, try to create
107 * and configure the channel directly on an AMP controller rather
108 * than BR/EDR.
109 */
110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
111
80__printf(2, 3) 112__printf(2, 3)
81int bt_printk(const char *level, const char *fmt, ...); 113int bt_printk(const char *level, const char *fmt, ...);
82 114
@@ -158,7 +190,7 @@ struct bt_skb_cb {
158 __u8 pkt_type; 190 __u8 pkt_type;
159 __u8 incoming; 191 __u8 incoming;
160 __u16 expect; 192 __u16 expect;
161 __u8 tx_seq; 193 __u16 tx_seq;
162 __u8 retries; 194 __u8 retries;
163 __u8 sar; 195 __u8 sar;
164 unsigned short channel; 196 unsigned short channel;
@@ -218,32 +250,10 @@ extern void bt_sysfs_cleanup(void);
218 250
219extern struct dentry *bt_debugfs; 251extern struct dentry *bt_debugfs;
220 252
221#ifdef CONFIG_BT_L2CAP
222int l2cap_init(void); 253int l2cap_init(void);
223void l2cap_exit(void); 254void l2cap_exit(void);
224#else
225static inline int l2cap_init(void)
226{
227 return 0;
228}
229
230static inline void l2cap_exit(void)
231{
232}
233#endif
234 255
235#ifdef CONFIG_BT_SCO
236int sco_init(void); 256int sco_init(void);
237void sco_exit(void); 257void sco_exit(void);
238#else
239static inline int sco_init(void)
240{
241 return 0;
242}
243
244static inline void sco_exit(void)
245{
246}
247#endif
248 258
249#endif /* __BLUETOOTH_H */ 259#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index aaf79af72432..5b2fed5eebf2 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -88,6 +88,14 @@ enum {
88 HCI_RESET, 88 HCI_RESET,
89}; 89};
90 90
91/*
92 * BR/EDR and/or LE controller flags: the flags defined here should represent
93 * states from the controller.
94 */
95enum {
96 HCI_LE_SCAN,
97};
98
91/* HCI ioctl defines */ 99/* HCI ioctl defines */
92#define HCIDEVUP _IOW('H', 201, int) 100#define HCIDEVUP _IOW('H', 201, int)
93#define HCIDEVDOWN _IOW('H', 202, int) 101#define HCIDEVDOWN _IOW('H', 202, int)
@@ -202,6 +210,7 @@ enum {
202 210
203#define LMP_EV4 0x01 211#define LMP_EV4 0x01
204#define LMP_EV5 0x02 212#define LMP_EV5 0x02
213#define LMP_NO_BREDR 0x20
205#define LMP_LE 0x40 214#define LMP_LE 0x40
206 215
207#define LMP_SNIFF_SUBR 0x02 216#define LMP_SNIFF_SUBR 0x02
@@ -264,6 +273,17 @@ enum {
264#define HCI_LK_SMP_IRK 0x82 273#define HCI_LK_SMP_IRK 0x82
265#define HCI_LK_SMP_CSRK 0x83 274#define HCI_LK_SMP_CSRK 0x83
266 275
276/* ---- HCI Error Codes ---- */
277#define HCI_ERROR_AUTH_FAILURE 0x05
278#define HCI_ERROR_REJ_BAD_ADDR 0x0f
279#define HCI_ERROR_REMOTE_USER_TERM 0x13
280#define HCI_ERROR_LOCAL_HOST_TERM 0x16
281#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
282
283/* Flow control modes */
284#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
285#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
286
267/* ----- HCI Commands ---- */ 287/* ----- HCI Commands ---- */
268#define HCI_OP_NOP 0x0000 288#define HCI_OP_NOP 0x0000
269 289
@@ -446,6 +466,14 @@ struct hci_rp_user_confirm_reply {
446 466
447#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 467#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
448 468
469#define HCI_OP_USER_PASSKEY_REPLY 0x042e
470struct hci_cp_user_passkey_reply {
471 bdaddr_t bdaddr;
472 __le32 passkey;
473} __packed;
474
475#define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f
476
449#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 477#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
450struct hci_cp_remote_oob_data_reply { 478struct hci_cp_remote_oob_data_reply {
451 bdaddr_t bdaddr; 479 bdaddr_t bdaddr;
@@ -662,6 +690,12 @@ struct hci_rp_read_local_oob_data {
662 690
663#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 691#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
664 692
693#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
694struct hci_rp_read_flow_control_mode {
695 __u8 status;
696 __u8 mode;
697} __packed;
698
665#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 699#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
666struct hci_cp_write_le_host_supported { 700struct hci_cp_write_le_host_supported {
667 __u8 le; 701 __u8 le;
@@ -716,6 +750,14 @@ struct hci_rp_read_bd_addr {
716 bdaddr_t bdaddr; 750 bdaddr_t bdaddr;
717} __packed; 751} __packed;
718 752
753#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
754struct hci_rp_read_data_block_size {
755 __u8 status;
756 __le16 max_acl_len;
757 __le16 block_len;
758 __le16 num_blocks;
759} __packed;
760
719#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 761#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
720struct hci_cp_write_page_scan_activity { 762struct hci_cp_write_page_scan_activity {
721 __le16 interval; 763 __le16 interval;
@@ -726,6 +768,21 @@ struct hci_cp_write_page_scan_activity {
726 #define PAGE_SCAN_TYPE_STANDARD 0x00 768 #define PAGE_SCAN_TYPE_STANDARD 0x00
727 #define PAGE_SCAN_TYPE_INTERLACED 0x01 769 #define PAGE_SCAN_TYPE_INTERLACED 0x01
728 770
771#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
772struct hci_rp_read_local_amp_info {
773 __u8 status;
774 __u8 amp_status;
775 __le32 total_bw;
776 __le32 max_bw;
777 __le32 min_latency;
778 __le32 max_pdu;
779 __u8 amp_type;
780 __le16 pal_cap;
781 __le16 max_assoc_size;
782 __le32 max_flush_to;
783 __le32 be_flush_to;
784} __packed;
785
729#define HCI_OP_LE_SET_EVENT_MASK 0x2001 786#define HCI_OP_LE_SET_EVENT_MASK 0x2001
730struct hci_cp_le_set_event_mask { 787struct hci_cp_le_set_event_mask {
731 __u8 mask[8]; 788 __u8 mask[8];
@@ -738,6 +795,18 @@ struct hci_rp_le_read_buffer_size {
738 __u8 le_max_pkt; 795 __u8 le_max_pkt;
739} __packed; 796} __packed;
740 797
798#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
799struct hci_cp_le_set_scan_param {
800 __u8 type;
801 __le16 interval;
802 __le16 window;
803 __u8 own_address_type;
804 __u8 filter_policy;
805} __packed;
806
807#define LE_SCANNING_DISABLED 0x00
808#define LE_SCANNING_ENABLED 0x01
809
741#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 810#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
742struct hci_cp_le_set_scan_enable { 811struct hci_cp_le_set_scan_enable {
743 __u8 enable; 812 __u8 enable;
@@ -913,9 +982,14 @@ struct hci_ev_role_change {
913} __packed; 982} __packed;
914 983
915#define HCI_EV_NUM_COMP_PKTS 0x13 984#define HCI_EV_NUM_COMP_PKTS 0x13
985struct hci_comp_pkts_info {
986 __le16 handle;
987 __le16 count;
988} __packed;
989
916struct hci_ev_num_comp_pkts { 990struct hci_ev_num_comp_pkts {
917 __u8 num_hndl; 991 __u8 num_hndl;
918 /* variable length part */ 992 struct hci_comp_pkts_info handles[0];
919} __packed; 993} __packed;
920 994
921#define HCI_EV_MODE_CHANGE 0x14 995#define HCI_EV_MODE_CHANGE 0x14
@@ -1054,6 +1128,11 @@ struct hci_ev_user_confirm_req {
1054 __le32 passkey; 1128 __le32 passkey;
1055} __packed; 1129} __packed;
1056 1130
1131#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1132struct hci_ev_user_passkey_req {
1133 bdaddr_t bdaddr;
1134} __packed;
1135
1057#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 1136#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1058struct hci_ev_remote_oob_data_request { 1137struct hci_ev_remote_oob_data_request {
1059 bdaddr_t bdaddr; 1138 bdaddr_t bdaddr;
@@ -1309,4 +1388,6 @@ struct hci_inquiry_req {
1309}; 1388};
1310#define IREQ_CACHE_FLUSH 0x0001 1389#define IREQ_CACHE_FLUSH 0x0001
1311 1390
1391extern int enable_hs;
1392
1312#endif /* __HCI_H */ 1393#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 3779ea362257..ea9231f4935f 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -28,9 +28,8 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <net/bluetooth/hci.h> 29#include <net/bluetooth/hci.h>
30 30
31/* HCI upper protocols */ 31/* HCI priority */
32#define HCI_PROTO_L2CAP 0 32#define HCI_PRIO_MAX 7
33#define HCI_PROTO_SCO 1
34 33
35/* HCI Core structures */ 34/* HCI Core structures */
36struct inquiry_data { 35struct inquiry_data {
@@ -51,14 +50,12 @@ struct inquiry_entry {
51}; 50};
52 51
53struct inquiry_cache { 52struct inquiry_cache {
54 spinlock_t lock;
55 __u32 timestamp; 53 __u32 timestamp;
56 struct inquiry_entry *list; 54 struct inquiry_entry *list;
57}; 55};
58 56
59struct hci_conn_hash { 57struct hci_conn_hash {
60 struct list_head list; 58 struct list_head list;
61 spinlock_t lock;
62 unsigned int acl_num; 59 unsigned int acl_num;
63 unsigned int sco_num; 60 unsigned int sco_num;
64 unsigned int le_num; 61 unsigned int le_num;
@@ -115,7 +112,7 @@ struct adv_entry {
115#define NUM_REASSEMBLY 4 112#define NUM_REASSEMBLY 4
116struct hci_dev { 113struct hci_dev {
117 struct list_head list; 114 struct list_head list;
118 spinlock_t lock; 115 struct mutex lock;
119 atomic_t refcnt; 116 atomic_t refcnt;
120 117
121 char name[8]; 118 char name[8];
@@ -130,7 +127,7 @@ struct hci_dev {
130 __u8 major_class; 127 __u8 major_class;
131 __u8 minor_class; 128 __u8 minor_class;
132 __u8 features[8]; 129 __u8 features[8];
133 __u8 extfeatures[8]; 130 __u8 host_features[8];
134 __u8 commands[64]; 131 __u8 commands[64];
135 __u8 ssp_mode; 132 __u8 ssp_mode;
136 __u8 hci_ver; 133 __u8 hci_ver;
@@ -150,6 +147,19 @@ struct hci_dev {
150 __u16 sniff_min_interval; 147 __u16 sniff_min_interval;
151 __u16 sniff_max_interval; 148 __u16 sniff_max_interval;
152 149
150 __u8 amp_status;
151 __u32 amp_total_bw;
152 __u32 amp_max_bw;
153 __u32 amp_min_latency;
154 __u32 amp_max_pdu;
155 __u8 amp_type;
156 __u16 amp_pal_cap;
157 __u16 amp_assoc_size;
158 __u32 amp_max_flush_to;
159 __u32 amp_be_flush_to;
160
161 __u8 flow_ctl_mode;
162
153 unsigned int auto_accept_delay; 163 unsigned int auto_accept_delay;
154 164
155 unsigned long quirks; 165 unsigned long quirks;
@@ -166,6 +176,11 @@ struct hci_dev {
166 unsigned int sco_pkts; 176 unsigned int sco_pkts;
167 unsigned int le_pkts; 177 unsigned int le_pkts;
168 178
179 __u16 block_len;
180 __u16 block_mtu;
181 __u16 num_blocks;
182 __u16 block_cnt;
183
169 unsigned long acl_last_tx; 184 unsigned long acl_last_tx;
170 unsigned long sco_last_tx; 185 unsigned long sco_last_tx;
171 unsigned long le_last_tx; 186 unsigned long le_last_tx;
@@ -173,13 +188,18 @@ struct hci_dev {
173 struct workqueue_struct *workqueue; 188 struct workqueue_struct *workqueue;
174 189
175 struct work_struct power_on; 190 struct work_struct power_on;
176 struct work_struct power_off; 191 struct delayed_work power_off;
177 struct timer_list off_timer; 192
193 __u16 discov_timeout;
194 struct delayed_work discov_off;
195
196 struct delayed_work service_cache;
178 197
179 struct timer_list cmd_timer; 198 struct timer_list cmd_timer;
180 struct tasklet_struct cmd_task; 199
181 struct tasklet_struct rx_task; 200 struct work_struct rx_work;
182 struct tasklet_struct tx_task; 201 struct work_struct cmd_work;
202 struct work_struct tx_work;
183 203
184 struct sk_buff_head rx_q; 204 struct sk_buff_head rx_q;
185 struct sk_buff_head raw_q; 205 struct sk_buff_head raw_q;
@@ -195,6 +215,8 @@ struct hci_dev {
195 215
196 __u16 init_last_cmd; 216 __u16 init_last_cmd;
197 217
218 struct list_head mgmt_pending;
219
198 struct inquiry_cache inq_cache; 220 struct inquiry_cache inq_cache;
199 struct hci_conn_hash conn_hash; 221 struct hci_conn_hash conn_hash;
200 struct list_head blacklist; 222 struct list_head blacklist;
@@ -206,7 +228,7 @@ struct hci_dev {
206 struct list_head remote_oob_data; 228 struct list_head remote_oob_data;
207 229
208 struct list_head adv_entries; 230 struct list_head adv_entries;
209 struct timer_list adv_timer; 231 struct delayed_work adv_work;
210 232
211 struct hci_dev_stats stat; 233 struct hci_dev_stats stat;
212 234
@@ -226,6 +248,8 @@ struct hci_dev {
226 248
227 struct module *owner; 249 struct module *owner;
228 250
251 unsigned long dev_flags;
252
229 int (*open)(struct hci_dev *hdev); 253 int (*open)(struct hci_dev *hdev);
230 int (*close)(struct hci_dev *hdev); 254 int (*close)(struct hci_dev *hdev);
231 int (*flush)(struct hci_dev *hdev); 255 int (*flush)(struct hci_dev *hdev);
@@ -273,20 +297,19 @@ struct hci_conn {
273 unsigned int sent; 297 unsigned int sent;
274 298
275 struct sk_buff_head data_q; 299 struct sk_buff_head data_q;
300 struct list_head chan_list;
276 301
277 struct timer_list disc_timer; 302 struct delayed_work disc_work;
278 struct timer_list idle_timer; 303 struct timer_list idle_timer;
279 struct timer_list auto_accept_timer; 304 struct timer_list auto_accept_timer;
280 305
281 struct work_struct work_add;
282 struct work_struct work_del;
283
284 struct device dev; 306 struct device dev;
285 atomic_t devref; 307 atomic_t devref;
286 308
287 struct hci_dev *hdev; 309 struct hci_dev *hdev;
288 void *l2cap_data; 310 void *l2cap_data;
289 void *sco_data; 311 void *sco_data;
312 void *smp_conn;
290 313
291 struct hci_conn *link; 314 struct hci_conn *link;
292 315
@@ -295,25 +318,39 @@ struct hci_conn {
295 void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason); 318 void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason);
296}; 319};
297 320
298extern struct hci_proto *hci_proto[]; 321struct hci_chan {
322 struct list_head list;
323
324 struct hci_conn *conn;
325 struct sk_buff_head data_q;
326 unsigned int sent;
327};
328
299extern struct list_head hci_dev_list; 329extern struct list_head hci_dev_list;
300extern struct list_head hci_cb_list; 330extern struct list_head hci_cb_list;
301extern rwlock_t hci_dev_list_lock; 331extern rwlock_t hci_dev_list_lock;
302extern rwlock_t hci_cb_list_lock; 332extern rwlock_t hci_cb_list_lock;
303 333
334/* ----- HCI interface to upper protocols ----- */
335extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
336extern int l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
337extern int l2cap_disconn_ind(struct hci_conn *hcon);
338extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
339extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
340extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
341
342extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
343extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status);
344extern int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
345extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
346
304/* ----- Inquiry cache ----- */ 347/* ----- Inquiry cache ----- */
305#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 348#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
306#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ 349#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */
307 350
308#define inquiry_cache_lock(c) spin_lock(&c->lock)
309#define inquiry_cache_unlock(c) spin_unlock(&c->lock)
310#define inquiry_cache_lock_bh(c) spin_lock_bh(&c->lock)
311#define inquiry_cache_unlock_bh(c) spin_unlock_bh(&c->lock)
312
313static inline void inquiry_cache_init(struct hci_dev *hdev) 351static inline void inquiry_cache_init(struct hci_dev *hdev)
314{ 352{
315 struct inquiry_cache *c = &hdev->inq_cache; 353 struct inquiry_cache *c = &hdev->inq_cache;
316 spin_lock_init(&c->lock);
317 c->list = NULL; 354 c->list = NULL;
318} 355}
319 356
@@ -353,15 +390,15 @@ static inline void hci_conn_hash_init(struct hci_dev *hdev)
353{ 390{
354 struct hci_conn_hash *h = &hdev->conn_hash; 391 struct hci_conn_hash *h = &hdev->conn_hash;
355 INIT_LIST_HEAD(&h->list); 392 INIT_LIST_HEAD(&h->list);
356 spin_lock_init(&h->lock);
357 h->acl_num = 0; 393 h->acl_num = 0;
358 h->sco_num = 0; 394 h->sco_num = 0;
395 h->le_num = 0;
359} 396}
360 397
361static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) 398static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
362{ 399{
363 struct hci_conn_hash *h = &hdev->conn_hash; 400 struct hci_conn_hash *h = &hdev->conn_hash;
364 list_add(&c->list, &h->list); 401 list_add_rcu(&c->list, &h->list);
365 switch (c->type) { 402 switch (c->type) {
366 case ACL_LINK: 403 case ACL_LINK:
367 h->acl_num++; 404 h->acl_num++;
@@ -379,7 +416,10 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
379static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) 416static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
380{ 417{
381 struct hci_conn_hash *h = &hdev->conn_hash; 418 struct hci_conn_hash *h = &hdev->conn_hash;
382 list_del(&c->list); 419
420 list_del_rcu(&c->list);
421 synchronize_rcu();
422
383 switch (c->type) { 423 switch (c->type) {
384 case ACL_LINK: 424 case ACL_LINK:
385 h->acl_num--; 425 h->acl_num--;
@@ -414,14 +454,18 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
414 __u16 handle) 454 __u16 handle)
415{ 455{
416 struct hci_conn_hash *h = &hdev->conn_hash; 456 struct hci_conn_hash *h = &hdev->conn_hash;
417 struct list_head *p;
418 struct hci_conn *c; 457 struct hci_conn *c;
419 458
420 list_for_each(p, &h->list) { 459 rcu_read_lock();
421 c = list_entry(p, struct hci_conn, list); 460
422 if (c->handle == handle) 461 list_for_each_entry_rcu(c, &h->list, list) {
462 if (c->handle == handle) {
463 rcu_read_unlock();
423 return c; 464 return c;
465 }
424 } 466 }
467 rcu_read_unlock();
468
425 return NULL; 469 return NULL;
426} 470}
427 471
@@ -429,14 +473,19 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
429 __u8 type, bdaddr_t *ba) 473 __u8 type, bdaddr_t *ba)
430{ 474{
431 struct hci_conn_hash *h = &hdev->conn_hash; 475 struct hci_conn_hash *h = &hdev->conn_hash;
432 struct list_head *p;
433 struct hci_conn *c; 476 struct hci_conn *c;
434 477
435 list_for_each(p, &h->list) { 478 rcu_read_lock();
436 c = list_entry(p, struct hci_conn, list); 479
437 if (c->type == type && !bacmp(&c->dst, ba)) 480 list_for_each_entry_rcu(c, &h->list, list) {
481 if (c->type == type && !bacmp(&c->dst, ba)) {
482 rcu_read_unlock();
438 return c; 483 return c;
484 }
439 } 485 }
486
487 rcu_read_unlock();
488
440 return NULL; 489 return NULL;
441} 490}
442 491
@@ -444,14 +493,19 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
444 __u8 type, __u16 state) 493 __u8 type, __u16 state)
445{ 494{
446 struct hci_conn_hash *h = &hdev->conn_hash; 495 struct hci_conn_hash *h = &hdev->conn_hash;
447 struct list_head *p;
448 struct hci_conn *c; 496 struct hci_conn *c;
449 497
450 list_for_each(p, &h->list) { 498 rcu_read_lock();
451 c = list_entry(p, struct hci_conn, list); 499
452 if (c->type == type && c->state == state) 500 list_for_each_entry_rcu(c, &h->list, list) {
501 if (c->type == type && c->state == state) {
502 rcu_read_unlock();
453 return c; 503 return c;
504 }
454 } 505 }
506
507 rcu_read_unlock();
508
455 return NULL; 509 return NULL;
456} 510}
457 511
@@ -466,6 +520,10 @@ int hci_conn_del(struct hci_conn *conn);
466void hci_conn_hash_flush(struct hci_dev *hdev); 520void hci_conn_hash_flush(struct hci_dev *hdev);
467void hci_conn_check_pending(struct hci_dev *hdev); 521void hci_conn_check_pending(struct hci_dev *hdev);
468 522
523struct hci_chan *hci_chan_create(struct hci_conn *conn);
524int hci_chan_del(struct hci_chan *chan);
525void hci_chan_list_flush(struct hci_conn *conn);
526
469struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 527struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
470 __u8 sec_level, __u8 auth_type); 528 __u8 sec_level, __u8 auth_type);
471int hci_conn_check_link_mode(struct hci_conn *conn); 529int hci_conn_check_link_mode(struct hci_conn *conn);
@@ -475,7 +533,6 @@ int hci_conn_change_link_key(struct hci_conn *conn);
475int hci_conn_switch_role(struct hci_conn *conn, __u8 role); 533int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
476 534
477void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 535void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
478void hci_conn_enter_sniff_mode(struct hci_conn *conn);
479 536
480void hci_conn_hold_device(struct hci_conn *conn); 537void hci_conn_hold_device(struct hci_conn *conn);
481void hci_conn_put_device(struct hci_conn *conn); 538void hci_conn_put_device(struct hci_conn *conn);
@@ -483,7 +540,7 @@ void hci_conn_put_device(struct hci_conn *conn);
483static inline void hci_conn_hold(struct hci_conn *conn) 540static inline void hci_conn_hold(struct hci_conn *conn)
484{ 541{
485 atomic_inc(&conn->refcnt); 542 atomic_inc(&conn->refcnt);
486 del_timer(&conn->disc_timer); 543 cancel_delayed_work_sync(&conn->disc_work);
487} 544}
488 545
489static inline void hci_conn_put(struct hci_conn *conn) 546static inline void hci_conn_put(struct hci_conn *conn)
@@ -502,7 +559,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
502 } else { 559 } else {
503 timeo = msecs_to_jiffies(10); 560 timeo = msecs_to_jiffies(10);
504 } 561 }
505 mod_timer(&conn->disc_timer, jiffies + timeo); 562 cancel_delayed_work_sync(&conn->disc_work);
563 queue_delayed_work(conn->hdev->workqueue,
564 &conn->disc_work, jiffies + timeo);
506 } 565 }
507} 566}
508 567
@@ -534,10 +593,8 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
534 try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ 593 try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \
535}) 594})
536 595
537#define hci_dev_lock(d) spin_lock(&d->lock) 596#define hci_dev_lock(d) mutex_lock(&d->lock)
538#define hci_dev_unlock(d) spin_unlock(&d->lock) 597#define hci_dev_unlock(d) mutex_unlock(&d->lock)
539#define hci_dev_lock_bh(d) spin_lock_bh(&d->lock)
540#define hci_dev_unlock_bh(d) spin_unlock_bh(&d->lock)
541 598
542struct hci_dev *hci_dev_get(int index); 599struct hci_dev *hci_dev_get(int index);
543struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 600struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
@@ -545,7 +602,7 @@ struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
545struct hci_dev *hci_alloc_dev(void); 602struct hci_dev *hci_alloc_dev(void);
546void hci_free_dev(struct hci_dev *hdev); 603void hci_free_dev(struct hci_dev *hdev);
547int hci_register_dev(struct hci_dev *hdev); 604int hci_register_dev(struct hci_dev *hdev);
548int hci_unregister_dev(struct hci_dev *hdev); 605void hci_unregister_dev(struct hci_dev *hdev);
549int hci_suspend_dev(struct hci_dev *hdev); 606int hci_suspend_dev(struct hci_dev *hdev);
550int hci_resume_dev(struct hci_dev *hdev); 607int hci_resume_dev(struct hci_dev *hdev);
551int hci_dev_open(__u16 dev); 608int hci_dev_open(__u16 dev);
@@ -599,8 +656,9 @@ int hci_recv_frame(struct sk_buff *skb);
599int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 656int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
600int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); 657int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
601 658
602int hci_register_sysfs(struct hci_dev *hdev); 659void hci_init_sysfs(struct hci_dev *hdev);
603void hci_unregister_sysfs(struct hci_dev *hdev); 660int hci_add_sysfs(struct hci_dev *hdev);
661void hci_del_sysfs(struct hci_dev *hdev);
604void hci_conn_init_sysfs(struct hci_conn *conn); 662void hci_conn_init_sysfs(struct hci_conn *conn);
605void hci_conn_add_sysfs(struct hci_conn *conn); 663void hci_conn_add_sysfs(struct hci_conn *conn);
606void hci_conn_del_sysfs(struct hci_conn *conn); 664void hci_conn_del_sysfs(struct hci_conn *conn);
@@ -618,56 +676,43 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
618#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 676#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
619 677
620/* ----- Extended LMP capabilities ----- */ 678/* ----- Extended LMP capabilities ----- */
621#define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE) 679#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE)
622 680
623/* ----- HCI protocols ----- */ 681/* ----- HCI protocols ----- */
624struct hci_proto {
625 char *name;
626 unsigned int id;
627 unsigned long flags;
628
629 void *priv;
630
631 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr,
632 __u8 type);
633 int (*connect_cfm) (struct hci_conn *conn, __u8 status);
634 int (*disconn_ind) (struct hci_conn *conn);
635 int (*disconn_cfm) (struct hci_conn *conn, __u8 reason);
636 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb,
637 __u16 flags);
638 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb);
639 int (*security_cfm) (struct hci_conn *conn, __u8 status,
640 __u8 encrypt);
641};
642
643static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, 682static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
644 __u8 type) 683 __u8 type)
645{ 684{
646 register struct hci_proto *hp; 685 switch (type) {
647 int mask = 0; 686 case ACL_LINK:
648 687 return l2cap_connect_ind(hdev, bdaddr);
649 hp = hci_proto[HCI_PROTO_L2CAP];
650 if (hp && hp->connect_ind)
651 mask |= hp->connect_ind(hdev, bdaddr, type);
652 688
653 hp = hci_proto[HCI_PROTO_SCO]; 689 case SCO_LINK:
654 if (hp && hp->connect_ind) 690 case ESCO_LINK:
655 mask |= hp->connect_ind(hdev, bdaddr, type); 691 return sco_connect_ind(hdev, bdaddr);
656 692
657 return mask; 693 default:
694 BT_ERR("unknown link type %d", type);
695 return -EINVAL;
696 }
658} 697}
659 698
660static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) 699static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
661{ 700{
662 register struct hci_proto *hp; 701 switch (conn->type) {
702 case ACL_LINK:
703 case LE_LINK:
704 l2cap_connect_cfm(conn, status);
705 break;
663 706
664 hp = hci_proto[HCI_PROTO_L2CAP]; 707 case SCO_LINK:
665 if (hp && hp->connect_cfm) 708 case ESCO_LINK:
666 hp->connect_cfm(conn, status); 709 sco_connect_cfm(conn, status);
710 break;
667 711
668 hp = hci_proto[HCI_PROTO_SCO]; 712 default:
669 if (hp && hp->connect_cfm) 713 BT_ERR("unknown link type %d", conn->type);
670 hp->connect_cfm(conn, status); 714 break;
715 }
671 716
672 if (conn->connect_cfm_cb) 717 if (conn->connect_cfm_cb)
673 conn->connect_cfm_cb(conn, status); 718 conn->connect_cfm_cb(conn, status);
@@ -675,31 +720,29 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
675 720
676static inline int hci_proto_disconn_ind(struct hci_conn *conn) 721static inline int hci_proto_disconn_ind(struct hci_conn *conn)
677{ 722{
678 register struct hci_proto *hp; 723 if (conn->type != ACL_LINK && conn->type != LE_LINK)
679 int reason = 0x13; 724 return HCI_ERROR_REMOTE_USER_TERM;
680
681 hp = hci_proto[HCI_PROTO_L2CAP];
682 if (hp && hp->disconn_ind)
683 reason = hp->disconn_ind(conn);
684 725
685 hp = hci_proto[HCI_PROTO_SCO]; 726 return l2cap_disconn_ind(conn);
686 if (hp && hp->disconn_ind)
687 reason = hp->disconn_ind(conn);
688
689 return reason;
690} 727}
691 728
692static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) 729static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
693{ 730{
694 register struct hci_proto *hp; 731 switch (conn->type) {
732 case ACL_LINK:
733 case LE_LINK:
734 l2cap_disconn_cfm(conn, reason);
735 break;
695 736
696 hp = hci_proto[HCI_PROTO_L2CAP]; 737 case SCO_LINK:
697 if (hp && hp->disconn_cfm) 738 case ESCO_LINK:
698 hp->disconn_cfm(conn, reason); 739 sco_disconn_cfm(conn, reason);
740 break;
699 741
700 hp = hci_proto[HCI_PROTO_SCO]; 742 default:
701 if (hp && hp->disconn_cfm) 743 BT_ERR("unknown link type %d", conn->type);
702 hp->disconn_cfm(conn, reason); 744 break;
745 }
703 746
704 if (conn->disconn_cfm_cb) 747 if (conn->disconn_cfm_cb)
705 conn->disconn_cfm_cb(conn, reason); 748 conn->disconn_cfm_cb(conn, reason);
@@ -707,21 +750,16 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
707 750
708static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 751static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
709{ 752{
710 register struct hci_proto *hp;
711 __u8 encrypt; 753 __u8 encrypt;
712 754
755 if (conn->type != ACL_LINK && conn->type != LE_LINK)
756 return;
757
713 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 758 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
714 return; 759 return;
715 760
716 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 761 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
717 762 l2cap_security_cfm(conn, status, encrypt);
718 hp = hci_proto[HCI_PROTO_L2CAP];
719 if (hp && hp->security_cfm)
720 hp->security_cfm(conn, status, encrypt);
721
722 hp = hci_proto[HCI_PROTO_SCO];
723 if (hp && hp->security_cfm)
724 hp->security_cfm(conn, status, encrypt);
725 763
726 if (conn->security_cfm_cb) 764 if (conn->security_cfm_cb)
727 conn->security_cfm_cb(conn, status); 765 conn->security_cfm_cb(conn, status);
@@ -730,23 +768,15 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
730static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, 768static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status,
731 __u8 encrypt) 769 __u8 encrypt)
732{ 770{
733 register struct hci_proto *hp; 771 if (conn->type != ACL_LINK && conn->type != LE_LINK)
734 772 return;
735 hp = hci_proto[HCI_PROTO_L2CAP];
736 if (hp && hp->security_cfm)
737 hp->security_cfm(conn, status, encrypt);
738 773
739 hp = hci_proto[HCI_PROTO_SCO]; 774 l2cap_security_cfm(conn, status, encrypt);
740 if (hp && hp->security_cfm)
741 hp->security_cfm(conn, status, encrypt);
742 775
743 if (conn->security_cfm_cb) 776 if (conn->security_cfm_cb)
744 conn->security_cfm_cb(conn, status); 777 conn->security_cfm_cb(conn, status);
745} 778}
746 779
747int hci_register_proto(struct hci_proto *hproto);
748int hci_unregister_proto(struct hci_proto *hproto);
749
750/* ----- HCI callbacks ----- */ 780/* ----- HCI callbacks ----- */
751struct hci_cb { 781struct hci_cb {
752 struct list_head list; 782 struct list_head list;
@@ -771,13 +801,13 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
771 801
772 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 802 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
773 803
774 read_lock_bh(&hci_cb_list_lock); 804 read_lock(&hci_cb_list_lock);
775 list_for_each(p, &hci_cb_list) { 805 list_for_each(p, &hci_cb_list) {
776 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 806 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
777 if (cb->security_cfm) 807 if (cb->security_cfm)
778 cb->security_cfm(conn, status, encrypt); 808 cb->security_cfm(conn, status, encrypt);
779 } 809 }
780 read_unlock_bh(&hci_cb_list_lock); 810 read_unlock(&hci_cb_list_lock);
781} 811}
782 812
783static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, 813static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
@@ -793,26 +823,26 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
793 823
794 hci_proto_encrypt_cfm(conn, status, encrypt); 824 hci_proto_encrypt_cfm(conn, status, encrypt);
795 825
796 read_lock_bh(&hci_cb_list_lock); 826 read_lock(&hci_cb_list_lock);
797 list_for_each(p, &hci_cb_list) { 827 list_for_each(p, &hci_cb_list) {
798 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 828 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
799 if (cb->security_cfm) 829 if (cb->security_cfm)
800 cb->security_cfm(conn, status, encrypt); 830 cb->security_cfm(conn, status, encrypt);
801 } 831 }
802 read_unlock_bh(&hci_cb_list_lock); 832 read_unlock(&hci_cb_list_lock);
803} 833}
804 834
805static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) 835static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
806{ 836{
807 struct list_head *p; 837 struct list_head *p;
808 838
809 read_lock_bh(&hci_cb_list_lock); 839 read_lock(&hci_cb_list_lock);
810 list_for_each(p, &hci_cb_list) { 840 list_for_each(p, &hci_cb_list) {
811 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 841 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
812 if (cb->key_change_cfm) 842 if (cb->key_change_cfm)
813 cb->key_change_cfm(conn, status); 843 cb->key_change_cfm(conn, status);
814 } 844 }
815 read_unlock_bh(&hci_cb_list_lock); 845 read_unlock(&hci_cb_list_lock);
816} 846}
817 847
818static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, 848static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
@@ -820,13 +850,13 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
820{ 850{
821 struct list_head *p; 851 struct list_head *p;
822 852
823 read_lock_bh(&hci_cb_list_lock); 853 read_lock(&hci_cb_list_lock);
824 list_for_each(p, &hci_cb_list) { 854 list_for_each(p, &hci_cb_list) {
825 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 855 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
826 if (cb->role_switch_cfm) 856 if (cb->role_switch_cfm)
827 cb->role_switch_cfm(conn, status, role); 857 cb->role_switch_cfm(conn, status, role);
828 } 858 }
829 read_unlock_bh(&hci_cb_list_lock); 859 read_unlock(&hci_cb_list_lock);
830} 860}
831 861
832int hci_register_cb(struct hci_cb *hcb); 862int hci_register_cb(struct hci_cb *hcb);
@@ -836,7 +866,7 @@ int hci_register_notifier(struct notifier_block *nb);
836int hci_unregister_notifier(struct notifier_block *nb); 866int hci_unregister_notifier(struct notifier_block *nb);
837 867
838int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 868int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
839void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 869void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
840void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 870void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
841 871
842void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 872void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
@@ -849,44 +879,63 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
849 879
850/* Management interface */ 880/* Management interface */
851int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 881int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
852int mgmt_index_added(u16 index); 882int mgmt_index_added(struct hci_dev *hdev);
853int mgmt_index_removed(u16 index); 883int mgmt_index_removed(struct hci_dev *hdev);
854int mgmt_powered(u16 index, u8 powered); 884int mgmt_powered(struct hci_dev *hdev, u8 powered);
855int mgmt_discoverable(u16 index, u8 discoverable); 885int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
856int mgmt_connectable(u16 index, u8 connectable); 886int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
857int mgmt_new_key(u16 index, struct link_key *key, u8 persistent); 887int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
858int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type); 888int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
859int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); 889 u8 persistent);
860int mgmt_disconnect_failed(u16 index); 890int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
861int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); 891 u8 addr_type);
862int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); 892int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
863int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 893 u8 addr_type);
864int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 894int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status);
865int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value, 895int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
866 u8 confirm_hint); 896 u8 addr_type, u8 status);
867int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); 897int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
868int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, 898int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
869 u8 status); 899 u8 status);
870int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); 900int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
871int mgmt_set_local_name_complete(u16 index, u8 *name, u8 status);
872int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer,
873 u8 status); 901 u8 status);
874int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, 902int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
875 u8 *eir); 903 __le32 value, u8 confirm_hint);
876int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); 904int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
877int mgmt_discovering(u16 index, u8 discovering); 905 u8 status);
878int mgmt_device_blocked(u16 index, bdaddr_t *bdaddr); 906int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev,
879int mgmt_device_unblocked(u16 index, bdaddr_t *bdaddr); 907 bdaddr_t *bdaddr, u8 status);
908int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr);
909int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
910 u8 status);
911int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev,
912 bdaddr_t *bdaddr, u8 status);
913int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status);
914int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
915int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
916 u8 *randomizer, u8 status);
917int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
918 u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir);
919int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name);
920int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
921int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
922int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
923int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr);
924int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr);
880 925
881/* HCI info for socket */ 926/* HCI info for socket */
882#define hci_pi(sk) ((struct hci_pinfo *) sk) 927#define hci_pi(sk) ((struct hci_pinfo *) sk)
883 928
929/* HCI socket flags */
930#define HCI_PI_MGMT_INIT 0
931
884struct hci_pinfo { 932struct hci_pinfo {
885 struct bt_sock bt; 933 struct bt_sock bt;
886 struct hci_dev *hdev; 934 struct hci_dev *hdev;
887 struct hci_filter filter; 935 struct hci_filter filter;
888 __u32 cmsg_mask; 936 __u32 cmsg_mask;
889 unsigned short channel; 937 unsigned short channel;
938 unsigned long flags;
890}; 939};
891 940
892/* HCI security filter */ 941/* HCI security filter */
@@ -915,4 +964,7 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
915void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]); 964void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]);
916void hci_le_ltk_neg_reply(struct hci_conn *conn); 965void hci_le_ltk_neg_reply(struct hci_conn *conn);
917 966
967int hci_do_inquiry(struct hci_dev *hdev, u8 length);
968int hci_cancel_inquiry(struct hci_dev *hdev);
969
918#endif /* __HCI_CORE_H */ 970#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 6cc18f371675..68f589150692 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -27,17 +27,23 @@
27#ifndef __L2CAP_H 27#ifndef __L2CAP_H
28#define __L2CAP_H 28#define __L2CAP_H
29 29
30#include <asm/unaligned.h>
31
30/* L2CAP defaults */ 32/* L2CAP defaults */
31#define L2CAP_DEFAULT_MTU 672 33#define L2CAP_DEFAULT_MTU 672
32#define L2CAP_DEFAULT_MIN_MTU 48 34#define L2CAP_DEFAULT_MIN_MTU 48
33#define L2CAP_DEFAULT_FLUSH_TO 0xffff 35#define L2CAP_DEFAULT_FLUSH_TO 0xffff
34#define L2CAP_DEFAULT_TX_WINDOW 63 36#define L2CAP_DEFAULT_TX_WINDOW 63
37#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF
35#define L2CAP_DEFAULT_MAX_TX 3 38#define L2CAP_DEFAULT_MAX_TX 3
36#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ 39#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
37#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 40#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 41#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
39#define L2CAP_DEFAULT_ACK_TO 200 42#define L2CAP_DEFAULT_ACK_TO 200
40#define L2CAP_LE_DEFAULT_MTU 23 43#define L2CAP_LE_DEFAULT_MTU 23
44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
41 47
42#define L2CAP_DISC_TIMEOUT (100) 48#define L2CAP_DISC_TIMEOUT (100)
43#define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ 49#define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */
@@ -91,52 +97,82 @@ struct l2cap_conninfo {
91#define L2CAP_ECHO_RSP 0x09 97#define L2CAP_ECHO_RSP 0x09
92#define L2CAP_INFO_REQ 0x0a 98#define L2CAP_INFO_REQ 0x0a
93#define L2CAP_INFO_RSP 0x0b 99#define L2CAP_INFO_RSP 0x0b
100#define L2CAP_CREATE_CHAN_REQ 0x0c
101#define L2CAP_CREATE_CHAN_RSP 0x0d
102#define L2CAP_MOVE_CHAN_REQ 0x0e
103#define L2CAP_MOVE_CHAN_RSP 0x0f
104#define L2CAP_MOVE_CHAN_CFM 0x10
105#define L2CAP_MOVE_CHAN_CFM_RSP 0x11
94#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12 106#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
95#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13 107#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
96 108
97/* L2CAP feature mask */ 109/* L2CAP extended feature mask */
98#define L2CAP_FEAT_FLOWCTL 0x00000001 110#define L2CAP_FEAT_FLOWCTL 0x00000001
99#define L2CAP_FEAT_RETRANS 0x00000002 111#define L2CAP_FEAT_RETRANS 0x00000002
112#define L2CAP_FEAT_BIDIR_QOS 0x00000004
100#define L2CAP_FEAT_ERTM 0x00000008 113#define L2CAP_FEAT_ERTM 0x00000008
101#define L2CAP_FEAT_STREAMING 0x00000010 114#define L2CAP_FEAT_STREAMING 0x00000010
102#define L2CAP_FEAT_FCS 0x00000020 115#define L2CAP_FEAT_FCS 0x00000020
116#define L2CAP_FEAT_EXT_FLOW 0x00000040
103#define L2CAP_FEAT_FIXED_CHAN 0x00000080 117#define L2CAP_FEAT_FIXED_CHAN 0x00000080
118#define L2CAP_FEAT_EXT_WINDOW 0x00000100
119#define L2CAP_FEAT_UCD 0x00000200
104 120
105/* L2CAP checksum option */ 121/* L2CAP checksum option */
106#define L2CAP_FCS_NONE 0x00 122#define L2CAP_FCS_NONE 0x00
107#define L2CAP_FCS_CRC16 0x01 123#define L2CAP_FCS_CRC16 0x01
108 124
125/* L2CAP fixed channels */
126#define L2CAP_FC_L2CAP 0x02
127#define L2CAP_FC_A2MP 0x08
128
109/* L2CAP Control Field bit masks */ 129/* L2CAP Control Field bit masks */
110#define L2CAP_CTRL_SAR 0xC000 130#define L2CAP_CTRL_SAR 0xC000
111#define L2CAP_CTRL_REQSEQ 0x3F00 131#define L2CAP_CTRL_REQSEQ 0x3F00
112#define L2CAP_CTRL_TXSEQ 0x007E 132#define L2CAP_CTRL_TXSEQ 0x007E
113#define L2CAP_CTRL_RETRANS 0x0080 133#define L2CAP_CTRL_SUPERVISE 0x000C
114#define L2CAP_CTRL_FINAL 0x0080 134
115#define L2CAP_CTRL_POLL 0x0010 135#define L2CAP_CTRL_RETRANS 0x0080
116#define L2CAP_CTRL_SUPERVISE 0x000C 136#define L2CAP_CTRL_FINAL 0x0080
117#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */ 137#define L2CAP_CTRL_POLL 0x0010
118 138#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */
119#define L2CAP_CTRL_TXSEQ_SHIFT 1 139
120#define L2CAP_CTRL_REQSEQ_SHIFT 8 140#define L2CAP_CTRL_TXSEQ_SHIFT 1
121#define L2CAP_CTRL_SAR_SHIFT 14 141#define L2CAP_CTRL_SUPER_SHIFT 2
142#define L2CAP_CTRL_REQSEQ_SHIFT 8
143#define L2CAP_CTRL_SAR_SHIFT 14
144
145/* L2CAP Extended Control Field bit mask */
146#define L2CAP_EXT_CTRL_TXSEQ 0xFFFC0000
147#define L2CAP_EXT_CTRL_SAR 0x00030000
148#define L2CAP_EXT_CTRL_SUPERVISE 0x00030000
149#define L2CAP_EXT_CTRL_REQSEQ 0x0000FFFC
150
151#define L2CAP_EXT_CTRL_POLL 0x00040000
152#define L2CAP_EXT_CTRL_FINAL 0x00000002
153#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */
154
155#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
156#define L2CAP_EXT_CTRL_SAR_SHIFT 16
157#define L2CAP_EXT_CTRL_SUPER_SHIFT 16
158#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
122 159
123/* L2CAP Supervisory Function */ 160/* L2CAP Supervisory Function */
124#define L2CAP_SUPER_RCV_READY 0x0000 161#define L2CAP_SUPER_RR 0x00
125#define L2CAP_SUPER_REJECT 0x0004 162#define L2CAP_SUPER_REJ 0x01
126#define L2CAP_SUPER_RCV_NOT_READY 0x0008 163#define L2CAP_SUPER_RNR 0x02
127#define L2CAP_SUPER_SELECT_REJECT 0x000C 164#define L2CAP_SUPER_SREJ 0x03
128 165
129/* L2CAP Segmentation and Reassembly */ 166/* L2CAP Segmentation and Reassembly */
130#define L2CAP_SDU_UNSEGMENTED 0x0000 167#define L2CAP_SAR_UNSEGMENTED 0x00
131#define L2CAP_SDU_START 0x4000 168#define L2CAP_SAR_START 0x01
132#define L2CAP_SDU_END 0x8000 169#define L2CAP_SAR_END 0x02
133#define L2CAP_SDU_CONTINUE 0xC000 170#define L2CAP_SAR_CONTINUE 0x03
134 171
135/* L2CAP Command rej. reasons */ 172/* L2CAP Command rej. reasons */
136#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000 173#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
137#define L2CAP_REJ_MTU_EXCEEDED 0x0001 174#define L2CAP_REJ_MTU_EXCEEDED 0x0001
138#define L2CAP_REJ_INVALID_CID 0x0002 175#define L2CAP_REJ_INVALID_CID 0x0002
139
140 176
141/* L2CAP structures */ 177/* L2CAP structures */
142struct l2cap_hdr { 178struct l2cap_hdr {
@@ -144,6 +180,12 @@ struct l2cap_hdr {
144 __le16 cid; 180 __le16 cid;
145} __packed; 181} __packed;
146#define L2CAP_HDR_SIZE 4 182#define L2CAP_HDR_SIZE 4
183#define L2CAP_ENH_HDR_SIZE 6
184#define L2CAP_EXT_HDR_SIZE 8
185
186#define L2CAP_FCS_SIZE 2
187#define L2CAP_SDULEN_SIZE 2
188#define L2CAP_PSMLEN_SIZE 2
147 189
148struct l2cap_cmd_hdr { 190struct l2cap_cmd_hdr {
149 __u8 code; 191 __u8 code;
@@ -188,14 +230,15 @@ struct l2cap_conn_rsp {
188#define L2CAP_CID_DYN_START 0x0040 230#define L2CAP_CID_DYN_START 0x0040
189#define L2CAP_CID_DYN_END 0xffff 231#define L2CAP_CID_DYN_END 0xffff
190 232
191/* connect result */ 233/* connect/create channel results */
192#define L2CAP_CR_SUCCESS 0x0000 234#define L2CAP_CR_SUCCESS 0x0000
193#define L2CAP_CR_PEND 0x0001 235#define L2CAP_CR_PEND 0x0001
194#define L2CAP_CR_BAD_PSM 0x0002 236#define L2CAP_CR_BAD_PSM 0x0002
195#define L2CAP_CR_SEC_BLOCK 0x0003 237#define L2CAP_CR_SEC_BLOCK 0x0003
196#define L2CAP_CR_NO_MEM 0x0004 238#define L2CAP_CR_NO_MEM 0x0004
239#define L2CAP_CR_BAD_AMP 0x0005
197 240
198/* connect status */ 241/* connect/create channel status */
199#define L2CAP_CS_NO_INFO 0x0000 242#define L2CAP_CS_NO_INFO 0x0000
200#define L2CAP_CS_AUTHEN_PEND 0x0001 243#define L2CAP_CS_AUTHEN_PEND 0x0001
201#define L2CAP_CS_AUTHOR_PEND 0x0002 244#define L2CAP_CS_AUTHOR_PEND 0x0002
@@ -217,6 +260,8 @@ struct l2cap_conf_rsp {
217#define L2CAP_CONF_UNACCEPT 0x0001 260#define L2CAP_CONF_UNACCEPT 0x0001
218#define L2CAP_CONF_REJECT 0x0002 261#define L2CAP_CONF_REJECT 0x0002
219#define L2CAP_CONF_UNKNOWN 0x0003 262#define L2CAP_CONF_UNKNOWN 0x0003
263#define L2CAP_CONF_PENDING 0x0004
264#define L2CAP_CONF_EFS_REJECT 0x0005
220 265
221struct l2cap_conf_opt { 266struct l2cap_conf_opt {
222 __u8 type; 267 __u8 type;
@@ -233,6 +278,8 @@ struct l2cap_conf_opt {
233#define L2CAP_CONF_QOS 0x03 278#define L2CAP_CONF_QOS 0x03
234#define L2CAP_CONF_RFC 0x04 279#define L2CAP_CONF_RFC 0x04
235#define L2CAP_CONF_FCS 0x05 280#define L2CAP_CONF_FCS 0x05
281#define L2CAP_CONF_EFS 0x06
282#define L2CAP_CONF_EWS 0x07
236 283
237#define L2CAP_CONF_MAX_SIZE 22 284#define L2CAP_CONF_MAX_SIZE 22
238 285
@@ -251,6 +298,21 @@ struct l2cap_conf_rfc {
251#define L2CAP_MODE_ERTM 0x03 298#define L2CAP_MODE_ERTM 0x03
252#define L2CAP_MODE_STREAMING 0x04 299#define L2CAP_MODE_STREAMING 0x04
253 300
301struct l2cap_conf_efs {
302 __u8 id;
303 __u8 stype;
304 __le16 msdu;
305 __le32 sdu_itime;
306 __le32 acc_lat;
307 __le32 flush_to;
308} __packed;
309
310#define L2CAP_SERV_NOTRAFIC 0x00
311#define L2CAP_SERV_BESTEFFORT 0x01
312#define L2CAP_SERV_GUARANTEED 0x02
313
314#define L2CAP_BESTEFFORT_ID 0x01
315
254struct l2cap_disconn_req { 316struct l2cap_disconn_req {
255 __le16 dcid; 317 __le16 dcid;
256 __le16 scid; 318 __le16 scid;
@@ -271,14 +333,57 @@ struct l2cap_info_rsp {
271 __u8 data[0]; 333 __u8 data[0];
272} __packed; 334} __packed;
273 335
336struct l2cap_create_chan_req {
337 __le16 psm;
338 __le16 scid;
339 __u8 amp_id;
340} __packed;
341
342struct l2cap_create_chan_rsp {
343 __le16 dcid;
344 __le16 scid;
345 __le16 result;
346 __le16 status;
347} __packed;
348
349struct l2cap_move_chan_req {
350 __le16 icid;
351 __u8 dest_amp_id;
352} __packed;
353
354struct l2cap_move_chan_rsp {
355 __le16 icid;
356 __le16 result;
357} __packed;
358
359#define L2CAP_MR_SUCCESS 0x0000
360#define L2CAP_MR_PEND 0x0001
361#define L2CAP_MR_BAD_ID 0x0002
362#define L2CAP_MR_SAME_ID 0x0003
363#define L2CAP_MR_NOT_SUPP 0x0004
364#define L2CAP_MR_COLLISION 0x0005
365#define L2CAP_MR_NOT_ALLOWED 0x0006
366
367struct l2cap_move_chan_cfm {
368 __le16 icid;
369 __le16 result;
370} __packed;
371
372#define L2CAP_MC_CONFIRMED 0x0000
373#define L2CAP_MC_UNCONFIRMED 0x0001
374
375struct l2cap_move_chan_cfm_rsp {
376 __le16 icid;
377} __packed;
378
274/* info type */ 379/* info type */
275#define L2CAP_IT_CL_MTU 0x0001 380#define L2CAP_IT_CL_MTU 0x0001
276#define L2CAP_IT_FEAT_MASK 0x0002 381#define L2CAP_IT_FEAT_MASK 0x0002
277#define L2CAP_IT_FIXED_CHAN 0x0003 382#define L2CAP_IT_FIXED_CHAN 0x0003
278 383
279/* info result */ 384/* info result */
280#define L2CAP_IR_SUCCESS 0x0000 385#define L2CAP_IR_SUCCESS 0x0000
281#define L2CAP_IR_NOTSUPP 0x0001 386#define L2CAP_IR_NOTSUPP 0x0001
282 387
283struct l2cap_conn_param_update_req { 388struct l2cap_conn_param_update_req {
284 __le16 min; 389 __le16 min;
@@ -297,7 +402,7 @@ struct l2cap_conn_param_update_rsp {
297 402
298/* ----- L2CAP channels and connections ----- */ 403/* ----- L2CAP channels and connections ----- */
299struct srej_list { 404struct srej_list {
300 __u8 tx_seq; 405 __u16 tx_seq;
301 struct list_head list; 406 struct list_head list;
302}; 407};
303 408
@@ -319,14 +424,11 @@ struct l2cap_chan {
319 __u16 flush_to; 424 __u16 flush_to;
320 __u8 mode; 425 __u8 mode;
321 __u8 chan_type; 426 __u8 chan_type;
427 __u8 chan_policy;
322 428
323 __le16 sport; 429 __le16 sport;
324 430
325 __u8 sec_level; 431 __u8 sec_level;
326 __u8 role_switch;
327 __u8 force_reliable;
328 __u8 flushable;
329 __u8 force_active;
330 432
331 __u8 ident; 433 __u8 ident;
332 434
@@ -337,7 +439,8 @@ struct l2cap_chan {
337 439
338 __u8 fcs; 440 __u8 fcs;
339 441
340 __u8 tx_win; 442 __u16 tx_win;
443 __u16 tx_win_max;
341 __u8 max_tx; 444 __u8 max_tx;
342 __u16 retrans_timeout; 445 __u16 retrans_timeout;
343 __u16 monitor_timeout; 446 __u16 monitor_timeout;
@@ -345,29 +448,45 @@ struct l2cap_chan {
345 448
346 unsigned long conf_state; 449 unsigned long conf_state;
347 unsigned long conn_state; 450 unsigned long conn_state;
348 451 unsigned long flags;
349 __u8 next_tx_seq; 452
350 __u8 expected_ack_seq; 453 __u16 next_tx_seq;
351 __u8 expected_tx_seq; 454 __u16 expected_ack_seq;
352 __u8 buffer_seq; 455 __u16 expected_tx_seq;
353 __u8 buffer_seq_srej; 456 __u16 buffer_seq;
354 __u8 srej_save_reqseq; 457 __u16 buffer_seq_srej;
355 __u8 frames_sent; 458 __u16 srej_save_reqseq;
356 __u8 unacked_frames; 459 __u16 frames_sent;
460 __u16 unacked_frames;
357 __u8 retry_count; 461 __u8 retry_count;
358 __u8 num_acked; 462 __u8 num_acked;
359 __u16 sdu_len; 463 __u16 sdu_len;
360 struct sk_buff *sdu; 464 struct sk_buff *sdu;
361 struct sk_buff *sdu_last_frag; 465 struct sk_buff *sdu_last_frag;
362 466
363 __u8 remote_tx_win; 467 __u16 remote_tx_win;
364 __u8 remote_max_tx; 468 __u8 remote_max_tx;
365 __u16 remote_mps; 469 __u16 remote_mps;
366 470
367 struct timer_list chan_timer; 471 __u8 local_id;
368 struct timer_list retrans_timer; 472 __u8 local_stype;
369 struct timer_list monitor_timer; 473 __u16 local_msdu;
370 struct timer_list ack_timer; 474 __u32 local_sdu_itime;
475 __u32 local_acc_lat;
476 __u32 local_flush_to;
477
478 __u8 remote_id;
479 __u8 remote_stype;
480 __u16 remote_msdu;
481 __u32 remote_sdu_itime;
482 __u32 remote_acc_lat;
483 __u32 remote_flush_to;
484
485 struct delayed_work chan_timer;
486 struct delayed_work retrans_timer;
487 struct delayed_work monitor_timer;
488 struct delayed_work ack_timer;
489
371 struct sk_buff *tx_send_head; 490 struct sk_buff *tx_send_head;
372 struct sk_buff_head tx_q; 491 struct sk_buff_head tx_q;
373 struct sk_buff_head srej_q; 492 struct sk_buff_head srej_q;
@@ -391,6 +510,7 @@ struct l2cap_ops {
391 510
392struct l2cap_conn { 511struct l2cap_conn {
393 struct hci_conn *hcon; 512 struct hci_conn *hcon;
513 struct hci_chan *hchan;
394 514
395 bdaddr_t *dst; 515 bdaddr_t *dst;
396 bdaddr_t *src; 516 bdaddr_t *src;
@@ -402,7 +522,7 @@ struct l2cap_conn {
402 __u8 info_state; 522 __u8 info_state;
403 __u8 info_ident; 523 __u8 info_ident;
404 524
405 struct timer_list info_timer; 525 struct delayed_work info_timer;
406 526
407 spinlock_t lock; 527 spinlock_t lock;
408 528
@@ -412,11 +532,11 @@ struct l2cap_conn {
412 532
413 __u8 disc_reason; 533 __u8 disc_reason;
414 534
415 struct timer_list security_timer; 535 struct delayed_work security_timer;
416 struct smp_chan *smp_chan; 536 struct smp_chan *smp_chan;
417 537
418 struct list_head chan_l; 538 struct list_head chan_l;
419 rwlock_t chan_lock; 539 struct mutex chan_lock;
420}; 540};
421 541
422#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 542#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
@@ -445,6 +565,9 @@ enum {
445 CONF_CONNECT_PEND, 565 CONF_CONNECT_PEND,
446 CONF_NO_FCS_RECV, 566 CONF_NO_FCS_RECV,
447 CONF_STATE2_DEVICE, 567 CONF_STATE2_DEVICE,
568 CONF_EWS_RECV,
569 CONF_LOC_CONF_PEND,
570 CONF_REM_CONF_PEND,
448}; 571};
449 572
450#define L2CAP_CONF_MAX_CONF_REQ 2 573#define L2CAP_CONF_MAX_CONF_REQ 2
@@ -462,6 +585,44 @@ enum {
462 CONN_RNR_SENT, 585 CONN_RNR_SENT,
463}; 586};
464 587
588/* Definitions for flags in l2cap_chan */
589enum {
590 FLAG_ROLE_SWITCH,
591 FLAG_FORCE_ACTIVE,
592 FLAG_FORCE_RELIABLE,
593 FLAG_FLUSHABLE,
594 FLAG_EXT_CTRL,
595 FLAG_EFS_ENABLE,
596};
597
598static inline void l2cap_chan_hold(struct l2cap_chan *c)
599{
600 atomic_inc(&c->refcnt);
601}
602
603static inline void l2cap_chan_put(struct l2cap_chan *c)
604{
605 if (atomic_dec_and_test(&c->refcnt))
606 kfree(c);
607}
608
609static inline void l2cap_set_timer(struct l2cap_chan *chan,
610 struct delayed_work *work, long timeout)
611{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout);
613
614 if (!__cancel_delayed_work(work))
615 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout);
617}
618
619static inline void l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work)
621{
622 if (__cancel_delayed_work(work))
623 l2cap_chan_put(chan);
624}
625
465#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
466#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
467#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
@@ -474,6 +635,22 @@ enum {
474 L2CAP_DEFAULT_ACK_TO); 635 L2CAP_DEFAULT_ACK_TO);
475#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
476 637
638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
639{
640 int offset;
641
642 offset = (seq1 - seq2) % (chan->tx_win_max + 1);
643 if (offset < 0)
644 offset += (chan->tx_win_max + 1);
645
646 return offset;
647}
648
649static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
650{
651 return (seq + 1) % (chan->tx_win_max + 1);
652}
653
477static inline int l2cap_tx_window_full(struct l2cap_chan *ch) 654static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
478{ 655{
479 int sub; 656 int sub;
@@ -486,13 +663,164 @@ static inline int l2cap_tx_window_full(struct l2cap_chan *ch)
486 return sub == ch->remote_tx_win; 663 return sub == ch->remote_tx_win;
487} 664}
488 665
489#define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) 666static inline __u16 __get_reqseq(struct l2cap_chan *chan, __u32 ctrl)
490#define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8) 667{
491#define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE)) 668 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
492#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) 669 return (ctrl & L2CAP_EXT_CTRL_REQSEQ) >>
493#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) 670 L2CAP_EXT_CTRL_REQSEQ_SHIFT;
671 else
672 return (ctrl & L2CAP_CTRL_REQSEQ) >> L2CAP_CTRL_REQSEQ_SHIFT;
673}
674
675static inline __u32 __set_reqseq(struct l2cap_chan *chan, __u32 reqseq)
676{
677 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
678 return (reqseq << L2CAP_EXT_CTRL_REQSEQ_SHIFT) &
679 L2CAP_EXT_CTRL_REQSEQ;
680 else
681 return (reqseq << L2CAP_CTRL_REQSEQ_SHIFT) & L2CAP_CTRL_REQSEQ;
682}
683
684static inline __u16 __get_txseq(struct l2cap_chan *chan, __u32 ctrl)
685{
686 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
687 return (ctrl & L2CAP_EXT_CTRL_TXSEQ) >>
688 L2CAP_EXT_CTRL_TXSEQ_SHIFT;
689 else
690 return (ctrl & L2CAP_CTRL_TXSEQ) >> L2CAP_CTRL_TXSEQ_SHIFT;
691}
692
693static inline __u32 __set_txseq(struct l2cap_chan *chan, __u32 txseq)
694{
695 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
696 return (txseq << L2CAP_EXT_CTRL_TXSEQ_SHIFT) &
697 L2CAP_EXT_CTRL_TXSEQ;
698 else
699 return (txseq << L2CAP_CTRL_TXSEQ_SHIFT) & L2CAP_CTRL_TXSEQ;
700}
701
702static inline bool __is_sframe(struct l2cap_chan *chan, __u32 ctrl)
703{
704 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
705 return ctrl & L2CAP_EXT_CTRL_FRAME_TYPE;
706 else
707 return ctrl & L2CAP_CTRL_FRAME_TYPE;
708}
709
710static inline __u32 __set_sframe(struct l2cap_chan *chan)
711{
712 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
713 return L2CAP_EXT_CTRL_FRAME_TYPE;
714 else
715 return L2CAP_CTRL_FRAME_TYPE;
716}
717
718static inline __u8 __get_ctrl_sar(struct l2cap_chan *chan, __u32 ctrl)
719{
720 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
721 return (ctrl & L2CAP_EXT_CTRL_SAR) >> L2CAP_EXT_CTRL_SAR_SHIFT;
722 else
723 return (ctrl & L2CAP_CTRL_SAR) >> L2CAP_CTRL_SAR_SHIFT;
724}
725
726static inline __u32 __set_ctrl_sar(struct l2cap_chan *chan, __u32 sar)
727{
728 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
729 return (sar << L2CAP_EXT_CTRL_SAR_SHIFT) & L2CAP_EXT_CTRL_SAR;
730 else
731 return (sar << L2CAP_CTRL_SAR_SHIFT) & L2CAP_CTRL_SAR;
732}
733
734static inline bool __is_sar_start(struct l2cap_chan *chan, __u32 ctrl)
735{
736 return __get_ctrl_sar(chan, ctrl) == L2CAP_SAR_START;
737}
738
739static inline __u32 __get_sar_mask(struct l2cap_chan *chan)
740{
741 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
742 return L2CAP_EXT_CTRL_SAR;
743 else
744 return L2CAP_CTRL_SAR;
745}
746
747static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl)
748{
749 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
750 return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >>
751 L2CAP_EXT_CTRL_SUPER_SHIFT;
752 else
753 return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT;
754}
755
756static inline __u32 __set_ctrl_super(struct l2cap_chan *chan, __u32 super)
757{
758 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
759 return (super << L2CAP_EXT_CTRL_SUPER_SHIFT) &
760 L2CAP_EXT_CTRL_SUPERVISE;
761 else
762 return (super << L2CAP_CTRL_SUPER_SHIFT) &
763 L2CAP_CTRL_SUPERVISE;
764}
765
766static inline __u32 __set_ctrl_final(struct l2cap_chan *chan)
767{
768 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
769 return L2CAP_EXT_CTRL_FINAL;
770 else
771 return L2CAP_CTRL_FINAL;
772}
773
774static inline bool __is_ctrl_final(struct l2cap_chan *chan, __u32 ctrl)
775{
776 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
777 return ctrl & L2CAP_EXT_CTRL_FINAL;
778 else
779 return ctrl & L2CAP_CTRL_FINAL;
780}
781
782static inline __u32 __set_ctrl_poll(struct l2cap_chan *chan)
783{
784 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
785 return L2CAP_EXT_CTRL_POLL;
786 else
787 return L2CAP_CTRL_POLL;
788}
789
790static inline bool __is_ctrl_poll(struct l2cap_chan *chan, __u32 ctrl)
791{
792 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
793 return ctrl & L2CAP_EXT_CTRL_POLL;
794 else
795 return ctrl & L2CAP_CTRL_POLL;
796}
797
798static inline __u32 __get_control(struct l2cap_chan *chan, void *p)
799{
800 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
801 return get_unaligned_le32(p);
802 else
803 return get_unaligned_le16(p);
804}
805
806static inline void __put_control(struct l2cap_chan *chan, __u32 control,
807 void *p)
808{
809 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
810 return put_unaligned_le32(control, p);
811 else
812 return put_unaligned_le16(control, p);
813}
814
815static inline __u8 __ctrl_size(struct l2cap_chan *chan)
816{
817 if (test_bit(FLAG_EXT_CTRL, &chan->flags))
818 return L2CAP_EXT_HDR_SIZE - L2CAP_HDR_SIZE;
819 else
820 return L2CAP_ENH_HDR_SIZE - L2CAP_HDR_SIZE;
821}
494 822
495extern int disable_ertm; 823extern bool disable_ertm;
496 824
497int l2cap_init_sockets(void); 825int l2cap_init_sockets(void);
498void l2cap_cleanup_sockets(void); 826void l2cap_cleanup_sockets(void);
@@ -506,8 +834,11 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
506struct l2cap_chan *l2cap_chan_create(struct sock *sk); 834struct l2cap_chan *l2cap_chan_create(struct sock *sk);
507void l2cap_chan_close(struct l2cap_chan *chan, int reason); 835void l2cap_chan_close(struct l2cap_chan *chan, int reason);
508void l2cap_chan_destroy(struct l2cap_chan *chan); 836void l2cap_chan_destroy(struct l2cap_chan *chan);
509int l2cap_chan_connect(struct l2cap_chan *chan); 837inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
510int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); 838 bdaddr_t *dst);
839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
840 u32 priority);
511void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 841void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
842int l2cap_chan_check_security(struct l2cap_chan *chan);
512 843
513#endif /* __L2CAP_H */ 844#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index d66da0f94f95..be65d3417883 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -23,6 +23,23 @@
23 23
24#define MGMT_INDEX_NONE 0xFFFF 24#define MGMT_INDEX_NONE 0xFFFF
25 25
26#define MGMT_STATUS_SUCCESS 0x00
27#define MGMT_STATUS_UNKNOWN_COMMAND 0x01
28#define MGMT_STATUS_NOT_CONNECTED 0x02
29#define MGMT_STATUS_FAILED 0x03
30#define MGMT_STATUS_CONNECT_FAILED 0x04
31#define MGMT_STATUS_AUTH_FAILED 0x05
32#define MGMT_STATUS_NOT_PAIRED 0x06
33#define MGMT_STATUS_NO_RESOURCES 0x07
34#define MGMT_STATUS_TIMEOUT 0x08
35#define MGMT_STATUS_ALREADY_CONNECTED 0x09
36#define MGMT_STATUS_BUSY 0x0a
37#define MGMT_STATUS_REJECTED 0x0b
38#define MGMT_STATUS_NOT_SUPPORTED 0x0c
39#define MGMT_STATUS_INVALID_PARAMS 0x0d
40#define MGMT_STATUS_DISCONNECTED 0x0e
41#define MGMT_STATUS_NOT_POWERED 0x0f
42
26struct mgmt_hdr { 43struct mgmt_hdr {
27 __le16 opcode; 44 __le16 opcode;
28 __le16 index; 45 __le16 index;
@@ -44,22 +61,29 @@ struct mgmt_rp_read_index_list {
44/* Reserve one extra byte for names in management messages so that they 61/* Reserve one extra byte for names in management messages so that they
45 * are always guaranteed to be nul-terminated */ 62 * are always guaranteed to be nul-terminated */
46#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) 63#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1)
64#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1)
65
66#define MGMT_SETTING_POWERED 0x00000001
67#define MGMT_SETTING_CONNECTABLE 0x00000002
68#define MGMT_SETTING_FAST_CONNECTABLE 0x00000004
69#define MGMT_SETTING_DISCOVERABLE 0x00000008
70#define MGMT_SETTING_PAIRABLE 0x00000010
71#define MGMT_SETTING_LINK_SECURITY 0x00000020
72#define MGMT_SETTING_SSP 0x00000040
73#define MGMT_SETTING_BREDR 0x00000080
74#define MGMT_SETTING_HS 0x00000100
75#define MGMT_SETTING_LE 0x00000200
47 76
48#define MGMT_OP_READ_INFO 0x0004 77#define MGMT_OP_READ_INFO 0x0004
49struct mgmt_rp_read_info { 78struct mgmt_rp_read_info {
50 __u8 type;
51 __u8 powered;
52 __u8 connectable;
53 __u8 discoverable;
54 __u8 pairable;
55 __u8 sec_mode;
56 bdaddr_t bdaddr; 79 bdaddr_t bdaddr;
80 __u8 version;
81 __le16 manufacturer;
82 __le32 supported_settings;
83 __le32 current_settings;
57 __u8 dev_class[3]; 84 __u8 dev_class[3];
58 __u8 features[8];
59 __u16 manufacturer;
60 __u8 hci_ver;
61 __u16 hci_rev;
62 __u8 name[MGMT_MAX_NAME_LENGTH]; 85 __u8 name[MGMT_MAX_NAME_LENGTH];
86 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
63} __packed; 87} __packed;
64 88
65struct mgmt_mode { 89struct mgmt_mode {
@@ -69,70 +93,97 @@ struct mgmt_mode {
69#define MGMT_OP_SET_POWERED 0x0005 93#define MGMT_OP_SET_POWERED 0x0005
70 94
71#define MGMT_OP_SET_DISCOVERABLE 0x0006 95#define MGMT_OP_SET_DISCOVERABLE 0x0006
96struct mgmt_cp_set_discoverable {
97 __u8 val;
98 __u16 timeout;
99} __packed;
72 100
73#define MGMT_OP_SET_CONNECTABLE 0x0007 101#define MGMT_OP_SET_CONNECTABLE 0x0007
74 102
75#define MGMT_OP_SET_PAIRABLE 0x0008 103#define MGMT_OP_SET_FAST_CONNECTABLE 0x0008
76 104
77#define MGMT_OP_ADD_UUID 0x0009 105#define MGMT_OP_SET_PAIRABLE 0x0009
78struct mgmt_cp_add_uuid {
79 __u8 uuid[16];
80 __u8 svc_hint;
81} __packed;
82 106
83#define MGMT_OP_REMOVE_UUID 0x000A 107#define MGMT_OP_SET_LINK_SECURITY 0x000A
84struct mgmt_cp_remove_uuid { 108
85 __u8 uuid[16]; 109#define MGMT_OP_SET_SSP 0x000B
86} __packed; 110
111#define MGMT_OP_SET_HS 0x000C
112
113#define MGMT_OP_SET_LE 0x000D
87 114
88#define MGMT_OP_SET_DEV_CLASS 0x000B 115#define MGMT_OP_SET_DEV_CLASS 0x000E
89struct mgmt_cp_set_dev_class { 116struct mgmt_cp_set_dev_class {
90 __u8 major; 117 __u8 major;
91 __u8 minor; 118 __u8 minor;
92} __packed; 119} __packed;
93 120
94#define MGMT_OP_SET_SERVICE_CACHE 0x000C 121#define MGMT_OP_SET_LOCAL_NAME 0x000F
95struct mgmt_cp_set_service_cache { 122struct mgmt_cp_set_local_name {
96 __u8 enable; 123 __u8 name[MGMT_MAX_NAME_LENGTH];
124} __packed;
125
126#define MGMT_OP_ADD_UUID 0x0010
127struct mgmt_cp_add_uuid {
128 __u8 uuid[16];
129 __u8 svc_hint;
130} __packed;
131
132#define MGMT_OP_REMOVE_UUID 0x0011
133struct mgmt_cp_remove_uuid {
134 __u8 uuid[16];
97} __packed; 135} __packed;
98 136
99struct mgmt_key_info { 137struct mgmt_link_key_info {
100 bdaddr_t bdaddr; 138 bdaddr_t bdaddr;
101 u8 type; 139 u8 type;
102 u8 val[16]; 140 u8 val[16];
103 u8 pin_len; 141 u8 pin_len;
104 u8 dlen;
105 u8 data[0];
106} __packed; 142} __packed;
107 143
108#define MGMT_OP_LOAD_KEYS 0x000D 144#define MGMT_OP_LOAD_LINK_KEYS 0x0012
109struct mgmt_cp_load_keys { 145struct mgmt_cp_load_link_keys {
110 __u8 debug_keys; 146 __u8 debug_keys;
111 __le16 key_count; 147 __le16 key_count;
112 struct mgmt_key_info keys[0]; 148 struct mgmt_link_key_info keys[0];
113} __packed; 149} __packed;
114 150
115#define MGMT_OP_REMOVE_KEY 0x000E 151#define MGMT_OP_REMOVE_KEYS 0x0013
116struct mgmt_cp_remove_key { 152struct mgmt_cp_remove_keys {
117 bdaddr_t bdaddr; 153 bdaddr_t bdaddr;
118 __u8 disconnect; 154 __u8 disconnect;
119} __packed; 155} __packed;
156struct mgmt_rp_remove_keys {
157 bdaddr_t bdaddr;
158 __u8 status;
159};
120 160
121#define MGMT_OP_DISCONNECT 0x000F 161#define MGMT_OP_DISCONNECT 0x0014
122struct mgmt_cp_disconnect { 162struct mgmt_cp_disconnect {
123 bdaddr_t bdaddr; 163 bdaddr_t bdaddr;
124} __packed; 164} __packed;
125struct mgmt_rp_disconnect { 165struct mgmt_rp_disconnect {
126 bdaddr_t bdaddr; 166 bdaddr_t bdaddr;
167 __u8 status;
127} __packed; 168} __packed;
128 169
129#define MGMT_OP_GET_CONNECTIONS 0x0010 170#define MGMT_ADDR_BREDR 0x00
171#define MGMT_ADDR_LE_PUBLIC 0x01
172#define MGMT_ADDR_LE_RANDOM 0x02
173#define MGMT_ADDR_INVALID 0xff
174
175struct mgmt_addr_info {
176 bdaddr_t bdaddr;
177 __u8 type;
178} __packed;
179
180#define MGMT_OP_GET_CONNECTIONS 0x0015
130struct mgmt_rp_get_connections { 181struct mgmt_rp_get_connections {
131 __le16 conn_count; 182 __le16 conn_count;
132 bdaddr_t conn[0]; 183 struct mgmt_addr_info addr[0];
133} __packed; 184} __packed;
134 185
135#define MGMT_OP_PIN_CODE_REPLY 0x0011 186#define MGMT_OP_PIN_CODE_REPLY 0x0016
136struct mgmt_cp_pin_code_reply { 187struct mgmt_cp_pin_code_reply {
137 bdaddr_t bdaddr; 188 bdaddr_t bdaddr;
138 __u8 pin_len; 189 __u8 pin_len;
@@ -143,27 +194,27 @@ struct mgmt_rp_pin_code_reply {
143 uint8_t status; 194 uint8_t status;
144} __packed; 195} __packed;
145 196
146#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 197#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
147struct mgmt_cp_pin_code_neg_reply { 198struct mgmt_cp_pin_code_neg_reply {
148 bdaddr_t bdaddr; 199 bdaddr_t bdaddr;
149} __packed; 200} __packed;
150 201
151#define MGMT_OP_SET_IO_CAPABILITY 0x0013 202#define MGMT_OP_SET_IO_CAPABILITY 0x0018
152struct mgmt_cp_set_io_capability { 203struct mgmt_cp_set_io_capability {
153 __u8 io_capability; 204 __u8 io_capability;
154} __packed; 205} __packed;
155 206
156#define MGMT_OP_PAIR_DEVICE 0x0014 207#define MGMT_OP_PAIR_DEVICE 0x0019
157struct mgmt_cp_pair_device { 208struct mgmt_cp_pair_device {
158 bdaddr_t bdaddr; 209 struct mgmt_addr_info addr;
159 __u8 io_cap; 210 __u8 io_cap;
160} __packed; 211} __packed;
161struct mgmt_rp_pair_device { 212struct mgmt_rp_pair_device {
162 bdaddr_t bdaddr; 213 struct mgmt_addr_info addr;
163 __u8 status; 214 __u8 status;
164} __packed; 215} __packed;
165 216
166#define MGMT_OP_USER_CONFIRM_REPLY 0x0015 217#define MGMT_OP_USER_CONFIRM_REPLY 0x001A
167struct mgmt_cp_user_confirm_reply { 218struct mgmt_cp_user_confirm_reply {
168 bdaddr_t bdaddr; 219 bdaddr_t bdaddr;
169} __packed; 220} __packed;
@@ -172,48 +223,69 @@ struct mgmt_rp_user_confirm_reply {
172 __u8 status; 223 __u8 status;
173} __packed; 224} __packed;
174 225
175#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 226#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B
227struct mgmt_cp_user_confirm_neg_reply {
228 bdaddr_t bdaddr;
229} __packed;
176 230
177#define MGMT_OP_SET_LOCAL_NAME 0x0017 231#define MGMT_OP_USER_PASSKEY_REPLY 0x001C
178struct mgmt_cp_set_local_name { 232struct mgmt_cp_user_passkey_reply {
179 __u8 name[MGMT_MAX_NAME_LENGTH]; 233 bdaddr_t bdaddr;
234 __le32 passkey;
235} __packed;
236struct mgmt_rp_user_passkey_reply {
237 bdaddr_t bdaddr;
238 __u8 status;
180} __packed; 239} __packed;
181 240
182#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0018 241#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D
242struct mgmt_cp_user_passkey_neg_reply {
243 bdaddr_t bdaddr;
244} __packed;
245
246#define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E
183struct mgmt_rp_read_local_oob_data { 247struct mgmt_rp_read_local_oob_data {
184 __u8 hash[16]; 248 __u8 hash[16];
185 __u8 randomizer[16]; 249 __u8 randomizer[16];
186} __packed; 250} __packed;
187 251
188#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0019 252#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F
189struct mgmt_cp_add_remote_oob_data { 253struct mgmt_cp_add_remote_oob_data {
190 bdaddr_t bdaddr; 254 bdaddr_t bdaddr;
191 __u8 hash[16]; 255 __u8 hash[16];
192 __u8 randomizer[16]; 256 __u8 randomizer[16];
193} __packed; 257} __packed;
194 258
195#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x001A 259#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020
196struct mgmt_cp_remove_remote_oob_data { 260struct mgmt_cp_remove_remote_oob_data {
197 bdaddr_t bdaddr; 261 bdaddr_t bdaddr;
198} __packed; 262} __packed;
199 263
200#define MGMT_OP_START_DISCOVERY 0x001B 264#define MGMT_OP_START_DISCOVERY 0x0021
265struct mgmt_cp_start_discovery {
266 __u8 type;
267} __packed;
201 268
202#define MGMT_OP_STOP_DISCOVERY 0x001C 269#define MGMT_OP_STOP_DISCOVERY 0x0022
203 270
204#define MGMT_OP_BLOCK_DEVICE 0x001D 271#define MGMT_OP_CONFIRM_NAME 0x0023
205struct mgmt_cp_block_device { 272struct mgmt_cp_confirm_name {
206 bdaddr_t bdaddr; 273 bdaddr_t bdaddr;
274 __u8 name_known;
275} __packed;
276struct mgmt_rp_confirm_name {
277 bdaddr_t bdaddr;
278 __u8 status;
207} __packed; 279} __packed;
208 280
209#define MGMT_OP_UNBLOCK_DEVICE 0x001E 281#define MGMT_OP_BLOCK_DEVICE 0x0024
210struct mgmt_cp_unblock_device { 282struct mgmt_cp_block_device {
211 bdaddr_t bdaddr; 283 bdaddr_t bdaddr;
212} __packed; 284} __packed;
213 285
214#define MGMT_OP_SET_FAST_CONNECTABLE 0x001F 286#define MGMT_OP_UNBLOCK_DEVICE 0x0025
215struct mgmt_cp_set_fast_connectable { 287struct mgmt_cp_unblock_device {
216 __u8 enable; 288 bdaddr_t bdaddr;
217} __packed; 289} __packed;
218 290
219#define MGMT_EV_CMD_COMPLETE 0x0001 291#define MGMT_EV_CMD_COMPLETE 0x0001
@@ -237,83 +309,82 @@ struct mgmt_ev_controller_error {
237 309
238#define MGMT_EV_INDEX_REMOVED 0x0005 310#define MGMT_EV_INDEX_REMOVED 0x0005
239 311
240#define MGMT_EV_POWERED 0x0006 312#define MGMT_EV_NEW_SETTINGS 0x0006
241 313
242#define MGMT_EV_DISCOVERABLE 0x0007 314#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
243 315struct mgmt_ev_class_of_dev_changed {
244#define MGMT_EV_CONNECTABLE 0x0008 316 __u8 dev_class[3];
317};
245 318
246#define MGMT_EV_PAIRABLE 0x0009 319#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
320struct mgmt_ev_local_name_changed {
321 __u8 name[MGMT_MAX_NAME_LENGTH];
322 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
323} __packed;
247 324
248#define MGMT_EV_NEW_KEY 0x000A 325#define MGMT_EV_NEW_LINK_KEY 0x0009
249struct mgmt_ev_new_key { 326struct mgmt_ev_new_link_key {
250 __u8 store_hint; 327 __u8 store_hint;
251 struct mgmt_key_info key; 328 struct mgmt_link_key_info key;
252} __packed; 329} __packed;
253 330
254#define MGMT_EV_CONNECTED 0x000B 331#define MGMT_EV_CONNECTED 0x000A
255struct mgmt_ev_connected {
256 bdaddr_t bdaddr;
257 __u8 link_type;
258} __packed;
259 332
260#define MGMT_EV_DISCONNECTED 0x000C 333#define MGMT_EV_DISCONNECTED 0x000B
261struct mgmt_ev_disconnected {
262 bdaddr_t bdaddr;
263} __packed;
264 334
265#define MGMT_EV_CONNECT_FAILED 0x000D 335#define MGMT_EV_CONNECT_FAILED 0x000C
266struct mgmt_ev_connect_failed { 336struct mgmt_ev_connect_failed {
267 bdaddr_t bdaddr; 337 struct mgmt_addr_info addr;
268 __u8 status; 338 __u8 status;
269} __packed; 339} __packed;
270 340
271#define MGMT_EV_PIN_CODE_REQUEST 0x000E 341#define MGMT_EV_PIN_CODE_REQUEST 0x000D
272struct mgmt_ev_pin_code_request { 342struct mgmt_ev_pin_code_request {
273 bdaddr_t bdaddr; 343 bdaddr_t bdaddr;
274 __u8 secure; 344 __u8 secure;
275} __packed; 345} __packed;
276 346
277#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F 347#define MGMT_EV_USER_CONFIRM_REQUEST 0x000E
278struct mgmt_ev_user_confirm_request { 348struct mgmt_ev_user_confirm_request {
279 bdaddr_t bdaddr; 349 bdaddr_t bdaddr;
280 __u8 confirm_hint; 350 __u8 confirm_hint;
281 __le32 value; 351 __le32 value;
282} __packed; 352} __packed;
283 353
354#define MGMT_EV_USER_PASSKEY_REQUEST 0x000F
355struct mgmt_ev_user_passkey_request {
356 bdaddr_t bdaddr;
357} __packed;
358
284#define MGMT_EV_AUTH_FAILED 0x0010 359#define MGMT_EV_AUTH_FAILED 0x0010
285struct mgmt_ev_auth_failed { 360struct mgmt_ev_auth_failed {
286 bdaddr_t bdaddr; 361 bdaddr_t bdaddr;
287 __u8 status; 362 __u8 status;
288} __packed; 363} __packed;
289 364
290#define MGMT_EV_LOCAL_NAME_CHANGED 0x0011 365#define MGMT_EV_DEVICE_FOUND 0x0011
291struct mgmt_ev_local_name_changed {
292 __u8 name[MGMT_MAX_NAME_LENGTH];
293} __packed;
294
295#define MGMT_EV_DEVICE_FOUND 0x0012
296struct mgmt_ev_device_found { 366struct mgmt_ev_device_found {
297 bdaddr_t bdaddr; 367 struct mgmt_addr_info addr;
298 __u8 dev_class[3]; 368 __u8 dev_class[3];
299 __s8 rssi; 369 __s8 rssi;
370 __u8 confirm_name;
300 __u8 eir[HCI_MAX_EIR_LENGTH]; 371 __u8 eir[HCI_MAX_EIR_LENGTH];
301} __packed; 372} __packed;
302 373
303#define MGMT_EV_REMOTE_NAME 0x0013 374#define MGMT_EV_REMOTE_NAME 0x0012
304struct mgmt_ev_remote_name { 375struct mgmt_ev_remote_name {
305 bdaddr_t bdaddr; 376 bdaddr_t bdaddr;
306 __u8 name[MGMT_MAX_NAME_LENGTH]; 377 __u8 name[MGMT_MAX_NAME_LENGTH];
307} __packed; 378} __packed;
308 379
309#define MGMT_EV_DISCOVERING 0x0014 380#define MGMT_EV_DISCOVERING 0x0013
310 381
311#define MGMT_EV_DEVICE_BLOCKED 0x0015 382#define MGMT_EV_DEVICE_BLOCKED 0x0014
312struct mgmt_ev_device_blocked { 383struct mgmt_ev_device_blocked {
313 bdaddr_t bdaddr; 384 bdaddr_t bdaddr;
314} __packed; 385} __packed;
315 386
316#define MGMT_EV_DEVICE_UNBLOCKED 0x0016 387#define MGMT_EV_DEVICE_UNBLOCKED 0x0015
317struct mgmt_ev_device_unblocked { 388struct mgmt_ev_device_unblocked {
318 bdaddr_t bdaddr; 389 bdaddr_t bdaddr;
319} __packed; 390} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 15b97d549441..aeaf5fa2b9f1 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -115,6 +115,10 @@ struct smp_cmd_security_req {
115#define SMP_MIN_ENC_KEY_SIZE 7 115#define SMP_MIN_ENC_KEY_SIZE 7
116#define SMP_MAX_ENC_KEY_SIZE 16 116#define SMP_MAX_ENC_KEY_SIZE 16
117 117
118#define SMP_FLAG_TK_VALID 1
119#define SMP_FLAG_CFM_PENDING 2
120#define SMP_FLAG_MITM_AUTH 3
121
118struct smp_chan { 122struct smp_chan {
119 struct l2cap_conn *conn; 123 struct l2cap_conn *conn;
120 u8 preq[7]; /* SMP Pairing Request */ 124 u8 preq[7]; /* SMP Pairing Request */
@@ -124,6 +128,7 @@ struct smp_chan {
124 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
125 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
126 u8 smp_key_size; 130 u8 smp_key_size;
131 unsigned long smp_flags;
127 struct crypto_blkcipher *tfm; 132 struct crypto_blkcipher *tfm;
128 struct work_struct confirm; 133 struct work_struct confirm;
129 struct work_struct random; 134 struct work_struct random;
@@ -134,6 +139,7 @@ struct smp_chan {
134int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); 139int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
135int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); 140int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
136int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); 141int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);
142int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey);
137 143
138void smp_chan_destroy(struct l2cap_conn *conn); 144void smp_chan_destroy(struct l2cap_conn *conn);
139 145
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index c011281d92c0..ef2dd9438bb1 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -9,6 +9,7 @@
9 9
10#include <net/caif/caif_layer.h> 10#include <net/caif/caif_layer.h>
11#include <net/caif/cfcnfg.h> 11#include <net/caif/cfcnfg.h>
12#include <net/caif/caif_device.h>
12#include <linux/caif/caif_socket.h> 13#include <linux/caif/caif_socket.h>
13#include <linux/if.h> 14#include <linux/if.h>
14#include <linux/net.h> 15#include <linux/net.h>
@@ -104,4 +105,24 @@ void caif_client_register_refcnt(struct cflayer *adapt_layer,
104 */ 105 */
105void caif_free_client(struct cflayer *adap_layer); 106void caif_free_client(struct cflayer *adap_layer);
106 107
108/**
109 * struct caif_enroll_dev - Enroll a net-device as a CAIF Link layer
110 * @dev: Network device to enroll.
111 * @caifdev: Configuration information from CAIF Link Layer
112 * @link_support: Link layer support layer
113 * @head_room: Head room needed by link support layer
114 * @layer: Lowest layer in CAIF stack
115 * @rcv_fun: Receive function for CAIF stack.
116 *
117 * This function enroll a CAIF link layer into CAIF Stack and
118 * expects the interface to be able to handle CAIF payload.
119 * The link_support layer is used to add any Link Layer specific
120 * framing.
121 */
122void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev,
123 struct cflayer *link_support, int head_room,
124 struct cflayer **layer, int (**rcv_func)(
125 struct sk_buff *, struct net_device *,
126 struct packet_type *, struct net_device *));
127
107#endif /* CAIF_DEV_H_ */ 128#endif /* CAIF_DEV_H_ */
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 35bc7883cf97..0f3a39125f90 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -121,9 +121,7 @@ enum caif_direction {
121 * @transmit: Packet transmit funciton. 121 * @transmit: Packet transmit funciton.
122 * @ctrlcmd: Used for control signalling upwards in the stack. 122 * @ctrlcmd: Used for control signalling upwards in the stack.
123 * @modemcmd: Used for control signaling downwards in the stack. 123 * @modemcmd: Used for control signaling downwards in the stack.
124 * @prio: Priority of this layer.
125 * @id: The identity of this layer 124 * @id: The identity of this layer
126 * @type: The type of this layer
127 * @name: Name of the layer. 125 * @name: Name of the layer.
128 * 126 *
129 * This structure defines the layered structure in CAIF. 127 * This structure defines the layered structure in CAIF.
@@ -230,9 +228,7 @@ struct cflayer {
230 */ 228 */
231 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl); 229 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl);
232 230
233 unsigned short prio;
234 unsigned int id; 231 unsigned int id;
235 unsigned int type;
236 char name[CAIF_LAYER_NAME_SZ]; 232 char name[CAIF_LAYER_NAME_SZ];
237}; 233};
238 234
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h
index 87c3d11b8e55..aa6a485b0545 100644
--- a/include/net/caif/caif_spi.h
+++ b/include/net/caif/caif_spi.h
@@ -55,8 +55,8 @@
55struct cfspi_xfer { 55struct cfspi_xfer {
56 u16 tx_dma_len; 56 u16 tx_dma_len;
57 u16 rx_dma_len; 57 u16 rx_dma_len;
58 void *va_tx; 58 void *va_tx[2];
59 dma_addr_t pa_tx; 59 dma_addr_t pa_tx[2];
60 void *va_rx; 60 void *va_rx;
61 dma_addr_t pa_rx; 61 dma_addr_t pa_rx;
62}; 62};
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 3e93a4a4b677..90b4ff8bad83 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -14,18 +14,6 @@
14struct cfcnfg; 14struct cfcnfg;
15 15
16/** 16/**
17 * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack
18 *
19 * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
20 * @CFPHYTYPE_CAIF: Generic CAIF physical interface
21 */
22enum cfcnfg_phy_type {
23 CFPHYTYPE_FRAG = 1,
24 CFPHYTYPE_CAIF,
25 CFPHYTYPE_MAX
26};
27
28/**
29 * enum cfcnfg_phy_preference - Physical preference HW Abstraction 17 * enum cfcnfg_phy_preference - Physical preference HW Abstraction
30 * 18 *
31 * @CFPHYPREF_UNSPECIFIED: Default physical interface 19 * @CFPHYPREF_UNSPECIFIED: Default physical interface
@@ -66,21 +54,20 @@ void cfcnfg_remove(struct cfcnfg *cfg);
66 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. 54 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
67 * @cnfg: Pointer to a CAIF configuration object, created by 55 * @cnfg: Pointer to a CAIF configuration object, created by
68 * cfcnfg_create(). 56 * cfcnfg_create().
69 * @phy_type: Specifies the type of physical interface, e.g.
70 * CFPHYTYPE_FRAG.
71 * @dev: Pointer to link layer device 57 * @dev: Pointer to link layer device
72 * @phy_layer: Specify the physical layer. The transmit function 58 * @phy_layer: Specify the physical layer. The transmit function
73 * MUST be set in the structure. 59 * MUST be set in the structure.
74 * @pref: The phy (link layer) preference. 60 * @pref: The phy (link layer) preference.
61 * @link_support: Protocol implementation for link layer specific protocol.
75 * @fcs: Specify if checksum is used in CAIF Framing Layer. 62 * @fcs: Specify if checksum is used in CAIF Framing Layer.
76 * @stx: Specify if Start Of Frame eXtention is used. 63 * @head_room: Head space needed by link specific protocol.
77 */ 64 */
78
79void 65void
80cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, 66cfcnfg_add_phy_layer(struct cfcnfg *cnfg,
81 struct net_device *dev, struct cflayer *phy_layer, 67 struct net_device *dev, struct cflayer *phy_layer,
82 enum cfcnfg_phy_preference pref, 68 enum cfcnfg_phy_preference pref,
83 bool fcs, bool stx); 69 struct cflayer *link_support,
70 bool fcs, int head_room);
84 71
85/** 72/**
86 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. 73 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
index b8374321b362..f121299a3427 100644
--- a/include/net/caif/cfserl.h
+++ b/include/net/caif/cfserl.h
@@ -8,5 +8,5 @@
8#define CFSERL_H_ 8#define CFSERL_H_
9#include <net/caif/caif_layer.h> 9#include <net/caif/caif_layer.h>
10 10
11struct cflayer *cfserl_create(int type, int instance, bool use_stx); 11struct cflayer *cfserl_create(int instance, bool use_stx);
12#endif /* CFSERL_H_ */ 12#endif
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 95852e36713b..15f4be7d768e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -391,6 +391,8 @@ struct cfg80211_crypto_settings {
391 * @assocresp_ies: extra information element(s) to add into (Re)Association 391 * @assocresp_ies: extra information element(s) to add into (Re)Association
392 * Response frames or %NULL 392 * Response frames or %NULL
393 * @assocresp_ies_len: length of assocresp_ies in octets 393 * @assocresp_ies_len: length of assocresp_ies in octets
394 * @probe_resp_len: length of probe response template (@probe_resp)
395 * @probe_resp: probe response template (AP mode only)
394 */ 396 */
395struct beacon_parameters { 397struct beacon_parameters {
396 u8 *head, *tail; 398 u8 *head, *tail;
@@ -408,6 +410,8 @@ struct beacon_parameters {
408 size_t proberesp_ies_len; 410 size_t proberesp_ies_len;
409 const u8 *assocresp_ies; 411 const u8 *assocresp_ies;
410 size_t assocresp_ies_len; 412 size_t assocresp_ies_len;
413 int probe_resp_len;
414 u8 *probe_resp;
411}; 415};
412 416
413/** 417/**
@@ -501,6 +505,7 @@ struct station_parameters {
501 * @STATION_INFO_CONNECTED_TIME: @connected_time filled 505 * @STATION_INFO_CONNECTED_TIME: @connected_time filled
502 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 506 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
503 * @STATION_INFO_STA_FLAGS: @sta_flags filled 507 * @STATION_INFO_STA_FLAGS: @sta_flags filled
508 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
504 */ 509 */
505enum station_info_flags { 510enum station_info_flags {
506 STATION_INFO_INACTIVE_TIME = 1<<0, 511 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -521,7 +526,8 @@ enum station_info_flags {
521 STATION_INFO_BSS_PARAM = 1<<15, 526 STATION_INFO_BSS_PARAM = 1<<15,
522 STATION_INFO_CONNECTED_TIME = 1<<16, 527 STATION_INFO_CONNECTED_TIME = 1<<16,
523 STATION_INFO_ASSOC_REQ_IES = 1<<17, 528 STATION_INFO_ASSOC_REQ_IES = 1<<17,
524 STATION_INFO_STA_FLAGS = 1<<18 529 STATION_INFO_STA_FLAGS = 1<<18,
530 STATION_INFO_BEACON_LOSS_COUNT = 1<<19
525}; 531};
526 532
527/** 533/**
@@ -619,6 +625,7 @@ struct sta_bss_parameters {
619 * the cfg80211_new_sta() calls to notify user space of the IEs. 625 * the cfg80211_new_sta() calls to notify user space of the IEs.
620 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 626 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
621 * @sta_flags: station flags mask & values 627 * @sta_flags: station flags mask & values
628 * @beacon_loss_count: Number of times beacon loss event has triggered.
622 */ 629 */
623struct station_info { 630struct station_info {
624 u32 filled; 631 u32 filled;
@@ -646,6 +653,8 @@ struct station_info {
646 const u8 *assoc_req_ies; 653 const u8 *assoc_req_ies;
647 size_t assoc_req_ies_len; 654 size_t assoc_req_ies_len;
648 655
656 u32 beacon_loss_count;
657
649 /* 658 /*
650 * Note: Add a new enum station_info_flags value for each new field and 659 * Note: Add a new enum station_info_flags value for each new field and
651 * use it to check which fields are initialized. 660 * use it to check which fields are initialized.
@@ -778,6 +787,7 @@ struct mesh_config {
778 u16 min_discovery_timeout; 787 u16 min_discovery_timeout;
779 u32 dot11MeshHWMPactivePathTimeout; 788 u32 dot11MeshHWMPactivePathTimeout;
780 u16 dot11MeshHWMPpreqMinInterval; 789 u16 dot11MeshHWMPpreqMinInterval;
790 u16 dot11MeshHWMPperrMinInterval;
781 u16 dot11MeshHWMPnetDiameterTraversalTime; 791 u16 dot11MeshHWMPnetDiameterTraversalTime;
782 u8 dot11MeshHWMPRootMode; 792 u8 dot11MeshHWMPRootMode;
783 u16 dot11MeshHWMPRannInterval; 793 u16 dot11MeshHWMPRannInterval;
@@ -798,6 +808,7 @@ struct mesh_config {
798 * @ie_len: length of vendor information elements 808 * @ie_len: length of vendor information elements
799 * @is_authenticated: this mesh requires authentication 809 * @is_authenticated: this mesh requires authentication
800 * @is_secure: this mesh uses security 810 * @is_secure: this mesh uses security
811 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
801 * 812 *
802 * These parameters are fixed when the mesh is created. 813 * These parameters are fixed when the mesh is created.
803 */ 814 */
@@ -810,6 +821,7 @@ struct mesh_setup {
810 u8 ie_len; 821 u8 ie_len;
811 bool is_authenticated; 822 bool is_authenticated;
812 bool is_secure; 823 bool is_secure;
824 int mcast_rate[IEEE80211_NUM_BANDS];
813}; 825};
814 826
815/** 827/**
@@ -1040,6 +1052,15 @@ struct cfg80211_auth_request {
1040}; 1052};
1041 1053
1042/** 1054/**
1055 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
1056 *
1057 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
1058 */
1059enum cfg80211_assoc_req_flags {
1060 ASSOC_REQ_DISABLE_HT = BIT(0),
1061};
1062
1063/**
1043 * struct cfg80211_assoc_request - (Re)Association request data 1064 * struct cfg80211_assoc_request - (Re)Association request data
1044 * 1065 *
1045 * This structure provides information needed to complete IEEE 802.11 1066 * This structure provides information needed to complete IEEE 802.11
@@ -1050,6 +1071,10 @@ struct cfg80211_auth_request {
1050 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1071 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1051 * @crypto: crypto settings 1072 * @crypto: crypto settings
1052 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 1073 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
1074 * @flags: See &enum cfg80211_assoc_req_flags
1075 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1076 * will be used in ht_capa. Un-supported values will be ignored.
1077 * @ht_capa_mask: The bits of ht_capa which are to be used.
1053 */ 1078 */
1054struct cfg80211_assoc_request { 1079struct cfg80211_assoc_request {
1055 struct cfg80211_bss *bss; 1080 struct cfg80211_bss *bss;
@@ -1057,6 +1082,9 @@ struct cfg80211_assoc_request {
1057 size_t ie_len; 1082 size_t ie_len;
1058 struct cfg80211_crypto_settings crypto; 1083 struct cfg80211_crypto_settings crypto;
1059 bool use_mfp; 1084 bool use_mfp;
1085 u32 flags;
1086 struct ieee80211_ht_cap ht_capa;
1087 struct ieee80211_ht_cap ht_capa_mask;
1060}; 1088};
1061 1089
1062/** 1090/**
@@ -1126,6 +1154,7 @@ struct cfg80211_ibss_params {
1126 u8 *ssid; 1154 u8 *ssid;
1127 u8 *bssid; 1155 u8 *bssid;
1128 struct ieee80211_channel *channel; 1156 struct ieee80211_channel *channel;
1157 enum nl80211_channel_type channel_type;
1129 u8 *ie; 1158 u8 *ie;
1130 u8 ssid_len, ie_len; 1159 u8 ssid_len, ie_len;
1131 u16 beacon_interval; 1160 u16 beacon_interval;
@@ -1155,6 +1184,10 @@ struct cfg80211_ibss_params {
1155 * @key_len: length of WEP key for shared key authentication 1184 * @key_len: length of WEP key for shared key authentication
1156 * @key_idx: index of WEP key for shared key authentication 1185 * @key_idx: index of WEP key for shared key authentication
1157 * @key: WEP key for shared key authentication 1186 * @key: WEP key for shared key authentication
1187 * @flags: See &enum cfg80211_assoc_req_flags
1188 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1189 * will be used in ht_capa. Un-supported values will be ignored.
1190 * @ht_capa_mask: The bits of ht_capa which are to be used.
1158 */ 1191 */
1159struct cfg80211_connect_params { 1192struct cfg80211_connect_params {
1160 struct ieee80211_channel *channel; 1193 struct ieee80211_channel *channel;
@@ -1168,6 +1201,9 @@ struct cfg80211_connect_params {
1168 struct cfg80211_crypto_settings crypto; 1201 struct cfg80211_crypto_settings crypto;
1169 const u8 *key; 1202 const u8 *key;
1170 u8 key_len, key_idx; 1203 u8 key_len, key_idx;
1204 u32 flags;
1205 struct ieee80211_ht_cap ht_capa;
1206 struct ieee80211_ht_cap ht_capa_mask;
1171}; 1207};
1172 1208
1173/** 1209/**
@@ -1315,7 +1351,12 @@ struct cfg80211_gtk_rekey_data {
1315 * 1351 *
1316 * @add_station: Add a new station. 1352 * @add_station: Add a new station.
1317 * @del_station: Remove a station; @mac may be NULL to remove all stations. 1353 * @del_station: Remove a station; @mac may be NULL to remove all stations.
1318 * @change_station: Modify a given station. 1354 * @change_station: Modify a given station. Note that flags changes are not much
1355 * validated in cfg80211, in particular the auth/assoc/authorized flags
1356 * might come to the driver in invalid combinations -- make sure to check
1357 * them, also against the existing state! Also, supported_rates changes are
1358 * not checked in station mode -- drivers need to reject (or ignore) them
1359 * for anything but TDLS peers.
1319 * @get_station: get station information for the station identified by @mac 1360 * @get_station: get station information for the station identified by @mac
1320 * @dump_station: dump station callback -- resume dump at index @idx 1361 * @dump_station: dump station callback -- resume dump at index @idx
1321 * 1362 *
@@ -1342,6 +1383,9 @@ struct cfg80211_gtk_rekey_data {
1342 * doesn't verify much. Note, however, that the passed netdev may be 1383 * doesn't verify much. Note, however, that the passed netdev may be
1343 * %NULL as well if the user requested changing the channel for the 1384 * %NULL as well if the user requested changing the channel for the
1344 * device itself, or for a monitor interface. 1385 * device itself, or for a monitor interface.
1386 * @get_channel: Get the current operating channel, should return %NULL if
1387 * there's no single defined operating channel if for example the
1388 * device implements channel hopping for multi-channel virtual interfaces.
1345 * 1389 *
1346 * @scan: Request to do a scan. If returning zero, the scan request is given 1390 * @scan: Request to do a scan. If returning zero, the scan request is given
1347 * the driver, and will be valid until passed to cfg80211_scan_done(). 1391 * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1369,7 +1413,8 @@ struct cfg80211_gtk_rekey_data {
1369 * have changed. The actual parameter values are available in 1413 * have changed. The actual parameter values are available in
1370 * struct wiphy. If returning an error, no value should be changed. 1414 * struct wiphy. If returning an error, no value should be changed.
1371 * 1415 *
1372 * @set_tx_power: set the transmit power according to the parameters 1416 * @set_tx_power: set the transmit power according to the parameters,
1417 * the power passed is in mBm, to get dBm use MBM_TO_DBM().
1373 * @get_tx_power: store the current TX power into the dbm variable; 1418 * @get_tx_power: store the current TX power into the dbm variable;
1374 * return 0 if successful 1419 * return 0 if successful
1375 * 1420 *
@@ -1432,6 +1477,11 @@ struct cfg80211_gtk_rekey_data {
1432 * 1477 *
1433 * @tdls_mgmt: Transmit a TDLS management frame. 1478 * @tdls_mgmt: Transmit a TDLS management frame.
1434 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 1479 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
1480 *
1481 * @probe_client: probe an associated client, must return a cookie that it
1482 * later passes to cfg80211_probe_status().
1483 *
1484 * @set_noack_map: Set the NoAck Map for the TIDs.
1435 */ 1485 */
1436struct cfg80211_ops { 1486struct cfg80211_ops {
1437 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1487 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1585,7 +1635,7 @@ struct cfg80211_ops {
1585 enum nl80211_channel_type channel_type, 1635 enum nl80211_channel_type channel_type,
1586 bool channel_type_valid, unsigned int wait, 1636 bool channel_type_valid, unsigned int wait,
1587 const u8 *buf, size_t len, bool no_cck, 1637 const u8 *buf, size_t len, bool no_cck,
1588 u64 *cookie); 1638 bool dont_wait_for_ack, u64 *cookie);
1589 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1639 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1590 struct net_device *dev, 1640 struct net_device *dev,
1591 u64 cookie); 1641 u64 cookie);
@@ -1621,6 +1671,15 @@ struct cfg80211_ops {
1621 u16 status_code, const u8 *buf, size_t len); 1671 u16 status_code, const u8 *buf, size_t len);
1622 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 1672 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
1623 u8 *peer, enum nl80211_tdls_operation oper); 1673 u8 *peer, enum nl80211_tdls_operation oper);
1674
1675 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
1676 const u8 *peer, u64 *cookie);
1677
1678 int (*set_noack_map)(struct wiphy *wiphy,
1679 struct net_device *dev,
1680 u16 noack_map);
1681
1682 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
1624}; 1683};
1625 1684
1626/* 1685/*
@@ -1645,7 +1704,9 @@ struct cfg80211_ops {
1645 * regulatory domain no user regulatory domain can enable these channels 1704 * regulatory domain no user regulatory domain can enable these channels
1646 * at a later time. This can be used for devices which do not have 1705 * at a later time. This can be used for devices which do not have
1647 * calibration information guaranteed for frequencies or settings 1706 * calibration information guaranteed for frequencies or settings
1648 * outside of its regulatory domain. 1707 * outside of its regulatory domain. If used in combination with
1708 * WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
1709 * will be followed.
1649 * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure 1710 * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
1650 * that passive scan flags and beaconing flags may not be lifted by 1711 * that passive scan flags and beaconing flags may not be lifted by
1651 * cfg80211 due to regulatory beacon hints. For more information on beacon 1712 * cfg80211 due to regulatory beacon hints. For more information on beacon
@@ -1679,6 +1740,14 @@ struct cfg80211_ops {
1679 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT 1740 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
1680 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be 1741 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
1681 * used for asking the driver/firmware to perform a TDLS operation. 1742 * used for asking the driver/firmware to perform a TDLS operation.
1743 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
1744 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
1745 * when there are virtual interfaces in AP mode by calling
1746 * cfg80211_report_obss_beacon().
1747 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
1748 * responds to probe-requests in hardware.
1749 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
1750 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
1682 */ 1751 */
1683enum wiphy_flags { 1752enum wiphy_flags {
1684 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 1753 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),
@@ -1697,6 +1766,11 @@ enum wiphy_flags {
1697 WIPHY_FLAG_AP_UAPSD = BIT(14), 1766 WIPHY_FLAG_AP_UAPSD = BIT(14),
1698 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 1767 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
1699 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), 1768 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
1769 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
1770 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
1771 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
1772 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
1773 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
1700}; 1774};
1701 1775
1702/** 1776/**
@@ -1869,6 +1943,7 @@ struct wiphy_wowlan_support {
1869 * @software_iftypes: bitmask of software interface types, these are not 1943 * @software_iftypes: bitmask of software interface types, these are not
1870 * subject to any restrictions since they are purely managed in SW. 1944 * subject to any restrictions since they are purely managed in SW.
1871 * @flags: wiphy flags, see &enum wiphy_flags 1945 * @flags: wiphy flags, see &enum wiphy_flags
1946 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
1872 * @bss_priv_size: each BSS struct has private data allocated with it, 1947 * @bss_priv_size: each BSS struct has private data allocated with it,
1873 * this variable determines its size 1948 * this variable determines its size
1874 * @max_scan_ssids: maximum number of SSIDs the device can scan for in 1949 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
@@ -1907,6 +1982,10 @@ struct wiphy_wowlan_support {
1907 * may request, if implemented. 1982 * may request, if implemented.
1908 * 1983 *
1909 * @wowlan: WoWLAN support information 1984 * @wowlan: WoWLAN support information
1985 *
1986 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
1987 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
1988 * If null, then none can be over-ridden.
1910 */ 1989 */
1911struct wiphy { 1990struct wiphy {
1912 /* assign these fields before you register the wiphy */ 1991 /* assign these fields before you register the wiphy */
@@ -1928,7 +2007,9 @@ struct wiphy {
1928 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 2007 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1929 u16 interface_modes; 2008 u16 interface_modes;
1930 2009
1931 u32 flags; 2010 u32 flags, features;
2011
2012 u32 ap_sme_capa;
1932 2013
1933 enum cfg80211_signal_type signal_type; 2014 enum cfg80211_signal_type signal_type;
1934 2015
@@ -1960,6 +2041,13 @@ struct wiphy {
1960 u32 available_antennas_tx; 2041 u32 available_antennas_tx;
1961 u32 available_antennas_rx; 2042 u32 available_antennas_rx;
1962 2043
2044 /*
2045 * Bitmap of supported protocols for probe response offloading
2046 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
2047 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
2048 */
2049 u32 probe_resp_offload;
2050
1963 /* If multiple wiphys are registered and you're handed e.g. 2051 /* If multiple wiphys are registered and you're handed e.g.
1964 * a regular netdev with assigned ieee80211_ptr, you won't 2052 * a regular netdev with assigned ieee80211_ptr, you won't
1965 * know whether it points to a wiphy your driver has registered 2053 * know whether it points to a wiphy your driver has registered
@@ -1987,6 +2075,8 @@ struct wiphy {
1987 /* dir in debugfs: ieee80211/<wiphyname> */ 2075 /* dir in debugfs: ieee80211/<wiphyname> */
1988 struct dentry *debugfsdir; 2076 struct dentry *debugfsdir;
1989 2077
2078 const struct ieee80211_ht_cap *ht_capa_mod_mask;
2079
1990#ifdef CONFIG_NET_NS 2080#ifdef CONFIG_NET_NS
1991 /* the network namespace this phy lives in currently */ 2081 /* the network namespace this phy lives in currently */
1992 struct net *_net; 2082 struct net *_net;
@@ -2183,6 +2273,8 @@ struct wireless_dev {
2183 2273
2184 int beacon_interval; 2274 int beacon_interval;
2185 2275
2276 u32 ap_unexpected_nlpid;
2277
2186#ifdef CONFIG_CFG80211_WEXT 2278#ifdef CONFIG_CFG80211_WEXT
2187 /* wext data */ 2279 /* wext data */
2188 struct { 2280 struct {
@@ -2349,69 +2441,6 @@ extern int ieee80211_radiotap_iterator_next(
2349extern const unsigned char rfc1042_header[6]; 2441extern const unsigned char rfc1042_header[6];
2350extern const unsigned char bridge_tunnel_header[6]; 2442extern const unsigned char bridge_tunnel_header[6];
2351 2443
2352/* Parsed Information Elements */
2353struct ieee802_11_elems {
2354 u8 *ie_start;
2355 size_t total_len;
2356
2357 /* pointers to IEs */
2358 u8 *ssid;
2359 u8 *supp_rates;
2360 u8 *fh_params;
2361 u8 *ds_params;
2362 u8 *cf_params;
2363 struct ieee80211_tim_ie *tim;
2364 u8 *ibss_params;
2365 u8 *challenge;
2366 u8 *wpa;
2367 u8 *rsn;
2368 u8 *erp_info;
2369 u8 *ext_supp_rates;
2370 u8 *wmm_info;
2371 u8 *wmm_param;
2372 struct ieee80211_ht_cap *ht_cap_elem;
2373 struct ieee80211_ht_info *ht_info_elem;
2374 struct ieee80211_meshconf_ie *mesh_config;
2375 u8 *mesh_id;
2376 u8 *peering;
2377 u8 *preq;
2378 u8 *prep;
2379 u8 *perr;
2380 struct ieee80211_rann_ie *rann;
2381 u8 *ch_switch_elem;
2382 u8 *country_elem;
2383 u8 *pwr_constr_elem;
2384 u8 *quiet_elem; /* first quite element */
2385 u8 *timeout_int;
2386
2387 /* length of them, respectively */
2388 u8 ssid_len;
2389 u8 supp_rates_len;
2390 u8 fh_params_len;
2391 u8 ds_params_len;
2392 u8 cf_params_len;
2393 u8 tim_len;
2394 u8 ibss_params_len;
2395 u8 challenge_len;
2396 u8 wpa_len;
2397 u8 rsn_len;
2398 u8 erp_info_len;
2399 u8 ext_supp_rates_len;
2400 u8 wmm_info_len;
2401 u8 wmm_param_len;
2402 u8 mesh_id_len;
2403 u8 peering_len;
2404 u8 preq_len;
2405 u8 prep_len;
2406 u8 perr_len;
2407 u8 ch_switch_elem_len;
2408 u8 country_elem_len;
2409 u8 pwr_constr_elem_len;
2410 u8 quiet_elem_len;
2411 u8 num_of_quiet_elem; /* can be more the one */
2412 u8 timeout_int_len;
2413};
2414
2415/** 2444/**
2416 * ieee80211_get_hdrlen_from_skb - get header length from data 2445 * ieee80211_get_hdrlen_from_skb - get header length from data
2417 * 2446 *
@@ -2636,8 +2665,10 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
2636 * 2665 *
2637 * This informs cfg80211 that BSS information was found and 2666 * This informs cfg80211 that BSS information was found and
2638 * the BSS should be updated/added. 2667 * the BSS should be updated/added.
2668 *
2669 * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
2639 */ 2670 */
2640struct cfg80211_bss* 2671struct cfg80211_bss * __must_check
2641cfg80211_inform_bss_frame(struct wiphy *wiphy, 2672cfg80211_inform_bss_frame(struct wiphy *wiphy,
2642 struct ieee80211_channel *channel, 2673 struct ieee80211_channel *channel,
2643 struct ieee80211_mgmt *mgmt, size_t len, 2674 struct ieee80211_mgmt *mgmt, size_t len,
@@ -2659,8 +2690,10 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2659 * 2690 *
2660 * This informs cfg80211 that BSS information was found and 2691 * This informs cfg80211 that BSS information was found and
2661 * the BSS should be updated/added. 2692 * the BSS should be updated/added.
2693 *
2694 * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()!
2662 */ 2695 */
2663struct cfg80211_bss* 2696struct cfg80211_bss * __must_check
2664cfg80211_inform_bss(struct wiphy *wiphy, 2697cfg80211_inform_bss(struct wiphy *wiphy,
2665 struct ieee80211_channel *channel, 2698 struct ieee80211_channel *channel,
2666 const u8 *bssid, 2699 const u8 *bssid,
@@ -3043,6 +3076,32 @@ void cfg80211_roamed(struct net_device *dev,
3043 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 3076 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3044 3077
3045/** 3078/**
3079 * cfg80211_roamed_bss - notify cfg80211 of roaming
3080 *
3081 * @dev: network device
3082 * @bss: entry of bss to which STA got roamed
3083 * @req_ie: association request IEs (maybe be %NULL)
3084 * @req_ie_len: association request IEs length
3085 * @resp_ie: association response IEs (may be %NULL)
3086 * @resp_ie_len: assoc response IEs length
3087 * @gfp: allocation flags
3088 *
3089 * This is just a wrapper to notify cfg80211 of roaming event with driver
3090 * passing bss to avoid a race in timeout of the bss entry. It should be
3091 * called by the underlying driver whenever it roamed from one AP to another
3092 * while connected. Drivers which have roaming implemented in firmware
3093 * may use this function to avoid a race in bss entry timeout where the bss
3094 * entry of the new AP is seen in the driver, but gets timed out by the time
3095 * it is accessed in __cfg80211_roamed() due to delay in scheduling
3096 * rdev->event_work. In case of any failures, the reference is released
3097 * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3098 * it will be released while diconneting from the current bss.
3099 */
3100void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3101 const u8 *req_ie, size_t req_ie_len,
3102 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3103
3104/**
3046 * cfg80211_disconnected - notify cfg80211 that connection was dropped 3105 * cfg80211_disconnected - notify cfg80211 that connection was dropped
3047 * 3106 *
3048 * @dev: network device 3107 * @dev: network device
@@ -3189,6 +3248,74 @@ void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
3189void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, 3248void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
3190 const u8 *bssid, bool preauth, gfp_t gfp); 3249 const u8 *bssid, bool preauth, gfp_t gfp);
3191 3250
3251/**
3252 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
3253 * @dev: The device the frame matched to
3254 * @addr: the transmitter address
3255 * @gfp: context flags
3256 *
3257 * This function is used in AP mode (only!) to inform userspace that
3258 * a spurious class 3 frame was received, to be able to deauth the
3259 * sender.
3260 * Returns %true if the frame was passed to userspace (or this failed
3261 * for a reason other than not having a subscription.)
3262 */
3263bool cfg80211_rx_spurious_frame(struct net_device *dev,
3264 const u8 *addr, gfp_t gfp);
3265
3266/**
3267 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
3268 * @dev: The device the frame matched to
3269 * @addr: the transmitter address
3270 * @gfp: context flags
3271 *
3272 * This function is used in AP mode (only!) to inform userspace that
3273 * an associated station sent a 4addr frame but that wasn't expected.
3274 * It is allowed and desirable to send this event only once for each
3275 * station to avoid event flooding.
3276 * Returns %true if the frame was passed to userspace (or this failed
3277 * for a reason other than not having a subscription.)
3278 */
3279bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
3280 const u8 *addr, gfp_t gfp);
3281
3282/**
3283 * cfg80211_probe_status - notify userspace about probe status
3284 * @dev: the device the probe was sent on
3285 * @addr: the address of the peer
3286 * @cookie: the cookie filled in @probe_client previously
3287 * @acked: indicates whether probe was acked or not
3288 * @gfp: allocation flags
3289 */
3290void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3291 u64 cookie, bool acked, gfp_t gfp);
3292
3293/**
3294 * cfg80211_report_obss_beacon - report beacon from other APs
3295 * @wiphy: The wiphy that received the beacon
3296 * @frame: the frame
3297 * @len: length of the frame
3298 * @freq: frequency the frame was received on
3299 * @gfp: allocation flags
3300 *
3301 * Use this function to report to userspace when a beacon was
3302 * received. It is not useful to call this when there is no
3303 * netdev that is in AP/GO mode.
3304 */
3305void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3306 const u8 *frame, size_t len,
3307 int freq, gfp_t gfp);
3308
3309/*
3310 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
3311 * @wiphy: the wiphy
3312 * @chan: main channel
3313 * @channel_type: HT mode
3314 */
3315int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3316 struct ieee80211_channel *chan,
3317 enum nl80211_channel_type channel_type);
3318
3192/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3319/* Logging, debugging and troubleshooting/diagnostic helpers. */
3193 3320
3194/* wiphy_printk helpers, similar to dev_printk */ 3321/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 839f768f9e35..7828ebf99ee1 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -11,6 +11,11 @@
11#ifndef __LINUX_NET_DSA_H 11#ifndef __LINUX_NET_DSA_H
12#define __LINUX_NET_DSA_H 12#define __LINUX_NET_DSA_H
13 13
14#include <linux/if_ether.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/workqueue.h>
18
14#define DSA_MAX_SWITCHES 4 19#define DSA_MAX_SWITCHES 4
15#define DSA_MAX_PORTS 12 20#define DSA_MAX_PORTS 12
16 21
@@ -54,8 +59,143 @@ struct dsa_platform_data {
54 struct dsa_chip_data *chip; 59 struct dsa_chip_data *chip;
55}; 60};
56 61
57extern bool dsa_uses_dsa_tags(void *dsa_ptr); 62struct dsa_switch_tree {
58extern bool dsa_uses_trailer_tags(void *dsa_ptr); 63 /*
64 * Configuration data for the platform device that owns
65 * this dsa switch tree instance.
66 */
67 struct dsa_platform_data *pd;
68
69 /*
70 * Reference to network device to use, and which tagging
71 * protocol to use.
72 */
73 struct net_device *master_netdev;
74 __be16 tag_protocol;
75
76 /*
77 * The switch and port to which the CPU is attached.
78 */
79 s8 cpu_switch;
80 s8 cpu_port;
81
82 /*
83 * Link state polling.
84 */
85 int link_poll_needed;
86 struct work_struct link_poll_work;
87 struct timer_list link_poll_timer;
88
89 /*
90 * Data for the individual switch chips.
91 */
92 struct dsa_switch *ds[DSA_MAX_SWITCHES];
93};
94
95struct dsa_switch {
96 /*
97 * Parent switch tree, and switch index.
98 */
99 struct dsa_switch_tree *dst;
100 int index;
101
102 /*
103 * Configuration data for this switch.
104 */
105 struct dsa_chip_data *pd;
106
107 /*
108 * The used switch driver.
109 */
110 struct dsa_switch_driver *drv;
111
112 /*
113 * Reference to mii bus to use.
114 */
115 struct mii_bus *master_mii_bus;
116
117 /*
118 * Slave mii_bus and devices for the individual ports.
119 */
120 u32 dsa_port_mask;
121 u32 phys_port_mask;
122 struct mii_bus *slave_mii_bus;
123 struct net_device *ports[DSA_MAX_PORTS];
124};
125
126static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
127{
128 return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
129}
130
131static inline u8 dsa_upstream_port(struct dsa_switch *ds)
132{
133 struct dsa_switch_tree *dst = ds->dst;
134
135 /*
136 * If this is the root switch (i.e. the switch that connects
137 * to the CPU), return the cpu port number on this switch.
138 * Else return the (DSA) port number that connects to the
139 * switch that is one hop closer to the cpu.
140 */
141 if (dst->cpu_switch == ds->index)
142 return dst->cpu_port;
143 else
144 return ds->pd->rtable[dst->cpu_switch];
145}
146
147struct dsa_switch_driver {
148 struct list_head list;
149
150 __be16 tag_protocol;
151 int priv_size;
152
153 /*
154 * Probing and setup.
155 */
156 char *(*probe)(struct mii_bus *bus, int sw_addr);
157 int (*setup)(struct dsa_switch *ds);
158 int (*set_addr)(struct dsa_switch *ds, u8 *addr);
159
160 /*
161 * Access to the switch's PHY registers.
162 */
163 int (*phy_read)(struct dsa_switch *ds, int port, int regnum);
164 int (*phy_write)(struct dsa_switch *ds, int port,
165 int regnum, u16 val);
166
167 /*
168 * Link state polling and IRQ handling.
169 */
170 void (*poll_link)(struct dsa_switch *ds);
171
172 /*
173 * ethtool hardware statistics.
174 */
175 void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data);
176 void (*get_ethtool_stats)(struct dsa_switch *ds,
177 int port, uint64_t *data);
178 int (*get_sset_count)(struct dsa_switch *ds);
179};
180
181void register_switch_driver(struct dsa_switch_driver *type);
182void unregister_switch_driver(struct dsa_switch_driver *type);
183
184/*
185 * The original DSA tag format and some other tag formats have no
186 * ethertype, which means that we need to add a little hack to the
187 * networking receive path to make sure that received frames get
188 * the right ->protocol assigned to them when one of those tag
189 * formats is in use.
190 */
191static inline bool dsa_uses_dsa_tags(struct dsa_switch_tree *dst)
192{
193 return !!(dst->tag_protocol == htons(ETH_P_DSA));
194}
59 195
196static inline bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst)
197{
198 return !!(dst->tag_protocol == htons(ETH_P_TRAILER));
199}
60 200
61#endif 201#endif
diff --git a/include/net/dst.h b/include/net/dst.h
index 6faec1a60216..344c8dd02874 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -53,6 +53,7 @@ struct dst_entry {
53#define DST_NOHASH 0x0008 53#define DST_NOHASH 0x0008
54#define DST_NOCACHE 0x0010 54#define DST_NOCACHE 0x0010
55#define DST_NOCOUNT 0x0020 55#define DST_NOCOUNT 0x0020
56#define DST_NOPEER 0x0040
56 57
57 short error; 58 short error;
58 short obsolete; 59 short obsolete;
@@ -86,12 +87,12 @@ struct dst_entry {
86 }; 87 };
87}; 88};
88 89
89static inline struct neighbour *dst_get_neighbour(struct dst_entry *dst) 90static inline struct neighbour *dst_get_neighbour_noref(struct dst_entry *dst)
90{ 91{
91 return rcu_dereference(dst->_neighbour); 92 return rcu_dereference(dst->_neighbour);
92} 93}
93 94
94static inline struct neighbour *dst_get_neighbour_raw(struct dst_entry *dst) 95static inline struct neighbour *dst_get_neighbour_noref_raw(struct dst_entry *dst)
95{ 96{
96 return rcu_dereference_raw(dst->_neighbour); 97 return rcu_dereference_raw(dst->_neighbour);
97} 98}
@@ -392,7 +393,7 @@ static inline void dst_confirm(struct dst_entry *dst)
392 struct neighbour *n; 393 struct neighbour *n;
393 394
394 rcu_read_lock(); 395 rcu_read_lock();
395 n = dst_get_neighbour(dst); 396 n = dst_get_neighbour_noref(dst);
396 neigh_confirm(n); 397 neigh_confirm(n);
397 rcu_read_unlock(); 398 rcu_read_unlock();
398 } 399 }
diff --git a/include/net/flow.h b/include/net/flow.h
index a09447749e2d..da1f064a81b3 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -59,8 +59,11 @@ struct flowi4 {
59#define flowi4_proto __fl_common.flowic_proto 59#define flowi4_proto __fl_common.flowic_proto
60#define flowi4_flags __fl_common.flowic_flags 60#define flowi4_flags __fl_common.flowic_flags
61#define flowi4_secid __fl_common.flowic_secid 61#define flowi4_secid __fl_common.flowic_secid
62 __be32 daddr; 62
63 /* (saddr,daddr) must be grouped, same order as in IP header */
63 __be32 saddr; 64 __be32 saddr;
65 __be32 daddr;
66
64 union flowi_uli uli; 67 union flowi_uli uli;
65#define fl4_sport uli.ports.sport 68#define fl4_sport uli.ports.sport
66#define fl4_dport uli.ports.dport 69#define fl4_dport uli.ports.dport
@@ -207,6 +210,7 @@ extern struct flow_cache_object *flow_cache_lookup(
207 u8 dir, flow_resolve_t resolver, void *ctx); 210 u8 dir, flow_resolve_t resolver, void *ctx);
208 211
209extern void flow_cache_flush(void); 212extern void flow_cache_flush(void);
213extern void flow_cache_flush_deferred(void);
210extern atomic_t flow_cache_genid; 214extern atomic_t flow_cache_genid;
211 215
212#endif 216#endif
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
new file mode 100644
index 000000000000..80461c1ae9ef
--- /dev/null
+++ b/include/net/flow_keys.h
@@ -0,0 +1,16 @@
1#ifndef _NET_FLOW_KEYS_H
2#define _NET_FLOW_KEYS_H
3
4struct flow_keys {
5 /* (src,dst) must be grouped, in the same way than in IP header */
6 __be32 src;
7 __be32 dst;
8 union {
9 __be32 ports;
10 __be16 port16[2];
11 };
12 u8 ip_proto;
13};
14
15extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
16#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 82d8d09faa44..7db32995ccd3 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -128,6 +128,8 @@ extern int genl_register_mc_group(struct genl_family *family,
128 struct genl_multicast_group *grp); 128 struct genl_multicast_group *grp);
129extern void genl_unregister_mc_group(struct genl_family *family, 129extern void genl_unregister_mc_group(struct genl_family *family,
130 struct genl_multicast_group *grp); 130 struct genl_multicast_group *grp);
131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
132 u32 group, struct nlmsghdr *nlh, gfp_t flags);
131 133
132/** 134/**
133 * genlmsg_put - Add generic netlink header to netlink message 135 * genlmsg_put - Add generic netlink header to netlink message
diff --git a/include/net/icmp.h b/include/net/icmp.h
index f0698b955b73..75d615649071 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -31,8 +31,8 @@ struct icmp_err {
31extern const struct icmp_err icmp_err_convert[]; 31extern const struct icmp_err icmp_err_convert[];
32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) 32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) 33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field)
34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) 34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256)
35#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmpmsg_statistics, field) 35#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field)
36 36
37struct dst_entry; 37struct dst_entry;
38struct net_proto_family; 38struct net_proto_family;
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 7e2c4d483ad0..71392545d0a1 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -271,14 +271,6 @@ enum ieee80211_radiotap_type {
271#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 271#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
272 272
273 273
274/* Ugly macro to convert literal channel numbers into their mhz equivalents
275 * There are certianly some conditions that will break this (like feeding it '30')
276 * but they shouldn't arise since nothing talks on channel 30. */
277#define ieee80211chan2mhz(x) \
278 (((x) <= 14) ? \
279 (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
280 ((x) + 1000) * 5)
281
282/* helpers */ 274/* helpers */
283static inline int ieee80211_get_radiotap_len(unsigned char *data) 275static inline int ieee80211_get_radiotap_len(unsigned char *data)
284{ 276{
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index d52685defb11..ee59f8b188dd 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -21,11 +21,14 @@
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com> 21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com> 22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
24 */ 25 */
25 26
26#ifndef NET_IEEE802154_H 27#ifndef NET_IEEE802154_H
27#define NET_IEEE802154_H 28#define NET_IEEE802154_H
28 29
30#define IEEE802154_MTU 127
31
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 32#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 33#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
31#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */ 34#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
@@ -56,6 +59,9 @@
56 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT) 59 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
57 60
58 61
62/* MAC footer size */
63#define IEEE802154_MFR_SIZE 2 /* 2 octets */
64
59/* MAC's Command Frames Identifiers */ 65/* MAC's Command Frames Identifiers */
60#define IEEE802154_CMD_ASSOCIATION_REQ 0x01 66#define IEEE802154_CMD_ASSOCIATION_REQ 0x01
61#define IEEE802154_CMD_ASSOCIATION_RESP 0x02 67#define IEEE802154_CMD_ASSOCIATION_RESP 0x02
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index e46674d5daea..00cbb4384c79 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -15,7 +15,7 @@
15#define _INET6_HASHTABLES_H 15#define _INET6_HASHTABLES_H
16 16
17 17
18#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 18#if IS_ENABLED(CONFIG_IPV6)
19#include <linux/in6.h> 19#include <linux/in6.h>
20#include <linux/ipv6.h> 20#include <linux/ipv6.h>
21#include <linux/types.h> 21#include <linux/types.h>
@@ -110,5 +110,5 @@ extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo
110 const struct in6_addr *saddr, const __be16 sport, 110 const struct in6_addr *saddr, const __be16 sport,
111 const struct in6_addr *daddr, const __be16 dport, 111 const struct in6_addr *daddr, const __be16 dport,
112 const int dif); 112 const int dif);
113#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */ 113#endif /* IS_ENABLED(CONFIG_IPV6) */
114#endif /* _INET6_HASHTABLES_H */ 114#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index e6db62e756dc..dbf9aab34c82 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -143,9 +143,9 @@ static inline void *inet_csk_ca(const struct sock *sk)
143 return (void *)inet_csk(sk)->icsk_ca_priv; 143 return (void *)inet_csk(sk)->icsk_ca_priv;
144} 144}
145 145
146extern struct sock *inet_csk_clone(struct sock *sk, 146extern struct sock *inet_csk_clone_lock(const struct sock *sk,
147 const struct request_sock *req, 147 const struct request_sock *req,
148 const gfp_t priority); 148 const gfp_t priority);
149 149
150enum inet_csk_ack_state_t { 150enum inet_csk_ack_state_t {
151 ICSK_ACK_SCHED = 1, 151 ICSK_ACK_SCHED = 1,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index f941964a9931..e3e405106afe 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -71,7 +71,7 @@ struct ip_options_data {
71 71
72struct inet_request_sock { 72struct inet_request_sock {
73 struct request_sock req; 73 struct request_sock req;
74#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 74#if IS_ENABLED(CONFIG_IPV6)
75 u16 inet6_rsk_offset; 75 u16 inet6_rsk_offset;
76#endif 76#endif
77 __be16 loc_port; 77 __be16 loc_port;
@@ -139,7 +139,7 @@ struct rtable;
139struct inet_sock { 139struct inet_sock {
140 /* sk and pinet6 has to be the first two members of inet_sock */ 140 /* sk and pinet6 has to be the first two members of inet_sock */
141 struct sock sk; 141 struct sock sk;
142#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 142#if IS_ENABLED(CONFIG_IPV6)
143 struct ipv6_pinfo *pinet6; 143 struct ipv6_pinfo *pinet6;
144#endif 144#endif
145 /* Socket demultiplex comparisons on incoming packets. */ 145 /* Socket demultiplex comparisons on incoming packets. */
@@ -188,7 +188,7 @@ static inline void __inet_sk_copy_descendant(struct sock *sk_to,
188 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, 188 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
189 sk_from->sk_prot->obj_size - ancestor_size); 189 sk_from->sk_prot->obj_size - ancestor_size);
190} 190}
191#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) 191#if !(IS_ENABLED(CONFIG_IPV6))
192static inline void inet_sk_copy_descendant(struct sock *sk_to, 192static inline void inet_sk_copy_descendant(struct sock *sk_to,
193 const struct sock *sk_from) 193 const struct sock *sk_from)
194{ 194{
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index e8c25b981205..ba52c830a7a5 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -218,20 +218,12 @@ extern void inet_twsk_purge(struct inet_hashinfo *hashinfo,
218static inline 218static inline
219struct net *twsk_net(const struct inet_timewait_sock *twsk) 219struct net *twsk_net(const struct inet_timewait_sock *twsk)
220{ 220{
221#ifdef CONFIG_NET_NS 221 return read_pnet(&twsk->tw_net);
222 return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
223 /* reference counting, */
224 /* initialization, or RCU. */
225#else
226 return &init_net;
227#endif
228} 222}
229 223
230static inline 224static inline
231void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) 225void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
232{ 226{
233#ifdef CONFIG_NET_NS 227 write_pnet(&twsk->tw_net, net);
234 rcu_assign_pointer(twsk->tw_net, net);
235#endif
236} 228}
237#endif /* _INET_TIMEWAIT_SOCK_ */ 229#endif /* _INET_TIMEWAIT_SOCK_ */
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index e9ff3fc5e688..06b795dd5906 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -87,7 +87,7 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr,
87{ 87{
88 struct inetpeer_addr daddr; 88 struct inetpeer_addr daddr;
89 89
90 ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr); 90 *(struct in6_addr *)daddr.addr.a6 = *v6daddr;
91 daddr.family = AF_INET6; 91 daddr.family = AF_INET6;
92 return inet_getpeer(&daddr, create); 92 return inet_getpeer(&daddr, create);
93} 93}
diff --git a/include/net/ip.h b/include/net/ip.h
index eca0ef7a495e..775009f9eaba 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -353,14 +353,14 @@ static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast,
353 memcpy(buf, &naddr, sizeof(naddr)); 353 memcpy(buf, &naddr, sizeof(naddr));
354} 354}
355 355
356#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 356#if IS_ENABLED(CONFIG_IPV6)
357#include <linux/ipv6.h> 357#include <linux/ipv6.h>
358#endif 358#endif
359 359
360static __inline__ void inet_reset_saddr(struct sock *sk) 360static __inline__ void inet_reset_saddr(struct sock *sk)
361{ 361{
362 inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0; 362 inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
363#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 363#if IS_ENABLED(CONFIG_IPV6)
364 if (sk->sk_family == PF_INET6) { 364 if (sk->sk_family == PF_INET6) {
365 struct ipv6_pinfo *np = inet6_sk(sk); 365 struct ipv6_pinfo *np = inet6_sk(sk);
366 366
@@ -379,7 +379,7 @@ static inline int sk_mc_loop(struct sock *sk)
379 switch (sk->sk_family) { 379 switch (sk->sk_family) {
380 case AF_INET: 380 case AF_INET:
381 return inet_sk(sk)->mc_loop; 381 return inet_sk(sk)->mc_loop;
382#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 382#if IS_ENABLED(CONFIG_IPV6)
383 case AF_INET6: 383 case AF_INET6:
384 return inet6_sk(sk)->mc_loop; 384 return inet6_sk(sk)->mc_loop;
385#endif 385#endif
@@ -450,7 +450,7 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
450 * Functions provided by ip_sockglue.c 450 * Functions provided by ip_sockglue.c
451 */ 451 */
452 452
453extern int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 453extern void ipv4_pktinfo_prepare(struct sk_buff *skb);
454extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 454extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
455extern int ip_cmsg_send(struct net *net, 455extern int ip_cmsg_send(struct net *net,
456 struct msghdr *msg, struct ipcm_cookie *ipc); 456 struct msghdr *msg, struct ipcm_cookie *ipc);
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 5735a0f979c3..b26bb8101981 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -86,9 +86,6 @@ struct fib6_table;
86struct rt6_info { 86struct rt6_info {
87 struct dst_entry dst; 87 struct dst_entry dst;
88 88
89#define rt6i_dev dst.dev
90#define rt6i_expires dst.expires
91
92 /* 89 /*
93 * Tail elements of dst_entry (__refcnt etc.) 90 * Tail elements of dst_entry (__refcnt etc.)
94 * and these elements (rarely used in hot path) are in 91 * and these elements (rarely used in hot path) are in
@@ -202,6 +199,10 @@ struct fib6_node *fib6_locate(struct fib6_node *root,
202 const struct in6_addr *daddr, int dst_len, 199 const struct in6_addr *daddr, int dst_len,
203 const struct in6_addr *saddr, int src_len); 200 const struct in6_addr *saddr, int src_len);
204 201
202extern void fib6_clean_all_ro(struct net *net,
203 int (*func)(struct rt6_info *, void *arg),
204 int prune, void *arg);
205
205extern void fib6_clean_all(struct net *net, 206extern void fib6_clean_all(struct net *net,
206 int (*func)(struct rt6_info *, void *arg), 207 int (*func)(struct rt6_info *, void *arg),
207 int prune, void *arg); 208 int prune, void *arg);
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5e91b72fc718..2ad92ca4e6f3 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -70,6 +70,8 @@ extern void ip6_route_input(struct sk_buff *skb);
70extern struct dst_entry * ip6_route_output(struct net *net, 70extern struct dst_entry * ip6_route_output(struct net *net,
71 const struct sock *sk, 71 const struct sock *sk,
72 struct flowi6 *fl6); 72 struct flowi6 *fl6);
73extern struct dst_entry * ip6_route_lookup(struct net *net,
74 struct flowi6 *fl6, int flags);
73 75
74extern int ip6_route_init(void); 76extern int ip6_route_init(void);
75extern void ip6_route_cleanup(void); 77extern void ip6_route_cleanup(void);
@@ -95,14 +97,14 @@ extern struct rt6_info *rt6_lookup(struct net *net,
95 97
96extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, 98extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
97 struct neighbour *neigh, 99 struct neighbour *neigh,
98 const struct in6_addr *addr); 100 struct flowi6 *fl6);
99extern int icmp6_dst_gc(void); 101extern int icmp6_dst_gc(void);
100 102
101extern void fib6_force_start_gc(struct net *net); 103extern void fib6_force_start_gc(struct net *net);
102 104
103extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, 105extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
104 const struct in6_addr *addr, 106 const struct in6_addr *addr,
105 int anycast); 107 bool anycast);
106 108
107extern int ip6_dst_hoplimit(struct dst_entry *dst); 109extern int ip6_dst_hoplimit(struct dst_entry *dst);
108 110
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 873d5be7926c..ebe517f2da9f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -21,7 +21,7 @@
21#include <linux/netfilter.h> /* for union nf_inet_addr */ 21#include <linux/netfilter.h> /* for union nf_inet_addr */
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> /* for ipv6_addr_copy */ 24#include <net/ipv6.h>
25#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 25#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
26#include <net/netfilter/nf_conntrack.h> 26#include <net/netfilter/nf_conntrack.h>
27#endif 27#endif
@@ -119,8 +119,8 @@ ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr)
119 const struct ipv6hdr *iph = nh; 119 const struct ipv6hdr *iph = nh;
120 iphdr->len = sizeof(struct ipv6hdr); 120 iphdr->len = sizeof(struct ipv6hdr);
121 iphdr->protocol = iph->nexthdr; 121 iphdr->protocol = iph->nexthdr;
122 ipv6_addr_copy(&iphdr->saddr.in6, &iph->saddr); 122 iphdr->saddr.in6 = iph->saddr;
123 ipv6_addr_copy(&iphdr->daddr.in6, &iph->daddr); 123 iphdr->daddr.in6 = iph->daddr;
124 } else 124 } else
125#endif 125#endif
126 { 126 {
@@ -137,7 +137,7 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
137{ 137{
138#ifdef CONFIG_IP_VS_IPV6 138#ifdef CONFIG_IP_VS_IPV6
139 if (af == AF_INET6) 139 if (af == AF_INET6)
140 ipv6_addr_copy(&dst->in6, &src->in6); 140 dst->in6 = src->in6;
141 else 141 else
142#endif 142#endif
143 dst->ip = src->ip; 143 dst->ip = src->ip;
@@ -1207,7 +1207,7 @@ extern void ip_vs_control_cleanup(void);
1207extern struct ip_vs_dest * 1207extern struct ip_vs_dest *
1208ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1208ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
1209 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1209 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1210 __u16 protocol, __u32 fwmark); 1210 __u16 protocol, __u32 fwmark, __u32 flags);
1211extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1211extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1212 1212
1213 1213
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a366a8a1fe23..e4170a22fc6f 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -132,6 +132,15 @@ extern struct ctl_path net_ipv6_ctl_path[];
132 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ 132 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
133}) 133})
134 134
135/* per device and per net counters are atomic_long_t */
136#define _DEVINC_ATOMIC_ATOMIC(net, statname, idev, field) \
137({ \
138 struct inet6_dev *_idev = (idev); \
139 if (likely(_idev != NULL)) \
140 SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \
141 SNMP_INC_STATS_ATOMIC_LONG((net)->mib.statname##_statistics, (field));\
142})
143
135#define _DEVADD(net, statname, modifier, idev, field, val) \ 144#define _DEVADD(net, statname, modifier, idev, field, val) \
136({ \ 145({ \
137 struct inet6_dev *_idev = (idev); \ 146 struct inet6_dev *_idev = (idev); \
@@ -168,11 +177,11 @@ extern struct ctl_path net_ipv6_ctl_path[];
168 _DEVINCATOMIC(net, icmpv6, _BH, idev, field) 177 _DEVINCATOMIC(net, icmpv6, _BH, idev, field)
169 178
170#define ICMP6MSGOUT_INC_STATS(net, idev, field) \ 179#define ICMP6MSGOUT_INC_STATS(net, idev, field) \
171 _DEVINCATOMIC(net, icmpv6msg, , idev, field +256) 180 _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256)
172#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ 181#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \
173 _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256) 182 _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256)
174#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ 183#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \
175 _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field) 184 _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field)
176 185
177struct ip6_ra_chain { 186struct ip6_ra_chain {
178 struct ip6_ra_chain *next; 187 struct ip6_ra_chain *next;
@@ -300,11 +309,6 @@ ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
300 ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3])); 309 ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]));
301} 310}
302 311
303static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
304{
305 memcpy(a1, a2, sizeof(struct in6_addr));
306}
307
308static inline void ipv6_addr_prefix(struct in6_addr *pfx, 312static inline void ipv6_addr_prefix(struct in6_addr *pfx,
309 const struct in6_addr *addr, 313 const struct in6_addr *addr,
310 int plen) 314 int plen)
@@ -554,7 +558,7 @@ extern void ipv6_push_frag_opts(struct sk_buff *skb,
554 u8 *proto); 558 u8 *proto);
555 559
556extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 560extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
557 u8 *nexthdrp); 561 u8 *nexthdrp, __be16 *frag_offp);
558 562
559extern int ipv6_ext_hdr(u8 nexthdr); 563extern int ipv6_ext_hdr(u8 nexthdr);
560 564
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index f2419cf44cef..0954ec959159 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -27,7 +27,6 @@ enum {
27 IUCV_OPEN, 27 IUCV_OPEN,
28 IUCV_BOUND, 28 IUCV_BOUND,
29 IUCV_LISTEN, 29 IUCV_LISTEN,
30 IUCV_SEVERED,
31 IUCV_DISCONN, 30 IUCV_DISCONN,
32 IUCV_CLOSING, 31 IUCV_CLOSING,
33 IUCV_CLOSED 32 IUCV_CLOSED
@@ -146,7 +145,6 @@ unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
146 poll_table *wait); 145 poll_table *wait);
147void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); 146void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
148void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); 147void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
149int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
150void iucv_accept_enqueue(struct sock *parent, struct sock *sk); 148void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
151void iucv_accept_unlink(struct sock *sk); 149void iucv_accept_unlink(struct sock *sk);
152struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock); 150struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 72eddd1b410b..d49928ba5d09 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -166,6 +166,7 @@ struct ieee80211_low_level_stats {
166 * that it is only ever disabled for station mode. 166 * that it is only ever disabled for station mode.
167 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. 167 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
168 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 168 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)
169 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
169 */ 170 */
170enum ieee80211_bss_change { 171enum ieee80211_bss_change {
171 BSS_CHANGED_ASSOC = 1<<0, 172 BSS_CHANGED_ASSOC = 1<<0,
@@ -184,6 +185,7 @@ enum ieee80211_bss_change {
184 BSS_CHANGED_QOS = 1<<13, 185 BSS_CHANGED_QOS = 1<<13,
185 BSS_CHANGED_IDLE = 1<<14, 186 BSS_CHANGED_IDLE = 1<<14,
186 BSS_CHANGED_SSID = 1<<15, 187 BSS_CHANGED_SSID = 1<<15,
188 BSS_CHANGED_AP_PROBE_RESP = 1<<16,
187 189
188 /* when adding here, make sure to change ieee80211_reconfig */ 190 /* when adding here, make sure to change ieee80211_reconfig */
189}; 191};
@@ -518,7 +520,7 @@ struct ieee80211_tx_rate {
518 * @flags: transmit info flags, defined above 520 * @flags: transmit info flags, defined above
519 * @band: the band to transmit on (use for checking for races) 521 * @band: the band to transmit on (use for checking for races)
520 * @antenna_sel_tx: antenna to use, 0 for automatic diversity 522 * @antenna_sel_tx: antenna to use, 0 for automatic diversity
521 * @pad: padding, ignore 523 * @ack_frame_id: internal frame ID for TX status, used internally
522 * @control: union for control data 524 * @control: union for control data
523 * @status: union for status data 525 * @status: union for status data
524 * @driver_data: array of driver_data pointers 526 * @driver_data: array of driver_data pointers
@@ -535,8 +537,7 @@ struct ieee80211_tx_info {
535 537
536 u8 antenna_sel_tx; 538 u8 antenna_sel_tx;
537 539
538 /* 2 byte hole */ 540 u16 ack_frame_id;
539 u8 pad[2];
540 541
541 union { 542 union {
542 struct { 543 struct {
@@ -901,6 +902,10 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
901 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a 902 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
902 * CCMP key if it requires CCMP encryption of management frames (MFP) to 903 * CCMP key if it requires CCMP encryption of management frames (MFP) to
903 * be done in software. 904 * be done in software.
905 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
906 * for a CCMP key if space should be prepared for the IV, but the IV
907 * itself should not be generated. Do not set together with
908 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.
904 */ 909 */
905enum ieee80211_key_flags { 910enum ieee80211_key_flags {
906 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 911 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
@@ -908,6 +913,7 @@ enum ieee80211_key_flags {
908 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 913 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
909 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 914 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
910 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4, 915 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
916 IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5,
911}; 917};
912 918
913/** 919/**
@@ -1304,6 +1310,16 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1304} 1310}
1305 1311
1306/** 1312/**
1313 * ieee80211_free_txskb - free TX skb
1314 * @hw: the hardware
1315 * @skb: the skb
1316 *
1317 * Free a transmit skb. Use this funtion when some failure
1318 * to transmit happened and thus status cannot be reported.
1319 */
1320void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1321
1322/**
1307 * DOC: Hardware crypto acceleration 1323 * DOC: Hardware crypto acceleration
1308 * 1324 *
1309 * mac80211 is capable of taking advantage of many hardware 1325 * mac80211 is capable of taking advantage of many hardware
@@ -1423,7 +1439,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1423 * DOC: Beacon filter support 1439 * DOC: Beacon filter support
1424 * 1440 *
1425 * Some hardware have beacon filter support to reduce host cpu wakeups 1441 * Some hardware have beacon filter support to reduce host cpu wakeups
1426 * which will reduce system power consumption. It usuallly works so that 1442 * which will reduce system power consumption. It usually works so that
1427 * the firmware creates a checksum of the beacon but omits all constantly 1443 * the firmware creates a checksum of the beacon but omits all constantly
1428 * changing elements (TSF, TIM etc). Whenever the checksum changes the 1444 * changing elements (TSF, TIM etc). Whenever the checksum changes the
1429 * beacon is forwarded to the host, otherwise it will be just dropped. That 1445 * beacon is forwarded to the host, otherwise it will be just dropped. That
@@ -1744,11 +1760,21 @@ enum ieee80211_frame_release_type {
1744 * skb contains the buffer starting from the IEEE 802.11 header. 1760 * skb contains the buffer starting from the IEEE 802.11 header.
1745 * The low-level driver should send the frame out based on 1761 * The low-level driver should send the frame out based on
1746 * configuration in the TX control data. This handler should, 1762 * configuration in the TX control data. This handler should,
1747 * preferably, never fail and stop queues appropriately, more 1763 * preferably, never fail and stop queues appropriately.
1748 * importantly, however, it must never fail for A-MPDU-queues. 1764 * This must be implemented if @tx_frags is not.
1749 * This function should return NETDEV_TX_OK except in very 1765 * Must be atomic.
1750 * limited cases. 1766 *
1751 * Must be implemented and atomic. 1767 * @tx_frags: Called to transmit multiple fragments of a single MSDU.
1768 * This handler must consume all fragments, sending out some of
1769 * them only is useless and it can't ask for some of them to be
1770 * queued again. If the frame is not fragmented the queue has a
1771 * single SKB only. To avoid issues with the networking stack
1772 * when TX status is reported the frames should be removed from
1773 * the skb queue.
1774 * If this is used, the tx_info @vif and @sta pointers will be
1775 * invalid -- you must not use them in that case.
1776 * This must be implemented if @tx isn't.
1777 * Must be atomic.
1752 * 1778 *
1753 * @start: Called before the first netdevice attached to the hardware 1779 * @start: Called before the first netdevice attached to the hardware
1754 * is enabled. This should turn on the hardware and must turn on 1780 * is enabled. This should turn on the hardware and must turn on
@@ -2085,6 +2111,8 @@ enum ieee80211_frame_release_type {
2085 */ 2111 */
2086struct ieee80211_ops { 2112struct ieee80211_ops {
2087 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 2113 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
2114 void (*tx_frags)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2115 struct ieee80211_sta *sta, struct sk_buff_head *skbs);
2088 int (*start)(struct ieee80211_hw *hw); 2116 int (*start)(struct ieee80211_hw *hw);
2089 void (*stop)(struct ieee80211_hw *hw); 2117 void (*stop)(struct ieee80211_hw *hw);
2090#ifdef CONFIG_PM 2118#ifdef CONFIG_PM
@@ -2661,6 +2689,19 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
2661} 2689}
2662 2690
2663/** 2691/**
2692 * ieee80211_proberesp_get - retrieve a Probe Response template
2693 * @hw: pointer obtained from ieee80211_alloc_hw().
2694 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2695 *
2696 * Creates a Probe Response template which can, for example, be uploaded to
2697 * hardware. The destination address should be set by the caller.
2698 *
2699 * Can only be called in AP mode.
2700 */
2701struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
2702 struct ieee80211_vif *vif);
2703
2704/**
2664 * ieee80211_pspoll_get - retrieve a PS Poll template 2705 * ieee80211_pspoll_get - retrieve a PS Poll template
2665 * @hw: pointer obtained from ieee80211_alloc_hw(). 2706 * @hw: pointer obtained from ieee80211_alloc_hw().
2666 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2707 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
@@ -3461,9 +3502,12 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
3461 * 3502 *
3462 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have 3503 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
3463 * changed, rate control algorithm can update its internal state if needed. 3504 * changed, rate control algorithm can update its internal state if needed.
3505 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate
3506 * control algorithm needs to adjust accordingly.
3464 */ 3507 */
3465enum rate_control_changed { 3508enum rate_control_changed {
3466 IEEE80211_RC_HT_CHANGED = BIT(0) 3509 IEEE80211_RC_HT_CHANGED = BIT(0),
3510 IEEE80211_RC_SMPS_CHANGED = BIT(1),
3467}; 3511};
3468 3512
3469/** 3513/**
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 62beeb97c4b1..e3133c23980e 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -79,6 +79,42 @@ struct nd_opt_hdr {
79 __u8 nd_opt_len; 79 __u8 nd_opt_len;
80} __packed; 80} __packed;
81 81
82static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd)
83{
84 const u32 *p32 = pkey;
85
86 return (((p32[0] ^ dev->ifindex) * hash_rnd[0]) +
87 (p32[1] * hash_rnd[1]) +
88 (p32[2] * hash_rnd[2]) +
89 (p32[3] * hash_rnd[3]));
90}
91
92static inline struct neighbour *__ipv6_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, const void *pkey)
93{
94 struct neigh_hash_table *nht;
95 const u32 *p32 = pkey;
96 struct neighbour *n;
97 u32 hash_val;
98
99 rcu_read_lock_bh();
100 nht = rcu_dereference_bh(tbl->nht);
101 hash_val = ndisc_hashfn(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
102 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
103 n != NULL;
104 n = rcu_dereference_bh(n->next)) {
105 u32 *n32 = (u32 *) n->primary_key;
106 if (n->dev == dev &&
107 ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
108 (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0) {
109 if (!atomic_inc_not_zero(&n->refcnt))
110 n = NULL;
111 break;
112 }
113 }
114 rcu_read_unlock_bh();
115
116 return n;
117}
82 118
83extern int ndisc_init(void); 119extern int ndisc_init(void);
84 120
@@ -145,13 +181,4 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
145extern void inet6_ifinfo_notify(int event, 181extern void inet6_ifinfo_notify(int event,
146 struct inet6_dev *idev); 182 struct inet6_dev *idev);
147 183
148static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr)
149{
150
151 if (dev)
152 return __neigh_lookup_errno(&nd_tbl, addr, dev);
153
154 return ERR_PTR(-ENODEV);
155}
156
157#endif 184#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 2720884287c3..34c996f46181 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -59,7 +59,7 @@ struct neigh_parms {
59 int reachable_time; 59 int reachable_time;
60 int delay_probe_time; 60 int delay_probe_time;
61 61
62 int queue_len; 62 int queue_len_bytes;
63 int ucast_probes; 63 int ucast_probes;
64 int app_probes; 64 int app_probes;
65 int mcast_probes; 65 int mcast_probes;
@@ -99,6 +99,7 @@ struct neighbour {
99 rwlock_t lock; 99 rwlock_t lock;
100 atomic_t refcnt; 100 atomic_t refcnt;
101 struct sk_buff_head arp_queue; 101 struct sk_buff_head arp_queue;
102 unsigned int arp_queue_len_bytes;
102 struct timer_list timer; 103 struct timer_list timer;
103 unsigned long used; 104 unsigned long used;
104 atomic_t probes; 105 atomic_t probes;
@@ -138,10 +139,12 @@ struct pneigh_entry {
138 * neighbour table manipulation 139 * neighbour table manipulation
139 */ 140 */
140 141
142#define NEIGH_NUM_HASH_RND 4
143
141struct neigh_hash_table { 144struct neigh_hash_table {
142 struct neighbour __rcu **hash_buckets; 145 struct neighbour __rcu **hash_buckets;
143 unsigned int hash_shift; 146 unsigned int hash_shift;
144 __u32 hash_rnd; 147 __u32 hash_rnd[NEIGH_NUM_HASH_RND];
145 struct rcu_head rcu; 148 struct rcu_head rcu;
146}; 149};
147 150
@@ -153,7 +156,7 @@ struct neigh_table {
153 int key_len; 156 int key_len;
154 __u32 (*hash)(const void *pkey, 157 __u32 (*hash)(const void *pkey,
155 const struct net_device *dev, 158 const struct net_device *dev,
156 __u32 hash_rnd); 159 __u32 *hash_rnd);
157 int (*constructor)(struct neighbour *); 160 int (*constructor)(struct neighbour *);
158 int (*pconstructor)(struct pneigh_entry *); 161 int (*pconstructor)(struct pneigh_entry *);
159 void (*pdestructor)(struct pneigh_entry *); 162 void (*pdestructor)(struct pneigh_entry *);
@@ -172,12 +175,18 @@ struct neigh_table {
172 atomic_t entries; 175 atomic_t entries;
173 rwlock_t lock; 176 rwlock_t lock;
174 unsigned long last_rand; 177 unsigned long last_rand;
175 struct kmem_cache *kmem_cachep;
176 struct neigh_statistics __percpu *stats; 178 struct neigh_statistics __percpu *stats;
177 struct neigh_hash_table __rcu *nht; 179 struct neigh_hash_table __rcu *nht;
178 struct pneigh_entry **phash_buckets; 180 struct pneigh_entry **phash_buckets;
179}; 181};
180 182
183#define NEIGH_PRIV_ALIGN sizeof(long long)
184
185static inline void *neighbour_priv(const struct neighbour *n)
186{
187 return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN);
188}
189
181/* flags for neigh_update() */ 190/* flags for neigh_update() */
182#define NEIGH_UPDATE_F_OVERRIDE 0x00000001 191#define NEIGH_UPDATE_F_OVERRIDE 0x00000001
183#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 192#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 3bb6fa0eace0..ee547c149810 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -77,7 +77,7 @@ struct net {
77 struct netns_packet packet; 77 struct netns_packet packet;
78 struct netns_unix unx; 78 struct netns_unix unx;
79 struct netns_ipv4 ipv4; 79 struct netns_ipv4 ipv4;
80#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 80#if IS_ENABLED(CONFIG_IPV6)
81 struct netns_ipv6 ipv6; 81 struct netns_ipv6 ipv6;
82#endif 82#endif
83#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 83#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 4e9c63a20db2..463ae8e16696 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -15,8 +15,8 @@
15#include <net/netfilter/nf_conntrack_extend.h> 15#include <net/netfilter/nf_conntrack_extend.h>
16 16
17struct nf_conn_counter { 17struct nf_conn_counter {
18 u_int64_t packets; 18 atomic64_t packets;
19 u_int64_t bytes; 19 atomic64_t bytes;
20}; 20};
21 21
22static inline 22static inline
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 0f8a8c587532..4619caadd9d1 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -91,7 +91,6 @@ static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
91 91
92void nf_ct_remove_expectations(struct nf_conn *ct); 92void nf_ct_remove_expectations(struct nf_conn *ct);
93void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); 93void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
94void nf_ct_remove_userspace_expectations(void);
95 94
96/* Allocate space for an expectation: this is mandatory before calling 95/* Allocate space for an expectation: this is mandatory before calling
97 nf_ct_expect_related. You will have to call put afterwards. */ 96 nf_ct_expect_related. You will have to call put afterwards. */
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 2f8fb77bfdd1..aea3f8221be0 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -12,7 +12,6 @@
12 12
13#include <linux/netfilter/x_tables.h> 13#include <linux/netfilter/x_tables.h>
14#include <linux/netfilter/nf_conntrack_tuple_common.h> 14#include <linux/netfilter/nf_conntrack_tuple_common.h>
15#include <linux/netfilter_ipv4/nf_nat.h>
16#include <linux/list_nulls.h> 15#include <linux/list_nulls.h>
17 16
18/* A `tuple' is a structure containing the information to uniquely 17/* A `tuple' is a structure containing the information to uniquely
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index b8872df7285f..b4de990b55f1 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -1,14 +1,12 @@
1#ifndef _NF_NAT_H 1#ifndef _NF_NAT_H
2#define _NF_NAT_H 2#define _NF_NAT_H
3#include <linux/netfilter_ipv4.h> 3#include <linux/netfilter_ipv4.h>
4#include <linux/netfilter_ipv4/nf_nat.h> 4#include <linux/netfilter/nf_nat.h>
5#include <net/netfilter/nf_conntrack_tuple.h> 5#include <net/netfilter/nf_conntrack_tuple.h>
6 6
7#define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16
8
9enum nf_nat_manip_type { 7enum nf_nat_manip_type {
10 IP_NAT_MANIP_SRC, 8 NF_NAT_MANIP_SRC,
11 IP_NAT_MANIP_DST 9 NF_NAT_MANIP_DST
12}; 10};
13 11
14/* SRC manip occurs POST_ROUTING or LOCAL_IN */ 12/* SRC manip occurs POST_ROUTING or LOCAL_IN */
@@ -52,7 +50,7 @@ struct nf_conn_nat {
52 50
53/* Set up the info structure to map into this range. */ 51/* Set up the info structure to map into this range. */
54extern unsigned int nf_nat_setup_info(struct nf_conn *ct, 52extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
55 const struct nf_nat_range *range, 53 const struct nf_nat_ipv4_range *range,
56 enum nf_nat_manip_type maniptype); 54 enum nf_nat_manip_type maniptype);
57 55
58/* Is this tuple already taken? (not by us)*/ 56/* Is this tuple already taken? (not by us)*/
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 3dc7b98effeb..b13d8d18d595 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -20,7 +20,7 @@ extern int nf_nat_icmp_reply_translation(struct nf_conn *ct,
20static inline int nf_nat_initialized(struct nf_conn *ct, 20static inline int nf_nat_initialized(struct nf_conn *ct,
21 enum nf_nat_manip_type manip) 21 enum nf_nat_manip_type manip)
22{ 22{
23 if (manip == IP_NAT_MANIP_SRC) 23 if (manip == NF_NAT_MANIP_SRC)
24 return ct->status & IPS_SRC_NAT_DONE; 24 return ct->status & IPS_SRC_NAT_DONE;
25 else 25 else
26 return ct->status & IPS_DST_NAT_DONE; 26 return ct->status & IPS_DST_NAT_DONE;
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
index 93cc90d28e66..7b0b51165f70 100644
--- a/include/net/netfilter/nf_nat_protocol.h
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -4,14 +4,12 @@
4#include <net/netfilter/nf_nat.h> 4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h> 5#include <linux/netfilter/nfnetlink_conntrack.h>
6 6
7struct nf_nat_range; 7struct nf_nat_ipv4_range;
8 8
9struct nf_nat_protocol { 9struct nf_nat_protocol {
10 /* Protocol number. */ 10 /* Protocol number. */
11 unsigned int protonum; 11 unsigned int protonum;
12 12
13 struct module *me;
14
15 /* Translate a packet to the target according to manip type. 13 /* Translate a packet to the target according to manip type.
16 Return true if succeeded. */ 14 Return true if succeeded. */
17 bool (*manip_pkt)(struct sk_buff *skb, 15 bool (*manip_pkt)(struct sk_buff *skb,
@@ -30,15 +28,12 @@ struct nf_nat_protocol {
30 possible. Per-protocol part of tuple is initialized to the 28 possible. Per-protocol part of tuple is initialized to the
31 incoming packet. */ 29 incoming packet. */
32 void (*unique_tuple)(struct nf_conntrack_tuple *tuple, 30 void (*unique_tuple)(struct nf_conntrack_tuple *tuple,
33 const struct nf_nat_range *range, 31 const struct nf_nat_ipv4_range *range,
34 enum nf_nat_manip_type maniptype, 32 enum nf_nat_manip_type maniptype,
35 const struct nf_conn *ct); 33 const struct nf_conn *ct);
36 34
37 int (*range_to_nlattr)(struct sk_buff *skb,
38 const struct nf_nat_range *range);
39
40 int (*nlattr_to_range)(struct nlattr *tb[], 35 int (*nlattr_to_range)(struct nlattr *tb[],
41 struct nf_nat_range *range); 36 struct nf_nat_ipv4_range *range);
42}; 37};
43 38
44/* Protocol registration. */ 39/* Protocol registration. */
@@ -61,14 +56,12 @@ extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
61 const union nf_conntrack_man_proto *max); 56 const union nf_conntrack_man_proto *max);
62 57
63extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, 58extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
64 const struct nf_nat_range *range, 59 const struct nf_nat_ipv4_range *range,
65 enum nf_nat_manip_type maniptype, 60 enum nf_nat_manip_type maniptype,
66 const struct nf_conn *ct, 61 const struct nf_conn *ct,
67 u_int16_t *rover); 62 u_int16_t *rover);
68 63
69extern int nf_nat_proto_range_to_nlattr(struct sk_buff *skb,
70 const struct nf_nat_range *range);
71extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[], 64extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
72 struct nf_nat_range *range); 65 struct nf_nat_ipv4_range *range);
73 66
74#endif /*_NF_NAT_PROTO_H*/ 67#endif /*_NF_NAT_PROTO_H*/
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index e505358d8999..75ca9291cf2c 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -131,7 +131,7 @@ nf_tproxy_get_sock_v4(struct net *net, const u8 protocol,
131 return sk; 131 return sk;
132} 132}
133 133
134#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 134#if IS_ENABLED(CONFIG_IPV6)
135static inline struct sock * 135static inline struct sock *
136nf_tproxy_get_sock_v6(struct net *net, const u8 protocol, 136nf_tproxy_get_sock_v6(struct net *net, const u8 protocol,
137 const struct in6_addr *saddr, const struct in6_addr *daddr, 137 const struct in6_addr *saddr, const struct in6_addr *daddr,
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index d786b4fc02a4..bbd023a1c9b9 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -55,6 +55,7 @@ struct netns_ipv4 {
55 int current_rt_cache_rebuild_count; 55 int current_rt_cache_rebuild_count;
56 56
57 unsigned int sysctl_ping_group_range[2]; 57 unsigned int sysctl_ping_group_range[2];
58 long sysctl_tcp_mem[3];
58 59
59 atomic_t rt_genid; 60 atomic_t rt_genid;
60 atomic_t dev_addr_genid; 61 atomic_t dev_addr_genid;
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 0b44112e2366..d542a4b28cca 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -10,15 +10,15 @@ struct netns_mib {
10 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); 10 DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); 11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); 12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
13 DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); 13 DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics);
14 14
15#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 15#if IS_ENABLED(CONFIG_IPV6)
16 struct proc_dir_entry *proc_net_devsnmp6; 16 struct proc_dir_entry *proc_net_devsnmp6;
17 DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6); 17 DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6);
18 DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6); 18 DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
19 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); 19 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); 21 DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib, icmpv6msg_statistics);
22#endif 22#endif
23#ifdef CONFIG_XFRM_STATISTICS 23#ifdef CONFIG_XFRM_STATISTICS
24 DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); 24 DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics);
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 748f91f87cd5..5299e69a32af 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -56,7 +56,7 @@ struct netns_xfrm {
56#endif 56#endif
57 57
58 struct dst_ops xfrm4_dst_ops; 58 struct dst_ops xfrm4_dst_ops;
59#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 59#if IS_ENABLED(CONFIG_IPV6)
60 struct dst_ops xfrm6_dst_ops; 60 struct dst_ops xfrm6_dst_ops;
61#endif 61#endif
62}; 62};
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
new file mode 100644
index 000000000000..e503b87c4c1b
--- /dev/null
+++ b/include/net/netprio_cgroup.h
@@ -0,0 +1,57 @@
1/*
2 * netprio_cgroup.h Control Group Priority set
3 *
4 *
5 * Authors: Neil Horman <nhorman@tuxdriver.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; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 */
13
14#ifndef _NETPRIO_CGROUP_H
15#define _NETPRIO_CGROUP_H
16#include <linux/module.h>
17#include <linux/cgroup.h>
18#include <linux/hardirq.h>
19#include <linux/rcupdate.h>
20
21
22struct netprio_map {
23 struct rcu_head rcu;
24 u32 priomap_len;
25 u32 priomap[];
26};
27
28#ifdef CONFIG_CGROUPS
29
30struct cgroup_netprio_state {
31 struct cgroup_subsys_state css;
32 u32 prioidx;
33};
34
35#ifndef CONFIG_NETPRIO_CGROUP
36extern int net_prio_subsys_id;
37#endif
38
39extern void sock_update_netprioidx(struct sock *sk);
40
41static inline struct cgroup_netprio_state
42 *task_netprio_state(struct task_struct *p)
43{
44#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
45 return container_of(task_subsys_state(p, net_prio_subsys_id),
46 struct cgroup_netprio_state, css);
47#else
48 return NULL;
49#endif
50}
51
52#else
53
54#define sock_update_netprioidx(sk)
55#endif
56
57#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 39b85bc0804f..2be95e2626c0 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -34,32 +34,30 @@
34#define NCI_MAX_NUM_CONN 10 34#define NCI_MAX_NUM_CONN 10
35 35
36/* NCI Status Codes */ 36/* NCI Status Codes */
37#define NCI_STATUS_OK 0x00 37#define NCI_STATUS_OK 0x00
38#define NCI_STATUS_REJECTED 0x01 38#define NCI_STATUS_REJECTED 0x01
39#define NCI_STATUS_MESSAGE_CORRUPTED 0x02 39#define NCI_STATUS_RF_FRAME_CORRUPTED 0x02
40#define NCI_STATUS_BUFFER_FULL 0x03 40#define NCI_STATUS_FAILED 0x03
41#define NCI_STATUS_FAILED 0x04 41#define NCI_STATUS_NOT_INITIALIZED 0x04
42#define NCI_STATUS_NOT_INITIALIZED 0x05 42#define NCI_STATUS_SYNTAX_ERROR 0x05
43#define NCI_STATUS_SYNTAX_ERROR 0x06 43#define NCI_STATUS_SEMANTIC_ERROR 0x06
44#define NCI_STATUS_SEMANTIC_ERROR 0x07 44#define NCI_STATUS_UNKNOWN_GID 0x07
45#define NCI_STATUS_UNKNOWN_GID 0x08 45#define NCI_STATUS_UNKNOWN_OID 0x08
46#define NCI_STATUS_UNKNOWN_OID 0x09 46#define NCI_STATUS_INVALID_PARAM 0x09
47#define NCI_STATUS_INVALID_PARAM 0x0a 47#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0a
48#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0b
49/* Discovery Specific Status Codes */ 48/* Discovery Specific Status Codes */
50#define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0 49#define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0
51#define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1 50#define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1
51#define NCI_STATUS_DISCOVERY_TEAR_DOWN 0xa2
52/* RF Interface Specific Status Codes */ 52/* RF Interface Specific Status Codes */
53#define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0 53#define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0
54#define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1 54#define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1
55#define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2 55#define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2
56#define NCI_STATUS_RF_LINK_LOSS_ERROR 0xb3
57/* NFCEE Interface Specific Status Codes */ 56/* NFCEE Interface Specific Status Codes */
58#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0 57#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc0
59#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1 58#define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc1
60#define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc2 59#define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc2
61#define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc3 60#define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc3
62#define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc4
63 61
64/* NCI RF Technology and Mode */ 62/* NCI RF Technology and Mode */
65#define NCI_NFC_A_PASSIVE_POLL_MODE 0x00 63#define NCI_NFC_A_PASSIVE_POLL_MODE 0x00
@@ -67,11 +65,28 @@
67#define NCI_NFC_F_PASSIVE_POLL_MODE 0x02 65#define NCI_NFC_F_PASSIVE_POLL_MODE 0x02
68#define NCI_NFC_A_ACTIVE_POLL_MODE 0x03 66#define NCI_NFC_A_ACTIVE_POLL_MODE 0x03
69#define NCI_NFC_F_ACTIVE_POLL_MODE 0x05 67#define NCI_NFC_F_ACTIVE_POLL_MODE 0x05
68#define NCI_NFC_15693_PASSIVE_POLL_MODE 0x06
70#define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80 69#define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80
71#define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81 70#define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81
72#define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82 71#define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82
73#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 72#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83
74#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 73#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85
74#define NCI_NFC_15693_PASSIVE_LISTEN_MODE 0x86
75
76/* NCI RF Technologies */
77#define NCI_NFC_RF_TECHNOLOGY_A 0x00
78#define NCI_NFC_RF_TECHNOLOGY_B 0x01
79#define NCI_NFC_RF_TECHNOLOGY_F 0x02
80#define NCI_NFC_RF_TECHNOLOGY_15693 0x03
81
82/* NCI Bit Rates */
83#define NCI_NFC_BIT_RATE_106 0x00
84#define NCI_NFC_BIT_RATE_212 0x01
85#define NCI_NFC_BIT_RATE_424 0x02
86#define NCI_NFC_BIT_RATE_848 0x03
87#define NCI_NFC_BIT_RATE_1695 0x04
88#define NCI_NFC_BIT_RATE_3390 0x05
89#define NCI_NFC_BIT_RATE_6780 0x06
75 90
76/* NCI RF Protocols */ 91/* NCI RF Protocols */
77#define NCI_RF_PROTOCOL_UNKNOWN 0x00 92#define NCI_RF_PROTOCOL_UNKNOWN 0x00
@@ -82,37 +97,30 @@
82#define NCI_RF_PROTOCOL_NFC_DEP 0x05 97#define NCI_RF_PROTOCOL_NFC_DEP 0x05
83 98
84/* NCI RF Interfaces */ 99/* NCI RF Interfaces */
85#define NCI_RF_INTERFACE_RFU 0x00 100#define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00
86#define NCI_RF_INTERFACE_FRAME 0x01 101#define NCI_RF_INTERFACE_FRAME 0x01
87#define NCI_RF_INTERFACE_ISO_DEP 0x02 102#define NCI_RF_INTERFACE_ISO_DEP 0x02
88#define NCI_RF_INTERFACE_NFC_DEP 0x03 103#define NCI_RF_INTERFACE_NFC_DEP 0x03
104
105/* NCI Reset types */
106#define NCI_RESET_TYPE_KEEP_CONFIG 0x00
107#define NCI_RESET_TYPE_RESET_CONFIG 0x01
108
109/* NCI Static RF connection ID */
110#define NCI_STATIC_RF_CONN_ID 0x00
111
112/* NCI Data Flow Control */
113#define NCI_DATA_FLOW_CONTROL_NOT_USED 0xff
89 114
90/* NCI RF_DISCOVER_MAP_CMD modes */ 115/* NCI RF_DISCOVER_MAP_CMD modes */
91#define NCI_DISC_MAP_MODE_POLL 0x01 116#define NCI_DISC_MAP_MODE_POLL 0x01
92#define NCI_DISC_MAP_MODE_LISTEN 0x02 117#define NCI_DISC_MAP_MODE_LISTEN 0x02
93#define NCI_DISC_MAP_MODE_BOTH 0x03
94
95/* NCI Discovery Types */
96#define NCI_DISCOVERY_TYPE_POLL_A_PASSIVE 0x00
97#define NCI_DISCOVERY_TYPE_POLL_B_PASSIVE 0x01
98#define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02
99#define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03
100#define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05
101#define NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE 0x06
102#define NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE 0x07
103#define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09
104#define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80
105#define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81
106#define NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE 0x82
107#define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 0x83
108#define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 0x85
109 118
110/* NCI Deactivation Type */ 119/* NCI Deactivation Type */
111#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 120#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
112#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 121#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
113#define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02 122#define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02
114#define NCI_DEACTIVATE_TYPE_RF_LINK_LOSS 0x03 123#define NCI_DEACTIVATE_TYPE_DISCOVERY 0x03
115#define NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR 0x04
116 124
117/* Message Type (MT) */ 125/* Message Type (MT) */
118#define NCI_MT_DATA_PKT 0x00 126#define NCI_MT_DATA_PKT 0x00
@@ -144,10 +152,10 @@
144#define nci_conn_id(hdr) (__u8)(((hdr)[0])&0x0f) 152#define nci_conn_id(hdr) (__u8)(((hdr)[0])&0x0f)
145 153
146/* GID values */ 154/* GID values */
147#define NCI_GID_CORE 0x0 155#define NCI_GID_CORE 0x0
148#define NCI_GID_RF_MGMT 0x1 156#define NCI_GID_RF_MGMT 0x1
149#define NCI_GID_NFCEE_MGMT 0x2 157#define NCI_GID_NFCEE_MGMT 0x2
150#define NCI_GID_PROPRIETARY 0xf 158#define NCI_GID_PROPRIETARY 0xf
151 159
152/* ---- NCI Packet structures ---- */ 160/* ---- NCI Packet structures ---- */
153#define NCI_CTRL_HDR_SIZE 3 161#define NCI_CTRL_HDR_SIZE 3
@@ -169,24 +177,17 @@ struct nci_data_hdr {
169/* ----- NCI Commands ---- */ 177/* ----- NCI Commands ---- */
170/* ------------------------ */ 178/* ------------------------ */
171#define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00) 179#define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00)
172 180struct nci_core_reset_cmd {
173#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) 181 __u8 reset_type;
174
175#define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02)
176
177#define NCI_OP_CORE_CONN_CREATE_CMD nci_opcode_pack(NCI_GID_CORE, 0x04)
178struct nci_core_conn_create_cmd {
179 __u8 target_handle;
180 __u8 num_target_specific_params;
181} __packed; 182} __packed;
182 183
183#define NCI_OP_CORE_CONN_CLOSE_CMD nci_opcode_pack(NCI_GID_CORE, 0x06) 184#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01)
184 185
185#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 186#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
186struct disc_map_config { 187struct disc_map_config {
187 __u8 rf_protocol; 188 __u8 rf_protocol;
188 __u8 mode; 189 __u8 mode;
189 __u8 rf_interface_type; 190 __u8 rf_interface;
190} __packed; 191} __packed;
191 192
192struct nci_rf_disc_map_cmd { 193struct nci_rf_disc_map_cmd {
@@ -197,7 +198,7 @@ struct nci_rf_disc_map_cmd {
197 198
198#define NCI_OP_RF_DISCOVER_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 199#define NCI_OP_RF_DISCOVER_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
199struct disc_config { 200struct disc_config {
200 __u8 type; 201 __u8 rf_tech_and_mode;
201 __u8 frequency; 202 __u8 frequency;
202} __packed; 203} __packed;
203 204
@@ -218,6 +219,7 @@ struct nci_rf_deactivate_cmd {
218struct nci_core_reset_rsp { 219struct nci_core_reset_rsp {
219 __u8 status; 220 __u8 status;
220 __u8 nci_ver; 221 __u8 nci_ver;
222 __u8 config_status;
221} __packed; 223} __packed;
222 224
223#define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01) 225#define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01)
@@ -232,24 +234,12 @@ struct nci_core_init_rsp_1 {
232struct nci_core_init_rsp_2 { 234struct nci_core_init_rsp_2 {
233 __u8 max_logical_connections; 235 __u8 max_logical_connections;
234 __le16 max_routing_table_size; 236 __le16 max_routing_table_size;
235 __u8 max_control_packet_payload_length; 237 __u8 max_ctrl_pkt_payload_len;
236 __le16 rf_sending_buffer_size; 238 __le16 max_size_for_large_params;
237 __le16 rf_receiving_buffer_size; 239 __u8 manufact_id;
238 __le16 manufacturer_id; 240 __le32 manufact_specific_info;
239} __packed; 241} __packed;
240 242
241#define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02)
242
243#define NCI_OP_CORE_CONN_CREATE_RSP nci_opcode_pack(NCI_GID_CORE, 0x04)
244struct nci_core_conn_create_rsp {
245 __u8 status;
246 __u8 max_pkt_payload_size;
247 __u8 initial_num_credits;
248 __u8 conn_id;
249} __packed;
250
251#define NCI_OP_CORE_CONN_CLOSE_RSP nci_opcode_pack(NCI_GID_CORE, 0x06)
252
253#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 243#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
254 244
255#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 245#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
@@ -259,7 +249,7 @@ struct nci_core_conn_create_rsp {
259/* --------------------------- */ 249/* --------------------------- */
260/* ---- NCI Notifications ---- */ 250/* ---- NCI Notifications ---- */
261/* --------------------------- */ 251/* --------------------------- */
262#define NCI_OP_CORE_CONN_CREDITS_NTF nci_opcode_pack(NCI_GID_CORE, 0x07) 252#define NCI_OP_CORE_CONN_CREDITS_NTF nci_opcode_pack(NCI_GID_CORE, 0x06)
263struct conn_credit_entry { 253struct conn_credit_entry {
264 __u8 conn_id; 254 __u8 conn_id;
265 __u8 credits; 255 __u8 credits;
@@ -270,12 +260,13 @@ struct nci_core_conn_credit_ntf {
270 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
271} __packed; 261} __packed;
272 262
273#define NCI_OP_RF_FIELD_INFO_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 263#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
274struct nci_rf_field_info_ntf { 264struct nci_core_intf_error_ntf {
275 __u8 rf_field_status; 265 __u8 status;
266 __u8 conn_id;
276} __packed; 267} __packed;
277 268
278#define NCI_OP_RF_ACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 269#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
279struct rf_tech_specific_params_nfca_poll { 270struct rf_tech_specific_params_nfca_poll {
280 __u16 sens_res; 271 __u16 sens_res;
281 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 272 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
@@ -289,17 +280,22 @@ struct activation_params_nfca_poll_iso_dep {
289 __u8 rats_res[20]; 280 __u8 rats_res[20];
290}; 281};
291 282
292struct nci_rf_activate_ntf { 283struct nci_rf_intf_activated_ntf {
293 __u8 target_handle; 284 __u8 rf_discovery_id;
285 __u8 rf_interface;
294 __u8 rf_protocol; 286 __u8 rf_protocol;
295 __u8 rf_tech_and_mode; 287 __u8 activation_rf_tech_and_mode;
288 __u8 max_data_pkt_payload_size;
289 __u8 initial_num_credits;
296 __u8 rf_tech_specific_params_len; 290 __u8 rf_tech_specific_params_len;
297 291
298 union { 292 union {
299 struct rf_tech_specific_params_nfca_poll nfca_poll; 293 struct rf_tech_specific_params_nfca_poll nfca_poll;
300 } rf_tech_specific_params; 294 } rf_tech_specific_params;
301 295
302 __u8 rf_interface_type; 296 __u8 data_exch_rf_tech_and_mode;
297 __u8 data_exch_tx_bit_rate;
298 __u8 data_exch_rx_bit_rate;
303 __u8 activation_params_len; 299 __u8 activation_params_len;
304 300
305 union { 301 union {
@@ -309,5 +305,9 @@ struct nci_rf_activate_ntf {
309} __packed; 305} __packed;
310 306
311#define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 307#define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
308struct nci_rf_deactivate_ntf {
309 __u8 type;
310 __u8 reason;
311} __packed;
312 312
313#endif /* __NCI_H */ 313#endif /* __NCI_H */
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index b8b4bbd7e0fc..bccd89e9d4c2 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -109,15 +109,14 @@ struct nci_dev {
109 [NCI_MAX_SUPPORTED_RF_INTERFACES]; 109 [NCI_MAX_SUPPORTED_RF_INTERFACES];
110 __u8 max_logical_connections; 110 __u8 max_logical_connections;
111 __u16 max_routing_table_size; 111 __u16 max_routing_table_size;
112 __u8 max_control_packet_payload_length; 112 __u8 max_ctrl_pkt_payload_len;
113 __u16 rf_sending_buffer_size; 113 __u16 max_size_for_large_params;
114 __u16 rf_receiving_buffer_size; 114 __u8 manufact_id;
115 __u16 manufacturer_id; 115 __u32 manufact_specific_info;
116 116
117 /* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */ 117 /* received during NCI_OP_RF_INTF_ACTIVATED_NTF */
118 __u8 max_pkt_payload_size; 118 __u8 max_data_pkt_payload_size;
119 __u8 initial_num_credits; 119 __u8 initial_num_credits;
120 __u8 conn_id;
121 120
122 /* stored during nci_data_exchange */ 121 /* stored during nci_data_exchange */
123 data_exchange_cb_t data_exchange_cb; 122 data_exchange_cb_t data_exchange_cb;
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 6a7f602aa841..8696b773a695 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -52,6 +52,9 @@ struct nfc_ops {
52 int (*dev_down)(struct nfc_dev *dev); 52 int (*dev_down)(struct nfc_dev *dev);
53 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 53 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
54 void (*stop_poll)(struct nfc_dev *dev); 54 void (*stop_poll)(struct nfc_dev *dev);
55 int (*dep_link_up)(struct nfc_dev *dev, int target_idx,
56 u8 comm_mode, u8 rf_mode);
57 int (*dep_link_down)(struct nfc_dev *dev);
55 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 58 int (*activate_target)(struct nfc_dev *dev, u32 target_idx,
56 u32 protocol); 59 u32 protocol);
57 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 60 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx);
@@ -60,11 +63,17 @@ struct nfc_ops {
60 void *cb_context); 63 void *cb_context);
61}; 64};
62 65
66#define NFC_TARGET_IDX_ANY -1
67#define NFC_MAX_GT_LEN 48
68#define NFC_MAX_NFCID1_LEN 10
69
63struct nfc_target { 70struct nfc_target {
64 u32 idx; 71 u32 idx;
65 u32 supported_protocols; 72 u32 supported_protocols;
66 u16 sens_res; 73 u16 sens_res;
67 u8 sel_res; 74 u8 sel_res;
75 u8 nfcid1_len;
76 u8 nfcid1[NFC_MAX_NFCID1_LEN];
68}; 77};
69 78
70struct nfc_genl_data { 79struct nfc_genl_data {
@@ -83,6 +92,8 @@ struct nfc_dev {
83 bool dev_up; 92 bool dev_up;
84 bool polling; 93 bool polling;
85 bool remote_activated; 94 bool remote_activated;
95 bool dep_link_up;
96 u32 dep_rf_mode;
86 struct nfc_genl_data genl_data; 97 struct nfc_genl_data genl_data;
87 u32 supported_protocols; 98 u32 supported_protocols;
88 99
@@ -157,9 +168,20 @@ static inline const char *nfc_device_name(struct nfc_dev *dev)
157 return dev_name(&dev->dev); 168 return dev_name(&dev->dev);
158} 169}
159 170
160struct sk_buff *nfc_alloc_skb(unsigned int size, gfp_t gfp); 171struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
172 unsigned int flags, unsigned int size,
173 unsigned int *err);
174struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp);
175
176int nfc_set_remote_general_bytes(struct nfc_dev *dev,
177 u8 *gt, u8 gt_len);
178
179u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len);
161 180
162int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, 181int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
163 int ntargets); 182 int ntargets);
164 183
184int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
185 u8 comm_mode, u8 rf_mode);
186
165#endif /* __NET_NFC_H */ 187#endif /* __NET_NFC_H */
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 6f7eb800974a..875f4895b033 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -25,7 +25,7 @@
25#define _PROTOCOL_H 25#define _PROTOCOL_H
26 26
27#include <linux/in6.h> 27#include <linux/in6.h>
28#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 28#if IS_ENABLED(CONFIG_IPV6)
29#include <linux/ipv6.h> 29#include <linux/ipv6.h>
30#endif 30#endif
31 31
@@ -38,7 +38,7 @@ struct net_protocol {
38 void (*err_handler)(struct sk_buff *skb, u32 info); 38 void (*err_handler)(struct sk_buff *skb, u32 info);
39 int (*gso_send_check)(struct sk_buff *skb); 39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 u32 features); 41 netdev_features_t features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head, 42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb); 43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb); 44 int (*gro_complete)(struct sk_buff *skb);
@@ -46,7 +46,7 @@ struct net_protocol {
46 netns_ok:1; 46 netns_ok:1;
47}; 47};
48 48
49#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 49#if IS_ENABLED(CONFIG_IPV6)
50struct inet6_protocol { 50struct inet6_protocol {
51 int (*handler)(struct sk_buff *skb); 51 int (*handler)(struct sk_buff *skb);
52 52
@@ -57,7 +57,7 @@ struct inet6_protocol {
57 57
58 int (*gso_send_check)(struct sk_buff *skb); 58 int (*gso_send_check)(struct sk_buff *skb);
59 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 59 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
60 u32 features); 60 netdev_features_t features);
61 struct sk_buff **(*gro_receive)(struct sk_buff **head, 61 struct sk_buff **(*gro_receive)(struct sk_buff **head,
62 struct sk_buff *skb); 62 struct sk_buff *skb);
63 int (*gro_complete)(struct sk_buff *skb); 63 int (*gro_complete)(struct sk_buff *skb);
@@ -91,7 +91,7 @@ struct inet_protosw {
91 91
92extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS]; 92extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS];
93 93
94#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 94#if IS_ENABLED(CONFIG_IPV6)
95extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS]; 95extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
96#endif 96#endif
97 97
@@ -100,7 +100,7 @@ extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num)
100extern void inet_register_protosw(struct inet_protosw *p); 100extern void inet_register_protosw(struct inet_protosw *p);
101extern void inet_unregister_protosw(struct inet_protosw *p); 101extern void inet_unregister_protosw(struct inet_protosw *p);
102 102
103#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 103#if IS_ENABLED(CONFIG_IPV6)
104extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num); 104extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
105extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num); 105extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
106extern int inet6_register_protosw(struct inet_protosw *p); 106extern int inet6_register_protosw(struct inet_protosw *p);
diff --git a/include/net/red.h b/include/net/red.h
index b72a3b833936..28068ec614b2 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -5,6 +5,7 @@
5#include <net/pkt_sched.h> 5#include <net/pkt_sched.h>
6#include <net/inet_ecn.h> 6#include <net/inet_ecn.h>
7#include <net/dsfield.h> 7#include <net/dsfield.h>
8#include <linux/reciprocal_div.h>
8 9
9/* Random Early Detection (RED) algorithm. 10/* Random Early Detection (RED) algorithm.
10 ======================================= 11 =======================================
@@ -87,6 +88,29 @@
87 etc. 88 etc.
88 */ 89 */
89 90
91/*
92 * Adaptative RED : An Algorithm for Increasing the Robustness of RED's AQM
93 * (Sally FLoyd, Ramakrishna Gummadi, and Scott Shenker) August 2001
94 *
95 * Every 500 ms:
96 * if (avg > target and max_p <= 0.5)
97 * increase max_p : max_p += alpha;
98 * else if (avg < target and max_p >= 0.01)
99 * decrease max_p : max_p *= beta;
100 *
101 * target :[qth_min + 0.4*(qth_min - qth_max),
102 * qth_min + 0.6*(qth_min - qth_max)].
103 * alpha : min(0.01, max_p / 4)
104 * beta : 0.9
105 * max_P is a Q0.32 fixed point number (with 32 bits mantissa)
106 * max_P between 0.01 and 0.5 (1% - 50%) [ Its no longer a negative power of two ]
107 */
108#define RED_ONE_PERCENT ((u32)DIV_ROUND_CLOSEST(1ULL<<32, 100))
109
110#define MAX_P_MIN (1 * RED_ONE_PERCENT)
111#define MAX_P_MAX (50 * RED_ONE_PERCENT)
112#define MAX_P_ALPHA(val) min(MAX_P_MIN, val / 4)
113
90#define RED_STAB_SIZE 256 114#define RED_STAB_SIZE 256
91#define RED_STAB_MASK (RED_STAB_SIZE - 1) 115#define RED_STAB_MASK (RED_STAB_SIZE - 1)
92 116
@@ -101,76 +125,110 @@ struct red_stats {
101 125
102struct red_parms { 126struct red_parms {
103 /* Parameters */ 127 /* Parameters */
104 u32 qth_min; /* Min avg length threshold: A scaled */ 128 u32 qth_min; /* Min avg length threshold: Wlog scaled */
105 u32 qth_max; /* Max avg length threshold: A scaled */ 129 u32 qth_max; /* Max avg length threshold: Wlog scaled */
106 u32 Scell_max; 130 u32 Scell_max;
107 u32 Rmask; /* Cached random mask, see red_rmask */ 131 u32 max_P; /* probability, [0 .. 1.0] 32 scaled */
132 u32 max_P_reciprocal; /* reciprocal_value(max_P / qth_delta) */
133 u32 qth_delta; /* max_th - min_th */
134 u32 target_min; /* min_th + 0.4*(max_th - min_th) */
135 u32 target_max; /* min_th + 0.6*(max_th - min_th) */
108 u8 Scell_log; 136 u8 Scell_log;
109 u8 Wlog; /* log(W) */ 137 u8 Wlog; /* log(W) */
110 u8 Plog; /* random number bits */ 138 u8 Plog; /* random number bits */
111 u8 Stab[RED_STAB_SIZE]; 139 u8 Stab[RED_STAB_SIZE];
140};
112 141
142struct red_vars {
113 /* Variables */ 143 /* Variables */
114 int qcount; /* Number of packets since last random 144 int qcount; /* Number of packets since last random
115 number generation */ 145 number generation */
116 u32 qR; /* Cached random number */ 146 u32 qR; /* Cached random number */
117 147
118 unsigned long qavg; /* Average queue length: A scaled */ 148 unsigned long qavg; /* Average queue length: Wlog scaled */
119 ktime_t qidlestart; /* Start of current idle period */ 149 ktime_t qidlestart; /* Start of current idle period */
120}; 150};
121 151
122static inline u32 red_rmask(u8 Plog) 152static inline u32 red_maxp(u8 Plog)
123{ 153{
124 return Plog < 32 ? ((1 << Plog) - 1) : ~0UL; 154 return Plog < 32 ? (~0U >> Plog) : ~0U;
125} 155}
126 156
127static inline void red_set_parms(struct red_parms *p, 157static inline void red_set_vars(struct red_vars *v)
128 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
129 u8 Scell_log, u8 *stab)
130{ 158{
131 /* Reset average queue length, the value is strictly bound 159 /* Reset average queue length, the value is strictly bound
132 * to the parameters below, reseting hurts a bit but leaving 160 * to the parameters below, reseting hurts a bit but leaving
133 * it might result in an unreasonable qavg for a while. --TGR 161 * it might result in an unreasonable qavg for a while. --TGR
134 */ 162 */
135 p->qavg = 0; 163 v->qavg = 0;
164
165 v->qcount = -1;
166}
167
168static inline void red_set_parms(struct red_parms *p,
169 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
170 u8 Scell_log, u8 *stab, u32 max_P)
171{
172 int delta = qth_max - qth_min;
173 u32 max_p_delta;
136 174
137 p->qcount = -1;
138 p->qth_min = qth_min << Wlog; 175 p->qth_min = qth_min << Wlog;
139 p->qth_max = qth_max << Wlog; 176 p->qth_max = qth_max << Wlog;
140 p->Wlog = Wlog; 177 p->Wlog = Wlog;
141 p->Plog = Plog; 178 p->Plog = Plog;
142 p->Rmask = red_rmask(Plog); 179 if (delta < 0)
180 delta = 1;
181 p->qth_delta = delta;
182 if (!max_P) {
183 max_P = red_maxp(Plog);
184 max_P *= delta; /* max_P = (qth_max - qth_min)/2^Plog */
185 }
186 p->max_P = max_P;
187 max_p_delta = max_P / delta;
188 max_p_delta = max(max_p_delta, 1U);
189 p->max_P_reciprocal = reciprocal_value(max_p_delta);
190
191 /* RED Adaptative target :
192 * [min_th + 0.4*(min_th - max_th),
193 * min_th + 0.6*(min_th - max_th)].
194 */
195 delta /= 5;
196 p->target_min = qth_min + 2*delta;
197 p->target_max = qth_min + 3*delta;
198
143 p->Scell_log = Scell_log; 199 p->Scell_log = Scell_log;
144 p->Scell_max = (255 << Scell_log); 200 p->Scell_max = (255 << Scell_log);
145 201
146 memcpy(p->Stab, stab, sizeof(p->Stab)); 202 if (stab)
203 memcpy(p->Stab, stab, sizeof(p->Stab));
147} 204}
148 205
149static inline int red_is_idling(struct red_parms *p) 206static inline int red_is_idling(const struct red_vars *v)
150{ 207{
151 return p->qidlestart.tv64 != 0; 208 return v->qidlestart.tv64 != 0;
152} 209}
153 210
154static inline void red_start_of_idle_period(struct red_parms *p) 211static inline void red_start_of_idle_period(struct red_vars *v)
155{ 212{
156 p->qidlestart = ktime_get(); 213 v->qidlestart = ktime_get();
157} 214}
158 215
159static inline void red_end_of_idle_period(struct red_parms *p) 216static inline void red_end_of_idle_period(struct red_vars *v)
160{ 217{
161 p->qidlestart.tv64 = 0; 218 v->qidlestart.tv64 = 0;
162} 219}
163 220
164static inline void red_restart(struct red_parms *p) 221static inline void red_restart(struct red_vars *v)
165{ 222{
166 red_end_of_idle_period(p); 223 red_end_of_idle_period(v);
167 p->qavg = 0; 224 v->qavg = 0;
168 p->qcount = -1; 225 v->qcount = -1;
169} 226}
170 227
171static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) 228static inline unsigned long red_calc_qavg_from_idle_time(const struct red_parms *p,
229 const struct red_vars *v)
172{ 230{
173 s64 delta = ktime_us_delta(ktime_get(), p->qidlestart); 231 s64 delta = ktime_us_delta(ktime_get(), v->qidlestart);
174 long us_idle = min_t(s64, delta, p->Scell_max); 232 long us_idle = min_t(s64, delta, p->Scell_max);
175 int shift; 233 int shift;
176 234
@@ -197,7 +255,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
197 shift = p->Stab[(us_idle >> p->Scell_log) & RED_STAB_MASK]; 255 shift = p->Stab[(us_idle >> p->Scell_log) & RED_STAB_MASK];
198 256
199 if (shift) 257 if (shift)
200 return p->qavg >> shift; 258 return v->qavg >> shift;
201 else { 259 else {
202 /* Approximate initial part of exponent with linear function: 260 /* Approximate initial part of exponent with linear function:
203 * 261 *
@@ -206,16 +264,17 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
206 * Seems, it is the best solution to 264 * Seems, it is the best solution to
207 * problem of too coarse exponent tabulation. 265 * problem of too coarse exponent tabulation.
208 */ 266 */
209 us_idle = (p->qavg * (u64)us_idle) >> p->Scell_log; 267 us_idle = (v->qavg * (u64)us_idle) >> p->Scell_log;
210 268
211 if (us_idle < (p->qavg >> 1)) 269 if (us_idle < (v->qavg >> 1))
212 return p->qavg - us_idle; 270 return v->qavg - us_idle;
213 else 271 else
214 return p->qavg >> 1; 272 return v->qavg >> 1;
215 } 273 }
216} 274}
217 275
218static inline unsigned long red_calc_qavg_no_idle_time(struct red_parms *p, 276static inline unsigned long red_calc_qavg_no_idle_time(const struct red_parms *p,
277 const struct red_vars *v,
219 unsigned int backlog) 278 unsigned int backlog)
220{ 279{
221 /* 280 /*
@@ -227,42 +286,46 @@ static inline unsigned long red_calc_qavg_no_idle_time(struct red_parms *p,
227 * 286 *
228 * --ANK (980924) 287 * --ANK (980924)
229 */ 288 */
230 return p->qavg + (backlog - (p->qavg >> p->Wlog)); 289 return v->qavg + (backlog - (v->qavg >> p->Wlog));
231} 290}
232 291
233static inline unsigned long red_calc_qavg(struct red_parms *p, 292static inline unsigned long red_calc_qavg(const struct red_parms *p,
293 const struct red_vars *v,
234 unsigned int backlog) 294 unsigned int backlog)
235{ 295{
236 if (!red_is_idling(p)) 296 if (!red_is_idling(v))
237 return red_calc_qavg_no_idle_time(p, backlog); 297 return red_calc_qavg_no_idle_time(p, v, backlog);
238 else 298 else
239 return red_calc_qavg_from_idle_time(p); 299 return red_calc_qavg_from_idle_time(p, v);
240} 300}
241 301
242static inline u32 red_random(struct red_parms *p) 302
303static inline u32 red_random(const struct red_parms *p)
243{ 304{
244 return net_random() & p->Rmask; 305 return reciprocal_divide(net_random(), p->max_P_reciprocal);
245} 306}
246 307
247static inline int red_mark_probability(struct red_parms *p, unsigned long qavg) 308static inline int red_mark_probability(const struct red_parms *p,
309 const struct red_vars *v,
310 unsigned long qavg)
248{ 311{
249 /* The formula used below causes questions. 312 /* The formula used below causes questions.
250 313
251 OK. qR is random number in the interval 0..Rmask 314 OK. qR is random number in the interval
315 (0..1/max_P)*(qth_max-qth_min)
252 i.e. 0..(2^Plog). If we used floating point 316 i.e. 0..(2^Plog). If we used floating point
253 arithmetics, it would be: (2^Plog)*rnd_num, 317 arithmetics, it would be: (2^Plog)*rnd_num,
254 where rnd_num is less 1. 318 where rnd_num is less 1.
255 319
256 Taking into account, that qavg have fixed 320 Taking into account, that qavg have fixed
257 point at Wlog, and Plog is related to max_P by 321 point at Wlog, two lines
258 max_P = (qth_max-qth_min)/2^Plog; two lines
259 below have the following floating point equivalent: 322 below have the following floating point equivalent:
260 323
261 max_P*(qavg - qth_min)/(qth_max-qth_min) < rnd/qcount 324 max_P*(qavg - qth_min)/(qth_max-qth_min) < rnd/qcount
262 325
263 Any questions? --ANK (980924) 326 Any questions? --ANK (980924)
264 */ 327 */
265 return !(((qavg - p->qth_min) >> p->Wlog) * p->qcount < p->qR); 328 return !(((qavg - p->qth_min) >> p->Wlog) * v->qcount < v->qR);
266} 329}
267 330
268enum { 331enum {
@@ -271,7 +334,7 @@ enum {
271 RED_ABOVE_MAX_TRESH, 334 RED_ABOVE_MAX_TRESH,
272}; 335};
273 336
274static inline int red_cmp_thresh(struct red_parms *p, unsigned long qavg) 337static inline int red_cmp_thresh(const struct red_parms *p, unsigned long qavg)
275{ 338{
276 if (qavg < p->qth_min) 339 if (qavg < p->qth_min)
277 return RED_BELOW_MIN_THRESH; 340 return RED_BELOW_MIN_THRESH;
@@ -287,27 +350,29 @@ enum {
287 RED_HARD_MARK, 350 RED_HARD_MARK,
288}; 351};
289 352
290static inline int red_action(struct red_parms *p, unsigned long qavg) 353static inline int red_action(const struct red_parms *p,
354 struct red_vars *v,
355 unsigned long qavg)
291{ 356{
292 switch (red_cmp_thresh(p, qavg)) { 357 switch (red_cmp_thresh(p, qavg)) {
293 case RED_BELOW_MIN_THRESH: 358 case RED_BELOW_MIN_THRESH:
294 p->qcount = -1; 359 v->qcount = -1;
295 return RED_DONT_MARK; 360 return RED_DONT_MARK;
296 361
297 case RED_BETWEEN_TRESH: 362 case RED_BETWEEN_TRESH:
298 if (++p->qcount) { 363 if (++v->qcount) {
299 if (red_mark_probability(p, qavg)) { 364 if (red_mark_probability(p, v, qavg)) {
300 p->qcount = 0; 365 v->qcount = 0;
301 p->qR = red_random(p); 366 v->qR = red_random(p);
302 return RED_PROB_MARK; 367 return RED_PROB_MARK;
303 } 368 }
304 } else 369 } else
305 p->qR = red_random(p); 370 v->qR = red_random(p);
306 371
307 return RED_DONT_MARK; 372 return RED_DONT_MARK;
308 373
309 case RED_ABOVE_MAX_TRESH: 374 case RED_ABOVE_MAX_TRESH:
310 p->qcount = -1; 375 v->qcount = -1;
311 return RED_HARD_MARK; 376 return RED_HARD_MARK;
312 } 377 }
313 378
@@ -315,4 +380,25 @@ static inline int red_action(struct red_parms *p, unsigned long qavg)
315 return RED_DONT_MARK; 380 return RED_DONT_MARK;
316} 381}
317 382
383static inline void red_adaptative_algo(struct red_parms *p, struct red_vars *v)
384{
385 unsigned long qavg;
386 u32 max_p_delta;
387
388 qavg = v->qavg;
389 if (red_is_idling(v))
390 qavg = red_calc_qavg_from_idle_time(p, v);
391
392 /* p->qavg is fixed point number with point at Wlog */
393 qavg >>= p->Wlog;
394
395 if (qavg > p->target_max && p->max_P <= MAX_P_MAX)
396 p->max_P += MAX_P_ALPHA(p->max_P); /* maxp = maxp + alpha */
397 else if (qavg < p->target_min && p->max_P >= MAX_P_MIN)
398 p->max_P = (p->max_P/10)*9; /* maxp = maxp * Beta */
399
400 max_p_delta = DIV_ROUND_CLOSEST(p->max_P, p->qth_delta);
401 max_p_delta = max(max_p_delta, 1U);
402 p->max_P_reciprocal = reciprocal_value(max_p_delta);
403}
318#endif 404#endif
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index eb7d3c2d4274..a5f79933e211 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -48,6 +48,10 @@ enum environment_cap {
48 * 99 - built by driver but a specific alpha2 cannot be determined 48 * 99 - built by driver but a specific alpha2 cannot be determined
49 * 98 - result of an intersection between two regulatory domains 49 * 98 - result of an intersection between two regulatory domains
50 * 97 - regulatory domain has not yet been configured 50 * 97 - regulatory domain has not yet been configured
51 * @dfs_region: If CRDA responded with a regulatory domain that requires
52 * DFS master operation on a known DFS region (NL80211_DFS_*),
53 * dfs_region represents that region. Drivers can use this and the
54 * @alpha2 to adjust their device's DFS parameters as required.
51 * @intersect: indicates whether the wireless core should intersect 55 * @intersect: indicates whether the wireless core should intersect
52 * the requested regulatory domain with the presently set regulatory 56 * the requested regulatory domain with the presently set regulatory
53 * domain. 57 * domain.
@@ -67,6 +71,7 @@ struct regulatory_request {
67 int wiphy_idx; 71 int wiphy_idx;
68 enum nl80211_reg_initiator initiator; 72 enum nl80211_reg_initiator initiator;
69 char alpha2[2]; 73 char alpha2[2];
74 u8 dfs_region;
70 bool intersect; 75 bool intersect;
71 bool processed; 76 bool processed;
72 enum environment_cap country_ie_env; 77 enum environment_cap country_ie_env;
@@ -93,6 +98,7 @@ struct ieee80211_reg_rule {
93struct ieee80211_regdomain { 98struct ieee80211_regdomain {
94 u32 n_reg_rules; 99 u32 n_reg_rules;
95 char alpha2[2]; 100 char alpha2[2];
101 u8 dfs_region;
96 struct ieee80211_reg_rule reg_rules[]; 102 struct ieee80211_reg_rule reg_rules[];
97}; 103};
98 104
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 6a72a58cde59..d3685615a8b0 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -71,7 +71,7 @@
71#include <linux/jiffies.h> 71#include <linux/jiffies.h>
72#include <linux/idr.h> 72#include <linux/idr.h>
73 73
74#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 74#if IS_ENABLED(CONFIG_IPV6)
75#include <net/ipv6.h> 75#include <net/ipv6.h>
76#include <net/ip6_route.h> 76#include <net/ip6_route.h>
77#endif 77#endif
@@ -383,7 +383,7 @@ static inline void sctp_sysctl_unregister(void) { return; }
383/* Size of Supported Address Parameter for 'x' address types. */ 383/* Size of Supported Address Parameter for 'x' address types. */
384#define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16)) 384#define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16))
385 385
386#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 386#if IS_ENABLED(CONFIG_IPV6)
387 387
388void sctp_v6_pf_init(void); 388void sctp_v6_pf_init(void);
389void sctp_v6_pf_exit(void); 389void sctp_v6_pf_exit(void);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index e90e7a9935dd..88949a994538 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -235,12 +235,15 @@ extern struct sctp_globals {
235 235
236 /* Flag to indicate whether computing and verifying checksum 236 /* Flag to indicate whether computing and verifying checksum
237 * is disabled. */ 237 * is disabled. */
238 int checksum_disable; 238 bool checksum_disable;
239 239
240 /* Threshold for rwnd update SACKS. Receive buffer shifted this many 240 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
241 * bits is an indicator of when to send and window update SACK. 241 * bits is an indicator of when to send and window update SACK.
242 */ 242 */
243 int rwnd_update_shift; 243 int rwnd_update_shift;
244
245 /* Threshold for autoclose timeout, in seconds. */
246 unsigned long max_autoclose;
244} sctp_globals; 247} sctp_globals;
245 248
246#define sctp_rto_initial (sctp_globals.rto_initial) 249#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -281,6 +284,7 @@ extern struct sctp_globals {
281#define sctp_auth_enable (sctp_globals.auth_enable) 284#define sctp_auth_enable (sctp_globals.auth_enable)
282#define sctp_checksum_disable (sctp_globals.checksum_disable) 285#define sctp_checksum_disable (sctp_globals.checksum_disable)
283#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift) 286#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
287#define sctp_max_autoclose (sctp_globals.max_autoclose)
284 288
285/* SCTP Socket type: UDP or TCP style. */ 289/* SCTP Socket type: UDP or TCP style. */
286typedef enum { 290typedef enum {
@@ -365,7 +369,7 @@ static inline struct sock *sctp_opt2sk(const struct sctp_sock *sp)
365 return (struct sock *)sp; 369 return (struct sock *)sp;
366} 370}
367 371
368#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 372#if IS_ENABLED(CONFIG_IPV6)
369struct sctp6_sock { 373struct sctp6_sock {
370 struct sctp_sock sctp; 374 struct sctp_sock sctp;
371 struct ipv6_pinfo inet6; 375 struct ipv6_pinfo inet6;
@@ -1085,6 +1089,7 @@ void sctp_transport_burst_reset(struct sctp_transport *);
1085unsigned long sctp_transport_timeout(struct sctp_transport *); 1089unsigned long sctp_transport_timeout(struct sctp_transport *);
1086void sctp_transport_reset(struct sctp_transport *); 1090void sctp_transport_reset(struct sctp_transport *);
1087void sctp_transport_update_pmtu(struct sctp_transport *, u32); 1091void sctp_transport_update_pmtu(struct sctp_transport *, u32);
1092void sctp_transport_immediate_rtx(struct sctp_transport *);
1088 1093
1089 1094
1090/* This is the structure we use to queue packets as they come into 1095/* This is the structure we use to queue packets as they come into
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 8f0f9ac0307f..0147b901e79c 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -67,7 +67,7 @@ struct icmp_mib {
67 67
68#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX 68#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX
69struct icmpmsg_mib { 69struct icmpmsg_mib {
70 unsigned long mibs[ICMPMSG_MIB_MAX]; 70 atomic_long_t mibs[ICMPMSG_MIB_MAX];
71}; 71};
72 72
73/* ICMP6 (IPv6-ICMP) */ 73/* ICMP6 (IPv6-ICMP) */
@@ -84,7 +84,7 @@ struct icmpv6_mib_device {
84#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX 84#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX
85/* per network ns counters */ 85/* per network ns counters */
86struct icmpv6msg_mib { 86struct icmpv6msg_mib {
87 unsigned long mibs[ICMP6MSG_MIB_MAX]; 87 atomic_long_t mibs[ICMP6MSG_MIB_MAX];
88}; 88};
89/* per device counters, (shared on all cpus) */ 89/* per device counters, (shared on all cpus) */
90struct icmpv6msg_mib_device { 90struct icmpv6msg_mib_device {
@@ -129,33 +129,33 @@ struct linux_xfrm_mib {
129 __this_cpu_inc(mib[0]->mibs[field]) 129 __this_cpu_inc(mib[0]->mibs[field])
130 130
131#define SNMP_INC_STATS_USER(mib, field) \ 131#define SNMP_INC_STATS_USER(mib, field) \
132 irqsafe_cpu_inc(mib[0]->mibs[field]) 132 this_cpu_inc(mib[0]->mibs[field])
133 133
134#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ 134#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
135 atomic_long_inc(&mib->mibs[field]) 135 atomic_long_inc(&mib->mibs[field])
136 136
137#define SNMP_INC_STATS(mib, field) \ 137#define SNMP_INC_STATS(mib, field) \
138 irqsafe_cpu_inc(mib[0]->mibs[field]) 138 this_cpu_inc(mib[0]->mibs[field])
139 139
140#define SNMP_DEC_STATS(mib, field) \ 140#define SNMP_DEC_STATS(mib, field) \
141 irqsafe_cpu_dec(mib[0]->mibs[field]) 141 this_cpu_dec(mib[0]->mibs[field])
142 142
143#define SNMP_ADD_STATS_BH(mib, field, addend) \ 143#define SNMP_ADD_STATS_BH(mib, field, addend) \
144 __this_cpu_add(mib[0]->mibs[field], addend) 144 __this_cpu_add(mib[0]->mibs[field], addend)
145 145
146#define SNMP_ADD_STATS_USER(mib, field, addend) \ 146#define SNMP_ADD_STATS_USER(mib, field, addend) \
147 irqsafe_cpu_add(mib[0]->mibs[field], addend) 147 this_cpu_add(mib[0]->mibs[field], addend)
148 148
149#define SNMP_ADD_STATS(mib, field, addend) \ 149#define SNMP_ADD_STATS(mib, field, addend) \
150 irqsafe_cpu_add(mib[0]->mibs[field], addend) 150 this_cpu_add(mib[0]->mibs[field], addend)
151/* 151/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
153 * to make @ptr a non-percpu pointer. 153 * to make @ptr a non-percpu pointer.
154 */ 154 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 156 do { \
157 irqsafe_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 157 this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \
158 irqsafe_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 158 this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \
159 } while (0) 159 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 161 do { \
diff --git a/include/net/sock.h b/include/net/sock.h
index abb6e0f0c3c3..bb972d254dff 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -53,6 +53,8 @@
53#include <linux/security.h> 53#include <linux/security.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/uaccess.h> 55#include <linux/uaccess.h>
56#include <linux/memcontrol.h>
57#include <linux/res_counter.h>
56 58
57#include <linux/filter.h> 59#include <linux/filter.h>
58#include <linux/rculist_nulls.h> 60#include <linux/rculist_nulls.h>
@@ -62,6 +64,22 @@
62#include <net/dst.h> 64#include <net/dst.h>
63#include <net/checksum.h> 65#include <net/checksum.h>
64 66
67struct cgroup;
68struct cgroup_subsys;
69#ifdef CONFIG_NET
70int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss);
71void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss);
72#else
73static inline
74int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
75{
76 return 0;
77}
78static inline
79void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss)
80{
81}
82#endif
65/* 83/*
66 * This structure really needs to be cleaned up. 84 * This structure really needs to be cleaned up.
67 * Most of it is for TCP, and not used by any of 85 * Most of it is for TCP, and not used by any of
@@ -167,6 +185,7 @@ struct sock_common {
167 /* public: */ 185 /* public: */
168}; 186};
169 187
188struct cg_proto;
170/** 189/**
171 * struct sock - network layer representation of sockets 190 * struct sock - network layer representation of sockets
172 * @__sk_common: shared layout with inet_timewait_sock 191 * @__sk_common: shared layout with inet_timewait_sock
@@ -227,6 +246,7 @@ struct sock_common {
227 * @sk_security: used by security modules 246 * @sk_security: used by security modules
228 * @sk_mark: generic packet mark 247 * @sk_mark: generic packet mark
229 * @sk_classid: this socket's cgroup classid 248 * @sk_classid: this socket's cgroup classid
249 * @sk_cgrp: this socket's cgroup-specific proto data
230 * @sk_write_pending: a write to stream socket waits to start 250 * @sk_write_pending: a write to stream socket waits to start
231 * @sk_state_change: callback to indicate change in the state of the sock 251 * @sk_state_change: callback to indicate change in the state of the sock
232 * @sk_data_ready: callback to indicate there is data to be processed 252 * @sk_data_ready: callback to indicate there is data to be processed
@@ -306,8 +326,8 @@ struct sock {
306 kmemcheck_bitfield_end(flags); 326 kmemcheck_bitfield_end(flags);
307 int sk_wmem_queued; 327 int sk_wmem_queued;
308 gfp_t sk_allocation; 328 gfp_t sk_allocation;
309 int sk_route_caps; 329 netdev_features_t sk_route_caps;
310 int sk_route_nocaps; 330 netdev_features_t sk_route_nocaps;
311 int sk_gso_type; 331 int sk_gso_type;
312 unsigned int sk_gso_max_size; 332 unsigned int sk_gso_max_size;
313 int sk_rcvlowat; 333 int sk_rcvlowat;
@@ -320,6 +340,9 @@ struct sock {
320 unsigned short sk_ack_backlog; 340 unsigned short sk_ack_backlog;
321 unsigned short sk_max_ack_backlog; 341 unsigned short sk_max_ack_backlog;
322 __u32 sk_priority; 342 __u32 sk_priority;
343#ifdef CONFIG_CGROUPS
344 __u32 sk_cgrp_prioidx;
345#endif
323 struct pid *sk_peer_pid; 346 struct pid *sk_peer_pid;
324 const struct cred *sk_peer_cred; 347 const struct cred *sk_peer_cred;
325 long sk_rcvtimeo; 348 long sk_rcvtimeo;
@@ -338,6 +361,7 @@ struct sock {
338#endif 361#endif
339 __u32 sk_mark; 362 __u32 sk_mark;
340 u32 sk_classid; 363 u32 sk_classid;
364 struct cg_proto *sk_cgrp;
341 void (*sk_state_change)(struct sock *sk); 365 void (*sk_state_change)(struct sock *sk);
342 void (*sk_data_ready)(struct sock *sk, int bytes); 366 void (*sk_data_ready)(struct sock *sk, int bytes);
343 void (*sk_write_space)(struct sock *sk); 367 void (*sk_write_space)(struct sock *sk);
@@ -563,6 +587,7 @@ enum sock_flags {
563 SOCK_FASYNC, /* fasync() active */ 587 SOCK_FASYNC, /* fasync() active */
564 SOCK_RXQ_OVFL, 588 SOCK_RXQ_OVFL,
565 SOCK_ZEROCOPY, /* buffers from userspace */ 589 SOCK_ZEROCOPY, /* buffers from userspace */
590 SOCK_WIFI_STATUS, /* push wifi status to userspace */
566}; 591};
567 592
568static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 593static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -637,12 +662,14 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
637 662
638/* 663/*
639 * Take into account size of receive queue and backlog queue 664 * Take into account size of receive queue and backlog queue
665 * Do not take into account this skb truesize,
666 * to allow even a single big packet to come.
640 */ 667 */
641static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb) 668static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb)
642{ 669{
643 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); 670 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
644 671
645 return qsize + skb->truesize > sk->sk_rcvbuf; 672 return qsize > sk->sk_rcvbuf;
646} 673}
647 674
648/* The per-socket spinlock must be held here. */ 675/* The per-socket spinlock must be held here. */
@@ -833,6 +860,37 @@ struct proto {
833#ifdef SOCK_REFCNT_DEBUG 860#ifdef SOCK_REFCNT_DEBUG
834 atomic_t socks; 861 atomic_t socks;
835#endif 862#endif
863#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
864 /*
865 * cgroup specific init/deinit functions. Called once for all
866 * protocols that implement it, from cgroups populate function.
867 * This function has to setup any files the protocol want to
868 * appear in the kmem cgroup filesystem.
869 */
870 int (*init_cgroup)(struct cgroup *cgrp,
871 struct cgroup_subsys *ss);
872 void (*destroy_cgroup)(struct cgroup *cgrp,
873 struct cgroup_subsys *ss);
874 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
875#endif
876};
877
878struct cg_proto {
879 void (*enter_memory_pressure)(struct sock *sk);
880 struct res_counter *memory_allocated; /* Current allocated memory. */
881 struct percpu_counter *sockets_allocated; /* Current number of sockets. */
882 int *memory_pressure;
883 long *sysctl_mem;
884 /*
885 * memcg field is used to find which memcg we belong directly
886 * Each memcg struct can hold more than one cg_proto, so container_of
887 * won't really cut.
888 *
889 * The elegant solution would be having an inverse function to
890 * proto_cgroup in struct proto, but that means polluting the structure
891 * for everybody, instead of just for memcg users.
892 */
893 struct mem_cgroup *memcg;
836}; 894};
837 895
838extern int proto_register(struct proto *prot, int alloc_slab); 896extern int proto_register(struct proto *prot, int alloc_slab);
@@ -851,7 +909,7 @@ static inline void sk_refcnt_debug_dec(struct sock *sk)
851 sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks)); 909 sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks));
852} 910}
853 911
854static inline void sk_refcnt_debug_release(const struct sock *sk) 912inline void sk_refcnt_debug_release(const struct sock *sk)
855{ 913{
856 if (atomic_read(&sk->sk_refcnt) != 1) 914 if (atomic_read(&sk->sk_refcnt) != 1)
857 printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n", 915 printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n",
@@ -863,6 +921,208 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
863#define sk_refcnt_debug_release(sk) do { } while (0) 921#define sk_refcnt_debug_release(sk) do { } while (0)
864#endif /* SOCK_REFCNT_DEBUG */ 922#endif /* SOCK_REFCNT_DEBUG */
865 923
924#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
925extern struct jump_label_key memcg_socket_limit_enabled;
926static inline struct cg_proto *parent_cg_proto(struct proto *proto,
927 struct cg_proto *cg_proto)
928{
929 return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg));
930}
931#define mem_cgroup_sockets_enabled static_branch(&memcg_socket_limit_enabled)
932#else
933#define mem_cgroup_sockets_enabled 0
934static inline struct cg_proto *parent_cg_proto(struct proto *proto,
935 struct cg_proto *cg_proto)
936{
937 return NULL;
938}
939#endif
940
941
942static inline bool sk_has_memory_pressure(const struct sock *sk)
943{
944 return sk->sk_prot->memory_pressure != NULL;
945}
946
947static inline bool sk_under_memory_pressure(const struct sock *sk)
948{
949 if (!sk->sk_prot->memory_pressure)
950 return false;
951
952 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
953 return !!*sk->sk_cgrp->memory_pressure;
954
955 return !!*sk->sk_prot->memory_pressure;
956}
957
958static inline void sk_leave_memory_pressure(struct sock *sk)
959{
960 int *memory_pressure = sk->sk_prot->memory_pressure;
961
962 if (!memory_pressure)
963 return;
964
965 if (*memory_pressure)
966 *memory_pressure = 0;
967
968 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
969 struct cg_proto *cg_proto = sk->sk_cgrp;
970 struct proto *prot = sk->sk_prot;
971
972 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
973 if (*cg_proto->memory_pressure)
974 *cg_proto->memory_pressure = 0;
975 }
976
977}
978
979static inline void sk_enter_memory_pressure(struct sock *sk)
980{
981 if (!sk->sk_prot->enter_memory_pressure)
982 return;
983
984 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
985 struct cg_proto *cg_proto = sk->sk_cgrp;
986 struct proto *prot = sk->sk_prot;
987
988 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
989 cg_proto->enter_memory_pressure(sk);
990 }
991
992 sk->sk_prot->enter_memory_pressure(sk);
993}
994
995static inline long sk_prot_mem_limits(const struct sock *sk, int index)
996{
997 long *prot = sk->sk_prot->sysctl_mem;
998 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
999 prot = sk->sk_cgrp->sysctl_mem;
1000 return prot[index];
1001}
1002
1003static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1004 unsigned long amt,
1005 int *parent_status)
1006{
1007 struct res_counter *fail;
1008 int ret;
1009
1010 ret = res_counter_charge(prot->memory_allocated,
1011 amt << PAGE_SHIFT, &fail);
1012
1013 if (ret < 0)
1014 *parent_status = OVER_LIMIT;
1015}
1016
1017static inline void memcg_memory_allocated_sub(struct cg_proto *prot,
1018 unsigned long amt)
1019{
1020 res_counter_uncharge(prot->memory_allocated, amt << PAGE_SHIFT);
1021}
1022
1023static inline u64 memcg_memory_allocated_read(struct cg_proto *prot)
1024{
1025 u64 ret;
1026 ret = res_counter_read_u64(prot->memory_allocated, RES_USAGE);
1027 return ret >> PAGE_SHIFT;
1028}
1029
1030static inline long
1031sk_memory_allocated(const struct sock *sk)
1032{
1033 struct proto *prot = sk->sk_prot;
1034 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1035 return memcg_memory_allocated_read(sk->sk_cgrp);
1036
1037 return atomic_long_read(prot->memory_allocated);
1038}
1039
1040static inline long
1041sk_memory_allocated_add(struct sock *sk, int amt, int *parent_status)
1042{
1043 struct proto *prot = sk->sk_prot;
1044
1045 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
1046 memcg_memory_allocated_add(sk->sk_cgrp, amt, parent_status);
1047 /* update the root cgroup regardless */
1048 atomic_long_add_return(amt, prot->memory_allocated);
1049 return memcg_memory_allocated_read(sk->sk_cgrp);
1050 }
1051
1052 return atomic_long_add_return(amt, prot->memory_allocated);
1053}
1054
1055static inline void
1056sk_memory_allocated_sub(struct sock *sk, int amt, int parent_status)
1057{
1058 struct proto *prot = sk->sk_prot;
1059
1060 if (mem_cgroup_sockets_enabled && sk->sk_cgrp &&
1061 parent_status != OVER_LIMIT) /* Otherwise was uncharged already */
1062 memcg_memory_allocated_sub(sk->sk_cgrp, amt);
1063
1064 atomic_long_sub(amt, prot->memory_allocated);
1065}
1066
1067static inline void sk_sockets_allocated_dec(struct sock *sk)
1068{
1069 struct proto *prot = sk->sk_prot;
1070
1071 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
1072 struct cg_proto *cg_proto = sk->sk_cgrp;
1073
1074 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1075 percpu_counter_dec(cg_proto->sockets_allocated);
1076 }
1077
1078 percpu_counter_dec(prot->sockets_allocated);
1079}
1080
1081static inline void sk_sockets_allocated_inc(struct sock *sk)
1082{
1083 struct proto *prot = sk->sk_prot;
1084
1085 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) {
1086 struct cg_proto *cg_proto = sk->sk_cgrp;
1087
1088 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1089 percpu_counter_inc(cg_proto->sockets_allocated);
1090 }
1091
1092 percpu_counter_inc(prot->sockets_allocated);
1093}
1094
1095static inline int
1096sk_sockets_allocated_read_positive(struct sock *sk)
1097{
1098 struct proto *prot = sk->sk_prot;
1099
1100 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1101 return percpu_counter_sum_positive(sk->sk_cgrp->sockets_allocated);
1102
1103 return percpu_counter_sum_positive(prot->sockets_allocated);
1104}
1105
1106static inline int
1107proto_sockets_allocated_sum_positive(struct proto *prot)
1108{
1109 return percpu_counter_sum_positive(prot->sockets_allocated);
1110}
1111
1112static inline long
1113proto_memory_allocated(struct proto *prot)
1114{
1115 return atomic_long_read(prot->memory_allocated);
1116}
1117
1118static inline bool
1119proto_memory_pressure(struct proto *prot)
1120{
1121 if (!prot->memory_pressure)
1122 return false;
1123 return !!*prot->memory_pressure;
1124}
1125
866 1126
867#ifdef CONFIG_PROC_FS 1127#ifdef CONFIG_PROC_FS
868/* Called with local bh disabled */ 1128/* Called with local bh disabled */
@@ -1089,8 +1349,8 @@ extern struct sock *sk_alloc(struct net *net, int family,
1089 struct proto *prot); 1349 struct proto *prot);
1090extern void sk_free(struct sock *sk); 1350extern void sk_free(struct sock *sk);
1091extern void sk_release_kernel(struct sock *sk); 1351extern void sk_release_kernel(struct sock *sk);
1092extern struct sock *sk_clone(const struct sock *sk, 1352extern struct sock *sk_clone_lock(const struct sock *sk,
1093 const gfp_t priority); 1353 const gfp_t priority);
1094 1354
1095extern struct sk_buff *sock_wmalloc(struct sock *sk, 1355extern struct sk_buff *sock_wmalloc(struct sock *sk,
1096 unsigned long size, int force, 1356 unsigned long size, int force,
@@ -1393,7 +1653,7 @@ static inline int sk_can_gso(const struct sock *sk)
1393 1653
1394extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1654extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1395 1655
1396static inline void sk_nocaps_add(struct sock *sk, int flags) 1656static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
1397{ 1657{
1398 sk->sk_route_nocaps |= flags; 1658 sk->sk_route_nocaps |= flags;
1399 sk->sk_route_caps &= ~flags; 1659 sk->sk_route_caps &= ~flags;
@@ -1670,7 +1930,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1670 1930
1671 page = alloc_pages(sk->sk_allocation, 0); 1931 page = alloc_pages(sk->sk_allocation, 0);
1672 if (!page) { 1932 if (!page) {
1673 sk->sk_prot->enter_memory_pressure(sk); 1933 sk_enter_memory_pressure(sk);
1674 sk_stream_moderate_sndbuf(sk); 1934 sk_stream_moderate_sndbuf(sk);
1675 } 1935 }
1676 return page; 1936 return page;
@@ -1714,6 +1974,8 @@ static inline int sock_intr_errno(long timeo)
1714 1974
1715extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 1975extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
1716 struct sk_buff *skb); 1976 struct sk_buff *skb);
1977extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
1978 struct sk_buff *skb);
1717 1979
1718static __inline__ void 1980static __inline__ void
1719sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1981sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -1741,6 +2003,9 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1741 __sock_recv_timestamp(msg, sk, skb); 2003 __sock_recv_timestamp(msg, sk, skb);
1742 else 2004 else
1743 sk->sk_stamp = kt; 2005 sk->sk_stamp = kt;
2006
2007 if (sock_flag(sk, SOCK_WIFI_STATUS) && skb->wifi_acked_valid)
2008 __sock_recv_wifi_status(msg, sk, skb);
1744} 2009}
1745 2010
1746extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2011extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
diff --git a/include/net/tcp.h b/include/net/tcp.h
index bb18c4d69aba..0118ea999f67 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -44,6 +44,7 @@
44#include <net/dst.h> 44#include <net/dst.h>
45 45
46#include <linux/seq_file.h> 46#include <linux/seq_file.h>
47#include <linux/memcontrol.h>
47 48
48extern struct inet_hashinfo tcp_hashinfo; 49extern struct inet_hashinfo tcp_hashinfo;
49 50
@@ -229,7 +230,6 @@ extern int sysctl_tcp_fack;
229extern int sysctl_tcp_reordering; 230extern int sysctl_tcp_reordering;
230extern int sysctl_tcp_ecn; 231extern int sysctl_tcp_ecn;
231extern int sysctl_tcp_dsack; 232extern int sysctl_tcp_dsack;
232extern long sysctl_tcp_mem[3];
233extern int sysctl_tcp_wmem[3]; 233extern int sysctl_tcp_wmem[3];
234extern int sysctl_tcp_rmem[3]; 234extern int sysctl_tcp_rmem[3];
235extern int sysctl_tcp_app_win; 235extern int sysctl_tcp_app_win;
@@ -285,7 +285,7 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
285 } 285 }
286 286
287 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && 287 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
288 atomic_long_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]) 288 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
289 return true; 289 return true;
290 return false; 290 return false;
291} 291}
@@ -628,7 +628,7 @@ extern u32 __tcp_select_window(struct sock *sk);
628struct tcp_skb_cb { 628struct tcp_skb_cb {
629 union { 629 union {
630 struct inet_skb_parm h4; 630 struct inet_skb_parm h4;
631#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 631#if IS_ENABLED(CONFIG_IPV6)
632 struct inet6_skb_parm h6; 632 struct inet6_skb_parm h6;
633#endif 633#endif
634 } header; /* For incoming frames */ 634 } header; /* For incoming frames */
@@ -773,12 +773,12 @@ static inline int tcp_is_reno(const struct tcp_sock *tp)
773 773
774static inline int tcp_is_fack(const struct tcp_sock *tp) 774static inline int tcp_is_fack(const struct tcp_sock *tp)
775{ 775{
776 return tp->rx_opt.sack_ok & 2; 776 return tp->rx_opt.sack_ok & TCP_FACK_ENABLED;
777} 777}
778 778
779static inline void tcp_enable_fack(struct tcp_sock *tp) 779static inline void tcp_enable_fack(struct tcp_sock *tp)
780{ 780{
781 tp->rx_opt.sack_ok |= 2; 781 tp->rx_opt.sack_ok |= TCP_FACK_ENABLED;
782} 782}
783 783
784static inline unsigned int tcp_left_out(const struct tcp_sock *tp) 784static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
@@ -834,6 +834,14 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
834extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 834extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
835extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 835extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst);
836 836
837/* The maximum number of MSS of available cwnd for which TSO defers
838 * sending if not using sysctl_tcp_tso_win_divisor.
839 */
840static inline __u32 tcp_max_tso_deferred_mss(const struct tcp_sock *tp)
841{
842 return 3;
843}
844
837/* Slow start with delack produces 3 packets of burst, so that 845/* Slow start with delack produces 3 packets of burst, so that
838 * it is safe "de facto". This will be the default - same as 846 * it is safe "de facto". This will be the default - same as
839 * the default reordering threshold - but if reordering increases, 847 * the default reordering threshold - but if reordering increases,
@@ -1144,7 +1152,7 @@ struct tcp6_md5sig_key {
1144/* - sock block */ 1152/* - sock block */
1145struct tcp_md5sig_info { 1153struct tcp_md5sig_info {
1146 struct tcp4_md5sig_key *keys4; 1154 struct tcp4_md5sig_key *keys4;
1147#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1155#if IS_ENABLED(CONFIG_IPV6)
1148 struct tcp6_md5sig_key *keys6; 1156 struct tcp6_md5sig_key *keys6;
1149 u32 entries6; 1157 u32 entries6;
1150 u32 alloced6; 1158 u32 alloced6;
@@ -1171,7 +1179,7 @@ struct tcp6_pseudohdr {
1171 1179
1172union tcp_md5sum_block { 1180union tcp_md5sum_block {
1173 struct tcp4_pseudohdr ip4; 1181 struct tcp4_pseudohdr ip4;
1174#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1182#if IS_ENABLED(CONFIG_IPV6)
1175 struct tcp6_pseudohdr ip6; 1183 struct tcp6_pseudohdr ip6;
1176#endif 1184#endif
1177}; 1185};
@@ -1430,7 +1438,8 @@ extern struct request_sock_ops tcp6_request_sock_ops;
1430extern void tcp_v4_destroy_sock(struct sock *sk); 1438extern void tcp_v4_destroy_sock(struct sock *sk);
1431 1439
1432extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1440extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1433extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features); 1441extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
1442 netdev_features_t features);
1434extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1443extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1435 struct sk_buff *skb); 1444 struct sk_buff *skb);
1436extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, 1445extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
new file mode 100644
index 000000000000..3512082fa909
--- /dev/null
+++ b/include/net/tcp_memcontrol.h
@@ -0,0 +1,19 @@
1#ifndef _TCP_MEMCG_H
2#define _TCP_MEMCG_H
3
4struct tcp_memcontrol {
5 struct cg_proto cg_proto;
6 /* per-cgroup tcp memory pressure knobs */
7 struct res_counter tcp_memory_allocated;
8 struct percpu_counter tcp_sockets_allocated;
9 /* those two are read-mostly, leave them at the end */
10 long tcp_prot_mem[3];
11 int tcp_memory_pressure;
12};
13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index 3b285f402f48..e39592f682c3 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -41,7 +41,7 @@
41struct udp_skb_cb { 41struct udp_skb_cb {
42 union { 42 union {
43 struct inet_skb_parm h4; 43 struct inet_skb_parm h4;
44#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 44#if IS_ENABLED(CONFIG_IPV6)
45 struct inet6_skb_parm h6; 45 struct inet6_skb_parm h6;
46#endif 46#endif
47 } header; 47 } header;
@@ -194,9 +194,15 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
194extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 194extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
195 __be32 daddr, __be16 dport, 195 __be32 daddr, __be16 dport,
196 int dif); 196 int dif);
197extern struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
198 __be32 daddr, __be16 dport,
199 int dif, struct udp_table *tbl);
197extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport, 200extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport,
198 const struct in6_addr *daddr, __be16 dport, 201 const struct in6_addr *daddr, __be16 dport,
199 int dif); 202 int dif);
203extern struct sock *__udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport,
204 const struct in6_addr *daddr, __be16 dport,
205 int dif, struct udp_table *tbl);
200 206
201/* 207/*
202 * SNMP statistics for UDP and UDP-Lite 208 * SNMP statistics for UDP and UDP-Lite
@@ -217,7 +223,7 @@ extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *sadd
217 else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \ 223 else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \
218} while(0) 224} while(0)
219 225
220#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 226#if IS_ENABLED(CONFIG_IPV6)
221#define UDPX_INC_STATS_BH(sk, field) \ 227#define UDPX_INC_STATS_BH(sk, field) \
222 do { \ 228 do { \
223 if ((sk)->sk_family == AF_INET) \ 229 if ((sk)->sk_family == AF_INET) \
@@ -258,5 +264,6 @@ extern void udp4_proc_exit(void);
258extern void udp_init(void); 264extern void udp_init(void);
259 265
260extern int udp4_ufo_send_check(struct sk_buff *skb); 266extern int udp4_ufo_send_check(struct sk_buff *skb);
261extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features); 267extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
268 netdev_features_t features);
262#endif /* _UDP_H */ 269#endif /* _UDP_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index b203e14d26b7..89174e29dca9 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -827,6 +827,14 @@ static inline bool addr_match(const void *token1, const void *token2,
827 return true; 827 return true;
828} 828}
829 829
830static inline bool addr4_match(__be32 a1, __be32 a2, u8 prefixlen)
831{
832 /* C99 6.5.7 (3): u32 << 32 is undefined behaviour */
833 if (prefixlen == 0)
834 return true;
835 return !((a1 ^ a2) & htonl(0xFFFFFFFFu << (32 - prefixlen)));
836}
837
830static __inline__ 838static __inline__
831__be16 xfrm_flowi_sport(const struct flowi *fl, const union flowi_uli *uli) 839__be16 xfrm_flowi_sport(const struct flowi *fl, const union flowi_uli *uli)
832{ 840{
@@ -1209,8 +1217,8 @@ void xfrm_flowi_addr_get(const struct flowi *fl,
1209 memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4)); 1217 memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4));
1210 break; 1218 break;
1211 case AF_INET6: 1219 case AF_INET6:
1212 ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->u.ip6.saddr); 1220 *(struct in6_addr *)saddr->a6 = fl->u.ip6.saddr;
1213 ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->u.ip6.daddr); 1221 *(struct in6_addr *)daddr->a6 = fl->u.ip6.daddr;
1214 break; 1222 break;
1215 } 1223 }
1216} 1224}
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 639a4491fc0d..99965395c5f3 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -281,7 +281,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid)
281static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev) 281static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev)
282{ 282{
283 return dev->priv_flags & IFF_802_1Q_VLAN ? 283 return dev->priv_flags & IFF_802_1Q_VLAN ?
284 vlan_dev_real_dev(dev) : 0; 284 vlan_dev_real_dev(dev) : NULL;
285} 285}
286 286
287#endif /* IB_ADDR_H */ 287#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index c8f94e8db69c..83f77ac33957 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -38,6 +38,9 @@
38#include <rdma/ib_mad.h> 38#include <rdma/ib_mad.h>
39#include <rdma/ib_sa.h> 39#include <rdma/ib_sa.h>
40 40
41/* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
42extern struct class cm_class;
43
41enum ib_cm_state { 44enum ib_cm_state {
42 IB_CM_IDLE, 45 IB_CM_IDLE,
43 IB_CM_LISTEN, 46 IB_CM_LISTEN,
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index d1e95c6ac776..5a35a2a2d3c5 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -147,6 +147,7 @@ struct fcoe_ctlr {
147 u8 map_dest; 147 u8 map_dest;
148 u8 spma; 148 u8 spma;
149 u8 probe_tries; 149 u8 probe_tries;
150 u8 priority;
150 u8 dest_addr[ETH_ALEN]; 151 u8 dest_addr[ETH_ALEN];
151 u8 ctl_src_addr[ETH_ALEN]; 152 u8 ctl_src_addr[ETH_ALEN];
152 153
@@ -301,6 +302,7 @@ struct fcoe_percpu_s {
301 * @lport: The associated local port 302 * @lport: The associated local port
302 * @fcoe_pending_queue: The pending Rx queue of skbs 303 * @fcoe_pending_queue: The pending Rx queue of skbs
303 * @fcoe_pending_queue_active: Indicates if the pending queue is active 304 * @fcoe_pending_queue_active: Indicates if the pending queue is active
305 * @priority: Packet priority (DCB)
304 * @max_queue_depth: Max queue depth of pending queue 306 * @max_queue_depth: Max queue depth of pending queue
305 * @min_queue_depth: Min queue depth of pending queue 307 * @min_queue_depth: Min queue depth of pending queue
306 * @timer: The queue timer 308 * @timer: The queue timer
@@ -316,6 +318,7 @@ struct fcoe_port {
316 struct fc_lport *lport; 318 struct fc_lport *lport;
317 struct sk_buff_head fcoe_pending_queue; 319 struct sk_buff_head fcoe_pending_queue;
318 u8 fcoe_pending_queue_active; 320 u8 fcoe_pending_queue_active;
321 u8 priority;
319 u32 max_queue_depth; 322 u32 max_queue_depth;
320 u32 min_queue_depth; 323 u32 min_queue_depth;
321 struct timer_list timer; 324 struct timer_list timer;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 5591ed54dc93..77273f2fdd80 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -185,7 +185,6 @@ typedef void (*activate_complete)(void *, int);
185struct scsi_device_handler { 185struct scsi_device_handler {
186 /* Used by the infrastructure */ 186 /* Used by the infrastructure */
187 struct list_head list; /* list of scsi_device_handlers */ 187 struct list_head list; /* list of scsi_device_handlers */
188 int idx;
189 188
190 /* Filled by the hardware handler */ 189 /* Filled by the hardware handler */
191 struct module *module; 190 struct module *module;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 50266c9405fc..5f7d5b3b1c6e 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -669,6 +669,9 @@ struct Scsi_Host {
669 /* Asynchronous scan in progress */ 669 /* Asynchronous scan in progress */
670 unsigned async_scan:1; 670 unsigned async_scan:1;
671 671
672 /* Don't resume host in EH */
673 unsigned eh_noresume:1;
674
672 /* 675 /*
673 * Optional work queue to be utilized by the transport 676 * Optional work queue to be utilized by the transport
674 */ 677 */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 5994bcc1b017..2c3a46d102fd 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -142,7 +142,7 @@ struct iscsi_transport {
142 int (*get_iface_param) (struct iscsi_iface *iface, 142 int (*get_iface_param) (struct iscsi_iface *iface,
143 enum iscsi_param_type param_type, 143 enum iscsi_param_type param_type,
144 int param, char *buf); 144 int param, char *buf);
145 mode_t (*attr_is_visible)(int param_type, int param); 145 umode_t (*attr_is_visible)(int param_type, int param);
146 int (*bsg_request)(struct bsg_job *job); 146 int (*bsg_request)(struct bsg_job *job);
147}; 147};
148 148
@@ -211,6 +211,11 @@ struct iscsi_cls_session {
211 unsigned int target_id; 211 unsigned int target_id;
212 bool ida_used; 212 bool ida_used;
213 213
214 /*
215 * pid of userspace process that created session or -1 if
216 * created by the kernel.
217 */
218 pid_t creator;
214 int state; 219 int state;
215 int sid; /* session id */ 220 int sid; /* session id */
216 void *dd_data; /* LLD private data */ 221 void *dd_data; /* LLD private data */
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
index 802947f60915..6df30ed1581c 100644
--- a/include/sound/Kbuild
+++ b/include/sound/Kbuild
@@ -6,3 +6,5 @@ header-y += hdsp.h
6header-y += hdspm.h 6header-y += hdspm.h
7header-y += sb16_csp.h 7header-y += sb16_csp.h
8header-y += sfnt_info.h 8header-y += sfnt_info.h
9header-y += compress_params.h
10header-y += compress_offload.h
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
new file mode 100644
index 000000000000..48f2a1ff2bbc
--- /dev/null
+++ b/include/sound/compress_driver.h
@@ -0,0 +1,167 @@
1/*
2 * compress_driver.h - compress offload driver definations
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Authors: Vinod Koul <vinod.koul@linux.intel.com>
6 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 */
25#ifndef __COMPRESS_DRIVER_H
26#define __COMPRESS_DRIVER_H
27
28#include <linux/types.h>
29#include <linux/sched.h>
30#include <sound/compress_offload.h>
31#include <sound/asound.h>
32#include <sound/pcm.h>
33
34struct snd_compr_ops;
35
36/**
37 * struct snd_compr_runtime: runtime stream description
38 * @state: stream state
39 * @ops: pointer to DSP callbacks
40 * @buffer: pointer to kernel buffer, valid only when not in mmap mode or
41 * DSP doesn't implement copy
42 * @buffer_size: size of the above buffer
43 * @fragment_size: size of buffer fragment in bytes
44 * @fragments: number of such fragments
45 * @hw_pointer: offset of last location in buffer where DSP copied data
46 * @app_pointer: offset of last location in buffer where app wrote data
47 * @total_bytes_available: cumulative number of bytes made available in
48 * the ring buffer
49 * @total_bytes_transferred: cumulative bytes transferred by offload DSP
50 * @sleep: poll sleep
51 */
52struct snd_compr_runtime {
53 snd_pcm_state_t state;
54 struct snd_compr_ops *ops;
55 void *buffer;
56 u64 buffer_size;
57 u32 fragment_size;
58 u32 fragments;
59 u64 hw_pointer;
60 u64 app_pointer;
61 u64 total_bytes_available;
62 u64 total_bytes_transferred;
63 wait_queue_head_t sleep;
64};
65
66/**
67 * struct snd_compr_stream: compressed stream
68 * @name: device name
69 * @ops: pointer to DSP callbacks
70 * @runtime: pointer to runtime structure
71 * @device: device pointer
72 * @direction: stream direction, playback/recording
73 * @private_data: pointer to DSP private data
74 */
75struct snd_compr_stream {
76 const char *name;
77 struct snd_compr_ops *ops;
78 struct snd_compr_runtime *runtime;
79 struct snd_compr *device;
80 enum snd_compr_direction direction;
81 void *private_data;
82};
83
84/**
85 * struct snd_compr_ops: compressed path DSP operations
86 * @open: Open the compressed stream
87 * This callback is mandatory and shall keep dsp ready to receive the stream
88 * parameter
89 * @free: Close the compressed stream, mandatory
90 * @set_params: Sets the compressed stream parameters, mandatory
91 * This can be called in during stream creation only to set codec params
92 * and the stream properties
93 * @get_params: retrieve the codec parameters, mandatory
94 * @trigger: Trigger operations like start, pause, resume, drain, stop.
95 * This callback is mandatory
96 * @pointer: Retrieve current h/w pointer information. Mandatory
97 * @copy: Copy the compressed data to/from userspace, Optional
98 * Can't be implemented if DSP supports mmap
99 * @mmap: DSP mmap method to mmap DSP memory
100 * @ack: Ack for DSP when data is written to audio buffer, Optional
101 * Not valid if copy is implemented
102 * @get_caps: Retrieve DSP capabilities, mandatory
103 * @get_codec_caps: Retrieve capabilities for a specific codec, mandatory
104 */
105struct snd_compr_ops {
106 int (*open)(struct snd_compr_stream *stream);
107 int (*free)(struct snd_compr_stream *stream);
108 int (*set_params)(struct snd_compr_stream *stream,
109 struct snd_compr_params *params);
110 int (*get_params)(struct snd_compr_stream *stream,
111 struct snd_codec *params);
112 int (*trigger)(struct snd_compr_stream *stream, int cmd);
113 int (*pointer)(struct snd_compr_stream *stream,
114 struct snd_compr_tstamp *tstamp);
115 int (*copy)(struct snd_compr_stream *stream, const char __user *buf,
116 size_t count);
117 int (*mmap)(struct snd_compr_stream *stream,
118 struct vm_area_struct *vma);
119 int (*ack)(struct snd_compr_stream *stream, size_t bytes);
120 int (*get_caps) (struct snd_compr_stream *stream,
121 struct snd_compr_caps *caps);
122 int (*get_codec_caps) (struct snd_compr_stream *stream,
123 struct snd_compr_codec_caps *codec);
124};
125
126/**
127 * struct snd_compr: Compressed device
128 * @name: DSP device name
129 * @dev: Device pointer
130 * @ops: pointer to DSP callbacks
131 * @private_data: pointer to DSP pvt data
132 * @card: sound card pointer
133 * @direction: Playback or capture direction
134 * @lock: device lock
135 * @device: device id
136 */
137struct snd_compr {
138 const char *name;
139 struct device *dev;
140 struct snd_compr_ops *ops;
141 void *private_data;
142 struct snd_card *card;
143 unsigned int direction;
144 struct mutex lock;
145 int device;
146};
147
148/* compress device register APIs */
149int snd_compress_register(struct snd_compr *device);
150int snd_compress_deregister(struct snd_compr *device);
151int snd_compress_new(struct snd_card *card, int device,
152 int type, struct snd_compr *compr);
153
154/* dsp driver callback apis
155 * For playback: driver should call snd_compress_fragment_elapsed() to let the
156 * framework know that a fragment has been consumed from the ring buffer
157 *
158 * For recording: we want to know when a frame is available or when
159 * at least one frame is available so snd_compress_frame_elapsed()
160 * callback should be called when a encodeded frame is available
161 */
162static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
163{
164 wake_up(&stream->runtime->sleep);
165}
166
167#endif
diff --git a/include/sound/compress_offload.h b/include/sound/compress_offload.h
new file mode 100644
index 000000000000..05341a43fedf
--- /dev/null
+++ b/include/sound/compress_offload.h
@@ -0,0 +1,161 @@
1/*
2 * compress_offload.h - compress offload header definations
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Authors: Vinod Koul <vinod.koul@linux.intel.com>
6 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 */
25#ifndef __COMPRESS_OFFLOAD_H
26#define __COMPRESS_OFFLOAD_H
27
28#include <linux/types.h>
29#include <sound/asound.h>
30#include <sound/compress_params.h>
31
32
33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0)
34/**
35 * struct snd_compressed_buffer: compressed buffer
36 * @fragment_size: size of buffer fragment in bytes
37 * @fragments: number of such fragments
38 */
39struct snd_compressed_buffer {
40 __u32 fragment_size;
41 __u32 fragments;
42};
43
44/**
45 * struct snd_compr_params: compressed stream params
46 * @buffer: buffer description
47 * @codec: codec parameters
48 * @no_wake_mode: dont wake on fragment elapsed
49 */
50struct snd_compr_params {
51 struct snd_compressed_buffer buffer;
52 struct snd_codec codec;
53 __u8 no_wake_mode;
54};
55
56/**
57 * struct snd_compr_tstamp: timestamp descriptor
58 * @byte_offset: Byte offset in ring buffer to DSP
59 * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP
60 * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by
61 * large steps and should only be used to monitor encoding/decoding
62 * progress. It shall not be used for timing estimates.
63 * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio
64 * output/input. This field should be used for A/V sync or time estimates.
65 * @sampling_rate: sampling rate of audio
66 */
67struct snd_compr_tstamp {
68 __u32 byte_offset;
69 __u32 copied_total;
70 snd_pcm_uframes_t pcm_frames;
71 snd_pcm_uframes_t pcm_io_frames;
72 __u32 sampling_rate;
73};
74
75/**
76 * struct snd_compr_avail: avail descriptor
77 * @avail: Number of bytes available in ring buffer for writing/reading
78 * @tstamp: timestamp infomation
79 */
80struct snd_compr_avail {
81 __u64 avail;
82 struct snd_compr_tstamp tstamp;
83};
84
85enum snd_compr_direction {
86 SND_COMPRESS_PLAYBACK = 0,
87 SND_COMPRESS_CAPTURE
88};
89
90/**
91 * struct snd_compr_caps: caps descriptor
92 * @codecs: pointer to array of codecs
93 * @direction: direction supported. Of type snd_compr_direction
94 * @min_fragment_size: minimum fragment supported by DSP
95 * @max_fragment_size: maximum fragment supported by DSP
96 * @min_fragments: min fragments supported by DSP
97 * @max_fragments: max fragments supported by DSP
98 * @num_codecs: number of codecs supported
99 * @reserved: reserved field
100 */
101struct snd_compr_caps {
102 __u32 num_codecs;
103 __u32 direction;
104 __u32 min_fragment_size;
105 __u32 max_fragment_size;
106 __u32 min_fragments;
107 __u32 max_fragments;
108 __u32 codecs[MAX_NUM_CODECS];
109 __u32 reserved[11];
110};
111
112/**
113 * struct snd_compr_codec_caps: query capability of codec
114 * @codec: codec for which capability is queried
115 * @num_descriptors: number of codec descriptors
116 * @descriptor: array of codec capability descriptor
117 */
118struct snd_compr_codec_caps {
119 __u32 codec;
120 __u32 num_descriptors;
121 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
122};
123
124/**
125 * compress path ioctl definitions
126 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
127 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
128 * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters
129 * Note: only codec params can be changed runtime and stream params cant be
130 * SNDRV_COMPRESS_GET_PARAMS: Query codec params
131 * SNDRV_COMPRESS_TSTAMP: get the current timestamp value
132 * SNDRV_COMPRESS_AVAIL: get the current buffer avail value.
133 * This also queries the tstamp properties
134 * SNDRV_COMPRESS_PAUSE: Pause the running stream
135 * SNDRV_COMPRESS_RESUME: resume a paused stream
136 * SNDRV_COMPRESS_START: Start a stream
137 * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content
138 * and the buffers currently with DSP
139 * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that
140 * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version
141 */
142#define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int)
143#define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps)
144#define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,\
145 struct snd_compr_codec_caps)
146#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
147#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
148#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
149#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
150#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
151#define SNDRV_COMPRESS_RESUME _IO('C', 0x31)
152#define SNDRV_COMPRESS_START _IO('C', 0x32)
153#define SNDRV_COMPRESS_STOP _IO('C', 0x33)
154#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
155/*
156 * TODO
157 * 1. add mmap support
158 *
159 */
160#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */
161#endif
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
new file mode 100644
index 000000000000..d97d69f81a7d
--- /dev/null
+++ b/include/sound/compress_params.h
@@ -0,0 +1,397 @@
1/*
2 * compress_params.h - codec types and parameters for compressed data
3 * streaming interface
4 *
5 * Copyright (C) 2011 Intel Corporation
6 * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * Vinod Koul <vinod.koul@linux.intel.com>
8 *
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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; version 2 of the License.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 *
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 *
26 * The definitions in this file are derived from the OpenMAX AL version 1.1
27 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below.
28 *
29 * Copyright (c) 2007-2010 The Khronos Group Inc.
30 *
31 * Permission is hereby granted, free of charge, to any person obtaining
32 * a copy of this software and/or associated documentation files (the
33 * "Materials "), to deal in the Materials without restriction, including
34 * without limitation the rights to use, copy, modify, merge, publish,
35 * distribute, sublicense, and/or sell copies of the Materials, and to
36 * permit persons to whom the Materials are furnished to do so, subject to
37 * the following conditions:
38 *
39 * The above copyright notice and this permission notice shall be included
40 * in all copies or substantial portions of the Materials.
41 *
42 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
49 *
50 */
51#ifndef __SND_COMPRESS_PARAMS_H
52#define __SND_COMPRESS_PARAMS_H
53
54/* AUDIO CODECS SUPPORTED */
55#define MAX_NUM_CODECS 32
56#define MAX_NUM_CODEC_DESCRIPTORS 32
57#define MAX_NUM_BITRATES 32
58
59/* Codecs are listed linearly to allow for extensibility */
60#define SND_AUDIOCODEC_PCM ((__u32) 0x00000001)
61#define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002)
62#define SND_AUDIOCODEC_AMR ((__u32) 0x00000003)
63#define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004)
64#define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005)
65#define SND_AUDIOCODEC_AAC ((__u32) 0x00000006)
66#define SND_AUDIOCODEC_WMA ((__u32) 0x00000007)
67#define SND_AUDIOCODEC_REAL ((__u32) 0x00000008)
68#define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009)
69#define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A)
70#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
71#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
72#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
73
74/*
75 * Profile and modes are listed with bit masks. This allows for a
76 * more compact representation of fields that will not evolve
77 * (in contrast to the list of codecs)
78 */
79
80#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
81
82/* MP3 modes are only useful for encoders */
83#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
84#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
85#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004)
86#define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008)
87
88#define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001)
89
90/* AMR modes are only useful for encoders */
91#define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001)
92#define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002)
93#define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004)
94
95#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000)
96#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001)
97#define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002)
98#define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004)
99#define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008)
100#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010)
101#define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020)
102
103#define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001)
104
105/* AMRWB modes are only useful for encoders */
106#define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001)
107#define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002)
108#define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004)
109
110#define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001)
111
112#define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001)
113
114/* AAC modes are required for encoders and decoders */
115#define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001)
116#define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002)
117#define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004)
118#define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008)
119#define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010)
120#define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020)
121#define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040)
122#define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080)
123#define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100)
124#define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200)
125
126/* AAC formats are required for encoders and decoders */
127#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001)
128#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002)
129#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004)
130#define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008)
131#define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010)
132#define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020)
133#define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040)
134
135#define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001)
136#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
137#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
138#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
139
140#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
141#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
142#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
143#define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008)
144#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010)
145#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020)
146#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040)
147#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080)
148
149#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001)
150/*
151 * Some implementations strip the ASF header and only send ASF packets
152 * to the DSP
153 */
154#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002)
155
156#define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001)
157
158#define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001)
159#define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002)
160#define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004)
161#define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008)
162
163#define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001)
164
165#define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001)
166
167#define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001)
168
169/*
170 * Define quality levels for FLAC encoders, from LEVEL0 (fast)
171 * to LEVEL8 (best)
172 */
173#define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001)
174#define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002)
175#define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004)
176#define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008)
177#define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010)
178#define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020)
179#define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040)
180#define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080)
181#define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100)
182
183#define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001)
184#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002)
185
186/* IEC61937 payloads without CUVP and preambles */
187#define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001)
188/* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */
189#define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002)
190
191/*
192 * IEC modes are mandatory for decoders. Format autodetection
193 * will only happen on the DSP side with mode 0. The PCM mode should
194 * not be used, the PCM codec should be used instead.
195 */
196#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000)
197#define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001)
198#define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002)
199#define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004)
200#define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008)
201#define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010)
202#define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020)
203#define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040)
204#define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080)
205#define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100)
206#define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200)
207#define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400)
208#define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800)
209#define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000)
210#define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000)
211#define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000)
212#define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000)
213#define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000)
214#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000)
215
216#define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001)
217
218#define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001)
219#define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002)
220#define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004)
221
222#define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001)
223
224#define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001)
225#define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002)
226
227/* <FIXME: multichannel encoders aren't supported for now. Would need
228 an additional definition of channel arrangement> */
229
230/* VBR/CBR definitions */
231#define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001)
232#define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002)
233
234/* Encoder options */
235
236struct snd_enc_wma {
237 __u32 super_block_align; /* WMA Type-specific data */
238};
239
240
241/**
242 * struct snd_enc_vorbis
243 * @quality: Sets encoding quality to n, between -1 (low) and 10 (high).
244 * In the default mode of operation, the quality level is 3.
245 * Normal quality range is 0 - 10.
246 * @managed: Boolean. Set bitrate management mode. This turns off the
247 * normal VBR encoding, but allows hard or soft bitrate constraints to be
248 * enforced by the encoder. This mode can be slower, and may also be
249 * lower quality. It is primarily useful for streaming.
250 * @max_bit_rate: Enabled only if managed is TRUE
251 * @min_bit_rate: Enabled only if managed is TRUE
252 * @downmix: Boolean. Downmix input from stereo to mono (has no effect on
253 * non-stereo streams). Useful for lower-bitrate encoding.
254 *
255 * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc
256 * properties
257 *
258 * For best quality users should specify VBR mode and set quality levels.
259 */
260
261struct snd_enc_vorbis {
262 __s32 quality;
263 __u32 managed;
264 __u32 max_bit_rate;
265 __u32 min_bit_rate;
266 __u32 downmix;
267};
268
269
270/**
271 * struct snd_enc_real
272 * @quant_bits: number of coupling quantization bits in the stream
273 * @start_region: coupling start region in the stream
274 * @num_regions: number of regions value
275 *
276 * These options were extracted from the OpenMAX IL spec
277 */
278
279struct snd_enc_real {
280 __u32 quant_bits;
281 __u32 start_region;
282 __u32 num_regions;
283};
284
285/**
286 * struct snd_enc_flac
287 * @num: serial number, valid only for OGG formats
288 * needs to be set by application
289 * @gain: Add replay gain tags
290 *
291 * These options were extracted from the FLAC online documentation
292 * at http://flac.sourceforge.net/documentation_tools_flac.html
293 *
294 * To make the API simpler, it is assumed that the user will select quality
295 * profiles. Additional options that affect encoding quality and speed can
296 * be added at a later stage if needed.
297 *
298 * By default the Subset format is used by encoders.
299 *
300 * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are
301 * not supported in this API.
302 */
303
304struct snd_enc_flac {
305 __u32 num;
306 __u32 gain;
307};
308
309struct snd_enc_generic {
310 __u32 bw; /* encoder bandwidth */
311 __s32 reserved[15];
312};
313
314union snd_codec_options {
315 struct snd_enc_wma wma;
316 struct snd_enc_vorbis vorbis;
317 struct snd_enc_real real;
318 struct snd_enc_flac flac;
319 struct snd_enc_generic generic;
320};
321
322/** struct snd_codec_desc - description of codec capabilities
323 * @max_ch: Maximum number of audio channels
324 * @sample_rates: Sampling rates in Hz, use SNDRV_PCM_RATE_xxx for this
325 * @bit_rate: Indexed array containing supported bit rates
326 * @num_bitrates: Number of valid values in bit_rate array
327 * @rate_control: value is specified by SND_RATECONTROLMODE defines.
328 * @profiles: Supported profiles. See SND_AUDIOPROFILE defines.
329 * @modes: Supported modes. See SND_AUDIOMODE defines
330 * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines
331 * @min_buffer: Minimum buffer size handled by codec implementation
332 * @reserved: reserved for future use
333 *
334 * This structure provides a scalar value for profiles, modes and stream
335 * format fields.
336 * If an implementation supports multiple combinations, they will be listed as
337 * codecs with different descriptors, for example there would be 2 descriptors
338 * for AAC-RAW and AAC-ADTS.
339 * This entails some redundancy but makes it easier to avoid invalid
340 * configurations.
341 *
342 */
343
344struct snd_codec_desc {
345 __u32 max_ch;
346 __u32 sample_rates;
347 __u32 bit_rate[MAX_NUM_BITRATES];
348 __u32 num_bitrates;
349 __u32 rate_control;
350 __u32 profiles;
351 __u32 modes;
352 __u32 formats;
353 __u32 min_buffer;
354 __u32 reserved[15];
355};
356
357/** struct snd_codec
358 * @id: Identifies the supported audio encoder/decoder.
359 * See SND_AUDIOCODEC macros.
360 * @ch_in: Number of input audio channels
361 * @ch_out: Number of output channels. In case of contradiction between
362 * this field and the channelMode field, the channelMode field
363 * overrides.
364 * @sample_rate: Audio sample rate of input data
365 * @bit_rate: Bitrate of encoded data. May be ignored by decoders
366 * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines.
367 * Encoders may rely on profiles for quality levels.
368 * May be ignored by decoders.
369 * @profile: Mandatory for encoders, can be mandatory for specific
370 * decoders as well. See SND_AUDIOPROFILE defines.
371 * @level: Supported level (Only used by WMA at the moment)
372 * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines
373 * @format: Format of encoded bistream. Mandatory when defined.
374 * See SND_AUDIOSTREAMFORMAT defines.
375 * @align: Block alignment in bytes of an audio sample.
376 * Only required for PCM or IEC formats.
377 * @options: encoder-specific settings
378 * @reserved: reserved for future use
379 */
380
381struct snd_codec {
382 __u32 id;
383 __u32 ch_in;
384 __u32 ch_out;
385 __u32 sample_rate;
386 __u32 bit_rate;
387 __u32 rate_control;
388 __u32 profile;
389 __u32 level;
390 __u32 ch_mode;
391 __u32 format;
392 __u32 align;
393 union snd_codec_options options;
394 __u32 reserved[3];
395};
396
397#endif
diff --git a/include/sound/control.h b/include/sound/control.h
index 1a94a216ed99..b2796e83c7ac 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -227,4 +227,12 @@ snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); 227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
228} 228}
229 229
230/*
231 * Helper functions for jack-detection controls
232 */
233struct snd_kcontrol *
234snd_kctl_jack_new(const char *name, int idx, void *private_data);
235void snd_kctl_jack_report(struct snd_card *card,
236 struct snd_kcontrol *kctl, bool status);
237
230#endif /* __SOUND_CONTROL_H */ 238#endif /* __SOUND_CONTROL_H */
diff --git a/include/sound/core.h b/include/sound/core.h
index 3be5ab782b99..5ab255f196cc 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -62,6 +62,7 @@ typedef int __bitwise snd_device_type_t;
62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009) 64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009)
65#define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A)
65#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 66#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
66 67
67typedef int __bitwise snd_device_state_t; 68typedef int __bitwise snd_device_state_t;
diff --git a/include/sound/info.h b/include/sound/info.h
index 5492cc40dc57..9ca1a493d370 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -72,7 +72,7 @@ struct snd_info_entry_ops {
72 72
73struct snd_info_entry { 73struct snd_info_entry {
74 const char *name; 74 const char *name;
75 mode_t mode; 75 umode_t mode;
76 long size; 76 long size;
77 unsigned short content; 77 unsigned short content;
78 union { 78 union {
diff --git a/include/sound/minors.h b/include/sound/minors.h
index 8f764204a856..5978f9a8c8b2 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -35,7 +35,7 @@
35#define SNDRV_MINOR_TIMER 33 /* SNDRV_MINOR_GLOBAL + 1 * 32 */ 35#define SNDRV_MINOR_TIMER 33 /* SNDRV_MINOR_GLOBAL + 1 * 32 */
36 36
37#ifndef CONFIG_SND_DYNAMIC_MINORS 37#ifndef CONFIG_SND_DYNAMIC_MINORS
38 /* 2 - 3 (reserved) */ 38#define SNDRV_MINOR_COMPRESS 2 /* 2 - 3 */
39#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 39#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
40#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 40#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
41#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ 41#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */
@@ -49,6 +49,7 @@
49#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE 49#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE
50#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 50#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
51#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 51#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
52#define SNDRV_DEVICE_TYPE_COMPRESS SNDRV_MINOR_COMPRESS
52 53
53#else /* CONFIG_SND_DYNAMIC_MINORS */ 54#else /* CONFIG_SND_DYNAMIC_MINORS */
54 55
@@ -60,6 +61,7 @@ enum {
60 SNDRV_DEVICE_TYPE_RAWMIDI, 61 SNDRV_DEVICE_TYPE_RAWMIDI,
61 SNDRV_DEVICE_TYPE_PCM_PLAYBACK, 62 SNDRV_DEVICE_TYPE_PCM_PLAYBACK,
62 SNDRV_DEVICE_TYPE_PCM_CAPTURE, 63 SNDRV_DEVICE_TYPE_PCM_CAPTURE,
64 SNDRV_DEVICE_TYPE_COMPRESS,
63}; 65};
64 66
65#endif /* CONFIG_SND_DYNAMIC_MINORS */ 67#endif /* CONFIG_SND_DYNAMIC_MINORS */
diff --git a/include/sound/saif.h b/include/sound/saif.h
index d0e0de7984ec..f22f3e16edf4 100644
--- a/include/sound/saif.h
+++ b/include/sound/saif.h
@@ -10,7 +10,7 @@
10#define __SOUND_SAIF_H__ 10#define __SOUND_SAIF_H__
11 11
12struct mxs_saif_platform_data { 12struct mxs_saif_platform_data {
13 int (*init) (void); 13 bool master_mode; /* if true use master mode */
14 int (*get_master_id) (unsigned int saif_id); 14 int master_id; /* id of the master if in slave mode */
15}; 15};
16#endif 16#endif
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 9a155f9d0a12..9b1aacaa82fe 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -78,4 +78,16 @@ struct sh_fsi_platform_info {
78 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); 78 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
79}; 79};
80 80
81/*
82 * for fsi-ak4642
83 */
84struct fsi_ak4642_info {
85 const char *name;
86 const char *card;
87 const char *cpu_dai;
88 const char *codec;
89 const char *platform;
90 int id;
91};
92
81#endif /* __SOUND_FSI_H */ 93#endif /* __SOUND_FSI_H */
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 17a4c17f19f5..d26a9b784772 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -43,6 +43,9 @@
43 .num_kcontrols = 0} 43 .num_kcontrols = 0}
44 44
45/* platform domain */ 45/* platform domain */
46#define SND_SOC_DAPM_SIGGEN(wname) \
47{ .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \
48 .num_kcontrols = 0, .reg = SND_SOC_NOPM }
46#define SND_SOC_DAPM_INPUT(wname) \ 49#define SND_SOC_DAPM_INPUT(wname) \
47{ .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \ 50{ .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \
48 .num_kcontrols = 0, .reg = SND_SOC_NOPM } 51 .num_kcontrols = 0, .reg = SND_SOC_NOPM }
@@ -380,6 +383,7 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
380 const char *pin); 383 const char *pin);
381int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 384int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
382 const char *pin); 385 const char *pin);
386void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
383 387
384/* Mostly internal - should not normally be used */ 388/* Mostly internal - should not normally be used */
385void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); 389void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
@@ -409,6 +413,7 @@ enum snd_soc_dapm_type {
409 snd_soc_dapm_supply, /* power/clock supply */ 413 snd_soc_dapm_supply, /* power/clock supply */
410 snd_soc_dapm_aif_in, /* audio interface input */ 414 snd_soc_dapm_aif_in, /* audio interface input */
411 snd_soc_dapm_aif_out, /* audio interface output */ 415 snd_soc_dapm_aif_out, /* audio interface output */
416 snd_soc_dapm_siggen, /* signal generator */
412}; 417};
413 418
414/* 419/*
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 11cfb5953e06..0992dff55959 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -231,6 +231,7 @@ enum snd_soc_bias_level {
231 SND_SOC_BIAS_ON = 3, 231 SND_SOC_BIAS_ON = 3,
232}; 232};
233 233
234struct device_node;
234struct snd_jack; 235struct snd_jack;
235struct snd_soc_card; 236struct snd_soc_card;
236struct snd_soc_pcm_stream; 237struct snd_soc_pcm_stream;
@@ -266,8 +267,6 @@ enum snd_soc_control_type {
266 267
267enum snd_soc_compress_type { 268enum snd_soc_compress_type {
268 SND_SOC_FLAT_COMPRESSION = 1, 269 SND_SOC_FLAT_COMPRESSION = 1,
269 SND_SOC_LZO_COMPRESSION,
270 SND_SOC_RBTREE_COMPRESSION
271}; 270};
272 271
273enum snd_soc_pcm_subclass { 272enum snd_soc_pcm_subclass {
@@ -318,6 +317,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
318 unsigned int reg); 317 unsigned int reg);
319int snd_soc_platform_write(struct snd_soc_platform *platform, 318int snd_soc_platform_write(struct snd_soc_platform *platform,
320 unsigned int reg, unsigned int val); 319 unsigned int reg, unsigned int val);
320int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
321 321
322/* Utility functions to get clock rates from various things */ 322/* Utility functions to get clock rates from various things */
323int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 323int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
@@ -593,8 +593,7 @@ struct snd_soc_codec_driver {
593 /* driver ops */ 593 /* driver ops */
594 int (*probe)(struct snd_soc_codec *); 594 int (*probe)(struct snd_soc_codec *);
595 int (*remove)(struct snd_soc_codec *); 595 int (*remove)(struct snd_soc_codec *);
596 int (*suspend)(struct snd_soc_codec *, 596 int (*suspend)(struct snd_soc_codec *);
597 pm_message_t state);
598 int (*resume)(struct snd_soc_codec *); 597 int (*resume)(struct snd_soc_codec *);
599 598
600 /* Default control and setup, added after probe() is run */ 599 /* Default control and setup, added after probe() is run */
@@ -706,8 +705,11 @@ struct snd_soc_dai_link {
706 const char *name; /* Codec name */ 705 const char *name; /* Codec name */
707 const char *stream_name; /* Stream name */ 706 const char *stream_name; /* Stream name */
708 const char *codec_name; /* for multi-codec */ 707 const char *codec_name; /* for multi-codec */
708 const struct device_node *codec_of_node;
709 const char *platform_name; /* for multi-platform */ 709 const char *platform_name; /* for multi-platform */
710 const struct device_node *platform_of_node;
710 const char *cpu_dai_name; 711 const char *cpu_dai_name;
712 const struct device_node *cpu_dai_of_node;
711 const char *codec_dai_name; 713 const char *codec_dai_name;
712 714
713 unsigned int dai_fmt; /* format to set on init */ 715 unsigned int dai_fmt; /* format to set on init */
@@ -718,6 +720,9 @@ struct snd_soc_dai_link {
718 /* Symmetry requirements */ 720 /* Symmetry requirements */
719 unsigned int symmetric_rates:1; 721 unsigned int symmetric_rates:1;
720 722
723 /* pmdown_time is ignored at stop */
724 unsigned int ignore_pmdown_time:1;
725
721 /* codec/machine specific init - e.g. add machine controls */ 726 /* codec/machine specific init - e.g. add machine controls */
722 int (*init)(struct snd_soc_pcm_runtime *rtd); 727 int (*init)(struct snd_soc_pcm_runtime *rtd);
723 728
@@ -813,6 +818,7 @@ struct snd_soc_card {
813 int num_dapm_widgets; 818 int num_dapm_widgets;
814 const struct snd_soc_dapm_route *dapm_routes; 819 const struct snd_soc_dapm_route *dapm_routes;
815 int num_dapm_routes; 820 int num_dapm_routes;
821 bool fully_routed;
816 822
817 struct work_struct deferred_resume_work; 823 struct work_struct deferred_resume_work;
818 824
@@ -840,8 +846,8 @@ struct snd_soc_card {
840}; 846};
841 847
842/* SoC machine DAI configuration, glues a codec and cpu DAI together */ 848/* SoC machine DAI configuration, glues a codec and cpu DAI together */
843struct snd_soc_pcm_runtime { 849struct snd_soc_pcm_runtime {
844 struct device dev; 850 struct device *dev;
845 struct snd_soc_card *card; 851 struct snd_soc_card *card;
846 struct snd_soc_dai_link *dai_link; 852 struct snd_soc_dai_link *dai_link;
847 struct mutex pcm_mutex; 853 struct mutex pcm_mutex;
@@ -927,12 +933,12 @@ static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platfo
927static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 933static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
928 void *data) 934 void *data)
929{ 935{
930 dev_set_drvdata(&rtd->dev, data); 936 dev_set_drvdata(rtd->dev, data);
931} 937}
932 938
933static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) 939static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
934{ 940{
935 return dev_get_drvdata(&rtd->dev); 941 return dev_get_drvdata(rtd->dev);
936} 942}
937 943
938static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 944static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
@@ -960,6 +966,11 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
960int snd_soc_util_init(void); 966int snd_soc_util_init(void);
961void snd_soc_util_exit(void); 967void snd_soc_util_exit(void);
962 968
969int snd_soc_of_parse_card_name(struct snd_soc_card *card,
970 const char *propname);
971int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
972 const char *propname);
973
963#include <sound/soc-dai.h> 974#include <sound/soc-dai.h>
964 975
965#ifdef CONFIG_DEBUG_FS 976#ifdef CONFIG_DEBUG_FS
diff --git a/include/sound/sta32x.h b/include/sound/sta32x.h
new file mode 100644
index 000000000000..8d93b0357a14
--- /dev/null
+++ b/include/sound/sta32x.h
@@ -0,0 +1,35 @@
1/*
2 * Platform data for ST STA32x ASoC codec driver.
3 *
4 * Copyright: 2011 Raumfeld GmbH
5 * Author: Johannes Stezenbach <js@sig21.net>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#ifndef __LINUX_SND__STA32X_H
13#define __LINUX_SND__STA32X_H
14
15#define STA32X_OCFG_2CH 0
16#define STA32X_OCFG_2_1CH 1
17#define STA32X_OCFG_1CH 3
18
19#define STA32X_OM_CH1 0
20#define STA32X_OM_CH2 1
21#define STA32X_OM_CH3 2
22
23#define STA32X_THERMAL_ADJUSTMENT_ENABLE 1
24#define STA32X_THERMAL_RECOVERY_ENABLE 2
25
26struct sta32x_platform_data {
27 int output_conf;
28 int ch1_output_mapping;
29 int ch2_output_mapping;
30 int ch3_output_mapping;
31 int thermal_conf;
32 int needs_esd_watchdog;
33};
34
35#endif /* __LINUX_SND__STA32X_H */
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h
index cf7ccb76a8de..b310c5a3a958 100644
--- a/include/sound/wm8903.h
+++ b/include/sound/wm8903.h
@@ -11,8 +11,11 @@
11#ifndef __LINUX_SND_WM8903_H 11#ifndef __LINUX_SND_WM8903_H
12#define __LINUX_SND_WM8903_H 12#define __LINUX_SND_WM8903_H
13 13
14/* Used to enable configuration of a GPIO to all zeros */ 14/*
15#define WM8903_GPIO_NO_CONFIG 0x8000 15 * Used to enable configuration of a GPIO to all zeros; a gpio_cfg value of
16 * zero in platform data means "don't touch this pin".
17 */
18#define WM8903_GPIO_CONFIG_ZERO 0x8000
16 19
17/* 20/*
18 * R6 (0x06) - Mic Bias Control 0 21 * R6 (0x06) - Mic Bias Control 0
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 748ff7cbe555..319538bf17d2 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -573,9 +573,9 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
573); 573);
574 574
575TRACE_EVENT(ext4_mb_release_group_pa, 575TRACE_EVENT(ext4_mb_release_group_pa,
576 TP_PROTO(struct ext4_prealloc_space *pa), 576 TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa),
577 577
578 TP_ARGS(pa), 578 TP_ARGS(sb, pa),
579 579
580 TP_STRUCT__entry( 580 TP_STRUCT__entry(
581 __field( dev_t, dev ) 581 __field( dev_t, dev )
@@ -585,7 +585,7 @@ TRACE_EVENT(ext4_mb_release_group_pa,
585 ), 585 ),
586 586
587 TP_fast_assign( 587 TP_fast_assign(
588 __entry->dev = pa->pa_inode->i_sb->s_dev; 588 __entry->dev = sb->s_dev;
589 __entry->pa_pstart = pa->pa_pstart; 589 __entry->pa_pstart = pa->pa_pstart;
590 __entry->pa_len = pa->pa_len; 590 __entry->pa_len = pa->pa_len;
591 ), 591 ),
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index a9c87ad8331c..5f889f16b0c8 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -147,7 +147,7 @@ DEFINE_EVENT(kmem_free, kmem_cache_free,
147 TP_ARGS(call_site, ptr) 147 TP_ARGS(call_site, ptr)
148); 148);
149 149
150TRACE_EVENT(mm_page_free_direct, 150TRACE_EVENT(mm_page_free,
151 151
152 TP_PROTO(struct page *page, unsigned int order), 152 TP_PROTO(struct page *page, unsigned int order),
153 153
@@ -169,7 +169,7 @@ TRACE_EVENT(mm_page_free_direct,
169 __entry->order) 169 __entry->order)
170); 170);
171 171
172TRACE_EVENT(mm_pagevec_free, 172TRACE_EVENT(mm_page_free_batched,
173 173
174 TP_PROTO(struct page *page, int cold), 174 TP_PROTO(struct page *page, int cold),
175 175
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
new file mode 100644
index 000000000000..dd4ba3b92002
--- /dev/null
+++ b/include/trace/events/oom.h
@@ -0,0 +1,33 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM oom
3
4#if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_OOM_H
6#include <linux/tracepoint.h>
7
8TRACE_EVENT(oom_score_adj_update,
9
10 TP_PROTO(struct task_struct *task),
11
12 TP_ARGS(task),
13
14 TP_STRUCT__entry(
15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN )
17 __field( int, oom_score_adj)
18 ),
19
20 TP_fast_assign(
21 __entry->pid = task->pid;
22 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
23 __entry->oom_score_adj = task->signal->oom_score_adj;
24 ),
25
26 TP_printk("pid=%d comm=%s oom_score_adj=%d",
27 __entry->pid, __entry->comm, __entry->oom_score_adj)
28);
29
30#endif
31
32/* This part must be outside protection */
33#include <trace/define_trace.h>
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 669fbd62ec25..d2d88bed891b 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -241,24 +241,73 @@ TRACE_EVENT(rcu_fqs,
241 241
242/* 242/*
243 * Tracepoint for dyntick-idle entry/exit events. These take a string 243 * Tracepoint for dyntick-idle entry/exit events. These take a string
244 * as argument: "Start" for entering dyntick-idle mode and "End" for 244 * as argument: "Start" for entering dyntick-idle mode, "End" for
245 * leaving it. 245 * leaving it, "--=" for events moving towards idle, and "++=" for events
246 * moving away from idle. "Error on entry: not idle task" and "Error on
247 * exit: not idle task" indicate that a non-idle task is erroneously
248 * toying with the idle loop.
249 *
250 * These events also take a pair of numbers, which indicate the nesting
251 * depth before and after the event of interest. Note that task-related
252 * events use the upper bits of each number, while interrupt-related
253 * events use the lower bits.
246 */ 254 */
247TRACE_EVENT(rcu_dyntick, 255TRACE_EVENT(rcu_dyntick,
248 256
249 TP_PROTO(char *polarity), 257 TP_PROTO(char *polarity, long long oldnesting, long long newnesting),
250 258
251 TP_ARGS(polarity), 259 TP_ARGS(polarity, oldnesting, newnesting),
252 260
253 TP_STRUCT__entry( 261 TP_STRUCT__entry(
254 __field(char *, polarity) 262 __field(char *, polarity)
263 __field(long long, oldnesting)
264 __field(long long, newnesting)
255 ), 265 ),
256 266
257 TP_fast_assign( 267 TP_fast_assign(
258 __entry->polarity = polarity; 268 __entry->polarity = polarity;
269 __entry->oldnesting = oldnesting;
270 __entry->newnesting = newnesting;
271 ),
272
273 TP_printk("%s %llx %llx", __entry->polarity,
274 __entry->oldnesting, __entry->newnesting)
275);
276
277/*
278 * Tracepoint for RCU preparation for idle, the goal being to get RCU
279 * processing done so that the current CPU can shut off its scheduling
280 * clock and enter dyntick-idle mode. One way to accomplish this is
281 * to drain all RCU callbacks from this CPU, and the other is to have
282 * done everything RCU requires for the current grace period. In this
283 * latter case, the CPU will be awakened at the end of the current grace
284 * period in order to process the remainder of its callbacks.
285 *
286 * These tracepoints take a string as argument:
287 *
288 * "No callbacks": Nothing to do, no callbacks on this CPU.
289 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
290 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
291 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
292 * "More callbacks": Still more callbacks, try again to clear them out.
293 * "Callbacks drained": All callbacks processed, off to dyntick idle!
294 * "Timer": Timer fired to cause CPU to continue processing callbacks.
295 */
296TRACE_EVENT(rcu_prep_idle,
297
298 TP_PROTO(char *reason),
299
300 TP_ARGS(reason),
301
302 TP_STRUCT__entry(
303 __field(char *, reason)
304 ),
305
306 TP_fast_assign(
307 __entry->reason = reason;
259 ), 308 ),
260 309
261 TP_printk("%s", __entry->polarity) 310 TP_printk("%s", __entry->reason)
262); 311);
263 312
264/* 313/*
@@ -412,27 +461,71 @@ TRACE_EVENT(rcu_invoke_kfree_callback,
412 461
413/* 462/*
414 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been 463 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
415 * invoked. The first argument is the name of the RCU flavor and 464 * invoked. The first argument is the name of the RCU flavor,
416 * the second argument is number of callbacks actually invoked. 465 * the second argument is number of callbacks actually invoked,
466 * the third argument (cb) is whether or not any of the callbacks that
467 * were ready to invoke at the beginning of this batch are still
468 * queued, the fourth argument (nr) is the return value of need_resched(),
469 * the fifth argument (iit) is 1 if the current task is the idle task,
470 * and the sixth argument (risk) is the return value from
471 * rcu_is_callbacks_kthread().
417 */ 472 */
418TRACE_EVENT(rcu_batch_end, 473TRACE_EVENT(rcu_batch_end,
419 474
420 TP_PROTO(char *rcuname, int callbacks_invoked), 475 TP_PROTO(char *rcuname, int callbacks_invoked,
476 bool cb, bool nr, bool iit, bool risk),
421 477
422 TP_ARGS(rcuname, callbacks_invoked), 478 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
423 479
424 TP_STRUCT__entry( 480 TP_STRUCT__entry(
425 __field(char *, rcuname) 481 __field(char *, rcuname)
426 __field(int, callbacks_invoked) 482 __field(int, callbacks_invoked)
483 __field(bool, cb)
484 __field(bool, nr)
485 __field(bool, iit)
486 __field(bool, risk)
427 ), 487 ),
428 488
429 TP_fast_assign( 489 TP_fast_assign(
430 __entry->rcuname = rcuname; 490 __entry->rcuname = rcuname;
431 __entry->callbacks_invoked = callbacks_invoked; 491 __entry->callbacks_invoked = callbacks_invoked;
492 __entry->cb = cb;
493 __entry->nr = nr;
494 __entry->iit = iit;
495 __entry->risk = risk;
496 ),
497
498 TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
499 __entry->rcuname, __entry->callbacks_invoked,
500 __entry->cb ? 'C' : '.',
501 __entry->nr ? 'S' : '.',
502 __entry->iit ? 'I' : '.',
503 __entry->risk ? 'R' : '.')
504);
505
506/*
507 * Tracepoint for rcutorture readers. The first argument is the name
508 * of the RCU flavor from rcutorture's viewpoint and the second argument
509 * is the callback address.
510 */
511TRACE_EVENT(rcu_torture_read,
512
513 TP_PROTO(char *rcutorturename, struct rcu_head *rhp),
514
515 TP_ARGS(rcutorturename, rhp),
516
517 TP_STRUCT__entry(
518 __field(char *, rcutorturename)
519 __field(struct rcu_head *, rhp)
520 ),
521
522 TP_fast_assign(
523 __entry->rcutorturename = rcutorturename;
524 __entry->rhp = rhp;
432 ), 525 ),
433 526
434 TP_printk("%s CBs-invoked=%d", 527 TP_printk("%s torture read %p",
435 __entry->rcuname, __entry->callbacks_invoked) 528 __entry->rcutorturename, __entry->rhp)
436); 529);
437 530
438#else /* #ifdef CONFIG_RCU_TRACE */ 531#else /* #ifdef CONFIG_RCU_TRACE */
@@ -443,13 +536,16 @@ TRACE_EVENT(rcu_batch_end,
443#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) 536#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
444#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks) do { } while (0) 537#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks) do { } while (0)
445#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0) 538#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
446#define trace_rcu_dyntick(polarity) do { } while (0) 539#define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
540#define trace_rcu_prep_idle(reason) do { } while (0)
447#define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0) 541#define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0)
448#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0) 542#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0)
449#define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0) 543#define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0)
450#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0) 544#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
451#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) 545#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
452#define trace_rcu_batch_end(rcuname, callbacks_invoked) do { } while (0) 546#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
547 do { } while (0)
548#define trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)
453 549
454#endif /* #else #ifdef CONFIG_RCU_TRACE */ 550#endif /* #else #ifdef CONFIG_RCU_TRACE */
455 551
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index 1e3193b8fcc8..12fbf43524e9 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -55,6 +55,15 @@ DEFINE_EVENT(regmap_reg, regmap_reg_read,
55 55
56); 56);
57 57
58DEFINE_EVENT(regmap_reg, regmap_reg_read_cache,
59
60 TP_PROTO(struct device *dev, unsigned int reg,
61 unsigned int val),
62
63 TP_ARGS(dev, reg, val)
64
65);
66
58DECLARE_EVENT_CLASS(regmap_block, 67DECLARE_EVENT_CLASS(regmap_block,
59 68
60 TP_PROTO(struct device *dev, unsigned int reg, int count), 69 TP_PROTO(struct device *dev, unsigned int reg, int count),
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 959ff18b63b6..6ba596b07a72 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -331,6 +331,13 @@ DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
331 TP_ARGS(tsk, delay)); 331 TP_ARGS(tsk, delay));
332 332
333/* 333/*
334 * Tracepoint for accounting blocked time (time the task is in uninterruptible).
335 */
336DEFINE_EVENT(sched_stat_template, sched_stat_blocked,
337 TP_PROTO(struct task_struct *tsk, u64 delay),
338 TP_ARGS(tsk, delay));
339
340/*
334 * Tracepoint for accounting runtime (time the task is executing 341 * Tracepoint for accounting runtime (time the task is executing
335 * on a CPU). 342 * on a CPU).
336 */ 343 */
@@ -363,6 +370,56 @@ TRACE_EVENT(sched_stat_runtime,
363 (unsigned long long)__entry->vruntime) 370 (unsigned long long)__entry->vruntime)
364); 371);
365 372
373#ifdef CREATE_TRACE_POINTS
374static inline u64 trace_get_sleeptime(struct task_struct *tsk)
375{
376#ifdef CONFIG_SCHEDSTATS
377 u64 block, sleep;
378
379 block = tsk->se.statistics.block_start;
380 sleep = tsk->se.statistics.sleep_start;
381 tsk->se.statistics.block_start = 0;
382 tsk->se.statistics.sleep_start = 0;
383
384 return block ? block : sleep ? sleep : 0;
385#else
386 return 0;
387#endif
388}
389#endif
390
391/*
392 * Tracepoint for accounting sleeptime (time the task is sleeping
393 * or waiting for I/O).
394 */
395TRACE_EVENT(sched_stat_sleeptime,
396
397 TP_PROTO(struct task_struct *tsk, u64 now),
398
399 TP_ARGS(tsk, now),
400
401 TP_STRUCT__entry(
402 __array( char, comm, TASK_COMM_LEN )
403 __field( pid_t, pid )
404 __field( u64, sleeptime )
405 ),
406
407 TP_fast_assign(
408 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
409 __entry->pid = tsk->pid;
410 __entry->sleeptime = trace_get_sleeptime(tsk);
411 __entry->sleeptime = __entry->sleeptime ?
412 now - __entry->sleeptime : 0;
413 )
414 TP_perf_assign(
415 __perf_count(__entry->sleeptime);
416 ),
417
418 TP_printk("comm=%s pid=%d sleeptime=%Lu [ns]",
419 __entry->comm, __entry->pid,
420 (unsigned long long)__entry->sleeptime)
421);
422
366/* 423/*
367 * Tracepoint for showing priority inheritance modifying a tasks 424 * Tracepoint for showing priority inheritance modifying a tasks
368 * priority. 425 * priority.
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
new file mode 100644
index 000000000000..b53add02e929
--- /dev/null
+++ b/include/trace/events/task.h
@@ -0,0 +1,61 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM task
3
4#if !defined(_TRACE_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TASK_H
6#include <linux/tracepoint.h>
7
8TRACE_EVENT(task_newtask,
9
10 TP_PROTO(struct task_struct *task, unsigned long clone_flags),
11
12 TP_ARGS(task, clone_flags),
13
14 TP_STRUCT__entry(
15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN)
17 __field( unsigned long, clone_flags)
18 __field( int, oom_score_adj)
19 ),
20
21 TP_fast_assign(
22 __entry->pid = task->pid;
23 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
24 __entry->clone_flags = clone_flags;
25 __entry->oom_score_adj = task->signal->oom_score_adj;
26 ),
27
28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%d",
29 __entry->pid, __entry->comm,
30 __entry->clone_flags, __entry->oom_score_adj)
31);
32
33TRACE_EVENT(task_rename,
34
35 TP_PROTO(struct task_struct *task, char *comm),
36
37 TP_ARGS(task, comm),
38
39 TP_STRUCT__entry(
40 __field( pid_t, pid)
41 __array( char, oldcomm, TASK_COMM_LEN)
42 __array( char, newcomm, TASK_COMM_LEN)
43 __field( int, oom_score_adj)
44 ),
45
46 TP_fast_assign(
47 __entry->pid = task->pid;
48 memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
49 memcpy(entry->newcomm, comm, TASK_COMM_LEN);
50 __entry->oom_score_adj = task->signal->oom_score_adj;
51 ),
52
53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%d",
54 __entry->pid, __entry->oldcomm,
55 __entry->newcomm, __entry->oom_score_adj)
56);
57
58#endif
59
60/* This part must be outside protection */
61#include <trace/define_trace.h>
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index edc4b3d25a2d..f64560e204bc 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -266,9 +266,10 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
266 unsigned long nr_lumpy_taken, 266 unsigned long nr_lumpy_taken,
267 unsigned long nr_lumpy_dirty, 267 unsigned long nr_lumpy_dirty,
268 unsigned long nr_lumpy_failed, 268 unsigned long nr_lumpy_failed,
269 isolate_mode_t isolate_mode), 269 isolate_mode_t isolate_mode,
270 int file),
270 271
271 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode), 272 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode, file),
272 273
273 TP_STRUCT__entry( 274 TP_STRUCT__entry(
274 __field(int, order) 275 __field(int, order)
@@ -279,6 +280,7 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
279 __field(unsigned long, nr_lumpy_dirty) 280 __field(unsigned long, nr_lumpy_dirty)
280 __field(unsigned long, nr_lumpy_failed) 281 __field(unsigned long, nr_lumpy_failed)
281 __field(isolate_mode_t, isolate_mode) 282 __field(isolate_mode_t, isolate_mode)
283 __field(int, file)
282 ), 284 ),
283 285
284 TP_fast_assign( 286 TP_fast_assign(
@@ -290,9 +292,10 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
290 __entry->nr_lumpy_dirty = nr_lumpy_dirty; 292 __entry->nr_lumpy_dirty = nr_lumpy_dirty;
291 __entry->nr_lumpy_failed = nr_lumpy_failed; 293 __entry->nr_lumpy_failed = nr_lumpy_failed;
292 __entry->isolate_mode = isolate_mode; 294 __entry->isolate_mode = isolate_mode;
295 __entry->file = file;
293 ), 296 ),
294 297
295 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu", 298 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu file=%d",
296 __entry->isolate_mode, 299 __entry->isolate_mode,
297 __entry->order, 300 __entry->order,
298 __entry->nr_requested, 301 __entry->nr_requested,
@@ -300,7 +303,8 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
300 __entry->nr_taken, 303 __entry->nr_taken,
301 __entry->nr_lumpy_taken, 304 __entry->nr_lumpy_taken,
302 __entry->nr_lumpy_dirty, 305 __entry->nr_lumpy_dirty,
303 __entry->nr_lumpy_failed) 306 __entry->nr_lumpy_failed,
307 __entry->file)
304); 308);
305 309
306DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, 310DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
@@ -312,9 +316,10 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
312 unsigned long nr_lumpy_taken, 316 unsigned long nr_lumpy_taken,
313 unsigned long nr_lumpy_dirty, 317 unsigned long nr_lumpy_dirty,
314 unsigned long nr_lumpy_failed, 318 unsigned long nr_lumpy_failed,
315 isolate_mode_t isolate_mode), 319 isolate_mode_t isolate_mode,
320 int file),
316 321
317 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode) 322 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode, file)
318 323
319); 324);
320 325
@@ -327,9 +332,10 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate,
327 unsigned long nr_lumpy_taken, 332 unsigned long nr_lumpy_taken,
328 unsigned long nr_lumpy_dirty, 333 unsigned long nr_lumpy_dirty,
329 unsigned long nr_lumpy_failed, 334 unsigned long nr_lumpy_failed,
330 isolate_mode_t isolate_mode), 335 isolate_mode_t isolate_mode,
336 int file),
331 337
332 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode) 338 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode, file)
333 339
334); 340);
335 341
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index b99caa8b780c..8588a8918023 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -21,6 +21,16 @@
21 {I_REFERENCED, "I_REFERENCED"} \ 21 {I_REFERENCED, "I_REFERENCED"} \
22 ) 22 )
23 23
24#define WB_WORK_REASON \
25 {WB_REASON_BACKGROUND, "background"}, \
26 {WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \
27 {WB_REASON_SYNC, "sync"}, \
28 {WB_REASON_PERIODIC, "periodic"}, \
29 {WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \
30 {WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \
31 {WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \
32 {WB_REASON_FORKER_THREAD, "forker_thread"}
33
24struct wb_writeback_work; 34struct wb_writeback_work;
25 35
26DECLARE_EVENT_CLASS(writeback_work_class, 36DECLARE_EVENT_CLASS(writeback_work_class,
@@ -55,7 +65,7 @@ DECLARE_EVENT_CLASS(writeback_work_class,
55 __entry->for_kupdate, 65 __entry->for_kupdate,
56 __entry->range_cyclic, 66 __entry->range_cyclic,
57 __entry->for_background, 67 __entry->for_background,
58 wb_reason_name[__entry->reason] 68 __print_symbolic(__entry->reason, WB_WORK_REASON)
59 ) 69 )
60); 70);
61#define DEFINE_WRITEBACK_WORK_EVENT(name) \ 71#define DEFINE_WRITEBACK_WORK_EVENT(name) \
@@ -184,7 +194,8 @@ TRACE_EVENT(writeback_queue_io,
184 __entry->older, /* older_than_this in jiffies */ 194 __entry->older, /* older_than_this in jiffies */
185 __entry->age, /* older_than_this in relative milliseconds */ 195 __entry->age, /* older_than_this in relative milliseconds */
186 __entry->moved, 196 __entry->moved,
187 wb_reason_name[__entry->reason]) 197 __print_symbolic(__entry->reason, WB_WORK_REASON)
198 )
188); 199);
189 200
190TRACE_EVENT(global_dirty_state, 201TRACE_EVENT(global_dirty_state,
@@ -289,12 +300,13 @@ TRACE_EVENT(balance_dirty_pages,
289 unsigned long dirty_ratelimit, 300 unsigned long dirty_ratelimit,
290 unsigned long task_ratelimit, 301 unsigned long task_ratelimit,
291 unsigned long dirtied, 302 unsigned long dirtied,
303 unsigned long period,
292 long pause, 304 long pause,
293 unsigned long start_time), 305 unsigned long start_time),
294 306
295 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, 307 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
296 dirty_ratelimit, task_ratelimit, 308 dirty_ratelimit, task_ratelimit,
297 dirtied, pause, start_time), 309 dirtied, period, pause, start_time),
298 310
299 TP_STRUCT__entry( 311 TP_STRUCT__entry(
300 __array( char, bdi, 32) 312 __array( char, bdi, 32)
@@ -309,6 +321,8 @@ TRACE_EVENT(balance_dirty_pages,
309 __field(unsigned int, dirtied_pause) 321 __field(unsigned int, dirtied_pause)
310 __field(unsigned long, paused) 322 __field(unsigned long, paused)
311 __field( long, pause) 323 __field( long, pause)
324 __field(unsigned long, period)
325 __field( long, think)
312 ), 326 ),
313 327
314 TP_fast_assign( 328 TP_fast_assign(
@@ -325,6 +339,9 @@ TRACE_EVENT(balance_dirty_pages,
325 __entry->task_ratelimit = KBps(task_ratelimit); 339 __entry->task_ratelimit = KBps(task_ratelimit);
326 __entry->dirtied = dirtied; 340 __entry->dirtied = dirtied;
327 __entry->dirtied_pause = current->nr_dirtied_pause; 341 __entry->dirtied_pause = current->nr_dirtied_pause;
342 __entry->think = current->dirty_paused_when == 0 ? 0 :
343 (long)(jiffies - current->dirty_paused_when) * 1000/HZ;
344 __entry->period = period * 1000 / HZ;
328 __entry->pause = pause * 1000 / HZ; 345 __entry->pause = pause * 1000 / HZ;
329 __entry->paused = (jiffies - start_time) * 1000 / HZ; 346 __entry->paused = (jiffies - start_time) * 1000 / HZ;
330 ), 347 ),
@@ -335,7 +352,7 @@ TRACE_EVENT(balance_dirty_pages,
335 "bdi_setpoint=%lu bdi_dirty=%lu " 352 "bdi_setpoint=%lu bdi_dirty=%lu "
336 "dirty_ratelimit=%lu task_ratelimit=%lu " 353 "dirty_ratelimit=%lu task_ratelimit=%lu "
337 "dirtied=%u dirtied_pause=%u " 354 "dirtied=%u dirtied_pause=%u "
338 "paused=%lu pause=%ld", 355 "paused=%lu pause=%ld period=%lu think=%ld",
339 __entry->bdi, 356 __entry->bdi,
340 __entry->limit, 357 __entry->limit,
341 __entry->setpoint, 358 __entry->setpoint,
@@ -347,7 +364,9 @@ TRACE_EVENT(balance_dirty_pages,
347 __entry->dirtied, 364 __entry->dirtied,
348 __entry->dirtied_pause, 365 __entry->dirtied_pause,
349 __entry->paused, /* ms */ 366 __entry->paused, /* ms */
350 __entry->pause /* ms */ 367 __entry->pause, /* ms */
368 __entry->period, /* ms */
369 __entry->think /* ms */
351 ) 370 )
352); 371);
353 372
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed6760b..062b3b24ff10 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -200,6 +200,10 @@ enum omap_dss_clk_source {
200 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */ 200 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
201}; 201};
202 202
203enum omap_hdmi_flags {
204 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
205};
206
203/* RFBI */ 207/* RFBI */
204 208
205struct rfbi_timings { 209struct rfbi_timings {
@@ -294,8 +298,8 @@ int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
294 u16 len); 298 u16 len);
295int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel); 299int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
296int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel); 300int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
297int dsi_video_mode_enable(struct omap_dss_device *dssdev, int channel); 301int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
298void dsi_video_mode_disable(struct omap_dss_device *dssdev, int channel); 302void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
299 303
300/* Board specific data */ 304/* Board specific data */
301struct omap_dss_board_info { 305struct omap_dss_board_info {
@@ -309,6 +313,8 @@ struct omap_dss_board_info {
309 313
310/* Init with the board info */ 314/* Init with the board info */
311extern int omap_display_init(struct omap_dss_board_info *board_data); 315extern int omap_display_init(struct omap_dss_board_info *board_data);
316/* HDMI mux init*/
317extern int omap_hdmi_init(enum omap_hdmi_flags flags);
312 318
313struct omap_display_platform_data { 319struct omap_display_platform_data {
314 struct omap_dss_board_info *board_data; 320 struct omap_dss_board_info *board_data;
@@ -352,8 +358,6 @@ struct omap_dss_cpr_coefs {
352}; 358};
353 359
354struct omap_overlay_info { 360struct omap_overlay_info {
355 bool enabled;
356
357 u32 paddr; 361 u32 paddr;
358 u32 p_uv_addr; /* for NV12 format */ 362 u32 p_uv_addr; /* for NV12 format */
359 u16 screen_width; 363 u16 screen_width;
@@ -385,11 +389,21 @@ struct omap_overlay {
385 389
386 /* dynamic fields */ 390 /* dynamic fields */
387 struct omap_overlay_manager *manager; 391 struct omap_overlay_manager *manager;
388 struct omap_overlay_info info;
389 392
390 bool manager_changed; 393 /*
391 /* if true, info has been changed, but not applied() yet */ 394 * The following functions do not block:
392 bool info_dirty; 395 *
396 * is_enabled
397 * set_overlay_info
398 * get_overlay_info
399 *
400 * The rest of the functions may block and cannot be called from
401 * interrupt context
402 */
403
404 int (*enable)(struct omap_overlay *ovl);
405 int (*disable)(struct omap_overlay *ovl);
406 bool (*is_enabled)(struct omap_overlay *ovl);
393 407
394 int (*set_manager)(struct omap_overlay *ovl, 408 int (*set_manager)(struct omap_overlay *ovl,
395 struct omap_overlay_manager *mgr); 409 struct omap_overlay_manager *mgr);
@@ -418,23 +432,27 @@ struct omap_overlay_manager_info {
418 432
419struct omap_overlay_manager { 433struct omap_overlay_manager {
420 struct kobject kobj; 434 struct kobject kobj;
421 struct list_head list;
422 435
423 /* static fields */ 436 /* static fields */
424 const char *name; 437 const char *name;
425 enum omap_channel id; 438 enum omap_channel id;
426 enum omap_overlay_manager_caps caps; 439 enum omap_overlay_manager_caps caps;
427 int num_overlays; 440 struct list_head overlays;
428 struct omap_overlay **overlays;
429 enum omap_display_type supported_displays; 441 enum omap_display_type supported_displays;
430 442
431 /* dynamic fields */ 443 /* dynamic fields */
432 struct omap_dss_device *device; 444 struct omap_dss_device *device;
433 struct omap_overlay_manager_info info;
434 445
435 bool device_changed; 446 /*
436 /* if true, info has been changed but not applied() yet */ 447 * The following functions do not block:
437 bool info_dirty; 448 *
449 * set_manager_info
450 * get_manager_info
451 * apply
452 *
453 * The rest of the functions may block and cannot be called from
454 * interrupt context
455 */
438 456
439 int (*set_device)(struct omap_overlay_manager *mgr, 457 int (*set_device)(struct omap_overlay_manager *mgr,
440 struct omap_dss_device *dssdev); 458 struct omap_dss_device *dssdev);
@@ -448,9 +466,6 @@ struct omap_overlay_manager {
448 int (*apply)(struct omap_overlay_manager *mgr); 466 int (*apply)(struct omap_overlay_manager *mgr);
449 int (*wait_for_go)(struct omap_overlay_manager *mgr); 467 int (*wait_for_go)(struct omap_overlay_manager *mgr);
450 int (*wait_for_vsync)(struct omap_overlay_manager *mgr); 468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
451
452 int (*enable)(struct omap_overlay_manager *mgr);
453 int (*disable)(struct omap_overlay_manager *mgr);
454}; 469};
455 470
456struct omap_dss_device { 471struct omap_dss_device {
@@ -662,12 +677,7 @@ void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
662 bool enable); 677 bool enable);
663int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); 678int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
664 679
665int omap_dsi_prepare_update(struct omap_dss_device *dssdev, 680int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
666 u16 *x, u16 *y, u16 *w, u16 *h,
667 bool enlarge_update_area);
668int omap_dsi_update(struct omap_dss_device *dssdev,
669 int channel,
670 u16 x, u16 y, u16 w, u16 h,
671 void (*callback)(int, void *), void *data); 681 void (*callback)(int, void *), void *data);
672int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); 682int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
673int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); 683int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 6cb95c977de9..434d56b4a1a5 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -28,14 +28,33 @@ enum sh_mipi_dsi_data_fmt {
28struct sh_mobile_lcdc_chan_cfg; 28struct sh_mobile_lcdc_chan_cfg;
29 29
30#define SH_MIPI_DSI_HSABM (1 << 0) 30#define SH_MIPI_DSI_HSABM (1 << 0)
31#define SH_MIPI_DSI_HSPBM (1 << 1) 31#define SH_MIPI_DSI_HBPBM (1 << 1)
32#define SH_MIPI_DSI_HFPBM (1 << 2)
33#define SH_MIPI_DSI_BL2E (1 << 3)
34#define SH_MIPI_DSI_VSEE (1 << 4)
35#define SH_MIPI_DSI_HSEE (1 << 5)
36#define SH_MIPI_DSI_HSAE (1 << 6)
37
38#define SH_MIPI_DSI_HSbyteCLK (1 << 24)
39#define SH_MIPI_DSI_HS6divCLK (1 << 25)
40#define SH_MIPI_DSI_HS4divCLK (1 << 26)
41
42#define SH_MIPI_DSI_SYNC_PULSES_MODE (SH_MIPI_DSI_VSEE | \
43 SH_MIPI_DSI_HSEE | \
44 SH_MIPI_DSI_HSAE)
45#define SH_MIPI_DSI_SYNC_EVENTS_MODE (0)
46#define SH_MIPI_DSI_SYNC_BURST_MODE (SH_MIPI_DSI_BL2E)
32 47
33struct sh_mipi_dsi_info { 48struct sh_mipi_dsi_info {
34 enum sh_mipi_dsi_data_fmt data_format; 49 enum sh_mipi_dsi_data_fmt data_format;
35 struct sh_mobile_lcdc_chan_cfg *lcd_chan; 50 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
51 int lane;
36 unsigned long flags; 52 unsigned long flags;
37 u32 clksrc; 53 u32 clksrc;
38 unsigned int vsynw_offset; 54 unsigned int vsynw_offset;
55 int (*set_dot_clock)(struct platform_device *pdev,
56 void __iomem *base,
57 int enable);
39}; 58};
40 59
41#endif 60#endif
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 8101b726b48a..fe30b759c51e 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -174,7 +174,8 @@ struct sh_mobile_lcdc_bl_info {
174 174
175struct sh_mobile_lcdc_chan_cfg { 175struct sh_mobile_lcdc_chan_cfg {
176 int chan; 176 int chan;
177 int bpp; 177 int fourcc;
178 int colorspace;
178 int interface_type; /* selects RGBn or SYSn I/F, see above */ 179 int interface_type; /* selects RGBn or SYSn I/F, see above */
179 int clock_divider; 180 int clock_divider;
180 unsigned long flags; /* LCDC_FLAGS_... */ 181 unsigned long flags; /* LCDC_FLAGS_... */
@@ -184,7 +185,6 @@ struct sh_mobile_lcdc_chan_cfg {
184 struct sh_mobile_lcdc_board_cfg board_cfg; 185 struct sh_mobile_lcdc_board_cfg board_cfg;
185 struct sh_mobile_lcdc_bl_info bl_info; 186 struct sh_mobile_lcdc_bl_info bl_info;
186 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 187 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
187 int nonstd;
188 struct sh_mobile_meram_cfg *meram_cfg; 188 struct sh_mobile_meram_cfg *meram_cfg;
189}; 189};
190 190
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
index d29c153705bc..cc2e1a7e44ec 100644
--- a/include/xen/balloon.h
+++ b/include/xen/balloon.h
@@ -29,11 +29,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages,
29 bool highmem); 29 bool highmem);
30void free_xenballooned_pages(int nr_pages, struct page **pages); 30void free_xenballooned_pages(int nr_pages, struct page **pages);
31 31
32struct sys_device; 32struct device;
33#ifdef CONFIG_XEN_SELFBALLOONING 33#ifdef CONFIG_XEN_SELFBALLOONING
34extern int register_xen_selfballooning(struct sys_device *sysdev); 34extern int register_xen_selfballooning(struct device *dev);
35#else 35#else
36static inline int register_xen_selfballooning(struct sys_device *sysdev) 36static inline int register_xen_selfballooning(struct device *dev)
37{ 37{
38 return -ENOSYS; 38 return -ENOSYS;
39} 39}
diff --git a/include/xen/events.h b/include/xen/events.h
index d287997d3eab..0f773708e02c 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -37,6 +37,13 @@ int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
37 */ 37 */
38void unbind_from_irqhandler(unsigned int irq, void *dev_id); 38void unbind_from_irqhandler(unsigned int irq, void *dev_id);
39 39
40/*
41 * Allow extra references to event channels exposed to userspace by evtchn
42 */
43int evtchn_make_refcounted(unsigned int evtchn);
44int evtchn_get(unsigned int evtchn);
45void evtchn_put(unsigned int evtchn);
46
40void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); 47void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
41int resend_irq_on_evtchn(unsigned int irq); 48int resend_irq_on_evtchn(unsigned int irq);
42void rebind_evtchn_irq(int evtchn, int irq); 49void rebind_evtchn_irq(int evtchn, int irq);
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 11e2dfce42f8..15f8a00ff003 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -62,6 +62,24 @@ int gnttab_resume(void);
62 62
63int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, 63int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
64 int readonly); 64 int readonly);
65int gnttab_grant_foreign_access_subpage(domid_t domid, unsigned long frame,
66 int flags, unsigned page_off,
67 unsigned length);
68int gnttab_grant_foreign_access_trans(domid_t domid, int flags,
69 domid_t trans_domid,
70 grant_ref_t trans_gref);
71
72/*
73 * Are sub-page grants available on this version of Xen? Returns true if they
74 * are, and false if they're not.
75 */
76bool gnttab_subpage_grants_available(void);
77
78/*
79 * Are transitive grants available on this version of Xen? Returns true if they
80 * are, and false if they're not.
81 */
82bool gnttab_trans_grants_available(void);
65 83
66/* 84/*
67 * End access through the given grant reference, iff the grant entry is no 85 * End access through the given grant reference, iff the grant entry is no
@@ -108,6 +126,13 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
108 126
109void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, 127void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
110 unsigned long frame, int readonly); 128 unsigned long frame, int readonly);
129int gnttab_grant_foreign_access_subpage_ref(grant_ref_t ref, domid_t domid,
130 unsigned long frame, int flags,
131 unsigned page_off,
132 unsigned length);
133int gnttab_grant_foreign_access_trans_ref(grant_ref_t ref, domid_t domid,
134 int flags, domid_t trans_domid,
135 grant_ref_t trans_gref);
111 136
112void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 137void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
113 unsigned long pfn); 138 unsigned long pfn);
@@ -145,9 +170,11 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
145 170
146int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, 171int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
147 unsigned long max_nr_gframes, 172 unsigned long max_nr_gframes,
148 struct grant_entry **__shared); 173 void **__shared);
149void arch_gnttab_unmap_shared(struct grant_entry *shared, 174int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
150 unsigned long nr_gframes); 175 unsigned long max_nr_gframes,
176 grant_status_t **__shared);
177void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);
151 178
152extern unsigned long xen_hvm_resume_frames; 179extern unsigned long xen_hvm_resume_frames;
153unsigned int gnttab_max_grant_frames(void); 180unsigned int gnttab_max_grant_frames(void);
@@ -155,9 +182,9 @@ unsigned int gnttab_max_grant_frames(void);
155#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 182#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
156 183
157int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, 184int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
158 struct gnttab_map_grant_ref *kmap_ops, 185 struct gnttab_map_grant_ref *kmap_ops,
159 struct page **pages, unsigned int count); 186 struct page **pages, unsigned int count);
160int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, 187int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
161 struct page **pages, unsigned int count); 188 struct page **pages, unsigned int count, bool clear_pte);
162 189
163#endif /* __ASM_GNTTAB_H__ */ 190#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index 39e571796e32..a17d84433e6a 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -85,12 +85,22 @@
85 */ 85 */
86 86
87/* 87/*
88 * Reference to a grant entry in a specified domain's grant table.
89 */
90typedef uint32_t grant_ref_t;
91
92/*
88 * A grant table comprises a packed array of grant entries in one or more 93 * A grant table comprises a packed array of grant entries in one or more
89 * page frames shared between Xen and a guest. 94 * page frames shared between Xen and a guest.
90 * [XEN]: This field is written by Xen and read by the sharing guest. 95 * [XEN]: This field is written by Xen and read by the sharing guest.
91 * [GST]: This field is written by the guest and read by Xen. 96 * [GST]: This field is written by the guest and read by Xen.
92 */ 97 */
93struct grant_entry { 98
99/*
100 * Version 1 of the grant table entry structure is maintained purely
101 * for backwards compatibility. New guests should use version 2.
102 */
103struct grant_entry_v1 {
94 /* GTF_xxx: various type and flag information. [XEN,GST] */ 104 /* GTF_xxx: various type and flag information. [XEN,GST] */
95 uint16_t flags; 105 uint16_t flags;
96 /* The domain being granted foreign privileges. [GST] */ 106 /* The domain being granted foreign privileges. [GST] */
@@ -108,10 +118,13 @@ struct grant_entry {
108 * GTF_permit_access: Allow @domid to map/access @frame. 118 * GTF_permit_access: Allow @domid to map/access @frame.
109 * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame 119 * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
110 * to this guest. Xen writes the page number to @frame. 120 * to this guest. Xen writes the page number to @frame.
121 * GTF_transitive: Allow @domid to transitively access a subrange of
122 * @trans_grant in @trans_domid. No mappings are allowed.
111 */ 123 */
112#define GTF_invalid (0U<<0) 124#define GTF_invalid (0U<<0)
113#define GTF_permit_access (1U<<0) 125#define GTF_permit_access (1U<<0)
114#define GTF_accept_transfer (2U<<0) 126#define GTF_accept_transfer (2U<<0)
127#define GTF_transitive (3U<<0)
115#define GTF_type_mask (3U<<0) 128#define GTF_type_mask (3U<<0)
116 129
117/* 130/*
@@ -119,6 +132,9 @@ struct grant_entry {
119 * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST] 132 * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
120 * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN] 133 * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
121 * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN] 134 * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
135 * GTF_sub_page: Grant access to only a subrange of the page. @domid
136 * will only be allowed to copy from the grant, and not
137 * map it. [GST]
122 */ 138 */
123#define _GTF_readonly (2) 139#define _GTF_readonly (2)
124#define GTF_readonly (1U<<_GTF_readonly) 140#define GTF_readonly (1U<<_GTF_readonly)
@@ -126,6 +142,8 @@ struct grant_entry {
126#define GTF_reading (1U<<_GTF_reading) 142#define GTF_reading (1U<<_GTF_reading)
127#define _GTF_writing (4) 143#define _GTF_writing (4)
128#define GTF_writing (1U<<_GTF_writing) 144#define GTF_writing (1U<<_GTF_writing)
145#define _GTF_sub_page (8)
146#define GTF_sub_page (1U<<_GTF_sub_page)
129 147
130/* 148/*
131 * Subflags for GTF_accept_transfer: 149 * Subflags for GTF_accept_transfer:
@@ -142,15 +160,81 @@ struct grant_entry {
142#define _GTF_transfer_completed (3) 160#define _GTF_transfer_completed (3)
143#define GTF_transfer_completed (1U<<_GTF_transfer_completed) 161#define GTF_transfer_completed (1U<<_GTF_transfer_completed)
144 162
163/*
164 * Version 2 grant table entries. These fulfil the same role as
165 * version 1 entries, but can represent more complicated operations.
166 * Any given domain will have either a version 1 or a version 2 table,
167 * and every entry in the table will be the same version.
168 *
169 * The interface by which domains use grant references does not depend
170 * on the grant table version in use by the other domain.
171 */
145 172
146/*********************************** 173/*
147 * GRANT TABLE QUERIES AND USES 174 * Version 1 and version 2 grant entries share a common prefix. The
175 * fields of the prefix are documented as part of struct
176 * grant_entry_v1.
148 */ 177 */
178struct grant_entry_header {
179 uint16_t flags;
180 domid_t domid;
181};
149 182
150/* 183/*
151 * Reference to a grant entry in a specified domain's grant table. 184 * Version 2 of the grant entry structure, here is an union because three
185 * different types are suppotted: full_page, sub_page and transitive.
186 */
187union grant_entry_v2 {
188 struct grant_entry_header hdr;
189
190 /*
191 * This member is used for V1-style full page grants, where either:
192 *
193 * -- hdr.type is GTF_accept_transfer, or
194 * -- hdr.type is GTF_permit_access and GTF_sub_page is not set.
195 *
196 * In that case, the frame field has the same semantics as the
197 * field of the same name in the V1 entry structure.
198 */
199 struct {
200 struct grant_entry_header hdr;
201 uint32_t pad0;
202 uint64_t frame;
203 } full_page;
204
205 /*
206 * If the grant type is GTF_grant_access and GTF_sub_page is set,
207 * @domid is allowed to access bytes [@page_off,@page_off+@length)
208 * in frame @frame.
209 */
210 struct {
211 struct grant_entry_header hdr;
212 uint16_t page_off;
213 uint16_t length;
214 uint64_t frame;
215 } sub_page;
216
217 /*
218 * If the grant is GTF_transitive, @domid is allowed to use the
219 * grant @gref in domain @trans_domid, as if it was the local
220 * domain. Obviously, the transitive access must be compatible
221 * with the original grant.
222 */
223 struct {
224 struct grant_entry_header hdr;
225 domid_t trans_domid;
226 uint16_t pad0;
227 grant_ref_t gref;
228 } transitive;
229
230 uint32_t __spacer[4]; /* Pad to a power of two */
231};
232
233typedef uint16_t grant_status_t;
234
235/***********************************
236 * GRANT TABLE QUERIES AND USES
152 */ 237 */
153typedef uint32_t grant_ref_t;
154 238
155/* 239/*
156 * Handle to track a mapping created via a grant reference. 240 * Handle to track a mapping created via a grant reference.
@@ -322,6 +406,79 @@ struct gnttab_query_size {
322DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size); 406DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size);
323 407
324/* 408/*
409 * GNTTABOP_unmap_and_replace: Destroy one or more grant-reference mappings
410 * tracked by <handle> but atomically replace the page table entry with one
411 * pointing to the machine address under <new_addr>. <new_addr> will be
412 * redirected to the null entry.
413 * NOTES:
414 * 1. The call may fail in an undefined manner if either mapping is not
415 * tracked by <handle>.
416 * 2. After executing a batch of unmaps, it is guaranteed that no stale
417 * mappings will remain in the device or host TLBs.
418 */
419#define GNTTABOP_unmap_and_replace 7
420struct gnttab_unmap_and_replace {
421 /* IN parameters. */
422 uint64_t host_addr;
423 uint64_t new_addr;
424 grant_handle_t handle;
425 /* OUT parameters. */
426 int16_t status; /* GNTST_* */
427};
428DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_and_replace);
429
430/*
431 * GNTTABOP_set_version: Request a particular version of the grant
432 * table shared table structure. This operation can only be performed
433 * once in any given domain. It must be performed before any grants
434 * are activated; otherwise, the domain will be stuck with version 1.
435 * The only defined versions are 1 and 2.
436 */
437#define GNTTABOP_set_version 8
438struct gnttab_set_version {
439 /* IN parameters */
440 uint32_t version;
441};
442DEFINE_GUEST_HANDLE_STRUCT(gnttab_set_version);
443
444/*
445 * GNTTABOP_get_status_frames: Get the list of frames used to store grant
446 * status for <dom>. In grant format version 2, the status is separated
447 * from the other shared grant fields to allow more efficient synchronization
448 * using barriers instead of atomic cmpexch operations.
449 * <nr_frames> specify the size of vector <frame_list>.
450 * The frame addresses are returned in the <frame_list>.
451 * Only <nr_frames> addresses are returned, even if the table is larger.
452 * NOTES:
453 * 1. <dom> may be specified as DOMID_SELF.
454 * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
455 */
456#define GNTTABOP_get_status_frames 9
457struct gnttab_get_status_frames {
458 /* IN parameters. */
459 uint32_t nr_frames;
460 domid_t dom;
461 /* OUT parameters. */
462 int16_t status; /* GNTST_* */
463 GUEST_HANDLE(uint64_t) frame_list;
464};
465DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_status_frames);
466
467/*
468 * GNTTABOP_get_version: Get the grant table version which is in
469 * effect for domain <dom>.
470 */
471#define GNTTABOP_get_version 10
472struct gnttab_get_version {
473 /* IN parameters */
474 domid_t dom;
475 uint16_t pad;
476 /* OUT parameters */
477 uint32_t version;
478};
479DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
480
481/*
325 * Bitfield values for update_pin_status.flags. 482 * Bitfield values for update_pin_status.flags.
326 */ 483 */
327 /* Map the grant entry for access by I/O devices. */ 484 /* Map the grant entry for access by I/O devices. */
diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h
index f0b6890370be..7cdfca24eafb 100644
--- a/include/xen/interface/io/xs_wire.h
+++ b/include/xen/interface/io/xs_wire.h
@@ -29,8 +29,7 @@ enum xsd_sockmsg_type
29 XS_IS_DOMAIN_INTRODUCED, 29 XS_IS_DOMAIN_INTRODUCED,
30 XS_RESUME, 30 XS_RESUME,
31 XS_SET_TARGET, 31 XS_SET_TARGET,
32 XS_RESTRICT, 32 XS_RESTRICT
33 XS_RESET_WATCHES
34}; 33};
35 34
36#define XS_WRITE_NONE "NONE" 35#define XS_WRITE_NONE "NONE"
@@ -88,4 +87,7 @@ struct xenstore_domain_interface {
88 XENSTORE_RING_IDX rsp_cons, rsp_prod; 87 XENSTORE_RING_IDX rsp_cons, rsp_prod;
89}; 88};
90 89
90/* Violating this is very bad. See docs/misc/xenstore.txt. */
91#define XENSTORE_PAYLOAD_MAX 4096
92
91#endif /* _XS_WIRE_H */ 93#endif /* _XS_WIRE_H */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 6a6e91449347..a890804945e3 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -523,6 +523,8 @@ struct tmem_op {
523 } u; 523 } u;
524}; 524};
525 525
526DEFINE_GUEST_HANDLE(u64);
527
526#else /* __ASSEMBLY__ */ 528#else /* __ASSEMBLY__ */
527 529
528/* In assembly code we cannot use C numeric constant suffixes. */ 530/* In assembly code we cannot use C numeric constant suffixes. */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b1b6676c1c43..e8c599b237c2 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -85,8 +85,6 @@ struct xenbus_device_id
85 85
86/* A xenbus driver. */ 86/* A xenbus driver. */
87struct xenbus_driver { 87struct xenbus_driver {
88 char *name;
89 struct module *owner;
90 const struct xenbus_device_id *ids; 88 const struct xenbus_device_id *ids;
91 int (*probe)(struct xenbus_device *dev, 89 int (*probe)(struct xenbus_device *dev,
92 const struct xenbus_device_id *id); 90 const struct xenbus_device_id *id);
@@ -101,31 +99,20 @@ struct xenbus_driver {
101 int (*is_ready)(struct xenbus_device *dev); 99 int (*is_ready)(struct xenbus_device *dev);
102}; 100};
103 101
104static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) 102#define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \
105{ 103struct xenbus_driver var ## _driver = { \
106 return container_of(drv, struct xenbus_driver, driver); 104 .driver.name = drvname + 0 ?: var ## _ids->devicetype, \
105 .driver.owner = THIS_MODULE, \
106 .ids = var ## _ids, ## methods \
107} 107}
108 108
109int __must_check __xenbus_register_frontend(struct xenbus_driver *drv, 109static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
110 struct module *owner,
111 const char *mod_name);
112
113static inline int __must_check
114xenbus_register_frontend(struct xenbus_driver *drv)
115{ 110{
116 WARN_ON(drv->owner != THIS_MODULE); 111 return container_of(drv, struct xenbus_driver, driver);
117 return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
118} 112}
119 113
120int __must_check __xenbus_register_backend(struct xenbus_driver *drv, 114int __must_check xenbus_register_frontend(struct xenbus_driver *);
121 struct module *owner, 115int __must_check xenbus_register_backend(struct xenbus_driver *);
122 const char *mod_name);
123static inline int __must_check
124xenbus_register_backend(struct xenbus_driver *drv)
125{
126 WARN_ON(drv->owner != THIS_MODULE);
127 return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
128}
129 116
130void xenbus_unregister_driver(struct xenbus_driver *drv); 117void xenbus_unregister_driver(struct xenbus_driver *drv);
131 118
diff --git a/include/xen/xenbus_dev.h b/include/xen/xenbus_dev.h
new file mode 100644
index 000000000000..ac5f0fe47ed9
--- /dev/null
+++ b/include/xen/xenbus_dev.h
@@ -0,0 +1,41 @@
1/******************************************************************************
2 * evtchn.h
3 *
4 * Interface to /dev/xen/xenbus_backend.
5 *
6 * Copyright (c) 2011 Bastian Blank <waldi@debian.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __LINUX_XEN_XENBUS_DEV_H__
34#define __LINUX_XEN_XENBUS_DEV_H__
35
36#include <linux/ioctl.h>
37
38#define IOCTL_XENBUS_BACKEND_EVTCHN \
39 _IOC(_IOC_NONE, 'B', 0, 0)
40
41#endif /* __LINUX_XEN_XENBUS_DEV_H__ */