aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-08-04 07:59:13 -0400
committerMichal Marek <mmarek@suse.cz>2010-08-04 07:59:13 -0400
commit772320e84588dcbe1600ffb83e5f328f2209ac2a (patch)
treea7de21b79340aeaa17c58126f6b801b82c77b53a /include
parent1ce53adf13a54375d2a5c7cdbe341b2558389615 (diff)
parent9fe6206f400646a2322096b56c59891d530e8d51 (diff)
Merge commit 'v2.6.35' into kbuild/kbuild
Conflicts: arch/powerpc/Makefile
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acoutput.h4
-rw-r--r--include/acpi/acpi.h2
-rw-r--r--include/acpi/acpi_bus.h14
-rw-r--r--include/acpi/acpi_drivers.h6
-rw-r--r--include/acpi/acpi_hest.h12
-rw-r--r--include/acpi/acpiosxf.h10
-rw-r--r--include/acpi/acpixf.h48
-rw-r--r--include/acpi/acrestyp.h4
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/acpi/actbl1.h2
-rw-r--r--include/acpi/actbl2.h70
-rw-r--r--include/acpi/actypes.h89
-rw-r--r--include/acpi/apei.h34
-rw-r--r--include/acpi/atomicio.h10
-rw-r--r--include/acpi/hed.h18
-rw-r--r--include/acpi/platform/acenv.h6
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/acpi/processor.h70
-rw-r--r--include/acpi/video.h16
-rw-r--r--include/asm-generic/atomic.h10
-rw-r--r--include/asm-generic/bitops/arch_hweight.h25
-rw-r--r--include/asm-generic/bitops/const_hweight.h42
-rw-r--r--include/asm-generic/bitops/hweight.h8
-rw-r--r--include/asm-generic/bug.h34
-rw-r--r--include/asm-generic/dma-mapping-common.h20
-rw-r--r--include/asm-generic/gpio.h37
-rw-r--r--include/asm-generic/kmap_types.h6
-rw-r--r--include/asm-generic/local.h19
-rw-r--r--include/asm-generic/pci-dma-compat.h15
-rw-r--r--include/asm-generic/percpu.h18
-rw-r--r--include/asm-generic/scatterlist.h17
-rw-r--r--include/asm-generic/topology.h3
-rw-r--r--include/asm-generic/vmlinux.lds.h20
-rw-r--r--include/crypto/algapi.h40
-rw-r--r--include/crypto/md5.h17
-rw-r--r--include/crypto/pcrypt.h51
-rw-r--r--include/drm/drmP.h66
-rw-r--r--include/drm/drm_buffer.h148
-rw-r--r--include/drm/drm_crtc.h45
-rw-r--r--include/drm/drm_crtc_helper.h12
-rw-r--r--include/drm/drm_edid.h2
-rw-r--r--include/drm/drm_fb_helper.h67
-rw-r--r--include/drm/drm_fixed.h67
-rw-r--r--include/drm/drm_mem_util.h65
-rw-r--r--include/drm/drm_mode.h2
-rw-r--r--include/drm/drm_pciids.h38
-rw-r--r--include/drm/i915_drm.h5
-rw-r--r--include/drm/nouveau_drm.h88
-rw-r--r--include/drm/radeon_drm.h3
-rw-r--r--include/drm/ttm/ttm_bo_api.h46
-rw-r--r--include/drm/ttm/ttm_bo_driver.h88
-rw-r--r--include/drm/ttm/ttm_page_alloc.h70
-rw-r--r--include/drm/vmwgfx_drm.h46
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acct.h3
-rw-r--r--include/linux/acpi.h10
-rw-r--r--include/linux/agp_backend.h1
-rw-r--r--include/linux/ahci_platform.h29
-rw-r--r--include/linux/aio.h5
-rw-r--r--include/linux/altera_jtaguart.h16
-rw-r--r--include/linux/altera_uart.h14
-rw-r--r--include/linux/amba/bus.h9
-rw-r--r--include/linux/amba/clcd.h33
-rw-r--r--include/linux/amba/mmci.h23
-rw-r--r--include/linux/amba/pl022.h32
-rw-r--r--include/linux/amba/pl061.h2
-rw-r--r--include/linux/amba/pl330.h45
-rw-r--r--include/linux/ata.h13
-rw-r--r--include/linux/audit.h11
-rw-r--r--include/linux/backing-dev.h12
-rw-r--r--include/linux/backlight.h11
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bitops.h12
-rw-r--r--include/linux/blkdev.h147
-rw-r--r--include/linux/blktrace_api.h4
-rw-r--r--include/linux/bootmem.h7
-rw-r--r--include/linux/brcmphy.h11
-rw-r--r--include/linux/btree-128.h109
-rw-r--r--include/linux/btree-type.h147
-rw-r--r--include/linux/btree.h243
-rw-r--r--include/linux/buffer_head.h11
-rw-r--r--include/linux/caif/caif_socket.h165
-rw-r--r--include/linux/caif/if_caif.h34
-rw-r--r--include/linux/can/dev.h19
-rw-r--r--include/linux/can/netlink.h17
-rw-r--r--include/linux/can/platform/mcp251x.h4
-rw-r--r--include/linux/can/platform/sja1000.h2
-rw-r--r--include/linux/can/platform/ti_hecc.h8
-rw-r--r--include/linux/cciss_defs.h130
-rw-r--r--include/linux/cciss_ioctl.h128
-rw-r--r--include/linux/cgroup.h71
-rw-r--r--include/linux/circ_buf.h4
-rw-r--r--include/linux/clockchips.h2
-rw-r--r--include/linux/clocksource.h24
-rw-r--r--include/linux/coda_psdev.h3
-rw-r--r--include/linux/compaction.h89
-rw-r--r--include/linux/compat.h7
-rw-r--r--include/linux/compiler-gcc.h10
-rw-r--r--include/linux/compiler-gcc4.h4
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/completion.h2
-rw-r--r--include/linux/connector.h32
-rw-r--r--include/linux/coredump.h45
-rw-r--r--include/linux/cper.h314
-rw-r--r--include/linux/cpufreq.h30
-rw-r--r--include/linux/cpuidle.h8
-rw-r--r--include/linux/cpumask.h22
-rw-r--r--include/linux/cpuset.h65
-rw-r--r--include/linux/cred.h37
-rw-r--r--include/linux/crypto.h6
-rw-r--r--include/linux/davinci_emac.h39
-rw-r--r--include/linux/dcache.h14
-rw-r--r--include/linux/dcbnl.h2
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/debugobjects.h11
-rw-r--r--include/linux/decompress/mm.h14
-rw-r--r--include/linux/delayacct.h1
-rw-r--r--include/linux/device-mapper.h5
-rw-r--r--include/linux/device.h75
-rw-r--r--include/linux/dm-io.h4
-rw-r--r--include/linux/dm-ioctl.h9
-rw-r--r--include/linux/dm9000.h2
-rw-r--r--include/linux/dma-mapping.h49
-rw-r--r--include/linux/dmaengine.h131
-rw-r--r--include/linux/dqblk_xfs.h9
-rw-r--r--include/linux/drbd.h5
-rw-r--r--include/linux/drbd_limits.h16
-rw-r--r--include/linux/drbd_nl.h8
-rw-r--r--include/linux/ds2782_battery.h8
-rw-r--r--include/linux/dynamic_debug.h6
-rw-r--r--include/linux/early_res.h23
-rw-r--r--include/linux/edac_mce.h31
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/elf.h41
-rw-r--r--include/linux/elfcore.h19
-rw-r--r--include/linux/err.h10
-rw-r--r--include/linux/ethtool.h179
-rw-r--r--include/linux/exportfs.h5
-rw-r--r--include/linux/ext2_fs_sb.h9
-rw-r--r--include/linux/ext3_fs.h37
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/fault-inject.h5
-rw-r--r--include/linux/fb.h34
-rw-r--r--include/linux/fcntl.h6
-rw-r--r--include/linux/fdtable.h12
-rw-r--r--include/linux/fec.h21
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/firewire-cdev.h118
-rw-r--r--include/linux/firewire-constants.h29
-rw-r--r--include/linux/firewire.h16
-rw-r--r--include/linux/firmware-map.h6
-rw-r--r--include/linux/firmware.h1
-rw-r--r--include/linux/freezer.h7
-rw-r--r--include/linux/fs.h155
-rw-r--r--include/linux/fscache-cache.h2
-rw-r--r--include/linux/fsnotify.h12
-rw-r--r--include/linux/ftrace.h68
-rw-r--r--include/linux/ftrace_event.h121
-rw-r--r--include/linux/fuse.h5
-rw-r--r--include/linux/gameport.h2
-rw-r--r--include/linux/generic_acl.h4
-rw-r--r--include/linux/genetlink.h8
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/gfp.h30
-rw-r--r--include/linux/gfs2_ondisk.h30
-rw-r--r--include/linux/gpio.h5
-rw-r--r--include/linux/gpio_keys.h1
-rw-r--r--include/linux/gsmmux.h25
-rw-r--r--include/linux/hdpu_features.h26
-rw-r--r--include/linux/hid.h15
-rw-r--r--include/linux/highmem.h8
-rw-r--r--include/linux/hil.h16
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/htcpld.h24
-rw-r--r--include/linux/hw_breakpoint.h37
-rw-r--r--include/linux/i2c-algo-bit.h2
-rw-r--r--include/linux/i2c-omap.h9
-rw-r--r--include/linux/i2c-pnx.h19
-rw-r--r--include/linux/i2c-smbus.h50
-rw-r--r--include/linux/i2c-xiic.h43
-rw-r--r--include/linux/i2c.h14
-rw-r--r--include/linux/i2c/adp8860.h154
-rw-r--r--include/linux/i2c/max732x.h3
-rw-r--r--include/linux/i2c/pca953x.h13
-rw-r--r--include/linux/i2c/twl.h40
-rw-r--r--include/linux/i2o.h3
-rw-r--r--include/linux/i8042.h12
-rw-r--r--include/linux/icmpv6.h3
-rw-r--r--include/linux/ide.h12
-rw-r--r--include/linux/ieee80211.h112
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_link.h153
-rw-r--r--include/linux/if_macvlan.h89
-rw-r--r--include/linux/if_packet.h2
-rw-r--r--include/linux/if_pppol2tp.h16
-rw-r--r--include/linux/if_pppox.h9
-rw-r--r--include/linux/if_tun.h19
-rw-r--r--include/linux/if_tunnel.h1
-rw-r--r--include/linux/if_x25.h26
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/ima.h4
-rw-r--r--include/linux/in.h2
-rw-r--r--include/linux/in6.h5
-rw-r--r--include/linux/inetdevice.h43
-rw-r--r--include/linux/init_task.h22
-rw-r--r--include/linux/input.h93
-rw-r--r--include/linux/input/ad714x.h63
-rw-r--r--include/linux/input/matrix_keypad.h2
-rw-r--r--include/linux/input/sh_keysc.h7
-rw-r--r--include/linux/input/tps6507x-ts.h24
-rw-r--r--include/linux/interrupt.h32
-rw-r--r--include/linux/io-mapping.h1
-rw-r--r--include/linux/iocontext.h5
-rw-r--r--include/linux/iommu.h24
-rw-r--r--include/linux/ioport.h31
-rw-r--r--include/linux/ipc_namespace.h5
-rw-r--r--include/linux/ipmi_smi.h1
-rw-r--r--include/linux/ipv6.h18
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/isapnp.h8
-rw-r--r--include/linux/iscsi_ibft.h8
-rw-r--r--include/linux/isdn/capilli.h8
-rw-r--r--include/linux/ivtvfb.h1
-rw-r--r--include/linux/jbd.h15
-rw-r--r--include/linux/jbd2.h34
-rw-r--r--include/linux/jffs2.h4
-rw-r--r--include/linux/joystick.h4
-rw-r--r--include/linux/kbd_kern.h3
-rw-r--r--include/linux/kdb.h117
-rw-r--r--include/linux/kernel.h58
-rw-r--r--include/linux/kernelcapi.h17
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/kfifo.h11
-rw-r--r--include/linux/kgdb.h55
-rw-r--r--include/linux/kmod.h65
-rw-r--r--include/linux/kobj_map.h9
-rw-r--r--include/linux/kobject.h52
-rw-r--r--include/linux/kprobes.h44
-rw-r--r--include/linux/kref.h3
-rw-r--r--include/linux/ks8842.h34
-rw-r--r--include/linux/ktime.h10
-rw-r--r--include/linux/kvm.h36
-rw-r--r--include/linux/kvm_host.h94
-rw-r--r--include/linux/l2tp.h163
-rw-r--r--include/linux/lcd.h23
-rw-r--r--include/linux/lcm.h8
-rw-r--r--include/linux/leds.h12
-rw-r--r--include/linux/libata.h124
-rw-r--r--include/linux/lis3lv02d.h12
-rw-r--r--include/linux/list.h35
-rw-r--r--include/linux/llc.h7
-rw-r--r--include/linux/lmb.h88
-rw-r--r--include/linux/lockdep.h16
-rw-r--r--include/linux/lru_cache.h2
-rw-r--r--include/linux/lsm_audit.h2
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/matroxfb.h3
-rw-r--r--include/linux/memblock.h89
-rw-r--r--include/linux/memcontrol.h25
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mempolicy.h15
-rw-r--r--include/linux/meye.h12
-rw-r--r--include/linux/mfd/88pm8607.h217
-rw-r--r--include/linux/mfd/88pm860x.h376
-rw-r--r--include/linux/mfd/ab4500.h262
-rw-r--r--include/linux/mfd/ab8500.h128
-rw-r--r--include/linux/mfd/abx500.h (renamed from include/linux/mfd/ab3100.h)137
-rw-r--r--include/linux/mfd/davinci_voicecodec.h126
-rw-r--r--include/linux/mfd/janz.h54
-rw-r--r--include/linux/mfd/max8925.h253
-rw-r--r--include/linux/mfd/mc13783.h94
-rw-r--r--include/linux/mfd/pcf50633/backlight.h51
-rw-r--r--include/linux/mfd/pcf50633/core.h4
-rw-r--r--include/linux/mfd/rdc321x.h26
-rw-r--r--include/linux/mfd/sh_mobile_sdhi.h6
-rw-r--r--include/linux/mfd/tc35892.h132
-rw-r--r--include/linux/mfd/tmio.h14
-rw-r--r--include/linux/mfd/tps6507x.h169
-rw-r--r--include/linux/mfd/ucb1x00.h1
-rw-r--r--include/linux/mfd/wm831x/core.h7
-rw-r--r--include/linux/mfd/wm831x/gpio.h4
-rw-r--r--include/linux/mfd/wm8350/audio.h2
-rw-r--r--include/linux/mfd/wm8350/core.h49
-rw-r--r--include/linux/mfd/wm8350/gpio.h1
-rw-r--r--include/linux/mfd/wm8350/rtc.h1
-rw-r--r--include/linux/mfd/wm8994/core.h105
-rw-r--r--include/linux/mfd/wm8994/gpio.h72
-rw-r--r--include/linux/mfd/wm8994/pdata.h98
-rw-r--r--include/linux/mfd/wm8994/registers.h4292
-rw-r--r--include/linux/migrate.h6
-rw-r--r--include/linux/miscdevice.h8
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mlx4/qp.h7
-rw-r--r--include/linux/mm.h147
-rw-r--r--include/linux/mm_types.h43
-rw-r--r--include/linux/mmc/card.h7
-rw-r--r--include/linux/mmc/host.h10
-rw-r--r--include/linux/mmc/mmc.h1
-rw-r--r--include/linux/mmc/pm.h30
-rw-r--r--include/linux/mmc/sdhci-spear.h42
-rw-r--r--include/linux/mmc/sdio.h4
-rw-r--r--include/linux/mmc/sdio_func.h8
-rw-r--r--include/linux/mmc/sh_mmcif.h200
-rw-r--r--include/linux/mmzone.h43
-rw-r--r--include/linux/mnt_namespace.h1
-rw-r--r--include/linux/mod_devicetable.h42
-rw-r--r--include/linux/module.h99
-rw-r--r--include/linux/mount.h16
-rw-r--r--include/linux/mroute.h20
-rw-r--r--include/linux/mroute6.h35
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/msm_mdp.h78
-rw-r--r--include/linux/mtd/blktrans.h15
-rw-r--r--include/linux/mtd/cfi.h30
-rw-r--r--include/linux/mtd/flashchip.h4
-rw-r--r--include/linux/mtd/map.h3
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/mtdram.h2
-rw-r--r--include/linux/mtd/nand.h25
-rw-r--r--include/linux/mtd/onenand.h9
-rw-r--r--include/linux/mtd/sh_flctl.h10
-rw-r--r--include/linux/mv643xx_eth.h5
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/ncp_fs_sb.h2
-rw-r--r--include/linux/net.h21
-rw-r--r--include/linux/netdevice.h483
-rw-r--r--include/linux/netfilter.h63
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h23
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h19
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h3
-rw-r--r--include/linux/netfilter/nfnetlink.h8
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h2
-rw-r--r--include/linux/netfilter/x_tables.h161
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h22
-rw-r--r--include/linux/netfilter/xt_CT.h17
-rw-r--r--include/linux/netfilter/xt_MARK.h6
-rw-r--r--include/linux/netfilter/xt_TEE.h12
-rw-r--r--include/linux/netfilter/xt_connmark.h11
-rw-r--r--include/linux/netfilter/xt_mark.h4
-rw-r--r--include/linux/netfilter/xt_recent.h7
-rw-r--r--include/linux/netfilter_arp/arp_tables.h11
-rw-r--r--include/linux/netfilter_bridge.h29
-rw-r--r--include/linux/netfilter_bridge/ebtables.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h18
-rw-r--r--include/linux/netfilter_ipv6.h1
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h21
-rw-r--r--include/linux/netlink.h6
-rw-r--r--include/linux/netpoll.h24
-rw-r--r--include/linux/nfs_fs.h22
-rw-r--r--include/linux/nfs_fs_sb.h6
-rw-r--r--include/linux/nfs_xdr.h7
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nilfs2_fs.h18
-rw-r--r--include/linux/nl80211.h221
-rw-r--r--include/linux/nodemask.h13
-rw-r--r--include/linux/notifier.h15
-rw-r--r--include/linux/of.h62
-rw-r--r--include/linux/of_device.h4
-rw-r--r--include/linux/of_fdt.h79
-rw-r--r--include/linux/of_platform.h6
-rw-r--r--include/linux/omapfb.h9
-rw-r--r--include/linux/padata.h143
-rw-r--r--include/linux/page_cgroup.h13
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/pci-dma.h11
-rw-r--r--include/linux/pci.h237
-rw-r--r--include/linux/pci_hotplug.h41
-rw-r--r--include/linux/pci_ids.h61
-rw-r--r--include/linux/pci_regs.h7
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu-defs.h40
-rw-r--r--include/linux/percpu.h67
-rw-r--r--include/linux/percpu_counter.h11
-rw-r--r--include/linux/perf_event.h268
-rw-r--r--include/linux/personality.h2
-rw-r--r--include/linux/pfkeyv2.h1
-rw-r--r--include/linux/phy.h14
-rw-r--r--include/linux/pipe_fs_i.h15
-rw-r--r--include/linux/pktcdvd.h10
-rw-r--r--include/linux/platform_device.h15
-rw-r--r--include/linux/plist.h4
-rw-r--r--include/linux/pm.h57
-rw-r--r--include/linux/pm_qos_params.h14
-rw-r--r--include/linux/pm_runtime.h17
-rw-r--r--include/linux/pm_wakeup.h38
-rw-r--r--include/linux/poison.h9
-rw-r--r--include/linux/poll.h2
-rw-r--r--include/linux/power_supply.h7
-rw-r--r--include/linux/ppp_channel.h3
-rw-r--r--include/linux/ptrace.h37
-rw-r--r--include/linux/quota.h77
-rw-r--r--include/linux/quotaops.h379
-rw-r--r--include/linux/radix-tree.h7
-rw-r--r--include/linux/raid_class.h1
-rw-r--r--include/linux/ramfs.h5
-rw-r--r--include/linux/random.h28
-rw-r--r--include/linux/range.h30
-rw-r--r--include/linux/ratelimit.h13
-rw-r--r--include/linux/rbtree.h16
-rw-r--r--include/linux/rculist.h61
-rw-r--r--include/linux/rculist_nulls.h4
-rw-r--r--include/linux/rcupdate.h252
-rw-r--r--include/linux/rcutiny.h45
-rw-r--r--include/linux/rcutree.h11
-rw-r--r--include/linux/reboot.h1
-rw-r--r--include/linux/regulator/consumer.h12
-rw-r--r--include/linux/regulator/driver.h6
-rw-r--r--include/linux/regulator/fixed.h2
-rw-r--r--include/linux/regulator/machine.h9
-rw-r--r--include/linux/regulator/max8649.h44
-rw-r--r--include/linux/regulator/tps6507x.h32
-rw-r--r--include/linux/reiserfs_acl.h4
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/reiserfs_xattr.h11
-rw-r--r--include/linux/resume-trace.h7
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/ring_buffer.h10
-rw-r--r--include/linux/rio.h55
-rw-r--r--include/linux/rio_drv.h6
-rw-r--r--include/linux/rio_ids.h14
-rw-r--r--include/linux/rio_regs.h80
-rw-r--r--include/linux/rmap.h65
-rw-r--r--include/linux/rtc-v3020.h2
-rw-r--r--include/linux/rtc.h6
-rw-r--r--include/linux/rtmutex.h2
-rw-r--r--include/linux/rtnetlink.h12
-rw-r--r--include/linux/rwlock.h20
-rw-r--r--include/linux/sched.h203
-rw-r--r--include/linux/sdhci-pltfm.h35
-rw-r--r--include/linux/security.h196
-rw-r--r--include/linux/sem.h4
-rw-r--r--include/linux/seq_file.h18
-rw-r--r--include/linux/serial_core.h16
-rw-r--r--include/linux/serial_sci.h8
-rw-r--r--include/linux/serio.h2
-rw-r--r--include/linux/sfi.h24
-rw-r--r--include/linux/sh_clk.h150
-rw-r--r--include/linux/sh_dma.h102
-rw-r--r--include/linux/sh_intc.h59
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h113
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/slab_def.h24
-rw-r--r--include/linux/slob_def.h8
-rw-r--r--include/linux/slub_def.h42
-rw-r--r--include/linux/smb_fs_sb.h3
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/snmp.h5
-rw-r--r--include/linux/socket.h6
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/spi/dw_spi.h5
-rw-r--r--include/linux/spi/l4f00242t03.h31
-rw-r--r--include/linux/spi/max7301.h18
-rw-r--r--include/linux/spi/spi.h1
-rw-r--r--include/linux/spi/spi_bitbang.h101
-rw-r--r--include/linux/spi/wl12xx.h2
-rw-r--r--include/linux/spinlock.h13
-rw-r--r--include/linux/splice.h7
-rw-r--r--include/linux/srcu.h99
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h15
-rw-r--r--include/linux/ssb/ssb_regs.h239
-rw-r--r--include/linux/stmmac.h54
-rw-r--r--include/linux/stop_machine.h122
-rw-r--r--include/linux/sunrpc/auth.h1
-rw-r--r--include/linux/sunrpc/auth_gss.h1
-rw-r--r--include/linux/sunrpc/bc_xprt.h20
-rw-r--r--include/linux/sunrpc/gss_api.h8
-rw-r--r--include/linux/sunrpc/gss_krb5.h184
-rw-r--r--include/linux/sunrpc/metrics.h7
-rw-r--r--include/linux/sunrpc/sched.h20
-rw-r--r--include/linux/sunrpc/xdr.h8
-rw-r--r--include/linux/sunrpc/xprt.h13
-rw-r--r--include/linux/suspend.h26
-rw-r--r--include/linux/swap.h29
-rw-r--r--include/linux/swiotlb.h10
-rw-r--r--include/linux/syscalls.h80
-rw-r--r--include/linux/sysctl.h6
-rw-r--r--include/linux/sysdev.h21
-rw-r--r--include/linux/sysfs.h87
-rw-r--r--include/linux/syslog.h52
-rw-r--r--include/linux/sysrq.h22
-rw-r--r--include/linux/taskstats_kern.h8
-rw-r--r--include/linux/tboot.h1
-rw-r--r--include/linux/tca6416_keypad.h34
-rw-r--r--include/linux/tcp.h7
-rw-r--r--include/linux/threads.h9
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/timb_dma.h55
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timer.h10
-rw-r--r--include/linux/timex.h8
-rw-r--r--include/linux/tipc.h36
-rw-r--r--include/linux/tipc_config.h1
-rw-r--r--include/linux/topology.h112
-rw-r--r--include/linux/tracepoint.h197
-rw-r--r--include/linux/tty.h18
-rw-r--r--include/linux/tty_flip.h7
-rw-r--r--include/linux/tty_ldisc.h8
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/uinput.h10
-rw-r--r--include/linux/usb.h205
-rw-r--r--include/linux/usb/Kbuild2
-rw-r--r--include/linux/usb/atmel_usba_udc.h1
-rw-r--r--include/linux/usb/audio-v2.h423
-rw-r--r--include/linux/usb/audio.h331
-rw-r--r--include/linux/usb/cdc.h94
-rw-r--r--include/linux/usb/ch11.h167
-rw-r--r--include/linux/usb/ch9.h18
-rw-r--r--include/linux/usb/composite.h1
-rw-r--r--include/linux/usb/ehci_def.h6
-rw-r--r--include/linux/usb/functionfs.h199
-rw-r--r--include/linux/usb/g_hid.h32
-rw-r--r--include/linux/usb/gadget.h8
-rw-r--r--include/linux/usb/gadgetfs.h2
-rw-r--r--include/linux/usb/hcd.h625
-rw-r--r--include/linux/usb/langwell_udc.h2
-rw-r--r--include/linux/usb/musb.h66
-rw-r--r--include/linux/usb/ncm.h114
-rw-r--r--include/linux/usb/net2280.h6
-rw-r--r--include/linux/usb/otg.h35
-rw-r--r--include/linux/usb/quirks.h7
-rw-r--r--include/linux/usb/rndis_host.h66
-rw-r--r--include/linux/usb/serial.h49
-rw-r--r--include/linux/usb/ulpi.h140
-rw-r--r--include/linux/usb/usbnet.h61
-rw-r--r--include/linux/usb/vstusb.h71
-rw-r--r--include/linux/usb/wusb-wa.h2
-rw-r--r--include/linux/uuid.h70
-rw-r--r--include/linux/vga_switcheroo.h57
-rw-r--r--include/linux/vgaarb.h22
-rw-r--r--include/linux/vhost.h130
-rw-r--r--include/linux/via-core.h219
-rw-r--r--include/linux/via-gpio.h14
-rw-r--r--include/linux/via_i2c.h42
-rw-r--r--include/linux/videodev2.h77
-rw-r--r--include/linux/virtio.h56
-rw-r--r--include/linux/virtio_9p.h13
-rw-r--r--include/linux/virtio_balloon.h15
-rw-r--r--include/linux/virtio_blk.h18
-rw-r--r--include/linux/virtio_console.h32
-rw-r--r--include/linux/vmstat.h12
-rw-r--r--include/linux/wait.h184
-rw-r--r--include/linux/wimax/debug.h1
-rw-r--r--include/linux/wireless.h4
-rw-r--r--include/linux/writeback.h27
-rw-r--r--include/linux/xattr.h2
-rw-r--r--include/linux/xfrm.h12
-rw-r--r--include/linux/z2_battery.h17
-rw-r--r--include/linux/zorro.h22
-rw-r--r--include/math-emu/op-common.h4
-rw-r--r--include/media/ak881x.h25
-rw-r--r--include/media/davinci/isif.h531
-rw-r--r--include/media/davinci/vpfe_capture.h4
-rw-r--r--include/media/davinci/vpss.h41
-rw-r--r--include/media/ir-common.h76
-rw-r--r--include/media/ir-core.h140
-rw-r--r--include/media/ir-kbd-i2c.h6
-rw-r--r--include/media/ov772x.h10
-rw-r--r--include/media/rc-map.h122
-rw-r--r--include/media/sh_vou.h34
-rw-r--r--include/media/soc_camera.h16
-rw-r--r--include/media/timb_radio.h36
-rw-r--r--include/media/tuner.h2
-rw-r--r--include/media/tvp7002.h56
-rw-r--r--include/media/tw9910.h4
-rw-r--r--include/media/v4l2-chip-ident.h134
-rw-r--r--include/media/v4l2-common.h27
-rw-r--r--include/media/v4l2-dev.h5
-rw-r--r--include/media/v4l2-event.h67
-rw-r--r--include/media/v4l2-fh.h65
-rw-r--r--include/media/v4l2-ioctl.h7
-rw-r--r--include/media/v4l2-mediabus.h21
-rw-r--r--include/media/v4l2-mem2mem.h201
-rw-r--r--include/media/v4l2-subdev.h73
-rw-r--r--include/media/videobuf-core.h35
-rw-r--r--include/media/videobuf-dma-sg.h26
-rw-r--r--include/media/videobuf-vmalloc.h12
-rw-r--r--include/net/9p/9p.h33
-rw-r--r--include/net/9p/client.h22
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/af_unix.h20
-rw-r--r--include/net/ax25.h1
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--include/net/bluetooth/hci.h6
-rw-r--r--include/net/bluetooth/hci_core.h11
-rw-r--r--include/net/bluetooth/l2cap.h41
-rw-r--r--include/net/caif/caif_dev.h103
-rw-r--r--include/net/caif/caif_device.h55
-rw-r--r--include/net/caif/caif_layer.h283
-rw-r--r--include/net/caif/cfcnfg.h140
-rw-r--r--include/net/caif/cfctrl.h139
-rw-r--r--include/net/caif/cffrml.h16
-rw-r--r--include/net/caif/cfmuxl.h22
-rw-r--r--include/net/caif/cfpkt.h274
-rw-r--r--include/net/caif/cfserl.h12
-rw-r--r--include/net/caif/cfsrvl.h56
-rw-r--r--include/net/cfg80211.h332
-rw-r--r--include/net/cls_cgroup.h63
-rw-r--r--include/net/dn_fib.h4
-rw-r--r--include/net/dst.h91
-rw-r--r--include/net/fib_rules.h4
-rw-r--r--include/net/flow.h23
-rw-r--r--include/net/icmp.h13
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/if_inet6.h27
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_sock.h5
-rw-r--r--include/net/inet_timewait_sock.h4
-rw-r--r--include/net/ip.h18
-rw-r--r--include/net/ip6_fib.h33
-rw-r--r--include/net/ip6_route.h22
-rw-r--r--include/net/ip6_tunnel.h1
-rw-r--r--include/net/ip_vs.h38
-rw-r--r--include/net/ipcomp.h2
-rw-r--r--include/net/ipv6.h18
-rw-r--r--include/net/ipx.h1
-rw-r--r--include/net/irda/irttp.h2
-rw-r--r--include/net/iucv/iucv.h1
-rw-r--r--include/net/iw_handler.h2
-rw-r--r--include/net/llc.h39
-rw-r--r--include/net/llc_conn.h2
-rw-r--r--include/net/mac80211.h540
-rw-r--r--include/net/mld.h75
-rw-r--r--include/net/neighbour.h17
-rw-r--r--include/net/net_namespace.h7
-rw-r--r--include/net/netfilter/nf_conntrack.h12
-rw-r--r--include/net/netfilter/nf_conntrack_core.h5
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h58
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h16
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h8
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h4
-rw-r--r--include/net/netfilter/nf_conntrack_zones.h25
-rw-r--r--include/net/netfilter/nf_nat_helper.h32
-rw-r--r--include/net/netlabel.h1
-rw-r--r--include/net/netlink.h8
-rw-r--r--include/net/netns/conntrack.h5
-rw-r--r--include/net/netns/core.h2
-rw-r--r--include/net/netns/generic.h9
-rw-r--r--include/net/netns/ipv4.h18
-rw-r--r--include/net/netns/ipv6.h16
-rw-r--r--include/net/netns/packet.h4
-rw-r--r--include/net/netrom.h1
-rw-r--r--include/net/phonet/pep.h3
-rw-r--r--include/net/pkt_sched.h3
-rw-r--r--include/net/raw.h13
-rw-r--r--include/net/regulatory.h1
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/route.h19
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h40
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/sctp.h5
-rw-r--r--include/net/sctp/sm.h3
-rw-r--r--include/net/sctp/structs.h70
-rw-r--r--include/net/snmp.h45
-rw-r--r--include/net/sock.h265
-rw-r--r--include/net/tc_act/tc_mirred.h1
-rw-r--r--include/net/tcp.h70
-rw-r--r--include/net/tipc/tipc.h16
-rw-r--r--include/net/transp_v6.h3
-rw-r--r--include/net/x25.h15
-rw-r--r--include/net/x25device.h1
-rw-r--r--include/net/xfrm.h105
-rw-r--r--include/pcmcia/cs.h19
-rw-r--r--include/pcmcia/device_id.h5
-rw-r--r--include/pcmcia/ds.h38
-rw-r--r--include/pcmcia/mem_op.h116
-rw-r--r--include/pcmcia/ss.h57
-rw-r--r--include/rdma/ib_pack.h1
-rw-r--r--include/rdma/ib_verbs.h15
-rw-r--r--include/rdma/rdma_cm.h1
-rw-r--r--include/scsi/Kbuild1
-rw-r--r--include/scsi/fc/fc_fcp.h1
-rw-r--r--include/scsi/fc_encode.h18
-rw-r--r--include/scsi/libfc.h29
-rw-r--r--include/scsi/libfcoe.h10
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/libsas.h1
-rw-r--r--include/scsi/scsi.h3
-rw-r--r--include/scsi/scsi_device.h3
-rw-r--r--include/scsi/scsi_host.h8
-rw-r--r--include/scsi/scsi_transport_fc.h2
-rw-r--r--include/scsi/scsi_transport_sas.h7
-rw-r--r--include/scsi/sg.h3
-rw-r--r--include/sound/ak4113.h2
-rw-r--r--include/sound/asound.h22
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/cs46xx_dsp_spos.h6
-rw-r--r--include/sound/es1688.h11
-rw-r--r--include/sound/info.h24
-rw-r--r--include/sound/jack.h8
-rw-r--r--include/sound/pcm.h57
-rw-r--r--include/sound/pcm_oss.h2
-rw-r--r--include/sound/sb.h1
-rw-r--r--include/sound/soc-dai.h27
-rw-r--r--include/sound/soc-dapm.h40
-rw-r--r--include/sound/soc.h88
-rw-r--r--include/sound/tlv320aic3x.h17
-rw-r--r--include/sound/tlv320dac33-plat.h2
-rw-r--r--include/sound/tpa6130a2-plat.h6
-rw-r--r--include/sound/uda134x.h1
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wm2000.h26
-rw-r--r--include/sound/wm8903.h249
-rw-r--r--include/sound/wm8904.h163
-rw-r--r--include/sound/wm8955.h26
-rw-r--r--include/sound/wm8960.h24
-rw-r--r--include/sound/wm9090.h28
-rw-r--r--include/trace/define_trace.h5
-rw-r--r--include/trace/events/block.h164
-rw-r--r--include/trace/events/ext4.h206
-rw-r--r--include/trace/events/jbd2.h28
-rw-r--r--include/trace/events/kvm.h42
-rw-r--r--include/trace/events/lock.h54
-rw-r--r--include/trace/events/module.h18
-rw-r--r--include/trace/events/napi.h10
-rw-r--r--include/trace/events/sched.h51
-rw-r--r--include/trace/events/scsi.h345
-rw-r--r--include/trace/events/signal.h55
-rw-r--r--include/trace/ftrace.h507
-rw-r--r--include/trace/syscall.h24
-rw-r--r--include/video/broadsheetfb.h23
-rw-r--r--include/video/da8xx-fb.h1
-rw-r--r--include/xen/xenbus.h1
735 files changed, 28047 insertions, 6296 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 473d584b1d31..17714beb868e 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -87,7 +87,7 @@
87#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) 87#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
88#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) 88#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
89#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) 89#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
90#define AE_WAKE_ONLY_GPE (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) 90#define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
91#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) 91#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
92 92
93#define AE_CODE_ENV_MAX 0x001B 93#define AE_CODE_ENV_MAX 0x001B
@@ -212,7 +212,7 @@ char const *acpi_gbl_exception_names_env[] = {
212 "AE_NO_GLOBAL_LOCK", 212 "AE_NO_GLOBAL_LOCK",
213 "AE_ABORT_METHOD", 213 "AE_ABORT_METHOD",
214 "AE_SAME_HANDLER", 214 "AE_SAME_HANDLER",
215 "AE_WAKE_ONLY_GPE", 215 "AE_NO_HANDLER",
216 "AE_OWNER_ID_LIMIT" 216 "AE_OWNER_ID_LIMIT"
217}; 217};
218 218
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index c1343a9265fa..9cf736ea4691 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index d814da4b5365..5e952262d6ee 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -206,6 +206,7 @@
206#define ACPI_WARNING(plist) acpi_warning plist 206#define ACPI_WARNING(plist) acpi_warning plist
207#define ACPI_EXCEPTION(plist) acpi_exception plist 207#define ACPI_EXCEPTION(plist) acpi_exception plist
208#define ACPI_ERROR(plist) acpi_error plist 208#define ACPI_ERROR(plist) acpi_error plist
209#define ACPI_DEBUG_OBJECT(obj,l,i) acpi_ex_do_debug_object(obj,l,i)
209 210
210#else 211#else
211 212
@@ -215,6 +216,7 @@
215#define ACPI_WARNING(plist) 216#define ACPI_WARNING(plist)
216#define ACPI_EXCEPTION(plist) 217#define ACPI_EXCEPTION(plist)
217#define ACPI_ERROR(plist) 218#define ACPI_ERROR(plist)
219#define ACPI_DEBUG_OBJECT(obj,l,i)
218 220
219#endif /* ACPI_NO_ERROR_MESSAGES */ 221#endif /* ACPI_NO_ERROR_MESSAGES */
220 222
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index 472b7bf0c5d4..a091cabca4b1 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 3cd9ccdcbd8f..baacd98e7cc6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -242,6 +242,8 @@ struct acpi_device_perf {
242struct acpi_device_wakeup_flags { 242struct acpi_device_wakeup_flags {
243 u8 valid:1; /* Can successfully enable wakeup? */ 243 u8 valid:1; /* Can successfully enable wakeup? */
244 u8 run_wake:1; /* Run-Wake GPE devices */ 244 u8 run_wake:1; /* Run-Wake GPE devices */
245 u8 always_enabled:1; /* Run-wake devices that are always enabled */
246 u8 notifier_present:1; /* Wake-up notify handler has been installed */
245}; 247};
246 248
247struct acpi_device_wakeup_state { 249struct acpi_device_wakeup_state {
@@ -250,12 +252,13 @@ struct acpi_device_wakeup_state {
250 252
251struct acpi_device_wakeup { 253struct acpi_device_wakeup {
252 acpi_handle gpe_device; 254 acpi_handle gpe_device;
253 acpi_integer gpe_number; 255 u64 gpe_number;
254 acpi_integer sleep_state; 256 u64 sleep_state;
255 struct acpi_handle_list resources; 257 struct acpi_handle_list resources;
256 struct acpi_device_wakeup_state state; 258 struct acpi_device_wakeup_state state;
257 struct acpi_device_wakeup_flags flags; 259 struct acpi_device_wakeup_flags flags;
258 int prepare_count; 260 int prepare_count;
261 int run_wake_count;
259}; 262};
260 263
261/* Device */ 264/* Device */
@@ -370,7 +373,7 @@ struct acpi_pci_root {
370 struct acpi_pci_id id; 373 struct acpi_pci_id id;
371 struct pci_bus *bus; 374 struct pci_bus *bus;
372 u16 segment; 375 u16 segment;
373 u8 bus_nr; 376 struct resource secondary; /* downstream bus range */
374 377
375 u32 osc_support_set; /* _OSC state of support bits */ 378 u32 osc_support_set; /* _OSC state of support bits */
376 u32 osc_control_set; /* _OSC state of control bits */ 379 u32 osc_control_set; /* _OSC state of control bits */
@@ -380,12 +383,15 @@ struct acpi_pci_root {
380}; 383};
381 384
382/* helper */ 385/* helper */
383acpi_handle acpi_get_child(acpi_handle, acpi_integer); 386acpi_handle acpi_get_child(acpi_handle, u64);
384int acpi_is_root_bridge(acpi_handle); 387int acpi_is_root_bridge(acpi_handle);
385acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 388acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
386struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 389struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
387#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 390#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
388 391
392int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
393int acpi_disable_wakeup_device_power(struct acpi_device *dev);
394
389#ifdef CONFIG_PM_SLEEP 395#ifdef CONFIG_PM_SLEEP
390int acpi_pm_device_sleep_state(struct device *, int *); 396int acpi_pm_device_sleep_state(struct device *, int *);
391int acpi_pm_device_sleep_wake(struct device *, bool); 397int acpi_pm_device_sleep_wake(struct device *, bool);
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index f4906f6568d4..23d78b4d088b 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -65,6 +65,8 @@
65#define ACPI_VIDEO_HID "LNXVIDEO" 65#define ACPI_VIDEO_HID "LNXVIDEO"
66#define ACPI_BAY_HID "LNXIOBAY" 66#define ACPI_BAY_HID "LNXIOBAY"
67#define ACPI_DOCK_HID "LNXDOCK" 67#define ACPI_DOCK_HID "LNXDOCK"
68/* Quirk for broken IBM BIOSes */
69#define ACPI_SMBUS_IBM_HID "SMBUSIBM"
68 70
69/* 71/*
70 * For fixed hardware buttons, we fabricate acpi_devices with HID 72 * For fixed hardware buttons, we fabricate acpi_devices with HID
@@ -102,8 +104,8 @@ int acpi_pci_bind_root(struct acpi_device *device);
102 104
103/* Arch-defined function to add a bus to the system */ 105/* Arch-defined function to add a bus to the system */
104 106
105struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, 107struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root);
106 int bus); 108void pci_acpi_crs_quirks(void);
107 109
108/* -------------------------------------------------------------------------- 110/* --------------------------------------------------------------------------
109 Processor 111 Processor
diff --git a/include/acpi/acpi_hest.h b/include/acpi/acpi_hest.h
deleted file mode 100644
index 63194d03cb2d..000000000000
--- a/include/acpi/acpi_hest.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __ACPI_HEST_H
2#define __ACPI_HEST_H
3
4#include <linux/pci.h>
5
6#ifdef CONFIG_ACPI
7extern int acpi_hest_firmware_first_pci(struct pci_dev *pci);
8#else
9static inline int acpi_hest_firmware_first_pci(struct pci_dev *pci) { return 0; }
10#endif
11
12#endif
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index eb0e7189075f..29bf945143e8 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -8,7 +8,7 @@
8 *****************************************************************************/ 8 *****************************************************************************/
9 9
10/* 10/*
11 * Copyright (C) 2000 - 2008, Intel Corp. 11 * Copyright (C) 2000 - 2010, Intel Corp.
12 * All rights reserved. 12 * All rights reserved.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -196,7 +196,7 @@ acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
196 196
197void acpi_os_wait_events_complete(void *context); 197void acpi_os_wait_events_complete(void *context);
198 198
199void acpi_os_sleep(acpi_integer milliseconds); 199void acpi_os_sleep(u64 milliseconds);
200 200
201void acpi_os_stall(u32 microseconds); 201void acpi_os_stall(u32 microseconds);
202 202
@@ -227,14 +227,14 @@ acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
227 227
228acpi_status 228acpi_status
229acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, 229acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
230 u32 reg, acpi_integer value, u32 width); 230 u32 reg, u64 value, u32 width);
231 231
232/* 232/*
233 * Interim function needed for PCI IRQ routing 233 * Interim function needed for PCI IRQ routing
234 */ 234 */
235void 235void
236acpi_os_derive_pci_id(acpi_handle rhandle, 236acpi_os_derive_pci_id(acpi_handle device,
237 acpi_handle chandle, struct acpi_pci_id **pci_id); 237 acpi_handle region, struct acpi_pci_id **pci_id);
238 238
239/* 239/*
240 * Miscellaneous 240 * Miscellaneous
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 86e9735a96bd..1371cc997393 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20091214 50#define ACPI_CA_VERSION 0x20100428
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -67,6 +67,9 @@ extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern u8 acpi_gbl_use_default_register_widths; 67extern u8 acpi_gbl_use_default_register_widths;
68extern acpi_name acpi_gbl_trace_method_name; 68extern acpi_name acpi_gbl_trace_method_name;
69extern u32 acpi_gbl_trace_flags; 69extern u32 acpi_gbl_trace_flags;
70extern u8 acpi_gbl_enable_aml_debug_object;
71extern u8 acpi_gbl_copy_dsdt_locally;
72extern u8 acpi_gbl_truncate_io_addresses;
70 73
71extern u32 acpi_current_gpe_count; 74extern u32 acpi_current_gpe_count;
72extern struct acpi_table_fadt acpi_gbl_FADT; 75extern struct acpi_table_fadt acpi_gbl_FADT;
@@ -164,7 +167,7 @@ acpi_get_devices(const char *HID,
164 void *context, void **return_value); 167 void *context, void **return_value);
165 168
166acpi_status 169acpi_status
167acpi_get_name(acpi_handle handle, 170acpi_get_name(acpi_handle object,
168 u32 name_type, struct acpi_buffer *ret_path_ptr); 171 u32 name_type, struct acpi_buffer *ret_path_ptr);
169 172
170acpi_status 173acpi_status
@@ -172,14 +175,12 @@ acpi_get_handle(acpi_handle parent,
172 acpi_string pathname, acpi_handle * ret_handle); 175 acpi_string pathname, acpi_handle * ret_handle);
173 176
174acpi_status 177acpi_status
175acpi_attach_data(acpi_handle obj_handle, 178acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data);
176 acpi_object_handler handler, void *data);
177 179
178acpi_status 180acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler);
179acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler);
180 181
181acpi_status 182acpi_status
182acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); 183acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data);
183 184
184acpi_status 185acpi_status
185acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); 186acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
@@ -201,7 +202,7 @@ acpi_evaluate_object_typed(acpi_handle object,
201 acpi_object_type return_type); 202 acpi_object_type return_type);
202 203
203acpi_status 204acpi_status
204acpi_get_object_info(acpi_handle handle, 205acpi_get_object_info(acpi_handle object,
205 struct acpi_device_info **return_buffer); 206 struct acpi_device_info **return_buffer);
206 207
207acpi_status acpi_install_method(u8 *buffer); 208acpi_status acpi_install_method(u8 *buffer);
@@ -281,18 +282,19 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
281/* 282/*
282 * GPE Interfaces 283 * GPE Interfaces
283 */ 284 */
284acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); 285acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action);
285 286
286acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); 287acpi_status
288acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type);
287 289
288acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); 290acpi_status
291acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type);
289 292
290acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); 293acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number);
291 294
292acpi_status 295acpi_status
293acpi_get_gpe_status(acpi_handle gpe_device, 296acpi_get_gpe_status(acpi_handle gpe_device,
294 u32 gpe_number, 297 u32 gpe_number, acpi_event_status *event_status);
295 u32 flags, acpi_event_status * event_status);
296 298
297acpi_status acpi_disable_all_gpes(void); 299acpi_status acpi_disable_all_gpes(void);
298 300
@@ -315,33 +317,29 @@ acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
315 void *context); 317 void *context);
316 318
317acpi_status 319acpi_status
318acpi_get_vendor_resource(acpi_handle device_handle, 320acpi_get_vendor_resource(acpi_handle device,
319 char *name, 321 char *name,
320 struct acpi_vendor_uuid *uuid, 322 struct acpi_vendor_uuid *uuid,
321 struct acpi_buffer *ret_buffer); 323 struct acpi_buffer *ret_buffer);
322 324
323acpi_status 325acpi_status
324acpi_get_current_resources(acpi_handle device_handle, 326acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
325 struct acpi_buffer *ret_buffer);
326 327
327#ifdef ACPI_FUTURE_USAGE 328#ifdef ACPI_FUTURE_USAGE
328acpi_status 329acpi_status
329acpi_get_possible_resources(acpi_handle device_handle, 330acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
330 struct acpi_buffer *ret_buffer);
331#endif 331#endif
332 332
333acpi_status 333acpi_status
334acpi_walk_resources(acpi_handle device_handle, 334acpi_walk_resources(acpi_handle device,
335 char *name, 335 char *name,
336 acpi_walk_resource_callback user_function, void *context); 336 acpi_walk_resource_callback user_function, void *context);
337 337
338acpi_status 338acpi_status
339acpi_set_current_resources(acpi_handle device_handle, 339acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer);
340 struct acpi_buffer *in_buffer);
341 340
342acpi_status 341acpi_status
343acpi_get_irq_routing_table(acpi_handle bus_device_handle, 342acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer);
344 struct acpi_buffer *ret_buffer);
345 343
346acpi_status 344acpi_status
347acpi_resource_to_address64(struct acpi_resource *resource, 345acpi_resource_to_address64(struct acpi_resource *resource,
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 9ffe00feada6..e5526354ba5e 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -397,7 +397,7 @@ struct acpi_resource {
397struct acpi_pci_routing_table { 397struct acpi_pci_routing_table {
398 u32 length; 398 u32 length;
399 u32 pin; 399 u32 pin;
400 acpi_integer address; /* here for 64-bit alignment */ 400 u64 address; /* here for 64-bit alignment */
401 u32 source_index; 401 u32 source_index;
402 char source[4]; /* pad to 64 bits so sizeof() works in all cases */ 402 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
403}; 403};
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 1b6587952604..ad2001683ba7 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 0b9b430b092b..c637b75b9f3f 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 6f3dce9991e1..95f4d0ef4819 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1,3 +1,46 @@
1/******************************************************************************
2 *
3 * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
1#ifndef __ACTBL2_H__ 44#ifndef __ACTBL2_H__
2#define __ACTBL2_H__ 45#define __ACTBL2_H__
3 46
@@ -26,6 +69,7 @@
26#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ 69#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */
27#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ 70#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
28#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 71#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
72#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
29#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ 73#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
30#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 74#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
31#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ 75#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
@@ -636,6 +680,32 @@ struct acpi_mcfg_allocation {
636 680
637/******************************************************************************* 681/*******************************************************************************
638 * 682 *
683 * MCHI - Management Controller Host Interface Table
684 * Version 1
685 *
686 * Conforms to "Management Component Transport Protocol (MCTP) Host
687 * Interface Specification", Revision 1.0.0a, October 13, 2009
688 *
689 ******************************************************************************/
690
691struct acpi_table_mchi {
692 struct acpi_table_header header; /* Common ACPI table header */
693 u8 interface_type;
694 u8 protocol;
695 u64 protocol_data;
696 u8 interrupt_type;
697 u8 gpe;
698 u8 pci_device_flag;
699 u32 global_interrupt;
700 struct acpi_generic_address control_register;
701 u8 pci_segment;
702 u8 pci_bus;
703 u8 pci_device;
704 u8 pci_function;
705};
706
707/*******************************************************************************
708 *
639 * SPCR - Serial Port Console Redirection table 709 * SPCR - Serial Port Console Redirection table
640 * Version 1 710 * Version 1
641 * 711 *
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 153f12dc3373..d55f4a7b824d 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -385,19 +385,6 @@ union uint64_overlay {
385 struct uint64_struct part; 385 struct uint64_struct part;
386}; 386};
387 387
388struct uint32_struct {
389 u32 lo;
390 u32 hi;
391};
392
393/*
394 * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
395 * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
396 * type only, not other integers used in the implementation of the ACPI CA
397 * subsystem.
398 */
399typedef unsigned long long acpi_integer;
400#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
401#define ACPI_INTEGER_BIT_SIZE 64 388#define ACPI_INTEGER_BIT_SIZE 64
402#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 389#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
403 390
@@ -421,6 +408,19 @@ typedef unsigned long long acpi_integer;
421#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ 408#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
422#define ACPI_DO_NOT_WAIT 0 409#define ACPI_DO_NOT_WAIT 0
423 410
411/*
412 * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits.
413 * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this
414 * pertains to the ACPI integer type only, not to other integers used in the
415 * implementation of the ACPICA subsystem.
416 *
417 * 01/2010: This type is obsolete and has been removed from the entire ACPICA
418 * code base. It remains here for compatibility with device drivers that use
419 * the type. However, it will be removed in the future.
420 */
421typedef u64 acpi_integer;
422#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
423
424/******************************************************************************* 424/*******************************************************************************
425 * 425 *
426 * Commonly used macros 426 * Commonly used macros
@@ -663,52 +663,43 @@ typedef u32 acpi_event_status;
663#define ACPI_GPE_MAX 0xFF 663#define ACPI_GPE_MAX 0xFF
664#define ACPI_NUM_GPE 256 664#define ACPI_NUM_GPE 256
665 665
666/* Actions for acpi_set_gpe and acpi_hw_low_set_gpe */
667
666#define ACPI_GPE_ENABLE 0 668#define ACPI_GPE_ENABLE 0
667#define ACPI_GPE_DISABLE 1 669#define ACPI_GPE_DISABLE 1
670#define ACPI_GPE_COND_ENABLE 2
671
672/* gpe_types for acpi_enable_gpe and acpi_disable_gpe */
673
674#define ACPI_GPE_TYPE_WAKE (u8) 0x01
675#define ACPI_GPE_TYPE_RUNTIME (u8) 0x02
676#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x03
668 677
669/* 678/*
670 * GPE info flags - Per GPE 679 * GPE info flags - Per GPE
671 * +-+-+-+---+---+-+ 680 * +-------+---+-+-+
672 * |7|6|5|4:3|2:1|0| 681 * | 7:4 |3:2|1|0|
673 * +-+-+-+---+---+-+ 682 * +-------+---+-+-+
674 * | | | | | | 683 * | | | |
675 * | | | | | +--- Interrupt type: Edge or Level Triggered 684 * | | | +--- Interrupt type: edge or level triggered
676 * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime 685 * | | +----- GPE can wake the system
677 * | | | +--- Type of dispatch -- to method, handler, or none 686 * | +-------- Type of dispatch:to method, handler, or none
678 * | | +--- Enabled for runtime? 687 * +-------------- <Reserved>
679 * | +--- Enabled for wake?
680 * +--- Unused
681 */ 688 */
682#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 689#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01
683#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01 690#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
684#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00 691#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00
685 692
686#define ACPI_GPE_TYPE_MASK (u8) 0x06 693#define ACPI_GPE_CAN_WAKE (u8) 0x02
687#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06
688#define ACPI_GPE_TYPE_WAKE (u8) 0x02
689#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */
690 694
691#define ACPI_GPE_DISPATCH_MASK (u8) 0x18 695#define ACPI_GPE_DISPATCH_MASK (u8) 0x0C
692#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 696#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x04
693#define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 697#define ACPI_GPE_DISPATCH_METHOD (u8) 0x08
694#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ 698#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00
695
696#define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20
697#define ACPI_GPE_RUN_ENABLED (u8) 0x20
698#define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */
699
700#define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40
701#define ACPI_GPE_WAKE_ENABLED (u8) 0x40
702#define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */
703
704#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */
705 699
706/* 700/*
707 * Flags for GPE and Lock interfaces 701 * Flags for GPE and Lock interfaces
708 */ 702 */
709#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */
710#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */
711
712#define ACPI_NOT_ISR 0x1 703#define ACPI_NOT_ISR 0x1
713#define ACPI_ISR 0x0 704#define ACPI_ISR 0x0
714 705
@@ -801,7 +792,7 @@ union acpi_object {
801 acpi_object_type type; /* See definition of acpi_ns_type for values */ 792 acpi_object_type type; /* See definition of acpi_ns_type for values */
802 struct { 793 struct {
803 acpi_object_type type; /* ACPI_TYPE_INTEGER */ 794 acpi_object_type type; /* ACPI_TYPE_INTEGER */
804 acpi_integer value; /* The actual number */ 795 u64 value; /* The actual number */
805 } integer; 796 } integer;
806 797
807 struct { 798 struct {
@@ -945,7 +936,7 @@ typedef
945acpi_status(*acpi_adr_space_handler) (u32 function, 936acpi_status(*acpi_adr_space_handler) (u32 function,
946 acpi_physical_address address, 937 acpi_physical_address address,
947 u32 bit_width, 938 u32 bit_width,
948 acpi_integer * value, 939 u64 *value,
949 void *handler_context, 940 void *handler_context,
950 void *region_context); 941 void *region_context);
951 942
@@ -961,7 +952,7 @@ acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
961#define ACPI_REGION_DEACTIVATE 1 952#define ACPI_REGION_DEACTIVATE 1
962 953
963typedef 954typedef
964acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, 955acpi_status(*acpi_walk_callback) (acpi_handle object,
965 u32 nesting_level, 956 u32 nesting_level,
966 void *context, void **return_value); 957 void *context, void **return_value);
967 958
@@ -1005,7 +996,7 @@ struct acpi_device_info {
1005 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ 996 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
1006 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ 997 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */
1007 u32 current_status; /* _STA value */ 998 u32 current_status; /* _STA value */
1008 acpi_integer address; /* _ADR value */ 999 u64 address; /* _ADR value */
1009 struct acpica_device_id hardware_id; /* _HID value */ 1000 struct acpica_device_id hardware_id; /* _HID value */
1010 struct acpica_device_id unique_id; /* _UID value */ 1001 struct acpica_device_id unique_id; /* _UID value */
1011 struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ 1002 struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
new file mode 100644
index 000000000000..b3365025ff8d
--- /dev/null
+++ b/include/acpi/apei.h
@@ -0,0 +1,34 @@
1/*
2 * apei.h - ACPI Platform Error Interface
3 */
4
5#ifndef ACPI_APEI_H
6#define ACPI_APEI_H
7
8#include <linux/acpi.h>
9#include <linux/cper.h>
10#include <asm/ioctls.h>
11
12#define APEI_ERST_INVALID_RECORD_ID 0xffffffffffffffffULL
13
14#define APEI_ERST_CLEAR_RECORD _IOW('E', 1, u64)
15#define APEI_ERST_GET_RECORD_COUNT _IOR('E', 2, u32)
16
17#ifdef __KERNEL__
18
19extern int hest_disable;
20extern int erst_disable;
21
22typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
23int apei_hest_parse(apei_hest_func_t func, void *data);
24
25int erst_write(const struct cper_record_header *record);
26ssize_t erst_get_record_count(void);
27int erst_get_next_record_id(u64 *record_id);
28ssize_t erst_read(u64 record_id, struct cper_record_header *record,
29 size_t buflen);
30ssize_t erst_read_next(struct cper_record_header *record, size_t buflen);
31int erst_clear(u64 record_id);
32
33#endif
34#endif
diff --git a/include/acpi/atomicio.h b/include/acpi/atomicio.h
new file mode 100644
index 000000000000..8b9fb4b0b9ce
--- /dev/null
+++ b/include/acpi/atomicio.h
@@ -0,0 +1,10 @@
1#ifndef ACPI_ATOMIC_IO_H
2#define ACPI_ATOMIC_IO_H
3
4int acpi_pre_map_gar(struct acpi_generic_address *reg);
5int acpi_post_unmap_gar(struct acpi_generic_address *reg);
6
7int acpi_atomic_read(u64 *val, struct acpi_generic_address *reg);
8int acpi_atomic_write(u64 val, struct acpi_generic_address *reg);
9
10#endif
diff --git a/include/acpi/hed.h b/include/acpi/hed.h
new file mode 100644
index 000000000000..46e1249b70cc
--- /dev/null
+++ b/include/acpi/hed.h
@@ -0,0 +1,18 @@
1/*
2 * hed.h - ACPI Hardware Error Device
3 *
4 * Copyright (C) 2009, Intel Corp.
5 * Author: Huang Ying <ying.huang@intel.com>
6 *
7 * This file is released under the GPLv2.
8 */
9
10#ifndef ACPI_HED_H
11#define ACPI_HED_H
12
13#include <linux/notifier.h>
14
15int register_acpi_hed_notifier(struct notifier_block *nb);
16void unregister_acpi_hed_notifier(struct notifier_block *nb);
17
18#endif
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index e62f10d9a7d8..c05aeba9e8f0 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -311,8 +311,8 @@ typedef char *va_list;
311#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) 311#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
312#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) 312#define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
313#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) 313#define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
314#define ACPI_TOUPPER acpi_ut_to_upper 314#define ACPI_TOUPPER(c) acpi_ut_to_upper ((int) (c))
315#define ACPI_TOLOWER acpi_ut_to_lower 315#define ACPI_TOLOWER(c) acpi_ut_to_lower ((int) (c))
316 316
317#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 317#endif /* ACPI_USE_SYSTEM_CLIBRARY */
318 318
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 6aadbf84ae71..0cd53e3cd1a3 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 09469971472f..e5039a2856f8 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2009, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 0ea5ef4eb6a9..a68ca8a11a53 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -48,21 +48,10 @@ struct acpi_power_register {
48 u8 space_id; 48 u8 space_id;
49 u8 bit_width; 49 u8 bit_width;
50 u8 bit_offset; 50 u8 bit_offset;
51 u8 reserved; 51 u8 access_size;
52 u64 address; 52 u64 address;
53} __attribute__ ((packed)); 53} __attribute__ ((packed));
54 54
55struct acpi_processor_cx_policy {
56 u32 count;
57 struct acpi_processor_cx *state;
58 struct {
59 u32 time;
60 u32 ticks;
61 u32 count;
62 u32 bm;
63 } threshold;
64};
65
66struct acpi_processor_cx { 55struct acpi_processor_cx {
67 u8 valid; 56 u8 valid;
68 u8 type; 57 u8 type;
@@ -74,8 +63,7 @@ struct acpi_processor_cx {
74 u32 power; 63 u32 power;
75 u32 usage; 64 u32 usage;
76 u64 time; 65 u64 time;
77 struct acpi_processor_cx_policy promotion; 66 u8 bm_sts_skip;
78 struct acpi_processor_cx_policy demotion;
79 char desc[ACPI_CX_DESC_LEN]; 67 char desc[ACPI_CX_DESC_LEN];
80}; 68};
81 69
@@ -92,11 +80,11 @@ struct acpi_processor_power {
92/* Performance Management */ 80/* Performance Management */
93 81
94struct acpi_psd_package { 82struct acpi_psd_package {
95 acpi_integer num_entries; 83 u64 num_entries;
96 acpi_integer revision; 84 u64 revision;
97 acpi_integer domain; 85 u64 domain;
98 acpi_integer coord_type; 86 u64 coord_type;
99 acpi_integer num_processors; 87 u64 num_processors;
100} __attribute__ ((packed)); 88} __attribute__ ((packed));
101 89
102struct acpi_pct_register { 90struct acpi_pct_register {
@@ -110,12 +98,12 @@ struct acpi_pct_register {
110} __attribute__ ((packed)); 98} __attribute__ ((packed));
111 99
112struct acpi_processor_px { 100struct acpi_processor_px {
113 acpi_integer core_frequency; /* megahertz */ 101 u64 core_frequency; /* megahertz */
114 acpi_integer power; /* milliWatts */ 102 u64 power; /* milliWatts */
115 acpi_integer transition_latency; /* microseconds */ 103 u64 transition_latency; /* microseconds */
116 acpi_integer bus_master_latency; /* microseconds */ 104 u64 bus_master_latency; /* microseconds */
117 acpi_integer control; /* control value */ 105 u64 control; /* control value */
118 acpi_integer status; /* success indicator */ 106 u64 status; /* success indicator */
119}; 107};
120 108
121struct acpi_processor_performance { 109struct acpi_processor_performance {
@@ -133,11 +121,11 @@ struct acpi_processor_performance {
133/* Throttling Control */ 121/* Throttling Control */
134 122
135struct acpi_tsd_package { 123struct acpi_tsd_package {
136 acpi_integer num_entries; 124 u64 num_entries;
137 acpi_integer revision; 125 u64 revision;
138 acpi_integer domain; 126 u64 domain;
139 acpi_integer coord_type; 127 u64 coord_type;
140 acpi_integer num_processors; 128 u64 num_processors;
141} __attribute__ ((packed)); 129} __attribute__ ((packed));
142 130
143struct acpi_ptc_register { 131struct acpi_ptc_register {
@@ -151,11 +139,11 @@ struct acpi_ptc_register {
151} __attribute__ ((packed)); 139} __attribute__ ((packed));
152 140
153struct acpi_processor_tx_tss { 141struct acpi_processor_tx_tss {
154 acpi_integer freqpercentage; /* */ 142 u64 freqpercentage; /* */
155 acpi_integer power; /* milliWatts */ 143 u64 power; /* milliWatts */
156 acpi_integer transition_latency; /* microseconds */ 144 u64 transition_latency; /* microseconds */
157 acpi_integer control; /* control value */ 145 u64 control; /* control value */
158 acpi_integer status; /* success indicator */ 146 u64 status; /* success indicator */
159}; 147};
160struct acpi_processor_tx { 148struct acpi_processor_tx {
161 u16 power; 149 u16 power;
@@ -238,7 +226,7 @@ struct acpi_processor_errata {
238 226
239extern int acpi_processor_preregister_performance(struct 227extern int acpi_processor_preregister_performance(struct
240 acpi_processor_performance 228 acpi_processor_performance
241 *performance); 229 __percpu *performance);
242 230
243extern int acpi_processor_register_performance(struct acpi_processor_performance 231extern int acpi_processor_register_performance(struct acpi_processor_performance
244 *performance, unsigned int cpu); 232 *performance, unsigned int cpu);
@@ -320,8 +308,16 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
320 308
321#endif /* CONFIG_CPU_FREQ */ 309#endif /* CONFIG_CPU_FREQ */
322 310
323/* in processor_pdc.c */ 311/* in processor_core.c */
324void acpi_processor_set_pdc(acpi_handle handle); 312void acpi_processor_set_pdc(acpi_handle handle);
313#ifdef CONFIG_SMP
314int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
315#else
316static inline int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
317{
318 return -1;
319}
320#endif
325 321
326/* in processor_throttling.c */ 322/* in processor_throttling.c */
327int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 323int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
diff --git a/include/acpi/video.h b/include/acpi/video.h
index cf7be3dd157b..551793c9b6e8 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -1,12 +1,28 @@
1#ifndef __ACPI_VIDEO_H 1#ifndef __ACPI_VIDEO_H
2#define __ACPI_VIDEO_H 2#define __ACPI_VIDEO_H
3 3
4#define ACPI_VIDEO_DISPLAY_CRT 1
5#define ACPI_VIDEO_DISPLAY_TV 2
6#define ACPI_VIDEO_DISPLAY_DVI 3
7#define ACPI_VIDEO_DISPLAY_LCD 4
8
9#define ACPI_VIDEO_DISPLAY_LEGACY_MONITOR 0x0100
10#define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110
11#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
12
4#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 13#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
5extern int acpi_video_register(void); 14extern int acpi_video_register(void);
6extern void acpi_video_unregister(void); 15extern void acpi_video_unregister(void);
16extern int acpi_video_get_edid(struct acpi_device *device, int type,
17 int device_id, void **edid);
7#else 18#else
8static inline int acpi_video_register(void) { return 0; } 19static inline int acpi_video_register(void) { return 0; }
9static inline void acpi_video_unregister(void) { return; } 20static inline void acpi_video_unregister(void) { return; }
21static inline int acpi_video_get_edid(struct acpi_device *device, int type,
22 int device_id, void **edid)
23{
24 return -ENODEV;
25}
10#endif 26#endif
11 27
12#endif 28#endif
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index c99c64dc5f3d..058129e9b04c 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -30,18 +30,16 @@
30 * atomic_read - read atomic variable 30 * atomic_read - read atomic variable
31 * @v: pointer of type atomic_t 31 * @v: pointer of type atomic_t
32 * 32 *
33 * Atomically reads the value of @v. Note that the guaranteed 33 * Atomically reads the value of @v.
34 * useful range of an atomic_t is only 24 bits.
35 */ 34 */
36#define atomic_read(v) ((v)->counter) 35#define atomic_read(v) (*(volatile int *)&(v)->counter)
37 36
38/** 37/**
39 * atomic_set - set atomic variable 38 * atomic_set - set atomic variable
40 * @v: pointer of type atomic_t 39 * @v: pointer of type atomic_t
41 * @i: required value 40 * @i: required value
42 * 41 *
43 * Atomically sets the value of @v to @i. Note that the guaranteed 42 * Atomically sets the value of @v to @i.
44 * useful range of an atomic_t is only 24 bits.
45 */ 43 */
46#define atomic_set(v, i) (((v)->counter) = (i)) 44#define atomic_set(v, i) (((v)->counter) = (i))
47 45
@@ -53,7 +51,6 @@
53 * @v: pointer of type atomic_t 51 * @v: pointer of type atomic_t
54 * 52 *
55 * Atomically adds @i to @v and returns the result 53 * Atomically adds @i to @v and returns the result
56 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
57 */ 54 */
58static inline int atomic_add_return(int i, atomic_t *v) 55static inline int atomic_add_return(int i, atomic_t *v)
59{ 56{
@@ -75,7 +72,6 @@ static inline int atomic_add_return(int i, atomic_t *v)
75 * @v: pointer of type atomic_t 72 * @v: pointer of type atomic_t
76 * 73 *
77 * Atomically subtracts @i from @v and returns the result 74 * Atomically subtracts @i from @v and returns the result
78 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
79 */ 75 */
80static inline int atomic_sub_return(int i, atomic_t *v) 76static inline int atomic_sub_return(int i, atomic_t *v)
81{ 77{
diff --git a/include/asm-generic/bitops/arch_hweight.h b/include/asm-generic/bitops/arch_hweight.h
new file mode 100644
index 000000000000..6a211f40665c
--- /dev/null
+++ b/include/asm-generic/bitops/arch_hweight.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
3
4#include <asm/types.h>
5
6static inline unsigned int __arch_hweight32(unsigned int w)
7{
8 return __sw_hweight32(w);
9}
10
11static inline unsigned int __arch_hweight16(unsigned int w)
12{
13 return __sw_hweight16(w);
14}
15
16static inline unsigned int __arch_hweight8(unsigned int w)
17{
18 return __sw_hweight8(w);
19}
20
21static inline unsigned long __arch_hweight64(__u64 w)
22{
23 return __sw_hweight64(w);
24}
25#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h
new file mode 100644
index 000000000000..fa2a50b7ee66
--- /dev/null
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
3
4/*
5 * Compile time versions of __arch_hweightN()
6 */
7#define __const_hweight8(w) \
8 ( (!!((w) & (1ULL << 0))) + \
9 (!!((w) & (1ULL << 1))) + \
10 (!!((w) & (1ULL << 2))) + \
11 (!!((w) & (1ULL << 3))) + \
12 (!!((w) & (1ULL << 4))) + \
13 (!!((w) & (1ULL << 5))) + \
14 (!!((w) & (1ULL << 6))) + \
15 (!!((w) & (1ULL << 7))) )
16
17#define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
18#define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
19#define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
20
21/*
22 * Generic interface.
23 */
24#define hweight8(w) (__builtin_constant_p(w) ? __const_hweight8(w) : __arch_hweight8(w))
25#define hweight16(w) (__builtin_constant_p(w) ? __const_hweight16(w) : __arch_hweight16(w))
26#define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
27#define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
28
29/*
30 * Interface for known constant arguments
31 */
32#define HWEIGHT8(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight8(w))
33#define HWEIGHT16(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight16(w))
34#define HWEIGHT32(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight32(w))
35#define HWEIGHT64(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight64(w))
36
37/*
38 * Type invariant interface to the compile time constant hweight functions.
39 */
40#define HWEIGHT(w) HWEIGHT64((u64)w)
41
42#endif /* _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ */
diff --git a/include/asm-generic/bitops/hweight.h b/include/asm-generic/bitops/hweight.h
index fbbc383771da..a94d6519c7ed 100644
--- a/include/asm-generic/bitops/hweight.h
+++ b/include/asm-generic/bitops/hweight.h
@@ -1,11 +1,7 @@
1#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_ 1#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_HWEIGHT_H_ 2#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
3 3
4#include <asm/types.h> 4#include <asm-generic/bitops/arch_hweight.h>
5 5#include <asm-generic/bitops/const_hweight.h>
6extern unsigned int hweight32(unsigned int w);
7extern unsigned int hweight16(unsigned int w);
8extern unsigned int hweight8(unsigned int w);
9extern unsigned long hweight64(__u64 w);
10 6
11#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */ 7#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 18c435d7c082..c2c9ba032d46 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -25,7 +25,10 @@ struct bug_entry {
25}; 25};
26#endif /* __ASSEMBLY__ */ 26#endif /* __ASSEMBLY__ */
27 27
28#define BUGFLAG_WARNING (1<<0) 28#define BUGFLAG_WARNING (1 << 0)
29#define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8))
30#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
31
29#endif /* CONFIG_GENERIC_BUG */ 32#endif /* CONFIG_GENERIC_BUG */
30 33
31/* 34/*
@@ -56,17 +59,25 @@ struct bug_entry {
56 * appear at runtime. Use the versions with printk format strings 59 * appear at runtime. Use the versions with printk format strings
57 * to provide better diagnostics. 60 * to provide better diagnostics.
58 */ 61 */
59#ifndef __WARN 62#ifndef __WARN_TAINT
60#ifndef __ASSEMBLY__ 63#ifndef __ASSEMBLY__
61extern void warn_slowpath_fmt(const char *file, const int line, 64extern void warn_slowpath_fmt(const char *file, const int line,
62 const char *fmt, ...) __attribute__((format(printf, 3, 4))); 65 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
66extern void warn_slowpath_fmt_taint(const char *file, const int line,
67 unsigned taint, const char *fmt, ...)
68 __attribute__((format(printf, 4, 5)));
63extern void warn_slowpath_null(const char *file, const int line); 69extern void warn_slowpath_null(const char *file, const int line);
64#define WANT_WARN_ON_SLOWPATH 70#define WANT_WARN_ON_SLOWPATH
65#endif 71#endif
66#define __WARN() warn_slowpath_null(__FILE__, __LINE__) 72#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
67#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) 73#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
74#define __WARN_printf_taint(taint, arg...) \
75 warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
68#else 76#else
77#define __WARN() __WARN_TAINT(TAINT_WARN)
69#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) 78#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
79#define __WARN_printf_taint(taint, arg...) \
80 do { printk(arg); __WARN_TAINT(taint); } while (0)
70#endif 81#endif
71 82
72#ifndef WARN_ON 83#ifndef WARN_ON
@@ -87,6 +98,13 @@ extern void warn_slowpath_null(const char *file, const int line);
87}) 98})
88#endif 99#endif
89 100
101#define WARN_TAINT(condition, taint, format...) ({ \
102 int __ret_warn_on = !!(condition); \
103 if (unlikely(__ret_warn_on)) \
104 __WARN_printf_taint(taint, format); \
105 unlikely(__ret_warn_on); \
106})
107
90#else /* !CONFIG_BUG */ 108#else /* !CONFIG_BUG */
91#ifndef HAVE_ARCH_BUG 109#ifndef HAVE_ARCH_BUG
92#define BUG() do {} while(0) 110#define BUG() do {} while(0)
@@ -110,6 +128,8 @@ extern void warn_slowpath_null(const char *file, const int line);
110}) 128})
111#endif 129#endif
112 130
131#define WARN_TAINT(condition, taint, format...) WARN_ON(condition)
132
113#endif 133#endif
114 134
115#define WARN_ON_ONCE(condition) ({ \ 135#define WARN_ON_ONCE(condition) ({ \
@@ -132,6 +152,16 @@ extern void warn_slowpath_null(const char *file, const int line);
132 unlikely(__ret_warn_once); \ 152 unlikely(__ret_warn_once); \
133}) 153})
134 154
155#define WARN_TAINT_ONCE(condition, taint, format...) ({ \
156 static bool __warned; \
157 int __ret_warn_once = !!(condition); \
158 \
159 if (unlikely(__ret_warn_once)) \
160 if (WARN_TAINT(!__warned, taint, format)) \
161 __warned = true; \
162 unlikely(__ret_warn_once); \
163})
164
135#define WARN_ON_RATELIMIT(condition, state) \ 165#define WARN_ON_RATELIMIT(condition, state) \
136 WARN_ON((condition) && __ratelimit(state)) 166 WARN_ON((condition) && __ratelimit(state))
137 167
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index e694263445f7..0c80bb38773f 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -123,15 +123,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
123 size_t size, 123 size_t size,
124 enum dma_data_direction dir) 124 enum dma_data_direction dir)
125{ 125{
126 struct dma_map_ops *ops = get_dma_ops(dev); 126 dma_sync_single_for_cpu(dev, addr + offset, size, dir);
127
128 BUG_ON(!valid_dma_direction(dir));
129 if (ops->sync_single_range_for_cpu) {
130 ops->sync_single_range_for_cpu(dev, addr, offset, size, dir);
131 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
132
133 } else
134 dma_sync_single_for_cpu(dev, addr, size, dir);
135} 127}
136 128
137static inline void dma_sync_single_range_for_device(struct device *dev, 129static inline void dma_sync_single_range_for_device(struct device *dev,
@@ -140,15 +132,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
140 size_t size, 132 size_t size,
141 enum dma_data_direction dir) 133 enum dma_data_direction dir)
142{ 134{
143 struct dma_map_ops *ops = get_dma_ops(dev); 135 dma_sync_single_for_device(dev, addr + offset, size, dir);
144
145 BUG_ON(!valid_dma_direction(dir));
146 if (ops->sync_single_range_for_device) {
147 ops->sync_single_range_for_device(dev, addr, offset, size, dir);
148 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
149
150 } else
151 dma_sync_single_for_device(dev, addr, size, dir);
152} 136}
153 137
154static inline void 138static inline void
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 485eeb6c4ef3..4f3d75e1ad39 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -60,7 +60,9 @@ struct module;
60 * @names: if set, must be an array of strings to use as alternative 60 * @names: if set, must be an array of strings to use as alternative
61 * names for the GPIOs in this chip. Any entry in the array 61 * names for the GPIOs in this chip. Any entry in the array
62 * may be NULL if there is no alias for the GPIO, however the 62 * may be NULL if there is no alias for the GPIO, however the
63 * array must be @ngpio entries long. 63 * array must be @ngpio entries long. A name can include a single printk
64 * format specifier for an unsigned int. It is substituted by the actual
65 * number of the gpio.
64 * 66 *
65 * A gpio_chip can help platforms abstract various sources of GPIOs so 67 * A gpio_chip can help platforms abstract various sources of GPIOs so
66 * they can all be accessed through a common programing interface. 68 * they can all be accessed through a common programing interface.
@@ -88,6 +90,9 @@ struct gpio_chip {
88 unsigned offset); 90 unsigned offset);
89 int (*direction_output)(struct gpio_chip *chip, 91 int (*direction_output)(struct gpio_chip *chip,
90 unsigned offset, int value); 92 unsigned offset, int value);
93 int (*set_debounce)(struct gpio_chip *chip,
94 unsigned offset, unsigned debounce);
95
91 void (*set)(struct gpio_chip *chip, 96 void (*set)(struct gpio_chip *chip,
92 unsigned offset, int value); 97 unsigned offset, int value);
93 98
@@ -98,7 +103,7 @@ struct gpio_chip {
98 struct gpio_chip *chip); 103 struct gpio_chip *chip);
99 int base; 104 int base;
100 u16 ngpio; 105 u16 ngpio;
101 char **names; 106 const char *const *names;
102 unsigned can_sleep:1; 107 unsigned can_sleep:1;
103 unsigned exported:1; 108 unsigned exported:1;
104}; 109};
@@ -121,6 +126,8 @@ extern void gpio_free(unsigned gpio);
121extern int gpio_direction_input(unsigned gpio); 126extern int gpio_direction_input(unsigned gpio);
122extern int gpio_direction_output(unsigned gpio, int value); 127extern int gpio_direction_output(unsigned gpio, int value);
123 128
129extern int gpio_set_debounce(unsigned gpio, unsigned debounce);
130
124extern int gpio_get_value_cansleep(unsigned gpio); 131extern int gpio_get_value_cansleep(unsigned gpio);
125extern void gpio_set_value_cansleep(unsigned gpio, int value); 132extern void gpio_set_value_cansleep(unsigned gpio, int value);
126 133
@@ -136,6 +143,32 @@ extern int __gpio_cansleep(unsigned gpio);
136 143
137extern int __gpio_to_irq(unsigned gpio); 144extern int __gpio_to_irq(unsigned gpio);
138 145
146#define GPIOF_DIR_OUT (0 << 0)
147#define GPIOF_DIR_IN (1 << 0)
148
149#define GPIOF_INIT_LOW (0 << 1)
150#define GPIOF_INIT_HIGH (1 << 1)
151
152#define GPIOF_IN (GPIOF_DIR_IN)
153#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
154#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
155
156/**
157 * struct gpio - a structure describing a GPIO with configuration
158 * @gpio: the GPIO number
159 * @flags: GPIO configuration as specified by GPIOF_*
160 * @label: a literal description string of this GPIO
161 */
162struct gpio {
163 unsigned gpio;
164 unsigned long flags;
165 const char *label;
166};
167
168extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
169extern int gpio_request_array(struct gpio *array, size_t num);
170extern void gpio_free_array(struct gpio *array, size_t num);
171
139#ifdef CONFIG_GPIO_SYSFS 172#ifdef CONFIG_GPIO_SYSFS
140 173
141/* 174/*
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
index e5f234a08540..0232ccb76f2b 100644
--- a/include/asm-generic/kmap_types.h
+++ b/include/asm-generic/kmap_types.h
@@ -28,7 +28,11 @@ KMAP_D(15) KM_UML_USERCOPY,
28KMAP_D(16) KM_IRQ_PTE, 28KMAP_D(16) KM_IRQ_PTE,
29KMAP_D(17) KM_NMI, 29KMAP_D(17) KM_NMI,
30KMAP_D(18) KM_NMI_PTE, 30KMAP_D(18) KM_NMI_PTE,
31KMAP_D(19) KM_TYPE_NR 31KMAP_D(19) KM_KDB,
32/*
33 * Remember to update debug_kmap_atomic() when adding new kmap types!
34 */
35KMAP_D(20) KM_TYPE_NR
32}; 36};
33 37
34#undef KMAP_D 38#undef KMAP_D
diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index fc218444e315..c8a5d68541d7 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -52,23 +52,4 @@ typedef struct
52#define __local_add(i,l) local_set((l), local_read(l) + (i)) 52#define __local_add(i,l) local_set((l), local_read(l) + (i))
53#define __local_sub(i,l) local_set((l), local_read(l) - (i)) 53#define __local_sub(i,l) local_set((l), local_read(l) - (i))
54 54
55/* Use these for per-cpu local_t variables: on some archs they are
56 * much more efficient than these naive implementations. Note they take
57 * a variable (eg. mystruct.foo), not an address.
58 */
59#define cpu_local_read(l) local_read(&__get_cpu_var(l))
60#define cpu_local_set(l, i) local_set(&__get_cpu_var(l), (i))
61#define cpu_local_inc(l) local_inc(&__get_cpu_var(l))
62#define cpu_local_dec(l) local_dec(&__get_cpu_var(l))
63#define cpu_local_add(i, l) local_add((i), &__get_cpu_var(l))
64#define cpu_local_sub(i, l) local_sub((i), &__get_cpu_var(l))
65
66/* Non-atomic increments, ie. preemption disabled and won't be touched
67 * in interrupt, etc. Some archs can optimize this case well.
68 */
69#define __cpu_local_inc(l) __local_inc(&__get_cpu_var(l))
70#define __cpu_local_dec(l) __local_dec(&__get_cpu_var(l))
71#define __cpu_local_add(i, l) __local_add((i), &__get_cpu_var(l))
72#define __cpu_local_sub(i, l) __local_sub((i), &__get_cpu_var(l))
73
74#endif /* _ASM_GENERIC_LOCAL_H */ 55#endif /* _ASM_GENERIC_LOCAL_H */
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index 37b3706226e7..1437b7da09b2 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -6,9 +6,6 @@
6 6
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8 8
9/* note pci_set_dma_mask isn't here, since it's a public function
10 * exported from drivers/pci, use dma_supported instead */
11
12static inline int 9static inline int
13pci_dma_supported(struct pci_dev *hwdev, u64 mask) 10pci_dma_supported(struct pci_dev *hwdev, u64 mask)
14{ 11{
@@ -104,4 +101,16 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
104 return dma_mapping_error(&pdev->dev, dma_addr); 101 return dma_mapping_error(&pdev->dev, dma_addr);
105} 102}
106 103
104#ifdef CONFIG_PCI
105static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
106{
107 return dma_set_mask(&dev->dev, mask);
108}
109
110static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
111{
112 return dma_set_coherent_mask(&dev->dev, mask);
113}
114#endif
115
107#endif 116#endif
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 1202a1550e91..b5043a9890d8 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -41,7 +41,11 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
41 * Only S390 provides its own means of moving the pointer. 41 * Only S390 provides its own means of moving the pointer.
42 */ 42 */
43#ifndef SHIFT_PERCPU_PTR 43#ifndef SHIFT_PERCPU_PTR
44#define SHIFT_PERCPU_PTR(__p, __offset) RELOC_HIDE((__p), (__offset)) 44/* Weird cast keeps both GCC and sparse happy. */
45#define SHIFT_PERCPU_PTR(__p, __offset) ({ \
46 __verify_pcpu_ptr((__p)); \
47 RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)); \
48})
45#endif 49#endif
46 50
47/* 51/*
@@ -50,11 +54,11 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
50 * offset. 54 * offset.
51 */ 55 */
52#define per_cpu(var, cpu) \ 56#define per_cpu(var, cpu) \
53 (*SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu))) 57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
54#define __get_cpu_var(var) \ 58#define __get_cpu_var(var) \
55 (*SHIFT_PERCPU_PTR(&per_cpu_var(var), my_cpu_offset)) 59 (*SHIFT_PERCPU_PTR(&(var), my_cpu_offset))
56#define __raw_get_cpu_var(var) \ 60#define __raw_get_cpu_var(var) \
57 (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) 61 (*SHIFT_PERCPU_PTR(&(var), __my_cpu_offset))
58 62
59#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) 63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset)
60#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) 64#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
@@ -66,9 +70,9 @@ extern void setup_per_cpu_areas(void);
66 70
67#else /* ! SMP */ 71#else /* ! SMP */
68 72
69#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var))) 73#define per_cpu(var, cpu) (*((void)(cpu), &(var)))
70#define __get_cpu_var(var) per_cpu_var(var) 74#define __get_cpu_var(var) (var)
71#define __raw_get_cpu_var(var) per_cpu_var(var) 75#define __raw_get_cpu_var(var) (var)
72#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) 76#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
73#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) 77#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr)
74 78
diff --git a/include/asm-generic/scatterlist.h b/include/asm-generic/scatterlist.h
index 8b9454496a7c..5de07355fad4 100644
--- a/include/asm-generic/scatterlist.h
+++ b/include/asm-generic/scatterlist.h
@@ -11,7 +11,9 @@ struct scatterlist {
11 unsigned int offset; 11 unsigned int offset;
12 unsigned int length; 12 unsigned int length;
13 dma_addr_t dma_address; 13 dma_addr_t dma_address;
14#ifdef CONFIG_NEED_SG_DMA_LENGTH
14 unsigned int dma_length; 15 unsigned int dma_length;
16#endif
15}; 17};
16 18
17/* 19/*
@@ -22,22 +24,11 @@ struct scatterlist {
22 * is 0. 24 * is 0.
23 */ 25 */
24#define sg_dma_address(sg) ((sg)->dma_address) 26#define sg_dma_address(sg) ((sg)->dma_address)
25#ifndef sg_dma_len 27
26/* 28#ifdef CONFIG_NEED_SG_DMA_LENGTH
27 * Normally, you have an iommu on 64 bit machines, but not on 32 bit
28 * machines. Architectures that are differnt should override this.
29 */
30#if __BITS_PER_LONG == 64
31#define sg_dma_len(sg) ((sg)->dma_length) 29#define sg_dma_len(sg) ((sg)->dma_length)
32#else 30#else
33#define sg_dma_len(sg) ((sg)->length) 31#define sg_dma_len(sg) ((sg)->length)
34#endif /* 64 bit */
35#endif /* sg_dma_len */
36
37#ifndef ISA_DMA_THRESHOLD
38#define ISA_DMA_THRESHOLD (~0UL)
39#endif 32#endif
40 33
41#define ARCH_HAS_SG_CHAIN
42
43#endif /* __ASM_GENERIC_SCATTERLIST_H */ 34#endif /* __ASM_GENERIC_SCATTERLIST_H */
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index 510df36dd5d4..fd60700503c8 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -34,6 +34,9 @@
34#ifndef cpu_to_node 34#ifndef cpu_to_node
35#define cpu_to_node(cpu) ((void)(cpu),0) 35#define cpu_to_node(cpu) ((void)(cpu),0)
36#endif 36#endif
37#ifndef cpu_to_mem
38#define cpu_to_mem(cpu) ((void)(cpu),0)
39#endif
37#ifndef parent_node 40#ifndef parent_node
38#define parent_node(node) ((void)(node),0) 41#define parent_node(node) ((void)(node),0)
39#endif 42#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index ea3660526e91..030a954ed292 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -63,6 +63,12 @@
63/* Align . to a 8 byte boundary equals to maximum function alignment. */ 63/* Align . to a 8 byte boundary equals to maximum function alignment. */
64#define ALIGN_FUNCTION() . = ALIGN(8) 64#define ALIGN_FUNCTION() . = ALIGN(8)
65 65
66/*
67 * Align to a 32 byte boundary equal to the
68 * alignment gcc 4.5 uses for a struct
69 */
70#define STRUCT_ALIGN() . = ALIGN(32)
71
66/* The actual configuration determine if the init/exit sections 72/* The actual configuration determine if the init/exit sections
67 * are handled as text/data or they can be discarded (which 73 * are handled as text/data or they can be discarded (which
68 * often happens at runtime) 74 * often happens at runtime)
@@ -166,7 +172,11 @@
166 LIKELY_PROFILE() \ 172 LIKELY_PROFILE() \
167 BRANCH_PROFILE() \ 173 BRANCH_PROFILE() \
168 TRACE_PRINTKS() \ 174 TRACE_PRINTKS() \
175 \
176 STRUCT_ALIGN(); \
169 FTRACE_EVENTS() \ 177 FTRACE_EVENTS() \
178 \
179 STRUCT_ALIGN(); \
170 TRACE_SYSCALLS() 180 TRACE_SYSCALLS()
171 181
172/* 182/*
@@ -247,10 +257,10 @@
247 } \ 257 } \
248 \ 258 \
249 /* RapidIO route ops */ \ 259 /* RapidIO route ops */ \
250 .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \ 260 .rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \
251 VMLINUX_SYMBOL(__start_rio_route_ops) = .; \ 261 VMLINUX_SYMBOL(__start_rio_switch_ops) = .; \
252 *(.rio_route_ops) \ 262 *(.rio_switch_ops) \
253 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \ 263 VMLINUX_SYMBOL(__end_rio_switch_ops) = .; \
254 } \ 264 } \
255 \ 265 \
256 TRACEDATA \ 266 TRACEDATA \
@@ -435,7 +445,7 @@
435 */ 445 */
436#define INIT_TASK_DATA_SECTION(align) \ 446#define INIT_TASK_DATA_SECTION(align) \
437 . = ALIGN(align); \ 447 . = ALIGN(align); \
438 .data..init_task : { \ 448 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
439 INIT_TASK_DATA(align) \ 449 INIT_TASK_DATA(align) \
440 } 450 }
441 451
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index fc0d575c71e0..59c3e5bd2c06 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -103,6 +103,23 @@ struct blkcipher_walk {
103 unsigned int blocksize; 103 unsigned int blocksize;
104}; 104};
105 105
106struct ablkcipher_walk {
107 struct {
108 struct page *page;
109 unsigned int offset;
110 } src, dst;
111
112 struct scatter_walk in;
113 unsigned int nbytes;
114 struct scatter_walk out;
115 unsigned int total;
116 struct list_head buffers;
117 u8 *iv_buffer;
118 u8 *iv;
119 int flags;
120 unsigned int blocksize;
121};
122
106extern const struct crypto_type crypto_ablkcipher_type; 123extern const struct crypto_type crypto_ablkcipher_type;
107extern const struct crypto_type crypto_aead_type; 124extern const struct crypto_type crypto_aead_type;
108extern const struct crypto_type crypto_blkcipher_type; 125extern const struct crypto_type crypto_blkcipher_type;
@@ -173,6 +190,12 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc,
173 struct blkcipher_walk *walk, 190 struct blkcipher_walk *walk,
174 unsigned int blocksize); 191 unsigned int blocksize);
175 192
193int ablkcipher_walk_done(struct ablkcipher_request *req,
194 struct ablkcipher_walk *walk, int err);
195int ablkcipher_walk_phys(struct ablkcipher_request *req,
196 struct ablkcipher_walk *walk);
197void __ablkcipher_walk_complete(struct ablkcipher_walk *walk);
198
176static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) 199static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
177{ 200{
178 return PTR_ALIGN(crypto_tfm_ctx(tfm), 201 return PTR_ALIGN(crypto_tfm_ctx(tfm),
@@ -283,6 +306,23 @@ static inline void blkcipher_walk_init(struct blkcipher_walk *walk,
283 walk->total = nbytes; 306 walk->total = nbytes;
284} 307}
285 308
309static inline void ablkcipher_walk_init(struct ablkcipher_walk *walk,
310 struct scatterlist *dst,
311 struct scatterlist *src,
312 unsigned int nbytes)
313{
314 walk->in.sg = src;
315 walk->out.sg = dst;
316 walk->total = nbytes;
317 INIT_LIST_HEAD(&walk->buffers);
318}
319
320static inline void ablkcipher_walk_complete(struct ablkcipher_walk *walk)
321{
322 if (unlikely(!list_empty(&walk->buffers)))
323 __ablkcipher_walk_complete(walk);
324}
325
286static inline struct crypto_async_request *crypto_get_backlog( 326static inline struct crypto_async_request *crypto_get_backlog(
287 struct crypto_queue *queue) 327 struct crypto_queue *queue)
288{ 328{
diff --git a/include/crypto/md5.h b/include/crypto/md5.h
new file mode 100644
index 000000000000..65f299b08b0d
--- /dev/null
+++ b/include/crypto/md5.h
@@ -0,0 +1,17 @@
1#ifndef _CRYPTO_MD5_H
2#define _CRYPTO_MD5_H
3
4#include <linux/types.h>
5
6#define MD5_DIGEST_SIZE 16
7#define MD5_HMAC_BLOCK_SIZE 64
8#define MD5_BLOCK_WORDS 16
9#define MD5_HASH_WORDS 4
10
11struct md5_state {
12 u32 hash[MD5_HASH_WORDS];
13 u32 block[MD5_BLOCK_WORDS];
14 u64 byte_count;
15};
16
17#endif
diff --git a/include/crypto/pcrypt.h b/include/crypto/pcrypt.h
new file mode 100644
index 000000000000..d7d8bd8c6edc
--- /dev/null
+++ b/include/crypto/pcrypt.h
@@ -0,0 +1,51 @@
1/*
2 * pcrypt - Parallel crypto engine.
3 *
4 * Copyright (C) 2009 secunet Security Networks AG
5 * Copyright (C) 2009 Steffen Klassert <steffen.klassert@secunet.com>
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#ifndef _CRYPTO_PCRYPT_H
22#define _CRYPTO_PCRYPT_H
23
24#include <linux/crypto.h>
25#include <linux/kernel.h>
26#include <linux/padata.h>
27
28struct pcrypt_request {
29 struct padata_priv padata;
30 void *data;
31 void *__ctx[] CRYPTO_MINALIGN_ATTR;
32};
33
34static inline void *pcrypt_request_ctx(struct pcrypt_request *req)
35{
36 return req->__ctx;
37}
38
39static inline
40struct padata_priv *pcrypt_request_padata(struct pcrypt_request *req)
41{
42 return &req->padata;
43}
44
45static inline
46struct pcrypt_request *pcrypt_padata_request(struct padata_priv *padata)
47{
48 return container_of(padata, struct pcrypt_request, padata);
49}
50
51#endif
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index ffac157fb5b2..c1b987158dfa 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -55,6 +55,7 @@
55#include <linux/mm.h> 55#include <linux/mm.h>
56#include <linux/cdev.h> 56#include <linux/cdev.h>
57#include <linux/mutex.h> 57#include <linux/mutex.h>
58#include <linux/slab.h>
58#if defined(__alpha__) || defined(__powerpc__) 59#if defined(__alpha__) || defined(__powerpc__)
59#include <asm/pgtable.h> /* For pte_wrprotect */ 60#include <asm/pgtable.h> /* For pte_wrprotect */
60#endif 61#endif
@@ -801,6 +802,7 @@ struct drm_driver {
801 */ 802 */
802 int (*gem_init_object) (struct drm_gem_object *obj); 803 int (*gem_init_object) (struct drm_gem_object *obj);
803 void (*gem_free_object) (struct drm_gem_object *obj); 804 void (*gem_free_object) (struct drm_gem_object *obj);
805 void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
804 806
805 /* vga arb irq handler */ 807 /* vga arb irq handler */
806 void (*vgaarb_irq)(struct drm_device *dev, bool state); 808 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -1426,9 +1428,13 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1426/* Graphics Execution Manager library functions (drm_gem.c) */ 1428/* Graphics Execution Manager library functions (drm_gem.c) */
1427int drm_gem_init(struct drm_device *dev); 1429int drm_gem_init(struct drm_device *dev);
1428void drm_gem_destroy(struct drm_device *dev); 1430void drm_gem_destroy(struct drm_device *dev);
1431void drm_gem_object_release(struct drm_gem_object *obj);
1429void drm_gem_object_free(struct kref *kref); 1432void drm_gem_object_free(struct kref *kref);
1433void drm_gem_object_free_unlocked(struct kref *kref);
1430struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1434struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1431 size_t size); 1435 size_t size);
1436int drm_gem_object_init(struct drm_device *dev,
1437 struct drm_gem_object *obj, size_t size);
1432void drm_gem_object_handle_free(struct kref *kref); 1438void drm_gem_object_handle_free(struct kref *kref);
1433void drm_gem_vm_open(struct vm_area_struct *vma); 1439void drm_gem_vm_open(struct vm_area_struct *vma);
1434void drm_gem_vm_close(struct vm_area_struct *vma); 1440void drm_gem_vm_close(struct vm_area_struct *vma);
@@ -1443,10 +1449,15 @@ drm_gem_object_reference(struct drm_gem_object *obj)
1443static inline void 1449static inline void
1444drm_gem_object_unreference(struct drm_gem_object *obj) 1450drm_gem_object_unreference(struct drm_gem_object *obj)
1445{ 1451{
1446 if (obj == NULL) 1452 if (obj != NULL)
1447 return; 1453 kref_put(&obj->refcount, drm_gem_object_free);
1454}
1448 1455
1449 kref_put(&obj->refcount, drm_gem_object_free); 1456static inline void
1457drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1458{
1459 if (obj != NULL)
1460 kref_put(&obj->refcount, drm_gem_object_free_unlocked);
1450} 1461}
1451 1462
1452int drm_gem_handle_create(struct drm_file *file_priv, 1463int drm_gem_handle_create(struct drm_file *file_priv,
@@ -1475,6 +1486,21 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1475 drm_gem_object_unreference(obj); 1486 drm_gem_object_unreference(obj);
1476} 1487}
1477 1488
1489static inline void
1490drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
1491{
1492 if (obj == NULL)
1493 return;
1494
1495 /*
1496 * Must bump handle count first as this may be the last
1497 * ref, in which case the object would disappear before we
1498 * checked for a name
1499 */
1500 kref_put(&obj->handlecount, drm_gem_object_handle_free);
1501 drm_gem_object_unreference_unlocked(obj);
1502}
1503
1478struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, 1504struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
1479 struct drm_file *filp, 1505 struct drm_file *filp,
1480 u32 handle); 1506 u32 handle);
@@ -1523,39 +1549,7 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1523{ 1549{
1524} 1550}
1525 1551
1526 1552#include "drm_mem_util.h"
1527static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1528{
1529 if (size != 0 && nmemb > ULONG_MAX / size)
1530 return NULL;
1531
1532 if (size * nmemb <= PAGE_SIZE)
1533 return kcalloc(nmemb, size, GFP_KERNEL);
1534
1535 return __vmalloc(size * nmemb,
1536 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
1537}
1538
1539/* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */
1540static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
1541{
1542 if (size != 0 && nmemb > ULONG_MAX / size)
1543 return NULL;
1544
1545 if (size * nmemb <= PAGE_SIZE)
1546 return kmalloc(nmemb * size, GFP_KERNEL);
1547
1548 return __vmalloc(size * nmemb,
1549 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
1550}
1551
1552static __inline void drm_free_large(void *ptr)
1553{
1554 if (!is_vmalloc_addr(ptr))
1555 return kfree(ptr);
1556
1557 vfree(ptr);
1558}
1559/*@}*/ 1553/*@}*/
1560 1554
1561#endif /* __KERNEL__ */ 1555#endif /* __KERNEL__ */
diff --git a/include/drm/drm_buffer.h b/include/drm/drm_buffer.h
new file mode 100644
index 000000000000..322dbff3f861
--- /dev/null
+++ b/include/drm/drm_buffer.h
@@ -0,0 +1,148 @@
1/**************************************************************************
2 *
3 * Copyright 2010 Pauli Nieminen.
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 * Multipart buffer for coping data which is larger than the page size.
30 *
31 * Authors:
32 * Pauli Nieminen <suokkos-at-gmail-dot-com>
33 */
34
35#ifndef _DRM_BUFFER_H_
36#define _DRM_BUFFER_H_
37
38#include "drmP.h"
39
40struct drm_buffer {
41 int iterator;
42 int size;
43 char *data[];
44};
45
46
47/**
48 * Return the index of page that buffer is currently pointing at.
49 */
50static inline int drm_buffer_page(struct drm_buffer *buf)
51{
52 return buf->iterator / PAGE_SIZE;
53}
54/**
55 * Return the index of the current byte in the page
56 */
57static inline int drm_buffer_index(struct drm_buffer *buf)
58{
59 return buf->iterator & (PAGE_SIZE - 1);
60}
61/**
62 * Return number of bytes that is left to process
63 */
64static inline int drm_buffer_unprocessed(struct drm_buffer *buf)
65{
66 return buf->size - buf->iterator;
67}
68
69/**
70 * Advance the buffer iterator number of bytes that is given.
71 */
72static inline void drm_buffer_advance(struct drm_buffer *buf, int bytes)
73{
74 buf->iterator += bytes;
75}
76
77/**
78 * Allocate the drm buffer object.
79 *
80 * buf: A pointer to a pointer where the object is stored.
81 * size: The number of bytes to allocate.
82 */
83extern int drm_buffer_alloc(struct drm_buffer **buf, int size);
84
85/**
86 * Copy the user data to the begin of the buffer and reset the processing
87 * iterator.
88 *
89 * user_data: A pointer the data that is copied to the buffer.
90 * size: The Number of bytes to copy.
91 */
92extern int drm_buffer_copy_from_user(struct drm_buffer *buf,
93 void __user *user_data, int size);
94
95/**
96 * Free the drm buffer object
97 */
98extern void drm_buffer_free(struct drm_buffer *buf);
99
100/**
101 * Read an object from buffer that may be split to multiple parts. If object
102 * is not split function just returns the pointer to object in buffer. But in
103 * case of split object data is copied to given stack object that is suplied
104 * by caller.
105 *
106 * The processing location of the buffer is also advanced to the next byte
107 * after the object.
108 *
109 * objsize: The size of the objet in bytes.
110 * stack_obj: A pointer to a memory location where object can be copied.
111 */
112extern void *drm_buffer_read_object(struct drm_buffer *buf,
113 int objsize, void *stack_obj);
114
115/**
116 * Returns the pointer to the dword which is offset number of elements from the
117 * current processing location.
118 *
119 * Caller must make sure that dword is not split in the buffer. This
120 * requirement is easily met if all the sizes of objects in buffer are
121 * multiples of dword and PAGE_SIZE is multiple dword.
122 *
123 * Call to this function doesn't change the processing location.
124 *
125 * offset: The index of the dword relative to the internat iterator.
126 */
127static inline void *drm_buffer_pointer_to_dword(struct drm_buffer *buffer,
128 int offset)
129{
130 int iter = buffer->iterator + offset * 4;
131 return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)];
132}
133/**
134 * Returns the pointer to the dword which is offset number of elements from
135 * the current processing location.
136 *
137 * Call to this function doesn't change the processing location.
138 *
139 * offset: The index of the byte relative to the internat iterator.
140 */
141static inline void *drm_buffer_pointer_to_byte(struct drm_buffer *buffer,
142 int offset)
143{
144 int iter = buffer->iterator + offset;
145 return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)];
146}
147
148#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index fdf43abc36db..93a1a31b9c2d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -31,6 +31,7 @@
31#include <linux/idr.h> 31#include <linux/idr.h>
32 32
33#include <linux/fb.h> 33#include <linux/fb.h>
34#include <linux/slow-work.h>
34 35
35struct drm_device; 36struct drm_device;
36struct drm_mode_set; 37struct drm_mode_set;
@@ -271,8 +272,6 @@ struct drm_framebuffer {
271 unsigned int depth; 272 unsigned int depth;
272 int bits_per_pixel; 273 int bits_per_pixel;
273 int flags; 274 int flags;
274 struct fb_info *fbdev;
275 u32 pseudo_palette[17];
276 struct list_head filp_head; 275 struct list_head filp_head;
277 /* if you are using the helper */ 276 /* if you are using the helper */
278 void *helper_private; 277 void *helper_private;
@@ -369,9 +368,6 @@ struct drm_crtc_funcs {
369 * @enabled: is this CRTC enabled? 368 * @enabled: is this CRTC enabled?
370 * @x: x position on screen 369 * @x: x position on screen
371 * @y: y position on screen 370 * @y: y position on screen
372 * @desired_mode: new desired mode
373 * @desired_x: desired x for desired_mode
374 * @desired_y: desired y for desired_mode
375 * @funcs: CRTC control functions 371 * @funcs: CRTC control functions
376 * 372 *
377 * Each CRTC may have one or more connectors associated with it. This structure 373 * Each CRTC may have one or more connectors associated with it. This structure
@@ -391,8 +387,6 @@ struct drm_crtc {
391 struct drm_display_mode mode; 387 struct drm_display_mode mode;
392 388
393 int x, y; 389 int x, y;
394 struct drm_display_mode *desired_mode;
395 int desired_x, desired_y;
396 const struct drm_crtc_funcs *funcs; 390 const struct drm_crtc_funcs *funcs;
397 391
398 /* CRTC gamma size for reporting to userspace */ 392 /* CRTC gamma size for reporting to userspace */
@@ -467,6 +461,15 @@ enum drm_connector_force {
467 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ 461 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
468}; 462};
469 463
464/* should we poll this connector for connects and disconnects */
465/* hot plug detectable */
466#define DRM_CONNECTOR_POLL_HPD (1 << 0)
467/* poll for connections */
468#define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
469/* can cleanly poll for disconnections without flickering the screen */
470/* DACs should rarely do this without a lot of testing */
471#define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
472
470/** 473/**
471 * drm_connector - central DRM connector control structure 474 * drm_connector - central DRM connector control structure
472 * @crtc: CRTC this connector is currently connected to, NULL if none 475 * @crtc: CRTC this connector is currently connected to, NULL if none
@@ -511,6 +514,8 @@ struct drm_connector {
511 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; 514 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
512 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; 515 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
513 516
517 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
518
514 /* requested DPMS state */ 519 /* requested DPMS state */
515 int dpms; 520 int dpms;
516 521
@@ -521,7 +526,6 @@ struct drm_connector {
521 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 526 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
522 uint32_t force_encoder_id; 527 uint32_t force_encoder_id;
523 struct drm_encoder *encoder; /* currently active encoder */ 528 struct drm_encoder *encoder; /* currently active encoder */
524 void *fb_helper_private;
525}; 529};
526 530
527/** 531/**
@@ -548,16 +552,10 @@ struct drm_mode_set {
548 552
549/** 553/**
550 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout 554 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
551 * @resize: adjust CRTCs as necessary for the proposed layout
552 *
553 * Currently only a resize hook is available. DRM will call back into the
554 * driver with a new screen width and height. If the driver can't support
555 * the proposed size, it can return false. Otherwise it should adjust
556 * the CRTC<->connector mappings as needed and update its view of the screen.
557 */ 555 */
558struct drm_mode_config_funcs { 556struct drm_mode_config_funcs {
559 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); 557 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
560 int (*fb_changed)(struct drm_device *dev); 558 void (*output_poll_changed)(struct drm_device *dev);
561}; 559};
562 560
563struct drm_mode_group { 561struct drm_mode_group {
@@ -590,14 +588,15 @@ struct drm_mode_config {
590 588
591 struct list_head property_list; 589 struct list_head property_list;
592 590
593 /* in-kernel framebuffers - hung of filp_head in drm_framebuffer */
594 struct list_head fb_kernel_list;
595
596 int min_width, min_height; 591 int min_width, min_height;
597 int max_width, max_height; 592 int max_width, max_height;
598 struct drm_mode_config_funcs *funcs; 593 struct drm_mode_config_funcs *funcs;
599 resource_size_t fb_base; 594 resource_size_t fb_base;
600 595
596 /* output poll support */
597 bool poll_enabled;
598 struct delayed_slow_work output_poll_slow_work;
599
601 /* pointers to standard properties */ 600 /* pointers to standard properties */
602 struct list_head property_blob_list; 601 struct list_head property_blob_list;
603 struct drm_property *edid_property; 602 struct drm_property *edid_property;
@@ -666,8 +665,6 @@ extern void drm_fb_release(struct drm_file *file_priv);
666extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 665extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
667extern struct edid *drm_get_edid(struct drm_connector *connector, 666extern struct edid *drm_get_edid(struct drm_connector *connector,
668 struct i2c_adapter *adapter); 667 struct i2c_adapter *adapter);
669extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
670 unsigned char *buf, int len);
671extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 668extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
672extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 669extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
673extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 670extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
@@ -799,6 +796,14 @@ extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
799extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, 796extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
800 int hdisplay, int vdisplay, int vrefresh, 797 int hdisplay, int vdisplay, int vrefresh,
801 bool interlaced, int margins); 798 bool interlaced, int margins);
799extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
800 int hdisplay, int vdisplay, int vrefresh,
801 bool interlaced, int margins, int GTF_M,
802 int GTF_2C, int GTF_K, int GTF_2J);
802extern int drm_add_modes_noedid(struct drm_connector *connector, 803extern int drm_add_modes_noedid(struct drm_connector *connector,
803 int hdisplay, int vdisplay); 804 int hdisplay, int vdisplay);
805
806extern bool drm_edid_is_valid(struct edid *edid);
807struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
808 int hsize, int vsize, int fresh);
804#endif /* __DRM_CRTC_H__ */ 809#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b29e20168b5f..1121f7799c6f 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -39,7 +39,6 @@
39 39
40#include <linux/fb.h> 40#include <linux/fb.h>
41 41
42#include "drm_fb_helper.h"
43struct drm_crtc_helper_funcs { 42struct drm_crtc_helper_funcs {
44 /* 43 /*
45 * Control power levels on the CRTC. If the mode passed in is 44 * Control power levels on the CRTC. If the mode passed in is
@@ -96,8 +95,6 @@ struct drm_connector_helper_funcs {
96 95
97extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 96extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
98extern void drm_helper_disable_unused_functions(struct drm_device *dev); 97extern void drm_helper_disable_unused_functions(struct drm_device *dev);
99extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
100extern bool drm_helper_initial_config(struct drm_device *dev);
101extern int drm_crtc_helper_set_config(struct drm_mode_set *set); 98extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
102extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 99extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
103 struct drm_display_mode *mode, 100 struct drm_display_mode *mode,
@@ -123,12 +120,17 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder,
123 encoder->helper_private = (void *)funcs; 120 encoder->helper_private = (void *)funcs;
124} 121}
125 122
126static inline int drm_connector_helper_add(struct drm_connector *connector, 123static inline void drm_connector_helper_add(struct drm_connector *connector,
127 const struct drm_connector_helper_funcs *funcs) 124 const struct drm_connector_helper_funcs *funcs)
128{ 125{
129 connector->helper_private = (void *)funcs; 126 connector->helper_private = (void *)funcs;
130 return drm_fb_helper_add_connector(connector);
131} 127}
132 128
133extern int drm_helper_resume_force_mode(struct drm_device *dev); 129extern int drm_helper_resume_force_mode(struct drm_device *dev);
130extern void drm_kms_helper_poll_init(struct drm_device *dev);
131extern void drm_kms_helper_poll_fini(struct drm_device *dev);
132extern void drm_helper_hpd_irq_event(struct drm_device *dev);
133
134extern void drm_kms_helper_poll_disable(struct drm_device *dev);
135extern void drm_kms_helper_poll_enable(struct drm_device *dev);
134#endif 136#endif
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index d33c3e038606..39e2cc5c7e66 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -120,7 +120,7 @@ struct detailed_non_pixel {
120 struct detailed_data_string str; 120 struct detailed_data_string str;
121 struct detailed_data_monitor_range range; 121 struct detailed_data_monitor_range range;
122 struct detailed_data_wpindex color; 122 struct detailed_data_wpindex color;
123 struct std_timing timings[5]; 123 struct std_timing timings[6];
124 struct cvt_timing cvt[4]; 124 struct cvt_timing cvt[4];
125 } data; 125 } data;
126} __attribute__((packed)); 126} __attribute__((packed));
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 58c892a2cbfa..f0a6afc47e76 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -30,17 +30,12 @@
30#ifndef DRM_FB_HELPER_H 30#ifndef DRM_FB_HELPER_H
31#define DRM_FB_HELPER_H 31#define DRM_FB_HELPER_H
32 32
33struct drm_fb_helper;
34
33struct drm_fb_helper_crtc { 35struct drm_fb_helper_crtc {
34 uint32_t crtc_id; 36 uint32_t crtc_id;
35 struct drm_mode_set mode_set; 37 struct drm_mode_set mode_set;
36}; 38 struct drm_display_mode *desired_mode;
37
38
39struct drm_fb_helper_funcs {
40 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
41 u16 blue, int regno);
42 void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
43 u16 *blue, int regno);
44}; 39};
45 40
46/* mode specified on the command line */ 41/* mode specified on the command line */
@@ -57,8 +52,28 @@ struct drm_fb_helper_cmdline_mode {
57 bool margins; 52 bool margins;
58}; 53};
59 54
55struct drm_fb_helper_surface_size {
56 u32 fb_width;
57 u32 fb_height;
58 u32 surface_width;
59 u32 surface_height;
60 u32 surface_bpp;
61 u32 surface_depth;
62};
63
64struct drm_fb_helper_funcs {
65 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
66 u16 blue, int regno);
67 void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
68 u16 *blue, int regno);
69
70 int (*fb_probe)(struct drm_fb_helper *helper,
71 struct drm_fb_helper_surface_size *sizes);
72};
73
60struct drm_fb_helper_connector { 74struct drm_fb_helper_connector {
61 struct drm_fb_helper_cmdline_mode cmdline_mode; 75 struct drm_fb_helper_cmdline_mode cmdline_mode;
76 struct drm_connector *connector;
62}; 77};
63 78
64struct drm_fb_helper { 79struct drm_fb_helper {
@@ -67,24 +82,26 @@ struct drm_fb_helper {
67 struct drm_display_mode *mode; 82 struct drm_display_mode *mode;
68 int crtc_count; 83 int crtc_count;
69 struct drm_fb_helper_crtc *crtc_info; 84 struct drm_fb_helper_crtc *crtc_info;
85 int connector_count;
86 struct drm_fb_helper_connector **connector_info;
70 struct drm_fb_helper_funcs *funcs; 87 struct drm_fb_helper_funcs *funcs;
71 int conn_limit; 88 int conn_limit;
89 struct fb_info *fbdev;
90 u32 pseudo_palette[17];
72 struct list_head kernel_fb_list; 91 struct list_head kernel_fb_list;
92
93 /* we got a hotplug but fbdev wasn't running the console
94 delay until next set_par */
95 bool delayed_hotplug;
73}; 96};
74 97
75int drm_fb_helper_single_fb_probe(struct drm_device *dev, 98int drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper,
76 int preferred_bpp, 99 int preferred_bpp);
77 int (*fb_create)(struct drm_device *dev, 100
78 uint32_t fb_width, 101int drm_fb_helper_init(struct drm_device *dev,
79 uint32_t fb_height, 102 struct drm_fb_helper *helper, int crtc_count,
80 uint32_t surface_width, 103 int max_conn);
81 uint32_t surface_height, 104void drm_fb_helper_fini(struct drm_fb_helper *helper);
82 uint32_t surface_depth,
83 uint32_t surface_bpp,
84 struct drm_framebuffer **fb_ptr));
85int drm_fb_helper_init_crtc_count(struct drm_fb_helper *helper, int crtc_count,
86 int max_conn);
87void drm_fb_helper_free(struct drm_fb_helper *helper);
88int drm_fb_helper_blank(int blank, struct fb_info *info); 105int drm_fb_helper_blank(int blank, struct fb_info *info);
89int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, 106int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
90 struct fb_info *info); 107 struct fb_info *info);
@@ -99,13 +116,15 @@ int drm_fb_helper_setcolreg(unsigned regno,
99 struct fb_info *info); 116 struct fb_info *info);
100 117
101void drm_fb_helper_restore(void); 118void drm_fb_helper_restore(void);
102void drm_fb_helper_fill_var(struct fb_info *info, struct drm_framebuffer *fb, 119void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
103 uint32_t fb_width, uint32_t fb_height); 120 uint32_t fb_width, uint32_t fb_height);
104void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 121void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
105 uint32_t depth); 122 uint32_t depth);
106 123
107int drm_fb_helper_add_connector(struct drm_connector *connector);
108int drm_fb_helper_parse_command_line(struct drm_device *dev);
109int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 124int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
110 125
126bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
127bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
128int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
129
111#endif 130#endif
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
new file mode 100644
index 000000000000..4a08a664ff1f
--- /dev/null
+++ b/include/drm/drm_fixed.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2009 Red Hat Inc.
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 shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Dave Airlie
23 */
24#ifndef DRM_FIXED_H
25#define DRM_FIXED_H
26
27typedef union dfixed {
28 u32 full;
29} fixed20_12;
30
31
32#define dfixed_const(A) (u32)(((A) << 12))/* + ((B + 0.000122)*4096)) */
33#define dfixed_const_half(A) (u32)(((A) << 12) + 2048)
34#define dfixed_const_666(A) (u32)(((A) << 12) + 2731)
35#define dfixed_const_8(A) (u32)(((A) << 12) + 3277)
36#define dfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12)
37#define dfixed_init(A) { .full = dfixed_const((A)) }
38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
39#define dfixed_trunc(A) ((A).full >> 12)
40
41static inline u32 dfixed_floor(fixed20_12 A)
42{
43 u32 non_frac = dfixed_trunc(A);
44
45 return dfixed_const(non_frac);
46}
47
48static inline u32 dfixed_ceil(fixed20_12 A)
49{
50 u32 non_frac = dfixed_trunc(A);
51
52 if (A.full > dfixed_const(non_frac))
53 return dfixed_const(non_frac + 1);
54 else
55 return dfixed_const(non_frac);
56}
57
58static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
59{
60 u64 tmp = ((u64)A.full << 13);
61
62 do_div(tmp, B.full);
63 tmp += 1;
64 tmp /= 2;
65 return lower_32_bits(tmp);
66}
67#endif
diff --git a/include/drm/drm_mem_util.h b/include/drm/drm_mem_util.h
new file mode 100644
index 000000000000..6bd325fedc87
--- /dev/null
+++ b/include/drm/drm_mem_util.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright © 2008 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * Authors:
24 * Jesse Barnes <jbarnes@virtuousgeek.org>
25 *
26 */
27#ifndef _DRM_MEM_UTIL_H_
28#define _DRM_MEM_UTIL_H_
29
30#include <linux/vmalloc.h>
31
32static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
33{
34 if (size != 0 && nmemb > ULONG_MAX / size)
35 return NULL;
36
37 if (size * nmemb <= PAGE_SIZE)
38 return kcalloc(nmemb, size, GFP_KERNEL);
39
40 return __vmalloc(size * nmemb,
41 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
42}
43
44/* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */
45static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
46{
47 if (size != 0 && nmemb > ULONG_MAX / size)
48 return NULL;
49
50 if (size * nmemb <= PAGE_SIZE)
51 return kmalloc(nmemb * size, GFP_KERNEL);
52
53 return __vmalloc(size * nmemb,
54 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
55}
56
57static __inline void drm_free_large(void *ptr)
58{
59 if (!is_vmalloc_addr(ptr))
60 return kfree(ptr);
61
62 vfree(ptr);
63}
64
65#endif
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index bc4fdf27bd2e..c5ba1636613c 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -85,7 +85,7 @@ struct drm_mode_modeinfo {
85 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; 85 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
86 __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan; 86 __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
87 87
88 __u32 vrefresh; /* vertical refresh * 1000 */ 88 __u32 vrefresh;
89 89
90 __u32 flags; 90 __u32 flags;
91 __u32 type; 91 __u32 type;
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index e6f3b120f51a..2d428b088cc8 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -6,6 +6,7 @@
6 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 6 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
7 {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 7 {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
8 {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 8 {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
9 {0x1002, 0x3155, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
9 {0x1002, 0x3E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 10 {0x1002, 0x3E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
10 {0x1002, 0x3E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 11 {0x1002, 0x3E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
11 {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP}, \ 12 {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP}, \
@@ -141,6 +142,41 @@
141 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 142 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
142 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 143 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 144 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x688A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
152 {0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x68a0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x68a1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x68a8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x68a9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
158 {0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
159 {0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
160 {0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
161 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
163 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
164 {0x1002, 0x68c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x68c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x68d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
167 {0x1002, 0x68d9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
168 {0x1002, 0x68da, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
169 {0x1002, 0x68de, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
170 {0x1002, 0x68e0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
171 {0x1002, 0x68e1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
172 {0x1002, 0x68e4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
173 {0x1002, 0x68e5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
174 {0x1002, 0x68e8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
175 {0x1002, 0x68e9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x68f1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
178 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
179 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ 180 {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 181 {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 182 {0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -375,6 +411,7 @@
375 {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 411 {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
376 {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 412 {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
377 {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 413 {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
414 {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
378 {0, 0, 0} 415 {0, 0, 0}
379 416
380#define r128_PCI_IDS \ 417#define r128_PCI_IDS \
@@ -558,4 +595,5 @@
558 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 595 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
559 {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 596 {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
560 {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 597 {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
598 {0x8086, 0x0102, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
561 {0, 0, 0} 599 {0, 0, 0}
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index b64a8d7cdf6d..7f0028e1010b 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -275,6 +275,7 @@ typedef struct drm_i915_irq_wait {
275#define I915_PARAM_HAS_OVERLAY 7 275#define I915_PARAM_HAS_OVERLAY 7
276#define I915_PARAM_HAS_PAGEFLIPPING 8 276#define I915_PARAM_HAS_PAGEFLIPPING 8
277#define I915_PARAM_HAS_EXECBUF2 9 277#define I915_PARAM_HAS_EXECBUF2 9
278#define I915_PARAM_HAS_BSD 10
278 279
279typedef struct drm_i915_getparam { 280typedef struct drm_i915_getparam {
280 int param; 281 int param;
@@ -616,7 +617,9 @@ struct drm_i915_gem_execbuffer2 {
616 __u32 num_cliprects; 617 __u32 num_cliprects;
617 /** This is a struct drm_clip_rect *cliprects */ 618 /** This is a struct drm_clip_rect *cliprects */
618 __u64 cliprects_ptr; 619 __u64 cliprects_ptr;
619 __u64 flags; /* currently unused */ 620#define I915_EXEC_RENDER (1<<0)
621#define I915_EXEC_BSD (1<<1)
622 __u64 flags;
620 __u64 rsvd1; 623 __u64 rsvd1;
621 __u64 rsvd2; 624 __u64 rsvd2;
622}; 625};
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index 1e67c441ea82..fe917dee723a 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -25,13 +25,14 @@
25#ifndef __NOUVEAU_DRM_H__ 25#ifndef __NOUVEAU_DRM_H__
26#define __NOUVEAU_DRM_H__ 26#define __NOUVEAU_DRM_H__
27 27
28#define NOUVEAU_DRM_HEADER_PATCHLEVEL 15 28#define NOUVEAU_DRM_HEADER_PATCHLEVEL 16
29 29
30struct drm_nouveau_channel_alloc { 30struct drm_nouveau_channel_alloc {
31 uint32_t fb_ctxdma_handle; 31 uint32_t fb_ctxdma_handle;
32 uint32_t tt_ctxdma_handle; 32 uint32_t tt_ctxdma_handle;
33 33
34 int channel; 34 int channel;
35 uint32_t pushbuf_domains;
35 36
36 /* Notifier memory */ 37 /* Notifier memory */
37 uint32_t notifier_handle; 38 uint32_t notifier_handle;
@@ -77,6 +78,8 @@ struct drm_nouveau_gpuobj_free {
77#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 78#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10
78#define NOUVEAU_GETPARAM_CHIPSET_ID 11 79#define NOUVEAU_GETPARAM_CHIPSET_ID 11
79#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 80#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
81#define NOUVEAU_GETPARAM_GRAPH_UNITS 13
82#define NOUVEAU_GETPARAM_PTIMER_TIME 14
80struct drm_nouveau_getparam { 83struct drm_nouveau_getparam {
81 uint64_t param; 84 uint64_t param;
82 uint64_t value; 85 uint64_t value;
@@ -108,68 +111,58 @@ struct drm_nouveau_gem_new {
108 uint32_t align; 111 uint32_t align;
109}; 112};
110 113
114#define NOUVEAU_GEM_MAX_BUFFERS 1024
115struct drm_nouveau_gem_pushbuf_bo_presumed {
116 uint32_t valid;
117 uint32_t domain;
118 uint64_t offset;
119};
120
111struct drm_nouveau_gem_pushbuf_bo { 121struct drm_nouveau_gem_pushbuf_bo {
112 uint64_t user_priv; 122 uint64_t user_priv;
113 uint32_t handle; 123 uint32_t handle;
114 uint32_t read_domains; 124 uint32_t read_domains;
115 uint32_t write_domains; 125 uint32_t write_domains;
116 uint32_t valid_domains; 126 uint32_t valid_domains;
117 uint32_t presumed_ok; 127 struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
118 uint32_t presumed_domain;
119 uint64_t presumed_offset;
120}; 128};
121 129
122#define NOUVEAU_GEM_RELOC_LOW (1 << 0) 130#define NOUVEAU_GEM_RELOC_LOW (1 << 0)
123#define NOUVEAU_GEM_RELOC_HIGH (1 << 1) 131#define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
124#define NOUVEAU_GEM_RELOC_OR (1 << 2) 132#define NOUVEAU_GEM_RELOC_OR (1 << 2)
133#define NOUVEAU_GEM_MAX_RELOCS 1024
125struct drm_nouveau_gem_pushbuf_reloc { 134struct drm_nouveau_gem_pushbuf_reloc {
135 uint32_t reloc_bo_index;
136 uint32_t reloc_bo_offset;
126 uint32_t bo_index; 137 uint32_t bo_index;
127 uint32_t reloc_index;
128 uint32_t flags; 138 uint32_t flags;
129 uint32_t data; 139 uint32_t data;
130 uint32_t vor; 140 uint32_t vor;
131 uint32_t tor; 141 uint32_t tor;
132}; 142};
133 143
134#define NOUVEAU_GEM_MAX_BUFFERS 1024 144#define NOUVEAU_GEM_MAX_PUSH 512
135#define NOUVEAU_GEM_MAX_RELOCS 1024 145struct drm_nouveau_gem_pushbuf_push {
146 uint32_t bo_index;
147 uint32_t pad;
148 uint64_t offset;
149 uint64_t length;
150};
136 151
137struct drm_nouveau_gem_pushbuf { 152struct drm_nouveau_gem_pushbuf {
138 uint32_t channel; 153 uint32_t channel;
139 uint32_t nr_dwords;
140 uint32_t nr_buffers; 154 uint32_t nr_buffers;
141 uint32_t nr_relocs;
142 uint64_t dwords;
143 uint64_t buffers; 155 uint64_t buffers;
144 uint64_t relocs;
145};
146
147struct drm_nouveau_gem_pushbuf_call {
148 uint32_t channel;
149 uint32_t handle;
150 uint32_t offset;
151 uint32_t nr_buffers;
152 uint32_t nr_relocs; 156 uint32_t nr_relocs;
153 uint32_t nr_dwords; 157 uint32_t nr_push;
154 uint64_t buffers;
155 uint64_t relocs; 158 uint64_t relocs;
159 uint64_t push;
156 uint32_t suffix0; 160 uint32_t suffix0;
157 uint32_t suffix1; 161 uint32_t suffix1;
158 /* below only accessed for CALL2 */
159 uint64_t vram_available; 162 uint64_t vram_available;
160 uint64_t gart_available; 163 uint64_t gart_available;
161}; 164};
162 165
163struct drm_nouveau_gem_pin {
164 uint32_t handle;
165 uint32_t domain;
166 uint64_t offset;
167};
168
169struct drm_nouveau_gem_unpin {
170 uint32_t handle;
171};
172
173#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 166#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
174#define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002 167#define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002
175#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 168#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
@@ -182,14 +175,6 @@ struct drm_nouveau_gem_cpu_fini {
182 uint32_t handle; 175 uint32_t handle;
183}; 176};
184 177
185struct drm_nouveau_gem_tile {
186 uint32_t handle;
187 uint32_t offset;
188 uint32_t size;
189 uint32_t tile_mode;
190 uint32_t tile_flags;
191};
192
193enum nouveau_bus_type { 178enum nouveau_bus_type {
194 NV_AGP = 0, 179 NV_AGP = 0,
195 NV_PCI = 1, 180 NV_PCI = 1,
@@ -199,22 +184,17 @@ enum nouveau_bus_type {
199struct drm_nouveau_sarea { 184struct drm_nouveau_sarea {
200}; 185};
201 186
202#define DRM_NOUVEAU_CARD_INIT 0x00 187#define DRM_NOUVEAU_GETPARAM 0x00
203#define DRM_NOUVEAU_GETPARAM 0x01 188#define DRM_NOUVEAU_SETPARAM 0x01
204#define DRM_NOUVEAU_SETPARAM 0x02 189#define DRM_NOUVEAU_CHANNEL_ALLOC 0x02
205#define DRM_NOUVEAU_CHANNEL_ALLOC 0x03 190#define DRM_NOUVEAU_CHANNEL_FREE 0x03
206#define DRM_NOUVEAU_CHANNEL_FREE 0x04 191#define DRM_NOUVEAU_GROBJ_ALLOC 0x04
207#define DRM_NOUVEAU_GROBJ_ALLOC 0x05 192#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05
208#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x06 193#define DRM_NOUVEAU_GPUOBJ_FREE 0x06
209#define DRM_NOUVEAU_GPUOBJ_FREE 0x07
210#define DRM_NOUVEAU_GEM_NEW 0x40 194#define DRM_NOUVEAU_GEM_NEW 0x40
211#define DRM_NOUVEAU_GEM_PUSHBUF 0x41 195#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
212#define DRM_NOUVEAU_GEM_PUSHBUF_CALL 0x42 196#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
213#define DRM_NOUVEAU_GEM_PIN 0x43 /* !KMS only */ 197#define DRM_NOUVEAU_GEM_CPU_FINI 0x43
214#define DRM_NOUVEAU_GEM_UNPIN 0x44 /* !KMS only */ 198#define DRM_NOUVEAU_GEM_INFO 0x44
215#define DRM_NOUVEAU_GEM_CPU_PREP 0x45
216#define DRM_NOUVEAU_GEM_CPU_FINI 0x46
217#define DRM_NOUVEAU_GEM_INFO 0x47
218#define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48
219 199
220#endif /* __NOUVEAU_DRM_H__ */ 200#endif /* __NOUVEAU_DRM_H__ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 39537f3cf98a..5347063e9d5a 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -808,6 +808,7 @@ struct drm_radeon_gem_create {
808#define RADEON_TILING_SWAP_32BIT 0x8 808#define RADEON_TILING_SWAP_32BIT 0x8
809#define RADEON_TILING_SURFACE 0x10 /* this object requires a surface 809#define RADEON_TILING_SURFACE 0x10 /* this object requires a surface
810 * when mapped - i.e. front buffer */ 810 * when mapped - i.e. front buffer */
811#define RADEON_TILING_MICRO_SQUARE 0x20
811 812
812struct drm_radeon_gem_set_tiling { 813struct drm_radeon_gem_set_tiling {
813 uint32_t handle; 814 uint32_t handle;
@@ -901,6 +902,8 @@ struct drm_radeon_cs {
901#define RADEON_INFO_NUM_GB_PIPES 0x01 902#define RADEON_INFO_NUM_GB_PIPES 0x01
902#define RADEON_INFO_NUM_Z_PIPES 0x02 903#define RADEON_INFO_NUM_Z_PIPES 0x02
903#define RADEON_INFO_ACCEL_WORKING 0x03 904#define RADEON_INFO_ACCEL_WORKING 0x03
905#define RADEON_INFO_CRTC_FROM_ID 0x04
906#define RADEON_INFO_ACCEL_WORKING2 0x05
904 907
905struct drm_radeon_info { 908struct drm_radeon_info {
906 uint32_t request; 909 uint32_t request;
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 81eb9f45883c..267a86c74e2e 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -66,6 +66,26 @@ struct ttm_placement {
66 const uint32_t *busy_placement; 66 const uint32_t *busy_placement;
67}; 67};
68 68
69/**
70 * struct ttm_bus_placement
71 *
72 * @addr: mapped virtual address
73 * @base: bus base address
74 * @is_iomem: is this io memory ?
75 * @size: size in byte
76 * @offset: offset from the base address
77 *
78 * Structure indicating the bus placement of an object.
79 */
80struct ttm_bus_placement {
81 void *addr;
82 unsigned long base;
83 unsigned long size;
84 unsigned long offset;
85 bool is_iomem;
86 bool io_reserved;
87};
88
69 89
70/** 90/**
71 * struct ttm_mem_reg 91 * struct ttm_mem_reg
@@ -75,6 +95,7 @@ struct ttm_placement {
75 * @num_pages: Actual size of memory region in pages. 95 * @num_pages: Actual size of memory region in pages.
76 * @page_alignment: Page alignment. 96 * @page_alignment: Page alignment.
77 * @placement: Placement flags. 97 * @placement: Placement flags.
98 * @bus: Placement on io bus accessible to the CPU
78 * 99 *
79 * Structure indicating the placement and space resources used by a 100 * Structure indicating the placement and space resources used by a
80 * buffer object. 101 * buffer object.
@@ -87,6 +108,7 @@ struct ttm_mem_reg {
87 uint32_t page_alignment; 108 uint32_t page_alignment;
88 uint32_t mem_type; 109 uint32_t mem_type;
89 uint32_t placement; 110 uint32_t placement;
111 struct ttm_bus_placement bus;
90}; 112};
91 113
92/** 114/**
@@ -274,6 +296,7 @@ struct ttm_bo_kmap_obj {
274 ttm_bo_map_kmap = 3, 296 ttm_bo_map_kmap = 3,
275 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, 297 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
276 } bo_kmap_type; 298 } bo_kmap_type;
299 struct ttm_buffer_object *bo;
277}; 300};
278 301
279/** 302/**
@@ -313,7 +336,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
313 * @bo: The buffer object. 336 * @bo: The buffer object.
314 * @placement: Proposed placement for the buffer object. 337 * @placement: Proposed placement for the buffer object.
315 * @interruptible: Sleep interruptible if sleeping. 338 * @interruptible: Sleep interruptible if sleeping.
316 * @no_wait: Return immediately if the buffer is busy. 339 * @no_wait_reserve: Return immediately if other buffers are busy.
340 * @no_wait_gpu: Return immediately if the GPU is busy.
317 * 341 *
318 * Changes placement and caching policy of the buffer object 342 * Changes placement and caching policy of the buffer object
319 * according proposed placement. 343 * according proposed placement.
@@ -325,7 +349,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
325 */ 349 */
326extern int ttm_bo_validate(struct ttm_buffer_object *bo, 350extern int ttm_bo_validate(struct ttm_buffer_object *bo,
327 struct ttm_placement *placement, 351 struct ttm_placement *placement,
328 bool interruptible, bool no_wait); 352 bool interruptible, bool no_wait_reserve,
353 bool no_wait_gpu);
329 354
330/** 355/**
331 * ttm_bo_unref 356 * ttm_bo_unref
@@ -337,6 +362,23 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo,
337extern void ttm_bo_unref(struct ttm_buffer_object **bo); 362extern void ttm_bo_unref(struct ttm_buffer_object **bo);
338 363
339/** 364/**
365 * ttm_bo_lock_delayed_workqueue
366 *
367 * Prevent the delayed workqueue from running.
368 * Returns
369 * True if the workqueue was queued at the time
370 */
371extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev);
372
373/**
374 * ttm_bo_unlock_delayed_workqueue
375 *
376 * Allows the delayed workqueue to run.
377 */
378extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
379 int resched);
380
381/**
340 * ttm_bo_synccpu_write_grab 382 * ttm_bo_synccpu_write_grab
341 * 383 *
342 * @bo: The buffer object: 384 * @bo: The buffer object:
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 4c4e0f8375b3..0ea602da43e7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -115,7 +115,6 @@ struct ttm_backend {
115 struct ttm_backend_func *func; 115 struct ttm_backend_func *func;
116}; 116};
117 117
118#define TTM_PAGE_FLAG_VMALLOC (1 << 0)
119#define TTM_PAGE_FLAG_USER (1 << 1) 118#define TTM_PAGE_FLAG_USER (1 << 1)
120#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) 119#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
121#define TTM_PAGE_FLAG_WRITE (1 << 3) 120#define TTM_PAGE_FLAG_WRITE (1 << 3)
@@ -177,8 +176,6 @@ struct ttm_tt {
177 176
178#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
179#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ 178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
180#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
181 before kernel access. */
182#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ 179#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
183 180
184/** 181/**
@@ -190,13 +187,6 @@ struct ttm_tt {
190 * managed by this memory type. 187 * managed by this memory type.
191 * @gpu_offset: If used, the GPU offset of the first managed page of 188 * @gpu_offset: If used, the GPU offset of the first managed page of
192 * fixed memory or the first managed location in an aperture. 189 * fixed memory or the first managed location in an aperture.
193 * @io_offset: The io_offset of the first managed page of IO memory or
194 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
195 * memory, this should be set to NULL.
196 * @io_size: The size of a managed IO region (fixed memory or aperture).
197 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
198 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
199 * @io_addr should be set to NULL.
200 * @size: Size of the managed region. 190 * @size: Size of the managed region.
201 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, 191 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
202 * as defined in ttm_placement_common.h 192 * as defined in ttm_placement_common.h
@@ -222,9 +212,6 @@ struct ttm_mem_type_manager {
222 bool use_type; 212 bool use_type;
223 uint32_t flags; 213 uint32_t flags;
224 unsigned long gpu_offset; 214 unsigned long gpu_offset;
225 unsigned long io_offset;
226 unsigned long io_size;
227 void *io_addr;
228 uint64_t size; 215 uint64_t size;
229 uint32_t available_caching; 216 uint32_t available_caching;
230 uint32_t default_caching; 217 uint32_t default_caching;
@@ -312,7 +299,8 @@ struct ttm_bo_driver {
312 */ 299 */
313 int (*move) (struct ttm_buffer_object *bo, 300 int (*move) (struct ttm_buffer_object *bo,
314 bool evict, bool interruptible, 301 bool evict, bool interruptible,
315 bool no_wait, struct ttm_mem_reg *new_mem); 302 bool no_wait_reserve, bool no_wait_gpu,
303 struct ttm_mem_reg *new_mem);
316 304
317 /** 305 /**
318 * struct ttm_bo_driver_member verify_access 306 * struct ttm_bo_driver_member verify_access
@@ -352,12 +340,21 @@ struct ttm_bo_driver {
352 struct ttm_mem_reg *new_mem); 340 struct ttm_mem_reg *new_mem);
353 /* notify the driver we are taking a fault on this BO 341 /* notify the driver we are taking a fault on this BO
354 * and have reserved it */ 342 * and have reserved it */
355 void (*fault_reserve_notify)(struct ttm_buffer_object *bo); 343 int (*fault_reserve_notify)(struct ttm_buffer_object *bo);
356 344
357 /** 345 /**
358 * notify the driver that we're about to swap out this bo 346 * notify the driver that we're about to swap out this bo
359 */ 347 */
360 void (*swap_notify) (struct ttm_buffer_object *bo); 348 void (*swap_notify) (struct ttm_buffer_object *bo);
349
350 /**
351 * Driver callback on when mapping io memory (for bo_move_memcpy
352 * for instance). TTM will take care to call io_mem_free whenever
353 * the mapping is not use anymore. io_mem_reserve & io_mem_free
354 * are balanced.
355 */
356 int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
357 void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
361}; 358};
362 359
363/** 360/**
@@ -634,7 +631,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
634 * @proposed_placement: Proposed new placement for the buffer object. 631 * @proposed_placement: Proposed new placement for the buffer object.
635 * @mem: A struct ttm_mem_reg. 632 * @mem: A struct ttm_mem_reg.
636 * @interruptible: Sleep interruptible when sliping. 633 * @interruptible: Sleep interruptible when sliping.
637 * @no_wait: Don't sleep waiting for space to become available. 634 * @no_wait_reserve: Return immediately if other buffers are busy.
635 * @no_wait_gpu: Return immediately if the GPU is busy.
638 * 636 *
639 * Allocate memory space for the buffer object pointed to by @bo, using 637 * Allocate memory space for the buffer object pointed to by @bo, using
640 * the placement flags in @mem, potentially evicting other idle buffer objects. 638 * the placement flags in @mem, potentially evicting other idle buffer objects.
@@ -648,7 +646,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
648extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, 646extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
649 struct ttm_placement *placement, 647 struct ttm_placement *placement,
650 struct ttm_mem_reg *mem, 648 struct ttm_mem_reg *mem,
651 bool interruptible, bool no_wait); 649 bool interruptible,
650 bool no_wait_reserve, bool no_wait_gpu);
652/** 651/**
653 * ttm_bo_wait_for_cpu 652 * ttm_bo_wait_for_cpu
654 * 653 *
@@ -683,6 +682,11 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
683 unsigned long *bus_offset, 682 unsigned long *bus_offset,
684 unsigned long *bus_size); 683 unsigned long *bus_size);
685 684
685extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
686 struct ttm_mem_reg *mem);
687extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
688 struct ttm_mem_reg *mem);
689
686extern void ttm_bo_global_release(struct ttm_global_reference *ref); 690extern void ttm_bo_global_release(struct ttm_global_reference *ref);
687extern int ttm_bo_global_init(struct ttm_global_reference *ref); 691extern int ttm_bo_global_init(struct ttm_global_reference *ref);
688 692
@@ -790,34 +794,6 @@ extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
790extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, 794extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
791 bool interruptible); 795 bool interruptible);
792 796
793/**
794 * ttm_bo_block_reservation
795 *
796 * @bo: A pointer to a struct ttm_buffer_object.
797 * @interruptible: Use interruptible sleep when waiting.
798 * @no_wait: Don't sleep, but rather return -EBUSY.
799 *
800 * Block reservation for validation by simply reserving the buffer.
801 * This is intended for single buffer use only without eviction,
802 * and thus needs no deadlock protection.
803 *
804 * Returns:
805 * -EBUSY: If no_wait == 1 and the buffer is already reserved.
806 * -ERESTARTSYS: If interruptible == 1 and the process received a signal
807 * while sleeping.
808 */
809extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
810 bool interruptible, bool no_wait);
811
812/**
813 * ttm_bo_unblock_reservation
814 *
815 * @bo: A pointer to a struct ttm_buffer_object.
816 *
817 * Unblocks reservation leaving lru lists untouched.
818 */
819extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
820
821/* 797/*
822 * ttm_bo_util.c 798 * ttm_bo_util.c
823 */ 799 */
@@ -827,7 +803,8 @@ extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
827 * 803 *
828 * @bo: A pointer to a struct ttm_buffer_object. 804 * @bo: A pointer to a struct ttm_buffer_object.
829 * @evict: 1: This is an eviction. Don't try to pipeline. 805 * @evict: 1: This is an eviction. Don't try to pipeline.
830 * @no_wait: Never sleep, but rather return with -EBUSY. 806 * @no_wait_reserve: Return immediately if other buffers are busy.
807 * @no_wait_gpu: Return immediately if the GPU is busy.
831 * @new_mem: struct ttm_mem_reg indicating where to move. 808 * @new_mem: struct ttm_mem_reg indicating where to move.
832 * 809 *
833 * Optimized move function for a buffer object with both old and 810 * Optimized move function for a buffer object with both old and
@@ -841,15 +818,16 @@ extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
841 */ 818 */
842 819
843extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 820extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
844 bool evict, bool no_wait, 821 bool evict, bool no_wait_reserve,
845 struct ttm_mem_reg *new_mem); 822 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
846 823
847/** 824/**
848 * ttm_bo_move_memcpy 825 * ttm_bo_move_memcpy
849 * 826 *
850 * @bo: A pointer to a struct ttm_buffer_object. 827 * @bo: A pointer to a struct ttm_buffer_object.
851 * @evict: 1: This is an eviction. Don't try to pipeline. 828 * @evict: 1: This is an eviction. Don't try to pipeline.
852 * @no_wait: Never sleep, but rather return with -EBUSY. 829 * @no_wait_reserve: Return immediately if other buffers are busy.
830 * @no_wait_gpu: Return immediately if the GPU is busy.
853 * @new_mem: struct ttm_mem_reg indicating where to move. 831 * @new_mem: struct ttm_mem_reg indicating where to move.
854 * 832 *
855 * Fallback move function for a mappable buffer object in mappable memory. 833 * Fallback move function for a mappable buffer object in mappable memory.
@@ -863,8 +841,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
863 */ 841 */
864 842
865extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 843extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
866 bool evict, 844 bool evict, bool no_wait_reserve,
867 bool no_wait, struct ttm_mem_reg *new_mem); 845 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
868 846
869/** 847/**
870 * ttm_bo_free_old_node 848 * ttm_bo_free_old_node
@@ -883,7 +861,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
883 * @sync_obj_arg: An argument to pass to the sync object idle / wait 861 * @sync_obj_arg: An argument to pass to the sync object idle / wait
884 * functions. 862 * functions.
885 * @evict: This is an evict move. Don't return until the buffer is idle. 863 * @evict: This is an evict move. Don't return until the buffer is idle.
886 * @no_wait: Never sleep, but rather return with -EBUSY. 864 * @no_wait_reserve: Return immediately if other buffers are busy.
865 * @no_wait_gpu: Return immediately if the GPU is busy.
887 * @new_mem: struct ttm_mem_reg indicating where to move. 866 * @new_mem: struct ttm_mem_reg indicating where to move.
888 * 867 *
889 * Accelerated move function to be called when an accelerated move 868 * Accelerated move function to be called when an accelerated move
@@ -897,7 +876,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
897extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 876extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
898 void *sync_obj, 877 void *sync_obj,
899 void *sync_obj_arg, 878 void *sync_obj_arg,
900 bool evict, bool no_wait, 879 bool evict, bool no_wait_reserve,
880 bool no_wait_gpu,
901 struct ttm_mem_reg *new_mem); 881 struct ttm_mem_reg *new_mem);
902/** 882/**
903 * ttm_io_prot 883 * ttm_io_prot
@@ -908,7 +888,7 @@ extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
908 * Utility function that returns the pgprot_t that should be used for 888 * Utility function that returns the pgprot_t that should be used for
909 * setting up a PTE with the caching model indicated by @c_state. 889 * setting up a PTE with the caching model indicated by @c_state.
910 */ 890 */
911extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp); 891extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
912 892
913#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) 893#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
914#define TTM_HAS_AGP 894#define TTM_HAS_AGP
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
new file mode 100644
index 000000000000..116821448c38
--- /dev/null
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) Red Hat Inc.
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, sub license,
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
12 * next paragraph) shall be included in all copies or substantial portions
13 * of the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Authors: Dave Airlie <airlied@redhat.com>
24 * Jerome Glisse <jglisse@redhat.com>
25 */
26#ifndef TTM_PAGE_ALLOC
27#define TTM_PAGE_ALLOC
28
29#include "ttm_bo_driver.h"
30#include "ttm_memory.h"
31
32/**
33 * Get count number of pages from pool to pages list.
34 *
35 * @pages: heado of empty linked list where pages are filled.
36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate.
39 */
40int ttm_get_pages(struct list_head *pages,
41 int flags,
42 enum ttm_caching_state cstate,
43 unsigned count);
44/**
45 * Put linked list of pages to pool.
46 *
47 * @pages: list of pages to free.
48 * @page_count: number of pages in the list. Zero can be passed for unknown
49 * count.
50 * @flags: ttm flags for page allocation.
51 * @cstate: ttm caching state.
52 */
53void ttm_put_pages(struct list_head *pages,
54 unsigned page_count,
55 int flags,
56 enum ttm_caching_state cstate);
57/**
58 * Initialize pool allocator.
59 */
60int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
61/**
62 * Free pool allocator.
63 */
64void ttm_page_alloc_fini(void);
65
66/**
67 * Output the state of pools to debugfs file
68 */
69extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
70#endif
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h
index 2be7e1249b6f..4d0842391edc 100644
--- a/include/drm/vmwgfx_drm.h
+++ b/include/drm/vmwgfx_drm.h
@@ -50,6 +50,8 @@
50#define DRM_VMW_EXECBUF 12 50#define DRM_VMW_EXECBUF 12
51#define DRM_VMW_FIFO_DEBUG 13 51#define DRM_VMW_FIFO_DEBUG 13
52#define DRM_VMW_FENCE_WAIT 14 52#define DRM_VMW_FENCE_WAIT 14
53/* guarded by minor version >= 2 */
54#define DRM_VMW_UPDATE_LAYOUT 15
53 55
54 56
55/*************************************************************************/ 57/*************************************************************************/
@@ -68,7 +70,8 @@
68#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 70#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
69#define DRM_VMW_PARAM_3D 2 71#define DRM_VMW_PARAM_3D 2
70#define DRM_VMW_PARAM_FIFO_OFFSET 3 72#define DRM_VMW_PARAM_FIFO_OFFSET 3
71 73#define DRM_VMW_PARAM_HW_CAPS 4
74#define DRM_VMW_PARAM_FIFO_CAPS 5
72 75
73/** 76/**
74 * struct drm_vmw_getparam_arg 77 * struct drm_vmw_getparam_arg
@@ -181,6 +184,8 @@ struct drm_vmw_context_arg {
181 * The size of the array should equal the total number of mipmap levels. 184 * The size of the array should equal the total number of mipmap levels.
182 * @shareable: Boolean whether other clients (as identified by file descriptors) 185 * @shareable: Boolean whether other clients (as identified by file descriptors)
183 * may reference this surface. 186 * may reference this surface.
187 * @scanout: Boolean whether the surface is intended to be used as a
188 * scanout.
184 * 189 *
185 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. 190 * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
186 * Output data from the DRM_VMW_REF_SURFACE Ioctl. 191 * Output data from the DRM_VMW_REF_SURFACE Ioctl.
@@ -192,7 +197,7 @@ struct drm_vmw_surface_create_req {
192 uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; 197 uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
193 uint64_t size_addr; 198 uint64_t size_addr;
194 int32_t shareable; 199 int32_t shareable;
195 uint32_t pad64; 200 int32_t scanout;
196}; 201};
197 202
198/** 203/**
@@ -295,17 +300,28 @@ union drm_vmw_surface_reference_arg {
295 * 300 *
296 * @commands: User-space address of a command buffer cast to an uint64_t. 301 * @commands: User-space address of a command buffer cast to an uint64_t.
297 * @command-size: Size in bytes of the command buffer. 302 * @command-size: Size in bytes of the command buffer.
303 * @throttle-us: Sleep until software is less than @throttle_us
304 * microseconds ahead of hardware. The driver may round this value
305 * to the nearest kernel tick.
298 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an 306 * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
299 * uint64_t. 307 * uint64_t.
308 * @version: Allows expanding the execbuf ioctl parameters without breaking
309 * backwards compatibility, since user-space will always tell the kernel
310 * which version it uses.
311 * @flags: Execbuf flags. None currently.
300 * 312 *
301 * Argument to the DRM_VMW_EXECBUF Ioctl. 313 * Argument to the DRM_VMW_EXECBUF Ioctl.
302 */ 314 */
303 315
316#define DRM_VMW_EXECBUF_VERSION 0
317
304struct drm_vmw_execbuf_arg { 318struct drm_vmw_execbuf_arg {
305 uint64_t commands; 319 uint64_t commands;
306 uint32_t command_size; 320 uint32_t command_size;
307 uint32_t pad64; 321 uint32_t throttle_us;
308 uint64_t fence_rep; 322 uint64_t fence_rep;
323 uint32_t version;
324 uint32_t flags;
309}; 325};
310 326
311/** 327/**
@@ -571,4 +587,28 @@ struct drm_vmw_stream_arg {
571 * sure that the stream has been stopped. 587 * sure that the stream has been stopped.
572 */ 588 */
573 589
590/*************************************************************************/
591/**
592 * DRM_VMW_UPDATE_LAYOUT - Update layout
593 *
594 * Updates the prefered modes and connection status for connectors. The
595 * command conisits of one drm_vmw_update_layout_arg pointing out a array
596 * of num_outputs drm_vmw_rect's.
597 */
598
599/**
600 * struct drm_vmw_update_layout_arg
601 *
602 * @num_outputs: number of active
603 * @rects: pointer to array of drm_vmw_rect
604 *
605 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
606 */
607
608struct drm_vmw_update_layout_arg {
609 uint32_t num_outputs;
610 uint32_t pad64;
611 uint64_t rects;
612};
613
574#endif 614#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 756f831cbdd5..2fc8e14cc24a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -43,6 +43,7 @@ header-y += blkpg.h
43header-y += bpqether.h 43header-y += bpqether.h
44header-y += bsg.h 44header-y += bsg.h
45header-y += can.h 45header-y += can.h
46header-y += cciss_defs.h
46header-y += cdk.h 47header-y += cdk.h
47header-y += chio.h 48header-y += chio.h
48header-y += coda_psdev.h 49header-y += coda_psdev.h
@@ -93,6 +94,7 @@ header-y += if_ppp.h
93header-y += if_slip.h 94header-y += if_slip.h
94header-y += if_strip.h 95header-y += if_strip.h
95header-y += if_tun.h 96header-y += if_tun.h
97header-y += if_x25.h
96header-y += in_route.h 98header-y += in_route.h
97header-y += ioctl.h 99header-y += ioctl.h
98header-y += ip6_tunnel.h 100header-y += ip6_tunnel.h
@@ -125,6 +127,7 @@ header-y += nfs2.h
125header-y += nfs4_mount.h 127header-y += nfs4_mount.h
126header-y += nfs_mount.h 128header-y += nfs_mount.h
127header-y += nl80211.h 129header-y += nl80211.h
130header-y += omapfb.h
128header-y += param.h 131header-y += param.h
129header-y += pci_regs.h 132header-y += pci_regs.h
130header-y += perf_event.h 133header-y += perf_event.h
@@ -362,6 +365,7 @@ unifdef-y += uio.h
362unifdef-y += unistd.h 365unifdef-y += unistd.h
363unifdef-y += usbdevice_fs.h 366unifdef-y += usbdevice_fs.h
364unifdef-y += utsname.h 367unifdef-y += utsname.h
368unifdef-y += vhost.h
365unifdef-y += videodev2.h 369unifdef-y += videodev2.h
366unifdef-y += videodev.h 370unifdef-y += videodev.h
367unifdef-y += virtio_config.h 371unifdef-y += virtio_config.h
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 882dc7248766..3e4737fa6cce 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -121,16 +121,15 @@ struct vfsmount;
121struct super_block; 121struct super_block;
122struct pacct_struct; 122struct pacct_struct;
123struct pid_namespace; 123struct pid_namespace;
124extern int acct_parm[]; /* for sysctl */
124extern void acct_auto_close_mnt(struct vfsmount *m); 125extern void acct_auto_close_mnt(struct vfsmount *m);
125extern void acct_auto_close(struct super_block *sb); 126extern void acct_auto_close(struct super_block *sb);
126extern void acct_init_pacct(struct pacct_struct *pacct);
127extern void acct_collect(long exitcode, int group_dead); 127extern void acct_collect(long exitcode, int group_dead);
128extern void acct_process(void); 128extern void acct_process(void);
129extern void acct_exit_ns(struct pid_namespace *); 129extern void acct_exit_ns(struct pid_namespace *);
130#else 130#else
131#define acct_auto_close_mnt(x) do { } while (0) 131#define acct_auto_close_mnt(x) do { } while (0)
132#define acct_auto_close(x) do { } while (0) 132#define acct_auto_close(x) do { } while (0)
133#define acct_init_pacct(x) do { } while (0)
134#define acct_collect(x,y) do { } while (0) 133#define acct_collect(x,y) do { } while (0)
135#define acct_process() do { } while (0) 134#define acct_process() do { } while (0)
136#define acct_exit_ns(ns) do { } while (0) 135#define acct_exit_ns(ns) do { } while (0)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b926afe8c03e..ccf94dc5acdf 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -116,11 +116,12 @@ extern unsigned long acpi_realmode_flags;
116 116
117int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity); 117int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
118int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 118int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
119int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
119 120
120#ifdef CONFIG_X86_IO_APIC 121#ifdef CONFIG_X86_IO_APIC
121extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity); 122extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
122#else 123#else
123#define acpi_get_override_irq(bus, trigger, polarity) (-1) 124#define acpi_get_override_irq(gsi, trigger, polarity) (-1)
124#endif 125#endif
125/* 126/*
126 * This function undoes the effect of one call to acpi_register_gsi(). 127 * This function undoes the effect of one call to acpi_register_gsi().
@@ -247,11 +248,12 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
247int acpi_check_mem_region(resource_size_t start, resource_size_t n, 248int acpi_check_mem_region(resource_size_t start, resource_size_t n,
248 const char *name); 249 const char *name);
249 250
251int acpi_resources_are_enforced(void);
252
250#ifdef CONFIG_PM_SLEEP 253#ifdef CONFIG_PM_SLEEP
251void __init acpi_no_s4_hw_signature(void); 254void __init acpi_no_s4_hw_signature(void);
252void __init acpi_old_suspend_ordering(void); 255void __init acpi_old_suspend_ordering(void);
253void __init acpi_s4_no_nvs(void); 256void __init acpi_nvs_nosave(void);
254void __init acpi_set_sci_en_on_resume(void);
255#endif /* CONFIG_PM_SLEEP */ 257#endif /* CONFIG_PM_SLEEP */
256 258
257struct acpi_osc_context { 259struct acpi_osc_context {
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 9101ed64f803..09ea4a1e9505 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -79,7 +79,6 @@ struct agp_memory {
79 u32 physical; 79 u32 physical;
80 bool is_bound; 80 bool is_bound;
81 bool is_flushed; 81 bool is_flushed;
82 bool vmalloc_flag;
83 /* list of agp_memory mapped to the aperture */ 82 /* list of agp_memory mapped to the aperture */
84 struct list_head mapped_list; 83 struct list_head mapped_list;
85 /* DMA-mapped addresses */ 84 /* DMA-mapped addresses */
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
new file mode 100644
index 000000000000..f7dd576dd5a4
--- /dev/null
+++ b/include/linux/ahci_platform.h
@@ -0,0 +1,29 @@
1/*
2 * AHCI SATA platform driver
3 *
4 * Copyright 2004-2005 Red Hat, Inc.
5 * Jeff Garzik <jgarzik@pobox.com>
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@ru.mvista.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 */
14
15#ifndef _AHCI_PLATFORM_H
16#define _AHCI_PLATFORM_H
17
18struct device;
19struct ata_port_info;
20
21struct ahci_platform_data {
22 int (*init)(struct device *dev);
23 void (*exit)(struct device *dev);
24 const struct ata_port_info *ata_port_info;
25 unsigned int force_port_map;
26 unsigned int mask_port_map;
27};
28
29#endif /* _AHCI_PLATFORM_H */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 811dbb369379..7a8db4155281 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -212,6 +212,8 @@ extern void kick_iocb(struct kiocb *iocb);
212extern int aio_complete(struct kiocb *iocb, long res, long res2); 212extern int aio_complete(struct kiocb *iocb, long res, long res2);
213struct mm_struct; 213struct mm_struct;
214extern void exit_aio(struct mm_struct *mm); 214extern void exit_aio(struct mm_struct *mm);
215extern long do_io_submit(aio_context_t ctx_id, long nr,
216 struct iocb __user *__user *iocbpp, bool compat);
215#else 217#else
216static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } 218static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
217static inline int aio_put_req(struct kiocb *iocb) { return 0; } 219static inline int aio_put_req(struct kiocb *iocb) { return 0; }
@@ -219,6 +221,9 @@ static inline void kick_iocb(struct kiocb *iocb) { }
219static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; } 221static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
220struct mm_struct; 222struct mm_struct;
221static inline void exit_aio(struct mm_struct *mm) { } 223static inline void exit_aio(struct mm_struct *mm) { }
224static inline long do_io_submit(aio_context_t ctx_id, long nr,
225 struct iocb __user * __user *iocbpp,
226 bool compat) { return 0; }
222#endif /* CONFIG_AIO */ 227#endif /* CONFIG_AIO */
223 228
224static inline struct kiocb *list_kiocb(struct list_head *h) 229static inline struct kiocb *list_kiocb(struct list_head *h)
diff --git a/include/linux/altera_jtaguart.h b/include/linux/altera_jtaguart.h
new file mode 100644
index 000000000000..953b178a1650
--- /dev/null
+++ b/include/linux/altera_jtaguart.h
@@ -0,0 +1,16 @@
1/*
2 * altera_jtaguart.h -- Altera JTAG UART driver defines.
3 */
4
5#ifndef __ALTJUART_H
6#define __ALTJUART_H
7
8#define ALTERA_JTAGUART_MAJOR 204
9#define ALTERA_JTAGUART_MINOR 186
10
11struct altera_jtaguart_platform_uart {
12 unsigned long mapbase; /* Physical address base */
13 unsigned int irq; /* Interrupt vector */
14};
15
16#endif /* __ALTJUART_H */
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
new file mode 100644
index 000000000000..8d441064a30d
--- /dev/null
+++ b/include/linux/altera_uart.h
@@ -0,0 +1,14 @@
1/*
2 * altera_uart.h -- Altera UART driver defines.
3 */
4
5#ifndef __ALTUART_H
6#define __ALTUART_H
7
8struct altera_uart_platform_uart {
9 unsigned long mapbase; /* Physical address base */
10 unsigned int irq; /* Interrupt vector */
11 unsigned int uartclk; /* UART clock rate */
12};
13
14#endif /* __ALTUART_H */
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index ab94335b4bb9..8b1038607831 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -1,5 +1,9 @@
1/* 1/*
2 * linux/include/asm-arm/hardware/amba.h 2 * linux/include/amba/bus.h
3 *
4 * This device type deals with ARM PrimeCells and anything else that
5 * presents a proper CID (0xB105F00D) at the end of the I/O register
6 * region or that is derived from a PrimeCell.
3 * 7 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved. 8 * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
5 * 9 *
@@ -10,6 +14,9 @@
10#ifndef ASMARM_AMBA_H 14#ifndef ASMARM_AMBA_H
11#define ASMARM_AMBA_H 15#define ASMARM_AMBA_H
12 16
17#include <linux/device.h>
18#include <linux/resource.h>
19
13#define AMBA_NR_IRQS 2 20#define AMBA_NR_IRQS 2
14 21
15struct amba_device { 22struct amba_device {
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index 29c0448265cf..ca16c3801a1e 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -21,22 +21,21 @@
21#define CLCD_UBAS 0x00000010 21#define CLCD_UBAS 0x00000010
22#define CLCD_LBAS 0x00000014 22#define CLCD_LBAS 0x00000014
23 23
24#if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW) 24#define CLCD_PL110_IENB 0x00000018
25#define CLCD_IENB 0x00000018 25#define CLCD_PL110_CNTL 0x0000001c
26#define CLCD_CNTL 0x0000001c 26#define CLCD_PL110_STAT 0x00000020
27#else 27#define CLCD_PL110_INTR 0x00000024
28/* 28#define CLCD_PL110_UCUR 0x00000028
29 * Someone rearranged these two registers on the Versatile 29#define CLCD_PL110_LCUR 0x0000002C
30 * platform... 30
31 */ 31#define CLCD_PL111_CNTL 0x00000018
32#define CLCD_IENB 0x0000001c 32#define CLCD_PL111_IENB 0x0000001c
33#define CLCD_CNTL 0x00000018 33#define CLCD_PL111_RIS 0x00000020
34#endif 34#define CLCD_PL111_MIS 0x00000024
35 35#define CLCD_PL111_ICR 0x00000028
36#define CLCD_STAT 0x00000020 36#define CLCD_PL111_UCUR 0x0000002c
37#define CLCD_INTR 0x00000024 37#define CLCD_PL111_LCUR 0x00000030
38#define CLCD_UCUR 0x00000028 38
39#define CLCD_LCUR 0x0000002C
40#define CLCD_PALL 0x00000200 39#define CLCD_PALL 0x00000200
41#define CLCD_PALETTE 0x00000200 40#define CLCD_PALETTE 0x00000200
42 41
@@ -147,6 +146,8 @@ struct clcd_fb {
147 struct clcd_board *board; 146 struct clcd_board *board;
148 void *board_data; 147 void *board_data;
149 void __iomem *regs; 148 void __iomem *regs;
149 u16 off_ienb;
150 u16 off_cntl;
150 u32 clcd_cntl; 151 u32 clcd_cntl;
151 u32 cmap[16]; 152 u32 cmap[16];
152}; 153};
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 6b4241748dda..7e466fe72025 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,8 +6,29 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9/**
10 * struct mmci_platform_data - platform configuration for the MMCI
11 * (also known as PL180) block.
12 * @f_max: the maximum operational frequency for this host in this
13 * platform configuration. When this is specified it takes precedence
14 * over the module parameter for the same frequency.
15 * @ocr_mask: available voltages on the 4 pins from the block, this
16 * is ignored if a regulator is used, see the MMC_VDD_* masks in
17 * mmc/host.h
18 * @translate_vdd: a callback function to translate a MMC_VDD_*
19 * mask into a value to be binary or:ed and written into the
20 * MMCIPWR register of the block
21 * @status: if no GPIO read function was given to the block in
22 * gpio_wp (below) this function will be called to determine
23 * whether a card is present in the MMC slot or not
24 * @gpio_wp: read this GPIO pin to see if the card is write protected
25 * @gpio_cd: read this GPIO pin to detect card insertion
26 * @capabilities: the capabilities of the block as implemented in
27 * this platform, signify anything MMC_CAP_* from mmc/host.h
28 */
9struct mmci_platform_data { 29struct mmci_platform_data {
10 unsigned int ocr_mask; /* available voltages */ 30 unsigned int f_max;
31 unsigned int ocr_mask;
11 u32 (*translate_vdd)(struct device *, unsigned int); 32 u32 (*translate_vdd)(struct device *, unsigned int);
12 unsigned int (*status)(struct device *); 33 unsigned int (*status)(struct device *);
13 int gpio_wp; 34 int gpio_wp;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index e4836c6b3dd7..abf26cc47a2b 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -71,6 +71,7 @@ struct ssp_clock_params {
71 71
72/** 72/**
73 * enum ssp_rx_endian - endianess of Rx FIFO Data 73 * enum ssp_rx_endian - endianess of Rx FIFO Data
74 * this feature is only available in ST versionf of PL022
74 */ 75 */
75enum ssp_rx_endian { 76enum ssp_rx_endian {
76 SSP_RX_MSB, 77 SSP_RX_MSB,
@@ -181,7 +182,8 @@ enum ssp_microwire_wait_state {
181}; 182};
182 183
183/** 184/**
184 * enum Microwire - whether Full/Half Duplex 185 * enum ssp_duplex - whether Full/Half Duplex on microwire, only
186 * available in the ST Micro variant.
185 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional, 187 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional,
186 * SSPRXD not used 188 * SSPRXD not used
187 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is 189 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is
@@ -193,6 +195,31 @@ enum ssp_duplex {
193}; 195};
194 196
195/** 197/**
198 * enum ssp_clkdelay - an optional clock delay on the feedback clock
199 * only available in the ST Micro PL023 variant.
200 * @SSP_FEEDBACK_CLK_DELAY_NONE: no delay, the data coming in from the
201 * slave is sampled directly
202 * @SSP_FEEDBACK_CLK_DELAY_1T: the incoming slave data is sampled with
203 * a delay of T-dt
204 * @SSP_FEEDBACK_CLK_DELAY_2T: dito with a delay if 2T-dt
205 * @SSP_FEEDBACK_CLK_DELAY_3T: dito with a delay if 3T-dt
206 * @SSP_FEEDBACK_CLK_DELAY_4T: dito with a delay if 4T-dt
207 * @SSP_FEEDBACK_CLK_DELAY_5T: dito with a delay if 5T-dt
208 * @SSP_FEEDBACK_CLK_DELAY_6T: dito with a delay if 6T-dt
209 * @SSP_FEEDBACK_CLK_DELAY_7T: dito with a delay if 7T-dt
210 */
211enum ssp_clkdelay {
212 SSP_FEEDBACK_CLK_DELAY_NONE,
213 SSP_FEEDBACK_CLK_DELAY_1T,
214 SSP_FEEDBACK_CLK_DELAY_2T,
215 SSP_FEEDBACK_CLK_DELAY_3T,
216 SSP_FEEDBACK_CLK_DELAY_4T,
217 SSP_FEEDBACK_CLK_DELAY_5T,
218 SSP_FEEDBACK_CLK_DELAY_6T,
219 SSP_FEEDBACK_CLK_DELAY_7T
220};
221
222/**
196 * CHIP select/deselect commands 223 * CHIP select/deselect commands
197 */ 224 */
198enum ssp_chip_select { 225enum ssp_chip_select {
@@ -235,6 +262,8 @@ struct pl022_ssp_controller {
235 * @ctrl_len: Microwire interface: Control length 262 * @ctrl_len: Microwire interface: Control length
236 * @wait_state: Microwire interface: Wait state 263 * @wait_state: Microwire interface: Wait state
237 * @duplex: Microwire interface: Full/Half duplex 264 * @duplex: Microwire interface: Full/Half duplex
265 * @clkdelay: on the PL023 variant, the delay in feeback clock cycles
266 * before sampling the incoming line
238 * @cs_control: function pointer to board-specific function to 267 * @cs_control: function pointer to board-specific function to
239 * assert/deassert I/O port to control HW generation of devices chip-select. 268 * assert/deassert I/O port to control HW generation of devices chip-select.
240 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph) 269 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
@@ -258,6 +287,7 @@ struct pl022_config_chip {
258 enum ssp_microwire_ctrl_len ctrl_len; 287 enum ssp_microwire_ctrl_len ctrl_len;
259 enum ssp_microwire_wait_state wait_state; 288 enum ssp_microwire_wait_state wait_state;
260 enum ssp_duplex duplex; 289 enum ssp_duplex duplex;
290 enum ssp_clkdelay clkdelay;
261 void (*cs_control) (u32 control); 291 void (*cs_control) (u32 control);
262}; 292};
263 293
diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
index b4fbd9862606..5ddd9ad4b19c 100644
--- a/include/linux/amba/pl061.h
+++ b/include/linux/amba/pl061.h
@@ -1,3 +1,5 @@
1#include <linux/types.h>
2
1/* platform data for the PL061 GPIO driver */ 3/* platform data for the PL061 GPIO driver */
2 4
3struct pl061_platform_data { 5struct pl061_platform_data {
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
new file mode 100644
index 000000000000..cbee7de7dd36
--- /dev/null
+++ b/include/linux/amba/pl330.h
@@ -0,0 +1,45 @@
1/* linux/include/linux/amba/pl330.h
2 *
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __AMBA_PL330_H_
13#define __AMBA_PL330_H_
14
15#include <asm/hardware/pl330.h>
16
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; /* {0, 31} */
23 enum pl330_reqtype rqtype;
24
25 /* For M->D and D->M Channels */
26 int burst_sz; /* in power of 2 */
27 dma_addr_t fifo_addr;
28};
29
30struct dma_pl330_platdata {
31 /*
32 * Number of valid peripherals connected to DMAC.
33 * This may be different from the value read from
34 * CR0, as the PL330 implementation might have 'holes'
35 * in the peri list or the peri could also be reached
36 * from another DMAC which the platform prefers.
37 */
38 u8 nr_valid_peri;
39 /* Array of valid peripherals */
40 struct dma_pl330_peri *peri;
41 /* Bytes to allocate for MC buffer */
42 unsigned mcbuf_sz;
43};
44
45#endif /* __AMBA_PL330_H_ */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 38a6948ce0c2..fe6e681a9d74 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -467,7 +467,7 @@ enum ata_ioctls {
467 467
468/* core structures */ 468/* core structures */
469 469
470struct ata_prd { 470struct ata_bmdma_prd {
471 __le32 addr; 471 __le32 addr;
472 __le32 flags_len; 472 __le32 flags_len;
473}; 473};
@@ -647,9 +647,9 @@ static inline int ata_id_has_large_logical_sectors(const u16 *id)
647 return id[ATA_ID_SECTOR_SIZE] & (1 << 13); 647 return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
648} 648}
649 649
650static inline u8 ata_id_logical_per_physical_sectors(const u16 *id) 650static inline u16 ata_id_logical_per_physical_sectors(const u16 *id)
651{ 651{
652 return id[ATA_ID_SECTOR_SIZE] & 0xf; 652 return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf);
653} 653}
654 654
655static inline int ata_id_has_lba48(const u16 *id) 655static inline int ata_id_has_lba48(const u16 *id)
@@ -841,7 +841,8 @@ static inline int ata_id_current_chs_valid(const u16 *id)
841 841
842static inline int ata_id_is_cfa(const u16 *id) 842static inline int ata_id_is_cfa(const u16 *id)
843{ 843{
844 if (id[ATA_ID_CONFIG] == 0x848A) /* Traditional CF */ 844 if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */
845 (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */
845 return 1; 846 return 1;
846 /* 847 /*
847 * CF specs don't require specific value in the word 0 anymore and yet 848 * CF specs don't require specific value in the word 0 anymore and yet
@@ -1024,8 +1025,8 @@ static inline int ata_ok(u8 status)
1024 1025
1025static inline int lba_28_ok(u64 block, u32 n_block) 1026static inline int lba_28_ok(u64 block, u32 n_block)
1026{ 1027{
1027 /* check the ending block number */ 1028 /* check the ending block number: must be LESS THAN 0x0fffffff */
1028 return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256); 1029 return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256);
1029} 1030}
1030 1031
1031static inline int lba_48_ok(u64 block, u32 n_block) 1032static inline int lba_48_ok(u64 block, u32 n_block)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 3c7a358241a7..f391d45c8aea 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -424,7 +424,7 @@ extern void audit_syscall_exit(int failed, long return_code);
424extern void __audit_getname(const char *name); 424extern void __audit_getname(const char *name);
425extern void audit_putname(const char *name); 425extern void audit_putname(const char *name);
426extern void __audit_inode(const char *name, const struct dentry *dentry); 426extern void __audit_inode(const char *name, const struct dentry *dentry);
427extern void __audit_inode_child(const char *dname, const struct dentry *dentry, 427extern void __audit_inode_child(const struct dentry *dentry,
428 const struct inode *parent); 428 const struct inode *parent);
429extern void __audit_ptrace(struct task_struct *t); 429extern void __audit_ptrace(struct task_struct *t);
430 430
@@ -442,11 +442,10 @@ static inline void audit_inode(const char *name, const struct dentry *dentry) {
442 if (unlikely(!audit_dummy_context())) 442 if (unlikely(!audit_dummy_context()))
443 __audit_inode(name, dentry); 443 __audit_inode(name, dentry);
444} 444}
445static inline void audit_inode_child(const char *dname, 445static inline void audit_inode_child(const struct dentry *dentry,
446 const struct dentry *dentry,
447 const struct inode *parent) { 446 const struct inode *parent) {
448 if (unlikely(!audit_dummy_context())) 447 if (unlikely(!audit_dummy_context()))
449 __audit_inode_child(dname, dentry, parent); 448 __audit_inode_child(dentry, parent);
450} 449}
451void audit_core_dumps(long signr); 450void audit_core_dumps(long signr);
452 451
@@ -544,9 +543,9 @@ extern int audit_signals;
544#define audit_getname(n) do { ; } while (0) 543#define audit_getname(n) do { ; } while (0)
545#define audit_putname(n) do { ; } while (0) 544#define audit_putname(n) do { ; } while (0)
546#define __audit_inode(n,d) do { ; } while (0) 545#define __audit_inode(n,d) do { ; } while (0)
547#define __audit_inode_child(d,i,p) do { ; } while (0) 546#define __audit_inode_child(i,p) do { ; } while (0)
548#define audit_inode(n,d) do { ; } while (0) 547#define audit_inode(n,d) do { ; } while (0)
549#define audit_inode_child(d,i,p) do { ; } while (0) 548#define audit_inode_child(i,p) do { ; } while (0)
550#define audit_core_dumps(i) do { ; } while (0) 549#define audit_core_dumps(i) do { ; } while (0)
551#define auditsc_get_stamp(c,t,s) (0) 550#define auditsc_get_stamp(c,t,s) (0)
552#define audit_get_loginuid(t) (-1) 551#define audit_get_loginuid(t) (-1)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index fcbc26af00e4..e9aec0d099df 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/timer.h>
17#include <linux/writeback.h> 18#include <linux/writeback.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
@@ -81,13 +82,13 @@ struct backing_dev_info {
81 struct bdi_writeback wb; /* default writeback info for this bdi */ 82 struct bdi_writeback wb; /* default writeback info for this bdi */
82 spinlock_t wb_lock; /* protects update side of wb_list */ 83 spinlock_t wb_lock; /* protects update side of wb_list */
83 struct list_head wb_list; /* the flusher threads hanging off this bdi */ 84 struct list_head wb_list; /* the flusher threads hanging off this bdi */
84 unsigned long wb_mask; /* bitmask of registered tasks */
85 unsigned int wb_cnt; /* number of registered tasks */
86 85
87 struct list_head work_list; 86 struct list_head work_list;
88 87
89 struct device *dev; 88 struct device *dev;
90 89
90 struct timer_list laptop_mode_wb_timer;
91
91#ifdef CONFIG_DEBUG_FS 92#ifdef CONFIG_DEBUG_FS
92 struct dentry *debug_dir; 93 struct dentry *debug_dir;
93 struct dentry *debug_stats; 94 struct dentry *debug_stats;
@@ -101,10 +102,12 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
101 const char *fmt, ...); 102 const char *fmt, ...);
102int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 103int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
103void bdi_unregister(struct backing_dev_info *bdi); 104void bdi_unregister(struct backing_dev_info *bdi);
104void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, 105int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
105 long nr_pages); 106void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
107void bdi_start_background_writeback(struct backing_dev_info *bdi);
106int bdi_writeback_task(struct bdi_writeback *wb); 108int bdi_writeback_task(struct bdi_writeback *wb);
107int bdi_has_dirty_io(struct backing_dev_info *bdi); 109int bdi_has_dirty_io(struct backing_dev_info *bdi);
110void bdi_arm_supers_timer(void);
108 111
109extern spinlock_t bdi_lock; 112extern spinlock_t bdi_lock;
110extern struct list_head bdi_list; 113extern struct list_head bdi_list;
@@ -246,6 +249,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
246#endif 249#endif
247 250
248extern struct backing_dev_info default_backing_dev_info; 251extern struct backing_dev_info default_backing_dev_info;
252extern struct backing_dev_info noop_backing_dev_info;
249void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 253void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
250 254
251int writeback_in_progress(struct backing_dev_info *bdi); 255int writeback_in_progress(struct backing_dev_info *bdi);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 8c4f884db6b4..4a3d52e545e1 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -36,18 +36,18 @@ struct backlight_device;
36struct fb_info; 36struct fb_info;
37 37
38struct backlight_ops { 38struct backlight_ops {
39 const unsigned int options; 39 unsigned int options;
40 40
41#define BL_CORE_SUSPENDRESUME (1 << 0) 41#define BL_CORE_SUSPENDRESUME (1 << 0)
42 42
43 /* Notify the backlight driver some property has changed */ 43 /* Notify the backlight driver some property has changed */
44 int (* const update_status)(struct backlight_device *); 44 int (*update_status)(struct backlight_device *);
45 /* Return the current backlight brightness (accounting for power, 45 /* Return the current backlight brightness (accounting for power,
46 fb_blank etc.) */ 46 fb_blank etc.) */
47 int (* const get_brightness)(struct backlight_device *); 47 int (*get_brightness)(struct backlight_device *);
48 /* Check if given framebuffer device is the one bound to this backlight; 48 /* Check if given framebuffer device is the one bound to this backlight;
49 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 49 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
50 int (* const check_fb)(struct fb_info *); 50 int (*check_fb)(struct backlight_device *, struct fb_info *);
51}; 51};
52 52
53/* This structure defines all the properties of a backlight */ 53/* This structure defines all the properties of a backlight */
@@ -103,7 +103,8 @@ static inline void backlight_update_status(struct backlight_device *bd)
103} 103}
104 104
105extern struct backlight_device *backlight_device_register(const char *name, 105extern struct backlight_device *backlight_device_register(const char *name,
106 struct device *dev, void *devdata, const struct backlight_ops *ops); 106 struct device *dev, void *devdata, const struct backlight_ops *ops,
107 const struct backlight_properties *props);
107extern void backlight_device_unregister(struct backlight_device *bd); 108extern void backlight_device_unregister(struct backlight_device *bd);
108extern void backlight_force_update(struct backlight_device *bd, 109extern void backlight_force_update(struct backlight_device *bd,
109 enum backlight_update_reason reason); 110 enum backlight_update_reason reason);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 89c6249fc561..c809e286d213 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -74,6 +74,7 @@ struct coredump_params {
74 struct pt_regs *regs; 74 struct pt_regs *regs;
75 struct file *file; 75 struct file *file;
76 unsigned long limit; 76 unsigned long limit;
77 unsigned long mm_flags;
77}; 78};
78 79
79/* 80/*
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index c05a29cb9bb2..fc68053378ce 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,22 +10,26 @@
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13extern unsigned int __sw_hweight8(unsigned int w);
14extern unsigned int __sw_hweight16(unsigned int w);
15extern unsigned int __sw_hweight32(unsigned int w);
16extern unsigned long __sw_hweight64(__u64 w);
17
13/* 18/*
14 * Include this here because some architectures need generic_ffs/fls in 19 * Include this here because some architectures need generic_ffs/fls in
15 * scope 20 * scope
16 */ 21 */
17#include <asm/bitops.h> 22#include <asm/bitops.h>
18 23
19#define for_each_bit(bit, addr, size) \ 24#define for_each_set_bit(bit, addr, size) \
20 for ((bit) = find_first_bit((addr), (size)); \ 25 for ((bit) = find_first_bit((addr), (size)); \
21 (bit) < (size); \ 26 (bit) < (size); \
22 (bit) = find_next_bit((addr), (size), (bit) + 1)) 27 (bit) = find_next_bit((addr), (size), (bit) + 1))
23 28
24
25static __inline__ int get_bitmask_order(unsigned int count) 29static __inline__ int get_bitmask_order(unsigned int count)
26{ 30{
27 int order; 31 int order;
28 32
29 order = fls(count); 33 order = fls(count);
30 return order; /* We could be slightly more clever with -1 here... */ 34 return order; /* We could be slightly more clever with -1 here... */
31} 35}
@@ -33,7 +37,7 @@ static __inline__ int get_bitmask_order(unsigned int count)
33static __inline__ int get_count_order(unsigned int count) 37static __inline__ int get_count_order(unsigned int count)
34{ 38{
35 int order; 39 int order;
36 40
37 order = fls(count) - 1; 41 order = fls(count) - 1;
38 if (count & (count - 1)) 42 if (count & (count - 1))
39 order++; 43 order++;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5c8018977efa..09a840264d6f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -158,7 +158,6 @@ enum rq_flag_bits {
158struct request { 158struct request {
159 struct list_head queuelist; 159 struct list_head queuelist;
160 struct call_single_data csd; 160 struct call_single_data csd;
161 int cpu;
162 161
163 struct request_queue *q; 162 struct request_queue *q;
164 163
@@ -166,9 +165,11 @@ struct request {
166 enum rq_cmd_type_bits cmd_type; 165 enum rq_cmd_type_bits cmd_type;
167 unsigned long atomic_flags; 166 unsigned long atomic_flags;
168 167
168 int cpu;
169
169 /* the following two fields are internal, NEVER access directly */ 170 /* the following two fields are internal, NEVER access directly */
170 sector_t __sector; /* sector cursor */
171 unsigned int __data_len; /* total data len */ 171 unsigned int __data_len; /* total data len */
172 sector_t __sector; /* sector cursor */
172 173
173 struct bio *bio; 174 struct bio *bio;
174 struct bio *biotail; 175 struct bio *biotail;
@@ -185,15 +186,19 @@ struct request {
185 }; 186 };
186 187
187 /* 188 /*
188 * two pointers are available for the IO schedulers, if they need 189 * Three pointers are available for the IO schedulers, if they need
189 * more they have to dynamically allocate it. 190 * more they have to dynamically allocate it.
190 */ 191 */
191 void *elevator_private; 192 void *elevator_private;
192 void *elevator_private2; 193 void *elevator_private2;
194 void *elevator_private3;
193 195
194 struct gendisk *rq_disk; 196 struct gendisk *rq_disk;
195 unsigned long start_time; 197 unsigned long start_time;
196 198#ifdef CONFIG_BLK_CGROUP
199 unsigned long long start_time_ns;
200 unsigned long long io_start_time_ns; /* when passed to hardware */
201#endif
197 /* Number of scatter-gather DMA addr+len pairs after 202 /* Number of scatter-gather DMA addr+len pairs after
198 * physical address coalescing is performed. 203 * physical address coalescing is performed.
199 */ 204 */
@@ -201,20 +206,20 @@ struct request {
201 206
202 unsigned short ioprio; 207 unsigned short ioprio;
203 208
209 int ref_count;
210
204 void *special; /* opaque pointer available for LLD use */ 211 void *special; /* opaque pointer available for LLD use */
205 char *buffer; /* kaddr of the current segment if available */ 212 char *buffer; /* kaddr of the current segment if available */
206 213
207 int tag; 214 int tag;
208 int errors; 215 int errors;
209 216
210 int ref_count;
211
212 /* 217 /*
213 * when request is used as a packet command carrier 218 * when request is used as a packet command carrier
214 */ 219 */
215 unsigned short cmd_len;
216 unsigned char __cmd[BLK_MAX_CDB]; 220 unsigned char __cmd[BLK_MAX_CDB];
217 unsigned char *cmd; 221 unsigned char *cmd;
222 unsigned short cmd_len;
218 223
219 unsigned int extra_len; /* length of alignment and padding */ 224 unsigned int extra_len; /* length of alignment and padding */
220 unsigned int sense_len; 225 unsigned int sense_len;
@@ -316,8 +321,7 @@ struct queue_limits {
316 unsigned int discard_alignment; 321 unsigned int discard_alignment;
317 322
318 unsigned short logical_block_size; 323 unsigned short logical_block_size;
319 unsigned short max_hw_segments; 324 unsigned short max_segments;
320 unsigned short max_phys_segments;
321 325
322 unsigned char misaligned; 326 unsigned char misaligned;
323 unsigned char discard_misaligned; 327 unsigned char discard_misaligned;
@@ -461,8 +465,8 @@ struct request_queue
461#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ 465#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
462#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ 466#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
463#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 467#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
464#define QUEUE_FLAG_CQ 16 /* hardware does queuing */ 468#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */
465#define QUEUE_FLAG_DISCARD 17 /* supports DISCARD */ 469#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */
466 470
467#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 471#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
468 (1 << QUEUE_FLAG_CLUSTER) | \ 472 (1 << QUEUE_FLAG_CLUSTER) | \
@@ -586,9 +590,10 @@ enum {
586 590
587#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 591#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
588#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 592#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
589#define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags)
590#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 593#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
591#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 594#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
595#define blk_queue_noxmerges(q) \
596 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
592#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 597#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
593#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) 598#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
594#define blk_queue_flushing(q) ((q)->ordseq) 599#define blk_queue_flushing(q) ((q)->ordseq)
@@ -916,14 +921,17 @@ extern void blk_abort_queue(struct request_queue *);
916 */ 921 */
917extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, 922extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
918 spinlock_t *lock, int node_id); 923 spinlock_t *lock, int node_id);
924extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
925 request_fn_proc *,
926 spinlock_t *, int node_id);
919extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); 927extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
928extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
929 request_fn_proc *, spinlock_t *);
920extern void blk_cleanup_queue(struct request_queue *); 930extern void blk_cleanup_queue(struct request_queue *);
921extern void blk_queue_make_request(struct request_queue *, make_request_fn *); 931extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
922extern void blk_queue_bounce_limit(struct request_queue *, u64); 932extern void blk_queue_bounce_limit(struct request_queue *, u64);
923extern void blk_queue_max_sectors(struct request_queue *, unsigned int);
924extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); 933extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
925extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short); 934extern void blk_queue_max_segments(struct request_queue *, unsigned short);
926extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
927extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 935extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
928extern void blk_queue_max_discard_sectors(struct request_queue *q, 936extern void blk_queue_max_discard_sectors(struct request_queue *q,
929 unsigned int max_discard_sectors); 937 unsigned int max_discard_sectors);
@@ -995,32 +1003,36 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
995 return NULL; 1003 return NULL;
996 return bqt->tag_index[tag]; 1004 return bqt->tag_index[tag];
997} 1005}
998 1006enum{
999extern int blkdev_issue_flush(struct block_device *, sector_t *); 1007 BLKDEV_WAIT, /* wait for completion */
1000#define DISCARD_FL_WAIT 0x01 /* wait for completion */ 1008 BLKDEV_BARRIER, /*issue request with barrier */
1001#define DISCARD_FL_BARRIER 0x02 /* issue DISCARD_BARRIER request */ 1009};
1002extern int blkdev_issue_discard(struct block_device *, sector_t sector, 1010#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
1003 sector_t nr_sects, gfp_t, int flags); 1011#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
1004 1012extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
1013 unsigned long);
1014extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
1015 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1016extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
1017 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1005static inline int sb_issue_discard(struct super_block *sb, 1018static inline int sb_issue_discard(struct super_block *sb,
1006 sector_t block, sector_t nr_blocks) 1019 sector_t block, sector_t nr_blocks)
1007{ 1020{
1008 block <<= (sb->s_blocksize_bits - 9); 1021 block <<= (sb->s_blocksize_bits - 9);
1009 nr_blocks <<= (sb->s_blocksize_bits - 9); 1022 nr_blocks <<= (sb->s_blocksize_bits - 9);
1010 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, 1023 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL,
1011 DISCARD_FL_BARRIER); 1024 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1012} 1025}
1013 1026
1014extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 1027extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
1015 1028
1016#define MAX_PHYS_SEGMENTS 128 1029enum blk_default_limits {
1017#define MAX_HW_SEGMENTS 128 1030 BLK_MAX_SEGMENTS = 128,
1018#define SAFE_MAX_SECTORS 255 1031 BLK_SAFE_MAX_SECTORS = 255,
1019#define BLK_DEF_MAX_SECTORS 1024 1032 BLK_DEF_MAX_SECTORS = 1024,
1020 1033 BLK_MAX_SEGMENT_SIZE = 65536,
1021#define MAX_SEGMENT_SIZE 65536 1034 BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
1022 1035};
1023#define BLK_SEG_BOUNDARY_MASK 0xFFFFFFFFUL
1024 1036
1025#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) 1037#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
1026 1038
@@ -1044,14 +1056,9 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
1044 return q->limits.max_hw_sectors; 1056 return q->limits.max_hw_sectors;
1045} 1057}
1046 1058
1047static inline unsigned short queue_max_hw_segments(struct request_queue *q) 1059static inline unsigned short queue_max_segments(struct request_queue *q)
1048{
1049 return q->limits.max_hw_segments;
1050}
1051
1052static inline unsigned short queue_max_phys_segments(struct request_queue *q)
1053{ 1060{
1054 return q->limits.max_phys_segments; 1061 return q->limits.max_segments;
1055} 1062}
1056 1063
1057static inline unsigned int queue_max_segment_size(struct request_queue *q) 1064static inline unsigned int queue_max_segment_size(struct request_queue *q)
@@ -1112,18 +1119,13 @@ static inline int queue_alignment_offset(struct request_queue *q)
1112 return q->limits.alignment_offset; 1119 return q->limits.alignment_offset;
1113} 1120}
1114 1121
1115static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) 1122static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
1116{ 1123{
1117 unsigned int granularity = max(lim->physical_block_size, lim->io_min); 1124 unsigned int granularity = max(lim->physical_block_size, lim->io_min);
1125 unsigned int alignment = (sector << 9) & (granularity - 1);
1118 1126
1119 offset &= granularity - 1; 1127 return (granularity + lim->alignment_offset - alignment)
1120 return (granularity + lim->alignment_offset - offset) & (granularity - 1); 1128 & (granularity - 1);
1121}
1122
1123static inline int queue_sector_alignment_offset(struct request_queue *q,
1124 sector_t sector)
1125{
1126 return queue_limit_alignment_offset(&q->limits, sector << 9);
1127} 1129}
1128 1130
1129static inline int bdev_alignment_offset(struct block_device *bdev) 1131static inline int bdev_alignment_offset(struct block_device *bdev)
@@ -1147,10 +1149,8 @@ static inline int queue_discard_alignment(struct request_queue *q)
1147 return q->limits.discard_alignment; 1149 return q->limits.discard_alignment;
1148} 1150}
1149 1151
1150static inline int queue_sector_discard_alignment(struct request_queue *q, 1152static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
1151 sector_t sector)
1152{ 1153{
1153 struct queue_limits *lim = &q->limits;
1154 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); 1154 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);
1155 1155
1156 return (lim->discard_granularity + lim->discard_alignment - alignment) 1156 return (lim->discard_granularity + lim->discard_alignment - alignment)
@@ -1210,6 +1210,48 @@ static inline void put_dev_sector(Sector p)
1210struct work_struct; 1210struct work_struct;
1211int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1211int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1212 1212
1213#ifdef CONFIG_BLK_CGROUP
1214/*
1215 * This should not be using sched_clock(). A real patch is in progress
1216 * to fix this up, until that is in place we need to disable preemption
1217 * around sched_clock() in this function and set_io_start_time_ns().
1218 */
1219static inline void set_start_time_ns(struct request *req)
1220{
1221 preempt_disable();
1222 req->start_time_ns = sched_clock();
1223 preempt_enable();
1224}
1225
1226static inline void set_io_start_time_ns(struct request *req)
1227{
1228 preempt_disable();
1229 req->io_start_time_ns = sched_clock();
1230 preempt_enable();
1231}
1232
1233static inline uint64_t rq_start_time_ns(struct request *req)
1234{
1235 return req->start_time_ns;
1236}
1237
1238static inline uint64_t rq_io_start_time_ns(struct request *req)
1239{
1240 return req->io_start_time_ns;
1241}
1242#else
1243static inline void set_start_time_ns(struct request *req) {}
1244static inline void set_io_start_time_ns(struct request *req) {}
1245static inline uint64_t rq_start_time_ns(struct request *req)
1246{
1247 return 0;
1248}
1249static inline uint64_t rq_io_start_time_ns(struct request *req)
1250{
1251 return 0;
1252}
1253#endif
1254
1213#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1255#define MODULE_ALIAS_BLOCKDEV(major,minor) \
1214 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 1256 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
1215#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 1257#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
@@ -1297,10 +1339,11 @@ struct block_device_operations {
1297 int (*direct_access) (struct block_device *, sector_t, 1339 int (*direct_access) (struct block_device *, sector_t,
1298 void **, unsigned long *); 1340 void **, unsigned long *);
1299 int (*media_changed) (struct gendisk *); 1341 int (*media_changed) (struct gendisk *);
1300 unsigned long long (*set_capacity) (struct gendisk *, 1342 void (*unlock_native_capacity) (struct gendisk *);
1301 unsigned long long);
1302 int (*revalidate_disk) (struct gendisk *); 1343 int (*revalidate_disk) (struct gendisk *);
1303 int (*getgeo)(struct block_device *, struct hd_geometry *); 1344 int (*getgeo)(struct block_device *, struct hd_geometry *);
1345 /* this callback is with swap_lock and sometimes page table lock held */
1346 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
1304 struct module *owner; 1347 struct module *owner;
1305}; 1348};
1306 1349
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 3b73b9992b26..416bf62d6d46 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -150,8 +150,8 @@ struct blk_user_trace_setup {
150struct blk_trace { 150struct blk_trace {
151 int trace_state; 151 int trace_state;
152 struct rchan *rchan; 152 struct rchan *rchan;
153 unsigned long *sequence; 153 unsigned long __percpu *sequence;
154 unsigned char *msg_data; 154 unsigned char __percpu *msg_data;
155 u16 act_mask; 155 u16 act_mask;
156 u64 start_lba; 156 u64 start_lba;
157 u64 end_lba; 157 u64 end_lba;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index b10ec49ee2dd..266ab9291232 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -23,6 +23,7 @@ extern unsigned long max_pfn;
23extern unsigned long saved_max_pfn; 23extern unsigned long saved_max_pfn;
24#endif 24#endif
25 25
26#ifndef CONFIG_NO_BOOTMEM
26/* 27/*
27 * node_bootmem_map is a map pointer - the bits represent all physical 28 * node_bootmem_map is a map pointer - the bits represent all physical
28 * memory pages (including holes) on the node. 29 * memory pages (including holes) on the node.
@@ -37,6 +38,7 @@ typedef struct bootmem_data {
37} bootmem_data_t; 38} bootmem_data_t;
38 39
39extern bootmem_data_t bootmem_node_data[]; 40extern bootmem_data_t bootmem_node_data[];
41#endif
40 42
41extern unsigned long bootmem_bootmap_pages(unsigned long); 43extern unsigned long bootmem_bootmap_pages(unsigned long);
42 44
@@ -46,6 +48,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
46 unsigned long endpfn); 48 unsigned long endpfn);
47extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 49extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
48 50
51unsigned long free_all_memory_core_early(int nodeid);
49extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); 52extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
50extern unsigned long free_all_bootmem(void); 53extern unsigned long free_all_bootmem(void);
51 54
@@ -84,6 +87,10 @@ extern void *__alloc_bootmem_node(pg_data_t *pgdat,
84 unsigned long size, 87 unsigned long size,
85 unsigned long align, 88 unsigned long align,
86 unsigned long goal); 89 unsigned long goal);
90void *__alloc_bootmem_node_high(pg_data_t *pgdat,
91 unsigned long size,
92 unsigned long align,
93 unsigned long goal);
87extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, 94extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat,
88 unsigned long size, 95 unsigned long size,
89 unsigned long align, 96 unsigned long align,
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 2b31b91f5871..7f437ca1ed44 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -1,3 +1,14 @@
1#define PHY_ID_BCM50610 0x0143bd60
2#define PHY_ID_BCM50610M 0x0143bd70
3#define PHY_ID_BCMAC131 0x0143bc70
4#define PHY_ID_BCM57780 0x03625d90
5
6#define PHY_BCM_OUI_MASK 0xfffffc00
7#define PHY_BCM_OUI_1 0x00206000
8#define PHY_BCM_OUI_2 0x0143bc00
9#define PHY_BCM_OUI_3 0x03625c00
10
11
1#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 12#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
2#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 13#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002
3#define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 14#define PHY_BCM_FLAGS_INTF_SGMII 0x00000010
diff --git a/include/linux/btree-128.h b/include/linux/btree-128.h
new file mode 100644
index 000000000000..0b3414c4c928
--- /dev/null
+++ b/include/linux/btree-128.h
@@ -0,0 +1,109 @@
1extern struct btree_geo btree_geo128;
2
3struct btree_head128 { struct btree_head h; };
4
5static inline void btree_init_mempool128(struct btree_head128 *head,
6 mempool_t *mempool)
7{
8 btree_init_mempool(&head->h, mempool);
9}
10
11static inline int btree_init128(struct btree_head128 *head)
12{
13 return btree_init(&head->h);
14}
15
16static inline void btree_destroy128(struct btree_head128 *head)
17{
18 btree_destroy(&head->h);
19}
20
21static inline void *btree_lookup128(struct btree_head128 *head, u64 k1, u64 k2)
22{
23 u64 key[2] = {k1, k2};
24 return btree_lookup(&head->h, &btree_geo128, (unsigned long *)&key);
25}
26
27static inline void *btree_get_prev128(struct btree_head128 *head,
28 u64 *k1, u64 *k2)
29{
30 u64 key[2] = {*k1, *k2};
31 void *val;
32
33 val = btree_get_prev(&head->h, &btree_geo128,
34 (unsigned long *)&key);
35 *k1 = key[0];
36 *k2 = key[1];
37 return val;
38}
39
40static inline int btree_insert128(struct btree_head128 *head, u64 k1, u64 k2,
41 void *val, gfp_t gfp)
42{
43 u64 key[2] = {k1, k2};
44 return btree_insert(&head->h, &btree_geo128,
45 (unsigned long *)&key, val, gfp);
46}
47
48static inline int btree_update128(struct btree_head128 *head, u64 k1, u64 k2,
49 void *val)
50{
51 u64 key[2] = {k1, k2};
52 return btree_update(&head->h, &btree_geo128,
53 (unsigned long *)&key, val);
54}
55
56static inline void *btree_remove128(struct btree_head128 *head, u64 k1, u64 k2)
57{
58 u64 key[2] = {k1, k2};
59 return btree_remove(&head->h, &btree_geo128, (unsigned long *)&key);
60}
61
62static inline void *btree_last128(struct btree_head128 *head, u64 *k1, u64 *k2)
63{
64 u64 key[2];
65 void *val;
66
67 val = btree_last(&head->h, &btree_geo128, (unsigned long *)&key[0]);
68 if (val) {
69 *k1 = key[0];
70 *k2 = key[1];
71 }
72
73 return val;
74}
75
76static inline int btree_merge128(struct btree_head128 *target,
77 struct btree_head128 *victim,
78 gfp_t gfp)
79{
80 return btree_merge(&target->h, &victim->h, &btree_geo128, gfp);
81}
82
83void visitor128(void *elem, unsigned long opaque, unsigned long *__key,
84 size_t index, void *__func);
85
86typedef void (*visitor128_t)(void *elem, unsigned long opaque,
87 u64 key1, u64 key2, size_t index);
88
89static inline size_t btree_visitor128(struct btree_head128 *head,
90 unsigned long opaque,
91 visitor128_t func2)
92{
93 return btree_visitor(&head->h, &btree_geo128, opaque,
94 visitor128, func2);
95}
96
97static inline size_t btree_grim_visitor128(struct btree_head128 *head,
98 unsigned long opaque,
99 visitor128_t func2)
100{
101 return btree_grim_visitor(&head->h, &btree_geo128, opaque,
102 visitor128, func2);
103}
104
105#define btree_for_each_safe128(head, k1, k2, val) \
106 for (val = btree_last128(head, &k1, &k2); \
107 val; \
108 val = btree_get_prev128(head, &k1, &k2))
109
diff --git a/include/linux/btree-type.h b/include/linux/btree-type.h
new file mode 100644
index 000000000000..9a1147ef8563
--- /dev/null
+++ b/include/linux/btree-type.h
@@ -0,0 +1,147 @@
1#define __BTREE_TP(pfx, type, sfx) pfx ## type ## sfx
2#define _BTREE_TP(pfx, type, sfx) __BTREE_TP(pfx, type, sfx)
3#define BTREE_TP(pfx) _BTREE_TP(pfx, BTREE_TYPE_SUFFIX,)
4#define BTREE_FN(name) BTREE_TP(btree_ ## name)
5#define BTREE_TYPE_HEAD BTREE_TP(struct btree_head)
6#define VISITOR_FN BTREE_TP(visitor)
7#define VISITOR_FN_T _BTREE_TP(visitor, BTREE_TYPE_SUFFIX, _t)
8
9BTREE_TYPE_HEAD {
10 struct btree_head h;
11};
12
13static inline void BTREE_FN(init_mempool)(BTREE_TYPE_HEAD *head,
14 mempool_t *mempool)
15{
16 btree_init_mempool(&head->h, mempool);
17}
18
19static inline int BTREE_FN(init)(BTREE_TYPE_HEAD *head)
20{
21 return btree_init(&head->h);
22}
23
24static inline void BTREE_FN(destroy)(BTREE_TYPE_HEAD *head)
25{
26 btree_destroy(&head->h);
27}
28
29static inline int BTREE_FN(merge)(BTREE_TYPE_HEAD *target,
30 BTREE_TYPE_HEAD *victim,
31 gfp_t gfp)
32{
33 return btree_merge(&target->h, &victim->h, BTREE_TYPE_GEO, gfp);
34}
35
36#if (BITS_PER_LONG > BTREE_TYPE_BITS)
37static inline void *BTREE_FN(lookup)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key)
38{
39 unsigned long _key = key;
40 return btree_lookup(&head->h, BTREE_TYPE_GEO, &_key);
41}
42
43static inline int BTREE_FN(insert)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key,
44 void *val, gfp_t gfp)
45{
46 unsigned long _key = key;
47 return btree_insert(&head->h, BTREE_TYPE_GEO, &_key, val, gfp);
48}
49
50static inline int BTREE_FN(update)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key,
51 void *val)
52{
53 unsigned long _key = key;
54 return btree_update(&head->h, BTREE_TYPE_GEO, &_key, val);
55}
56
57static inline void *BTREE_FN(remove)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key)
58{
59 unsigned long _key = key;
60 return btree_remove(&head->h, BTREE_TYPE_GEO, &_key);
61}
62
63static inline void *BTREE_FN(last)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key)
64{
65 unsigned long _key;
66 void *val = btree_last(&head->h, BTREE_TYPE_GEO, &_key);
67 if (val)
68 *key = _key;
69 return val;
70}
71
72static inline void *BTREE_FN(get_prev)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key)
73{
74 unsigned long _key = *key;
75 void *val = btree_get_prev(&head->h, BTREE_TYPE_GEO, &_key);
76 if (val)
77 *key = _key;
78 return val;
79}
80#else
81static inline void *BTREE_FN(lookup)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key)
82{
83 return btree_lookup(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key);
84}
85
86static inline int BTREE_FN(insert)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key,
87 void *val, gfp_t gfp)
88{
89 return btree_insert(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key,
90 val, gfp);
91}
92
93static inline int BTREE_FN(update)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key,
94 void *val)
95{
96 return btree_update(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key, val);
97}
98
99static inline void *BTREE_FN(remove)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE key)
100{
101 return btree_remove(&head->h, BTREE_TYPE_GEO, (unsigned long *)&key);
102}
103
104static inline void *BTREE_FN(last)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key)
105{
106 return btree_last(&head->h, BTREE_TYPE_GEO, (unsigned long *)key);
107}
108
109static inline void *BTREE_FN(get_prev)(BTREE_TYPE_HEAD *head, BTREE_KEYTYPE *key)
110{
111 return btree_get_prev(&head->h, BTREE_TYPE_GEO, (unsigned long *)key);
112}
113#endif
114
115void VISITOR_FN(void *elem, unsigned long opaque, unsigned long *key,
116 size_t index, void *__func);
117
118typedef void (*VISITOR_FN_T)(void *elem, unsigned long opaque,
119 BTREE_KEYTYPE key, size_t index);
120
121static inline size_t BTREE_FN(visitor)(BTREE_TYPE_HEAD *head,
122 unsigned long opaque,
123 VISITOR_FN_T func2)
124{
125 return btree_visitor(&head->h, BTREE_TYPE_GEO, opaque,
126 visitorl, func2);
127}
128
129static inline size_t BTREE_FN(grim_visitor)(BTREE_TYPE_HEAD *head,
130 unsigned long opaque,
131 VISITOR_FN_T func2)
132{
133 return btree_grim_visitor(&head->h, BTREE_TYPE_GEO, opaque,
134 visitorl, func2);
135}
136
137#undef VISITOR_FN
138#undef VISITOR_FN_T
139#undef __BTREE_TP
140#undef _BTREE_TP
141#undef BTREE_TP
142#undef BTREE_FN
143#undef BTREE_TYPE_HEAD
144#undef BTREE_TYPE_SUFFIX
145#undef BTREE_TYPE_GEO
146#undef BTREE_KEYTYPE
147#undef BTREE_TYPE_BITS
diff --git a/include/linux/btree.h b/include/linux/btree.h
new file mode 100644
index 000000000000..65b5bb058324
--- /dev/null
+++ b/include/linux/btree.h
@@ -0,0 +1,243 @@
1#ifndef BTREE_H
2#define BTREE_H
3
4#include <linux/kernel.h>
5#include <linux/mempool.h>
6
7/**
8 * DOC: B+Tree basics
9 *
10 * A B+Tree is a data structure for looking up arbitrary (currently allowing
11 * unsigned long, u32, u64 and 2 * u64) keys into pointers. The data structure
12 * is described at http://en.wikipedia.org/wiki/B-tree, we currently do not
13 * use binary search to find the key on lookups.
14 *
15 * Each B+Tree consists of a head, that contains bookkeeping information and
16 * a variable number (starting with zero) nodes. Each node contains the keys
17 * and pointers to sub-nodes, or, for leaf nodes, the keys and values for the
18 * tree entries.
19 *
20 * Each node in this implementation has the following layout:
21 * [key1, key2, ..., keyN] [val1, val2, ..., valN]
22 *
23 * Each key here is an array of unsigned longs, geo->no_longs in total. The
24 * number of keys and values (N) is geo->no_pairs.
25 */
26
27/**
28 * struct btree_head - btree head
29 *
30 * @node: the first node in the tree
31 * @mempool: mempool used for node allocations
32 * @height: current of the tree
33 */
34struct btree_head {
35 unsigned long *node;
36 mempool_t *mempool;
37 int height;
38};
39
40/* btree geometry */
41struct btree_geo;
42
43/**
44 * btree_alloc - allocate function for the mempool
45 * @gfp_mask: gfp mask for the allocation
46 * @pool_data: unused
47 */
48void *btree_alloc(gfp_t gfp_mask, void *pool_data);
49
50/**
51 * btree_free - free function for the mempool
52 * @element: the element to free
53 * @pool_data: unused
54 */
55void btree_free(void *element, void *pool_data);
56
57/**
58 * btree_init_mempool - initialise a btree with given mempool
59 *
60 * @head: the btree head to initialise
61 * @mempool: the mempool to use
62 *
63 * When this function is used, there is no need to destroy
64 * the mempool.
65 */
66void btree_init_mempool(struct btree_head *head, mempool_t *mempool);
67
68/**
69 * btree_init - initialise a btree
70 *
71 * @head: the btree head to initialise
72 *
73 * This function allocates the memory pool that the
74 * btree needs. Returns zero or a negative error code
75 * (-%ENOMEM) when memory allocation fails.
76 *
77 */
78int __must_check btree_init(struct btree_head *head);
79
80/**
81 * btree_destroy - destroy mempool
82 *
83 * @head: the btree head to destroy
84 *
85 * This function destroys the internal memory pool, use only
86 * when using btree_init(), not with btree_init_mempool().
87 */
88void btree_destroy(struct btree_head *head);
89
90/**
91 * btree_lookup - look up a key in the btree
92 *
93 * @head: the btree to look in
94 * @geo: the btree geometry
95 * @key: the key to look up
96 *
97 * This function returns the value for the given key, or %NULL.
98 */
99void *btree_lookup(struct btree_head *head, struct btree_geo *geo,
100 unsigned long *key);
101
102/**
103 * btree_insert - insert an entry into the btree
104 *
105 * @head: the btree to add to
106 * @geo: the btree geometry
107 * @key: the key to add (must not already be present)
108 * @val: the value to add (must not be %NULL)
109 * @gfp: allocation flags for node allocations
110 *
111 * This function returns 0 if the item could be added, or an
112 * error code if it failed (may fail due to memory pressure).
113 */
114int __must_check btree_insert(struct btree_head *head, struct btree_geo *geo,
115 unsigned long *key, void *val, gfp_t gfp);
116/**
117 * btree_update - update an entry in the btree
118 *
119 * @head: the btree to update
120 * @geo: the btree geometry
121 * @key: the key to update
122 * @val: the value to change it to (must not be %NULL)
123 *
124 * This function returns 0 if the update was successful, or
125 * -%ENOENT if the key could not be found.
126 */
127int btree_update(struct btree_head *head, struct btree_geo *geo,
128 unsigned long *key, void *val);
129/**
130 * btree_remove - remove an entry from the btree
131 *
132 * @head: the btree to update
133 * @geo: the btree geometry
134 * @key: the key to remove
135 *
136 * This function returns the removed entry, or %NULL if the key
137 * could not be found.
138 */
139void *btree_remove(struct btree_head *head, struct btree_geo *geo,
140 unsigned long *key);
141
142/**
143 * btree_merge - merge two btrees
144 *
145 * @target: the tree that gets all the entries
146 * @victim: the tree that gets merged into @target
147 * @geo: the btree geometry
148 * @gfp: allocation flags
149 *
150 * The two trees @target and @victim may not contain the same keys,
151 * that is a bug and triggers a BUG(). This function returns zero
152 * if the trees were merged successfully, and may return a failure
153 * when memory allocation fails, in which case both trees might have
154 * been partially merged, i.e. some entries have been moved from
155 * @victim to @target.
156 */
157int btree_merge(struct btree_head *target, struct btree_head *victim,
158 struct btree_geo *geo, gfp_t gfp);
159
160/**
161 * btree_last - get last entry in btree
162 *
163 * @head: btree head
164 * @geo: btree geometry
165 * @key: last key
166 *
167 * Returns the last entry in the btree, and sets @key to the key
168 * of that entry; returns NULL if the tree is empty, in that case
169 * key is not changed.
170 */
171void *btree_last(struct btree_head *head, struct btree_geo *geo,
172 unsigned long *key);
173
174/**
175 * btree_get_prev - get previous entry
176 *
177 * @head: btree head
178 * @geo: btree geometry
179 * @key: pointer to key
180 *
181 * The function returns the next item right before the value pointed to by
182 * @key, and updates @key with its key, or returns %NULL when there is no
183 * entry with a key smaller than the given key.
184 */
185void *btree_get_prev(struct btree_head *head, struct btree_geo *geo,
186 unsigned long *key);
187
188
189/* internal use, use btree_visitor{l,32,64,128} */
190size_t btree_visitor(struct btree_head *head, struct btree_geo *geo,
191 unsigned long opaque,
192 void (*func)(void *elem, unsigned long opaque,
193 unsigned long *key, size_t index,
194 void *func2),
195 void *func2);
196
197/* internal use, use btree_grim_visitor{l,32,64,128} */
198size_t btree_grim_visitor(struct btree_head *head, struct btree_geo *geo,
199 unsigned long opaque,
200 void (*func)(void *elem, unsigned long opaque,
201 unsigned long *key,
202 size_t index, void *func2),
203 void *func2);
204
205
206#include <linux/btree-128.h>
207
208extern struct btree_geo btree_geo32;
209#define BTREE_TYPE_SUFFIX l
210#define BTREE_TYPE_BITS BITS_PER_LONG
211#define BTREE_TYPE_GEO &btree_geo32
212#define BTREE_KEYTYPE unsigned long
213#include <linux/btree-type.h>
214
215#define btree_for_each_safel(head, key, val) \
216 for (val = btree_lastl(head, &key); \
217 val; \
218 val = btree_get_prevl(head, &key))
219
220#define BTREE_TYPE_SUFFIX 32
221#define BTREE_TYPE_BITS 32
222#define BTREE_TYPE_GEO &btree_geo32
223#define BTREE_KEYTYPE u32
224#include <linux/btree-type.h>
225
226#define btree_for_each_safe32(head, key, val) \
227 for (val = btree_last32(head, &key); \
228 val; \
229 val = btree_get_prev32(head, &key))
230
231extern struct btree_geo btree_geo64;
232#define BTREE_TYPE_SUFFIX 64
233#define BTREE_TYPE_BITS 64
234#define BTREE_TYPE_GEO &btree_geo64
235#define BTREE_KEYTYPE u64
236#include <linux/btree-type.h>
237
238#define btree_for_each_safe64(head, key, val) \
239 for (val = btree_last64(head, &key); \
240 val; \
241 val = btree_get_prev64(head, &key))
242
243#endif
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 16ed0284d780..1b9ba193b789 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -203,6 +203,9 @@ int block_write_full_page_endio(struct page *page, get_block_t *get_block,
203int block_read_full_page(struct page*, get_block_t*); 203int block_read_full_page(struct page*, get_block_t*);
204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
205 unsigned long from); 205 unsigned long from);
206int block_write_begin_newtrunc(struct file *, struct address_space *,
207 loff_t, unsigned, unsigned,
208 struct page **, void **, get_block_t*);
206int block_write_begin(struct file *, struct address_space *, 209int block_write_begin(struct file *, struct address_space *,
207 loff_t, unsigned, unsigned, 210 loff_t, unsigned, unsigned,
208 struct page **, void **, get_block_t*); 211 struct page **, void **, get_block_t*);
@@ -214,6 +217,9 @@ int generic_write_end(struct file *, struct address_space *,
214 struct page *, void *); 217 struct page *, void *);
215void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); 218void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
216int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 219int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
220int cont_write_begin_newtrunc(struct file *, struct address_space *, loff_t,
221 unsigned, unsigned, struct page **, void **,
222 get_block_t *, loff_t *);
217int cont_write_begin(struct file *, struct address_space *, loff_t, 223int cont_write_begin(struct file *, struct address_space *, loff_t,
218 unsigned, unsigned, struct page **, void **, 224 unsigned, unsigned, struct page **, void **,
219 get_block_t *, loff_t *); 225 get_block_t *, loff_t *);
@@ -224,7 +230,10 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
224void block_sync_page(struct page *); 230void block_sync_page(struct page *);
225sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 231sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
226int block_truncate_page(struct address_space *, loff_t, get_block_t *); 232int block_truncate_page(struct address_space *, loff_t, get_block_t *);
227int file_fsync(struct file *, struct dentry *, int); 233int file_fsync(struct file *, int);
234int nobh_write_begin_newtrunc(struct file *, struct address_space *,
235 loff_t, unsigned, unsigned,
236 struct page **, void **, get_block_t*);
228int nobh_write_begin(struct file *, struct address_space *, 237int nobh_write_begin(struct file *, struct address_space *,
229 loff_t, unsigned, unsigned, 238 loff_t, unsigned, unsigned,
230 struct page **, void **, get_block_t*); 239 struct page **, void **, get_block_t*);
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h
new file mode 100644
index 000000000000..2a61eb1beb85
--- /dev/null
+++ b/include/linux/caif/caif_socket.h
@@ -0,0 +1,165 @@
1/* linux/caif_socket.h
2 * CAIF Definitions for CAIF socket and network layer
3 * Copyright (C) ST-Ericsson AB 2010
4 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef _LINUX_CAIF_SOCKET_H
9#define _LINUX_CAIF_SOCKET_H
10
11#include <linux/types.h>
12
13#ifdef __KERNEL__
14#include <linux/socket.h>
15#else
16#include <sys/socket.h>
17#endif
18
19/**
20 * enum caif_link_selector - Physical Link Selection.
21 * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
22 * traffic.
23 * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
24 * traffic.
25 *
26 * CAIF Link Layers can register their link properties.
27 * This enum is used for choosing between CAIF Link Layers when
28 * setting up CAIF Channels when multiple CAIF Link Layers exists.
29 */
30enum caif_link_selector {
31 CAIF_LINK_HIGH_BANDW,
32 CAIF_LINK_LOW_LATENCY
33};
34
35/**
36 * enum caif_channel_priority - CAIF channel priorities.
37 *
38 * @CAIF_PRIO_MIN: Min priority for a channel.
39 * @CAIF_PRIO_LOW: Low-priority channel.
40 * @CAIF_PRIO_NORMAL: Normal/default priority level.
41 * @CAIF_PRIO_HIGH: High priority level
42 * @CAIF_PRIO_MAX: Max priority for channel
43 *
44 * Priority can be set on CAIF Channels in order to
45 * prioritize between traffic on different CAIF Channels.
46 * These priority levels are recommended, but the priority value
47 * is not restricted to the values defined in this enum, any value
48 * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
49 */
50enum caif_channel_priority {
51 CAIF_PRIO_MIN = 0x01,
52 CAIF_PRIO_LOW = 0x04,
53 CAIF_PRIO_NORMAL = 0x0f,
54 CAIF_PRIO_HIGH = 0x14,
55 CAIF_PRIO_MAX = 0x1F
56};
57
58/**
59 * enum caif_protocol_type - CAIF Channel type.
60 * @CAIFPROTO_AT: Classic AT channel.
61 * @CAIFPROTO_DATAGRAM: Datagram channel.
62 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
63 * @CAIFPROTO_UTIL: Utility (Psock) channel.
64 * @CAIFPROTO_RFM: Remote File Manager
65 *
66 * This enum defines the CAIF Channel type to be used. This defines
67 * the service to connect to on the modem.
68 */
69enum caif_protocol_type {
70 CAIFPROTO_AT,
71 CAIFPROTO_DATAGRAM,
72 CAIFPROTO_DATAGRAM_LOOP,
73 CAIFPROTO_UTIL,
74 CAIFPROTO_RFM,
75 _CAIFPROTO_MAX
76};
77#define CAIFPROTO_MAX _CAIFPROTO_MAX
78
79/**
80 * enum caif_at_type - AT Service Endpoint
81 * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
82 */
83enum caif_at_type {
84 CAIF_ATTYPE_PLAIN = 2
85};
86
87/**
88 * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
89 * @family: Address family number, must be AF_CAIF.
90 * @u: Union of address data 'switched' by family.
91 * :
92 * @u.at: Applies when family = CAIFPROTO_AT.
93 *
94 * @u.at.type: Type of AT link to set up (enum caif_at_type).
95 *
96 * @u.util: Applies when family = CAIFPROTO_UTIL
97 *
98 * @u.util.service: Utility service name.
99 *
100 * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM
101 *
102 * @u.dgm.connection_id: Datagram connection id.
103 *
104 * @u.dgm.nsapi: NSAPI of the PDP-Context.
105 *
106 * @u.rfm: Applies when family = CAIFPROTO_RFM
107 *
108 * @u.rfm.connection_id: Connection ID for RFM.
109 *
110 * @u.rfm.volume: Volume to mount.
111 *
112 * Description:
113 * This structure holds the connect parameters used for setting up a
114 * CAIF Channel. It defines the service to connect to on the modem.
115 */
116struct sockaddr_caif {
117 sa_family_t family;
118 union {
119 struct {
120 __u8 type; /* type: enum caif_at_type */
121 } at; /* CAIFPROTO_AT */
122 struct {
123 char service[16];
124 } util; /* CAIFPROTO_UTIL */
125 union {
126 __u32 connection_id;
127 __u8 nsapi;
128 } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
129 struct {
130 __u32 connection_id;
131 char volume[16];
132 } rfm; /* CAIFPROTO_RFM */
133 } u;
134};
135
136/**
137 * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
138 *
139 * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are
140 * available. Either a high bandwidth
141 * link can be selected (CAIF_LINK_HIGH_BANDW) or
142 * or a low latency link (CAIF_LINK_LOW_LATENCY).
143 * This option is of type __u32.
144 * Alternatively SO_BINDTODEVICE can be used.
145 *
146 * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
147 * utility channel. (maximum 256 bytes). This
148 * option must be set before connecting.
149 *
150 * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility
151 * channel. (maximum 256 bytes). This option
152 * is valid after a successful connect.
153 *
154 *
155 * This enum defines the CAIF Socket options to be used on a socket
156 * of type PF_CAIF.
157 *
158 */
159enum caif_socket_opts {
160 CAIFSO_LINK_SELECT = 127,
161 CAIFSO_REQ_PARAM = 128,
162 CAIFSO_RSP_PARAM = 129,
163};
164
165#endif /* _LINUX_CAIF_SOCKET_H */
diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h
new file mode 100644
index 000000000000..5e7eed4edf51
--- /dev/null
+++ b/include/linux/caif/if_caif.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef IF_CAIF_H_
8#define IF_CAIF_H_
9#include <linux/sockios.h>
10#include <linux/types.h>
11#include <linux/socket.h>
12
13/**
14 * enum ifla_caif - CAIF NetlinkRT parameters.
15 * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context.
16 * The type of attribute is NLA_U32.
17 * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context.
18 * The type of attribute is NLA_U32.
19 * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback
20 * The type of attribute is NLA_U8.
21 *
22 * When using RT Netlink to create, destroy or configure a CAIF IP interface,
23 * enum ifla_caif is used to specify the configuration attributes.
24 */
25enum ifla_caif {
26 __IFLA_CAIF_UNSPEC,
27 IFLA_CAIF_IPV4_CONNID,
28 IFLA_CAIF_IPV6_CONNID,
29 IFLA_CAIF_LOOPBACK,
30 __IFLA_CAIF_MAX
31};
32#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1)
33
34#endif /*IF_CAIF_H_*/
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 3db7767d2a17..cc0bb4961669 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -14,6 +14,7 @@
14#ifndef CAN_DEV_H 14#ifndef CAN_DEV_H
15#define CAN_DEV_H 15#define CAN_DEV_H
16 16
17#include <linux/can.h>
17#include <linux/can/netlink.h> 18#include <linux/can/netlink.h>
18#include <linux/can/error.h> 19#include <linux/can/error.h>
19 20
@@ -38,6 +39,7 @@ struct can_priv {
38 39
39 enum can_state state; 40 enum can_state state;
40 u32 ctrlmode; 41 u32 ctrlmode;
42 u32 ctrlmode_supported;
41 43
42 int restart_ms; 44 int restart_ms;
43 struct timer_list restart_timer; 45 struct timer_list restart_timer;
@@ -46,6 +48,8 @@ struct can_priv {
46 int (*do_set_mode)(struct net_device *dev, enum can_mode mode); 48 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
47 int (*do_get_state)(const struct net_device *dev, 49 int (*do_get_state)(const struct net_device *dev,
48 enum can_state *state); 50 enum can_state *state);
51 int (*do_get_berr_counter)(const struct net_device *dev,
52 struct can_berr_counter *bec);
49 53
50 unsigned int echo_skb_max; 54 unsigned int echo_skb_max;
51 struct sk_buff **echo_skb; 55 struct sk_buff **echo_skb;
@@ -60,6 +64,21 @@ struct can_priv {
60 */ 64 */
61#define get_can_dlc(i) (min_t(__u8, (i), 8)) 65#define get_can_dlc(i) (min_t(__u8, (i), 8))
62 66
67/* Drop a given socketbuffer if it does not contain a valid CAN frame. */
68static inline int can_dropped_invalid_skb(struct net_device *dev,
69 struct sk_buff *skb)
70{
71 const struct can_frame *cf = (struct can_frame *)skb->data;
72
73 if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) {
74 kfree_skb(skb);
75 dev->stats.tx_dropped++;
76 return 1;
77 }
78
79 return 0;
80}
81
63struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); 82struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
64void free_candev(struct net_device *dev); 83void free_candev(struct net_device *dev);
65 84
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
index 9ecbb7871c0e..3250de935e1a 100644
--- a/include/linux/can/netlink.h
+++ b/include/linux/can/netlink.h
@@ -70,6 +70,14 @@ enum can_state {
70}; 70};
71 71
72/* 72/*
73 * CAN bus error counters
74 */
75struct can_berr_counter {
76 __u16 txerr;
77 __u16 rxerr;
78};
79
80/*
73 * CAN controller mode 81 * CAN controller mode
74 */ 82 */
75struct can_ctrlmode { 83struct can_ctrlmode {
@@ -77,9 +85,11 @@ struct can_ctrlmode {
77 __u32 flags; 85 __u32 flags;
78}; 86};
79 87
80#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */ 88#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */
81#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */ 89#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */
82#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */ 90#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
91#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
92#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
83 93
84/* 94/*
85 * CAN device statistics 95 * CAN device statistics
@@ -105,6 +115,7 @@ enum {
105 IFLA_CAN_CTRLMODE, 115 IFLA_CAN_CTRLMODE,
106 IFLA_CAN_RESTART_MS, 116 IFLA_CAN_RESTART_MS,
107 IFLA_CAN_RESTART, 117 IFLA_CAN_RESTART,
118 IFLA_CAN_BERR_COUNTER,
108 __IFLA_CAN_MAX 119 __IFLA_CAN_MAX
109}; 120};
110 121
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 1448177d86d5..dba28268e651 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -26,8 +26,8 @@
26struct mcp251x_platform_data { 26struct mcp251x_platform_data {
27 unsigned long oscillator_frequency; 27 unsigned long oscillator_frequency;
28 int model; 28 int model;
29#define CAN_MCP251X_MCP2510 0 29#define CAN_MCP251X_MCP2510 0x2510
30#define CAN_MCP251X_MCP2515 1 30#define CAN_MCP251X_MCP2515 0x2515
31 int (*board_specific_setup)(struct spi_device *spi); 31 int (*board_specific_setup)(struct spi_device *spi);
32 int (*transceiver_enable)(int enable); 32 int (*transceiver_enable)(int enable);
33 int (*power_enable) (int enable); 33 int (*power_enable) (int enable);
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
index 01ee2aeb048d..96f8fcc78d78 100644
--- a/include/linux/can/platform/sja1000.h
+++ b/include/linux/can/platform/sja1000.h
@@ -26,7 +26,7 @@
26#define OCR_TX_SHIFT 2 26#define OCR_TX_SHIFT 2
27 27
28struct sja1000_platform_data { 28struct sja1000_platform_data {
29 u32 clock; /* CAN bus oscillator frequency in Hz */ 29 u32 osc_freq; /* CAN bus oscillator frequency in Hz */
30 30
31 u8 ocr; /* output control register */ 31 u8 ocr; /* output control register */
32 u8 cdr; /* clock divider register */ 32 u8 cdr; /* clock divider register */
diff --git a/include/linux/can/platform/ti_hecc.h b/include/linux/can/platform/ti_hecc.h
index 4688c7bb1bd1..af17cb3f7a84 100644
--- a/include/linux/can/platform/ti_hecc.h
+++ b/include/linux/can/platform/ti_hecc.h
@@ -1,3 +1,6 @@
1#ifndef __CAN_PLATFORM_TI_HECC_H__
2#define __CAN_PLATFORM_TI_HECC_H__
3
1/* 4/*
2 * TI HECC (High End CAN Controller) driver platform header 5 * TI HECC (High End CAN Controller) driver platform header
3 * 6 *
@@ -23,6 +26,7 @@
23 * @mbx_offset: Mailbox RAM offset 26 * @mbx_offset: Mailbox RAM offset
24 * @int_line: Interrupt line to use - 0 or 1 27 * @int_line: Interrupt line to use - 0 or 1
25 * @version: version for future use 28 * @version: version for future use
29 * @transceiver_switch: platform specific callback fn for transceiver control
26 * 30 *
27 * Platform data structure to get all platform specific settings. 31 * Platform data structure to get all platform specific settings.
28 * this structure also accounts the fact that the IP may have different 32 * this structure also accounts the fact that the IP may have different
@@ -35,6 +39,6 @@ struct ti_hecc_platform_data {
35 u32 mbx_offset; 39 u32 mbx_offset;
36 u32 int_line; 40 u32 int_line;
37 u32 version; 41 u32 version;
42 void (*transceiver_switch) (int);
38}; 43};
39 44#endif
40
diff --git a/include/linux/cciss_defs.h b/include/linux/cciss_defs.h
new file mode 100644
index 000000000000..316b670d4e33
--- /dev/null
+++ b/include/linux/cciss_defs.h
@@ -0,0 +1,130 @@
1#ifndef CCISS_DEFS_H
2#define CCISS_DEFS_H
3
4#include <linux/types.h>
5
6/* general boundary definitions */
7#define SENSEINFOBYTES 32 /* note that this value may vary
8 between host implementations */
9
10/* Command Status value */
11#define CMD_SUCCESS 0x0000
12#define CMD_TARGET_STATUS 0x0001
13#define CMD_DATA_UNDERRUN 0x0002
14#define CMD_DATA_OVERRUN 0x0003
15#define CMD_INVALID 0x0004
16#define CMD_PROTOCOL_ERR 0x0005
17#define CMD_HARDWARE_ERR 0x0006
18#define CMD_CONNECTION_LOST 0x0007
19#define CMD_ABORTED 0x0008
20#define CMD_ABORT_FAILED 0x0009
21#define CMD_UNSOLICITED_ABORT 0x000A
22#define CMD_TIMEOUT 0x000B
23#define CMD_UNABORTABLE 0x000C
24
25/* transfer direction */
26#define XFER_NONE 0x00
27#define XFER_WRITE 0x01
28#define XFER_READ 0x02
29#define XFER_RSVD 0x03
30
31/* task attribute */
32#define ATTR_UNTAGGED 0x00
33#define ATTR_SIMPLE 0x04
34#define ATTR_HEADOFQUEUE 0x05
35#define ATTR_ORDERED 0x06
36#define ATTR_ACA 0x07
37
38/* cdb type */
39#define TYPE_CMD 0x00
40#define TYPE_MSG 0x01
41
42/* Type defs used in the following structs */
43#define BYTE __u8
44#define WORD __u16
45#define HWORD __u16
46#define DWORD __u32
47
48#define CISS_MAX_LUN 1024
49
50#define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */
51#define LEVEL3LUN 0
52
53#pragma pack(1)
54
55/* Command List Structure */
56typedef union _SCSI3Addr_struct {
57 struct {
58 BYTE Dev;
59 BYTE Bus:6;
60 BYTE Mode:2; /* b00 */
61 } PeripDev;
62 struct {
63 BYTE DevLSB;
64 BYTE DevMSB:6;
65 BYTE Mode:2; /* b01 */
66 } LogDev;
67 struct {
68 BYTE Dev:5;
69 BYTE Bus:3;
70 BYTE Targ:6;
71 BYTE Mode:2; /* b10 */
72 } LogUnit;
73} SCSI3Addr_struct;
74
75typedef struct _PhysDevAddr_struct {
76 DWORD TargetId:24;
77 DWORD Bus:6;
78 DWORD Mode:2;
79 SCSI3Addr_struct Target[2]; /* 2 level target device addr */
80} PhysDevAddr_struct;
81
82typedef struct _LogDevAddr_struct {
83 DWORD VolId:30;
84 DWORD Mode:2;
85 BYTE reserved[4];
86} LogDevAddr_struct;
87
88typedef union _LUNAddr_struct {
89 BYTE LunAddrBytes[8];
90 SCSI3Addr_struct SCSI3Lun[4];
91 PhysDevAddr_struct PhysDev;
92 LogDevAddr_struct LogDev;
93} LUNAddr_struct;
94
95typedef struct _RequestBlock_struct {
96 BYTE CDBLen;
97 struct {
98 BYTE Type:3;
99 BYTE Attribute:3;
100 BYTE Direction:2;
101 } Type;
102 HWORD Timeout;
103 BYTE CDB[16];
104} RequestBlock_struct;
105
106typedef union _MoreErrInfo_struct{
107 struct {
108 BYTE Reserved[3];
109 BYTE Type;
110 DWORD ErrorInfo;
111 } Common_Info;
112 struct{
113 BYTE Reserved[2];
114 BYTE offense_size; /* size of offending entry */
115 BYTE offense_num; /* byte # of offense 0-base */
116 DWORD offense_value;
117 } Invalid_Cmd;
118} MoreErrInfo_struct;
119typedef struct _ErrorInfo_struct {
120 BYTE ScsiStatus;
121 BYTE SenseLen;
122 HWORD CommandStatus;
123 DWORD ResidualCnt;
124 MoreErrInfo_struct MoreErrInfo;
125 BYTE SenseInfo[SENSEINFOBYTES];
126} ErrorInfo_struct;
127
128#pragma pack()
129
130#endif /* CCISS_DEFS_H */
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
index eb130b4d8e72..986493f5b92b 100644
--- a/include/linux/cciss_ioctl.h
+++ b/include/linux/cciss_ioctl.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/ioctl.h> 5#include <linux/ioctl.h>
6#include <linux/cciss_defs.h>
6 7
7#define CCISS_IOC_MAGIC 'B' 8#define CCISS_IOC_MAGIC 'B'
8 9
@@ -36,133 +37,6 @@ typedef __u32 DriverVer_type;
36 37
37#define MAX_KMALLOC_SIZE 128000 38#define MAX_KMALLOC_SIZE 128000
38 39
39#ifndef CCISS_CMD_H
40// This defines are duplicated in cciss_cmd.h in the driver directory
41
42//general boundary definitions
43#define SENSEINFOBYTES 32//note that this value may vary between host implementations
44
45//Command Status value
46#define CMD_SUCCESS 0x0000
47#define CMD_TARGET_STATUS 0x0001
48#define CMD_DATA_UNDERRUN 0x0002
49#define CMD_DATA_OVERRUN 0x0003
50#define CMD_INVALID 0x0004
51#define CMD_PROTOCOL_ERR 0x0005
52#define CMD_HARDWARE_ERR 0x0006
53#define CMD_CONNECTION_LOST 0x0007
54#define CMD_ABORTED 0x0008
55#define CMD_ABORT_FAILED 0x0009
56#define CMD_UNSOLICITED_ABORT 0x000A
57#define CMD_TIMEOUT 0x000B
58#define CMD_UNABORTABLE 0x000C
59
60//transfer direction
61#define XFER_NONE 0x00
62#define XFER_WRITE 0x01
63#define XFER_READ 0x02
64#define XFER_RSVD 0x03
65
66//task attribute
67#define ATTR_UNTAGGED 0x00
68#define ATTR_SIMPLE 0x04
69#define ATTR_HEADOFQUEUE 0x05
70#define ATTR_ORDERED 0x06
71#define ATTR_ACA 0x07
72
73//cdb type
74#define TYPE_CMD 0x00
75#define TYPE_MSG 0x01
76
77// Type defs used in the following structs
78#define BYTE __u8
79#define WORD __u16
80#define HWORD __u16
81#define DWORD __u32
82
83#define CISS_MAX_LUN 1024
84
85#define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping
86#define LEVEL3LUN 0
87
88#pragma pack(1)
89
90//Command List Structure
91typedef union _SCSI3Addr_struct {
92 struct {
93 BYTE Dev;
94 BYTE Bus:6;
95 BYTE Mode:2; // b00
96 } PeripDev;
97 struct {
98 BYTE DevLSB;
99 BYTE DevMSB:6;
100 BYTE Mode:2; // b01
101 } LogDev;
102 struct {
103 BYTE Dev:5;
104 BYTE Bus:3;
105 BYTE Targ:6;
106 BYTE Mode:2; // b10
107 } LogUnit;
108} SCSI3Addr_struct;
109
110typedef struct _PhysDevAddr_struct {
111 DWORD TargetId:24;
112 DWORD Bus:6;
113 DWORD Mode:2;
114 SCSI3Addr_struct Target[2]; //2 level target device addr
115} PhysDevAddr_struct;
116
117typedef struct _LogDevAddr_struct {
118 DWORD VolId:30;
119 DWORD Mode:2;
120 BYTE reserved[4];
121} LogDevAddr_struct;
122
123typedef union _LUNAddr_struct {
124 BYTE LunAddrBytes[8];
125 SCSI3Addr_struct SCSI3Lun[4];
126 PhysDevAddr_struct PhysDev;
127 LogDevAddr_struct LogDev;
128} LUNAddr_struct;
129
130typedef struct _RequestBlock_struct {
131 BYTE CDBLen;
132 struct {
133 BYTE Type:3;
134 BYTE Attribute:3;
135 BYTE Direction:2;
136 } Type;
137 HWORD Timeout;
138 BYTE CDB[16];
139} RequestBlock_struct;
140
141typedef union _MoreErrInfo_struct{
142 struct {
143 BYTE Reserved[3];
144 BYTE Type;
145 DWORD ErrorInfo;
146 }Common_Info;
147 struct{
148 BYTE Reserved[2];
149 BYTE offense_size;//size of offending entry
150 BYTE offense_num; //byte # of offense 0-base
151 DWORD offense_value;
152 }Invalid_Cmd;
153}MoreErrInfo_struct;
154typedef struct _ErrorInfo_struct {
155 BYTE ScsiStatus;
156 BYTE SenseLen;
157 HWORD CommandStatus;
158 DWORD ResidualCnt;
159 MoreErrInfo_struct MoreErrInfo;
160 BYTE SenseInfo[SENSEINFOBYTES];
161} ErrorInfo_struct;
162
163#pragma pack()
164#endif /* CCISS_CMD_H */
165
166typedef struct _IOCTL_Command_struct { 40typedef struct _IOCTL_Command_struct {
167 LUNAddr_struct LUN_info; 41 LUNAddr_struct LUN_info;
168 RequestBlock_struct Request; 42 RequestBlock_struct Request;
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 0008dee66514..e3d00fdb858d 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -28,6 +28,7 @@ struct css_id;
28extern int cgroup_init_early(void); 28extern int cgroup_init_early(void);
29extern int cgroup_init(void); 29extern int cgroup_init(void);
30extern void cgroup_lock(void); 30extern void cgroup_lock(void);
31extern int cgroup_lock_is_held(void);
31extern bool cgroup_lock_live_group(struct cgroup *cgrp); 32extern bool cgroup_lock_live_group(struct cgroup *cgrp);
32extern void cgroup_unlock(void); 33extern void cgroup_unlock(void);
33extern void cgroup_fork(struct task_struct *p); 34extern void cgroup_fork(struct task_struct *p);
@@ -36,16 +37,24 @@ extern void cgroup_post_fork(struct task_struct *p);
36extern void cgroup_exit(struct task_struct *p, int run_callbacks); 37extern void cgroup_exit(struct task_struct *p, int run_callbacks);
37extern int cgroupstats_build(struct cgroupstats *stats, 38extern int cgroupstats_build(struct cgroupstats *stats,
38 struct dentry *dentry); 39 struct dentry *dentry);
40extern int cgroup_load_subsys(struct cgroup_subsys *ss);
41extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
39 42
40extern const struct file_operations proc_cgroup_operations; 43extern const struct file_operations proc_cgroup_operations;
41 44
42/* Define the enumeration of all cgroup subsystems */ 45/* Define the enumeration of all builtin cgroup subsystems */
43#define SUBSYS(_x) _x ## _subsys_id, 46#define SUBSYS(_x) _x ## _subsys_id,
44enum cgroup_subsys_id { 47enum cgroup_subsys_id {
45#include <linux/cgroup_subsys.h> 48#include <linux/cgroup_subsys.h>
46 CGROUP_SUBSYS_COUNT 49 CGROUP_BUILTIN_SUBSYS_COUNT
47}; 50};
48#undef SUBSYS 51#undef SUBSYS
52/*
53 * This define indicates the maximum number of subsystems that can be loaded
54 * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
55 * track of all of them.
56 */
57#define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
49 58
50/* Per-subsystem/per-cgroup state maintained by the system. */ 59/* Per-subsystem/per-cgroup state maintained by the system. */
51struct cgroup_subsys_state { 60struct cgroup_subsys_state {
@@ -75,6 +84,12 @@ enum {
75 CSS_REMOVED, /* This CSS is dead */ 84 CSS_REMOVED, /* This CSS is dead */
76}; 85};
77 86
87/* Caller must verify that the css is not for root cgroup */
88static inline void __css_get(struct cgroup_subsys_state *css, int count)
89{
90 atomic_add(count, &css->refcnt);
91}
92
78/* 93/*
79 * Call css_get() to hold a reference on the css; it can be used 94 * Call css_get() to hold a reference on the css; it can be used
80 * for a reference obtained via: 95 * for a reference obtained via:
@@ -86,7 +101,7 @@ static inline void css_get(struct cgroup_subsys_state *css)
86{ 101{
87 /* We don't need to reference count the root state */ 102 /* We don't need to reference count the root state */
88 if (!test_bit(CSS_ROOT, &css->flags)) 103 if (!test_bit(CSS_ROOT, &css->flags))
89 atomic_inc(&css->refcnt); 104 __css_get(css, 1);
90} 105}
91 106
92static inline bool css_is_removed(struct cgroup_subsys_state *css) 107static inline bool css_is_removed(struct cgroup_subsys_state *css)
@@ -117,11 +132,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
117 * css_get() or css_tryget() 132 * css_get() or css_tryget()
118 */ 133 */
119 134
120extern void __css_put(struct cgroup_subsys_state *css); 135extern void __css_put(struct cgroup_subsys_state *css, int count);
121static inline void css_put(struct cgroup_subsys_state *css) 136static inline void css_put(struct cgroup_subsys_state *css)
122{ 137{
123 if (!test_bit(CSS_ROOT, &css->flags)) 138 if (!test_bit(CSS_ROOT, &css->flags))
124 __css_put(css); 139 __css_put(css, 1);
125} 140}
126 141
127/* bits in struct cgroup flags field */ 142/* bits in struct cgroup flags field */
@@ -220,6 +235,10 @@ struct cgroup {
220 235
221 /* For RCU-protected deletion */ 236 /* For RCU-protected deletion */
222 struct rcu_head rcu_head; 237 struct rcu_head rcu_head;
238
239 /* List of events which userspace want to recieve */
240 struct list_head event_list;
241 spinlock_t event_list_lock;
223}; 242};
224 243
225/* 244/*
@@ -257,7 +276,8 @@ struct css_set {
257 /* 276 /*
258 * Set of subsystem states, one for each subsystem. This array 277 * Set of subsystem states, one for each subsystem. This array
259 * is immutable after creation apart from the init_css_set 278 * is immutable after creation apart from the init_css_set
260 * during subsystem registration (at boot time). 279 * during subsystem registration (at boot time) and modular subsystem
280 * loading/unloading.
261 */ 281 */
262 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 282 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
263 283
@@ -362,6 +382,23 @@ struct cftype {
362 int (*trigger)(struct cgroup *cgrp, unsigned int event); 382 int (*trigger)(struct cgroup *cgrp, unsigned int event);
363 383
364 int (*release)(struct inode *inode, struct file *file); 384 int (*release)(struct inode *inode, struct file *file);
385
386 /*
387 * register_event() callback will be used to add new userspace
388 * waiter for changes related to the cftype. Implement it if
389 * you want to provide this functionality. Use eventfd_signal()
390 * on eventfd to send notification to userspace.
391 */
392 int (*register_event)(struct cgroup *cgrp, struct cftype *cft,
393 struct eventfd_ctx *eventfd, const char *args);
394 /*
395 * unregister_event() callback will be called when userspace
396 * closes the eventfd or on cgroup removing.
397 * This callback must be implemented, if you want provide
398 * notification functionality.
399 */
400 void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft,
401 struct eventfd_ctx *eventfd);
365}; 402};
366 403
367struct cgroup_scanner { 404struct cgroup_scanner {
@@ -427,6 +464,8 @@ struct cgroup_subsys {
427 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 464 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
428 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 465 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
429 struct task_struct *tsk, bool threadgroup); 466 struct task_struct *tsk, bool threadgroup);
467 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
468 struct task_struct *tsk, bool threadgroup);
430 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 469 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
431 struct cgroup *old_cgrp, struct task_struct *tsk, 470 struct cgroup *old_cgrp, struct task_struct *tsk,
432 bool threadgroup); 471 bool threadgroup);
@@ -471,6 +510,9 @@ struct cgroup_subsys {
471 /* used when use_id == true */ 510 /* used when use_id == true */
472 struct idr idr; 511 struct idr idr;
473 spinlock_t id_lock; 512 spinlock_t id_lock;
513
514 /* should be defined only by modular subsystems */
515 struct module *module;
474}; 516};
475 517
476#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 518#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
@@ -483,10 +525,21 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
483 return cgrp->subsys[subsys_id]; 525 return cgrp->subsys[subsys_id];
484} 526}
485 527
486static inline struct cgroup_subsys_state *task_subsys_state( 528/*
487 struct task_struct *task, int subsys_id) 529 * function to get the cgroup_subsys_state which allows for extra
530 * rcu_dereference_check() conditions, such as locks used during the
531 * cgroup_subsys::attach() methods.
532 */
533#define task_subsys_state_check(task, subsys_id, __c) \
534 rcu_dereference_check(task->cgroups->subsys[subsys_id], \
535 rcu_read_lock_held() || \
536 lockdep_is_held(&task->alloc_lock) || \
537 cgroup_lock_is_held() || (__c))
538
539static inline struct cgroup_subsys_state *
540task_subsys_state(struct task_struct *task, int subsys_id)
488{ 541{
489 return rcu_dereference(task->cgroups->subsys[subsys_id]); 542 return task_subsys_state_check(task, subsys_id, false);
490} 543}
491 544
492static inline struct cgroup* task_cgroup(struct task_struct *task, 545static inline struct cgroup* task_cgroup(struct task_struct *task,
diff --git a/include/linux/circ_buf.h b/include/linux/circ_buf.h
index a2ed0591fb19..90f2471dc6f2 100644
--- a/include/linux/circ_buf.h
+++ b/include/linux/circ_buf.h
@@ -1,3 +1,7 @@
1/*
2 * See Documentation/circular-buffers.txt for more information.
3 */
4
1#ifndef _LINUX_CIRC_BUF_H 5#ifndef _LINUX_CIRC_BUF_H
2#define _LINUX_CIRC_BUF_H 1 6#define _LINUX_CIRC_BUF_H 1
3 7
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 0cf725bdd2a1..fc53492b6ad7 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -73,6 +73,7 @@ enum clock_event_nofitiers {
73 * @list: list head for the management code 73 * @list: list head for the management code
74 * @mode: operating mode assigned by the management code 74 * @mode: operating mode assigned by the management code
75 * @next_event: local storage for the next event in oneshot mode 75 * @next_event: local storage for the next event in oneshot mode
76 * @retries: number of forced programming retries
76 */ 77 */
77struct clock_event_device { 78struct clock_event_device {
78 const char *name; 79 const char *name;
@@ -93,6 +94,7 @@ struct clock_event_device {
93 struct list_head list; 94 struct list_head list;
94 enum clock_event_mode mode; 95 enum clock_event_mode mode;
95 ktime_t next_event; 96 ktime_t next_event;
97 unsigned long retries;
96}; 98};
97 99
98/* 100/*
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 8a4a130cc196..5ea3c60c160c 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -154,6 +154,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
155 * @flags: flags describing special properties 155 * @flags: flags describing special properties
156 * @vread: vsyscall based read 156 * @vread: vsyscall based read
157 * @suspend: suspend function for the clocksource, if necessary
157 * @resume: resume function for the clocksource, if necessary 158 * @resume: resume function for the clocksource, if necessary
158 */ 159 */
159struct clocksource { 160struct clocksource {
@@ -172,7 +173,8 @@ struct clocksource {
172 u64 max_idle_ns; 173 u64 max_idle_ns;
173 unsigned long flags; 174 unsigned long flags;
174 cycle_t (*vread)(void); 175 cycle_t (*vread)(void);
175 void (*resume)(void); 176 void (*suspend)(struct clocksource *cs);
177 void (*resume)(struct clocksource *cs);
176#ifdef CONFIG_IA64 178#ifdef CONFIG_IA64
177 void *fsys_mmio; /* used by fsyscall asm code */ 179 void *fsys_mmio; /* used by fsyscall asm code */
178#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr)) 180#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
@@ -271,12 +273,12 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
271} 273}
272 274
273 275
274/* used to install a new clocksource */
275extern int clocksource_register(struct clocksource*); 276extern int clocksource_register(struct clocksource*);
276extern void clocksource_unregister(struct clocksource*); 277extern void clocksource_unregister(struct clocksource*);
277extern void clocksource_touch_watchdog(void); 278extern void clocksource_touch_watchdog(void);
278extern struct clocksource* clocksource_get_next(void); 279extern struct clocksource* clocksource_get_next(void);
279extern void clocksource_change_rating(struct clocksource *cs, int rating); 280extern void clocksource_change_rating(struct clocksource *cs, int rating);
281extern void clocksource_suspend(void);
280extern void clocksource_resume(void); 282extern void clocksource_resume(void);
281extern struct clocksource * __init __weak clocksource_default_clock(void); 283extern struct clocksource * __init __weak clocksource_default_clock(void);
282extern void clocksource_mark_unstable(struct clocksource *cs); 284extern void clocksource_mark_unstable(struct clocksource *cs);
@@ -284,6 +286,24 @@ extern void clocksource_mark_unstable(struct clocksource *cs);
284extern void 286extern void
285clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 287clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
286 288
289/*
290 * Don't call __clocksource_register_scale directly, use
291 * clocksource_register_hz/khz
292 */
293extern int
294__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
295
296static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
297{
298 return __clocksource_register_scale(cs, 1, hz);
299}
300
301static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
302{
303 return __clocksource_register_scale(cs, 1000, khz);
304}
305
306
287static inline void 307static inline void
288clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) 308clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
289{ 309{
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 5b5d4731f956..8859e2ede9fe 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -7,6 +7,8 @@
7#define MAX_CODADEVS 5 /* how many do we allow */ 7#define MAX_CODADEVS 5 /* how many do we allow */
8 8
9#ifdef __KERNEL__ 9#ifdef __KERNEL__
10#include <linux/backing-dev.h>
11
10struct kstatfs; 12struct kstatfs;
11 13
12/* communication pending/processing queues */ 14/* communication pending/processing queues */
@@ -17,6 +19,7 @@ struct venus_comm {
17 struct list_head vc_processing; 19 struct list_head vc_processing;
18 int vc_inuse; 20 int vc_inuse;
19 struct super_block *vc_sb; 21 struct super_block *vc_sb;
22 struct backing_dev_info bdi;
20}; 23};
21 24
22 25
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
new file mode 100644
index 000000000000..5ac51552d908
--- /dev/null
+++ b/include/linux/compaction.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_COMPACTION_H
2#define _LINUX_COMPACTION_H
3
4/* Return values for compact_zone() and try_to_compact_pages() */
5/* compaction didn't start as it was not possible or direct reclaim was more suitable */
6#define COMPACT_SKIPPED 0
7/* compaction should continue to another pageblock */
8#define COMPACT_CONTINUE 1
9/* direct compaction partially compacted a zone and there are suitable pages */
10#define COMPACT_PARTIAL 2
11/* The full zone was compacted */
12#define COMPACT_COMPLETE 3
13
14#ifdef CONFIG_COMPACTION
15extern int sysctl_compact_memory;
16extern int sysctl_compaction_handler(struct ctl_table *table, int write,
17 void __user *buffer, size_t *length, loff_t *ppos);
18extern int sysctl_extfrag_threshold;
19extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
20 void __user *buffer, size_t *length, loff_t *ppos);
21
22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask);
25
26/* Do not skip compaction more than 64 times */
27#define COMPACT_MAX_DEFER_SHIFT 6
28
29/*
30 * Compaction is deferred when compaction fails to result in a page
31 * allocation success. 1 << compact_defer_limit compactions are skipped up
32 * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT
33 */
34static inline void defer_compaction(struct zone *zone)
35{
36 zone->compact_considered = 0;
37 zone->compact_defer_shift++;
38
39 if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT)
40 zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT;
41}
42
43/* Returns true if compaction should be skipped this time */
44static inline bool compaction_deferred(struct zone *zone)
45{
46 unsigned long defer_limit = 1UL << zone->compact_defer_shift;
47
48 /* Avoid possible overflow */
49 if (++zone->compact_considered > defer_limit)
50 zone->compact_considered = defer_limit;
51
52 return zone->compact_considered < (1UL << zone->compact_defer_shift);
53}
54
55#else
56static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
57 int order, gfp_t gfp_mask, nodemask_t *nodemask)
58{
59 return COMPACT_CONTINUE;
60}
61
62static inline void defer_compaction(struct zone *zone)
63{
64}
65
66static inline bool compaction_deferred(struct zone *zone)
67{
68 return 1;
69}
70
71#endif /* CONFIG_COMPACTION */
72
73#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
74extern int compaction_register_node(struct node *node);
75extern void compaction_unregister_node(struct node *node);
76
77#else
78
79static inline int compaction_register_node(struct node *node)
80{
81 return 0;
82}
83
84static inline void compaction_unregister_node(struct node *node)
85{
86}
87#endif /* CONFIG_COMPACTION && CONFIG_SYSFS && CONFIG_NUMA */
88
89#endif /* _LINUX_COMPACTION_H */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index ef68119a4fd2..168f7daa7bde 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -23,6 +23,7 @@
23typedef __compat_uid32_t compat_uid_t; 23typedef __compat_uid32_t compat_uid_t;
24typedef __compat_gid32_t compat_gid_t; 24typedef __compat_gid32_t compat_gid_t;
25 25
26struct compat_sel_arg_struct;
26struct rusage; 27struct rusage;
27 28
28struct compat_itimerspec { 29struct compat_itimerspec {
@@ -249,6 +250,8 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
249 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 250 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
250 struct compat_timeval __user *tvp); 251 struct compat_timeval __user *tvp);
251 252
253asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg);
254
252asmlinkage long compat_sys_wait4(compat_pid_t pid, 255asmlinkage long compat_sys_wait4(compat_pid_t pid,
253 compat_uint_t __user *stat_addr, int options, 256 compat_uint_t __user *stat_addr, int options,
254 struct compat_rusage __user *ru); 257 struct compat_rusage __user *ru);
@@ -353,5 +356,9 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
353asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
354 int flags, int mode); 357 int flags, int mode);
355 358
359extern ssize_t compat_rw_copy_check_uvector(int type,
360 const struct compat_iovec __user *uvector, unsigned long nr_segs,
361 unsigned long fast_segs, struct iovec *fast_pointer,
362 struct iovec **ret_pointer);
356#endif /* CONFIG_COMPAT */ 363#endif /* CONFIG_COMPAT */
357#endif /* _LINUX_COMPAT_H */ 364#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 73dcf804bc94..0da5b187f124 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -58,8 +58,12 @@
58 * naked functions because then mcount is called without stack and frame pointer 58 * naked functions because then mcount is called without stack and frame pointer
59 * being set up and there is no chance to restore the lr register to the value 59 * being set up and there is no chance to restore the lr register to the value
60 * before mcount was called. 60 * before mcount was called.
61 *
62 * The asm() bodies of naked functions often depend on standard calling conventions,
63 * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce
64 * this, so we must do so ourselves. See GCC PR44290.
61 */ 65 */
62#define __naked __attribute__((naked)) notrace 66#define __naked __attribute__((naked)) noinline __noclone notrace
63 67
64#define __noreturn __attribute__((noreturn)) 68#define __noreturn __attribute__((noreturn))
65 69
@@ -85,3 +89,7 @@
85#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) 89#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
86#define gcc_header(x) _gcc_header(x) 90#define gcc_header(x) _gcc_header(x)
87#include gcc_header(__GNUC__) 91#include gcc_header(__GNUC__)
92
93#if !defined(__noclone)
94#define __noclone /* not needed */
95#endif
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 94dea3ffbfa1..fcfa5b9a4317 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -48,6 +48,10 @@
48 * unreleased. Really, we need to have autoconf for the kernel. 48 * unreleased. Really, we need to have autoconf for the kernel.
49 */ 49 */
50#define unreachable() __builtin_unreachable() 50#define unreachable() __builtin_unreachable()
51
52/* Mark a function definition as prohibited from being cloned. */
53#define __noclone __attribute__((__noclone__))
54
51#endif 55#endif
52 56
53#endif 57#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 5be3dab4a695..a5a472b10746 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -5,7 +5,7 @@
5 5
6#ifdef __CHECKER__ 6#ifdef __CHECKER__
7# define __user __attribute__((noderef, address_space(1))) 7# define __user __attribute__((noderef, address_space(1)))
8# define __kernel /* default address space */ 8# define __kernel __attribute__((address_space(0)))
9# define __safe __attribute__((safe)) 9# define __safe __attribute__((safe))
10# define __force __attribute__((force)) 10# define __force __attribute__((force))
11# define __nocast __attribute__((nocast)) 11# define __nocast __attribute__((nocast))
@@ -15,6 +15,7 @@
15# define __acquire(x) __context__(x,1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18# define __percpu __attribute__((noderef, address_space(3)))
18extern void __chk_user_ptr(const volatile void __user *); 19extern void __chk_user_ptr(const volatile void __user *);
19extern void __chk_io_ptr(const volatile void __iomem *); 20extern void __chk_io_ptr(const volatile void __iomem *);
20#else 21#else
@@ -32,6 +33,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
32# define __acquire(x) (void)0 33# define __acquire(x) (void)0
33# define __release(x) (void)0 34# define __release(x) (void)0
34# define __cond_lock(x,c) (c) 35# define __cond_lock(x,c) (c)
36# define __percpu
35#endif 37#endif
36 38
37#ifdef __KERNEL__ 39#ifdef __KERNEL__
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 4a6b604ef7e4..51e3145196f6 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -83,6 +83,8 @@ extern unsigned long wait_for_completion_timeout(struct completion *x,
83 unsigned long timeout); 83 unsigned long timeout);
84extern unsigned long wait_for_completion_interruptible_timeout( 84extern unsigned long wait_for_completion_interruptible_timeout(
85 struct completion *x, unsigned long timeout); 85 struct completion *x, unsigned long timeout);
86extern unsigned long wait_for_completion_killable_timeout(
87 struct completion *x, unsigned long timeout);
86extern bool try_wait_for_completion(struct completion *x); 88extern bool try_wait_for_completion(struct completion *x);
87extern bool completion_done(struct completion *x); 89extern bool completion_done(struct completion *x);
88 90
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 72ba63eb83c5..3a779ffba60b 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -24,9 +24,6 @@
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27#define CN_IDX_CONNECTOR 0xffffffff
28#define CN_VAL_CONNECTOR 0xffffffff
29
30/* 27/*
31 * Process Events connector unique ids -- used for message routing 28 * Process Events connector unique ids -- used for message routing
32 */ 29 */
@@ -75,30 +72,6 @@ struct cn_msg {
75 __u8 data[0]; 72 __u8 data[0];
76}; 73};
77 74
78/*
79 * Notify structure - requests notification about
80 * registering/unregistering idx/val in range [first, first+range].
81 */
82struct cn_notify_req {
83 __u32 first;
84 __u32 range;
85};
86
87/*
88 * Main notification control message
89 * *_notify_num - number of appropriate cn_notify_req structures after
90 * this struct.
91 * group - notification receiver's idx.
92 * len - total length of the attached data.
93 */
94struct cn_ctl_msg {
95 __u32 idx_notify_num;
96 __u32 val_notify_num;
97 __u32 group;
98 __u32 len;
99 __u8 data[0];
100};
101
102#ifdef __KERNEL__ 75#ifdef __KERNEL__
103 76
104#include <asm/atomic.h> 77#include <asm/atomic.h>
@@ -151,11 +124,6 @@ struct cn_callback_entry {
151 u32 seq, group; 124 u32 seq, group;
152}; 125};
153 126
154struct cn_ctl_entry {
155 struct list_head notify_entry;
156 struct cn_ctl_msg *msg;
157};
158
159struct cn_dev { 127struct cn_dev {
160 struct cb_id id; 128 struct cb_id id;
161 129
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
new file mode 100644
index 000000000000..8ba66a9d9022
--- /dev/null
+++ b/include/linux/coredump.h
@@ -0,0 +1,45 @@
1#ifndef _LINUX_COREDUMP_H
2#define _LINUX_COREDUMP_H
3
4#include <linux/types.h>
5#include <linux/mm.h>
6#include <linux/fs.h>
7
8/*
9 * These are the only things you should do on a core-file: use only these
10 * functions to write out all the necessary info.
11 */
12static inline int dump_write(struct file *file, const void *addr, int nr)
13{
14 return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
15}
16
17static inline int dump_seek(struct file *file, loff_t off)
18{
19 int ret = 1;
20
21 if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
22 if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
23 return 0;
24 } else {
25 char *buf = (char *)get_zeroed_page(GFP_KERNEL);
26
27 if (!buf)
28 return 0;
29 while (off > 0) {
30 unsigned long n = off;
31
32 if (n > PAGE_SIZE)
33 n = PAGE_SIZE;
34 if (!dump_write(file, buf, n)) {
35 ret = 0;
36 break;
37 }
38 off -= n;
39 }
40 free_page((unsigned long)buf);
41 }
42 return ret;
43}
44
45#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cper.h b/include/linux/cper.h
new file mode 100644
index 000000000000..4b38f905b705
--- /dev/null
+++ b/include/linux/cper.h
@@ -0,0 +1,314 @@
1/*
2 * UEFI Common Platform Error Record
3 *
4 * Copyright (C) 2010, Intel Corp.
5 * Author: Huang Ying <ying.huang@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef LINUX_CPER_H
22#define LINUX_CPER_H
23
24#include <linux/uuid.h>
25
26/* CPER record signature and the size */
27#define CPER_SIG_RECORD "CPER"
28#define CPER_SIG_SIZE 4
29/* Used in signature_end field in struct cper_record_header */
30#define CPER_SIG_END 0xffffffff
31
32/*
33 * CPER record header revision, used in revision field in struct
34 * cper_record_header
35 */
36#define CPER_RECORD_REV 0x0100
37
38/*
39 * Severity difinition for error_severity in struct cper_record_header
40 * and section_severity in struct cper_section_descriptor
41 */
42#define CPER_SER_RECOVERABLE 0x0
43#define CPER_SER_FATAL 0x1
44#define CPER_SER_CORRECTED 0x2
45#define CPER_SER_INFORMATIONAL 0x3
46
47/*
48 * Validation bits difinition for validation_bits in struct
49 * cper_record_header. If set, corresponding fields in struct
50 * cper_record_header contain valid information.
51 *
52 * corresponds platform_id
53 */
54#define CPER_VALID_PLATFORM_ID 0x0001
55/* corresponds timestamp */
56#define CPER_VALID_TIMESTAMP 0x0002
57/* corresponds partition_id */
58#define CPER_VALID_PARTITION_ID 0x0004
59
60/*
61 * Notification type used to generate error record, used in
62 * notification_type in struct cper_record_header
63 *
64 * Corrected Machine Check
65 */
66#define CPER_NOTIFY_CMC \
67 UUID_LE(0x2DCE8BB1, 0xBDD7, 0x450e, 0xB9, 0xAD, 0x9C, 0xF4, \
68 0xEB, 0xD4, 0xF8, 0x90)
69/* Corrected Platform Error */
70#define CPER_NOTIFY_CPE \
71 UUID_LE(0x4E292F96, 0xD843, 0x4a55, 0xA8, 0xC2, 0xD4, 0x81, \
72 0xF2, 0x7E, 0xBE, 0xEE)
73/* Machine Check Exception */
74#define CPER_NOTIFY_MCE \
75 UUID_LE(0xE8F56FFE, 0x919C, 0x4cc5, 0xBA, 0x88, 0x65, 0xAB, \
76 0xE1, 0x49, 0x13, 0xBB)
77/* PCI Express Error */
78#define CPER_NOTIFY_PCIE \
79 UUID_LE(0xCF93C01F, 0x1A16, 0x4dfc, 0xB8, 0xBC, 0x9C, 0x4D, \
80 0xAF, 0x67, 0xC1, 0x04)
81/* INIT Record (for IPF) */
82#define CPER_NOTIFY_INIT \
83 UUID_LE(0xCC5263E8, 0x9308, 0x454a, 0x89, 0xD0, 0x34, 0x0B, \
84 0xD3, 0x9B, 0xC9, 0x8E)
85/* Non-Maskable Interrupt */
86#define CPER_NOTIFY_NMI \
87 UUID_LE(0x5BAD89FF, 0xB7E6, 0x42c9, 0x81, 0x4A, 0xCF, 0x24, \
88 0x85, 0xD6, 0xE9, 0x8A)
89/* BOOT Error Record */
90#define CPER_NOTIFY_BOOT \
91 UUID_LE(0x3D61A466, 0xAB40, 0x409a, 0xA6, 0x98, 0xF3, 0x62, \
92 0xD4, 0x64, 0xB3, 0x8F)
93/* DMA Remapping Error */
94#define CPER_NOTIFY_DMAR \
95 UUID_LE(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \
96 0x72, 0x2D, 0xEB, 0x41)
97
98/*
99 * Flags bits definitions for flags in struct cper_record_header
100 * If set, the error has been recovered
101 */
102#define CPER_HW_ERROR_FLAGS_RECOVERED 0x1
103/* If set, the error is for previous boot */
104#define CPER_HW_ERROR_FLAGS_PREVERR 0x2
105/* If set, the error is injected for testing */
106#define CPER_HW_ERROR_FLAGS_SIMULATED 0x4
107
108/*
109 * CPER section header revision, used in revision field in struct
110 * cper_section_descriptor
111 */
112#define CPER_SEC_REV 0x0100
113
114/*
115 * Validation bits difinition for validation_bits in struct
116 * cper_section_descriptor. If set, corresponding fields in struct
117 * cper_section_descriptor contain valid information.
118 *
119 * corresponds fru_id
120 */
121#define CPER_SEC_VALID_FRU_ID 0x1
122/* corresponds fru_text */
123#define CPER_SEC_VALID_FRU_TEXT 0x2
124
125/*
126 * Flags bits definitions for flags in struct cper_section_descriptor
127 *
128 * If set, the section is associated with the error condition
129 * directly, and should be focused on
130 */
131#define CPER_SEC_PRIMARY 0x0001
132/*
133 * If set, the error was not contained within the processor or memory
134 * hierarchy and the error may have propagated to persistent storage
135 * or network
136 */
137#define CPER_SEC_CONTAINMENT_WARNING 0x0002
138/* If set, the component must be re-initialized or re-enabled prior to use */
139#define CPER_SEC_RESET 0x0004
140/* If set, Linux may choose to discontinue use of the resource */
141#define CPER_SEC_ERROR_THRESHOLD_EXCEEDED 0x0008
142/*
143 * If set, resource could not be queried for error information due to
144 * conflicts with other system software or resources. Some fields of
145 * the section will be invalid
146 */
147#define CPER_SEC_RESOURCE_NOT_ACCESSIBLE 0x0010
148/*
149 * If set, action has been taken to ensure error containment (such as
150 * poisoning data), but the error has not been fully corrected and the
151 * data has not been consumed. Linux may choose to take further
152 * corrective action before the data is consumed
153 */
154#define CPER_SEC_LATENT_ERROR 0x0020
155
156/*
157 * Section type definitions, used in section_type field in struct
158 * cper_section_descriptor
159 *
160 * Processor Generic
161 */
162#define CPER_SEC_PROC_GENERIC \
163 UUID_LE(0x9876CCAD, 0x47B4, 0x4bdb, 0xB6, 0x5E, 0x16, 0xF1, \
164 0x93, 0xC4, 0xF3, 0xDB)
165/* Processor Specific: X86/X86_64 */
166#define CPER_SEC_PROC_IA \
167 UUID_LE(0xDC3EA0B0, 0xA144, 0x4797, 0xB9, 0x5B, 0x53, 0xFA, \
168 0x24, 0x2B, 0x6E, 0x1D)
169/* Processor Specific: IA64 */
170#define CPER_SEC_PROC_IPF \
171 UUID_LE(0xE429FAF1, 0x3CB7, 0x11D4, 0x0B, 0xCA, 0x07, 0x00, \
172 0x80, 0xC7, 0x3C, 0x88, 0x81)
173/* Platform Memory */
174#define CPER_SEC_PLATFORM_MEM \
175 UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \
176 0xED, 0x7C, 0x83, 0xB1)
177#define CPER_SEC_PCIE \
178 UUID_LE(0xD995E954, 0xBBC1, 0x430F, 0xAD, 0x91, 0xB4, 0x4D, \
179 0xCB, 0x3C, 0x6F, 0x35)
180/* Firmware Error Record Reference */
181#define CPER_SEC_FW_ERR_REC_REF \
182 UUID_LE(0x81212A96, 0x09ED, 0x4996, 0x94, 0x71, 0x8D, 0x72, \
183 0x9C, 0x8E, 0x69, 0xED)
184/* PCI/PCI-X Bus */
185#define CPER_SEC_PCI_X_BUS \
186 UUID_LE(0xC5753963, 0x3B84, 0x4095, 0xBF, 0x78, 0xED, 0xDA, \
187 0xD3, 0xF9, 0xC9, 0xDD)
188/* PCI Component/Device */
189#define CPER_SEC_PCI_DEV \
190 UUID_LE(0xEB5E4685, 0xCA66, 0x4769, 0xB6, 0xA2, 0x26, 0x06, \
191 0x8B, 0x00, 0x13, 0x26)
192#define CPER_SEC_DMAR_GENERIC \
193 UUID_LE(0x5B51FEF7, 0xC79D, 0x4434, 0x8F, 0x1B, 0xAA, 0x62, \
194 0xDE, 0x3E, 0x2C, 0x64)
195/* Intel VT for Directed I/O specific DMAr */
196#define CPER_SEC_DMAR_VT \
197 UUID_LE(0x71761D37, 0x32B2, 0x45cd, 0xA7, 0xD0, 0xB0, 0xFE, \
198 0xDD, 0x93, 0xE8, 0xCF)
199/* IOMMU specific DMAr */
200#define CPER_SEC_DMAR_IOMMU \
201 UUID_LE(0x036F84E1, 0x7F37, 0x428c, 0xA7, 0x9E, 0x57, 0x5F, \
202 0xDF, 0xAA, 0x84, 0xEC)
203
204/*
205 * All tables and structs must be byte-packed to match CPER
206 * specification, since the tables are provided by the system BIOS
207 */
208#pragma pack(1)
209
210struct cper_record_header {
211 char signature[CPER_SIG_SIZE]; /* must be CPER_SIG_RECORD */
212 __u16 revision; /* must be CPER_RECORD_REV */
213 __u32 signature_end; /* must be CPER_SIG_END */
214 __u16 section_count;
215 __u32 error_severity;
216 __u32 validation_bits;
217 __u32 record_length;
218 __u64 timestamp;
219 uuid_le platform_id;
220 uuid_le partition_id;
221 uuid_le creator_id;
222 uuid_le notification_type;
223 __u64 record_id;
224 __u32 flags;
225 __u64 persistence_information;
226 __u8 reserved[12]; /* must be zero */
227};
228
229struct cper_section_descriptor {
230 __u32 section_offset; /* Offset in bytes of the
231 * section body from the base
232 * of the record header */
233 __u32 section_length;
234 __u16 revision; /* must be CPER_RECORD_REV */
235 __u8 validation_bits;
236 __u8 reserved; /* must be zero */
237 __u32 flags;
238 uuid_le section_type;
239 uuid_le fru_id;
240 __u32 section_severity;
241 __u8 fru_text[20];
242};
243
244/* Generic Processor Error Section */
245struct cper_sec_proc_generic {
246 __u64 validation_bits;
247 __u8 proc_type;
248 __u8 proc_isa;
249 __u8 proc_error_type;
250 __u8 operation;
251 __u8 flags;
252 __u8 level;
253 __u16 reserved;
254 __u64 cpu_version;
255 char cpu_brand[128];
256 __u64 proc_id;
257 __u64 target_addr;
258 __u64 requestor_id;
259 __u64 responder_id;
260 __u64 ip;
261};
262
263/* IA32/X64 Processor Error Section */
264struct cper_sec_proc_ia {
265 __u64 validation_bits;
266 __u8 lapic_id;
267 __u8 cpuid[48];
268};
269
270/* IA32/X64 Processor Error Infomation Structure */
271struct cper_ia_err_info {
272 uuid_le err_type;
273 __u64 validation_bits;
274 __u64 check_info;
275 __u64 target_id;
276 __u64 requestor_id;
277 __u64 responder_id;
278 __u64 ip;
279};
280
281/* IA32/X64 Processor Context Information Structure */
282struct cper_ia_proc_ctx {
283 __u16 reg_ctx_type;
284 __u16 reg_arr_size;
285 __u32 msr_addr;
286 __u64 mm_reg_addr;
287};
288
289/* Memory Error Section */
290struct cper_sec_mem_err {
291 __u64 validation_bits;
292 __u64 error_status;
293 __u64 physical_addr;
294 __u64 physical_addr_mask;
295 __u16 node;
296 __u16 card;
297 __u16 module;
298 __u16 bank;
299 __u16 device;
300 __u16 row;
301 __u16 column;
302 __u16 bit_pos;
303 __u64 requestor_id;
304 __u64 responder_id;
305 __u64 target_id;
306 __u8 error_type;
307};
308
309/* Reset to default packing */
310#pragma pack()
311
312u64 cper_next_record_id(void);
313
314#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4de02b10007f..9f15150ce8d6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -278,6 +278,27 @@ struct freq_attr {
278 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); 278 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
279}; 279};
280 280
281#define cpufreq_freq_attr_ro(_name) \
282static struct freq_attr _name = \
283__ATTR(_name, 0444, show_##_name, NULL)
284
285#define cpufreq_freq_attr_ro_perm(_name, _perm) \
286static struct freq_attr _name = \
287__ATTR(_name, _perm, show_##_name, NULL)
288
289#define cpufreq_freq_attr_ro_old(_name) \
290static struct freq_attr _name##_old = \
291__ATTR(_name, 0444, show_##_name##_old, NULL)
292
293#define cpufreq_freq_attr_rw(_name) \
294static struct freq_attr _name = \
295__ATTR(_name, 0644, show_##_name, store_##_name)
296
297#define cpufreq_freq_attr_rw_old(_name) \
298static struct freq_attr _name##_old = \
299__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)
300
301
281struct global_attr { 302struct global_attr {
282 struct attribute attr; 303 struct attribute attr;
283 ssize_t (*show)(struct kobject *kobj, 304 ssize_t (*show)(struct kobject *kobj,
@@ -286,6 +307,15 @@ struct global_attr {
286 const char *c, size_t count); 307 const char *c, size_t count);
287}; 308};
288 309
310#define define_one_global_ro(_name) \
311static struct global_attr _name = \
312__ATTR(_name, 0444, show_##_name, NULL)
313
314#define define_one_global_rw(_name) \
315static struct global_attr _name = \
316__ATTR(_name, 0644, show_##_name, store_##_name)
317
318
289/********************************************************************* 319/*********************************************************************
290 * CPUFREQ 2.6. INTERFACE * 320 * CPUFREQ 2.6. INTERFACE *
291 *********************************************************************/ 321 *********************************************************************/
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index dcf77fa826b5..55215cce5005 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -125,6 +125,7 @@ struct cpuidle_driver {
125#ifdef CONFIG_CPU_IDLE 125#ifdef CONFIG_CPU_IDLE
126 126
127extern int cpuidle_register_driver(struct cpuidle_driver *drv); 127extern int cpuidle_register_driver(struct cpuidle_driver *drv);
128struct cpuidle_driver *cpuidle_get_driver(void);
128extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); 129extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
129extern int cpuidle_register_device(struct cpuidle_device *dev); 130extern int cpuidle_register_device(struct cpuidle_device *dev);
130extern void cpuidle_unregister_device(struct cpuidle_device *dev); 131extern void cpuidle_unregister_device(struct cpuidle_device *dev);
@@ -137,16 +138,17 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
137#else 138#else
138 139
139static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 140static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
140{return 0;} 141{return -ENODEV; }
142static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
141static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } 143static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
142static inline int cpuidle_register_device(struct cpuidle_device *dev) 144static inline int cpuidle_register_device(struct cpuidle_device *dev)
143{return 0;} 145{return -ENODEV; }
144static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } 146static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }
145 147
146static inline void cpuidle_pause_and_lock(void) { } 148static inline void cpuidle_pause_and_lock(void) { }
147static inline void cpuidle_resume_and_unlock(void) { } 149static inline void cpuidle_resume_and_unlock(void) { }
148static inline int cpuidle_enable_device(struct cpuidle_device *dev) 150static inline int cpuidle_enable_device(struct cpuidle_device *dev)
149{return 0;} 151{return -ENODEV; }
150static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 152static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
151 153
152#endif 154#endif
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d77b54733c5b..bae6fe24d1f9 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -90,10 +90,10 @@ extern const struct cpumask *const cpu_active_mask;
90#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) 90#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
91#define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask) 91#define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask)
92#else 92#else
93#define num_online_cpus() 1 93#define num_online_cpus() 1U
94#define num_possible_cpus() 1 94#define num_possible_cpus() 1U
95#define num_present_cpus() 1 95#define num_present_cpus() 1U
96#define num_active_cpus() 1 96#define num_active_cpus() 1U
97#define cpu_online(cpu) ((cpu) == 0) 97#define cpu_online(cpu) ((cpu) == 0)
98#define cpu_possible(cpu) ((cpu) == 0) 98#define cpu_possible(cpu) ((cpu) == 0)
99#define cpu_present(cpu) ((cpu) == 0) 99#define cpu_present(cpu) ((cpu) == 0)
@@ -143,6 +143,8 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,
143 143
144#define for_each_cpu(cpu, mask) \ 144#define for_each_cpu(cpu, mask) \
145 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 145 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
146#define for_each_cpu_not(cpu, mask) \
147 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
146#define for_each_cpu_and(cpu, mask, and) \ 148#define for_each_cpu_and(cpu, mask, and) \
147 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and) 149 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and)
148#else 150#else
@@ -203,6 +205,18 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
203 (cpu) < nr_cpu_ids;) 205 (cpu) < nr_cpu_ids;)
204 206
205/** 207/**
208 * for_each_cpu_not - iterate over every cpu in a complemented mask
209 * @cpu: the (optionally unsigned) integer iterator
210 * @mask: the cpumask pointer
211 *
212 * After the loop, cpu is >= nr_cpu_ids.
213 */
214#define for_each_cpu_not(cpu, mask) \
215 for ((cpu) = -1; \
216 (cpu) = cpumask_next_zero((cpu), (mask)), \
217 (cpu) < nr_cpu_ids;)
218
219/**
206 * for_each_cpu_and - iterate over every cpu in both masks 220 * for_each_cpu_and - iterate over every cpu in both masks
207 * @cpu: the (optionally unsigned) integer iterator 221 * @cpu: the (optionally unsigned) integer iterator
208 * @mask: the first cpumask pointer 222 * @mask: the first cpumask pointer
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index a5740fc4d04b..457ed765a116 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -21,8 +21,7 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern void cpuset_cpus_allowed_locked(struct task_struct *p, 24extern int cpuset_cpus_allowed_fallback(struct task_struct *p);
25 struct cpumask *mask);
26extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
27#define cpuset_current_mems_allowed (current->mems_allowed) 26#define cpuset_current_mems_allowed (current->mems_allowed)
28void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
@@ -69,10 +68,8 @@ struct seq_file;
69extern void cpuset_task_status_allowed(struct seq_file *m, 68extern void cpuset_task_status_allowed(struct seq_file *m,
70 struct task_struct *task); 69 struct task_struct *task);
71 70
72extern void cpuset_lock(void);
73extern void cpuset_unlock(void);
74
75extern int cpuset_mem_spread_node(void); 71extern int cpuset_mem_spread_node(void);
72extern int cpuset_slab_spread_node(void);
76 73
77static inline int cpuset_do_page_mem_spread(void) 74static inline int cpuset_do_page_mem_spread(void)
78{ 75{
@@ -90,9 +87,44 @@ extern void rebuild_sched_domains(void);
90 87
91extern void cpuset_print_task_mems_allowed(struct task_struct *p); 88extern void cpuset_print_task_mems_allowed(struct task_struct *p);
92 89
90/*
91 * reading current mems_allowed and mempolicy in the fastpath must protected
92 * by get_mems_allowed()
93 */
94static inline void get_mems_allowed(void)
95{
96 current->mems_allowed_change_disable++;
97
98 /*
99 * ensure that reading mems_allowed and mempolicy happens after the
100 * update of ->mems_allowed_change_disable.
101 *
102 * the write-side task finds ->mems_allowed_change_disable is not 0,
103 * and knows the read-side task is reading mems_allowed or mempolicy,
104 * so it will clear old bits lazily.
105 */
106 smp_mb();
107}
108
109static inline void put_mems_allowed(void)
110{
111 /*
112 * ensure that reading mems_allowed and mempolicy before reducing
113 * mems_allowed_change_disable.
114 *
115 * the write-side task will know that the read-side task is still
116 * reading mems_allowed or mempolicy, don't clears old bits in the
117 * nodemask.
118 */
119 smp_mb();
120 --ACCESS_ONCE(current->mems_allowed_change_disable);
121}
122
93static inline void set_mems_allowed(nodemask_t nodemask) 123static inline void set_mems_allowed(nodemask_t nodemask)
94{ 124{
125 task_lock(current);
95 current->mems_allowed = nodemask; 126 current->mems_allowed = nodemask;
127 task_unlock(current);
96} 128}
97 129
98#else /* !CONFIG_CPUSETS */ 130#else /* !CONFIG_CPUSETS */
@@ -105,10 +137,11 @@ static inline void cpuset_cpus_allowed(struct task_struct *p,
105{ 137{
106 cpumask_copy(mask, cpu_possible_mask); 138 cpumask_copy(mask, cpu_possible_mask);
107} 139}
108static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 140
109 struct cpumask *mask) 141static inline int cpuset_cpus_allowed_fallback(struct task_struct *p)
110{ 142{
111 cpumask_copy(mask, cpu_possible_mask); 143 cpumask_copy(&p->cpus_allowed, cpu_possible_mask);
144 return cpumask_any(cpu_active_mask);
112} 145}
113 146
114static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 147static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
@@ -157,14 +190,16 @@ static inline void cpuset_task_status_allowed(struct seq_file *m,
157{ 190{
158} 191}
159 192
160static inline void cpuset_lock(void) {}
161static inline void cpuset_unlock(void) {}
162
163static inline int cpuset_mem_spread_node(void) 193static inline int cpuset_mem_spread_node(void)
164{ 194{
165 return 0; 195 return 0;
166} 196}
167 197
198static inline int cpuset_slab_spread_node(void)
199{
200 return 0;
201}
202
168static inline int cpuset_do_page_mem_spread(void) 203static inline int cpuset_do_page_mem_spread(void)
169{ 204{
170 return 0; 205 return 0;
@@ -193,6 +228,14 @@ static inline void set_mems_allowed(nodemask_t nodemask)
193{ 228{
194} 229}
195 230
231static inline void get_mems_allowed(void)
232{
233}
234
235static inline void put_mems_allowed(void)
236{
237}
238
196#endif /* !CONFIG_CPUSETS */ 239#endif /* !CONFIG_CPUSETS */
197 240
198#endif /* _LINUX_CPUSET_H */ 241#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4e3387a89cb9..4d2c39573f36 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -153,10 +153,10 @@ struct cred {
153extern void __put_cred(struct cred *); 153extern void __put_cred(struct cred *);
154extern void exit_creds(struct task_struct *); 154extern void exit_creds(struct task_struct *);
155extern int copy_creds(struct task_struct *, unsigned long); 155extern int copy_creds(struct task_struct *, unsigned long);
156extern const struct cred *get_task_cred(struct task_struct *);
156extern struct cred *cred_alloc_blank(void); 157extern struct cred *cred_alloc_blank(void);
157extern struct cred *prepare_creds(void); 158extern struct cred *prepare_creds(void);
158extern struct cred *prepare_exec_creds(void); 159extern struct cred *prepare_exec_creds(void);
159extern struct cred *prepare_usermodehelper_creds(void);
160extern int commit_creds(struct cred *); 160extern int commit_creds(struct cred *);
161extern void abort_creds(struct cred *); 161extern void abort_creds(struct cred *);
162extern const struct cred *override_creds(const struct cred *); 162extern const struct cred *override_creds(const struct cred *);
@@ -274,33 +274,18 @@ static inline void put_cred(const struct cred *_cred)
274 * @task: The task to query 274 * @task: The task to query
275 * 275 *
276 * Access the objective credentials of a task. The caller must hold the RCU 276 * Access the objective credentials of a task. The caller must hold the RCU
277 * readlock. 277 * readlock or the task must be dead and unable to change its own credentials.
278 * 278 *
279 * The caller must make sure task doesn't go away, either by holding a ref on 279 * The result of this function should not be passed directly to get_cred();
280 * task or by holding tasklist_lock to prevent it from being unlinked. 280 * rather get_task_cred() should be used instead.
281 */ 281 */
282#define __task_cred(task) \ 282#define __task_cred(task) \
283 ((const struct cred *)(rcu_dereference((task)->real_cred))) 283 ({ \
284 284 const struct task_struct *__t = (task); \
285/** 285 rcu_dereference_check(__t->real_cred, \
286 * get_task_cred - Get another task's objective credentials 286 rcu_read_lock_held() || \
287 * @task: The task to query 287 task_is_dead(__t)); \
288 * 288 })
289 * Get the objective credentials of a task, pinning them so that they can't go
290 * away. Accessing a task's credentials directly is not permitted.
291 *
292 * The caller must make sure task doesn't go away, either by holding a ref on
293 * task or by holding tasklist_lock to prevent it from being unlinked.
294 */
295#define get_task_cred(task) \
296({ \
297 struct cred *__cred; \
298 rcu_read_lock(); \
299 __cred = (struct cred *) __task_cred((task)); \
300 get_cred(__cred); \
301 rcu_read_unlock(); \
302 __cred; \
303})
304 289
305/** 290/**
306 * get_current_cred - Get the current task's subjective credentials 291 * get_current_cred - Get the current task's subjective credentials
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 24d2e30f1b46..a6a7a1c83f54 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -99,13 +99,7 @@
99 * as arm where pointers are 32-bit aligned but there are data types such as 99 * as arm where pointers are 32-bit aligned but there are data types such as
100 * u64 which require 64-bit alignment. 100 * u64 which require 64-bit alignment.
101 */ 101 */
102#if defined(ARCH_KMALLOC_MINALIGN)
103#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN 102#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
104#elif defined(ARCH_SLAB_MINALIGN)
105#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
106#else
107#define CRYPTO_MINALIGN __alignof__(unsigned long long)
108#endif
109 103
110#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) 104#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
111 105
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
new file mode 100644
index 000000000000..7c930dba477c
--- /dev/null
+++ b/include/linux/davinci_emac.h
@@ -0,0 +1,39 @@
1/*
2 * TI DaVinci EMAC platform support
3 *
4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 *
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef _LINUX_DAVINCI_EMAC_H
12#define _LINUX_DAVINCI_EMAC_H
13
14#include <linux/if_ether.h>
15#include <linux/memory.h>
16
17struct emac_platform_data {
18 char mac_addr[ETH_ALEN];
19 u32 ctrl_reg_offset;
20 u32 ctrl_mod_reg_offset;
21 u32 ctrl_ram_offset;
22 u32 hw_ram_addr;
23 u32 mdio_reg_offset;
24 u32 ctrl_ram_size;
25 u32 phy_mask;
26 u32 mdio_max_freq;
27 u8 rmii_en;
28 u8 version;
29 void (*interrupt_enable) (void);
30 void (*interrupt_disable) (void);
31};
32
33enum {
34 EMAC_VERSION_1, /* DM644x */
35 EMAC_VERSION_2, /* DM646x */
36};
37
38void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context);
39#endif
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 30b93b2a01a4..eebb617c17d8 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -186,6 +186,8 @@ d_iput: no no no yes
186 186
187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ 187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */
188 188
189#define DCACHE_CANT_MOUNT 0x0100
190
189extern spinlock_t dcache_lock; 191extern spinlock_t dcache_lock;
190extern seqlock_t rename_lock; 192extern seqlock_t rename_lock;
191 193
@@ -358,6 +360,18 @@ static inline int d_unlinked(struct dentry *dentry)
358 return d_unhashed(dentry) && !IS_ROOT(dentry); 360 return d_unhashed(dentry) && !IS_ROOT(dentry);
359} 361}
360 362
363static inline int cant_mount(struct dentry *dentry)
364{
365 return (dentry->d_flags & DCACHE_CANT_MOUNT);
366}
367
368static inline void dont_mount(struct dentry *dentry)
369{
370 spin_lock(&dentry->d_lock);
371 dentry->d_flags |= DCACHE_CANT_MOUNT;
372 spin_unlock(&dentry->d_lock);
373}
374
361static inline struct dentry *dget_parent(struct dentry *dentry) 375static inline struct dentry *dget_parent(struct dentry *dentry)
362{ 376{
363 struct dentry *ret; 377 struct dentry *ret;
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index b7cdbb4373df..8723491f7dfd 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -22,8 +22,6 @@
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25#define DCB_PROTO_VERSION 1
26
27struct dcbmsg { 25struct dcbmsg {
28 __u8 dcb_family; 26 __u8 dcb_family;
29 __u8 cmd; 27 __u8 cmd;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index fc1b930f246c..e7d9b20ddc5b 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -63,6 +63,8 @@ struct dentry *debugfs_create_x16(const char *name, mode_t mode,
63 struct dentry *parent, u16 *value); 63 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 64struct dentry *debugfs_create_x32(const char *name, mode_t mode,
65 struct dentry *parent, u32 *value); 65 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_x64(const char *name, mode_t mode,
67 struct dentry *parent, u64 *value);
66struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 68struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
67 struct dentry *parent, size_t *value); 69 struct dentry *parent, size_t *value);
68struct dentry *debugfs_create_bool(const char *name, mode_t mode, 70struct dentry *debugfs_create_bool(const char *name, mode_t mode,
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 8c243aaa86a7..597692f1fc8d 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -20,12 +20,14 @@ struct debug_obj_descr;
20 * struct debug_obj - representaion of an tracked object 20 * struct debug_obj - representaion of an tracked object
21 * @node: hlist node to link the object into the tracker list 21 * @node: hlist node to link the object into the tracker list
22 * @state: tracked object state 22 * @state: tracked object state
23 * @astate: current active state
23 * @object: pointer to the real object 24 * @object: pointer to the real object
24 * @descr: pointer to an object type specific debug description structure 25 * @descr: pointer to an object type specific debug description structure
25 */ 26 */
26struct debug_obj { 27struct debug_obj {
27 struct hlist_node node; 28 struct hlist_node node;
28 enum debug_obj_state state; 29 enum debug_obj_state state;
30 unsigned int astate;
29 void *object; 31 void *object;
30 struct debug_obj_descr *descr; 32 struct debug_obj_descr *descr;
31}; 33};
@@ -60,6 +62,15 @@ extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
60extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 62extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
61extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 63extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
62 64
65/*
66 * Active state:
67 * - Set at 0 upon initialization.
68 * - Must return to 0 before deactivation.
69 */
70extern void
71debug_object_active_state(void *addr, struct debug_obj_descr *descr,
72 unsigned int expect, unsigned int next);
73
63extern void debug_objects_early_init(void); 74extern void debug_objects_early_init(void);
64extern void debug_objects_mem_init(void); 75extern void debug_objects_mem_init(void);
65#else 76#else
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 5032b9a31ae7..ad5ec1d0475e 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -14,11 +14,21 @@
14 14
15/* Code active when included from pre-boot environment: */ 15/* Code active when included from pre-boot environment: */
16 16
17/*
18 * Some architectures want to ensure there is no local data in their
19 * pre-boot environment, so that data can arbitarily relocated (via
20 * GOT references). This is achieved by defining STATIC_RW_DATA to
21 * be null.
22 */
23#ifndef STATIC_RW_DATA
24#define STATIC_RW_DATA static
25#endif
26
17/* A trivial malloc implementation, adapted from 27/* A trivial malloc implementation, adapted from
18 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 28 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
19 */ 29 */
20static unsigned long malloc_ptr; 30STATIC_RW_DATA unsigned long malloc_ptr;
21static int malloc_count; 31STATIC_RW_DATA int malloc_count;
22 32
23static void *malloc(int size) 33static void *malloc(int size)
24{ 34{
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index 5076fe0c8a96..6cee17c22313 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -18,6 +18,7 @@
18#define _LINUX_DELAYACCT_H 18#define _LINUX_DELAYACCT_H
19 19
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/slab.h>
21 22
22/* 23/*
23 * Per-task flags relevant to delay accounting 24 * Per-task flags relevant to delay accounting
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index d4c9c0b88adc..1381cd97b4ed 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -118,10 +118,9 @@ struct dm_dev {
118/* 118/*
119 * Constructors should call these functions to ensure destination devices 119 * Constructors should call these functions to ensure destination devices
120 * are opened/closed correctly. 120 * are opened/closed correctly.
121 * FIXME: too many arguments.
122 */ 121 */
123int dm_get_device(struct dm_target *ti, const char *path, sector_t start, 122int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
124 sector_t len, fmode_t mode, struct dm_dev **result); 123 struct dm_dev **result);
125void dm_put_device(struct dm_target *ti, struct dm_dev *d); 124void dm_put_device(struct dm_target *ti, struct dm_dev *d);
126 125
127/* 126/*
diff --git a/include/linux/device.h b/include/linux/device.h
index a62799f2ab00..0713e10571dd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,7 +22,6 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/semaphore.h>
26#include <asm/atomic.h> 25#include <asm/atomic.h>
27#include <asm/device.h> 26#include <asm/device.h>
28 27
@@ -34,6 +33,7 @@ struct class;
34struct class_private; 33struct class_private;
35struct bus_type; 34struct bus_type;
36struct bus_type_private; 35struct bus_type_private;
36struct device_node;
37 37
38struct bus_attribute { 38struct bus_attribute {
39 struct attribute attr; 39 struct attribute attr;
@@ -106,7 +106,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,
106 106
107/* All 4 notifers below get called with the target struct device * 107/* All 4 notifers below get called with the target struct device *
108 * as an argument. Note that those functions are likely to be called 108 * as an argument. Note that those functions are likely to be called
109 * with the device semaphore held in the core, so be careful. 109 * with the device lock held in the core, so be careful.
110 */ 110 */
111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
@@ -128,6 +128,10 @@ struct device_driver {
128 128
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
130 130
131#if defined(CONFIG_OF)
132 const struct of_device_id *of_match_table;
133#endif
134
131 int (*probe) (struct device *dev); 135 int (*probe) (struct device *dev);
132 int (*remove) (struct device *dev); 136 int (*remove) (struct device *dev);
133 void (*shutdown) (struct device *dev); 137 void (*shutdown) (struct device *dev);
@@ -203,6 +207,9 @@ struct class {
203 int (*suspend)(struct device *dev, pm_message_t state); 207 int (*suspend)(struct device *dev, pm_message_t state);
204 int (*resume)(struct device *dev); 208 int (*resume)(struct device *dev);
205 209
210 const struct kobj_ns_type_operations *ns_type;
211 const void *(*namespace)(struct device *dev);
212
206 const struct dev_pm_ops *pm; 213 const struct dev_pm_ops *pm;
207 214
208 struct class_private *p; 215 struct class_private *p;
@@ -251,8 +258,10 @@ extern struct device *class_find_device(struct class *class,
251 258
252struct class_attribute { 259struct class_attribute {
253 struct attribute attr; 260 struct attribute attr;
254 ssize_t (*show)(struct class *class, char *buf); 261 ssize_t (*show)(struct class *class, struct class_attribute *attr,
255 ssize_t (*store)(struct class *class, const char *buf, size_t count); 262 char *buf);
263 ssize_t (*store)(struct class *class, struct class_attribute *attr,
264 const char *buf, size_t count);
256}; 265};
257 266
258#define CLASS_ATTR(_name, _mode, _show, _store) \ 267#define CLASS_ATTR(_name, _mode, _show, _store) \
@@ -263,6 +272,23 @@ extern int __must_check class_create_file(struct class *class,
263extern void class_remove_file(struct class *class, 272extern void class_remove_file(struct class *class,
264 const struct class_attribute *attr); 273 const struct class_attribute *attr);
265 274
275/* Simple class attribute that is just a static string */
276
277struct class_attribute_string {
278 struct class_attribute attr;
279 char *str;
280};
281
282/* Currently read-only only */
283#define _CLASS_ATTR_STRING(_name, _mode, _str) \
284 { __ATTR(_name, _mode, show_class_attr_string, NULL), _str }
285#define CLASS_ATTR_STRING(_name, _mode, _str) \
286 struct class_attribute_string class_attr_##_name = \
287 _CLASS_ATTR_STRING(_name, _mode, _str)
288
289extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr,
290 char *buf);
291
266struct class_interface { 292struct class_interface {
267 struct list_head node; 293 struct list_head node;
268 struct class *class; 294 struct class *class;
@@ -385,7 +411,7 @@ struct device {
385 const char *init_name; /* initial name of the device */ 411 const char *init_name; /* initial name of the device */
386 struct device_type *type; 412 struct device_type *type;
387 413
388 struct semaphore sem; /* semaphore to synchronize calls to 414 struct mutex mutex; /* mutex to synchronize calls to
389 * its driver. 415 * its driver.
390 */ 416 */
391 417
@@ -414,6 +440,9 @@ struct device {
414 override */ 440 override */
415 /* arch specific additions */ 441 /* arch specific additions */
416 struct dev_archdata archdata; 442 struct dev_archdata archdata;
443#ifdef CONFIG_OF
444 struct device_node *of_node;
445#endif
417 446
418 dev_t devt; /* dev_t, creates the sysfs "dev" */ 447 dev_t devt; /* dev_t, creates the sysfs "dev" */
419 448
@@ -432,6 +461,10 @@ struct device {
432 461
433static inline const char *dev_name(const struct device *dev) 462static inline const char *dev_name(const struct device *dev)
434{ 463{
464 /* Use the init name until the kobject becomes available */
465 if (dev->init_name)
466 return dev->init_name;
467
435 return kobject_name(&dev->kobj); 468 return kobject_name(&dev->kobj);
436} 469}
437 470
@@ -472,6 +505,38 @@ static inline int device_is_registered(struct device *dev)
472 return dev->kobj.state_in_sysfs; 505 return dev->kobj.state_in_sysfs;
473} 506}
474 507
508static inline void device_enable_async_suspend(struct device *dev)
509{
510 if (dev->power.status == DPM_ON)
511 dev->power.async_suspend = true;
512}
513
514static inline void device_disable_async_suspend(struct device *dev)
515{
516 if (dev->power.status == DPM_ON)
517 dev->power.async_suspend = false;
518}
519
520static inline bool device_async_suspend_enabled(struct device *dev)
521{
522 return !!dev->power.async_suspend;
523}
524
525static inline void device_lock(struct device *dev)
526{
527 mutex_lock(&dev->mutex);
528}
529
530static inline int device_trylock(struct device *dev)
531{
532 return mutex_trylock(&dev->mutex);
533}
534
535static inline void device_unlock(struct device *dev)
536{
537 mutex_unlock(&dev->mutex);
538}
539
475void driver_init(void); 540void driver_init(void);
476 541
477/* 542/*
diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h
index b6bf17ee2f61..5c9186b93fff 100644
--- a/include/linux/dm-io.h
+++ b/include/linux/dm-io.h
@@ -37,14 +37,14 @@ enum dm_io_mem_type {
37struct dm_io_memory { 37struct dm_io_memory {
38 enum dm_io_mem_type type; 38 enum dm_io_mem_type type;
39 39
40 unsigned offset;
41
40 union { 42 union {
41 struct page_list *pl; 43 struct page_list *pl;
42 struct bio_vec *bvec; 44 struct bio_vec *bvec;
43 void *vma; 45 void *vma;
44 void *addr; 46 void *addr;
45 } ptr; 47 } ptr;
46
47 unsigned offset;
48}; 48};
49 49
50struct dm_io_notify { 50struct dm_io_notify {
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index aa95508d2f95..2c445e113790 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -266,9 +266,9 @@ enum {
266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
267 267
268#define DM_VERSION_MAJOR 4 268#define DM_VERSION_MAJOR 4
269#define DM_VERSION_MINOR 16 269#define DM_VERSION_MINOR 17
270#define DM_VERSION_PATCHLEVEL 0 270#define DM_VERSION_PATCHLEVEL 0
271#define DM_VERSION_EXTRA "-ioctl (2009-11-05)" 271#define DM_VERSION_EXTRA "-ioctl (2010-03-05)"
272 272
273/* Status bits */ 273/* Status bits */
274#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 274#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -316,4 +316,9 @@ enum {
316 */ 316 */
317#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ 317#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */
318 318
319/*
320 * If set, a uevent was generated for which the caller may need to wait.
321 */
322#define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */
323
319#endif /* _LINUX_DM_IOCTL_H */ 324#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index c30879cf93bc..96e87693d933 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -23,7 +23,7 @@
23#define DM9000_PLATF_NO_EEPROM (0x0010) 23#define DM9000_PLATF_NO_EEPROM (0x0010)
24#define DM9000_PLATF_SIMPLE_PHY (0x0020) /* Use NSR to find LinkStatus */ 24#define DM9000_PLATF_SIMPLE_PHY (0x0020) /* Use NSR to find LinkStatus */
25 25
26/* platfrom data for platfrom device structure's platfrom_data field */ 26/* platform data for platform device structure's platform_data field */
27 27
28struct dm9000_plat_data { 28struct dm9000_plat_data {
29 unsigned int flags; 29 unsigned int flags;
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 91b761846061..89b7e1a605b8 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -40,16 +40,6 @@ struct dma_map_ops {
40 void (*sync_single_for_device)(struct device *dev, 40 void (*sync_single_for_device)(struct device *dev,
41 dma_addr_t dma_handle, size_t size, 41 dma_addr_t dma_handle, size_t size,
42 enum dma_data_direction dir); 42 enum dma_data_direction dir);
43 void (*sync_single_range_for_cpu)(struct device *dev,
44 dma_addr_t dma_handle,
45 unsigned long offset,
46 size_t size,
47 enum dma_data_direction dir);
48 void (*sync_single_range_for_device)(struct device *dev,
49 dma_addr_t dma_handle,
50 unsigned long offset,
51 size_t size,
52 enum dma_data_direction dir);
53 void (*sync_sg_for_cpu)(struct device *dev, 43 void (*sync_sg_for_cpu)(struct device *dev,
54 struct scatterlist *sg, int nents, 44 struct scatterlist *sg, int nents,
55 enum dma_data_direction dir); 45 enum dma_data_direction dir);
@@ -105,21 +95,6 @@ static inline int is_device_dma_capable(struct device *dev)
105#include <asm-generic/dma-mapping-broken.h> 95#include <asm-generic/dma-mapping-broken.h>
106#endif 96#endif
107 97
108/* for backwards compatibility, removed soon */
109static inline void __deprecated dma_sync_single(struct device *dev,
110 dma_addr_t addr, size_t size,
111 enum dma_data_direction dir)
112{
113 dma_sync_single_for_cpu(dev, addr, size, dir);
114}
115
116static inline void __deprecated dma_sync_sg(struct device *dev,
117 struct scatterlist *sg, int nelems,
118 enum dma_data_direction dir)
119{
120 dma_sync_sg_for_cpu(dev, sg, nelems, dir);
121}
122
123static inline u64 dma_get_mask(struct device *dev) 98static inline u64 dma_get_mask(struct device *dev)
124{ 99{
125 if (dev && dev->dma_mask && *dev->dma_mask) 100 if (dev && dev->dma_mask && *dev->dma_mask)
@@ -127,6 +102,14 @@ static inline u64 dma_get_mask(struct device *dev)
127 return DMA_BIT_MASK(32); 102 return DMA_BIT_MASK(32);
128} 103}
129 104
105static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
106{
107 if (!dma_supported(dev, mask))
108 return -EIO;
109 dev->coherent_dma_mask = mask;
110 return 0;
111}
112
130extern u64 dma_get_required_mask(struct device *dev); 113extern u64 dma_get_required_mask(struct device *dev);
131 114
132static inline unsigned int dma_get_max_seg_size(struct device *dev) 115static inline unsigned int dma_get_max_seg_size(struct device *dev)
@@ -232,4 +215,20 @@ struct dma_attrs;
232 215
233#endif /* CONFIG_HAVE_DMA_ATTRS */ 216#endif /* CONFIG_HAVE_DMA_ATTRS */
234 217
218#ifdef CONFIG_NEED_DMA_MAP_STATE
219#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
220#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
221#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
222#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
223#define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
224#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
225#else
226#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)
227#define DEFINE_DMA_UNMAP_LEN(LEN_NAME)
228#define dma_unmap_addr(PTR, ADDR_NAME) (0)
229#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
230#define dma_unmap_len(PTR, LEN_NAME) (0)
231#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
232#endif
233
235#endif 234#endif
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 78784982b33e..5204f018931b 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -31,6 +31,8 @@
31 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 31 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
32 */ 32 */
33typedef s32 dma_cookie_t; 33typedef s32 dma_cookie_t;
34#define DMA_MIN_COOKIE 1
35#define DMA_MAX_COOKIE INT_MAX
34 36
35#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) 37#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0)
36 38
@@ -38,11 +40,13 @@ typedef s32 dma_cookie_t;
38 * enum dma_status - DMA transaction status 40 * enum dma_status - DMA transaction status
39 * @DMA_SUCCESS: transaction completed successfully 41 * @DMA_SUCCESS: transaction completed successfully
40 * @DMA_IN_PROGRESS: transaction not yet processed 42 * @DMA_IN_PROGRESS: transaction not yet processed
43 * @DMA_PAUSED: transaction is paused
41 * @DMA_ERROR: transaction failed 44 * @DMA_ERROR: transaction failed
42 */ 45 */
43enum dma_status { 46enum dma_status {
44 DMA_SUCCESS, 47 DMA_SUCCESS,
45 DMA_IN_PROGRESS, 48 DMA_IN_PROGRESS,
49 DMA_PAUSED,
46 DMA_ERROR, 50 DMA_ERROR,
47}; 51};
48 52
@@ -105,6 +109,19 @@ enum dma_ctrl_flags {
105}; 109};
106 110
107/** 111/**
112 * enum dma_ctrl_cmd - DMA operations that can optionally be exercised
113 * on a running channel.
114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers
115 * @DMA_PAUSE: pause ongoing transfers
116 * @DMA_RESUME: resume paused transfer
117 */
118enum dma_ctrl_cmd {
119 DMA_TERMINATE_ALL,
120 DMA_PAUSE,
121 DMA_RESUME,
122};
123
124/**
108 * enum sum_check_bits - bit position of pq_check_flags 125 * enum sum_check_bits - bit position of pq_check_flags
109 */ 126 */
110enum sum_check_bits { 127enum sum_check_bits {
@@ -162,7 +179,7 @@ struct dma_chan {
162 struct dma_chan_dev *dev; 179 struct dma_chan_dev *dev;
163 180
164 struct list_head device_node; 181 struct list_head device_node;
165 struct dma_chan_percpu *local; 182 struct dma_chan_percpu __percpu *local;
166 int client_count; 183 int client_count;
167 int table_count; 184 int table_count;
168 void *private; 185 void *private;
@@ -228,9 +245,84 @@ struct dma_async_tx_descriptor {
228 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 245 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
229 dma_async_tx_callback callback; 246 dma_async_tx_callback callback;
230 void *callback_param; 247 void *callback_param;
248#ifndef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
231 struct dma_async_tx_descriptor *next; 249 struct dma_async_tx_descriptor *next;
232 struct dma_async_tx_descriptor *parent; 250 struct dma_async_tx_descriptor *parent;
233 spinlock_t lock; 251 spinlock_t lock;
252#endif
253};
254
255#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
256static inline void txd_lock(struct dma_async_tx_descriptor *txd)
257{
258}
259static inline void txd_unlock(struct dma_async_tx_descriptor *txd)
260{
261}
262static inline void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next)
263{
264 BUG();
265}
266static inline void txd_clear_parent(struct dma_async_tx_descriptor *txd)
267{
268}
269static inline void txd_clear_next(struct dma_async_tx_descriptor *txd)
270{
271}
272static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd)
273{
274 return NULL;
275}
276static inline struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd)
277{
278 return NULL;
279}
280
281#else
282static inline void txd_lock(struct dma_async_tx_descriptor *txd)
283{
284 spin_lock_bh(&txd->lock);
285}
286static inline void txd_unlock(struct dma_async_tx_descriptor *txd)
287{
288 spin_unlock_bh(&txd->lock);
289}
290static inline void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next)
291{
292 txd->next = next;
293 next->parent = txd;
294}
295static inline void txd_clear_parent(struct dma_async_tx_descriptor *txd)
296{
297 txd->parent = NULL;
298}
299static inline void txd_clear_next(struct dma_async_tx_descriptor *txd)
300{
301 txd->next = NULL;
302}
303static inline struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd)
304{
305 return txd->parent;
306}
307static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd)
308{
309 return txd->next;
310}
311#endif
312
313/**
314 * struct dma_tx_state - filled in to report the status of
315 * a transfer.
316 * @last: last completed DMA cookie
317 * @used: last issued DMA cookie (i.e. the one in progress)
318 * @residue: the remaining number of bytes left to transmit
319 * on the selected transfer for states DMA_IN_PROGRESS and
320 * DMA_PAUSED if this is implemented in the driver, else 0
321 */
322struct dma_tx_state {
323 dma_cookie_t last;
324 dma_cookie_t used;
325 u32 residue;
234}; 326};
235 327
236/** 328/**
@@ -259,8 +351,12 @@ struct dma_async_tx_descriptor {
259 * @device_prep_dma_memset: prepares a memset operation 351 * @device_prep_dma_memset: prepares a memset operation
260 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 352 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
261 * @device_prep_slave_sg: prepares a slave dma operation 353 * @device_prep_slave_sg: prepares a slave dma operation
262 * @device_terminate_all: terminate all pending operations 354 * @device_control: manipulate all pending operations on a channel, returns
263 * @device_is_tx_complete: poll for transaction completion 355 * zero or error code
356 * @device_tx_status: poll for transaction completion, the optional
357 * txstate parameter can be supplied with a pointer to get a
358 * struct with auxilary transfer status information, otherwise the call
359 * will just return a simple status code
264 * @device_issue_pending: push pending transactions to hardware 360 * @device_issue_pending: push pending transactions to hardware
265 */ 361 */
266struct dma_device { 362struct dma_device {
@@ -311,11 +407,12 @@ struct dma_device {
311 struct dma_chan *chan, struct scatterlist *sgl, 407 struct dma_chan *chan, struct scatterlist *sgl,
312 unsigned int sg_len, enum dma_data_direction direction, 408 unsigned int sg_len, enum dma_data_direction direction,
313 unsigned long flags); 409 unsigned long flags);
314 void (*device_terminate_all)(struct dma_chan *chan); 410 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
411 unsigned long arg);
315 412
316 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, 413 enum dma_status (*device_tx_status)(struct dma_chan *chan,
317 dma_cookie_t cookie, dma_cookie_t *last, 414 dma_cookie_t cookie,
318 dma_cookie_t *used); 415 struct dma_tx_state *txstate);
319 void (*device_issue_pending)(struct dma_chan *chan); 416 void (*device_issue_pending)(struct dma_chan *chan);
320}; 417};
321 418
@@ -556,7 +653,15 @@ static inline void dma_async_issue_pending(struct dma_chan *chan)
556static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, 653static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan,
557 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used) 654 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used)
558{ 655{
559 return chan->device->device_is_tx_complete(chan, cookie, last, used); 656 struct dma_tx_state state;
657 enum dma_status status;
658
659 status = chan->device->device_tx_status(chan, cookie, &state);
660 if (last)
661 *last = state.last;
662 if (used)
663 *used = state.used;
664 return status;
560} 665}
561 666
562#define dma_async_memcpy_complete(chan, cookie, last, used)\ 667#define dma_async_memcpy_complete(chan, cookie, last, used)\
@@ -584,6 +689,16 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
584 return DMA_IN_PROGRESS; 689 return DMA_IN_PROGRESS;
585} 690}
586 691
692static inline void
693dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)
694{
695 if (st) {
696 st->last = last;
697 st->used = used;
698 st->residue = residue;
699 }
700}
701
587enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); 702enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
588#ifdef CONFIG_DMA_ENGINE 703#ifdef CONFIG_DMA_ENGINE
589enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 704enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index 527504c11c5e..4389ae72024e 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -110,6 +110,15 @@ typedef struct fs_disk_quota {
110#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) 110#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
111 111
112/* 112/*
113 * Accounting values. These can only be set for filesystem with
114 * non-transactional quotas that require quotacheck(8) in userspace.
115 */
116#define FS_DQ_BCOUNT (1<<12)
117#define FS_DQ_ICOUNT (1<<13)
118#define FS_DQ_RTBCOUNT (1<<14)
119#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
120
121/*
113 * Various flags related to quotactl(2). Only relevant to XFS filesystems. 122 * Various flags related to quotactl(2). Only relevant to XFS filesystems.
114 */ 123 */
115#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ 124#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 78962272338a..b8d2516668aa 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,10 +53,10 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.7" 56#define REL_VERSION "8.3.8"
57#define API_VERSION 88 57#define API_VERSION 88
58#define PRO_VERSION_MIN 86 58#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 91 59#define PRO_VERSION_MAX 94
60 60
61 61
62enum drbd_io_error_p { 62enum drbd_io_error_p {
@@ -139,6 +139,7 @@ enum drbd_ret_codes {
139 ERR_DATA_NOT_CURRENT = 150, 139 ERR_DATA_NOT_CURRENT = 150,
140 ERR_CONNECTED = 151, /* DRBD 8.3 only */ 140 ERR_CONNECTED = 151, /* DRBD 8.3 only */
141 ERR_PERM = 152, 141 ERR_PERM = 152,
142 ERR_NEED_APV_93 = 153,
142 143
143 /* insert new ones above this line */ 144 /* insert new ones above this line */
144 AFTER_LAST_ERR_CODE 145 AFTER_LAST_ERR_CODE
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 51f47a586ad8..440b42e38e89 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -133,5 +133,21 @@
133#define DRBD_MAX_BIO_BVECS_MAX 128 133#define DRBD_MAX_BIO_BVECS_MAX 128
134#define DRBD_MAX_BIO_BVECS_DEF 0 134#define DRBD_MAX_BIO_BVECS_DEF 0
135 135
136#define DRBD_DP_VOLUME_MIN 4
137#define DRBD_DP_VOLUME_MAX 1048576
138#define DRBD_DP_VOLUME_DEF 16384
139
140#define DRBD_DP_INTERVAL_MIN 1
141#define DRBD_DP_INTERVAL_MAX 600
142#define DRBD_DP_INTERVAL_DEF 5
143
144#define DRBD_RS_THROTTLE_TH_MIN 1
145#define DRBD_RS_THROTTLE_TH_MAX 600
146#define DRBD_RS_THROTTLE_TH_DEF 20
147
148#define DRBD_RS_HOLD_OFF_TH_MIN 1
149#define DRBD_RS_HOLD_OFF_TH_MAX 6000
150#define DRBD_RS_HOLD_OFF_TH_DEF 100
151
136#undef RANGE 152#undef RANGE
137#endif 153#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index a4d82f895994..ce77a746fc9d 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -12,7 +12,7 @@
12#endif 12#endif
13 13
14NL_PACKET(primary, 1, 14NL_PACKET(primary, 1,
15 NL_BIT( 1, T_MAY_IGNORE, overwrite_peer) 15 NL_BIT( 1, T_MAY_IGNORE, primary_force)
16) 16)
17 17
18NL_PACKET(secondary, 2, ) 18NL_PACKET(secondary, 2, )
@@ -63,6 +63,7 @@ NL_PACKET(net_conf, 5,
63 NL_BIT( 41, T_MAY_IGNORE, always_asbp) 63 NL_BIT( 41, T_MAY_IGNORE, always_asbp)
64 NL_BIT( 61, T_MAY_IGNORE, no_cork) 64 NL_BIT( 61, T_MAY_IGNORE, no_cork)
65 NL_BIT( 62, T_MANDATORY, auto_sndbuf_size) 65 NL_BIT( 62, T_MANDATORY, auto_sndbuf_size)
66 NL_BIT( 70, T_MANDATORY, dry_run)
66) 67)
67 68
68NL_PACKET(disconnect, 6, ) 69NL_PACKET(disconnect, 6, )
@@ -70,12 +71,17 @@ NL_PACKET(disconnect, 6, )
70NL_PACKET(resize, 7, 71NL_PACKET(resize, 7,
71 NL_INT64( 29, T_MAY_IGNORE, resize_size) 72 NL_INT64( 29, T_MAY_IGNORE, resize_size)
72 NL_BIT( 68, T_MAY_IGNORE, resize_force) 73 NL_BIT( 68, T_MAY_IGNORE, resize_force)
74 NL_BIT( 69, T_MANDATORY, no_resync)
73) 75)
74 76
75NL_PACKET(syncer_conf, 8, 77NL_PACKET(syncer_conf, 8,
76 NL_INTEGER( 30, T_MAY_IGNORE, rate) 78 NL_INTEGER( 30, T_MAY_IGNORE, rate)
77 NL_INTEGER( 31, T_MAY_IGNORE, after) 79 NL_INTEGER( 31, T_MAY_IGNORE, after)
78 NL_INTEGER( 32, T_MAY_IGNORE, al_extents) 80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
81 NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
82 NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
83 NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
84 NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
79 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) 85 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
80 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) 86 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
81 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) 87 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
diff --git a/include/linux/ds2782_battery.h b/include/linux/ds2782_battery.h
new file mode 100644
index 000000000000..b4e281f65c15
--- /dev/null
+++ b/include/linux/ds2782_battery.h
@@ -0,0 +1,8 @@
1#ifndef __LINUX_DS2782_BATTERY_H
2#define __LINUX_DS2782_BATTERY_H
3
4struct ds278x_platform_data {
5 int rsns;
6};
7
8#endif
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index f8c2e1767500..52c0da4bdd18 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -28,7 +28,7 @@ struct _ddebug {
28 /* 28 /*
29 * The flags field controls the behaviour at the callsite. 29 * The flags field controls the behaviour at the callsite.
30 * The bits here are changed dynamically when the user 30 * The bits here are changed dynamically when the user
31 * writes commands to <debugfs>/dynamic_debug/ddebug 31 * writes commands to <debugfs>/dynamic_debug/control
32 */ 32 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
34#define _DPRINTK_FLAGS_DEFAULT 0 34#define _DPRINTK_FLAGS_DEFAULT 0
@@ -40,7 +40,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
40 const char *modname); 40 const char *modname);
41 41
42#if defined(CONFIG_DYNAMIC_DEBUG) 42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(char *mod_name); 43extern int ddebug_remove_module(const char *mod_name);
44 44
45#define __dynamic_dbg_enabled(dd) ({ \ 45#define __dynamic_dbg_enabled(dd) ({ \
46 int __ret = 0; \ 46 int __ret = 0; \
@@ -73,7 +73,7 @@ extern int ddebug_remove_module(char *mod_name);
73 73
74#else 74#else
75 75
76static inline int ddebug_remove_module(char *mod) 76static inline int ddebug_remove_module(const char *mod)
77{ 77{
78 return 0; 78 return 0;
79} 79}
diff --git a/include/linux/early_res.h b/include/linux/early_res.h
new file mode 100644
index 000000000000..29c09f57a13c
--- /dev/null
+++ b/include/linux/early_res.h
@@ -0,0 +1,23 @@
1#ifndef _LINUX_EARLY_RES_H
2#define _LINUX_EARLY_RES_H
3#ifdef __KERNEL__
4
5extern void reserve_early(u64 start, u64 end, char *name);
6extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
7extern void free_early(u64 start, u64 end);
8void free_early_partial(u64 start, u64 end);
9extern void early_res_to_bootmem(u64 start, u64 end);
10
11void reserve_early_without_check(u64 start, u64 end, char *name);
12u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
13 u64 size, u64 align);
14u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
15 u64 *sizep, u64 align);
16u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
17u64 get_max_mapped(void);
18#include <linux/range.h>
19int get_free_all_memory_range(struct range **rangep, int nodeid);
20
21#endif /* __KERNEL__ */
22
23#endif /* _LINUX_EARLY_RES_H */
diff --git a/include/linux/edac_mce.h b/include/linux/edac_mce.h
new file mode 100644
index 000000000000..f974fc035363
--- /dev/null
+++ b/include/linux/edac_mce.h
@@ -0,0 +1,31 @@
1/* Provides edac interface to mcelog events
2 *
3 * This file may be distributed under the terms of the
4 * GNU General Public License version 2.
5 *
6 * Copyright (c) 2009 by:
7 * Mauro Carvalho Chehab <mchehab@redhat.com>
8 *
9 * Red Hat Inc. http://www.redhat.com
10 */
11
12#if defined(CONFIG_EDAC_MCE) || \
13 (defined(CONFIG_EDAC_MCE_MODULE) && defined(MODULE))
14
15#include <asm/mce.h>
16#include <linux/list.h>
17
18struct edac_mce {
19 struct list_head list;
20
21 void *priv;
22 int (*check_error)(void *priv, struct mce *mce);
23};
24
25int edac_mce_register(struct edac_mce *edac_mce);
26void edac_mce_unregister(struct edac_mce *edac_mce);
27int edac_mce_parse(struct mce *mce);
28
29#else
30#define edac_mce_parse(mce) (0)
31#endif
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 1cb3372e65d8..2c958f4fce1e 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -14,6 +14,9 @@ typedef void (elevator_merged_fn) (struct request_queue *, struct request *, int
14 14
15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *); 15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *);
16 16
17typedef void (elevator_bio_merged_fn) (struct request_queue *,
18 struct request *, struct bio *);
19
17typedef int (elevator_dispatch_fn) (struct request_queue *, int); 20typedef int (elevator_dispatch_fn) (struct request_queue *, int);
18 21
19typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); 22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
@@ -36,6 +39,7 @@ struct elevator_ops
36 elevator_merged_fn *elevator_merged_fn; 39 elevator_merged_fn *elevator_merged_fn;
37 elevator_merge_req_fn *elevator_merge_req_fn; 40 elevator_merge_req_fn *elevator_merge_req_fn;
38 elevator_allow_merge_fn *elevator_allow_merge_fn; 41 elevator_allow_merge_fn *elevator_allow_merge_fn;
42 elevator_bio_merged_fn *elevator_bio_merged_fn;
39 43
40 elevator_dispatch_fn *elevator_dispatch_fn; 44 elevator_dispatch_fn *elevator_dispatch_fn;
41 elevator_add_req_fn *elevator_add_req_fn; 45 elevator_add_req_fn *elevator_add_req_fn;
@@ -103,6 +107,8 @@ extern int elv_merge(struct request_queue *, struct request **, struct bio *);
103extern void elv_merge_requests(struct request_queue *, struct request *, 107extern void elv_merge_requests(struct request_queue *, struct request *,
104 struct request *); 108 struct request *);
105extern void elv_merged_request(struct request_queue *, struct request *, int); 109extern void elv_merged_request(struct request_queue *, struct request *, int);
110extern void elv_bio_merged(struct request_queue *q, struct request *,
111 struct bio *);
106extern void elv_requeue_request(struct request_queue *, struct request *); 112extern void elv_requeue_request(struct request_queue *, struct request *);
107extern int elv_queue_empty(struct request_queue *); 113extern int elv_queue_empty(struct request_queue *);
108extern struct request *elv_former_request(struct request_queue *, struct request *); 114extern struct request *elv_former_request(struct request_queue *, struct request *);
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 0cc4d55151b7..4d608014753a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -50,6 +50,28 @@ typedef __s64 Elf64_Sxword;
50 50
51#define PT_GNU_STACK (PT_LOOS + 0x474e551) 51#define PT_GNU_STACK (PT_LOOS + 0x474e551)
52 52
53/*
54 * Extended Numbering
55 *
56 * If the real number of program header table entries is larger than
57 * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
58 * section header at index 0, and PN_XNUM is set to e_phnum
59 * field. Otherwise, the section header at index 0 is zero
60 * initialized, if it exists.
61 *
62 * Specifications are available in:
63 *
64 * - Sun microsystems: Linker and Libraries.
65 * Part No: 817-1984-17, September 2008.
66 * URL: http://docs.sun.com/app/docs/doc/817-1984
67 *
68 * - System V ABI AMD64 Architecture Processor Supplement
69 * Draft Version 0.99.,
70 * May 11, 2009.
71 * URL: http://www.x86-64.org/
72 */
73#define PN_XNUM 0xffff
74
53/* These constants define the different elf file types */ 75/* These constants define the different elf file types */
54#define ET_NONE 0 76#define ET_NONE 0
55#define ET_REL 1 77#define ET_REL 1
@@ -286,7 +308,7 @@ typedef struct elf64_phdr {
286#define SHN_COMMON 0xfff2 308#define SHN_COMMON 0xfff2
287#define SHN_HIRESERVE 0xffff 309#define SHN_HIRESERVE 0xffff
288 310
289typedef struct { 311typedef struct elf32_shdr {
290 Elf32_Word sh_name; 312 Elf32_Word sh_name;
291 Elf32_Word sh_type; 313 Elf32_Word sh_type;
292 Elf32_Word sh_flags; 314 Elf32_Word sh_flags;
@@ -349,7 +371,11 @@ typedef struct elf64_shdr {
349#define ELF_OSABI ELFOSABI_NONE 371#define ELF_OSABI ELFOSABI_NONE
350#endif 372#endif
351 373
352/* Notes used in ET_CORE */ 374/*
375 * Notes used in ET_CORE. Architectures export some of the arch register sets
376 * using the corresponding note types via the PTRACE_GETREGSET and
377 * PTRACE_SETREGSET requests.
378 */
353#define NT_PRSTATUS 1 379#define NT_PRSTATUS 1
354#define NT_PRFPREG 2 380#define NT_PRFPREG 2
355#define NT_PRPSINFO 3 381#define NT_PRPSINFO 3
@@ -361,7 +387,14 @@ typedef struct elf64_shdr {
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 387#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 388#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 389#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
390#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
364#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ 391#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
392#define NT_S390_TIMER 0x301 /* s390 timer register */
393#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
394#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
395#define NT_S390_CTRS 0x304 /* s390 control registers */
396#define NT_S390_PREFIX 0x305 /* s390 prefix register */
397#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
365 398
366 399
367/* Note header in a PT_NOTE section */ 400/* Note header in a PT_NOTE section */
@@ -384,16 +417,20 @@ typedef struct elf64_note {
384extern Elf32_Dyn _DYNAMIC []; 417extern Elf32_Dyn _DYNAMIC [];
385#define elfhdr elf32_hdr 418#define elfhdr elf32_hdr
386#define elf_phdr elf32_phdr 419#define elf_phdr elf32_phdr
420#define elf_shdr elf32_shdr
387#define elf_note elf32_note 421#define elf_note elf32_note
388#define elf_addr_t Elf32_Off 422#define elf_addr_t Elf32_Off
423#define Elf_Half Elf32_Half
389 424
390#else 425#else
391 426
392extern Elf64_Dyn _DYNAMIC []; 427extern Elf64_Dyn _DYNAMIC [];
393#define elfhdr elf64_hdr 428#define elfhdr elf64_hdr
394#define elf_phdr elf64_phdr 429#define elf_phdr elf64_phdr
430#define elf_shdr elf64_shdr
395#define elf_note elf64_note 431#define elf_note elf64_note
396#define elf_addr_t Elf64_Off 432#define elf_addr_t Elf64_Off
433#define Elf_Half Elf64_Half
397 434
398#endif 435#endif
399 436
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 00d6a68d0421..394a3e0e4a6b 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -8,6 +8,8 @@
8#include <linux/user.h> 8#include <linux/user.h>
9#endif 9#endif
10#include <linux/ptrace.h> 10#include <linux/ptrace.h>
11#include <linux/elf.h>
12#include <linux/fs.h>
11 13
12struct elf_siginfo 14struct elf_siginfo
13{ 15{
@@ -148,7 +150,22 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse
148} 150}
149#endif 151#endif
150 152
151#endif /* __KERNEL__ */ 153/*
154 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
155 * extra segments containing the gate DSO contents. Dumping its
156 * contents makes post-mortem fully interpretable later without matching up
157 * the same kernel and hardware config to see what PC values meant.
158 * Dumping its extra ELF program headers includes all the other information
159 * a debugger needs to easily find how the gate DSO was being used.
160 */
161extern Elf_Half elf_core_extra_phdrs(void);
162extern int
163elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size,
164 unsigned long limit);
165extern int
166elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit);
167extern size_t elf_core_extra_data_size(void);
152 168
169#endif /* __KERNEL__ */
153 170
154#endif /* _LINUX_ELFCORE_H */ 171#endif /* _LINUX_ELFCORE_H */
diff --git a/include/linux/err.h b/include/linux/err.h
index 1b12642636c7..448afc12c78a 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -19,22 +19,22 @@
19 19
20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) 20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
21 21
22static inline void *ERR_PTR(long error) 22static inline void * __must_check ERR_PTR(long error)
23{ 23{
24 return (void *) error; 24 return (void *) error;
25} 25}
26 26
27static inline long PTR_ERR(const void *ptr) 27static inline long __must_check PTR_ERR(const void *ptr)
28{ 28{
29 return (long) ptr; 29 return (long) ptr;
30} 30}
31 31
32static inline long IS_ERR(const void *ptr) 32static inline long __must_check IS_ERR(const void *ptr)
33{ 33{
34 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
35} 35}
36 36
37static inline long IS_ERR_OR_NULL(const void *ptr) 37static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
38{ 38{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr); 39 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40} 40}
@@ -46,7 +46,7 @@ static inline long IS_ERR_OR_NULL(const void *ptr)
46 * Explicitly cast an error-valued pointer to another pointer type in such a 46 * Explicitly cast an error-valued pointer to another pointer type in such a
47 * way as to make it clear that's what's going on. 47 * way as to make it clear that's what's going on.
48 */ 48 */
49static inline void *ERR_CAST(const void *ptr) 49static inline void * __must_check ERR_CAST(const void *ptr)
50{ 50{
51 /* cast away the const */ 51 /* cast away the const */
52 return (void *) ptr; 52 return (void *) ptr;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index ef4a2d84d922..b4207ca3ad52 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -61,6 +61,13 @@ struct ethtool_drvinfo {
61 /* For PCI devices, use pci_name(pci_dev). */ 61 /* For PCI devices, use pci_name(pci_dev). */
62 char reserved1[32]; 62 char reserved1[32];
63 char reserved2[12]; 63 char reserved2[12];
64 /*
65 * Some struct members below are filled in
66 * using ops->get_sset_count(). Obtaining
67 * this info from ethtool_drvinfo is now
68 * deprecated; Use ETHTOOL_GSSET_INFO
69 * instead.
70 */
64 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ 71 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
65 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ 72 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
66 __u32 testinfo_len; 73 __u32 testinfo_len;
@@ -242,6 +249,7 @@ enum ethtool_stringset {
242 ETH_SS_TEST = 0, 249 ETH_SS_TEST = 0,
243 ETH_SS_STATS, 250 ETH_SS_STATS,
244 ETH_SS_PRIV_FLAGS, 251 ETH_SS_PRIV_FLAGS,
252 ETH_SS_NTUPLE_FILTERS,
245}; 253};
246 254
247/* for passing string sets for data tagging */ 255/* for passing string sets for data tagging */
@@ -252,6 +260,17 @@ struct ethtool_gstrings {
252 __u8 data[0]; 260 __u8 data[0];
253}; 261};
254 262
263struct ethtool_sset_info {
264 __u32 cmd; /* ETHTOOL_GSSET_INFO */
265 __u32 reserved;
266 __u64 sset_mask; /* input: each bit selects an sset to query */
267 /* output: each bit a returned sset */
268 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
269 in sset_mask. One bit implies one
270 __u32, two bits implies two
271 __u32's, etc. */
272};
273
255enum ethtool_test_flags { 274enum ethtool_test_flags {
256 ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ 275 ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */
257 ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ 276 ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */
@@ -290,6 +309,8 @@ struct ethtool_perm_addr {
290 */ 309 */
291enum ethtool_flags { 310enum ethtool_flags {
292 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 311 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
312 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
313 ETH_FLAG_RXHASH = (1 << 28),
293}; 314};
294 315
295/* The following structures are for supporting RX network flow 316/* The following structures are for supporting RX network flow
@@ -358,11 +379,42 @@ struct ethtool_rxnfc {
358 __u32 flow_type; 379 __u32 flow_type;
359 /* The rx flow hash value or the rule DB size */ 380 /* The rx flow hash value or the rule DB size */
360 __u64 data; 381 __u64 data;
382 /* The following fields are not valid and must not be used for
383 * the ETHTOOL_{G,X}RXFH commands. */
361 struct ethtool_rx_flow_spec fs; 384 struct ethtool_rx_flow_spec fs;
362 __u32 rule_cnt; 385 __u32 rule_cnt;
363 __u32 rule_locs[0]; 386 __u32 rule_locs[0];
364}; 387};
365 388
389struct ethtool_rx_ntuple_flow_spec {
390 __u32 flow_type;
391 union {
392 struct ethtool_tcpip4_spec tcp_ip4_spec;
393 struct ethtool_tcpip4_spec udp_ip4_spec;
394 struct ethtool_tcpip4_spec sctp_ip4_spec;
395 struct ethtool_ah_espip4_spec ah_ip4_spec;
396 struct ethtool_ah_espip4_spec esp_ip4_spec;
397 struct ethtool_rawip4_spec raw_ip4_spec;
398 struct ethtool_ether_spec ether_spec;
399 struct ethtool_usrip4_spec usr_ip4_spec;
400 __u8 hdata[64];
401 } h_u, m_u; /* entry, mask */
402
403 __u16 vlan_tag;
404 __u16 vlan_tag_mask;
405 __u64 data; /* user-defined flow spec data */
406 __u64 data_mask; /* user-defined flow spec mask */
407
408 /* signed to distinguish between queue and actions (DROP) */
409 __s32 action;
410#define ETHTOOL_RXNTUPLE_ACTION_DROP -1
411};
412
413struct ethtool_rx_ntuple {
414 __u32 cmd;
415 struct ethtool_rx_ntuple_flow_spec fs;
416};
417
366#define ETHTOOL_FLASH_MAX_FILENAME 128 418#define ETHTOOL_FLASH_MAX_FILENAME 128
367enum ethtool_flash_op_type { 419enum ethtool_flash_op_type {
368 ETHTOOL_FLASH_ALL_REGIONS = 0, 420 ETHTOOL_FLASH_ALL_REGIONS = 0,
@@ -377,6 +429,20 @@ struct ethtool_flash {
377 429
378#ifdef __KERNEL__ 430#ifdef __KERNEL__
379 431
432#include <linux/rculist.h>
433
434struct ethtool_rx_ntuple_flow_spec_container {
435 struct ethtool_rx_ntuple_flow_spec fs;
436 struct list_head list;
437};
438
439struct ethtool_rx_ntuple_list {
440#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
441#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
442 struct list_head list;
443 unsigned int count;
444};
445
380struct net_device; 446struct net_device;
381 447
382/* Some generic methods drivers may use in their ethtool_ops */ 448/* Some generic methods drivers may use in their ethtool_ops */
@@ -394,6 +460,7 @@ u32 ethtool_op_get_ufo(struct net_device *dev);
394int ethtool_op_set_ufo(struct net_device *dev, u32 data); 460int ethtool_op_set_ufo(struct net_device *dev, u32 data);
395u32 ethtool_op_get_flags(struct net_device *dev); 461u32 ethtool_op_get_flags(struct net_device *dev);
396int ethtool_op_set_flags(struct net_device *dev, u32 data); 462int ethtool_op_set_flags(struct net_device *dev, u32 data);
463void ethtool_ntuple_flush(struct net_device *dev);
397 464
398/** 465/**
399 * &ethtool_ops - Alter and report network device settings 466 * &ethtool_ops - Alter and report network device settings
@@ -426,12 +493,12 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data);
426 * get_ufo: Report whether UDP fragmentation offload is enabled 493 * get_ufo: Report whether UDP fragmentation offload is enabled
427 * set_ufo: Turn UDP fragmentation offload on or off 494 * set_ufo: Turn UDP fragmentation offload on or off
428 * self_test: Run specified self-tests 495 * self_test: Run specified self-tests
429 * get_strings: Return a set of strings that describe the requested objects 496 * get_strings: Return a set of strings that describe the requested objects
430 * phys_id: Identify the device 497 * phys_id: Identify the device
431 * get_stats: Return statistics about the device 498 * get_stats: Return statistics about the device
432 * get_flags: get 32-bit flags bitmap 499 * get_flags: get 32-bit flags bitmap
433 * set_flags: set 32-bit flags bitmap 500 * set_flags: set 32-bit flags bitmap
434 * 501 *
435 * Description: 502 * Description:
436 * 503 *
437 * get_settings: 504 * get_settings:
@@ -467,14 +534,20 @@ struct ethtool_ops {
467 int (*nway_reset)(struct net_device *); 534 int (*nway_reset)(struct net_device *);
468 u32 (*get_link)(struct net_device *); 535 u32 (*get_link)(struct net_device *);
469 int (*get_eeprom_len)(struct net_device *); 536 int (*get_eeprom_len)(struct net_device *);
470 int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); 537 int (*get_eeprom)(struct net_device *,
471 int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); 538 struct ethtool_eeprom *, u8 *);
539 int (*set_eeprom)(struct net_device *,
540 struct ethtool_eeprom *, u8 *);
472 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); 541 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
473 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); 542 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
474 void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); 543 void (*get_ringparam)(struct net_device *,
475 int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); 544 struct ethtool_ringparam *);
476 void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); 545 int (*set_ringparam)(struct net_device *,
477 int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); 546 struct ethtool_ringparam *);
547 void (*get_pauseparam)(struct net_device *,
548 struct ethtool_pauseparam*);
549 int (*set_pauseparam)(struct net_device *,
550 struct ethtool_pauseparam*);
478 u32 (*get_rx_csum)(struct net_device *); 551 u32 (*get_rx_csum)(struct net_device *);
479 int (*set_rx_csum)(struct net_device *, u32); 552 int (*set_rx_csum)(struct net_device *, u32);
480 u32 (*get_tx_csum)(struct net_device *); 553 u32 (*get_tx_csum)(struct net_device *);
@@ -486,20 +559,25 @@ struct ethtool_ops {
486 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 559 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
487 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 560 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
488 int (*phys_id)(struct net_device *, u32); 561 int (*phys_id)(struct net_device *, u32);
489 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 562 void (*get_ethtool_stats)(struct net_device *,
563 struct ethtool_stats *, u64 *);
490 int (*begin)(struct net_device *); 564 int (*begin)(struct net_device *);
491 void (*complete)(struct net_device *); 565 void (*complete)(struct net_device *);
492 u32 (*get_ufo)(struct net_device *); 566 u32 (*get_ufo)(struct net_device *);
493 int (*set_ufo)(struct net_device *, u32); 567 int (*set_ufo)(struct net_device *, u32);
494 u32 (*get_flags)(struct net_device *); 568 u32 (*get_flags)(struct net_device *);
495 int (*set_flags)(struct net_device *, u32); 569 int (*set_flags)(struct net_device *, u32);
496 u32 (*get_priv_flags)(struct net_device *); 570 u32 (*get_priv_flags)(struct net_device *);
497 int (*set_priv_flags)(struct net_device *, u32); 571 int (*set_priv_flags)(struct net_device *, u32);
498 int (*get_sset_count)(struct net_device *, int); 572 int (*get_sset_count)(struct net_device *, int);
499 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 573 int (*get_rxnfc)(struct net_device *,
574 struct ethtool_rxnfc *, void *);
500 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 575 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
501 int (*flash_device)(struct net_device *, struct ethtool_flash *); 576 int (*flash_device)(struct net_device *, struct ethtool_flash *);
502 int (*reset)(struct net_device *, u32 *); 577 int (*reset)(struct net_device *, u32 *);
578 int (*set_rx_ntuple)(struct net_device *,
579 struct ethtool_rx_ntuple *);
580 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
503}; 581};
504#endif /* __KERNEL__ */ 582#endif /* __KERNEL__ */
505 583
@@ -510,29 +588,29 @@ struct ethtool_ops {
510#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 588#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
511#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 589#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
512#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 590#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
513#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 591#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
514#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 592#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
515#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 593#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
516#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ 594#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */
517#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 595#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
518#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 596#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
519#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 597#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
520#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 598#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
521#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 599#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
522#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 600#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
523#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 601#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
524#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 602#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
525#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 603#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
526#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 604#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
527#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 605#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
528#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 606#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
529#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 607#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
530 * (ethtool_value) */ 608 * (ethtool_value) */
531#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 609#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
532 * (ethtool_value). */ 610 * (ethtool_value). */
533#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 611#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
534#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 612#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
535#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 613#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
536#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 614#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
537#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 615#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
538#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 616#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
@@ -543,21 +621,24 @@ struct ethtool_ops {
543#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 621#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
544#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 622#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
545#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 623#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
546#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 624#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
547#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 625#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
548 626
549#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 627#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
550#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 628#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
551#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 629#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
552#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 630#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
553#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 631#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
554#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 632#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
555#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 633#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
556#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 634#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
557#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 635#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
558#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 636#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
559#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 637#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
560#define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 638#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
639#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
640#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */
641#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
561 642
562/* compatibility with older code */ 643/* compatibility with older code */
563#define SPARC_ETH_GSET ETHTOOL_GSET 644#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -566,18 +647,18 @@ struct ethtool_ops {
566/* Indicates what features are supported by the interface. */ 647/* Indicates what features are supported by the interface. */
567#define SUPPORTED_10baseT_Half (1 << 0) 648#define SUPPORTED_10baseT_Half (1 << 0)
568#define SUPPORTED_10baseT_Full (1 << 1) 649#define SUPPORTED_10baseT_Full (1 << 1)
569#define SUPPORTED_100baseT_Half (1 << 2) 650#define SUPPORTED_100baseT_Half (1 << 2)
570#define SUPPORTED_100baseT_Full (1 << 3) 651#define SUPPORTED_100baseT_Full (1 << 3)
571#define SUPPORTED_1000baseT_Half (1 << 4) 652#define SUPPORTED_1000baseT_Half (1 << 4)
572#define SUPPORTED_1000baseT_Full (1 << 5) 653#define SUPPORTED_1000baseT_Full (1 << 5)
573#define SUPPORTED_Autoneg (1 << 6) 654#define SUPPORTED_Autoneg (1 << 6)
574#define SUPPORTED_TP (1 << 7) 655#define SUPPORTED_TP (1 << 7)
575#define SUPPORTED_AUI (1 << 8) 656#define SUPPORTED_AUI (1 << 8)
576#define SUPPORTED_MII (1 << 9) 657#define SUPPORTED_MII (1 << 9)
577#define SUPPORTED_FIBRE (1 << 10) 658#define SUPPORTED_FIBRE (1 << 10)
578#define SUPPORTED_BNC (1 << 11) 659#define SUPPORTED_BNC (1 << 11)
579#define SUPPORTED_10000baseT_Full (1 << 12) 660#define SUPPORTED_10000baseT_Full (1 << 12)
580#define SUPPORTED_Pause (1 << 13) 661#define SUPPORTED_Pause (1 << 13)
581#define SUPPORTED_Asym_Pause (1 << 14) 662#define SUPPORTED_Asym_Pause (1 << 14)
582#define SUPPORTED_2500baseX_Full (1 << 15) 663#define SUPPORTED_2500baseX_Full (1 << 15)
583#define SUPPORTED_Backplane (1 << 16) 664#define SUPPORTED_Backplane (1 << 16)
@@ -587,8 +668,8 @@ struct ethtool_ops {
587#define SUPPORTED_10000baseR_FEC (1 << 20) 668#define SUPPORTED_10000baseR_FEC (1 << 20)
588 669
589/* Indicates what features are advertised by the interface. */ 670/* Indicates what features are advertised by the interface. */
590#define ADVERTISED_10baseT_Half (1 << 0) 671#define ADVERTISED_10baseT_Half (1 << 0)
591#define ADVERTISED_10baseT_Full (1 << 1) 672#define ADVERTISED_10baseT_Full (1 << 1)
592#define ADVERTISED_100baseT_Half (1 << 2) 673#define ADVERTISED_100baseT_Half (1 << 2)
593#define ADVERTISED_100baseT_Full (1 << 3) 674#define ADVERTISED_100baseT_Full (1 << 3)
594#define ADVERTISED_1000baseT_Half (1 << 4) 675#define ADVERTISED_1000baseT_Half (1 << 4)
@@ -627,12 +708,12 @@ struct ethtool_ops {
627#define DUPLEX_FULL 0x01 708#define DUPLEX_FULL 0x01
628 709
629/* Which connector port. */ 710/* Which connector port. */
630#define PORT_TP 0x00 711#define PORT_TP 0x00
631#define PORT_AUI 0x01 712#define PORT_AUI 0x01
632#define PORT_MII 0x02 713#define PORT_MII 0x02
633#define PORT_FIBRE 0x03 714#define PORT_FIBRE 0x03
634#define PORT_BNC 0x04 715#define PORT_BNC 0x04
635#define PORT_DA 0x05 716#define PORT_DA 0x05
636#define PORT_NONE 0xef 717#define PORT_NONE 0xef
637#define PORT_OTHER 0xff 718#define PORT_OTHER 0xff
638 719
@@ -646,7 +727,7 @@ struct ethtool_ops {
646/* Enable or disable autonegotiation. If this is set to enable, 727/* Enable or disable autonegotiation. If this is set to enable,
647 * the forced link modes above are completely ignored. 728 * the forced link modes above are completely ignored.
648 */ 729 */
649#define AUTONEG_DISABLE 0x00 730#define AUTONEG_DISABLE 0x00
650#define AUTONEG_ENABLE 0x01 731#define AUTONEG_ENABLE 0x01
651 732
652/* Mode MDI or MDI-X */ 733/* Mode MDI or MDI-X */
@@ -677,8 +758,8 @@ struct ethtool_ops {
677#define AH_V6_FLOW 0x0b 758#define AH_V6_FLOW 0x0b
678#define ESP_V6_FLOW 0x0c 759#define ESP_V6_FLOW 0x0c
679#define IP_USER_FLOW 0x0d 760#define IP_USER_FLOW 0x0d
680#define IPV4_FLOW 0x10 761#define IPV4_FLOW 0x10
681#define IPV6_FLOW 0x11 762#define IPV6_FLOW 0x11
682 763
683/* L3-L4 network traffic flow hash options */ 764/* L3-L4 network traffic flow hash options */
684#define RXH_L2DA (1 << 1) 765#define RXH_L2DA (1 << 1)
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index dc12f416a49f..a9cd507f8cd2 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -96,6 +96,7 @@ struct fid {
96 * @fh_to_parent: find the implied object's parent and get a dentry for it 96 * @fh_to_parent: find the implied object's parent and get a dentry for it
97 * @get_name: find the name for a given inode in a given directory 97 * @get_name: find the name for a given inode in a given directory
98 * @get_parent: find the parent of a given directory 98 * @get_parent: find the parent of a given directory
99 * @commit_metadata: commit metadata changes to stable storage
99 * 100 *
100 * See Documentation/filesystems/nfs/Exporting for details on how to use 101 * See Documentation/filesystems/nfs/Exporting for details on how to use
101 * this interface correctly. 102 * this interface correctly.
@@ -137,6 +138,9 @@ struct fid {
137 * is also a directory. In the event that it cannot be found, or storage 138 * is also a directory. In the event that it cannot be found, or storage
138 * space cannot be allocated, a %ERR_PTR should be returned. 139 * space cannot be allocated, a %ERR_PTR should be returned.
139 * 140 *
141 * commit_metadata:
142 * @commit_metadata should commit metadata changes to stable storage.
143 *
140 * Locking rules: 144 * Locking rules:
141 * get_parent is called with child->d_inode->i_mutex down 145 * get_parent is called with child->d_inode->i_mutex down
142 * get_name is not (which is possibly inconsistent) 146 * get_name is not (which is possibly inconsistent)
@@ -152,6 +156,7 @@ struct export_operations {
152 int (*get_name)(struct dentry *parent, char *name, 156 int (*get_name)(struct dentry *parent, char *name,
153 struct dentry *child); 157 struct dentry *child);
154 struct dentry * (*get_parent)(struct dentry *child); 158 struct dentry * (*get_parent)(struct dentry *child);
159 int (*commit_metadata)(struct inode *inode);
155}; 160};
156 161
157extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, 162extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index 1cdb66367c98..db4d9f586bb6 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -106,6 +106,15 @@ struct ext2_sb_info {
106 spinlock_t s_rsv_window_lock; 106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root; 107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head; 108 struct ext2_reserve_window_node s_rsv_window_head;
109 /*
110 * s_lock protects against concurrent modifications of s_mount_state,
111 * s_blocks_last, s_overhead_last and the content of superblock's
112 * buffer pointed to by sbi->s_es.
113 *
114 * Note: It is used in ext2_show_options() to provide a consistent view
115 * of the mount options.
116 */
117 spinlock_t s_lock;
109}; 118};
110 119
111static inline spinlock_t * 120static inline spinlock_t *
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 6b049030fbe6..7fc62d4550b2 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -202,14 +202,6 @@ static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
202 return flags & EXT3_OTHER_FLMASK; 202 return flags & EXT3_OTHER_FLMASK;
203} 203}
204 204
205/*
206 * Inode dynamic state flags
207 */
208#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */
209#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */
210#define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */
211#define EXT3_STATE_FLUSH_ON_CLOSE 0x00000008
212
213/* Used to pass group descriptor data when online resize is done */ 205/* Used to pass group descriptor data when online resize is done */
214struct ext3_new_group_input { 206struct ext3_new_group_input {
215 __u32 group; /* Group number for this data */ 207 __u32 group; /* Group number for this data */
@@ -560,6 +552,31 @@ static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
560 (ino >= EXT3_FIRST_INO(sb) && 552 (ino >= EXT3_FIRST_INO(sb) &&
561 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); 553 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
562} 554}
555
556/*
557 * Inode dynamic state flags
558 */
559enum {
560 EXT3_STATE_JDATA, /* journaled data exists */
561 EXT3_STATE_NEW, /* inode is newly created */
562 EXT3_STATE_XATTR, /* has in-inode xattrs */
563 EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */
564};
565
566static inline int ext3_test_inode_state(struct inode *inode, int bit)
567{
568 return test_bit(bit, &EXT3_I(inode)->i_state_flags);
569}
570
571static inline void ext3_set_inode_state(struct inode *inode, int bit)
572{
573 set_bit(bit, &EXT3_I(inode)->i_state_flags);
574}
575
576static inline void ext3_clear_inode_state(struct inode *inode, int bit)
577{
578 clear_bit(bit, &EXT3_I(inode)->i_state_flags);
579}
563#else 580#else
564/* Assume that user mode programs are passing in an ext3fs superblock, not 581/* Assume that user mode programs are passing in an ext3fs superblock, not
565 * a kernel struct super_block. This will allow us to call the feature-test 582 * a kernel struct super_block. This will allow us to call the feature-test
@@ -851,7 +868,7 @@ extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
851extern void ext3_htree_free_dir_info(struct dir_private_info *p); 868extern void ext3_htree_free_dir_info(struct dir_private_info *p);
852 869
853/* fsync.c */ 870/* fsync.c */
854extern int ext3_sync_file (struct file *, struct dentry *, int); 871extern int ext3_sync_file(struct file *, int);
855 872
856/* hash.c */ 873/* hash.c */
857extern int ext3fs_dirhash(const char *name, int len, struct 874extern int ext3fs_dirhash(const char *name, int len, struct
@@ -877,7 +894,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
877 int create); 894 int create);
878 895
879extern struct inode *ext3_iget(struct super_block *, unsigned long); 896extern struct inode *ext3_iget(struct super_block *, unsigned long);
880extern int ext3_write_inode (struct inode *, int); 897extern int ext3_write_inode (struct inode *, struct writeback_control *);
881extern int ext3_setattr (struct dentry *, struct iattr *); 898extern int ext3_setattr (struct dentry *, struct iattr *);
882extern void ext3_delete_inode (struct inode *); 899extern void ext3_delete_inode (struct inode *);
883extern int ext3_sync_inode (handle_t *, struct inode *); 900extern int ext3_sync_inode (handle_t *, struct inode *);
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 93e7428156ba..f42c098aed8d 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -87,7 +87,7 @@ struct ext3_inode_info {
87 * near to their parent directory's inode. 87 * near to their parent directory's inode.
88 */ 88 */
89 __u32 i_block_group; 89 __u32 i_block_group;
90 __u32 i_state; /* Dynamic state flags for ext3 */ 90 unsigned long i_state_flags; /* Dynamic state flags for ext3 */
91 91
92 /* block reservation info */ 92 /* block reservation info */
93 struct ext3_block_alloc_info *i_block_alloc_info; 93 struct ext3_block_alloc_info *i_block_alloc_info;
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index 06ca9b21dad2..7b64ad40e4ce 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -82,9 +82,10 @@ static inline void cleanup_fault_attr_dentries(struct fault_attr *attr)
82#endif /* CONFIG_FAULT_INJECTION */ 82#endif /* CONFIG_FAULT_INJECTION */
83 83
84#ifdef CONFIG_FAILSLAB 84#ifdef CONFIG_FAILSLAB
85extern bool should_failslab(size_t size, gfp_t gfpflags); 85extern bool should_failslab(size_t size, gfp_t gfpflags, unsigned long flags);
86#else 86#else
87static inline bool should_failslab(size_t size, gfp_t gfpflags) 87static inline bool should_failslab(size_t size, gfp_t gfpflags,
88 unsigned long flags)
88{ 89{
89 return false; 90 return false;
90} 91}
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 369767bd873e..e7445df44d6c 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -4,8 +4,6 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/i2c.h> 5#include <linux/i2c.h>
6 6
7struct dentry;
8
9/* Definitions of frame buffers */ 7/* Definitions of frame buffers */
10 8
11#define FB_MAX 32 /* sufficient for now */ 9#define FB_MAX 32 /* sufficient for now */
@@ -37,7 +35,7 @@ struct dentry;
37#define FBIOGET_HWCINFO 0x4616 35#define FBIOGET_HWCINFO 0x4616
38#define FBIOPUT_MODEINFO 0x4617 36#define FBIOPUT_MODEINFO 0x4617
39#define FBIOGET_DISPINFO 0x4618 37#define FBIOGET_DISPINFO 0x4618
40 38#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
41 39
42#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ 40#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
43#define FB_TYPE_PLANES 1 /* Non interleaved planes */ 41#define FB_TYPE_PLANES 1 /* Non interleaved planes */
@@ -403,6 +401,7 @@ struct fb_cursor {
403#include <linux/notifier.h> 401#include <linux/notifier.h>
404#include <linux/list.h> 402#include <linux/list.h>
405#include <linux/backlight.h> 403#include <linux/backlight.h>
404#include <linux/slab.h>
406#include <asm/io.h> 405#include <asm/io.h>
407 406
408struct vm_area_struct; 407struct vm_area_struct;
@@ -543,6 +542,8 @@ struct fb_cursor_user {
543#define FB_EVENT_GET_REQ 0x0D 542#define FB_EVENT_GET_REQ 0x0D
544/* Unbind from the console if possible */ 543/* Unbind from the console if possible */
545#define FB_EVENT_FB_UNBIND 0x0E 544#define FB_EVENT_FB_UNBIND 0x0E
545/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */
546#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
546 547
547struct fb_event { 548struct fb_event {
548 struct fb_info *info; 549 struct fb_info *info;
@@ -785,8 +786,6 @@ struct fb_tile_ops {
785#define FBINFO_MISC_USEREVENT 0x10000 /* event request 786#define FBINFO_MISC_USEREVENT 0x10000 /* event request
786 from userspace */ 787 from userspace */
787#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ 788#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
788#define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware
789 inited framebuffer */
790 789
791/* A driver may set this flag to indicate that it does want a set_par to be 790/* A driver may set this flag to indicate that it does want a set_par to be
792 * called every time when fbcon_switch is executed. The advantage is that with 791 * called every time when fbcon_switch is executed. The advantage is that with
@@ -800,6 +799,8 @@ struct fb_tile_ops {
800 */ 799 */
801#define FBINFO_MISC_ALWAYS_SETPAR 0x40000 800#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
802 801
802/* where the fb is a firmware driver, and can be replaced with a proper one */
803#define FBINFO_MISC_FIRMWARE 0x80000
803/* 804/*
804 * Host and GPU endianness differ. 805 * Host and GPU endianness differ.
805 */ 806 */
@@ -860,10 +861,24 @@ struct fb_info {
860 /* we need the PCI or similiar aperture base/size not 861 /* we need the PCI or similiar aperture base/size not
861 smem_start/size as smem_start may just be an object 862 smem_start/size as smem_start may just be an object
862 allocated inside the aperture so may not actually overlap */ 863 allocated inside the aperture so may not actually overlap */
863 resource_size_t aperture_base; 864 struct apertures_struct {
864 resource_size_t aperture_size; 865 unsigned int count;
866 struct aperture {
867 resource_size_t base;
868 resource_size_t size;
869 } ranges[0];
870 } *apertures;
865}; 871};
866 872
873static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
874 struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
875 + max_num * sizeof(struct aperture), GFP_KERNEL);
876 if (!a)
877 return NULL;
878 a->count = max_num;
879 return a;
880}
881
867#ifdef MODULE 882#ifdef MODULE
868#define FBINFO_DEFAULT FBINFO_MODULE 883#define FBINFO_DEFAULT FBINFO_MODULE
869#else 884#else
@@ -956,6 +971,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
956/* drivers/video/fbmem.c */ 971/* drivers/video/fbmem.c */
957extern int register_framebuffer(struct fb_info *fb_info); 972extern int register_framebuffer(struct fb_info *fb_info);
958extern int unregister_framebuffer(struct fb_info *fb_info); 973extern int unregister_framebuffer(struct fb_info *fb_info);
974extern void remove_conflicting_framebuffers(struct apertures_struct *a,
975 const char *name, bool primary);
959extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 976extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
960extern int fb_show_logo(struct fb_info *fb_info, int rotate); 977extern int fb_show_logo(struct fb_info *fb_info, int rotate);
961extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 978extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
@@ -1000,8 +1017,7 @@ extern void fb_deferred_io_open(struct fb_info *info,
1000 struct inode *inode, 1017 struct inode *inode,
1001 struct file *file); 1018 struct file *file);
1002extern void fb_deferred_io_cleanup(struct fb_info *info); 1019extern void fb_deferred_io_cleanup(struct fb_info *info);
1003extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 1020extern int fb_deferred_io_fsync(struct file *file, int datasync);
1004 int datasync);
1005 1021
1006static inline bool fb_be_math(struct fb_info *info) 1022static inline bool fb_be_math(struct fb_info *info)
1007{ 1023{
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 86037400a6e3..afc00af3229b 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -22,6 +22,12 @@
22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) 22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
23 23
24/* 24/*
25 * Set and get of pipe page size array
26 */
27#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29
30/*
25 * Types of directory notifications that may be requested. 31 * Types of directory notifications that may be requested.
26 */ 32 */
27#define DN_ACCESS 0x00000001 /* File accessed */ 33#define DN_ACCESS 0x00000001 /* File accessed */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index a2ec74bc4812..d147461bc271 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -57,7 +57,15 @@ struct files_struct {
57 struct file * fd_array[NR_OPEN_DEFAULT]; 57 struct file * fd_array[NR_OPEN_DEFAULT];
58}; 58};
59 59
60#define files_fdtable(files) (rcu_dereference((files)->fdt)) 60#define rcu_dereference_check_fdtable(files, fdtfd) \
61 (rcu_dereference_check((fdtfd), \
62 rcu_read_lock_held() || \
63 lockdep_is_held(&(files)->file_lock) || \
64 atomic_read(&(files)->count) == 1 || \
65 rcu_my_thread_group_empty()))
66
67#define files_fdtable(files) \
68 (rcu_dereference_check_fdtable((files), (files)->fdt))
61 69
62struct file_operations; 70struct file_operations;
63struct vfsmount; 71struct vfsmount;
@@ -78,7 +86,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
78 struct fdtable *fdt = files_fdtable(files); 86 struct fdtable *fdt = files_fdtable(files);
79 87
80 if (fd < fdt->max_fds) 88 if (fd < fdt->max_fds)
81 file = rcu_dereference(fdt->fd[fd]); 89 file = rcu_dereference_check_fdtable(files, fdt->fd[fd]);
82 return file; 90 return file;
83} 91}
84 92
diff --git a/include/linux/fec.h b/include/linux/fec.h
new file mode 100644
index 000000000000..5d3523d8dd0c
--- /dev/null
+++ b/include/linux/fec.h
@@ -0,0 +1,21 @@
1/* include/linux/fec.h
2 *
3 * Copyright (c) 2009 Orex Computed Radiography
4 * Baruch Siach <baruch@tkos.co.il>
5 *
6 * Header file for the FEC platform data
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __LINUX_FEC_H__
13#define __LINUX_FEC_H__
14
15#include <linux/phy.h>
16
17struct fec_platform_data {
18 phy_interface_t phy;
19};
20
21#endif
diff --git a/include/linux/file.h b/include/linux/file.h
index 5555508fd517..b1e12970f617 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -11,7 +11,6 @@
11 11
12struct file; 12struct file;
13 13
14extern void __fput(struct file *);
15extern void fput(struct file *); 14extern void fput(struct file *);
16extern void drop_file_write_access(struct file *file); 15extern void drop_file_write_access(struct file *file);
17 16
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 29a0e3db9f43..151f5d703b7e 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -123,7 +123,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
123#define SKF_AD_NLATTR_NEST 16 123#define SKF_AD_NLATTR_NEST 16
124#define SKF_AD_MARK 20 124#define SKF_AD_MARK 20
125#define SKF_AD_QUEUE 24 125#define SKF_AD_QUEUE 24
126#define SKF_AD_MAX 28 126#define SKF_AD_HATYPE 28
127#define SKF_AD_MAX 32
127#define SKF_NET_OFF (-0x100000) 128#define SKF_NET_OFF (-0x100000)
128#define SKF_LL_OFF (-0x200000) 129#define SKF_LL_OFF (-0x200000)
129 130
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 520ecf86cbb3..68f883b30a53 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -1,21 +1,26 @@
1/* 1/*
2 * Char device interface. 2 * Char device interface.
3 * 3 *
4 * Copyright (C) 2005-2006 Kristian Hoegsberg <krh@bitplanet.net> 4 * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * it under the terms of the GNU General Public License as published by 7 * copy of this software and associated documentation files (the "Software"),
8 * the Free Software Foundation; either version 2 of the License, or 8 * to deal in the Software without restriction, including without limitation
9 * (at your option) any later version. 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * This program is distributed in the hope that it will be useful, 11 * Software is furnished to do so, subject to the following conditions:
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * The above copyright notice and this permission notice (including the next
14 * GNU General Public License for more details. 14 * paragraph) shall be included in all copies or substantial portions of the
15 * 15 * Software.
16 * You should have received a copy of the GNU General Public License 16 *
17 * along with this program; if not, write to the Free Software Foundation, 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
19 */ 24 */
20 25
21#ifndef _LINUX_FIREWIRE_CDEV_H 26#ifndef _LINUX_FIREWIRE_CDEV_H
@@ -248,13 +253,20 @@ union fw_cdev_event {
248#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) 253#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
249#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) 254#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
250 255
256/* available since kernel version 2.6.34 */
257#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
258
251/* 259/*
252 * FW_CDEV_VERSION History 260 * FW_CDEV_VERSION History
253 * 1 (2.6.22) - initial version 261 * 1 (2.6.22) - initial version
254 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if 262 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
255 * &fw_cdev_create_iso_context.header_size is 8 or more 263 * &fw_cdev_create_iso_context.header_size is 8 or more
264 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
265 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
266 * dual-buffer or packet-per-buffer depending on hardware
267 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
256 */ 268 */
257#define FW_CDEV_VERSION 2 269#define FW_CDEV_VERSION 3
258 270
259/** 271/**
260 * struct fw_cdev_get_info - General purpose information ioctl 272 * struct fw_cdev_get_info - General purpose information ioctl
@@ -431,7 +443,7 @@ struct fw_cdev_remove_descriptor {
431 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE 443 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE
432 * @header_size: Header size to strip for receive contexts 444 * @header_size: Header size to strip for receive contexts
433 * @channel: Channel to bind to 445 * @channel: Channel to bind to
434 * @speed: Speed to transmit at 446 * @speed: Speed for transmit contexts
435 * @closure: To be returned in &fw_cdev_event_iso_interrupt 447 * @closure: To be returned in &fw_cdev_event_iso_interrupt
436 * @handle: Handle to context, written back by kernel 448 * @handle: Handle to context, written back by kernel
437 * 449 *
@@ -444,6 +456,9 @@ struct fw_cdev_remove_descriptor {
444 * If a context was successfully created, the kernel writes back a handle to the 456 * If a context was successfully created, the kernel writes back a handle to the
445 * context, which must be passed in for subsequent operations on that context. 457 * context, which must be passed in for subsequent operations on that context.
446 * 458 *
459 * For receive contexts, @header_size must be at least 4 and must be a multiple
460 * of 4.
461 *
447 * Note that the effect of a @header_size > 4 depends on 462 * Note that the effect of a @header_size > 4 depends on
448 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. 463 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
449 */ 464 */
@@ -474,10 +489,34 @@ struct fw_cdev_create_iso_context {
474 * 489 *
475 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. 490 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
476 * 491 *
477 * Use the FW_CDEV_ISO_ macros to fill in @control. The sy and tag fields are 492 * Use the FW_CDEV_ISO_ macros to fill in @control.
478 * specified by IEEE 1394a and IEC 61883. 493 *
479 * 494 * For transmit packets, the header length must be a multiple of 4 and specifies
480 * FIXME - finish this documentation 495 * the numbers of bytes in @header that will be prepended to the packet's
496 * payload; these bytes are copied into the kernel and will not be accessed
497 * after the ioctl has returned. The sy and tag fields are copied to the iso
498 * packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
499 * The skip flag specifies that no packet is to be sent in a frame; when using
500 * this, all other fields except the interrupt flag must be zero.
501 *
502 * For receive packets, the header length must be a multiple of the context's
503 * header size; if the header length is larger than the context's header size,
504 * multiple packets are queued for this entry. The sy and tag fields are
505 * ignored. If the sync flag is set, the context drops all packets until
506 * a packet with a matching sy field is received (the sync value to wait for is
507 * specified in the &fw_cdev_start_iso structure). The payload length defines
508 * how many payload bytes can be received for one packet (in addition to payload
509 * quadlets that have been defined as headers and are stripped and returned in
510 * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
511 * additional bytes are dropped. If less bytes are received, the remaining
512 * bytes in this part of the payload buffer will not be written to, not even by
513 * the next packet, i.e., packets received in consecutive frames will not
514 * necessarily be consecutive in memory. If an entry has queued multiple
515 * packets, the payload length is divided equally among them.
516 *
517 * When a packet with the interrupt flag set has been completed, the
518 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
519 * multiple receive packets is completed when its last packet is completed.
481 */ 520 */
482struct fw_cdev_iso_packet { 521struct fw_cdev_iso_packet {
483 __u32 control; 522 __u32 control;
@@ -494,7 +533,7 @@ struct fw_cdev_iso_packet {
494 * Queue a number of isochronous packets for reception or transmission. 533 * Queue a number of isochronous packets for reception or transmission.
495 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, 534 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
496 * which describe how to transmit from or receive into a contiguous region 535 * which describe how to transmit from or receive into a contiguous region
497 * of a mmap()'ed payload buffer. As part of the packet descriptors, 536 * of a mmap()'ed payload buffer. As part of transmit packet descriptors,
498 * a series of headers can be supplied, which will be prepended to the 537 * a series of headers can be supplied, which will be prepended to the
499 * payload during DMA. 538 * payload during DMA.
500 * 539 *
@@ -544,14 +583,18 @@ struct fw_cdev_stop_iso {
544/** 583/**
545 * struct fw_cdev_get_cycle_timer - read cycle timer register 584 * struct fw_cdev_get_cycle_timer - read cycle timer register
546 * @local_time: system time, in microseconds since the Epoch 585 * @local_time: system time, in microseconds since the Epoch
547 * @cycle_timer: isochronous cycle timer, as per OHCI 1.1 clause 5.13 586 * @cycle_timer: Cycle Time register contents
548 * 587 *
549 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer 588 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
550 * and also the system clock. This allows to express the receive time of an 589 * and also the system clock (%CLOCK_REALTIME). This allows to express the
551 * isochronous packet as a system time with microsecond accuracy. 590 * receive time of an isochronous packet as a system time.
552 * 591 *
553 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and 592 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
554 * 12 bits cycleOffset, in host byte order. 593 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
594 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
595 *
596 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
597 * monotonic) @cycle_timer values on certain controllers.
555 */ 598 */
556struct fw_cdev_get_cycle_timer { 599struct fw_cdev_get_cycle_timer {
557 __u64 local_time; 600 __u64 local_time;
@@ -559,6 +602,25 @@ struct fw_cdev_get_cycle_timer {
559}; 602};
560 603
561/** 604/**
605 * struct fw_cdev_get_cycle_timer2 - read cycle timer register
606 * @tv_sec: system time, seconds
607 * @tv_nsec: system time, sub-seconds part in nanoseconds
608 * @clk_id: input parameter, clock from which to get the system time
609 * @cycle_timer: Cycle Time register contents
610 *
611 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
612 * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
613 * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME
614 * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
615 */
616struct fw_cdev_get_cycle_timer2 {
617 __s64 tv_sec;
618 __s32 tv_nsec;
619 __s32 clk_id;
620 __u32 cycle_timer;
621};
622
623/**
562 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth 624 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
563 * @closure: Passed back to userspace in correponding iso resource events 625 * @closure: Passed back to userspace in correponding iso resource events
564 * @channels: Isochronous channels of which one is to be (de)allocated 626 * @channels: Isochronous channels of which one is to be (de)allocated
@@ -590,8 +652,8 @@ struct fw_cdev_get_cycle_timer {
590 * instead of allocated. 652 * instead of allocated.
591 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. 653 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
592 * 654 *
593 * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources 655 * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
594 * for the lifetime of the fd or handle. 656 * for the lifetime of the fd or @handle.
595 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources 657 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
596 * for the duration of a bus generation. 658 * for the duration of a bus generation.
597 * 659 *
diff --git a/include/linux/firewire-constants.h b/include/linux/firewire-constants.h
index b316770a43fd..9b4bb5fbba4b 100644
--- a/include/linux/firewire-constants.h
+++ b/include/linux/firewire-constants.h
@@ -1,3 +1,28 @@
1/*
2 * IEEE 1394 constants.
3 *
4 * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 */
25
1#ifndef _LINUX_FIREWIRE_CONSTANTS_H 26#ifndef _LINUX_FIREWIRE_CONSTANTS_H
2#define _LINUX_FIREWIRE_CONSTANTS_H 27#define _LINUX_FIREWIRE_CONSTANTS_H
3 28
@@ -21,7 +46,7 @@
21#define EXTCODE_WRAP_ADD 0x6 46#define EXTCODE_WRAP_ADD 0x6
22#define EXTCODE_VENDOR_DEPENDENT 0x7 47#define EXTCODE_VENDOR_DEPENDENT 0x7
23 48
24/* Juju specific tcodes */ 49/* Linux firewire-core (Juju) specific tcodes */
25#define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) 50#define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP)
26#define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) 51#define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP)
27#define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) 52#define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD)
@@ -36,7 +61,7 @@
36#define RCODE_TYPE_ERROR 0x6 61#define RCODE_TYPE_ERROR 0x6
37#define RCODE_ADDRESS_ERROR 0x7 62#define RCODE_ADDRESS_ERROR 0x7
38 63
39/* Juju specific rcodes */ 64/* Linux firewire-core (Juju) specific rcodes */
40#define RCODE_SEND_ERROR 0x10 65#define RCODE_SEND_ERROR 0x10
41#define RCODE_CANCELLED 0x11 66#define RCODE_CANCELLED 0x11
42#define RCODE_BUSY 0x12 67#define RCODE_BUSY 0x12
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index a0e67150a729..72e2b8ac2a5a 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -55,22 +55,21 @@
55#define CSR_DESCRIPTOR 0x01 55#define CSR_DESCRIPTOR 0x01
56#define CSR_VENDOR 0x03 56#define CSR_VENDOR 0x03
57#define CSR_HARDWARE_VERSION 0x04 57#define CSR_HARDWARE_VERSION 0x04
58#define CSR_NODE_CAPABILITIES 0x0c
59#define CSR_UNIT 0x11 58#define CSR_UNIT 0x11
60#define CSR_SPECIFIER_ID 0x12 59#define CSR_SPECIFIER_ID 0x12
61#define CSR_VERSION 0x13 60#define CSR_VERSION 0x13
62#define CSR_DEPENDENT_INFO 0x14 61#define CSR_DEPENDENT_INFO 0x14
63#define CSR_MODEL 0x17 62#define CSR_MODEL 0x17
64#define CSR_INSTANCE 0x18
65#define CSR_DIRECTORY_ID 0x20 63#define CSR_DIRECTORY_ID 0x20
66 64
67struct fw_csr_iterator { 65struct fw_csr_iterator {
68 u32 *p; 66 const u32 *p;
69 u32 *end; 67 const u32 *end;
70}; 68};
71 69
72void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p); 70void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p);
73int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); 71int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
72int fw_csr_string(const u32 *directory, int key, char *buf, size_t size);
74 73
75extern struct bus_type fw_bus_type; 74extern struct bus_type fw_bus_type;
76 75
@@ -88,7 +87,6 @@ struct fw_card {
88 int current_tlabel; 87 int current_tlabel;
89 u64 tlabel_mask; 88 u64 tlabel_mask;
90 struct list_head transaction_list; 89 struct list_head transaction_list;
91 struct timer_list flush_timer;
92 unsigned long reset_jiffies; 90 unsigned long reset_jiffies;
93 91
94 unsigned long long guid; 92 unsigned long long guid;
@@ -162,7 +160,7 @@ struct fw_device {
162 struct mutex client_list_mutex; 160 struct mutex client_list_mutex;
163 struct list_head client_list; 161 struct list_head client_list;
164 162
165 u32 *config_rom; 163 const u32 *config_rom;
166 size_t config_rom_length; 164 size_t config_rom_length;
167 int config_rom_retries; 165 int config_rom_retries;
168 unsigned is_local:1; 166 unsigned is_local:1;
@@ -204,7 +202,7 @@ int fw_device_enable_phys_dma(struct fw_device *device);
204 */ 202 */
205struct fw_unit { 203struct fw_unit {
206 struct device device; 204 struct device device;
207 u32 *directory; 205 const u32 *directory;
208 struct fw_attribute_group attribute_group; 206 struct fw_attribute_group attribute_group;
209}; 207};
210 208
@@ -289,6 +287,8 @@ struct fw_transaction {
289 int tlabel; 287 int tlabel;
290 int timestamp; 288 int timestamp;
291 struct list_head link; 289 struct list_head link;
290 struct fw_card *card;
291 struct timer_list split_timeout_timer;
292 292
293 struct fw_packet packet; 293 struct fw_packet packet;
294 294
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index 875451f1373a..c6dcc1dfe781 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -24,17 +24,17 @@
24 */ 24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP 25#ifdef CONFIG_FIRMWARE_MEMMAP
26 26
27int firmware_map_add(u64 start, u64 end, const char *type);
28int firmware_map_add_early(u64 start, u64 end, const char *type); 27int firmware_map_add_early(u64 start, u64 end, const char *type);
28int firmware_map_add_hotplug(u64 start, u64 end, const char *type);
29 29
30#else /* CONFIG_FIRMWARE_MEMMAP */ 30#else /* CONFIG_FIRMWARE_MEMMAP */
31 31
32static inline int firmware_map_add(u64 start, u64 end, const char *type) 32static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
33{ 33{
34 return 0; 34 return 0;
35} 35}
36 36
37static inline int firmware_map_add_early(u64 start, u64 end, const char *type) 37static inline int firmware_map_add_hotplug(u64 start, u64 end, const char *type)
38{ 38{
39 return 0; 39 return 0;
40} 40}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 043811f0d277..53d1e6c4f848 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -12,6 +12,7 @@
12struct firmware { 12struct firmware {
13 size_t size; 13 size_t size;
14 const u8 *data; 14 const u8 *data;
15 struct page **pages;
15}; 16};
16 17
17struct device; 18struct device;
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 5a361f85cfec..da7e52b099f3 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -64,9 +64,12 @@ extern bool freeze_task(struct task_struct *p, bool sig_only);
64extern void cancel_freezing(struct task_struct *p); 64extern void cancel_freezing(struct task_struct *p);
65 65
66#ifdef CONFIG_CGROUP_FREEZER 66#ifdef CONFIG_CGROUP_FREEZER
67extern int cgroup_frozen(struct task_struct *task); 67extern int cgroup_freezing_or_frozen(struct task_struct *task);
68#else /* !CONFIG_CGROUP_FREEZER */ 68#else /* !CONFIG_CGROUP_FREEZER */
69static inline int cgroup_frozen(struct task_struct *task) { return 0; } 69static inline int cgroup_freezing_or_frozen(struct task_struct *task)
70{
71 return 0;
72}
70#endif /* !CONFIG_CGROUP_FREEZER */ 73#endif /* !CONFIG_CGROUP_FREEZER */
71 74
72/* 75/*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b1bcb275b596..68ca1b0491af 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -60,24 +60,24 @@ struct inodes_stat_t {
60 */ 60 */
61 61
62/* file is open for reading */ 62/* file is open for reading */
63#define FMODE_READ ((__force fmode_t)1) 63#define FMODE_READ ((__force fmode_t)0x1)
64/* file is open for writing */ 64/* file is open for writing */
65#define FMODE_WRITE ((__force fmode_t)2) 65#define FMODE_WRITE ((__force fmode_t)0x2)
66/* file is seekable */ 66/* file is seekable */
67#define FMODE_LSEEK ((__force fmode_t)4) 67#define FMODE_LSEEK ((__force fmode_t)0x4)
68/* file can be accessed using pread */ 68/* file can be accessed using pread */
69#define FMODE_PREAD ((__force fmode_t)8) 69#define FMODE_PREAD ((__force fmode_t)0x8)
70/* file can be accessed using pwrite */ 70/* file can be accessed using pwrite */
71#define FMODE_PWRITE ((__force fmode_t)16) 71#define FMODE_PWRITE ((__force fmode_t)0x10)
72/* File is opened for execution with sys_execve / sys_uselib */ 72/* File is opened for execution with sys_execve / sys_uselib */
73#define FMODE_EXEC ((__force fmode_t)32) 73#define FMODE_EXEC ((__force fmode_t)0x20)
74/* File is opened with O_NDELAY (only set for block devices) */ 74/* File is opened with O_NDELAY (only set for block devices) */
75#define FMODE_NDELAY ((__force fmode_t)64) 75#define FMODE_NDELAY ((__force fmode_t)0x40)
76/* File is opened with O_EXCL (only set for block devices) */ 76/* File is opened with O_EXCL (only set for block devices) */
77#define FMODE_EXCL ((__force fmode_t)128) 77#define FMODE_EXCL ((__force fmode_t)0x80)
78/* File is opened using open(.., 3, ..) and is writeable only for ioctls 78/* File is opened using open(.., 3, ..) and is writeable only for ioctls
79 (specialy hack for floppy.c) */ 79 (specialy hack for floppy.c) */
80#define FMODE_WRITE_IOCTL ((__force fmode_t)256) 80#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100)
81 81
82/* 82/*
83 * Don't update ctime and mtime. 83 * Don't update ctime and mtime.
@@ -85,7 +85,10 @@ struct inodes_stat_t {
85 * Currently a special hack for the XFS open_by_handle ioctl, but we'll 85 * Currently a special hack for the XFS open_by_handle ioctl, but we'll
86 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon. 86 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
87 */ 87 */
88#define FMODE_NOCMTIME ((__force fmode_t)2048) 88#define FMODE_NOCMTIME ((__force fmode_t)0x800)
89
90/* Expect random access pattern */
91#define FMODE_RANDOM ((__force fmode_t)0x1000)
89 92
90/* 93/*
91 * The below are the various read and write types that we support. Some of 94 * The below are the various read and write types that we support. Some of
@@ -648,6 +651,7 @@ struct block_device {
648 int bd_openers; 651 int bd_openers;
649 struct mutex bd_mutex; /* open/close mutex */ 652 struct mutex bd_mutex; /* open/close mutex */
650 struct list_head bd_inodes; 653 struct list_head bd_inodes;
654 void * bd_claiming;
651 void * bd_holder; 655 void * bd_holder;
652 int bd_holders; 656 int bd_holders;
653#ifdef CONFIG_SYSFS 657#ifdef CONFIG_SYSFS
@@ -729,6 +733,7 @@ struct inode {
729 uid_t i_uid; 733 uid_t i_uid;
730 gid_t i_gid; 734 gid_t i_gid;
731 dev_t i_rdev; 735 dev_t i_rdev;
736 unsigned int i_blkbits;
732 u64 i_version; 737 u64 i_version;
733 loff_t i_size; 738 loff_t i_size;
734#ifdef __NEED_I_SIZE_ORDERED 739#ifdef __NEED_I_SIZE_ORDERED
@@ -738,7 +743,6 @@ struct inode {
738 struct timespec i_mtime; 743 struct timespec i_mtime;
739 struct timespec i_ctime; 744 struct timespec i_ctime;
740 blkcnt_t i_blocks; 745 blkcnt_t i_blocks;
741 unsigned int i_blkbits;
742 unsigned short i_bytes; 746 unsigned short i_bytes;
743 umode_t i_mode; 747 umode_t i_mode;
744 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 748 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
@@ -950,6 +954,7 @@ extern spinlock_t files_lock;
950#define file_list_unlock() spin_unlock(&files_lock); 954#define file_list_unlock() spin_unlock(&files_lock);
951 955
952#define get_file(x) atomic_long_inc(&(x)->f_count) 956#define get_file(x) atomic_long_inc(&(x)->f_count)
957#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
953#define file_count(x) atomic_long_read(&(x)->f_count) 958#define file_count(x) atomic_long_read(&(x)->f_count)
954 959
955#ifdef CONFIG_DEBUG_WRITECOUNT 960#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1277,10 +1282,12 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1277 1282
1278 1283
1279struct fasync_struct { 1284struct fasync_struct {
1280 int magic; 1285 spinlock_t fa_lock;
1281 int fa_fd; 1286 int magic;
1282 struct fasync_struct *fa_next; /* singly linked list */ 1287 int fa_fd;
1283 struct file *fa_file; 1288 struct fasync_struct *fa_next; /* singly linked list */
1289 struct file *fa_file;
1290 struct rcu_head fa_rcu;
1284}; 1291};
1285 1292
1286#define FASYNC_MAGIC 0x4601 1293#define FASYNC_MAGIC 0x4601
@@ -1289,8 +1296,6 @@ struct fasync_struct {
1289extern int fasync_helper(int, struct file *, int, struct fasync_struct **); 1296extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1290/* can be called from interrupts */ 1297/* can be called from interrupts */
1291extern void kill_fasync(struct fasync_struct **, int, int); 1298extern void kill_fasync(struct fasync_struct **, int, int);
1292/* only for net: no internal synchronization */
1293extern void __kill_fasync(struct fasync_struct *, int, int);
1294 1299
1295extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1300extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1296extern int f_setown(struct file *filp, unsigned long arg, int force); 1301extern int f_setown(struct file *filp, unsigned long arg, int force);
@@ -1305,18 +1310,18 @@ extern int send_sigurg(struct fown_struct *fown);
1305#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ 1310#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
1306#define MNT_DETACH 0x00000002 /* Just detach from the tree */ 1311#define MNT_DETACH 0x00000002 /* Just detach from the tree */
1307#define MNT_EXPIRE 0x00000004 /* Mark for expiry */ 1312#define MNT_EXPIRE 0x00000004 /* Mark for expiry */
1313#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */
1314#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */
1308 1315
1309extern struct list_head super_blocks; 1316extern struct list_head super_blocks;
1310extern spinlock_t sb_lock; 1317extern spinlock_t sb_lock;
1311 1318
1312#define sb_entry(list) list_entry((list), struct super_block, s_list)
1313#define S_BIAS (1<<30)
1314struct super_block { 1319struct super_block {
1315 struct list_head s_list; /* Keep this first */ 1320 struct list_head s_list; /* Keep this first */
1316 dev_t s_dev; /* search index; _not_ kdev_t */ 1321 dev_t s_dev; /* search index; _not_ kdev_t */
1317 unsigned long s_blocksize;
1318 unsigned char s_blocksize_bits;
1319 unsigned char s_dirt; 1322 unsigned char s_dirt;
1323 unsigned char s_blocksize_bits;
1324 unsigned long s_blocksize;
1320 loff_t s_maxbytes; /* Max file size */ 1325 loff_t s_maxbytes; /* Max file size */
1321 struct file_system_type *s_type; 1326 struct file_system_type *s_type;
1322 const struct super_operations *s_op; 1327 const struct super_operations *s_op;
@@ -1329,12 +1334,11 @@ struct super_block {
1329 struct rw_semaphore s_umount; 1334 struct rw_semaphore s_umount;
1330 struct mutex s_lock; 1335 struct mutex s_lock;
1331 int s_count; 1336 int s_count;
1332 int s_need_sync;
1333 atomic_t s_active; 1337 atomic_t s_active;
1334#ifdef CONFIG_SECURITY 1338#ifdef CONFIG_SECURITY
1335 void *s_security; 1339 void *s_security;
1336#endif 1340#endif
1337 struct xattr_handler **s_xattr; 1341 const struct xattr_handler **s_xattr;
1338 1342
1339 struct list_head s_inodes; /* all inodes */ 1343 struct list_head s_inodes; /* all inodes */
1340 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1344 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
@@ -1357,16 +1361,16 @@ struct super_block {
1357 void *s_fs_info; /* Filesystem private info */ 1361 void *s_fs_info; /* Filesystem private info */
1358 fmode_t s_mode; 1362 fmode_t s_mode;
1359 1363
1364 /* Granularity of c/m/atime in ns.
1365 Cannot be worse than a second */
1366 u32 s_time_gran;
1367
1360 /* 1368 /*
1361 * The next field is for VFS *only*. No filesystems have any business 1369 * The next field is for VFS *only*. No filesystems have any business
1362 * even looking at it. You had been warned. 1370 * even looking at it. You had been warned.
1363 */ 1371 */
1364 struct mutex s_vfs_rename_mutex; /* Kludge */ 1372 struct mutex s_vfs_rename_mutex; /* Kludge */
1365 1373
1366 /* Granularity of c/m/atime in ns.
1367 Cannot be worse than a second */
1368 u32 s_time_gran;
1369
1370 /* 1374 /*
1371 * Filesystem subtype. If non-empty the filesystem type field 1375 * Filesystem subtype. If non-empty the filesystem type field
1372 * in /proc/mounts will be "type.subtype" 1376 * in /proc/mounts will be "type.subtype"
@@ -1426,7 +1430,8 @@ extern void dentry_unhash(struct dentry *dentry);
1426 * VFS file helper functions. 1430 * VFS file helper functions.
1427 */ 1431 */
1428extern int file_permission(struct file *, int); 1432extern int file_permission(struct file *, int);
1429 1433extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1434 mode_t mode);
1430/* 1435/*
1431 * VFS FS_IOC_FIEMAP helper definitions. 1436 * VFS FS_IOC_FIEMAP helper definitions.
1432 */ 1437 */
@@ -1493,7 +1498,7 @@ struct file_operations {
1493 int (*open) (struct inode *, struct file *); 1498 int (*open) (struct inode *, struct file *);
1494 int (*flush) (struct file *, fl_owner_t id); 1499 int (*flush) (struct file *, fl_owner_t id);
1495 int (*release) (struct inode *, struct file *); 1500 int (*release) (struct inode *, struct file *);
1496 int (*fsync) (struct file *, struct dentry *, int datasync); 1501 int (*fsync) (struct file *, int datasync);
1497 int (*aio_fsync) (struct kiocb *, int datasync); 1502 int (*aio_fsync) (struct kiocb *, int datasync);
1498 int (*fasync) (int, struct file *, int); 1503 int (*fasync) (int, struct file *, int);
1499 int (*lock) (struct file *, int, struct file_lock *); 1504 int (*lock) (struct file *, int, struct file_lock *);
@@ -1555,7 +1560,7 @@ struct super_operations {
1555 void (*destroy_inode)(struct inode *); 1560 void (*destroy_inode)(struct inode *);
1556 1561
1557 void (*dirty_inode) (struct inode *); 1562 void (*dirty_inode) (struct inode *);
1558 int (*write_inode) (struct inode *, int); 1563 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1559 void (*drop_inode) (struct inode *); 1564 void (*drop_inode) (struct inode *);
1560 void (*delete_inode) (struct inode *); 1565 void (*delete_inode) (struct inode *);
1561 void (*put_super) (struct super_block *); 1566 void (*put_super) (struct super_block *);
@@ -1739,6 +1744,7 @@ struct file_system_type {
1739 1744
1740 struct lock_class_key s_lock_key; 1745 struct lock_class_key s_lock_key;
1741 struct lock_class_key s_umount_key; 1746 struct lock_class_key s_umount_key;
1747 struct lock_class_key s_vfs_rename_key;
1742 1748
1743 struct lock_class_key i_lock_key; 1749 struct lock_class_key i_lock_key;
1744 struct lock_class_key i_mutex_key; 1750 struct lock_class_key i_mutex_key;
@@ -1776,8 +1782,19 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1776 const struct super_operations *ops, unsigned long, 1782 const struct super_operations *ops, unsigned long,
1777 struct vfsmount *mnt); 1783 struct vfsmount *mnt);
1778extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1784extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1779int __put_super_and_need_restart(struct super_block *sb); 1785
1780void put_super(struct super_block *sb); 1786static inline void sb_mark_dirty(struct super_block *sb)
1787{
1788 sb->s_dirt = 1;
1789}
1790static inline void sb_mark_clean(struct super_block *sb)
1791{
1792 sb->s_dirt = 0;
1793}
1794static inline int sb_is_dirty(struct super_block *sb)
1795{
1796 return sb->s_dirt;
1797}
1781 1798
1782/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1799/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1783#define fops_get(fops) \ 1800#define fops_get(fops) \
@@ -1794,8 +1811,11 @@ extern int may_umount(struct vfsmount *);
1794extern long do_mount(char *, char *, char *, unsigned long, void *); 1811extern long do_mount(char *, char *, char *, unsigned long, void *);
1795extern struct vfsmount *collect_mounts(struct path *); 1812extern struct vfsmount *collect_mounts(struct path *);
1796extern void drop_collected_mounts(struct vfsmount *); 1813extern void drop_collected_mounts(struct vfsmount *);
1797 1814extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1815 struct vfsmount *);
1798extern int vfs_statfs(struct dentry *, struct kstatfs *); 1816extern int vfs_statfs(struct dentry *, struct kstatfs *);
1817extern int freeze_super(struct super_block *super);
1818extern int thaw_super(struct super_block *super);
1799 1819
1800extern int current_umask(void); 1820extern int current_umask(void);
1801 1821
@@ -2058,12 +2078,6 @@ extern int invalidate_inodes(struct super_block *);
2058unsigned long invalidate_mapping_pages(struct address_space *mapping, 2078unsigned long invalidate_mapping_pages(struct address_space *mapping,
2059 pgoff_t start, pgoff_t end); 2079 pgoff_t start, pgoff_t end);
2060 2080
2061static inline unsigned long __deprecated
2062invalidate_inode_pages(struct address_space *mapping)
2063{
2064 return invalidate_mapping_pages(mapping, 0, ~0UL);
2065}
2066
2067static inline void invalidate_remote_inode(struct inode *inode) 2081static inline void invalidate_remote_inode(struct inode *inode)
2068{ 2082{
2069 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 2083 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
@@ -2087,9 +2101,9 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2087extern int filemap_fdatawrite_range(struct address_space *mapping, 2101extern int filemap_fdatawrite_range(struct address_space *mapping,
2088 loff_t start, loff_t end); 2102 loff_t start, loff_t end);
2089 2103
2090extern int vfs_fsync_range(struct file *file, struct dentry *dentry, 2104extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2091 loff_t start, loff_t end, int datasync); 2105 int datasync);
2092extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2106extern int vfs_fsync(struct file *file, int datasync);
2093extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2107extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2094extern void sync_supers(void); 2108extern void sync_supers(void);
2095extern void emergency_sync(void); 2109extern void emergency_sync(void);
@@ -2132,6 +2146,7 @@ extern struct file * open_exec(const char *);
2132 2146
2133/* fs/dcache.c -- generic fs support functions */ 2147/* fs/dcache.c -- generic fs support functions */
2134extern int is_subdir(struct dentry *, struct dentry *); 2148extern int is_subdir(struct dentry *, struct dentry *);
2149extern int path_is_under(struct path *, struct path *);
2135extern ino_t find_inode_number(struct dentry *, struct qstr *); 2150extern ino_t find_inode_number(struct dentry *, struct qstr *);
2136 2151
2137#include <linux/err.h> 2152#include <linux/err.h>
@@ -2211,6 +2226,7 @@ extern int generic_segment_checks(const struct iovec *iov,
2211/* fs/block_dev.c */ 2226/* fs/block_dev.c */
2212extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2227extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2213 unsigned long nr_segs, loff_t pos); 2228 unsigned long nr_segs, loff_t pos);
2229extern int blkdev_fsync(struct file *filp, int datasync);
2214 2230
2215/* fs/splice.c */ 2231/* fs/splice.c */
2216extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2232extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2226,6 +2242,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2226 2242
2227extern void 2243extern void
2228file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2244file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2245extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
2229extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 2246extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2230extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 2247extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
2231extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, 2248extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
@@ -2248,10 +2265,19 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2248#endif 2265#endif
2249 2266
2250#ifdef CONFIG_BLOCK 2267#ifdef CONFIG_BLOCK
2268struct bio;
2269typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2270 loff_t file_offset);
2271void dio_end_io(struct bio *bio, int error);
2272
2273ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2274 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2275 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2276 dio_submit_t submit_io, int lock_type);
2251ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2277ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2252 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2278 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2253 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 2279 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2254 int lock_type); 2280 dio_submit_t submit_io, int lock_type);
2255 2281
2256enum { 2282enum {
2257 /* need locking between buffered and direct access */ 2283 /* need locking between buffered and direct access */
@@ -2261,13 +2287,31 @@ enum {
2261 DIO_SKIP_HOLES = 0x02, 2287 DIO_SKIP_HOLES = 0x02,
2262}; 2288};
2263 2289
2290static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb,
2291 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2292 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2293 dio_iodone_t end_io)
2294{
2295 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2296 nr_segs, get_block, end_io, NULL,
2297 DIO_LOCKING | DIO_SKIP_HOLES);
2298}
2299
2300static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2301 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2302 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2303 dio_iodone_t end_io)
2304{
2305 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2306 nr_segs, get_block, end_io, NULL, 0);
2307}
2264static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2308static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2265 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2309 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2266 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2310 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2267 dio_iodone_t end_io) 2311 dio_iodone_t end_io)
2268{ 2312{
2269 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2313 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2270 nr_segs, get_block, end_io, 2314 nr_segs, get_block, end_io, NULL,
2271 DIO_LOCKING | DIO_SKIP_HOLES); 2315 DIO_LOCKING | DIO_SKIP_HOLES);
2272} 2316}
2273 2317
@@ -2277,7 +2321,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2277 dio_iodone_t end_io) 2321 dio_iodone_t end_io)
2278{ 2322{
2279 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2323 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2280 nr_segs, get_block, end_io, 0); 2324 nr_segs, get_block, end_io, NULL, 0);
2281} 2325}
2282#endif 2326#endif
2283 2327
@@ -2313,8 +2357,9 @@ extern int vfs_fstatat(int , char __user *, struct kstat *, int);
2313extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2357extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2314 unsigned long arg); 2358 unsigned long arg);
2315extern int __generic_block_fiemap(struct inode *inode, 2359extern int __generic_block_fiemap(struct inode *inode,
2316 struct fiemap_extent_info *fieinfo, u64 start, 2360 struct fiemap_extent_info *fieinfo,
2317 u64 len, get_block_t *get_block); 2361 loff_t start, loff_t len,
2362 get_block_t *get_block);
2318extern int generic_block_fiemap(struct inode *inode, 2363extern int generic_block_fiemap(struct inode *inode,
2319 struct fiemap_extent_info *fieinfo, u64 start, 2364 struct fiemap_extent_info *fieinfo, u64 start,
2320 u64 len, get_block_t *get_block); 2365 u64 len, get_block_t *get_block);
@@ -2326,22 +2371,23 @@ extern struct super_block *get_super(struct block_device *);
2326extern struct super_block *get_active_super(struct block_device *bdev); 2371extern struct super_block *get_active_super(struct block_device *bdev);
2327extern struct super_block *user_get_super(dev_t); 2372extern struct super_block *user_get_super(dev_t);
2328extern void drop_super(struct super_block *sb); 2373extern void drop_super(struct super_block *sb);
2374extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2329 2375
2330extern int dcache_dir_open(struct inode *, struct file *); 2376extern int dcache_dir_open(struct inode *, struct file *);
2331extern int dcache_dir_close(struct inode *, struct file *); 2377extern int dcache_dir_close(struct inode *, struct file *);
2332extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2378extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2333extern int dcache_readdir(struct file *, void *, filldir_t); 2379extern int dcache_readdir(struct file *, void *, filldir_t);
2380extern int simple_setattr(struct dentry *, struct iattr *);
2334extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2381extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2335extern int simple_statfs(struct dentry *, struct kstatfs *); 2382extern int simple_statfs(struct dentry *, struct kstatfs *);
2336extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2383extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2337extern int simple_unlink(struct inode *, struct dentry *); 2384extern int simple_unlink(struct inode *, struct dentry *);
2338extern int simple_rmdir(struct inode *, struct dentry *); 2385extern int simple_rmdir(struct inode *, struct dentry *);
2339extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2386extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2340extern int simple_sync_file(struct file *, struct dentry *, int); 2387extern int simple_setsize(struct inode *, loff_t);
2388extern int noop_fsync(struct file *, int);
2341extern int simple_empty(struct dentry *); 2389extern int simple_empty(struct dentry *);
2342extern int simple_readpage(struct file *file, struct page *page); 2390extern int simple_readpage(struct file *file, struct page *page);
2343extern int simple_prepare_write(struct file *file, struct page *page,
2344 unsigned offset, unsigned to);
2345extern int simple_write_begin(struct file *file, struct address_space *mapping, 2391extern int simple_write_begin(struct file *file, struct address_space *mapping,
2346 loff_t pos, unsigned len, unsigned flags, 2392 loff_t pos, unsigned len, unsigned flags,
2347 struct page **pagep, void **fsdata); 2393 struct page **pagep, void **fsdata);
@@ -2355,14 +2401,16 @@ extern const struct file_operations simple_dir_operations;
2355extern const struct inode_operations simple_dir_inode_operations; 2401extern const struct inode_operations simple_dir_inode_operations;
2356struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 2402struct tree_descr { char *name; const struct file_operations *ops; int mode; };
2357struct dentry *d_alloc_name(struct dentry *, const char *); 2403struct dentry *d_alloc_name(struct dentry *, const char *);
2358extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 2404extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *);
2359extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); 2405extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
2360extern void simple_release_fs(struct vfsmount **mount, int *count); 2406extern void simple_release_fs(struct vfsmount **mount, int *count);
2361 2407
2362extern ssize_t simple_read_from_buffer(void __user *to, size_t count, 2408extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2363 loff_t *ppos, const void *from, size_t available); 2409 loff_t *ppos, const void *from, size_t available);
2410extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2411 const void __user *from, size_t count);
2364 2412
2365extern int simple_fsync(struct file *, struct dentry *, int); 2413extern int generic_file_fsync(struct file *, int);
2366 2414
2367#ifdef CONFIG_MIGRATION 2415#ifdef CONFIG_MIGRATION
2368extern int buffer_migrate_page(struct address_space *, 2416extern int buffer_migrate_page(struct address_space *,
@@ -2373,7 +2421,8 @@ extern int buffer_migrate_page(struct address_space *,
2373 2421
2374extern int inode_change_ok(const struct inode *, struct iattr *); 2422extern int inode_change_ok(const struct inode *, struct iattr *);
2375extern int inode_newsize_ok(const struct inode *, loff_t offset); 2423extern int inode_newsize_ok(const struct inode *, loff_t offset);
2376extern int __must_check inode_setattr(struct inode *, struct iattr *); 2424extern int __must_check inode_setattr(struct inode *, const struct iattr *);
2425extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2377 2426
2378extern void file_update_time(struct file *file); 2427extern void file_update_time(struct file *file);
2379 2428
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 7be0c6fbe880..c57db27ac861 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -105,7 +105,7 @@ struct fscache_operation {
105 /* operation releaser */ 105 /* operation releaser */
106 fscache_operation_release_t release; 106 fscache_operation_release_t release;
107 107
108#ifdef CONFIG_SLOW_WORK_PROC 108#ifdef CONFIG_SLOW_WORK_DEBUG
109 const char *name; /* operation name */ 109 const char *name; /* operation name */
110 const char *state; /* operation state */ 110 const char *state; /* operation state */
111#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) 111#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0)
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 936f9aa8bb97..01755909ce81 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -15,6 +15,7 @@
15#include <linux/inotify.h> 15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h> 16#include <linux/fsnotify_backend.h>
17#include <linux/audit.h> 17#include <linux/audit.h>
18#include <linux/slab.h>
18 19
19/* 20/*
20 * fsnotify_d_instantiate - instantiate a dentry for inode 21 * fsnotify_d_instantiate - instantiate a dentry for inode
@@ -65,7 +66,7 @@ static inline void fsnotify_link_count(struct inode *inode)
65 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 66 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
66 */ 67 */
67static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 68static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
68 const char *old_name, const char *new_name, 69 const char *old_name,
69 int isdir, struct inode *target, struct dentry *moved) 70 int isdir, struct inode *target, struct dentry *moved)
70{ 71{
71 struct inode *source = moved->d_inode; 72 struct inode *source = moved->d_inode;
@@ -73,6 +74,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
73 u32 fs_cookie = fsnotify_get_cookie(); 74 u32 fs_cookie = fsnotify_get_cookie();
74 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); 75 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
75 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); 76 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
77 const char *new_name = moved->d_name.name;
76 78
77 if (old_dir == new_dir) 79 if (old_dir == new_dir)
78 old_dir_mask |= FS_DN_RENAME; 80 old_dir_mask |= FS_DN_RENAME;
@@ -103,7 +105,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
103 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); 105 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
104 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
105 } 107 }
106 audit_inode_child(new_name, moved, new_dir); 108 audit_inode_child(moved, new_dir);
107} 109}
108 110
109/* 111/*
@@ -146,7 +148,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
146{ 148{
147 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 149 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
148 dentry->d_inode); 150 dentry->d_inode);
149 audit_inode_child(dentry->d_name.name, dentry, inode); 151 audit_inode_child(dentry, inode);
150 152
151 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 153 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
152} 154}
@@ -161,7 +163,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
161 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, 163 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
162 inode); 164 inode);
163 fsnotify_link_count(inode); 165 fsnotify_link_count(inode);
164 audit_inode_child(new_dentry->d_name.name, new_dentry, dir); 166 audit_inode_child(new_dentry, dir);
165 167
166 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); 168 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0);
167} 169}
@@ -175,7 +177,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
175 struct inode *d_inode = dentry->d_inode; 177 struct inode *d_inode = dentry->d_inode;
176 178
177 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode); 179 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
178 audit_inode_child(dentry->d_name.name, dentry, inode); 180 audit_inode_child(dentry, inode);
179 181
180 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
181} 183}
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 0b4f97d24d7f..41e46330d9be 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -82,9 +82,13 @@ void clear_ftrace_function(void);
82extern void ftrace_stub(unsigned long a0, unsigned long a1); 82extern void ftrace_stub(unsigned long a0, unsigned long a1);
83 83
84#else /* !CONFIG_FUNCTION_TRACER */ 84#else /* !CONFIG_FUNCTION_TRACER */
85# define register_ftrace_function(ops) do { } while (0) 85/*
86# define unregister_ftrace_function(ops) do { } while (0) 86 * (un)register_ftrace_function must be a macro since the ops parameter
87# define clear_ftrace_function(ops) do { } while (0) 87 * must not be evaluated.
88 */
89#define register_ftrace_function(ops) ({ 0; })
90#define unregister_ftrace_function(ops) ({ 0; })
91static inline void clear_ftrace_function(void) { }
88static inline void ftrace_kill(void) { } 92static inline void ftrace_kill(void) { }
89static inline void ftrace_stop(void) { } 93static inline void ftrace_stop(void) { }
90static inline void ftrace_start(void) { } 94static inline void ftrace_start(void) { }
@@ -134,6 +138,8 @@ extern void
134unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); 138unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
135extern void unregister_ftrace_function_probe_all(char *glob); 139extern void unregister_ftrace_function_probe_all(char *glob);
136 140
141extern int ftrace_text_reserved(void *start, void *end);
142
137enum { 143enum {
138 FTRACE_FL_FREE = (1 << 0), 144 FTRACE_FL_FREE = (1 << 0),
139 FTRACE_FL_FAILED = (1 << 1), 145 FTRACE_FL_FAILED = (1 << 1),
@@ -141,7 +147,6 @@ enum {
141 FTRACE_FL_ENABLED = (1 << 3), 147 FTRACE_FL_ENABLED = (1 << 3),
142 FTRACE_FL_NOTRACE = (1 << 4), 148 FTRACE_FL_NOTRACE = (1 << 4),
143 FTRACE_FL_CONVERTED = (1 << 5), 149 FTRACE_FL_CONVERTED = (1 << 5),
144 FTRACE_FL_FROZEN = (1 << 6),
145}; 150};
146 151
147struct dyn_ftrace { 152struct dyn_ftrace {
@@ -236,11 +241,13 @@ extern int skip_trace(unsigned long ip);
236extern void ftrace_disable_daemon(void); 241extern void ftrace_disable_daemon(void);
237extern void ftrace_enable_daemon(void); 242extern void ftrace_enable_daemon(void);
238#else 243#else
239# define skip_trace(ip) ({ 0; }) 244static inline int skip_trace(unsigned long ip) { return 0; }
240# define ftrace_force_update() ({ 0; }) 245static inline int ftrace_force_update(void) { return 0; }
241# define ftrace_set_filter(buf, len, reset) do { } while (0) 246static inline void ftrace_set_filter(unsigned char *buf, int len, int reset)
242# define ftrace_disable_daemon() do { } while (0) 247{
243# define ftrace_enable_daemon() do { } while (0) 248}
249static inline void ftrace_disable_daemon(void) { }
250static inline void ftrace_enable_daemon(void) { }
244static inline void ftrace_release_mod(struct module *mod) {} 251static inline void ftrace_release_mod(struct module *mod) {}
245static inline int register_ftrace_command(struct ftrace_func_command *cmd) 252static inline int register_ftrace_command(struct ftrace_func_command *cmd)
246{ 253{
@@ -250,6 +257,10 @@ static inline int unregister_ftrace_command(char *cmd_name)
250{ 257{
251 return -EINVAL; 258 return -EINVAL;
252} 259}
260static inline int ftrace_text_reserved(void *start, void *end)
261{
262 return 0;
263}
253#endif /* CONFIG_DYNAMIC_FTRACE */ 264#endif /* CONFIG_DYNAMIC_FTRACE */
254 265
255/* totally disable ftrace - can not re-enable after this */ 266/* totally disable ftrace - can not re-enable after this */
@@ -309,16 +320,16 @@ static inline void __ftrace_enabled_restore(int enabled)
309 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 320 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
310 extern void time_hardirqs_off(unsigned long a0, unsigned long a1); 321 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
311#else 322#else
312# define time_hardirqs_on(a0, a1) do { } while (0) 323 static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { }
313# define time_hardirqs_off(a0, a1) do { } while (0) 324 static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { }
314#endif 325#endif
315 326
316#ifdef CONFIG_PREEMPT_TRACER 327#ifdef CONFIG_PREEMPT_TRACER
317 extern void trace_preempt_on(unsigned long a0, unsigned long a1); 328 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
318 extern void trace_preempt_off(unsigned long a0, unsigned long a1); 329 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
319#else 330#else
320# define trace_preempt_on(a0, a1) do { } while (0) 331 static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { }
321# define trace_preempt_off(a0, a1) do { } while (0) 332 static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { }
322#endif 333#endif
323 334
324#ifdef CONFIG_FTRACE_MCOUNT_RECORD 335#ifdef CONFIG_FTRACE_MCOUNT_RECORD
@@ -347,6 +358,10 @@ struct ftrace_graph_ret {
347 int depth; 358 int depth;
348}; 359};
349 360
361/* Type of the callback handlers for tracing function graph*/
362typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
363typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
364
350#ifdef CONFIG_FUNCTION_GRAPH_TRACER 365#ifdef CONFIG_FUNCTION_GRAPH_TRACER
351 366
352/* for init task */ 367/* for init task */
@@ -395,10 +410,6 @@ extern char __irqentry_text_end[];
395 410
396#define FTRACE_RETFUNC_DEPTH 50 411#define FTRACE_RETFUNC_DEPTH 50
397#define FTRACE_RETSTACK_ALLOC_SIZE 32 412#define FTRACE_RETSTACK_ALLOC_SIZE 32
398/* Type of the callback handlers for tracing function graph*/
399typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
400typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
401
402extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 413extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
403 trace_func_graph_ent_t entryfunc); 414 trace_func_graph_ent_t entryfunc);
404 415
@@ -436,6 +447,13 @@ static inline void unpause_graph_tracing(void)
436static inline void ftrace_graph_init_task(struct task_struct *t) { } 447static inline void ftrace_graph_init_task(struct task_struct *t) { }
437static inline void ftrace_graph_exit_task(struct task_struct *t) { } 448static inline void ftrace_graph_exit_task(struct task_struct *t) { }
438 449
450static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
451 trace_func_graph_ent_t entryfunc)
452{
453 return -1;
454}
455static inline void unregister_ftrace_graph(void) { }
456
439static inline int task_curr_ret_stack(struct task_struct *tsk) 457static inline int task_curr_ret_stack(struct task_struct *tsk)
440{ 458{
441 return -1; 459 return -1;
@@ -487,7 +505,9 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
487 return tsk->trace & TSK_TRACE_FL_GRAPH; 505 return tsk->trace & TSK_TRACE_FL_GRAPH;
488} 506}
489 507
490extern int ftrace_dump_on_oops; 508enum ftrace_dump_mode;
509
510extern enum ftrace_dump_mode ftrace_dump_on_oops;
491 511
492#ifdef CONFIG_PREEMPT 512#ifdef CONFIG_PREEMPT
493#define INIT_TRACE_RECURSION .trace_recursion = 0, 513#define INIT_TRACE_RECURSION .trace_recursion = 0,
@@ -499,16 +519,10 @@ extern int ftrace_dump_on_oops;
499#define INIT_TRACE_RECURSION 519#define INIT_TRACE_RECURSION
500#endif 520#endif
501 521
502#ifdef CONFIG_HW_BRANCH_TRACER 522#ifdef CONFIG_FTRACE_SYSCALLS
503
504void trace_hw_branch(u64 from, u64 to);
505void trace_hw_branch_oops(void);
506
507#else /* CONFIG_HW_BRANCH_TRACER */
508 523
509static inline void trace_hw_branch(u64 from, u64 to) {} 524unsigned long arch_syscall_addr(int nr);
510static inline void trace_hw_branch_oops(void) {}
511 525
512#endif /* CONFIG_HW_BRANCH_TRACER */ 526#endif /* CONFIG_FTRACE_SYSCALLS */
513 527
514#endif /* _LINUX_FTRACE_H */ 528#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 2233c98d80df..3167f2df4126 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -5,6 +5,7 @@
5#include <linux/trace_seq.h> 5#include <linux/trace_seq.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/hardirq.h> 7#include <linux/hardirq.h>
8#include <linux/perf_event.h>
8 9
9struct trace_array; 10struct trace_array;
10struct tracer; 11struct tracer;
@@ -24,6 +25,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
24const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, 25const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
25 const struct trace_print_flags *symbol_array); 26 const struct trace_print_flags *symbol_array);
26 27
28const char *ftrace_print_hex_seq(struct trace_seq *p,
29 const unsigned char *buf, int len);
30
27/* 31/*
28 * The trace entry - the most basic unit of tracing. This is what 32 * The trace entry - the most basic unit of tracing. This is what
29 * is printed in the end as a single line in the trace output, such as: 33 * is printed in the end as a single line in the trace output, such as:
@@ -57,6 +61,7 @@ struct trace_iterator {
57 /* The below is zeroed out in pipe_read */ 61 /* The below is zeroed out in pipe_read */
58 struct trace_seq seq; 62 struct trace_seq seq;
59 struct trace_entry *ent; 63 struct trace_entry *ent;
64 unsigned long lost_events;
60 int leftover; 65 int leftover;
61 int cpu; 66 int cpu;
62 u64 ts; 67 u64 ts;
@@ -68,18 +73,25 @@ struct trace_iterator {
68}; 73};
69 74
70 75
76struct trace_event;
77
71typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, 78typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
72 int flags); 79 int flags, struct trace_event *event);
73struct trace_event { 80
74 struct hlist_node node; 81struct trace_event_functions {
75 struct list_head list;
76 int type;
77 trace_print_func trace; 82 trace_print_func trace;
78 trace_print_func raw; 83 trace_print_func raw;
79 trace_print_func hex; 84 trace_print_func hex;
80 trace_print_func binary; 85 trace_print_func binary;
81}; 86};
82 87
88struct trace_event {
89 struct hlist_node node;
90 struct list_head list;
91 int type;
92 struct trace_event_functions *funcs;
93};
94
83extern int register_ftrace_event(struct trace_event *event); 95extern int register_ftrace_event(struct trace_event *event);
84extern int unregister_ftrace_event(struct trace_event *event); 96extern int unregister_ftrace_event(struct trace_event *event);
85 97
@@ -111,35 +123,73 @@ void tracing_record_cmdline(struct task_struct *tsk);
111 123
112struct event_filter; 124struct event_filter;
113 125
126enum trace_reg {
127 TRACE_REG_REGISTER,
128 TRACE_REG_UNREGISTER,
129 TRACE_REG_PERF_REGISTER,
130 TRACE_REG_PERF_UNREGISTER,
131};
132
133struct ftrace_event_call;
134
135struct ftrace_event_class {
136 char *system;
137 void *probe;
138#ifdef CONFIG_PERF_EVENTS
139 void *perf_probe;
140#endif
141 int (*reg)(struct ftrace_event_call *event,
142 enum trace_reg type);
143 int (*define_fields)(struct ftrace_event_call *);
144 struct list_head *(*get_fields)(struct ftrace_event_call *);
145 struct list_head fields;
146 int (*raw_init)(struct ftrace_event_call *);
147};
148
149enum {
150 TRACE_EVENT_FL_ENABLED_BIT,
151 TRACE_EVENT_FL_FILTERED_BIT,
152};
153
154enum {
155 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
156 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
157};
158
114struct ftrace_event_call { 159struct ftrace_event_call {
115 struct list_head list; 160 struct list_head list;
161 struct ftrace_event_class *class;
116 char *name; 162 char *name;
117 char *system;
118 struct dentry *dir; 163 struct dentry *dir;
119 struct trace_event *event; 164 struct trace_event event;
120 int enabled; 165 const char *print_fmt;
121 int (*regfunc)(struct ftrace_event_call *);
122 void (*unregfunc)(struct ftrace_event_call *);
123 int id;
124 int (*raw_init)(struct ftrace_event_call *);
125 int (*show_format)(struct ftrace_event_call *,
126 struct trace_seq *);
127 int (*define_fields)(struct ftrace_event_call *);
128 struct list_head fields;
129 int filter_active;
130 struct event_filter *filter; 166 struct event_filter *filter;
131 void *mod; 167 void *mod;
132 void *data; 168 void *data;
133 169
134 int profile_count; 170 /*
135 int (*profile_enable)(struct ftrace_event_call *); 171 * 32 bit flags:
136 void (*profile_disable)(struct ftrace_event_call *); 172 * bit 1: enabled
173 * bit 2: filter_active
174 *
175 * Changes to flags must hold the event_mutex.
176 *
177 * Note: Reads of flags do not hold the event_mutex since
178 * they occur in critical sections. But the way flags
179 * is currently used, these changes do no affect the code
180 * except that when a change is made, it may have a slight
181 * delay in propagating the changes to other CPUs due to
182 * caching and such.
183 */
184 unsigned int flags;
185
186#ifdef CONFIG_PERF_EVENTS
187 int perf_refcount;
188 struct hlist_head *perf_events;
189#endif
137}; 190};
138 191
139#define FTRACE_MAX_PROFILE_SIZE 2048 192#define PERF_MAX_TRACE_SIZE 2048
140
141extern char *perf_trace_buf;
142extern char *perf_trace_buf_nmi;
143 193
144#define MAX_FILTER_PRED 32 194#define MAX_FILTER_PRED 32
145#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 195#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
@@ -188,13 +238,28 @@ do { \
188 __trace_printk(ip, fmt, ##args); \ 238 __trace_printk(ip, fmt, ##args); \
189} while (0) 239} while (0)
190 240
191#ifdef CONFIG_EVENT_PROFILE 241#ifdef CONFIG_PERF_EVENTS
192struct perf_event; 242struct perf_event;
193extern int ftrace_profile_enable(int event_id); 243
194extern void ftrace_profile_disable(int event_id); 244DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
195extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, 245
246extern int perf_trace_init(struct perf_event *event);
247extern void perf_trace_destroy(struct perf_event *event);
248extern int perf_trace_enable(struct perf_event *event);
249extern void perf_trace_disable(struct perf_event *event);
250extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
196 char *filter_str); 251 char *filter_str);
197extern void ftrace_profile_free_filter(struct perf_event *event); 252extern void ftrace_profile_free_filter(struct perf_event *event);
253extern void *perf_trace_buf_prepare(int size, unsigned short type,
254 struct pt_regs *regs, int *rctxp);
255
256static inline void
257perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
258 u64 count, struct pt_regs *regs, void *head)
259{
260 perf_tp_event(addr, count, raw_data, size, regs, head);
261 perf_swevent_put_recursion_context(rctx);
262}
198#endif 263#endif
199 264
200#endif /* _LINUX_FTRACE_EVENT_H */ 265#endif /* _LINUX_FTRACE_EVENT_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 3e2925a34bf0..88e0eb596919 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -34,6 +34,9 @@
34 * 7.13 34 * 7.13
35 * - make max number of background requests and congestion threshold 35 * - make max number of background requests and congestion threshold
36 * tunables 36 * tunables
37 *
38 * 7.14
39 * - add splice support to fuse device
37 */ 40 */
38 41
39#ifndef _LINUX_FUSE_H 42#ifndef _LINUX_FUSE_H
@@ -65,7 +68,7 @@
65#define FUSE_KERNEL_VERSION 7 68#define FUSE_KERNEL_VERSION 7
66 69
67/** Minor version number of this interface */ 70/** Minor version number of this interface */
68#define FUSE_KERNEL_MINOR_VERSION 13 71#define FUSE_KERNEL_MINOR_VERSION 14
69 72
70/** The node ID of the root inode */ 73/** The node ID of the root inode */
71#define FUSE_ROOT_ID 1 74#define FUSE_ROOT_ID 1
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 1bc08541c2b9..361d1cc288d0 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/slab.h>
19 20
20struct gameport { 21struct gameport {
21 22
@@ -46,7 +47,6 @@ struct gameport {
46 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ 47 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
47 48
48 struct device dev; 49 struct device dev;
49 unsigned int registered; /* port has been fully registered with driver core */
50 50
51 struct list_head node; 51 struct list_head node;
52}; 52};
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
index ca666d18ed67..574bea4013b6 100644
--- a/include/linux/generic_acl.h
+++ b/include/linux/generic_acl.h
@@ -5,8 +5,8 @@
5 5
6struct inode; 6struct inode;
7 7
8extern struct xattr_handler generic_acl_access_handler; 8extern const struct xattr_handler generic_acl_access_handler;
9extern struct xattr_handler generic_acl_default_handler; 9extern const struct xattr_handler generic_acl_default_handler;
10 10
11int generic_acl_init(struct inode *, struct inode *); 11int generic_acl_init(struct inode *, struct inode *);
12int generic_acl_chmod(struct inode *); 12int generic_acl_chmod(struct inode *);
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index b834ef6d59fa..61549b26ad6f 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -80,4 +80,12 @@ enum {
80 80
81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) 81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
82 82
83#ifdef __KERNEL__
84
85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void);
87extern void genl_unlock(void);
88
89#endif /* __KERNEL__ */
90
83#endif /* __LINUX_GENERIC_NETLINK_H */ 91#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9717081c75ad..5f2f4c4d8fb0 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -101,7 +101,7 @@ struct hd_struct {
101 unsigned long stamp; 101 unsigned long stamp;
102 int in_flight[2]; 102 int in_flight[2];
103#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
104 struct disk_stats *dkstats; 104 struct disk_stats __percpu *dkstats;
105#else 105#else
106 struct disk_stats dkstats; 106 struct disk_stats dkstats;
107#endif 107#endif
@@ -109,7 +109,7 @@ struct hd_struct {
109}; 109};
110 110
111#define GENHD_FL_REMOVABLE 1 111#define GENHD_FL_REMOVABLE 1
112#define GENHD_FL_DRIVERFS 2 112/* 2 is unused */
113#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 113#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
114#define GENHD_FL_CD 8 114#define GENHD_FL_CD 8
115#define GENHD_FL_UP 16 115#define GENHD_FL_UP 16
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 557bdad320b6..975609cb8548 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -15,7 +15,7 @@ struct vm_area_struct;
15 * Zone modifiers (see linux/mmzone.h - low three bits) 15 * Zone modifiers (see linux/mmzone.h - low three bits)
16 * 16 *
17 * Do not put any conditional on these. If necessary modify the definitions 17 * Do not put any conditional on these. If necessary modify the definitions
18 * without the underscores and use the consistently. The definitions here may 18 * without the underscores and use them consistently. The definitions here may
19 * be used in bit comparisons. 19 * be used in bit comparisons.
20 */ 20 */
21#define __GFP_DMA ((__force gfp_t)0x01u) 21#define __GFP_DMA ((__force gfp_t)0x01u)
@@ -30,7 +30,8 @@ struct vm_area_struct;
30 * _might_ fail. This depends upon the particular VM implementation. 30 * _might_ fail. This depends upon the particular VM implementation.
31 * 31 *
32 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller 32 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
33 * cannot handle allocation failures. 33 * cannot handle allocation failures. This modifier is deprecated and no new
34 * users should be added.
34 * 35 *
35 * __GFP_NORETRY: The VM implementation must not retry indefinitely. 36 * __GFP_NORETRY: The VM implementation must not retry indefinitely.
36 * 37 *
@@ -83,6 +84,7 @@ struct vm_area_struct;
83#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \ 84#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
84 __GFP_HARDWALL | __GFP_HIGHMEM | \ 85 __GFP_HARDWALL | __GFP_HIGHMEM | \
85 __GFP_MOVABLE) 86 __GFP_MOVABLE)
87#define GFP_IOFS (__GFP_IO | __GFP_FS)
86 88
87#ifdef CONFIG_NUMA 89#ifdef CONFIG_NUMA
88#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 90#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
@@ -99,7 +101,7 @@ struct vm_area_struct;
99 __GFP_NORETRY|__GFP_NOMEMALLOC) 101 __GFP_NORETRY|__GFP_NOMEMALLOC)
100 102
101/* Control slab gfp mask during early boot */ 103/* Control slab gfp mask during early boot */
102#define GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS) 104#define GFP_BOOT_MASK (__GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS))
103 105
104/* Control allocation constraints */ 106/* Control allocation constraints */
105#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) 107#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
@@ -150,12 +152,12 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
150 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the 152 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
151 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long 153 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
152 * and there are 16 of them to cover all possible combinations of 154 * and there are 16 of them to cover all possible combinations of
153 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM 155 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM.
154 * 156 *
155 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA. 157 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
156 * But GFP_MOVABLE is not only a zone specifier but also an allocation 158 * But GFP_MOVABLE is not only a zone specifier but also an allocation
157 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid. 159 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
158 * Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1". 160 * Only 1 bit of the lowest 3 bits (DMA,DMA32,HIGHMEM) can be set to "1".
159 * 161 *
160 * bit result 162 * bit result
161 * ================= 163 * =================
@@ -185,7 +187,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
185 187
186#define GFP_ZONE_TABLE ( \ 188#define GFP_ZONE_TABLE ( \
187 (ZONE_NORMAL << 0 * ZONES_SHIFT) \ 189 (ZONE_NORMAL << 0 * ZONES_SHIFT) \
188 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \ 190 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
189 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \ 191 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
190 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \ 192 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
191 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \ 193 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
@@ -195,7 +197,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
195) 197)
196 198
197/* 199/*
198 * GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32 200 * GFP_ZONE_BAD is a bitmap for all combinations of __GFP_DMA, __GFP_DMA32
199 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per 201 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
200 * entry starting with bit 0. Bit is set if the combination is not 202 * entry starting with bit 0. Bit is set if the combination is not
201 * allowed. 203 * allowed.
@@ -318,17 +320,17 @@ void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
318void free_pages_exact(void *virt, size_t size); 320void free_pages_exact(void *virt, size_t size);
319 321
320#define __get_free_page(gfp_mask) \ 322#define __get_free_page(gfp_mask) \
321 __get_free_pages((gfp_mask),0) 323 __get_free_pages((gfp_mask), 0)
322 324
323#define __get_dma_pages(gfp_mask, order) \ 325#define __get_dma_pages(gfp_mask, order) \
324 __get_free_pages((gfp_mask) | GFP_DMA,(order)) 326 __get_free_pages((gfp_mask) | GFP_DMA, (order))
325 327
326extern void __free_pages(struct page *page, unsigned int order); 328extern void __free_pages(struct page *page, unsigned int order);
327extern void free_pages(unsigned long addr, unsigned int order); 329extern void free_pages(unsigned long addr, unsigned int order);
328extern void free_hot_page(struct page *page); 330extern void free_hot_cold_page(struct page *page, int cold);
329 331
330#define __free_page(page) __free_pages((page), 0) 332#define __free_page(page) __free_pages((page), 0)
331#define free_page(addr) free_pages((addr),0) 333#define free_page(addr) free_pages((addr), 0)
332 334
333void page_alloc_init(void); 335void page_alloc_init(void);
334void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); 336void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
@@ -337,9 +339,7 @@ void drain_local_pages(void *dummy);
337 339
338extern gfp_t gfp_allowed_mask; 340extern gfp_t gfp_allowed_mask;
339 341
340static inline void set_gfp_allowed_mask(gfp_t mask) 342extern void set_gfp_allowed_mask(gfp_t mask);
341{ 343extern gfp_t clear_gfp_allowed_mask(gfp_t mask);
342 gfp_allowed_mask = mask;
343}
344 344
345#endif /* __LINUX_GFP_H */ 345#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index 81f90a59cda6..4f4462974c14 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -180,33 +180,6 @@ struct gfs2_rgrp {
180}; 180};
181 181
182/* 182/*
183 * quota linked list: user quotas and group quotas form two separate
184 * singly linked lists. ll_next stores uids or gids of next quotas in the
185 * linked list.
186
187Given the uid/gid, how to calculate the quota file offsets for the corresponding
188gfs2_quota structures on disk:
189
190for user quotas, given uid,
191offset = uid * sizeof(struct gfs2_quota);
192
193for group quotas, given gid,
194offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota);
195
196
197 uid:0 gid:0 uid:12 gid:12 uid:17 gid:17 uid:5142 gid:5142
198+-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+
199| valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid |
200+-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+
201next:12 next:12 next:17 next:5142 next:NULL next:NULL
202 | | | | |<-- user quota list |
203 \______|___________/ \______|___________/ group quota list -->|
204 | | |
205 \__________________/ \_______________________________________/
206
207*/
208
209/*
210 * quota structure 183 * quota structure
211 */ 184 */
212 185
@@ -214,8 +187,7 @@ struct gfs2_quota {
214 __be64 qu_limit; 187 __be64 qu_limit;
215 __be64 qu_warn; 188 __be64 qu_warn;
216 __be64 qu_value; 189 __be64 qu_value;
217 __be32 qu_ll_next; /* location of next quota in list */ 190 __u8 qu_reserved[64];
218 __u8 qu_reserved[60];
219}; 191};
220 192
221/* 193/*
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 4e949a5b5b85..03f616b78cfa 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -51,6 +51,11 @@ static inline int gpio_direction_output(unsigned gpio, int value)
51 return -ENOSYS; 51 return -ENOSYS;
52} 52}
53 53
54static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
55{
56 return -ENOSYS;
57}
58
54static inline int gpio_get_value(unsigned gpio) 59static inline int gpio_get_value(unsigned gpio)
55{ 60{
56 /* GPIO can never have been requested or set as {in,out}put */ 61 /* GPIO can never have been requested or set as {in,out}put */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 1289fa7623ca..cd0b3f30f48e 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -10,6 +10,7 @@ struct gpio_keys_button {
10 int type; /* input event type (EV_KEY, EV_SW) */ 10 int type; /* input event type (EV_KEY, EV_SW) */
11 int wakeup; /* configure the button as a wake-up source */ 11 int wakeup; /* configure the button as a wake-up source */
12 int debounce_interval; /* debounce ticks interval in msecs */ 12 int debounce_interval; /* debounce ticks interval in msecs */
13 bool can_disable;
13}; 14};
14 15
15struct gpio_keys_platform_data { 16struct gpio_keys_platform_data {
diff --git a/include/linux/gsmmux.h b/include/linux/gsmmux.h
new file mode 100644
index 000000000000..378de4195caf
--- /dev/null
+++ b/include/linux/gsmmux.h
@@ -0,0 +1,25 @@
1#ifndef _LINUX_GSMMUX_H
2#define _LINUX_GSMMUX_H
3
4struct gsm_config
5{
6 unsigned int adaption;
7 unsigned int encapsulation;
8 unsigned int initiator;
9 unsigned int t1;
10 unsigned int t2;
11 unsigned int t3;
12 unsigned int n2;
13 unsigned int mru;
14 unsigned int mtu;
15 unsigned int k;
16 unsigned int i;
17 unsigned int unused[8]; /* Padding for expansion without
18 breaking stuff */
19};
20
21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
23
24
25#endif
diff --git a/include/linux/hdpu_features.h b/include/linux/hdpu_features.h
deleted file mode 100644
index 6a8715431ae4..000000000000
--- a/include/linux/hdpu_features.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#include <linux/spinlock.h>
2
3struct cpustate_t {
4 spinlock_t lock;
5 int excl;
6 int open_count;
7 unsigned char cached_val;
8 int inited;
9 unsigned long *set_addr;
10 unsigned long *clr_addr;
11};
12
13
14#define HDPU_CPUSTATE_NAME "hdpu cpustate"
15#define HDPU_NEXUS_NAME "hdpu nexus"
16
17#define CPUSTATE_KERNEL_MAJOR 0x10
18
19#define CPUSTATE_KERNEL_INIT_DRV 0 /* CPU State Driver Initialized */
20#define CPUSTATE_KERNEL_INIT_PCI 1 /* 64360 PCI Busses Init */
21#define CPUSTATE_KERNEL_INIT_REG 2 /* 64360 Bridge Init */
22#define CPUSTATE_KERNEL_CPU1_KICK 3 /* Boot cpu 1 */
23#define CPUSTATE_KERNEL_CPU1_OK 4 /* Cpu 1 has checked in */
24#define CPUSTATE_KERNEL_OK 5 /* Terminal state */
25#define CPUSTATE_KERNEL_RESET 14 /* Board reset via SW*/
26#define CPUSTATE_KERNEL_HALT 15 /* Board halted via SW*/
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 87093652dda8..895001f7f4b2 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -308,11 +308,13 @@ struct hid_item {
308#define HID_QUIRK_NOTOUCH 0x00000002 308#define HID_QUIRK_NOTOUCH 0x00000002
309#define HID_QUIRK_IGNORE 0x00000004 309#define HID_QUIRK_IGNORE 0x00000004
310#define HID_QUIRK_NOGET 0x00000008 310#define HID_QUIRK_NOGET 0x00000008
311#define HID_QUIRK_HIDDEV_FORCE 0x00000010
311#define HID_QUIRK_BADPAD 0x00000020 312#define HID_QUIRK_BADPAD 0x00000020
312#define HID_QUIRK_MULTI_INPUT 0x00000040 313#define HID_QUIRK_MULTI_INPUT 0x00000040
313#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 314#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
314#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 315#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
315#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 316#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
317#define HID_QUIRK_NO_IGNORE 0x40000000
316 318
317/* 319/*
318 * This is the global environment of the parser. This information is 320 * This is the global environment of the parser. This information is
@@ -501,7 +503,7 @@ struct hid_device { /* device report descriptor */
501 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 503 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
502 504
503 /* handler for raw output data, used by hidraw */ 505 /* handler for raw output data, used by hidraw */
504 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 506 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
505 507
506 /* debugging support via debugfs */ 508 /* debugging support via debugfs */
507 unsigned short debug; 509 unsigned short debug;
@@ -589,6 +591,9 @@ struct hid_usage_id {
589 * @report_fixup: called before report descriptor parsing (NULL means nop) 591 * @report_fixup: called before report descriptor parsing (NULL means nop)
590 * @input_mapping: invoked on input registering before mapping an usage 592 * @input_mapping: invoked on input registering before mapping an usage
591 * @input_mapped: invoked on input registering after mapping an usage 593 * @input_mapped: invoked on input registering after mapping an usage
594 * @suspend: invoked on suspend (NULL means nop)
595 * @resume: invoked on resume if device was not reset (NULL means nop)
596 * @reset_resume: invoked on resume if device was reset (NULL means nop)
592 * 597 *
593 * raw_event and event should return 0 on no action performed, 1 when no 598 * raw_event and event should return 0 on no action performed, 1 when no
594 * further processing should be done and negative on error 599 * further processing should be done and negative on error
@@ -629,6 +634,11 @@ struct hid_driver {
629 int (*input_mapped)(struct hid_device *hdev, 634 int (*input_mapped)(struct hid_device *hdev,
630 struct hid_input *hidinput, struct hid_field *field, 635 struct hid_input *hidinput, struct hid_field *field,
631 struct hid_usage *usage, unsigned long **bit, int *max); 636 struct hid_usage *usage, unsigned long **bit, int *max);
637#ifdef CONFIG_PM
638 int (*suspend)(struct hid_device *hdev, pm_message_t message);
639 int (*resume)(struct hid_device *hdev);
640 int (*reset_resume)(struct hid_device *hdev);
641#endif
632/* private: */ 642/* private: */
633 struct device_driver driver; 643 struct device_driver driver;
634}; 644};
@@ -663,7 +673,7 @@ struct hid_ll_driver {
663 673
664/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 674/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
665/* We ignore a few input applications that are not widely used */ 675/* We ignore a few input applications that are not widely used */
666#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 676#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
667 677
668/* HID core API */ 678/* HID core API */
669 679
@@ -690,6 +700,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int);
690int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 700int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
691void hid_output_report(struct hid_report *report, __u8 *data); 701void hid_output_report(struct hid_report *report, __u8 *data);
692struct hid_device *hid_allocate_device(void); 702struct hid_device *hid_allocate_device(void);
703struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
693int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 704int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
694int hid_check_keys_pressed(struct hid_device *hid); 705int hid_check_keys_pressed(struct hid_device *hid);
695int hid_connect(struct hid_device *hid, unsigned int connect_mask); 706int hid_connect(struct hid_device *hid, unsigned int connect_mask);
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index ab2cc20e21a5..caafd0561aa1 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -17,11 +17,17 @@ static inline void flush_anon_page(struct vm_area_struct *vma, struct page *page
17static inline void flush_kernel_dcache_page(struct page *page) 17static inline void flush_kernel_dcache_page(struct page *page)
18{ 18{
19} 19}
20static inline void flush_kernel_vmap_range(void *vaddr, int size)
21{
22}
23static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
24{
25}
20#endif 26#endif
21 27
22#include <asm/kmap_types.h> 28#include <asm/kmap_types.h>
23 29
24#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT) 30#ifdef CONFIG_DEBUG_HIGHMEM
25 31
26void debug_kmap_atomic(enum km_type type); 32void debug_kmap_atomic(enum km_type type);
27 33
diff --git a/include/linux/hil.h b/include/linux/hil.h
index 13352d7d0caf..523785a9de70 100644
--- a/include/linux/hil.h
+++ b/include/linux/hil.h
@@ -168,14 +168,14 @@ enum hil_command {
168 HIL_CMD_PR6 = 0x45, /* Prompt6 */ 168 HIL_CMD_PR6 = 0x45, /* Prompt6 */
169 HIL_CMD_PR7 = 0x46, /* Prompt7 */ 169 HIL_CMD_PR7 = 0x46, /* Prompt7 */
170 HIL_CMD_PRM = 0x47, /* Prompt (General Purpose) */ 170 HIL_CMD_PRM = 0x47, /* Prompt (General Purpose) */
171 HIL_CMD_AK1 = 0x48, /* Acknowlege1 */ 171 HIL_CMD_AK1 = 0x48, /* Acknowledge1 */
172 HIL_CMD_AK2 = 0x49, /* Acknowlege2 */ 172 HIL_CMD_AK2 = 0x49, /* Acknowledge2 */
173 HIL_CMD_AK3 = 0x4a, /* Acknowlege3 */ 173 HIL_CMD_AK3 = 0x4a, /* Acknowledge3 */
174 HIL_CMD_AK4 = 0x4b, /* Acknowlege4 */ 174 HIL_CMD_AK4 = 0x4b, /* Acknowledge4 */
175 HIL_CMD_AK5 = 0x4c, /* Acknowlege5 */ 175 HIL_CMD_AK5 = 0x4c, /* Acknowledge5 */
176 HIL_CMD_AK6 = 0x4d, /* Acknowlege6 */ 176 HIL_CMD_AK6 = 0x4d, /* Acknowledge6 */
177 HIL_CMD_AK7 = 0x4e, /* Acknowlege7 */ 177 HIL_CMD_AK7 = 0x4e, /* Acknowledge7 */
178 HIL_CMD_ACK = 0x4f, /* Acknowlege (General Purpose) */ 178 HIL_CMD_ACK = 0x4f, /* Acknowledge (General Purpose) */
179 179
180 /* 0x50 to 0x78 reserved for future use */ 180 /* 0x50 to 0x78 reserved for future use */
181 /* 0x80 to 0xEF device-specific commands */ 181 /* 0x80 to 0xEF device-specific commands */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 5d86fb2309d2..fd0c1b857d3d 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -422,6 +422,8 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
422 422
423extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, 423extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta,
424 const enum hrtimer_mode mode); 424 const enum hrtimer_mode mode);
425extern int schedule_hrtimeout_range_clock(ktime_t *expires,
426 unsigned long delta, const enum hrtimer_mode mode, int clock);
425extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode); 427extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
426 428
427/* Soft interrupt function to run the hrtimer queues: */ 429/* Soft interrupt function to run the hrtimer queues: */
diff --git a/include/linux/htcpld.h b/include/linux/htcpld.h
new file mode 100644
index 000000000000..ab3f6cb4dddc
--- /dev/null
+++ b/include/linux/htcpld.h
@@ -0,0 +1,24 @@
1#ifndef __LINUX_HTCPLD_H
2#define __LINUX_HTCPLD_H
3
4struct htcpld_chip_platform_data {
5 unsigned int addr;
6 unsigned int reset;
7 unsigned int num_gpios;
8 unsigned int gpio_out_base;
9 unsigned int gpio_in_base;
10 unsigned int irq_base;
11 unsigned int num_irqs;
12};
13
14struct htcpld_core_platform_data {
15 unsigned int int_reset_gpio_hi;
16 unsigned int int_reset_gpio_lo;
17 unsigned int i2c_adapter_id;
18
19 struct htcpld_chip_platform_data *chip;
20 unsigned int num_chip;
21};
22
23#endif /* __LINUX_HTCPLD_H */
24
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index 41235c93e4e9..a2d6ea49ec56 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -9,9 +9,22 @@ enum {
9}; 9};
10 10
11enum { 11enum {
12 HW_BREAKPOINT_R = 1, 12 HW_BREAKPOINT_EMPTY = 0,
13 HW_BREAKPOINT_W = 2, 13 HW_BREAKPOINT_R = 1,
14 HW_BREAKPOINT_X = 4, 14 HW_BREAKPOINT_W = 2,
15 HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
16 HW_BREAKPOINT_X = 4,
17 HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
18};
19
20enum bp_type_idx {
21 TYPE_INST = 0,
22#ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
23 TYPE_DATA = 0,
24#else
25 TYPE_DATA = 1,
26#endif
27 TYPE_MAX
15}; 28};
16 29
17#ifdef __KERNEL__ 30#ifdef __KERNEL__
@@ -34,6 +47,12 @@ static inline void hw_breakpoint_init(struct perf_event_attr *attr)
34 attr->sample_period = 1; 47 attr->sample_period = 1;
35} 48}
36 49
50static inline void ptrace_breakpoint_init(struct perf_event_attr *attr)
51{
52 hw_breakpoint_init(attr);
53 attr->exclude_kernel = 1;
54}
55
37static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) 56static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
38{ 57{
39 return bp->attr.bp_addr; 58 return bp->attr.bp_addr;
@@ -44,7 +63,7 @@ static inline int hw_breakpoint_type(struct perf_event *bp)
44 return bp->attr.bp_type; 63 return bp->attr.bp_type;
45} 64}
46 65
47static inline int hw_breakpoint_len(struct perf_event *bp) 66static inline unsigned long hw_breakpoint_len(struct perf_event *bp)
48{ 67{
49 return bp->attr.bp_len; 68 return bp->attr.bp_len;
50} 69}
@@ -66,15 +85,17 @@ register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
66 perf_overflow_handler_t triggered, 85 perf_overflow_handler_t triggered,
67 int cpu); 86 int cpu);
68 87
69extern struct perf_event ** 88extern struct perf_event * __percpu *
70register_wide_hw_breakpoint(struct perf_event_attr *attr, 89register_wide_hw_breakpoint(struct perf_event_attr *attr,
71 perf_overflow_handler_t triggered); 90 perf_overflow_handler_t triggered);
72 91
73extern int register_perf_hw_breakpoint(struct perf_event *bp); 92extern int register_perf_hw_breakpoint(struct perf_event *bp);
74extern int __register_perf_hw_breakpoint(struct perf_event *bp); 93extern int __register_perf_hw_breakpoint(struct perf_event *bp);
75extern void unregister_hw_breakpoint(struct perf_event *bp); 94extern void unregister_hw_breakpoint(struct perf_event *bp);
76extern void unregister_wide_hw_breakpoint(struct perf_event **cpu_events); 95extern void unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events);
77 96
97extern int dbg_reserve_bp_slot(struct perf_event *bp);
98extern int dbg_release_bp_slot(struct perf_event *bp);
78extern int reserve_bp_slot(struct perf_event *bp); 99extern int reserve_bp_slot(struct perf_event *bp);
79extern void release_bp_slot(struct perf_event *bp); 100extern void release_bp_slot(struct perf_event *bp);
80 101
@@ -98,7 +119,7 @@ static inline struct perf_event *
98register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 119register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
99 perf_overflow_handler_t triggered, 120 perf_overflow_handler_t triggered,
100 int cpu) { return NULL; } 121 int cpu) { return NULL; }
101static inline struct perf_event ** 122static inline struct perf_event * __percpu *
102register_wide_hw_breakpoint(struct perf_event_attr *attr, 123register_wide_hw_breakpoint(struct perf_event_attr *attr,
103 perf_overflow_handler_t triggered) { return NULL; } 124 perf_overflow_handler_t triggered) { return NULL; }
104static inline int 125static inline int
@@ -107,7 +128,7 @@ static inline int
107__register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } 128__register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
108static inline void unregister_hw_breakpoint(struct perf_event *bp) { } 129static inline void unregister_hw_breakpoint(struct perf_event *bp) { }
109static inline void 130static inline void
110unregister_wide_hw_breakpoint(struct perf_event **cpu_events) { } 131unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events) { }
111static inline int 132static inline int
112reserve_bp_slot(struct perf_event *bp) {return -ENOSYS; } 133reserve_bp_slot(struct perf_event *bp) {return -ENOSYS; }
113static inline void release_bp_slot(struct perf_event *bp) { } 134static inline void release_bp_slot(struct perf_event *bp) { }
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 111334f5b922..4f98148c11c3 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -36,6 +36,8 @@ struct i2c_algo_bit_data {
36 void (*setscl) (void *data, int state); 36 void (*setscl) (void *data, int state);
37 int (*getsda) (void *data); 37 int (*getsda) (void *data);
38 int (*getscl) (void *data); 38 int (*getscl) (void *data);
39 int (*pre_xfer) (struct i2c_adapter *);
40 void (*post_xfer) (struct i2c_adapter *);
39 41
40 /* local settings */ 42 /* local settings */
41 int udelay; /* half clock cycle time in us, 43 int udelay; /* half clock cycle time in us,
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
new file mode 100644
index 000000000000..78ebf507ce56
--- /dev/null
+++ b/include/linux/i2c-omap.h
@@ -0,0 +1,9 @@
1#ifndef __I2C_OMAP_H__
2#define __I2C_OMAP_H__
3
4struct omap_i2c_bus_platform_data {
5 u32 clkrate;
6 void (*set_mpu_wkup_lat)(struct device *dev, long set);
7};
8
9#endif
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index 9eb07bbc6522..a87124d4d533 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -12,9 +12,8 @@
12#ifndef __I2C_PNX_H__ 12#ifndef __I2C_PNX_H__
13#define __I2C_PNX_H__ 13#define __I2C_PNX_H__
14 14
15#include <linux/pm.h>
16
17struct platform_device; 15struct platform_device;
16struct clk;
18 17
19struct i2c_pnx_mif { 18struct i2c_pnx_mif {
20 int ret; /* Return value */ 19 int ret; /* Return value */
@@ -26,20 +25,18 @@ struct i2c_pnx_mif {
26}; 25};
27 26
28struct i2c_pnx_algo_data { 27struct i2c_pnx_algo_data {
29 u32 base; 28 void __iomem *ioaddr;
30 u32 ioaddr;
31 int irq;
32 struct i2c_pnx_mif mif; 29 struct i2c_pnx_mif mif;
33 int last; 30 int last;
31 struct clk *clk;
32 struct i2c_pnx_data *i2c_pnx;
33 struct i2c_adapter adapter;
34}; 34};
35 35
36struct i2c_pnx_data { 36struct i2c_pnx_data {
37 int (*suspend) (struct platform_device *pdev, pm_message_t state); 37 const char *name;
38 int (*resume) (struct platform_device *pdev); 38 u32 base;
39 u32 (*calculate_input_freq) (struct platform_device *pdev); 39 int irq;
40 int (*set_clock_run) (struct platform_device *pdev);
41 int (*set_clock_stop) (struct platform_device *pdev);
42 struct i2c_adapter *adapter;
43}; 40};
44 41
45#endif /* __I2C_PNX_H__ */ 42#endif /* __I2C_PNX_H__ */
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
new file mode 100644
index 000000000000..63f57a8c8b31
--- /dev/null
+++ b/include/linux/i2c-smbus.h
@@ -0,0 +1,50 @@
1/*
2 * i2c-smbus.h - SMBus extensions to the I2C protocol
3 *
4 * Copyright (C) 2010 Jean Delvare <khali@linux-fr.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _LINUX_I2C_SMBUS_H
22#define _LINUX_I2C_SMBUS_H
23
24#include <linux/i2c.h>
25
26
27/**
28 * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client
29 * @alert_edge_triggered: whether the alert interrupt is edge (1) or level (0)
30 * triggered
31 * @irq: IRQ number, if the smbus_alert driver should take care of interrupt
32 * handling
33 *
34 * If irq is not specified, the smbus_alert driver doesn't take care of
35 * interrupt handling. In that case it is up to the I2C bus driver to either
36 * handle the interrupts or to poll for alerts.
37 *
38 * If irq is specified then it it crucial that alert_edge_triggered is
39 * properly set.
40 */
41struct i2c_smbus_alert_setup {
42 unsigned int alert_edge_triggered:1;
43 int irq;
44};
45
46struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,
47 struct i2c_smbus_alert_setup *setup);
48int i2c_handle_smbus_alert(struct i2c_client *ara);
49
50#endif /* _LINUX_I2C_SMBUS_H */
diff --git a/include/linux/i2c-xiic.h b/include/linux/i2c-xiic.h
new file mode 100644
index 000000000000..4f9f2256a97e
--- /dev/null
+++ b/include/linux/i2c-xiic.h
@@ -0,0 +1,43 @@
1/*
2 * i2c-xiic.h
3 * Copyright (c) 2009 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19/* Supports:
20 * Xilinx IIC
21 */
22
23#ifndef _LINUX_I2C_XIIC_H
24#define _LINUX_I2C_XIIC_H
25
26/**
27 * struct xiic_i2c_platform_data - Platform data of the Xilinx I2C driver
28 * @num_devices: Number of devices that shall be added when the driver
29 * is probed.
30 * @devices: The actuall devices to add.
31 *
32 * This purpose of this platform data struct is to be able to provide a number
33 * of devices that should be added to the I2C bus. The reason is that sometimes
34 * the I2C board info is not enough, a new PCI board can for instance be
35 * plugged into a standard PC, and the bus number might be unknown at
36 * early init time.
37 */
38struct xiic_i2c_platform_data {
39 u8 num_devices;
40 struct i2c_board_info const *devices;
41};
42
43#endif /* _LINUX_I2C_XIIC_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 02fc617782ef..21067b418536 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -34,6 +34,7 @@
34#include <linux/device.h> /* for struct device */ 34#include <linux/device.h> /* for struct device */
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/of.h> /* for struct device_node */
37 38
38extern struct bus_type i2c_bus_type; 39extern struct bus_type i2c_bus_type;
39 40
@@ -53,6 +54,7 @@ struct i2c_board_info;
53 * on a bus (or read from them). Apart from two basic transfer functions to 54 * on a bus (or read from them). Apart from two basic transfer functions to
54 * transmit one message at a time, a more complex version can be used to 55 * transmit one message at a time, a more complex version can be used to
55 * transmit an arbitrary number of messages without interruption. 56 * transmit an arbitrary number of messages without interruption.
57 * @count must be be less than 64k since msg.len is u16.
56 */ 58 */
57extern int i2c_master_send(struct i2c_client *client, const char *buf, 59extern int i2c_master_send(struct i2c_client *client, const char *buf,
58 int count); 60 int count);
@@ -152,6 +154,13 @@ struct i2c_driver {
152 int (*suspend)(struct i2c_client *, pm_message_t mesg); 154 int (*suspend)(struct i2c_client *, pm_message_t mesg);
153 int (*resume)(struct i2c_client *); 155 int (*resume)(struct i2c_client *);
154 156
157 /* Alert callback, for example for the SMBus alert protocol.
158 * The format and meaning of the data value depends on the protocol.
159 * For the SMBus alert protocol, there is a single bit of data passed
160 * as the alert response's low bit ("event flag").
161 */
162 void (*alert)(struct i2c_client *, unsigned int data);
163
155 /* a ioctl like command that can be used to perform specific functions 164 /* a ioctl like command that can be used to perform specific functions
156 * with the device. 165 * with the device.
157 */ 166 */
@@ -243,6 +252,9 @@ struct i2c_board_info {
243 unsigned short addr; 252 unsigned short addr;
244 void *platform_data; 253 void *platform_data;
245 struct dev_archdata *archdata; 254 struct dev_archdata *archdata;
255#ifdef CONFIG_OF
256 struct device_node *of_node;
257#endif
246 int irq; 258 int irq;
247}; 259};
248 260
@@ -347,6 +359,8 @@ struct i2c_adapter {
347 int nr; 359 int nr;
348 char name[48]; 360 char name[48];
349 struct completion dev_released; 361 struct completion dev_released;
362
363 struct list_head userspace_clients;
350}; 364};
351#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 365#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
352 366
diff --git a/include/linux/i2c/adp8860.h b/include/linux/i2c/adp8860.h
new file mode 100644
index 000000000000..0b4d39855c91
--- /dev/null
+++ b/include/linux/i2c/adp8860.h
@@ -0,0 +1,154 @@
1/*
2 * Definitions and platform data for Analog Devices
3 * Backlight drivers ADP8860
4 *
5 * Copyright 2009-2010 Analog Devices Inc.
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef __LINUX_I2C_ADP8860_H
11#define __LINUX_I2C_ADP8860_H
12
13#include <linux/leds.h>
14#include <linux/types.h>
15
16#define ID_ADP8860 8860
17
18#define ADP8860_MAX_BRIGHTNESS 0x7F
19#define FLAG_OFFT_SHIFT 8
20
21/*
22 * LEDs subdevice platform data
23 */
24
25#define ADP8860_LED_DIS_BLINK (0 << FLAG_OFFT_SHIFT)
26#define ADP8860_LED_OFFT_600ms (1 << FLAG_OFFT_SHIFT)
27#define ADP8860_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT)
28#define ADP8860_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT)
29
30#define ADP8860_LED_ONT_200ms 0
31#define ADP8860_LED_ONT_600ms 1
32#define ADP8860_LED_ONT_800ms 2
33#define ADP8860_LED_ONT_1200ms 3
34
35#define ADP8860_LED_D7 (7)
36#define ADP8860_LED_D6 (6)
37#define ADP8860_LED_D5 (5)
38#define ADP8860_LED_D4 (4)
39#define ADP8860_LED_D3 (3)
40#define ADP8860_LED_D2 (2)
41#define ADP8860_LED_D1 (1)
42
43/*
44 * Backlight subdevice platform data
45 */
46
47#define ADP8860_BL_D7 (1 << 6)
48#define ADP8860_BL_D6 (1 << 5)
49#define ADP8860_BL_D5 (1 << 4)
50#define ADP8860_BL_D4 (1 << 3)
51#define ADP8860_BL_D3 (1 << 2)
52#define ADP8860_BL_D2 (1 << 1)
53#define ADP8860_BL_D1 (1 << 0)
54
55#define ADP8860_FADE_T_DIS 0 /* Fade Timer Disabled */
56#define ADP8860_FADE_T_300ms 1 /* 0.3 Sec */
57#define ADP8860_FADE_T_600ms 2
58#define ADP8860_FADE_T_900ms 3
59#define ADP8860_FADE_T_1200ms 4
60#define ADP8860_FADE_T_1500ms 5
61#define ADP8860_FADE_T_1800ms 6
62#define ADP8860_FADE_T_2100ms 7
63#define ADP8860_FADE_T_2400ms 8
64#define ADP8860_FADE_T_2700ms 9
65#define ADP8860_FADE_T_3000ms 10
66#define ADP8860_FADE_T_3500ms 11
67#define ADP8860_FADE_T_4000ms 12
68#define ADP8860_FADE_T_4500ms 13
69#define ADP8860_FADE_T_5000ms 14
70#define ADP8860_FADE_T_5500ms 15 /* 5.5 Sec */
71
72#define ADP8860_FADE_LAW_LINEAR 0
73#define ADP8860_FADE_LAW_SQUARE 1
74#define ADP8860_FADE_LAW_CUBIC1 2
75#define ADP8860_FADE_LAW_CUBIC2 3
76
77#define ADP8860_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */
78#define ADP8860_BL_AMBL_FILT_160ms 1
79#define ADP8860_BL_AMBL_FILT_320ms 2
80#define ADP8860_BL_AMBL_FILT_640ms 3
81#define ADP8860_BL_AMBL_FILT_1280ms 4
82#define ADP8860_BL_AMBL_FILT_2560ms 5
83#define ADP8860_BL_AMBL_FILT_5120ms 6
84#define ADP8860_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */
85
86/*
87 * Blacklight current 0..30mA
88 */
89#define ADP8860_BL_CUR_mA(I) ((I * 127) / 30)
90
91/*
92 * L2 comparator current 0..1106uA
93 */
94#define ADP8860_L2_COMP_CURR_uA(I) ((I * 255) / 1106)
95
96/*
97 * L3 comparator current 0..138uA
98 */
99#define ADP8860_L3_COMP_CURR_uA(I) ((I * 255) / 138)
100
101struct adp8860_backlight_platform_data {
102 u8 bl_led_assign; /* 1 = Backlight 0 = Individual LED */
103
104 u8 bl_fade_in; /* Backlight Fade-In Timer */
105 u8 bl_fade_out; /* Backlight Fade-Out Timer */
106 u8 bl_fade_law; /* fade-on/fade-off transfer characteristic */
107
108 u8 en_ambl_sens; /* 1 = enable ambient light sensor */
109 u8 abml_filt; /* Light sensor filter time */
110
111 u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
112 u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
113 u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
114 u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
115 u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
116 u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
117
118 u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
119 u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
120 u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
121 u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
122
123 /**
124 * Independent Current Sinks / LEDS
125 * Sinks not assigned to the Backlight can be exposed to
126 * user space using the LEDS CLASS interface
127 */
128
129 int num_leds;
130 struct led_info *leds;
131 u8 led_fade_in; /* LED Fade-In Timer */
132 u8 led_fade_out; /* LED Fade-Out Timer */
133 u8 led_fade_law; /* fade-on/fade-off transfer characteristic */
134 u8 led_on_time;
135
136 /**
137 * Gain down disable. Setting this option does not allow the
138 * charge pump to switch to lower gains. NOT AVAILABLE on ADP8860
139 * 1 = the charge pump doesn't switch down in gain until all LEDs are 0.
140 * The charge pump switches up in gain as needed. This feature is
141 * useful if the ADP8863 charge pump is used to drive an external load.
142 * This feature must be used when utilizing small fly capacitors
143 * (0402 or smaller).
144 * 0 = the charge pump automatically switches up and down in gain.
145 * This provides optimal efficiency, but is not suitable for driving
146 * loads that are not connected through the ADP8863 diode drivers.
147 * Additionally, the charge pump fly capacitors should be low ESR
148 * and sized 0603 or greater.
149 */
150
151 u8 gdwn_dis;
152};
153
154#endif /* __LINUX_I2C_ADP8860_H */
diff --git a/include/linux/i2c/max732x.h b/include/linux/i2c/max732x.h
index e10336631c62..c04bac8bf2fe 100644
--- a/include/linux/i2c/max732x.h
+++ b/include/linux/i2c/max732x.h
@@ -7,6 +7,9 @@ struct max732x_platform_data {
7 /* number of the first GPIO */ 7 /* number of the first GPIO */
8 unsigned gpio_base; 8 unsigned gpio_base;
9 9
10 /* interrupt base */
11 int irq_base;
12
10 void *context; /* param to setup/teardown */ 13 void *context; /* param to setup/teardown */
11 14
12 int (*setup)(struct i2c_client *client, 15 int (*setup)(struct i2c_client *client,
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 81736d6a8db7..139ba52667c8 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -1,3 +1,9 @@
1#ifndef _LINUX_PCA953X_H
2#define _LINUX_PCA953X_H
3
4#include <linux/types.h>
5#include <linux/i2c.h>
6
1/* platform data for the PCA9539 16-bit I/O expander driver */ 7/* platform data for the PCA9539 16-bit I/O expander driver */
2 8
3struct pca953x_platform_data { 9struct pca953x_platform_data {
@@ -7,6 +13,9 @@ struct pca953x_platform_data {
7 /* initial polarity inversion setting */ 13 /* initial polarity inversion setting */
8 uint16_t invert; 14 uint16_t invert;
9 15
16 /* interrupt base */
17 int irq_base;
18
10 void *context; /* param to setup/teardown */ 19 void *context; /* param to setup/teardown */
11 20
12 int (*setup)(struct i2c_client *client, 21 int (*setup)(struct i2c_client *client,
@@ -15,5 +24,7 @@ struct pca953x_platform_data {
15 int (*teardown)(struct i2c_client *client, 24 int (*teardown)(struct i2c_client *client,
16 unsigned gpio, unsigned ngpio, 25 unsigned gpio, unsigned ngpio,
17 void *context); 26 void *context);
18 char **names; 27 const char *const *names;
19}; 28};
29
30#endif /* _LINUX_PCA953X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index bf1c5be1f5b6..6de90bfc6acd 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -80,6 +80,11 @@
80#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER 80#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
81#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER 81#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
82#define TWL_MODULE_RTC TWL4030_MODULE_RTC 82#define TWL_MODULE_RTC TWL4030_MODULE_RTC
83#define TWL_MODULE_PWM TWL4030_MODULE_PWM0
84
85#define TWL6030_MODULE_ID0 0x0D
86#define TWL6030_MODULE_ID1 0x0E
87#define TWL6030_MODULE_ID2 0x0F
83 88
84#define GPIO_INTR_OFFSET 0 89#define GPIO_INTR_OFFSET 0
85#define KEYPAD_INTR_OFFSET 1 90#define KEYPAD_INTR_OFFSET 1
@@ -239,6 +244,21 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
239 244
240/*----------------------------------------------------------------------*/ 245/*----------------------------------------------------------------------*/
241 246
247/*Interface Bit Register (INTBR) offsets
248 *(Use TWL_4030_MODULE_INTBR)
249 */
250
251#define REG_GPPUPDCTR1 0x0F
252
253/*I2C1 and I2C4(SR) SDA/SCL pull-up control bits */
254
255#define I2C_SCL_CTRL_PU BIT(0)
256#define I2C_SDA_CTRL_PU BIT(2)
257#define SR_I2C_SCL_CTRL_PU BIT(4)
258#define SR_I2C_SDA_CTRL_PU BIT(6)
259
260/*----------------------------------------------------------------------*/
261
242/* 262/*
243 * Keypad register offsets (use TWL4030_MODULE_KEYPAD) 263 * Keypad register offsets (use TWL4030_MODULE_KEYPAD)
244 * ... SIH/interrupt only 264 * ... SIH/interrupt only
@@ -476,7 +496,7 @@ struct twl4030_madc_platform_data {
476 int irq_line; 496 int irq_line;
477}; 497};
478 498
479/* Boards have uniqe mappings of {row, col} --> keycode. 499/* Boards have unique mappings of {row, col} --> keycode.
480 * Column and row are 8 bits each, but range only from 0..7. 500 * Column and row are 8 bits each, but range only from 0..7.
481 * a PERSISTENT_KEY is "always on" and never reported. 501 * a PERSISTENT_KEY is "always on" and never reported.
482 */ 502 */
@@ -530,6 +550,7 @@ struct twl4030_power_data {
530}; 550};
531 551
532extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 552extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
553extern int twl4030_remove_script(u8 flags);
533 554
534struct twl4030_codec_audio_data { 555struct twl4030_codec_audio_data {
535 unsigned int audio_mclk; 556 unsigned int audio_mclk;
@@ -547,6 +568,10 @@ struct twl4030_codec_data {
547 unsigned int audio_mclk; 568 unsigned int audio_mclk;
548 struct twl4030_codec_audio_data *audio; 569 struct twl4030_codec_audio_data *audio;
549 struct twl4030_codec_vibra_data *vibra; 570 struct twl4030_codec_vibra_data *vibra;
571
572 /* twl6040 */
573 int audpwron_gpio; /* audio power-on gpio */
574 int naudint_irq; /* audio interrupt */
550}; 575};
551 576
552struct twl4030_platform_data { 577struct twl4030_platform_data {
@@ -601,12 +626,7 @@ int twl4030_sih_setup(int module);
601#define TWL4030_VAUX3_DEV_GRP 0x1F 626#define TWL4030_VAUX3_DEV_GRP 0x1F
602#define TWL4030_VAUX3_DEDICATED 0x22 627#define TWL4030_VAUX3_DEDICATED 0x22
603 628
604#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 629static inline int twl4030charger_usb_en(int enable) { return 0; }
605 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
606 extern int twl4030charger_usb_en(int enable);
607#else
608 static inline int twl4030charger_usb_en(int enable) { return 0; }
609#endif
610 630
611/*----------------------------------------------------------------------*/ 631/*----------------------------------------------------------------------*/
612 632
@@ -644,15 +664,15 @@ int twl4030_sih_setup(int module);
644#define TWL4030_REG_VUSB3V1 19 664#define TWL4030_REG_VUSB3V1 19
645 665
646/* TWL6030 SMPS/LDO's */ 666/* TWL6030 SMPS/LDO's */
647/* EXTERNAL dc-to-dc buck convertor contollable via SR */ 667/* EXTERNAL dc-to-dc buck convertor controllable via SR */
648#define TWL6030_REG_VDD1 30 668#define TWL6030_REG_VDD1 30
649#define TWL6030_REG_VDD2 31 669#define TWL6030_REG_VDD2 31
650#define TWL6030_REG_VDD3 32 670#define TWL6030_REG_VDD3 32
651 671
652/* Non SR compliant dc-to-dc buck convertors */ 672/* Non SR compliant dc-to-dc buck convertors */
653#define TWL6030_REG_VMEM 33 673#define TWL6030_REG_VMEM 33
654#define TWL6030_REG_V2V1 34 674#define TWL6030_REG_V2V1 34
655#define TWL6030_REG_V1V29 35 675#define TWL6030_REG_V1V29 35
656#define TWL6030_REG_V1V8 36 676#define TWL6030_REG_V1V8 36
657 677
658/* EXTERNAL LDOs */ 678/* EXTERNAL LDOs */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 4c4e57d1f19d..9e7a12d6385d 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -385,7 +385,7 @@
385/* defines for max_sectors and max_phys_segments */ 385/* defines for max_sectors and max_phys_segments */
386#define I2O_MAX_SECTORS 1024 386#define I2O_MAX_SECTORS 1024
387#define I2O_MAX_SECTORS_LIMITED 128 387#define I2O_MAX_SECTORS_LIMITED 128
388#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS 388#define I2O_MAX_PHYS_SEGMENTS BLK_MAX_SEGMENTS
389 389
390/* 390/*
391 * Message structures 391 * Message structures
@@ -782,7 +782,6 @@ extern int i2o_exec_lct_get(struct i2o_controller *);
782#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) 782#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
783#define to_i2o_device(dev) container_of(dev, struct i2o_device, device) 783#define to_i2o_device(dev) container_of(dev, struct i2o_device, device)
784#define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) 784#define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device)
785#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
786 785
787/** 786/**
788 * i2o_out_to_virt - Turn an I2O message to a virtual address 787 * i2o_out_to_virt - Turn an I2O message to a virtual address
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 9bf6870ee5f4..a986ff588944 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -46,31 +46,31 @@ int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
46 46
47#else 47#else
48 48
49void i8042_lock_chip(void) 49static inline void i8042_lock_chip(void)
50{ 50{
51} 51}
52 52
53void i8042_unlock_chip(void) 53static inline void i8042_unlock_chip(void)
54{ 54{
55} 55}
56 56
57int i8042_command(unsigned char *param, int command) 57static inline int i8042_command(unsigned char *param, int command)
58{ 58{
59 return -ENODEV; 59 return -ENODEV;
60} 60}
61 61
62bool i8042_check_port_owner(const struct serio *serio) 62static inline bool i8042_check_port_owner(const struct serio *serio)
63{ 63{
64 return false; 64 return false;
65} 65}
66 66
67int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, 67static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
68 struct serio *serio)) 68 struct serio *serio))
69{ 69{
70 return -ENODEV; 70 return -ENODEV;
71} 71}
72 72
73int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, 73static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
74 struct serio *serio)) 74 struct serio *serio))
75{ 75{
76 return -ENODEV; 76 return -ENODEV;
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index c0d8357917e2..4c4c74ec5987 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -174,8 +174,7 @@ struct icmp6_filter {
174 174
175extern void icmpv6_send(struct sk_buff *skb, 175extern void icmpv6_send(struct sk_buff *skb,
176 u8 type, u8 code, 176 u8 type, u8 code,
177 __u32 info, 177 __u32 info);
178 struct net_device *dev);
179 178
180extern int icmpv6_init(void); 179extern int icmpv6_init(void);
181extern int icmpv6_err_convert(u8 type, u8 code, 180extern int icmpv6_err_convert(u8 type, u8 code,
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 0ec612959042..7b02aa5ce9b4 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -362,7 +362,7 @@ struct ide_drive_s;
362struct ide_disk_ops { 362struct ide_disk_ops {
363 int (*check)(struct ide_drive_s *, const char *); 363 int (*check)(struct ide_drive_s *, const char *);
364 int (*get_capacity)(struct ide_drive_s *); 364 int (*get_capacity)(struct ide_drive_s *);
365 u64 (*set_capacity)(struct ide_drive_s *, u64); 365 void (*unlock_native_capacity)(struct ide_drive_s *);
366 void (*setup)(struct ide_drive_s *); 366 void (*setup)(struct ide_drive_s *);
367 void (*flush)(struct ide_drive_s *); 367 void (*flush)(struct ide_drive_s *);
368 int (*init_media)(struct ide_drive_s *, struct gendisk *); 368 int (*init_media)(struct ide_drive_s *, struct gendisk *);
@@ -515,7 +515,9 @@ struct ide_drive_s {
515 u8 init_speed; /* transfer rate set at boot */ 515 u8 init_speed; /* transfer rate set at boot */
516 u8 current_speed; /* current transfer rate set */ 516 u8 current_speed; /* current transfer rate set */
517 u8 desired_speed; /* desired transfer rate set */ 517 u8 desired_speed; /* desired transfer rate set */
518 u8 dn; /* now wide spread use */ 518 u8 pio_mode; /* for ->set_pio_mode _only_ */
519 u8 dma_mode; /* for ->set_dma_mode _only_ */
520 u8 dn; /* now wide spread use */
519 u8 acoustic; /* acoustic management */ 521 u8 acoustic; /* acoustic management */
520 u8 media; /* disk, cdrom, tape, floppy, ... */ 522 u8 media; /* disk, cdrom, tape, floppy, ... */
521 u8 ready_stat; /* min status value for drive ready */ 523 u8 ready_stat; /* min status value for drive ready */
@@ -622,8 +624,8 @@ extern const struct ide_tp_ops default_tp_ops;
622 */ 624 */
623struct ide_port_ops { 625struct ide_port_ops {
624 void (*init_dev)(ide_drive_t *); 626 void (*init_dev)(ide_drive_t *);
625 void (*set_pio_mode)(ide_drive_t *, const u8); 627 void (*set_pio_mode)(struct hwif_s *, ide_drive_t *);
626 void (*set_dma_mode)(ide_drive_t *, const u8); 628 void (*set_dma_mode)(struct hwif_s *, ide_drive_t *);
627 int (*reset_poll)(ide_drive_t *); 629 int (*reset_poll)(ide_drive_t *);
628 void (*pre_reset)(ide_drive_t *); 630 void (*pre_reset)(ide_drive_t *);
629 void (*resetproc)(ide_drive_t *); 631 void (*resetproc)(ide_drive_t *);
@@ -1167,6 +1169,7 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1167extern void ide_timer_expiry(unsigned long); 1169extern void ide_timer_expiry(unsigned long);
1168extern irqreturn_t ide_intr(int irq, void *dev_id); 1170extern irqreturn_t ide_intr(int irq, void *dev_id);
1169extern void do_ide_request(struct request_queue *); 1171extern void do_ide_request(struct request_queue *);
1172extern void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq);
1170 1173
1171void ide_init_disk(struct gendisk *, ide_drive_t *); 1174void ide_init_disk(struct gendisk *, ide_drive_t *);
1172 1175
@@ -1494,7 +1497,6 @@ int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1494#ifdef CONFIG_IDE_XFER_MODE 1497#ifdef CONFIG_IDE_XFER_MODE
1495int ide_scan_pio_blacklist(char *); 1498int ide_scan_pio_blacklist(char *);
1496const char *ide_xfer_verbose(u8); 1499const char *ide_xfer_verbose(u8);
1497u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1498int ide_pio_need_iordy(ide_drive_t *, const u8); 1500int ide_pio_need_iordy(ide_drive_t *, const u8);
1499int ide_set_pio_mode(ide_drive_t *, u8); 1501int ide_set_pio_mode(ide_drive_t *, u8);
1500int ide_set_dma_mode(ide_drive_t *, u8); 1502int ide_set_dma_mode(ide_drive_t *, u8);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 163c840437d6..97b2eae6a22c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -120,6 +120,26 @@
120#define IEEE80211_QOS_CTL_TID_MASK 0x000F 120#define IEEE80211_QOS_CTL_TID_MASK 0x000F
121#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 121#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
122 122
123/* U-APSD queue for WMM IEs sent by AP */
124#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
125
126/* U-APSD queues for WMM IEs sent by STA */
127#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0)
128#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI (1<<1)
129#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK (1<<2)
130#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE (1<<3)
131#define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f
132
133/* U-APSD max SP length for WMM IEs sent by STA */
134#define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00
135#define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01
136#define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02
137#define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03
138#define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03
139#define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5
140
141#define IEEE80211_HT_CTL_LEN 4
142
123struct ieee80211_hdr { 143struct ieee80211_hdr {
124 __le16 frame_control; 144 __le16 frame_control;
125 __le16 duration_id; 145 __le16 duration_id;
@@ -130,6 +150,25 @@ struct ieee80211_hdr {
130 u8 addr4[6]; 150 u8 addr4[6];
131} __attribute__ ((packed)); 151} __attribute__ ((packed));
132 152
153struct ieee80211_hdr_3addr {
154 __le16 frame_control;
155 __le16 duration_id;
156 u8 addr1[6];
157 u8 addr2[6];
158 u8 addr3[6];
159 __le16 seq_ctrl;
160} __attribute__ ((packed));
161
162struct ieee80211_qos_hdr {
163 __le16 frame_control;
164 __le16 duration_id;
165 u8 addr1[6];
166 u8 addr2[6];
167 u8 addr3[6];
168 __le16 seq_ctrl;
169 __le16 qos_ctrl;
170} __attribute__ ((packed));
171
133/** 172/**
134 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set 173 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
135 * @fc: frame control bytes in little-endian byteorder 174 * @fc: frame control bytes in little-endian byteorder
@@ -707,6 +746,10 @@ struct ieee80211_mgmt {
707 u8 action; 746 u8 action;
708 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; 747 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
709 } __attribute__ ((packed)) sa_query; 748 } __attribute__ ((packed)) sa_query;
749 struct {
750 u8 action;
751 u8 smps_control;
752 } __attribute__ ((packed)) ht_smps;
710 } u; 753 } u;
711 } __attribute__ ((packed)) action; 754 } __attribute__ ((packed)) action;
712 } u; 755 } u;
@@ -771,7 +814,10 @@ struct ieee80211_bar {
771/** 814/**
772 * struct ieee80211_mcs_info - MCS information 815 * struct ieee80211_mcs_info - MCS information
773 * @rx_mask: RX mask 816 * @rx_mask: RX mask
774 * @rx_highest: highest supported RX rate 817 * @rx_highest: highest supported RX rate. If set represents
818 * the highest supported RX data rate in units of 1 Mbps.
819 * If this field is 0 this value should not be used to
820 * consider the highest RX data rate supported.
775 * @tx_params: TX parameters 821 * @tx_params: TX parameters
776 */ 822 */
777struct ieee80211_mcs_info { 823struct ieee80211_mcs_info {
@@ -824,11 +870,13 @@ struct ieee80211_ht_cap {
824#define IEEE80211_HT_CAP_LDPC_CODING 0x0001 870#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
825#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 871#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
826#define IEEE80211_HT_CAP_SM_PS 0x000C 872#define IEEE80211_HT_CAP_SM_PS 0x000C
873#define IEEE80211_HT_CAP_SM_PS_SHIFT 2
827#define IEEE80211_HT_CAP_GRN_FLD 0x0010 874#define IEEE80211_HT_CAP_GRN_FLD 0x0010
828#define IEEE80211_HT_CAP_SGI_20 0x0020 875#define IEEE80211_HT_CAP_SGI_20 0x0020
829#define IEEE80211_HT_CAP_SGI_40 0x0040 876#define IEEE80211_HT_CAP_SGI_40 0x0040
830#define IEEE80211_HT_CAP_TX_STBC 0x0080 877#define IEEE80211_HT_CAP_TX_STBC 0x0080
831#define IEEE80211_HT_CAP_RX_STBC 0x0300 878#define IEEE80211_HT_CAP_RX_STBC 0x0300
879#define IEEE80211_HT_CAP_RX_STBC_SHIFT 8
832#define IEEE80211_HT_CAP_DELAY_BA 0x0400 880#define IEEE80211_HT_CAP_DELAY_BA 0x0400
833#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 881#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
834#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 882#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
@@ -839,6 +887,7 @@ struct ieee80211_ht_cap {
839/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ 887/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
840#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 888#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
841#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C 889#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
890#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2
842 891
843/* 892/*
844 * Maximum length of AMPDU that the STA can receive. 893 * Maximum length of AMPDU that the STA can receive.
@@ -922,12 +971,17 @@ struct ieee80211_ht_info {
922#define IEEE80211_MAX_AMPDU_BUF 0x40 971#define IEEE80211_MAX_AMPDU_BUF 0x40
923 972
924 973
925/* Spatial Multiplexing Power Save Modes */ 974/* Spatial Multiplexing Power Save Modes (for capability) */
926#define WLAN_HT_CAP_SM_PS_STATIC 0 975#define WLAN_HT_CAP_SM_PS_STATIC 0
927#define WLAN_HT_CAP_SM_PS_DYNAMIC 1 976#define WLAN_HT_CAP_SM_PS_DYNAMIC 1
928#define WLAN_HT_CAP_SM_PS_INVALID 2 977#define WLAN_HT_CAP_SM_PS_INVALID 2
929#define WLAN_HT_CAP_SM_PS_DISABLED 3 978#define WLAN_HT_CAP_SM_PS_DISABLED 3
930 979
980/* for SM power control field lower two bits */
981#define WLAN_HT_SMPS_CONTROL_DISABLED 0
982#define WLAN_HT_SMPS_CONTROL_STATIC 1
983#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3
984
931/* Authentication algorithms */ 985/* Authentication algorithms */
932#define WLAN_AUTH_OPEN 0 986#define WLAN_AUTH_OPEN 0
933#define WLAN_AUTH_SHARED_KEY 1 987#define WLAN_AUTH_SHARED_KEY 1
@@ -1071,12 +1125,12 @@ enum ieee80211_eid {
1071 WLAN_EID_TIM = 5, 1125 WLAN_EID_TIM = 5,
1072 WLAN_EID_IBSS_PARAMS = 6, 1126 WLAN_EID_IBSS_PARAMS = 6,
1073 WLAN_EID_CHALLENGE = 16, 1127 WLAN_EID_CHALLENGE = 16,
1074 /* 802.11d */ 1128
1075 WLAN_EID_COUNTRY = 7, 1129 WLAN_EID_COUNTRY = 7,
1076 WLAN_EID_HP_PARAMS = 8, 1130 WLAN_EID_HP_PARAMS = 8,
1077 WLAN_EID_HP_TABLE = 9, 1131 WLAN_EID_HP_TABLE = 9,
1078 WLAN_EID_REQUEST = 10, 1132 WLAN_EID_REQUEST = 10,
1079 /* 802.11e */ 1133
1080 WLAN_EID_QBSS_LOAD = 11, 1134 WLAN_EID_QBSS_LOAD = 11,
1081 WLAN_EID_EDCA_PARAM_SET = 12, 1135 WLAN_EID_EDCA_PARAM_SET = 12,
1082 WLAN_EID_TSPEC = 13, 1136 WLAN_EID_TSPEC = 13,
@@ -1099,7 +1153,7 @@ enum ieee80211_eid {
1099 WLAN_EID_PREP = 69, 1153 WLAN_EID_PREP = 69,
1100 WLAN_EID_PERR = 70, 1154 WLAN_EID_PERR = 70,
1101 WLAN_EID_RANN = 49, /* compatible with FreeBSD */ 1155 WLAN_EID_RANN = 49, /* compatible with FreeBSD */
1102 /* 802.11h */ 1156
1103 WLAN_EID_PWR_CONSTRAINT = 32, 1157 WLAN_EID_PWR_CONSTRAINT = 32,
1104 WLAN_EID_PWR_CAPABILITY = 33, 1158 WLAN_EID_PWR_CAPABILITY = 33,
1105 WLAN_EID_TPC_REQUEST = 34, 1159 WLAN_EID_TPC_REQUEST = 34,
@@ -1110,20 +1164,41 @@ enum ieee80211_eid {
1110 WLAN_EID_MEASURE_REPORT = 39, 1164 WLAN_EID_MEASURE_REPORT = 39,
1111 WLAN_EID_QUIET = 40, 1165 WLAN_EID_QUIET = 40,
1112 WLAN_EID_IBSS_DFS = 41, 1166 WLAN_EID_IBSS_DFS = 41,
1113 /* 802.11g */ 1167
1114 WLAN_EID_ERP_INFO = 42, 1168 WLAN_EID_ERP_INFO = 42,
1115 WLAN_EID_EXT_SUPP_RATES = 50, 1169 WLAN_EID_EXT_SUPP_RATES = 50,
1116 /* 802.11n */ 1170
1117 WLAN_EID_HT_CAPABILITY = 45, 1171 WLAN_EID_HT_CAPABILITY = 45,
1118 WLAN_EID_HT_INFORMATION = 61, 1172 WLAN_EID_HT_INFORMATION = 61,
1119 /* 802.11i */ 1173
1120 WLAN_EID_RSN = 48, 1174 WLAN_EID_RSN = 48,
1121 WLAN_EID_TIMEOUT_INTERVAL = 56, 1175 WLAN_EID_MMIE = 76,
1122 WLAN_EID_MMIE = 76 /* 802.11w */,
1123 WLAN_EID_WPA = 221, 1176 WLAN_EID_WPA = 221,
1124 WLAN_EID_GENERIC = 221, 1177 WLAN_EID_GENERIC = 221,
1125 WLAN_EID_VENDOR_SPECIFIC = 221, 1178 WLAN_EID_VENDOR_SPECIFIC = 221,
1126 WLAN_EID_QOS_PARAMETER = 222 1179 WLAN_EID_QOS_PARAMETER = 222,
1180
1181 WLAN_EID_AP_CHAN_REPORT = 51,
1182 WLAN_EID_NEIGHBOR_REPORT = 52,
1183 WLAN_EID_RCPI = 53,
1184 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
1185 WLAN_EID_ANTENNA_INFO = 64,
1186 WLAN_EID_RSNI = 65,
1187 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
1188 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
1189 WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
1190 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1191 WLAN_EID_MULTIPLE_BSSID = 71,
1192
1193 WLAN_EID_MOBILITY_DOMAIN = 54,
1194 WLAN_EID_FAST_BSS_TRANSITION = 55,
1195 WLAN_EID_TIMEOUT_INTERVAL = 56,
1196 WLAN_EID_RIC_DATA = 57,
1197 WLAN_EID_RIC_DESCRIPTOR = 75,
1198
1199 WLAN_EID_DSE_REGISTERED_LOCATION = 58,
1200 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
1201 WLAN_EID_EXT_CHANSWITCH_ANN = 60,
1127}; 1202};
1128 1203
1129/* Action category code */ 1204/* Action category code */
@@ -1137,6 +1212,8 @@ enum ieee80211_category {
1137 WLAN_CATEGORY_SA_QUERY = 8, 1212 WLAN_CATEGORY_SA_QUERY = 8,
1138 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1213 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1139 WLAN_CATEGORY_WMM = 17, 1214 WLAN_CATEGORY_WMM = 17,
1215 WLAN_CATEGORY_MESH_PLINK = 30, /* Pending ANA approval */
1216 WLAN_CATEGORY_MESH_PATH_SEL = 32, /* Pending ANA approval */
1140 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1217 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1141 WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1218 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1142}; 1219};
@@ -1150,6 +1227,18 @@ enum ieee80211_spectrum_mgmt_actioncode {
1150 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1227 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1151}; 1228};
1152 1229
1230/* HT action codes */
1231enum ieee80211_ht_actioncode {
1232 WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0,
1233 WLAN_HT_ACTION_SMPS = 1,
1234 WLAN_HT_ACTION_PSMP = 2,
1235 WLAN_HT_ACTION_PCO_PHASE = 3,
1236 WLAN_HT_ACTION_CSI = 4,
1237 WLAN_HT_ACTION_NONCOMPRESSED_BF = 5,
1238 WLAN_HT_ACTION_COMPRESSED_BF = 6,
1239 WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7,
1240};
1241
1153/* Security key length */ 1242/* Security key length */
1154enum ieee80211_key_len { 1243enum ieee80211_key_len {
1155 WLAN_KEY_LEN_WEP40 = 5, 1244 WLAN_KEY_LEN_WEP40 = 5,
@@ -1238,7 +1327,6 @@ enum ieee80211_back_actioncode {
1238enum ieee80211_back_parties { 1327enum ieee80211_back_parties {
1239 WLAN_BACK_RECIPIENT = 0, 1328 WLAN_BACK_RECIPIENT = 0,
1240 WLAN_BACK_INITIATOR = 1, 1329 WLAN_BACK_INITIATOR = 1,
1241 WLAN_BACK_TIMER = 2,
1242}; 1330};
1243 1331
1244/* SA Query action */ 1332/* SA Query action */
diff --git a/include/linux/if.h b/include/linux/if.h
index 3a9f410a296b..be350e62a905 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,6 +71,8 @@
71 * release skb->dst 71 * release skb->dst
72 */ 72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
74 76
75#define IF_GET_IFACE 0x0001 /* for querying only */ 77#define IF_GET_IFACE 0x0001 /* for querying only */
76#define IF_GET_PROTO 0x0002 78#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index e80b7f88f7c6..6d722f41ee7c 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -90,6 +90,7 @@
90 90
91#define ARPHRD_PHONET 820 /* PhoNet media type */ 91#define ARPHRD_PHONET 820 /* PhoNet media type */
92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
93#define ARPHRD_CAIF 822 /* CAIF media type */
93 94
94#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 95#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
95#define ARPHRD_NONE 0xFFFE /* zero header length */ 96#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 299b4121f914..bed7a4682b90 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -109,6 +109,7 @@
109#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ 109#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
110#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ 110#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
111#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ 111#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
112#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
112 113
113/* 114/*
114 * This is an Ethernet frame header. 115 * This is an Ethernet frame header.
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 6674791622ca..85c812db5a3f 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -37,6 +37,38 @@ struct rtnl_link_stats {
37 __u32 tx_compressed; 37 __u32 tx_compressed;
38}; 38};
39 39
40struct rtnl_link_stats64 {
41 __u64 rx_packets; /* total packets received */
42 __u64 tx_packets; /* total packets transmitted */
43 __u64 rx_bytes; /* total bytes received */
44 __u64 tx_bytes; /* total bytes transmitted */
45 __u64 rx_errors; /* bad packets received */
46 __u64 tx_errors; /* packet transmit problems */
47 __u64 rx_dropped; /* no space in linux buffers */
48 __u64 tx_dropped; /* no space available in linux */
49 __u64 multicast; /* multicast packets received */
50 __u64 collisions;
51
52 /* detailed rx_errors: */
53 __u64 rx_length_errors;
54 __u64 rx_over_errors; /* receiver ring buff overflow */
55 __u64 rx_crc_errors; /* recved pkt with crc error */
56 __u64 rx_frame_errors; /* recv'd frame alignment error */
57 __u64 rx_fifo_errors; /* recv'r fifo overrun */
58 __u64 rx_missed_errors; /* receiver missed packet */
59
60 /* detailed tx_errors */
61 __u64 tx_aborted_errors;
62 __u64 tx_carrier_errors;
63 __u64 tx_fifo_errors;
64 __u64 tx_heartbeat_errors;
65 __u64 tx_window_errors;
66
67 /* for cslip etc */
68 __u64 rx_compressed;
69 __u64 tx_compressed;
70};
71
40/* The struct should be in sync with struct ifmap */ 72/* The struct should be in sync with struct ifmap */
41struct rtnl_link_ifmap { 73struct rtnl_link_ifmap {
42 __u64 mem_start; 74 __u64 mem_start;
@@ -78,6 +110,11 @@ enum {
78#define IFLA_LINKINFO IFLA_LINKINFO 110#define IFLA_LINKINFO IFLA_LINKINFO
79 IFLA_NET_NS_PID, 111 IFLA_NET_NS_PID,
80 IFLA_IFALIAS, 112 IFLA_IFALIAS,
113 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
114 IFLA_VFINFO_LIST,
115 IFLA_STATS64,
116 IFLA_VF_PORTS,
117 IFLA_PORT_SELF,
81 __IFLA_MAX 118 __IFLA_MAX
82}; 119};
83 120
@@ -196,4 +233,120 @@ enum macvlan_mode {
196 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ 233 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
197}; 234};
198 235
236/* SR-IOV virtual function managment section */
237
238enum {
239 IFLA_VF_INFO_UNSPEC,
240 IFLA_VF_INFO,
241 __IFLA_VF_INFO_MAX,
242};
243
244#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
245
246enum {
247 IFLA_VF_UNSPEC,
248 IFLA_VF_MAC, /* Hardware queue specific attributes */
249 IFLA_VF_VLAN,
250 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
251 __IFLA_VF_MAX,
252};
253
254#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
255
256struct ifla_vf_mac {
257 __u32 vf;
258 __u8 mac[32]; /* MAX_ADDR_LEN */
259};
260
261struct ifla_vf_vlan {
262 __u32 vf;
263 __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
264 __u32 qos;
265};
266
267struct ifla_vf_tx_rate {
268 __u32 vf;
269 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
270};
271
272struct ifla_vf_info {
273 __u32 vf;
274 __u8 mac[32];
275 __u32 vlan;
276 __u32 qos;
277 __u32 tx_rate;
278};
279
280/* VF ports management section
281 *
282 * Nested layout of set/get msg is:
283 *
284 * [IFLA_NUM_VF]
285 * [IFLA_VF_PORTS]
286 * [IFLA_VF_PORT]
287 * [IFLA_PORT_*], ...
288 * [IFLA_VF_PORT]
289 * [IFLA_PORT_*], ...
290 * ...
291 * [IFLA_PORT_SELF]
292 * [IFLA_PORT_*], ...
293 */
294
295enum {
296 IFLA_VF_PORT_UNSPEC,
297 IFLA_VF_PORT, /* nest */
298 __IFLA_VF_PORT_MAX,
299};
300
301#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
302
303enum {
304 IFLA_PORT_UNSPEC,
305 IFLA_PORT_VF, /* __u32 */
306 IFLA_PORT_PROFILE, /* string */
307 IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
308 IFLA_PORT_INSTANCE_UUID, /* binary UUID */
309 IFLA_PORT_HOST_UUID, /* binary UUID */
310 IFLA_PORT_REQUEST, /* __u8 */
311 IFLA_PORT_RESPONSE, /* __u16, output only */
312 __IFLA_PORT_MAX,
313};
314
315#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
316
317#define PORT_PROFILE_MAX 40
318#define PORT_UUID_MAX 16
319#define PORT_SELF_VF -1
320
321enum {
322 PORT_REQUEST_PREASSOCIATE = 0,
323 PORT_REQUEST_PREASSOCIATE_RR,
324 PORT_REQUEST_ASSOCIATE,
325 PORT_REQUEST_DISASSOCIATE,
326};
327
328enum {
329 PORT_VDP_RESPONSE_SUCCESS = 0,
330 PORT_VDP_RESPONSE_INVALID_FORMAT,
331 PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
332 PORT_VDP_RESPONSE_UNUSED_VTID,
333 PORT_VDP_RESPONSE_VTID_VIOLATION,
334 PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
335 PORT_VDP_RESPONSE_OUT_OF_SYNC,
336 /* 0x08-0xFF reserved for future VDP use */
337 PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
338 PORT_PROFILE_RESPONSE_INPROGRESS,
339 PORT_PROFILE_RESPONSE_INVALID,
340 PORT_PROFILE_RESPONSE_BADSTATE,
341 PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
342 PORT_PROFILE_RESPONSE_ERROR,
343};
344
345struct ifla_port_vsi {
346 __u8 vsi_mgr_id;
347 __u8 vsi_type_id[3];
348 __u8 vsi_type_version;
349 __u8 pad[3];
350};
351
199#endif /* _LINUX_IF_LINK_H */ 352#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 5f200bac3749..1ffaeffeff74 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -1,6 +1,93 @@
1#ifndef _LINUX_IF_MACVLAN_H 1#ifndef _LINUX_IF_MACVLAN_H
2#define _LINUX_IF_MACVLAN_H 2#define _LINUX_IF_MACVLAN_H
3 3
4extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); 4#include <linux/if_link.h>
5#include <linux/list.h>
6#include <linux/netdevice.h>
7#include <linux/netlink.h>
8#include <net/netlink.h>
9
10#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE)
11struct socket *macvtap_get_socket(struct file *);
12#else
13#include <linux/err.h>
14#include <linux/errno.h>
15struct file;
16struct socket;
17static inline struct socket *macvtap_get_socket(struct file *f)
18{
19 return ERR_PTR(-EINVAL);
20}
21#endif /* CONFIG_MACVTAP */
22
23struct macvlan_port;
24struct macvtap_queue;
25
26/**
27 * struct macvlan_rx_stats - MACVLAN percpu rx stats
28 * @rx_packets: number of received packets
29 * @rx_bytes: number of received bytes
30 * @multicast: number of received multicast packets
31 * @rx_errors: number of errors
32 */
33struct macvlan_rx_stats {
34 unsigned long rx_packets;
35 unsigned long rx_bytes;
36 unsigned long multicast;
37 unsigned long rx_errors;
38};
39
40struct macvlan_dev {
41 struct net_device *dev;
42 struct list_head list;
43 struct hlist_node hlist;
44 struct macvlan_port *port;
45 struct net_device *lowerdev;
46 struct macvlan_rx_stats __percpu *rx_stats;
47 enum macvlan_mode mode;
48 int (*receive)(struct sk_buff *skb);
49 int (*forward)(struct net_device *dev, struct sk_buff *skb);
50 struct macvtap_queue *tap;
51};
52
53static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
54 unsigned int len, bool success,
55 bool multicast)
56{
57 struct macvlan_rx_stats *rx_stats;
58
59 rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id());
60 if (likely(success)) {
61 rx_stats->rx_packets++;;
62 rx_stats->rx_bytes += len;
63 if (multicast)
64 rx_stats->multicast++;
65 } else {
66 rx_stats->rx_errors++;
67 }
68}
69
70extern void macvlan_common_setup(struct net_device *dev);
71
72extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
73 struct nlattr *tb[], struct nlattr *data[],
74 int (*receive)(struct sk_buff *skb),
75 int (*forward)(struct net_device *dev,
76 struct sk_buff *skb));
77
78extern void macvlan_count_rx(const struct macvlan_dev *vlan,
79 unsigned int len, bool success,
80 bool multicast);
81
82extern void macvlan_dellink(struct net_device *dev, struct list_head *head);
83
84extern int macvlan_link_register(struct rtnl_link_ops *ops);
85
86extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
87 struct net_device *dev);
88
89
90extern struct sk_buff *(*macvlan_handle_frame_hook)(struct macvlan_port *,
91 struct sk_buff *);
5 92
6#endif /* _LINUX_IF_MACVLAN_H */ 93#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 4021d47cc437..6ac23ef1801a 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -46,6 +46,8 @@ struct sockaddr_ll {
46#define PACKET_RESERVE 12 46#define PACKET_RESERVE 12
47#define PACKET_TX_RING 13 47#define PACKET_TX_RING 13
48#define PACKET_LOSS 14 48#define PACKET_LOSS 14
49#define PACKET_VNET_HDR 15
50#define PACKET_TX_TIMESTAMP 16
49 51
50struct tpacket_stats { 52struct tpacket_stats {
51 unsigned int tp_packets; 53 unsigned int tp_packets;
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index c58baea4a25b..184bc5566207 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -2,7 +2,7 @@
2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661) 2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
3 * 3 *
4 * This file supplies definitions required by the PPP over L2TP driver 4 * This file supplies definitions required by the PPP over L2TP driver
5 * (pppol2tp.c). All version information wrt this file is located in pppol2tp.c 5 * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c
6 * 6 *
7 * License: 7 * License:
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
@@ -35,6 +35,20 @@ struct pppol2tp_addr {
35 __u16 d_tunnel, d_session; /* For sending outgoing packets */ 35 __u16 d_tunnel, d_session; /* For sending outgoing packets */
36}; 36};
37 37
38/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
39 * bits. So we need a different sockaddr structure.
40 */
41struct pppol2tpv3_addr {
42 pid_t pid; /* pid that owns the fd.
43 * 0 => current */
44 int fd; /* FD of UDP or IP socket to use */
45
46 struct sockaddr_in addr; /* IP address and port to send to */
47
48 __u32 s_tunnel, s_session; /* For matching incoming packets */
49 __u32 d_tunnel, d_session; /* For sending outgoing packets */
50};
51
38/* Socket options: 52/* Socket options:
39 * DEBUG - bitmask of debug message categories 53 * DEBUG - bitmask of debug message categories
40 * SENDSEQ - 0 => don't send packets with sequence numbers 54 * SENDSEQ - 0 => don't send packets with sequence numbers
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 90b5fae5d714..a6577af0c4e6 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -72,6 +72,15 @@ struct sockaddr_pppol2tp {
72 struct pppol2tp_addr pppol2tp; 72 struct pppol2tp_addr pppol2tp;
73}__attribute__ ((packed)); 73}__attribute__ ((packed));
74 74
75/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
76 * bits. So we need a different sockaddr structure.
77 */
78struct sockaddr_pppol2tpv3 {
79 sa_family_t sa_family; /* address family, AF_PPPOX */
80 unsigned int sa_protocol; /* protocol identifier */
81 struct pppol2tpv3_addr pppol2tp;
82} __attribute__ ((packed));
83
75/********************************************************************* 84/*********************************************************************
76 * 85 *
77 * ioctl interface for defining forwarding of connections 86 * ioctl interface for defining forwarding of connections
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 3f5fd523b49d..06b1829731fd 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <linux/filter.h>
21 22
22/* Read queue size */ 23/* Read queue size */
23#define TUN_READQ_SIZE 500 24#define TUN_READQ_SIZE 500
@@ -48,6 +49,10 @@
48#define TUNGETIFF _IOR('T', 210, unsigned int) 49#define TUNGETIFF _IOR('T', 210, unsigned int)
49#define TUNGETSNDBUF _IOR('T', 211, int) 50#define TUNGETSNDBUF _IOR('T', 211, int)
50#define TUNSETSNDBUF _IOW('T', 212, int) 51#define TUNSETSNDBUF _IOW('T', 212, int)
52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
54#define TUNGETVNETHDRSZ _IOR('T', 215, int)
55#define TUNSETVNETHDRSZ _IOW('T', 216, int)
51 56
52/* TUNSETIFF ifr flags */ 57/* TUNSETIFF ifr flags */
53#define IFF_TUN 0x0001 58#define IFF_TUN 0x0001
@@ -86,4 +91,18 @@ struct tun_filter {
86 __u8 addr[0][ETH_ALEN]; 91 __u8 addr[0][ETH_ALEN];
87}; 92};
88 93
94#ifdef __KERNEL__
95#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
96struct socket *tun_get_socket(struct file *);
97#else
98#include <linux/err.h>
99#include <linux/errno.h>
100struct file;
101struct socket;
102static inline struct socket *tun_get_socket(struct file *f)
103{
104 return ERR_PTR(-EINVAL);
105}
106#endif /* CONFIG_TUN */
107#endif /* __KERNEL__ */
89#endif /* __IF_TUN_H */ 108#endif /* __IF_TUN_H */
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 1822d635be6b..16b92d008bed 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,6 +2,7 @@
2#define _IF_TUNNEL_H_ 2#define _IF_TUNNEL_H_
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <asm/byteorder.h>
5 6
6#ifdef __KERNEL__ 7#ifdef __KERNEL__
7#include <linux/ip.h> 8#include <linux/ip.h>
diff --git a/include/linux/if_x25.h b/include/linux/if_x25.h
new file mode 100644
index 000000000000..897765f5feb8
--- /dev/null
+++ b/include/linux/if_x25.h
@@ -0,0 +1,26 @@
1/*
2 * Linux X.25 packet to device interface
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _IF_X25_H
16#define _IF_X25_H
17
18#include <linux/types.h>
19
20/* Documentation/networking/x25-iface.txt */
21#define X25_IFACE_DATA 0x00
22#define X25_IFACE_CONNECT 0x01
23#define X25_IFACE_DISCONNECT 0x02
24#define X25_IFACE_PARAMS 0x03
25
26#endif /* _IF_X25_H */
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 724c27e5d173..93fc2449af10 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -153,6 +153,7 @@ extern int sysctl_igmp_max_msf;
153struct ip_sf_socklist { 153struct ip_sf_socklist {
154 unsigned int sl_max; 154 unsigned int sl_max;
155 unsigned int sl_count; 155 unsigned int sl_count;
156 struct rcu_head rcu;
156 __be32 sl_addr[0]; 157 __be32 sl_addr[0];
157}; 158};
158 159
@@ -170,6 +171,7 @@ struct ip_mc_socklist {
170 struct ip_mreqn multi; 171 struct ip_mreqn multi;
171 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ 172 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
172 struct ip_sf_socklist *sflist; 173 struct ip_sf_socklist *sflist;
174 struct rcu_head rcu;
173}; 175};
174 176
175struct ip_sf_list { 177struct ip_sf_list {
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 99dc6d5cf7e5..975837e7d6c0 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -17,7 +17,7 @@ struct linux_binprm;
17extern int ima_bprm_check(struct linux_binprm *bprm); 17extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_inode_alloc(struct inode *inode); 18extern int ima_inode_alloc(struct inode *inode);
19extern void ima_inode_free(struct inode *inode); 19extern void ima_inode_free(struct inode *inode);
20extern int ima_path_check(struct path *path, int mask); 20extern int ima_file_check(struct file *file, int mask);
21extern void ima_file_free(struct file *file); 21extern void ima_file_free(struct file *file);
22extern int ima_file_mmap(struct file *file, unsigned long prot); 22extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern void ima_counts_get(struct file *file); 23extern void ima_counts_get(struct file *file);
@@ -38,7 +38,7 @@ static inline void ima_inode_free(struct inode *inode)
38 return; 38 return;
39} 39}
40 40
41static inline int ima_path_check(struct path *path, int mask) 41static inline int ima_file_check(struct file *file, int mask)
42{ 42{
43 return 0; 43 return 0;
44} 44}
diff --git a/include/linux/in.h b/include/linux/in.h
index b615649db129..583c76f9c30f 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -84,6 +84,8 @@ struct in_addr {
84#define IP_ORIGDSTADDR 20 84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR 85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86 86
87#define IP_MINTTL 21
88
87/* IP_MTU_DISCOVER values */ 89/* IP_MTU_DISCOVER values */
88#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 90#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
89#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 91#define IP_PMTUDISC_WANT 1 /* Use per route hints */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index bd55c6e46b2e..c4bf46f764bf 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -221,10 +221,10 @@ struct in6_flowlabel_req {
221#define IPV6_RTHDR 57 221#define IPV6_RTHDR 57
222#define IPV6_RECVDSTOPTS 58 222#define IPV6_RECVDSTOPTS 58
223#define IPV6_DSTOPTS 59 223#define IPV6_DSTOPTS 59
224#if 0 /* not yet */
225#define IPV6_RECVPATHMTU 60 224#define IPV6_RECVPATHMTU 60
226#define IPV6_PATHMTU 61 225#define IPV6_PATHMTU 61
227#define IPV6_DONTFRAG 62 226#define IPV6_DONTFRAG 62
227#if 0 /* not yet */
228#define IPV6_USE_MIN_MTU 63 228#define IPV6_USE_MIN_MTU 63
229#endif 229#endif
230 230
@@ -265,6 +265,9 @@ struct in6_flowlabel_req {
265#define IPV6_PREFER_SRC_CGA 0x0008 265#define IPV6_PREFER_SRC_CGA 0x0008
266#define IPV6_PREFER_SRC_NONCGA 0x0800 266#define IPV6_PREFER_SRC_NONCGA 0x0800
267 267
268/* RFC5082: Generalized Ttl Security Mechanism */
269#define IPV6_MINHOPCOUNT 73
270
268/* 271/*
269 * Multicast Routing: 272 * Multicast Routing:
270 * see include/linux/mroute6.h. 273 * see include/linux/mroute6.h.
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index b2304929434e..2be1a1a2beb9 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -10,10 +10,40 @@
10#include <linux/timer.h> 10#include <linux/timer.h>
11#include <linux/sysctl.h> 11#include <linux/sysctl.h>
12 12
13enum
14{
15 IPV4_DEVCONF_FORWARDING=1,
16 IPV4_DEVCONF_MC_FORWARDING,
17 IPV4_DEVCONF_PROXY_ARP,
18 IPV4_DEVCONF_ACCEPT_REDIRECTS,
19 IPV4_DEVCONF_SECURE_REDIRECTS,
20 IPV4_DEVCONF_SEND_REDIRECTS,
21 IPV4_DEVCONF_SHARED_MEDIA,
22 IPV4_DEVCONF_RP_FILTER,
23 IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE,
24 IPV4_DEVCONF_BOOTP_RELAY,
25 IPV4_DEVCONF_LOG_MARTIANS,
26 IPV4_DEVCONF_TAG,
27 IPV4_DEVCONF_ARPFILTER,
28 IPV4_DEVCONF_MEDIUM_ID,
29 IPV4_DEVCONF_NOXFRM,
30 IPV4_DEVCONF_NOPOLICY,
31 IPV4_DEVCONF_FORCE_IGMP_VERSION,
32 IPV4_DEVCONF_ARP_ANNOUNCE,
33 IPV4_DEVCONF_ARP_IGNORE,
34 IPV4_DEVCONF_PROMOTE_SECONDARIES,
35 IPV4_DEVCONF_ARP_ACCEPT,
36 IPV4_DEVCONF_ARP_NOTIFY,
37 IPV4_DEVCONF_ACCEPT_LOCAL,
38 IPV4_DEVCONF_SRC_VMARK,
39 IPV4_DEVCONF_PROXY_ARP_PVLAN,
40 __IPV4_DEVCONF_MAX
41};
42
13struct ipv4_devconf { 43struct ipv4_devconf {
14 void *sysctl; 44 void *sysctl;
15 int data[__NET_IPV4_CONF_MAX - 1]; 45 int data[__IPV4_DEVCONF_MAX - 1];
16 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); 46 DECLARE_BITMAP(state, __IPV4_DEVCONF_MAX - 1);
17}; 47};
18 48
19struct in_device { 49struct in_device {
@@ -40,7 +70,7 @@ struct in_device {
40 struct rcu_head rcu_head; 70 struct rcu_head rcu_head;
41}; 71};
42 72
43#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) 73#define IPV4_DEVCONF(cnf, attr) ((cnf).data[IPV4_DEVCONF_ ## attr - 1])
44#define IPV4_DEVCONF_ALL(net, attr) \ 74#define IPV4_DEVCONF_ALL(net, attr) \
45 IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) 75 IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)
46 76
@@ -60,13 +90,13 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
60 90
61static inline void ipv4_devconf_setall(struct in_device *in_dev) 91static inline void ipv4_devconf_setall(struct in_device *in_dev)
62{ 92{
63 bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1); 93 bitmap_fill(in_dev->cnf.state, __IPV4_DEVCONF_MAX - 1);
64} 94}
65 95
66#define IN_DEV_CONF_GET(in_dev, attr) \ 96#define IN_DEV_CONF_GET(in_dev, attr) \
67 ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr) 97 ipv4_devconf_get((in_dev), IPV4_DEVCONF_ ## attr)
68#define IN_DEV_CONF_SET(in_dev, attr, val) \ 98#define IN_DEV_CONF_SET(in_dev, attr, val) \
69 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) 99 ipv4_devconf_set((in_dev), IPV4_DEVCONF_ ## attr, (val))
70 100
71#define IN_DEV_ANDCONF(in_dev, attr) \ 101#define IN_DEV_ANDCONF(in_dev, attr) \
72 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ 102 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
@@ -89,6 +119,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
89 119
90#define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS) 120#define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS)
91#define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP) 121#define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP)
122#define IN_DEV_PROXY_ARP_PVLAN(in_dev) IN_DEV_CONF_GET(in_dev, PROXY_ARP_PVLAN)
92#define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA) 123#define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA)
93#define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS) 124#define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS)
94#define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \ 125#define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index f00253b3fc47..1f43fa56f600 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -16,7 +16,7 @@ extern struct files_struct init_files;
16extern struct fs_struct init_fs; 16extern struct fs_struct init_fs;
17 17
18#define INIT_SIGNALS(sig) { \ 18#define INIT_SIGNALS(sig) { \
19 .count = ATOMIC_INIT(1), \ 19 .nr_threads = 1, \
20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
21 .shared_pending = { \ 21 .shared_pending = { \
22 .list = LIST_HEAD_INIT(sig.shared_pending.list), \ 22 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
@@ -32,18 +32,10 @@ extern struct fs_struct init_fs;
32} 32}
33 33
34extern struct nsproxy init_nsproxy; 34extern struct nsproxy init_nsproxy;
35#define INIT_NSPROXY(nsproxy) { \
36 .pid_ns = &init_pid_ns, \
37 .count = ATOMIC_INIT(1), \
38 .uts_ns = &init_uts_ns, \
39 .mnt_ns = NULL, \
40 INIT_NET_NS(net_ns) \
41 INIT_IPC_NS(ipc_ns) \
42}
43 35
44#define INIT_SIGHAND(sighand) { \ 36#define INIT_SIGHAND(sighand) { \
45 .count = ATOMIC_INIT(1), \ 37 .count = ATOMIC_INIT(1), \
46 .action = { { { .sa_handler = NULL, } }, }, \ 38 .action = { { { .sa_handler = SIG_DFL, } }, }, \
47 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \ 39 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
48 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \ 40 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
49} 41}
@@ -53,11 +45,10 @@ extern struct group_info init_groups;
53#define INIT_STRUCT_PID { \ 45#define INIT_STRUCT_PID { \
54 .count = ATOMIC_INIT(1), \ 46 .count = ATOMIC_INIT(1), \
55 .tasks = { \ 47 .tasks = { \
56 { .first = &init_task.pids[PIDTYPE_PID].node }, \ 48 { .first = NULL }, \
57 { .first = &init_task.pids[PIDTYPE_PGID].node }, \ 49 { .first = NULL }, \
58 { .first = &init_task.pids[PIDTYPE_SID].node }, \ 50 { .first = NULL }, \
59 }, \ 51 }, \
60 .rcu = RCU_HEAD_INIT, \
61 .level = 0, \ 52 .level = 0, \
62 .numbers = { { \ 53 .numbers = { { \
63 .nr = 0, \ 54 .nr = 0, \
@@ -70,7 +61,7 @@ extern struct group_info init_groups;
70{ \ 61{ \
71 .node = { \ 62 .node = { \
72 .next = NULL, \ 63 .next = NULL, \
73 .pprev = &init_struct_pid.tasks[type].first, \ 64 .pprev = NULL, \
74 }, \ 65 }, \
75 .pid = &init_struct_pid, \ 66 .pid = &init_struct_pid, \
76} 67}
@@ -172,6 +163,7 @@ extern struct cred init_cred;
172 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ 163 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
173 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 164 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
174 }, \ 165 }, \
166 .thread_group = LIST_HEAD_INIT(tsk.thread_group), \
175 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 167 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
176 INIT_IDS \ 168 INIT_IDS \
177 INIT_PERF_EVENTS(tsk) \ 169 INIT_PERF_EVENTS(tsk) \
diff --git a/include/linux/input.h b/include/linux/input.h
index 735ceaf1bc2d..6fcc9101beeb 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -58,10 +58,10 @@ struct input_absinfo {
58 58
59#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ 59#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
60#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ 60#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
61#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ 61#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
62#define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ 62#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
63#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ 63#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
64#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ 64#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
65 65
66#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 66#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
67#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ 67#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
@@ -376,8 +376,9 @@ struct input_absinfo {
376#define KEY_DISPLAY_OFF 245 /* display device to off state */ 376#define KEY_DISPLAY_OFF 245 /* display device to off state */
377 377
378#define KEY_WIMAX 246 378#define KEY_WIMAX 246
379#define KEY_RFKILL 247 /* Key that controls all radios */
379 380
380/* Range 248 - 255 is reserved for special needs of AT keyboard driver */ 381/* Code 255 is reserved for special needs of AT keyboard driver */
381 382
382#define BTN_MISC 0x100 383#define BTN_MISC 0x100
383#define BTN_0 0x100 384#define BTN_0 0x100
@@ -596,6 +597,49 @@ struct input_absinfo {
596#define KEY_NUMERIC_POUND 0x20b 597#define KEY_NUMERIC_POUND 0x20b
597 598
598#define KEY_CAMERA_FOCUS 0x210 599#define KEY_CAMERA_FOCUS 0x210
600#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
601
602#define BTN_TRIGGER_HAPPY 0x2c0
603#define BTN_TRIGGER_HAPPY1 0x2c0
604#define BTN_TRIGGER_HAPPY2 0x2c1
605#define BTN_TRIGGER_HAPPY3 0x2c2
606#define BTN_TRIGGER_HAPPY4 0x2c3
607#define BTN_TRIGGER_HAPPY5 0x2c4
608#define BTN_TRIGGER_HAPPY6 0x2c5
609#define BTN_TRIGGER_HAPPY7 0x2c6
610#define BTN_TRIGGER_HAPPY8 0x2c7
611#define BTN_TRIGGER_HAPPY9 0x2c8
612#define BTN_TRIGGER_HAPPY10 0x2c9
613#define BTN_TRIGGER_HAPPY11 0x2ca
614#define BTN_TRIGGER_HAPPY12 0x2cb
615#define BTN_TRIGGER_HAPPY13 0x2cc
616#define BTN_TRIGGER_HAPPY14 0x2cd
617#define BTN_TRIGGER_HAPPY15 0x2ce
618#define BTN_TRIGGER_HAPPY16 0x2cf
619#define BTN_TRIGGER_HAPPY17 0x2d0
620#define BTN_TRIGGER_HAPPY18 0x2d1
621#define BTN_TRIGGER_HAPPY19 0x2d2
622#define BTN_TRIGGER_HAPPY20 0x2d3
623#define BTN_TRIGGER_HAPPY21 0x2d4
624#define BTN_TRIGGER_HAPPY22 0x2d5
625#define BTN_TRIGGER_HAPPY23 0x2d6
626#define BTN_TRIGGER_HAPPY24 0x2d7
627#define BTN_TRIGGER_HAPPY25 0x2d8
628#define BTN_TRIGGER_HAPPY26 0x2d9
629#define BTN_TRIGGER_HAPPY27 0x2da
630#define BTN_TRIGGER_HAPPY28 0x2db
631#define BTN_TRIGGER_HAPPY29 0x2dc
632#define BTN_TRIGGER_HAPPY30 0x2dd
633#define BTN_TRIGGER_HAPPY31 0x2de
634#define BTN_TRIGGER_HAPPY32 0x2df
635#define BTN_TRIGGER_HAPPY33 0x2e0
636#define BTN_TRIGGER_HAPPY34 0x2e1
637#define BTN_TRIGGER_HAPPY35 0x2e2
638#define BTN_TRIGGER_HAPPY36 0x2e3
639#define BTN_TRIGGER_HAPPY37 0x2e4
640#define BTN_TRIGGER_HAPPY38 0x2e5
641#define BTN_TRIGGER_HAPPY39 0x2e6
642#define BTN_TRIGGER_HAPPY40 0x2e7
599 643
600/* We avoid low common keys in module aliases so they don't get huge. */ 644/* We avoid low common keys in module aliases so they don't get huge. */
601#define KEY_MIN_INTERESTING KEY_MUTE 645#define KEY_MIN_INTERESTING KEY_MUTE
@@ -762,6 +806,7 @@ struct input_absinfo {
762#define BUS_HOST 0x19 806#define BUS_HOST 0x19
763#define BUS_GSC 0x1A 807#define BUS_GSC 0x1A
764#define BUS_ATARI 0x1B 808#define BUS_ATARI 0x1B
809#define BUS_SPI 0x1C
765 810
766/* 811/*
767 * MT_TOOL types 812 * MT_TOOL types
@@ -1098,8 +1143,10 @@ struct input_dev {
1098 unsigned int keycodemax; 1143 unsigned int keycodemax;
1099 unsigned int keycodesize; 1144 unsigned int keycodesize;
1100 void *keycode; 1145 void *keycode;
1101 int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); 1146 int (*setkeycode)(struct input_dev *dev,
1102 int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); 1147 unsigned int scancode, unsigned int keycode);
1148 int (*getkeycode)(struct input_dev *dev,
1149 unsigned int scancode, unsigned int *keycode);
1103 1150
1104 struct ff_device *ff; 1151 struct ff_device *ff;
1105 1152
@@ -1108,7 +1155,7 @@ struct input_dev {
1108 1155
1109 int sync; 1156 int sync;
1110 1157
1111 int abs[ABS_MAX + 1]; 1158 int abs[ABS_CNT];
1112 int rep[REP_MAX + 1]; 1159 int rep[REP_MAX + 1];
1113 1160
1114 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1161 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
@@ -1116,11 +1163,11 @@ struct input_dev {
1116 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1163 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1117 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1164 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1118 1165
1119 int absmax[ABS_MAX + 1]; 1166 int absmax[ABS_CNT];
1120 int absmin[ABS_MAX + 1]; 1167 int absmin[ABS_CNT];
1121 int absfuzz[ABS_MAX + 1]; 1168 int absfuzz[ABS_CNT];
1122 int absflat[ABS_MAX + 1]; 1169 int absflat[ABS_CNT];
1123 int absres[ABS_MAX + 1]; 1170 int absres[ABS_CNT];
1124 1171
1125 int (*open)(struct input_dev *dev); 1172 int (*open)(struct input_dev *dev);
1126 void (*close)(struct input_dev *dev); 1173 void (*close)(struct input_dev *dev);
@@ -1199,6 +1246,10 @@ struct input_handle;
1199 * @event: event handler. This method is being called by input core with 1246 * @event: event handler. This method is being called by input core with
1200 * interrupts disabled and dev->event_lock spinlock held and so 1247 * interrupts disabled and dev->event_lock spinlock held and so
1201 * it may not sleep 1248 * it may not sleep
1249 * @filter: similar to @event; separates normal event handlers from
1250 * "filters".
1251 * @match: called after comparing device's id with handler's id_table
1252 * to perform fine-grained matching between device and handler
1202 * @connect: called when attaching a handler to an input device 1253 * @connect: called when attaching a handler to an input device
1203 * @disconnect: disconnects a handler from input device 1254 * @disconnect: disconnects a handler from input device
1204 * @start: starts handler for given handle. This function is called by 1255 * @start: starts handler for given handle. This function is called by
@@ -1210,8 +1261,6 @@ struct input_handle;
1210 * @name: name of the handler, to be shown in /proc/bus/input/handlers 1261 * @name: name of the handler, to be shown in /proc/bus/input/handlers
1211 * @id_table: pointer to a table of input_device_ids this driver can 1262 * @id_table: pointer to a table of input_device_ids this driver can
1212 * handle 1263 * handle
1213 * @blacklist: pointer to a table of input_device_ids this driver should
1214 * ignore even if they match @id_table
1215 * @h_list: list of input handles associated with the handler 1264 * @h_list: list of input handles associated with the handler
1216 * @node: for placing the driver onto input_handler_list 1265 * @node: for placing the driver onto input_handler_list
1217 * 1266 *
@@ -1220,6 +1269,11 @@ struct input_handle;
1220 * same time. All of them will get their copy of input event generated by 1269 * same time. All of them will get their copy of input event generated by
1221 * the device. 1270 * the device.
1222 * 1271 *
1272 * The very same structure is used to implement input filters. Input core
1273 * allows filters to run first and will not pass event to regular handlers
1274 * if any of the filters indicate that the event should be filtered (by
1275 * returning %true from their filter() method).
1276 *
1223 * Note that input core serializes calls to connect() and disconnect() 1277 * Note that input core serializes calls to connect() and disconnect()
1224 * methods. 1278 * methods.
1225 */ 1279 */
@@ -1228,6 +1282,8 @@ struct input_handler {
1228 void *private; 1282 void *private;
1229 1283
1230 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1284 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1285 bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1286 bool (*match)(struct input_handler *handler, struct input_dev *dev);
1231 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); 1287 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1232 void (*disconnect)(struct input_handle *handle); 1288 void (*disconnect)(struct input_handle *handle);
1233 void (*start)(struct input_handle *handle); 1289 void (*start)(struct input_handle *handle);
@@ -1237,7 +1293,6 @@ struct input_handler {
1237 const char *name; 1293 const char *name;
1238 1294
1239 const struct input_device_id *id_table; 1295 const struct input_device_id *id_table;
1240 const struct input_device_id *blacklist;
1241 1296
1242 struct list_head h_list; 1297 struct list_head h_list;
1243 struct list_head node; 1298 struct list_head node;
@@ -1363,8 +1418,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1363 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1418 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
1364} 1419}
1365 1420
1366int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); 1421int input_get_keycode(struct input_dev *dev,
1367int input_set_keycode(struct input_dev *dev, int scancode, int keycode); 1422 unsigned int scancode, unsigned int *keycode);
1423int input_set_keycode(struct input_dev *dev,
1424 unsigned int scancode, unsigned int keycode);
1368 1425
1369extern struct class input_class; 1426extern struct class input_class;
1370 1427
diff --git a/include/linux/input/ad714x.h b/include/linux/input/ad714x.h
new file mode 100644
index 000000000000..0cbe5e81482e
--- /dev/null
+++ b/include/linux/input/ad714x.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/input/ad714x.h
3 *
4 * AD714x is very flexible, it can be used as buttons, scrollwheel,
5 * slider, touchpad at the same time. That depends on the boards.
6 * The platform_data for the device's "struct device" holds this
7 * information.
8 *
9 * Copyright 2009 Analog Devices Inc.
10 *
11 * Licensed under the GPL-2 or later.
12 */
13
14#ifndef __LINUX_INPUT_AD714X_H__
15#define __LINUX_INPUT_AD714X_H__
16
17#define STAGE_NUM 12
18#define STAGE_CFGREG_NUM 8
19#define SYS_CFGREG_NUM 8
20
21/* board information which need be initialized in arch/mach... */
22struct ad714x_slider_plat {
23 int start_stage;
24 int end_stage;
25 int max_coord;
26};
27
28struct ad714x_wheel_plat {
29 int start_stage;
30 int end_stage;
31 int max_coord;
32};
33
34struct ad714x_touchpad_plat {
35 int x_start_stage;
36 int x_end_stage;
37 int x_max_coord;
38
39 int y_start_stage;
40 int y_end_stage;
41 int y_max_coord;
42};
43
44struct ad714x_button_plat {
45 int keycode;
46 unsigned short l_mask;
47 unsigned short h_mask;
48};
49
50struct ad714x_platform_data {
51 int slider_num;
52 int wheel_num;
53 int touchpad_num;
54 int button_num;
55 struct ad714x_slider_plat *slider;
56 struct ad714x_wheel_plat *wheel;
57 struct ad714x_touchpad_plat *touchpad;
58 struct ad714x_button_plat *button;
59 unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
60 unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
61};
62
63#endif
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 3bd018baae20..c964cd7f436a 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -44,6 +44,7 @@ struct matrix_keymap_data {
44 * @active_low: gpio polarity 44 * @active_low: gpio polarity
45 * @wakeup: controls whether the device should be set up as wakeup 45 * @wakeup: controls whether the device should be set up as wakeup
46 * source 46 * source
47 * @no_autorepeat: disable key autorepeat
47 * 48 *
48 * This structure represents platform-specific data that use used by 49 * This structure represents platform-specific data that use used by
49 * matrix_keypad driver to perform proper initialization. 50 * matrix_keypad driver to perform proper initialization.
@@ -64,6 +65,7 @@ struct matrix_keypad_platform_data {
64 65
65 bool active_low; 66 bool active_low;
66 bool wakeup; 67 bool wakeup;
68 bool no_autorepeat;
67}; 69};
68 70
69/** 71/**
diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h
index c211b5cf08e6..649dc7f12925 100644
--- a/include/linux/input/sh_keysc.h
+++ b/include/linux/input/sh_keysc.h
@@ -1,14 +1,15 @@
1#ifndef __SH_KEYSC_H__ 1#ifndef __SH_KEYSC_H__
2#define __SH_KEYSC_H__ 2#define __SH_KEYSC_H__
3 3
4#define SH_KEYSC_MAXKEYS 30 4#define SH_KEYSC_MAXKEYS 49
5 5
6struct sh_keysc_info { 6struct sh_keysc_info {
7 enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode; 7 enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3,
8 SH_KEYSC_MODE_4, SH_KEYSC_MODE_5, SH_KEYSC_MODE_6 } mode;
8 int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ 9 int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
9 int delay; 10 int delay;
10 int kycr2_delay; 11 int kycr2_delay;
11 int keycodes[SH_KEYSC_MAXKEYS]; 12 int keycodes[SH_KEYSC_MAXKEYS]; /* KEYIN * KEYOUT */
12}; 13};
13 14
14#endif /* __SH_KEYSC_H__ */ 15#endif /* __SH_KEYSC_H__ */
diff --git a/include/linux/input/tps6507x-ts.h b/include/linux/input/tps6507x-ts.h
new file mode 100644
index 000000000000..ab1440313924
--- /dev/null
+++ b/include/linux/input/tps6507x-ts.h
@@ -0,0 +1,24 @@
1/* linux/i2c/tps6507x-ts.h
2 *
3 * Functions to access TPS65070 touch screen chip.
4 *
5 * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
6 *
7 *
8 * For licencing details see kernel-base/COPYING
9 */
10
11#ifndef __LINUX_I2C_TPS6507X_TS_H
12#define __LINUX_I2C_TPS6507X_TS_H
13
14/* Board specific touch screen initial values */
15struct touchscreen_init_data {
16 int poll_period; /* ms */
17 int vref; /* non-zero to leave vref on */
18 __u16 min_pressure; /* min reading to be treated as a touch */
19 __u16 vendor;
20 __u16 product;
21 __u16 version;
22};
23
24#endif /* __LINUX_I2C_TPS6507X_TS_H */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 75f3f00ac1e5..c2331138ca1b 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -39,7 +39,8 @@
39 * These flags used only by the kernel as part of the 39 * These flags used only by the kernel as part of the
40 * irq handling routines. 40 * irq handling routines.
41 * 41 *
42 * IRQF_DISABLED - keep irqs disabled when calling the action handler 42 * IRQF_DISABLED - keep irqs disabled when calling the action handler.
43 * DEPRECATED. This flag is a NOOP and scheduled to be removed
43 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator 44 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
44 * IRQF_SHARED - allow sharing the irq among several devices 45 * IRQF_SHARED - allow sharing the irq among several devices
45 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur 46 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
@@ -77,6 +78,18 @@ enum {
77 IRQTF_AFFINITY, 78 IRQTF_AFFINITY,
78}; 79};
79 80
81/*
82 * These values can be returned by request_any_context_irq() and
83 * describe the context the interrupt will be run in.
84 *
85 * IRQC_IS_HARDIRQ - interrupt runs in hardirq context
86 * IRQC_IS_NESTED - interrupt runs in a nested threaded context
87 */
88enum {
89 IRQC_IS_HARDIRQ = 0,
90 IRQC_IS_NESTED,
91};
92
80typedef irqreturn_t (*irq_handler_t)(int, void *); 93typedef irqreturn_t (*irq_handler_t)(int, void *);
81 94
82/** 95/**
@@ -120,6 +133,10 @@ request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
120 return request_threaded_irq(irq, handler, NULL, flags, name, dev); 133 return request_threaded_irq(irq, handler, NULL, flags, name, dev);
121} 134}
122 135
136extern int __must_check
137request_any_context_irq(unsigned int irq, irq_handler_t handler,
138 unsigned long flags, const char *name, void *dev_id);
139
123extern void exit_irq_thread(void); 140extern void exit_irq_thread(void);
124#else 141#else
125 142
@@ -141,6 +158,13 @@ request_threaded_irq(unsigned int irq, irq_handler_t handler,
141 return request_irq(irq, handler, flags, name, dev); 158 return request_irq(irq, handler, flags, name, dev);
142} 159}
143 160
161static inline int __must_check
162request_any_context_irq(unsigned int irq, irq_handler_t handler,
163 unsigned long flags, const char *name, void *dev_id)
164{
165 return request_irq(irq, handler, flags, name, dev_id);
166}
167
144static inline void exit_irq_thread(void) { } 168static inline void exit_irq_thread(void) { }
145#endif 169#endif
146 170
@@ -209,6 +233,7 @@ extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
209extern int irq_can_set_affinity(unsigned int irq); 233extern int irq_can_set_affinity(unsigned int irq);
210extern int irq_select_affinity(unsigned int irq); 234extern int irq_select_affinity(unsigned int irq);
211 235
236extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
212#else /* CONFIG_SMP */ 237#else /* CONFIG_SMP */
213 238
214static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 239static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -223,6 +248,11 @@ static inline int irq_can_set_affinity(unsigned int irq)
223 248
224static inline int irq_select_affinity(unsigned int irq) { return 0; } 249static inline int irq_select_affinity(unsigned int irq) { return 0; }
225 250
251static inline int irq_set_affinity_hint(unsigned int irq,
252 const struct cpumask *m)
253{
254 return -EINVAL;
255}
226#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 256#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
227 257
228#ifdef CONFIG_GENERIC_HARDIRQS 258#ifdef CONFIG_GENERIC_HARDIRQS
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 97eb928b4924..25085ddd955f 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -19,6 +19,7 @@
19#define _LINUX_IO_MAPPING_H 19#define _LINUX_IO_MAPPING_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/slab.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/iomap.h> 25#include <asm/iomap.h>
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 78ef023227d4..64d529133031 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -7,7 +7,6 @@
7struct cfq_queue; 7struct cfq_queue;
8struct cfq_io_context { 8struct cfq_io_context {
9 void *key; 9 void *key;
10 unsigned long dead_key;
11 10
12 struct cfq_queue *cfqq[2]; 11 struct cfq_queue *cfqq[2];
13 12
@@ -42,15 +41,15 @@ struct io_context {
42 unsigned short ioprio; 41 unsigned short ioprio;
43 unsigned short ioprio_changed; 42 unsigned short ioprio_changed;
44 43
45#ifdef CONFIG_BLK_CGROUP 44#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
46 unsigned short cgroup_changed; 45 unsigned short cgroup_changed;
47#endif 46#endif
48 47
49 /* 48 /*
50 * For request batching 49 * For request batching
51 */ 50 */
52 unsigned long last_waited; /* Time last woken after wait for request */
53 int nr_batch_requests; /* Number of requests left in the batch */ 51 int nr_batch_requests; /* Number of requests left in the batch */
52 unsigned long last_waited; /* Time last woken after wait for request */
54 53
55 struct radix_tree_root radix_root; 54 struct radix_tree_root radix_root;
56 struct hlist_head cic_list; 55 struct hlist_head cic_list;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 3af4ffd591b9..be22ad83689c 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -37,9 +37,9 @@ struct iommu_ops {
37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
39 int (*map)(struct iommu_domain *domain, unsigned long iova, 39 int (*map)(struct iommu_domain *domain, unsigned long iova,
40 phys_addr_t paddr, size_t size, int prot); 40 phys_addr_t paddr, int gfp_order, int prot);
41 void (*unmap)(struct iommu_domain *domain, unsigned long iova, 41 int (*unmap)(struct iommu_domain *domain, unsigned long iova,
42 size_t size); 42 int gfp_order);
43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
44 unsigned long iova); 44 unsigned long iova);
45 int (*domain_has_cap)(struct iommu_domain *domain, 45 int (*domain_has_cap)(struct iommu_domain *domain,
@@ -56,10 +56,10 @@ extern int iommu_attach_device(struct iommu_domain *domain,
56 struct device *dev); 56 struct device *dev);
57extern void iommu_detach_device(struct iommu_domain *domain, 57extern void iommu_detach_device(struct iommu_domain *domain,
58 struct device *dev); 58 struct device *dev);
59extern int iommu_map_range(struct iommu_domain *domain, unsigned long iova, 59extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
60 phys_addr_t paddr, size_t size, int prot); 60 phys_addr_t paddr, int gfp_order, int prot);
61extern void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova, 61extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
62 size_t size); 62 int gfp_order);
63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
64 unsigned long iova); 64 unsigned long iova);
65extern int iommu_domain_has_cap(struct iommu_domain *domain, 65extern int iommu_domain_has_cap(struct iommu_domain *domain,
@@ -96,16 +96,16 @@ static inline void iommu_detach_device(struct iommu_domain *domain,
96{ 96{
97} 97}
98 98
99static inline int iommu_map_range(struct iommu_domain *domain, 99static inline int iommu_map(struct iommu_domain *domain, unsigned long iova,
100 unsigned long iova, phys_addr_t paddr, 100 phys_addr_t paddr, int gfp_order, int prot)
101 size_t size, int prot)
102{ 101{
103 return -ENODEV; 102 return -ENODEV;
104} 103}
105 104
106static inline void iommu_unmap_range(struct iommu_domain *domain, 105static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
107 unsigned long iova, size_t size) 106 int gfp_order)
108{ 107{
108 return -ENODEV;
109} 109}
110 110
111static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 111static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 7129504e053d..b22790268b64 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -34,22 +34,25 @@ struct resource_list {
34 */ 34 */
35#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 35#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
36 36
37#define IORESOURCE_TYPE_BITS 0x00000f00 /* Resource type */ 37#define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */
38#define IORESOURCE_IO 0x00000100 38#define IORESOURCE_IO 0x00000100
39#define IORESOURCE_MEM 0x00000200 39#define IORESOURCE_MEM 0x00000200
40#define IORESOURCE_IRQ 0x00000400 40#define IORESOURCE_IRQ 0x00000400
41#define IORESOURCE_DMA 0x00000800 41#define IORESOURCE_DMA 0x00000800
42#define IORESOURCE_BUS 0x00001000
42 43
43#define IORESOURCE_PREFETCH 0x00001000 /* No side effects */ 44#define IORESOURCE_PREFETCH 0x00002000 /* No side effects */
44#define IORESOURCE_READONLY 0x00002000 45#define IORESOURCE_READONLY 0x00004000
45#define IORESOURCE_CACHEABLE 0x00004000 46#define IORESOURCE_CACHEABLE 0x00008000
46#define IORESOURCE_RANGELENGTH 0x00008000 47#define IORESOURCE_RANGELENGTH 0x00010000
47#define IORESOURCE_SHADOWABLE 0x00010000 48#define IORESOURCE_SHADOWABLE 0x00020000
48 49
49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ 50#define IORESOURCE_SIZEALIGN 0x00040000 /* size indicates alignment */
50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ 51#define IORESOURCE_STARTALIGN 0x00080000 /* start field is alignment */
51 52
52#define IORESOURCE_MEM_64 0x00100000 53#define IORESOURCE_MEM_64 0x00100000
54#define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */
55#define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */
53 56
54#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 57#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
55#define IORESOURCE_DISABLED 0x10000000 58#define IORESOURCE_DISABLED 0x10000000
@@ -110,18 +113,23 @@ struct resource_list {
110extern struct resource ioport_resource; 113extern struct resource ioport_resource;
111extern struct resource iomem_resource; 114extern struct resource iomem_resource;
112 115
116extern struct resource *request_resource_conflict(struct resource *root, struct resource *new);
113extern int request_resource(struct resource *root, struct resource *new); 117extern int request_resource(struct resource *root, struct resource *new);
114extern int release_resource(struct resource *new); 118extern int release_resource(struct resource *new);
119void release_child_resources(struct resource *new);
115extern void reserve_region_with_split(struct resource *root, 120extern void reserve_region_with_split(struct resource *root,
116 resource_size_t start, resource_size_t end, 121 resource_size_t start, resource_size_t end,
117 const char *name); 122 const char *name);
123extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new);
118extern int insert_resource(struct resource *parent, struct resource *new); 124extern int insert_resource(struct resource *parent, struct resource *new);
119extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 125extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
120extern int allocate_resource(struct resource *root, struct resource *new, 126extern int allocate_resource(struct resource *root, struct resource *new,
121 resource_size_t size, resource_size_t min, 127 resource_size_t size, resource_size_t min,
122 resource_size_t max, resource_size_t align, 128 resource_size_t max, resource_size_t align,
123 void (*alignf)(void *, struct resource *, 129 resource_size_t (*alignf)(void *,
124 resource_size_t, resource_size_t), 130 const struct resource *,
131 resource_size_t,
132 resource_size_t),
125 void *alignf_data); 133 void *alignf_data);
126int adjust_resource(struct resource *res, resource_size_t start, 134int adjust_resource(struct resource *res, resource_size_t start,
127 resource_size_t size); 135 resource_size_t size);
@@ -136,7 +144,8 @@ static inline unsigned long resource_type(const struct resource *res)
136} 144}
137 145
138/* Convenience shorthand with allocation */ 146/* Convenience shorthand with allocation */
139#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 147#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
148#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
140#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) 149#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
141#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) 150#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
142#define request_mem_region_exclusive(start,n,name) \ 151#define request_mem_region_exclusive(start,n,name) \
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 07baa38bce37..51952989ad42 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -62,11 +62,6 @@ extern struct ipc_namespace init_ipc_ns;
62extern atomic_t nr_ipc_ns; 62extern atomic_t nr_ipc_ns;
63 63
64extern spinlock_t mq_lock; 64extern spinlock_t mq_lock;
65#if defined(CONFIG_POSIX_MQUEUE) || defined(CONFIG_SYSVIPC)
66#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
67#else
68#define INIT_IPC_NS(ns)
69#endif
70 65
71#ifdef CONFIG_SYSVIPC 66#ifdef CONFIG_SYSVIPC
72extern int register_ipcns_notifier(struct ipc_namespace *); 67extern int register_ipcns_notifier(struct ipc_namespace *);
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index f7c9c75a2775..4b48318ac542 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -39,7 +39,6 @@
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/platform_device.h> 41#include <linux/platform_device.h>
42#include <linux/ipmi_smi.h>
43 42
44/* This files describes the interface for IPMI system management interface 43/* This files describes the interface for IPMI system management interface
45 drivers to bind into the IPMI message handler. */ 44 drivers to bind into the IPMI message handler. */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0cc9a7db2b5..99e1ab7e3eec 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -21,6 +21,10 @@ struct in6_pktinfo {
21 int ipi6_ifindex; 21 int ipi6_ifindex;
22}; 22};
23 23
24struct ip6_mtuinfo {
25 struct sockaddr_in6 ip6m_addr;
26 __u32 ip6m_mtu;
27};
24 28
25struct in6_ifreq { 29struct in6_ifreq {
26 struct in6_addr ifr6_addr; 30 struct in6_addr ifr6_addr;
@@ -250,9 +254,11 @@ struct inet6_skb_parm {
250 254
251#define IP6SKB_XFRM_TRANSFORMED 1 255#define IP6SKB_XFRM_TRANSFORMED 1
252#define IP6SKB_FORWARDED 2 256#define IP6SKB_FORWARDED 2
257#define IP6SKB_REROUTED 4
253}; 258};
254 259
255#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 260#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
261#define IP6CBMTU(skb) ((struct ip6_mtuinfo *)((skb)->cb))
256 262
257static inline int inet6_iif(const struct sk_buff *skb) 263static inline int inet6_iif(const struct sk_buff *skb)
258{ 264{
@@ -334,21 +340,25 @@ struct ipv6_pinfo {
334 dstopts:1, 340 dstopts:1,
335 odstopts:1, 341 odstopts:1,
336 rxflow:1, 342 rxflow:1,
337 rxtclass:1; 343 rxtclass:1,
344 rxpmtu:1;
338 } bits; 345 } bits;
339 __u16 all; 346 __u16 all;
340 } rxopt; 347 } rxopt;
341 348
342 /* sockopt flags */ 349 /* sockopt flags */
343 __u8 recverr:1, 350 __u16 recverr:1,
344 sndflow:1, 351 sndflow:1,
345 pmtudisc:2, 352 pmtudisc:2,
346 ipv6only:1, 353 ipv6only:1,
347 srcprefs:3; /* 001: prefer temporary address 354 srcprefs:3, /* 001: prefer temporary address
348 * 010: prefer public address 355 * 010: prefer public address
349 * 100: prefer care-of address 356 * 100: prefer care-of address
350 */ 357 */
358 dontfrag:1;
359 __u8 min_hopcount;
351 __u8 tclass; 360 __u8 tclass;
361 __u8 padding;
352 362
353 __u32 dst_cookie; 363 __u32 dst_cookie;
354 364
@@ -358,6 +368,7 @@ struct ipv6_pinfo {
358 368
359 struct ipv6_txoptions *opt; 369 struct ipv6_txoptions *opt;
360 struct sk_buff *pktoptions; 370 struct sk_buff *pktoptions;
371 struct sk_buff *rxpmtu;
361 struct { 372 struct {
362 struct ipv6_txoptions *opt; 373 struct ipv6_txoptions *opt;
363 u8 hop_limit; 374 u8 hop_limit;
@@ -372,6 +383,7 @@ struct raw6_sock {
372 __u32 checksum; /* perform checksum */ 383 __u32 checksum; /* perform checksum */
373 __u32 offset; /* checksum offset */ 384 __u32 offset; /* checksum offset */
374 struct icmp6_filter filter; 385 struct icmp6_filter filter;
386 __u32 ip6mr_table;
375 /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */ 387 /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */
376 struct ipv6_pinfo inet6; 388 struct ipv6_pinfo inet6;
377}; 389};
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 451481c082b5..c03243ad84b4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -90,7 +90,7 @@ struct msi_desc;
90 * @startup: start up the interrupt (defaults to ->enable if NULL) 90 * @startup: start up the interrupt (defaults to ->enable if NULL)
91 * @shutdown: shut down the interrupt (defaults to ->disable if NULL) 91 * @shutdown: shut down the interrupt (defaults to ->disable if NULL)
92 * @enable: enable the interrupt (defaults to chip->unmask if NULL) 92 * @enable: enable the interrupt (defaults to chip->unmask if NULL)
93 * @disable: disable the interrupt (defaults to chip->mask if NULL) 93 * @disable: disable the interrupt
94 * @ack: start of a new interrupt 94 * @ack: start of a new interrupt
95 * @mask: mask an interrupt source 95 * @mask: mask an interrupt source
96 * @mask_ack: ack and mask an interrupt source 96 * @mask_ack: ack and mask an interrupt source
@@ -195,6 +195,7 @@ struct irq_desc {
195 raw_spinlock_t lock; 195 raw_spinlock_t lock;
196#ifdef CONFIG_SMP 196#ifdef CONFIG_SMP
197 cpumask_var_t affinity; 197 cpumask_var_t affinity;
198 const struct cpumask *affinity_hint;
198 unsigned int node; 199 unsigned int node;
199#ifdef CONFIG_GENERIC_PENDING_IRQ 200#ifdef CONFIG_GENERIC_PENDING_IRQ
200 cpumask_var_t pending_mask; 201 cpumask_var_t pending_mask;
@@ -400,7 +401,9 @@ static inline int irq_has_action(unsigned int irq)
400 401
401/* Dynamic irq helper functions */ 402/* Dynamic irq helper functions */
402extern void dynamic_irq_init(unsigned int irq); 403extern void dynamic_irq_init(unsigned int irq);
404void dynamic_irq_init_keep_chip_data(unsigned int irq);
403extern void dynamic_irq_cleanup(unsigned int irq); 405extern void dynamic_irq_cleanup(unsigned int irq);
406void dynamic_irq_cleanup_keep_chip_data(unsigned int irq);
404 407
405/* Set/get chip/data for an IRQ: */ 408/* Set/get chip/data for an IRQ: */
406extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); 409extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index cd5a269fdb5e..e2d28b026a8c 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -43,10 +43,10 @@
43 */ 43 */
44 44
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/mod_devicetable.h>
46 47
47#define DEVICE_COUNT_COMPATIBLE 4 48#define DEVICE_COUNT_COMPATIBLE 4
48 49
49#define ISAPNP_ANY_ID 0xffff
50#define ISAPNP_CARD_DEVS 8 50#define ISAPNP_CARD_DEVS 8
51 51
52#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \ 52#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \
@@ -74,12 +74,6 @@ struct isapnp_card_id {
74#define ISAPNP_DEVICE_SINGLE_END \ 74#define ISAPNP_DEVICE_SINGLE_END \
75 .card_vendor = 0, .card_device = 0 75 .card_vendor = 0, .card_device = 0
76 76
77struct isapnp_device_id {
78 unsigned short card_vendor, card_device;
79 unsigned short vendor, function;
80 unsigned long driver_data; /* data private to the driver */
81};
82
83#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) 77#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
84 78
85#define __ISAPNP__ 79#define __ISAPNP__
diff --git a/include/linux/iscsi_ibft.h b/include/linux/iscsi_ibft.h
index 6092487e2950..d2e4042f8f5e 100644
--- a/include/linux/iscsi_ibft.h
+++ b/include/linux/iscsi_ibft.h
@@ -42,9 +42,13 @@ extern struct ibft_table_header *ibft_addr;
42 * mapped address is set in the ibft_addr variable. 42 * mapped address is set in the ibft_addr variable.
43 */ 43 */
44#ifdef CONFIG_ISCSI_IBFT_FIND 44#ifdef CONFIG_ISCSI_IBFT_FIND
45extern void __init reserve_ibft_region(void); 45unsigned long find_ibft_region(unsigned long *sizep);
46#else 46#else
47static inline void reserve_ibft_region(void) { } 47static inline unsigned long find_ibft_region(unsigned long *sizep)
48{
49 *sizep = 0;
50 return 0;
51}
48#endif 52#endif
49 53
50#endif /* ISCSI_IBFT_H */ 54#endif /* ISCSI_IBFT_H */
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h
index 7acb87a44872..11b57c485854 100644
--- a/include/linux/isdn/capilli.h
+++ b/include/linux/isdn/capilli.h
@@ -50,8 +50,7 @@ struct capi_ctr {
50 u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); 50 u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb);
51 51
52 char *(*procinfo)(struct capi_ctr *); 52 char *(*procinfo)(struct capi_ctr *);
53 int (*ctr_read_proc)(char *page, char **start, off_t off, 53 const struct file_operations *proc_fops;
54 int count, int *eof, struct capi_ctr *card);
55 54
56 /* filled in before calling ready callback */ 55 /* filled in before calling ready callback */
57 u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ 56 u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */
@@ -67,9 +66,10 @@ struct capi_ctr {
67 unsigned long nsentdatapkt; 66 unsigned long nsentdatapkt;
68 67
69 int cnr; /* controller number */ 68 int cnr; /* controller number */
70 volatile unsigned short cardstate; /* controller state */ 69 unsigned short state; /* controller state */
71 volatile int blocked; /* output blocked */ 70 int blocked; /* output blocked */
72 int traceflag; /* capi trace */ 71 int traceflag; /* capi trace */
72 wait_queue_head_t state_wait_queue;
73 73
74 struct proc_dir_entry *procent; 74 struct proc_dir_entry *procent;
75 char procfn[128]; 75 char procfn[128];
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h
index 9d88b29ddf55..e8b92f67f10d 100644
--- a/include/linux/ivtvfb.h
+++ b/include/linux/ivtvfb.h
@@ -33,6 +33,5 @@ struct ivtvfb_dma_frame {
33}; 33};
34 34
35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) 35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame)
36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
37 36
38#endif 37#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 331530cd3cc6..e06965081ba5 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -31,6 +31,7 @@
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/lockdep.h> 33#include <linux/lockdep.h>
34#include <linux/slab.h>
34 35
35#define journal_oom_retry 1 36#define journal_oom_retry 1
36 37
@@ -246,19 +247,8 @@ typedef struct journal_superblock_s
246 247
247#define J_ASSERT(assert) BUG_ON(!(assert)) 248#define J_ASSERT(assert) BUG_ON(!(assert))
248 249
249#if defined(CONFIG_BUFFER_DEBUG)
250void buffer_assertion_failure(struct buffer_head *bh);
251#define J_ASSERT_BH(bh, expr) \
252 do { \
253 if (!(expr)) \
254 buffer_assertion_failure(bh); \
255 J_ASSERT(expr); \
256 } while (0)
257#define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr)
258#else
259#define J_ASSERT_BH(bh, expr) J_ASSERT(expr) 250#define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
260#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 251#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
261#endif
262 252
263#if defined(JBD_PARANOID_IOFAIL) 253#if defined(JBD_PARANOID_IOFAIL)
264#define J_EXPECT(expr, why...) J_ASSERT(expr) 254#define J_EXPECT(expr, why...) J_ASSERT(expr)
@@ -437,9 +427,9 @@ struct transaction_s
437 enum { 427 enum {
438 T_RUNNING, 428 T_RUNNING,
439 T_LOCKED, 429 T_LOCKED,
440 T_RUNDOWN,
441 T_FLUSH, 430 T_FLUSH,
442 T_COMMIT, 431 T_COMMIT,
432 T_COMMIT_RECORD,
443 T_FINISHED 433 T_FINISHED
444 } t_state; 434 } t_state;
445 435
@@ -1001,6 +991,7 @@ int journal_start_commit(journal_t *journal, tid_t *tid);
1001int journal_force_commit_nested(journal_t *journal); 991int journal_force_commit_nested(journal_t *journal);
1002int log_wait_commit(journal_t *journal, tid_t tid); 992int log_wait_commit(journal_t *journal, tid_t tid);
1003int log_do_checkpoint(journal_t *journal); 993int log_do_checkpoint(journal_t *journal);
994int journal_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
1004 995
1005void __log_wait_for_space(journal_t *journal); 996void __log_wait_for_space(journal_t *journal);
1006extern void __journal_drop_transaction(journal_t *, transaction_t *); 997extern void __journal_drop_transaction(journal_t *, transaction_t *);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 638ce4554c76..adf832dec3f3 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -30,6 +30,7 @@
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/slab.h>
33#endif 34#endif
34 35
35#define journal_oom_retry 1 36#define journal_oom_retry 1
@@ -69,15 +70,8 @@ extern u8 jbd2_journal_enable_debug;
69#define jbd_debug(f, a...) /**/ 70#define jbd_debug(f, a...) /**/
70#endif 71#endif
71 72
72static inline void *jbd2_alloc(size_t size, gfp_t flags) 73extern void *jbd2_alloc(size_t size, gfp_t flags);
73{ 74extern void jbd2_free(void *ptr, size_t size);
74 return (void *)__get_free_pages(flags, get_order(size));
75}
76
77static inline void jbd2_free(void *ptr, size_t size)
78{
79 free_pages((unsigned long)ptr, get_order(size));
80};
81 75
82#define JBD2_MIN_JOURNAL_BLOCKS 1024 76#define JBD2_MIN_JOURNAL_BLOCKS 1024
83 77
@@ -284,19 +278,8 @@ typedef struct journal_superblock_s
284 278
285#define J_ASSERT(assert) BUG_ON(!(assert)) 279#define J_ASSERT(assert) BUG_ON(!(assert))
286 280
287#if defined(CONFIG_BUFFER_DEBUG)
288void buffer_assertion_failure(struct buffer_head *bh);
289#define J_ASSERT_BH(bh, expr) \
290 do { \
291 if (!(expr)) \
292 buffer_assertion_failure(bh); \
293 J_ASSERT(expr); \
294 } while (0)
295#define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr)
296#else
297#define J_ASSERT_BH(bh, expr) J_ASSERT(expr) 281#define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
298#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 282#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
299#endif
300 283
301#if defined(JBD2_PARANOID_IOFAIL) 284#if defined(JBD2_PARANOID_IOFAIL)
302#define J_EXPECT(expr, why...) J_ASSERT(expr) 285#define J_EXPECT(expr, why...) J_ASSERT(expr)
@@ -1043,11 +1026,12 @@ void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1043 1026
1044struct jbd2_buffer_trigger_type { 1027struct jbd2_buffer_trigger_type {
1045 /* 1028 /*
1046 * Fired just before a buffer is written to the journal. 1029 * Fired a the moment data to write to the journal are known to be
1047 * mapped_data is a mapped buffer that is the frozen data for 1030 * stable - so either at the moment b_frozen_data is created or just
1048 * commit. 1031 * before a buffer is written to the journal. mapped_data is a mapped
1032 * buffer that is the frozen data for commit.
1049 */ 1033 */
1050 void (*t_commit)(struct jbd2_buffer_trigger_type *type, 1034 void (*t_frozen)(struct jbd2_buffer_trigger_type *type,
1051 struct buffer_head *bh, void *mapped_data, 1035 struct buffer_head *bh, void *mapped_data,
1052 size_t size); 1036 size_t size);
1053 1037
@@ -1059,7 +1043,7 @@ struct jbd2_buffer_trigger_type {
1059 struct buffer_head *bh); 1043 struct buffer_head *bh);
1060}; 1044};
1061 1045
1062extern void jbd2_buffer_commit_trigger(struct journal_head *jh, 1046extern void jbd2_buffer_frozen_trigger(struct journal_head *jh,
1063 void *mapped_data, 1047 void *mapped_data,
1064 struct jbd2_buffer_trigger_type *triggers); 1048 struct jbd2_buffer_trigger_type *triggers);
1065extern void jbd2_buffer_abort_trigger(struct journal_head *jh, 1049extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 2b32d638147d..0874ab59ffef 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -215,8 +215,8 @@ union jffs2_node_union
215 215
216/* Data payload for device nodes. */ 216/* Data payload for device nodes. */
217union jffs2_device_node { 217union jffs2_device_node {
218 jint16_t old; 218 jint16_t old_id;
219 jint32_t new; 219 jint32_t new_id;
220}; 220};
221 221
222#endif /* __LINUX_JFFS2_H__ */ 222#endif /* __LINUX_JFFS2_H__ */
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index 9e20c29c1e14..47199b13e0eb 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -64,8 +64,8 @@ struct js_event {
64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ 64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ 65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
66 66
67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */ 67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */ 68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ 69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ 70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
71 71
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 8bdb16bfe5fb..506ad20c18f8 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -161,7 +161,4 @@ static inline void con_schedule_flip(struct tty_struct *t)
161 schedule_delayed_work(&t->buf.work, 0); 161 schedule_delayed_work(&t->buf.work, 0);
162} 162}
163 163
164/* mac_hid.c */
165extern int mac_hid_mouse_emulate_buttons(int, unsigned int, int);
166
167#endif 164#endif
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
new file mode 100644
index 000000000000..ccb2b3ec0fe8
--- /dev/null
+++ b/include/linux/kdb.h
@@ -0,0 +1,117 @@
1#ifndef _KDB_H
2#define _KDB_H
3
4/*
5 * Kernel Debugger Architecture Independent Global Headers
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
12 * Copyright (C) 2000 Stephane Eranian <eranian@hpl.hp.com>
13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
14 */
15
16#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h>
18#include <linux/sched.h>
19#include <asm/atomic.h>
20
21#define KDB_POLL_FUNC_MAX 5
22extern int kdb_poll_idx;
23
24/*
25 * kdb_initial_cpu is initialized to -1, and is set to the cpu
26 * number whenever the kernel debugger is entered.
27 */
28extern int kdb_initial_cpu;
29extern atomic_t kdb_event;
30
31/*
32 * kdb_diemsg
33 *
34 * Contains a pointer to the last string supplied to the
35 * kernel 'die' panic function.
36 */
37extern const char *kdb_diemsg;
38
39#define KDB_FLAG_EARLYKDB (1 << 0) /* set from boot parameter kdb=early */
40#define KDB_FLAG_CATASTROPHIC (1 << 1) /* A catastrophic event has occurred */
41#define KDB_FLAG_CMD_INTERRUPT (1 << 2) /* Previous command was interrupted */
42#define KDB_FLAG_NOIPI (1 << 3) /* Do not send IPIs */
43#define KDB_FLAG_ONLY_DO_DUMP (1 << 4) /* Only do a dump, used when
44 * kdb is off */
45#define KDB_FLAG_NO_CONSOLE (1 << 5) /* No console is available,
46 * kdb is disabled */
47#define KDB_FLAG_NO_VT_CONSOLE (1 << 6) /* No VT console is available, do
48 * not use keyboard */
49#define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do
50 * not use keyboard */
51
52extern int kdb_flags; /* Global flags, see kdb_state for per cpu state */
53
54extern void kdb_save_flags(void);
55extern void kdb_restore_flags(void);
56
57#define KDB_FLAG(flag) (kdb_flags & KDB_FLAG_##flag)
58#define KDB_FLAG_SET(flag) ((void)(kdb_flags |= KDB_FLAG_##flag))
59#define KDB_FLAG_CLEAR(flag) ((void)(kdb_flags &= ~KDB_FLAG_##flag))
60
61/*
62 * External entry point for the kernel debugger. The pt_regs
63 * at the time of entry are supplied along with the reason for
64 * entry to the kernel debugger.
65 */
66
67typedef enum {
68 KDB_REASON_ENTER = 1, /* KDB_ENTER() trap/fault - regs valid */
69 KDB_REASON_ENTER_SLAVE, /* KDB_ENTER_SLAVE() trap/fault - regs valid */
70 KDB_REASON_BREAK, /* Breakpoint inst. - regs valid */
71 KDB_REASON_DEBUG, /* Debug Fault - regs valid */
72 KDB_REASON_OOPS, /* Kernel Oops - regs valid */
73 KDB_REASON_SWITCH, /* CPU switch - regs valid*/
74 KDB_REASON_KEYBOARD, /* Keyboard entry - regs valid */
75 KDB_REASON_NMI, /* Non-maskable interrupt; regs valid */
76 KDB_REASON_RECURSE, /* Recursive entry to kdb;
77 * regs probably valid */
78 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
79} kdb_reason_t;
80
81extern int kdb_trap_printk;
82extern int vkdb_printf(const char *fmt, va_list args)
83 __attribute__ ((format (printf, 1, 0)));
84extern int kdb_printf(const char *, ...)
85 __attribute__ ((format (printf, 1, 2)));
86typedef int (*kdb_printf_t)(const char *, ...)
87 __attribute__ ((format (printf, 1, 2)));
88
89extern void kdb_init(int level);
90
91/* Access to kdb specific polling devices */
92typedef int (*get_char_func)(void);
93extern get_char_func kdb_poll_funcs[];
94extern int kdb_get_kbd_char(void);
95
96static inline
97int kdb_process_cpu(const struct task_struct *p)
98{
99 unsigned int cpu = task_thread_info(p)->cpu;
100 if (cpu > num_possible_cpus())
101 cpu = 0;
102 return cpu;
103}
104
105/* kdb access to register set for stack dumping */
106extern struct pt_regs *kdb_current_regs;
107
108#else /* ! CONFIG_KGDB_KDB */
109#define kdb_printf(...)
110#define kdb_init(x)
111#endif /* CONFIG_KGDB_KDB */
112enum {
113 KDB_NOT_INITIALIZED,
114 KDB_INIT_EARLY,
115 KDB_INIT_FULL,
116};
117#endif /* !_KDB_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 328bca609b9b..8317ec4b9f3b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -4,6 +4,8 @@
4/* 4/*
5 * 'kernel.h' contains some often-used function prototypes etc 5 * 'kernel.h' contains some often-used function prototypes etc
6 */ 6 */
7#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
8#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
7 9
8#ifdef __KERNEL__ 10#ifdef __KERNEL__
9 11
@@ -22,9 +24,9 @@
22extern const char linux_banner[]; 24extern const char linux_banner[];
23extern const char linux_proc_banner[]; 25extern const char linux_proc_banner[];
24 26
25#define USHORT_MAX ((u16)(~0U)) 27#define USHRT_MAX ((u16)(~0U))
26#define SHORT_MAX ((s16)(USHORT_MAX>>1)) 28#define SHRT_MAX ((s16)(USHRT_MAX>>1))
27#define SHORT_MIN (-SHORT_MAX - 1) 29#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
28#define INT_MAX ((int)(~0U>>1)) 30#define INT_MAX ((int)(~0U>>1))
29#define INT_MIN (-INT_MAX - 1) 31#define INT_MIN (-INT_MAX - 1)
30#define UINT_MAX (~0U) 32#define UINT_MAX (~0U)
@@ -37,13 +39,23 @@ extern const char linux_proc_banner[];
37 39
38#define STACK_MAGIC 0xdeadbeef 40#define STACK_MAGIC 0xdeadbeef
39 41
40#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) 42#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
41#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 43#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
42#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 44#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
43#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) 45#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
44 46
45#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) 47#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
46 48
49/*
50 * This looks more complex than it should be. But we need to
51 * get the type for the ~ right in round_down (it needs to be
52 * as wide as the result!), and we want to evaluate the macro
53 * arguments just once each.
54 */
55#define __round_mask(x, y) ((__typeof__(x))((y)-1))
56#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
57#define round_down(x, y) ((x) & ~__round_mask(x, y))
58
47#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 59#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
48#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 60#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
49#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 61#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
@@ -124,7 +136,7 @@ extern int _cond_resched(void);
124#endif 136#endif
125 137
126#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 138#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
127 void __might_sleep(char *file, int line, int preempt_offset); 139 void __might_sleep(const char *file, int line, int preempt_offset);
128/** 140/**
129 * might_sleep - annotation for functions that can sleep 141 * might_sleep - annotation for functions that can sleep
130 * 142 *
@@ -138,7 +150,8 @@ extern int _cond_resched(void);
138# define might_sleep() \ 150# define might_sleep() \
139 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) 151 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
140#else 152#else
141 static inline void __might_sleep(char *file, int line, int preempt_offset) { } 153 static inline void __might_sleep(const char *file, int line,
154 int preempt_offset) { }
142# define might_sleep() do { might_resched(); } while (0) 155# define might_sleep() do { might_resched(); } while (0)
143#endif 156#endif
144 157
@@ -333,6 +346,7 @@ extern enum system_states {
333#define TAINT_OVERRIDDEN_ACPI_TABLE 8 346#define TAINT_OVERRIDDEN_ACPI_TABLE 8
334#define TAINT_WARN 9 347#define TAINT_WARN 9
335#define TAINT_CRAP 10 348#define TAINT_CRAP 10
349#define TAINT_FIRMWARE_WORKAROUND 11
336 350
337extern void dump_stack(void) __cold; 351extern void dump_stack(void) __cold;
338 352
@@ -361,6 +375,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
361 return buf; 375 return buf;
362} 376}
363 377
378extern int hex_to_bin(char ch);
379
364#ifndef pr_fmt 380#ifndef pr_fmt
365#define pr_fmt(fmt) fmt 381#define pr_fmt(fmt) fmt
366#endif 382#endif
@@ -375,6 +391,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
375 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) 391 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
376#define pr_warning(fmt, ...) \ 392#define pr_warning(fmt, ...) \
377 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) 393 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
394#define pr_warn pr_warning
378#define pr_notice(fmt, ...) \ 395#define pr_notice(fmt, ...) \
379 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 396 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
380#define pr_info(fmt, ...) \ 397#define pr_info(fmt, ...) \
@@ -409,14 +426,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
409 * no local ratelimit_state used in the !PRINTK case 426 * no local ratelimit_state used in the !PRINTK case
410 */ 427 */
411#ifdef CONFIG_PRINTK 428#ifdef CONFIG_PRINTK
412#define printk_ratelimited(fmt, ...) ({ \ 429#define printk_ratelimited(fmt, ...) ({ \
413 static struct ratelimit_state _rs = { \ 430 static DEFINE_RATELIMIT_STATE(_rs, \
414 .interval = DEFAULT_RATELIMIT_INTERVAL, \ 431 DEFAULT_RATELIMIT_INTERVAL, \
415 .burst = DEFAULT_RATELIMIT_BURST, \ 432 DEFAULT_RATELIMIT_BURST); \
416 }; \ 433 \
417 \ 434 if (__ratelimit(&_rs)) \
418 if (!__ratelimit(&_rs)) \ 435 printk(fmt, ##__VA_ARGS__); \
419 printk(fmt, ##__VA_ARGS__); \
420}) 436})
421#else 437#else
422/* No effect, but we still get type checking even in the !PRINTK case: */ 438/* No effect, but we still get type checking even in the !PRINTK case: */
@@ -433,6 +449,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
433 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) 449 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
434#define pr_warning_ratelimited(fmt, ...) \ 450#define pr_warning_ratelimited(fmt, ...) \
435 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) 451 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
452#define pr_warn_ratelimited pr_warning_ratelimited
436#define pr_notice_ratelimited(fmt, ...) \ 453#define pr_notice_ratelimited(fmt, ...) \
437 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 454 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
438#define pr_info_ratelimited(fmt, ...) \ 455#define pr_info_ratelimited(fmt, ...) \
@@ -479,6 +496,13 @@ static inline void tracing_off(void) { }
479static inline void tracing_off_permanent(void) { } 496static inline void tracing_off_permanent(void) { }
480static inline int tracing_is_on(void) { return 0; } 497static inline int tracing_is_on(void) { return 0; }
481#endif 498#endif
499
500enum ftrace_dump_mode {
501 DUMP_NONE,
502 DUMP_ALL,
503 DUMP_ORIG,
504};
505
482#ifdef CONFIG_TRACING 506#ifdef CONFIG_TRACING
483extern void tracing_start(void); 507extern void tracing_start(void);
484extern void tracing_stop(void); 508extern void tracing_stop(void);
@@ -560,7 +584,7 @@ __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);
560extern int 584extern int
561__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); 585__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
562 586
563extern void ftrace_dump(void); 587extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
564#else 588#else
565static inline void 589static inline void
566ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } 590ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
@@ -581,7 +605,7 @@ ftrace_vprintk(const char *fmt, va_list ap)
581{ 605{
582 return 0; 606 return 0;
583} 607}
584static inline void ftrace_dump(void) { } 608static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
585#endif /* CONFIG_TRACING */ 609#endif /* CONFIG_TRACING */
586 610
587/* 611/*
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index a53e932f80fb..9c2683929fd3 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -48,9 +48,7 @@ typedef struct kcapi_carddef {
48#include <linux/list.h> 48#include <linux/list.h>
49#include <linux/skbuff.h> 49#include <linux/skbuff.h>
50#include <linux/workqueue.h> 50#include <linux/workqueue.h>
51 51#include <linux/notifier.h>
52#define KCI_CONTRUP 0 /* arg: struct capi_profile */
53#define KCI_CONTRDOWN 1 /* arg: NULL */
54 52
55struct capi20_appl { 53struct capi20_appl {
56 u16 applid; 54 u16 applid;
@@ -67,11 +65,6 @@ struct capi20_appl {
67 struct sk_buff_head recv_queue; 65 struct sk_buff_head recv_queue;
68 struct work_struct recv_work; 66 struct work_struct recv_work;
69 int release_in_progress; 67 int release_in_progress;
70
71 /* ugly hack to allow for notification of added/removed
72 * controllers. The Right Way (tm) is known. XXX
73 */
74 void (*callback) (unsigned int cmd, __u32 contr, void *data);
75}; 68};
76 69
77u16 capi20_isinstalled(void); 70u16 capi20_isinstalled(void);
@@ -84,11 +77,11 @@ u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
84u16 capi20_get_profile(u32 contr, struct capi_profile *profp); 77u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
85int capi20_manufacturer(unsigned int cmd, void __user *data); 78int capi20_manufacturer(unsigned int cmd, void __user *data);
86 79
87/* temporary hack XXX */ 80#define CAPICTR_UP 0
88void capi20_set_callback(struct capi20_appl *ap, 81#define CAPICTR_DOWN 1
89 void (*callback) (unsigned int cmd, __u32 contr, void *data));
90
91 82
83int register_capictr_notifier(struct notifier_block *nb);
84int unregister_capictr_notifier(struct notifier_block *nb);
92 85
93#define CAPI_NOERROR 0x0000 86#define CAPI_NOERROR 0x0000
94 87
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index c356b6914ffd..03e8e8dbc577 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -199,7 +199,7 @@ extern struct kimage *kexec_crash_image;
199 */ 199 */
200extern struct resource crashk_res; 200extern struct resource crashk_res;
201typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; 201typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
202extern note_buf_t *crash_notes; 202extern note_buf_t __percpu *crash_notes;
203extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; 203extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
204extern size_t vmcoreinfo_size; 204extern size_t vmcoreinfo_size;
205extern size_t vmcoreinfo_max_size; 205extern size_t vmcoreinfo_max_size;
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 6f6c5f300af6..9fad0527344f 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -86,7 +86,8 @@ union { \
86 */ 86 */
87#define INIT_KFIFO(name) \ 87#define INIT_KFIFO(name) \
88 name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ 88 name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
89 sizeof(struct kfifo), name##kfifo_buffer) 89 sizeof(struct kfifo), \
90 name##kfifo_buffer + sizeof(struct kfifo))
90 91
91/** 92/**
92 * DEFINE_KFIFO - macro to define and initialize a kfifo 93 * DEFINE_KFIFO - macro to define and initialize a kfifo
@@ -102,8 +103,6 @@ union { \
102 unsigned char name##kfifo_buffer[size]; \ 103 unsigned char name##kfifo_buffer[size]; \
103 struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) 104 struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer)
104 105
105#undef __kfifo_initializer
106
107extern void kfifo_init(struct kfifo *fifo, void *buffer, 106extern void kfifo_init(struct kfifo *fifo, void *buffer,
108 unsigned int size); 107 unsigned int size);
109extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, 108extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size,
@@ -124,7 +123,7 @@ extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
124 */ 123 */
125static inline bool kfifo_initialized(struct kfifo *fifo) 124static inline bool kfifo_initialized(struct kfifo *fifo)
126{ 125{
127 return fifo->buffer != 0; 126 return fifo->buffer != NULL;
128} 127}
129 128
130/** 129/**
@@ -202,7 +201,7 @@ static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo)
202 * @n: the length of the data to be added. 201 * @n: the length of the data to be added.
203 * @lock: pointer to the spinlock to use for locking. 202 * @lock: pointer to the spinlock to use for locking.
204 * 203 *
205 * This function copies at most @len bytes from the @from buffer into 204 * This function copies at most @n bytes from the @from buffer into
206 * the FIFO depending on the free space, and returns the number of 205 * the FIFO depending on the free space, and returns the number of
207 * bytes copied. 206 * bytes copied.
208 */ 207 */
@@ -228,7 +227,7 @@ static inline unsigned int kfifo_in_locked(struct kfifo *fifo,
228 * @n: the size of the destination buffer. 227 * @n: the size of the destination buffer.
229 * @lock: pointer to the spinlock to use for locking. 228 * @lock: pointer to the spinlock to use for locking.
230 * 229 *
231 * This function copies at most @len bytes from the FIFO into the 230 * This function copies at most @n bytes from the FIFO into the
232 * @to buffer and returns the number of copied bytes. 231 * @to buffer and returns the number of copied bytes.
233 */ 232 */
234static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, 233static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 19ec41a183f5..9340f34d1bb5 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -16,10 +16,12 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/init.h> 18#include <linux/init.h>
19
20#include <asm/atomic.h> 19#include <asm/atomic.h>
20#ifdef CONFIG_HAVE_ARCH_KGDB
21#include <asm/kgdb.h> 21#include <asm/kgdb.h>
22#endif
22 23
24#ifdef CONFIG_KGDB
23struct pt_regs; 25struct pt_regs;
24 26
25/** 27/**
@@ -34,20 +36,6 @@ struct pt_regs;
34extern int kgdb_skipexception(int exception, struct pt_regs *regs); 36extern int kgdb_skipexception(int exception, struct pt_regs *regs);
35 37
36/** 38/**
37 * kgdb_post_primary_code - (optional) Save error vector/code numbers.
38 * @regs: Original pt_regs.
39 * @e_vector: Original error vector.
40 * @err_code: Original error code.
41 *
42 * This is usually needed on architectures which support SMP and
43 * KGDB. This function is called after all the secondary cpus have
44 * been put to a know spin state and the primary CPU has control over
45 * KGDB.
46 */
47extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector,
48 int err_code);
49
50/**
51 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook 39 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
52 * @regs: Current &struct pt_regs. 40 * @regs: Current &struct pt_regs.
53 * 41 *
@@ -72,6 +60,7 @@ struct uart_port;
72void kgdb_breakpoint(void); 60void kgdb_breakpoint(void);
73 61
74extern int kgdb_connected; 62extern int kgdb_connected;
63extern int kgdb_io_module_registered;
75 64
76extern atomic_t kgdb_setting_breakpoint; 65extern atomic_t kgdb_setting_breakpoint;
77extern atomic_t kgdb_cpu_doing_single_step; 66extern atomic_t kgdb_cpu_doing_single_step;
@@ -202,12 +191,34 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
202 */ 191 */
203extern void kgdb_roundup_cpus(unsigned long flags); 192extern void kgdb_roundup_cpus(unsigned long flags);
204 193
194/**
195 * kgdb_arch_set_pc - Generic call back to the program counter
196 * @regs: Current &struct pt_regs.
197 * @pc: The new value for the program counter
198 *
199 * This function handles updating the program counter and requires an
200 * architecture specific implementation.
201 */
202extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
203
204
205/* Optional functions. */ 205/* Optional functions. */
206extern int kgdb_validate_break_address(unsigned long addr); 206extern int kgdb_validate_break_address(unsigned long addr);
207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); 207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
208extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); 208extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
209 209
210/** 210/**
211 * kgdb_arch_late - Perform any architecture specific initalization.
212 *
213 * This function will handle the late initalization of any
214 * architecture specific callbacks. This is an optional function for
215 * handling things like late initialization of hw breakpoints. The
216 * default implementation does nothing.
217 */
218extern void kgdb_arch_late(void);
219
220
221/**
211 * struct kgdb_arch - Describe architecture specific values. 222 * struct kgdb_arch - Describe architecture specific values.
212 * @gdb_bpt_instr: The instruction to trigger a breakpoint. 223 * @gdb_bpt_instr: The instruction to trigger a breakpoint.
213 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. 224 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
@@ -247,6 +258,8 @@ struct kgdb_arch {
247 * the I/O driver. 258 * the I/O driver.
248 * @post_exception: Pointer to a function that will do any cleanup work 259 * @post_exception: Pointer to a function that will do any cleanup work
249 * for the I/O driver. 260 * for the I/O driver.
261 * @is_console: 1 if the end device is a console 0 if the I/O device is
262 * not a console
250 */ 263 */
251struct kgdb_io { 264struct kgdb_io {
252 const char *name; 265 const char *name;
@@ -256,6 +269,7 @@ struct kgdb_io {
256 int (*init) (void); 269 int (*init) (void);
257 void (*pre_exception) (void); 270 void (*pre_exception) (void);
258 void (*post_exception) (void); 271 void (*post_exception) (void);
272 int is_console;
259}; 273};
260 274
261extern struct kgdb_arch arch_kgdb_ops; 275extern struct kgdb_arch arch_kgdb_ops;
@@ -264,12 +278,14 @@ extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
264 278
265extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 279extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
266extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); 280extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
281extern struct kgdb_io *dbg_io_ops;
267 282
268extern int kgdb_hex2long(char **ptr, unsigned long *long_val); 283extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
269extern int kgdb_mem2hex(char *mem, char *buf, int count); 284extern int kgdb_mem2hex(char *mem, char *buf, int count);
270extern int kgdb_hex2mem(char *buf, char *mem, int count); 285extern int kgdb_hex2mem(char *buf, char *mem, int count);
271 286
272extern int kgdb_isremovedbreak(unsigned long addr); 287extern int kgdb_isremovedbreak(unsigned long addr);
288extern void kgdb_schedule_breakpoint(void);
273 289
274extern int 290extern int
275kgdb_handle_exception(int ex_vector, int signo, int err_code, 291kgdb_handle_exception(int ex_vector, int signo, int err_code,
@@ -278,5 +294,12 @@ extern int kgdb_nmicallback(int cpu, void *regs);
278 294
279extern int kgdb_single_step; 295extern int kgdb_single_step;
280extern atomic_t kgdb_active; 296extern atomic_t kgdb_active;
281 297#define in_dbg_master() \
298 (raw_smp_processor_id() == atomic_read(&kgdb_active))
299extern bool dbg_is_early;
300extern void __init dbg_late_init(void);
301#else /* ! CONFIG_KGDB */
302#define in_dbg_master() (0)
303#define dbg_late_init()
304#endif /* ! CONFIG_KGDB */
282#endif /* _KGDB_H_ */ 305#endif /* _KGDB_H_ */
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 384ca8bbf1ac..6efd7a78de6a 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -23,10 +23,12 @@
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/workqueue.h>
26 27
27#define KMOD_PATH_LEN 256 28#define KMOD_PATH_LEN 256
28 29
29#ifdef CONFIG_MODULES 30#ifdef CONFIG_MODULES
31extern char modprobe_path[]; /* for sysctl */
30/* modprobe exit status on success, -ve on error. Return value 32/* modprobe exit status on success, -ve on error. Return value
31 * usually useless though. */ 33 * usually useless though. */
32extern int __request_module(bool wait, const char *name, ...) \ 34extern int __request_module(bool wait, const char *name, ...) \
@@ -44,19 +46,6 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
44 46
45struct key; 47struct key;
46struct file; 48struct file;
47struct subprocess_info;
48
49/* Allocate a subprocess_info structure */
50struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
51 char **envp, gfp_t gfp_mask);
52
53/* Set various pieces of state into the subprocess_info structure */
54void call_usermodehelper_setkeys(struct subprocess_info *info,
55 struct key *session_keyring);
56int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info,
57 struct file **filp);
58void call_usermodehelper_setcleanup(struct subprocess_info *info,
59 void (*cleanup)(char **argv, char **envp));
60 49
61enum umh_wait { 50enum umh_wait {
62 UMH_NO_WAIT = -1, /* don't wait at all */ 51 UMH_NO_WAIT = -1, /* don't wait at all */
@@ -64,6 +53,29 @@ enum umh_wait {
64 UMH_WAIT_PROC = 1, /* wait for the process to complete */ 53 UMH_WAIT_PROC = 1, /* wait for the process to complete */
65}; 54};
66 55
56struct subprocess_info {
57 struct work_struct work;
58 struct completion *complete;
59 char *path;
60 char **argv;
61 char **envp;
62 enum umh_wait wait;
63 int retval;
64 int (*init)(struct subprocess_info *info);
65 void (*cleanup)(struct subprocess_info *info);
66 void *data;
67};
68
69/* Allocate a subprocess_info structure */
70struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
71 char **envp, gfp_t gfp_mask);
72
73/* Set various pieces of state into the subprocess_info structure */
74void call_usermodehelper_setfns(struct subprocess_info *info,
75 int (*init)(struct subprocess_info *info),
76 void (*cleanup)(struct subprocess_info *info),
77 void *data);
78
67/* Actually execute the sub-process */ 79/* Actually execute the sub-process */
68int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); 80int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
69 81
@@ -72,38 +84,33 @@ int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
72void call_usermodehelper_freeinfo(struct subprocess_info *info); 84void call_usermodehelper_freeinfo(struct subprocess_info *info);
73 85
74static inline int 86static inline int
75call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) 87call_usermodehelper_fns(char *path, char **argv, char **envp,
88 enum umh_wait wait,
89 int (*init)(struct subprocess_info *info),
90 void (*cleanup)(struct subprocess_info *), void *data)
76{ 91{
77 struct subprocess_info *info; 92 struct subprocess_info *info;
78 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; 93 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
79 94
80 info = call_usermodehelper_setup(path, argv, envp, gfp_mask); 95 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
96
81 if (info == NULL) 97 if (info == NULL)
82 return -ENOMEM; 98 return -ENOMEM;
99
100 call_usermodehelper_setfns(info, init, cleanup, data);
101
83 return call_usermodehelper_exec(info, wait); 102 return call_usermodehelper_exec(info, wait);
84} 103}
85 104
86static inline int 105static inline int
87call_usermodehelper_keys(char *path, char **argv, char **envp, 106call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
88 struct key *session_keyring, enum umh_wait wait)
89{ 107{
90 struct subprocess_info *info; 108 return call_usermodehelper_fns(path, argv, envp, wait,
91 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; 109 NULL, NULL, NULL);
92
93 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
94 if (info == NULL)
95 return -ENOMEM;
96
97 call_usermodehelper_setkeys(info, session_keyring);
98 return call_usermodehelper_exec(info, wait);
99} 110}
100 111
101extern void usermodehelper_init(void); 112extern void usermodehelper_init(void);
102 113
103struct file;
104extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[],
105 struct file **filp);
106
107extern int usermodehelper_disable(void); 114extern int usermodehelper_disable(void);
108extern void usermodehelper_enable(void); 115extern void usermodehelper_enable(void);
109 116
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index 73717ed9ea79..18ca75ffcc5a 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,3 +1,10 @@
1/*
2 * kobj_map.h
3 */
4
5#ifndef _KOBJ_MAP_H_
6#define _KOBJ_MAP_H_
7
1#include <linux/mutex.h> 8#include <linux/mutex.h>
2 9
3typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 10typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
@@ -8,3 +15,5 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
8void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 15void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
9struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 16struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
10struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); 17struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
18
19#endif /* _KOBJ_MAP_H_ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 58ae8e00fcdd..cf343a852534 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -106,8 +106,10 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
106 106
107struct kobj_type { 107struct kobj_type {
108 void (*release)(struct kobject *kobj); 108 void (*release)(struct kobject *kobj);
109 struct sysfs_ops *sysfs_ops; 109 const struct sysfs_ops *sysfs_ops;
110 struct attribute **default_attrs; 110 struct attribute **default_attrs;
111 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
112 const void *(*namespace)(struct kobject *kobj);
111}; 113};
112 114
113struct kobj_uevent_env { 115struct kobj_uevent_env {
@@ -118,9 +120,9 @@ struct kobj_uevent_env {
118}; 120};
119 121
120struct kset_uevent_ops { 122struct kset_uevent_ops {
121 int (*filter)(struct kset *kset, struct kobject *kobj); 123 int (* const filter)(struct kset *kset, struct kobject *kobj);
122 const char *(*name)(struct kset *kset, struct kobject *kobj); 124 const char *(* const name)(struct kset *kset, struct kobject *kobj);
123 int (*uevent)(struct kset *kset, struct kobject *kobj, 125 int (* const uevent)(struct kset *kset, struct kobject *kobj,
124 struct kobj_uevent_env *env); 126 struct kobj_uevent_env *env);
125}; 127};
126 128
@@ -132,7 +134,43 @@ struct kobj_attribute {
132 const char *buf, size_t count); 134 const char *buf, size_t count);
133}; 135};
134 136
135extern struct sysfs_ops kobj_sysfs_ops; 137extern const struct sysfs_ops kobj_sysfs_ops;
138
139/*
140 * Namespace types which are used to tag kobjects and sysfs entries.
141 * Network namespace will likely be the first.
142 */
143enum kobj_ns_type {
144 KOBJ_NS_TYPE_NONE = 0,
145 KOBJ_NS_TYPE_NET,
146 KOBJ_NS_TYPES
147};
148
149struct sock;
150
151/*
152 * Callbacks so sysfs can determine namespaces
153 * @current_ns: return calling task's namespace
154 * @netlink_ns: return namespace to which a sock belongs (right?)
155 * @initial_ns: return the initial namespace (i.e. init_net_ns)
156 */
157struct kobj_ns_type_operations {
158 enum kobj_ns_type type;
159 const void *(*current_ns)(void);
160 const void *(*netlink_ns)(struct sock *sk);
161 const void *(*initial_ns)(void);
162};
163
164int kobj_ns_type_register(const struct kobj_ns_type_operations *ops);
165int kobj_ns_type_registered(enum kobj_ns_type type);
166const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent);
167const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj);
168
169const void *kobj_ns_current(enum kobj_ns_type type);
170const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk);
171const void *kobj_ns_initial(enum kobj_ns_type type);
172void kobj_ns_exit(enum kobj_ns_type type, const void *ns);
173
136 174
137/** 175/**
138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 176 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
@@ -155,14 +193,14 @@ struct kset {
155 struct list_head list; 193 struct list_head list;
156 spinlock_t list_lock; 194 spinlock_t list_lock;
157 struct kobject kobj; 195 struct kobject kobj;
158 struct kset_uevent_ops *uevent_ops; 196 const struct kset_uevent_ops *uevent_ops;
159}; 197};
160 198
161extern void kset_init(struct kset *kset); 199extern void kset_init(struct kset *kset);
162extern int __must_check kset_register(struct kset *kset); 200extern int __must_check kset_register(struct kset *kset);
163extern void kset_unregister(struct kset *kset); 201extern void kset_unregister(struct kset *kset);
164extern struct kset * __must_check kset_create_and_add(const char *name, 202extern struct kset * __must_check kset_create_and_add(const char *name,
165 struct kset_uevent_ops *u, 203 const struct kset_uevent_ops *u,
166 struct kobject *parent_kobj); 204 struct kobject *parent_kobj);
167 205
168static inline struct kset *to_kset(struct kobject *kobj) 206static inline struct kset *to_kset(struct kobject *kobj)
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 1b672f74a32f..e7d1b2e0070d 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -122,6 +122,11 @@ struct kprobe {
122/* Kprobe status flags */ 122/* Kprobe status flags */
123#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ 123#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
124#define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ 124#define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */
125#define KPROBE_FLAG_OPTIMIZED 4 /*
126 * probe is really optimized.
127 * NOTE:
128 * this flag is only for optimized_kprobe.
129 */
125 130
126/* Has this kprobe gone ? */ 131/* Has this kprobe gone ? */
127static inline int kprobe_gone(struct kprobe *p) 132static inline int kprobe_gone(struct kprobe *p)
@@ -134,6 +139,12 @@ static inline int kprobe_disabled(struct kprobe *p)
134{ 139{
135 return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); 140 return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE);
136} 141}
142
143/* Is this kprobe really running optimized path ? */
144static inline int kprobe_optimized(struct kprobe *p)
145{
146 return p->flags & KPROBE_FLAG_OPTIMIZED;
147}
137/* 148/*
138 * Special probe type that uses setjmp-longjmp type tricks to resume 149 * Special probe type that uses setjmp-longjmp type tricks to resume
139 * execution at a specified entry with a matching prototype corresponding 150 * execution at a specified entry with a matching prototype corresponding
@@ -249,6 +260,39 @@ extern kprobe_opcode_t *get_insn_slot(void);
249extern void free_insn_slot(kprobe_opcode_t *slot, int dirty); 260extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
250extern void kprobes_inc_nmissed_count(struct kprobe *p); 261extern void kprobes_inc_nmissed_count(struct kprobe *p);
251 262
263#ifdef CONFIG_OPTPROBES
264/*
265 * Internal structure for direct jump optimized probe
266 */
267struct optimized_kprobe {
268 struct kprobe kp;
269 struct list_head list; /* list for optimizing queue */
270 struct arch_optimized_insn optinsn;
271};
272
273/* Architecture dependent functions for direct jump optimization */
274extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn);
275extern int arch_check_optimized_kprobe(struct optimized_kprobe *op);
276extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op);
277extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op);
278extern int arch_optimize_kprobe(struct optimized_kprobe *op);
279extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
280extern kprobe_opcode_t *get_optinsn_slot(void);
281extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
282extern int arch_within_optimized_kprobe(struct optimized_kprobe *op,
283 unsigned long addr);
284
285extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
286
287#ifdef CONFIG_SYSCTL
288extern int sysctl_kprobes_optimization;
289extern int proc_kprobes_optimization_handler(struct ctl_table *table,
290 int write, void __user *buffer,
291 size_t *length, loff_t *ppos);
292#endif
293
294#endif /* CONFIG_OPTPROBES */
295
252/* Get the kprobe at this addr (if any) - called with preemption disabled */ 296/* Get the kprobe at this addr (if any) - called with preemption disabled */
253struct kprobe *get_kprobe(void *addr); 297struct kprobe *get_kprobe(void *addr);
254void kretprobe_hash_lock(struct task_struct *tsk, 298void kretprobe_hash_lock(struct task_struct *tsk,
diff --git a/include/linux/kref.h b/include/linux/kref.h
index b0cb0ebad9e6..6cc38fc07ab7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * kref.c - library routines for handling generic reference counted objects 2 * kref.h - library routines for handling generic reference counted objects
3 * 3 *
4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> 4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2004 IBM Corp. 5 * Copyright (C) 2004 IBM Corp.
@@ -21,7 +21,6 @@ struct kref {
21 atomic_t refcount; 21 atomic_t refcount;
22}; 22};
23 23
24void kref_set(struct kref *kref, int num);
25void kref_init(struct kref *kref); 24void kref_init(struct kref *kref);
26void kref_get(struct kref *kref); 25void kref_get(struct kref *kref);
27int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 26int kref_put(struct kref *kref, void (*release) (struct kref *kref));
diff --git a/include/linux/ks8842.h b/include/linux/ks8842.h
new file mode 100644
index 000000000000..da0341b8ca0a
--- /dev/null
+++ b/include/linux/ks8842.h
@@ -0,0 +1,34 @@
1/*
2 * ks8842.h KS8842 platform data struct definition
3 * Copyright (c) 2010 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef _LINUX_KS8842_H
20#define _LINUX_KS8842_H
21
22#include <linux/if_ether.h>
23
24/**
25 * struct ks8842_platform_data - Platform data of the KS8842 network driver
26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in
27 * the chip.
28 *
29 */
30struct ks8842_platform_data {
31 u8 macaddr[ETH_ALEN];
32};
33
34#endif
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index ce5983225be4..e1ceaa9b36bb 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -130,7 +130,7 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
130/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 130/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
131#define ktime_to_ns(kt) ((kt).tv64) 131#define ktime_to_ns(kt) ((kt).tv64)
132 132
133#else 133#else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
134 134
135/* 135/*
136 * Helper macros/inlines to get the ktime_t math right in the timespec 136 * Helper macros/inlines to get the ktime_t math right in the timespec
@@ -275,7 +275,7 @@ static inline s64 ktime_to_ns(const ktime_t kt)
275 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; 275 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
276} 276}
277 277
278#endif 278#endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
279 279
280/** 280/**
281 * ktime_equal - Compares two ktime_t variables to see if they are equal 281 * ktime_equal - Compares two ktime_t variables to see if they are equal
@@ -295,6 +295,12 @@ static inline s64 ktime_to_us(const ktime_t kt)
295 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; 295 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
296} 296}
297 297
298static inline s64 ktime_to_ms(const ktime_t kt)
299{
300 struct timeval tv = ktime_to_timeval(kt);
301 return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
302}
303
298static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) 304static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
299{ 305{
300 return ktime_to_us(ktime_sub(later, earlier)); 306 return ktime_to_us(ktime_sub(later, earlier));
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index a24de0b1858e..23ea02253900 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -103,7 +103,7 @@ struct kvm_userspace_memory_region {
103 103
104/* for kvm_memory_region::flags */ 104/* for kvm_memory_region::flags */
105#define KVM_MEM_LOG_DIRTY_PAGES 1UL 105#define KVM_MEM_LOG_DIRTY_PAGES 1UL
106 106#define KVM_MEMSLOT_INVALID (1UL << 1)
107 107
108/* for KVM_IRQ_LINE */ 108/* for KVM_IRQ_LINE */
109struct kvm_irq_level { 109struct kvm_irq_level {
@@ -160,6 +160,7 @@ struct kvm_pit_config {
160#define KVM_EXIT_DCR 15 160#define KVM_EXIT_DCR 15
161#define KVM_EXIT_NMI 16 161#define KVM_EXIT_NMI 16
162#define KVM_EXIT_INTERNAL_ERROR 17 162#define KVM_EXIT_INTERNAL_ERROR 17
163#define KVM_EXIT_OSI 18
163 164
164/* For KVM_EXIT_INTERNAL_ERROR */ 165/* For KVM_EXIT_INTERNAL_ERROR */
165#define KVM_INTERNAL_ERROR_EMULATION 1 166#define KVM_INTERNAL_ERROR_EMULATION 1
@@ -259,6 +260,10 @@ struct kvm_run {
259 __u32 ndata; 260 __u32 ndata;
260 __u64 data[16]; 261 __u64 data[16];
261 } internal; 262 } internal;
263 /* KVM_EXIT_OSI */
264 struct {
265 __u64 gprs[32];
266 } osi;
262 /* Fix the size of the union. */ 267 /* Fix the size of the union. */
263 char padding[256]; 268 char padding[256];
264 }; 269 };
@@ -400,6 +405,15 @@ struct kvm_ioeventfd {
400 __u8 pad[36]; 405 __u8 pad[36];
401}; 406};
402 407
408/* for KVM_ENABLE_CAP */
409struct kvm_enable_cap {
410 /* in */
411 __u32 cap;
412 __u32 flags;
413 __u64 args[4];
414 __u8 pad[64];
415};
416
403#define KVMIO 0xAE 417#define KVMIO 0xAE
404 418
405/* 419/*
@@ -497,6 +511,19 @@ struct kvm_ioeventfd {
497#endif 511#endif
498#define KVM_CAP_S390_PSW 42 512#define KVM_CAP_S390_PSW 42
499#define KVM_CAP_PPC_SEGSTATE 43 513#define KVM_CAP_PPC_SEGSTATE 43
514#define KVM_CAP_HYPERV 44
515#define KVM_CAP_HYPERV_VAPIC 45
516#define KVM_CAP_HYPERV_SPIN 46
517#define KVM_CAP_PCI_SEGMENT 47
518#define KVM_CAP_PPC_PAIRED_SINGLES 48
519#define KVM_CAP_INTR_SHADOW 49
520#ifdef __KVM_HAVE_DEBUGREGS
521#define KVM_CAP_DEBUGREGS 50
522#endif
523#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
524#define KVM_CAP_PPC_OSI 52
525#define KVM_CAP_PPC_UNSET_IRQ 53
526#define KVM_CAP_ENABLE_CAP 54
500 527
501#ifdef KVM_CAP_IRQ_ROUTING 528#ifdef KVM_CAP_IRQ_ROUTING
502 529
@@ -683,6 +710,10 @@ struct kvm_clock_data {
683/* Available with KVM_CAP_VCPU_EVENTS */ 710/* Available with KVM_CAP_VCPU_EVENTS */
684#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) 711#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
685#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) 712#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
713/* Available with KVM_CAP_DEBUGREGS */
714#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
715#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
716#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
686 717
687#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 718#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
688 719
@@ -691,8 +722,9 @@ struct kvm_assigned_pci_dev {
691 __u32 busnr; 722 __u32 busnr;
692 __u32 devfn; 723 __u32 devfn;
693 __u32 flags; 724 __u32 flags;
725 __u32 segnr;
694 union { 726 union {
695 __u32 reserved[12]; 727 __u32 reserved[11];
696 }; 728 };
697}; 729};
698 730
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index bd5a616d9373..7cb116afa1cd 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -38,6 +38,7 @@
38#define KVM_REQ_MMU_SYNC 7 38#define KVM_REQ_MMU_SYNC 7
39#define KVM_REQ_KVMCLOCK_UPDATE 8 39#define KVM_REQ_KVMCLOCK_UPDATE 8
40#define KVM_REQ_KICK 9 40#define KVM_REQ_KICK 9
41#define KVM_REQ_DEACTIVATE_FPU 10
41 42
42#define KVM_USERSPACE_IRQ_SOURCE_ID 0 43#define KVM_USERSPACE_IRQ_SOURCE_ID 0
43 44
@@ -53,24 +54,24 @@ extern struct kmem_cache *kvm_vcpu_cache;
53 */ 54 */
54struct kvm_io_bus { 55struct kvm_io_bus {
55 int dev_count; 56 int dev_count;
56#define NR_IOBUS_DEVS 6 57#define NR_IOBUS_DEVS 200
57 struct kvm_io_device *devs[NR_IOBUS_DEVS]; 58 struct kvm_io_device *devs[NR_IOBUS_DEVS];
58}; 59};
59 60
60void kvm_io_bus_init(struct kvm_io_bus *bus); 61enum kvm_bus {
61void kvm_io_bus_destroy(struct kvm_io_bus *bus); 62 KVM_MMIO_BUS,
62int kvm_io_bus_write(struct kvm_io_bus *bus, gpa_t addr, int len, 63 KVM_PIO_BUS,
63 const void *val); 64 KVM_NR_BUSES
64int kvm_io_bus_read(struct kvm_io_bus *bus, gpa_t addr, int len, 65};
66
67int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
68 int len, const void *val);
69int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
65 void *val); 70 void *val);
66int __kvm_io_bus_register_dev(struct kvm_io_bus *bus, 71int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx,
67 struct kvm_io_device *dev);
68int kvm_io_bus_register_dev(struct kvm *kvm, struct kvm_io_bus *bus,
69 struct kvm_io_device *dev); 72 struct kvm_io_device *dev);
70void __kvm_io_bus_unregister_dev(struct kvm_io_bus *bus, 73int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
71 struct kvm_io_device *dev); 74 struct kvm_io_device *dev);
72void kvm_io_bus_unregister_dev(struct kvm *kvm, struct kvm_io_bus *bus,
73 struct kvm_io_device *dev);
74 75
75struct kvm_vcpu { 76struct kvm_vcpu {
76 struct kvm *kvm; 77 struct kvm *kvm;
@@ -83,6 +84,8 @@ struct kvm_vcpu {
83 struct kvm_run *run; 84 struct kvm_run *run;
84 unsigned long requests; 85 unsigned long requests;
85 unsigned long guest_debug; 86 unsigned long guest_debug;
87 int srcu_idx;
88
86 int fpu_active; 89 int fpu_active;
87 int guest_fpu_loaded; 90 int guest_fpu_loaded;
88 wait_queue_head_t wq; 91 wait_queue_head_t wq;
@@ -102,6 +105,12 @@ struct kvm_vcpu {
102 struct kvm_vcpu_arch arch; 105 struct kvm_vcpu_arch arch;
103}; 106};
104 107
108/*
109 * Some of the bitops functions do not support too long bitmaps.
110 * This number must be determined not to exceed such limits.
111 */
112#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
113
105struct kvm_memory_slot { 114struct kvm_memory_slot {
106 gfn_t base_gfn; 115 gfn_t base_gfn;
107 unsigned long npages; 116 unsigned long npages;
@@ -116,6 +125,11 @@ struct kvm_memory_slot {
116 int user_alloc; 125 int user_alloc;
117}; 126};
118 127
128static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
129{
130 return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
131}
132
119struct kvm_kernel_irq_routing_entry { 133struct kvm_kernel_irq_routing_entry {
120 u32 gsi; 134 u32 gsi;
121 u32 type; 135 u32 type;
@@ -150,14 +164,19 @@ struct kvm_irq_routing_table {};
150 164
151#endif 165#endif
152 166
153struct kvm { 167struct kvm_memslots {
154 spinlock_t mmu_lock;
155 spinlock_t requests_lock;
156 struct rw_semaphore slots_lock;
157 struct mm_struct *mm; /* userspace tied to this vm */
158 int nmemslots; 168 int nmemslots;
159 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 169 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
160 KVM_PRIVATE_MEM_SLOTS]; 170 KVM_PRIVATE_MEM_SLOTS];
171};
172
173struct kvm {
174 spinlock_t mmu_lock;
175 raw_spinlock_t requests_lock;
176 struct mutex slots_lock;
177 struct mm_struct *mm; /* userspace tied to this vm */
178 struct kvm_memslots *memslots;
179 struct srcu_struct srcu;
161#ifdef CONFIG_KVM_APIC_ARCHITECTURE 180#ifdef CONFIG_KVM_APIC_ARCHITECTURE
162 u32 bsp_vcpu_id; 181 u32 bsp_vcpu_id;
163 struct kvm_vcpu *bsp_vcpu; 182 struct kvm_vcpu *bsp_vcpu;
@@ -166,8 +185,7 @@ struct kvm {
166 atomic_t online_vcpus; 185 atomic_t online_vcpus;
167 struct list_head vm_list; 186 struct list_head vm_list;
168 struct mutex lock; 187 struct mutex lock;
169 struct kvm_io_bus mmio_bus; 188 struct kvm_io_bus *buses[KVM_NR_BUSES];
170 struct kvm_io_bus pio_bus;
171#ifdef CONFIG_HAVE_KVM_EVENTFD 189#ifdef CONFIG_HAVE_KVM_EVENTFD
172 struct { 190 struct {
173 spinlock_t lock; 191 spinlock_t lock;
@@ -225,17 +243,23 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
225void vcpu_load(struct kvm_vcpu *vcpu); 243void vcpu_load(struct kvm_vcpu *vcpu);
226void vcpu_put(struct kvm_vcpu *vcpu); 244void vcpu_put(struct kvm_vcpu *vcpu);
227 245
228int kvm_init(void *opaque, unsigned int vcpu_size, 246int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
229 struct module *module); 247 struct module *module);
230void kvm_exit(void); 248void kvm_exit(void);
231 249
232void kvm_get_kvm(struct kvm *kvm); 250void kvm_get_kvm(struct kvm *kvm);
233void kvm_put_kvm(struct kvm *kvm); 251void kvm_put_kvm(struct kvm *kvm);
234 252
253static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
254{
255 return rcu_dereference_check(kvm->memslots,
256 srcu_read_lock_held(&kvm->srcu)
257 || lockdep_is_held(&kvm->slots_lock));
258}
259
235#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 260#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
236#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 261#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
237static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 262static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
238struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
239 263
240extern struct page *bad_page; 264extern struct page *bad_page;
241extern pfn_t bad_pfn; 265extern pfn_t bad_pfn;
@@ -249,13 +273,20 @@ int kvm_set_memory_region(struct kvm *kvm,
249int __kvm_set_memory_region(struct kvm *kvm, 273int __kvm_set_memory_region(struct kvm *kvm,
250 struct kvm_userspace_memory_region *mem, 274 struct kvm_userspace_memory_region *mem,
251 int user_alloc); 275 int user_alloc);
252int kvm_arch_set_memory_region(struct kvm *kvm, 276int kvm_arch_prepare_memory_region(struct kvm *kvm,
277 struct kvm_memory_slot *memslot,
278 struct kvm_memory_slot old,
279 struct kvm_userspace_memory_region *mem,
280 int user_alloc);
281void kvm_arch_commit_memory_region(struct kvm *kvm,
253 struct kvm_userspace_memory_region *mem, 282 struct kvm_userspace_memory_region *mem,
254 struct kvm_memory_slot old, 283 struct kvm_memory_slot old,
255 int user_alloc); 284 int user_alloc);
256void kvm_disable_largepages(void); 285void kvm_disable_largepages(void);
257void kvm_arch_flush_shadow(struct kvm *kvm); 286void kvm_arch_flush_shadow(struct kvm *kvm);
258gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); 287gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
288gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn);
289
259struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 290struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
260unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 291unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
261void kvm_release_page_clean(struct page *page); 292void kvm_release_page_clean(struct page *page);
@@ -264,6 +295,9 @@ void kvm_set_page_dirty(struct page *page);
264void kvm_set_page_accessed(struct page *page); 295void kvm_set_page_accessed(struct page *page);
265 296
266pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); 297pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
298pfn_t gfn_to_pfn_memslot(struct kvm *kvm,
299 struct kvm_memory_slot *slot, gfn_t gfn);
300int memslot_id(struct kvm *kvm, gfn_t gfn);
267void kvm_release_pfn_dirty(pfn_t); 301void kvm_release_pfn_dirty(pfn_t);
268void kvm_release_pfn_clean(pfn_t pfn); 302void kvm_release_pfn_clean(pfn_t pfn);
269void kvm_set_pfn_dirty(pfn_t pfn); 303void kvm_set_pfn_dirty(pfn_t pfn);
@@ -283,6 +317,7 @@ int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
283int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); 317int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
284struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); 318struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
285int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); 319int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
320unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn);
286void mark_page_dirty(struct kvm *kvm, gfn_t gfn); 321void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
287 322
288void kvm_vcpu_block(struct kvm_vcpu *vcpu); 323void kvm_vcpu_block(struct kvm_vcpu *vcpu);
@@ -383,6 +418,7 @@ struct kvm_assigned_dev_kernel {
383 struct work_struct interrupt_work; 418 struct work_struct interrupt_work;
384 struct list_head list; 419 struct list_head list;
385 int assigned_dev_id; 420 int assigned_dev_id;
421 int host_segnr;
386 int host_busnr; 422 int host_busnr;
387 int host_devfn; 423 int host_devfn;
388 unsigned int entries_nr; 424 unsigned int entries_nr;
@@ -429,8 +465,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
429#define KVM_IOMMU_CACHE_COHERENCY 0x1 465#define KVM_IOMMU_CACHE_COHERENCY 0x1
430 466
431#ifdef CONFIG_IOMMU_API 467#ifdef CONFIG_IOMMU_API
432int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, 468int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
433 unsigned long npages);
434int kvm_iommu_map_guest(struct kvm *kvm); 469int kvm_iommu_map_guest(struct kvm *kvm);
435int kvm_iommu_unmap_guest(struct kvm *kvm); 470int kvm_iommu_unmap_guest(struct kvm *kvm);
436int kvm_assign_device(struct kvm *kvm, 471int kvm_assign_device(struct kvm *kvm,
@@ -480,11 +515,6 @@ static inline void kvm_guest_exit(void)
480 current->flags &= ~PF_VCPU; 515 current->flags &= ~PF_VCPU;
481} 516}
482 517
483static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot)
484{
485 return slot - kvm->memslots;
486}
487
488static inline gpa_t gfn_to_gpa(gfn_t gfn) 518static inline gpa_t gfn_to_gpa(gfn_t gfn)
489{ 519{
490 return (gpa_t)gfn << PAGE_SHIFT; 520 return (gpa_t)gfn << PAGE_SHIFT;
@@ -532,6 +562,10 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
532} 562}
533#endif 563#endif
534 564
565#ifndef KVM_ARCH_HAS_UNALIAS_INSTANTIATION
566#define unalias_gfn_instantiation unalias_gfn
567#endif
568
535#ifdef CONFIG_HAVE_KVM_IRQCHIP 569#ifdef CONFIG_HAVE_KVM_IRQCHIP
536 570
537#define KVM_MAX_IRQ_ROUTES 1024 571#define KVM_MAX_IRQ_ROUTES 1024
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
new file mode 100644
index 000000000000..4bdb31df8e72
--- /dev/null
+++ b/include/linux/l2tp.h
@@ -0,0 +1,163 @@
1/*
2 * L2TP-over-IP socket for L2TPv3.
3 *
4 * Author: James Chapman <jchapman@katalix.com>
5 */
6
7#ifndef _LINUX_L2TP_H_
8#define _LINUX_L2TP_H_
9
10#include <linux/types.h>
11#ifdef __KERNEL__
12#include <linux/socket.h>
13#include <linux/in.h>
14#else
15#include <netinet/in.h>
16#endif
17
18#define IPPROTO_L2TP 115
19
20/**
21 * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
22 * @l2tp_family: address family number AF_L2TPIP.
23 * @l2tp_addr: protocol specific address information
24 * @l2tp_conn_id: connection id of tunnel
25 */
26#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
27struct sockaddr_l2tpip {
28 /* The first fields must match struct sockaddr_in */
29 sa_family_t l2tp_family; /* AF_INET */
30 __be16 l2tp_unused; /* INET port number (unused) */
31 struct in_addr l2tp_addr; /* Internet address */
32
33 __u32 l2tp_conn_id; /* Connection ID of tunnel */
34
35 /* Pad to size of `struct sockaddr'. */
36 unsigned char __pad[sizeof(struct sockaddr) - sizeof(sa_family_t) -
37 sizeof(__be16) - sizeof(struct in_addr) -
38 sizeof(__u32)];
39};
40
41/*****************************************************************************
42 * NETLINK_GENERIC netlink family.
43 *****************************************************************************/
44
45/*
46 * Commands.
47 * Valid TLVs of each command are:-
48 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
49 * TUNNEL_DELETE - CONN_ID
50 * TUNNEL_MODIFY - CONN_ID, udpcsum
51 * TUNNEL_GETSTATS - CONN_ID, (stats)
52 * TUNNEL_GET - CONN_ID, (...)
53 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
54 * SESSION_DELETE - SESSION_ID
55 * SESSION_MODIFY - SESSION_ID, data_seq
56 * SESSION_GET - SESSION_ID, (...)
57 * SESSION_GETSTATS - SESSION_ID, (stats)
58 *
59 */
60enum {
61 L2TP_CMD_NOOP,
62 L2TP_CMD_TUNNEL_CREATE,
63 L2TP_CMD_TUNNEL_DELETE,
64 L2TP_CMD_TUNNEL_MODIFY,
65 L2TP_CMD_TUNNEL_GET,
66 L2TP_CMD_SESSION_CREATE,
67 L2TP_CMD_SESSION_DELETE,
68 L2TP_CMD_SESSION_MODIFY,
69 L2TP_CMD_SESSION_GET,
70 __L2TP_CMD_MAX,
71};
72
73#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
74
75/*
76 * ATTR types defined for L2TP
77 */
78enum {
79 L2TP_ATTR_NONE, /* no data */
80 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
81 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
82 L2TP_ATTR_OFFSET, /* u16 */
83 L2TP_ATTR_DATA_SEQ, /* u16 */
84 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
85 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
86 L2TP_ATTR_PROTO_VERSION, /* u8 */
87 L2TP_ATTR_IFNAME, /* string */
88 L2TP_ATTR_CONN_ID, /* u32 */
89 L2TP_ATTR_PEER_CONN_ID, /* u32 */
90 L2TP_ATTR_SESSION_ID, /* u32 */
91 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
92 L2TP_ATTR_UDP_CSUM, /* u8 */
93 L2TP_ATTR_VLAN_ID, /* u16 */
94 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
95 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
96 L2TP_ATTR_DEBUG, /* u32 */
97 L2TP_ATTR_RECV_SEQ, /* u8 */
98 L2TP_ATTR_SEND_SEQ, /* u8 */
99 L2TP_ATTR_LNS_MODE, /* u8 */
100 L2TP_ATTR_USING_IPSEC, /* u8 */
101 L2TP_ATTR_RECV_TIMEOUT, /* msec */
102 L2TP_ATTR_FD, /* int */
103 L2TP_ATTR_IP_SADDR, /* u32 */
104 L2TP_ATTR_IP_DADDR, /* u32 */
105 L2TP_ATTR_UDP_SPORT, /* u16 */
106 L2TP_ATTR_UDP_DPORT, /* u16 */
107 L2TP_ATTR_MTU, /* u16 */
108 L2TP_ATTR_MRU, /* u16 */
109 L2TP_ATTR_STATS, /* nested */
110 __L2TP_ATTR_MAX,
111};
112
113#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
114
115/* Nested in L2TP_ATTR_STATS */
116enum {
117 L2TP_ATTR_STATS_NONE, /* no data */
118 L2TP_ATTR_TX_PACKETS, /* u64 */
119 L2TP_ATTR_TX_BYTES, /* u64 */
120 L2TP_ATTR_TX_ERRORS, /* u64 */
121 L2TP_ATTR_RX_PACKETS, /* u64 */
122 L2TP_ATTR_RX_BYTES, /* u64 */
123 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
124 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
125 L2TP_ATTR_RX_ERRORS, /* u64 */
126 __L2TP_ATTR_STATS_MAX,
127};
128
129#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
130
131enum l2tp_pwtype {
132 L2TP_PWTYPE_NONE = 0x0000,
133 L2TP_PWTYPE_ETH_VLAN = 0x0004,
134 L2TP_PWTYPE_ETH = 0x0005,
135 L2TP_PWTYPE_PPP = 0x0007,
136 L2TP_PWTYPE_PPP_AC = 0x0008,
137 L2TP_PWTYPE_IP = 0x000b,
138 __L2TP_PWTYPE_MAX
139};
140
141enum l2tp_l2spec_type {
142 L2TP_L2SPECTYPE_NONE,
143 L2TP_L2SPECTYPE_DEFAULT,
144};
145
146enum l2tp_encap_type {
147 L2TP_ENCAPTYPE_UDP,
148 L2TP_ENCAPTYPE_IP,
149};
150
151enum l2tp_seqmode {
152 L2TP_SEQ_NONE = 0,
153 L2TP_SEQ_IP = 1,
154 L2TP_SEQ_ALL = 2,
155};
156
157/*
158 * NETLINK_GENERIC related info
159 */
160#define L2TP_GENL_NAME "l2tp"
161#define L2TP_GENL_VERSION 0x1
162
163#endif
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index c67fecafff90..8877123f2d6e 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -69,6 +69,29 @@ struct lcd_device {
69 struct device dev; 69 struct device dev;
70}; 70};
71 71
72struct lcd_platform_data {
73 /* reset lcd panel device. */
74 int (*reset)(struct lcd_device *ld);
75 /* on or off to lcd panel. if 'enable' is 0 then
76 lcd power off and 1, lcd power on. */
77 int (*power_on)(struct lcd_device *ld, int enable);
78
79 /* it indicates whether lcd panel was enabled
80 from bootloader or not. */
81 int lcd_enabled;
82 /* it means delay for stable time when it becomes low to high
83 or high to low that is dependent on whether reset gpio is
84 low active or high active. */
85 unsigned int reset_delay;
86 /* stable time needing to become lcd power on. */
87 unsigned int power_on_delay;
88 /* stable time needing to become lcd power off. */
89 unsigned int power_off_delay;
90
91 /* it could be used for any purpose. */
92 void *pdata;
93};
94
72static inline void lcd_set_power(struct lcd_device *ld, int power) 95static inline void lcd_set_power(struct lcd_device *ld, int power)
73{ 96{
74 mutex_lock(&ld->update_lock); 97 mutex_lock(&ld->update_lock);
diff --git a/include/linux/lcm.h b/include/linux/lcm.h
new file mode 100644
index 000000000000..7bf01d779b45
--- /dev/null
+++ b/include/linux/lcm.h
@@ -0,0 +1,8 @@
1#ifndef _LCM_H
2#define _LCM_H
3
4#include <linux/compiler.h>
5
6unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__;
7
8#endif /* _LCM_H */
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d8bf9665e70c..ba6986a11663 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -149,14 +149,18 @@ struct gpio_led {
149 unsigned default_state : 2; 149 unsigned default_state : 2;
150 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ 150 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */
151}; 151};
152#define LEDS_GPIO_DEFSTATE_OFF 0 152#define LEDS_GPIO_DEFSTATE_OFF 0
153#define LEDS_GPIO_DEFSTATE_ON 1 153#define LEDS_GPIO_DEFSTATE_ON 1
154#define LEDS_GPIO_DEFSTATE_KEEP 2 154#define LEDS_GPIO_DEFSTATE_KEEP 2
155 155
156struct gpio_led_platform_data { 156struct gpio_led_platform_data {
157 int num_leds; 157 int num_leds;
158 struct gpio_led *leds; 158 struct gpio_led *leds;
159 int (*gpio_blink_set)(unsigned gpio, 159
160#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
161#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
162#define GPIO_LED_BLINK 2 /* Plase, blink */
163 int (*gpio_blink_set)(unsigned gpio, int state,
160 unsigned long *delay_on, 164 unsigned long *delay_on,
161 unsigned long *delay_off); 165 unsigned long *delay_off);
162}; 166};
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 73112250862c..b85f3ff34d7d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -146,6 +146,7 @@ enum {
146 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 146 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
147 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 147 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
148 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ 148 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
149 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
149 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 150 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
150 151
151 ATA_DFLAG_DETACH = (1 << 24), 152 ATA_DFLAG_DETACH = (1 << 24),
@@ -201,12 +202,6 @@ enum {
201 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
202 * led */ 203 * led */
203 204
204 /* The following flag belongs to ap->pflags but is kept in
205 * ap->flags because it's referenced in many LLDs and will be
206 * removed in not-too-distant future.
207 */
208 ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */
209
210 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 205 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
211 206
212 207
@@ -255,12 +250,13 @@ enum {
255 ATA_TMOUT_INTERNAL_QUICK = 5000, 250 ATA_TMOUT_INTERNAL_QUICK = 5000,
256 ATA_TMOUT_MAX_PARK = 30000, 251 ATA_TMOUT_MAX_PARK = 30000,
257 252
258 /* FIXME: GoVault needs 2s but we can't afford that without 253 /*
259 * parallel probing. 800ms is enough for iVDR disk 254 * GoVault needs 2s and iVDR disk HHD424020F7SV00 800ms. 2s
260 * HHD424020F7SV00. Increase to 2secs when parallel probing 255 * is too much without parallel probing. Use 2s if parallel
261 * is in place. 256 * probing is available, 800ms otherwise.
262 */ 257 */
263 ATA_TMOUT_FF_WAIT = 800, 258 ATA_TMOUT_FF_WAIT_LONG = 2000,
259 ATA_TMOUT_FF_WAIT = 800,
264 260
265 /* Spec mandates to wait for ">= 2ms" before checking status 261 /* Spec mandates to wait for ">= 2ms" before checking status
266 * after reset. We wait 150ms, because that was the magic 262 * after reset. We wait 150ms, because that was the magic
@@ -390,6 +386,7 @@ enum {
390 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ 386 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
391 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ 387 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */
392 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ 388 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
389 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
393 390
394 /* DMA mask for user DMA control: User visible values; DO NOT 391 /* DMA mask for user DMA control: User visible values; DO NOT
395 renumber */ 392 renumber */
@@ -517,7 +514,9 @@ struct ata_ioports {
517 void __iomem *command_addr; 514 void __iomem *command_addr;
518 void __iomem *altstatus_addr; 515 void __iomem *altstatus_addr;
519 void __iomem *ctl_addr; 516 void __iomem *ctl_addr;
517#ifdef CONFIG_ATA_BMDMA
520 void __iomem *bmdma_addr; 518 void __iomem *bmdma_addr;
519#endif /* CONFIG_ATA_BMDMA */
521 void __iomem *scr_addr; 520 void __iomem *scr_addr;
522}; 521};
523#endif /* CONFIG_ATA_SFF */ 522#endif /* CONFIG_ATA_SFF */
@@ -720,15 +719,17 @@ struct ata_port {
720 unsigned int print_id; /* user visible unique port ID */ 719 unsigned int print_id; /* user visible unique port ID */
721 unsigned int port_no; /* 0 based port no. inside the host */ 720 unsigned int port_no; /* 0 based port no. inside the host */
722 721
723 struct ata_prd *prd; /* our SG list */
724 dma_addr_t prd_dma; /* and its DMA mapping */
725
726#ifdef CONFIG_ATA_SFF 722#ifdef CONFIG_ATA_SFF
727 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 723 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
728#endif /* CONFIG_ATA_SFF */
729
730 u8 ctl; /* cache of ATA control register */ 724 u8 ctl; /* cache of ATA control register */
731 u8 last_ctl; /* Cache last written value */ 725 u8 last_ctl; /* Cache last written value */
726 struct delayed_work sff_pio_task;
727#ifdef CONFIG_ATA_BMDMA
728 struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */
729 dma_addr_t bmdma_prd_dma; /* and its DMA mapping */
730#endif /* CONFIG_ATA_BMDMA */
731#endif /* CONFIG_ATA_SFF */
732
732 unsigned int pio_mask; 733 unsigned int pio_mask;
733 unsigned int mwdma_mask; 734 unsigned int mwdma_mask;
734 unsigned int udma_mask; 735 unsigned int udma_mask;
@@ -750,8 +751,6 @@ struct ata_port {
750 struct ata_host *host; 751 struct ata_host *host;
751 struct device *dev; 752 struct device *dev;
752 753
753 void *port_task_data;
754 struct delayed_work port_task;
755 struct delayed_work hotplug_task; 754 struct delayed_work hotplug_task;
756 struct work_struct scsi_rescan_task; 755 struct work_struct scsi_rescan_task;
757 756
@@ -848,6 +847,7 @@ struct ata_port_operations {
848 * SFF / taskfile oriented ops 847 * SFF / taskfile oriented ops
849 */ 848 */
850 void (*sff_dev_select)(struct ata_port *ap, unsigned int device); 849 void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
850 void (*sff_set_devctl)(struct ata_port *ap, u8 ctl);
851 u8 (*sff_check_status)(struct ata_port *ap); 851 u8 (*sff_check_status)(struct ata_port *ap);
852 u8 (*sff_check_altstatus)(struct ata_port *ap); 852 u8 (*sff_check_altstatus)(struct ata_port *ap);
853 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf); 853 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf);
@@ -856,15 +856,17 @@ struct ata_port_operations {
856 const struct ata_taskfile *tf); 856 const struct ata_taskfile *tf);
857 unsigned int (*sff_data_xfer)(struct ata_device *dev, 857 unsigned int (*sff_data_xfer)(struct ata_device *dev,
858 unsigned char *buf, unsigned int buflen, int rw); 858 unsigned char *buf, unsigned int buflen, int rw);
859 u8 (*sff_irq_on)(struct ata_port *); 859 void (*sff_irq_on)(struct ata_port *);
860 bool (*sff_irq_check)(struct ata_port *);
860 void (*sff_irq_clear)(struct ata_port *); 861 void (*sff_irq_clear)(struct ata_port *);
862 void (*sff_drain_fifo)(struct ata_queued_cmd *qc);
861 863
864#ifdef CONFIG_ATA_BMDMA
862 void (*bmdma_setup)(struct ata_queued_cmd *qc); 865 void (*bmdma_setup)(struct ata_queued_cmd *qc);
863 void (*bmdma_start)(struct ata_queued_cmd *qc); 866 void (*bmdma_start)(struct ata_queued_cmd *qc);
864 void (*bmdma_stop)(struct ata_queued_cmd *qc); 867 void (*bmdma_stop)(struct ata_queued_cmd *qc);
865 u8 (*bmdma_status)(struct ata_port *ap); 868 u8 (*bmdma_status)(struct ata_port *ap);
866 869#endif /* CONFIG_ATA_BMDMA */
867 void (*drain_fifo)(struct ata_queued_cmd *qc);
868#endif /* CONFIG_ATA_SFF */ 870#endif /* CONFIG_ATA_SFF */
869 871
870 ssize_t (*em_show)(struct ata_port *ap, char *buf); 872 ssize_t (*em_show)(struct ata_port *ap, char *buf);
@@ -933,7 +935,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
933 return ap->ops == &ata_dummy_port_ops; 935 return ap->ops == &ata_dummy_port_ops;
934} 936}
935 937
936extern void ata_port_probe(struct ata_port *);
937extern int sata_set_spd(struct ata_link *link); 938extern int sata_set_spd(struct ata_link *link);
938extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); 939extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
939extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, 940extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
@@ -948,7 +949,6 @@ extern int sata_link_hardreset(struct ata_link *link,
948extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, 949extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
949 unsigned long deadline); 950 unsigned long deadline);
950extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 951extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
951extern void ata_port_disable(struct ata_port *);
952 952
953extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 953extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
954extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 954extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
@@ -1004,7 +1004,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
1004extern int ata_xfer_mode2shift(unsigned long xfer_mode); 1004extern int ata_xfer_mode2shift(unsigned long xfer_mode);
1005extern const char *ata_mode_string(unsigned long xfer_mask); 1005extern const char *ata_mode_string(unsigned long xfer_mask);
1006extern unsigned long ata_id_xfermask(const u16 *id); 1006extern unsigned long ata_id_xfermask(const u16 *id);
1007extern int ata_port_start(struct ata_port *ap);
1008extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 1007extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
1009extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 1008extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
1010extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 1009extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -1024,6 +1023,7 @@ extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
1024extern int ata_std_bios_param(struct scsi_device *sdev, 1023extern int ata_std_bios_param(struct scsi_device *sdev,
1025 struct block_device *bdev, 1024 struct block_device *bdev,
1026 sector_t capacity, int geom[]); 1025 sector_t capacity, int geom[]);
1026extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
1027extern int ata_scsi_slave_config(struct scsi_device *sdev); 1027extern int ata_scsi_slave_config(struct scsi_device *sdev);
1028extern void ata_scsi_slave_destroy(struct scsi_device *sdev); 1028extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
1029extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 1029extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
@@ -1037,9 +1037,6 @@ extern int ata_cable_sata(struct ata_port *ap);
1037extern int ata_cable_ignore(struct ata_port *ap); 1037extern int ata_cable_ignore(struct ata_port *ap);
1038extern int ata_cable_unknown(struct ata_port *ap); 1038extern int ata_cable_unknown(struct ata_port *ap);
1039 1039
1040extern void ata_pio_queue_task(struct ata_port *ap, void *data,
1041 unsigned long delay);
1042
1043/* Timing helpers */ 1040/* Timing helpers */
1044extern unsigned int ata_pio_need_iordy(const struct ata_device *); 1041extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1045extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 1042extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
@@ -1178,6 +1175,7 @@ extern struct device_attribute *ata_common_sdev_attrs[];
1178 .slave_configure = ata_scsi_slave_config, \ 1175 .slave_configure = ata_scsi_slave_config, \
1179 .slave_destroy = ata_scsi_slave_destroy, \ 1176 .slave_destroy = ata_scsi_slave_destroy, \
1180 .bios_param = ata_std_bios_param, \ 1177 .bios_param = ata_std_bios_param, \
1178 .unlock_native_capacity = ata_scsi_unlock_native_capacity, \
1181 .sdev_attrs = ata_common_sdev_attrs 1179 .sdev_attrs = ata_common_sdev_attrs
1182 1180
1183#define ATA_NCQ_SHT(drv_name) \ 1181#define ATA_NCQ_SHT(drv_name) \
@@ -1441,7 +1439,11 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1441{ 1439{
1442 memset(tf, 0, sizeof(*tf)); 1440 memset(tf, 0, sizeof(*tf));
1443 1441
1442#ifdef CONFIG_ATA_SFF
1444 tf->ctl = dev->link->ap->ctl; 1443 tf->ctl = dev->link->ap->ctl;
1444#else
1445 tf->ctl = ATA_DEVCTL_OBS;
1446#endif
1445 if (dev->devno == 0) 1447 if (dev->devno == 0)
1446 tf->device = ATA_DEVICE_OBS; 1448 tf->device = ATA_DEVICE_OBS;
1447 else 1449 else
@@ -1562,7 +1564,6 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
1562#ifdef CONFIG_ATA_SFF 1564#ifdef CONFIG_ATA_SFF
1563 1565
1564extern const struct ata_port_operations ata_sff_port_ops; 1566extern const struct ata_port_operations ata_sff_port_ops;
1565extern const struct ata_port_operations ata_bmdma_port_ops;
1566extern const struct ata_port_operations ata_bmdma32_port_ops; 1567extern const struct ata_port_operations ata_bmdma32_port_ops;
1567 1568
1568/* PIO only, sg_tablesize and dma_boundary limits can be removed */ 1569/* PIO only, sg_tablesize and dma_boundary limits can be removed */
@@ -1571,13 +1572,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops;
1571 .sg_tablesize = LIBATA_MAX_PRD, \ 1572 .sg_tablesize = LIBATA_MAX_PRD, \
1572 .dma_boundary = ATA_DMA_BOUNDARY 1573 .dma_boundary = ATA_DMA_BOUNDARY
1573 1574
1574#define ATA_BMDMA_SHT(drv_name) \
1575 ATA_BASE_SHT(drv_name), \
1576 .sg_tablesize = LIBATA_MAX_PRD, \
1577 .dma_boundary = ATA_DMA_BOUNDARY
1578
1579extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1580extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1581extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); 1575extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1582extern u8 ata_sff_check_status(struct ata_port *ap); 1576extern u8 ata_sff_check_status(struct ata_port *ap);
1583extern void ata_sff_pause(struct ata_port *ap); 1577extern void ata_sff_pause(struct ata_port *ap);
@@ -1595,13 +1589,14 @@ extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1595 unsigned char *buf, unsigned int buflen, int rw); 1589 unsigned char *buf, unsigned int buflen, int rw);
1596extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1590extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1597 unsigned char *buf, unsigned int buflen, int rw); 1591 unsigned char *buf, unsigned int buflen, int rw);
1598extern u8 ata_sff_irq_on(struct ata_port *ap); 1592extern void ata_sff_irq_on(struct ata_port *ap);
1599extern void ata_sff_irq_clear(struct ata_port *ap); 1593extern void ata_sff_irq_clear(struct ata_port *ap);
1600extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, 1594extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1601 u8 status, int in_wq); 1595 u8 status, int in_wq);
1596extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay);
1602extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); 1597extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1603extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); 1598extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1604extern unsigned int ata_sff_host_intr(struct ata_port *ap, 1599extern unsigned int ata_sff_port_intr(struct ata_port *ap,
1605 struct ata_queued_cmd *qc); 1600 struct ata_queued_cmd *qc);
1606extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); 1601extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1607extern void ata_sff_lost_interrupt(struct ata_port *ap); 1602extern void ata_sff_lost_interrupt(struct ata_port *ap);
@@ -1619,21 +1614,8 @@ extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1619extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); 1614extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1620extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc); 1615extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1621extern void ata_sff_error_handler(struct ata_port *ap); 1616extern void ata_sff_error_handler(struct ata_port *ap);
1622extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1623extern int ata_sff_port_start(struct ata_port *ap);
1624extern int ata_sff_port_start32(struct ata_port *ap);
1625extern void ata_sff_std_ports(struct ata_ioports *ioaddr); 1617extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1626extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1627 unsigned long xfer_mask);
1628extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1629extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1630extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1631extern u8 ata_bmdma_status(struct ata_port *ap);
1632extern void ata_bus_reset(struct ata_port *ap);
1633
1634#ifdef CONFIG_PCI 1618#ifdef CONFIG_PCI
1635extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1636extern int ata_pci_bmdma_init(struct ata_host *host);
1637extern int ata_pci_sff_init_host(struct ata_host *host); 1619extern int ata_pci_sff_init_host(struct ata_host *host);
1638extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, 1620extern int ata_pci_sff_prepare_host(struct pci_dev *pdev,
1639 const struct ata_port_info * const * ppi, 1621 const struct ata_port_info * const * ppi,
@@ -1642,9 +1624,47 @@ extern int ata_pci_sff_activate_host(struct ata_host *host,
1642 irq_handler_t irq_handler, 1624 irq_handler_t irq_handler,
1643 struct scsi_host_template *sht); 1625 struct scsi_host_template *sht);
1644extern int ata_pci_sff_init_one(struct pci_dev *pdev, 1626extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1645 const struct ata_port_info * const * ppi, 1627 const struct ata_port_info * const * ppi,
1646 struct scsi_host_template *sht, void *host_priv); 1628 struct scsi_host_template *sht, void *host_priv, int hflags);
1629#endif /* CONFIG_PCI */
1630
1631#ifdef CONFIG_ATA_BMDMA
1632
1633extern const struct ata_port_operations ata_bmdma_port_ops;
1634
1635#define ATA_BMDMA_SHT(drv_name) \
1636 ATA_BASE_SHT(drv_name), \
1637 .sg_tablesize = LIBATA_MAX_PRD, \
1638 .dma_boundary = ATA_DMA_BOUNDARY
1639
1640extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc);
1641extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc);
1642extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc);
1643extern unsigned int ata_bmdma_port_intr(struct ata_port *ap,
1644 struct ata_queued_cmd *qc);
1645extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance);
1646extern void ata_bmdma_error_handler(struct ata_port *ap);
1647extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
1648extern void ata_bmdma_irq_clear(struct ata_port *ap);
1649extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1650extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1651extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1652extern u8 ata_bmdma_status(struct ata_port *ap);
1653extern int ata_bmdma_port_start(struct ata_port *ap);
1654extern int ata_bmdma_port_start32(struct ata_port *ap);
1655
1656#ifdef CONFIG_PCI
1657extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1658extern void ata_pci_bmdma_init(struct ata_host *host);
1659extern int ata_pci_bmdma_prepare_host(struct pci_dev *pdev,
1660 const struct ata_port_info * const * ppi,
1661 struct ata_host **r_host);
1662extern int ata_pci_bmdma_init_one(struct pci_dev *pdev,
1663 const struct ata_port_info * const * ppi,
1664 struct scsi_host_template *sht,
1665 void *host_priv, int hflags);
1647#endif /* CONFIG_PCI */ 1666#endif /* CONFIG_PCI */
1667#endif /* CONFIG_ATA_BMDMA */
1648 1668
1649/** 1669/**
1650 * ata_sff_busy_wait - Wait for a port status register 1670 * ata_sff_busy_wait - Wait for a port status register
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
index f1ca0dcc1628..0e8a346424bb 100644
--- a/include/linux/lis3lv02d.h
+++ b/include/linux/lis3lv02d.h
@@ -25,12 +25,14 @@ struct lis3lv02d_platform_data {
25#define LIS3_IRQ1_FF_WU_12 (3 << 0) 25#define LIS3_IRQ1_FF_WU_12 (3 << 0)
26#define LIS3_IRQ1_DATA_READY (4 << 0) 26#define LIS3_IRQ1_DATA_READY (4 << 0)
27#define LIS3_IRQ1_CLICK (7 << 0) 27#define LIS3_IRQ1_CLICK (7 << 0)
28#define LIS3_IRQ1_MASK (7 << 0)
28#define LIS3_IRQ2_DISABLE (0 << 3) 29#define LIS3_IRQ2_DISABLE (0 << 3)
29#define LIS3_IRQ2_FF_WU_1 (1 << 3) 30#define LIS3_IRQ2_FF_WU_1 (1 << 3)
30#define LIS3_IRQ2_FF_WU_2 (2 << 3) 31#define LIS3_IRQ2_FF_WU_2 (2 << 3)
31#define LIS3_IRQ2_FF_WU_12 (3 << 3) 32#define LIS3_IRQ2_FF_WU_12 (3 << 3)
32#define LIS3_IRQ2_DATA_READY (4 << 3) 33#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3) 34#define LIS3_IRQ2_CLICK (7 << 3)
35#define LIS3_IRQ2_MASK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6) 36#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_LOW (1 << 7) 37#define LIS3_IRQ_ACTIVE_LOW (1 << 7)
36 unsigned char irq_cfg; 38 unsigned char irq_cfg;
@@ -43,6 +45,15 @@ struct lis3lv02d_platform_data {
43#define LIS3_WAKEUP_Z_HI (1 << 5) 45#define LIS3_WAKEUP_Z_HI (1 << 5)
44 unsigned char wakeup_flags; 46 unsigned char wakeup_flags;
45 unsigned char wakeup_thresh; 47 unsigned char wakeup_thresh;
48 unsigned char wakeup_flags2;
49 unsigned char wakeup_thresh2;
50#define LIS3_HIPASS_CUTFF_8HZ 0
51#define LIS3_HIPASS_CUTFF_4HZ 1
52#define LIS3_HIPASS_CUTFF_2HZ 2
53#define LIS3_HIPASS_CUTFF_1HZ 3
54#define LIS3_HIPASS1_DISABLE (1 << 2)
55#define LIS3_HIPASS2_DISABLE (1 << 3)
56 unsigned char hipass_ctrl;
46#define LIS3_NO_MAP 0 57#define LIS3_NO_MAP 0
47#define LIS3_DEV_X 1 58#define LIS3_DEV_X 1
48#define LIS3_DEV_Y 2 59#define LIS3_DEV_Y 2
@@ -58,6 +69,7 @@ struct lis3lv02d_platform_data {
58 /* Limits for selftest are specified in chip data sheet */ 69 /* Limits for selftest are specified in chip data sheet */
59 s16 st_min_limits[3]; /* min pass limit x, y, z */ 70 s16 st_min_limits[3]; /* min pass limit x, y, z */
60 s16 st_max_limits[3]; /* max pass limit x, y, z */ 71 s16 st_max_limits[3]; /* max pass limit x, y, z */
72 int irq2;
61}; 73};
62 74
63#endif /* __LIS3LV02D_H_ */ 75#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 969f6e92d089..5d57a3a1fa1b 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -206,6 +206,20 @@ static inline int list_empty_careful(const struct list_head *head)
206} 206}
207 207
208/** 208/**
209 * list_rotate_left - rotate the list to the left
210 * @head: the head of the list
211 */
212static inline void list_rotate_left(struct list_head *head)
213{
214 struct list_head *first;
215
216 if (!list_empty(head)) {
217 first = head->next;
218 list_move_tail(first, head);
219 }
220}
221
222/**
209 * list_is_singular - tests whether a list has just one entry. 223 * list_is_singular - tests whether a list has just one entry.
210 * @head: the list to test. 224 * @head: the list to test.
211 */ 225 */
@@ -484,7 +498,7 @@ static inline void list_splice_tail_init(struct list_head *list,
484 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 498 pos = n, n = list_entry(n->member.next, typeof(*n), member))
485 499
486/** 500/**
487 * list_for_each_entry_safe_continue 501 * list_for_each_entry_safe_continue - continue list iteration safe against removal
488 * @pos: the type * to use as a loop cursor. 502 * @pos: the type * to use as a loop cursor.
489 * @n: another type * to use as temporary storage 503 * @n: another type * to use as temporary storage
490 * @head: the head for your list. 504 * @head: the head for your list.
@@ -500,7 +514,7 @@ static inline void list_splice_tail_init(struct list_head *list,
500 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 514 pos = n, n = list_entry(n->member.next, typeof(*n), member))
501 515
502/** 516/**
503 * list_for_each_entry_safe_from 517 * list_for_each_entry_safe_from - iterate over list from current point safe against removal
504 * @pos: the type * to use as a loop cursor. 518 * @pos: the type * to use as a loop cursor.
505 * @n: another type * to use as temporary storage 519 * @n: another type * to use as temporary storage
506 * @head: the head for your list. 520 * @head: the head for your list.
@@ -515,7 +529,7 @@ static inline void list_splice_tail_init(struct list_head *list,
515 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 529 pos = n, n = list_entry(n->member.next, typeof(*n), member))
516 530
517/** 531/**
518 * list_for_each_entry_safe_reverse 532 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
519 * @pos: the type * to use as a loop cursor. 533 * @pos: the type * to use as a loop cursor.
520 * @n: another type * to use as temporary storage 534 * @n: another type * to use as temporary storage
521 * @head: the head for your list. 535 * @head: the head for your list.
@@ -530,6 +544,21 @@ static inline void list_splice_tail_init(struct list_head *list,
530 &pos->member != (head); \ 544 &pos->member != (head); \
531 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 545 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
532 546
547/**
548 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
549 * @pos: the loop cursor used in the list_for_each_entry_safe loop
550 * @n: temporary storage used in list_for_each_entry_safe
551 * @member: the name of the list_struct within the struct.
552 *
553 * list_safe_reset_next is not safe to use in general if the list may be
554 * modified concurrently (eg. the lock is dropped in the loop body). An
555 * exception to this is if the cursor element (pos) is pinned in the list,
556 * and list_safe_reset_next is called after re-taking the lock and before
557 * completing the current iteration of the loop body.
558 */
559#define list_safe_reset_next(pos, n, member) \
560 n = list_entry(pos->member.next, typeof(*pos), member)
561
533/* 562/*
534 * Double linked lists with a single pointer list head. 563 * Double linked lists with a single pointer list head.
535 * Mostly useful for hash tables where the two pointer list head is 564 * Mostly useful for hash tables where the two pointer list head is
diff --git a/include/linux/llc.h b/include/linux/llc.h
index 7733585603f1..ad7074ba81af 100644
--- a/include/linux/llc.h
+++ b/include/linux/llc.h
@@ -36,6 +36,7 @@ enum llc_sockopts {
36 LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ 36 LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */
37 LLC_OPT_TX_WIN, /* tx window size. */ 37 LLC_OPT_TX_WIN, /* tx window size. */
38 LLC_OPT_RX_WIN, /* rx window size. */ 38 LLC_OPT_RX_WIN, /* rx window size. */
39 LLC_OPT_PKTINFO, /* ancillary packet information. */
39 LLC_OPT_MAX 40 LLC_OPT_MAX
40}; 41};
41 42
@@ -70,6 +71,12 @@ enum llc_sockopts {
70#define LLC_SAP_RM 0xD4 /* Resource Management */ 71#define LLC_SAP_RM 0xD4 /* Resource Management */
71#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ 72#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */
72 73
74struct llc_pktinfo {
75 int lpi_ifindex;
76 unsigned char lpi_sap;
77 unsigned char lpi_mac[IFHWADDRLEN];
78};
79
73#ifdef __KERNEL__ 80#ifdef __KERNEL__
74#define LLC_SAP_DYN_START 0xC0 81#define LLC_SAP_DYN_START 0xC0
75#define LLC_SAP_DYN_STOP 0xDE 82#define LLC_SAP_DYN_STOP 0xDE
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
deleted file mode 100644
index ef82b8fcbddb..000000000000
--- a/include/linux/lmb.h
+++ /dev/null
@@ -1,88 +0,0 @@
1#ifndef _LINUX_LMB_H
2#define _LINUX_LMB_H
3#ifdef __KERNEL__
4
5/*
6 * Logical memory blocks.
7 *
8 * Copyright (C) 2001 Peter Bergner, IBM Corp.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/mm.h>
18
19#define MAX_LMB_REGIONS 128
20
21struct lmb_property {
22 u64 base;
23 u64 size;
24};
25
26struct lmb_region {
27 unsigned long cnt;
28 u64 size;
29 struct lmb_property region[MAX_LMB_REGIONS+1];
30};
31
32struct lmb {
33 unsigned long debug;
34 u64 rmo_size;
35 struct lmb_region memory;
36 struct lmb_region reserved;
37};
38
39extern struct lmb lmb;
40
41extern void __init lmb_init(void);
42extern void __init lmb_analyze(void);
43extern long lmb_add(u64 base, u64 size);
44extern long lmb_remove(u64 base, u64 size);
45extern long __init lmb_reserve(u64 base, u64 size);
46extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
47 u64 (*nid_range)(u64, u64, int *));
48extern u64 __init lmb_alloc(u64 size, u64 align);
49extern u64 __init lmb_alloc_base(u64 size,
50 u64, u64 max_addr);
51extern u64 __init __lmb_alloc_base(u64 size,
52 u64 align, u64 max_addr);
53extern u64 __init lmb_phys_mem_size(void);
54extern u64 lmb_end_of_DRAM(void);
55extern void __init lmb_enforce_memory_limit(u64 memory_limit);
56extern int __init lmb_is_reserved(u64 addr);
57extern int lmb_is_region_reserved(u64 base, u64 size);
58extern int lmb_find(struct lmb_property *res);
59
60extern void lmb_dump_all(void);
61
62static inline u64
63lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
64{
65 return type->region[region_nr].size;
66}
67static inline u64
68lmb_size_pages(struct lmb_region *type, unsigned long region_nr)
69{
70 return lmb_size_bytes(type, region_nr) >> PAGE_SHIFT;
71}
72static inline u64
73lmb_start_pfn(struct lmb_region *type, unsigned long region_nr)
74{
75 return type->region[region_nr].base >> PAGE_SHIFT;
76}
77static inline u64
78lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
79{
80 return lmb_start_pfn(type, region_nr) +
81 lmb_size_pages(type, region_nr);
82}
83
84#include <asm/lmb.h>
85
86#endif /* __KERNEL__ */
87
88#endif /* _LINUX_LMB_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 9ccf0e286b2a..06aed8305bf3 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -12,6 +12,10 @@
12struct task_struct; 12struct task_struct;
13struct lockdep_map; 13struct lockdep_map;
14 14
15/* for sysctl */
16extern int prove_locking;
17extern int lock_stat;
18
15#ifdef CONFIG_LOCKDEP 19#ifdef CONFIG_LOCKDEP
16 20
17#include <linux/linkage.h> 21#include <linux/linkage.h>
@@ -40,6 +44,8 @@ struct lock_class_key {
40 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; 44 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
41}; 45};
42 46
47extern struct lock_class_key __lockdep_no_validate__;
48
43#define LOCKSTAT_POINTS 4 49#define LOCKSTAT_POINTS 4
44 50
45/* 51/*
@@ -266,6 +272,9 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
266#define lockdep_set_subclass(lock, sub) \ 272#define lockdep_set_subclass(lock, sub) \
267 lockdep_init_map(&(lock)->dep_map, #lock, \ 273 lockdep_init_map(&(lock)->dep_map, #lock, \
268 (lock)->dep_map.key, sub) 274 (lock)->dep_map.key, sub)
275
276#define lockdep_set_novalidate_class(lock) \
277 lockdep_set_class(lock, &__lockdep_no_validate__)
269/* 278/*
270 * Compare locking classes 279 * Compare locking classes
271 */ 280 */
@@ -350,6 +359,9 @@ static inline void lockdep_on(void)
350#define lockdep_set_class_and_subclass(lock, key, sub) \ 359#define lockdep_set_class_and_subclass(lock, key, sub) \
351 do { (void)(key); } while (0) 360 do { (void)(key); } while (0)
352#define lockdep_set_subclass(lock, sub) do { } while (0) 361#define lockdep_set_subclass(lock, sub) do { } while (0)
362
363#define lockdep_set_novalidate_class(lock) do { } while (0)
364
353/* 365/*
354 * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP 366 * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP
355 * case since the result is not well defined and the caller should rather 367 * case since the result is not well defined and the caller should rather
@@ -534,4 +546,8 @@ do { \
534# define might_lock_read(lock) do { } while (0) 546# define might_lock_read(lock) do { } while (0)
535#endif 547#endif
536 548
549#ifdef CONFIG_PROVE_RCU
550extern void lockdep_rcu_dereference(const char *file, const int line);
551#endif
552
537#endif /* __LINUX_LOCKDEP_H */ 553#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index 3a2b2d9b0472..de48d167568b 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -64,7 +64,7 @@ For crash recovery after replication node failure,
64 usually the condition is softened to regions that _may_ have been target of 64 usually the condition is softened to regions that _may_ have been target of
65 in-flight WRITE IO, e.g. by only lazily clearing the on-disk write-intent 65 in-flight WRITE IO, e.g. by only lazily clearing the on-disk write-intent
66 bitmap, trading frequency of meta data transactions against amount of 66 bitmap, trading frequency of meta data transactions against amount of
67 (possibly unneccessary) resync traffic. 67 (possibly unnecessary) resync traffic.
68 68
69 If we set a hard limit on the area that may be "hot" at any given time, we 69 If we set a hard limit on the area that may be "hot" at any given time, we
70 limit the amount of resync traffic needed for crash recovery. 70 limit the amount of resync traffic needed for crash recovery.
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index f78f83d7663f..6907251d5200 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -33,7 +33,7 @@ struct common_audit_data {
33#define LSM_AUDIT_DATA_IPC 4 33#define LSM_AUDIT_DATA_IPC 4
34#define LSM_AUDIT_DATA_TASK 5 34#define LSM_AUDIT_DATA_TASK 5
35#define LSM_AUDIT_DATA_KEY 6 35#define LSM_AUDIT_DATA_KEY 6
36#define LSM_AUDIT_NO_AUDIT 7 36#define LSM_AUDIT_DATA_NONE 7
37#define LSM_AUDIT_DATA_KMOD 8 37#define LSM_AUDIT_DATA_KMOD 8
38 struct task_struct *tsk; 38 struct task_struct *tsk;
39 union { 39 union {
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 76285e01b39e..eb9800f05782 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -52,7 +52,6 @@
52#define CGROUP_SUPER_MAGIC 0x27e0eb 52#define CGROUP_SUPER_MAGIC 0x27e0eb
53 53
54#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA 54#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
55#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
56 55
57#define STACK_END_MAGIC 0x57AC6E9D 56#define STACK_END_MAGIC 0x57AC6E9D
58 57
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index 2203121a43e9..8c22a8938642 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -4,6 +4,7 @@
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/videodev2.h> 6#include <linux/videodev2.h>
7#include <linux/fb.h>
7 8
8struct matroxioc_output_mode { 9struct matroxioc_output_mode {
9 __u32 output; /* which output */ 10 __u32 output; /* which output */
@@ -37,7 +38,5 @@ enum matroxfb_ctrl_id {
37 MATROXFB_CID_LAST 38 MATROXFB_CID_LAST
38}; 39};
39 40
40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
41
42#endif 41#endif
43 42
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
new file mode 100644
index 000000000000..a59faf2b5edd
--- /dev/null
+++ b/include/linux/memblock.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_MEMBLOCK_H
2#define _LINUX_MEMBLOCK_H
3#ifdef __KERNEL__
4
5/*
6 * Logical memory blocks.
7 *
8 * Copyright (C) 2001 Peter Bergner, IBM Corp.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/mm.h>
18
19#define MAX_MEMBLOCK_REGIONS 128
20
21struct memblock_property {
22 u64 base;
23 u64 size;
24};
25
26struct memblock_region {
27 unsigned long cnt;
28 u64 size;
29 struct memblock_property region[MAX_MEMBLOCK_REGIONS+1];
30};
31
32struct memblock {
33 unsigned long debug;
34 u64 rmo_size;
35 struct memblock_region memory;
36 struct memblock_region reserved;
37};
38
39extern struct memblock memblock;
40
41extern void __init memblock_init(void);
42extern void __init memblock_analyze(void);
43extern long memblock_add(u64 base, u64 size);
44extern long memblock_remove(u64 base, u64 size);
45extern long __init memblock_free(u64 base, u64 size);
46extern long __init memblock_reserve(u64 base, u64 size);
47extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid,
48 u64 (*nid_range)(u64, u64, int *));
49extern u64 __init memblock_alloc(u64 size, u64 align);
50extern u64 __init memblock_alloc_base(u64 size,
51 u64, u64 max_addr);
52extern u64 __init __memblock_alloc_base(u64 size,
53 u64 align, u64 max_addr);
54extern u64 __init memblock_phys_mem_size(void);
55extern u64 memblock_end_of_DRAM(void);
56extern void __init memblock_enforce_memory_limit(u64 memory_limit);
57extern int __init memblock_is_reserved(u64 addr);
58extern int memblock_is_region_reserved(u64 base, u64 size);
59extern int memblock_find(struct memblock_property *res);
60
61extern void memblock_dump_all(void);
62
63static inline u64
64memblock_size_bytes(struct memblock_region *type, unsigned long region_nr)
65{
66 return type->region[region_nr].size;
67}
68static inline u64
69memblock_size_pages(struct memblock_region *type, unsigned long region_nr)
70{
71 return memblock_size_bytes(type, region_nr) >> PAGE_SHIFT;
72}
73static inline u64
74memblock_start_pfn(struct memblock_region *type, unsigned long region_nr)
75{
76 return type->region[region_nr].base >> PAGE_SHIFT;
77}
78static inline u64
79memblock_end_pfn(struct memblock_region *type, unsigned long region_nr)
80{
81 return memblock_start_pfn(type, region_nr) +
82 memblock_size_pages(type, region_nr);
83}
84
85#include <asm/memblock.h>
86
87#endif /* __KERNEL__ */
88
89#endif /* _LINUX_MEMBLOCK_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 1f9b119f4ace..9411d32840b0 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -25,6 +25,13 @@ struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
29 struct list_head *dst,
30 unsigned long *scanned, int order,
31 int mode, struct zone *z,
32 struct mem_cgroup *mem_cont,
33 int active, int file);
34
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 35#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29/* 36/*
30 * All "charge" functions with gfp_mask should use GFP_KERNEL or 37 * All "charge" functions with gfp_mask should use GFP_KERNEL or
@@ -64,12 +71,6 @@ extern void mem_cgroup_uncharge_cache_page(struct page *page);
64extern int mem_cgroup_shmem_charge_fallback(struct page *page, 71extern int mem_cgroup_shmem_charge_fallback(struct page *page,
65 struct mm_struct *mm, gfp_t gfp_mask); 72 struct mm_struct *mm, gfp_t gfp_mask);
66 73
67extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
68 struct list_head *dst,
69 unsigned long *scanned, int order,
70 int mode, struct zone *z,
71 struct mem_cgroup *mem_cont,
72 int active, int file);
73extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); 74extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
74int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 75int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
75 76
@@ -89,7 +90,8 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
89extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem); 90extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
90 91
91extern int 92extern int
92mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); 93mem_cgroup_prepare_migration(struct page *page,
94 struct page *newpage, struct mem_cgroup **ptr);
93extern void mem_cgroup_end_migration(struct mem_cgroup *mem, 95extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
94 struct page *oldpage, struct page *newpage); 96 struct page *oldpage, struct page *newpage);
95 97
@@ -124,7 +126,6 @@ static inline bool mem_cgroup_disabled(void)
124 return false; 126 return false;
125} 127}
126 128
127extern bool mem_cgroup_oom_called(struct task_struct *task);
128void mem_cgroup_update_file_mapped(struct page *page, int val); 129void mem_cgroup_update_file_mapped(struct page *page, int val);
129unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 130unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
130 gfp_t gfp_mask, int nid, 131 gfp_t gfp_mask, int nid,
@@ -227,7 +228,8 @@ static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
227} 228}
228 229
229static inline int 230static inline int
230mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) 231mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
232 struct mem_cgroup **ptr)
231{ 233{
232 return 0; 234 return 0;
233} 235}
@@ -258,11 +260,6 @@ static inline bool mem_cgroup_disabled(void)
258 return true; 260 return true;
259} 261}
260 262
261static inline bool mem_cgroup_oom_called(struct task_struct *task)
262{
263 return false;
264}
265
266static inline int 263static inline int
267mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg) 264mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
268{ 265{
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 1adfe779eb99..85582e1bcee9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -36,6 +36,8 @@ struct memory_block {
36 struct sys_device sysdev; 36 struct sys_device sysdev;
37}; 37};
38 38
39int arch_get_memory_phys_device(unsigned long start_pfn);
40
39/* These states are exposed to userspace as text strings in sysfs */ 41/* These states are exposed to userspace as text strings in sysfs */
40#define MEM_ONLINE (1<<0) /* exposed to userspace */ 42#define MEM_ONLINE (1<<0) /* exposed to userspace */
41#define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ 43#define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 35b07b773e6c..864035fb8f8a 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -202,6 +202,7 @@ static inline int is_mem_section_removable(unsigned long pfn,
202} 202}
203#endif /* CONFIG_MEMORY_HOTREMOVE */ 203#endif /* CONFIG_MEMORY_HOTREMOVE */
204 204
205extern int mem_online_node(int nid);
205extern int add_memory(int nid, u64 start, u64 size); 206extern int add_memory(int nid, u64 start, u64 size);
206extern int arch_add_memory(int nid, u64 start, u64 size); 207extern int arch_add_memory(int nid, u64 start, u64 size);
207extern int remove_memory(u64 start, u64 size); 208extern int remove_memory(u64 start, u64 size);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 1cc966cd3e5f..7b9ef6bf45aa 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -23,6 +23,13 @@ enum {
23 MPOL_MAX, /* always last member of enum */ 23 MPOL_MAX, /* always last member of enum */
24}; 24};
25 25
26enum mpol_rebind_step {
27 MPOL_REBIND_ONCE, /* do rebind work at once(not by two step) */
28 MPOL_REBIND_STEP1, /* first step(set all the newly nodes) */
29 MPOL_REBIND_STEP2, /* second step(clean all the disallowed nodes)*/
30 MPOL_REBIND_NSTEP,
31};
32
26/* Flags for set_mempolicy */ 33/* Flags for set_mempolicy */
27#define MPOL_F_STATIC_NODES (1 << 15) 34#define MPOL_F_STATIC_NODES (1 << 15)
28#define MPOL_F_RELATIVE_NODES (1 << 14) 35#define MPOL_F_RELATIVE_NODES (1 << 14)
@@ -51,6 +58,7 @@ enum {
51 */ 58 */
52#define MPOL_F_SHARED (1 << 0) /* identify shared policies */ 59#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
53#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */ 60#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
61#define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */
54 62
55#ifdef __KERNEL__ 63#ifdef __KERNEL__
56 64
@@ -193,8 +201,8 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
193 201
194extern void numa_default_policy(void); 202extern void numa_default_policy(void);
195extern void numa_policy_init(void); 203extern void numa_policy_init(void);
196extern void mpol_rebind_task(struct task_struct *tsk, 204extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new,
197 const nodemask_t *new); 205 enum mpol_rebind_step step);
198extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 206extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
199extern void mpol_fix_fork_child_flag(struct task_struct *p); 207extern void mpol_fix_fork_child_flag(struct task_struct *p);
200 208
@@ -308,7 +316,8 @@ static inline void numa_default_policy(void)
308} 316}
309 317
310static inline void mpol_rebind_task(struct task_struct *tsk, 318static inline void mpol_rebind_task(struct task_struct *tsk,
311 const nodemask_t *new) 319 const nodemask_t *new,
320 enum mpol_rebind_step step)
312{ 321{
313} 322}
314 323
diff --git a/include/linux/meye.h b/include/linux/meye.h
index 12010ace1f04..0dd49954f746 100644
--- a/include/linux/meye.h
+++ b/include/linux/meye.h
@@ -44,17 +44,17 @@ struct meye_params {
44}; 44};
45 45
46/* query the extended parameters */ 46/* query the extended parameters */
47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) 47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params)
48/* set the extended parameters */ 48/* set the extended parameters */
49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) 49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params)
50/* queue a buffer for mjpeg capture */ 50/* queue a buffer for mjpeg capture */
51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) 51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int)
52/* sync a previously queued mjpeg buffer */ 52/* sync a previously queued mjpeg buffer */
53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) 53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int)
54/* get a still uncompressed snapshot */ 54/* get a still uncompressed snapshot */
55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) 55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4)
56/* get a jpeg compressed snapshot */ 56/* get a jpeg compressed snapshot */
57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) 57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int)
58 58
59/* V4L2 private controls */ 59/* V4L2 private controls */
60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE 60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE
diff --git a/include/linux/mfd/88pm8607.h b/include/linux/mfd/88pm8607.h
deleted file mode 100644
index f41b428d2cec..000000000000
--- a/include/linux/mfd/88pm8607.h
+++ /dev/null
@@ -1,217 +0,0 @@
1/*
2 * Marvell 88PM8607 Interface
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_MFD_88PM8607_H
13#define __LINUX_MFD_88PM8607_H
14
15enum {
16 PM8607_ID_BUCK1 = 0,
17 PM8607_ID_BUCK2,
18 PM8607_ID_BUCK3,
19
20 PM8607_ID_LDO1,
21 PM8607_ID_LDO2,
22 PM8607_ID_LDO3,
23 PM8607_ID_LDO4,
24 PM8607_ID_LDO5,
25 PM8607_ID_LDO6,
26 PM8607_ID_LDO7,
27 PM8607_ID_LDO8,
28 PM8607_ID_LDO9,
29 PM8607_ID_LDO10,
30 PM8607_ID_LDO12,
31 PM8607_ID_LDO14,
32
33 PM8607_ID_RG_MAX,
34};
35
36#define CHIP_ID (0x40)
37#define CHIP_ID_MASK (0xF8)
38
39/* Interrupt Registers */
40#define PM8607_STATUS_1 (0x01)
41#define PM8607_STATUS_2 (0x02)
42#define PM8607_INT_STATUS1 (0x03)
43#define PM8607_INT_STATUS2 (0x04)
44#define PM8607_INT_STATUS3 (0x05)
45#define PM8607_INT_MASK_1 (0x06)
46#define PM8607_INT_MASK_2 (0x07)
47#define PM8607_INT_MASK_3 (0x08)
48
49/* Regulator Control Registers */
50#define PM8607_LDO1 (0x10)
51#define PM8607_LDO2 (0x11)
52#define PM8607_LDO3 (0x12)
53#define PM8607_LDO4 (0x13)
54#define PM8607_LDO5 (0x14)
55#define PM8607_LDO6 (0x15)
56#define PM8607_LDO7 (0x16)
57#define PM8607_LDO8 (0x17)
58#define PM8607_LDO9 (0x18)
59#define PM8607_LDO10 (0x19)
60#define PM8607_LDO12 (0x1A)
61#define PM8607_LDO14 (0x1B)
62#define PM8607_SLEEP_MODE1 (0x1C)
63#define PM8607_SLEEP_MODE2 (0x1D)
64#define PM8607_SLEEP_MODE3 (0x1E)
65#define PM8607_SLEEP_MODE4 (0x1F)
66#define PM8607_GO (0x20)
67#define PM8607_SLEEP_BUCK1 (0x21)
68#define PM8607_SLEEP_BUCK2 (0x22)
69#define PM8607_SLEEP_BUCK3 (0x23)
70#define PM8607_BUCK1 (0x24)
71#define PM8607_BUCK2 (0x25)
72#define PM8607_BUCK3 (0x26)
73#define PM8607_BUCK_CONTROLS (0x27)
74#define PM8607_SUPPLIES_EN11 (0x2B)
75#define PM8607_SUPPLIES_EN12 (0x2C)
76#define PM8607_GROUP1 (0x2D)
77#define PM8607_GROUP2 (0x2E)
78#define PM8607_GROUP3 (0x2F)
79#define PM8607_GROUP4 (0x30)
80#define PM8607_GROUP5 (0x31)
81#define PM8607_GROUP6 (0x32)
82#define PM8607_SUPPLIES_EN21 (0x33)
83#define PM8607_SUPPLIES_EN22 (0x34)
84
85/* RTC Control Registers */
86#define PM8607_RTC1 (0xA0)
87#define PM8607_RTC_COUNTER1 (0xA1)
88#define PM8607_RTC_COUNTER2 (0xA2)
89#define PM8607_RTC_COUNTER3 (0xA3)
90#define PM8607_RTC_COUNTER4 (0xA4)
91#define PM8607_RTC_EXPIRE1 (0xA5)
92#define PM8607_RTC_EXPIRE2 (0xA6)
93#define PM8607_RTC_EXPIRE3 (0xA7)
94#define PM8607_RTC_EXPIRE4 (0xA8)
95#define PM8607_RTC_TRIM1 (0xA9)
96#define PM8607_RTC_TRIM2 (0xAA)
97#define PM8607_RTC_TRIM3 (0xAB)
98#define PM8607_RTC_TRIM4 (0xAC)
99#define PM8607_RTC_MISC1 (0xAD)
100#define PM8607_RTC_MISC2 (0xAE)
101#define PM8607_RTC_MISC3 (0xAF)
102
103/* Misc Registers */
104#define PM8607_CHIP_ID (0x00)
105#define PM8607_LDO1 (0x10)
106#define PM8607_DVC3 (0x26)
107#define PM8607_MISC1 (0x40)
108
109/* bit definitions for PM8607 events */
110#define PM8607_EVENT_ONKEY (1 << 0)
111#define PM8607_EVENT_EXTON (1 << 1)
112#define PM8607_EVENT_CHG (1 << 2)
113#define PM8607_EVENT_BAT (1 << 3)
114#define PM8607_EVENT_RTC (1 << 4)
115#define PM8607_EVENT_CC (1 << 5)
116#define PM8607_EVENT_VBAT (1 << 8)
117#define PM8607_EVENT_VCHG (1 << 9)
118#define PM8607_EVENT_VSYS (1 << 10)
119#define PM8607_EVENT_TINT (1 << 11)
120#define PM8607_EVENT_GPADC0 (1 << 12)
121#define PM8607_EVENT_GPADC1 (1 << 13)
122#define PM8607_EVENT_GPADC2 (1 << 14)
123#define PM8607_EVENT_GPADC3 (1 << 15)
124#define PM8607_EVENT_AUDIO_SHORT (1 << 16)
125#define PM8607_EVENT_PEN (1 << 17)
126#define PM8607_EVENT_HEADSET (1 << 18)
127#define PM8607_EVENT_HOOK (1 << 19)
128#define PM8607_EVENT_MICIN (1 << 20)
129#define PM8607_EVENT_CHG_TIMEOUT (1 << 21)
130#define PM8607_EVENT_CHG_DONE (1 << 22)
131#define PM8607_EVENT_CHG_FAULT (1 << 23)
132
133/* bit definitions of Status Query Interface */
134#define PM8607_STATUS_CC (1 << 3)
135#define PM8607_STATUS_PEN (1 << 4)
136#define PM8607_STATUS_HEADSET (1 << 5)
137#define PM8607_STATUS_HOOK (1 << 6)
138#define PM8607_STATUS_MICIN (1 << 7)
139#define PM8607_STATUS_ONKEY (1 << 8)
140#define PM8607_STATUS_EXTON (1 << 9)
141#define PM8607_STATUS_CHG (1 << 10)
142#define PM8607_STATUS_BAT (1 << 11)
143#define PM8607_STATUS_VBUS (1 << 12)
144#define PM8607_STATUS_OV (1 << 13)
145
146/* bit definitions of BUCK3 */
147#define PM8607_BUCK3_DOUBLE (1 << 6)
148
149/* bit definitions of Misc1 */
150#define PM8607_MISC1_PI2C (1 << 0)
151
152/* Interrupt Number in 88PM8607 */
153enum {
154 PM8607_IRQ_ONKEY = 0,
155 PM8607_IRQ_EXTON,
156 PM8607_IRQ_CHG,
157 PM8607_IRQ_BAT,
158 PM8607_IRQ_RTC,
159 PM8607_IRQ_VBAT = 8,
160 PM8607_IRQ_VCHG,
161 PM8607_IRQ_VSYS,
162 PM8607_IRQ_TINT,
163 PM8607_IRQ_GPADC0,
164 PM8607_IRQ_GPADC1,
165 PM8607_IRQ_GPADC2,
166 PM8607_IRQ_GPADC3,
167 PM8607_IRQ_AUDIO_SHORT = 16,
168 PM8607_IRQ_PEN,
169 PM8607_IRQ_HEADSET,
170 PM8607_IRQ_HOOK,
171 PM8607_IRQ_MICIN,
172 PM8607_IRQ_CHG_FAIL,
173 PM8607_IRQ_CHG_DONE,
174 PM8607_IRQ_CHG_FAULT,
175};
176
177enum {
178 PM8607_CHIP_A0 = 0x40,
179 PM8607_CHIP_A1 = 0x41,
180 PM8607_CHIP_B0 = 0x48,
181};
182
183
184struct pm8607_chip {
185 struct device *dev;
186 struct mutex io_lock;
187 struct i2c_client *client;
188
189 int (*read)(struct pm8607_chip *chip, int reg, int bytes, void *dest);
190 int (*write)(struct pm8607_chip *chip, int reg, int bytes, void *src);
191
192 int buck3_double; /* DVC ramp slope double */
193 unsigned char chip_id;
194
195};
196
197#define PM8607_MAX_REGULATOR 15 /* 3 Bucks, 12 LDOs */
198
199enum {
200 GI2C_PORT = 0,
201 PI2C_PORT,
202};
203
204struct pm8607_platform_data {
205 int i2c_port; /* Controlled by GI2C or PI2C */
206 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR];
207};
208
209extern int pm8607_reg_read(struct pm8607_chip *, int);
210extern int pm8607_reg_write(struct pm8607_chip *, int, unsigned char);
211extern int pm8607_bulk_read(struct pm8607_chip *, int, int,
212 unsigned char *);
213extern int pm8607_bulk_write(struct pm8607_chip *, int, int,
214 unsigned char *);
215extern int pm8607_set_bits(struct pm8607_chip *, int, unsigned char,
216 unsigned char);
217#endif /* __LINUX_MFD_88PM8607_H */
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
new file mode 100644
index 000000000000..bfd23bef7363
--- /dev/null
+++ b/include/linux/mfd/88pm860x.h
@@ -0,0 +1,376 @@
1/*
2 * Marvell 88PM860x Interface
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_MFD_88PM860X_H
13#define __LINUX_MFD_88PM860X_H
14
15#include <linux/interrupt.h>
16
17#define MFD_NAME_SIZE (40)
18
19enum {
20 CHIP_INVALID = 0,
21 CHIP_PM8606,
22 CHIP_PM8607,
23 CHIP_MAX,
24};
25
26enum {
27 PM8606_ID_INVALID,
28 PM8606_ID_BACKLIGHT,
29 PM8606_ID_LED,
30 PM8606_ID_VIBRATOR,
31 PM8606_ID_TOUCH,
32 PM8606_ID_SOUND,
33 PM8606_ID_CHARGER,
34 PM8606_ID_MAX,
35};
36
37enum {
38 PM8606_BACKLIGHT1 = 0,
39 PM8606_BACKLIGHT2,
40 PM8606_BACKLIGHT3,
41};
42
43enum {
44 PM8606_LED1_RED = 0,
45 PM8606_LED1_GREEN,
46 PM8606_LED1_BLUE,
47 PM8606_LED2_RED,
48 PM8606_LED2_GREEN,
49 PM8606_LED2_BLUE,
50 PM8607_LED_VIBRATOR,
51};
52
53
54/* 8606 Registers */
55#define PM8606_DCM_BOOST (0x00)
56#define PM8606_PWM (0x01)
57
58/* Backlight Registers */
59#define PM8606_WLED1A (0x02)
60#define PM8606_WLED1B (0x03)
61#define PM8606_WLED2A (0x04)
62#define PM8606_WLED2B (0x05)
63#define PM8606_WLED3A (0x06)
64#define PM8606_WLED3B (0x07)
65
66/* LED Registers */
67#define PM8606_RGB2A (0x08)
68#define PM8606_RGB2B (0x09)
69#define PM8606_RGB2C (0x0A)
70#define PM8606_RGB2D (0x0B)
71#define PM8606_RGB1A (0x0C)
72#define PM8606_RGB1B (0x0D)
73#define PM8606_RGB1C (0x0E)
74#define PM8606_RGB1D (0x0F)
75
76#define PM8606_PREREGULATORA (0x10)
77#define PM8606_PREREGULATORB (0x11)
78#define PM8606_VIBRATORA (0x12)
79#define PM8606_VIBRATORB (0x13)
80#define PM8606_VCHG (0x14)
81#define PM8606_VSYS (0x15)
82#define PM8606_MISC (0x16)
83#define PM8606_CHIP_ID (0x17)
84#define PM8606_STATUS (0x18)
85#define PM8606_FLAGS (0x19)
86#define PM8606_PROTECTA (0x1A)
87#define PM8606_PROTECTB (0x1B)
88#define PM8606_PROTECTC (0x1C)
89
90/* Bit definitions of PM8606 registers */
91#define PM8606_DCM_500MA (0x0) /* current limit */
92#define PM8606_DCM_750MA (0x1)
93#define PM8606_DCM_1000MA (0x2)
94#define PM8606_DCM_1250MA (0x3)
95#define PM8606_DCM_250MV (0x0 << 2)
96#define PM8606_DCM_300MV (0x1 << 2)
97#define PM8606_DCM_350MV (0x2 << 2)
98#define PM8606_DCM_400MV (0x3 << 2)
99
100#define PM8606_PWM_31200HZ (0x0)
101#define PM8606_PWM_15600HZ (0x1)
102#define PM8606_PWM_7800HZ (0x2)
103#define PM8606_PWM_3900HZ (0x3)
104#define PM8606_PWM_1950HZ (0x4)
105#define PM8606_PWM_976HZ (0x5)
106#define PM8606_PWM_488HZ (0x6)
107#define PM8606_PWM_244HZ (0x7)
108#define PM8606_PWM_FREQ_MASK (0x7)
109
110#define PM8606_WLED_ON (1 << 0)
111#define PM8606_WLED_CURRENT(x) ((x & 0x1F) << 1)
112
113#define PM8606_LED_CURRENT(x) (((x >> 2) & 0x07) << 5)
114
115#define PM8606_VSYS_EN (1 << 1)
116
117#define PM8606_MISC_OSC_EN (1 << 4)
118
119enum {
120 PM8607_ID_BUCK1 = 0,
121 PM8607_ID_BUCK2,
122 PM8607_ID_BUCK3,
123
124 PM8607_ID_LDO1,
125 PM8607_ID_LDO2,
126 PM8607_ID_LDO3,
127 PM8607_ID_LDO4,
128 PM8607_ID_LDO5,
129 PM8607_ID_LDO6,
130 PM8607_ID_LDO7,
131 PM8607_ID_LDO8,
132 PM8607_ID_LDO9,
133 PM8607_ID_LDO10,
134 PM8607_ID_LDO12,
135 PM8607_ID_LDO13,
136 PM8607_ID_LDO14,
137
138 PM8607_ID_RG_MAX,
139};
140
141#define PM8607_VERSION (0x40) /* 8607 chip ID */
142#define PM8607_VERSION_MASK (0xF0) /* 8607 chip ID mask */
143
144/* Interrupt Registers */
145#define PM8607_STATUS_1 (0x01)
146#define PM8607_STATUS_2 (0x02)
147#define PM8607_INT_STATUS1 (0x03)
148#define PM8607_INT_STATUS2 (0x04)
149#define PM8607_INT_STATUS3 (0x05)
150#define PM8607_INT_MASK_1 (0x06)
151#define PM8607_INT_MASK_2 (0x07)
152#define PM8607_INT_MASK_3 (0x08)
153
154/* Regulator Control Registers */
155#define PM8607_LDO1 (0x10)
156#define PM8607_LDO2 (0x11)
157#define PM8607_LDO3 (0x12)
158#define PM8607_LDO4 (0x13)
159#define PM8607_LDO5 (0x14)
160#define PM8607_LDO6 (0x15)
161#define PM8607_LDO7 (0x16)
162#define PM8607_LDO8 (0x17)
163#define PM8607_LDO9 (0x18)
164#define PM8607_LDO10 (0x19)
165#define PM8607_LDO12 (0x1A)
166#define PM8607_LDO14 (0x1B)
167#define PM8607_SLEEP_MODE1 (0x1C)
168#define PM8607_SLEEP_MODE2 (0x1D)
169#define PM8607_SLEEP_MODE3 (0x1E)
170#define PM8607_SLEEP_MODE4 (0x1F)
171#define PM8607_GO (0x20)
172#define PM8607_SLEEP_BUCK1 (0x21)
173#define PM8607_SLEEP_BUCK2 (0x22)
174#define PM8607_SLEEP_BUCK3 (0x23)
175#define PM8607_BUCK1 (0x24)
176#define PM8607_BUCK2 (0x25)
177#define PM8607_BUCK3 (0x26)
178#define PM8607_BUCK_CONTROLS (0x27)
179#define PM8607_SUPPLIES_EN11 (0x2B)
180#define PM8607_SUPPLIES_EN12 (0x2C)
181#define PM8607_GROUP1 (0x2D)
182#define PM8607_GROUP2 (0x2E)
183#define PM8607_GROUP3 (0x2F)
184#define PM8607_GROUP4 (0x30)
185#define PM8607_GROUP5 (0x31)
186#define PM8607_GROUP6 (0x32)
187#define PM8607_SUPPLIES_EN21 (0x33)
188#define PM8607_SUPPLIES_EN22 (0x34)
189
190/* Vibrator Control Registers */
191#define PM8607_VIBRATOR_SET (0x28)
192#define PM8607_VIBRATOR_PWM (0x29)
193
194/* GPADC Registers */
195#define PM8607_GP_BIAS1 (0x4F)
196#define PM8607_MEAS_EN1 (0x50)
197#define PM8607_MEAS_EN2 (0x51)
198#define PM8607_MEAS_EN3 (0x52)
199#define PM8607_MEAS_OFF_TIME1 (0x53)
200#define PM8607_MEAS_OFF_TIME2 (0x54)
201#define PM8607_TSI_PREBIAS (0x55) /* prebias time */
202#define PM8607_PD_PREBIAS (0x56) /* prebias time */
203#define PM8607_GPADC_MISC1 (0x57)
204
205/* RTC Control Registers */
206#define PM8607_RTC1 (0xA0)
207#define PM8607_RTC_COUNTER1 (0xA1)
208#define PM8607_RTC_COUNTER2 (0xA2)
209#define PM8607_RTC_COUNTER3 (0xA3)
210#define PM8607_RTC_COUNTER4 (0xA4)
211#define PM8607_RTC_EXPIRE1 (0xA5)
212#define PM8607_RTC_EXPIRE2 (0xA6)
213#define PM8607_RTC_EXPIRE3 (0xA7)
214#define PM8607_RTC_EXPIRE4 (0xA8)
215#define PM8607_RTC_TRIM1 (0xA9)
216#define PM8607_RTC_TRIM2 (0xAA)
217#define PM8607_RTC_TRIM3 (0xAB)
218#define PM8607_RTC_TRIM4 (0xAC)
219#define PM8607_RTC_MISC1 (0xAD)
220#define PM8607_RTC_MISC2 (0xAE)
221#define PM8607_RTC_MISC3 (0xAF)
222
223/* Misc Registers */
224#define PM8607_CHIP_ID (0x00)
225#define PM8607_B0_MISC1 (0x0C)
226#define PM8607_LDO1 (0x10)
227#define PM8607_DVC3 (0x26)
228#define PM8607_A1_MISC1 (0x40)
229
230/* bit definitions of Status Query Interface */
231#define PM8607_STATUS_CC (1 << 3)
232#define PM8607_STATUS_PEN (1 << 4)
233#define PM8607_STATUS_HEADSET (1 << 5)
234#define PM8607_STATUS_HOOK (1 << 6)
235#define PM8607_STATUS_MICIN (1 << 7)
236#define PM8607_STATUS_ONKEY (1 << 8)
237#define PM8607_STATUS_EXTON (1 << 9)
238#define PM8607_STATUS_CHG (1 << 10)
239#define PM8607_STATUS_BAT (1 << 11)
240#define PM8607_STATUS_VBUS (1 << 12)
241#define PM8607_STATUS_OV (1 << 13)
242
243/* bit definitions of BUCK3 */
244#define PM8607_BUCK3_DOUBLE (1 << 6)
245
246/* bit definitions of Misc1 */
247#define PM8607_A1_MISC1_PI2C (1 << 0)
248#define PM8607_B0_MISC1_INV_INT (1 << 0)
249#define PM8607_B0_MISC1_INT_CLEAR (1 << 1)
250#define PM8607_B0_MISC1_INT_MASK (1 << 2)
251#define PM8607_B0_MISC1_PI2C (1 << 3)
252#define PM8607_B0_MISC1_RESET (1 << 6)
253
254/* bits definitions of GPADC */
255#define PM8607_GPADC_EN (1 << 0)
256#define PM8607_GPADC_PREBIAS_MASK (3 << 1)
257#define PM8607_GPADC_SLOT_CYCLE_MASK (3 << 3) /* slow mode */
258#define PM8607_GPADC_OFF_SCALE_MASK (3 << 5) /* GP sleep mode */
259#define PM8607_GPADC_SW_CAL_MASK (1 << 7)
260
261#define PM8607_PD_PREBIAS_MASK (0x1F << 0)
262#define PM8607_PD_PRECHG_MASK (7 << 5)
263
264/* Interrupt Number in 88PM8607 */
265enum {
266 PM8607_IRQ_ONKEY,
267 PM8607_IRQ_EXTON,
268 PM8607_IRQ_CHG,
269 PM8607_IRQ_BAT,
270 PM8607_IRQ_RTC,
271 PM8607_IRQ_CC,
272 PM8607_IRQ_VBAT,
273 PM8607_IRQ_VCHG,
274 PM8607_IRQ_VSYS,
275 PM8607_IRQ_TINT,
276 PM8607_IRQ_GPADC0,
277 PM8607_IRQ_GPADC1,
278 PM8607_IRQ_GPADC2,
279 PM8607_IRQ_GPADC3,
280 PM8607_IRQ_AUDIO_SHORT,
281 PM8607_IRQ_PEN,
282 PM8607_IRQ_HEADSET,
283 PM8607_IRQ_HOOK,
284 PM8607_IRQ_MICIN,
285 PM8607_IRQ_CHG_FAIL,
286 PM8607_IRQ_CHG_DONE,
287 PM8607_IRQ_CHG_FAULT,
288};
289
290enum {
291 PM8607_CHIP_A0 = 0x40,
292 PM8607_CHIP_A1 = 0x41,
293 PM8607_CHIP_B0 = 0x48,
294};
295
296struct pm860x_chip {
297 struct device *dev;
298 struct mutex io_lock;
299 struct mutex irq_lock;
300 struct i2c_client *client;
301 struct i2c_client *companion; /* companion chip client */
302
303 int buck3_double; /* DVC ramp slope double */
304 unsigned short companion_addr;
305 int id;
306 int irq_mode;
307 int irq_base;
308 int core_irq;
309 unsigned char chip_version;
310
311};
312
313#define PM8607_MAX_REGULATOR PM8607_ID_RG_MAX /* 3 Bucks, 13 LDOs */
314
315enum {
316 GI2C_PORT = 0,
317 PI2C_PORT,
318};
319
320struct pm860x_backlight_pdata {
321 int id;
322 int pwm;
323 int iset;
324 unsigned long flags;
325};
326
327struct pm860x_led_pdata {
328 int id;
329 int iset;
330 unsigned long flags;
331};
332
333struct pm860x_touch_pdata {
334 int gpadc_prebias;
335 int slot_cycle;
336 int off_scale;
337 int sw_cal;
338 int tsi_prebias; /* time, slot */
339 int pen_prebias; /* time, slot */
340 int pen_prechg; /* time, slot */
341 int res_x; /* resistor of Xplate */
342 unsigned long flags;
343};
344
345struct pm860x_power_pdata {
346 unsigned fast_charge; /* charge current */
347};
348
349struct pm860x_platform_data {
350 struct pm860x_backlight_pdata *backlight;
351 struct pm860x_led_pdata *led;
352 struct pm860x_touch_pdata *touch;
353 struct pm860x_power_pdata *power;
354
355 unsigned short companion_addr; /* I2C address of companion chip */
356 int i2c_port; /* Controlled by GI2C or PI2C */
357 int irq_mode; /* Clear interrupt by read/write(0/1) */
358 int irq_base; /* IRQ base number of 88pm860x */
359 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR];
360};
361
362extern char pm860x_backlight_name[][MFD_NAME_SIZE];
363extern char pm860x_led_name[][MFD_NAME_SIZE];
364
365extern int pm860x_reg_read(struct i2c_client *, int);
366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *);
369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
370 unsigned char);
371
372extern int pm860x_device_init(struct pm860x_chip *chip,
373 struct pm860x_platform_data *pdata) __devinit ;
374extern void pm860x_device_exit(struct pm860x_chip *chip) __devexit ;
375
376#endif /* __LINUX_MFD_88PM860X_H */
diff --git a/include/linux/mfd/ab4500.h b/include/linux/mfd/ab4500.h
deleted file mode 100644
index a42a7033ae53..000000000000
--- a/include/linux/mfd/ab4500.h
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2 * Copyright (C) 2009 ST-Ericsson
3 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.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 * AB4500 device core funtions, for client access
11 */
12#ifndef MFD_AB4500_H
13#define MFD_AB4500_H
14
15#include <linux/device.h>
16
17/*
18 * AB4500 bank addresses
19 */
20#define AB4500_SYS_CTRL1_BLOCK 0x1
21#define AB4500_SYS_CTRL2_BLOCK 0x2
22#define AB4500_REGU_CTRL1 0x3
23#define AB4500_REGU_CTRL2 0x4
24#define AB4500_USB 0x5
25#define AB4500_TVOUT 0x6
26#define AB4500_DBI 0x7
27#define AB4500_ECI_AV_ACC 0x8
28#define AB4500_RESERVED 0x9
29#define AB4500_GPADC 0xA
30#define AB4500_CHARGER 0xB
31#define AB4500_GAS_GAUGE 0xC
32#define AB4500_AUDIO 0xD
33#define AB4500_INTERRUPT 0xE
34#define AB4500_RTC 0xF
35#define AB4500_MISC 0x10
36#define AB4500_DEBUG 0x12
37#define AB4500_PROD_TEST 0x13
38#define AB4500_OTP_EMUL 0x15
39
40/*
41 * System control 1 register offsets.
42 * Bank = 0x01
43 */
44#define AB4500_TURNON_STAT_REG 0x0100
45#define AB4500_RESET_STAT_REG 0x0101
46#define AB4500_PONKEY1_PRESS_STAT_REG 0x0102
47
48#define AB4500_FSM_STAT1_REG 0x0140
49#define AB4500_FSM_STAT2_REG 0x0141
50#define AB4500_SYSCLK_REQ_STAT_REG 0x0142
51#define AB4500_USB_STAT1_REG 0x0143
52#define AB4500_USB_STAT2_REG 0x0144
53#define AB4500_STATUS_SPARE1_REG 0x0145
54#define AB4500_STATUS_SPARE2_REG 0x0146
55
56#define AB4500_CTRL1_REG 0x0180
57#define AB4500_CTRL2_REG 0x0181
58
59/*
60 * System control 2 register offsets.
61 * bank = 0x02
62 */
63#define AB4500_CTRL3_REG 0x0200
64#define AB4500_MAIN_WDOG_CTRL_REG 0x0201
65#define AB4500_MAIN_WDOG_TIMER_REG 0x0202
66#define AB4500_LOW_BAT_REG 0x0203
67#define AB4500_BATT_OK_REG 0x0204
68#define AB4500_SYSCLK_TIMER_REG 0x0205
69#define AB4500_SMPSCLK_CTRL_REG 0x0206
70#define AB4500_SMPSCLK_SEL1_REG 0x0207
71#define AB4500_SMPSCLK_SEL2_REG 0x0208
72#define AB4500_SMPSCLK_SEL3_REG 0x0209
73#define AB4500_SYSULPCLK_CONF_REG 0x020A
74#define AB4500_SYSULPCLK_CTRL1_REG 0x020B
75#define AB4500_SYSCLK_CTRL_REG 0x020C
76#define AB4500_SYSCLK_REQ1_VALID_REG 0x020D
77#define AB4500_SYSCLK_REQ_VALID_REG 0x020E
78#define AB4500_SYSCTRL_SPARE_REG 0x020F
79#define AB4500_PAD_CONF_REG 0x0210
80
81/*
82 * Regu control1 register offsets
83 * Bank = 0x03
84 */
85#define AB4500_REGU_SERIAL_CTRL1_REG 0x0300
86#define AB4500_REGU_SERIAL_CTRL2_REG 0x0301
87#define AB4500_REGU_SERIAL_CTRL3_REG 0x0302
88#define AB4500_REGU_REQ_CTRL1_REG 0x0303
89#define AB4500_REGU_REQ_CTRL2_REG 0x0304
90#define AB4500_REGU_REQ_CTRL3_REG 0x0305
91#define AB4500_REGU_REQ_CTRL4_REG 0x0306
92#define AB4500_REGU_MISC1_REG 0x0380
93#define AB4500_REGU_OTGSUPPLY_CTRL_REG 0x0381
94#define AB4500_REGU_VUSB_CTRL_REG 0x0382
95#define AB4500_REGU_VAUDIO_SUPPLY_REG 0x0383
96#define AB4500_REGU_CTRL1_SPARE_REG 0x0384
97
98/*
99 * Regu control2 Vmod register offsets
100 */
101#define AB4500_REGU_VMOD_REGU_REG 0x0440
102#define AB4500_REGU_VMOD_SEL1_REG 0x0441
103#define AB4500_REGU_VMOD_SEL2_REG 0x0442
104#define AB4500_REGU_CTRL_DISCH_REG 0x0443
105#define AB4500_REGU_CTRL_DISCH2_REG 0x0444
106
107/*
108 * USB/ULPI register offsets
109 * Bank : 0x5
110 */
111#define AB4500_USB_LINE_STAT_REG 0x0580
112#define AB4500_USB_LINE_CTRL1_REG 0x0581
113#define AB4500_USB_LINE_CTRL2_REG 0x0582
114#define AB4500_USB_LINE_CTRL3_REG 0x0583
115#define AB4500_USB_LINE_CTRL4_REG 0x0584
116#define AB4500_USB_LINE_CTRL5_REG 0x0585
117#define AB4500_USB_OTG_CTRL_REG 0x0587
118#define AB4500_USB_OTG_STAT_REG 0x0588
119#define AB4500_USB_OTG_STAT_REG 0x0588
120#define AB4500_USB_CTRL_SPARE_REG 0x0589
121#define AB4500_USB_PHY_CTRL_REG 0x058A
122
123/*
124 * TVOUT / CTRL register offsets
125 * Bank : 0x06
126 */
127#define AB4500_TVOUT_CTRL_REG 0x0680
128
129/*
130 * DBI register offsets
131 * Bank : 0x07
132 */
133#define AB4500_DBI_REG1_REG 0x0700
134#define AB4500_DBI_REG2_REG 0x0701
135
136/*
137 * ECI regsiter offsets
138 * Bank : 0x08
139 */
140#define AB4500_ECI_CTRL_REG 0x0800
141#define AB4500_ECI_HOOKLEVEL_REG 0x0801
142#define AB4500_ECI_DATAOUT_REG 0x0802
143#define AB4500_ECI_DATAIN_REG 0x0803
144
145/*
146 * AV Connector register offsets
147 * Bank : 0x08
148 */
149#define AB4500_AV_CONN_REG 0x0840
150
151/*
152 * Accessory detection register offsets
153 * Bank : 0x08
154 */
155#define AB4500_ACC_DET_DB1_REG 0x0880
156#define AB4500_ACC_DET_DB2_REG 0x0881
157
158/*
159 * GPADC register offsets
160 * Bank : 0x0A
161 */
162#define AB4500_GPADC_CTRL1_REG 0x0A00
163#define AB4500_GPADC_CTRL2_REG 0x0A01
164#define AB4500_GPADC_CTRL3_REG 0x0A02
165#define AB4500_GPADC_AUTO_TIMER_REG 0x0A03
166#define AB4500_GPADC_STAT_REG 0x0A04
167#define AB4500_GPADC_MANDATAL_REG 0x0A05
168#define AB4500_GPADC_MANDATAH_REG 0x0A06
169#define AB4500_GPADC_AUTODATAL_REG 0x0A07
170#define AB4500_GPADC_AUTODATAH_REG 0x0A08
171#define AB4500_GPADC_MUX_CTRL_REG 0x0A09
172
173/*
174 * Charger / status register offfsets
175 * Bank : 0x0B
176 */
177#define AB4500_CH_STATUS1_REG 0x0B00
178#define AB4500_CH_STATUS2_REG 0x0B01
179#define AB4500_CH_USBCH_STAT1_REG 0x0B02
180#define AB4500_CH_USBCH_STAT2_REG 0x0B03
181#define AB4500_CH_FSM_STAT_REG 0x0B04
182#define AB4500_CH_STAT_REG 0x0B05
183
184/*
185 * Charger / control register offfsets
186 * Bank : 0x0B
187 */
188#define AB4500_CH_VOLT_LVL_REG 0x0B40
189
190/*
191 * Charger / main control register offfsets
192 * Bank : 0x0B
193 */
194#define AB4500_MCH_CTRL1 0x0B80
195#define AB4500_MCH_CTRL2 0x0B81
196#define AB4500_MCH_IPT_CURLVL_REG 0x0B82
197#define AB4500_CH_WD_REG 0x0B83
198
199/*
200 * Charger / USB control register offsets
201 * Bank : 0x0B
202 */
203#define AB4500_USBCH_CTRL1_REG 0x0BC0
204#define AB4500_USBCH_CTRL2_REG 0x0BC1
205#define AB4500_USBCH_IPT_CRNTLVL_REG 0x0BC2
206
207/*
208 * RTC bank register offsets
209 * Bank : 0xF
210 */
211#define AB4500_RTC_SOFF_STAT_REG 0x0F00
212#define AB4500_RTC_CC_CONF_REG 0x0F01
213#define AB4500_RTC_READ_REQ_REG 0x0F02
214#define AB4500_RTC_WATCH_TSECMID_REG 0x0F03
215#define AB4500_RTC_WATCH_TSECHI_REG 0x0F04
216#define AB4500_RTC_WATCH_TMIN_LOW_REG 0x0F05
217#define AB4500_RTC_WATCH_TMIN_MID_REG 0x0F06
218#define AB4500_RTC_WATCH_TMIN_HI_REG 0x0F07
219#define AB4500_RTC_ALRM_MIN_LOW_REG 0x0F08
220#define AB4500_RTC_ALRM_MIN_MID_REG 0x0F09
221#define AB4500_RTC_ALRM_MIN_HI_REG 0x0F0A
222#define AB4500_RTC_STAT_REG 0x0F0B
223#define AB4500_RTC_BKUP_CHG_REG 0x0F0C
224#define AB4500_RTC_FORCE_BKUP_REG 0x0F0D
225#define AB4500_RTC_CALIB_REG 0x0F0E
226#define AB4500_RTC_SWITCH_STAT_REG 0x0F0F
227
228/*
229 * PWM Out generators
230 * Bank: 0x10
231 */
232#define AB4500_PWM_OUT_CTRL1_REG 0x1060
233#define AB4500_PWM_OUT_CTRL2_REG 0x1061
234#define AB4500_PWM_OUT_CTRL3_REG 0x1062
235#define AB4500_PWM_OUT_CTRL4_REG 0x1063
236#define AB4500_PWM_OUT_CTRL5_REG 0x1064
237#define AB4500_PWM_OUT_CTRL6_REG 0x1065
238#define AB4500_PWM_OUT_CTRL7_REG 0x1066
239
240#define AB4500_I2C_PAD_CTRL_REG 0x1067
241#define AB4500_REV_REG 0x1080
242
243/**
244 * struct ab4500
245 * @spi: spi device structure
246 * @tx_buf: transmit buffer
247 * @rx_buf: receive buffer
248 * @lock: sync primitive
249 */
250struct ab4500 {
251 struct spi_device *spi;
252 unsigned long tx_buf[4];
253 unsigned long rx_buf[4];
254 struct mutex lock;
255};
256
257int ab4500_write(struct ab4500 *ab4500, unsigned char block,
258 unsigned long addr, unsigned char data);
259int ab4500_read(struct ab4500 *ab4500, unsigned char block,
260 unsigned long addr);
261
262#endif /* MFD_AB4500_H */
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
new file mode 100644
index 000000000000..b63ff3ba3351
--- /dev/null
+++ b/include/linux/mfd/ab8500.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 * Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
6 */
7#ifndef MFD_AB8500_H
8#define MFD_AB8500_H
9
10#include <linux/device.h>
11
12/*
13 * Interrupts
14 */
15
16#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0
17#define AB8500_INT_UN_PLUG_TV_DET 1
18#define AB8500_INT_PLUG_TV_DET 2
19#define AB8500_INT_TEMP_WARM 3
20#define AB8500_INT_PON_KEY2DB_F 4
21#define AB8500_INT_PON_KEY2DB_R 5
22#define AB8500_INT_PON_KEY1DB_F 6
23#define AB8500_INT_PON_KEY1DB_R 7
24#define AB8500_INT_BATT_OVV 8
25#define AB8500_INT_MAIN_CH_UNPLUG_DET 10
26#define AB8500_INT_MAIN_CH_PLUG_DET 11
27#define AB8500_INT_USB_ID_DET_F 12
28#define AB8500_INT_USB_ID_DET_R 13
29#define AB8500_INT_VBUS_DET_F 14
30#define AB8500_INT_VBUS_DET_R 15
31#define AB8500_INT_VBUS_CH_DROP_END 16
32#define AB8500_INT_RTC_60S 17
33#define AB8500_INT_RTC_ALARM 18
34#define AB8500_INT_BAT_CTRL_INDB 20
35#define AB8500_INT_CH_WD_EXP 21
36#define AB8500_INT_VBUS_OVV 22
37#define AB8500_INT_MAIN_CH_DROP_END 23
38#define AB8500_INT_CCN_CONV_ACC 24
39#define AB8500_INT_INT_AUD 25
40#define AB8500_INT_CCEOC 26
41#define AB8500_INT_CC_INT_CALIB 27
42#define AB8500_INT_LOW_BAT_F 28
43#define AB8500_INT_LOW_BAT_R 29
44#define AB8500_INT_BUP_CHG_NOT_OK 30
45#define AB8500_INT_BUP_CHG_OK 31
46#define AB8500_INT_GP_HW_ADC_CONV_END 32
47#define AB8500_INT_ACC_DETECT_1DB_F 33
48#define AB8500_INT_ACC_DETECT_1DB_R 34
49#define AB8500_INT_ACC_DETECT_22DB_F 35
50#define AB8500_INT_ACC_DETECT_22DB_R 36
51#define AB8500_INT_ACC_DETECT_21DB_F 37
52#define AB8500_INT_ACC_DETECT_21DB_R 38
53#define AB8500_INT_GP_SW_ADC_CONV_END 39
54#define AB8500_INT_BTEMP_LOW 72
55#define AB8500_INT_BTEMP_LOW_MEDIUM 73
56#define AB8500_INT_BTEMP_MEDIUM_HIGH 74
57#define AB8500_INT_BTEMP_HIGH 75
58#define AB8500_INT_USB_CHARGER_NOT_OK 81
59#define AB8500_INT_ID_WAKEUP_R 82
60#define AB8500_INT_ID_DET_R1R 84
61#define AB8500_INT_ID_DET_R2R 85
62#define AB8500_INT_ID_DET_R3R 86
63#define AB8500_INT_ID_DET_R4R 87
64#define AB8500_INT_ID_WAKEUP_F 88
65#define AB8500_INT_ID_DET_R1F 90
66#define AB8500_INT_ID_DET_R2F 91
67#define AB8500_INT_ID_DET_R3F 92
68#define AB8500_INT_ID_DET_R4F 93
69#define AB8500_INT_USB_CHG_DET_DONE 94
70#define AB8500_INT_USB_CH_TH_PROT_F 96
71#define AB8500_INT_USB_CH_TH_PROP_R 97
72#define AB8500_INT_MAIN_CH_TH_PROP_F 98
73#define AB8500_INT_MAIN_CH_TH_PROT_R 99
74#define AB8500_INT_USB_CHARGER_NOT_OKF 103
75
76#define AB8500_NR_IRQS 104
77#define AB8500_NUM_IRQ_REGS 13
78
79/**
80 * struct ab8500 - ab8500 internal structure
81 * @dev: parent device
82 * @lock: read/write operations lock
83 * @irq_lock: genirq bus lock
84 * @revision: chip revision
85 * @irq: irq line
86 * @write: register write
87 * @read: register read
88 * @rx_buf: rx buf for SPI
89 * @tx_buf: tx buf for SPI
90 * @mask: cache of IRQ regs for bus lock
91 * @oldmask: cache of previous IRQ regs for bus lock
92 */
93struct ab8500 {
94 struct device *dev;
95 struct mutex lock;
96 struct mutex irq_lock;
97 int revision;
98 int irq_base;
99 int irq;
100
101 int (*write) (struct ab8500 *a8500, u16 addr, u8 data);
102 int (*read) (struct ab8500 *a8500, u16 addr);
103
104 unsigned long tx_buf[4];
105 unsigned long rx_buf[4];
106
107 u8 mask[AB8500_NUM_IRQ_REGS];
108 u8 oldmask[AB8500_NUM_IRQ_REGS];
109};
110
111/**
112 * struct ab8500_platform_data - AB8500 platform data
113 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
114 * @init: board-specific initialization after detection of ab8500
115 */
116struct ab8500_platform_data {
117 int irq_base;
118 void (*init) (struct ab8500 *);
119};
120
121extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data);
122extern int ab8500_read(struct ab8500 *a8500, u16 addr);
123extern int ab8500_set_bits(struct ab8500 *a8500, u16 addr, u8 mask, u8 data);
124
125extern int __devinit ab8500_init(struct ab8500 *ab8500);
126extern int __devexit ab8500_exit(struct ab8500 *ab8500);
127
128#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/abx500.h
index e9aa4c9d749d..390726fcbcb1 100644
--- a/include/linux/mfd/ab3100.h
+++ b/include/linux/mfd/abx500.h
@@ -3,18 +3,37 @@
3 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions 4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com> 5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 *
7 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip
9 * ab3100, ab3550, ab5500 and possibly comming. It is not used for
10 * ab4500 and ab8500 since they are another family of chip.
11 *
12 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
13 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
14 * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
15 * Author: Rickard Andersson <rickard.andersson@stericsson.com>
6 */ 16 */
7 17
8#include <linux/device.h> 18#include <linux/device.h>
9#include <linux/workqueue.h>
10#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
11 20
12#ifndef MFD_AB3100_H 21#ifndef MFD_ABX500_H
13#define MFD_AB3100_H 22#define MFD_ABX500_H
14 23
15#define ABUNKNOWN 0 24#define AB3100_P1A 0xc0
16#define AB3000 1 25#define AB3100_P1B 0xc1
17#define AB3100 2 26#define AB3100_P1C 0xc2
27#define AB3100_P1D 0xc3
28#define AB3100_P1E 0xc4
29#define AB3100_P1F 0xc5
30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8
33#define AB3550_P1A 0x10
34#define AB5500_1_0 0x20
35#define AB5500_2_0 0x21
36#define AB5500_2_1 0x22
18 37
19/* 38/*
20 * AB3100, EVENTA1, A2 and A3 event register flags 39 * AB3100, EVENTA1, A2 and A3 event register flags
@@ -74,7 +93,6 @@
74 * @testreg_client: secondary client for test registers 93 * @testreg_client: secondary client for test registers
75 * @chip_name: name of this chip variant 94 * @chip_name: name of this chip variant
76 * @chip_id: 8 bit chip ID for this chip variant 95 * @chip_id: 8 bit chip ID for this chip variant
77 * @work: an event handling worker
78 * @event_subscribers: event subscribers are listed here 96 * @event_subscribers: event subscribers are listed here
79 * @startup_events: a copy of the first reading of the event registers 97 * @startup_events: a copy of the first reading of the event registers
80 * @startup_events_read: whether the first events have been read 98 * @startup_events_read: whether the first events have been read
@@ -90,9 +108,8 @@ struct ab3100 {
90 struct i2c_client *testreg_client; 108 struct i2c_client *testreg_client;
91 char chip_name[32]; 109 char chip_name[32];
92 u8 chip_id; 110 u8 chip_id;
93 struct work_struct work;
94 struct blocking_notifier_head event_subscribers; 111 struct blocking_notifier_head event_subscribers;
95 u32 startup_events; 112 u8 startup_events[3];
96 bool startup_events_read; 113 bool startup_events_read;
97}; 114};
98 115
@@ -115,18 +132,102 @@ struct ab3100_platform_data {
115 int external_voltage; 132 int external_voltage;
116}; 133};
117 134
118int ab3100_set_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 regval);
119int ab3100_get_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 *regval);
120int ab3100_get_register_page_interruptible(struct ab3100 *ab3100,
121 u8 first_reg, u8 *regvals, u8 numregs);
122int ab3100_mask_and_set_register_interruptible(struct ab3100 *ab3100,
123 u8 reg, u8 andmask, u8 ormask);
124u8 ab3100_get_chip_type(struct ab3100 *ab3100);
125int ab3100_event_register(struct ab3100 *ab3100, 135int ab3100_event_register(struct ab3100 *ab3100,
126 struct notifier_block *nb); 136 struct notifier_block *nb);
127int ab3100_event_unregister(struct ab3100 *ab3100, 137int ab3100_event_unregister(struct ab3100 *ab3100,
128 struct notifier_block *nb); 138 struct notifier_block *nb);
129int ab3100_event_registers_startup_state_get(struct ab3100 *ab3100,
130 u32 *fatevent);
131 139
140/* AB3550, STR register flags */
141#define AB3550_STR_ONSWA (0x01)
142#define AB3550_STR_ONSWB (0x02)
143#define AB3550_STR_ONSWC (0x04)
144#define AB3550_STR_DCIO (0x08)
145#define AB3550_STR_BOOT_MODE (0x10)
146#define AB3550_STR_SIM_OFF (0x20)
147#define AB3550_STR_BATT_REMOVAL (0x40)
148#define AB3550_STR_VBUS (0x80)
149
150/* Interrupt mask registers */
151#define AB3550_IMR1 0x29
152#define AB3550_IMR2 0x2a
153#define AB3550_IMR3 0x2b
154#define AB3550_IMR4 0x2c
155#define AB3550_IMR5 0x2d
156
157enum ab3550_devid {
158 AB3550_DEVID_ADC,
159 AB3550_DEVID_DAC,
160 AB3550_DEVID_LEDS,
161 AB3550_DEVID_POWER,
162 AB3550_DEVID_REGULATORS,
163 AB3550_DEVID_SIM,
164 AB3550_DEVID_UART,
165 AB3550_DEVID_RTC,
166 AB3550_DEVID_CHARGER,
167 AB3550_DEVID_FUELGAUGE,
168 AB3550_DEVID_VIBRATOR,
169 AB3550_DEVID_CODEC,
170 AB3550_NUM_DEVICES,
171};
172
173/**
174 * struct abx500_init_setting
175 * Initial value of the registers for driver to use during setup.
176 */
177struct abx500_init_settings {
178 u8 bank;
179 u8 reg;
180 u8 setting;
181};
182
183/**
184 * struct ab3550_platform_data
185 * Data supplied to initialize board connections to the AB3550
186 */
187struct ab3550_platform_data {
188 struct {unsigned int base; unsigned int count; } irq;
189 void *dev_data[AB3550_NUM_DEVICES];
190 size_t dev_data_sz[AB3550_NUM_DEVICES];
191 struct abx500_init_settings *init_settings;
192 unsigned int init_settings_sz;
193};
194
195int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
196 u8 value);
197int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
198 u8 *value);
199int abx500_get_register_page_interruptible(struct device *dev, u8 bank,
200 u8 first_reg, u8 *regvals, u8 numregs);
201int abx500_set_register_page_interruptible(struct device *dev, u8 bank,
202 u8 first_reg, u8 *regvals, u8 numregs);
203/**
204 * abx500_mask_and_set_register_inerruptible() - Modifies selected bits of a
205 * target register
206 *
207 * @dev: The AB sub device.
208 * @bank: The i2c bank number.
209 * @bitmask: The bit mask to use.
210 * @bitvalues: The new bit values.
211 *
212 * Updates the value of an AB register:
213 * value -> ((value & ~bitmask) | (bitvalues & bitmask))
214 */
215int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
216 u8 reg, u8 bitmask, u8 bitvalues);
217int abx500_get_chip_id(struct device *dev);
218int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
219int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
220
221struct abx500_ops {
222 int (*get_chip_id) (struct device *);
223 int (*get_register) (struct device *, u8, u8, u8 *);
224 int (*set_register) (struct device *, u8, u8, u8);
225 int (*get_register_page) (struct device *, u8, u8, u8 *, u8);
226 int (*set_register_page) (struct device *, u8, u8, u8 *, u8);
227 int (*mask_and_set_register) (struct device *, u8, u8, u8, u8);
228 int (*event_registers_startup_state_get) (struct device *, u8 *);
229 int (*startup_irq_enabled) (struct device *, unsigned int);
230};
231
232int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops);
132#endif 233#endif
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
new file mode 100644
index 000000000000..0ab61320ffa8
--- /dev/null
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -0,0 +1,126 @@
1/*
2 * DaVinci Voice Codec Core Interface for TI platforms
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc
5 *
6 * Author: Miguel Aguilar <miguel.aguilar@ridgerun.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
24#define __LINUX_MFD_DAVINIC_VOICECODEC_H_
25
26#include <linux/kernel.h>
27#include <linux/platform_device.h>
28#include <linux/mfd/core.h>
29
30#include <mach/edma.h>
31
32/*
33 * Register values.
34 */
35#define DAVINCI_VC_PID 0x00
36#define DAVINCI_VC_CTRL 0x04
37#define DAVINCI_VC_INTEN 0x08
38#define DAVINCI_VC_INTSTATUS 0x0c
39#define DAVINCI_VC_INTCLR 0x10
40#define DAVINCI_VC_EMUL_CTRL 0x14
41#define DAVINCI_VC_RFIFO 0x20
42#define DAVINCI_VC_WFIFO 0x24
43#define DAVINCI_VC_FIFOSTAT 0x28
44#define DAVINCI_VC_TST_CTRL 0x2C
45#define DAVINCI_VC_REG05 0x94
46#define DAVINCI_VC_REG09 0xA4
47#define DAVINCI_VC_REG12 0xB0
48
49/* DAVINCI_VC_CTRL bit fields */
50#define DAVINCI_VC_CTRL_MASK 0x5500
51#define DAVINCI_VC_CTRL_RSTADC BIT(0)
52#define DAVINCI_VC_CTRL_RSTDAC BIT(1)
53#define DAVINCI_VC_CTRL_RD_BITS_8 BIT(4)
54#define DAVINCI_VC_CTRL_RD_UNSIGNED BIT(5)
55#define DAVINCI_VC_CTRL_WD_BITS_8 BIT(6)
56#define DAVINCI_VC_CTRL_WD_UNSIGNED BIT(7)
57#define DAVINCI_VC_CTRL_RFIFOEN BIT(8)
58#define DAVINCI_VC_CTRL_RFIFOCL BIT(9)
59#define DAVINCI_VC_CTRL_RFIFOMD_WORD_1 BIT(10)
60#define DAVINCI_VC_CTRL_WFIFOEN BIT(12)
61#define DAVINCI_VC_CTRL_WFIFOCL BIT(13)
62#define DAVINCI_VC_CTRL_WFIFOMD_WORD_1 BIT(14)
63
64/* DAVINCI_VC_INT bit fields */
65#define DAVINCI_VC_INT_MASK 0x3F
66#define DAVINCI_VC_INT_RDRDY_MASK BIT(0)
67#define DAVINCI_VC_INT_RERROVF_MASK BIT(1)
68#define DAVINCI_VC_INT_RERRUDR_MASK BIT(2)
69#define DAVINCI_VC_INT_WDREQ_MASK BIT(3)
70#define DAVINCI_VC_INT_WERROVF_MASKBIT BIT(4)
71#define DAVINCI_VC_INT_WERRUDR_MASK BIT(5)
72
73/* DAVINCI_VC_REG05 bit fields */
74#define DAVINCI_VC_REG05_PGA_GAIN 0x07
75
76/* DAVINCI_VC_REG09 bit fields */
77#define DAVINCI_VC_REG09_MUTE 0x40
78#define DAVINCI_VC_REG09_DIG_ATTEN 0x3F
79
80/* DAVINCI_VC_REG12 bit fields */
81#define DAVINCI_VC_REG12_POWER_ALL_ON 0xFD
82#define DAVINCI_VC_REG12_POWER_ALL_OFF 0x00
83
84#define DAVINCI_VC_CELLS 2
85
86enum davinci_vc_cells {
87 DAVINCI_VC_VCIF_CELL,
88 DAVINCI_VC_CQ93VC_CELL,
89};
90
91struct davinci_vcif {
92 struct platform_device *pdev;
93 u32 dma_tx_channel;
94 u32 dma_rx_channel;
95 dma_addr_t dma_tx_addr;
96 dma_addr_t dma_rx_addr;
97};
98
99struct cq93vc {
100 struct platform_device *pdev;
101 struct snd_soc_codec *codec;
102 u32 sysclk;
103};
104
105struct davinci_vc;
106
107struct davinci_vc {
108 /* Device data */
109 struct device *dev;
110 struct platform_device *pdev;
111 struct clk *clk;
112
113 /* Memory resources */
114 void __iomem *base;
115 resource_size_t pbase;
116 size_t base_size;
117
118 /* MFD cells */
119 struct mfd_cell cells[DAVINCI_VC_CELLS];
120
121 /* Client devices */
122 struct davinci_vcif davinci_vcif;
123 struct cq93vc cq93vc;
124};
125
126#endif
diff --git a/include/linux/mfd/janz.h b/include/linux/mfd/janz.h
new file mode 100644
index 000000000000..e9994c469803
--- /dev/null
+++ b/include/linux/mfd/janz.h
@@ -0,0 +1,54 @@
1/*
2 * Common Definitions for Janz MODULbus devices
3 *
4 * Copyright (c) 2010 Ira W. Snyder <iws@ovro.caltech.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef JANZ_H
13#define JANZ_H
14
15struct janz_platform_data {
16 /* MODULbus Module Number */
17 unsigned int modno;
18};
19
20/* PLX bridge chip onboard registers */
21struct janz_cmodio_onboard_regs {
22 u8 unused1;
23
24 /*
25 * Read access: interrupt status
26 * Write access: interrupt disable
27 */
28 u8 int_disable;
29 u8 unused2;
30
31 /*
32 * Read access: MODULbus number (hex switch)
33 * Write access: interrupt enable
34 */
35 u8 int_enable;
36 u8 unused3;
37
38 /* write-only */
39 u8 reset_assert;
40 u8 unused4;
41
42 /* write-only */
43 u8 reset_deassert;
44 u8 unused5;
45
46 /* read-write access to serial EEPROM */
47 u8 eep;
48 u8 unused6;
49
50 /* write-only access to EEPROM chip select */
51 u8 enid;
52};
53
54#endif /* JANZ_H */
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
new file mode 100644
index 000000000000..5259dfe8c585
--- /dev/null
+++ b/include/linux/mfd/max8925.h
@@ -0,0 +1,253 @@
1/*
2 * Maxim8925 Interface
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_MFD_MAX8925_H
13#define __LINUX_MFD_MAX8925_H
14
15#include <linux/mutex.h>
16#include <linux/interrupt.h>
17
18/* Unified sub device IDs for MAX8925 */
19enum {
20 MAX8925_ID_SD1,
21 MAX8925_ID_SD2,
22 MAX8925_ID_SD3,
23 MAX8925_ID_LDO1,
24 MAX8925_ID_LDO2,
25 MAX8925_ID_LDO3,
26 MAX8925_ID_LDO4,
27 MAX8925_ID_LDO5,
28 MAX8925_ID_LDO6,
29 MAX8925_ID_LDO7,
30 MAX8925_ID_LDO8,
31 MAX8925_ID_LDO9,
32 MAX8925_ID_LDO10,
33 MAX8925_ID_LDO11,
34 MAX8925_ID_LDO12,
35 MAX8925_ID_LDO13,
36 MAX8925_ID_LDO14,
37 MAX8925_ID_LDO15,
38 MAX8925_ID_LDO16,
39 MAX8925_ID_LDO17,
40 MAX8925_ID_LDO18,
41 MAX8925_ID_LDO19,
42 MAX8925_ID_LDO20,
43 MAX8925_ID_MAX,
44};
45
46enum {
47 /*
48 * Charging current threshold trigger going from fast charge
49 * to TOPOFF charge. From 5% to 20% of fasting charging current.
50 */
51 MAX8925_TOPOFF_THR_5PER,
52 MAX8925_TOPOFF_THR_10PER,
53 MAX8925_TOPOFF_THR_15PER,
54 MAX8925_TOPOFF_THR_20PER,
55};
56
57enum {
58 /* Fast charging current */
59 MAX8925_FCHG_85MA,
60 MAX8925_FCHG_300MA,
61 MAX8925_FCHG_460MA,
62 MAX8925_FCHG_600MA,
63 MAX8925_FCHG_700MA,
64 MAX8925_FCHG_800MA,
65 MAX8925_FCHG_900MA,
66 MAX8925_FCHG_1000MA,
67};
68
69/* Charger registers */
70#define MAX8925_CHG_IRQ1 (0x7e)
71#define MAX8925_CHG_IRQ2 (0x7f)
72#define MAX8925_CHG_IRQ1_MASK (0x80)
73#define MAX8925_CHG_IRQ2_MASK (0x81)
74#define MAX8925_CHG_STATUS (0x82)
75
76/* GPM registers */
77#define MAX8925_SYSENSEL (0x00)
78#define MAX8925_ON_OFF_IRQ1 (0x01)
79#define MAX8925_ON_OFF_IRQ1_MASK (0x02)
80#define MAX8925_ON_OFF_STATUS (0x03)
81#define MAX8925_ON_OFF_IRQ2 (0x0d)
82#define MAX8925_ON_OFF_IRQ2_MASK (0x0e)
83#define MAX8925_RESET_CNFG (0x0f)
84
85/* Touch registers */
86#define MAX8925_TSC_IRQ (0x00)
87#define MAX8925_TSC_IRQ_MASK (0x01)
88#define MAX8925_TSC_CNFG1 (0x02)
89#define MAX8925_ADC_SCHED (0x10)
90#define MAX8925_ADC_RES_END (0x6f)
91
92#define MAX8925_NREF_OK (1 << 4)
93
94/* RTC registers */
95#define MAX8925_ALARM0_CNTL (0x18)
96#define MAX8925_ALARM1_CNTL (0x19)
97#define MAX8925_RTC_IRQ (0x1c)
98#define MAX8925_RTC_IRQ_MASK (0x1d)
99#define MAX8925_MPL_CNTL (0x1e)
100
101/* WLED registers */
102#define MAX8925_WLED_MODE_CNTL (0x84)
103#define MAX8925_WLED_CNTL (0x85)
104
105/* MAX8925 Registers */
106#define MAX8925_SDCTL1 (0x04)
107#define MAX8925_SDCTL2 (0x07)
108#define MAX8925_SDCTL3 (0x0A)
109#define MAX8925_SDV1 (0x06)
110#define MAX8925_SDV2 (0x09)
111#define MAX8925_SDV3 (0x0C)
112#define MAX8925_LDOCTL1 (0x18)
113#define MAX8925_LDOCTL2 (0x1C)
114#define MAX8925_LDOCTL3 (0x20)
115#define MAX8925_LDOCTL4 (0x24)
116#define MAX8925_LDOCTL5 (0x28)
117#define MAX8925_LDOCTL6 (0x2C)
118#define MAX8925_LDOCTL7 (0x30)
119#define MAX8925_LDOCTL8 (0x34)
120#define MAX8925_LDOCTL9 (0x38)
121#define MAX8925_LDOCTL10 (0x3C)
122#define MAX8925_LDOCTL11 (0x40)
123#define MAX8925_LDOCTL12 (0x44)
124#define MAX8925_LDOCTL13 (0x48)
125#define MAX8925_LDOCTL14 (0x4C)
126#define MAX8925_LDOCTL15 (0x50)
127#define MAX8925_LDOCTL16 (0x10)
128#define MAX8925_LDOCTL17 (0x14)
129#define MAX8925_LDOCTL18 (0x72)
130#define MAX8925_LDOCTL19 (0x5C)
131#define MAX8925_LDOCTL20 (0x9C)
132#define MAX8925_LDOVOUT1 (0x1A)
133#define MAX8925_LDOVOUT2 (0x1E)
134#define MAX8925_LDOVOUT3 (0x22)
135#define MAX8925_LDOVOUT4 (0x26)
136#define MAX8925_LDOVOUT5 (0x2A)
137#define MAX8925_LDOVOUT6 (0x2E)
138#define MAX8925_LDOVOUT7 (0x32)
139#define MAX8925_LDOVOUT8 (0x36)
140#define MAX8925_LDOVOUT9 (0x3A)
141#define MAX8925_LDOVOUT10 (0x3E)
142#define MAX8925_LDOVOUT11 (0x42)
143#define MAX8925_LDOVOUT12 (0x46)
144#define MAX8925_LDOVOUT13 (0x4A)
145#define MAX8925_LDOVOUT14 (0x4E)
146#define MAX8925_LDOVOUT15 (0x52)
147#define MAX8925_LDOVOUT16 (0x12)
148#define MAX8925_LDOVOUT17 (0x16)
149#define MAX8925_LDOVOUT18 (0x74)
150#define MAX8925_LDOVOUT19 (0x5E)
151#define MAX8925_LDOVOUT20 (0x9E)
152
153/* bit definitions */
154#define CHG_IRQ1_MASK (0x07)
155#define CHG_IRQ2_MASK (0xff)
156#define ON_OFF_IRQ1_MASK (0xff)
157#define ON_OFF_IRQ2_MASK (0x03)
158#define TSC_IRQ_MASK (0x03)
159#define RTC_IRQ_MASK (0x0c)
160
161#define MAX8925_MAX_REGULATOR (23)
162
163#define MAX8925_NAME_SIZE (32)
164
165/* IRQ definitions */
166enum {
167 MAX8925_IRQ_VCHG_DC_OVP,
168 MAX8925_IRQ_VCHG_DC_F,
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,
174 MAX8925_IRQ_VCHG_THM_OK_F,
175 MAX8925_IRQ_VCHG_SYSLOW_F,
176 MAX8925_IRQ_VCHG_SYSLOW_R,
177 MAX8925_IRQ_VCHG_RST,
178 MAX8925_IRQ_VCHG_DONE,
179 MAX8925_IRQ_VCHG_TOPOFF,
180 MAX8925_IRQ_VCHG_TMR_FAULT,
181 MAX8925_IRQ_GPM_RSTIN,
182 MAX8925_IRQ_GPM_MPL,
183 MAX8925_IRQ_GPM_SW_3SEC,
184 MAX8925_IRQ_GPM_EXTON_F,
185 MAX8925_IRQ_GPM_EXTON_R,
186 MAX8925_IRQ_GPM_SW_1SEC,
187 MAX8925_IRQ_GPM_SW_F,
188 MAX8925_IRQ_GPM_SW_R,
189 MAX8925_IRQ_GPM_SYSCKEN_F,
190 MAX8925_IRQ_GPM_SYSCKEN_R,
191 MAX8925_IRQ_RTC_ALARM1,
192 MAX8925_IRQ_RTC_ALARM0,
193 MAX8925_IRQ_TSC_STICK,
194 MAX8925_IRQ_TSC_NSTICK,
195 MAX8925_NR_IRQS,
196};
197
198struct max8925_chip {
199 struct device *dev;
200 struct i2c_client *i2c;
201 struct i2c_client *adc;
202 struct i2c_client *rtc;
203 struct mutex io_lock;
204 struct mutex irq_lock;
205
206 int irq_base;
207 int core_irq;
208 int tsc_irq;
209};
210
211struct max8925_backlight_pdata {
212 int lxw_scl; /* 0/1 -- 0.8Ohm/0.4Ohm */
213 int lxw_freq; /* 700KHz ~ 1400KHz */
214 int dual_string; /* 0/1 -- single/dual string */
215};
216
217struct max8925_touch_pdata {
218 unsigned int flags;
219};
220
221struct max8925_power_pdata {
222 int (*set_charger)(int);
223 unsigned batt_detect:1;
224 unsigned topoff_threshold:2;
225 unsigned fast_charge:3; /* charge current */
226};
227
228/*
229 * irq_base: stores IRQ base number of MAX8925 in platform
230 * tsc_irq: stores IRQ number of MAX8925 TSC
231 */
232struct max8925_platform_data {
233 struct max8925_backlight_pdata *backlight;
234 struct max8925_touch_pdata *touch;
235 struct max8925_power_pdata *power;
236 struct regulator_init_data *regulator[MAX8925_MAX_REGULATOR];
237
238 int irq_base;
239 int tsc_irq;
240};
241
242extern int max8925_reg_read(struct i2c_client *, int);
243extern int max8925_reg_write(struct i2c_client *, int, unsigned char);
244extern int max8925_bulk_read(struct i2c_client *, int, int, unsigned char *);
245extern int max8925_bulk_write(struct i2c_client *, int, int, unsigned char *);
246extern int max8925_set_bits(struct i2c_client *, int, unsigned char,
247 unsigned char);
248
249extern int max8925_device_init(struct max8925_chip *,
250 struct max8925_platform_data *);
251extern void max8925_device_exit(struct max8925_chip *);
252#endif /* __LINUX_MFD_MAX8925_H */
253
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 35680409b8cf..4a894f688549 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -26,10 +26,30 @@ int mc13783_irq_request(struct mc13783 *mc13783, int irq,
26int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, 26int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
27 irq_handler_t handler, const char *name, void *dev); 27 irq_handler_t handler, const char *name, void *dev);
28int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); 28int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev);
29int mc13783_ackirq(struct mc13783 *mc13783, int irq);
30 29
31int mc13783_mask(struct mc13783 *mc13783, int irq); 30int mc13783_irq_mask(struct mc13783 *mc13783, int irq);
32int mc13783_unmask(struct mc13783 *mc13783, int irq); 31int mc13783_irq_unmask(struct mc13783 *mc13783, int irq);
32int mc13783_irq_status(struct mc13783 *mc13783, int irq,
33 int *enabled, int *pending);
34int mc13783_irq_ack(struct mc13783 *mc13783, int irq);
35
36static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated;
37static inline int mc13783_mask(struct mc13783 *mc13783, int irq)
38{
39 return mc13783_irq_mask(mc13783, irq);
40}
41
42static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated;
43static inline int mc13783_unmask(struct mc13783 *mc13783, int irq)
44{
45 return mc13783_irq_unmask(mc13783, irq);
46}
47
48static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated;
49static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
50{
51 return mc13783_irq_ack(mc13783, irq);
52}
33 53
34#define MC13783_ADC0 43 54#define MC13783_ADC0 43
35#define MC13783_ADC0_ADREFEN (1 << 10) 55#define MC13783_ADC0_ADREFEN (1 << 10)
@@ -44,6 +64,70 @@ int mc13783_unmask(struct mc13783 *mc13783, int irq);
44 MC13783_ADC0_TSMOD1 | \ 64 MC13783_ADC0_TSMOD1 | \
45 MC13783_ADC0_TSMOD2) 65 MC13783_ADC0_TSMOD2)
46 66
67struct mc13783_led_platform_data {
68#define MC13783_LED_MD 0
69#define MC13783_LED_AD 1
70#define MC13783_LED_KP 2
71#define MC13783_LED_R1 3
72#define MC13783_LED_G1 4
73#define MC13783_LED_B1 5
74#define MC13783_LED_R2 6
75#define MC13783_LED_G2 7
76#define MC13783_LED_B2 8
77#define MC13783_LED_R3 9
78#define MC13783_LED_G3 10
79#define MC13783_LED_B3 11
80#define MC13783_LED_MAX MC13783_LED_B3
81 int id;
82 const char *name;
83 const char *default_trigger;
84
85/* Three or two bits current selection depending on the led */
86 char max_current;
87};
88
89struct mc13783_leds_platform_data {
90 int num_leds;
91 struct mc13783_led_platform_data *led;
92
93#define MC13783_LED_TRIODE_MD (1 << 0)
94#define MC13783_LED_TRIODE_AD (1 << 1)
95#define MC13783_LED_TRIODE_KP (1 << 2)
96#define MC13783_LED_BOOST_EN (1 << 3)
97#define MC13783_LED_TC1HALF (1 << 4)
98#define MC13783_LED_SLEWLIMTC (1 << 5)
99#define MC13783_LED_SLEWLIMBL (1 << 6)
100#define MC13783_LED_TRIODE_TC1 (1 << 7)
101#define MC13783_LED_TRIODE_TC2 (1 << 8)
102#define MC13783_LED_TRIODE_TC3 (1 << 9)
103 int flags;
104
105#define MC13783_LED_AB_DISABLED 0
106#define MC13783_LED_AB_MD1 1
107#define MC13783_LED_AB_MD12 2
108#define MC13783_LED_AB_MD123 3
109#define MC13783_LED_AB_MD1234 4
110#define MC13783_LED_AB_MD1234_AD1 5
111#define MC13783_LED_AB_MD1234_AD12 6
112#define MC13783_LED_AB_MD1_AD 7
113 char abmode;
114
115#define MC13783_LED_ABREF_200MV 0
116#define MC13783_LED_ABREF_400MV 1
117#define MC13783_LED_ABREF_600MV 2
118#define MC13783_LED_ABREF_800MV 3
119 char abref;
120
121#define MC13783_LED_PERIOD_10MS 0
122#define MC13783_LED_PERIOD_100MS 1
123#define MC13783_LED_PERIOD_500MS 2
124#define MC13783_LED_PERIOD_2S 3
125 char bl_period;
126 char tc1_period;
127 char tc2_period;
128 char tc3_period;
129};
130
47/* to be cleaned up */ 131/* to be cleaned up */
48struct regulator_init_data; 132struct regulator_init_data;
49 133
@@ -60,12 +144,14 @@ struct mc13783_regulator_platform_data {
60struct mc13783_platform_data { 144struct mc13783_platform_data {
61 int num_regulators; 145 int num_regulators;
62 struct mc13783_regulator_init_data *regulators; 146 struct mc13783_regulator_init_data *regulators;
147 struct mc13783_leds_platform_data *leds;
63 148
64#define MC13783_USE_TOUCHSCREEN (1 << 0) 149#define MC13783_USE_TOUCHSCREEN (1 << 0)
65#define MC13783_USE_CODEC (1 << 1) 150#define MC13783_USE_CODEC (1 << 1)
66#define MC13783_USE_ADC (1 << 2) 151#define MC13783_USE_ADC (1 << 2)
67#define MC13783_USE_RTC (1 << 3) 152#define MC13783_USE_RTC (1 << 3)
68#define MC13783_USE_REGULATOR (1 << 4) 153#define MC13783_USE_REGULATOR (1 << 4)
154#define MC13783_USE_LED (1 << 5)
69 unsigned int flags; 155 unsigned int flags;
70}; 156};
71 157
@@ -108,6 +194,8 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
108#define MC13783_REGU_V2 28 194#define MC13783_REGU_V2 28
109#define MC13783_REGU_V3 29 195#define MC13783_REGU_V3 29
110#define MC13783_REGU_V4 30 196#define MC13783_REGU_V4 30
197#define MC13783_REGU_PWGT1SPI 31
198#define MC13783_REGU_PWGT2SPI 32
111 199
112#define MC13783_IRQ_ADCDONE 0 200#define MC13783_IRQ_ADCDONE 0
113#define MC13783_IRQ_ADCBISDONE 1 201#define MC13783_IRQ_ADCBISDONE 1
diff --git a/include/linux/mfd/pcf50633/backlight.h b/include/linux/mfd/pcf50633/backlight.h
new file mode 100644
index 000000000000..83747e217b27
--- /dev/null
+++ b/include/linux/mfd/pcf50633/backlight.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * PCF50633 backlight device driver
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __LINUX_MFD_PCF50633_BACKLIGHT
17#define __LINUX_MFD_PCF50633_BACKLIGHT
18
19/*
20* @default_brightness: Backlight brightness is initialized to this value
21*
22* Brightness to be used after the driver has been probed.
23* Valid range 0-63.
24*
25* @default_brightness_limit: The actual brightness is limited by this value
26*
27* Brightness limit to be used after the driver has been probed. This is useful
28* when it is not known how much power is available for the backlight during
29* probe.
30* Valid range 0-63. Can be changed later with pcf50633_bl_set_brightness_limit.
31*
32* @ramp_time: Display ramp time when changing brightness
33*
34* When changing the backlights brightness the change is not instant, instead
35* it fades smooth from one state to another. This value specifies how long
36* the fade should take. The lower the value the higher the fade time.
37* Valid range 0-255
38*/
39struct pcf50633_bl_platform_data {
40 unsigned int default_brightness;
41 unsigned int default_brightness_limit;
42 uint8_t ramp_time;
43};
44
45
46struct pcf50633;
47
48int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit);
49
50#endif
51
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 3398bd9aab11..ad411a78870c 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -18,6 +18,7 @@
18#include <linux/regulator/driver.h> 18#include <linux/regulator/driver.h>
19#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
20#include <linux/power_supply.h> 20#include <linux/power_supply.h>
21#include <linux/mfd/pcf50633/backlight.h>
21 22
22struct pcf50633; 23struct pcf50633;
23 24
@@ -43,6 +44,8 @@ struct pcf50633_platform_data {
43 void (*force_shutdown)(struct pcf50633 *); 44 void (*force_shutdown)(struct pcf50633 *);
44 45
45 u8 resumers[5]; 46 u8 resumers[5];
47
48 struct pcf50633_bl_platform_data *backlight_data;
46}; 49};
47 50
48struct pcf50633_irq { 51struct pcf50633_irq {
@@ -152,6 +155,7 @@ struct pcf50633 {
152 struct platform_device *mbc_pdev; 155 struct platform_device *mbc_pdev;
153 struct platform_device *adc_pdev; 156 struct platform_device *adc_pdev;
154 struct platform_device *input_pdev; 157 struct platform_device *input_pdev;
158 struct platform_device *bl_pdev;
155 struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS]; 159 struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS];
156}; 160};
157 161
diff --git a/include/linux/mfd/rdc321x.h b/include/linux/mfd/rdc321x.h
new file mode 100644
index 000000000000..4bdf19c8eedf
--- /dev/null
+++ b/include/linux/mfd/rdc321x.h
@@ -0,0 +1,26 @@
1#ifndef __RDC321X_MFD_H
2#define __RDC321X_MFD_H
3
4#include <linux/types.h>
5#include <linux/pci.h>
6
7/* Offsets to be accessed in the southbridge PCI
8 * device configuration register */
9#define RDC321X_WDT_CTRL 0x44
10#define RDC321X_GPIO_CTRL_REG1 0x48
11#define RDC321X_GPIO_DATA_REG1 0x4c
12#define RDC321X_GPIO_CTRL_REG2 0x84
13#define RDC321X_GPIO_DATA_REG2 0x88
14
15#define RDC321X_MAX_GPIO 58
16
17struct rdc321x_gpio_pdata {
18 struct pci_dev *sb_pdev;
19 unsigned max_gpios;
20};
21
22struct rdc321x_wdt_pdata {
23 struct pci_dev *sb_pdev;
24};
25
26#endif /* __RDC321X_MFD_H */
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
index 3bcd7163485c..49067802a6d7 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -1,7 +1,13 @@
1#ifndef __SH_MOBILE_SDHI_H__ 1#ifndef __SH_MOBILE_SDHI_H__
2#define __SH_MOBILE_SDHI_H__ 2#define __SH_MOBILE_SDHI_H__
3 3
4#include <linux/types.h>
5
4struct sh_mobile_sdhi_info { 6struct sh_mobile_sdhi_info {
7 int dma_slave_tx;
8 int dma_slave_rx;
9 unsigned long tmio_flags;
10 u32 tmio_ocr_mask; /* available MMC voltages */
5 void (*set_pwr)(struct platform_device *pdev, int state); 11 void (*set_pwr)(struct platform_device *pdev, int state);
6}; 12};
7 13
diff --git a/include/linux/mfd/tc35892.h b/include/linux/mfd/tc35892.h
new file mode 100644
index 000000000000..e47f770d3068
--- /dev/null
+++ b/include/linux/mfd/tc35892.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 */
6
7#ifndef __LINUX_MFD_TC35892_H
8#define __LINUX_MFD_TC35892_H
9
10#include <linux/device.h>
11
12#define TC35892_RSTCTRL_IRQRST (1 << 4)
13#define TC35892_RSTCTRL_TIMRST (1 << 3)
14#define TC35892_RSTCTRL_ROTRST (1 << 2)
15#define TC35892_RSTCTRL_KBDRST (1 << 1)
16#define TC35892_RSTCTRL_GPIRST (1 << 0)
17
18#define TC35892_IRQST 0x91
19
20#define TC35892_MANFCODE_MAGIC 0x03
21#define TC35892_MANFCODE 0x80
22#define TC35892_VERSION 0x81
23#define TC35892_IOCFG 0xA7
24
25#define TC35892_CLKMODE 0x88
26#define TC35892_CLKCFG 0x89
27#define TC35892_CLKEN 0x8A
28
29#define TC35892_RSTCTRL 0x82
30#define TC35892_EXTRSTN 0x83
31#define TC35892_RSTINTCLR 0x84
32
33#define TC35892_GPIOIS0 0xC9
34#define TC35892_GPIOIS1 0xCA
35#define TC35892_GPIOIS2 0xCB
36#define TC35892_GPIOIBE0 0xCC
37#define TC35892_GPIOIBE1 0xCD
38#define TC35892_GPIOIBE2 0xCE
39#define TC35892_GPIOIEV0 0xCF
40#define TC35892_GPIOIEV1 0xD0
41#define TC35892_GPIOIEV2 0xD1
42#define TC35892_GPIOIE0 0xD2
43#define TC35892_GPIOIE1 0xD3
44#define TC35892_GPIOIE2 0xD4
45#define TC35892_GPIORIS0 0xD6
46#define TC35892_GPIORIS1 0xD7
47#define TC35892_GPIORIS2 0xD8
48#define TC35892_GPIOMIS0 0xD9
49#define TC35892_GPIOMIS1 0xDA
50#define TC35892_GPIOMIS2 0xDB
51#define TC35892_GPIOIC0 0xDC
52#define TC35892_GPIOIC1 0xDD
53#define TC35892_GPIOIC2 0xDE
54
55#define TC35892_GPIODATA0 0xC0
56#define TC35892_GPIOMASK0 0xc1
57#define TC35892_GPIODATA1 0xC2
58#define TC35892_GPIOMASK1 0xc3
59#define TC35892_GPIODATA2 0xC4
60#define TC35892_GPIOMASK2 0xC5
61
62#define TC35892_GPIODIR0 0xC6
63#define TC35892_GPIODIR1 0xC7
64#define TC35892_GPIODIR2 0xC8
65
66#define TC35892_GPIOSYNC0 0xE6
67#define TC35892_GPIOSYNC1 0xE7
68#define TC35892_GPIOSYNC2 0xE8
69
70#define TC35892_GPIOWAKE0 0xE9
71#define TC35892_GPIOWAKE1 0xEA
72#define TC35892_GPIOWAKE2 0xEB
73
74#define TC35892_GPIOODM0 0xE0
75#define TC35892_GPIOODE0 0xE1
76#define TC35892_GPIOODM1 0xE2
77#define TC35892_GPIOODE1 0xE3
78#define TC35892_GPIOODM2 0xE4
79#define TC35892_GPIOODE2 0xE5
80
81#define TC35892_INT_GPIIRQ 0
82#define TC35892_INT_TI0IRQ 1
83#define TC35892_INT_TI1IRQ 2
84#define TC35892_INT_TI2IRQ 3
85#define TC35892_INT_ROTIRQ 5
86#define TC35892_INT_KBDIRQ 6
87#define TC35892_INT_PORIRQ 7
88
89#define TC35892_NR_INTERNAL_IRQS 8
90#define TC35892_INT_GPIO(x) (TC35892_NR_INTERNAL_IRQS + (x))
91
92struct tc35892 {
93 struct mutex lock;
94 struct device *dev;
95 struct i2c_client *i2c;
96
97 int irq_base;
98 int num_gpio;
99 struct tc35892_platform_data *pdata;
100};
101
102extern int tc35892_reg_write(struct tc35892 *tc35892, u8 reg, u8 data);
103extern int tc35892_reg_read(struct tc35892 *tc35892, u8 reg);
104extern int tc35892_block_read(struct tc35892 *tc35892, u8 reg, u8 length,
105 u8 *values);
106extern int tc35892_block_write(struct tc35892 *tc35892, u8 reg, u8 length,
107 const u8 *values);
108extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val);
109
110/**
111 * struct tc35892_gpio_platform_data - TC35892 GPIO platform data
112 * @gpio_base: first gpio number assigned to TC35892. A maximum of
113 * %TC35892_NR_GPIOS GPIOs will be allocated.
114 */
115struct tc35892_gpio_platform_data {
116 int gpio_base;
117};
118
119/**
120 * struct tc35892_platform_data - TC35892 platform data
121 * @irq_base: base IRQ number. %TC35892_NR_IRQS irqs will be used.
122 * @gpio: GPIO-specific platform data
123 */
124struct tc35892_platform_data {
125 int irq_base;
126 struct tc35892_gpio_platform_data *gpio;
127};
128
129#define TC35892_NR_GPIOS 24
130#define TC35892_NR_IRQS TC35892_INT_GPIO(TC35892_NR_GPIOS)
131
132#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 9cb1834deffa..f07425bc3dcd 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -50,16 +50,28 @@
50 tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \ 50 tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
51 } while (0) 51 } while (0)
52 52
53/* tmio MMC platform flags */
54#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0)
55
53int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 56int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
54int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 57int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
55void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 58void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
56void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 59void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
57 60
61struct tmio_mmc_dma {
62 void *chan_priv_tx;
63 void *chan_priv_rx;
64};
65
58/* 66/*
59 * data for the MMC controller 67 * data for the MMC controller
60 */ 68 */
61struct tmio_mmc_data { 69struct tmio_mmc_data {
62 const unsigned int hclk; 70 unsigned int hclk;
71 unsigned long capabilities;
72 unsigned long flags;
73 u32 ocr_mask; /* available voltages */
74 struct tmio_mmc_dma *dma;
63 void (*set_pwr)(struct platform_device *host, int state); 75 void (*set_pwr)(struct platform_device *host, int state);
64 void (*set_clk_div)(struct platform_device *host, int state); 76 void (*set_clk_div)(struct platform_device *host, int state);
65}; 77};
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
new file mode 100644
index 000000000000..c923e4864f55
--- /dev/null
+++ b/include/linux/mfd/tps6507x.h
@@ -0,0 +1,169 @@
1/* linux/mfd/tps6507x.h
2 *
3 * Functions to access TPS65070 power management chip.
4 *
5 * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
6 *
7 *
8 * For licencing details see kernel-base/COPYING
9 */
10
11#ifndef __LINUX_MFD_TPS6507X_H
12#define __LINUX_MFD_TPS6507X_H
13
14/*
15 * ----------------------------------------------------------------------------
16 * Registers, all 8 bits
17 * ----------------------------------------------------------------------------
18 */
19
20
21/* Register definitions */
22#define TPS6507X_REG_PPATH1 0X01
23#define TPS6507X_CHG_USB BIT(7)
24#define TPS6507X_CHG_AC BIT(6)
25#define TPS6507X_CHG_USB_PW_ENABLE BIT(5)
26#define TPS6507X_CHG_AC_PW_ENABLE BIT(4)
27#define TPS6507X_CHG_AC_CURRENT BIT(2)
28#define TPS6507X_CHG_USB_CURRENT BIT(0)
29
30#define TPS6507X_REG_INT 0X02
31#define TPS6507X_REG_MASK_AC_USB BIT(7)
32#define TPS6507X_REG_MASK_TSC BIT(6)
33#define TPS6507X_REG_MASK_PB_IN BIT(5)
34#define TPS6507X_REG_TSC_INT BIT(3)
35#define TPS6507X_REG_PB_IN_INT BIT(2)
36#define TPS6507X_REG_AC_USB_APPLIED BIT(1)
37#define TPS6507X_REG_AC_USB_REMOVED BIT(0)
38
39#define TPS6507X_REG_CHGCONFIG0 0X03
40
41#define TPS6507X_REG_CHGCONFIG1 0X04
42#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
43#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
44#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
45#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
46#define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
47
48#define TPS6507X_REG_CHGCONFIG2 0X05
49
50#define TPS6507X_REG_CHGCONFIG3 0X06
51
52#define TPS6507X_REG_ADCONFIG 0X07
53#define TPS6507X_ADCONFIG_AD_ENABLE BIT(7)
54#define TPS6507X_ADCONFIG_START_CONVERSION BIT(6)
55#define TPS6507X_ADCONFIG_CONVERSION_DONE BIT(5)
56#define TPS6507X_ADCONFIG_VREF_ENABLE BIT(4)
57#define TPS6507X_ADCONFIG_INPUT_AD_IN1 0
58#define TPS6507X_ADCONFIG_INPUT_AD_IN2 1
59#define TPS6507X_ADCONFIG_INPUT_AD_IN3 2
60#define TPS6507X_ADCONFIG_INPUT_AD_IN4 3
61#define TPS6507X_ADCONFIG_INPUT_TS_PIN 4
62#define TPS6507X_ADCONFIG_INPUT_BAT_CURRENT 5
63#define TPS6507X_ADCONFIG_INPUT_AC_VOLTAGE 6
64#define TPS6507X_ADCONFIG_INPUT_SYS_VOLTAGE 7
65#define TPS6507X_ADCONFIG_INPUT_CHARGER_VOLTAGE 8
66#define TPS6507X_ADCONFIG_INPUT_BAT_VOLTAGE 9
67#define TPS6507X_ADCONFIG_INPUT_THRESHOLD_VOLTAGE 10
68#define TPS6507X_ADCONFIG_INPUT_ISET1_VOLTAGE 11
69#define TPS6507X_ADCONFIG_INPUT_ISET2_VOLTAGE 12
70#define TPS6507X_ADCONFIG_INPUT_REAL_TSC 14
71#define TPS6507X_ADCONFIG_INPUT_TSC 15
72
73#define TPS6507X_REG_TSCMODE 0X08
74#define TPS6507X_TSCMODE_X_POSITION 0
75#define TPS6507X_TSCMODE_Y_POSITION 1
76#define TPS6507X_TSCMODE_PRESSURE 2
77#define TPS6507X_TSCMODE_X_PLATE 3
78#define TPS6507X_TSCMODE_Y_PLATE 4
79#define TPS6507X_TSCMODE_STANDBY 5
80#define TPS6507X_TSCMODE_ADC_INPUT 6
81#define TPS6507X_TSCMODE_DISABLE 7
82
83#define TPS6507X_REG_ADRESULT_1 0X09
84
85#define TPS6507X_REG_ADRESULT_2 0X0A
86#define TPS6507X_REG_ADRESULT_2_MASK (BIT(1) | BIT(0))
87
88#define TPS6507X_REG_PGOOD 0X0B
89
90#define TPS6507X_REG_PGOODMASK 0X0C
91
92#define TPS6507X_REG_CON_CTRL1 0X0D
93#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
94#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
95#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
96#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
97#define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
98
99#define TPS6507X_REG_CON_CTRL2 0X0E
100
101#define TPS6507X_REG_CON_CTRL3 0X0F
102
103#define TPS6507X_REG_DEFDCDC1 0X10
104#define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
105#define TPS6507X_DEFDCDC1_DCDC1_MASK 0X3F
106
107#define TPS6507X_REG_DEFDCDC2_LOW 0X11
108#define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK 0X3F
109
110#define TPS6507X_REG_DEFDCDC2_HIGH 0X12
111#define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK 0X3F
112
113#define TPS6507X_REG_DEFDCDC3_LOW 0X13
114#define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK 0X3F
115
116#define TPS6507X_REG_DEFDCDC3_HIGH 0X14
117#define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK 0X3F
118
119#define TPS6507X_REG_DEFSLEW 0X15
120
121#define TPS6507X_REG_LDO_CTRL1 0X16
122#define TPS6507X_REG_LDO_CTRL1_LDO1_MASK 0X0F
123
124#define TPS6507X_REG_DEFLDO2 0X17
125#define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
126
127#define TPS6507X_REG_WLED_CTRL1 0X18
128
129#define TPS6507X_REG_WLED_CTRL2 0X19
130
131/* VDCDC MASK */
132#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
133
134#define TPS6507X_MAX_REGISTER 0X19
135
136/**
137 * struct tps6507x_board - packages regulator and touchscreen init data
138 * @tps6507x_regulator_data: regulator initialization values
139 *
140 * Board data may be used to initialize regulator and touchscreen.
141 */
142
143struct tps6507x_board {
144 struct regulator_init_data *tps6507x_pmic_init_data;
145 struct touchscreen_init_data *tps6507x_ts_init_data;
146};
147
148/**
149 * struct tps6507x_dev - tps6507x sub-driver chip access routines
150 * @read_dev() - I2C register read function
151 * @write_dev() - I2C register write function
152 *
153 * Device data may be used to access the TPS6507x chip
154 */
155
156struct tps6507x_dev {
157 struct device *dev;
158 struct i2c_client *i2c_client;
159 int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
160 void *dest);
161 int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
162 void *src);
163
164 /* Client devices */
165 struct tps6507x_pmic *pmic;
166 struct tps6507x_ts *ts;
167};
168
169#endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index aa9c3789bed4..4321f044d1e4 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/mfd/mcp.h> 13#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/semaphore.h>
15 16
16#define UCB_IO_DATA 0x00 17#define UCB_IO_DATA 0x00
17#define UCB_IO_DIR 0x01 18#define UCB_IO_DIR 0x01
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 5184b79c700b..eb5bd4e0e03c 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -15,6 +15,7 @@
15#ifndef __MFD_WM831X_CORE_H__ 15#ifndef __MFD_WM831X_CORE_H__
16#define __MFD_WM831X_CORE_H__ 16#define __MFD_WM831X_CORE_H__
17 17
18#include <linux/completion.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19 20
20/* 21/*
@@ -254,9 +255,15 @@ struct wm831x {
254 int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */ 255 int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */
255 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ 256 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */
256 257
258 /* Chip revision based flags */
259 unsigned has_gpio_ena:1; /* Has GPIO enable bit */
260 unsigned has_cs_sts:1; /* Has current sink status bit */
261 unsigned charger_irq_wake:1; /* Are charger IRQs a wake source? */
262
257 int num_gpio; 263 int num_gpio;
258 264
259 struct mutex auxadc_lock; 265 struct mutex auxadc_lock;
266 struct completion auxadc_done;
260 267
261 /* The WM831x has a security key blocking access to certain 268 /* The WM831x has a security key blocking access to certain
262 * registers. The mutex is taken by the accessors for locking 269 * registers. The mutex is taken by the accessors for locking
diff --git a/include/linux/mfd/wm831x/gpio.h b/include/linux/mfd/wm831x/gpio.h
index 2835614af0e3..9b163c58865f 100644
--- a/include/linux/mfd/wm831x/gpio.h
+++ b/include/linux/mfd/wm831x/gpio.h
@@ -41,6 +41,10 @@
41#define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */ 41#define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */
42#define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */ 42#define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */
43#define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */ 43#define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */
44#define WM831X_GPN_ENA 0x0080 /* GPN_ENA */
45#define WM831X_GPN_ENA_MASK 0x0080 /* GPN_ENA */
46#define WM831X_GPN_ENA_SHIFT 7 /* GPN_ENA */
47#define WM831X_GPN_ENA_WIDTH 1 /* GPN_ENA */
44#define WM831X_GPN_TRI 0x0080 /* GPN_TRI */ 48#define WM831X_GPN_TRI 0x0080 /* GPN_TRI */
45#define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */ 49#define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */
46#define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */ 50#define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index d899dc0223ba..a95141eafce3 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -492,6 +492,8 @@
492 */ 492 */
493#define WM8350_JACK_L_LVL 0x0800 493#define WM8350_JACK_L_LVL 0x0800
494#define WM8350_JACK_R_LVL 0x0400 494#define WM8350_JACK_R_LVL 0x0400
495#define WM8350_JACK_MICSCD_LVL 0x0200
496#define WM8350_JACK_MICSD_LVL 0x0100
495 497
496/* 498/*
497 * WM8350 Platform setup 499 * WM8350 Platform setup
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 43868899bf49..98fcc977e82b 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/completion.h>
19 20
20#include <linux/mfd/wm8350/audio.h> 21#include <linux/mfd/wm8350/audio.h>
21#include <linux/mfd/wm8350/gpio.h> 22#include <linux/mfd/wm8350/gpio.h>
@@ -579,6 +580,8 @@
579 580
580#define WM8350_NUM_IRQ 63 581#define WM8350_NUM_IRQ 63
581 582
583#define WM8350_NUM_IRQ_REGS 7
584
582struct wm8350_reg_access { 585struct wm8350_reg_access {
583 u16 readable; /* Mask of readable bits */ 586 u16 readable; /* Mask of readable bits */
584 u16 writable; /* Mask of writable bits */ 587 u16 writable; /* Mask of writable bits */
@@ -600,11 +603,6 @@ extern const u16 wm8352_mode3_defaults[];
600 603
601struct wm8350; 604struct wm8350;
602 605
603struct wm8350_irq {
604 irq_handler_t handler;
605 void *data;
606};
607
608struct wm8350_hwmon { 606struct wm8350_hwmon {
609 struct platform_device *pdev; 607 struct platform_device *pdev;
610 struct device *classdev; 608 struct device *classdev;
@@ -624,11 +622,13 @@ struct wm8350 {
624 u16 *reg_cache; 622 u16 *reg_cache;
625 623
626 struct mutex auxadc_mutex; 624 struct mutex auxadc_mutex;
625 struct completion auxadc_done;
627 626
628 /* Interrupt handling */ 627 /* Interrupt handling */
629 struct mutex irq_mutex; /* IRQ table mutex */ 628 struct mutex irq_lock;
630 struct wm8350_irq irq[WM8350_NUM_IRQ];
631 int chip_irq; 629 int chip_irq;
630 int irq_base;
631 u16 irq_masks[WM8350_NUM_IRQ_REGS];
632 632
633 /* Client devices */ 633 /* Client devices */
634 struct wm8350_codec codec; 634 struct wm8350_codec codec;
@@ -647,11 +647,13 @@ struct wm8350 {
647 * used by the platform to configure GPIO functions and similar. 647 * used by the platform to configure GPIO functions and similar.
648 * @irq_high: Set if WM8350 IRQ is active high. 648 * @irq_high: Set if WM8350 IRQ is active high.
649 * @irq_base: Base IRQ for genirq (not currently used). 649 * @irq_base: Base IRQ for genirq (not currently used).
650 * @gpio_base: Base for gpiolib.
650 */ 651 */
651struct wm8350_platform_data { 652struct wm8350_platform_data {
652 int (*init)(struct wm8350 *wm8350); 653 int (*init)(struct wm8350 *wm8350);
653 int irq_high; 654 int irq_high;
654 int irq_base; 655 int irq_base;
656 int gpio_base;
655}; 657};
656 658
657 659
@@ -677,12 +679,33 @@ int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
677/* 679/*
678 * WM8350 internal interrupts 680 * WM8350 internal interrupts
679 */ 681 */
680int wm8350_register_irq(struct wm8350 *wm8350, int irq, 682static inline int wm8350_register_irq(struct wm8350 *wm8350, int irq,
681 irq_handler_t handler, unsigned long flags, 683 irq_handler_t handler,
682 const char *name, void *data); 684 unsigned long flags,
683int wm8350_free_irq(struct wm8350 *wm8350, int irq); 685 const char *name, void *data)
684int wm8350_mask_irq(struct wm8350 *wm8350, int irq); 686{
685int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); 687 if (!wm8350->irq_base)
688 return -ENODEV;
689
690 return request_threaded_irq(irq + wm8350->irq_base, NULL,
691 handler, flags, name, data);
692}
693
694static inline void wm8350_free_irq(struct wm8350 *wm8350, int irq, void *data)
695{
696 free_irq(irq + wm8350->irq_base, data);
697}
698
699static inline void wm8350_mask_irq(struct wm8350 *wm8350, int irq)
700{
701 disable_irq(irq + wm8350->irq_base);
702}
703
704static inline void wm8350_unmask_irq(struct wm8350 *wm8350, int irq)
705{
706 enable_irq(irq + wm8350->irq_base);
707}
708
686int wm8350_irq_init(struct wm8350 *wm8350, int irq, 709int wm8350_irq_init(struct wm8350 *wm8350, int irq,
687 struct wm8350_platform_data *pdata); 710 struct wm8350_platform_data *pdata);
688int wm8350_irq_exit(struct wm8350 *wm8350); 711int wm8350_irq_exit(struct wm8350 *wm8350);
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h
index 71af3d6ebe9d..d657bcd6d955 100644
--- a/include/linux/mfd/wm8350/gpio.h
+++ b/include/linux/mfd/wm8350/gpio.h
@@ -29,6 +29,7 @@
29#define WM8350_GPIO_FUNCTION_SELECT_2 0x8D 29#define WM8350_GPIO_FUNCTION_SELECT_2 0x8D
30#define WM8350_GPIO_FUNCTION_SELECT_3 0x8E 30#define WM8350_GPIO_FUNCTION_SELECT_3 0x8E
31#define WM8350_GPIO_FUNCTION_SELECT_4 0x8F 31#define WM8350_GPIO_FUNCTION_SELECT_4 0x8F
32#define WM8350_GPIO_LEVEL 0xE6
32 33
33/* 34/*
34 * GPIO Functions 35 * GPIO Functions
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h
index 24add2bef6c9..ebd72ffc62d1 100644
--- a/include/linux/mfd/wm8350/rtc.h
+++ b/include/linux/mfd/wm8350/rtc.h
@@ -263,6 +263,7 @@ struct wm8350_rtc {
263 struct platform_device *pdev; 263 struct platform_device *pdev;
264 struct rtc_device *rtc; 264 struct rtc_device *rtc;
265 int alarm_enabled; /* used over suspend/resume */ 265 int alarm_enabled; /* used over suspend/resume */
266 int update_enabled;
266}; 267};
267 268
268#endif 269#endif
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
new file mode 100644
index 000000000000..de79baee4925
--- /dev/null
+++ b/include/linux/mfd/wm8994/core.h
@@ -0,0 +1,105 @@
1/*
2 * include/linux/mfd/wm8994/core.h -- Core interface for WM8994
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM8994_CORE_H__
16#define __MFD_WM8994_CORE_H__
17
18#include <linux/interrupt.h>
19
20struct regulator_dev;
21struct regulator_bulk_data;
22
23#define WM8994_NUM_GPIO_REGS 11
24#define WM8994_NUM_LDO_REGS 2
25#define WM8994_NUM_IRQ_REGS 2
26
27#define WM8994_IRQ_TEMP_SHUT 0
28#define WM8994_IRQ_MIC1_DET 1
29#define WM8994_IRQ_MIC1_SHRT 2
30#define WM8994_IRQ_MIC2_DET 3
31#define WM8994_IRQ_MIC2_SHRT 4
32#define WM8994_IRQ_FLL1_LOCK 5
33#define WM8994_IRQ_FLL2_LOCK 6
34#define WM8994_IRQ_SRC1_LOCK 7
35#define WM8994_IRQ_SRC2_LOCK 8
36#define WM8994_IRQ_AIF1DRC1_SIG_DET 9
37#define WM8994_IRQ_AIF1DRC2_SIG_DET 10
38#define WM8994_IRQ_AIF2DRC_SIG_DET 11
39#define WM8994_IRQ_FIFOS_ERR 12
40#define WM8994_IRQ_WSEQ_DONE 13
41#define WM8994_IRQ_DCS_DONE 14
42#define WM8994_IRQ_TEMP_WARN 15
43
44/* GPIOs in the chip are numbered from 1-11 */
45#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
46
47struct wm8994 {
48 struct mutex io_lock;
49 struct mutex irq_lock;
50
51 struct device *dev;
52 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
53 int bytes, void *dest);
54 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
55 int bytes, void *src);
56
57 void *control_data;
58
59 int gpio_base;
60 int irq_base;
61
62 int irq;
63 u16 irq_masks_cur[WM8994_NUM_IRQ_REGS];
64 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
65
66 /* Used over suspend/resume */
67 u16 ldo_regs[WM8994_NUM_LDO_REGS];
68 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
69
70 struct regulator_dev *dbvdd;
71 struct regulator_bulk_data *supplies;
72};
73
74/* Device I/O API */
75int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
76int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
77 unsigned short val);
78int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
79 unsigned short mask, unsigned short val);
80int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
81 int count, u16 *buf);
82
83
84/* Helper to save on boilerplate */
85static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
86 irq_handler_t handler, const char *name,
87 void *data)
88{
89 if (!wm8994->irq_base)
90 return -EINVAL;
91 return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
92 IRQF_TRIGGER_RISING, name,
93 data);
94}
95static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
96{
97 if (!wm8994->irq_base)
98 return;
99 free_irq(wm8994->irq_base + irq, data);
100}
101
102int wm8994_irq_init(struct wm8994 *wm8994);
103void wm8994_irq_exit(struct wm8994 *wm8994);
104
105#endif
diff --git a/include/linux/mfd/wm8994/gpio.h b/include/linux/mfd/wm8994/gpio.h
new file mode 100644
index 000000000000..b4d4c22991e8
--- /dev/null
+++ b/include/linux/mfd/wm8994/gpio.h
@@ -0,0 +1,72 @@
1/*
2 * include/linux/mfd/wm8994/gpio.h - GPIO configuration for WM8994
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM8994_GPIO_H__
16#define __MFD_WM8994_GPIO_H__
17
18#define WM8994_GPIO_MAX 11
19
20#define WM8994_GP_FN_PIN_SPECIFIC 0
21#define WM8994_GP_FN_GPIO 1
22#define WM8994_GP_FN_SDOUT 2
23#define WM8994_GP_FN_IRQ 3
24#define WM8994_GP_FN_TEMPERATURE 4
25#define WM8994_GP_FN_MICBIAS1_DET 5
26#define WM8994_GP_FN_MICBIAS1_SHORT 6
27#define WM8994_GP_FN_MICBIAS2_DET 7
28#define WM8994_GP_FN_MICBIAS2_SHORT 8
29#define WM8994_GP_FN_FLL1_LOCK 9
30#define WM8994_GP_FN_FLL2_LOCK 10
31#define WM8994_GP_FN_SRC1_LOCK 11
32#define WM8994_GP_FN_SRC2_LOCK 12
33#define WM8994_GP_FN_DRC1_ACT 13
34#define WM8994_GP_FN_DRC2_ACT 14
35#define WM8994_GP_FN_DRC3_ACT 15
36#define WM8994_GP_FN_WSEQ_STATUS 16
37#define WM8994_GP_FN_FIFO_ERROR 17
38#define WM8994_GP_FN_OPCLK 18
39
40#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */
41#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */
42#define WM8994_GPN_DIR_SHIFT 15 /* GPN_DIR */
43#define WM8994_GPN_DIR_WIDTH 1 /* GPN_DIR */
44#define WM8994_GPN_PU 0x4000 /* GPN_PU */
45#define WM8994_GPN_PU_MASK 0x4000 /* GPN_PU */
46#define WM8994_GPN_PU_SHIFT 14 /* GPN_PU */
47#define WM8994_GPN_PU_WIDTH 1 /* GPN_PU */
48#define WM8994_GPN_PD 0x2000 /* GPN_PD */
49#define WM8994_GPN_PD_MASK 0x2000 /* GPN_PD */
50#define WM8994_GPN_PD_SHIFT 13 /* GPN_PD */
51#define WM8994_GPN_PD_WIDTH 1 /* GPN_PD */
52#define WM8994_GPN_POL 0x0400 /* GPN_POL */
53#define WM8994_GPN_POL_MASK 0x0400 /* GPN_POL */
54#define WM8994_GPN_POL_SHIFT 10 /* GPN_POL */
55#define WM8994_GPN_POL_WIDTH 1 /* GPN_POL */
56#define WM8994_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
57#define WM8994_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
58#define WM8994_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
59#define WM8994_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
60#define WM8994_GPN_DB 0x0100 /* GPN_DB */
61#define WM8994_GPN_DB_MASK 0x0100 /* GPN_DB */
62#define WM8994_GPN_DB_SHIFT 8 /* GPN_DB */
63#define WM8994_GPN_DB_WIDTH 1 /* GPN_DB */
64#define WM8994_GPN_LVL 0x0040 /* GPN_LVL */
65#define WM8994_GPN_LVL_MASK 0x0040 /* GPN_LVL */
66#define WM8994_GPN_LVL_SHIFT 6 /* GPN_LVL */
67#define WM8994_GPN_LVL_WIDTH 1 /* GPN_LVL */
68#define WM8994_GPN_FN_MASK 0x001F /* GPN_FN - [4:0] */
69#define WM8994_GPN_FN_SHIFT 0 /* GPN_FN - [4:0] */
70#define WM8994_GPN_FN_WIDTH 5 /* GPN_FN - [4:0] */
71
72#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
new file mode 100644
index 000000000000..5c51f367c061
--- /dev/null
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -0,0 +1,98 @@
1/*
2 * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM8994_PDATA_H__
16#define __MFD_WM8994_PDATA_H__
17
18#define WM8994_NUM_LDO 2
19#define WM8994_NUM_GPIO 11
20
21struct wm8994_ldo_pdata {
22 /** GPIOs to enable regulator, 0 or less if not available */
23 int enable;
24
25 const char *supply;
26 struct regulator_init_data *init_data;
27};
28
29#define WM8994_CONFIGURE_GPIO 0x8000
30
31#define WM8994_DRC_REGS 5
32#define WM8994_EQ_REGS 19
33
34/**
35 * DRC configurations are specified with a label and a set of register
36 * values to write (the enable bits will be ignored). At runtime an
37 * enumerated control will be presented for each DRC block allowing
38 * the user to choose the configration to use.
39 *
40 * Configurations may be generated by hand or by using the DRC control
41 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
42 * for details.
43 */
44struct wm8994_drc_cfg {
45 const char *name;
46 u16 regs[WM8994_DRC_REGS];
47};
48
49/**
50 * ReTune Mobile configurations are specified with a label, sample
51 * rate and set of values to write (the enable bits will be ignored).
52 *
53 * Configurations are expected to be generated using the ReTune Mobile
54 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
55 */
56struct wm8994_retune_mobile_cfg {
57 const char *name;
58 unsigned int rate;
59 u16 regs[WM8994_EQ_REGS];
60};
61
62struct wm8994_pdata {
63 int gpio_base;
64
65 /**
66 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
67 * can be used for all zero values.
68 */
69 int gpio_defaults[WM8994_NUM_GPIO];
70
71 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
72
73 int irq_base; /** Base IRQ number for WM8994, required for IRQs */
74
75 int num_drc_cfgs;
76 struct wm8994_drc_cfg *drc_cfgs;
77
78 int num_retune_mobile_cfgs;
79 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
80
81 /* LINEOUT can be differential or single ended */
82 unsigned int lineout1_diff:1;
83 unsigned int lineout2_diff:1;
84
85 /* Common mode feedback */
86 unsigned int lineout1fb:1;
87 unsigned int lineout2fb:1;
88
89 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
90 unsigned int micbias1_lvl:1;
91 unsigned int micbias2_lvl:1;
92
93 /* Jack detect threashold levels, see datasheet for values */
94 unsigned int jd_scthr:2;
95 unsigned int jd_thr:2;
96};
97
98#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
new file mode 100644
index 000000000000..967f62f54159
--- /dev/null
+++ b/include/linux/mfd/wm8994/registers.h
@@ -0,0 +1,4292 @@
1/*
2 * include/linux/mfd/wm8994/registers.h -- Register definitions for WM8994
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM8994_REGISTERS_H__
16#define __MFD_WM8994_REGISTERS_H__
17
18/*
19 * Register values.
20 */
21#define WM8994_SOFTWARE_RESET 0x00
22#define WM8994_POWER_MANAGEMENT_1 0x01
23#define WM8994_POWER_MANAGEMENT_2 0x02
24#define WM8994_POWER_MANAGEMENT_3 0x03
25#define WM8994_POWER_MANAGEMENT_4 0x04
26#define WM8994_POWER_MANAGEMENT_5 0x05
27#define WM8994_POWER_MANAGEMENT_6 0x06
28#define WM8994_INPUT_MIXER_1 0x15
29#define WM8994_LEFT_LINE_INPUT_1_2_VOLUME 0x18
30#define WM8994_LEFT_LINE_INPUT_3_4_VOLUME 0x19
31#define WM8994_RIGHT_LINE_INPUT_1_2_VOLUME 0x1A
32#define WM8994_RIGHT_LINE_INPUT_3_4_VOLUME 0x1B
33#define WM8994_LEFT_OUTPUT_VOLUME 0x1C
34#define WM8994_RIGHT_OUTPUT_VOLUME 0x1D
35#define WM8994_LINE_OUTPUTS_VOLUME 0x1E
36#define WM8994_HPOUT2_VOLUME 0x1F
37#define WM8994_LEFT_OPGA_VOLUME 0x20
38#define WM8994_RIGHT_OPGA_VOLUME 0x21
39#define WM8994_SPKMIXL_ATTENUATION 0x22
40#define WM8994_SPKMIXR_ATTENUATION 0x23
41#define WM8994_SPKOUT_MIXERS 0x24
42#define WM8994_CLASSD 0x25
43#define WM8994_SPEAKER_VOLUME_LEFT 0x26
44#define WM8994_SPEAKER_VOLUME_RIGHT 0x27
45#define WM8994_INPUT_MIXER_2 0x28
46#define WM8994_INPUT_MIXER_3 0x29
47#define WM8994_INPUT_MIXER_4 0x2A
48#define WM8994_INPUT_MIXER_5 0x2B
49#define WM8994_INPUT_MIXER_6 0x2C
50#define WM8994_OUTPUT_MIXER_1 0x2D
51#define WM8994_OUTPUT_MIXER_2 0x2E
52#define WM8994_OUTPUT_MIXER_3 0x2F
53#define WM8994_OUTPUT_MIXER_4 0x30
54#define WM8994_OUTPUT_MIXER_5 0x31
55#define WM8994_OUTPUT_MIXER_6 0x32
56#define WM8994_HPOUT2_MIXER 0x33
57#define WM8994_LINE_MIXER_1 0x34
58#define WM8994_LINE_MIXER_2 0x35
59#define WM8994_SPEAKER_MIXER 0x36
60#define WM8994_ADDITIONAL_CONTROL 0x37
61#define WM8994_ANTIPOP_1 0x38
62#define WM8994_ANTIPOP_2 0x39
63#define WM8994_MICBIAS 0x3A
64#define WM8994_LDO_1 0x3B
65#define WM8994_LDO_2 0x3C
66#define WM8994_CHARGE_PUMP_1 0x4C
67#define WM8994_CLASS_W_1 0x51
68#define WM8994_DC_SERVO_1 0x54
69#define WM8994_DC_SERVO_2 0x55
70#define WM8994_DC_SERVO_4 0x57
71#define WM8994_DC_SERVO_READBACK 0x58
72#define WM8994_ANALOGUE_HP_1 0x60
73#define WM8994_CHIP_REVISION 0x100
74#define WM8994_CONTROL_INTERFACE 0x101
75#define WM8994_WRITE_SEQUENCER_CTRL_1 0x110
76#define WM8994_WRITE_SEQUENCER_CTRL_2 0x111
77#define WM8994_AIF1_CLOCKING_1 0x200
78#define WM8994_AIF1_CLOCKING_2 0x201
79#define WM8994_AIF2_CLOCKING_1 0x204
80#define WM8994_AIF2_CLOCKING_2 0x205
81#define WM8994_CLOCKING_1 0x208
82#define WM8994_CLOCKING_2 0x209
83#define WM8994_AIF1_RATE 0x210
84#define WM8994_AIF2_RATE 0x211
85#define WM8994_RATE_STATUS 0x212
86#define WM8994_FLL1_CONTROL_1 0x220
87#define WM8994_FLL1_CONTROL_2 0x221
88#define WM8994_FLL1_CONTROL_3 0x222
89#define WM8994_FLL1_CONTROL_4 0x223
90#define WM8994_FLL1_CONTROL_5 0x224
91#define WM8994_FLL2_CONTROL_1 0x240
92#define WM8994_FLL2_CONTROL_2 0x241
93#define WM8994_FLL2_CONTROL_3 0x242
94#define WM8994_FLL2_CONTROL_4 0x243
95#define WM8994_FLL2_CONTROL_5 0x244
96#define WM8994_AIF1_CONTROL_1 0x300
97#define WM8994_AIF1_CONTROL_2 0x301
98#define WM8994_AIF1_MASTER_SLAVE 0x302
99#define WM8994_AIF1_BCLK 0x303
100#define WM8994_AIF1ADC_LRCLK 0x304
101#define WM8994_AIF1DAC_LRCLK 0x305
102#define WM8994_AIF1DAC_DATA 0x306
103#define WM8994_AIF1ADC_DATA 0x307
104#define WM8994_AIF2_CONTROL_1 0x310
105#define WM8994_AIF2_CONTROL_2 0x311
106#define WM8994_AIF2_MASTER_SLAVE 0x312
107#define WM8994_AIF2_BCLK 0x313
108#define WM8994_AIF2ADC_LRCLK 0x314
109#define WM8994_AIF2DAC_LRCLK 0x315
110#define WM8994_AIF2DAC_DATA 0x316
111#define WM8994_AIF2ADC_DATA 0x317
112#define WM8994_AIF1_ADC1_LEFT_VOLUME 0x400
113#define WM8994_AIF1_ADC1_RIGHT_VOLUME 0x401
114#define WM8994_AIF1_DAC1_LEFT_VOLUME 0x402
115#define WM8994_AIF1_DAC1_RIGHT_VOLUME 0x403
116#define WM8994_AIF1_ADC2_LEFT_VOLUME 0x404
117#define WM8994_AIF1_ADC2_RIGHT_VOLUME 0x405
118#define WM8994_AIF1_DAC2_LEFT_VOLUME 0x406
119#define WM8994_AIF1_DAC2_RIGHT_VOLUME 0x407
120#define WM8994_AIF1_ADC1_FILTERS 0x410
121#define WM8994_AIF1_ADC2_FILTERS 0x411
122#define WM8994_AIF1_DAC1_FILTERS_1 0x420
123#define WM8994_AIF1_DAC1_FILTERS_2 0x421
124#define WM8994_AIF1_DAC2_FILTERS_1 0x422
125#define WM8994_AIF1_DAC2_FILTERS_2 0x423
126#define WM8994_AIF1_DRC1_1 0x440
127#define WM8994_AIF1_DRC1_2 0x441
128#define WM8994_AIF1_DRC1_3 0x442
129#define WM8994_AIF1_DRC1_4 0x443
130#define WM8994_AIF1_DRC1_5 0x444
131#define WM8994_AIF1_DRC2_1 0x450
132#define WM8994_AIF1_DRC2_2 0x451
133#define WM8994_AIF1_DRC2_3 0x452
134#define WM8994_AIF1_DRC2_4 0x453
135#define WM8994_AIF1_DRC2_5 0x454
136#define WM8994_AIF1_DAC1_EQ_GAINS_1 0x480
137#define WM8994_AIF1_DAC1_EQ_GAINS_2 0x481
138#define WM8994_AIF1_DAC1_EQ_BAND_1_A 0x482
139#define WM8994_AIF1_DAC1_EQ_BAND_1_B 0x483
140#define WM8994_AIF1_DAC1_EQ_BAND_1_PG 0x484
141#define WM8994_AIF1_DAC1_EQ_BAND_2_A 0x485
142#define WM8994_AIF1_DAC1_EQ_BAND_2_B 0x486
143#define WM8994_AIF1_DAC1_EQ_BAND_2_C 0x487
144#define WM8994_AIF1_DAC1_EQ_BAND_2_PG 0x488
145#define WM8994_AIF1_DAC1_EQ_BAND_3_A 0x489
146#define WM8994_AIF1_DAC1_EQ_BAND_3_B 0x48A
147#define WM8994_AIF1_DAC1_EQ_BAND_3_C 0x48B
148#define WM8994_AIF1_DAC1_EQ_BAND_3_PG 0x48C
149#define WM8994_AIF1_DAC1_EQ_BAND_4_A 0x48D
150#define WM8994_AIF1_DAC1_EQ_BAND_4_B 0x48E
151#define WM8994_AIF1_DAC1_EQ_BAND_4_C 0x48F
152#define WM8994_AIF1_DAC1_EQ_BAND_4_PG 0x490
153#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491
154#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492
155#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493
156#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0
157#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1
158#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2
159#define WM8994_AIF1_DAC2_EQ_BAND_1_B 0x4A3
160#define WM8994_AIF1_DAC2_EQ_BAND_1_PG 0x4A4
161#define WM8994_AIF1_DAC2_EQ_BAND_2_A 0x4A5
162#define WM8994_AIF1_DAC2_EQ_BAND_2_B 0x4A6
163#define WM8994_AIF1_DAC2_EQ_BAND_2_C 0x4A7
164#define WM8994_AIF1_DAC2_EQ_BAND_2_PG 0x4A8
165#define WM8994_AIF1_DAC2_EQ_BAND_3_A 0x4A9
166#define WM8994_AIF1_DAC2_EQ_BAND_3_B 0x4AA
167#define WM8994_AIF1_DAC2_EQ_BAND_3_C 0x4AB
168#define WM8994_AIF1_DAC2_EQ_BAND_3_PG 0x4AC
169#define WM8994_AIF1_DAC2_EQ_BAND_4_A 0x4AD
170#define WM8994_AIF1_DAC2_EQ_BAND_4_B 0x4AE
171#define WM8994_AIF1_DAC2_EQ_BAND_4_C 0x4AF
172#define WM8994_AIF1_DAC2_EQ_BAND_4_PG 0x4B0
173#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1
174#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2
175#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3
176#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500
177#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501
178#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502
179#define WM8994_AIF2_DAC_RIGHT_VOLUME 0x503
180#define WM8994_AIF2_ADC_FILTERS 0x510
181#define WM8994_AIF2_DAC_FILTERS_1 0x520
182#define WM8994_AIF2_DAC_FILTERS_2 0x521
183#define WM8994_AIF2_DRC_1 0x540
184#define WM8994_AIF2_DRC_2 0x541
185#define WM8994_AIF2_DRC_3 0x542
186#define WM8994_AIF2_DRC_4 0x543
187#define WM8994_AIF2_DRC_5 0x544
188#define WM8994_AIF2_EQ_GAINS_1 0x580
189#define WM8994_AIF2_EQ_GAINS_2 0x581
190#define WM8994_AIF2_EQ_BAND_1_A 0x582
191#define WM8994_AIF2_EQ_BAND_1_B 0x583
192#define WM8994_AIF2_EQ_BAND_1_PG 0x584
193#define WM8994_AIF2_EQ_BAND_2_A 0x585
194#define WM8994_AIF2_EQ_BAND_2_B 0x586
195#define WM8994_AIF2_EQ_BAND_2_C 0x587
196#define WM8994_AIF2_EQ_BAND_2_PG 0x588
197#define WM8994_AIF2_EQ_BAND_3_A 0x589
198#define WM8994_AIF2_EQ_BAND_3_B 0x58A
199#define WM8994_AIF2_EQ_BAND_3_C 0x58B
200#define WM8994_AIF2_EQ_BAND_3_PG 0x58C
201#define WM8994_AIF2_EQ_BAND_4_A 0x58D
202#define WM8994_AIF2_EQ_BAND_4_B 0x58E
203#define WM8994_AIF2_EQ_BAND_4_C 0x58F
204#define WM8994_AIF2_EQ_BAND_4_PG 0x590
205#define WM8994_AIF2_EQ_BAND_5_A 0x591
206#define WM8994_AIF2_EQ_BAND_5_B 0x592
207#define WM8994_AIF2_EQ_BAND_5_PG 0x593
208#define WM8994_DAC1_MIXER_VOLUMES 0x600
209#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601
210#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602
211#define WM8994_DAC2_MIXER_VOLUMES 0x603
212#define WM8994_DAC2_LEFT_MIXER_ROUTING 0x604
213#define WM8994_DAC2_RIGHT_MIXER_ROUTING 0x605
214#define WM8994_AIF1_ADC1_LEFT_MIXER_ROUTING 0x606
215#define WM8994_AIF1_ADC1_RIGHT_MIXER_ROUTING 0x607
216#define WM8994_AIF1_ADC2_LEFT_MIXER_ROUTING 0x608
217#define WM8994_AIF1_ADC2_RIGHT_MIXER_ROUTING 0x609
218#define WM8994_DAC1_LEFT_VOLUME 0x610
219#define WM8994_DAC1_RIGHT_VOLUME 0x611
220#define WM8994_DAC2_LEFT_VOLUME 0x612
221#define WM8994_DAC2_RIGHT_VOLUME 0x613
222#define WM8994_DAC_SOFTMUTE 0x614
223#define WM8994_OVERSAMPLING 0x620
224#define WM8994_SIDETONE 0x621
225#define WM8994_GPIO_1 0x700
226#define WM8994_GPIO_2 0x701
227#define WM8994_GPIO_3 0x702
228#define WM8994_GPIO_4 0x703
229#define WM8994_GPIO_5 0x704
230#define WM8994_GPIO_6 0x705
231#define WM8994_GPIO_7 0x706
232#define WM8994_GPIO_8 0x707
233#define WM8994_GPIO_9 0x708
234#define WM8994_GPIO_10 0x709
235#define WM8994_GPIO_11 0x70A
236#define WM8994_PULL_CONTROL_1 0x720
237#define WM8994_PULL_CONTROL_2 0x721
238#define WM8994_INTERRUPT_STATUS_1 0x730
239#define WM8994_INTERRUPT_STATUS_2 0x731
240#define WM8994_INTERRUPT_RAW_STATUS_2 0x732
241#define WM8994_INTERRUPT_STATUS_1_MASK 0x738
242#define WM8994_INTERRUPT_STATUS_2_MASK 0x739
243#define WM8994_INTERRUPT_CONTROL 0x740
244#define WM8994_IRQ_DEBOUNCE 0x748
245#define WM8994_WRITE_SEQUENCER_0 0x3000
246#define WM8994_WRITE_SEQUENCER_1 0x3001
247#define WM8994_WRITE_SEQUENCER_2 0x3002
248#define WM8994_WRITE_SEQUENCER_3 0x3003
249#define WM8994_WRITE_SEQUENCER_4 0x3004
250#define WM8994_WRITE_SEQUENCER_5 0x3005
251#define WM8994_WRITE_SEQUENCER_6 0x3006
252#define WM8994_WRITE_SEQUENCER_7 0x3007
253#define WM8994_WRITE_SEQUENCER_8 0x3008
254#define WM8994_WRITE_SEQUENCER_9 0x3009
255#define WM8994_WRITE_SEQUENCER_10 0x300A
256#define WM8994_WRITE_SEQUENCER_11 0x300B
257#define WM8994_WRITE_SEQUENCER_12 0x300C
258#define WM8994_WRITE_SEQUENCER_13 0x300D
259#define WM8994_WRITE_SEQUENCER_14 0x300E
260#define WM8994_WRITE_SEQUENCER_15 0x300F
261#define WM8994_WRITE_SEQUENCER_16 0x3010
262#define WM8994_WRITE_SEQUENCER_17 0x3011
263#define WM8994_WRITE_SEQUENCER_18 0x3012
264#define WM8994_WRITE_SEQUENCER_19 0x3013
265#define WM8994_WRITE_SEQUENCER_20 0x3014
266#define WM8994_WRITE_SEQUENCER_21 0x3015
267#define WM8994_WRITE_SEQUENCER_22 0x3016
268#define WM8994_WRITE_SEQUENCER_23 0x3017
269#define WM8994_WRITE_SEQUENCER_24 0x3018
270#define WM8994_WRITE_SEQUENCER_25 0x3019
271#define WM8994_WRITE_SEQUENCER_26 0x301A
272#define WM8994_WRITE_SEQUENCER_27 0x301B
273#define WM8994_WRITE_SEQUENCER_28 0x301C
274#define WM8994_WRITE_SEQUENCER_29 0x301D
275#define WM8994_WRITE_SEQUENCER_30 0x301E
276#define WM8994_WRITE_SEQUENCER_31 0x301F
277#define WM8994_WRITE_SEQUENCER_32 0x3020
278#define WM8994_WRITE_SEQUENCER_33 0x3021
279#define WM8994_WRITE_SEQUENCER_34 0x3022
280#define WM8994_WRITE_SEQUENCER_35 0x3023
281#define WM8994_WRITE_SEQUENCER_36 0x3024
282#define WM8994_WRITE_SEQUENCER_37 0x3025
283#define WM8994_WRITE_SEQUENCER_38 0x3026
284#define WM8994_WRITE_SEQUENCER_39 0x3027
285#define WM8994_WRITE_SEQUENCER_40 0x3028
286#define WM8994_WRITE_SEQUENCER_41 0x3029
287#define WM8994_WRITE_SEQUENCER_42 0x302A
288#define WM8994_WRITE_SEQUENCER_43 0x302B
289#define WM8994_WRITE_SEQUENCER_44 0x302C
290#define WM8994_WRITE_SEQUENCER_45 0x302D
291#define WM8994_WRITE_SEQUENCER_46 0x302E
292#define WM8994_WRITE_SEQUENCER_47 0x302F
293#define WM8994_WRITE_SEQUENCER_48 0x3030
294#define WM8994_WRITE_SEQUENCER_49 0x3031
295#define WM8994_WRITE_SEQUENCER_50 0x3032
296#define WM8994_WRITE_SEQUENCER_51 0x3033
297#define WM8994_WRITE_SEQUENCER_52 0x3034
298#define WM8994_WRITE_SEQUENCER_53 0x3035
299#define WM8994_WRITE_SEQUENCER_54 0x3036
300#define WM8994_WRITE_SEQUENCER_55 0x3037
301#define WM8994_WRITE_SEQUENCER_56 0x3038
302#define WM8994_WRITE_SEQUENCER_57 0x3039
303#define WM8994_WRITE_SEQUENCER_58 0x303A
304#define WM8994_WRITE_SEQUENCER_59 0x303B
305#define WM8994_WRITE_SEQUENCER_60 0x303C
306#define WM8994_WRITE_SEQUENCER_61 0x303D
307#define WM8994_WRITE_SEQUENCER_62 0x303E
308#define WM8994_WRITE_SEQUENCER_63 0x303F
309#define WM8994_WRITE_SEQUENCER_64 0x3040
310#define WM8994_WRITE_SEQUENCER_65 0x3041
311#define WM8994_WRITE_SEQUENCER_66 0x3042
312#define WM8994_WRITE_SEQUENCER_67 0x3043
313#define WM8994_WRITE_SEQUENCER_68 0x3044
314#define WM8994_WRITE_SEQUENCER_69 0x3045
315#define WM8994_WRITE_SEQUENCER_70 0x3046
316#define WM8994_WRITE_SEQUENCER_71 0x3047
317#define WM8994_WRITE_SEQUENCER_72 0x3048
318#define WM8994_WRITE_SEQUENCER_73 0x3049
319#define WM8994_WRITE_SEQUENCER_74 0x304A
320#define WM8994_WRITE_SEQUENCER_75 0x304B
321#define WM8994_WRITE_SEQUENCER_76 0x304C
322#define WM8994_WRITE_SEQUENCER_77 0x304D
323#define WM8994_WRITE_SEQUENCER_78 0x304E
324#define WM8994_WRITE_SEQUENCER_79 0x304F
325#define WM8994_WRITE_SEQUENCER_80 0x3050
326#define WM8994_WRITE_SEQUENCER_81 0x3051
327#define WM8994_WRITE_SEQUENCER_82 0x3052
328#define WM8994_WRITE_SEQUENCER_83 0x3053
329#define WM8994_WRITE_SEQUENCER_84 0x3054
330#define WM8994_WRITE_SEQUENCER_85 0x3055
331#define WM8994_WRITE_SEQUENCER_86 0x3056
332#define WM8994_WRITE_SEQUENCER_87 0x3057
333#define WM8994_WRITE_SEQUENCER_88 0x3058
334#define WM8994_WRITE_SEQUENCER_89 0x3059
335#define WM8994_WRITE_SEQUENCER_90 0x305A
336#define WM8994_WRITE_SEQUENCER_91 0x305B
337#define WM8994_WRITE_SEQUENCER_92 0x305C
338#define WM8994_WRITE_SEQUENCER_93 0x305D
339#define WM8994_WRITE_SEQUENCER_94 0x305E
340#define WM8994_WRITE_SEQUENCER_95 0x305F
341#define WM8994_WRITE_SEQUENCER_96 0x3060
342#define WM8994_WRITE_SEQUENCER_97 0x3061
343#define WM8994_WRITE_SEQUENCER_98 0x3062
344#define WM8994_WRITE_SEQUENCER_99 0x3063
345#define WM8994_WRITE_SEQUENCER_100 0x3064
346#define WM8994_WRITE_SEQUENCER_101 0x3065
347#define WM8994_WRITE_SEQUENCER_102 0x3066
348#define WM8994_WRITE_SEQUENCER_103 0x3067
349#define WM8994_WRITE_SEQUENCER_104 0x3068
350#define WM8994_WRITE_SEQUENCER_105 0x3069
351#define WM8994_WRITE_SEQUENCER_106 0x306A
352#define WM8994_WRITE_SEQUENCER_107 0x306B
353#define WM8994_WRITE_SEQUENCER_108 0x306C
354#define WM8994_WRITE_SEQUENCER_109 0x306D
355#define WM8994_WRITE_SEQUENCER_110 0x306E
356#define WM8994_WRITE_SEQUENCER_111 0x306F
357#define WM8994_WRITE_SEQUENCER_112 0x3070
358#define WM8994_WRITE_SEQUENCER_113 0x3071
359#define WM8994_WRITE_SEQUENCER_114 0x3072
360#define WM8994_WRITE_SEQUENCER_115 0x3073
361#define WM8994_WRITE_SEQUENCER_116 0x3074
362#define WM8994_WRITE_SEQUENCER_117 0x3075
363#define WM8994_WRITE_SEQUENCER_118 0x3076
364#define WM8994_WRITE_SEQUENCER_119 0x3077
365#define WM8994_WRITE_SEQUENCER_120 0x3078
366#define WM8994_WRITE_SEQUENCER_121 0x3079
367#define WM8994_WRITE_SEQUENCER_122 0x307A
368#define WM8994_WRITE_SEQUENCER_123 0x307B
369#define WM8994_WRITE_SEQUENCER_124 0x307C
370#define WM8994_WRITE_SEQUENCER_125 0x307D
371#define WM8994_WRITE_SEQUENCER_126 0x307E
372#define WM8994_WRITE_SEQUENCER_127 0x307F
373#define WM8994_WRITE_SEQUENCER_128 0x3080
374#define WM8994_WRITE_SEQUENCER_129 0x3081
375#define WM8994_WRITE_SEQUENCER_130 0x3082
376#define WM8994_WRITE_SEQUENCER_131 0x3083
377#define WM8994_WRITE_SEQUENCER_132 0x3084
378#define WM8994_WRITE_SEQUENCER_133 0x3085
379#define WM8994_WRITE_SEQUENCER_134 0x3086
380#define WM8994_WRITE_SEQUENCER_135 0x3087
381#define WM8994_WRITE_SEQUENCER_136 0x3088
382#define WM8994_WRITE_SEQUENCER_137 0x3089
383#define WM8994_WRITE_SEQUENCER_138 0x308A
384#define WM8994_WRITE_SEQUENCER_139 0x308B
385#define WM8994_WRITE_SEQUENCER_140 0x308C
386#define WM8994_WRITE_SEQUENCER_141 0x308D
387#define WM8994_WRITE_SEQUENCER_142 0x308E
388#define WM8994_WRITE_SEQUENCER_143 0x308F
389#define WM8994_WRITE_SEQUENCER_144 0x3090
390#define WM8994_WRITE_SEQUENCER_145 0x3091
391#define WM8994_WRITE_SEQUENCER_146 0x3092
392#define WM8994_WRITE_SEQUENCER_147 0x3093
393#define WM8994_WRITE_SEQUENCER_148 0x3094
394#define WM8994_WRITE_SEQUENCER_149 0x3095
395#define WM8994_WRITE_SEQUENCER_150 0x3096
396#define WM8994_WRITE_SEQUENCER_151 0x3097
397#define WM8994_WRITE_SEQUENCER_152 0x3098
398#define WM8994_WRITE_SEQUENCER_153 0x3099
399#define WM8994_WRITE_SEQUENCER_154 0x309A
400#define WM8994_WRITE_SEQUENCER_155 0x309B
401#define WM8994_WRITE_SEQUENCER_156 0x309C
402#define WM8994_WRITE_SEQUENCER_157 0x309D
403#define WM8994_WRITE_SEQUENCER_158 0x309E
404#define WM8994_WRITE_SEQUENCER_159 0x309F
405#define WM8994_WRITE_SEQUENCER_160 0x30A0
406#define WM8994_WRITE_SEQUENCER_161 0x30A1
407#define WM8994_WRITE_SEQUENCER_162 0x30A2
408#define WM8994_WRITE_SEQUENCER_163 0x30A3
409#define WM8994_WRITE_SEQUENCER_164 0x30A4
410#define WM8994_WRITE_SEQUENCER_165 0x30A5
411#define WM8994_WRITE_SEQUENCER_166 0x30A6
412#define WM8994_WRITE_SEQUENCER_167 0x30A7
413#define WM8994_WRITE_SEQUENCER_168 0x30A8
414#define WM8994_WRITE_SEQUENCER_169 0x30A9
415#define WM8994_WRITE_SEQUENCER_170 0x30AA
416#define WM8994_WRITE_SEQUENCER_171 0x30AB
417#define WM8994_WRITE_SEQUENCER_172 0x30AC
418#define WM8994_WRITE_SEQUENCER_173 0x30AD
419#define WM8994_WRITE_SEQUENCER_174 0x30AE
420#define WM8994_WRITE_SEQUENCER_175 0x30AF
421#define WM8994_WRITE_SEQUENCER_176 0x30B0
422#define WM8994_WRITE_SEQUENCER_177 0x30B1
423#define WM8994_WRITE_SEQUENCER_178 0x30B2
424#define WM8994_WRITE_SEQUENCER_179 0x30B3
425#define WM8994_WRITE_SEQUENCER_180 0x30B4
426#define WM8994_WRITE_SEQUENCER_181 0x30B5
427#define WM8994_WRITE_SEQUENCER_182 0x30B6
428#define WM8994_WRITE_SEQUENCER_183 0x30B7
429#define WM8994_WRITE_SEQUENCER_184 0x30B8
430#define WM8994_WRITE_SEQUENCER_185 0x30B9
431#define WM8994_WRITE_SEQUENCER_186 0x30BA
432#define WM8994_WRITE_SEQUENCER_187 0x30BB
433#define WM8994_WRITE_SEQUENCER_188 0x30BC
434#define WM8994_WRITE_SEQUENCER_189 0x30BD
435#define WM8994_WRITE_SEQUENCER_190 0x30BE
436#define WM8994_WRITE_SEQUENCER_191 0x30BF
437#define WM8994_WRITE_SEQUENCER_192 0x30C0
438#define WM8994_WRITE_SEQUENCER_193 0x30C1
439#define WM8994_WRITE_SEQUENCER_194 0x30C2
440#define WM8994_WRITE_SEQUENCER_195 0x30C3
441#define WM8994_WRITE_SEQUENCER_196 0x30C4
442#define WM8994_WRITE_SEQUENCER_197 0x30C5
443#define WM8994_WRITE_SEQUENCER_198 0x30C6
444#define WM8994_WRITE_SEQUENCER_199 0x30C7
445#define WM8994_WRITE_SEQUENCER_200 0x30C8
446#define WM8994_WRITE_SEQUENCER_201 0x30C9
447#define WM8994_WRITE_SEQUENCER_202 0x30CA
448#define WM8994_WRITE_SEQUENCER_203 0x30CB
449#define WM8994_WRITE_SEQUENCER_204 0x30CC
450#define WM8994_WRITE_SEQUENCER_205 0x30CD
451#define WM8994_WRITE_SEQUENCER_206 0x30CE
452#define WM8994_WRITE_SEQUENCER_207 0x30CF
453#define WM8994_WRITE_SEQUENCER_208 0x30D0
454#define WM8994_WRITE_SEQUENCER_209 0x30D1
455#define WM8994_WRITE_SEQUENCER_210 0x30D2
456#define WM8994_WRITE_SEQUENCER_211 0x30D3
457#define WM8994_WRITE_SEQUENCER_212 0x30D4
458#define WM8994_WRITE_SEQUENCER_213 0x30D5
459#define WM8994_WRITE_SEQUENCER_214 0x30D6
460#define WM8994_WRITE_SEQUENCER_215 0x30D7
461#define WM8994_WRITE_SEQUENCER_216 0x30D8
462#define WM8994_WRITE_SEQUENCER_217 0x30D9
463#define WM8994_WRITE_SEQUENCER_218 0x30DA
464#define WM8994_WRITE_SEQUENCER_219 0x30DB
465#define WM8994_WRITE_SEQUENCER_220 0x30DC
466#define WM8994_WRITE_SEQUENCER_221 0x30DD
467#define WM8994_WRITE_SEQUENCER_222 0x30DE
468#define WM8994_WRITE_SEQUENCER_223 0x30DF
469#define WM8994_WRITE_SEQUENCER_224 0x30E0
470#define WM8994_WRITE_SEQUENCER_225 0x30E1
471#define WM8994_WRITE_SEQUENCER_226 0x30E2
472#define WM8994_WRITE_SEQUENCER_227 0x30E3
473#define WM8994_WRITE_SEQUENCER_228 0x30E4
474#define WM8994_WRITE_SEQUENCER_229 0x30E5
475#define WM8994_WRITE_SEQUENCER_230 0x30E6
476#define WM8994_WRITE_SEQUENCER_231 0x30E7
477#define WM8994_WRITE_SEQUENCER_232 0x30E8
478#define WM8994_WRITE_SEQUENCER_233 0x30E9
479#define WM8994_WRITE_SEQUENCER_234 0x30EA
480#define WM8994_WRITE_SEQUENCER_235 0x30EB
481#define WM8994_WRITE_SEQUENCER_236 0x30EC
482#define WM8994_WRITE_SEQUENCER_237 0x30ED
483#define WM8994_WRITE_SEQUENCER_238 0x30EE
484#define WM8994_WRITE_SEQUENCER_239 0x30EF
485#define WM8994_WRITE_SEQUENCER_240 0x30F0
486#define WM8994_WRITE_SEQUENCER_241 0x30F1
487#define WM8994_WRITE_SEQUENCER_242 0x30F2
488#define WM8994_WRITE_SEQUENCER_243 0x30F3
489#define WM8994_WRITE_SEQUENCER_244 0x30F4
490#define WM8994_WRITE_SEQUENCER_245 0x30F5
491#define WM8994_WRITE_SEQUENCER_246 0x30F6
492#define WM8994_WRITE_SEQUENCER_247 0x30F7
493#define WM8994_WRITE_SEQUENCER_248 0x30F8
494#define WM8994_WRITE_SEQUENCER_249 0x30F9
495#define WM8994_WRITE_SEQUENCER_250 0x30FA
496#define WM8994_WRITE_SEQUENCER_251 0x30FB
497#define WM8994_WRITE_SEQUENCER_252 0x30FC
498#define WM8994_WRITE_SEQUENCER_253 0x30FD
499#define WM8994_WRITE_SEQUENCER_254 0x30FE
500#define WM8994_WRITE_SEQUENCER_255 0x30FF
501#define WM8994_WRITE_SEQUENCER_256 0x3100
502#define WM8994_WRITE_SEQUENCER_257 0x3101
503#define WM8994_WRITE_SEQUENCER_258 0x3102
504#define WM8994_WRITE_SEQUENCER_259 0x3103
505#define WM8994_WRITE_SEQUENCER_260 0x3104
506#define WM8994_WRITE_SEQUENCER_261 0x3105
507#define WM8994_WRITE_SEQUENCER_262 0x3106
508#define WM8994_WRITE_SEQUENCER_263 0x3107
509#define WM8994_WRITE_SEQUENCER_264 0x3108
510#define WM8994_WRITE_SEQUENCER_265 0x3109
511#define WM8994_WRITE_SEQUENCER_266 0x310A
512#define WM8994_WRITE_SEQUENCER_267 0x310B
513#define WM8994_WRITE_SEQUENCER_268 0x310C
514#define WM8994_WRITE_SEQUENCER_269 0x310D
515#define WM8994_WRITE_SEQUENCER_270 0x310E
516#define WM8994_WRITE_SEQUENCER_271 0x310F
517#define WM8994_WRITE_SEQUENCER_272 0x3110
518#define WM8994_WRITE_SEQUENCER_273 0x3111
519#define WM8994_WRITE_SEQUENCER_274 0x3112
520#define WM8994_WRITE_SEQUENCER_275 0x3113
521#define WM8994_WRITE_SEQUENCER_276 0x3114
522#define WM8994_WRITE_SEQUENCER_277 0x3115
523#define WM8994_WRITE_SEQUENCER_278 0x3116
524#define WM8994_WRITE_SEQUENCER_279 0x3117
525#define WM8994_WRITE_SEQUENCER_280 0x3118
526#define WM8994_WRITE_SEQUENCER_281 0x3119
527#define WM8994_WRITE_SEQUENCER_282 0x311A
528#define WM8994_WRITE_SEQUENCER_283 0x311B
529#define WM8994_WRITE_SEQUENCER_284 0x311C
530#define WM8994_WRITE_SEQUENCER_285 0x311D
531#define WM8994_WRITE_SEQUENCER_286 0x311E
532#define WM8994_WRITE_SEQUENCER_287 0x311F
533#define WM8994_WRITE_SEQUENCER_288 0x3120
534#define WM8994_WRITE_SEQUENCER_289 0x3121
535#define WM8994_WRITE_SEQUENCER_290 0x3122
536#define WM8994_WRITE_SEQUENCER_291 0x3123
537#define WM8994_WRITE_SEQUENCER_292 0x3124
538#define WM8994_WRITE_SEQUENCER_293 0x3125
539#define WM8994_WRITE_SEQUENCER_294 0x3126
540#define WM8994_WRITE_SEQUENCER_295 0x3127
541#define WM8994_WRITE_SEQUENCER_296 0x3128
542#define WM8994_WRITE_SEQUENCER_297 0x3129
543#define WM8994_WRITE_SEQUENCER_298 0x312A
544#define WM8994_WRITE_SEQUENCER_299 0x312B
545#define WM8994_WRITE_SEQUENCER_300 0x312C
546#define WM8994_WRITE_SEQUENCER_301 0x312D
547#define WM8994_WRITE_SEQUENCER_302 0x312E
548#define WM8994_WRITE_SEQUENCER_303 0x312F
549#define WM8994_WRITE_SEQUENCER_304 0x3130
550#define WM8994_WRITE_SEQUENCER_305 0x3131
551#define WM8994_WRITE_SEQUENCER_306 0x3132
552#define WM8994_WRITE_SEQUENCER_307 0x3133
553#define WM8994_WRITE_SEQUENCER_308 0x3134
554#define WM8994_WRITE_SEQUENCER_309 0x3135
555#define WM8994_WRITE_SEQUENCER_310 0x3136
556#define WM8994_WRITE_SEQUENCER_311 0x3137
557#define WM8994_WRITE_SEQUENCER_312 0x3138
558#define WM8994_WRITE_SEQUENCER_313 0x3139
559#define WM8994_WRITE_SEQUENCER_314 0x313A
560#define WM8994_WRITE_SEQUENCER_315 0x313B
561#define WM8994_WRITE_SEQUENCER_316 0x313C
562#define WM8994_WRITE_SEQUENCER_317 0x313D
563#define WM8994_WRITE_SEQUENCER_318 0x313E
564#define WM8994_WRITE_SEQUENCER_319 0x313F
565#define WM8994_WRITE_SEQUENCER_320 0x3140
566#define WM8994_WRITE_SEQUENCER_321 0x3141
567#define WM8994_WRITE_SEQUENCER_322 0x3142
568#define WM8994_WRITE_SEQUENCER_323 0x3143
569#define WM8994_WRITE_SEQUENCER_324 0x3144
570#define WM8994_WRITE_SEQUENCER_325 0x3145
571#define WM8994_WRITE_SEQUENCER_326 0x3146
572#define WM8994_WRITE_SEQUENCER_327 0x3147
573#define WM8994_WRITE_SEQUENCER_328 0x3148
574#define WM8994_WRITE_SEQUENCER_329 0x3149
575#define WM8994_WRITE_SEQUENCER_330 0x314A
576#define WM8994_WRITE_SEQUENCER_331 0x314B
577#define WM8994_WRITE_SEQUENCER_332 0x314C
578#define WM8994_WRITE_SEQUENCER_333 0x314D
579#define WM8994_WRITE_SEQUENCER_334 0x314E
580#define WM8994_WRITE_SEQUENCER_335 0x314F
581#define WM8994_WRITE_SEQUENCER_336 0x3150
582#define WM8994_WRITE_SEQUENCER_337 0x3151
583#define WM8994_WRITE_SEQUENCER_338 0x3152
584#define WM8994_WRITE_SEQUENCER_339 0x3153
585#define WM8994_WRITE_SEQUENCER_340 0x3154
586#define WM8994_WRITE_SEQUENCER_341 0x3155
587#define WM8994_WRITE_SEQUENCER_342 0x3156
588#define WM8994_WRITE_SEQUENCER_343 0x3157
589#define WM8994_WRITE_SEQUENCER_344 0x3158
590#define WM8994_WRITE_SEQUENCER_345 0x3159
591#define WM8994_WRITE_SEQUENCER_346 0x315A
592#define WM8994_WRITE_SEQUENCER_347 0x315B
593#define WM8994_WRITE_SEQUENCER_348 0x315C
594#define WM8994_WRITE_SEQUENCER_349 0x315D
595#define WM8994_WRITE_SEQUENCER_350 0x315E
596#define WM8994_WRITE_SEQUENCER_351 0x315F
597#define WM8994_WRITE_SEQUENCER_352 0x3160
598#define WM8994_WRITE_SEQUENCER_353 0x3161
599#define WM8994_WRITE_SEQUENCER_354 0x3162
600#define WM8994_WRITE_SEQUENCER_355 0x3163
601#define WM8994_WRITE_SEQUENCER_356 0x3164
602#define WM8994_WRITE_SEQUENCER_357 0x3165
603#define WM8994_WRITE_SEQUENCER_358 0x3166
604#define WM8994_WRITE_SEQUENCER_359 0x3167
605#define WM8994_WRITE_SEQUENCER_360 0x3168
606#define WM8994_WRITE_SEQUENCER_361 0x3169
607#define WM8994_WRITE_SEQUENCER_362 0x316A
608#define WM8994_WRITE_SEQUENCER_363 0x316B
609#define WM8994_WRITE_SEQUENCER_364 0x316C
610#define WM8994_WRITE_SEQUENCER_365 0x316D
611#define WM8994_WRITE_SEQUENCER_366 0x316E
612#define WM8994_WRITE_SEQUENCER_367 0x316F
613#define WM8994_WRITE_SEQUENCER_368 0x3170
614#define WM8994_WRITE_SEQUENCER_369 0x3171
615#define WM8994_WRITE_SEQUENCER_370 0x3172
616#define WM8994_WRITE_SEQUENCER_371 0x3173
617#define WM8994_WRITE_SEQUENCER_372 0x3174
618#define WM8994_WRITE_SEQUENCER_373 0x3175
619#define WM8994_WRITE_SEQUENCER_374 0x3176
620#define WM8994_WRITE_SEQUENCER_375 0x3177
621#define WM8994_WRITE_SEQUENCER_376 0x3178
622#define WM8994_WRITE_SEQUENCER_377 0x3179
623#define WM8994_WRITE_SEQUENCER_378 0x317A
624#define WM8994_WRITE_SEQUENCER_379 0x317B
625#define WM8994_WRITE_SEQUENCER_380 0x317C
626#define WM8994_WRITE_SEQUENCER_381 0x317D
627#define WM8994_WRITE_SEQUENCER_382 0x317E
628#define WM8994_WRITE_SEQUENCER_383 0x317F
629#define WM8994_WRITE_SEQUENCER_384 0x3180
630#define WM8994_WRITE_SEQUENCER_385 0x3181
631#define WM8994_WRITE_SEQUENCER_386 0x3182
632#define WM8994_WRITE_SEQUENCER_387 0x3183
633#define WM8994_WRITE_SEQUENCER_388 0x3184
634#define WM8994_WRITE_SEQUENCER_389 0x3185
635#define WM8994_WRITE_SEQUENCER_390 0x3186
636#define WM8994_WRITE_SEQUENCER_391 0x3187
637#define WM8994_WRITE_SEQUENCER_392 0x3188
638#define WM8994_WRITE_SEQUENCER_393 0x3189
639#define WM8994_WRITE_SEQUENCER_394 0x318A
640#define WM8994_WRITE_SEQUENCER_395 0x318B
641#define WM8994_WRITE_SEQUENCER_396 0x318C
642#define WM8994_WRITE_SEQUENCER_397 0x318D
643#define WM8994_WRITE_SEQUENCER_398 0x318E
644#define WM8994_WRITE_SEQUENCER_399 0x318F
645#define WM8994_WRITE_SEQUENCER_400 0x3190
646#define WM8994_WRITE_SEQUENCER_401 0x3191
647#define WM8994_WRITE_SEQUENCER_402 0x3192
648#define WM8994_WRITE_SEQUENCER_403 0x3193
649#define WM8994_WRITE_SEQUENCER_404 0x3194
650#define WM8994_WRITE_SEQUENCER_405 0x3195
651#define WM8994_WRITE_SEQUENCER_406 0x3196
652#define WM8994_WRITE_SEQUENCER_407 0x3197
653#define WM8994_WRITE_SEQUENCER_408 0x3198
654#define WM8994_WRITE_SEQUENCER_409 0x3199
655#define WM8994_WRITE_SEQUENCER_410 0x319A
656#define WM8994_WRITE_SEQUENCER_411 0x319B
657#define WM8994_WRITE_SEQUENCER_412 0x319C
658#define WM8994_WRITE_SEQUENCER_413 0x319D
659#define WM8994_WRITE_SEQUENCER_414 0x319E
660#define WM8994_WRITE_SEQUENCER_415 0x319F
661#define WM8994_WRITE_SEQUENCER_416 0x31A0
662#define WM8994_WRITE_SEQUENCER_417 0x31A1
663#define WM8994_WRITE_SEQUENCER_418 0x31A2
664#define WM8994_WRITE_SEQUENCER_419 0x31A3
665#define WM8994_WRITE_SEQUENCER_420 0x31A4
666#define WM8994_WRITE_SEQUENCER_421 0x31A5
667#define WM8994_WRITE_SEQUENCER_422 0x31A6
668#define WM8994_WRITE_SEQUENCER_423 0x31A7
669#define WM8994_WRITE_SEQUENCER_424 0x31A8
670#define WM8994_WRITE_SEQUENCER_425 0x31A9
671#define WM8994_WRITE_SEQUENCER_426 0x31AA
672#define WM8994_WRITE_SEQUENCER_427 0x31AB
673#define WM8994_WRITE_SEQUENCER_428 0x31AC
674#define WM8994_WRITE_SEQUENCER_429 0x31AD
675#define WM8994_WRITE_SEQUENCER_430 0x31AE
676#define WM8994_WRITE_SEQUENCER_431 0x31AF
677#define WM8994_WRITE_SEQUENCER_432 0x31B0
678#define WM8994_WRITE_SEQUENCER_433 0x31B1
679#define WM8994_WRITE_SEQUENCER_434 0x31B2
680#define WM8994_WRITE_SEQUENCER_435 0x31B3
681#define WM8994_WRITE_SEQUENCER_436 0x31B4
682#define WM8994_WRITE_SEQUENCER_437 0x31B5
683#define WM8994_WRITE_SEQUENCER_438 0x31B6
684#define WM8994_WRITE_SEQUENCER_439 0x31B7
685#define WM8994_WRITE_SEQUENCER_440 0x31B8
686#define WM8994_WRITE_SEQUENCER_441 0x31B9
687#define WM8994_WRITE_SEQUENCER_442 0x31BA
688#define WM8994_WRITE_SEQUENCER_443 0x31BB
689#define WM8994_WRITE_SEQUENCER_444 0x31BC
690#define WM8994_WRITE_SEQUENCER_445 0x31BD
691#define WM8994_WRITE_SEQUENCER_446 0x31BE
692#define WM8994_WRITE_SEQUENCER_447 0x31BF
693#define WM8994_WRITE_SEQUENCER_448 0x31C0
694#define WM8994_WRITE_SEQUENCER_449 0x31C1
695#define WM8994_WRITE_SEQUENCER_450 0x31C2
696#define WM8994_WRITE_SEQUENCER_451 0x31C3
697#define WM8994_WRITE_SEQUENCER_452 0x31C4
698#define WM8994_WRITE_SEQUENCER_453 0x31C5
699#define WM8994_WRITE_SEQUENCER_454 0x31C6
700#define WM8994_WRITE_SEQUENCER_455 0x31C7
701#define WM8994_WRITE_SEQUENCER_456 0x31C8
702#define WM8994_WRITE_SEQUENCER_457 0x31C9
703#define WM8994_WRITE_SEQUENCER_458 0x31CA
704#define WM8994_WRITE_SEQUENCER_459 0x31CB
705#define WM8994_WRITE_SEQUENCER_460 0x31CC
706#define WM8994_WRITE_SEQUENCER_461 0x31CD
707#define WM8994_WRITE_SEQUENCER_462 0x31CE
708#define WM8994_WRITE_SEQUENCER_463 0x31CF
709#define WM8994_WRITE_SEQUENCER_464 0x31D0
710#define WM8994_WRITE_SEQUENCER_465 0x31D1
711#define WM8994_WRITE_SEQUENCER_466 0x31D2
712#define WM8994_WRITE_SEQUENCER_467 0x31D3
713#define WM8994_WRITE_SEQUENCER_468 0x31D4
714#define WM8994_WRITE_SEQUENCER_469 0x31D5
715#define WM8994_WRITE_SEQUENCER_470 0x31D6
716#define WM8994_WRITE_SEQUENCER_471 0x31D7
717#define WM8994_WRITE_SEQUENCER_472 0x31D8
718#define WM8994_WRITE_SEQUENCER_473 0x31D9
719#define WM8994_WRITE_SEQUENCER_474 0x31DA
720#define WM8994_WRITE_SEQUENCER_475 0x31DB
721#define WM8994_WRITE_SEQUENCER_476 0x31DC
722#define WM8994_WRITE_SEQUENCER_477 0x31DD
723#define WM8994_WRITE_SEQUENCER_478 0x31DE
724#define WM8994_WRITE_SEQUENCER_479 0x31DF
725#define WM8994_WRITE_SEQUENCER_480 0x31E0
726#define WM8994_WRITE_SEQUENCER_481 0x31E1
727#define WM8994_WRITE_SEQUENCER_482 0x31E2
728#define WM8994_WRITE_SEQUENCER_483 0x31E3
729#define WM8994_WRITE_SEQUENCER_484 0x31E4
730#define WM8994_WRITE_SEQUENCER_485 0x31E5
731#define WM8994_WRITE_SEQUENCER_486 0x31E6
732#define WM8994_WRITE_SEQUENCER_487 0x31E7
733#define WM8994_WRITE_SEQUENCER_488 0x31E8
734#define WM8994_WRITE_SEQUENCER_489 0x31E9
735#define WM8994_WRITE_SEQUENCER_490 0x31EA
736#define WM8994_WRITE_SEQUENCER_491 0x31EB
737#define WM8994_WRITE_SEQUENCER_492 0x31EC
738#define WM8994_WRITE_SEQUENCER_493 0x31ED
739#define WM8994_WRITE_SEQUENCER_494 0x31EE
740#define WM8994_WRITE_SEQUENCER_495 0x31EF
741#define WM8994_WRITE_SEQUENCER_496 0x31F0
742#define WM8994_WRITE_SEQUENCER_497 0x31F1
743#define WM8994_WRITE_SEQUENCER_498 0x31F2
744#define WM8994_WRITE_SEQUENCER_499 0x31F3
745#define WM8994_WRITE_SEQUENCER_500 0x31F4
746#define WM8994_WRITE_SEQUENCER_501 0x31F5
747#define WM8994_WRITE_SEQUENCER_502 0x31F6
748#define WM8994_WRITE_SEQUENCER_503 0x31F7
749#define WM8994_WRITE_SEQUENCER_504 0x31F8
750#define WM8994_WRITE_SEQUENCER_505 0x31F9
751#define WM8994_WRITE_SEQUENCER_506 0x31FA
752#define WM8994_WRITE_SEQUENCER_507 0x31FB
753#define WM8994_WRITE_SEQUENCER_508 0x31FC
754#define WM8994_WRITE_SEQUENCER_509 0x31FD
755#define WM8994_WRITE_SEQUENCER_510 0x31FE
756#define WM8994_WRITE_SEQUENCER_511 0x31FF
757
758#define WM8994_REGISTER_COUNT 736
759#define WM8994_MAX_REGISTER 0x31FF
760#define WM8994_MAX_CACHED_REGISTER 0x749
761
762/*
763 * Field Definitions.
764 */
765
766/*
767 * R0 (0x00) - Software Reset
768 */
769#define WM8994_SW_RESET_MASK 0xFFFF /* SW_RESET - [15:0] */
770#define WM8994_SW_RESET_SHIFT 0 /* SW_RESET - [15:0] */
771#define WM8994_SW_RESET_WIDTH 16 /* SW_RESET - [15:0] */
772
773/*
774 * R1 (0x01) - Power Management (1)
775 */
776#define WM8994_SPKOUTR_ENA 0x2000 /* SPKOUTR_ENA */
777#define WM8994_SPKOUTR_ENA_MASK 0x2000 /* SPKOUTR_ENA */
778#define WM8994_SPKOUTR_ENA_SHIFT 13 /* SPKOUTR_ENA */
779#define WM8994_SPKOUTR_ENA_WIDTH 1 /* SPKOUTR_ENA */
780#define WM8994_SPKOUTL_ENA 0x1000 /* SPKOUTL_ENA */
781#define WM8994_SPKOUTL_ENA_MASK 0x1000 /* SPKOUTL_ENA */
782#define WM8994_SPKOUTL_ENA_SHIFT 12 /* SPKOUTL_ENA */
783#define WM8994_SPKOUTL_ENA_WIDTH 1 /* SPKOUTL_ENA */
784#define WM8994_HPOUT2_ENA 0x0800 /* HPOUT2_ENA */
785#define WM8994_HPOUT2_ENA_MASK 0x0800 /* HPOUT2_ENA */
786#define WM8994_HPOUT2_ENA_SHIFT 11 /* HPOUT2_ENA */
787#define WM8994_HPOUT2_ENA_WIDTH 1 /* HPOUT2_ENA */
788#define WM8994_HPOUT1L_ENA 0x0200 /* HPOUT1L_ENA */
789#define WM8994_HPOUT1L_ENA_MASK 0x0200 /* HPOUT1L_ENA */
790#define WM8994_HPOUT1L_ENA_SHIFT 9 /* HPOUT1L_ENA */
791#define WM8994_HPOUT1L_ENA_WIDTH 1 /* HPOUT1L_ENA */
792#define WM8994_HPOUT1R_ENA 0x0100 /* HPOUT1R_ENA */
793#define WM8994_HPOUT1R_ENA_MASK 0x0100 /* HPOUT1R_ENA */
794#define WM8994_HPOUT1R_ENA_SHIFT 8 /* HPOUT1R_ENA */
795#define WM8994_HPOUT1R_ENA_WIDTH 1 /* HPOUT1R_ENA */
796#define WM8994_MICB2_ENA 0x0020 /* MICB2_ENA */
797#define WM8994_MICB2_ENA_MASK 0x0020 /* MICB2_ENA */
798#define WM8994_MICB2_ENA_SHIFT 5 /* MICB2_ENA */
799#define WM8994_MICB2_ENA_WIDTH 1 /* MICB2_ENA */
800#define WM8994_MICB1_ENA 0x0010 /* MICB1_ENA */
801#define WM8994_MICB1_ENA_MASK 0x0010 /* MICB1_ENA */
802#define WM8994_MICB1_ENA_SHIFT 4 /* MICB1_ENA */
803#define WM8994_MICB1_ENA_WIDTH 1 /* MICB1_ENA */
804#define WM8994_VMID_SEL_MASK 0x0006 /* VMID_SEL - [2:1] */
805#define WM8994_VMID_SEL_SHIFT 1 /* VMID_SEL - [2:1] */
806#define WM8994_VMID_SEL_WIDTH 2 /* VMID_SEL - [2:1] */
807#define WM8994_BIAS_ENA 0x0001 /* BIAS_ENA */
808#define WM8994_BIAS_ENA_MASK 0x0001 /* BIAS_ENA */
809#define WM8994_BIAS_ENA_SHIFT 0 /* BIAS_ENA */
810#define WM8994_BIAS_ENA_WIDTH 1 /* BIAS_ENA */
811
812/*
813 * R2 (0x02) - Power Management (2)
814 */
815#define WM8994_TSHUT_ENA 0x4000 /* TSHUT_ENA */
816#define WM8994_TSHUT_ENA_MASK 0x4000 /* TSHUT_ENA */
817#define WM8994_TSHUT_ENA_SHIFT 14 /* TSHUT_ENA */
818#define WM8994_TSHUT_ENA_WIDTH 1 /* TSHUT_ENA */
819#define WM8994_TSHUT_OPDIS 0x2000 /* TSHUT_OPDIS */
820#define WM8994_TSHUT_OPDIS_MASK 0x2000 /* TSHUT_OPDIS */
821#define WM8994_TSHUT_OPDIS_SHIFT 13 /* TSHUT_OPDIS */
822#define WM8994_TSHUT_OPDIS_WIDTH 1 /* TSHUT_OPDIS */
823#define WM8994_OPCLK_ENA 0x0800 /* OPCLK_ENA */
824#define WM8994_OPCLK_ENA_MASK 0x0800 /* OPCLK_ENA */
825#define WM8994_OPCLK_ENA_SHIFT 11 /* OPCLK_ENA */
826#define WM8994_OPCLK_ENA_WIDTH 1 /* OPCLK_ENA */
827#define WM8994_MIXINL_ENA 0x0200 /* MIXINL_ENA */
828#define WM8994_MIXINL_ENA_MASK 0x0200 /* MIXINL_ENA */
829#define WM8994_MIXINL_ENA_SHIFT 9 /* MIXINL_ENA */
830#define WM8994_MIXINL_ENA_WIDTH 1 /* MIXINL_ENA */
831#define WM8994_MIXINR_ENA 0x0100 /* MIXINR_ENA */
832#define WM8994_MIXINR_ENA_MASK 0x0100 /* MIXINR_ENA */
833#define WM8994_MIXINR_ENA_SHIFT 8 /* MIXINR_ENA */
834#define WM8994_MIXINR_ENA_WIDTH 1 /* MIXINR_ENA */
835#define WM8994_IN2L_ENA 0x0080 /* IN2L_ENA */
836#define WM8994_IN2L_ENA_MASK 0x0080 /* IN2L_ENA */
837#define WM8994_IN2L_ENA_SHIFT 7 /* IN2L_ENA */
838#define WM8994_IN2L_ENA_WIDTH 1 /* IN2L_ENA */
839#define WM8994_IN1L_ENA 0x0040 /* IN1L_ENA */
840#define WM8994_IN1L_ENA_MASK 0x0040 /* IN1L_ENA */
841#define WM8994_IN1L_ENA_SHIFT 6 /* IN1L_ENA */
842#define WM8994_IN1L_ENA_WIDTH 1 /* IN1L_ENA */
843#define WM8994_IN2R_ENA 0x0020 /* IN2R_ENA */
844#define WM8994_IN2R_ENA_MASK 0x0020 /* IN2R_ENA */
845#define WM8994_IN2R_ENA_SHIFT 5 /* IN2R_ENA */
846#define WM8994_IN2R_ENA_WIDTH 1 /* IN2R_ENA */
847#define WM8994_IN1R_ENA 0x0010 /* IN1R_ENA */
848#define WM8994_IN1R_ENA_MASK 0x0010 /* IN1R_ENA */
849#define WM8994_IN1R_ENA_SHIFT 4 /* IN1R_ENA */
850#define WM8994_IN1R_ENA_WIDTH 1 /* IN1R_ENA */
851
852/*
853 * R3 (0x03) - Power Management (3)
854 */
855#define WM8994_LINEOUT1N_ENA 0x2000 /* LINEOUT1N_ENA */
856#define WM8994_LINEOUT1N_ENA_MASK 0x2000 /* LINEOUT1N_ENA */
857#define WM8994_LINEOUT1N_ENA_SHIFT 13 /* LINEOUT1N_ENA */
858#define WM8994_LINEOUT1N_ENA_WIDTH 1 /* LINEOUT1N_ENA */
859#define WM8994_LINEOUT1P_ENA 0x1000 /* LINEOUT1P_ENA */
860#define WM8994_LINEOUT1P_ENA_MASK 0x1000 /* LINEOUT1P_ENA */
861#define WM8994_LINEOUT1P_ENA_SHIFT 12 /* LINEOUT1P_ENA */
862#define WM8994_LINEOUT1P_ENA_WIDTH 1 /* LINEOUT1P_ENA */
863#define WM8994_LINEOUT2N_ENA 0x0800 /* LINEOUT2N_ENA */
864#define WM8994_LINEOUT2N_ENA_MASK 0x0800 /* LINEOUT2N_ENA */
865#define WM8994_LINEOUT2N_ENA_SHIFT 11 /* LINEOUT2N_ENA */
866#define WM8994_LINEOUT2N_ENA_WIDTH 1 /* LINEOUT2N_ENA */
867#define WM8994_LINEOUT2P_ENA 0x0400 /* LINEOUT2P_ENA */
868#define WM8994_LINEOUT2P_ENA_MASK 0x0400 /* LINEOUT2P_ENA */
869#define WM8994_LINEOUT2P_ENA_SHIFT 10 /* LINEOUT2P_ENA */
870#define WM8994_LINEOUT2P_ENA_WIDTH 1 /* LINEOUT2P_ENA */
871#define WM8994_SPKRVOL_ENA 0x0200 /* SPKRVOL_ENA */
872#define WM8994_SPKRVOL_ENA_MASK 0x0200 /* SPKRVOL_ENA */
873#define WM8994_SPKRVOL_ENA_SHIFT 9 /* SPKRVOL_ENA */
874#define WM8994_SPKRVOL_ENA_WIDTH 1 /* SPKRVOL_ENA */
875#define WM8994_SPKLVOL_ENA 0x0100 /* SPKLVOL_ENA */
876#define WM8994_SPKLVOL_ENA_MASK 0x0100 /* SPKLVOL_ENA */
877#define WM8994_SPKLVOL_ENA_SHIFT 8 /* SPKLVOL_ENA */
878#define WM8994_SPKLVOL_ENA_WIDTH 1 /* SPKLVOL_ENA */
879#define WM8994_MIXOUTLVOL_ENA 0x0080 /* MIXOUTLVOL_ENA */
880#define WM8994_MIXOUTLVOL_ENA_MASK 0x0080 /* MIXOUTLVOL_ENA */
881#define WM8994_MIXOUTLVOL_ENA_SHIFT 7 /* MIXOUTLVOL_ENA */
882#define WM8994_MIXOUTLVOL_ENA_WIDTH 1 /* MIXOUTLVOL_ENA */
883#define WM8994_MIXOUTRVOL_ENA 0x0040 /* MIXOUTRVOL_ENA */
884#define WM8994_MIXOUTRVOL_ENA_MASK 0x0040 /* MIXOUTRVOL_ENA */
885#define WM8994_MIXOUTRVOL_ENA_SHIFT 6 /* MIXOUTRVOL_ENA */
886#define WM8994_MIXOUTRVOL_ENA_WIDTH 1 /* MIXOUTRVOL_ENA */
887#define WM8994_MIXOUTL_ENA 0x0020 /* MIXOUTL_ENA */
888#define WM8994_MIXOUTL_ENA_MASK 0x0020 /* MIXOUTL_ENA */
889#define WM8994_MIXOUTL_ENA_SHIFT 5 /* MIXOUTL_ENA */
890#define WM8994_MIXOUTL_ENA_WIDTH 1 /* MIXOUTL_ENA */
891#define WM8994_MIXOUTR_ENA 0x0010 /* MIXOUTR_ENA */
892#define WM8994_MIXOUTR_ENA_MASK 0x0010 /* MIXOUTR_ENA */
893#define WM8994_MIXOUTR_ENA_SHIFT 4 /* MIXOUTR_ENA */
894#define WM8994_MIXOUTR_ENA_WIDTH 1 /* MIXOUTR_ENA */
895
896/*
897 * R4 (0x04) - Power Management (4)
898 */
899#define WM8994_AIF2ADCL_ENA 0x2000 /* AIF2ADCL_ENA */
900#define WM8994_AIF2ADCL_ENA_MASK 0x2000 /* AIF2ADCL_ENA */
901#define WM8994_AIF2ADCL_ENA_SHIFT 13 /* AIF2ADCL_ENA */
902#define WM8994_AIF2ADCL_ENA_WIDTH 1 /* AIF2ADCL_ENA */
903#define WM8994_AIF2ADCR_ENA 0x1000 /* AIF2ADCR_ENA */
904#define WM8994_AIF2ADCR_ENA_MASK 0x1000 /* AIF2ADCR_ENA */
905#define WM8994_AIF2ADCR_ENA_SHIFT 12 /* AIF2ADCR_ENA */
906#define WM8994_AIF2ADCR_ENA_WIDTH 1 /* AIF2ADCR_ENA */
907#define WM8994_AIF1ADC2L_ENA 0x0800 /* AIF1ADC2L_ENA */
908#define WM8994_AIF1ADC2L_ENA_MASK 0x0800 /* AIF1ADC2L_ENA */
909#define WM8994_AIF1ADC2L_ENA_SHIFT 11 /* AIF1ADC2L_ENA */
910#define WM8994_AIF1ADC2L_ENA_WIDTH 1 /* AIF1ADC2L_ENA */
911#define WM8994_AIF1ADC2R_ENA 0x0400 /* AIF1ADC2R_ENA */
912#define WM8994_AIF1ADC2R_ENA_MASK 0x0400 /* AIF1ADC2R_ENA */
913#define WM8994_AIF1ADC2R_ENA_SHIFT 10 /* AIF1ADC2R_ENA */
914#define WM8994_AIF1ADC2R_ENA_WIDTH 1 /* AIF1ADC2R_ENA */
915#define WM8994_AIF1ADC1L_ENA 0x0200 /* AIF1ADC1L_ENA */
916#define WM8994_AIF1ADC1L_ENA_MASK 0x0200 /* AIF1ADC1L_ENA */
917#define WM8994_AIF1ADC1L_ENA_SHIFT 9 /* AIF1ADC1L_ENA */
918#define WM8994_AIF1ADC1L_ENA_WIDTH 1 /* AIF1ADC1L_ENA */
919#define WM8994_AIF1ADC1R_ENA 0x0100 /* AIF1ADC1R_ENA */
920#define WM8994_AIF1ADC1R_ENA_MASK 0x0100 /* AIF1ADC1R_ENA */
921#define WM8994_AIF1ADC1R_ENA_SHIFT 8 /* AIF1ADC1R_ENA */
922#define WM8994_AIF1ADC1R_ENA_WIDTH 1 /* AIF1ADC1R_ENA */
923#define WM8994_DMIC2L_ENA 0x0020 /* DMIC2L_ENA */
924#define WM8994_DMIC2L_ENA_MASK 0x0020 /* DMIC2L_ENA */
925#define WM8994_DMIC2L_ENA_SHIFT 5 /* DMIC2L_ENA */
926#define WM8994_DMIC2L_ENA_WIDTH 1 /* DMIC2L_ENA */
927#define WM8994_DMIC2R_ENA 0x0010 /* DMIC2R_ENA */
928#define WM8994_DMIC2R_ENA_MASK 0x0010 /* DMIC2R_ENA */
929#define WM8994_DMIC2R_ENA_SHIFT 4 /* DMIC2R_ENA */
930#define WM8994_DMIC2R_ENA_WIDTH 1 /* DMIC2R_ENA */
931#define WM8994_DMIC1L_ENA 0x0008 /* DMIC1L_ENA */
932#define WM8994_DMIC1L_ENA_MASK 0x0008 /* DMIC1L_ENA */
933#define WM8994_DMIC1L_ENA_SHIFT 3 /* DMIC1L_ENA */
934#define WM8994_DMIC1L_ENA_WIDTH 1 /* DMIC1L_ENA */
935#define WM8994_DMIC1R_ENA 0x0004 /* DMIC1R_ENA */
936#define WM8994_DMIC1R_ENA_MASK 0x0004 /* DMIC1R_ENA */
937#define WM8994_DMIC1R_ENA_SHIFT 2 /* DMIC1R_ENA */
938#define WM8994_DMIC1R_ENA_WIDTH 1 /* DMIC1R_ENA */
939#define WM8994_ADCL_ENA 0x0002 /* ADCL_ENA */
940#define WM8994_ADCL_ENA_MASK 0x0002 /* ADCL_ENA */
941#define WM8994_ADCL_ENA_SHIFT 1 /* ADCL_ENA */
942#define WM8994_ADCL_ENA_WIDTH 1 /* ADCL_ENA */
943#define WM8994_ADCR_ENA 0x0001 /* ADCR_ENA */
944#define WM8994_ADCR_ENA_MASK 0x0001 /* ADCR_ENA */
945#define WM8994_ADCR_ENA_SHIFT 0 /* ADCR_ENA */
946#define WM8994_ADCR_ENA_WIDTH 1 /* ADCR_ENA */
947
948/*
949 * R5 (0x05) - Power Management (5)
950 */
951#define WM8994_AIF2DACL_ENA 0x2000 /* AIF2DACL_ENA */
952#define WM8994_AIF2DACL_ENA_MASK 0x2000 /* AIF2DACL_ENA */
953#define WM8994_AIF2DACL_ENA_SHIFT 13 /* AIF2DACL_ENA */
954#define WM8994_AIF2DACL_ENA_WIDTH 1 /* AIF2DACL_ENA */
955#define WM8994_AIF2DACR_ENA 0x1000 /* AIF2DACR_ENA */
956#define WM8994_AIF2DACR_ENA_MASK 0x1000 /* AIF2DACR_ENA */
957#define WM8994_AIF2DACR_ENA_SHIFT 12 /* AIF2DACR_ENA */
958#define WM8994_AIF2DACR_ENA_WIDTH 1 /* AIF2DACR_ENA */
959#define WM8994_AIF1DAC2L_ENA 0x0800 /* AIF1DAC2L_ENA */
960#define WM8994_AIF1DAC2L_ENA_MASK 0x0800 /* AIF1DAC2L_ENA */
961#define WM8994_AIF1DAC2L_ENA_SHIFT 11 /* AIF1DAC2L_ENA */
962#define WM8994_AIF1DAC2L_ENA_WIDTH 1 /* AIF1DAC2L_ENA */
963#define WM8994_AIF1DAC2R_ENA 0x0400 /* AIF1DAC2R_ENA */
964#define WM8994_AIF1DAC2R_ENA_MASK 0x0400 /* AIF1DAC2R_ENA */
965#define WM8994_AIF1DAC2R_ENA_SHIFT 10 /* AIF1DAC2R_ENA */
966#define WM8994_AIF1DAC2R_ENA_WIDTH 1 /* AIF1DAC2R_ENA */
967#define WM8994_AIF1DAC1L_ENA 0x0200 /* AIF1DAC1L_ENA */
968#define WM8994_AIF1DAC1L_ENA_MASK 0x0200 /* AIF1DAC1L_ENA */
969#define WM8994_AIF1DAC1L_ENA_SHIFT 9 /* AIF1DAC1L_ENA */
970#define WM8994_AIF1DAC1L_ENA_WIDTH 1 /* AIF1DAC1L_ENA */
971#define WM8994_AIF1DAC1R_ENA 0x0100 /* AIF1DAC1R_ENA */
972#define WM8994_AIF1DAC1R_ENA_MASK 0x0100 /* AIF1DAC1R_ENA */
973#define WM8994_AIF1DAC1R_ENA_SHIFT 8 /* AIF1DAC1R_ENA */
974#define WM8994_AIF1DAC1R_ENA_WIDTH 1 /* AIF1DAC1R_ENA */
975#define WM8994_DAC2L_ENA 0x0008 /* DAC2L_ENA */
976#define WM8994_DAC2L_ENA_MASK 0x0008 /* DAC2L_ENA */
977#define WM8994_DAC2L_ENA_SHIFT 3 /* DAC2L_ENA */
978#define WM8994_DAC2L_ENA_WIDTH 1 /* DAC2L_ENA */
979#define WM8994_DAC2R_ENA 0x0004 /* DAC2R_ENA */
980#define WM8994_DAC2R_ENA_MASK 0x0004 /* DAC2R_ENA */
981#define WM8994_DAC2R_ENA_SHIFT 2 /* DAC2R_ENA */
982#define WM8994_DAC2R_ENA_WIDTH 1 /* DAC2R_ENA */
983#define WM8994_DAC1L_ENA 0x0002 /* DAC1L_ENA */
984#define WM8994_DAC1L_ENA_MASK 0x0002 /* DAC1L_ENA */
985#define WM8994_DAC1L_ENA_SHIFT 1 /* DAC1L_ENA */
986#define WM8994_DAC1L_ENA_WIDTH 1 /* DAC1L_ENA */
987#define WM8994_DAC1R_ENA 0x0001 /* DAC1R_ENA */
988#define WM8994_DAC1R_ENA_MASK 0x0001 /* DAC1R_ENA */
989#define WM8994_DAC1R_ENA_SHIFT 0 /* DAC1R_ENA */
990#define WM8994_DAC1R_ENA_WIDTH 1 /* DAC1R_ENA */
991
992/*
993 * R6 (0x06) - Power Management (6)
994 */
995#define WM8994_AIF3_TRI 0x0020 /* AIF3_TRI */
996#define WM8994_AIF3_TRI_MASK 0x0020 /* AIF3_TRI */
997#define WM8994_AIF3_TRI_SHIFT 5 /* AIF3_TRI */
998#define WM8994_AIF3_TRI_WIDTH 1 /* AIF3_TRI */
999#define WM8994_AIF3_ADCDAT_SRC_MASK 0x0018 /* AIF3_ADCDAT_SRC - [4:3] */
1000#define WM8994_AIF3_ADCDAT_SRC_SHIFT 3 /* AIF3_ADCDAT_SRC - [4:3] */
1001#define WM8994_AIF3_ADCDAT_SRC_WIDTH 2 /* AIF3_ADCDAT_SRC - [4:3] */
1002#define WM8994_AIF2_ADCDAT_SRC 0x0004 /* AIF2_ADCDAT_SRC */
1003#define WM8994_AIF2_ADCDAT_SRC_MASK 0x0004 /* AIF2_ADCDAT_SRC */
1004#define WM8994_AIF2_ADCDAT_SRC_SHIFT 2 /* AIF2_ADCDAT_SRC */
1005#define WM8994_AIF2_ADCDAT_SRC_WIDTH 1 /* AIF2_ADCDAT_SRC */
1006#define WM8994_AIF2_DACDAT_SRC 0x0002 /* AIF2_DACDAT_SRC */
1007#define WM8994_AIF2_DACDAT_SRC_MASK 0x0002 /* AIF2_DACDAT_SRC */
1008#define WM8994_AIF2_DACDAT_SRC_SHIFT 1 /* AIF2_DACDAT_SRC */
1009#define WM8994_AIF2_DACDAT_SRC_WIDTH 1 /* AIF2_DACDAT_SRC */
1010#define WM8994_AIF1_DACDAT_SRC 0x0001 /* AIF1_DACDAT_SRC */
1011#define WM8994_AIF1_DACDAT_SRC_MASK 0x0001 /* AIF1_DACDAT_SRC */
1012#define WM8994_AIF1_DACDAT_SRC_SHIFT 0 /* AIF1_DACDAT_SRC */
1013#define WM8994_AIF1_DACDAT_SRC_WIDTH 1 /* AIF1_DACDAT_SRC */
1014
1015/*
1016 * R21 (0x15) - Input Mixer (1)
1017 */
1018#define WM8994_IN1RP_MIXINR_BOOST 0x0100 /* IN1RP_MIXINR_BOOST */
1019#define WM8994_IN1RP_MIXINR_BOOST_MASK 0x0100 /* IN1RP_MIXINR_BOOST */
1020#define WM8994_IN1RP_MIXINR_BOOST_SHIFT 8 /* IN1RP_MIXINR_BOOST */
1021#define WM8994_IN1RP_MIXINR_BOOST_WIDTH 1 /* IN1RP_MIXINR_BOOST */
1022#define WM8994_IN1LP_MIXINL_BOOST 0x0080 /* IN1LP_MIXINL_BOOST */
1023#define WM8994_IN1LP_MIXINL_BOOST_MASK 0x0080 /* IN1LP_MIXINL_BOOST */
1024#define WM8994_IN1LP_MIXINL_BOOST_SHIFT 7 /* IN1LP_MIXINL_BOOST */
1025#define WM8994_IN1LP_MIXINL_BOOST_WIDTH 1 /* IN1LP_MIXINL_BOOST */
1026#define WM8994_INPUTS_CLAMP 0x0040 /* INPUTS_CLAMP */
1027#define WM8994_INPUTS_CLAMP_MASK 0x0040 /* INPUTS_CLAMP */
1028#define WM8994_INPUTS_CLAMP_SHIFT 6 /* INPUTS_CLAMP */
1029#define WM8994_INPUTS_CLAMP_WIDTH 1 /* INPUTS_CLAMP */
1030
1031/*
1032 * R24 (0x18) - Left Line Input 1&2 Volume
1033 */
1034#define WM8994_IN1_VU 0x0100 /* IN1_VU */
1035#define WM8994_IN1_VU_MASK 0x0100 /* IN1_VU */
1036#define WM8994_IN1_VU_SHIFT 8 /* IN1_VU */
1037#define WM8994_IN1_VU_WIDTH 1 /* IN1_VU */
1038#define WM8994_IN1L_MUTE 0x0080 /* IN1L_MUTE */
1039#define WM8994_IN1L_MUTE_MASK 0x0080 /* IN1L_MUTE */
1040#define WM8994_IN1L_MUTE_SHIFT 7 /* IN1L_MUTE */
1041#define WM8994_IN1L_MUTE_WIDTH 1 /* IN1L_MUTE */
1042#define WM8994_IN1L_ZC 0x0040 /* IN1L_ZC */
1043#define WM8994_IN1L_ZC_MASK 0x0040 /* IN1L_ZC */
1044#define WM8994_IN1L_ZC_SHIFT 6 /* IN1L_ZC */
1045#define WM8994_IN1L_ZC_WIDTH 1 /* IN1L_ZC */
1046#define WM8994_IN1L_VOL_MASK 0x001F /* IN1L_VOL - [4:0] */
1047#define WM8994_IN1L_VOL_SHIFT 0 /* IN1L_VOL - [4:0] */
1048#define WM8994_IN1L_VOL_WIDTH 5 /* IN1L_VOL - [4:0] */
1049
1050/*
1051 * R25 (0x19) - Left Line Input 3&4 Volume
1052 */
1053#define WM8994_IN2_VU 0x0100 /* IN2_VU */
1054#define WM8994_IN2_VU_MASK 0x0100 /* IN2_VU */
1055#define WM8994_IN2_VU_SHIFT 8 /* IN2_VU */
1056#define WM8994_IN2_VU_WIDTH 1 /* IN2_VU */
1057#define WM8994_IN2L_MUTE 0x0080 /* IN2L_MUTE */
1058#define WM8994_IN2L_MUTE_MASK 0x0080 /* IN2L_MUTE */
1059#define WM8994_IN2L_MUTE_SHIFT 7 /* IN2L_MUTE */
1060#define WM8994_IN2L_MUTE_WIDTH 1 /* IN2L_MUTE */
1061#define WM8994_IN2L_ZC 0x0040 /* IN2L_ZC */
1062#define WM8994_IN2L_ZC_MASK 0x0040 /* IN2L_ZC */
1063#define WM8994_IN2L_ZC_SHIFT 6 /* IN2L_ZC */
1064#define WM8994_IN2L_ZC_WIDTH 1 /* IN2L_ZC */
1065#define WM8994_IN2L_VOL_MASK 0x001F /* IN2L_VOL - [4:0] */
1066#define WM8994_IN2L_VOL_SHIFT 0 /* IN2L_VOL - [4:0] */
1067#define WM8994_IN2L_VOL_WIDTH 5 /* IN2L_VOL - [4:0] */
1068
1069/*
1070 * R26 (0x1A) - Right Line Input 1&2 Volume
1071 */
1072#define WM8994_IN1_VU 0x0100 /* IN1_VU */
1073#define WM8994_IN1_VU_MASK 0x0100 /* IN1_VU */
1074#define WM8994_IN1_VU_SHIFT 8 /* IN1_VU */
1075#define WM8994_IN1_VU_WIDTH 1 /* IN1_VU */
1076#define WM8994_IN1R_MUTE 0x0080 /* IN1R_MUTE */
1077#define WM8994_IN1R_MUTE_MASK 0x0080 /* IN1R_MUTE */
1078#define WM8994_IN1R_MUTE_SHIFT 7 /* IN1R_MUTE */
1079#define WM8994_IN1R_MUTE_WIDTH 1 /* IN1R_MUTE */
1080#define WM8994_IN1R_ZC 0x0040 /* IN1R_ZC */
1081#define WM8994_IN1R_ZC_MASK 0x0040 /* IN1R_ZC */
1082#define WM8994_IN1R_ZC_SHIFT 6 /* IN1R_ZC */
1083#define WM8994_IN1R_ZC_WIDTH 1 /* IN1R_ZC */
1084#define WM8994_IN1R_VOL_MASK 0x001F /* IN1R_VOL - [4:0] */
1085#define WM8994_IN1R_VOL_SHIFT 0 /* IN1R_VOL - [4:0] */
1086#define WM8994_IN1R_VOL_WIDTH 5 /* IN1R_VOL - [4:0] */
1087
1088/*
1089 * R27 (0x1B) - Right Line Input 3&4 Volume
1090 */
1091#define WM8994_IN2_VU 0x0100 /* IN2_VU */
1092#define WM8994_IN2_VU_MASK 0x0100 /* IN2_VU */
1093#define WM8994_IN2_VU_SHIFT 8 /* IN2_VU */
1094#define WM8994_IN2_VU_WIDTH 1 /* IN2_VU */
1095#define WM8994_IN2R_MUTE 0x0080 /* IN2R_MUTE */
1096#define WM8994_IN2R_MUTE_MASK 0x0080 /* IN2R_MUTE */
1097#define WM8994_IN2R_MUTE_SHIFT 7 /* IN2R_MUTE */
1098#define WM8994_IN2R_MUTE_WIDTH 1 /* IN2R_MUTE */
1099#define WM8994_IN2R_ZC 0x0040 /* IN2R_ZC */
1100#define WM8994_IN2R_ZC_MASK 0x0040 /* IN2R_ZC */
1101#define WM8994_IN2R_ZC_SHIFT 6 /* IN2R_ZC */
1102#define WM8994_IN2R_ZC_WIDTH 1 /* IN2R_ZC */
1103#define WM8994_IN2R_VOL_MASK 0x001F /* IN2R_VOL - [4:0] */
1104#define WM8994_IN2R_VOL_SHIFT 0 /* IN2R_VOL - [4:0] */
1105#define WM8994_IN2R_VOL_WIDTH 5 /* IN2R_VOL - [4:0] */
1106
1107/*
1108 * R28 (0x1C) - Left Output Volume
1109 */
1110#define WM8994_HPOUT1_VU 0x0100 /* HPOUT1_VU */
1111#define WM8994_HPOUT1_VU_MASK 0x0100 /* HPOUT1_VU */
1112#define WM8994_HPOUT1_VU_SHIFT 8 /* HPOUT1_VU */
1113#define WM8994_HPOUT1_VU_WIDTH 1 /* HPOUT1_VU */
1114#define WM8994_HPOUT1L_ZC 0x0080 /* HPOUT1L_ZC */
1115#define WM8994_HPOUT1L_ZC_MASK 0x0080 /* HPOUT1L_ZC */
1116#define WM8994_HPOUT1L_ZC_SHIFT 7 /* HPOUT1L_ZC */
1117#define WM8994_HPOUT1L_ZC_WIDTH 1 /* HPOUT1L_ZC */
1118#define WM8994_HPOUT1L_MUTE_N 0x0040 /* HPOUT1L_MUTE_N */
1119#define WM8994_HPOUT1L_MUTE_N_MASK 0x0040 /* HPOUT1L_MUTE_N */
1120#define WM8994_HPOUT1L_MUTE_N_SHIFT 6 /* HPOUT1L_MUTE_N */
1121#define WM8994_HPOUT1L_MUTE_N_WIDTH 1 /* HPOUT1L_MUTE_N */
1122#define WM8994_HPOUT1L_VOL_MASK 0x003F /* HPOUT1L_VOL - [5:0] */
1123#define WM8994_HPOUT1L_VOL_SHIFT 0 /* HPOUT1L_VOL - [5:0] */
1124#define WM8994_HPOUT1L_VOL_WIDTH 6 /* HPOUT1L_VOL - [5:0] */
1125
1126/*
1127 * R29 (0x1D) - Right Output Volume
1128 */
1129#define WM8994_HPOUT1_VU 0x0100 /* HPOUT1_VU */
1130#define WM8994_HPOUT1_VU_MASK 0x0100 /* HPOUT1_VU */
1131#define WM8994_HPOUT1_VU_SHIFT 8 /* HPOUT1_VU */
1132#define WM8994_HPOUT1_VU_WIDTH 1 /* HPOUT1_VU */
1133#define WM8994_HPOUT1R_ZC 0x0080 /* HPOUT1R_ZC */
1134#define WM8994_HPOUT1R_ZC_MASK 0x0080 /* HPOUT1R_ZC */
1135#define WM8994_HPOUT1R_ZC_SHIFT 7 /* HPOUT1R_ZC */
1136#define WM8994_HPOUT1R_ZC_WIDTH 1 /* HPOUT1R_ZC */
1137#define WM8994_HPOUT1R_MUTE_N 0x0040 /* HPOUT1R_MUTE_N */
1138#define WM8994_HPOUT1R_MUTE_N_MASK 0x0040 /* HPOUT1R_MUTE_N */
1139#define WM8994_HPOUT1R_MUTE_N_SHIFT 6 /* HPOUT1R_MUTE_N */
1140#define WM8994_HPOUT1R_MUTE_N_WIDTH 1 /* HPOUT1R_MUTE_N */
1141#define WM8994_HPOUT1R_VOL_MASK 0x003F /* HPOUT1R_VOL - [5:0] */
1142#define WM8994_HPOUT1R_VOL_SHIFT 0 /* HPOUT1R_VOL - [5:0] */
1143#define WM8994_HPOUT1R_VOL_WIDTH 6 /* HPOUT1R_VOL - [5:0] */
1144
1145/*
1146 * R30 (0x1E) - Line Outputs Volume
1147 */
1148#define WM8994_LINEOUT1N_MUTE 0x0040 /* LINEOUT1N_MUTE */
1149#define WM8994_LINEOUT1N_MUTE_MASK 0x0040 /* LINEOUT1N_MUTE */
1150#define WM8994_LINEOUT1N_MUTE_SHIFT 6 /* LINEOUT1N_MUTE */
1151#define WM8994_LINEOUT1N_MUTE_WIDTH 1 /* LINEOUT1N_MUTE */
1152#define WM8994_LINEOUT1P_MUTE 0x0020 /* LINEOUT1P_MUTE */
1153#define WM8994_LINEOUT1P_MUTE_MASK 0x0020 /* LINEOUT1P_MUTE */
1154#define WM8994_LINEOUT1P_MUTE_SHIFT 5 /* LINEOUT1P_MUTE */
1155#define WM8994_LINEOUT1P_MUTE_WIDTH 1 /* LINEOUT1P_MUTE */
1156#define WM8994_LINEOUT1_VOL 0x0010 /* LINEOUT1_VOL */
1157#define WM8994_LINEOUT1_VOL_MASK 0x0010 /* LINEOUT1_VOL */
1158#define WM8994_LINEOUT1_VOL_SHIFT 4 /* LINEOUT1_VOL */
1159#define WM8994_LINEOUT1_VOL_WIDTH 1 /* LINEOUT1_VOL */
1160#define WM8994_LINEOUT2N_MUTE 0x0004 /* LINEOUT2N_MUTE */
1161#define WM8994_LINEOUT2N_MUTE_MASK 0x0004 /* LINEOUT2N_MUTE */
1162#define WM8994_LINEOUT2N_MUTE_SHIFT 2 /* LINEOUT2N_MUTE */
1163#define WM8994_LINEOUT2N_MUTE_WIDTH 1 /* LINEOUT2N_MUTE */
1164#define WM8994_LINEOUT2P_MUTE 0x0002 /* LINEOUT2P_MUTE */
1165#define WM8994_LINEOUT2P_MUTE_MASK 0x0002 /* LINEOUT2P_MUTE */
1166#define WM8994_LINEOUT2P_MUTE_SHIFT 1 /* LINEOUT2P_MUTE */
1167#define WM8994_LINEOUT2P_MUTE_WIDTH 1 /* LINEOUT2P_MUTE */
1168#define WM8994_LINEOUT2_VOL 0x0001 /* LINEOUT2_VOL */
1169#define WM8994_LINEOUT2_VOL_MASK 0x0001 /* LINEOUT2_VOL */
1170#define WM8994_LINEOUT2_VOL_SHIFT 0 /* LINEOUT2_VOL */
1171#define WM8994_LINEOUT2_VOL_WIDTH 1 /* LINEOUT2_VOL */
1172
1173/*
1174 * R31 (0x1F) - HPOUT2 Volume
1175 */
1176#define WM8994_HPOUT2_MUTE 0x0020 /* HPOUT2_MUTE */
1177#define WM8994_HPOUT2_MUTE_MASK 0x0020 /* HPOUT2_MUTE */
1178#define WM8994_HPOUT2_MUTE_SHIFT 5 /* HPOUT2_MUTE */
1179#define WM8994_HPOUT2_MUTE_WIDTH 1 /* HPOUT2_MUTE */
1180#define WM8994_HPOUT2_VOL 0x0010 /* HPOUT2_VOL */
1181#define WM8994_HPOUT2_VOL_MASK 0x0010 /* HPOUT2_VOL */
1182#define WM8994_HPOUT2_VOL_SHIFT 4 /* HPOUT2_VOL */
1183#define WM8994_HPOUT2_VOL_WIDTH 1 /* HPOUT2_VOL */
1184
1185/*
1186 * R32 (0x20) - Left OPGA Volume
1187 */
1188#define WM8994_MIXOUT_VU 0x0100 /* MIXOUT_VU */
1189#define WM8994_MIXOUT_VU_MASK 0x0100 /* MIXOUT_VU */
1190#define WM8994_MIXOUT_VU_SHIFT 8 /* MIXOUT_VU */
1191#define WM8994_MIXOUT_VU_WIDTH 1 /* MIXOUT_VU */
1192#define WM8994_MIXOUTL_ZC 0x0080 /* MIXOUTL_ZC */
1193#define WM8994_MIXOUTL_ZC_MASK 0x0080 /* MIXOUTL_ZC */
1194#define WM8994_MIXOUTL_ZC_SHIFT 7 /* MIXOUTL_ZC */
1195#define WM8994_MIXOUTL_ZC_WIDTH 1 /* MIXOUTL_ZC */
1196#define WM8994_MIXOUTL_MUTE_N 0x0040 /* MIXOUTL_MUTE_N */
1197#define WM8994_MIXOUTL_MUTE_N_MASK 0x0040 /* MIXOUTL_MUTE_N */
1198#define WM8994_MIXOUTL_MUTE_N_SHIFT 6 /* MIXOUTL_MUTE_N */
1199#define WM8994_MIXOUTL_MUTE_N_WIDTH 1 /* MIXOUTL_MUTE_N */
1200#define WM8994_MIXOUTL_VOL_MASK 0x003F /* MIXOUTL_VOL - [5:0] */
1201#define WM8994_MIXOUTL_VOL_SHIFT 0 /* MIXOUTL_VOL - [5:0] */
1202#define WM8994_MIXOUTL_VOL_WIDTH 6 /* MIXOUTL_VOL - [5:0] */
1203
1204/*
1205 * R33 (0x21) - Right OPGA Volume
1206 */
1207#define WM8994_MIXOUT_VU 0x0100 /* MIXOUT_VU */
1208#define WM8994_MIXOUT_VU_MASK 0x0100 /* MIXOUT_VU */
1209#define WM8994_MIXOUT_VU_SHIFT 8 /* MIXOUT_VU */
1210#define WM8994_MIXOUT_VU_WIDTH 1 /* MIXOUT_VU */
1211#define WM8994_MIXOUTR_ZC 0x0080 /* MIXOUTR_ZC */
1212#define WM8994_MIXOUTR_ZC_MASK 0x0080 /* MIXOUTR_ZC */
1213#define WM8994_MIXOUTR_ZC_SHIFT 7 /* MIXOUTR_ZC */
1214#define WM8994_MIXOUTR_ZC_WIDTH 1 /* MIXOUTR_ZC */
1215#define WM8994_MIXOUTR_MUTE_N 0x0040 /* MIXOUTR_MUTE_N */
1216#define WM8994_MIXOUTR_MUTE_N_MASK 0x0040 /* MIXOUTR_MUTE_N */
1217#define WM8994_MIXOUTR_MUTE_N_SHIFT 6 /* MIXOUTR_MUTE_N */
1218#define WM8994_MIXOUTR_MUTE_N_WIDTH 1 /* MIXOUTR_MUTE_N */
1219#define WM8994_MIXOUTR_VOL_MASK 0x003F /* MIXOUTR_VOL - [5:0] */
1220#define WM8994_MIXOUTR_VOL_SHIFT 0 /* MIXOUTR_VOL - [5:0] */
1221#define WM8994_MIXOUTR_VOL_WIDTH 6 /* MIXOUTR_VOL - [5:0] */
1222
1223/*
1224 * R34 (0x22) - SPKMIXL Attenuation
1225 */
1226#define WM8994_DAC2L_SPKMIXL_VOL 0x0040 /* DAC2L_SPKMIXL_VOL */
1227#define WM8994_DAC2L_SPKMIXL_VOL_MASK 0x0040 /* DAC2L_SPKMIXL_VOL */
1228#define WM8994_DAC2L_SPKMIXL_VOL_SHIFT 6 /* DAC2L_SPKMIXL_VOL */
1229#define WM8994_DAC2L_SPKMIXL_VOL_WIDTH 1 /* DAC2L_SPKMIXL_VOL */
1230#define WM8994_MIXINL_SPKMIXL_VOL 0x0020 /* MIXINL_SPKMIXL_VOL */
1231#define WM8994_MIXINL_SPKMIXL_VOL_MASK 0x0020 /* MIXINL_SPKMIXL_VOL */
1232#define WM8994_MIXINL_SPKMIXL_VOL_SHIFT 5 /* MIXINL_SPKMIXL_VOL */
1233#define WM8994_MIXINL_SPKMIXL_VOL_WIDTH 1 /* MIXINL_SPKMIXL_VOL */
1234#define WM8994_IN1LP_SPKMIXL_VOL 0x0010 /* IN1LP_SPKMIXL_VOL */
1235#define WM8994_IN1LP_SPKMIXL_VOL_MASK 0x0010 /* IN1LP_SPKMIXL_VOL */
1236#define WM8994_IN1LP_SPKMIXL_VOL_SHIFT 4 /* IN1LP_SPKMIXL_VOL */
1237#define WM8994_IN1LP_SPKMIXL_VOL_WIDTH 1 /* IN1LP_SPKMIXL_VOL */
1238#define WM8994_MIXOUTL_SPKMIXL_VOL 0x0008 /* MIXOUTL_SPKMIXL_VOL */
1239#define WM8994_MIXOUTL_SPKMIXL_VOL_MASK 0x0008 /* MIXOUTL_SPKMIXL_VOL */
1240#define WM8994_MIXOUTL_SPKMIXL_VOL_SHIFT 3 /* MIXOUTL_SPKMIXL_VOL */
1241#define WM8994_MIXOUTL_SPKMIXL_VOL_WIDTH 1 /* MIXOUTL_SPKMIXL_VOL */
1242#define WM8994_DAC1L_SPKMIXL_VOL 0x0004 /* DAC1L_SPKMIXL_VOL */
1243#define WM8994_DAC1L_SPKMIXL_VOL_MASK 0x0004 /* DAC1L_SPKMIXL_VOL */
1244#define WM8994_DAC1L_SPKMIXL_VOL_SHIFT 2 /* DAC1L_SPKMIXL_VOL */
1245#define WM8994_DAC1L_SPKMIXL_VOL_WIDTH 1 /* DAC1L_SPKMIXL_VOL */
1246#define WM8994_SPKMIXL_VOL_MASK 0x0003 /* SPKMIXL_VOL - [1:0] */
1247#define WM8994_SPKMIXL_VOL_SHIFT 0 /* SPKMIXL_VOL - [1:0] */
1248#define WM8994_SPKMIXL_VOL_WIDTH 2 /* SPKMIXL_VOL - [1:0] */
1249
1250/*
1251 * R35 (0x23) - SPKMIXR Attenuation
1252 */
1253#define WM8994_SPKOUT_CLASSAB 0x0100 /* SPKOUT_CLASSAB */
1254#define WM8994_SPKOUT_CLASSAB_MASK 0x0100 /* SPKOUT_CLASSAB */
1255#define WM8994_SPKOUT_CLASSAB_SHIFT 8 /* SPKOUT_CLASSAB */
1256#define WM8994_SPKOUT_CLASSAB_WIDTH 1 /* SPKOUT_CLASSAB */
1257#define WM8994_DAC2R_SPKMIXR_VOL 0x0040 /* DAC2R_SPKMIXR_VOL */
1258#define WM8994_DAC2R_SPKMIXR_VOL_MASK 0x0040 /* DAC2R_SPKMIXR_VOL */
1259#define WM8994_DAC2R_SPKMIXR_VOL_SHIFT 6 /* DAC2R_SPKMIXR_VOL */
1260#define WM8994_DAC2R_SPKMIXR_VOL_WIDTH 1 /* DAC2R_SPKMIXR_VOL */
1261#define WM8994_MIXINR_SPKMIXR_VOL 0x0020 /* MIXINR_SPKMIXR_VOL */
1262#define WM8994_MIXINR_SPKMIXR_VOL_MASK 0x0020 /* MIXINR_SPKMIXR_VOL */
1263#define WM8994_MIXINR_SPKMIXR_VOL_SHIFT 5 /* MIXINR_SPKMIXR_VOL */
1264#define WM8994_MIXINR_SPKMIXR_VOL_WIDTH 1 /* MIXINR_SPKMIXR_VOL */
1265#define WM8994_IN1RP_SPKMIXR_VOL 0x0010 /* IN1RP_SPKMIXR_VOL */
1266#define WM8994_IN1RP_SPKMIXR_VOL_MASK 0x0010 /* IN1RP_SPKMIXR_VOL */
1267#define WM8994_IN1RP_SPKMIXR_VOL_SHIFT 4 /* IN1RP_SPKMIXR_VOL */
1268#define WM8994_IN1RP_SPKMIXR_VOL_WIDTH 1 /* IN1RP_SPKMIXR_VOL */
1269#define WM8994_MIXOUTR_SPKMIXR_VOL 0x0008 /* MIXOUTR_SPKMIXR_VOL */
1270#define WM8994_MIXOUTR_SPKMIXR_VOL_MASK 0x0008 /* MIXOUTR_SPKMIXR_VOL */
1271#define WM8994_MIXOUTR_SPKMIXR_VOL_SHIFT 3 /* MIXOUTR_SPKMIXR_VOL */
1272#define WM8994_MIXOUTR_SPKMIXR_VOL_WIDTH 1 /* MIXOUTR_SPKMIXR_VOL */
1273#define WM8994_DAC1R_SPKMIXR_VOL 0x0004 /* DAC1R_SPKMIXR_VOL */
1274#define WM8994_DAC1R_SPKMIXR_VOL_MASK 0x0004 /* DAC1R_SPKMIXR_VOL */
1275#define WM8994_DAC1R_SPKMIXR_VOL_SHIFT 2 /* DAC1R_SPKMIXR_VOL */
1276#define WM8994_DAC1R_SPKMIXR_VOL_WIDTH 1 /* DAC1R_SPKMIXR_VOL */
1277#define WM8994_SPKMIXR_VOL_MASK 0x0003 /* SPKMIXR_VOL - [1:0] */
1278#define WM8994_SPKMIXR_VOL_SHIFT 0 /* SPKMIXR_VOL - [1:0] */
1279#define WM8994_SPKMIXR_VOL_WIDTH 2 /* SPKMIXR_VOL - [1:0] */
1280
1281/*
1282 * R36 (0x24) - SPKOUT Mixers
1283 */
1284#define WM8994_IN2LRP_TO_SPKOUTL 0x0020 /* IN2LRP_TO_SPKOUTL */
1285#define WM8994_IN2LRP_TO_SPKOUTL_MASK 0x0020 /* IN2LRP_TO_SPKOUTL */
1286#define WM8994_IN2LRP_TO_SPKOUTL_SHIFT 5 /* IN2LRP_TO_SPKOUTL */
1287#define WM8994_IN2LRP_TO_SPKOUTL_WIDTH 1 /* IN2LRP_TO_SPKOUTL */
1288#define WM8994_SPKMIXL_TO_SPKOUTL 0x0010 /* SPKMIXL_TO_SPKOUTL */
1289#define WM8994_SPKMIXL_TO_SPKOUTL_MASK 0x0010 /* SPKMIXL_TO_SPKOUTL */
1290#define WM8994_SPKMIXL_TO_SPKOUTL_SHIFT 4 /* SPKMIXL_TO_SPKOUTL */
1291#define WM8994_SPKMIXL_TO_SPKOUTL_WIDTH 1 /* SPKMIXL_TO_SPKOUTL */
1292#define WM8994_SPKMIXR_TO_SPKOUTL 0x0008 /* SPKMIXR_TO_SPKOUTL */
1293#define WM8994_SPKMIXR_TO_SPKOUTL_MASK 0x0008 /* SPKMIXR_TO_SPKOUTL */
1294#define WM8994_SPKMIXR_TO_SPKOUTL_SHIFT 3 /* SPKMIXR_TO_SPKOUTL */
1295#define WM8994_SPKMIXR_TO_SPKOUTL_WIDTH 1 /* SPKMIXR_TO_SPKOUTL */
1296#define WM8994_IN2LRP_TO_SPKOUTR 0x0004 /* IN2LRP_TO_SPKOUTR */
1297#define WM8994_IN2LRP_TO_SPKOUTR_MASK 0x0004 /* IN2LRP_TO_SPKOUTR */
1298#define WM8994_IN2LRP_TO_SPKOUTR_SHIFT 2 /* IN2LRP_TO_SPKOUTR */
1299#define WM8994_IN2LRP_TO_SPKOUTR_WIDTH 1 /* IN2LRP_TO_SPKOUTR */
1300#define WM8994_SPKMIXL_TO_SPKOUTR 0x0002 /* SPKMIXL_TO_SPKOUTR */
1301#define WM8994_SPKMIXL_TO_SPKOUTR_MASK 0x0002 /* SPKMIXL_TO_SPKOUTR */
1302#define WM8994_SPKMIXL_TO_SPKOUTR_SHIFT 1 /* SPKMIXL_TO_SPKOUTR */
1303#define WM8994_SPKMIXL_TO_SPKOUTR_WIDTH 1 /* SPKMIXL_TO_SPKOUTR */
1304#define WM8994_SPKMIXR_TO_SPKOUTR 0x0001 /* SPKMIXR_TO_SPKOUTR */
1305#define WM8994_SPKMIXR_TO_SPKOUTR_MASK 0x0001 /* SPKMIXR_TO_SPKOUTR */
1306#define WM8994_SPKMIXR_TO_SPKOUTR_SHIFT 0 /* SPKMIXR_TO_SPKOUTR */
1307#define WM8994_SPKMIXR_TO_SPKOUTR_WIDTH 1 /* SPKMIXR_TO_SPKOUTR */
1308
1309/*
1310 * R37 (0x25) - ClassD
1311 */
1312#define WM8994_SPKOUTL_BOOST_MASK 0x0038 /* SPKOUTL_BOOST - [5:3] */
1313#define WM8994_SPKOUTL_BOOST_SHIFT 3 /* SPKOUTL_BOOST - [5:3] */
1314#define WM8994_SPKOUTL_BOOST_WIDTH 3 /* SPKOUTL_BOOST - [5:3] */
1315#define WM8994_SPKOUTR_BOOST_MASK 0x0007 /* SPKOUTR_BOOST - [2:0] */
1316#define WM8994_SPKOUTR_BOOST_SHIFT 0 /* SPKOUTR_BOOST - [2:0] */
1317#define WM8994_SPKOUTR_BOOST_WIDTH 3 /* SPKOUTR_BOOST - [2:0] */
1318
1319/*
1320 * R38 (0x26) - Speaker Volume Left
1321 */
1322#define WM8994_SPKOUT_VU 0x0100 /* SPKOUT_VU */
1323#define WM8994_SPKOUT_VU_MASK 0x0100 /* SPKOUT_VU */
1324#define WM8994_SPKOUT_VU_SHIFT 8 /* SPKOUT_VU */
1325#define WM8994_SPKOUT_VU_WIDTH 1 /* SPKOUT_VU */
1326#define WM8994_SPKOUTL_ZC 0x0080 /* SPKOUTL_ZC */
1327#define WM8994_SPKOUTL_ZC_MASK 0x0080 /* SPKOUTL_ZC */
1328#define WM8994_SPKOUTL_ZC_SHIFT 7 /* SPKOUTL_ZC */
1329#define WM8994_SPKOUTL_ZC_WIDTH 1 /* SPKOUTL_ZC */
1330#define WM8994_SPKOUTL_MUTE_N 0x0040 /* SPKOUTL_MUTE_N */
1331#define WM8994_SPKOUTL_MUTE_N_MASK 0x0040 /* SPKOUTL_MUTE_N */
1332#define WM8994_SPKOUTL_MUTE_N_SHIFT 6 /* SPKOUTL_MUTE_N */
1333#define WM8994_SPKOUTL_MUTE_N_WIDTH 1 /* SPKOUTL_MUTE_N */
1334#define WM8994_SPKOUTL_VOL_MASK 0x003F /* SPKOUTL_VOL - [5:0] */
1335#define WM8994_SPKOUTL_VOL_SHIFT 0 /* SPKOUTL_VOL - [5:0] */
1336#define WM8994_SPKOUTL_VOL_WIDTH 6 /* SPKOUTL_VOL - [5:0] */
1337
1338/*
1339 * R39 (0x27) - Speaker Volume Right
1340 */
1341#define WM8994_SPKOUT_VU 0x0100 /* SPKOUT_VU */
1342#define WM8994_SPKOUT_VU_MASK 0x0100 /* SPKOUT_VU */
1343#define WM8994_SPKOUT_VU_SHIFT 8 /* SPKOUT_VU */
1344#define WM8994_SPKOUT_VU_WIDTH 1 /* SPKOUT_VU */
1345#define WM8994_SPKOUTR_ZC 0x0080 /* SPKOUTR_ZC */
1346#define WM8994_SPKOUTR_ZC_MASK 0x0080 /* SPKOUTR_ZC */
1347#define WM8994_SPKOUTR_ZC_SHIFT 7 /* SPKOUTR_ZC */
1348#define WM8994_SPKOUTR_ZC_WIDTH 1 /* SPKOUTR_ZC */
1349#define WM8994_SPKOUTR_MUTE_N 0x0040 /* SPKOUTR_MUTE_N */
1350#define WM8994_SPKOUTR_MUTE_N_MASK 0x0040 /* SPKOUTR_MUTE_N */
1351#define WM8994_SPKOUTR_MUTE_N_SHIFT 6 /* SPKOUTR_MUTE_N */
1352#define WM8994_SPKOUTR_MUTE_N_WIDTH 1 /* SPKOUTR_MUTE_N */
1353#define WM8994_SPKOUTR_VOL_MASK 0x003F /* SPKOUTR_VOL - [5:0] */
1354#define WM8994_SPKOUTR_VOL_SHIFT 0 /* SPKOUTR_VOL - [5:0] */
1355#define WM8994_SPKOUTR_VOL_WIDTH 6 /* SPKOUTR_VOL - [5:0] */
1356
1357/*
1358 * R40 (0x28) - Input Mixer (2)
1359 */
1360#define WM8994_IN2LP_TO_IN2L 0x0080 /* IN2LP_TO_IN2L */
1361#define WM8994_IN2LP_TO_IN2L_MASK 0x0080 /* IN2LP_TO_IN2L */
1362#define WM8994_IN2LP_TO_IN2L_SHIFT 7 /* IN2LP_TO_IN2L */
1363#define WM8994_IN2LP_TO_IN2L_WIDTH 1 /* IN2LP_TO_IN2L */
1364#define WM8994_IN2LN_TO_IN2L 0x0040 /* IN2LN_TO_IN2L */
1365#define WM8994_IN2LN_TO_IN2L_MASK 0x0040 /* IN2LN_TO_IN2L */
1366#define WM8994_IN2LN_TO_IN2L_SHIFT 6 /* IN2LN_TO_IN2L */
1367#define WM8994_IN2LN_TO_IN2L_WIDTH 1 /* IN2LN_TO_IN2L */
1368#define WM8994_IN1LP_TO_IN1L 0x0020 /* IN1LP_TO_IN1L */
1369#define WM8994_IN1LP_TO_IN1L_MASK 0x0020 /* IN1LP_TO_IN1L */
1370#define WM8994_IN1LP_TO_IN1L_SHIFT 5 /* IN1LP_TO_IN1L */
1371#define WM8994_IN1LP_TO_IN1L_WIDTH 1 /* IN1LP_TO_IN1L */
1372#define WM8994_IN1LN_TO_IN1L 0x0010 /* IN1LN_TO_IN1L */
1373#define WM8994_IN1LN_TO_IN1L_MASK 0x0010 /* IN1LN_TO_IN1L */
1374#define WM8994_IN1LN_TO_IN1L_SHIFT 4 /* IN1LN_TO_IN1L */
1375#define WM8994_IN1LN_TO_IN1L_WIDTH 1 /* IN1LN_TO_IN1L */
1376#define WM8994_IN2RP_TO_IN2R 0x0008 /* IN2RP_TO_IN2R */
1377#define WM8994_IN2RP_TO_IN2R_MASK 0x0008 /* IN2RP_TO_IN2R */
1378#define WM8994_IN2RP_TO_IN2R_SHIFT 3 /* IN2RP_TO_IN2R */
1379#define WM8994_IN2RP_TO_IN2R_WIDTH 1 /* IN2RP_TO_IN2R */
1380#define WM8994_IN2RN_TO_IN2R 0x0004 /* IN2RN_TO_IN2R */
1381#define WM8994_IN2RN_TO_IN2R_MASK 0x0004 /* IN2RN_TO_IN2R */
1382#define WM8994_IN2RN_TO_IN2R_SHIFT 2 /* IN2RN_TO_IN2R */
1383#define WM8994_IN2RN_TO_IN2R_WIDTH 1 /* IN2RN_TO_IN2R */
1384#define WM8994_IN1RP_TO_IN1R 0x0002 /* IN1RP_TO_IN1R */
1385#define WM8994_IN1RP_TO_IN1R_MASK 0x0002 /* IN1RP_TO_IN1R */
1386#define WM8994_IN1RP_TO_IN1R_SHIFT 1 /* IN1RP_TO_IN1R */
1387#define WM8994_IN1RP_TO_IN1R_WIDTH 1 /* IN1RP_TO_IN1R */
1388#define WM8994_IN1RN_TO_IN1R 0x0001 /* IN1RN_TO_IN1R */
1389#define WM8994_IN1RN_TO_IN1R_MASK 0x0001 /* IN1RN_TO_IN1R */
1390#define WM8994_IN1RN_TO_IN1R_SHIFT 0 /* IN1RN_TO_IN1R */
1391#define WM8994_IN1RN_TO_IN1R_WIDTH 1 /* IN1RN_TO_IN1R */
1392
1393/*
1394 * R41 (0x29) - Input Mixer (3)
1395 */
1396#define WM8994_IN2L_TO_MIXINL 0x0100 /* IN2L_TO_MIXINL */
1397#define WM8994_IN2L_TO_MIXINL_MASK 0x0100 /* IN2L_TO_MIXINL */
1398#define WM8994_IN2L_TO_MIXINL_SHIFT 8 /* IN2L_TO_MIXINL */
1399#define WM8994_IN2L_TO_MIXINL_WIDTH 1 /* IN2L_TO_MIXINL */
1400#define WM8994_IN2L_MIXINL_VOL 0x0080 /* IN2L_MIXINL_VOL */
1401#define WM8994_IN2L_MIXINL_VOL_MASK 0x0080 /* IN2L_MIXINL_VOL */
1402#define WM8994_IN2L_MIXINL_VOL_SHIFT 7 /* IN2L_MIXINL_VOL */
1403#define WM8994_IN2L_MIXINL_VOL_WIDTH 1 /* IN2L_MIXINL_VOL */
1404#define WM8994_IN1L_TO_MIXINL 0x0020 /* IN1L_TO_MIXINL */
1405#define WM8994_IN1L_TO_MIXINL_MASK 0x0020 /* IN1L_TO_MIXINL */
1406#define WM8994_IN1L_TO_MIXINL_SHIFT 5 /* IN1L_TO_MIXINL */
1407#define WM8994_IN1L_TO_MIXINL_WIDTH 1 /* IN1L_TO_MIXINL */
1408#define WM8994_IN1L_MIXINL_VOL 0x0010 /* IN1L_MIXINL_VOL */
1409#define WM8994_IN1L_MIXINL_VOL_MASK 0x0010 /* IN1L_MIXINL_VOL */
1410#define WM8994_IN1L_MIXINL_VOL_SHIFT 4 /* IN1L_MIXINL_VOL */
1411#define WM8994_IN1L_MIXINL_VOL_WIDTH 1 /* IN1L_MIXINL_VOL */
1412#define WM8994_MIXOUTL_MIXINL_VOL_MASK 0x0007 /* MIXOUTL_MIXINL_VOL - [2:0] */
1413#define WM8994_MIXOUTL_MIXINL_VOL_SHIFT 0 /* MIXOUTL_MIXINL_VOL - [2:0] */
1414#define WM8994_MIXOUTL_MIXINL_VOL_WIDTH 3 /* MIXOUTL_MIXINL_VOL - [2:0] */
1415
1416/*
1417 * R42 (0x2A) - Input Mixer (4)
1418 */
1419#define WM8994_IN2R_TO_MIXINR 0x0100 /* IN2R_TO_MIXINR */
1420#define WM8994_IN2R_TO_MIXINR_MASK 0x0100 /* IN2R_TO_MIXINR */
1421#define WM8994_IN2R_TO_MIXINR_SHIFT 8 /* IN2R_TO_MIXINR */
1422#define WM8994_IN2R_TO_MIXINR_WIDTH 1 /* IN2R_TO_MIXINR */
1423#define WM8994_IN2R_MIXINR_VOL 0x0080 /* IN2R_MIXINR_VOL */
1424#define WM8994_IN2R_MIXINR_VOL_MASK 0x0080 /* IN2R_MIXINR_VOL */
1425#define WM8994_IN2R_MIXINR_VOL_SHIFT 7 /* IN2R_MIXINR_VOL */
1426#define WM8994_IN2R_MIXINR_VOL_WIDTH 1 /* IN2R_MIXINR_VOL */
1427#define WM8994_IN1R_TO_MIXINR 0x0020 /* IN1R_TO_MIXINR */
1428#define WM8994_IN1R_TO_MIXINR_MASK 0x0020 /* IN1R_TO_MIXINR */
1429#define WM8994_IN1R_TO_MIXINR_SHIFT 5 /* IN1R_TO_MIXINR */
1430#define WM8994_IN1R_TO_MIXINR_WIDTH 1 /* IN1R_TO_MIXINR */
1431#define WM8994_IN1R_MIXINR_VOL 0x0010 /* IN1R_MIXINR_VOL */
1432#define WM8994_IN1R_MIXINR_VOL_MASK 0x0010 /* IN1R_MIXINR_VOL */
1433#define WM8994_IN1R_MIXINR_VOL_SHIFT 4 /* IN1R_MIXINR_VOL */
1434#define WM8994_IN1R_MIXINR_VOL_WIDTH 1 /* IN1R_MIXINR_VOL */
1435#define WM8994_MIXOUTR_MIXINR_VOL_MASK 0x0007 /* MIXOUTR_MIXINR_VOL - [2:0] */
1436#define WM8994_MIXOUTR_MIXINR_VOL_SHIFT 0 /* MIXOUTR_MIXINR_VOL - [2:0] */
1437#define WM8994_MIXOUTR_MIXINR_VOL_WIDTH 3 /* MIXOUTR_MIXINR_VOL - [2:0] */
1438
1439/*
1440 * R43 (0x2B) - Input Mixer (5)
1441 */
1442#define WM8994_IN1LP_MIXINL_VOL_MASK 0x01C0 /* IN1LP_MIXINL_VOL - [8:6] */
1443#define WM8994_IN1LP_MIXINL_VOL_SHIFT 6 /* IN1LP_MIXINL_VOL - [8:6] */
1444#define WM8994_IN1LP_MIXINL_VOL_WIDTH 3 /* IN1LP_MIXINL_VOL - [8:6] */
1445#define WM8994_IN2LRP_MIXINL_VOL_MASK 0x0007 /* IN2LRP_MIXINL_VOL - [2:0] */
1446#define WM8994_IN2LRP_MIXINL_VOL_SHIFT 0 /* IN2LRP_MIXINL_VOL - [2:0] */
1447#define WM8994_IN2LRP_MIXINL_VOL_WIDTH 3 /* IN2LRP_MIXINL_VOL - [2:0] */
1448
1449/*
1450 * R44 (0x2C) - Input Mixer (6)
1451 */
1452#define WM8994_IN1RP_MIXINR_VOL_MASK 0x01C0 /* IN1RP_MIXINR_VOL - [8:6] */
1453#define WM8994_IN1RP_MIXINR_VOL_SHIFT 6 /* IN1RP_MIXINR_VOL - [8:6] */
1454#define WM8994_IN1RP_MIXINR_VOL_WIDTH 3 /* IN1RP_MIXINR_VOL - [8:6] */
1455#define WM8994_IN2LRP_MIXINR_VOL_MASK 0x0007 /* IN2LRP_MIXINR_VOL - [2:0] */
1456#define WM8994_IN2LRP_MIXINR_VOL_SHIFT 0 /* IN2LRP_MIXINR_VOL - [2:0] */
1457#define WM8994_IN2LRP_MIXINR_VOL_WIDTH 3 /* IN2LRP_MIXINR_VOL - [2:0] */
1458
1459/*
1460 * R45 (0x2D) - Output Mixer (1)
1461 */
1462#define WM8994_DAC1L_TO_HPOUT1L 0x0100 /* DAC1L_TO_HPOUT1L */
1463#define WM8994_DAC1L_TO_HPOUT1L_MASK 0x0100 /* DAC1L_TO_HPOUT1L */
1464#define WM8994_DAC1L_TO_HPOUT1L_SHIFT 8 /* DAC1L_TO_HPOUT1L */
1465#define WM8994_DAC1L_TO_HPOUT1L_WIDTH 1 /* DAC1L_TO_HPOUT1L */
1466#define WM8994_MIXINR_TO_MIXOUTL 0x0080 /* MIXINR_TO_MIXOUTL */
1467#define WM8994_MIXINR_TO_MIXOUTL_MASK 0x0080 /* MIXINR_TO_MIXOUTL */
1468#define WM8994_MIXINR_TO_MIXOUTL_SHIFT 7 /* MIXINR_TO_MIXOUTL */
1469#define WM8994_MIXINR_TO_MIXOUTL_WIDTH 1 /* MIXINR_TO_MIXOUTL */
1470#define WM8994_MIXINL_TO_MIXOUTL 0x0040 /* MIXINL_TO_MIXOUTL */
1471#define WM8994_MIXINL_TO_MIXOUTL_MASK 0x0040 /* MIXINL_TO_MIXOUTL */
1472#define WM8994_MIXINL_TO_MIXOUTL_SHIFT 6 /* MIXINL_TO_MIXOUTL */
1473#define WM8994_MIXINL_TO_MIXOUTL_WIDTH 1 /* MIXINL_TO_MIXOUTL */
1474#define WM8994_IN2RN_TO_MIXOUTL 0x0020 /* IN2RN_TO_MIXOUTL */
1475#define WM8994_IN2RN_TO_MIXOUTL_MASK 0x0020 /* IN2RN_TO_MIXOUTL */
1476#define WM8994_IN2RN_TO_MIXOUTL_SHIFT 5 /* IN2RN_TO_MIXOUTL */
1477#define WM8994_IN2RN_TO_MIXOUTL_WIDTH 1 /* IN2RN_TO_MIXOUTL */
1478#define WM8994_IN2LN_TO_MIXOUTL 0x0010 /* IN2LN_TO_MIXOUTL */
1479#define WM8994_IN2LN_TO_MIXOUTL_MASK 0x0010 /* IN2LN_TO_MIXOUTL */
1480#define WM8994_IN2LN_TO_MIXOUTL_SHIFT 4 /* IN2LN_TO_MIXOUTL */
1481#define WM8994_IN2LN_TO_MIXOUTL_WIDTH 1 /* IN2LN_TO_MIXOUTL */
1482#define WM8994_IN1R_TO_MIXOUTL 0x0008 /* IN1R_TO_MIXOUTL */
1483#define WM8994_IN1R_TO_MIXOUTL_MASK 0x0008 /* IN1R_TO_MIXOUTL */
1484#define WM8994_IN1R_TO_MIXOUTL_SHIFT 3 /* IN1R_TO_MIXOUTL */
1485#define WM8994_IN1R_TO_MIXOUTL_WIDTH 1 /* IN1R_TO_MIXOUTL */
1486#define WM8994_IN1L_TO_MIXOUTL 0x0004 /* IN1L_TO_MIXOUTL */
1487#define WM8994_IN1L_TO_MIXOUTL_MASK 0x0004 /* IN1L_TO_MIXOUTL */
1488#define WM8994_IN1L_TO_MIXOUTL_SHIFT 2 /* IN1L_TO_MIXOUTL */
1489#define WM8994_IN1L_TO_MIXOUTL_WIDTH 1 /* IN1L_TO_MIXOUTL */
1490#define WM8994_IN2LP_TO_MIXOUTL 0x0002 /* IN2LP_TO_MIXOUTL */
1491#define WM8994_IN2LP_TO_MIXOUTL_MASK 0x0002 /* IN2LP_TO_MIXOUTL */
1492#define WM8994_IN2LP_TO_MIXOUTL_SHIFT 1 /* IN2LP_TO_MIXOUTL */
1493#define WM8994_IN2LP_TO_MIXOUTL_WIDTH 1 /* IN2LP_TO_MIXOUTL */
1494#define WM8994_DAC1L_TO_MIXOUTL 0x0001 /* DAC1L_TO_MIXOUTL */
1495#define WM8994_DAC1L_TO_MIXOUTL_MASK 0x0001 /* DAC1L_TO_MIXOUTL */
1496#define WM8994_DAC1L_TO_MIXOUTL_SHIFT 0 /* DAC1L_TO_MIXOUTL */
1497#define WM8994_DAC1L_TO_MIXOUTL_WIDTH 1 /* DAC1L_TO_MIXOUTL */
1498
1499/*
1500 * R46 (0x2E) - Output Mixer (2)
1501 */
1502#define WM8994_DAC1R_TO_HPOUT1R 0x0100 /* DAC1R_TO_HPOUT1R */
1503#define WM8994_DAC1R_TO_HPOUT1R_MASK 0x0100 /* DAC1R_TO_HPOUT1R */
1504#define WM8994_DAC1R_TO_HPOUT1R_SHIFT 8 /* DAC1R_TO_HPOUT1R */
1505#define WM8994_DAC1R_TO_HPOUT1R_WIDTH 1 /* DAC1R_TO_HPOUT1R */
1506#define WM8994_MIXINL_TO_MIXOUTR 0x0080 /* MIXINL_TO_MIXOUTR */
1507#define WM8994_MIXINL_TO_MIXOUTR_MASK 0x0080 /* MIXINL_TO_MIXOUTR */
1508#define WM8994_MIXINL_TO_MIXOUTR_SHIFT 7 /* MIXINL_TO_MIXOUTR */
1509#define WM8994_MIXINL_TO_MIXOUTR_WIDTH 1 /* MIXINL_TO_MIXOUTR */
1510#define WM8994_MIXINR_TO_MIXOUTR 0x0040 /* MIXINR_TO_MIXOUTR */
1511#define WM8994_MIXINR_TO_MIXOUTR_MASK 0x0040 /* MIXINR_TO_MIXOUTR */
1512#define WM8994_MIXINR_TO_MIXOUTR_SHIFT 6 /* MIXINR_TO_MIXOUTR */
1513#define WM8994_MIXINR_TO_MIXOUTR_WIDTH 1 /* MIXINR_TO_MIXOUTR */
1514#define WM8994_IN2LN_TO_MIXOUTR 0x0020 /* IN2LN_TO_MIXOUTR */
1515#define WM8994_IN2LN_TO_MIXOUTR_MASK 0x0020 /* IN2LN_TO_MIXOUTR */
1516#define WM8994_IN2LN_TO_MIXOUTR_SHIFT 5 /* IN2LN_TO_MIXOUTR */
1517#define WM8994_IN2LN_TO_MIXOUTR_WIDTH 1 /* IN2LN_TO_MIXOUTR */
1518#define WM8994_IN2RN_TO_MIXOUTR 0x0010 /* IN2RN_TO_MIXOUTR */
1519#define WM8994_IN2RN_TO_MIXOUTR_MASK 0x0010 /* IN2RN_TO_MIXOUTR */
1520#define WM8994_IN2RN_TO_MIXOUTR_SHIFT 4 /* IN2RN_TO_MIXOUTR */
1521#define WM8994_IN2RN_TO_MIXOUTR_WIDTH 1 /* IN2RN_TO_MIXOUTR */
1522#define WM8994_IN1L_TO_MIXOUTR 0x0008 /* IN1L_TO_MIXOUTR */
1523#define WM8994_IN1L_TO_MIXOUTR_MASK 0x0008 /* IN1L_TO_MIXOUTR */
1524#define WM8994_IN1L_TO_MIXOUTR_SHIFT 3 /* IN1L_TO_MIXOUTR */
1525#define WM8994_IN1L_TO_MIXOUTR_WIDTH 1 /* IN1L_TO_MIXOUTR */
1526#define WM8994_IN1R_TO_MIXOUTR 0x0004 /* IN1R_TO_MIXOUTR */
1527#define WM8994_IN1R_TO_MIXOUTR_MASK 0x0004 /* IN1R_TO_MIXOUTR */
1528#define WM8994_IN1R_TO_MIXOUTR_SHIFT 2 /* IN1R_TO_MIXOUTR */
1529#define WM8994_IN1R_TO_MIXOUTR_WIDTH 1 /* IN1R_TO_MIXOUTR */
1530#define WM8994_IN2RP_TO_MIXOUTR 0x0002 /* IN2RP_TO_MIXOUTR */
1531#define WM8994_IN2RP_TO_MIXOUTR_MASK 0x0002 /* IN2RP_TO_MIXOUTR */
1532#define WM8994_IN2RP_TO_MIXOUTR_SHIFT 1 /* IN2RP_TO_MIXOUTR */
1533#define WM8994_IN2RP_TO_MIXOUTR_WIDTH 1 /* IN2RP_TO_MIXOUTR */
1534#define WM8994_DAC1R_TO_MIXOUTR 0x0001 /* DAC1R_TO_MIXOUTR */
1535#define WM8994_DAC1R_TO_MIXOUTR_MASK 0x0001 /* DAC1R_TO_MIXOUTR */
1536#define WM8994_DAC1R_TO_MIXOUTR_SHIFT 0 /* DAC1R_TO_MIXOUTR */
1537#define WM8994_DAC1R_TO_MIXOUTR_WIDTH 1 /* DAC1R_TO_MIXOUTR */
1538
1539/*
1540 * R47 (0x2F) - Output Mixer (3)
1541 */
1542#define WM8994_IN2LP_MIXOUTL_VOL_MASK 0x0E00 /* IN2LP_MIXOUTL_VOL - [11:9] */
1543#define WM8994_IN2LP_MIXOUTL_VOL_SHIFT 9 /* IN2LP_MIXOUTL_VOL - [11:9] */
1544#define WM8994_IN2LP_MIXOUTL_VOL_WIDTH 3 /* IN2LP_MIXOUTL_VOL - [11:9] */
1545#define WM8994_IN2LN_MIXOUTL_VOL_MASK 0x01C0 /* IN2LN_MIXOUTL_VOL - [8:6] */
1546#define WM8994_IN2LN_MIXOUTL_VOL_SHIFT 6 /* IN2LN_MIXOUTL_VOL - [8:6] */
1547#define WM8994_IN2LN_MIXOUTL_VOL_WIDTH 3 /* IN2LN_MIXOUTL_VOL - [8:6] */
1548#define WM8994_IN1R_MIXOUTL_VOL_MASK 0x0038 /* IN1R_MIXOUTL_VOL - [5:3] */
1549#define WM8994_IN1R_MIXOUTL_VOL_SHIFT 3 /* IN1R_MIXOUTL_VOL - [5:3] */
1550#define WM8994_IN1R_MIXOUTL_VOL_WIDTH 3 /* IN1R_MIXOUTL_VOL - [5:3] */
1551#define WM8994_IN1L_MIXOUTL_VOL_MASK 0x0007 /* IN1L_MIXOUTL_VOL - [2:0] */
1552#define WM8994_IN1L_MIXOUTL_VOL_SHIFT 0 /* IN1L_MIXOUTL_VOL - [2:0] */
1553#define WM8994_IN1L_MIXOUTL_VOL_WIDTH 3 /* IN1L_MIXOUTL_VOL - [2:0] */
1554
1555/*
1556 * R48 (0x30) - Output Mixer (4)
1557 */
1558#define WM8994_IN2RP_MIXOUTR_VOL_MASK 0x0E00 /* IN2RP_MIXOUTR_VOL - [11:9] */
1559#define WM8994_IN2RP_MIXOUTR_VOL_SHIFT 9 /* IN2RP_MIXOUTR_VOL - [11:9] */
1560#define WM8994_IN2RP_MIXOUTR_VOL_WIDTH 3 /* IN2RP_MIXOUTR_VOL - [11:9] */
1561#define WM8994_IN2RN_MIXOUTR_VOL_MASK 0x01C0 /* IN2RN_MIXOUTR_VOL - [8:6] */
1562#define WM8994_IN2RN_MIXOUTR_VOL_SHIFT 6 /* IN2RN_MIXOUTR_VOL - [8:6] */
1563#define WM8994_IN2RN_MIXOUTR_VOL_WIDTH 3 /* IN2RN_MIXOUTR_VOL - [8:6] */
1564#define WM8994_IN1L_MIXOUTR_VOL_MASK 0x0038 /* IN1L_MIXOUTR_VOL - [5:3] */
1565#define WM8994_IN1L_MIXOUTR_VOL_SHIFT 3 /* IN1L_MIXOUTR_VOL - [5:3] */
1566#define WM8994_IN1L_MIXOUTR_VOL_WIDTH 3 /* IN1L_MIXOUTR_VOL - [5:3] */
1567#define WM8994_IN1R_MIXOUTR_VOL_MASK 0x0007 /* IN1R_MIXOUTR_VOL - [2:0] */
1568#define WM8994_IN1R_MIXOUTR_VOL_SHIFT 0 /* IN1R_MIXOUTR_VOL - [2:0] */
1569#define WM8994_IN1R_MIXOUTR_VOL_WIDTH 3 /* IN1R_MIXOUTR_VOL - [2:0] */
1570
1571/*
1572 * R49 (0x31) - Output Mixer (5)
1573 */
1574#define WM8994_DAC1L_MIXOUTL_VOL_MASK 0x0E00 /* DAC1L_MIXOUTL_VOL - [11:9] */
1575#define WM8994_DAC1L_MIXOUTL_VOL_SHIFT 9 /* DAC1L_MIXOUTL_VOL - [11:9] */
1576#define WM8994_DAC1L_MIXOUTL_VOL_WIDTH 3 /* DAC1L_MIXOUTL_VOL - [11:9] */
1577#define WM8994_IN2RN_MIXOUTL_VOL_MASK 0x01C0 /* IN2RN_MIXOUTL_VOL - [8:6] */
1578#define WM8994_IN2RN_MIXOUTL_VOL_SHIFT 6 /* IN2RN_MIXOUTL_VOL - [8:6] */
1579#define WM8994_IN2RN_MIXOUTL_VOL_WIDTH 3 /* IN2RN_MIXOUTL_VOL - [8:6] */
1580#define WM8994_MIXINR_MIXOUTL_VOL_MASK 0x0038 /* MIXINR_MIXOUTL_VOL - [5:3] */
1581#define WM8994_MIXINR_MIXOUTL_VOL_SHIFT 3 /* MIXINR_MIXOUTL_VOL - [5:3] */
1582#define WM8994_MIXINR_MIXOUTL_VOL_WIDTH 3 /* MIXINR_MIXOUTL_VOL - [5:3] */
1583#define WM8994_MIXINL_MIXOUTL_VOL_MASK 0x0007 /* MIXINL_MIXOUTL_VOL - [2:0] */
1584#define WM8994_MIXINL_MIXOUTL_VOL_SHIFT 0 /* MIXINL_MIXOUTL_VOL - [2:0] */
1585#define WM8994_MIXINL_MIXOUTL_VOL_WIDTH 3 /* MIXINL_MIXOUTL_VOL - [2:0] */
1586
1587/*
1588 * R50 (0x32) - Output Mixer (6)
1589 */
1590#define WM8994_DAC1R_MIXOUTR_VOL_MASK 0x0E00 /* DAC1R_MIXOUTR_VOL - [11:9] */
1591#define WM8994_DAC1R_MIXOUTR_VOL_SHIFT 9 /* DAC1R_MIXOUTR_VOL - [11:9] */
1592#define WM8994_DAC1R_MIXOUTR_VOL_WIDTH 3 /* DAC1R_MIXOUTR_VOL - [11:9] */
1593#define WM8994_IN2LN_MIXOUTR_VOL_MASK 0x01C0 /* IN2LN_MIXOUTR_VOL - [8:6] */
1594#define WM8994_IN2LN_MIXOUTR_VOL_SHIFT 6 /* IN2LN_MIXOUTR_VOL - [8:6] */
1595#define WM8994_IN2LN_MIXOUTR_VOL_WIDTH 3 /* IN2LN_MIXOUTR_VOL - [8:6] */
1596#define WM8994_MIXINL_MIXOUTR_VOL_MASK 0x0038 /* MIXINL_MIXOUTR_VOL - [5:3] */
1597#define WM8994_MIXINL_MIXOUTR_VOL_SHIFT 3 /* MIXINL_MIXOUTR_VOL - [5:3] */
1598#define WM8994_MIXINL_MIXOUTR_VOL_WIDTH 3 /* MIXINL_MIXOUTR_VOL - [5:3] */
1599#define WM8994_MIXINR_MIXOUTR_VOL_MASK 0x0007 /* MIXINR_MIXOUTR_VOL - [2:0] */
1600#define WM8994_MIXINR_MIXOUTR_VOL_SHIFT 0 /* MIXINR_MIXOUTR_VOL - [2:0] */
1601#define WM8994_MIXINR_MIXOUTR_VOL_WIDTH 3 /* MIXINR_MIXOUTR_VOL - [2:0] */
1602
1603/*
1604 * R51 (0x33) - HPOUT2 Mixer
1605 */
1606#define WM8994_IN2LRP_TO_HPOUT2 0x0020 /* IN2LRP_TO_HPOUT2 */
1607#define WM8994_IN2LRP_TO_HPOUT2_MASK 0x0020 /* IN2LRP_TO_HPOUT2 */
1608#define WM8994_IN2LRP_TO_HPOUT2_SHIFT 5 /* IN2LRP_TO_HPOUT2 */
1609#define WM8994_IN2LRP_TO_HPOUT2_WIDTH 1 /* IN2LRP_TO_HPOUT2 */
1610#define WM8994_MIXOUTLVOL_TO_HPOUT2 0x0010 /* MIXOUTLVOL_TO_HPOUT2 */
1611#define WM8994_MIXOUTLVOL_TO_HPOUT2_MASK 0x0010 /* MIXOUTLVOL_TO_HPOUT2 */
1612#define WM8994_MIXOUTLVOL_TO_HPOUT2_SHIFT 4 /* MIXOUTLVOL_TO_HPOUT2 */
1613#define WM8994_MIXOUTLVOL_TO_HPOUT2_WIDTH 1 /* MIXOUTLVOL_TO_HPOUT2 */
1614#define WM8994_MIXOUTRVOL_TO_HPOUT2 0x0008 /* MIXOUTRVOL_TO_HPOUT2 */
1615#define WM8994_MIXOUTRVOL_TO_HPOUT2_MASK 0x0008 /* MIXOUTRVOL_TO_HPOUT2 */
1616#define WM8994_MIXOUTRVOL_TO_HPOUT2_SHIFT 3 /* MIXOUTRVOL_TO_HPOUT2 */
1617#define WM8994_MIXOUTRVOL_TO_HPOUT2_WIDTH 1 /* MIXOUTRVOL_TO_HPOUT2 */
1618
1619/*
1620 * R52 (0x34) - Line Mixer (1)
1621 */
1622#define WM8994_MIXOUTL_TO_LINEOUT1N 0x0040 /* MIXOUTL_TO_LINEOUT1N */
1623#define WM8994_MIXOUTL_TO_LINEOUT1N_MASK 0x0040 /* MIXOUTL_TO_LINEOUT1N */
1624#define WM8994_MIXOUTL_TO_LINEOUT1N_SHIFT 6 /* MIXOUTL_TO_LINEOUT1N */
1625#define WM8994_MIXOUTL_TO_LINEOUT1N_WIDTH 1 /* MIXOUTL_TO_LINEOUT1N */
1626#define WM8994_MIXOUTR_TO_LINEOUT1N 0x0020 /* MIXOUTR_TO_LINEOUT1N */
1627#define WM8994_MIXOUTR_TO_LINEOUT1N_MASK 0x0020 /* MIXOUTR_TO_LINEOUT1N */
1628#define WM8994_MIXOUTR_TO_LINEOUT1N_SHIFT 5 /* MIXOUTR_TO_LINEOUT1N */
1629#define WM8994_MIXOUTR_TO_LINEOUT1N_WIDTH 1 /* MIXOUTR_TO_LINEOUT1N */
1630#define WM8994_LINEOUT1_MODE 0x0010 /* LINEOUT1_MODE */
1631#define WM8994_LINEOUT1_MODE_MASK 0x0010 /* LINEOUT1_MODE */
1632#define WM8994_LINEOUT1_MODE_SHIFT 4 /* LINEOUT1_MODE */
1633#define WM8994_LINEOUT1_MODE_WIDTH 1 /* LINEOUT1_MODE */
1634#define WM8994_IN1R_TO_LINEOUT1P 0x0004 /* IN1R_TO_LINEOUT1P */
1635#define WM8994_IN1R_TO_LINEOUT1P_MASK 0x0004 /* IN1R_TO_LINEOUT1P */
1636#define WM8994_IN1R_TO_LINEOUT1P_SHIFT 2 /* IN1R_TO_LINEOUT1P */
1637#define WM8994_IN1R_TO_LINEOUT1P_WIDTH 1 /* IN1R_TO_LINEOUT1P */
1638#define WM8994_IN1L_TO_LINEOUT1P 0x0002 /* IN1L_TO_LINEOUT1P */
1639#define WM8994_IN1L_TO_LINEOUT1P_MASK 0x0002 /* IN1L_TO_LINEOUT1P */
1640#define WM8994_IN1L_TO_LINEOUT1P_SHIFT 1 /* IN1L_TO_LINEOUT1P */
1641#define WM8994_IN1L_TO_LINEOUT1P_WIDTH 1 /* IN1L_TO_LINEOUT1P */
1642#define WM8994_MIXOUTL_TO_LINEOUT1P 0x0001 /* MIXOUTL_TO_LINEOUT1P */
1643#define WM8994_MIXOUTL_TO_LINEOUT1P_MASK 0x0001 /* MIXOUTL_TO_LINEOUT1P */
1644#define WM8994_MIXOUTL_TO_LINEOUT1P_SHIFT 0 /* MIXOUTL_TO_LINEOUT1P */
1645#define WM8994_MIXOUTL_TO_LINEOUT1P_WIDTH 1 /* MIXOUTL_TO_LINEOUT1P */
1646
1647/*
1648 * R53 (0x35) - Line Mixer (2)
1649 */
1650#define WM8994_MIXOUTR_TO_LINEOUT2N 0x0040 /* MIXOUTR_TO_LINEOUT2N */
1651#define WM8994_MIXOUTR_TO_LINEOUT2N_MASK 0x0040 /* MIXOUTR_TO_LINEOUT2N */
1652#define WM8994_MIXOUTR_TO_LINEOUT2N_SHIFT 6 /* MIXOUTR_TO_LINEOUT2N */
1653#define WM8994_MIXOUTR_TO_LINEOUT2N_WIDTH 1 /* MIXOUTR_TO_LINEOUT2N */
1654#define WM8994_MIXOUTL_TO_LINEOUT2N 0x0020 /* MIXOUTL_TO_LINEOUT2N */
1655#define WM8994_MIXOUTL_TO_LINEOUT2N_MASK 0x0020 /* MIXOUTL_TO_LINEOUT2N */
1656#define WM8994_MIXOUTL_TO_LINEOUT2N_SHIFT 5 /* MIXOUTL_TO_LINEOUT2N */
1657#define WM8994_MIXOUTL_TO_LINEOUT2N_WIDTH 1 /* MIXOUTL_TO_LINEOUT2N */
1658#define WM8994_LINEOUT2_MODE 0x0010 /* LINEOUT2_MODE */
1659#define WM8994_LINEOUT2_MODE_MASK 0x0010 /* LINEOUT2_MODE */
1660#define WM8994_LINEOUT2_MODE_SHIFT 4 /* LINEOUT2_MODE */
1661#define WM8994_LINEOUT2_MODE_WIDTH 1 /* LINEOUT2_MODE */
1662#define WM8994_IN1L_TO_LINEOUT2P 0x0004 /* IN1L_TO_LINEOUT2P */
1663#define WM8994_IN1L_TO_LINEOUT2P_MASK 0x0004 /* IN1L_TO_LINEOUT2P */
1664#define WM8994_IN1L_TO_LINEOUT2P_SHIFT 2 /* IN1L_TO_LINEOUT2P */
1665#define WM8994_IN1L_TO_LINEOUT2P_WIDTH 1 /* IN1L_TO_LINEOUT2P */
1666#define WM8994_IN1R_TO_LINEOUT2P 0x0002 /* IN1R_TO_LINEOUT2P */
1667#define WM8994_IN1R_TO_LINEOUT2P_MASK 0x0002 /* IN1R_TO_LINEOUT2P */
1668#define WM8994_IN1R_TO_LINEOUT2P_SHIFT 1 /* IN1R_TO_LINEOUT2P */
1669#define WM8994_IN1R_TO_LINEOUT2P_WIDTH 1 /* IN1R_TO_LINEOUT2P */
1670#define WM8994_MIXOUTR_TO_LINEOUT2P 0x0001 /* MIXOUTR_TO_LINEOUT2P */
1671#define WM8994_MIXOUTR_TO_LINEOUT2P_MASK 0x0001 /* MIXOUTR_TO_LINEOUT2P */
1672#define WM8994_MIXOUTR_TO_LINEOUT2P_SHIFT 0 /* MIXOUTR_TO_LINEOUT2P */
1673#define WM8994_MIXOUTR_TO_LINEOUT2P_WIDTH 1 /* MIXOUTR_TO_LINEOUT2P */
1674
1675/*
1676 * R54 (0x36) - Speaker Mixer
1677 */
1678#define WM8994_DAC2L_TO_SPKMIXL 0x0200 /* DAC2L_TO_SPKMIXL */
1679#define WM8994_DAC2L_TO_SPKMIXL_MASK 0x0200 /* DAC2L_TO_SPKMIXL */
1680#define WM8994_DAC2L_TO_SPKMIXL_SHIFT 9 /* DAC2L_TO_SPKMIXL */
1681#define WM8994_DAC2L_TO_SPKMIXL_WIDTH 1 /* DAC2L_TO_SPKMIXL */
1682#define WM8994_DAC2R_TO_SPKMIXR 0x0100 /* DAC2R_TO_SPKMIXR */
1683#define WM8994_DAC2R_TO_SPKMIXR_MASK 0x0100 /* DAC2R_TO_SPKMIXR */
1684#define WM8994_DAC2R_TO_SPKMIXR_SHIFT 8 /* DAC2R_TO_SPKMIXR */
1685#define WM8994_DAC2R_TO_SPKMIXR_WIDTH 1 /* DAC2R_TO_SPKMIXR */
1686#define WM8994_MIXINL_TO_SPKMIXL 0x0080 /* MIXINL_TO_SPKMIXL */
1687#define WM8994_MIXINL_TO_SPKMIXL_MASK 0x0080 /* MIXINL_TO_SPKMIXL */
1688#define WM8994_MIXINL_TO_SPKMIXL_SHIFT 7 /* MIXINL_TO_SPKMIXL */
1689#define WM8994_MIXINL_TO_SPKMIXL_WIDTH 1 /* MIXINL_TO_SPKMIXL */
1690#define WM8994_MIXINR_TO_SPKMIXR 0x0040 /* MIXINR_TO_SPKMIXR */
1691#define WM8994_MIXINR_TO_SPKMIXR_MASK 0x0040 /* MIXINR_TO_SPKMIXR */
1692#define WM8994_MIXINR_TO_SPKMIXR_SHIFT 6 /* MIXINR_TO_SPKMIXR */
1693#define WM8994_MIXINR_TO_SPKMIXR_WIDTH 1 /* MIXINR_TO_SPKMIXR */
1694#define WM8994_IN1LP_TO_SPKMIXL 0x0020 /* IN1LP_TO_SPKMIXL */
1695#define WM8994_IN1LP_TO_SPKMIXL_MASK 0x0020 /* IN1LP_TO_SPKMIXL */
1696#define WM8994_IN1LP_TO_SPKMIXL_SHIFT 5 /* IN1LP_TO_SPKMIXL */
1697#define WM8994_IN1LP_TO_SPKMIXL_WIDTH 1 /* IN1LP_TO_SPKMIXL */
1698#define WM8994_IN1RP_TO_SPKMIXR 0x0010 /* IN1RP_TO_SPKMIXR */
1699#define WM8994_IN1RP_TO_SPKMIXR_MASK 0x0010 /* IN1RP_TO_SPKMIXR */
1700#define WM8994_IN1RP_TO_SPKMIXR_SHIFT 4 /* IN1RP_TO_SPKMIXR */
1701#define WM8994_IN1RP_TO_SPKMIXR_WIDTH 1 /* IN1RP_TO_SPKMIXR */
1702#define WM8994_MIXOUTL_TO_SPKMIXL 0x0008 /* MIXOUTL_TO_SPKMIXL */
1703#define WM8994_MIXOUTL_TO_SPKMIXL_MASK 0x0008 /* MIXOUTL_TO_SPKMIXL */
1704#define WM8994_MIXOUTL_TO_SPKMIXL_SHIFT 3 /* MIXOUTL_TO_SPKMIXL */
1705#define WM8994_MIXOUTL_TO_SPKMIXL_WIDTH 1 /* MIXOUTL_TO_SPKMIXL */
1706#define WM8994_MIXOUTR_TO_SPKMIXR 0x0004 /* MIXOUTR_TO_SPKMIXR */
1707#define WM8994_MIXOUTR_TO_SPKMIXR_MASK 0x0004 /* MIXOUTR_TO_SPKMIXR */
1708#define WM8994_MIXOUTR_TO_SPKMIXR_SHIFT 2 /* MIXOUTR_TO_SPKMIXR */
1709#define WM8994_MIXOUTR_TO_SPKMIXR_WIDTH 1 /* MIXOUTR_TO_SPKMIXR */
1710#define WM8994_DAC1L_TO_SPKMIXL 0x0002 /* DAC1L_TO_SPKMIXL */
1711#define WM8994_DAC1L_TO_SPKMIXL_MASK 0x0002 /* DAC1L_TO_SPKMIXL */
1712#define WM8994_DAC1L_TO_SPKMIXL_SHIFT 1 /* DAC1L_TO_SPKMIXL */
1713#define WM8994_DAC1L_TO_SPKMIXL_WIDTH 1 /* DAC1L_TO_SPKMIXL */
1714#define WM8994_DAC1R_TO_SPKMIXR 0x0001 /* DAC1R_TO_SPKMIXR */
1715#define WM8994_DAC1R_TO_SPKMIXR_MASK 0x0001 /* DAC1R_TO_SPKMIXR */
1716#define WM8994_DAC1R_TO_SPKMIXR_SHIFT 0 /* DAC1R_TO_SPKMIXR */
1717#define WM8994_DAC1R_TO_SPKMIXR_WIDTH 1 /* DAC1R_TO_SPKMIXR */
1718
1719/*
1720 * R55 (0x37) - Additional Control
1721 */
1722#define WM8994_LINEOUT1_FB 0x0080 /* LINEOUT1_FB */
1723#define WM8994_LINEOUT1_FB_MASK 0x0080 /* LINEOUT1_FB */
1724#define WM8994_LINEOUT1_FB_SHIFT 7 /* LINEOUT1_FB */
1725#define WM8994_LINEOUT1_FB_WIDTH 1 /* LINEOUT1_FB */
1726#define WM8994_LINEOUT2_FB 0x0040 /* LINEOUT2_FB */
1727#define WM8994_LINEOUT2_FB_MASK 0x0040 /* LINEOUT2_FB */
1728#define WM8994_LINEOUT2_FB_SHIFT 6 /* LINEOUT2_FB */
1729#define WM8994_LINEOUT2_FB_WIDTH 1 /* LINEOUT2_FB */
1730#define WM8994_VROI 0x0001 /* VROI */
1731#define WM8994_VROI_MASK 0x0001 /* VROI */
1732#define WM8994_VROI_SHIFT 0 /* VROI */
1733#define WM8994_VROI_WIDTH 1 /* VROI */
1734
1735/*
1736 * R56 (0x38) - AntiPOP (1)
1737 */
1738#define WM8994_LINEOUT_VMID_BUF_ENA 0x0080 /* LINEOUT_VMID_BUF_ENA */
1739#define WM8994_LINEOUT_VMID_BUF_ENA_MASK 0x0080 /* LINEOUT_VMID_BUF_ENA */
1740#define WM8994_LINEOUT_VMID_BUF_ENA_SHIFT 7 /* LINEOUT_VMID_BUF_ENA */
1741#define WM8994_LINEOUT_VMID_BUF_ENA_WIDTH 1 /* LINEOUT_VMID_BUF_ENA */
1742#define WM8994_HPOUT2_IN_ENA 0x0040 /* HPOUT2_IN_ENA */
1743#define WM8994_HPOUT2_IN_ENA_MASK 0x0040 /* HPOUT2_IN_ENA */
1744#define WM8994_HPOUT2_IN_ENA_SHIFT 6 /* HPOUT2_IN_ENA */
1745#define WM8994_HPOUT2_IN_ENA_WIDTH 1 /* HPOUT2_IN_ENA */
1746#define WM8994_LINEOUT1_DISCH 0x0020 /* LINEOUT1_DISCH */
1747#define WM8994_LINEOUT1_DISCH_MASK 0x0020 /* LINEOUT1_DISCH */
1748#define WM8994_LINEOUT1_DISCH_SHIFT 5 /* LINEOUT1_DISCH */
1749#define WM8994_LINEOUT1_DISCH_WIDTH 1 /* LINEOUT1_DISCH */
1750#define WM8994_LINEOUT2_DISCH 0x0010 /* LINEOUT2_DISCH */
1751#define WM8994_LINEOUT2_DISCH_MASK 0x0010 /* LINEOUT2_DISCH */
1752#define WM8994_LINEOUT2_DISCH_SHIFT 4 /* LINEOUT2_DISCH */
1753#define WM8994_LINEOUT2_DISCH_WIDTH 1 /* LINEOUT2_DISCH */
1754
1755/*
1756 * R57 (0x39) - AntiPOP (2)
1757 */
1758#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */
1759#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */
1760#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */
1761#define WM8994_MICB2_DISCH_WIDTH 1 /* MICB2_DISCH */
1762#define WM8994_MICB1_DISCH 0x0080 /* MICB1_DISCH */
1763#define WM8994_MICB1_DISCH_MASK 0x0080 /* MICB1_DISCH */
1764#define WM8994_MICB1_DISCH_SHIFT 7 /* MICB1_DISCH */
1765#define WM8994_MICB1_DISCH_WIDTH 1 /* MICB1_DISCH */
1766#define WM8994_VMID_RAMP_MASK 0x0060 /* VMID_RAMP - [6:5] */
1767#define WM8994_VMID_RAMP_SHIFT 5 /* VMID_RAMP - [6:5] */
1768#define WM8994_VMID_RAMP_WIDTH 2 /* VMID_RAMP - [6:5] */
1769#define WM8994_VMID_BUF_ENA 0x0008 /* VMID_BUF_ENA */
1770#define WM8994_VMID_BUF_ENA_MASK 0x0008 /* VMID_BUF_ENA */
1771#define WM8994_VMID_BUF_ENA_SHIFT 3 /* VMID_BUF_ENA */
1772#define WM8994_VMID_BUF_ENA_WIDTH 1 /* VMID_BUF_ENA */
1773#define WM8994_STARTUP_BIAS_ENA 0x0004 /* STARTUP_BIAS_ENA */
1774#define WM8994_STARTUP_BIAS_ENA_MASK 0x0004 /* STARTUP_BIAS_ENA */
1775#define WM8994_STARTUP_BIAS_ENA_SHIFT 2 /* STARTUP_BIAS_ENA */
1776#define WM8994_STARTUP_BIAS_ENA_WIDTH 1 /* STARTUP_BIAS_ENA */
1777#define WM8994_BIAS_SRC 0x0002 /* BIAS_SRC */
1778#define WM8994_BIAS_SRC_MASK 0x0002 /* BIAS_SRC */
1779#define WM8994_BIAS_SRC_SHIFT 1 /* BIAS_SRC */
1780#define WM8994_BIAS_SRC_WIDTH 1 /* BIAS_SRC */
1781#define WM8994_VMID_DISCH 0x0001 /* VMID_DISCH */
1782#define WM8994_VMID_DISCH_MASK 0x0001 /* VMID_DISCH */
1783#define WM8994_VMID_DISCH_SHIFT 0 /* VMID_DISCH */
1784#define WM8994_VMID_DISCH_WIDTH 1 /* VMID_DISCH */
1785
1786/*
1787 * R58 (0x3A) - MICBIAS
1788 */
1789#define WM8994_MICD_SCTHR_MASK 0x00C0 /* MICD_SCTHR - [7:6] */
1790#define WM8994_MICD_SCTHR_SHIFT 6 /* MICD_SCTHR - [7:6] */
1791#define WM8994_MICD_SCTHR_WIDTH 2 /* MICD_SCTHR - [7:6] */
1792#define WM8994_MICD_THR_MASK 0x0038 /* MICD_THR - [5:3] */
1793#define WM8994_MICD_THR_SHIFT 3 /* MICD_THR - [5:3] */
1794#define WM8994_MICD_THR_WIDTH 3 /* MICD_THR - [5:3] */
1795#define WM8994_MICD_ENA 0x0004 /* MICD_ENA */
1796#define WM8994_MICD_ENA_MASK 0x0004 /* MICD_ENA */
1797#define WM8994_MICD_ENA_SHIFT 2 /* MICD_ENA */
1798#define WM8994_MICD_ENA_WIDTH 1 /* MICD_ENA */
1799#define WM8994_MICB2_LVL 0x0002 /* MICB2_LVL */
1800#define WM8994_MICB2_LVL_MASK 0x0002 /* MICB2_LVL */
1801#define WM8994_MICB2_LVL_SHIFT 1 /* MICB2_LVL */
1802#define WM8994_MICB2_LVL_WIDTH 1 /* MICB2_LVL */
1803#define WM8994_MICB1_LVL 0x0001 /* MICB1_LVL */
1804#define WM8994_MICB1_LVL_MASK 0x0001 /* MICB1_LVL */
1805#define WM8994_MICB1_LVL_SHIFT 0 /* MICB1_LVL */
1806#define WM8994_MICB1_LVL_WIDTH 1 /* MICB1_LVL */
1807
1808/*
1809 * R59 (0x3B) - LDO 1
1810 */
1811#define WM8994_LDO1_VSEL_MASK 0x000E /* LDO1_VSEL - [3:1] */
1812#define WM8994_LDO1_VSEL_SHIFT 1 /* LDO1_VSEL - [3:1] */
1813#define WM8994_LDO1_VSEL_WIDTH 3 /* LDO1_VSEL - [3:1] */
1814#define WM8994_LDO1_DISCH 0x0001 /* LDO1_DISCH */
1815#define WM8994_LDO1_DISCH_MASK 0x0001 /* LDO1_DISCH */
1816#define WM8994_LDO1_DISCH_SHIFT 0 /* LDO1_DISCH */
1817#define WM8994_LDO1_DISCH_WIDTH 1 /* LDO1_DISCH */
1818
1819/*
1820 * R60 (0x3C) - LDO 2
1821 */
1822#define WM8994_LDO2_VSEL_MASK 0x0006 /* LDO2_VSEL - [2:1] */
1823#define WM8994_LDO2_VSEL_SHIFT 1 /* LDO2_VSEL - [2:1] */
1824#define WM8994_LDO2_VSEL_WIDTH 2 /* LDO2_VSEL - [2:1] */
1825#define WM8994_LDO2_DISCH 0x0001 /* LDO2_DISCH */
1826#define WM8994_LDO2_DISCH_MASK 0x0001 /* LDO2_DISCH */
1827#define WM8994_LDO2_DISCH_SHIFT 0 /* LDO2_DISCH */
1828#define WM8994_LDO2_DISCH_WIDTH 1 /* LDO2_DISCH */
1829
1830/*
1831 * R76 (0x4C) - Charge Pump (1)
1832 */
1833#define WM8994_CP_ENA 0x8000 /* CP_ENA */
1834#define WM8994_CP_ENA_MASK 0x8000 /* CP_ENA */
1835#define WM8994_CP_ENA_SHIFT 15 /* CP_ENA */
1836#define WM8994_CP_ENA_WIDTH 1 /* CP_ENA */
1837
1838/*
1839 * R81 (0x51) - Class W (1)
1840 */
1841#define WM8994_CP_DYN_SRC_SEL_MASK 0x0300 /* CP_DYN_SRC_SEL - [9:8] */
1842#define WM8994_CP_DYN_SRC_SEL_SHIFT 8 /* CP_DYN_SRC_SEL - [9:8] */
1843#define WM8994_CP_DYN_SRC_SEL_WIDTH 2 /* CP_DYN_SRC_SEL - [9:8] */
1844#define WM8994_CP_DYN_PWR 0x0001 /* CP_DYN_PWR */
1845#define WM8994_CP_DYN_PWR_MASK 0x0001 /* CP_DYN_PWR */
1846#define WM8994_CP_DYN_PWR_SHIFT 0 /* CP_DYN_PWR */
1847#define WM8994_CP_DYN_PWR_WIDTH 1 /* CP_DYN_PWR */
1848
1849/*
1850 * R84 (0x54) - DC Servo (1)
1851 */
1852#define WM8994_DCS_TRIG_SINGLE_1 0x2000 /* DCS_TRIG_SINGLE_1 */
1853#define WM8994_DCS_TRIG_SINGLE_1_MASK 0x2000 /* DCS_TRIG_SINGLE_1 */
1854#define WM8994_DCS_TRIG_SINGLE_1_SHIFT 13 /* DCS_TRIG_SINGLE_1 */
1855#define WM8994_DCS_TRIG_SINGLE_1_WIDTH 1 /* DCS_TRIG_SINGLE_1 */
1856#define WM8994_DCS_TRIG_SINGLE_0 0x1000 /* DCS_TRIG_SINGLE_0 */
1857#define WM8994_DCS_TRIG_SINGLE_0_MASK 0x1000 /* DCS_TRIG_SINGLE_0 */
1858#define WM8994_DCS_TRIG_SINGLE_0_SHIFT 12 /* DCS_TRIG_SINGLE_0 */
1859#define WM8994_DCS_TRIG_SINGLE_0_WIDTH 1 /* DCS_TRIG_SINGLE_0 */
1860#define WM8994_DCS_TRIG_SERIES_1 0x0200 /* DCS_TRIG_SERIES_1 */
1861#define WM8994_DCS_TRIG_SERIES_1_MASK 0x0200 /* DCS_TRIG_SERIES_1 */
1862#define WM8994_DCS_TRIG_SERIES_1_SHIFT 9 /* DCS_TRIG_SERIES_1 */
1863#define WM8994_DCS_TRIG_SERIES_1_WIDTH 1 /* DCS_TRIG_SERIES_1 */
1864#define WM8994_DCS_TRIG_SERIES_0 0x0100 /* DCS_TRIG_SERIES_0 */
1865#define WM8994_DCS_TRIG_SERIES_0_MASK 0x0100 /* DCS_TRIG_SERIES_0 */
1866#define WM8994_DCS_TRIG_SERIES_0_SHIFT 8 /* DCS_TRIG_SERIES_0 */
1867#define WM8994_DCS_TRIG_SERIES_0_WIDTH 1 /* DCS_TRIG_SERIES_0 */
1868#define WM8994_DCS_TRIG_STARTUP_1 0x0020 /* DCS_TRIG_STARTUP_1 */
1869#define WM8994_DCS_TRIG_STARTUP_1_MASK 0x0020 /* DCS_TRIG_STARTUP_1 */
1870#define WM8994_DCS_TRIG_STARTUP_1_SHIFT 5 /* DCS_TRIG_STARTUP_1 */
1871#define WM8994_DCS_TRIG_STARTUP_1_WIDTH 1 /* DCS_TRIG_STARTUP_1 */
1872#define WM8994_DCS_TRIG_STARTUP_0 0x0010 /* DCS_TRIG_STARTUP_0 */
1873#define WM8994_DCS_TRIG_STARTUP_0_MASK 0x0010 /* DCS_TRIG_STARTUP_0 */
1874#define WM8994_DCS_TRIG_STARTUP_0_SHIFT 4 /* DCS_TRIG_STARTUP_0 */
1875#define WM8994_DCS_TRIG_STARTUP_0_WIDTH 1 /* DCS_TRIG_STARTUP_0 */
1876#define WM8994_DCS_TRIG_DAC_WR_1 0x0008 /* DCS_TRIG_DAC_WR_1 */
1877#define WM8994_DCS_TRIG_DAC_WR_1_MASK 0x0008 /* DCS_TRIG_DAC_WR_1 */
1878#define WM8994_DCS_TRIG_DAC_WR_1_SHIFT 3 /* DCS_TRIG_DAC_WR_1 */
1879#define WM8994_DCS_TRIG_DAC_WR_1_WIDTH 1 /* DCS_TRIG_DAC_WR_1 */
1880#define WM8994_DCS_TRIG_DAC_WR_0 0x0004 /* DCS_TRIG_DAC_WR_0 */
1881#define WM8994_DCS_TRIG_DAC_WR_0_MASK 0x0004 /* DCS_TRIG_DAC_WR_0 */
1882#define WM8994_DCS_TRIG_DAC_WR_0_SHIFT 2 /* DCS_TRIG_DAC_WR_0 */
1883#define WM8994_DCS_TRIG_DAC_WR_0_WIDTH 1 /* DCS_TRIG_DAC_WR_0 */
1884#define WM8994_DCS_ENA_CHAN_1 0x0002 /* DCS_ENA_CHAN_1 */
1885#define WM8994_DCS_ENA_CHAN_1_MASK 0x0002 /* DCS_ENA_CHAN_1 */
1886#define WM8994_DCS_ENA_CHAN_1_SHIFT 1 /* DCS_ENA_CHAN_1 */
1887#define WM8994_DCS_ENA_CHAN_1_WIDTH 1 /* DCS_ENA_CHAN_1 */
1888#define WM8994_DCS_ENA_CHAN_0 0x0001 /* DCS_ENA_CHAN_0 */
1889#define WM8994_DCS_ENA_CHAN_0_MASK 0x0001 /* DCS_ENA_CHAN_0 */
1890#define WM8994_DCS_ENA_CHAN_0_SHIFT 0 /* DCS_ENA_CHAN_0 */
1891#define WM8994_DCS_ENA_CHAN_0_WIDTH 1 /* DCS_ENA_CHAN_0 */
1892
1893/*
1894 * R85 (0x55) - DC Servo (2)
1895 */
1896#define WM8994_DCS_SERIES_NO_01_MASK 0x0FE0 /* DCS_SERIES_NO_01 - [11:5] */
1897#define WM8994_DCS_SERIES_NO_01_SHIFT 5 /* DCS_SERIES_NO_01 - [11:5] */
1898#define WM8994_DCS_SERIES_NO_01_WIDTH 7 /* DCS_SERIES_NO_01 - [11:5] */
1899#define WM8994_DCS_TIMER_PERIOD_01_MASK 0x000F /* DCS_TIMER_PERIOD_01 - [3:0] */
1900#define WM8994_DCS_TIMER_PERIOD_01_SHIFT 0 /* DCS_TIMER_PERIOD_01 - [3:0] */
1901#define WM8994_DCS_TIMER_PERIOD_01_WIDTH 4 /* DCS_TIMER_PERIOD_01 - [3:0] */
1902
1903/*
1904 * R87 (0x57) - DC Servo (4)
1905 */
1906#define WM8994_DCS_DAC_WR_VAL_1_MASK 0xFF00 /* DCS_DAC_WR_VAL_1 - [15:8] */
1907#define WM8994_DCS_DAC_WR_VAL_1_SHIFT 8 /* DCS_DAC_WR_VAL_1 - [15:8] */
1908#define WM8994_DCS_DAC_WR_VAL_1_WIDTH 8 /* DCS_DAC_WR_VAL_1 - [15:8] */
1909#define WM8994_DCS_DAC_WR_VAL_0_MASK 0x00FF /* DCS_DAC_WR_VAL_0 - [7:0] */
1910#define WM8994_DCS_DAC_WR_VAL_0_SHIFT 0 /* DCS_DAC_WR_VAL_0 - [7:0] */
1911#define WM8994_DCS_DAC_WR_VAL_0_WIDTH 8 /* DCS_DAC_WR_VAL_0 - [7:0] */
1912
1913/*
1914 * R88 (0x58) - DC Servo Readback
1915 */
1916#define WM8994_DCS_CAL_COMPLETE_MASK 0x0300 /* DCS_CAL_COMPLETE - [9:8] */
1917#define WM8994_DCS_CAL_COMPLETE_SHIFT 8 /* DCS_CAL_COMPLETE - [9:8] */
1918#define WM8994_DCS_CAL_COMPLETE_WIDTH 2 /* DCS_CAL_COMPLETE - [9:8] */
1919#define WM8994_DCS_DAC_WR_COMPLETE_MASK 0x0030 /* DCS_DAC_WR_COMPLETE - [5:4] */
1920#define WM8994_DCS_DAC_WR_COMPLETE_SHIFT 4 /* DCS_DAC_WR_COMPLETE - [5:4] */
1921#define WM8994_DCS_DAC_WR_COMPLETE_WIDTH 2 /* DCS_DAC_WR_COMPLETE - [5:4] */
1922#define WM8994_DCS_STARTUP_COMPLETE_MASK 0x0003 /* DCS_STARTUP_COMPLETE - [1:0] */
1923#define WM8994_DCS_STARTUP_COMPLETE_SHIFT 0 /* DCS_STARTUP_COMPLETE - [1:0] */
1924#define WM8994_DCS_STARTUP_COMPLETE_WIDTH 2 /* DCS_STARTUP_COMPLETE - [1:0] */
1925
1926/*
1927 * R96 (0x60) - Analogue HP (1)
1928 */
1929#define WM8994_HPOUT1L_RMV_SHORT 0x0080 /* HPOUT1L_RMV_SHORT */
1930#define WM8994_HPOUT1L_RMV_SHORT_MASK 0x0080 /* HPOUT1L_RMV_SHORT */
1931#define WM8994_HPOUT1L_RMV_SHORT_SHIFT 7 /* HPOUT1L_RMV_SHORT */
1932#define WM8994_HPOUT1L_RMV_SHORT_WIDTH 1 /* HPOUT1L_RMV_SHORT */
1933#define WM8994_HPOUT1L_OUTP 0x0040 /* HPOUT1L_OUTP */
1934#define WM8994_HPOUT1L_OUTP_MASK 0x0040 /* HPOUT1L_OUTP */
1935#define WM8994_HPOUT1L_OUTP_SHIFT 6 /* HPOUT1L_OUTP */
1936#define WM8994_HPOUT1L_OUTP_WIDTH 1 /* HPOUT1L_OUTP */
1937#define WM8994_HPOUT1L_DLY 0x0020 /* HPOUT1L_DLY */
1938#define WM8994_HPOUT1L_DLY_MASK 0x0020 /* HPOUT1L_DLY */
1939#define WM8994_HPOUT1L_DLY_SHIFT 5 /* HPOUT1L_DLY */
1940#define WM8994_HPOUT1L_DLY_WIDTH 1 /* HPOUT1L_DLY */
1941#define WM8994_HPOUT1R_RMV_SHORT 0x0008 /* HPOUT1R_RMV_SHORT */
1942#define WM8994_HPOUT1R_RMV_SHORT_MASK 0x0008 /* HPOUT1R_RMV_SHORT */
1943#define WM8994_HPOUT1R_RMV_SHORT_SHIFT 3 /* HPOUT1R_RMV_SHORT */
1944#define WM8994_HPOUT1R_RMV_SHORT_WIDTH 1 /* HPOUT1R_RMV_SHORT */
1945#define WM8994_HPOUT1R_OUTP 0x0004 /* HPOUT1R_OUTP */
1946#define WM8994_HPOUT1R_OUTP_MASK 0x0004 /* HPOUT1R_OUTP */
1947#define WM8994_HPOUT1R_OUTP_SHIFT 2 /* HPOUT1R_OUTP */
1948#define WM8994_HPOUT1R_OUTP_WIDTH 1 /* HPOUT1R_OUTP */
1949#define WM8994_HPOUT1R_DLY 0x0002 /* HPOUT1R_DLY */
1950#define WM8994_HPOUT1R_DLY_MASK 0x0002 /* HPOUT1R_DLY */
1951#define WM8994_HPOUT1R_DLY_SHIFT 1 /* HPOUT1R_DLY */
1952#define WM8994_HPOUT1R_DLY_WIDTH 1 /* HPOUT1R_DLY */
1953
1954/*
1955 * R256 (0x100) - Chip Revision
1956 */
1957#define WM8994_CHIP_REV_MASK 0x000F /* CHIP_REV - [3:0] */
1958#define WM8994_CHIP_REV_SHIFT 0 /* CHIP_REV - [3:0] */
1959#define WM8994_CHIP_REV_WIDTH 4 /* CHIP_REV - [3:0] */
1960
1961/*
1962 * R257 (0x101) - Control Interface
1963 */
1964#define WM8994_SPI_CONTRD 0x0040 /* SPI_CONTRD */
1965#define WM8994_SPI_CONTRD_MASK 0x0040 /* SPI_CONTRD */
1966#define WM8994_SPI_CONTRD_SHIFT 6 /* SPI_CONTRD */
1967#define WM8994_SPI_CONTRD_WIDTH 1 /* SPI_CONTRD */
1968#define WM8994_SPI_4WIRE 0x0020 /* SPI_4WIRE */
1969#define WM8994_SPI_4WIRE_MASK 0x0020 /* SPI_4WIRE */
1970#define WM8994_SPI_4WIRE_SHIFT 5 /* SPI_4WIRE */
1971#define WM8994_SPI_4WIRE_WIDTH 1 /* SPI_4WIRE */
1972#define WM8994_SPI_CFG 0x0010 /* SPI_CFG */
1973#define WM8994_SPI_CFG_MASK 0x0010 /* SPI_CFG */
1974#define WM8994_SPI_CFG_SHIFT 4 /* SPI_CFG */
1975#define WM8994_SPI_CFG_WIDTH 1 /* SPI_CFG */
1976#define WM8994_AUTO_INC 0x0004 /* AUTO_INC */
1977#define WM8994_AUTO_INC_MASK 0x0004 /* AUTO_INC */
1978#define WM8994_AUTO_INC_SHIFT 2 /* AUTO_INC */
1979#define WM8994_AUTO_INC_WIDTH 1 /* AUTO_INC */
1980
1981/*
1982 * R272 (0x110) - Write Sequencer Ctrl (1)
1983 */
1984#define WM8994_WSEQ_ENA 0x8000 /* WSEQ_ENA */
1985#define WM8994_WSEQ_ENA_MASK 0x8000 /* WSEQ_ENA */
1986#define WM8994_WSEQ_ENA_SHIFT 15 /* WSEQ_ENA */
1987#define WM8994_WSEQ_ENA_WIDTH 1 /* WSEQ_ENA */
1988#define WM8994_WSEQ_ABORT 0x0200 /* WSEQ_ABORT */
1989#define WM8994_WSEQ_ABORT_MASK 0x0200 /* WSEQ_ABORT */
1990#define WM8994_WSEQ_ABORT_SHIFT 9 /* WSEQ_ABORT */
1991#define WM8994_WSEQ_ABORT_WIDTH 1 /* WSEQ_ABORT */
1992#define WM8994_WSEQ_START 0x0100 /* WSEQ_START */
1993#define WM8994_WSEQ_START_MASK 0x0100 /* WSEQ_START */
1994#define WM8994_WSEQ_START_SHIFT 8 /* WSEQ_START */
1995#define WM8994_WSEQ_START_WIDTH 1 /* WSEQ_START */
1996#define WM8994_WSEQ_START_INDEX_MASK 0x007F /* WSEQ_START_INDEX - [6:0] */
1997#define WM8994_WSEQ_START_INDEX_SHIFT 0 /* WSEQ_START_INDEX - [6:0] */
1998#define WM8994_WSEQ_START_INDEX_WIDTH 7 /* WSEQ_START_INDEX - [6:0] */
1999
2000/*
2001 * R273 (0x111) - Write Sequencer Ctrl (2)
2002 */
2003#define WM8994_WSEQ_BUSY 0x0100 /* WSEQ_BUSY */
2004#define WM8994_WSEQ_BUSY_MASK 0x0100 /* WSEQ_BUSY */
2005#define WM8994_WSEQ_BUSY_SHIFT 8 /* WSEQ_BUSY */
2006#define WM8994_WSEQ_BUSY_WIDTH 1 /* WSEQ_BUSY */
2007#define WM8994_WSEQ_CURRENT_INDEX_MASK 0x007F /* WSEQ_CURRENT_INDEX - [6:0] */
2008#define WM8994_WSEQ_CURRENT_INDEX_SHIFT 0 /* WSEQ_CURRENT_INDEX - [6:0] */
2009#define WM8994_WSEQ_CURRENT_INDEX_WIDTH 7 /* WSEQ_CURRENT_INDEX - [6:0] */
2010
2011/*
2012 * R512 (0x200) - AIF1 Clocking (1)
2013 */
2014#define WM8994_AIF1CLK_SRC_MASK 0x0018 /* AIF1CLK_SRC - [4:3] */
2015#define WM8994_AIF1CLK_SRC_SHIFT 3 /* AIF1CLK_SRC - [4:3] */
2016#define WM8994_AIF1CLK_SRC_WIDTH 2 /* AIF1CLK_SRC - [4:3] */
2017#define WM8994_AIF1CLK_INV 0x0004 /* AIF1CLK_INV */
2018#define WM8994_AIF1CLK_INV_MASK 0x0004 /* AIF1CLK_INV */
2019#define WM8994_AIF1CLK_INV_SHIFT 2 /* AIF1CLK_INV */
2020#define WM8994_AIF1CLK_INV_WIDTH 1 /* AIF1CLK_INV */
2021#define WM8994_AIF1CLK_DIV 0x0002 /* AIF1CLK_DIV */
2022#define WM8994_AIF1CLK_DIV_MASK 0x0002 /* AIF1CLK_DIV */
2023#define WM8994_AIF1CLK_DIV_SHIFT 1 /* AIF1CLK_DIV */
2024#define WM8994_AIF1CLK_DIV_WIDTH 1 /* AIF1CLK_DIV */
2025#define WM8994_AIF1CLK_ENA 0x0001 /* AIF1CLK_ENA */
2026#define WM8994_AIF1CLK_ENA_MASK 0x0001 /* AIF1CLK_ENA */
2027#define WM8994_AIF1CLK_ENA_SHIFT 0 /* AIF1CLK_ENA */
2028#define WM8994_AIF1CLK_ENA_WIDTH 1 /* AIF1CLK_ENA */
2029
2030/*
2031 * R513 (0x201) - AIF1 Clocking (2)
2032 */
2033#define WM8994_AIF1DAC_DIV_MASK 0x0038 /* AIF1DAC_DIV - [5:3] */
2034#define WM8994_AIF1DAC_DIV_SHIFT 3 /* AIF1DAC_DIV - [5:3] */
2035#define WM8994_AIF1DAC_DIV_WIDTH 3 /* AIF1DAC_DIV - [5:3] */
2036#define WM8994_AIF1ADC_DIV_MASK 0x0007 /* AIF1ADC_DIV - [2:0] */
2037#define WM8994_AIF1ADC_DIV_SHIFT 0 /* AIF1ADC_DIV - [2:0] */
2038#define WM8994_AIF1ADC_DIV_WIDTH 3 /* AIF1ADC_DIV - [2:0] */
2039
2040/*
2041 * R516 (0x204) - AIF2 Clocking (1)
2042 */
2043#define WM8994_AIF2CLK_SRC_MASK 0x0018 /* AIF2CLK_SRC - [4:3] */
2044#define WM8994_AIF2CLK_SRC_SHIFT 3 /* AIF2CLK_SRC - [4:3] */
2045#define WM8994_AIF2CLK_SRC_WIDTH 2 /* AIF2CLK_SRC - [4:3] */
2046#define WM8994_AIF2CLK_INV 0x0004 /* AIF2CLK_INV */
2047#define WM8994_AIF2CLK_INV_MASK 0x0004 /* AIF2CLK_INV */
2048#define WM8994_AIF2CLK_INV_SHIFT 2 /* AIF2CLK_INV */
2049#define WM8994_AIF2CLK_INV_WIDTH 1 /* AIF2CLK_INV */
2050#define WM8994_AIF2CLK_DIV 0x0002 /* AIF2CLK_DIV */
2051#define WM8994_AIF2CLK_DIV_MASK 0x0002 /* AIF2CLK_DIV */
2052#define WM8994_AIF2CLK_DIV_SHIFT 1 /* AIF2CLK_DIV */
2053#define WM8994_AIF2CLK_DIV_WIDTH 1 /* AIF2CLK_DIV */
2054#define WM8994_AIF2CLK_ENA 0x0001 /* AIF2CLK_ENA */
2055#define WM8994_AIF2CLK_ENA_MASK 0x0001 /* AIF2CLK_ENA */
2056#define WM8994_AIF2CLK_ENA_SHIFT 0 /* AIF2CLK_ENA */
2057#define WM8994_AIF2CLK_ENA_WIDTH 1 /* AIF2CLK_ENA */
2058
2059/*
2060 * R517 (0x205) - AIF2 Clocking (2)
2061 */
2062#define WM8994_AIF2DAC_DIV_MASK 0x0038 /* AIF2DAC_DIV - [5:3] */
2063#define WM8994_AIF2DAC_DIV_SHIFT 3 /* AIF2DAC_DIV - [5:3] */
2064#define WM8994_AIF2DAC_DIV_WIDTH 3 /* AIF2DAC_DIV - [5:3] */
2065#define WM8994_AIF2ADC_DIV_MASK 0x0007 /* AIF2ADC_DIV - [2:0] */
2066#define WM8994_AIF2ADC_DIV_SHIFT 0 /* AIF2ADC_DIV - [2:0] */
2067#define WM8994_AIF2ADC_DIV_WIDTH 3 /* AIF2ADC_DIV - [2:0] */
2068
2069/*
2070 * R520 (0x208) - Clocking (1)
2071 */
2072#define WM8994_TOCLK_ENA 0x0010 /* TOCLK_ENA */
2073#define WM8994_TOCLK_ENA_MASK 0x0010 /* TOCLK_ENA */
2074#define WM8994_TOCLK_ENA_SHIFT 4 /* TOCLK_ENA */
2075#define WM8994_TOCLK_ENA_WIDTH 1 /* TOCLK_ENA */
2076#define WM8994_AIF1DSPCLK_ENA 0x0008 /* AIF1DSPCLK_ENA */
2077#define WM8994_AIF1DSPCLK_ENA_MASK 0x0008 /* AIF1DSPCLK_ENA */
2078#define WM8994_AIF1DSPCLK_ENA_SHIFT 3 /* AIF1DSPCLK_ENA */
2079#define WM8994_AIF1DSPCLK_ENA_WIDTH 1 /* AIF1DSPCLK_ENA */
2080#define WM8994_AIF2DSPCLK_ENA 0x0004 /* AIF2DSPCLK_ENA */
2081#define WM8994_AIF2DSPCLK_ENA_MASK 0x0004 /* AIF2DSPCLK_ENA */
2082#define WM8994_AIF2DSPCLK_ENA_SHIFT 2 /* AIF2DSPCLK_ENA */
2083#define WM8994_AIF2DSPCLK_ENA_WIDTH 1 /* AIF2DSPCLK_ENA */
2084#define WM8994_SYSDSPCLK_ENA 0x0002 /* SYSDSPCLK_ENA */
2085#define WM8994_SYSDSPCLK_ENA_MASK 0x0002 /* SYSDSPCLK_ENA */
2086#define WM8994_SYSDSPCLK_ENA_SHIFT 1 /* SYSDSPCLK_ENA */
2087#define WM8994_SYSDSPCLK_ENA_WIDTH 1 /* SYSDSPCLK_ENA */
2088#define WM8994_SYSCLK_SRC 0x0001 /* SYSCLK_SRC */
2089#define WM8994_SYSCLK_SRC_MASK 0x0001 /* SYSCLK_SRC */
2090#define WM8994_SYSCLK_SRC_SHIFT 0 /* SYSCLK_SRC */
2091#define WM8994_SYSCLK_SRC_WIDTH 1 /* SYSCLK_SRC */
2092
2093/*
2094 * R521 (0x209) - Clocking (2)
2095 */
2096#define WM8994_TOCLK_DIV_MASK 0x0700 /* TOCLK_DIV - [10:8] */
2097#define WM8994_TOCLK_DIV_SHIFT 8 /* TOCLK_DIV - [10:8] */
2098#define WM8994_TOCLK_DIV_WIDTH 3 /* TOCLK_DIV - [10:8] */
2099#define WM8994_DBCLK_DIV_MASK 0x0070 /* DBCLK_DIV - [6:4] */
2100#define WM8994_DBCLK_DIV_SHIFT 4 /* DBCLK_DIV - [6:4] */
2101#define WM8994_DBCLK_DIV_WIDTH 3 /* DBCLK_DIV - [6:4] */
2102#define WM8994_OPCLK_DIV_MASK 0x0007 /* OPCLK_DIV - [2:0] */
2103#define WM8994_OPCLK_DIV_SHIFT 0 /* OPCLK_DIV - [2:0] */
2104#define WM8994_OPCLK_DIV_WIDTH 3 /* OPCLK_DIV - [2:0] */
2105
2106/*
2107 * R528 (0x210) - AIF1 Rate
2108 */
2109#define WM8994_AIF1_SR_MASK 0x00F0 /* AIF1_SR - [7:4] */
2110#define WM8994_AIF1_SR_SHIFT 4 /* AIF1_SR - [7:4] */
2111#define WM8994_AIF1_SR_WIDTH 4 /* AIF1_SR - [7:4] */
2112#define WM8994_AIF1CLK_RATE_MASK 0x000F /* AIF1CLK_RATE - [3:0] */
2113#define WM8994_AIF1CLK_RATE_SHIFT 0 /* AIF1CLK_RATE - [3:0] */
2114#define WM8994_AIF1CLK_RATE_WIDTH 4 /* AIF1CLK_RATE - [3:0] */
2115
2116/*
2117 * R529 (0x211) - AIF2 Rate
2118 */
2119#define WM8994_AIF2_SR_MASK 0x00F0 /* AIF2_SR - [7:4] */
2120#define WM8994_AIF2_SR_SHIFT 4 /* AIF2_SR - [7:4] */
2121#define WM8994_AIF2_SR_WIDTH 4 /* AIF2_SR - [7:4] */
2122#define WM8994_AIF2CLK_RATE_MASK 0x000F /* AIF2CLK_RATE - [3:0] */
2123#define WM8994_AIF2CLK_RATE_SHIFT 0 /* AIF2CLK_RATE - [3:0] */
2124#define WM8994_AIF2CLK_RATE_WIDTH 4 /* AIF2CLK_RATE - [3:0] */
2125
2126/*
2127 * R530 (0x212) - Rate Status
2128 */
2129#define WM8994_SR_ERROR_MASK 0x000F /* SR_ERROR - [3:0] */
2130#define WM8994_SR_ERROR_SHIFT 0 /* SR_ERROR - [3:0] */
2131#define WM8994_SR_ERROR_WIDTH 4 /* SR_ERROR - [3:0] */
2132
2133/*
2134 * R544 (0x220) - FLL1 Control (1)
2135 */
2136#define WM8994_FLL1_FRAC 0x0004 /* FLL1_FRAC */
2137#define WM8994_FLL1_FRAC_MASK 0x0004 /* FLL1_FRAC */
2138#define WM8994_FLL1_FRAC_SHIFT 2 /* FLL1_FRAC */
2139#define WM8994_FLL1_FRAC_WIDTH 1 /* FLL1_FRAC */
2140#define WM8994_FLL1_OSC_ENA 0x0002 /* FLL1_OSC_ENA */
2141#define WM8994_FLL1_OSC_ENA_MASK 0x0002 /* FLL1_OSC_ENA */
2142#define WM8994_FLL1_OSC_ENA_SHIFT 1 /* FLL1_OSC_ENA */
2143#define WM8994_FLL1_OSC_ENA_WIDTH 1 /* FLL1_OSC_ENA */
2144#define WM8994_FLL1_ENA 0x0001 /* FLL1_ENA */
2145#define WM8994_FLL1_ENA_MASK 0x0001 /* FLL1_ENA */
2146#define WM8994_FLL1_ENA_SHIFT 0 /* FLL1_ENA */
2147#define WM8994_FLL1_ENA_WIDTH 1 /* FLL1_ENA */
2148
2149/*
2150 * R545 (0x221) - FLL1 Control (2)
2151 */
2152#define WM8994_FLL1_OUTDIV_MASK 0x3F00 /* FLL1_OUTDIV - [13:8] */
2153#define WM8994_FLL1_OUTDIV_SHIFT 8 /* FLL1_OUTDIV - [13:8] */
2154#define WM8994_FLL1_OUTDIV_WIDTH 6 /* FLL1_OUTDIV - [13:8] */
2155#define WM8994_FLL1_CTRL_RATE_MASK 0x0070 /* FLL1_CTRL_RATE - [6:4] */
2156#define WM8994_FLL1_CTRL_RATE_SHIFT 4 /* FLL1_CTRL_RATE - [6:4] */
2157#define WM8994_FLL1_CTRL_RATE_WIDTH 3 /* FLL1_CTRL_RATE - [6:4] */
2158#define WM8994_FLL1_FRATIO_MASK 0x0007 /* FLL1_FRATIO - [2:0] */
2159#define WM8994_FLL1_FRATIO_SHIFT 0 /* FLL1_FRATIO - [2:0] */
2160#define WM8994_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [2:0] */
2161
2162/*
2163 * R546 (0x222) - FLL1 Control (3)
2164 */
2165#define WM8994_FLL1_K_MASK 0xFFFF /* FLL1_K - [15:0] */
2166#define WM8994_FLL1_K_SHIFT 0 /* FLL1_K - [15:0] */
2167#define WM8994_FLL1_K_WIDTH 16 /* FLL1_K - [15:0] */
2168
2169/*
2170 * R547 (0x223) - FLL1 Control (4)
2171 */
2172#define WM8994_FLL1_N_MASK 0x7FE0 /* FLL1_N - [14:5] */
2173#define WM8994_FLL1_N_SHIFT 5 /* FLL1_N - [14:5] */
2174#define WM8994_FLL1_N_WIDTH 10 /* FLL1_N - [14:5] */
2175#define WM8994_FLL1_LOOP_GAIN_MASK 0x000F /* FLL1_LOOP_GAIN - [3:0] */
2176#define WM8994_FLL1_LOOP_GAIN_SHIFT 0 /* FLL1_LOOP_GAIN - [3:0] */
2177#define WM8994_FLL1_LOOP_GAIN_WIDTH 4 /* FLL1_LOOP_GAIN - [3:0] */
2178
2179/*
2180 * R548 (0x224) - FLL1 Control (5)
2181 */
2182#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */
2183#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */
2184#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */
2185#define WM8994_FLL1_FRC_NCO 0x0040 /* FLL1_FRC_NCO */
2186#define WM8994_FLL1_FRC_NCO_MASK 0x0040 /* FLL1_FRC_NCO */
2187#define WM8994_FLL1_FRC_NCO_SHIFT 6 /* FLL1_FRC_NCO */
2188#define WM8994_FLL1_FRC_NCO_WIDTH 1 /* FLL1_FRC_NCO */
2189#define WM8994_FLL1_REFCLK_DIV_MASK 0x0018 /* FLL1_REFCLK_DIV - [4:3] */
2190#define WM8994_FLL1_REFCLK_DIV_SHIFT 3 /* FLL1_REFCLK_DIV - [4:3] */
2191#define WM8994_FLL1_REFCLK_DIV_WIDTH 2 /* FLL1_REFCLK_DIV - [4:3] */
2192#define WM8994_FLL1_REFCLK_SRC_MASK 0x0003 /* FLL1_REFCLK_SRC - [1:0] */
2193#define WM8994_FLL1_REFCLK_SRC_SHIFT 0 /* FLL1_REFCLK_SRC - [1:0] */
2194#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */
2195
2196/*
2197 * R576 (0x240) - FLL2 Control (1)
2198 */
2199#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */
2200#define WM8994_FLL2_FRAC_MASK 0x0004 /* FLL2_FRAC */
2201#define WM8994_FLL2_FRAC_SHIFT 2 /* FLL2_FRAC */
2202#define WM8994_FLL2_FRAC_WIDTH 1 /* FLL2_FRAC */
2203#define WM8994_FLL2_OSC_ENA 0x0002 /* FLL2_OSC_ENA */
2204#define WM8994_FLL2_OSC_ENA_MASK 0x0002 /* FLL2_OSC_ENA */
2205#define WM8994_FLL2_OSC_ENA_SHIFT 1 /* FLL2_OSC_ENA */
2206#define WM8994_FLL2_OSC_ENA_WIDTH 1 /* FLL2_OSC_ENA */
2207#define WM8994_FLL2_ENA 0x0001 /* FLL2_ENA */
2208#define WM8994_FLL2_ENA_MASK 0x0001 /* FLL2_ENA */
2209#define WM8994_FLL2_ENA_SHIFT 0 /* FLL2_ENA */
2210#define WM8994_FLL2_ENA_WIDTH 1 /* FLL2_ENA */
2211
2212/*
2213 * R577 (0x241) - FLL2 Control (2)
2214 */
2215#define WM8994_FLL2_OUTDIV_MASK 0x3F00 /* FLL2_OUTDIV - [13:8] */
2216#define WM8994_FLL2_OUTDIV_SHIFT 8 /* FLL2_OUTDIV - [13:8] */
2217#define WM8994_FLL2_OUTDIV_WIDTH 6 /* FLL2_OUTDIV - [13:8] */
2218#define WM8994_FLL2_CTRL_RATE_MASK 0x0070 /* FLL2_CTRL_RATE - [6:4] */
2219#define WM8994_FLL2_CTRL_RATE_SHIFT 4 /* FLL2_CTRL_RATE - [6:4] */
2220#define WM8994_FLL2_CTRL_RATE_WIDTH 3 /* FLL2_CTRL_RATE - [6:4] */
2221#define WM8994_FLL2_FRATIO_MASK 0x0007 /* FLL2_FRATIO - [2:0] */
2222#define WM8994_FLL2_FRATIO_SHIFT 0 /* FLL2_FRATIO - [2:0] */
2223#define WM8994_FLL2_FRATIO_WIDTH 3 /* FLL2_FRATIO - [2:0] */
2224
2225/*
2226 * R578 (0x242) - FLL2 Control (3)
2227 */
2228#define WM8994_FLL2_K_MASK 0xFFFF /* FLL2_K - [15:0] */
2229#define WM8994_FLL2_K_SHIFT 0 /* FLL2_K - [15:0] */
2230#define WM8994_FLL2_K_WIDTH 16 /* FLL2_K - [15:0] */
2231
2232/*
2233 * R579 (0x243) - FLL2 Control (4)
2234 */
2235#define WM8994_FLL2_N_MASK 0x7FE0 /* FLL2_N - [14:5] */
2236#define WM8994_FLL2_N_SHIFT 5 /* FLL2_N - [14:5] */
2237#define WM8994_FLL2_N_WIDTH 10 /* FLL2_N - [14:5] */
2238#define WM8994_FLL2_LOOP_GAIN_MASK 0x000F /* FLL2_LOOP_GAIN - [3:0] */
2239#define WM8994_FLL2_LOOP_GAIN_SHIFT 0 /* FLL2_LOOP_GAIN - [3:0] */
2240#define WM8994_FLL2_LOOP_GAIN_WIDTH 4 /* FLL2_LOOP_GAIN - [3:0] */
2241
2242/*
2243 * R580 (0x244) - FLL2 Control (5)
2244 */
2245#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */
2246#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */
2247#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */
2248#define WM8994_FLL2_FRC_NCO 0x0040 /* FLL2_FRC_NCO */
2249#define WM8994_FLL2_FRC_NCO_MASK 0x0040 /* FLL2_FRC_NCO */
2250#define WM8994_FLL2_FRC_NCO_SHIFT 6 /* FLL2_FRC_NCO */
2251#define WM8994_FLL2_FRC_NCO_WIDTH 1 /* FLL2_FRC_NCO */
2252#define WM8994_FLL2_REFCLK_DIV_MASK 0x0018 /* FLL2_REFCLK_DIV - [4:3] */
2253#define WM8994_FLL2_REFCLK_DIV_SHIFT 3 /* FLL2_REFCLK_DIV - [4:3] */
2254#define WM8994_FLL2_REFCLK_DIV_WIDTH 2 /* FLL2_REFCLK_DIV - [4:3] */
2255#define WM8994_FLL2_REFCLK_SRC_MASK 0x0003 /* FLL2_REFCLK_SRC - [1:0] */
2256#define WM8994_FLL2_REFCLK_SRC_SHIFT 0 /* FLL2_REFCLK_SRC - [1:0] */
2257#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */
2258
2259/*
2260 * R768 (0x300) - AIF1 Control (1)
2261 */
2262#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */
2263#define WM8994_AIF1ADCL_SRC_MASK 0x8000 /* AIF1ADCL_SRC */
2264#define WM8994_AIF1ADCL_SRC_SHIFT 15 /* AIF1ADCL_SRC */
2265#define WM8994_AIF1ADCL_SRC_WIDTH 1 /* AIF1ADCL_SRC */
2266#define WM8994_AIF1ADCR_SRC 0x4000 /* AIF1ADCR_SRC */
2267#define WM8994_AIF1ADCR_SRC_MASK 0x4000 /* AIF1ADCR_SRC */
2268#define WM8994_AIF1ADCR_SRC_SHIFT 14 /* AIF1ADCR_SRC */
2269#define WM8994_AIF1ADCR_SRC_WIDTH 1 /* AIF1ADCR_SRC */
2270#define WM8994_AIF1ADC_TDM 0x2000 /* AIF1ADC_TDM */
2271#define WM8994_AIF1ADC_TDM_MASK 0x2000 /* AIF1ADC_TDM */
2272#define WM8994_AIF1ADC_TDM_SHIFT 13 /* AIF1ADC_TDM */
2273#define WM8994_AIF1ADC_TDM_WIDTH 1 /* AIF1ADC_TDM */
2274#define WM8994_AIF1_BCLK_INV 0x0100 /* AIF1_BCLK_INV */
2275#define WM8994_AIF1_BCLK_INV_MASK 0x0100 /* AIF1_BCLK_INV */
2276#define WM8994_AIF1_BCLK_INV_SHIFT 8 /* AIF1_BCLK_INV */
2277#define WM8994_AIF1_BCLK_INV_WIDTH 1 /* AIF1_BCLK_INV */
2278#define WM8994_AIF1_LRCLK_INV 0x0080 /* AIF1_LRCLK_INV */
2279#define WM8994_AIF1_LRCLK_INV_MASK 0x0080 /* AIF1_LRCLK_INV */
2280#define WM8994_AIF1_LRCLK_INV_SHIFT 7 /* AIF1_LRCLK_INV */
2281#define WM8994_AIF1_LRCLK_INV_WIDTH 1 /* AIF1_LRCLK_INV */
2282#define WM8994_AIF1_WL_MASK 0x0060 /* AIF1_WL - [6:5] */
2283#define WM8994_AIF1_WL_SHIFT 5 /* AIF1_WL - [6:5] */
2284#define WM8994_AIF1_WL_WIDTH 2 /* AIF1_WL - [6:5] */
2285#define WM8994_AIF1_FMT_MASK 0x0018 /* AIF1_FMT - [4:3] */
2286#define WM8994_AIF1_FMT_SHIFT 3 /* AIF1_FMT - [4:3] */
2287#define WM8994_AIF1_FMT_WIDTH 2 /* AIF1_FMT - [4:3] */
2288
2289/*
2290 * R769 (0x301) - AIF1 Control (2)
2291 */
2292#define WM8994_AIF1DACL_SRC 0x8000 /* AIF1DACL_SRC */
2293#define WM8994_AIF1DACL_SRC_MASK 0x8000 /* AIF1DACL_SRC */
2294#define WM8994_AIF1DACL_SRC_SHIFT 15 /* AIF1DACL_SRC */
2295#define WM8994_AIF1DACL_SRC_WIDTH 1 /* AIF1DACL_SRC */
2296#define WM8994_AIF1DACR_SRC 0x4000 /* AIF1DACR_SRC */
2297#define WM8994_AIF1DACR_SRC_MASK 0x4000 /* AIF1DACR_SRC */
2298#define WM8994_AIF1DACR_SRC_SHIFT 14 /* AIF1DACR_SRC */
2299#define WM8994_AIF1DACR_SRC_WIDTH 1 /* AIF1DACR_SRC */
2300#define WM8994_AIF1DAC_BOOST_MASK 0x0C00 /* AIF1DAC_BOOST - [11:10] */
2301#define WM8994_AIF1DAC_BOOST_SHIFT 10 /* AIF1DAC_BOOST - [11:10] */
2302#define WM8994_AIF1DAC_BOOST_WIDTH 2 /* AIF1DAC_BOOST - [11:10] */
2303#define WM8994_AIF1_MONO 0x0100 /* AIF1_MONO */
2304#define WM8994_AIF1_MONO_MASK 0x0100 /* AIF1_MONO */
2305#define WM8994_AIF1_MONO_SHIFT 8 /* AIF1_MONO */
2306#define WM8994_AIF1_MONO_WIDTH 1 /* AIF1_MONO */
2307#define WM8994_AIF1DAC_COMP 0x0010 /* AIF1DAC_COMP */
2308#define WM8994_AIF1DAC_COMP_MASK 0x0010 /* AIF1DAC_COMP */
2309#define WM8994_AIF1DAC_COMP_SHIFT 4 /* AIF1DAC_COMP */
2310#define WM8994_AIF1DAC_COMP_WIDTH 1 /* AIF1DAC_COMP */
2311#define WM8994_AIF1DAC_COMPMODE 0x0008 /* AIF1DAC_COMPMODE */
2312#define WM8994_AIF1DAC_COMPMODE_MASK 0x0008 /* AIF1DAC_COMPMODE */
2313#define WM8994_AIF1DAC_COMPMODE_SHIFT 3 /* AIF1DAC_COMPMODE */
2314#define WM8994_AIF1DAC_COMPMODE_WIDTH 1 /* AIF1DAC_COMPMODE */
2315#define WM8994_AIF1ADC_COMP 0x0004 /* AIF1ADC_COMP */
2316#define WM8994_AIF1ADC_COMP_MASK 0x0004 /* AIF1ADC_COMP */
2317#define WM8994_AIF1ADC_COMP_SHIFT 2 /* AIF1ADC_COMP */
2318#define WM8994_AIF1ADC_COMP_WIDTH 1 /* AIF1ADC_COMP */
2319#define WM8994_AIF1ADC_COMPMODE 0x0002 /* AIF1ADC_COMPMODE */
2320#define WM8994_AIF1ADC_COMPMODE_MASK 0x0002 /* AIF1ADC_COMPMODE */
2321#define WM8994_AIF1ADC_COMPMODE_SHIFT 1 /* AIF1ADC_COMPMODE */
2322#define WM8994_AIF1ADC_COMPMODE_WIDTH 1 /* AIF1ADC_COMPMODE */
2323#define WM8994_AIF1_LOOPBACK 0x0001 /* AIF1_LOOPBACK */
2324#define WM8994_AIF1_LOOPBACK_MASK 0x0001 /* AIF1_LOOPBACK */
2325#define WM8994_AIF1_LOOPBACK_SHIFT 0 /* AIF1_LOOPBACK */
2326#define WM8994_AIF1_LOOPBACK_WIDTH 1 /* AIF1_LOOPBACK */
2327
2328/*
2329 * R770 (0x302) - AIF1 Master/Slave
2330 */
2331#define WM8994_AIF1_TRI 0x8000 /* AIF1_TRI */
2332#define WM8994_AIF1_TRI_MASK 0x8000 /* AIF1_TRI */
2333#define WM8994_AIF1_TRI_SHIFT 15 /* AIF1_TRI */
2334#define WM8994_AIF1_TRI_WIDTH 1 /* AIF1_TRI */
2335#define WM8994_AIF1_MSTR 0x4000 /* AIF1_MSTR */
2336#define WM8994_AIF1_MSTR_MASK 0x4000 /* AIF1_MSTR */
2337#define WM8994_AIF1_MSTR_SHIFT 14 /* AIF1_MSTR */
2338#define WM8994_AIF1_MSTR_WIDTH 1 /* AIF1_MSTR */
2339#define WM8994_AIF1_CLK_FRC 0x2000 /* AIF1_CLK_FRC */
2340#define WM8994_AIF1_CLK_FRC_MASK 0x2000 /* AIF1_CLK_FRC */
2341#define WM8994_AIF1_CLK_FRC_SHIFT 13 /* AIF1_CLK_FRC */
2342#define WM8994_AIF1_CLK_FRC_WIDTH 1 /* AIF1_CLK_FRC */
2343#define WM8994_AIF1_LRCLK_FRC 0x1000 /* AIF1_LRCLK_FRC */
2344#define WM8994_AIF1_LRCLK_FRC_MASK 0x1000 /* AIF1_LRCLK_FRC */
2345#define WM8994_AIF1_LRCLK_FRC_SHIFT 12 /* AIF1_LRCLK_FRC */
2346#define WM8994_AIF1_LRCLK_FRC_WIDTH 1 /* AIF1_LRCLK_FRC */
2347
2348/*
2349 * R771 (0x303) - AIF1 BCLK
2350 */
2351#define WM8994_AIF1_BCLK_DIV_MASK 0x01F0 /* AIF1_BCLK_DIV - [8:4] */
2352#define WM8994_AIF1_BCLK_DIV_SHIFT 4 /* AIF1_BCLK_DIV - [8:4] */
2353#define WM8994_AIF1_BCLK_DIV_WIDTH 5 /* AIF1_BCLK_DIV - [8:4] */
2354
2355/*
2356 * R772 (0x304) - AIF1ADC LRCLK
2357 */
2358#define WM8994_AIF1ADC_LRCLK_DIR 0x0800 /* AIF1ADC_LRCLK_DIR */
2359#define WM8994_AIF1ADC_LRCLK_DIR_MASK 0x0800 /* AIF1ADC_LRCLK_DIR */
2360#define WM8994_AIF1ADC_LRCLK_DIR_SHIFT 11 /* AIF1ADC_LRCLK_DIR */
2361#define WM8994_AIF1ADC_LRCLK_DIR_WIDTH 1 /* AIF1ADC_LRCLK_DIR */
2362#define WM8994_AIF1ADC_RATE_MASK 0x07FF /* AIF1ADC_RATE - [10:0] */
2363#define WM8994_AIF1ADC_RATE_SHIFT 0 /* AIF1ADC_RATE - [10:0] */
2364#define WM8994_AIF1ADC_RATE_WIDTH 11 /* AIF1ADC_RATE - [10:0] */
2365
2366/*
2367 * R773 (0x305) - AIF1DAC LRCLK
2368 */
2369#define WM8994_AIF1DAC_LRCLK_DIR 0x0800 /* AIF1DAC_LRCLK_DIR */
2370#define WM8994_AIF1DAC_LRCLK_DIR_MASK 0x0800 /* AIF1DAC_LRCLK_DIR */
2371#define WM8994_AIF1DAC_LRCLK_DIR_SHIFT 11 /* AIF1DAC_LRCLK_DIR */
2372#define WM8994_AIF1DAC_LRCLK_DIR_WIDTH 1 /* AIF1DAC_LRCLK_DIR */
2373#define WM8994_AIF1DAC_RATE_MASK 0x07FF /* AIF1DAC_RATE - [10:0] */
2374#define WM8994_AIF1DAC_RATE_SHIFT 0 /* AIF1DAC_RATE - [10:0] */
2375#define WM8994_AIF1DAC_RATE_WIDTH 11 /* AIF1DAC_RATE - [10:0] */
2376
2377/*
2378 * R774 (0x306) - AIF1DAC Data
2379 */
2380#define WM8994_AIF1DACL_DAT_INV 0x0002 /* AIF1DACL_DAT_INV */
2381#define WM8994_AIF1DACL_DAT_INV_MASK 0x0002 /* AIF1DACL_DAT_INV */
2382#define WM8994_AIF1DACL_DAT_INV_SHIFT 1 /* AIF1DACL_DAT_INV */
2383#define WM8994_AIF1DACL_DAT_INV_WIDTH 1 /* AIF1DACL_DAT_INV */
2384#define WM8994_AIF1DACR_DAT_INV 0x0001 /* AIF1DACR_DAT_INV */
2385#define WM8994_AIF1DACR_DAT_INV_MASK 0x0001 /* AIF1DACR_DAT_INV */
2386#define WM8994_AIF1DACR_DAT_INV_SHIFT 0 /* AIF1DACR_DAT_INV */
2387#define WM8994_AIF1DACR_DAT_INV_WIDTH 1 /* AIF1DACR_DAT_INV */
2388
2389/*
2390 * R775 (0x307) - AIF1ADC Data
2391 */
2392#define WM8994_AIF1ADCL_DAT_INV 0x0002 /* AIF1ADCL_DAT_INV */
2393#define WM8994_AIF1ADCL_DAT_INV_MASK 0x0002 /* AIF1ADCL_DAT_INV */
2394#define WM8994_AIF1ADCL_DAT_INV_SHIFT 1 /* AIF1ADCL_DAT_INV */
2395#define WM8994_AIF1ADCL_DAT_INV_WIDTH 1 /* AIF1ADCL_DAT_INV */
2396#define WM8994_AIF1ADCR_DAT_INV 0x0001 /* AIF1ADCR_DAT_INV */
2397#define WM8994_AIF1ADCR_DAT_INV_MASK 0x0001 /* AIF1ADCR_DAT_INV */
2398#define WM8994_AIF1ADCR_DAT_INV_SHIFT 0 /* AIF1ADCR_DAT_INV */
2399#define WM8994_AIF1ADCR_DAT_INV_WIDTH 1 /* AIF1ADCR_DAT_INV */
2400
2401/*
2402 * R784 (0x310) - AIF2 Control (1)
2403 */
2404#define WM8994_AIF2ADCL_SRC 0x8000 /* AIF2ADCL_SRC */
2405#define WM8994_AIF2ADCL_SRC_MASK 0x8000 /* AIF2ADCL_SRC */
2406#define WM8994_AIF2ADCL_SRC_SHIFT 15 /* AIF2ADCL_SRC */
2407#define WM8994_AIF2ADCL_SRC_WIDTH 1 /* AIF2ADCL_SRC */
2408#define WM8994_AIF2ADCR_SRC 0x4000 /* AIF2ADCR_SRC */
2409#define WM8994_AIF2ADCR_SRC_MASK 0x4000 /* AIF2ADCR_SRC */
2410#define WM8994_AIF2ADCR_SRC_SHIFT 14 /* AIF2ADCR_SRC */
2411#define WM8994_AIF2ADCR_SRC_WIDTH 1 /* AIF2ADCR_SRC */
2412#define WM8994_AIF2ADC_TDM 0x2000 /* AIF2ADC_TDM */
2413#define WM8994_AIF2ADC_TDM_MASK 0x2000 /* AIF2ADC_TDM */
2414#define WM8994_AIF2ADC_TDM_SHIFT 13 /* AIF2ADC_TDM */
2415#define WM8994_AIF2ADC_TDM_WIDTH 1 /* AIF2ADC_TDM */
2416#define WM8994_AIF2ADC_TDM_CHAN 0x1000 /* AIF2ADC_TDM_CHAN */
2417#define WM8994_AIF2ADC_TDM_CHAN_MASK 0x1000 /* AIF2ADC_TDM_CHAN */
2418#define WM8994_AIF2ADC_TDM_CHAN_SHIFT 12 /* AIF2ADC_TDM_CHAN */
2419#define WM8994_AIF2ADC_TDM_CHAN_WIDTH 1 /* AIF2ADC_TDM_CHAN */
2420#define WM8994_AIF2_BCLK_INV 0x0100 /* AIF2_BCLK_INV */
2421#define WM8994_AIF2_BCLK_INV_MASK 0x0100 /* AIF2_BCLK_INV */
2422#define WM8994_AIF2_BCLK_INV_SHIFT 8 /* AIF2_BCLK_INV */
2423#define WM8994_AIF2_BCLK_INV_WIDTH 1 /* AIF2_BCLK_INV */
2424#define WM8994_AIF2_LRCLK_INV 0x0080 /* AIF2_LRCLK_INV */
2425#define WM8994_AIF2_LRCLK_INV_MASK 0x0080 /* AIF2_LRCLK_INV */
2426#define WM8994_AIF2_LRCLK_INV_SHIFT 7 /* AIF2_LRCLK_INV */
2427#define WM8994_AIF2_LRCLK_INV_WIDTH 1 /* AIF2_LRCLK_INV */
2428#define WM8994_AIF2_WL_MASK 0x0060 /* AIF2_WL - [6:5] */
2429#define WM8994_AIF2_WL_SHIFT 5 /* AIF2_WL - [6:5] */
2430#define WM8994_AIF2_WL_WIDTH 2 /* AIF2_WL - [6:5] */
2431#define WM8994_AIF2_FMT_MASK 0x0018 /* AIF2_FMT - [4:3] */
2432#define WM8994_AIF2_FMT_SHIFT 3 /* AIF2_FMT - [4:3] */
2433#define WM8994_AIF2_FMT_WIDTH 2 /* AIF2_FMT - [4:3] */
2434
2435/*
2436 * R785 (0x311) - AIF2 Control (2)
2437 */
2438#define WM8994_AIF2DACL_SRC 0x8000 /* AIF2DACL_SRC */
2439#define WM8994_AIF2DACL_SRC_MASK 0x8000 /* AIF2DACL_SRC */
2440#define WM8994_AIF2DACL_SRC_SHIFT 15 /* AIF2DACL_SRC */
2441#define WM8994_AIF2DACL_SRC_WIDTH 1 /* AIF2DACL_SRC */
2442#define WM8994_AIF2DACR_SRC 0x4000 /* AIF2DACR_SRC */
2443#define WM8994_AIF2DACR_SRC_MASK 0x4000 /* AIF2DACR_SRC */
2444#define WM8994_AIF2DACR_SRC_SHIFT 14 /* AIF2DACR_SRC */
2445#define WM8994_AIF2DACR_SRC_WIDTH 1 /* AIF2DACR_SRC */
2446#define WM8994_AIF2DAC_TDM 0x2000 /* AIF2DAC_TDM */
2447#define WM8994_AIF2DAC_TDM_MASK 0x2000 /* AIF2DAC_TDM */
2448#define WM8994_AIF2DAC_TDM_SHIFT 13 /* AIF2DAC_TDM */
2449#define WM8994_AIF2DAC_TDM_WIDTH 1 /* AIF2DAC_TDM */
2450#define WM8994_AIF2DAC_TDM_CHAN 0x1000 /* AIF2DAC_TDM_CHAN */
2451#define WM8994_AIF2DAC_TDM_CHAN_MASK 0x1000 /* AIF2DAC_TDM_CHAN */
2452#define WM8994_AIF2DAC_TDM_CHAN_SHIFT 12 /* AIF2DAC_TDM_CHAN */
2453#define WM8994_AIF2DAC_TDM_CHAN_WIDTH 1 /* AIF2DAC_TDM_CHAN */
2454#define WM8994_AIF2DAC_BOOST_MASK 0x0C00 /* AIF2DAC_BOOST - [11:10] */
2455#define WM8994_AIF2DAC_BOOST_SHIFT 10 /* AIF2DAC_BOOST - [11:10] */
2456#define WM8994_AIF2DAC_BOOST_WIDTH 2 /* AIF2DAC_BOOST - [11:10] */
2457#define WM8994_AIF2_MONO 0x0100 /* AIF2_MONO */
2458#define WM8994_AIF2_MONO_MASK 0x0100 /* AIF2_MONO */
2459#define WM8994_AIF2_MONO_SHIFT 8 /* AIF2_MONO */
2460#define WM8994_AIF2_MONO_WIDTH 1 /* AIF2_MONO */
2461#define WM8994_AIF2DAC_COMP 0x0010 /* AIF2DAC_COMP */
2462#define WM8994_AIF2DAC_COMP_MASK 0x0010 /* AIF2DAC_COMP */
2463#define WM8994_AIF2DAC_COMP_SHIFT 4 /* AIF2DAC_COMP */
2464#define WM8994_AIF2DAC_COMP_WIDTH 1 /* AIF2DAC_COMP */
2465#define WM8994_AIF2DAC_COMPMODE 0x0008 /* AIF2DAC_COMPMODE */
2466#define WM8994_AIF2DAC_COMPMODE_MASK 0x0008 /* AIF2DAC_COMPMODE */
2467#define WM8994_AIF2DAC_COMPMODE_SHIFT 3 /* AIF2DAC_COMPMODE */
2468#define WM8994_AIF2DAC_COMPMODE_WIDTH 1 /* AIF2DAC_COMPMODE */
2469#define WM8994_AIF2ADC_COMP 0x0004 /* AIF2ADC_COMP */
2470#define WM8994_AIF2ADC_COMP_MASK 0x0004 /* AIF2ADC_COMP */
2471#define WM8994_AIF2ADC_COMP_SHIFT 2 /* AIF2ADC_COMP */
2472#define WM8994_AIF2ADC_COMP_WIDTH 1 /* AIF2ADC_COMP */
2473#define WM8994_AIF2ADC_COMPMODE 0x0002 /* AIF2ADC_COMPMODE */
2474#define WM8994_AIF2ADC_COMPMODE_MASK 0x0002 /* AIF2ADC_COMPMODE */
2475#define WM8994_AIF2ADC_COMPMODE_SHIFT 1 /* AIF2ADC_COMPMODE */
2476#define WM8994_AIF2ADC_COMPMODE_WIDTH 1 /* AIF2ADC_COMPMODE */
2477#define WM8994_AIF2_LOOPBACK 0x0001 /* AIF2_LOOPBACK */
2478#define WM8994_AIF2_LOOPBACK_MASK 0x0001 /* AIF2_LOOPBACK */
2479#define WM8994_AIF2_LOOPBACK_SHIFT 0 /* AIF2_LOOPBACK */
2480#define WM8994_AIF2_LOOPBACK_WIDTH 1 /* AIF2_LOOPBACK */
2481
2482/*
2483 * R786 (0x312) - AIF2 Master/Slave
2484 */
2485#define WM8994_AIF2_TRI 0x8000 /* AIF2_TRI */
2486#define WM8994_AIF2_TRI_MASK 0x8000 /* AIF2_TRI */
2487#define WM8994_AIF2_TRI_SHIFT 15 /* AIF2_TRI */
2488#define WM8994_AIF2_TRI_WIDTH 1 /* AIF2_TRI */
2489#define WM8994_AIF2_MSTR 0x4000 /* AIF2_MSTR */
2490#define WM8994_AIF2_MSTR_MASK 0x4000 /* AIF2_MSTR */
2491#define WM8994_AIF2_MSTR_SHIFT 14 /* AIF2_MSTR */
2492#define WM8994_AIF2_MSTR_WIDTH 1 /* AIF2_MSTR */
2493#define WM8994_AIF2_CLK_FRC 0x2000 /* AIF2_CLK_FRC */
2494#define WM8994_AIF2_CLK_FRC_MASK 0x2000 /* AIF2_CLK_FRC */
2495#define WM8994_AIF2_CLK_FRC_SHIFT 13 /* AIF2_CLK_FRC */
2496#define WM8994_AIF2_CLK_FRC_WIDTH 1 /* AIF2_CLK_FRC */
2497#define WM8994_AIF2_LRCLK_FRC 0x1000 /* AIF2_LRCLK_FRC */
2498#define WM8994_AIF2_LRCLK_FRC_MASK 0x1000 /* AIF2_LRCLK_FRC */
2499#define WM8994_AIF2_LRCLK_FRC_SHIFT 12 /* AIF2_LRCLK_FRC */
2500#define WM8994_AIF2_LRCLK_FRC_WIDTH 1 /* AIF2_LRCLK_FRC */
2501
2502/*
2503 * R787 (0x313) - AIF2 BCLK
2504 */
2505#define WM8994_AIF2_BCLK_DIV_MASK 0x01F0 /* AIF2_BCLK_DIV - [8:4] */
2506#define WM8994_AIF2_BCLK_DIV_SHIFT 4 /* AIF2_BCLK_DIV - [8:4] */
2507#define WM8994_AIF2_BCLK_DIV_WIDTH 5 /* AIF2_BCLK_DIV - [8:4] */
2508
2509/*
2510 * R788 (0x314) - AIF2ADC LRCLK
2511 */
2512#define WM8994_AIF2ADC_LRCLK_DIR 0x0800 /* AIF2ADC_LRCLK_DIR */
2513#define WM8994_AIF2ADC_LRCLK_DIR_MASK 0x0800 /* AIF2ADC_LRCLK_DIR */
2514#define WM8994_AIF2ADC_LRCLK_DIR_SHIFT 11 /* AIF2ADC_LRCLK_DIR */
2515#define WM8994_AIF2ADC_LRCLK_DIR_WIDTH 1 /* AIF2ADC_LRCLK_DIR */
2516#define WM8994_AIF2ADC_RATE_MASK 0x07FF /* AIF2ADC_RATE - [10:0] */
2517#define WM8994_AIF2ADC_RATE_SHIFT 0 /* AIF2ADC_RATE - [10:0] */
2518#define WM8994_AIF2ADC_RATE_WIDTH 11 /* AIF2ADC_RATE - [10:0] */
2519
2520/*
2521 * R789 (0x315) - AIF2DAC LRCLK
2522 */
2523#define WM8994_AIF2DAC_LRCLK_DIR 0x0800 /* AIF2DAC_LRCLK_DIR */
2524#define WM8994_AIF2DAC_LRCLK_DIR_MASK 0x0800 /* AIF2DAC_LRCLK_DIR */
2525#define WM8994_AIF2DAC_LRCLK_DIR_SHIFT 11 /* AIF2DAC_LRCLK_DIR */
2526#define WM8994_AIF2DAC_LRCLK_DIR_WIDTH 1 /* AIF2DAC_LRCLK_DIR */
2527#define WM8994_AIF2DAC_RATE_MASK 0x07FF /* AIF2DAC_RATE - [10:0] */
2528#define WM8994_AIF2DAC_RATE_SHIFT 0 /* AIF2DAC_RATE - [10:0] */
2529#define WM8994_AIF2DAC_RATE_WIDTH 11 /* AIF2DAC_RATE - [10:0] */
2530
2531/*
2532 * R790 (0x316) - AIF2DAC Data
2533 */
2534#define WM8994_AIF2DACL_DAT_INV 0x0002 /* AIF2DACL_DAT_INV */
2535#define WM8994_AIF2DACL_DAT_INV_MASK 0x0002 /* AIF2DACL_DAT_INV */
2536#define WM8994_AIF2DACL_DAT_INV_SHIFT 1 /* AIF2DACL_DAT_INV */
2537#define WM8994_AIF2DACL_DAT_INV_WIDTH 1 /* AIF2DACL_DAT_INV */
2538#define WM8994_AIF2DACR_DAT_INV 0x0001 /* AIF2DACR_DAT_INV */
2539#define WM8994_AIF2DACR_DAT_INV_MASK 0x0001 /* AIF2DACR_DAT_INV */
2540#define WM8994_AIF2DACR_DAT_INV_SHIFT 0 /* AIF2DACR_DAT_INV */
2541#define WM8994_AIF2DACR_DAT_INV_WIDTH 1 /* AIF2DACR_DAT_INV */
2542
2543/*
2544 * R791 (0x317) - AIF2ADC Data
2545 */
2546#define WM8994_AIF2ADCL_DAT_INV 0x0002 /* AIF2ADCL_DAT_INV */
2547#define WM8994_AIF2ADCL_DAT_INV_MASK 0x0002 /* AIF2ADCL_DAT_INV */
2548#define WM8994_AIF2ADCL_DAT_INV_SHIFT 1 /* AIF2ADCL_DAT_INV */
2549#define WM8994_AIF2ADCL_DAT_INV_WIDTH 1 /* AIF2ADCL_DAT_INV */
2550#define WM8994_AIF2ADCR_DAT_INV 0x0001 /* AIF2ADCR_DAT_INV */
2551#define WM8994_AIF2ADCR_DAT_INV_MASK 0x0001 /* AIF2ADCR_DAT_INV */
2552#define WM8994_AIF2ADCR_DAT_INV_SHIFT 0 /* AIF2ADCR_DAT_INV */
2553#define WM8994_AIF2ADCR_DAT_INV_WIDTH 1 /* AIF2ADCR_DAT_INV */
2554
2555/*
2556 * R1024 (0x400) - AIF1 ADC1 Left Volume
2557 */
2558#define WM8994_AIF1ADC1_VU 0x0100 /* AIF1ADC1_VU */
2559#define WM8994_AIF1ADC1_VU_MASK 0x0100 /* AIF1ADC1_VU */
2560#define WM8994_AIF1ADC1_VU_SHIFT 8 /* AIF1ADC1_VU */
2561#define WM8994_AIF1ADC1_VU_WIDTH 1 /* AIF1ADC1_VU */
2562#define WM8994_AIF1ADC1L_VOL_MASK 0x00FF /* AIF1ADC1L_VOL - [7:0] */
2563#define WM8994_AIF1ADC1L_VOL_SHIFT 0 /* AIF1ADC1L_VOL - [7:0] */
2564#define WM8994_AIF1ADC1L_VOL_WIDTH 8 /* AIF1ADC1L_VOL - [7:0] */
2565
2566/*
2567 * R1025 (0x401) - AIF1 ADC1 Right Volume
2568 */
2569#define WM8994_AIF1ADC1_VU 0x0100 /* AIF1ADC1_VU */
2570#define WM8994_AIF1ADC1_VU_MASK 0x0100 /* AIF1ADC1_VU */
2571#define WM8994_AIF1ADC1_VU_SHIFT 8 /* AIF1ADC1_VU */
2572#define WM8994_AIF1ADC1_VU_WIDTH 1 /* AIF1ADC1_VU */
2573#define WM8994_AIF1ADC1R_VOL_MASK 0x00FF /* AIF1ADC1R_VOL - [7:0] */
2574#define WM8994_AIF1ADC1R_VOL_SHIFT 0 /* AIF1ADC1R_VOL - [7:0] */
2575#define WM8994_AIF1ADC1R_VOL_WIDTH 8 /* AIF1ADC1R_VOL - [7:0] */
2576
2577/*
2578 * R1026 (0x402) - AIF1 DAC1 Left Volume
2579 */
2580#define WM8994_AIF1DAC1_VU 0x0100 /* AIF1DAC1_VU */
2581#define WM8994_AIF1DAC1_VU_MASK 0x0100 /* AIF1DAC1_VU */
2582#define WM8994_AIF1DAC1_VU_SHIFT 8 /* AIF1DAC1_VU */
2583#define WM8994_AIF1DAC1_VU_WIDTH 1 /* AIF1DAC1_VU */
2584#define WM8994_AIF1DAC1L_VOL_MASK 0x00FF /* AIF1DAC1L_VOL - [7:0] */
2585#define WM8994_AIF1DAC1L_VOL_SHIFT 0 /* AIF1DAC1L_VOL - [7:0] */
2586#define WM8994_AIF1DAC1L_VOL_WIDTH 8 /* AIF1DAC1L_VOL - [7:0] */
2587
2588/*
2589 * R1027 (0x403) - AIF1 DAC1 Right Volume
2590 */
2591#define WM8994_AIF1DAC1_VU 0x0100 /* AIF1DAC1_VU */
2592#define WM8994_AIF1DAC1_VU_MASK 0x0100 /* AIF1DAC1_VU */
2593#define WM8994_AIF1DAC1_VU_SHIFT 8 /* AIF1DAC1_VU */
2594#define WM8994_AIF1DAC1_VU_WIDTH 1 /* AIF1DAC1_VU */
2595#define WM8994_AIF1DAC1R_VOL_MASK 0x00FF /* AIF1DAC1R_VOL - [7:0] */
2596#define WM8994_AIF1DAC1R_VOL_SHIFT 0 /* AIF1DAC1R_VOL - [7:0] */
2597#define WM8994_AIF1DAC1R_VOL_WIDTH 8 /* AIF1DAC1R_VOL - [7:0] */
2598
2599/*
2600 * R1028 (0x404) - AIF1 ADC2 Left Volume
2601 */
2602#define WM8994_AIF1ADC2_VU 0x0100 /* AIF1ADC2_VU */
2603#define WM8994_AIF1ADC2_VU_MASK 0x0100 /* AIF1ADC2_VU */
2604#define WM8994_AIF1ADC2_VU_SHIFT 8 /* AIF1ADC2_VU */
2605#define WM8994_AIF1ADC2_VU_WIDTH 1 /* AIF1ADC2_VU */
2606#define WM8994_AIF1ADC2L_VOL_MASK 0x00FF /* AIF1ADC2L_VOL - [7:0] */
2607#define WM8994_AIF1ADC2L_VOL_SHIFT 0 /* AIF1ADC2L_VOL - [7:0] */
2608#define WM8994_AIF1ADC2L_VOL_WIDTH 8 /* AIF1ADC2L_VOL - [7:0] */
2609
2610/*
2611 * R1029 (0x405) - AIF1 ADC2 Right Volume
2612 */
2613#define WM8994_AIF1ADC2_VU 0x0100 /* AIF1ADC2_VU */
2614#define WM8994_AIF1ADC2_VU_MASK 0x0100 /* AIF1ADC2_VU */
2615#define WM8994_AIF1ADC2_VU_SHIFT 8 /* AIF1ADC2_VU */
2616#define WM8994_AIF1ADC2_VU_WIDTH 1 /* AIF1ADC2_VU */
2617#define WM8994_AIF1ADC2R_VOL_MASK 0x00FF /* AIF1ADC2R_VOL - [7:0] */
2618#define WM8994_AIF1ADC2R_VOL_SHIFT 0 /* AIF1ADC2R_VOL - [7:0] */
2619#define WM8994_AIF1ADC2R_VOL_WIDTH 8 /* AIF1ADC2R_VOL - [7:0] */
2620
2621/*
2622 * R1030 (0x406) - AIF1 DAC2 Left Volume
2623 */
2624#define WM8994_AIF1DAC2_VU 0x0100 /* AIF1DAC2_VU */
2625#define WM8994_AIF1DAC2_VU_MASK 0x0100 /* AIF1DAC2_VU */
2626#define WM8994_AIF1DAC2_VU_SHIFT 8 /* AIF1DAC2_VU */
2627#define WM8994_AIF1DAC2_VU_WIDTH 1 /* AIF1DAC2_VU */
2628#define WM8994_AIF1DAC2L_VOL_MASK 0x00FF /* AIF1DAC2L_VOL - [7:0] */
2629#define WM8994_AIF1DAC2L_VOL_SHIFT 0 /* AIF1DAC2L_VOL - [7:0] */
2630#define WM8994_AIF1DAC2L_VOL_WIDTH 8 /* AIF1DAC2L_VOL - [7:0] */
2631
2632/*
2633 * R1031 (0x407) - AIF1 DAC2 Right Volume
2634 */
2635#define WM8994_AIF1DAC2_VU 0x0100 /* AIF1DAC2_VU */
2636#define WM8994_AIF1DAC2_VU_MASK 0x0100 /* AIF1DAC2_VU */
2637#define WM8994_AIF1DAC2_VU_SHIFT 8 /* AIF1DAC2_VU */
2638#define WM8994_AIF1DAC2_VU_WIDTH 1 /* AIF1DAC2_VU */
2639#define WM8994_AIF1DAC2R_VOL_MASK 0x00FF /* AIF1DAC2R_VOL - [7:0] */
2640#define WM8994_AIF1DAC2R_VOL_SHIFT 0 /* AIF1DAC2R_VOL - [7:0] */
2641#define WM8994_AIF1DAC2R_VOL_WIDTH 8 /* AIF1DAC2R_VOL - [7:0] */
2642
2643/*
2644 * R1040 (0x410) - AIF1 ADC1 Filters
2645 */
2646#define WM8994_AIF1ADC_4FS 0x8000 /* AIF1ADC_4FS */
2647#define WM8994_AIF1ADC_4FS_MASK 0x8000 /* AIF1ADC_4FS */
2648#define WM8994_AIF1ADC_4FS_SHIFT 15 /* AIF1ADC_4FS */
2649#define WM8994_AIF1ADC_4FS_WIDTH 1 /* AIF1ADC_4FS */
2650#define WM8994_AIF1ADC1_HPF_CUT_MASK 0x6000 /* AIF1ADC1_HPF_CUT - [14:13] */
2651#define WM8994_AIF1ADC1_HPF_CUT_SHIFT 13 /* AIF1ADC1_HPF_CUT - [14:13] */
2652#define WM8994_AIF1ADC1_HPF_CUT_WIDTH 2 /* AIF1ADC1_HPF_CUT - [14:13] */
2653#define WM8994_AIF1ADC1L_HPF 0x1000 /* AIF1ADC1L_HPF */
2654#define WM8994_AIF1ADC1L_HPF_MASK 0x1000 /* AIF1ADC1L_HPF */
2655#define WM8994_AIF1ADC1L_HPF_SHIFT 12 /* AIF1ADC1L_HPF */
2656#define WM8994_AIF1ADC1L_HPF_WIDTH 1 /* AIF1ADC1L_HPF */
2657#define WM8994_AIF1ADC1R_HPF 0x0800 /* AIF1ADC1R_HPF */
2658#define WM8994_AIF1ADC1R_HPF_MASK 0x0800 /* AIF1ADC1R_HPF */
2659#define WM8994_AIF1ADC1R_HPF_SHIFT 11 /* AIF1ADC1R_HPF */
2660#define WM8994_AIF1ADC1R_HPF_WIDTH 1 /* AIF1ADC1R_HPF */
2661
2662/*
2663 * R1041 (0x411) - AIF1 ADC2 Filters
2664 */
2665#define WM8994_AIF1ADC2_HPF_CUT_MASK 0x6000 /* AIF1ADC2_HPF_CUT - [14:13] */
2666#define WM8994_AIF1ADC2_HPF_CUT_SHIFT 13 /* AIF1ADC2_HPF_CUT - [14:13] */
2667#define WM8994_AIF1ADC2_HPF_CUT_WIDTH 2 /* AIF1ADC2_HPF_CUT - [14:13] */
2668#define WM8994_AIF1ADC2L_HPF 0x1000 /* AIF1ADC2L_HPF */
2669#define WM8994_AIF1ADC2L_HPF_MASK 0x1000 /* AIF1ADC2L_HPF */
2670#define WM8994_AIF1ADC2L_HPF_SHIFT 12 /* AIF1ADC2L_HPF */
2671#define WM8994_AIF1ADC2L_HPF_WIDTH 1 /* AIF1ADC2L_HPF */
2672#define WM8994_AIF1ADC2R_HPF 0x0800 /* AIF1ADC2R_HPF */
2673#define WM8994_AIF1ADC2R_HPF_MASK 0x0800 /* AIF1ADC2R_HPF */
2674#define WM8994_AIF1ADC2R_HPF_SHIFT 11 /* AIF1ADC2R_HPF */
2675#define WM8994_AIF1ADC2R_HPF_WIDTH 1 /* AIF1ADC2R_HPF */
2676
2677/*
2678 * R1056 (0x420) - AIF1 DAC1 Filters (1)
2679 */
2680#define WM8994_AIF1DAC1_MUTE 0x0200 /* AIF1DAC1_MUTE */
2681#define WM8994_AIF1DAC1_MUTE_MASK 0x0200 /* AIF1DAC1_MUTE */
2682#define WM8994_AIF1DAC1_MUTE_SHIFT 9 /* AIF1DAC1_MUTE */
2683#define WM8994_AIF1DAC1_MUTE_WIDTH 1 /* AIF1DAC1_MUTE */
2684#define WM8994_AIF1DAC1_MONO 0x0080 /* AIF1DAC1_MONO */
2685#define WM8994_AIF1DAC1_MONO_MASK 0x0080 /* AIF1DAC1_MONO */
2686#define WM8994_AIF1DAC1_MONO_SHIFT 7 /* AIF1DAC1_MONO */
2687#define WM8994_AIF1DAC1_MONO_WIDTH 1 /* AIF1DAC1_MONO */
2688#define WM8994_AIF1DAC1_MUTERATE 0x0020 /* AIF1DAC1_MUTERATE */
2689#define WM8994_AIF1DAC1_MUTERATE_MASK 0x0020 /* AIF1DAC1_MUTERATE */
2690#define WM8994_AIF1DAC1_MUTERATE_SHIFT 5 /* AIF1DAC1_MUTERATE */
2691#define WM8994_AIF1DAC1_MUTERATE_WIDTH 1 /* AIF1DAC1_MUTERATE */
2692#define WM8994_AIF1DAC1_UNMUTE_RAMP 0x0010 /* AIF1DAC1_UNMUTE_RAMP */
2693#define WM8994_AIF1DAC1_UNMUTE_RAMP_MASK 0x0010 /* AIF1DAC1_UNMUTE_RAMP */
2694#define WM8994_AIF1DAC1_UNMUTE_RAMP_SHIFT 4 /* AIF1DAC1_UNMUTE_RAMP */
2695#define WM8994_AIF1DAC1_UNMUTE_RAMP_WIDTH 1 /* AIF1DAC1_UNMUTE_RAMP */
2696#define WM8994_AIF1DAC1_DEEMP_MASK 0x0006 /* AIF1DAC1_DEEMP - [2:1] */
2697#define WM8994_AIF1DAC1_DEEMP_SHIFT 1 /* AIF1DAC1_DEEMP - [2:1] */
2698#define WM8994_AIF1DAC1_DEEMP_WIDTH 2 /* AIF1DAC1_DEEMP - [2:1] */
2699
2700/*
2701 * R1057 (0x421) - AIF1 DAC1 Filters (2)
2702 */
2703#define WM8994_AIF1DAC1_3D_GAIN_MASK 0x3E00 /* AIF1DAC1_3D_GAIN - [13:9] */
2704#define WM8994_AIF1DAC1_3D_GAIN_SHIFT 9 /* AIF1DAC1_3D_GAIN - [13:9] */
2705#define WM8994_AIF1DAC1_3D_GAIN_WIDTH 5 /* AIF1DAC1_3D_GAIN - [13:9] */
2706#define WM8994_AIF1DAC1_3D_ENA 0x0100 /* AIF1DAC1_3D_ENA */
2707#define WM8994_AIF1DAC1_3D_ENA_MASK 0x0100 /* AIF1DAC1_3D_ENA */
2708#define WM8994_AIF1DAC1_3D_ENA_SHIFT 8 /* AIF1DAC1_3D_ENA */
2709#define WM8994_AIF1DAC1_3D_ENA_WIDTH 1 /* AIF1DAC1_3D_ENA */
2710
2711/*
2712 * R1058 (0x422) - AIF1 DAC2 Filters (1)
2713 */
2714#define WM8994_AIF1DAC2_MUTE 0x0200 /* AIF1DAC2_MUTE */
2715#define WM8994_AIF1DAC2_MUTE_MASK 0x0200 /* AIF1DAC2_MUTE */
2716#define WM8994_AIF1DAC2_MUTE_SHIFT 9 /* AIF1DAC2_MUTE */
2717#define WM8994_AIF1DAC2_MUTE_WIDTH 1 /* AIF1DAC2_MUTE */
2718#define WM8994_AIF1DAC2_MONO 0x0080 /* AIF1DAC2_MONO */
2719#define WM8994_AIF1DAC2_MONO_MASK 0x0080 /* AIF1DAC2_MONO */
2720#define WM8994_AIF1DAC2_MONO_SHIFT 7 /* AIF1DAC2_MONO */
2721#define WM8994_AIF1DAC2_MONO_WIDTH 1 /* AIF1DAC2_MONO */
2722#define WM8994_AIF1DAC2_MUTERATE 0x0020 /* AIF1DAC2_MUTERATE */
2723#define WM8994_AIF1DAC2_MUTERATE_MASK 0x0020 /* AIF1DAC2_MUTERATE */
2724#define WM8994_AIF1DAC2_MUTERATE_SHIFT 5 /* AIF1DAC2_MUTERATE */
2725#define WM8994_AIF1DAC2_MUTERATE_WIDTH 1 /* AIF1DAC2_MUTERATE */
2726#define WM8994_AIF1DAC2_UNMUTE_RAMP 0x0010 /* AIF1DAC2_UNMUTE_RAMP */
2727#define WM8994_AIF1DAC2_UNMUTE_RAMP_MASK 0x0010 /* AIF1DAC2_UNMUTE_RAMP */
2728#define WM8994_AIF1DAC2_UNMUTE_RAMP_SHIFT 4 /* AIF1DAC2_UNMUTE_RAMP */
2729#define WM8994_AIF1DAC2_UNMUTE_RAMP_WIDTH 1 /* AIF1DAC2_UNMUTE_RAMP */
2730#define WM8994_AIF1DAC2_DEEMP_MASK 0x0006 /* AIF1DAC2_DEEMP - [2:1] */
2731#define WM8994_AIF1DAC2_DEEMP_SHIFT 1 /* AIF1DAC2_DEEMP - [2:1] */
2732#define WM8994_AIF1DAC2_DEEMP_WIDTH 2 /* AIF1DAC2_DEEMP - [2:1] */
2733
2734/*
2735 * R1059 (0x423) - AIF1 DAC2 Filters (2)
2736 */
2737#define WM8994_AIF1DAC2_3D_GAIN_MASK 0x3E00 /* AIF1DAC2_3D_GAIN - [13:9] */
2738#define WM8994_AIF1DAC2_3D_GAIN_SHIFT 9 /* AIF1DAC2_3D_GAIN - [13:9] */
2739#define WM8994_AIF1DAC2_3D_GAIN_WIDTH 5 /* AIF1DAC2_3D_GAIN - [13:9] */
2740#define WM8994_AIF1DAC2_3D_ENA 0x0100 /* AIF1DAC2_3D_ENA */
2741#define WM8994_AIF1DAC2_3D_ENA_MASK 0x0100 /* AIF1DAC2_3D_ENA */
2742#define WM8994_AIF1DAC2_3D_ENA_SHIFT 8 /* AIF1DAC2_3D_ENA */
2743#define WM8994_AIF1DAC2_3D_ENA_WIDTH 1 /* AIF1DAC2_3D_ENA */
2744
2745/*
2746 * R1088 (0x440) - AIF1 DRC1 (1)
2747 */
2748#define WM8994_AIF1DRC1_SIG_DET_RMS_MASK 0xF800 /* AIF1DRC1_SIG_DET_RMS - [15:11] */
2749#define WM8994_AIF1DRC1_SIG_DET_RMS_SHIFT 11 /* AIF1DRC1_SIG_DET_RMS - [15:11] */
2750#define WM8994_AIF1DRC1_SIG_DET_RMS_WIDTH 5 /* AIF1DRC1_SIG_DET_RMS - [15:11] */
2751#define WM8994_AIF1DRC1_SIG_DET_PK_MASK 0x0600 /* AIF1DRC1_SIG_DET_PK - [10:9] */
2752#define WM8994_AIF1DRC1_SIG_DET_PK_SHIFT 9 /* AIF1DRC1_SIG_DET_PK - [10:9] */
2753#define WM8994_AIF1DRC1_SIG_DET_PK_WIDTH 2 /* AIF1DRC1_SIG_DET_PK - [10:9] */
2754#define WM8994_AIF1DRC1_NG_ENA 0x0100 /* AIF1DRC1_NG_ENA */
2755#define WM8994_AIF1DRC1_NG_ENA_MASK 0x0100 /* AIF1DRC1_NG_ENA */
2756#define WM8994_AIF1DRC1_NG_ENA_SHIFT 8 /* AIF1DRC1_NG_ENA */
2757#define WM8994_AIF1DRC1_NG_ENA_WIDTH 1 /* AIF1DRC1_NG_ENA */
2758#define WM8994_AIF1DRC1_SIG_DET_MODE 0x0080 /* AIF1DRC1_SIG_DET_MODE */
2759#define WM8994_AIF1DRC1_SIG_DET_MODE_MASK 0x0080 /* AIF1DRC1_SIG_DET_MODE */
2760#define WM8994_AIF1DRC1_SIG_DET_MODE_SHIFT 7 /* AIF1DRC1_SIG_DET_MODE */
2761#define WM8994_AIF1DRC1_SIG_DET_MODE_WIDTH 1 /* AIF1DRC1_SIG_DET_MODE */
2762#define WM8994_AIF1DRC1_SIG_DET 0x0040 /* AIF1DRC1_SIG_DET */
2763#define WM8994_AIF1DRC1_SIG_DET_MASK 0x0040 /* AIF1DRC1_SIG_DET */
2764#define WM8994_AIF1DRC1_SIG_DET_SHIFT 6 /* AIF1DRC1_SIG_DET */
2765#define WM8994_AIF1DRC1_SIG_DET_WIDTH 1 /* AIF1DRC1_SIG_DET */
2766#define WM8994_AIF1DRC1_KNEE2_OP_ENA 0x0020 /* AIF1DRC1_KNEE2_OP_ENA */
2767#define WM8994_AIF1DRC1_KNEE2_OP_ENA_MASK 0x0020 /* AIF1DRC1_KNEE2_OP_ENA */
2768#define WM8994_AIF1DRC1_KNEE2_OP_ENA_SHIFT 5 /* AIF1DRC1_KNEE2_OP_ENA */
2769#define WM8994_AIF1DRC1_KNEE2_OP_ENA_WIDTH 1 /* AIF1DRC1_KNEE2_OP_ENA */
2770#define WM8994_AIF1DRC1_QR 0x0010 /* AIF1DRC1_QR */
2771#define WM8994_AIF1DRC1_QR_MASK 0x0010 /* AIF1DRC1_QR */
2772#define WM8994_AIF1DRC1_QR_SHIFT 4 /* AIF1DRC1_QR */
2773#define WM8994_AIF1DRC1_QR_WIDTH 1 /* AIF1DRC1_QR */
2774#define WM8994_AIF1DRC1_ANTICLIP 0x0008 /* AIF1DRC1_ANTICLIP */
2775#define WM8994_AIF1DRC1_ANTICLIP_MASK 0x0008 /* AIF1DRC1_ANTICLIP */
2776#define WM8994_AIF1DRC1_ANTICLIP_SHIFT 3 /* AIF1DRC1_ANTICLIP */
2777#define WM8994_AIF1DRC1_ANTICLIP_WIDTH 1 /* AIF1DRC1_ANTICLIP */
2778#define WM8994_AIF1DAC1_DRC_ENA 0x0004 /* AIF1DAC1_DRC_ENA */
2779#define WM8994_AIF1DAC1_DRC_ENA_MASK 0x0004 /* AIF1DAC1_DRC_ENA */
2780#define WM8994_AIF1DAC1_DRC_ENA_SHIFT 2 /* AIF1DAC1_DRC_ENA */
2781#define WM8994_AIF1DAC1_DRC_ENA_WIDTH 1 /* AIF1DAC1_DRC_ENA */
2782#define WM8994_AIF1ADC1L_DRC_ENA 0x0002 /* AIF1ADC1L_DRC_ENA */
2783#define WM8994_AIF1ADC1L_DRC_ENA_MASK 0x0002 /* AIF1ADC1L_DRC_ENA */
2784#define WM8994_AIF1ADC1L_DRC_ENA_SHIFT 1 /* AIF1ADC1L_DRC_ENA */
2785#define WM8994_AIF1ADC1L_DRC_ENA_WIDTH 1 /* AIF1ADC1L_DRC_ENA */
2786#define WM8994_AIF1ADC1R_DRC_ENA 0x0001 /* AIF1ADC1R_DRC_ENA */
2787#define WM8994_AIF1ADC1R_DRC_ENA_MASK 0x0001 /* AIF1ADC1R_DRC_ENA */
2788#define WM8994_AIF1ADC1R_DRC_ENA_SHIFT 0 /* AIF1ADC1R_DRC_ENA */
2789#define WM8994_AIF1ADC1R_DRC_ENA_WIDTH 1 /* AIF1ADC1R_DRC_ENA */
2790
2791/*
2792 * R1089 (0x441) - AIF1 DRC1 (2)
2793 */
2794#define WM8994_AIF1DRC1_ATK_MASK 0x1E00 /* AIF1DRC1_ATK - [12:9] */
2795#define WM8994_AIF1DRC1_ATK_SHIFT 9 /* AIF1DRC1_ATK - [12:9] */
2796#define WM8994_AIF1DRC1_ATK_WIDTH 4 /* AIF1DRC1_ATK - [12:9] */
2797#define WM8994_AIF1DRC1_DCY_MASK 0x01E0 /* AIF1DRC1_DCY - [8:5] */
2798#define WM8994_AIF1DRC1_DCY_SHIFT 5 /* AIF1DRC1_DCY - [8:5] */
2799#define WM8994_AIF1DRC1_DCY_WIDTH 4 /* AIF1DRC1_DCY - [8:5] */
2800#define WM8994_AIF1DRC1_MINGAIN_MASK 0x001C /* AIF1DRC1_MINGAIN - [4:2] */
2801#define WM8994_AIF1DRC1_MINGAIN_SHIFT 2 /* AIF1DRC1_MINGAIN - [4:2] */
2802#define WM8994_AIF1DRC1_MINGAIN_WIDTH 3 /* AIF1DRC1_MINGAIN - [4:2] */
2803#define WM8994_AIF1DRC1_MAXGAIN_MASK 0x0003 /* AIF1DRC1_MAXGAIN - [1:0] */
2804#define WM8994_AIF1DRC1_MAXGAIN_SHIFT 0 /* AIF1DRC1_MAXGAIN - [1:0] */
2805#define WM8994_AIF1DRC1_MAXGAIN_WIDTH 2 /* AIF1DRC1_MAXGAIN - [1:0] */
2806
2807/*
2808 * R1090 (0x442) - AIF1 DRC1 (3)
2809 */
2810#define WM8994_AIF1DRC1_NG_MINGAIN_MASK 0xF000 /* AIF1DRC1_NG_MINGAIN - [15:12] */
2811#define WM8994_AIF1DRC1_NG_MINGAIN_SHIFT 12 /* AIF1DRC1_NG_MINGAIN - [15:12] */
2812#define WM8994_AIF1DRC1_NG_MINGAIN_WIDTH 4 /* AIF1DRC1_NG_MINGAIN - [15:12] */
2813#define WM8994_AIF1DRC1_NG_EXP_MASK 0x0C00 /* AIF1DRC1_NG_EXP - [11:10] */
2814#define WM8994_AIF1DRC1_NG_EXP_SHIFT 10 /* AIF1DRC1_NG_EXP - [11:10] */
2815#define WM8994_AIF1DRC1_NG_EXP_WIDTH 2 /* AIF1DRC1_NG_EXP - [11:10] */
2816#define WM8994_AIF1DRC1_QR_THR_MASK 0x0300 /* AIF1DRC1_QR_THR - [9:8] */
2817#define WM8994_AIF1DRC1_QR_THR_SHIFT 8 /* AIF1DRC1_QR_THR - [9:8] */
2818#define WM8994_AIF1DRC1_QR_THR_WIDTH 2 /* AIF1DRC1_QR_THR - [9:8] */
2819#define WM8994_AIF1DRC1_QR_DCY_MASK 0x00C0 /* AIF1DRC1_QR_DCY - [7:6] */
2820#define WM8994_AIF1DRC1_QR_DCY_SHIFT 6 /* AIF1DRC1_QR_DCY - [7:6] */
2821#define WM8994_AIF1DRC1_QR_DCY_WIDTH 2 /* AIF1DRC1_QR_DCY - [7:6] */
2822#define WM8994_AIF1DRC1_HI_COMP_MASK 0x0038 /* AIF1DRC1_HI_COMP - [5:3] */
2823#define WM8994_AIF1DRC1_HI_COMP_SHIFT 3 /* AIF1DRC1_HI_COMP - [5:3] */
2824#define WM8994_AIF1DRC1_HI_COMP_WIDTH 3 /* AIF1DRC1_HI_COMP - [5:3] */
2825#define WM8994_AIF1DRC1_LO_COMP_MASK 0x0007 /* AIF1DRC1_LO_COMP - [2:0] */
2826#define WM8994_AIF1DRC1_LO_COMP_SHIFT 0 /* AIF1DRC1_LO_COMP - [2:0] */
2827#define WM8994_AIF1DRC1_LO_COMP_WIDTH 3 /* AIF1DRC1_LO_COMP - [2:0] */
2828
2829/*
2830 * R1091 (0x443) - AIF1 DRC1 (4)
2831 */
2832#define WM8994_AIF1DRC1_KNEE_IP_MASK 0x07E0 /* AIF1DRC1_KNEE_IP - [10:5] */
2833#define WM8994_AIF1DRC1_KNEE_IP_SHIFT 5 /* AIF1DRC1_KNEE_IP - [10:5] */
2834#define WM8994_AIF1DRC1_KNEE_IP_WIDTH 6 /* AIF1DRC1_KNEE_IP - [10:5] */
2835#define WM8994_AIF1DRC1_KNEE_OP_MASK 0x001F /* AIF1DRC1_KNEE_OP - [4:0] */
2836#define WM8994_AIF1DRC1_KNEE_OP_SHIFT 0 /* AIF1DRC1_KNEE_OP - [4:0] */
2837#define WM8994_AIF1DRC1_KNEE_OP_WIDTH 5 /* AIF1DRC1_KNEE_OP - [4:0] */
2838
2839/*
2840 * R1092 (0x444) - AIF1 DRC1 (5)
2841 */
2842#define WM8994_AIF1DRC1_KNEE2_IP_MASK 0x03E0 /* AIF1DRC1_KNEE2_IP - [9:5] */
2843#define WM8994_AIF1DRC1_KNEE2_IP_SHIFT 5 /* AIF1DRC1_KNEE2_IP - [9:5] */
2844#define WM8994_AIF1DRC1_KNEE2_IP_WIDTH 5 /* AIF1DRC1_KNEE2_IP - [9:5] */
2845#define WM8994_AIF1DRC1_KNEE2_OP_MASK 0x001F /* AIF1DRC1_KNEE2_OP - [4:0] */
2846#define WM8994_AIF1DRC1_KNEE2_OP_SHIFT 0 /* AIF1DRC1_KNEE2_OP - [4:0] */
2847#define WM8994_AIF1DRC1_KNEE2_OP_WIDTH 5 /* AIF1DRC1_KNEE2_OP - [4:0] */
2848
2849/*
2850 * R1104 (0x450) - AIF1 DRC2 (1)
2851 */
2852#define WM8994_AIF1DRC2_SIG_DET_RMS_MASK 0xF800 /* AIF1DRC2_SIG_DET_RMS - [15:11] */
2853#define WM8994_AIF1DRC2_SIG_DET_RMS_SHIFT 11 /* AIF1DRC2_SIG_DET_RMS - [15:11] */
2854#define WM8994_AIF1DRC2_SIG_DET_RMS_WIDTH 5 /* AIF1DRC2_SIG_DET_RMS - [15:11] */
2855#define WM8994_AIF1DRC2_SIG_DET_PK_MASK 0x0600 /* AIF1DRC2_SIG_DET_PK - [10:9] */
2856#define WM8994_AIF1DRC2_SIG_DET_PK_SHIFT 9 /* AIF1DRC2_SIG_DET_PK - [10:9] */
2857#define WM8994_AIF1DRC2_SIG_DET_PK_WIDTH 2 /* AIF1DRC2_SIG_DET_PK - [10:9] */
2858#define WM8994_AIF1DRC2_NG_ENA 0x0100 /* AIF1DRC2_NG_ENA */
2859#define WM8994_AIF1DRC2_NG_ENA_MASK 0x0100 /* AIF1DRC2_NG_ENA */
2860#define WM8994_AIF1DRC2_NG_ENA_SHIFT 8 /* AIF1DRC2_NG_ENA */
2861#define WM8994_AIF1DRC2_NG_ENA_WIDTH 1 /* AIF1DRC2_NG_ENA */
2862#define WM8994_AIF1DRC2_SIG_DET_MODE 0x0080 /* AIF1DRC2_SIG_DET_MODE */
2863#define WM8994_AIF1DRC2_SIG_DET_MODE_MASK 0x0080 /* AIF1DRC2_SIG_DET_MODE */
2864#define WM8994_AIF1DRC2_SIG_DET_MODE_SHIFT 7 /* AIF1DRC2_SIG_DET_MODE */
2865#define WM8994_AIF1DRC2_SIG_DET_MODE_WIDTH 1 /* AIF1DRC2_SIG_DET_MODE */
2866#define WM8994_AIF1DRC2_SIG_DET 0x0040 /* AIF1DRC2_SIG_DET */
2867#define WM8994_AIF1DRC2_SIG_DET_MASK 0x0040 /* AIF1DRC2_SIG_DET */
2868#define WM8994_AIF1DRC2_SIG_DET_SHIFT 6 /* AIF1DRC2_SIG_DET */
2869#define WM8994_AIF1DRC2_SIG_DET_WIDTH 1 /* AIF1DRC2_SIG_DET */
2870#define WM8994_AIF1DRC2_KNEE2_OP_ENA 0x0020 /* AIF1DRC2_KNEE2_OP_ENA */
2871#define WM8994_AIF1DRC2_KNEE2_OP_ENA_MASK 0x0020 /* AIF1DRC2_KNEE2_OP_ENA */
2872#define WM8994_AIF1DRC2_KNEE2_OP_ENA_SHIFT 5 /* AIF1DRC2_KNEE2_OP_ENA */
2873#define WM8994_AIF1DRC2_KNEE2_OP_ENA_WIDTH 1 /* AIF1DRC2_KNEE2_OP_ENA */
2874#define WM8994_AIF1DRC2_QR 0x0010 /* AIF1DRC2_QR */
2875#define WM8994_AIF1DRC2_QR_MASK 0x0010 /* AIF1DRC2_QR */
2876#define WM8994_AIF1DRC2_QR_SHIFT 4 /* AIF1DRC2_QR */
2877#define WM8994_AIF1DRC2_QR_WIDTH 1 /* AIF1DRC2_QR */
2878#define WM8994_AIF1DRC2_ANTICLIP 0x0008 /* AIF1DRC2_ANTICLIP */
2879#define WM8994_AIF1DRC2_ANTICLIP_MASK 0x0008 /* AIF1DRC2_ANTICLIP */
2880#define WM8994_AIF1DRC2_ANTICLIP_SHIFT 3 /* AIF1DRC2_ANTICLIP */
2881#define WM8994_AIF1DRC2_ANTICLIP_WIDTH 1 /* AIF1DRC2_ANTICLIP */
2882#define WM8994_AIF1DAC2_DRC_ENA 0x0004 /* AIF1DAC2_DRC_ENA */
2883#define WM8994_AIF1DAC2_DRC_ENA_MASK 0x0004 /* AIF1DAC2_DRC_ENA */
2884#define WM8994_AIF1DAC2_DRC_ENA_SHIFT 2 /* AIF1DAC2_DRC_ENA */
2885#define WM8994_AIF1DAC2_DRC_ENA_WIDTH 1 /* AIF1DAC2_DRC_ENA */
2886#define WM8994_AIF1ADC2L_DRC_ENA 0x0002 /* AIF1ADC2L_DRC_ENA */
2887#define WM8994_AIF1ADC2L_DRC_ENA_MASK 0x0002 /* AIF1ADC2L_DRC_ENA */
2888#define WM8994_AIF1ADC2L_DRC_ENA_SHIFT 1 /* AIF1ADC2L_DRC_ENA */
2889#define WM8994_AIF1ADC2L_DRC_ENA_WIDTH 1 /* AIF1ADC2L_DRC_ENA */
2890#define WM8994_AIF1ADC2R_DRC_ENA 0x0001 /* AIF1ADC2R_DRC_ENA */
2891#define WM8994_AIF1ADC2R_DRC_ENA_MASK 0x0001 /* AIF1ADC2R_DRC_ENA */
2892#define WM8994_AIF1ADC2R_DRC_ENA_SHIFT 0 /* AIF1ADC2R_DRC_ENA */
2893#define WM8994_AIF1ADC2R_DRC_ENA_WIDTH 1 /* AIF1ADC2R_DRC_ENA */
2894
2895/*
2896 * R1105 (0x451) - AIF1 DRC2 (2)
2897 */
2898#define WM8994_AIF1DRC2_ATK_MASK 0x1E00 /* AIF1DRC2_ATK - [12:9] */
2899#define WM8994_AIF1DRC2_ATK_SHIFT 9 /* AIF1DRC2_ATK - [12:9] */
2900#define WM8994_AIF1DRC2_ATK_WIDTH 4 /* AIF1DRC2_ATK - [12:9] */
2901#define WM8994_AIF1DRC2_DCY_MASK 0x01E0 /* AIF1DRC2_DCY - [8:5] */
2902#define WM8994_AIF1DRC2_DCY_SHIFT 5 /* AIF1DRC2_DCY - [8:5] */
2903#define WM8994_AIF1DRC2_DCY_WIDTH 4 /* AIF1DRC2_DCY - [8:5] */
2904#define WM8994_AIF1DRC2_MINGAIN_MASK 0x001C /* AIF1DRC2_MINGAIN - [4:2] */
2905#define WM8994_AIF1DRC2_MINGAIN_SHIFT 2 /* AIF1DRC2_MINGAIN - [4:2] */
2906#define WM8994_AIF1DRC2_MINGAIN_WIDTH 3 /* AIF1DRC2_MINGAIN - [4:2] */
2907#define WM8994_AIF1DRC2_MAXGAIN_MASK 0x0003 /* AIF1DRC2_MAXGAIN - [1:0] */
2908#define WM8994_AIF1DRC2_MAXGAIN_SHIFT 0 /* AIF1DRC2_MAXGAIN - [1:0] */
2909#define WM8994_AIF1DRC2_MAXGAIN_WIDTH 2 /* AIF1DRC2_MAXGAIN - [1:0] */
2910
2911/*
2912 * R1106 (0x452) - AIF1 DRC2 (3)
2913 */
2914#define WM8994_AIF1DRC2_NG_MINGAIN_MASK 0xF000 /* AIF1DRC2_NG_MINGAIN - [15:12] */
2915#define WM8994_AIF1DRC2_NG_MINGAIN_SHIFT 12 /* AIF1DRC2_NG_MINGAIN - [15:12] */
2916#define WM8994_AIF1DRC2_NG_MINGAIN_WIDTH 4 /* AIF1DRC2_NG_MINGAIN - [15:12] */
2917#define WM8994_AIF1DRC2_NG_EXP_MASK 0x0C00 /* AIF1DRC2_NG_EXP - [11:10] */
2918#define WM8994_AIF1DRC2_NG_EXP_SHIFT 10 /* AIF1DRC2_NG_EXP - [11:10] */
2919#define WM8994_AIF1DRC2_NG_EXP_WIDTH 2 /* AIF1DRC2_NG_EXP - [11:10] */
2920#define WM8994_AIF1DRC2_QR_THR_MASK 0x0300 /* AIF1DRC2_QR_THR - [9:8] */
2921#define WM8994_AIF1DRC2_QR_THR_SHIFT 8 /* AIF1DRC2_QR_THR - [9:8] */
2922#define WM8994_AIF1DRC2_QR_THR_WIDTH 2 /* AIF1DRC2_QR_THR - [9:8] */
2923#define WM8994_AIF1DRC2_QR_DCY_MASK 0x00C0 /* AIF1DRC2_QR_DCY - [7:6] */
2924#define WM8994_AIF1DRC2_QR_DCY_SHIFT 6 /* AIF1DRC2_QR_DCY - [7:6] */
2925#define WM8994_AIF1DRC2_QR_DCY_WIDTH 2 /* AIF1DRC2_QR_DCY - [7:6] */
2926#define WM8994_AIF1DRC2_HI_COMP_MASK 0x0038 /* AIF1DRC2_HI_COMP - [5:3] */
2927#define WM8994_AIF1DRC2_HI_COMP_SHIFT 3 /* AIF1DRC2_HI_COMP - [5:3] */
2928#define WM8994_AIF1DRC2_HI_COMP_WIDTH 3 /* AIF1DRC2_HI_COMP - [5:3] */
2929#define WM8994_AIF1DRC2_LO_COMP_MASK 0x0007 /* AIF1DRC2_LO_COMP - [2:0] */
2930#define WM8994_AIF1DRC2_LO_COMP_SHIFT 0 /* AIF1DRC2_LO_COMP - [2:0] */
2931#define WM8994_AIF1DRC2_LO_COMP_WIDTH 3 /* AIF1DRC2_LO_COMP - [2:0] */
2932
2933/*
2934 * R1107 (0x453) - AIF1 DRC2 (4)
2935 */
2936#define WM8994_AIF1DRC2_KNEE_IP_MASK 0x07E0 /* AIF1DRC2_KNEE_IP - [10:5] */
2937#define WM8994_AIF1DRC2_KNEE_IP_SHIFT 5 /* AIF1DRC2_KNEE_IP - [10:5] */
2938#define WM8994_AIF1DRC2_KNEE_IP_WIDTH 6 /* AIF1DRC2_KNEE_IP - [10:5] */
2939#define WM8994_AIF1DRC2_KNEE_OP_MASK 0x001F /* AIF1DRC2_KNEE_OP - [4:0] */
2940#define WM8994_AIF1DRC2_KNEE_OP_SHIFT 0 /* AIF1DRC2_KNEE_OP - [4:0] */
2941#define WM8994_AIF1DRC2_KNEE_OP_WIDTH 5 /* AIF1DRC2_KNEE_OP - [4:0] */
2942
2943/*
2944 * R1108 (0x454) - AIF1 DRC2 (5)
2945 */
2946#define WM8994_AIF1DRC2_KNEE2_IP_MASK 0x03E0 /* AIF1DRC2_KNEE2_IP - [9:5] */
2947#define WM8994_AIF1DRC2_KNEE2_IP_SHIFT 5 /* AIF1DRC2_KNEE2_IP - [9:5] */
2948#define WM8994_AIF1DRC2_KNEE2_IP_WIDTH 5 /* AIF1DRC2_KNEE2_IP - [9:5] */
2949#define WM8994_AIF1DRC2_KNEE2_OP_MASK 0x001F /* AIF1DRC2_KNEE2_OP - [4:0] */
2950#define WM8994_AIF1DRC2_KNEE2_OP_SHIFT 0 /* AIF1DRC2_KNEE2_OP - [4:0] */
2951#define WM8994_AIF1DRC2_KNEE2_OP_WIDTH 5 /* AIF1DRC2_KNEE2_OP - [4:0] */
2952
2953/*
2954 * R1152 (0x480) - AIF1 DAC1 EQ Gains (1)
2955 */
2956#define WM8994_AIF1DAC1_EQ_B1_GAIN_MASK 0xF800 /* AIF1DAC1_EQ_B1_GAIN - [15:11] */
2957#define WM8994_AIF1DAC1_EQ_B1_GAIN_SHIFT 11 /* AIF1DAC1_EQ_B1_GAIN - [15:11] */
2958#define WM8994_AIF1DAC1_EQ_B1_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B1_GAIN - [15:11] */
2959#define WM8994_AIF1DAC1_EQ_B2_GAIN_MASK 0x07C0 /* AIF1DAC1_EQ_B2_GAIN - [10:6] */
2960#define WM8994_AIF1DAC1_EQ_B2_GAIN_SHIFT 6 /* AIF1DAC1_EQ_B2_GAIN - [10:6] */
2961#define WM8994_AIF1DAC1_EQ_B2_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B2_GAIN - [10:6] */
2962#define WM8994_AIF1DAC1_EQ_B3_GAIN_MASK 0x003E /* AIF1DAC1_EQ_B3_GAIN - [5:1] */
2963#define WM8994_AIF1DAC1_EQ_B3_GAIN_SHIFT 1 /* AIF1DAC1_EQ_B3_GAIN - [5:1] */
2964#define WM8994_AIF1DAC1_EQ_B3_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B3_GAIN - [5:1] */
2965#define WM8994_AIF1DAC1_EQ_ENA 0x0001 /* AIF1DAC1_EQ_ENA */
2966#define WM8994_AIF1DAC1_EQ_ENA_MASK 0x0001 /* AIF1DAC1_EQ_ENA */
2967#define WM8994_AIF1DAC1_EQ_ENA_SHIFT 0 /* AIF1DAC1_EQ_ENA */
2968#define WM8994_AIF1DAC1_EQ_ENA_WIDTH 1 /* AIF1DAC1_EQ_ENA */
2969
2970/*
2971 * R1153 (0x481) - AIF1 DAC1 EQ Gains (2)
2972 */
2973#define WM8994_AIF1DAC1_EQ_B4_GAIN_MASK 0xF800 /* AIF1DAC1_EQ_B4_GAIN - [15:11] */
2974#define WM8994_AIF1DAC1_EQ_B4_GAIN_SHIFT 11 /* AIF1DAC1_EQ_B4_GAIN - [15:11] */
2975#define WM8994_AIF1DAC1_EQ_B4_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B4_GAIN - [15:11] */
2976#define WM8994_AIF1DAC1_EQ_B5_GAIN_MASK 0x07C0 /* AIF1DAC1_EQ_B5_GAIN - [10:6] */
2977#define WM8994_AIF1DAC1_EQ_B5_GAIN_SHIFT 6 /* AIF1DAC1_EQ_B5_GAIN - [10:6] */
2978#define WM8994_AIF1DAC1_EQ_B5_GAIN_WIDTH 5 /* AIF1DAC1_EQ_B5_GAIN - [10:6] */
2979
2980/*
2981 * R1154 (0x482) - AIF1 DAC1 EQ Band 1 A
2982 */
2983#define WM8994_AIF1DAC1_EQ_B1_A_MASK 0xFFFF /* AIF1DAC1_EQ_B1_A - [15:0] */
2984#define WM8994_AIF1DAC1_EQ_B1_A_SHIFT 0 /* AIF1DAC1_EQ_B1_A - [15:0] */
2985#define WM8994_AIF1DAC1_EQ_B1_A_WIDTH 16 /* AIF1DAC1_EQ_B1_A - [15:0] */
2986
2987/*
2988 * R1155 (0x483) - AIF1 DAC1 EQ Band 1 B
2989 */
2990#define WM8994_AIF1DAC1_EQ_B1_B_MASK 0xFFFF /* AIF1DAC1_EQ_B1_B - [15:0] */
2991#define WM8994_AIF1DAC1_EQ_B1_B_SHIFT 0 /* AIF1DAC1_EQ_B1_B - [15:0] */
2992#define WM8994_AIF1DAC1_EQ_B1_B_WIDTH 16 /* AIF1DAC1_EQ_B1_B - [15:0] */
2993
2994/*
2995 * R1156 (0x484) - AIF1 DAC1 EQ Band 1 PG
2996 */
2997#define WM8994_AIF1DAC1_EQ_B1_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B1_PG - [15:0] */
2998#define WM8994_AIF1DAC1_EQ_B1_PG_SHIFT 0 /* AIF1DAC1_EQ_B1_PG - [15:0] */
2999#define WM8994_AIF1DAC1_EQ_B1_PG_WIDTH 16 /* AIF1DAC1_EQ_B1_PG - [15:0] */
3000
3001/*
3002 * R1157 (0x485) - AIF1 DAC1 EQ Band 2 A
3003 */
3004#define WM8994_AIF1DAC1_EQ_B2_A_MASK 0xFFFF /* AIF1DAC1_EQ_B2_A - [15:0] */
3005#define WM8994_AIF1DAC1_EQ_B2_A_SHIFT 0 /* AIF1DAC1_EQ_B2_A - [15:0] */
3006#define WM8994_AIF1DAC1_EQ_B2_A_WIDTH 16 /* AIF1DAC1_EQ_B2_A - [15:0] */
3007
3008/*
3009 * R1158 (0x486) - AIF1 DAC1 EQ Band 2 B
3010 */
3011#define WM8994_AIF1DAC1_EQ_B2_B_MASK 0xFFFF /* AIF1DAC1_EQ_B2_B - [15:0] */
3012#define WM8994_AIF1DAC1_EQ_B2_B_SHIFT 0 /* AIF1DAC1_EQ_B2_B - [15:0] */
3013#define WM8994_AIF1DAC1_EQ_B2_B_WIDTH 16 /* AIF1DAC1_EQ_B2_B - [15:0] */
3014
3015/*
3016 * R1159 (0x487) - AIF1 DAC1 EQ Band 2 C
3017 */
3018#define WM8994_AIF1DAC1_EQ_B2_C_MASK 0xFFFF /* AIF1DAC1_EQ_B2_C - [15:0] */
3019#define WM8994_AIF1DAC1_EQ_B2_C_SHIFT 0 /* AIF1DAC1_EQ_B2_C - [15:0] */
3020#define WM8994_AIF1DAC1_EQ_B2_C_WIDTH 16 /* AIF1DAC1_EQ_B2_C - [15:0] */
3021
3022/*
3023 * R1160 (0x488) - AIF1 DAC1 EQ Band 2 PG
3024 */
3025#define WM8994_AIF1DAC1_EQ_B2_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B2_PG - [15:0] */
3026#define WM8994_AIF1DAC1_EQ_B2_PG_SHIFT 0 /* AIF1DAC1_EQ_B2_PG - [15:0] */
3027#define WM8994_AIF1DAC1_EQ_B2_PG_WIDTH 16 /* AIF1DAC1_EQ_B2_PG - [15:0] */
3028
3029/*
3030 * R1161 (0x489) - AIF1 DAC1 EQ Band 3 A
3031 */
3032#define WM8994_AIF1DAC1_EQ_B3_A_MASK 0xFFFF /* AIF1DAC1_EQ_B3_A - [15:0] */
3033#define WM8994_AIF1DAC1_EQ_B3_A_SHIFT 0 /* AIF1DAC1_EQ_B3_A - [15:0] */
3034#define WM8994_AIF1DAC1_EQ_B3_A_WIDTH 16 /* AIF1DAC1_EQ_B3_A - [15:0] */
3035
3036/*
3037 * R1162 (0x48A) - AIF1 DAC1 EQ Band 3 B
3038 */
3039#define WM8994_AIF1DAC1_EQ_B3_B_MASK 0xFFFF /* AIF1DAC1_EQ_B3_B - [15:0] */
3040#define WM8994_AIF1DAC1_EQ_B3_B_SHIFT 0 /* AIF1DAC1_EQ_B3_B - [15:0] */
3041#define WM8994_AIF1DAC1_EQ_B3_B_WIDTH 16 /* AIF1DAC1_EQ_B3_B - [15:0] */
3042
3043/*
3044 * R1163 (0x48B) - AIF1 DAC1 EQ Band 3 C
3045 */
3046#define WM8994_AIF1DAC1_EQ_B3_C_MASK 0xFFFF /* AIF1DAC1_EQ_B3_C - [15:0] */
3047#define WM8994_AIF1DAC1_EQ_B3_C_SHIFT 0 /* AIF1DAC1_EQ_B3_C - [15:0] */
3048#define WM8994_AIF1DAC1_EQ_B3_C_WIDTH 16 /* AIF1DAC1_EQ_B3_C - [15:0] */
3049
3050/*
3051 * R1164 (0x48C) - AIF1 DAC1 EQ Band 3 PG
3052 */
3053#define WM8994_AIF1DAC1_EQ_B3_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B3_PG - [15:0] */
3054#define WM8994_AIF1DAC1_EQ_B3_PG_SHIFT 0 /* AIF1DAC1_EQ_B3_PG - [15:0] */
3055#define WM8994_AIF1DAC1_EQ_B3_PG_WIDTH 16 /* AIF1DAC1_EQ_B3_PG - [15:0] */
3056
3057/*
3058 * R1165 (0x48D) - AIF1 DAC1 EQ Band 4 A
3059 */
3060#define WM8994_AIF1DAC1_EQ_B4_A_MASK 0xFFFF /* AIF1DAC1_EQ_B4_A - [15:0] */
3061#define WM8994_AIF1DAC1_EQ_B4_A_SHIFT 0 /* AIF1DAC1_EQ_B4_A - [15:0] */
3062#define WM8994_AIF1DAC1_EQ_B4_A_WIDTH 16 /* AIF1DAC1_EQ_B4_A - [15:0] */
3063
3064/*
3065 * R1166 (0x48E) - AIF1 DAC1 EQ Band 4 B
3066 */
3067#define WM8994_AIF1DAC1_EQ_B4_B_MASK 0xFFFF /* AIF1DAC1_EQ_B4_B - [15:0] */
3068#define WM8994_AIF1DAC1_EQ_B4_B_SHIFT 0 /* AIF1DAC1_EQ_B4_B - [15:0] */
3069#define WM8994_AIF1DAC1_EQ_B4_B_WIDTH 16 /* AIF1DAC1_EQ_B4_B - [15:0] */
3070
3071/*
3072 * R1167 (0x48F) - AIF1 DAC1 EQ Band 4 C
3073 */
3074#define WM8994_AIF1DAC1_EQ_B4_C_MASK 0xFFFF /* AIF1DAC1_EQ_B4_C - [15:0] */
3075#define WM8994_AIF1DAC1_EQ_B4_C_SHIFT 0 /* AIF1DAC1_EQ_B4_C - [15:0] */
3076#define WM8994_AIF1DAC1_EQ_B4_C_WIDTH 16 /* AIF1DAC1_EQ_B4_C - [15:0] */
3077
3078/*
3079 * R1168 (0x490) - AIF1 DAC1 EQ Band 4 PG
3080 */
3081#define WM8994_AIF1DAC1_EQ_B4_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B4_PG - [15:0] */
3082#define WM8994_AIF1DAC1_EQ_B4_PG_SHIFT 0 /* AIF1DAC1_EQ_B4_PG - [15:0] */
3083#define WM8994_AIF1DAC1_EQ_B4_PG_WIDTH 16 /* AIF1DAC1_EQ_B4_PG - [15:0] */
3084
3085/*
3086 * R1169 (0x491) - AIF1 DAC1 EQ Band 5 A
3087 */
3088#define WM8994_AIF1DAC1_EQ_B5_A_MASK 0xFFFF /* AIF1DAC1_EQ_B5_A - [15:0] */
3089#define WM8994_AIF1DAC1_EQ_B5_A_SHIFT 0 /* AIF1DAC1_EQ_B5_A - [15:0] */
3090#define WM8994_AIF1DAC1_EQ_B5_A_WIDTH 16 /* AIF1DAC1_EQ_B5_A - [15:0] */
3091
3092/*
3093 * R1170 (0x492) - AIF1 DAC1 EQ Band 5 B
3094 */
3095#define WM8994_AIF1DAC1_EQ_B5_B_MASK 0xFFFF /* AIF1DAC1_EQ_B5_B - [15:0] */
3096#define WM8994_AIF1DAC1_EQ_B5_B_SHIFT 0 /* AIF1DAC1_EQ_B5_B - [15:0] */
3097#define WM8994_AIF1DAC1_EQ_B5_B_WIDTH 16 /* AIF1DAC1_EQ_B5_B - [15:0] */
3098
3099/*
3100 * R1171 (0x493) - AIF1 DAC1 EQ Band 5 PG
3101 */
3102#define WM8994_AIF1DAC1_EQ_B5_PG_MASK 0xFFFF /* AIF1DAC1_EQ_B5_PG - [15:0] */
3103#define WM8994_AIF1DAC1_EQ_B5_PG_SHIFT 0 /* AIF1DAC1_EQ_B5_PG - [15:0] */
3104#define WM8994_AIF1DAC1_EQ_B5_PG_WIDTH 16 /* AIF1DAC1_EQ_B5_PG - [15:0] */
3105
3106/*
3107 * R1184 (0x4A0) - AIF1 DAC2 EQ Gains (1)
3108 */
3109#define WM8994_AIF1DAC2_EQ_B1_GAIN_MASK 0xF800 /* AIF1DAC2_EQ_B1_GAIN - [15:11] */
3110#define WM8994_AIF1DAC2_EQ_B1_GAIN_SHIFT 11 /* AIF1DAC2_EQ_B1_GAIN - [15:11] */
3111#define WM8994_AIF1DAC2_EQ_B1_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B1_GAIN - [15:11] */
3112#define WM8994_AIF1DAC2_EQ_B2_GAIN_MASK 0x07C0 /* AIF1DAC2_EQ_B2_GAIN - [10:6] */
3113#define WM8994_AIF1DAC2_EQ_B2_GAIN_SHIFT 6 /* AIF1DAC2_EQ_B2_GAIN - [10:6] */
3114#define WM8994_AIF1DAC2_EQ_B2_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B2_GAIN - [10:6] */
3115#define WM8994_AIF1DAC2_EQ_B3_GAIN_MASK 0x003E /* AIF1DAC2_EQ_B3_GAIN - [5:1] */
3116#define WM8994_AIF1DAC2_EQ_B3_GAIN_SHIFT 1 /* AIF1DAC2_EQ_B3_GAIN - [5:1] */
3117#define WM8994_AIF1DAC2_EQ_B3_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B3_GAIN - [5:1] */
3118#define WM8994_AIF1DAC2_EQ_ENA 0x0001 /* AIF1DAC2_EQ_ENA */
3119#define WM8994_AIF1DAC2_EQ_ENA_MASK 0x0001 /* AIF1DAC2_EQ_ENA */
3120#define WM8994_AIF1DAC2_EQ_ENA_SHIFT 0 /* AIF1DAC2_EQ_ENA */
3121#define WM8994_AIF1DAC2_EQ_ENA_WIDTH 1 /* AIF1DAC2_EQ_ENA */
3122
3123/*
3124 * R1185 (0x4A1) - AIF1 DAC2 EQ Gains (2)
3125 */
3126#define WM8994_AIF1DAC2_EQ_B4_GAIN_MASK 0xF800 /* AIF1DAC2_EQ_B4_GAIN - [15:11] */
3127#define WM8994_AIF1DAC2_EQ_B4_GAIN_SHIFT 11 /* AIF1DAC2_EQ_B4_GAIN - [15:11] */
3128#define WM8994_AIF1DAC2_EQ_B4_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B4_GAIN - [15:11] */
3129#define WM8994_AIF1DAC2_EQ_B5_GAIN_MASK 0x07C0 /* AIF1DAC2_EQ_B5_GAIN - [10:6] */
3130#define WM8994_AIF1DAC2_EQ_B5_GAIN_SHIFT 6 /* AIF1DAC2_EQ_B5_GAIN - [10:6] */
3131#define WM8994_AIF1DAC2_EQ_B5_GAIN_WIDTH 5 /* AIF1DAC2_EQ_B5_GAIN - [10:6] */
3132
3133/*
3134 * R1186 (0x4A2) - AIF1 DAC2 EQ Band 1 A
3135 */
3136#define WM8994_AIF1DAC2_EQ_B1_A_MASK 0xFFFF /* AIF1DAC2_EQ_B1_A - [15:0] */
3137#define WM8994_AIF1DAC2_EQ_B1_A_SHIFT 0 /* AIF1DAC2_EQ_B1_A - [15:0] */
3138#define WM8994_AIF1DAC2_EQ_B1_A_WIDTH 16 /* AIF1DAC2_EQ_B1_A - [15:0] */
3139
3140/*
3141 * R1187 (0x4A3) - AIF1 DAC2 EQ Band 1 B
3142 */
3143#define WM8994_AIF1DAC2_EQ_B1_B_MASK 0xFFFF /* AIF1DAC2_EQ_B1_B - [15:0] */
3144#define WM8994_AIF1DAC2_EQ_B1_B_SHIFT 0 /* AIF1DAC2_EQ_B1_B - [15:0] */
3145#define WM8994_AIF1DAC2_EQ_B1_B_WIDTH 16 /* AIF1DAC2_EQ_B1_B - [15:0] */
3146
3147/*
3148 * R1188 (0x4A4) - AIF1 DAC2 EQ Band 1 PG
3149 */
3150#define WM8994_AIF1DAC2_EQ_B1_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B1_PG - [15:0] */
3151#define WM8994_AIF1DAC2_EQ_B1_PG_SHIFT 0 /* AIF1DAC2_EQ_B1_PG - [15:0] */
3152#define WM8994_AIF1DAC2_EQ_B1_PG_WIDTH 16 /* AIF1DAC2_EQ_B1_PG - [15:0] */
3153
3154/*
3155 * R1189 (0x4A5) - AIF1 DAC2 EQ Band 2 A
3156 */
3157#define WM8994_AIF1DAC2_EQ_B2_A_MASK 0xFFFF /* AIF1DAC2_EQ_B2_A - [15:0] */
3158#define WM8994_AIF1DAC2_EQ_B2_A_SHIFT 0 /* AIF1DAC2_EQ_B2_A - [15:0] */
3159#define WM8994_AIF1DAC2_EQ_B2_A_WIDTH 16 /* AIF1DAC2_EQ_B2_A - [15:0] */
3160
3161/*
3162 * R1190 (0x4A6) - AIF1 DAC2 EQ Band 2 B
3163 */
3164#define WM8994_AIF1DAC2_EQ_B2_B_MASK 0xFFFF /* AIF1DAC2_EQ_B2_B - [15:0] */
3165#define WM8994_AIF1DAC2_EQ_B2_B_SHIFT 0 /* AIF1DAC2_EQ_B2_B - [15:0] */
3166#define WM8994_AIF1DAC2_EQ_B2_B_WIDTH 16 /* AIF1DAC2_EQ_B2_B - [15:0] */
3167
3168/*
3169 * R1191 (0x4A7) - AIF1 DAC2 EQ Band 2 C
3170 */
3171#define WM8994_AIF1DAC2_EQ_B2_C_MASK 0xFFFF /* AIF1DAC2_EQ_B2_C - [15:0] */
3172#define WM8994_AIF1DAC2_EQ_B2_C_SHIFT 0 /* AIF1DAC2_EQ_B2_C - [15:0] */
3173#define WM8994_AIF1DAC2_EQ_B2_C_WIDTH 16 /* AIF1DAC2_EQ_B2_C - [15:0] */
3174
3175/*
3176 * R1192 (0x4A8) - AIF1 DAC2 EQ Band 2 PG
3177 */
3178#define WM8994_AIF1DAC2_EQ_B2_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B2_PG - [15:0] */
3179#define WM8994_AIF1DAC2_EQ_B2_PG_SHIFT 0 /* AIF1DAC2_EQ_B2_PG - [15:0] */
3180#define WM8994_AIF1DAC2_EQ_B2_PG_WIDTH 16 /* AIF1DAC2_EQ_B2_PG - [15:0] */
3181
3182/*
3183 * R1193 (0x4A9) - AIF1 DAC2 EQ Band 3 A
3184 */
3185#define WM8994_AIF1DAC2_EQ_B3_A_MASK 0xFFFF /* AIF1DAC2_EQ_B3_A - [15:0] */
3186#define WM8994_AIF1DAC2_EQ_B3_A_SHIFT 0 /* AIF1DAC2_EQ_B3_A - [15:0] */
3187#define WM8994_AIF1DAC2_EQ_B3_A_WIDTH 16 /* AIF1DAC2_EQ_B3_A - [15:0] */
3188
3189/*
3190 * R1194 (0x4AA) - AIF1 DAC2 EQ Band 3 B
3191 */
3192#define WM8994_AIF1DAC2_EQ_B3_B_MASK 0xFFFF /* AIF1DAC2_EQ_B3_B - [15:0] */
3193#define WM8994_AIF1DAC2_EQ_B3_B_SHIFT 0 /* AIF1DAC2_EQ_B3_B - [15:0] */
3194#define WM8994_AIF1DAC2_EQ_B3_B_WIDTH 16 /* AIF1DAC2_EQ_B3_B - [15:0] */
3195
3196/*
3197 * R1195 (0x4AB) - AIF1 DAC2 EQ Band 3 C
3198 */
3199#define WM8994_AIF1DAC2_EQ_B3_C_MASK 0xFFFF /* AIF1DAC2_EQ_B3_C - [15:0] */
3200#define WM8994_AIF1DAC2_EQ_B3_C_SHIFT 0 /* AIF1DAC2_EQ_B3_C - [15:0] */
3201#define WM8994_AIF1DAC2_EQ_B3_C_WIDTH 16 /* AIF1DAC2_EQ_B3_C - [15:0] */
3202
3203/*
3204 * R1196 (0x4AC) - AIF1 DAC2 EQ Band 3 PG
3205 */
3206#define WM8994_AIF1DAC2_EQ_B3_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B3_PG - [15:0] */
3207#define WM8994_AIF1DAC2_EQ_B3_PG_SHIFT 0 /* AIF1DAC2_EQ_B3_PG - [15:0] */
3208#define WM8994_AIF1DAC2_EQ_B3_PG_WIDTH 16 /* AIF1DAC2_EQ_B3_PG - [15:0] */
3209
3210/*
3211 * R1197 (0x4AD) - AIF1 DAC2 EQ Band 4 A
3212 */
3213#define WM8994_AIF1DAC2_EQ_B4_A_MASK 0xFFFF /* AIF1DAC2_EQ_B4_A - [15:0] */
3214#define WM8994_AIF1DAC2_EQ_B4_A_SHIFT 0 /* AIF1DAC2_EQ_B4_A - [15:0] */
3215#define WM8994_AIF1DAC2_EQ_B4_A_WIDTH 16 /* AIF1DAC2_EQ_B4_A - [15:0] */
3216
3217/*
3218 * R1198 (0x4AE) - AIF1 DAC2 EQ Band 4 B
3219 */
3220#define WM8994_AIF1DAC2_EQ_B4_B_MASK 0xFFFF /* AIF1DAC2_EQ_B4_B - [15:0] */
3221#define WM8994_AIF1DAC2_EQ_B4_B_SHIFT 0 /* AIF1DAC2_EQ_B4_B - [15:0] */
3222#define WM8994_AIF1DAC2_EQ_B4_B_WIDTH 16 /* AIF1DAC2_EQ_B4_B - [15:0] */
3223
3224/*
3225 * R1199 (0x4AF) - AIF1 DAC2 EQ Band 4 C
3226 */
3227#define WM8994_AIF1DAC2_EQ_B4_C_MASK 0xFFFF /* AIF1DAC2_EQ_B4_C - [15:0] */
3228#define WM8994_AIF1DAC2_EQ_B4_C_SHIFT 0 /* AIF1DAC2_EQ_B4_C - [15:0] */
3229#define WM8994_AIF1DAC2_EQ_B4_C_WIDTH 16 /* AIF1DAC2_EQ_B4_C - [15:0] */
3230
3231/*
3232 * R1200 (0x4B0) - AIF1 DAC2 EQ Band 4 PG
3233 */
3234#define WM8994_AIF1DAC2_EQ_B4_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B4_PG - [15:0] */
3235#define WM8994_AIF1DAC2_EQ_B4_PG_SHIFT 0 /* AIF1DAC2_EQ_B4_PG - [15:0] */
3236#define WM8994_AIF1DAC2_EQ_B4_PG_WIDTH 16 /* AIF1DAC2_EQ_B4_PG - [15:0] */
3237
3238/*
3239 * R1201 (0x4B1) - AIF1 DAC2 EQ Band 5 A
3240 */
3241#define WM8994_AIF1DAC2_EQ_B5_A_MASK 0xFFFF /* AIF1DAC2_EQ_B5_A - [15:0] */
3242#define WM8994_AIF1DAC2_EQ_B5_A_SHIFT 0 /* AIF1DAC2_EQ_B5_A - [15:0] */
3243#define WM8994_AIF1DAC2_EQ_B5_A_WIDTH 16 /* AIF1DAC2_EQ_B5_A - [15:0] */
3244
3245/*
3246 * R1202 (0x4B2) - AIF1 DAC2 EQ Band 5 B
3247 */
3248#define WM8994_AIF1DAC2_EQ_B5_B_MASK 0xFFFF /* AIF1DAC2_EQ_B5_B - [15:0] */
3249#define WM8994_AIF1DAC2_EQ_B5_B_SHIFT 0 /* AIF1DAC2_EQ_B5_B - [15:0] */
3250#define WM8994_AIF1DAC2_EQ_B5_B_WIDTH 16 /* AIF1DAC2_EQ_B5_B - [15:0] */
3251
3252/*
3253 * R1203 (0x4B3) - AIF1 DAC2 EQ Band 5 PG
3254 */
3255#define WM8994_AIF1DAC2_EQ_B5_PG_MASK 0xFFFF /* AIF1DAC2_EQ_B5_PG - [15:0] */
3256#define WM8994_AIF1DAC2_EQ_B5_PG_SHIFT 0 /* AIF1DAC2_EQ_B5_PG - [15:0] */
3257#define WM8994_AIF1DAC2_EQ_B5_PG_WIDTH 16 /* AIF1DAC2_EQ_B5_PG - [15:0] */
3258
3259/*
3260 * R1280 (0x500) - AIF2 ADC Left Volume
3261 */
3262#define WM8994_AIF2ADC_VU 0x0100 /* AIF2ADC_VU */
3263#define WM8994_AIF2ADC_VU_MASK 0x0100 /* AIF2ADC_VU */
3264#define WM8994_AIF2ADC_VU_SHIFT 8 /* AIF2ADC_VU */
3265#define WM8994_AIF2ADC_VU_WIDTH 1 /* AIF2ADC_VU */
3266#define WM8994_AIF2ADCL_VOL_MASK 0x00FF /* AIF2ADCL_VOL - [7:0] */
3267#define WM8994_AIF2ADCL_VOL_SHIFT 0 /* AIF2ADCL_VOL - [7:0] */
3268#define WM8994_AIF2ADCL_VOL_WIDTH 8 /* AIF2ADCL_VOL - [7:0] */
3269
3270/*
3271 * R1281 (0x501) - AIF2 ADC Right Volume
3272 */
3273#define WM8994_AIF2ADC_VU 0x0100 /* AIF2ADC_VU */
3274#define WM8994_AIF2ADC_VU_MASK 0x0100 /* AIF2ADC_VU */
3275#define WM8994_AIF2ADC_VU_SHIFT 8 /* AIF2ADC_VU */
3276#define WM8994_AIF2ADC_VU_WIDTH 1 /* AIF2ADC_VU */
3277#define WM8994_AIF2ADCR_VOL_MASK 0x00FF /* AIF2ADCR_VOL - [7:0] */
3278#define WM8994_AIF2ADCR_VOL_SHIFT 0 /* AIF2ADCR_VOL - [7:0] */
3279#define WM8994_AIF2ADCR_VOL_WIDTH 8 /* AIF2ADCR_VOL - [7:0] */
3280
3281/*
3282 * R1282 (0x502) - AIF2 DAC Left Volume
3283 */
3284#define WM8994_AIF2DAC_VU 0x0100 /* AIF2DAC_VU */
3285#define WM8994_AIF2DAC_VU_MASK 0x0100 /* AIF2DAC_VU */
3286#define WM8994_AIF2DAC_VU_SHIFT 8 /* AIF2DAC_VU */
3287#define WM8994_AIF2DAC_VU_WIDTH 1 /* AIF2DAC_VU */
3288#define WM8994_AIF2DACL_VOL_MASK 0x00FF /* AIF2DACL_VOL - [7:0] */
3289#define WM8994_AIF2DACL_VOL_SHIFT 0 /* AIF2DACL_VOL - [7:0] */
3290#define WM8994_AIF2DACL_VOL_WIDTH 8 /* AIF2DACL_VOL - [7:0] */
3291
3292/*
3293 * R1283 (0x503) - AIF2 DAC Right Volume
3294 */
3295#define WM8994_AIF2DAC_VU 0x0100 /* AIF2DAC_VU */
3296#define WM8994_AIF2DAC_VU_MASK 0x0100 /* AIF2DAC_VU */
3297#define WM8994_AIF2DAC_VU_SHIFT 8 /* AIF2DAC_VU */
3298#define WM8994_AIF2DAC_VU_WIDTH 1 /* AIF2DAC_VU */
3299#define WM8994_AIF2DACR_VOL_MASK 0x00FF /* AIF2DACR_VOL - [7:0] */
3300#define WM8994_AIF2DACR_VOL_SHIFT 0 /* AIF2DACR_VOL - [7:0] */
3301#define WM8994_AIF2DACR_VOL_WIDTH 8 /* AIF2DACR_VOL - [7:0] */
3302
3303/*
3304 * R1296 (0x510) - AIF2 ADC Filters
3305 */
3306#define WM8994_AIF2ADC_4FS 0x8000 /* AIF2ADC_4FS */
3307#define WM8994_AIF2ADC_4FS_MASK 0x8000 /* AIF2ADC_4FS */
3308#define WM8994_AIF2ADC_4FS_SHIFT 15 /* AIF2ADC_4FS */
3309#define WM8994_AIF2ADC_4FS_WIDTH 1 /* AIF2ADC_4FS */
3310#define WM8994_AIF2ADC_HPF_CUT_MASK 0x6000 /* AIF2ADC_HPF_CUT - [14:13] */
3311#define WM8994_AIF2ADC_HPF_CUT_SHIFT 13 /* AIF2ADC_HPF_CUT - [14:13] */
3312#define WM8994_AIF2ADC_HPF_CUT_WIDTH 2 /* AIF2ADC_HPF_CUT - [14:13] */
3313#define WM8994_AIF2ADCL_HPF 0x1000 /* AIF2ADCL_HPF */
3314#define WM8994_AIF2ADCL_HPF_MASK 0x1000 /* AIF2ADCL_HPF */
3315#define WM8994_AIF2ADCL_HPF_SHIFT 12 /* AIF2ADCL_HPF */
3316#define WM8994_AIF2ADCL_HPF_WIDTH 1 /* AIF2ADCL_HPF */
3317#define WM8994_AIF2ADCR_HPF 0x0800 /* AIF2ADCR_HPF */
3318#define WM8994_AIF2ADCR_HPF_MASK 0x0800 /* AIF2ADCR_HPF */
3319#define WM8994_AIF2ADCR_HPF_SHIFT 11 /* AIF2ADCR_HPF */
3320#define WM8994_AIF2ADCR_HPF_WIDTH 1 /* AIF2ADCR_HPF */
3321
3322/*
3323 * R1312 (0x520) - AIF2 DAC Filters (1)
3324 */
3325#define WM8994_AIF2DAC_MUTE 0x0200 /* AIF2DAC_MUTE */
3326#define WM8994_AIF2DAC_MUTE_MASK 0x0200 /* AIF2DAC_MUTE */
3327#define WM8994_AIF2DAC_MUTE_SHIFT 9 /* AIF2DAC_MUTE */
3328#define WM8994_AIF2DAC_MUTE_WIDTH 1 /* AIF2DAC_MUTE */
3329#define WM8994_AIF2DAC_MONO 0x0080 /* AIF2DAC_MONO */
3330#define WM8994_AIF2DAC_MONO_MASK 0x0080 /* AIF2DAC_MONO */
3331#define WM8994_AIF2DAC_MONO_SHIFT 7 /* AIF2DAC_MONO */
3332#define WM8994_AIF2DAC_MONO_WIDTH 1 /* AIF2DAC_MONO */
3333#define WM8994_AIF2DAC_MUTERATE 0x0020 /* AIF2DAC_MUTERATE */
3334#define WM8994_AIF2DAC_MUTERATE_MASK 0x0020 /* AIF2DAC_MUTERATE */
3335#define WM8994_AIF2DAC_MUTERATE_SHIFT 5 /* AIF2DAC_MUTERATE */
3336#define WM8994_AIF2DAC_MUTERATE_WIDTH 1 /* AIF2DAC_MUTERATE */
3337#define WM8994_AIF2DAC_UNMUTE_RAMP 0x0010 /* AIF2DAC_UNMUTE_RAMP */
3338#define WM8994_AIF2DAC_UNMUTE_RAMP_MASK 0x0010 /* AIF2DAC_UNMUTE_RAMP */
3339#define WM8994_AIF2DAC_UNMUTE_RAMP_SHIFT 4 /* AIF2DAC_UNMUTE_RAMP */
3340#define WM8994_AIF2DAC_UNMUTE_RAMP_WIDTH 1 /* AIF2DAC_UNMUTE_RAMP */
3341#define WM8994_AIF2DAC_DEEMP_MASK 0x0006 /* AIF2DAC_DEEMP - [2:1] */
3342#define WM8994_AIF2DAC_DEEMP_SHIFT 1 /* AIF2DAC_DEEMP - [2:1] */
3343#define WM8994_AIF2DAC_DEEMP_WIDTH 2 /* AIF2DAC_DEEMP - [2:1] */
3344
3345/*
3346 * R1313 (0x521) - AIF2 DAC Filters (2)
3347 */
3348#define WM8994_AIF2DAC_3D_GAIN_MASK 0x3E00 /* AIF2DAC_3D_GAIN - [13:9] */
3349#define WM8994_AIF2DAC_3D_GAIN_SHIFT 9 /* AIF2DAC_3D_GAIN - [13:9] */
3350#define WM8994_AIF2DAC_3D_GAIN_WIDTH 5 /* AIF2DAC_3D_GAIN - [13:9] */
3351#define WM8994_AIF2DAC_3D_ENA 0x0100 /* AIF2DAC_3D_ENA */
3352#define WM8994_AIF2DAC_3D_ENA_MASK 0x0100 /* AIF2DAC_3D_ENA */
3353#define WM8994_AIF2DAC_3D_ENA_SHIFT 8 /* AIF2DAC_3D_ENA */
3354#define WM8994_AIF2DAC_3D_ENA_WIDTH 1 /* AIF2DAC_3D_ENA */
3355
3356/*
3357 * R1344 (0x540) - AIF2 DRC (1)
3358 */
3359#define WM8994_AIF2DRC_SIG_DET_RMS_MASK 0xF800 /* AIF2DRC_SIG_DET_RMS - [15:11] */
3360#define WM8994_AIF2DRC_SIG_DET_RMS_SHIFT 11 /* AIF2DRC_SIG_DET_RMS - [15:11] */
3361#define WM8994_AIF2DRC_SIG_DET_RMS_WIDTH 5 /* AIF2DRC_SIG_DET_RMS - [15:11] */
3362#define WM8994_AIF2DRC_SIG_DET_PK_MASK 0x0600 /* AIF2DRC_SIG_DET_PK - [10:9] */
3363#define WM8994_AIF2DRC_SIG_DET_PK_SHIFT 9 /* AIF2DRC_SIG_DET_PK - [10:9] */
3364#define WM8994_AIF2DRC_SIG_DET_PK_WIDTH 2 /* AIF2DRC_SIG_DET_PK - [10:9] */
3365#define WM8994_AIF2DRC_NG_ENA 0x0100 /* AIF2DRC_NG_ENA */
3366#define WM8994_AIF2DRC_NG_ENA_MASK 0x0100 /* AIF2DRC_NG_ENA */
3367#define WM8994_AIF2DRC_NG_ENA_SHIFT 8 /* AIF2DRC_NG_ENA */
3368#define WM8994_AIF2DRC_NG_ENA_WIDTH 1 /* AIF2DRC_NG_ENA */
3369#define WM8994_AIF2DRC_SIG_DET_MODE 0x0080 /* AIF2DRC_SIG_DET_MODE */
3370#define WM8994_AIF2DRC_SIG_DET_MODE_MASK 0x0080 /* AIF2DRC_SIG_DET_MODE */
3371#define WM8994_AIF2DRC_SIG_DET_MODE_SHIFT 7 /* AIF2DRC_SIG_DET_MODE */
3372#define WM8994_AIF2DRC_SIG_DET_MODE_WIDTH 1 /* AIF2DRC_SIG_DET_MODE */
3373#define WM8994_AIF2DRC_SIG_DET 0x0040 /* AIF2DRC_SIG_DET */
3374#define WM8994_AIF2DRC_SIG_DET_MASK 0x0040 /* AIF2DRC_SIG_DET */
3375#define WM8994_AIF2DRC_SIG_DET_SHIFT 6 /* AIF2DRC_SIG_DET */
3376#define WM8994_AIF2DRC_SIG_DET_WIDTH 1 /* AIF2DRC_SIG_DET */
3377#define WM8994_AIF2DRC_KNEE2_OP_ENA 0x0020 /* AIF2DRC_KNEE2_OP_ENA */
3378#define WM8994_AIF2DRC_KNEE2_OP_ENA_MASK 0x0020 /* AIF2DRC_KNEE2_OP_ENA */
3379#define WM8994_AIF2DRC_KNEE2_OP_ENA_SHIFT 5 /* AIF2DRC_KNEE2_OP_ENA */
3380#define WM8994_AIF2DRC_KNEE2_OP_ENA_WIDTH 1 /* AIF2DRC_KNEE2_OP_ENA */
3381#define WM8994_AIF2DRC_QR 0x0010 /* AIF2DRC_QR */
3382#define WM8994_AIF2DRC_QR_MASK 0x0010 /* AIF2DRC_QR */
3383#define WM8994_AIF2DRC_QR_SHIFT 4 /* AIF2DRC_QR */
3384#define WM8994_AIF2DRC_QR_WIDTH 1 /* AIF2DRC_QR */
3385#define WM8994_AIF2DRC_ANTICLIP 0x0008 /* AIF2DRC_ANTICLIP */
3386#define WM8994_AIF2DRC_ANTICLIP_MASK 0x0008 /* AIF2DRC_ANTICLIP */
3387#define WM8994_AIF2DRC_ANTICLIP_SHIFT 3 /* AIF2DRC_ANTICLIP */
3388#define WM8994_AIF2DRC_ANTICLIP_WIDTH 1 /* AIF2DRC_ANTICLIP */
3389#define WM8994_AIF2DAC_DRC_ENA 0x0004 /* AIF2DAC_DRC_ENA */
3390#define WM8994_AIF2DAC_DRC_ENA_MASK 0x0004 /* AIF2DAC_DRC_ENA */
3391#define WM8994_AIF2DAC_DRC_ENA_SHIFT 2 /* AIF2DAC_DRC_ENA */
3392#define WM8994_AIF2DAC_DRC_ENA_WIDTH 1 /* AIF2DAC_DRC_ENA */
3393#define WM8994_AIF2ADCL_DRC_ENA 0x0002 /* AIF2ADCL_DRC_ENA */
3394#define WM8994_AIF2ADCL_DRC_ENA_MASK 0x0002 /* AIF2ADCL_DRC_ENA */
3395#define WM8994_AIF2ADCL_DRC_ENA_SHIFT 1 /* AIF2ADCL_DRC_ENA */
3396#define WM8994_AIF2ADCL_DRC_ENA_WIDTH 1 /* AIF2ADCL_DRC_ENA */
3397#define WM8994_AIF2ADCR_DRC_ENA 0x0001 /* AIF2ADCR_DRC_ENA */
3398#define WM8994_AIF2ADCR_DRC_ENA_MASK 0x0001 /* AIF2ADCR_DRC_ENA */
3399#define WM8994_AIF2ADCR_DRC_ENA_SHIFT 0 /* AIF2ADCR_DRC_ENA */
3400#define WM8994_AIF2ADCR_DRC_ENA_WIDTH 1 /* AIF2ADCR_DRC_ENA */
3401
3402/*
3403 * R1345 (0x541) - AIF2 DRC (2)
3404 */
3405#define WM8994_AIF2DRC_ATK_MASK 0x1E00 /* AIF2DRC_ATK - [12:9] */
3406#define WM8994_AIF2DRC_ATK_SHIFT 9 /* AIF2DRC_ATK - [12:9] */
3407#define WM8994_AIF2DRC_ATK_WIDTH 4 /* AIF2DRC_ATK - [12:9] */
3408#define WM8994_AIF2DRC_DCY_MASK 0x01E0 /* AIF2DRC_DCY - [8:5] */
3409#define WM8994_AIF2DRC_DCY_SHIFT 5 /* AIF2DRC_DCY - [8:5] */
3410#define WM8994_AIF2DRC_DCY_WIDTH 4 /* AIF2DRC_DCY - [8:5] */
3411#define WM8994_AIF2DRC_MINGAIN_MASK 0x001C /* AIF2DRC_MINGAIN - [4:2] */
3412#define WM8994_AIF2DRC_MINGAIN_SHIFT 2 /* AIF2DRC_MINGAIN - [4:2] */
3413#define WM8994_AIF2DRC_MINGAIN_WIDTH 3 /* AIF2DRC_MINGAIN - [4:2] */
3414#define WM8994_AIF2DRC_MAXGAIN_MASK 0x0003 /* AIF2DRC_MAXGAIN - [1:0] */
3415#define WM8994_AIF2DRC_MAXGAIN_SHIFT 0 /* AIF2DRC_MAXGAIN - [1:0] */
3416#define WM8994_AIF2DRC_MAXGAIN_WIDTH 2 /* AIF2DRC_MAXGAIN - [1:0] */
3417
3418/*
3419 * R1346 (0x542) - AIF2 DRC (3)
3420 */
3421#define WM8994_AIF2DRC_NG_MINGAIN_MASK 0xF000 /* AIF2DRC_NG_MINGAIN - [15:12] */
3422#define WM8994_AIF2DRC_NG_MINGAIN_SHIFT 12 /* AIF2DRC_NG_MINGAIN - [15:12] */
3423#define WM8994_AIF2DRC_NG_MINGAIN_WIDTH 4 /* AIF2DRC_NG_MINGAIN - [15:12] */
3424#define WM8994_AIF2DRC_NG_EXP_MASK 0x0C00 /* AIF2DRC_NG_EXP - [11:10] */
3425#define WM8994_AIF2DRC_NG_EXP_SHIFT 10 /* AIF2DRC_NG_EXP - [11:10] */
3426#define WM8994_AIF2DRC_NG_EXP_WIDTH 2 /* AIF2DRC_NG_EXP - [11:10] */
3427#define WM8994_AIF2DRC_QR_THR_MASK 0x0300 /* AIF2DRC_QR_THR - [9:8] */
3428#define WM8994_AIF2DRC_QR_THR_SHIFT 8 /* AIF2DRC_QR_THR - [9:8] */
3429#define WM8994_AIF2DRC_QR_THR_WIDTH 2 /* AIF2DRC_QR_THR - [9:8] */
3430#define WM8994_AIF2DRC_QR_DCY_MASK 0x00C0 /* AIF2DRC_QR_DCY - [7:6] */
3431#define WM8994_AIF2DRC_QR_DCY_SHIFT 6 /* AIF2DRC_QR_DCY - [7:6] */
3432#define WM8994_AIF2DRC_QR_DCY_WIDTH 2 /* AIF2DRC_QR_DCY - [7:6] */
3433#define WM8994_AIF2DRC_HI_COMP_MASK 0x0038 /* AIF2DRC_HI_COMP - [5:3] */
3434#define WM8994_AIF2DRC_HI_COMP_SHIFT 3 /* AIF2DRC_HI_COMP - [5:3] */
3435#define WM8994_AIF2DRC_HI_COMP_WIDTH 3 /* AIF2DRC_HI_COMP - [5:3] */
3436#define WM8994_AIF2DRC_LO_COMP_MASK 0x0007 /* AIF2DRC_LO_COMP - [2:0] */
3437#define WM8994_AIF2DRC_LO_COMP_SHIFT 0 /* AIF2DRC_LO_COMP - [2:0] */
3438#define WM8994_AIF2DRC_LO_COMP_WIDTH 3 /* AIF2DRC_LO_COMP - [2:0] */
3439
3440/*
3441 * R1347 (0x543) - AIF2 DRC (4)
3442 */
3443#define WM8994_AIF2DRC_KNEE_IP_MASK 0x07E0 /* AIF2DRC_KNEE_IP - [10:5] */
3444#define WM8994_AIF2DRC_KNEE_IP_SHIFT 5 /* AIF2DRC_KNEE_IP - [10:5] */
3445#define WM8994_AIF2DRC_KNEE_IP_WIDTH 6 /* AIF2DRC_KNEE_IP - [10:5] */
3446#define WM8994_AIF2DRC_KNEE_OP_MASK 0x001F /* AIF2DRC_KNEE_OP - [4:0] */
3447#define WM8994_AIF2DRC_KNEE_OP_SHIFT 0 /* AIF2DRC_KNEE_OP - [4:0] */
3448#define WM8994_AIF2DRC_KNEE_OP_WIDTH 5 /* AIF2DRC_KNEE_OP - [4:0] */
3449
3450/*
3451 * R1348 (0x544) - AIF2 DRC (5)
3452 */
3453#define WM8994_AIF2DRC_KNEE2_IP_MASK 0x03E0 /* AIF2DRC_KNEE2_IP - [9:5] */
3454#define WM8994_AIF2DRC_KNEE2_IP_SHIFT 5 /* AIF2DRC_KNEE2_IP - [9:5] */
3455#define WM8994_AIF2DRC_KNEE2_IP_WIDTH 5 /* AIF2DRC_KNEE2_IP - [9:5] */
3456#define WM8994_AIF2DRC_KNEE2_OP_MASK 0x001F /* AIF2DRC_KNEE2_OP - [4:0] */
3457#define WM8994_AIF2DRC_KNEE2_OP_SHIFT 0 /* AIF2DRC_KNEE2_OP - [4:0] */
3458#define WM8994_AIF2DRC_KNEE2_OP_WIDTH 5 /* AIF2DRC_KNEE2_OP - [4:0] */
3459
3460/*
3461 * R1408 (0x580) - AIF2 EQ Gains (1)
3462 */
3463#define WM8994_AIF2DAC_EQ_B1_GAIN_MASK 0xF800 /* AIF2DAC_EQ_B1_GAIN - [15:11] */
3464#define WM8994_AIF2DAC_EQ_B1_GAIN_SHIFT 11 /* AIF2DAC_EQ_B1_GAIN - [15:11] */
3465#define WM8994_AIF2DAC_EQ_B1_GAIN_WIDTH 5 /* AIF2DAC_EQ_B1_GAIN - [15:11] */
3466#define WM8994_AIF2DAC_EQ_B2_GAIN_MASK 0x07C0 /* AIF2DAC_EQ_B2_GAIN - [10:6] */
3467#define WM8994_AIF2DAC_EQ_B2_GAIN_SHIFT 6 /* AIF2DAC_EQ_B2_GAIN - [10:6] */
3468#define WM8994_AIF2DAC_EQ_B2_GAIN_WIDTH 5 /* AIF2DAC_EQ_B2_GAIN - [10:6] */
3469#define WM8994_AIF2DAC_EQ_B3_GAIN_MASK 0x003E /* AIF2DAC_EQ_B3_GAIN - [5:1] */
3470#define WM8994_AIF2DAC_EQ_B3_GAIN_SHIFT 1 /* AIF2DAC_EQ_B3_GAIN - [5:1] */
3471#define WM8994_AIF2DAC_EQ_B3_GAIN_WIDTH 5 /* AIF2DAC_EQ_B3_GAIN - [5:1] */
3472#define WM8994_AIF2DAC_EQ_ENA 0x0001 /* AIF2DAC_EQ_ENA */
3473#define WM8994_AIF2DAC_EQ_ENA_MASK 0x0001 /* AIF2DAC_EQ_ENA */
3474#define WM8994_AIF2DAC_EQ_ENA_SHIFT 0 /* AIF2DAC_EQ_ENA */
3475#define WM8994_AIF2DAC_EQ_ENA_WIDTH 1 /* AIF2DAC_EQ_ENA */
3476
3477/*
3478 * R1409 (0x581) - AIF2 EQ Gains (2)
3479 */
3480#define WM8994_AIF2DAC_EQ_B4_GAIN_MASK 0xF800 /* AIF2DAC_EQ_B4_GAIN - [15:11] */
3481#define WM8994_AIF2DAC_EQ_B4_GAIN_SHIFT 11 /* AIF2DAC_EQ_B4_GAIN - [15:11] */
3482#define WM8994_AIF2DAC_EQ_B4_GAIN_WIDTH 5 /* AIF2DAC_EQ_B4_GAIN - [15:11] */
3483#define WM8994_AIF2DAC_EQ_B5_GAIN_MASK 0x07C0 /* AIF2DAC_EQ_B5_GAIN - [10:6] */
3484#define WM8994_AIF2DAC_EQ_B5_GAIN_SHIFT 6 /* AIF2DAC_EQ_B5_GAIN - [10:6] */
3485#define WM8994_AIF2DAC_EQ_B5_GAIN_WIDTH 5 /* AIF2DAC_EQ_B5_GAIN - [10:6] */
3486
3487/*
3488 * R1410 (0x582) - AIF2 EQ Band 1 A
3489 */
3490#define WM8994_AIF2DAC_EQ_B1_A_MASK 0xFFFF /* AIF2DAC_EQ_B1_A - [15:0] */
3491#define WM8994_AIF2DAC_EQ_B1_A_SHIFT 0 /* AIF2DAC_EQ_B1_A - [15:0] */
3492#define WM8994_AIF2DAC_EQ_B1_A_WIDTH 16 /* AIF2DAC_EQ_B1_A - [15:0] */
3493
3494/*
3495 * R1411 (0x583) - AIF2 EQ Band 1 B
3496 */
3497#define WM8994_AIF2DAC_EQ_B1_B_MASK 0xFFFF /* AIF2DAC_EQ_B1_B - [15:0] */
3498#define WM8994_AIF2DAC_EQ_B1_B_SHIFT 0 /* AIF2DAC_EQ_B1_B - [15:0] */
3499#define WM8994_AIF2DAC_EQ_B1_B_WIDTH 16 /* AIF2DAC_EQ_B1_B - [15:0] */
3500
3501/*
3502 * R1412 (0x584) - AIF2 EQ Band 1 PG
3503 */
3504#define WM8994_AIF2DAC_EQ_B1_PG_MASK 0xFFFF /* AIF2DAC_EQ_B1_PG - [15:0] */
3505#define WM8994_AIF2DAC_EQ_B1_PG_SHIFT 0 /* AIF2DAC_EQ_B1_PG - [15:0] */
3506#define WM8994_AIF2DAC_EQ_B1_PG_WIDTH 16 /* AIF2DAC_EQ_B1_PG - [15:0] */
3507
3508/*
3509 * R1413 (0x585) - AIF2 EQ Band 2 A
3510 */
3511#define WM8994_AIF2DAC_EQ_B2_A_MASK 0xFFFF /* AIF2DAC_EQ_B2_A - [15:0] */
3512#define WM8994_AIF2DAC_EQ_B2_A_SHIFT 0 /* AIF2DAC_EQ_B2_A - [15:0] */
3513#define WM8994_AIF2DAC_EQ_B2_A_WIDTH 16 /* AIF2DAC_EQ_B2_A - [15:0] */
3514
3515/*
3516 * R1414 (0x586) - AIF2 EQ Band 2 B
3517 */
3518#define WM8994_AIF2DAC_EQ_B2_B_MASK 0xFFFF /* AIF2DAC_EQ_B2_B - [15:0] */
3519#define WM8994_AIF2DAC_EQ_B2_B_SHIFT 0 /* AIF2DAC_EQ_B2_B - [15:0] */
3520#define WM8994_AIF2DAC_EQ_B2_B_WIDTH 16 /* AIF2DAC_EQ_B2_B - [15:0] */
3521
3522/*
3523 * R1415 (0x587) - AIF2 EQ Band 2 C
3524 */
3525#define WM8994_AIF2DAC_EQ_B2_C_MASK 0xFFFF /* AIF2DAC_EQ_B2_C - [15:0] */
3526#define WM8994_AIF2DAC_EQ_B2_C_SHIFT 0 /* AIF2DAC_EQ_B2_C - [15:0] */
3527#define WM8994_AIF2DAC_EQ_B2_C_WIDTH 16 /* AIF2DAC_EQ_B2_C - [15:0] */
3528
3529/*
3530 * R1416 (0x588) - AIF2 EQ Band 2 PG
3531 */
3532#define WM8994_AIF2DAC_EQ_B2_PG_MASK 0xFFFF /* AIF2DAC_EQ_B2_PG - [15:0] */
3533#define WM8994_AIF2DAC_EQ_B2_PG_SHIFT 0 /* AIF2DAC_EQ_B2_PG - [15:0] */
3534#define WM8994_AIF2DAC_EQ_B2_PG_WIDTH 16 /* AIF2DAC_EQ_B2_PG - [15:0] */
3535
3536/*
3537 * R1417 (0x589) - AIF2 EQ Band 3 A
3538 */
3539#define WM8994_AIF2DAC_EQ_B3_A_MASK 0xFFFF /* AIF2DAC_EQ_B3_A - [15:0] */
3540#define WM8994_AIF2DAC_EQ_B3_A_SHIFT 0 /* AIF2DAC_EQ_B3_A - [15:0] */
3541#define WM8994_AIF2DAC_EQ_B3_A_WIDTH 16 /* AIF2DAC_EQ_B3_A - [15:0] */
3542
3543/*
3544 * R1418 (0x58A) - AIF2 EQ Band 3 B
3545 */
3546#define WM8994_AIF2DAC_EQ_B3_B_MASK 0xFFFF /* AIF2DAC_EQ_B3_B - [15:0] */
3547#define WM8994_AIF2DAC_EQ_B3_B_SHIFT 0 /* AIF2DAC_EQ_B3_B - [15:0] */
3548#define WM8994_AIF2DAC_EQ_B3_B_WIDTH 16 /* AIF2DAC_EQ_B3_B - [15:0] */
3549
3550/*
3551 * R1419 (0x58B) - AIF2 EQ Band 3 C
3552 */
3553#define WM8994_AIF2DAC_EQ_B3_C_MASK 0xFFFF /* AIF2DAC_EQ_B3_C - [15:0] */
3554#define WM8994_AIF2DAC_EQ_B3_C_SHIFT 0 /* AIF2DAC_EQ_B3_C - [15:0] */
3555#define WM8994_AIF2DAC_EQ_B3_C_WIDTH 16 /* AIF2DAC_EQ_B3_C - [15:0] */
3556
3557/*
3558 * R1420 (0x58C) - AIF2 EQ Band 3 PG
3559 */
3560#define WM8994_AIF2DAC_EQ_B3_PG_MASK 0xFFFF /* AIF2DAC_EQ_B3_PG - [15:0] */
3561#define WM8994_AIF2DAC_EQ_B3_PG_SHIFT 0 /* AIF2DAC_EQ_B3_PG - [15:0] */
3562#define WM8994_AIF2DAC_EQ_B3_PG_WIDTH 16 /* AIF2DAC_EQ_B3_PG - [15:0] */
3563
3564/*
3565 * R1421 (0x58D) - AIF2 EQ Band 4 A
3566 */
3567#define WM8994_AIF2DAC_EQ_B4_A_MASK 0xFFFF /* AIF2DAC_EQ_B4_A - [15:0] */
3568#define WM8994_AIF2DAC_EQ_B4_A_SHIFT 0 /* AIF2DAC_EQ_B4_A - [15:0] */
3569#define WM8994_AIF2DAC_EQ_B4_A_WIDTH 16 /* AIF2DAC_EQ_B4_A - [15:0] */
3570
3571/*
3572 * R1422 (0x58E) - AIF2 EQ Band 4 B
3573 */
3574#define WM8994_AIF2DAC_EQ_B4_B_MASK 0xFFFF /* AIF2DAC_EQ_B4_B - [15:0] */
3575#define WM8994_AIF2DAC_EQ_B4_B_SHIFT 0 /* AIF2DAC_EQ_B4_B - [15:0] */
3576#define WM8994_AIF2DAC_EQ_B4_B_WIDTH 16 /* AIF2DAC_EQ_B4_B - [15:0] */
3577
3578/*
3579 * R1423 (0x58F) - AIF2 EQ Band 4 C
3580 */
3581#define WM8994_AIF2DAC_EQ_B4_C_MASK 0xFFFF /* AIF2DAC_EQ_B4_C - [15:0] */
3582#define WM8994_AIF2DAC_EQ_B4_C_SHIFT 0 /* AIF2DAC_EQ_B4_C - [15:0] */
3583#define WM8994_AIF2DAC_EQ_B4_C_WIDTH 16 /* AIF2DAC_EQ_B4_C - [15:0] */
3584
3585/*
3586 * R1424 (0x590) - AIF2 EQ Band 4 PG
3587 */
3588#define WM8994_AIF2DAC_EQ_B4_PG_MASK 0xFFFF /* AIF2DAC_EQ_B4_PG - [15:0] */
3589#define WM8994_AIF2DAC_EQ_B4_PG_SHIFT 0 /* AIF2DAC_EQ_B4_PG - [15:0] */
3590#define WM8994_AIF2DAC_EQ_B4_PG_WIDTH 16 /* AIF2DAC_EQ_B4_PG - [15:0] */
3591
3592/*
3593 * R1425 (0x591) - AIF2 EQ Band 5 A
3594 */
3595#define WM8994_AIF2DAC_EQ_B5_A_MASK 0xFFFF /* AIF2DAC_EQ_B5_A - [15:0] */
3596#define WM8994_AIF2DAC_EQ_B5_A_SHIFT 0 /* AIF2DAC_EQ_B5_A - [15:0] */
3597#define WM8994_AIF2DAC_EQ_B5_A_WIDTH 16 /* AIF2DAC_EQ_B5_A - [15:0] */
3598
3599/*
3600 * R1426 (0x592) - AIF2 EQ Band 5 B
3601 */
3602#define WM8994_AIF2DAC_EQ_B5_B_MASK 0xFFFF /* AIF2DAC_EQ_B5_B - [15:0] */
3603#define WM8994_AIF2DAC_EQ_B5_B_SHIFT 0 /* AIF2DAC_EQ_B5_B - [15:0] */
3604#define WM8994_AIF2DAC_EQ_B5_B_WIDTH 16 /* AIF2DAC_EQ_B5_B - [15:0] */
3605
3606/*
3607 * R1427 (0x593) - AIF2 EQ Band 5 PG
3608 */
3609#define WM8994_AIF2DAC_EQ_B5_PG_MASK 0xFFFF /* AIF2DAC_EQ_B5_PG - [15:0] */
3610#define WM8994_AIF2DAC_EQ_B5_PG_SHIFT 0 /* AIF2DAC_EQ_B5_PG - [15:0] */
3611#define WM8994_AIF2DAC_EQ_B5_PG_WIDTH 16 /* AIF2DAC_EQ_B5_PG - [15:0] */
3612
3613/*
3614 * R1536 (0x600) - DAC1 Mixer Volumes
3615 */
3616#define WM8994_ADCR_DAC1_VOL_MASK 0x01E0 /* ADCR_DAC1_VOL - [8:5] */
3617#define WM8994_ADCR_DAC1_VOL_SHIFT 5 /* ADCR_DAC1_VOL - [8:5] */
3618#define WM8994_ADCR_DAC1_VOL_WIDTH 4 /* ADCR_DAC1_VOL - [8:5] */
3619#define WM8994_ADCL_DAC1_VOL_MASK 0x000F /* ADCL_DAC1_VOL - [3:0] */
3620#define WM8994_ADCL_DAC1_VOL_SHIFT 0 /* ADCL_DAC1_VOL - [3:0] */
3621#define WM8994_ADCL_DAC1_VOL_WIDTH 4 /* ADCL_DAC1_VOL - [3:0] */
3622
3623/*
3624 * R1537 (0x601) - DAC1 Left Mixer Routing
3625 */
3626#define WM8994_ADCR_TO_DAC1L 0x0020 /* ADCR_TO_DAC1L */
3627#define WM8994_ADCR_TO_DAC1L_MASK 0x0020 /* ADCR_TO_DAC1L */
3628#define WM8994_ADCR_TO_DAC1L_SHIFT 5 /* ADCR_TO_DAC1L */
3629#define WM8994_ADCR_TO_DAC1L_WIDTH 1 /* ADCR_TO_DAC1L */
3630#define WM8994_ADCL_TO_DAC1L 0x0010 /* ADCL_TO_DAC1L */
3631#define WM8994_ADCL_TO_DAC1L_MASK 0x0010 /* ADCL_TO_DAC1L */
3632#define WM8994_ADCL_TO_DAC1L_SHIFT 4 /* ADCL_TO_DAC1L */
3633#define WM8994_ADCL_TO_DAC1L_WIDTH 1 /* ADCL_TO_DAC1L */
3634#define WM8994_AIF2DACL_TO_DAC1L 0x0004 /* AIF2DACL_TO_DAC1L */
3635#define WM8994_AIF2DACL_TO_DAC1L_MASK 0x0004 /* AIF2DACL_TO_DAC1L */
3636#define WM8994_AIF2DACL_TO_DAC1L_SHIFT 2 /* AIF2DACL_TO_DAC1L */
3637#define WM8994_AIF2DACL_TO_DAC1L_WIDTH 1 /* AIF2DACL_TO_DAC1L */
3638#define WM8994_AIF1DAC2L_TO_DAC1L 0x0002 /* AIF1DAC2L_TO_DAC1L */
3639#define WM8994_AIF1DAC2L_TO_DAC1L_MASK 0x0002 /* AIF1DAC2L_TO_DAC1L */
3640#define WM8994_AIF1DAC2L_TO_DAC1L_SHIFT 1 /* AIF1DAC2L_TO_DAC1L */
3641#define WM8994_AIF1DAC2L_TO_DAC1L_WIDTH 1 /* AIF1DAC2L_TO_DAC1L */
3642#define WM8994_AIF1DAC1L_TO_DAC1L 0x0001 /* AIF1DAC1L_TO_DAC1L */
3643#define WM8994_AIF1DAC1L_TO_DAC1L_MASK 0x0001 /* AIF1DAC1L_TO_DAC1L */
3644#define WM8994_AIF1DAC1L_TO_DAC1L_SHIFT 0 /* AIF1DAC1L_TO_DAC1L */
3645#define WM8994_AIF1DAC1L_TO_DAC1L_WIDTH 1 /* AIF1DAC1L_TO_DAC1L */
3646
3647/*
3648 * R1538 (0x602) - DAC1 Right Mixer Routing
3649 */
3650#define WM8994_ADCR_TO_DAC1R 0x0020 /* ADCR_TO_DAC1R */
3651#define WM8994_ADCR_TO_DAC1R_MASK 0x0020 /* ADCR_TO_DAC1R */
3652#define WM8994_ADCR_TO_DAC1R_SHIFT 5 /* ADCR_TO_DAC1R */
3653#define WM8994_ADCR_TO_DAC1R_WIDTH 1 /* ADCR_TO_DAC1R */
3654#define WM8994_ADCL_TO_DAC1R 0x0010 /* ADCL_TO_DAC1R */
3655#define WM8994_ADCL_TO_DAC1R_MASK 0x0010 /* ADCL_TO_DAC1R */
3656#define WM8994_ADCL_TO_DAC1R_SHIFT 4 /* ADCL_TO_DAC1R */
3657#define WM8994_ADCL_TO_DAC1R_WIDTH 1 /* ADCL_TO_DAC1R */
3658#define WM8994_AIF2DACR_TO_DAC1R 0x0004 /* AIF2DACR_TO_DAC1R */
3659#define WM8994_AIF2DACR_TO_DAC1R_MASK 0x0004 /* AIF2DACR_TO_DAC1R */
3660#define WM8994_AIF2DACR_TO_DAC1R_SHIFT 2 /* AIF2DACR_TO_DAC1R */
3661#define WM8994_AIF2DACR_TO_DAC1R_WIDTH 1 /* AIF2DACR_TO_DAC1R */
3662#define WM8994_AIF1DAC2R_TO_DAC1R 0x0002 /* AIF1DAC2R_TO_DAC1R */
3663#define WM8994_AIF1DAC2R_TO_DAC1R_MASK 0x0002 /* AIF1DAC2R_TO_DAC1R */
3664#define WM8994_AIF1DAC2R_TO_DAC1R_SHIFT 1 /* AIF1DAC2R_TO_DAC1R */
3665#define WM8994_AIF1DAC2R_TO_DAC1R_WIDTH 1 /* AIF1DAC2R_TO_DAC1R */
3666#define WM8994_AIF1DAC1R_TO_DAC1R 0x0001 /* AIF1DAC1R_TO_DAC1R */
3667#define WM8994_AIF1DAC1R_TO_DAC1R_MASK 0x0001 /* AIF1DAC1R_TO_DAC1R */
3668#define WM8994_AIF1DAC1R_TO_DAC1R_SHIFT 0 /* AIF1DAC1R_TO_DAC1R */
3669#define WM8994_AIF1DAC1R_TO_DAC1R_WIDTH 1 /* AIF1DAC1R_TO_DAC1R */
3670
3671/*
3672 * R1539 (0x603) - DAC2 Mixer Volumes
3673 */
3674#define WM8994_ADCR_DAC2_VOL_MASK 0x01E0 /* ADCR_DAC2_VOL - [8:5] */
3675#define WM8994_ADCR_DAC2_VOL_SHIFT 5 /* ADCR_DAC2_VOL - [8:5] */
3676#define WM8994_ADCR_DAC2_VOL_WIDTH 4 /* ADCR_DAC2_VOL - [8:5] */
3677#define WM8994_ADCL_DAC2_VOL_MASK 0x000F /* ADCL_DAC2_VOL - [3:0] */
3678#define WM8994_ADCL_DAC2_VOL_SHIFT 0 /* ADCL_DAC2_VOL - [3:0] */
3679#define WM8994_ADCL_DAC2_VOL_WIDTH 4 /* ADCL_DAC2_VOL - [3:0] */
3680
3681/*
3682 * R1540 (0x604) - DAC2 Left Mixer Routing
3683 */
3684#define WM8994_ADCR_TO_DAC2L 0x0020 /* ADCR_TO_DAC2L */
3685#define WM8994_ADCR_TO_DAC2L_MASK 0x0020 /* ADCR_TO_DAC2L */
3686#define WM8994_ADCR_TO_DAC2L_SHIFT 5 /* ADCR_TO_DAC2L */
3687#define WM8994_ADCR_TO_DAC2L_WIDTH 1 /* ADCR_TO_DAC2L */
3688#define WM8994_ADCL_TO_DAC2L 0x0010 /* ADCL_TO_DAC2L */
3689#define WM8994_ADCL_TO_DAC2L_MASK 0x0010 /* ADCL_TO_DAC2L */
3690#define WM8994_ADCL_TO_DAC2L_SHIFT 4 /* ADCL_TO_DAC2L */
3691#define WM8994_ADCL_TO_DAC2L_WIDTH 1 /* ADCL_TO_DAC2L */
3692#define WM8994_AIF2DACL_TO_DAC2L 0x0004 /* AIF2DACL_TO_DAC2L */
3693#define WM8994_AIF2DACL_TO_DAC2L_MASK 0x0004 /* AIF2DACL_TO_DAC2L */
3694#define WM8994_AIF2DACL_TO_DAC2L_SHIFT 2 /* AIF2DACL_TO_DAC2L */
3695#define WM8994_AIF2DACL_TO_DAC2L_WIDTH 1 /* AIF2DACL_TO_DAC2L */
3696#define WM8994_AIF1DAC2L_TO_DAC2L 0x0002 /* AIF1DAC2L_TO_DAC2L */
3697#define WM8994_AIF1DAC2L_TO_DAC2L_MASK 0x0002 /* AIF1DAC2L_TO_DAC2L */
3698#define WM8994_AIF1DAC2L_TO_DAC2L_SHIFT 1 /* AIF1DAC2L_TO_DAC2L */
3699#define WM8994_AIF1DAC2L_TO_DAC2L_WIDTH 1 /* AIF1DAC2L_TO_DAC2L */
3700#define WM8994_AIF1DAC1L_TO_DAC2L 0x0001 /* AIF1DAC1L_TO_DAC2L */
3701#define WM8994_AIF1DAC1L_TO_DAC2L_MASK 0x0001 /* AIF1DAC1L_TO_DAC2L */
3702#define WM8994_AIF1DAC1L_TO_DAC2L_SHIFT 0 /* AIF1DAC1L_TO_DAC2L */
3703#define WM8994_AIF1DAC1L_TO_DAC2L_WIDTH 1 /* AIF1DAC1L_TO_DAC2L */
3704
3705/*
3706 * R1541 (0x605) - DAC2 Right Mixer Routing
3707 */
3708#define WM8994_ADCR_TO_DAC2R 0x0020 /* ADCR_TO_DAC2R */
3709#define WM8994_ADCR_TO_DAC2R_MASK 0x0020 /* ADCR_TO_DAC2R */
3710#define WM8994_ADCR_TO_DAC2R_SHIFT 5 /* ADCR_TO_DAC2R */
3711#define WM8994_ADCR_TO_DAC2R_WIDTH 1 /* ADCR_TO_DAC2R */
3712#define WM8994_ADCL_TO_DAC2R 0x0010 /* ADCL_TO_DAC2R */
3713#define WM8994_ADCL_TO_DAC2R_MASK 0x0010 /* ADCL_TO_DAC2R */
3714#define WM8994_ADCL_TO_DAC2R_SHIFT 4 /* ADCL_TO_DAC2R */
3715#define WM8994_ADCL_TO_DAC2R_WIDTH 1 /* ADCL_TO_DAC2R */
3716#define WM8994_AIF2DACR_TO_DAC2R 0x0004 /* AIF2DACR_TO_DAC2R */
3717#define WM8994_AIF2DACR_TO_DAC2R_MASK 0x0004 /* AIF2DACR_TO_DAC2R */
3718#define WM8994_AIF2DACR_TO_DAC2R_SHIFT 2 /* AIF2DACR_TO_DAC2R */
3719#define WM8994_AIF2DACR_TO_DAC2R_WIDTH 1 /* AIF2DACR_TO_DAC2R */
3720#define WM8994_AIF1DAC2R_TO_DAC2R 0x0002 /* AIF1DAC2R_TO_DAC2R */
3721#define WM8994_AIF1DAC2R_TO_DAC2R_MASK 0x0002 /* AIF1DAC2R_TO_DAC2R */
3722#define WM8994_AIF1DAC2R_TO_DAC2R_SHIFT 1 /* AIF1DAC2R_TO_DAC2R */
3723#define WM8994_AIF1DAC2R_TO_DAC2R_WIDTH 1 /* AIF1DAC2R_TO_DAC2R */
3724#define WM8994_AIF1DAC1R_TO_DAC2R 0x0001 /* AIF1DAC1R_TO_DAC2R */
3725#define WM8994_AIF1DAC1R_TO_DAC2R_MASK 0x0001 /* AIF1DAC1R_TO_DAC2R */
3726#define WM8994_AIF1DAC1R_TO_DAC2R_SHIFT 0 /* AIF1DAC1R_TO_DAC2R */
3727#define WM8994_AIF1DAC1R_TO_DAC2R_WIDTH 1 /* AIF1DAC1R_TO_DAC2R */
3728
3729/*
3730 * R1542 (0x606) - AIF1 ADC1 Left Mixer Routing
3731 */
3732#define WM8994_ADC1L_TO_AIF1ADC1L 0x0002 /* ADC1L_TO_AIF1ADC1L */
3733#define WM8994_ADC1L_TO_AIF1ADC1L_MASK 0x0002 /* ADC1L_TO_AIF1ADC1L */
3734#define WM8994_ADC1L_TO_AIF1ADC1L_SHIFT 1 /* ADC1L_TO_AIF1ADC1L */
3735#define WM8994_ADC1L_TO_AIF1ADC1L_WIDTH 1 /* ADC1L_TO_AIF1ADC1L */
3736#define WM8994_AIF2DACL_TO_AIF1ADC1L 0x0001 /* AIF2DACL_TO_AIF1ADC1L */
3737#define WM8994_AIF2DACL_TO_AIF1ADC1L_MASK 0x0001 /* AIF2DACL_TO_AIF1ADC1L */
3738#define WM8994_AIF2DACL_TO_AIF1ADC1L_SHIFT 0 /* AIF2DACL_TO_AIF1ADC1L */
3739#define WM8994_AIF2DACL_TO_AIF1ADC1L_WIDTH 1 /* AIF2DACL_TO_AIF1ADC1L */
3740
3741/*
3742 * R1543 (0x607) - AIF1 ADC1 Right Mixer Routing
3743 */
3744#define WM8994_ADC1R_TO_AIF1ADC1R 0x0002 /* ADC1R_TO_AIF1ADC1R */
3745#define WM8994_ADC1R_TO_AIF1ADC1R_MASK 0x0002 /* ADC1R_TO_AIF1ADC1R */
3746#define WM8994_ADC1R_TO_AIF1ADC1R_SHIFT 1 /* ADC1R_TO_AIF1ADC1R */
3747#define WM8994_ADC1R_TO_AIF1ADC1R_WIDTH 1 /* ADC1R_TO_AIF1ADC1R */
3748#define WM8994_AIF2DACR_TO_AIF1ADC1R 0x0001 /* AIF2DACR_TO_AIF1ADC1R */
3749#define WM8994_AIF2DACR_TO_AIF1ADC1R_MASK 0x0001 /* AIF2DACR_TO_AIF1ADC1R */
3750#define WM8994_AIF2DACR_TO_AIF1ADC1R_SHIFT 0 /* AIF2DACR_TO_AIF1ADC1R */
3751#define WM8994_AIF2DACR_TO_AIF1ADC1R_WIDTH 1 /* AIF2DACR_TO_AIF1ADC1R */
3752
3753/*
3754 * R1544 (0x608) - AIF1 ADC2 Left Mixer Routing
3755 */
3756#define WM8994_ADC2L_TO_AIF1ADC2L 0x0002 /* ADC2L_TO_AIF1ADC2L */
3757#define WM8994_ADC2L_TO_AIF1ADC2L_MASK 0x0002 /* ADC2L_TO_AIF1ADC2L */
3758#define WM8994_ADC2L_TO_AIF1ADC2L_SHIFT 1 /* ADC2L_TO_AIF1ADC2L */
3759#define WM8994_ADC2L_TO_AIF1ADC2L_WIDTH 1 /* ADC2L_TO_AIF1ADC2L */
3760#define WM8994_AIF2DACL_TO_AIF1ADC2L 0x0001 /* AIF2DACL_TO_AIF1ADC2L */
3761#define WM8994_AIF2DACL_TO_AIF1ADC2L_MASK 0x0001 /* AIF2DACL_TO_AIF1ADC2L */
3762#define WM8994_AIF2DACL_TO_AIF1ADC2L_SHIFT 0 /* AIF2DACL_TO_AIF1ADC2L */
3763#define WM8994_AIF2DACL_TO_AIF1ADC2L_WIDTH 1 /* AIF2DACL_TO_AIF1ADC2L */
3764
3765/*
3766 * R1545 (0x609) - AIF1 ADC2 Right mixer Routing
3767 */
3768#define WM8994_ADC2R_TO_AIF1ADC2R 0x0002 /* ADC2R_TO_AIF1ADC2R */
3769#define WM8994_ADC2R_TO_AIF1ADC2R_MASK 0x0002 /* ADC2R_TO_AIF1ADC2R */
3770#define WM8994_ADC2R_TO_AIF1ADC2R_SHIFT 1 /* ADC2R_TO_AIF1ADC2R */
3771#define WM8994_ADC2R_TO_AIF1ADC2R_WIDTH 1 /* ADC2R_TO_AIF1ADC2R */
3772#define WM8994_AIF2DACR_TO_AIF1ADC2R 0x0001 /* AIF2DACR_TO_AIF1ADC2R */
3773#define WM8994_AIF2DACR_TO_AIF1ADC2R_MASK 0x0001 /* AIF2DACR_TO_AIF1ADC2R */
3774#define WM8994_AIF2DACR_TO_AIF1ADC2R_SHIFT 0 /* AIF2DACR_TO_AIF1ADC2R */
3775#define WM8994_AIF2DACR_TO_AIF1ADC2R_WIDTH 1 /* AIF2DACR_TO_AIF1ADC2R */
3776
3777/*
3778 * R1552 (0x610) - DAC1 Left Volume
3779 */
3780#define WM8994_DAC1L_MUTE 0x0200 /* DAC1L_MUTE */
3781#define WM8994_DAC1L_MUTE_MASK 0x0200 /* DAC1L_MUTE */
3782#define WM8994_DAC1L_MUTE_SHIFT 9 /* DAC1L_MUTE */
3783#define WM8994_DAC1L_MUTE_WIDTH 1 /* DAC1L_MUTE */
3784#define WM8994_DAC1_VU 0x0100 /* DAC1_VU */
3785#define WM8994_DAC1_VU_MASK 0x0100 /* DAC1_VU */
3786#define WM8994_DAC1_VU_SHIFT 8 /* DAC1_VU */
3787#define WM8994_DAC1_VU_WIDTH 1 /* DAC1_VU */
3788#define WM8994_DAC1L_VOL_MASK 0x00FF /* DAC1L_VOL - [7:0] */
3789#define WM8994_DAC1L_VOL_SHIFT 0 /* DAC1L_VOL - [7:0] */
3790#define WM8994_DAC1L_VOL_WIDTH 8 /* DAC1L_VOL - [7:0] */
3791
3792/*
3793 * R1553 (0x611) - DAC1 Right Volume
3794 */
3795#define WM8994_DAC1R_MUTE 0x0200 /* DAC1R_MUTE */
3796#define WM8994_DAC1R_MUTE_MASK 0x0200 /* DAC1R_MUTE */
3797#define WM8994_DAC1R_MUTE_SHIFT 9 /* DAC1R_MUTE */
3798#define WM8994_DAC1R_MUTE_WIDTH 1 /* DAC1R_MUTE */
3799#define WM8994_DAC1_VU 0x0100 /* DAC1_VU */
3800#define WM8994_DAC1_VU_MASK 0x0100 /* DAC1_VU */
3801#define WM8994_DAC1_VU_SHIFT 8 /* DAC1_VU */
3802#define WM8994_DAC1_VU_WIDTH 1 /* DAC1_VU */
3803#define WM8994_DAC1R_VOL_MASK 0x00FF /* DAC1R_VOL - [7:0] */
3804#define WM8994_DAC1R_VOL_SHIFT 0 /* DAC1R_VOL - [7:0] */
3805#define WM8994_DAC1R_VOL_WIDTH 8 /* DAC1R_VOL - [7:0] */
3806
3807/*
3808 * R1554 (0x612) - DAC2 Left Volume
3809 */
3810#define WM8994_DAC2L_MUTE 0x0200 /* DAC2L_MUTE */
3811#define WM8994_DAC2L_MUTE_MASK 0x0200 /* DAC2L_MUTE */
3812#define WM8994_DAC2L_MUTE_SHIFT 9 /* DAC2L_MUTE */
3813#define WM8994_DAC2L_MUTE_WIDTH 1 /* DAC2L_MUTE */
3814#define WM8994_DAC2_VU 0x0100 /* DAC2_VU */
3815#define WM8994_DAC2_VU_MASK 0x0100 /* DAC2_VU */
3816#define WM8994_DAC2_VU_SHIFT 8 /* DAC2_VU */
3817#define WM8994_DAC2_VU_WIDTH 1 /* DAC2_VU */
3818#define WM8994_DAC2L_VOL_MASK 0x00FF /* DAC2L_VOL - [7:0] */
3819#define WM8994_DAC2L_VOL_SHIFT 0 /* DAC2L_VOL - [7:0] */
3820#define WM8994_DAC2L_VOL_WIDTH 8 /* DAC2L_VOL - [7:0] */
3821
3822/*
3823 * R1555 (0x613) - DAC2 Right Volume
3824 */
3825#define WM8994_DAC2R_MUTE 0x0200 /* DAC2R_MUTE */
3826#define WM8994_DAC2R_MUTE_MASK 0x0200 /* DAC2R_MUTE */
3827#define WM8994_DAC2R_MUTE_SHIFT 9 /* DAC2R_MUTE */
3828#define WM8994_DAC2R_MUTE_WIDTH 1 /* DAC2R_MUTE */
3829#define WM8994_DAC2_VU 0x0100 /* DAC2_VU */
3830#define WM8994_DAC2_VU_MASK 0x0100 /* DAC2_VU */
3831#define WM8994_DAC2_VU_SHIFT 8 /* DAC2_VU */
3832#define WM8994_DAC2_VU_WIDTH 1 /* DAC2_VU */
3833#define WM8994_DAC2R_VOL_MASK 0x00FF /* DAC2R_VOL - [7:0] */
3834#define WM8994_DAC2R_VOL_SHIFT 0 /* DAC2R_VOL - [7:0] */
3835#define WM8994_DAC2R_VOL_WIDTH 8 /* DAC2R_VOL - [7:0] */
3836
3837/*
3838 * R1556 (0x614) - DAC Softmute
3839 */
3840#define WM8994_DAC_SOFTMUTEMODE 0x0002 /* DAC_SOFTMUTEMODE */
3841#define WM8994_DAC_SOFTMUTEMODE_MASK 0x0002 /* DAC_SOFTMUTEMODE */
3842#define WM8994_DAC_SOFTMUTEMODE_SHIFT 1 /* DAC_SOFTMUTEMODE */
3843#define WM8994_DAC_SOFTMUTEMODE_WIDTH 1 /* DAC_SOFTMUTEMODE */
3844#define WM8994_DAC_MUTERATE 0x0001 /* DAC_MUTERATE */
3845#define WM8994_DAC_MUTERATE_MASK 0x0001 /* DAC_MUTERATE */
3846#define WM8994_DAC_MUTERATE_SHIFT 0 /* DAC_MUTERATE */
3847#define WM8994_DAC_MUTERATE_WIDTH 1 /* DAC_MUTERATE */
3848
3849/*
3850 * R1568 (0x620) - Oversampling
3851 */
3852#define WM8994_ADC_OSR128 0x0002 /* ADC_OSR128 */
3853#define WM8994_ADC_OSR128_MASK 0x0002 /* ADC_OSR128 */
3854#define WM8994_ADC_OSR128_SHIFT 1 /* ADC_OSR128 */
3855#define WM8994_ADC_OSR128_WIDTH 1 /* ADC_OSR128 */
3856#define WM8994_DAC_OSR128 0x0001 /* DAC_OSR128 */
3857#define WM8994_DAC_OSR128_MASK 0x0001 /* DAC_OSR128 */
3858#define WM8994_DAC_OSR128_SHIFT 0 /* DAC_OSR128 */
3859#define WM8994_DAC_OSR128_WIDTH 1 /* DAC_OSR128 */
3860
3861/*
3862 * R1569 (0x621) - Sidetone
3863 */
3864#define WM8994_ST_HPF_CUT_MASK 0x0380 /* ST_HPF_CUT - [9:7] */
3865#define WM8994_ST_HPF_CUT_SHIFT 7 /* ST_HPF_CUT - [9:7] */
3866#define WM8994_ST_HPF_CUT_WIDTH 3 /* ST_HPF_CUT - [9:7] */
3867#define WM8994_ST_HPF 0x0040 /* ST_HPF */
3868#define WM8994_ST_HPF_MASK 0x0040 /* ST_HPF */
3869#define WM8994_ST_HPF_SHIFT 6 /* ST_HPF */
3870#define WM8994_ST_HPF_WIDTH 1 /* ST_HPF */
3871#define WM8994_STR_SEL 0x0002 /* STR_SEL */
3872#define WM8994_STR_SEL_MASK 0x0002 /* STR_SEL */
3873#define WM8994_STR_SEL_SHIFT 1 /* STR_SEL */
3874#define WM8994_STR_SEL_WIDTH 1 /* STR_SEL */
3875#define WM8994_STL_SEL 0x0001 /* STL_SEL */
3876#define WM8994_STL_SEL_MASK 0x0001 /* STL_SEL */
3877#define WM8994_STL_SEL_SHIFT 0 /* STL_SEL */
3878#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */
3879
3880/*
3881 * R1824 (0x720) - Pull Control (1)
3882 */
3883#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */
3884#define WM8994_DMICDAT2_PU_MASK 0x0800 /* DMICDAT2_PU */
3885#define WM8994_DMICDAT2_PU_SHIFT 11 /* DMICDAT2_PU */
3886#define WM8994_DMICDAT2_PU_WIDTH 1 /* DMICDAT2_PU */
3887#define WM8994_DMICDAT2_PD 0x0400 /* DMICDAT2_PD */
3888#define WM8994_DMICDAT2_PD_MASK 0x0400 /* DMICDAT2_PD */
3889#define WM8994_DMICDAT2_PD_SHIFT 10 /* DMICDAT2_PD */
3890#define WM8994_DMICDAT2_PD_WIDTH 1 /* DMICDAT2_PD */
3891#define WM8994_DMICDAT1_PU 0x0200 /* DMICDAT1_PU */
3892#define WM8994_DMICDAT1_PU_MASK 0x0200 /* DMICDAT1_PU */
3893#define WM8994_DMICDAT1_PU_SHIFT 9 /* DMICDAT1_PU */
3894#define WM8994_DMICDAT1_PU_WIDTH 1 /* DMICDAT1_PU */
3895#define WM8994_DMICDAT1_PD 0x0100 /* DMICDAT1_PD */
3896#define WM8994_DMICDAT1_PD_MASK 0x0100 /* DMICDAT1_PD */
3897#define WM8994_DMICDAT1_PD_SHIFT 8 /* DMICDAT1_PD */
3898#define WM8994_DMICDAT1_PD_WIDTH 1 /* DMICDAT1_PD */
3899#define WM8994_MCLK1_PU 0x0080 /* MCLK1_PU */
3900#define WM8994_MCLK1_PU_MASK 0x0080 /* MCLK1_PU */
3901#define WM8994_MCLK1_PU_SHIFT 7 /* MCLK1_PU */
3902#define WM8994_MCLK1_PU_WIDTH 1 /* MCLK1_PU */
3903#define WM8994_MCLK1_PD 0x0040 /* MCLK1_PD */
3904#define WM8994_MCLK1_PD_MASK 0x0040 /* MCLK1_PD */
3905#define WM8994_MCLK1_PD_SHIFT 6 /* MCLK1_PD */
3906#define WM8994_MCLK1_PD_WIDTH 1 /* MCLK1_PD */
3907#define WM8994_DACDAT1_PU 0x0020 /* DACDAT1_PU */
3908#define WM8994_DACDAT1_PU_MASK 0x0020 /* DACDAT1_PU */
3909#define WM8994_DACDAT1_PU_SHIFT 5 /* DACDAT1_PU */
3910#define WM8994_DACDAT1_PU_WIDTH 1 /* DACDAT1_PU */
3911#define WM8994_DACDAT1_PD 0x0010 /* DACDAT1_PD */
3912#define WM8994_DACDAT1_PD_MASK 0x0010 /* DACDAT1_PD */
3913#define WM8994_DACDAT1_PD_SHIFT 4 /* DACDAT1_PD */
3914#define WM8994_DACDAT1_PD_WIDTH 1 /* DACDAT1_PD */
3915#define WM8994_DACLRCLK1_PU 0x0008 /* DACLRCLK1_PU */
3916#define WM8994_DACLRCLK1_PU_MASK 0x0008 /* DACLRCLK1_PU */
3917#define WM8994_DACLRCLK1_PU_SHIFT 3 /* DACLRCLK1_PU */
3918#define WM8994_DACLRCLK1_PU_WIDTH 1 /* DACLRCLK1_PU */
3919#define WM8994_DACLRCLK1_PD 0x0004 /* DACLRCLK1_PD */
3920#define WM8994_DACLRCLK1_PD_MASK 0x0004 /* DACLRCLK1_PD */
3921#define WM8994_DACLRCLK1_PD_SHIFT 2 /* DACLRCLK1_PD */
3922#define WM8994_DACLRCLK1_PD_WIDTH 1 /* DACLRCLK1_PD */
3923#define WM8994_BCLK1_PU 0x0002 /* BCLK1_PU */
3924#define WM8994_BCLK1_PU_MASK 0x0002 /* BCLK1_PU */
3925#define WM8994_BCLK1_PU_SHIFT 1 /* BCLK1_PU */
3926#define WM8994_BCLK1_PU_WIDTH 1 /* BCLK1_PU */
3927#define WM8994_BCLK1_PD 0x0001 /* BCLK1_PD */
3928#define WM8994_BCLK1_PD_MASK 0x0001 /* BCLK1_PD */
3929#define WM8994_BCLK1_PD_SHIFT 0 /* BCLK1_PD */
3930#define WM8994_BCLK1_PD_WIDTH 1 /* BCLK1_PD */
3931
3932/*
3933 * R1825 (0x721) - Pull Control (2)
3934 */
3935#define WM8994_CSNADDR_PD 0x0100 /* CSNADDR_PD */
3936#define WM8994_CSNADDR_PD_MASK 0x0100 /* CSNADDR_PD */
3937#define WM8994_CSNADDR_PD_SHIFT 8 /* CSNADDR_PD */
3938#define WM8994_CSNADDR_PD_WIDTH 1 /* CSNADDR_PD */
3939#define WM8994_LDO2ENA_PD 0x0040 /* LDO2ENA_PD */
3940#define WM8994_LDO2ENA_PD_MASK 0x0040 /* LDO2ENA_PD */
3941#define WM8994_LDO2ENA_PD_SHIFT 6 /* LDO2ENA_PD */
3942#define WM8994_LDO2ENA_PD_WIDTH 1 /* LDO2ENA_PD */
3943#define WM8994_LDO1ENA_PD 0x0010 /* LDO1ENA_PD */
3944#define WM8994_LDO1ENA_PD_MASK 0x0010 /* LDO1ENA_PD */
3945#define WM8994_LDO1ENA_PD_SHIFT 4 /* LDO1ENA_PD */
3946#define WM8994_LDO1ENA_PD_WIDTH 1 /* LDO1ENA_PD */
3947#define WM8994_CIFMODE_PD 0x0004 /* CIFMODE_PD */
3948#define WM8994_CIFMODE_PD_MASK 0x0004 /* CIFMODE_PD */
3949#define WM8994_CIFMODE_PD_SHIFT 2 /* CIFMODE_PD */
3950#define WM8994_CIFMODE_PD_WIDTH 1 /* CIFMODE_PD */
3951#define WM8994_SPKMODE_PU 0x0002 /* SPKMODE_PU */
3952#define WM8994_SPKMODE_PU_MASK 0x0002 /* SPKMODE_PU */
3953#define WM8994_SPKMODE_PU_SHIFT 1 /* SPKMODE_PU */
3954#define WM8994_SPKMODE_PU_WIDTH 1 /* SPKMODE_PU */
3955
3956/*
3957 * R1840 (0x730) - Interrupt Status 1
3958 */
3959#define WM8994_GP11_EINT 0x0400 /* GP11_EINT */
3960#define WM8994_GP11_EINT_MASK 0x0400 /* GP11_EINT */
3961#define WM8994_GP11_EINT_SHIFT 10 /* GP11_EINT */
3962#define WM8994_GP11_EINT_WIDTH 1 /* GP11_EINT */
3963#define WM8994_GP10_EINT 0x0200 /* GP10_EINT */
3964#define WM8994_GP10_EINT_MASK 0x0200 /* GP10_EINT */
3965#define WM8994_GP10_EINT_SHIFT 9 /* GP10_EINT */
3966#define WM8994_GP10_EINT_WIDTH 1 /* GP10_EINT */
3967#define WM8994_GP9_EINT 0x0100 /* GP9_EINT */
3968#define WM8994_GP9_EINT_MASK 0x0100 /* GP9_EINT */
3969#define WM8994_GP9_EINT_SHIFT 8 /* GP9_EINT */
3970#define WM8994_GP9_EINT_WIDTH 1 /* GP9_EINT */
3971#define WM8994_GP8_EINT 0x0080 /* GP8_EINT */
3972#define WM8994_GP8_EINT_MASK 0x0080 /* GP8_EINT */
3973#define WM8994_GP8_EINT_SHIFT 7 /* GP8_EINT */
3974#define WM8994_GP8_EINT_WIDTH 1 /* GP8_EINT */
3975#define WM8994_GP7_EINT 0x0040 /* GP7_EINT */
3976#define WM8994_GP7_EINT_MASK 0x0040 /* GP7_EINT */
3977#define WM8994_GP7_EINT_SHIFT 6 /* GP7_EINT */
3978#define WM8994_GP7_EINT_WIDTH 1 /* GP7_EINT */
3979#define WM8994_GP6_EINT 0x0020 /* GP6_EINT */
3980#define WM8994_GP6_EINT_MASK 0x0020 /* GP6_EINT */
3981#define WM8994_GP6_EINT_SHIFT 5 /* GP6_EINT */
3982#define WM8994_GP6_EINT_WIDTH 1 /* GP6_EINT */
3983#define WM8994_GP5_EINT 0x0010 /* GP5_EINT */
3984#define WM8994_GP5_EINT_MASK 0x0010 /* GP5_EINT */
3985#define WM8994_GP5_EINT_SHIFT 4 /* GP5_EINT */
3986#define WM8994_GP5_EINT_WIDTH 1 /* GP5_EINT */
3987#define WM8994_GP4_EINT 0x0008 /* GP4_EINT */
3988#define WM8994_GP4_EINT_MASK 0x0008 /* GP4_EINT */
3989#define WM8994_GP4_EINT_SHIFT 3 /* GP4_EINT */
3990#define WM8994_GP4_EINT_WIDTH 1 /* GP4_EINT */
3991#define WM8994_GP3_EINT 0x0004 /* GP3_EINT */
3992#define WM8994_GP3_EINT_MASK 0x0004 /* GP3_EINT */
3993#define WM8994_GP3_EINT_SHIFT 2 /* GP3_EINT */
3994#define WM8994_GP3_EINT_WIDTH 1 /* GP3_EINT */
3995#define WM8994_GP2_EINT 0x0002 /* GP2_EINT */
3996#define WM8994_GP2_EINT_MASK 0x0002 /* GP2_EINT */
3997#define WM8994_GP2_EINT_SHIFT 1 /* GP2_EINT */
3998#define WM8994_GP2_EINT_WIDTH 1 /* GP2_EINT */
3999#define WM8994_GP1_EINT 0x0001 /* GP1_EINT */
4000#define WM8994_GP1_EINT_MASK 0x0001 /* GP1_EINT */
4001#define WM8994_GP1_EINT_SHIFT 0 /* GP1_EINT */
4002#define WM8994_GP1_EINT_WIDTH 1 /* GP1_EINT */
4003
4004/*
4005 * R1841 (0x731) - Interrupt Status 2
4006 */
4007#define WM8994_TEMP_WARN_EINT 0x8000 /* TEMP_WARN_EINT */
4008#define WM8994_TEMP_WARN_EINT_MASK 0x8000 /* TEMP_WARN_EINT */
4009#define WM8994_TEMP_WARN_EINT_SHIFT 15 /* TEMP_WARN_EINT */
4010#define WM8994_TEMP_WARN_EINT_WIDTH 1 /* TEMP_WARN_EINT */
4011#define WM8994_DCS_DONE_EINT 0x4000 /* DCS_DONE_EINT */
4012#define WM8994_DCS_DONE_EINT_MASK 0x4000 /* DCS_DONE_EINT */
4013#define WM8994_DCS_DONE_EINT_SHIFT 14 /* DCS_DONE_EINT */
4014#define WM8994_DCS_DONE_EINT_WIDTH 1 /* DCS_DONE_EINT */
4015#define WM8994_WSEQ_DONE_EINT 0x2000 /* WSEQ_DONE_EINT */
4016#define WM8994_WSEQ_DONE_EINT_MASK 0x2000 /* WSEQ_DONE_EINT */
4017#define WM8994_WSEQ_DONE_EINT_SHIFT 13 /* WSEQ_DONE_EINT */
4018#define WM8994_WSEQ_DONE_EINT_WIDTH 1 /* WSEQ_DONE_EINT */
4019#define WM8994_FIFOS_ERR_EINT 0x1000 /* FIFOS_ERR_EINT */
4020#define WM8994_FIFOS_ERR_EINT_MASK 0x1000 /* FIFOS_ERR_EINT */
4021#define WM8994_FIFOS_ERR_EINT_SHIFT 12 /* FIFOS_ERR_EINT */
4022#define WM8994_FIFOS_ERR_EINT_WIDTH 1 /* FIFOS_ERR_EINT */
4023#define WM8994_AIF2DRC_SIG_DET_EINT 0x0800 /* AIF2DRC_SIG_DET_EINT */
4024#define WM8994_AIF2DRC_SIG_DET_EINT_MASK 0x0800 /* AIF2DRC_SIG_DET_EINT */
4025#define WM8994_AIF2DRC_SIG_DET_EINT_SHIFT 11 /* AIF2DRC_SIG_DET_EINT */
4026#define WM8994_AIF2DRC_SIG_DET_EINT_WIDTH 1 /* AIF2DRC_SIG_DET_EINT */
4027#define WM8994_AIF1DRC2_SIG_DET_EINT 0x0400 /* AIF1DRC2_SIG_DET_EINT */
4028#define WM8994_AIF1DRC2_SIG_DET_EINT_MASK 0x0400 /* AIF1DRC2_SIG_DET_EINT */
4029#define WM8994_AIF1DRC2_SIG_DET_EINT_SHIFT 10 /* AIF1DRC2_SIG_DET_EINT */
4030#define WM8994_AIF1DRC2_SIG_DET_EINT_WIDTH 1 /* AIF1DRC2_SIG_DET_EINT */
4031#define WM8994_AIF1DRC1_SIG_DET_EINT 0x0200 /* AIF1DRC1_SIG_DET_EINT */
4032#define WM8994_AIF1DRC1_SIG_DET_EINT_MASK 0x0200 /* AIF1DRC1_SIG_DET_EINT */
4033#define WM8994_AIF1DRC1_SIG_DET_EINT_SHIFT 9 /* AIF1DRC1_SIG_DET_EINT */
4034#define WM8994_AIF1DRC1_SIG_DET_EINT_WIDTH 1 /* AIF1DRC1_SIG_DET_EINT */
4035#define WM8994_SRC2_LOCK_EINT 0x0100 /* SRC2_LOCK_EINT */
4036#define WM8994_SRC2_LOCK_EINT_MASK 0x0100 /* SRC2_LOCK_EINT */
4037#define WM8994_SRC2_LOCK_EINT_SHIFT 8 /* SRC2_LOCK_EINT */
4038#define WM8994_SRC2_LOCK_EINT_WIDTH 1 /* SRC2_LOCK_EINT */
4039#define WM8994_SRC1_LOCK_EINT 0x0080 /* SRC1_LOCK_EINT */
4040#define WM8994_SRC1_LOCK_EINT_MASK 0x0080 /* SRC1_LOCK_EINT */
4041#define WM8994_SRC1_LOCK_EINT_SHIFT 7 /* SRC1_LOCK_EINT */
4042#define WM8994_SRC1_LOCK_EINT_WIDTH 1 /* SRC1_LOCK_EINT */
4043#define WM8994_FLL2_LOCK_EINT 0x0040 /* FLL2_LOCK_EINT */
4044#define WM8994_FLL2_LOCK_EINT_MASK 0x0040 /* FLL2_LOCK_EINT */
4045#define WM8994_FLL2_LOCK_EINT_SHIFT 6 /* FLL2_LOCK_EINT */
4046#define WM8994_FLL2_LOCK_EINT_WIDTH 1 /* FLL2_LOCK_EINT */
4047#define WM8994_FLL1_LOCK_EINT 0x0020 /* FLL1_LOCK_EINT */
4048#define WM8994_FLL1_LOCK_EINT_MASK 0x0020 /* FLL1_LOCK_EINT */
4049#define WM8994_FLL1_LOCK_EINT_SHIFT 5 /* FLL1_LOCK_EINT */
4050#define WM8994_FLL1_LOCK_EINT_WIDTH 1 /* FLL1_LOCK_EINT */
4051#define WM8994_MIC2_SHRT_EINT 0x0010 /* MIC2_SHRT_EINT */
4052#define WM8994_MIC2_SHRT_EINT_MASK 0x0010 /* MIC2_SHRT_EINT */
4053#define WM8994_MIC2_SHRT_EINT_SHIFT 4 /* MIC2_SHRT_EINT */
4054#define WM8994_MIC2_SHRT_EINT_WIDTH 1 /* MIC2_SHRT_EINT */
4055#define WM8994_MIC2_DET_EINT 0x0008 /* MIC2_DET_EINT */
4056#define WM8994_MIC2_DET_EINT_MASK 0x0008 /* MIC2_DET_EINT */
4057#define WM8994_MIC2_DET_EINT_SHIFT 3 /* MIC2_DET_EINT */
4058#define WM8994_MIC2_DET_EINT_WIDTH 1 /* MIC2_DET_EINT */
4059#define WM8994_MIC1_SHRT_EINT 0x0004 /* MIC1_SHRT_EINT */
4060#define WM8994_MIC1_SHRT_EINT_MASK 0x0004 /* MIC1_SHRT_EINT */
4061#define WM8994_MIC1_SHRT_EINT_SHIFT 2 /* MIC1_SHRT_EINT */
4062#define WM8994_MIC1_SHRT_EINT_WIDTH 1 /* MIC1_SHRT_EINT */
4063#define WM8994_MIC1_DET_EINT 0x0002 /* MIC1_DET_EINT */
4064#define WM8994_MIC1_DET_EINT_MASK 0x0002 /* MIC1_DET_EINT */
4065#define WM8994_MIC1_DET_EINT_SHIFT 1 /* MIC1_DET_EINT */
4066#define WM8994_MIC1_DET_EINT_WIDTH 1 /* MIC1_DET_EINT */
4067#define WM8994_TEMP_SHUT_EINT 0x0001 /* TEMP_SHUT_EINT */
4068#define WM8994_TEMP_SHUT_EINT_MASK 0x0001 /* TEMP_SHUT_EINT */
4069#define WM8994_TEMP_SHUT_EINT_SHIFT 0 /* TEMP_SHUT_EINT */
4070#define WM8994_TEMP_SHUT_EINT_WIDTH 1 /* TEMP_SHUT_EINT */
4071
4072/*
4073 * R1842 (0x732) - Interrupt Raw Status 2
4074 */
4075#define WM8994_TEMP_WARN_STS 0x8000 /* TEMP_WARN_STS */
4076#define WM8994_TEMP_WARN_STS_MASK 0x8000 /* TEMP_WARN_STS */
4077#define WM8994_TEMP_WARN_STS_SHIFT 15 /* TEMP_WARN_STS */
4078#define WM8994_TEMP_WARN_STS_WIDTH 1 /* TEMP_WARN_STS */
4079#define WM8994_DCS_DONE_STS 0x4000 /* DCS_DONE_STS */
4080#define WM8994_DCS_DONE_STS_MASK 0x4000 /* DCS_DONE_STS */
4081#define WM8994_DCS_DONE_STS_SHIFT 14 /* DCS_DONE_STS */
4082#define WM8994_DCS_DONE_STS_WIDTH 1 /* DCS_DONE_STS */
4083#define WM8994_WSEQ_DONE_STS 0x2000 /* WSEQ_DONE_STS */
4084#define WM8994_WSEQ_DONE_STS_MASK 0x2000 /* WSEQ_DONE_STS */
4085#define WM8994_WSEQ_DONE_STS_SHIFT 13 /* WSEQ_DONE_STS */
4086#define WM8994_WSEQ_DONE_STS_WIDTH 1 /* WSEQ_DONE_STS */
4087#define WM8994_FIFOS_ERR_STS 0x1000 /* FIFOS_ERR_STS */
4088#define WM8994_FIFOS_ERR_STS_MASK 0x1000 /* FIFOS_ERR_STS */
4089#define WM8994_FIFOS_ERR_STS_SHIFT 12 /* FIFOS_ERR_STS */
4090#define WM8994_FIFOS_ERR_STS_WIDTH 1 /* FIFOS_ERR_STS */
4091#define WM8994_AIF2DRC_SIG_DET_STS 0x0800 /* AIF2DRC_SIG_DET_STS */
4092#define WM8994_AIF2DRC_SIG_DET_STS_MASK 0x0800 /* AIF2DRC_SIG_DET_STS */
4093#define WM8994_AIF2DRC_SIG_DET_STS_SHIFT 11 /* AIF2DRC_SIG_DET_STS */
4094#define WM8994_AIF2DRC_SIG_DET_STS_WIDTH 1 /* AIF2DRC_SIG_DET_STS */
4095#define WM8994_AIF1DRC2_SIG_DET_STS 0x0400 /* AIF1DRC2_SIG_DET_STS */
4096#define WM8994_AIF1DRC2_SIG_DET_STS_MASK 0x0400 /* AIF1DRC2_SIG_DET_STS */
4097#define WM8994_AIF1DRC2_SIG_DET_STS_SHIFT 10 /* AIF1DRC2_SIG_DET_STS */
4098#define WM8994_AIF1DRC2_SIG_DET_STS_WIDTH 1 /* AIF1DRC2_SIG_DET_STS */
4099#define WM8994_AIF1DRC1_SIG_DET_STS 0x0200 /* AIF1DRC1_SIG_DET_STS */
4100#define WM8994_AIF1DRC1_SIG_DET_STS_MASK 0x0200 /* AIF1DRC1_SIG_DET_STS */
4101#define WM8994_AIF1DRC1_SIG_DET_STS_SHIFT 9 /* AIF1DRC1_SIG_DET_STS */
4102#define WM8994_AIF1DRC1_SIG_DET_STS_WIDTH 1 /* AIF1DRC1_SIG_DET_STS */
4103#define WM8994_SRC2_LOCK_STS 0x0100 /* SRC2_LOCK_STS */
4104#define WM8994_SRC2_LOCK_STS_MASK 0x0100 /* SRC2_LOCK_STS */
4105#define WM8994_SRC2_LOCK_STS_SHIFT 8 /* SRC2_LOCK_STS */
4106#define WM8994_SRC2_LOCK_STS_WIDTH 1 /* SRC2_LOCK_STS */
4107#define WM8994_SRC1_LOCK_STS 0x0080 /* SRC1_LOCK_STS */
4108#define WM8994_SRC1_LOCK_STS_MASK 0x0080 /* SRC1_LOCK_STS */
4109#define WM8994_SRC1_LOCK_STS_SHIFT 7 /* SRC1_LOCK_STS */
4110#define WM8994_SRC1_LOCK_STS_WIDTH 1 /* SRC1_LOCK_STS */
4111#define WM8994_FLL2_LOCK_STS 0x0040 /* FLL2_LOCK_STS */
4112#define WM8994_FLL2_LOCK_STS_MASK 0x0040 /* FLL2_LOCK_STS */
4113#define WM8994_FLL2_LOCK_STS_SHIFT 6 /* FLL2_LOCK_STS */
4114#define WM8994_FLL2_LOCK_STS_WIDTH 1 /* FLL2_LOCK_STS */
4115#define WM8994_FLL1_LOCK_STS 0x0020 /* FLL1_LOCK_STS */
4116#define WM8994_FLL1_LOCK_STS_MASK 0x0020 /* FLL1_LOCK_STS */
4117#define WM8994_FLL1_LOCK_STS_SHIFT 5 /* FLL1_LOCK_STS */
4118#define WM8994_FLL1_LOCK_STS_WIDTH 1 /* FLL1_LOCK_STS */
4119#define WM8994_MIC2_SHRT_STS 0x0010 /* MIC2_SHRT_STS */
4120#define WM8994_MIC2_SHRT_STS_MASK 0x0010 /* MIC2_SHRT_STS */
4121#define WM8994_MIC2_SHRT_STS_SHIFT 4 /* MIC2_SHRT_STS */
4122#define WM8994_MIC2_SHRT_STS_WIDTH 1 /* MIC2_SHRT_STS */
4123#define WM8994_MIC2_DET_STS 0x0008 /* MIC2_DET_STS */
4124#define WM8994_MIC2_DET_STS_MASK 0x0008 /* MIC2_DET_STS */
4125#define WM8994_MIC2_DET_STS_SHIFT 3 /* MIC2_DET_STS */
4126#define WM8994_MIC2_DET_STS_WIDTH 1 /* MIC2_DET_STS */
4127#define WM8994_MIC1_SHRT_STS 0x0004 /* MIC1_SHRT_STS */
4128#define WM8994_MIC1_SHRT_STS_MASK 0x0004 /* MIC1_SHRT_STS */
4129#define WM8994_MIC1_SHRT_STS_SHIFT 2 /* MIC1_SHRT_STS */
4130#define WM8994_MIC1_SHRT_STS_WIDTH 1 /* MIC1_SHRT_STS */
4131#define WM8994_MIC1_DET_STS 0x0002 /* MIC1_DET_STS */
4132#define WM8994_MIC1_DET_STS_MASK 0x0002 /* MIC1_DET_STS */
4133#define WM8994_MIC1_DET_STS_SHIFT 1 /* MIC1_DET_STS */
4134#define WM8994_MIC1_DET_STS_WIDTH 1 /* MIC1_DET_STS */
4135#define WM8994_TEMP_SHUT_STS 0x0001 /* TEMP_SHUT_STS */
4136#define WM8994_TEMP_SHUT_STS_MASK 0x0001 /* TEMP_SHUT_STS */
4137#define WM8994_TEMP_SHUT_STS_SHIFT 0 /* TEMP_SHUT_STS */
4138#define WM8994_TEMP_SHUT_STS_WIDTH 1 /* TEMP_SHUT_STS */
4139
4140/*
4141 * R1848 (0x738) - Interrupt Status 1 Mask
4142 */
4143#define WM8994_IM_GP11_EINT 0x0400 /* IM_GP11_EINT */
4144#define WM8994_IM_GP11_EINT_MASK 0x0400 /* IM_GP11_EINT */
4145#define WM8994_IM_GP11_EINT_SHIFT 10 /* IM_GP11_EINT */
4146#define WM8994_IM_GP11_EINT_WIDTH 1 /* IM_GP11_EINT */
4147#define WM8994_IM_GP10_EINT 0x0200 /* IM_GP10_EINT */
4148#define WM8994_IM_GP10_EINT_MASK 0x0200 /* IM_GP10_EINT */
4149#define WM8994_IM_GP10_EINT_SHIFT 9 /* IM_GP10_EINT */
4150#define WM8994_IM_GP10_EINT_WIDTH 1 /* IM_GP10_EINT */
4151#define WM8994_IM_GP9_EINT 0x0100 /* IM_GP9_EINT */
4152#define WM8994_IM_GP9_EINT_MASK 0x0100 /* IM_GP9_EINT */
4153#define WM8994_IM_GP9_EINT_SHIFT 8 /* IM_GP9_EINT */
4154#define WM8994_IM_GP9_EINT_WIDTH 1 /* IM_GP9_EINT */
4155#define WM8994_IM_GP8_EINT 0x0080 /* IM_GP8_EINT */
4156#define WM8994_IM_GP8_EINT_MASK 0x0080 /* IM_GP8_EINT */
4157#define WM8994_IM_GP8_EINT_SHIFT 7 /* IM_GP8_EINT */
4158#define WM8994_IM_GP8_EINT_WIDTH 1 /* IM_GP8_EINT */
4159#define WM8994_IM_GP7_EINT 0x0040 /* IM_GP7_EINT */
4160#define WM8994_IM_GP7_EINT_MASK 0x0040 /* IM_GP7_EINT */
4161#define WM8994_IM_GP7_EINT_SHIFT 6 /* IM_GP7_EINT */
4162#define WM8994_IM_GP7_EINT_WIDTH 1 /* IM_GP7_EINT */
4163#define WM8994_IM_GP6_EINT 0x0020 /* IM_GP6_EINT */
4164#define WM8994_IM_GP6_EINT_MASK 0x0020 /* IM_GP6_EINT */
4165#define WM8994_IM_GP6_EINT_SHIFT 5 /* IM_GP6_EINT */
4166#define WM8994_IM_GP6_EINT_WIDTH 1 /* IM_GP6_EINT */
4167#define WM8994_IM_GP5_EINT 0x0010 /* IM_GP5_EINT */
4168#define WM8994_IM_GP5_EINT_MASK 0x0010 /* IM_GP5_EINT */
4169#define WM8994_IM_GP5_EINT_SHIFT 4 /* IM_GP5_EINT */
4170#define WM8994_IM_GP5_EINT_WIDTH 1 /* IM_GP5_EINT */
4171#define WM8994_IM_GP4_EINT 0x0008 /* IM_GP4_EINT */
4172#define WM8994_IM_GP4_EINT_MASK 0x0008 /* IM_GP4_EINT */
4173#define WM8994_IM_GP4_EINT_SHIFT 3 /* IM_GP4_EINT */
4174#define WM8994_IM_GP4_EINT_WIDTH 1 /* IM_GP4_EINT */
4175#define WM8994_IM_GP3_EINT 0x0004 /* IM_GP3_EINT */
4176#define WM8994_IM_GP3_EINT_MASK 0x0004 /* IM_GP3_EINT */
4177#define WM8994_IM_GP3_EINT_SHIFT 2 /* IM_GP3_EINT */
4178#define WM8994_IM_GP3_EINT_WIDTH 1 /* IM_GP3_EINT */
4179#define WM8994_IM_GP2_EINT 0x0002 /* IM_GP2_EINT */
4180#define WM8994_IM_GP2_EINT_MASK 0x0002 /* IM_GP2_EINT */
4181#define WM8994_IM_GP2_EINT_SHIFT 1 /* IM_GP2_EINT */
4182#define WM8994_IM_GP2_EINT_WIDTH 1 /* IM_GP2_EINT */
4183#define WM8994_IM_GP1_EINT 0x0001 /* IM_GP1_EINT */
4184#define WM8994_IM_GP1_EINT_MASK 0x0001 /* IM_GP1_EINT */
4185#define WM8994_IM_GP1_EINT_SHIFT 0 /* IM_GP1_EINT */
4186#define WM8994_IM_GP1_EINT_WIDTH 1 /* IM_GP1_EINT */
4187
4188/*
4189 * R1849 (0x739) - Interrupt Status 2 Mask
4190 */
4191#define WM8994_IM_TEMP_WARN_EINT 0x8000 /* IM_TEMP_WARN_EINT */
4192#define WM8994_IM_TEMP_WARN_EINT_MASK 0x8000 /* IM_TEMP_WARN_EINT */
4193#define WM8994_IM_TEMP_WARN_EINT_SHIFT 15 /* IM_TEMP_WARN_EINT */
4194#define WM8994_IM_TEMP_WARN_EINT_WIDTH 1 /* IM_TEMP_WARN_EINT */
4195#define WM8994_IM_DCS_DONE_EINT 0x4000 /* IM_DCS_DONE_EINT */
4196#define WM8994_IM_DCS_DONE_EINT_MASK 0x4000 /* IM_DCS_DONE_EINT */
4197#define WM8994_IM_DCS_DONE_EINT_SHIFT 14 /* IM_DCS_DONE_EINT */
4198#define WM8994_IM_DCS_DONE_EINT_WIDTH 1 /* IM_DCS_DONE_EINT */
4199#define WM8994_IM_WSEQ_DONE_EINT 0x2000 /* IM_WSEQ_DONE_EINT */
4200#define WM8994_IM_WSEQ_DONE_EINT_MASK 0x2000 /* IM_WSEQ_DONE_EINT */
4201#define WM8994_IM_WSEQ_DONE_EINT_SHIFT 13 /* IM_WSEQ_DONE_EINT */
4202#define WM8994_IM_WSEQ_DONE_EINT_WIDTH 1 /* IM_WSEQ_DONE_EINT */
4203#define WM8994_IM_FIFOS_ERR_EINT 0x1000 /* IM_FIFOS_ERR_EINT */
4204#define WM8994_IM_FIFOS_ERR_EINT_MASK 0x1000 /* IM_FIFOS_ERR_EINT */
4205#define WM8994_IM_FIFOS_ERR_EINT_SHIFT 12 /* IM_FIFOS_ERR_EINT */
4206#define WM8994_IM_FIFOS_ERR_EINT_WIDTH 1 /* IM_FIFOS_ERR_EINT */
4207#define WM8994_IM_AIF2DRC_SIG_DET_EINT 0x0800 /* IM_AIF2DRC_SIG_DET_EINT */
4208#define WM8994_IM_AIF2DRC_SIG_DET_EINT_MASK 0x0800 /* IM_AIF2DRC_SIG_DET_EINT */
4209#define WM8994_IM_AIF2DRC_SIG_DET_EINT_SHIFT 11 /* IM_AIF2DRC_SIG_DET_EINT */
4210#define WM8994_IM_AIF2DRC_SIG_DET_EINT_WIDTH 1 /* IM_AIF2DRC_SIG_DET_EINT */
4211#define WM8994_IM_AIF1DRC2_SIG_DET_EINT 0x0400 /* IM_AIF1DRC2_SIG_DET_EINT */
4212#define WM8994_IM_AIF1DRC2_SIG_DET_EINT_MASK 0x0400 /* IM_AIF1DRC2_SIG_DET_EINT */
4213#define WM8994_IM_AIF1DRC2_SIG_DET_EINT_SHIFT 10 /* IM_AIF1DRC2_SIG_DET_EINT */
4214#define WM8994_IM_AIF1DRC2_SIG_DET_EINT_WIDTH 1 /* IM_AIF1DRC2_SIG_DET_EINT */
4215#define WM8994_IM_AIF1DRC1_SIG_DET_EINT 0x0200 /* IM_AIF1DRC1_SIG_DET_EINT */
4216#define WM8994_IM_AIF1DRC1_SIG_DET_EINT_MASK 0x0200 /* IM_AIF1DRC1_SIG_DET_EINT */
4217#define WM8994_IM_AIF1DRC1_SIG_DET_EINT_SHIFT 9 /* IM_AIF1DRC1_SIG_DET_EINT */
4218#define WM8994_IM_AIF1DRC1_SIG_DET_EINT_WIDTH 1 /* IM_AIF1DRC1_SIG_DET_EINT */
4219#define WM8994_IM_SRC2_LOCK_EINT 0x0100 /* IM_SRC2_LOCK_EINT */
4220#define WM8994_IM_SRC2_LOCK_EINT_MASK 0x0100 /* IM_SRC2_LOCK_EINT */
4221#define WM8994_IM_SRC2_LOCK_EINT_SHIFT 8 /* IM_SRC2_LOCK_EINT */
4222#define WM8994_IM_SRC2_LOCK_EINT_WIDTH 1 /* IM_SRC2_LOCK_EINT */
4223#define WM8994_IM_SRC1_LOCK_EINT 0x0080 /* IM_SRC1_LOCK_EINT */
4224#define WM8994_IM_SRC1_LOCK_EINT_MASK 0x0080 /* IM_SRC1_LOCK_EINT */
4225#define WM8994_IM_SRC1_LOCK_EINT_SHIFT 7 /* IM_SRC1_LOCK_EINT */
4226#define WM8994_IM_SRC1_LOCK_EINT_WIDTH 1 /* IM_SRC1_LOCK_EINT */
4227#define WM8994_IM_FLL2_LOCK_EINT 0x0040 /* IM_FLL2_LOCK_EINT */
4228#define WM8994_IM_FLL2_LOCK_EINT_MASK 0x0040 /* IM_FLL2_LOCK_EINT */
4229#define WM8994_IM_FLL2_LOCK_EINT_SHIFT 6 /* IM_FLL2_LOCK_EINT */
4230#define WM8994_IM_FLL2_LOCK_EINT_WIDTH 1 /* IM_FLL2_LOCK_EINT */
4231#define WM8994_IM_FLL1_LOCK_EINT 0x0020 /* IM_FLL1_LOCK_EINT */
4232#define WM8994_IM_FLL1_LOCK_EINT_MASK 0x0020 /* IM_FLL1_LOCK_EINT */
4233#define WM8994_IM_FLL1_LOCK_EINT_SHIFT 5 /* IM_FLL1_LOCK_EINT */
4234#define WM8994_IM_FLL1_LOCK_EINT_WIDTH 1 /* IM_FLL1_LOCK_EINT */
4235#define WM8994_IM_MIC2_SHRT_EINT 0x0010 /* IM_MIC2_SHRT_EINT */
4236#define WM8994_IM_MIC2_SHRT_EINT_MASK 0x0010 /* IM_MIC2_SHRT_EINT */
4237#define WM8994_IM_MIC2_SHRT_EINT_SHIFT 4 /* IM_MIC2_SHRT_EINT */
4238#define WM8994_IM_MIC2_SHRT_EINT_WIDTH 1 /* IM_MIC2_SHRT_EINT */
4239#define WM8994_IM_MIC2_DET_EINT 0x0008 /* IM_MIC2_DET_EINT */
4240#define WM8994_IM_MIC2_DET_EINT_MASK 0x0008 /* IM_MIC2_DET_EINT */
4241#define WM8994_IM_MIC2_DET_EINT_SHIFT 3 /* IM_MIC2_DET_EINT */
4242#define WM8994_IM_MIC2_DET_EINT_WIDTH 1 /* IM_MIC2_DET_EINT */
4243#define WM8994_IM_MIC1_SHRT_EINT 0x0004 /* IM_MIC1_SHRT_EINT */
4244#define WM8994_IM_MIC1_SHRT_EINT_MASK 0x0004 /* IM_MIC1_SHRT_EINT */
4245#define WM8994_IM_MIC1_SHRT_EINT_SHIFT 2 /* IM_MIC1_SHRT_EINT */
4246#define WM8994_IM_MIC1_SHRT_EINT_WIDTH 1 /* IM_MIC1_SHRT_EINT */
4247#define WM8994_IM_MIC1_DET_EINT 0x0002 /* IM_MIC1_DET_EINT */
4248#define WM8994_IM_MIC1_DET_EINT_MASK 0x0002 /* IM_MIC1_DET_EINT */
4249#define WM8994_IM_MIC1_DET_EINT_SHIFT 1 /* IM_MIC1_DET_EINT */
4250#define WM8994_IM_MIC1_DET_EINT_WIDTH 1 /* IM_MIC1_DET_EINT */
4251#define WM8994_IM_TEMP_SHUT_EINT 0x0001 /* IM_TEMP_SHUT_EINT */
4252#define WM8994_IM_TEMP_SHUT_EINT_MASK 0x0001 /* IM_TEMP_SHUT_EINT */
4253#define WM8994_IM_TEMP_SHUT_EINT_SHIFT 0 /* IM_TEMP_SHUT_EINT */
4254#define WM8994_IM_TEMP_SHUT_EINT_WIDTH 1 /* IM_TEMP_SHUT_EINT */
4255
4256/*
4257 * R1856 (0x740) - Interrupt Control
4258 */
4259#define WM8994_IM_IRQ 0x0001 /* IM_IRQ */
4260#define WM8994_IM_IRQ_MASK 0x0001 /* IM_IRQ */
4261#define WM8994_IM_IRQ_SHIFT 0 /* IM_IRQ */
4262#define WM8994_IM_IRQ_WIDTH 1 /* IM_IRQ */
4263
4264/*
4265 * R1864 (0x748) - IRQ Debounce
4266 */
4267#define WM8994_TEMP_WARN_DB 0x0020 /* TEMP_WARN_DB */
4268#define WM8994_TEMP_WARN_DB_MASK 0x0020 /* TEMP_WARN_DB */
4269#define WM8994_TEMP_WARN_DB_SHIFT 5 /* TEMP_WARN_DB */
4270#define WM8994_TEMP_WARN_DB_WIDTH 1 /* TEMP_WARN_DB */
4271#define WM8994_MIC2_SHRT_DB 0x0010 /* MIC2_SHRT_DB */
4272#define WM8994_MIC2_SHRT_DB_MASK 0x0010 /* MIC2_SHRT_DB */
4273#define WM8994_MIC2_SHRT_DB_SHIFT 4 /* MIC2_SHRT_DB */
4274#define WM8994_MIC2_SHRT_DB_WIDTH 1 /* MIC2_SHRT_DB */
4275#define WM8994_MIC2_DET_DB 0x0008 /* MIC2_DET_DB */
4276#define WM8994_MIC2_DET_DB_MASK 0x0008 /* MIC2_DET_DB */
4277#define WM8994_MIC2_DET_DB_SHIFT 3 /* MIC2_DET_DB */
4278#define WM8994_MIC2_DET_DB_WIDTH 1 /* MIC2_DET_DB */
4279#define WM8994_MIC1_SHRT_DB 0x0004 /* MIC1_SHRT_DB */
4280#define WM8994_MIC1_SHRT_DB_MASK 0x0004 /* MIC1_SHRT_DB */
4281#define WM8994_MIC1_SHRT_DB_SHIFT 2 /* MIC1_SHRT_DB */
4282#define WM8994_MIC1_SHRT_DB_WIDTH 1 /* MIC1_SHRT_DB */
4283#define WM8994_MIC1_DET_DB 0x0002 /* MIC1_DET_DB */
4284#define WM8994_MIC1_DET_DB_MASK 0x0002 /* MIC1_DET_DB */
4285#define WM8994_MIC1_DET_DB_SHIFT 1 /* MIC1_DET_DB */
4286#define WM8994_MIC1_DET_DB_WIDTH 1 /* MIC1_DET_DB */
4287#define WM8994_TEMP_SHUT_DB 0x0001 /* TEMP_SHUT_DB */
4288#define WM8994_TEMP_SHUT_DB_MASK 0x0001 /* TEMP_SHUT_DB */
4289#define WM8994_TEMP_SHUT_DB_SHIFT 0 /* TEMP_SHUT_DB */
4290#define WM8994_TEMP_SHUT_DB_WIDTH 1 /* TEMP_SHUT_DB */
4291
4292#endif
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 7f085c97c799..7238231b8dd4 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -9,7 +9,7 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9#ifdef CONFIG_MIGRATION 9#ifdef CONFIG_MIGRATION
10#define PAGE_MIGRATION 1 10#define PAGE_MIGRATION 1
11 11
12extern int putback_lru_pages(struct list_head *l); 12extern void putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 14 struct page *, struct page *);
15extern int migrate_pages(struct list_head *l, new_page_t x, 15extern int migrate_pages(struct list_head *l, new_page_t x,
@@ -19,17 +19,19 @@ extern int fail_migrate_page(struct address_space *,
19 struct page *, struct page *); 19 struct page *, struct page *);
20 20
21extern int migrate_prep(void); 21extern int migrate_prep(void);
22extern int migrate_prep_local(void);
22extern int migrate_vmas(struct mm_struct *mm, 23extern int migrate_vmas(struct mm_struct *mm,
23 const nodemask_t *from, const nodemask_t *to, 24 const nodemask_t *from, const nodemask_t *to,
24 unsigned long flags); 25 unsigned long flags);
25#else 26#else
26#define PAGE_MIGRATION 0 27#define PAGE_MIGRATION 0
27 28
28static inline int putback_lru_pages(struct list_head *l) { return 0; } 29static inline void putback_lru_pages(struct list_head *l) {}
29static inline int migrate_pages(struct list_head *l, new_page_t x, 30static inline int migrate_pages(struct list_head *l, new_page_t x,
30 unsigned long private, int offlining) { return -ENOSYS; } 31 unsigned long private, int offlining) { return -ENOSYS; }
31 32
32static inline int migrate_prep(void) { return -ENOSYS; } 33static inline int migrate_prep(void) { return -ENOSYS; }
34static inline int migrate_prep_local(void) { return -ENOSYS; }
33 35
34static inline int migrate_vmas(struct mm_struct *mm, 36static inline int migrate_vmas(struct mm_struct *mm,
35 const nodemask_t *from, const nodemask_t *to, 37 const nodemask_t *from, const nodemask_t *to,
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index adaf3c15e449..f6c9b7dcb9fd 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -3,6 +3,12 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/major.h> 4#include <linux/major.h>
5 5
6/*
7 * These allocations are managed by device@lanana.org. If you use an
8 * entry that is not in assigned your entry may well be moved and
9 * reassigned, or set dynamic if a fixed value is not justified.
10 */
11
6#define PSMOUSE_MINOR 1 12#define PSMOUSE_MINOR 1
7#define MS_BUSMOUSE_MINOR 2 13#define MS_BUSMOUSE_MINOR 2
8#define ATIXL_BUSMOUSE_MINOR 3 14#define ATIXL_BUSMOUSE_MINOR 3
@@ -30,6 +36,8 @@
30#define HPET_MINOR 228 36#define HPET_MINOR 228
31#define FUSE_MINOR 229 37#define FUSE_MINOR 229
32#define KVM_MINOR 232 38#define KVM_MINOR 232
39#define BTRFS_MINOR 234
40#define AUTOFS_MINOR 235
33#define MISC_DYNAMIC_MINOR 255 41#define MISC_DYNAMIC_MINOR 255
34 42
35struct device; 43struct device;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e92d1bfdb330..7a7f9c1e679a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -123,8 +123,8 @@ enum {
123 MLX4_OPCODE_RDMA_READ = 0x10, 123 MLX4_OPCODE_RDMA_READ = 0x10,
124 MLX4_OPCODE_ATOMIC_CS = 0x11, 124 MLX4_OPCODE_ATOMIC_CS = 0x11,
125 MLX4_OPCODE_ATOMIC_FA = 0x12, 125 MLX4_OPCODE_ATOMIC_FA = 0x12,
126 MLX4_OPCODE_ATOMIC_MASK_CS = 0x14, 126 MLX4_OPCODE_MASKED_ATOMIC_CS = 0x14,
127 MLX4_OPCODE_ATOMIC_MASK_FA = 0x15, 127 MLX4_OPCODE_MASKED_ATOMIC_FA = 0x15,
128 MLX4_OPCODE_BIND_MW = 0x18, 128 MLX4_OPCODE_BIND_MW = 0x18,
129 MLX4_OPCODE_FMR = 0x19, 129 MLX4_OPCODE_FMR = 0x19,
130 MLX4_OPCODE_LOCAL_INVAL = 0x1b, 130 MLX4_OPCODE_LOCAL_INVAL = 0x1b,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 9f29d86e5dc9..7abe64326f72 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -285,6 +285,13 @@ struct mlx4_wqe_atomic_seg {
285 __be64 compare; 285 __be64 compare;
286}; 286};
287 287
288struct mlx4_wqe_masked_atomic_seg {
289 __be64 swap_add;
290 __be64 compare;
291 __be64 swap_add_mask;
292 __be64 compare_mask;
293};
294
288struct mlx4_wqe_data_seg { 295struct mlx4_wqe_data_seg {
289 __be32 byte_count; 296 __be32 byte_count;
290 __be32 lkey; 297 __be32 lkey;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 60c467bfbabd..a2b48041b910 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -12,13 +12,14 @@
12#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
13#include <linux/debug_locks.h> 13#include <linux/debug_locks.h>
14#include <linux/mm_types.h> 14#include <linux/mm_types.h>
15#include <linux/range.h>
16#include <linux/pfn.h>
15 17
16struct mempolicy; 18struct mempolicy;
17struct anon_vma; 19struct anon_vma;
18struct file_ra_state; 20struct file_ra_state;
19struct user_struct; 21struct user_struct;
20struct writeback_control; 22struct writeback_control;
21struct rlimit;
22 23
23#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 24#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
24extern unsigned long max_mapnr; 25extern unsigned long max_mapnr;
@@ -106,6 +107,9 @@ extern unsigned int kobjsize(const void *objp);
106#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 107#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
107#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ 108#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
108 109
110/* Bits set in the VMA until the stack is in its final location */
111#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)
112
109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 113#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 114#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
111#endif 115#endif
@@ -265,6 +269,8 @@ static inline int get_page_unless_zero(struct page *page)
265 return atomic_inc_not_zero(&page->_count); 269 return atomic_inc_not_zero(&page->_count);
266} 270}
267 271
272extern int page_is_ram(unsigned long pfn);
273
268/* Support for virtually mapped pages */ 274/* Support for virtually mapped pages */
269struct page *vmalloc_to_page(const void *addr); 275struct page *vmalloc_to_page(const void *addr);
270unsigned long vmalloc_to_pfn(const void *addr); 276unsigned long vmalloc_to_pfn(const void *addr);
@@ -332,6 +338,7 @@ void put_page(struct page *page);
332void put_pages_list(struct list_head *pages); 338void put_pages_list(struct list_head *pages);
333 339
334void split_page(struct page *page, unsigned int order); 340void split_page(struct page *page, unsigned int order);
341int split_free_page(struct page *page);
335 342
336/* 343/*
337 * Compound pages have a destructor function. Provide a 344 * Compound pages have a destructor function. Provide a
@@ -589,7 +596,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
589 596
590static __always_inline void *lowmem_page_address(struct page *page) 597static __always_inline void *lowmem_page_address(struct page *page)
591{ 598{
592 return __va(page_to_pfn(page) << PAGE_SHIFT); 599 return __va(PFN_PHYS(page_to_pfn(page)));
593} 600}
594 601
595#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) 602#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
@@ -780,8 +787,8 @@ struct mm_walk {
780 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); 787 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
781 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); 788 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
782 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); 789 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
783 int (*hugetlb_entry)(pte_t *, unsigned long, unsigned long, 790 int (*hugetlb_entry)(pte_t *, unsigned long,
784 struct mm_walk *); 791 unsigned long, unsigned long, struct mm_walk *);
785 struct mm_struct *mm; 792 struct mm_struct *mm;
786 void *private; 793 void *private;
787}; 794};
@@ -867,6 +874,114 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
867 */ 874 */
868int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 875int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
869 struct page **pages); 876 struct page **pages);
877/*
878 * per-process(per-mm_struct) statistics.
879 */
880#if defined(SPLIT_RSS_COUNTING)
881/*
882 * The mm counters are not protected by its page_table_lock,
883 * so must be incremented atomically.
884 */
885static inline void set_mm_counter(struct mm_struct *mm, int member, long value)
886{
887 atomic_long_set(&mm->rss_stat.count[member], value);
888}
889
890unsigned long get_mm_counter(struct mm_struct *mm, int member);
891
892static inline void add_mm_counter(struct mm_struct *mm, int member, long value)
893{
894 atomic_long_add(value, &mm->rss_stat.count[member]);
895}
896
897static inline void inc_mm_counter(struct mm_struct *mm, int member)
898{
899 atomic_long_inc(&mm->rss_stat.count[member]);
900}
901
902static inline void dec_mm_counter(struct mm_struct *mm, int member)
903{
904 atomic_long_dec(&mm->rss_stat.count[member]);
905}
906
907#else /* !USE_SPLIT_PTLOCKS */
908/*
909 * The mm counters are protected by its page_table_lock,
910 * so can be incremented directly.
911 */
912static inline void set_mm_counter(struct mm_struct *mm, int member, long value)
913{
914 mm->rss_stat.count[member] = value;
915}
916
917static inline unsigned long get_mm_counter(struct mm_struct *mm, int member)
918{
919 return mm->rss_stat.count[member];
920}
921
922static inline void add_mm_counter(struct mm_struct *mm, int member, long value)
923{
924 mm->rss_stat.count[member] += value;
925}
926
927static inline void inc_mm_counter(struct mm_struct *mm, int member)
928{
929 mm->rss_stat.count[member]++;
930}
931
932static inline void dec_mm_counter(struct mm_struct *mm, int member)
933{
934 mm->rss_stat.count[member]--;
935}
936
937#endif /* !USE_SPLIT_PTLOCKS */
938
939static inline unsigned long get_mm_rss(struct mm_struct *mm)
940{
941 return get_mm_counter(mm, MM_FILEPAGES) +
942 get_mm_counter(mm, MM_ANONPAGES);
943}
944
945static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
946{
947 return max(mm->hiwater_rss, get_mm_rss(mm));
948}
949
950static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
951{
952 return max(mm->hiwater_vm, mm->total_vm);
953}
954
955static inline void update_hiwater_rss(struct mm_struct *mm)
956{
957 unsigned long _rss = get_mm_rss(mm);
958
959 if ((mm)->hiwater_rss < _rss)
960 (mm)->hiwater_rss = _rss;
961}
962
963static inline void update_hiwater_vm(struct mm_struct *mm)
964{
965 if (mm->hiwater_vm < mm->total_vm)
966 mm->hiwater_vm = mm->total_vm;
967}
968
969static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
970 struct mm_struct *mm)
971{
972 unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
973
974 if (*maxrss < hiwater_rss)
975 *maxrss = hiwater_rss;
976}
977
978#if defined(SPLIT_RSS_COUNTING)
979void sync_mm_rss(struct task_struct *task, struct mm_struct *mm);
980#else
981static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
982{
983}
984#endif
870 985
871/* 986/*
872 * A callback you can register to apply pressure to ageable caches. 987 * A callback you can register to apply pressure to ageable caches.
@@ -884,7 +999,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
884 * querying the cache size, so a fastpath for that case is appropriate. 999 * querying the cache size, so a fastpath for that case is appropriate.
885 */ 1000 */
886struct shrinker { 1001struct shrinker {
887 int (*shrink)(int nr_to_scan, gfp_t gfp_mask); 1002 int (*shrink)(struct shrinker *, int nr_to_scan, gfp_t gfp_mask);
888 int seeks; /* seeks to recreate an obj */ 1003 int seeks; /* seeks to recreate an obj */
889 1004
890 /* These are for internal use */ 1005 /* These are for internal use */
@@ -1047,6 +1162,10 @@ extern void get_pfn_range_for_nid(unsigned int nid,
1047extern unsigned long find_min_pfn_with_active_regions(void); 1162extern unsigned long find_min_pfn_with_active_regions(void);
1048extern void free_bootmem_with_active_regions(int nid, 1163extern void free_bootmem_with_active_regions(int nid,
1049 unsigned long max_low_pfn); 1164 unsigned long max_low_pfn);
1165int add_from_early_node_map(struct range *range, int az,
1166 int nr_range, int nid);
1167void *__alloc_memory_core_early(int nodeid, u64 size, u64 align,
1168 u64 goal, u64 limit);
1050typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1169typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1051extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); 1170extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1052extern void sparse_memory_present_with_active_regions(int nid); 1171extern void sparse_memory_present_with_active_regions(int nid);
@@ -1079,11 +1198,7 @@ extern void si_meminfo(struct sysinfo * val);
1079extern void si_meminfo_node(struct sysinfo *val, int nid); 1198extern void si_meminfo_node(struct sysinfo *val, int nid);
1080extern int after_bootmem; 1199extern int after_bootmem;
1081 1200
1082#ifdef CONFIG_NUMA
1083extern void setup_per_cpu_pageset(void); 1201extern void setup_per_cpu_pageset(void);
1084#else
1085static inline void setup_per_cpu_pageset(void) {}
1086#endif
1087 1202
1088extern void zone_pcp_update(struct zone *zone); 1203extern void zone_pcp_update(struct zone *zone);
1089 1204
@@ -1111,7 +1226,7 @@ static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
1111 1226
1112/* mmap.c */ 1227/* mmap.c */
1113extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); 1228extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin);
1114extern void vma_adjust(struct vm_area_struct *vma, unsigned long start, 1229extern int vma_adjust(struct vm_area_struct *vma, unsigned long start,
1115 unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); 1230 unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert);
1116extern struct vm_area_struct *vma_merge(struct mm_struct *, 1231extern struct vm_area_struct *vma_merge(struct mm_struct *,
1117 struct vm_area_struct *prev, unsigned long addr, unsigned long end, 1232 struct vm_area_struct *prev, unsigned long addr, unsigned long end,
@@ -1319,21 +1434,25 @@ extern int randomize_va_space;
1319const char * arch_vma_name(struct vm_area_struct *vma); 1434const char * arch_vma_name(struct vm_area_struct *vma);
1320void print_vma_addr(char *prefix, unsigned long rip); 1435void print_vma_addr(char *prefix, unsigned long rip);
1321 1436
1437void sparse_mem_maps_populate_node(struct page **map_map,
1438 unsigned long pnum_begin,
1439 unsigned long pnum_end,
1440 unsigned long map_count,
1441 int nodeid);
1442
1322struct page *sparse_mem_map_populate(unsigned long pnum, int nid); 1443struct page *sparse_mem_map_populate(unsigned long pnum, int nid);
1323pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); 1444pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
1324pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); 1445pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node);
1325pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); 1446pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node);
1326pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); 1447pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node);
1327void *vmemmap_alloc_block(unsigned long size, int node); 1448void *vmemmap_alloc_block(unsigned long size, int node);
1449void *vmemmap_alloc_block_buf(unsigned long size, int node);
1328void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); 1450void vmemmap_verify(pte_t *, int, unsigned long, unsigned long);
1329int vmemmap_populate_basepages(struct page *start_page, 1451int vmemmap_populate_basepages(struct page *start_page,
1330 unsigned long pages, int node); 1452 unsigned long pages, int node);
1331int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1453int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1332void vmemmap_populate_print_last(void); 1454void vmemmap_populate_print_last(void);
1333 1455
1334extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1335 size_t size);
1336extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1337 1456
1338enum mf_flags { 1457enum mf_flags {
1339 MF_COUNT_INCREASED = 1 << 0, 1458 MF_COUNT_INCREASED = 1 << 0,
@@ -1347,5 +1466,7 @@ extern void shake_page(struct page *p, int access);
1347extern atomic_long_t mce_bad_pages; 1466extern atomic_long_t mce_bad_pages;
1348extern int soft_offline_page(struct page *page, int flags); 1467extern int soft_offline_page(struct page *page, int flags);
1349 1468
1469extern void dump_page(struct page *page);
1470
1350#endif /* __KERNEL__ */ 1471#endif /* __KERNEL__ */
1351#endif /* _LINUX_MM_H */ 1472#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 36f96271306c..b8bb9a6a1f37 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -24,12 +24,6 @@ struct address_space;
24 24
25#define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) 25#define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
26 26
27#if USE_SPLIT_PTLOCKS
28typedef atomic_long_t mm_counter_t;
29#else /* !USE_SPLIT_PTLOCKS */
30typedef unsigned long mm_counter_t;
31#endif /* !USE_SPLIT_PTLOCKS */
32
33/* 27/*
34 * Each physical page in the system has a struct page associated with 28 * Each physical page in the system has a struct page associated with
35 * it to keep track of whatever it is we are using the page for at the 29 * it to keep track of whatever it is we are using the page for at the
@@ -169,7 +163,8 @@ struct vm_area_struct {
169 * can only be in the i_mmap tree. An anonymous MAP_PRIVATE, stack 163 * can only be in the i_mmap tree. An anonymous MAP_PRIVATE, stack
170 * or brk vma (with NULL file) can only be in an anon_vma list. 164 * or brk vma (with NULL file) can only be in an anon_vma list.
171 */ 165 */
172 struct list_head anon_vma_node; /* Serialized by anon_vma->lock */ 166 struct list_head anon_vma_chain; /* Serialized by mmap_sem &
167 * page_table_lock */
173 struct anon_vma *anon_vma; /* Serialized by page_table_lock */ 168 struct anon_vma *anon_vma; /* Serialized by page_table_lock */
174 169
175 /* Function pointers to deal with this struct. */ 170 /* Function pointers to deal with this struct. */
@@ -201,6 +196,29 @@ struct core_state {
201 struct completion startup; 196 struct completion startup;
202}; 197};
203 198
199enum {
200 MM_FILEPAGES,
201 MM_ANONPAGES,
202 MM_SWAPENTS,
203 NR_MM_COUNTERS
204};
205
206#if USE_SPLIT_PTLOCKS && defined(CONFIG_MMU)
207#define SPLIT_RSS_COUNTING
208struct mm_rss_stat {
209 atomic_long_t count[NR_MM_COUNTERS];
210};
211/* per-thread cached information, */
212struct task_rss_stat {
213 int events; /* for synchronization threshold */
214 int count[NR_MM_COUNTERS];
215};
216#else /* !USE_SPLIT_PTLOCKS */
217struct mm_rss_stat {
218 unsigned long count[NR_MM_COUNTERS];
219};
220#endif /* !USE_SPLIT_PTLOCKS */
221
204struct mm_struct { 222struct mm_struct {
205 struct vm_area_struct * mmap; /* list of VMAs */ 223 struct vm_area_struct * mmap; /* list of VMAs */
206 struct rb_root mm_rb; 224 struct rb_root mm_rb;
@@ -227,11 +245,6 @@ struct mm_struct {
227 * by mmlist_lock 245 * by mmlist_lock
228 */ 246 */
229 247
230 /* Special counters, in some configurations protected by the
231 * page_table_lock, in other configurations by being atomic.
232 */
233 mm_counter_t _file_rss;
234 mm_counter_t _anon_rss;
235 248
236 unsigned long hiwater_rss; /* High-watermark of RSS usage */ 249 unsigned long hiwater_rss; /* High-watermark of RSS usage */
237 unsigned long hiwater_vm; /* High-water virtual memory usage */ 250 unsigned long hiwater_vm; /* High-water virtual memory usage */
@@ -244,6 +257,12 @@ struct mm_struct {
244 257
245 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 258 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
246 259
260 /*
261 * Special counters, in some configurations protected by the
262 * page_table_lock, in other configurations by being atomic.
263 */
264 struct mm_rss_stat rss_stat;
265
247 struct linux_binfmt *binfmt; 266 struct linux_binfmt *binfmt;
248 267
249 cpumask_t cpu_vm_mask; 268 cpumask_t cpu_vm_mask;
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 2ee22e8af110..d02d2c6e0cfe 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -99,6 +99,8 @@ struct mmc_card {
99#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 99#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
100 unsigned int quirks; /* card quirks */ 100 unsigned int quirks; /* card quirks */
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
102#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
103 /* for byte mode */
102 104
103 u32 raw_cid[4]; /* raw card CID */ 105 u32 raw_cid[4]; /* raw card CID */
104 u32 raw_csd[4]; /* raw card CSD */ 106 u32 raw_csd[4]; /* raw card CSD */
@@ -139,6 +141,11 @@ static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
139 return c->quirks & MMC_QUIRK_LENIENT_FN0; 141 return c->quirks & MMC_QUIRK_LENIENT_FN0;
140} 142}
141 143
144static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
145{
146 return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
147}
148
142#define mmc_card_name(c) ((c)->cid.prod_name) 149#define mmc_card_name(c) ((c)->cid.prod_name)
143#define mmc_card_id(c) (dev_name(&(c)->dev)) 150#define mmc_card_id(c) (dev_name(&(c)->dev))
144 151
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index eaf36364b7d4..f65913c9f5a4 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -14,6 +14,7 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15 15
16#include <linux/mmc/core.h> 16#include <linux/mmc/core.h>
17#include <linux/mmc/pm.h>
17 18
18struct mmc_ios { 19struct mmc_ios {
19 unsigned int clock; /* clock rate */ 20 unsigned int clock; /* clock rate */
@@ -107,6 +108,9 @@ struct mmc_host_ops {
107 int (*get_cd)(struct mmc_host *host); 108 int (*get_cd)(struct mmc_host *host);
108 109
109 void (*enable_sdio_irq)(struct mmc_host *host, int enable); 110 void (*enable_sdio_irq)(struct mmc_host *host, int enable);
111
112 /* optional callback for HC quirks */
113 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
110}; 114};
111 115
112struct mmc_card; 116struct mmc_card;
@@ -152,6 +156,8 @@ struct mmc_host {
152#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 156#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
153#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 157#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
154 158
159 mmc_pm_flag_t pm_caps; /* supported pm features */
160
155 /* host specific block data */ 161 /* host specific block data */
156 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 162 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
157 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ 163 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */
@@ -197,6 +203,8 @@ struct mmc_host {
197 struct task_struct *sdio_irq_thread; 203 struct task_struct *sdio_irq_thread;
198 atomic_t sdio_irq_thread_abort; 204 atomic_t sdio_irq_thread_abort;
199 205
206 mmc_pm_flag_t pm_flags; /* requested pm features */
207
200#ifdef CONFIG_LEDS_TRIGGERS 208#ifdef CONFIG_LEDS_TRIGGERS
201 struct led_trigger *led; /* activity led */ 209 struct led_trigger *led; /* activity led */
202#endif 210#endif
@@ -222,7 +230,7 @@ static inline void *mmc_priv(struct mmc_host *host)
222#define mmc_classdev(x) (&(x)->class_dev) 230#define mmc_classdev(x) (&(x)->class_dev)
223#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 231#define mmc_hostname(x) (dev_name(&(x)->class_dev))
224 232
225extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 233extern int mmc_suspend_host(struct mmc_host *);
226extern int mmc_resume_host(struct mmc_host *); 234extern int mmc_resume_host(struct mmc_host *);
227 235
228extern void mmc_power_save_host(struct mmc_host *host); 236extern void mmc_power_save_host(struct mmc_host *host);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index c02c8db73701..8a49cbf0376d 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -268,6 +268,7 @@ struct _mmc_csd {
268 268
269#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 269#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
270#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 270#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
271#define EXT_CSD_CARD_TYPE_MASK 0x3 /* Mask out reserved and DDR bits */
271 272
272#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 273#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
273#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 274#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
new file mode 100644
index 000000000000..d37aac49cf9a
--- /dev/null
+++ b/include/linux/mmc/pm.h
@@ -0,0 +1,30 @@
1/*
2 * linux/include/linux/mmc/pm.h
3 *
4 * Author: Nicolas Pitre
5 * Copyright: (C) 2009 Marvell Technology Group Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef LINUX_MMC_PM_H
13#define LINUX_MMC_PM_H
14
15/*
16 * These flags are used to describe power management features that
17 * some cards (typically SDIO cards) might wish to benefit from when
18 * the host system is being suspended. There are several layers of
19 * abstractions involved, from the host controller driver, to the MMC core
20 * code, to the SDIO core code, to finally get to the actual SDIO function
21 * driver. This file is therefore used for common definitions shared across
22 * all those layers.
23 */
24
25typedef unsigned int mmc_pm_flag_t;
26
27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
29
30#endif
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
new file mode 100644
index 000000000000..9188c973f3e1
--- /dev/null
+++ b/include/linux/mmc/sdhci-spear.h
@@ -0,0 +1,42 @@
1/*
2 * include/linux/mmc/sdhci-spear.h
3 *
4 * SDHCI declarations specific to ST SPEAr platform
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef MMC_SDHCI_SPEAR_H
15#define MMC_SDHCI_SPEAR_H
16
17#include <linux/platform_device.h>
18/*
19 * struct sdhci_plat_data: spear sdhci platform data structure
20 *
21 * @card_power_gpio: gpio pin for enabling/disabling power to sdhci socket
22 * @power_active_high: if set, enable power to sdhci socket by setting
23 * card_power_gpio
24 * @power_always_enb: If set, then enable power on probe, otherwise enable only
25 * on card insertion and disable on card removal.
26 * card_int_gpio: gpio pin used for card detection
27 */
28struct sdhci_plat_data {
29 int card_power_gpio;
30 int power_active_high;
31 int power_always_enb;
32 int card_int_gpio;
33};
34
35/* This function is used to set platform_data field of pdev->dev */
36static inline void
37sdhci_set_plat_data(struct platform_device *pdev, struct sdhci_plat_data *data)
38{
39 pdev->dev.platform_data = data;
40}
41
42#endif /* MMC_SDHCI_SPEAR_H */
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 47ba464f5170..329a8faa6e37 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -94,6 +94,10 @@
94 94
95#define SDIO_BUS_WIDTH_1BIT 0x00 95#define SDIO_BUS_WIDTH_1BIT 0x00
96#define SDIO_BUS_WIDTH_4BIT 0x02 96#define SDIO_BUS_WIDTH_4BIT 0x02
97#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
98#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
99
100#define SDIO_BUS_ASYNC_INT 0x20
97 101
98#define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */ 102#define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */
99 103
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index ac3ab683fec6..31baaf82f458 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -15,6 +15,8 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h> 16#include <linux/mod_devicetable.h>
17 17
18#include <linux/mmc/pm.h>
19
18struct mmc_card; 20struct mmc_card;
19struct sdio_func; 21struct sdio_func;
20 22
@@ -143,6 +145,9 @@ extern void sdio_writew(struct sdio_func *func, u16 b,
143extern void sdio_writel(struct sdio_func *func, u32 b, 145extern void sdio_writel(struct sdio_func *func, u32 b,
144 unsigned int addr, int *err_ret); 146 unsigned int addr, int *err_ret);
145 147
148extern u8 sdio_writeb_readb(struct sdio_func *func, u8 write_byte,
149 unsigned int addr, int *err_ret);
150
146extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, 151extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
147 void *src, int count); 152 void *src, int count);
148extern int sdio_writesb(struct sdio_func *func, unsigned int addr, 153extern int sdio_writesb(struct sdio_func *func, unsigned int addr,
@@ -153,5 +158,8 @@ extern unsigned char sdio_f0_readb(struct sdio_func *func,
153extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b, 158extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
154 unsigned int addr, int *err_ret); 159 unsigned int addr, int *err_ret);
155 160
161extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
162extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
163
156#endif 164#endif
157 165
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
new file mode 100644
index 000000000000..d4a2ebbdab4b
--- /dev/null
+++ b/include/linux/mmc/sh_mmcif.h
@@ -0,0 +1,200 @@
1/*
2 * include/linux/mmc/sh_mmcif.h
3 *
4 * platform data for eMMC driver
5 *
6 * Copyright (C) 2010 Renesas Solutions Corp.
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.
11 *
12 */
13
14#ifndef __SH_MMCIF_H__
15#define __SH_MMCIF_H__
16
17#include <linux/platform_device.h>
18#include <linux/io.h>
19
20/*
21 * MMCIF : CE_CLK_CTRL [19:16]
22 * 1000 : Peripheral clock / 512
23 * 0111 : Peripheral clock / 256
24 * 0110 : Peripheral clock / 128
25 * 0101 : Peripheral clock / 64
26 * 0100 : Peripheral clock / 32
27 * 0011 : Peripheral clock / 16
28 * 0010 : Peripheral clock / 8
29 * 0001 : Peripheral clock / 4
30 * 0000 : Peripheral clock / 2
31 * 1111 : Peripheral clock (sup_pclk set '1')
32 */
33
34struct sh_mmcif_plat_data {
35 void (*set_pwr)(struct platform_device *pdev, int state);
36 void (*down_pwr)(struct platform_device *pdev);
37 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
38 unsigned long caps;
39 u32 ocr;
40};
41
42#define MMCIF_CE_CMD_SET 0x00000000
43#define MMCIF_CE_ARG 0x00000008
44#define MMCIF_CE_ARG_CMD12 0x0000000C
45#define MMCIF_CE_CMD_CTRL 0x00000010
46#define MMCIF_CE_BLOCK_SET 0x00000014
47#define MMCIF_CE_CLK_CTRL 0x00000018
48#define MMCIF_CE_BUF_ACC 0x0000001C
49#define MMCIF_CE_RESP3 0x00000020
50#define MMCIF_CE_RESP2 0x00000024
51#define MMCIF_CE_RESP1 0x00000028
52#define MMCIF_CE_RESP0 0x0000002C
53#define MMCIF_CE_RESP_CMD12 0x00000030
54#define MMCIF_CE_DATA 0x00000034
55#define MMCIF_CE_INT 0x00000040
56#define MMCIF_CE_INT_MASK 0x00000044
57#define MMCIF_CE_HOST_STS1 0x00000048
58#define MMCIF_CE_HOST_STS2 0x0000004C
59#define MMCIF_CE_VERSION 0x0000007C
60
61extern inline u32 sh_mmcif_readl(void __iomem *addr, int reg)
62{
63 return readl(addr + reg);
64}
65
66extern inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
67{
68 writel(val, addr + reg);
69}
70
71#define SH_MMCIF_BBS 512 /* boot block size */
72
73extern inline void sh_mmcif_boot_cmd_send(void __iomem *base,
74 unsigned long cmd, unsigned long arg)
75{
76 sh_mmcif_writel(base, MMCIF_CE_INT, 0);
77 sh_mmcif_writel(base, MMCIF_CE_ARG, arg);
78 sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd);
79}
80
81extern inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask)
82{
83 unsigned long tmp;
84 int cnt;
85
86 for (cnt = 0; cnt < 1000000; cnt++) {
87 tmp = sh_mmcif_readl(base, MMCIF_CE_INT);
88 if (tmp & mask) {
89 sh_mmcif_writel(base, MMCIF_CE_INT, tmp & ~mask);
90 return 0;
91 }
92 }
93
94 return -1;
95}
96
97extern inline int sh_mmcif_boot_cmd(void __iomem *base,
98 unsigned long cmd, unsigned long arg)
99{
100 sh_mmcif_boot_cmd_send(base, cmd, arg);
101 return sh_mmcif_boot_cmd_poll(base, 0x00010000);
102}
103
104extern inline int sh_mmcif_boot_do_read_single(void __iomem *base,
105 unsigned int block_nr,
106 unsigned long *buf)
107{
108 int k;
109
110 /* CMD13 - Status */
111 sh_mmcif_boot_cmd(base, 0x0d400000, 0x00010000);
112
113 if (sh_mmcif_readl(base, MMCIF_CE_RESP0) != 0x0900)
114 return -1;
115
116 /* CMD17 - Read */
117 sh_mmcif_boot_cmd(base, 0x11480000, block_nr * SH_MMCIF_BBS);
118 if (sh_mmcif_boot_cmd_poll(base, 0x00100000) < 0)
119 return -1;
120
121 for (k = 0; k < (SH_MMCIF_BBS / 4); k++)
122 buf[k] = sh_mmcif_readl(base, MMCIF_CE_DATA);
123
124 return 0;
125}
126
127extern inline int sh_mmcif_boot_do_read(void __iomem *base,
128 unsigned long first_block,
129 unsigned long nr_blocks,
130 void *buf)
131{
132 unsigned long k;
133 int ret = 0;
134
135 /* CMD16 - Set the block size */
136 sh_mmcif_boot_cmd(base, 0x10400000, SH_MMCIF_BBS);
137
138 for (k = 0; !ret && k < nr_blocks; k++)
139 ret = sh_mmcif_boot_do_read_single(base, first_block + k,
140 buf + (k * SH_MMCIF_BBS));
141
142 return ret;
143}
144
145extern inline void sh_mmcif_boot_init(void __iomem *base)
146{
147 unsigned long tmp;
148
149 /* reset */
150 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION);
151 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | 0x80000000);
152 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & ~0x80000000);
153
154 /* byte swap */
155 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, 0x00010000);
156
157 /* Set block size in MMCIF hardware */
158 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS);
159
160 /* Enable the clock, set it to Bus clock/256 (about 325Khz)*/
161 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01072fff);
162
163 /* CMD0 */
164 sh_mmcif_boot_cmd(base, 0x00000040, 0);
165
166 /* CMD1 - Get OCR */
167 do {
168 sh_mmcif_boot_cmd(base, 0x01405040, 0x40300000); /* CMD1 */
169 } while ((sh_mmcif_readl(base, MMCIF_CE_RESP0) & 0x80000000)
170 != 0x80000000);
171
172 /* CMD2 - Get CID */
173 sh_mmcif_boot_cmd(base, 0x02806040, 0);
174
175 /* CMD3 - Set card relative address */
176 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);
177}
178
179extern inline void sh_mmcif_boot_slurp(void __iomem *base,
180 unsigned char *buf,
181 unsigned long no_bytes)
182{
183 unsigned long tmp;
184
185 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
186 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01012fff);
187
188 /* CMD9 - Get CSD */
189 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
190
191 /* CMD7 - Select the card */
192 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
193
194 tmp = no_bytes / SH_MMCIF_BBS;
195 tmp += (no_bytes % SH_MMCIF_BBS) ? 1 : 0;
196
197 sh_mmcif_boot_do_read(base, 512, tmp, buf);
198}
199
200#endif /* __SH_MMCIF_H__ */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 30fe668c2542..b4d109e389b8 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -184,13 +184,7 @@ struct per_cpu_pageset {
184 s8 stat_threshold; 184 s8 stat_threshold;
185 s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; 185 s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS];
186#endif 186#endif
187} ____cacheline_aligned_in_smp; 187};
188
189#ifdef CONFIG_NUMA
190#define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)])
191#else
192#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
193#endif
194 188
195#endif /* !__GENERATING_BOUNDS.H */ 189#endif /* !__GENERATING_BOUNDS.H */
196 190
@@ -306,14 +300,13 @@ struct zone {
306 */ 300 */
307 unsigned long min_unmapped_pages; 301 unsigned long min_unmapped_pages;
308 unsigned long min_slab_pages; 302 unsigned long min_slab_pages;
309 struct per_cpu_pageset *pageset[NR_CPUS];
310#else
311 struct per_cpu_pageset pageset[NR_CPUS];
312#endif 303#endif
304 struct per_cpu_pageset __percpu *pageset;
313 /* 305 /*
314 * free areas of different sizes 306 * free areas of different sizes
315 */ 307 */
316 spinlock_t lock; 308 spinlock_t lock;
309 int all_unreclaimable; /* All pages pinned */
317#ifdef CONFIG_MEMORY_HOTPLUG 310#ifdef CONFIG_MEMORY_HOTPLUG
318 /* see spanned/present_pages for more description */ 311 /* see spanned/present_pages for more description */
319 seqlock_t span_seqlock; 312 seqlock_t span_seqlock;
@@ -328,6 +321,15 @@ struct zone {
328 unsigned long *pageblock_flags; 321 unsigned long *pageblock_flags;
329#endif /* CONFIG_SPARSEMEM */ 322#endif /* CONFIG_SPARSEMEM */
330 323
324#ifdef CONFIG_COMPACTION
325 /*
326 * On compaction failure, 1<<compact_defer_shift compactions
327 * are skipped before trying again. The number attempted since
328 * last failure is tracked with compact_considered.
329 */
330 unsigned int compact_considered;
331 unsigned int compact_defer_shift;
332#endif
331 333
332 ZONE_PADDING(_pad1_) 334 ZONE_PADDING(_pad1_)
333 335
@@ -349,7 +351,7 @@ struct zone {
349 * prev_priority holds the scanning priority for this zone. It is 351 * prev_priority holds the scanning priority for this zone. It is
350 * defined as the scanning priority at which we achieved our reclaim 352 * defined as the scanning priority at which we achieved our reclaim
351 * target at the previous try_to_free_pages() or balance_pgdat() 353 * target at the previous try_to_free_pages() or balance_pgdat()
352 * invokation. 354 * invocation.
353 * 355 *
354 * We use prev_priority as a measure of how much stress page reclaim is 356 * We use prev_priority as a measure of how much stress page reclaim is
355 * under - it drives the swappiness decision: whether to unmap mapped 357 * under - it drives the swappiness decision: whether to unmap mapped
@@ -425,7 +427,6 @@ struct zone {
425} ____cacheline_internodealigned_in_smp; 427} ____cacheline_internodealigned_in_smp;
426 428
427typedef enum { 429typedef enum {
428 ZONE_ALL_UNRECLAIMABLE, /* all pages pinned */
429 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ 430 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
430 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ 431 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */
431} zone_flags_t; 432} zone_flags_t;
@@ -445,11 +446,6 @@ static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
445 clear_bit(flag, &zone->flags); 446 clear_bit(flag, &zone->flags);
446} 447}
447 448
448static inline int zone_is_all_unreclaimable(const struct zone *zone)
449{
450 return test_bit(ZONE_ALL_UNRECLAIMABLE, &zone->flags);
451}
452
453static inline int zone_is_reclaim_locked(const struct zone *zone) 449static inline int zone_is_reclaim_locked(const struct zone *zone)
454{ 450{
455 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 451 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
@@ -620,7 +616,9 @@ typedef struct pglist_data {
620 struct page_cgroup *node_page_cgroup; 616 struct page_cgroup *node_page_cgroup;
621#endif 617#endif
622#endif 618#endif
619#ifndef CONFIG_NO_BOOTMEM
623 struct bootmem_data *bdata; 620 struct bootmem_data *bdata;
621#endif
624#ifdef CONFIG_MEMORY_HOTPLUG 622#ifdef CONFIG_MEMORY_HOTPLUG
625 /* 623 /*
626 * Must be held any time you expect node_start_pfn, node_present_pages 624 * Must be held any time you expect node_start_pfn, node_present_pages
@@ -652,9 +650,10 @@ typedef struct pglist_data {
652 650
653#include <linux/memory_hotplug.h> 651#include <linux/memory_hotplug.h>
654 652
653extern struct mutex zonelists_mutex;
655void get_zone_counts(unsigned long *active, unsigned long *inactive, 654void get_zone_counts(unsigned long *active, unsigned long *inactive,
656 unsigned long *free); 655 unsigned long *free);
657void build_all_zonelists(void); 656void build_all_zonelists(void *data);
658void wakeup_kswapd(struct zone *zone, int order); 657void wakeup_kswapd(struct zone *zone, int order);
659int zone_watermark_ok(struct zone *z, int order, unsigned long mark, 658int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
660 int classzone_idx, int alloc_flags); 659 int classzone_idx, int alloc_flags);
@@ -672,6 +671,12 @@ void memory_present(int nid, unsigned long start, unsigned long end);
672static inline void memory_present(int nid, unsigned long start, unsigned long end) {} 671static inline void memory_present(int nid, unsigned long start, unsigned long end) {}
673#endif 672#endif
674 673
674#ifdef CONFIG_HAVE_MEMORYLESS_NODES
675int local_memory_node(int node_id);
676#else
677static inline int local_memory_node(int node_id) { return node_id; };
678#endif
679
675#ifdef CONFIG_NEED_NODE_MEMMAP_SIZE 680#ifdef CONFIG_NEED_NODE_MEMMAP_SIZE
676unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); 681unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
677#endif 682#endif
@@ -983,7 +988,7 @@ struct mem_section {
983#endif 988#endif
984 989
985#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT) 990#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT)
986#define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT) 991#define NR_SECTION_ROOTS DIV_ROUND_UP(NR_MEM_SECTIONS, SECTIONS_PER_ROOT)
987#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) 992#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)
988 993
989#ifdef CONFIG_SPARSEMEM_EXTREME 994#ifdef CONFIG_SPARSEMEM_EXTREME
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index d74785c2393a..0b89efc6f215 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -35,6 +35,7 @@ static inline void get_mnt_ns(struct mnt_namespace *ns)
35extern const struct seq_operations mounts_op; 35extern const struct seq_operations mounts_op;
36extern const struct seq_operations mountinfo_op; 36extern const struct seq_operations mountinfo_op;
37extern const struct seq_operations mountstats_op; 37extern const struct seq_operations mountstats_op;
38extern int mnt_had_events(struct proc_mounts *);
38 39
39#endif 40#endif
40#endif 41#endif
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f58e9d836f32..48c007dae476 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -474,4 +474,46 @@ struct platform_device_id {
474 __attribute__((aligned(sizeof(kernel_ulong_t)))); 474 __attribute__((aligned(sizeof(kernel_ulong_t))));
475}; 475};
476 476
477#define MDIO_MODULE_PREFIX "mdio:"
478
479#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d"
480#define MDIO_ID_ARGS(_id) \
481 (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
482 ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
483 ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
484 ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
485 ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
486 ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
487 ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
488 ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
489
490/**
491 * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
492 * @phy_id: The result of
493 * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask
494 * for this PHY type
495 * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
496 * is used to terminate an array of struct mdio_device_id.
497 */
498struct mdio_device_id {
499 __u32 phy_id;
500 __u32 phy_id_mask;
501};
502
503struct zorro_device_id {
504 __u32 id; /* Device ID or ZORRO_WILDCARD */
505 kernel_ulong_t driver_data; /* Data private to the driver */
506};
507
508#define ZORRO_WILDCARD (0xffffffff) /* not official */
509
510#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
511
512#define ISAPNP_ANY_ID 0xffff
513struct isapnp_device_id {
514 unsigned short card_vendor, card_device;
515 unsigned short vendor, function;
516 kernel_ulong_t driver_data; /* data private to the driver */
517};
518
477#endif /* LINUX_MOD_DEVICETABLE_H */ 519#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 6cb1a3cab5d3..8a6b9fdc7ffa 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -17,7 +17,7 @@
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
19 19
20#include <asm/local.h> 20#include <linux/percpu.h>
21#include <asm/module.h> 21#include <asm/module.h>
22 22
23#include <trace/events/module.h> 23#include <trace/events/module.h>
@@ -175,11 +175,19 @@ struct notifier_block;
175 175
176#ifdef CONFIG_MODULES 176#ifdef CONFIG_MODULES
177 177
178extern int modules_disabled; /* for sysctl */
178/* Get/put a kernel symbol (calls must be symmetric) */ 179/* Get/put a kernel symbol (calls must be symmetric) */
179void *__symbol_get(const char *symbol); 180void *__symbol_get(const char *symbol);
180void *__symbol_get_gpl(const char *symbol); 181void *__symbol_get_gpl(const char *symbol);
181#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x))) 182#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x)))
182 183
184/* modules using other modules: kdb wants to see this. */
185struct module_use {
186 struct list_head source_list;
187 struct list_head target_list;
188 struct module *source, *target;
189};
190
183#ifndef __GENKSYMS__ 191#ifndef __GENKSYMS__
184#ifdef CONFIG_MODVERSIONS 192#ifdef CONFIG_MODVERSIONS
185/* Mark the CRC weak since genksyms apparently decides not to 193/* Mark the CRC weak since genksyms apparently decides not to
@@ -329,8 +337,11 @@ struct module
329 struct module_notes_attrs *notes_attrs; 337 struct module_notes_attrs *notes_attrs;
330#endif 338#endif
331 339
340#ifdef CONFIG_SMP
332 /* Per-cpu data. */ 341 /* Per-cpu data. */
333 void *percpu; 342 void __percpu *percpu;
343 unsigned int percpu_size;
344#endif
334 345
335 /* The command line arguments (may be mangled). People like 346 /* The command line arguments (may be mangled). People like
336 keeping pointers to this stuff */ 347 keeping pointers to this stuff */
@@ -355,7 +366,9 @@ struct module
355 366
356#ifdef CONFIG_MODULE_UNLOAD 367#ifdef CONFIG_MODULE_UNLOAD
357 /* What modules depend on me? */ 368 /* What modules depend on me? */
358 struct list_head modules_which_use_me; 369 struct list_head source_list;
370 /* What modules do I depend on? */
371 struct list_head target_list;
359 372
360 /* Who is waiting for us to be unloaded */ 373 /* Who is waiting for us to be unloaded */
361 struct task_struct *waiter; 374 struct task_struct *waiter;
@@ -363,11 +376,10 @@ struct module
363 /* Destruction function. */ 376 /* Destruction function. */
364 void (*exit)(void); 377 void (*exit)(void);
365 378
366#ifdef CONFIG_SMP 379 struct module_ref {
367 char *refptr; 380 unsigned int incs;
368#else 381 unsigned int decs;
369 local_t ref; 382 } __percpu *refptr;
370#endif
371#endif 383#endif
372 384
373#ifdef CONFIG_CONSTRUCTORS 385#ifdef CONFIG_CONSTRUCTORS
@@ -393,6 +405,7 @@ static inline int module_is_live(struct module *mod)
393struct module *__module_text_address(unsigned long addr); 405struct module *__module_text_address(unsigned long addr);
394struct module *__module_address(unsigned long addr); 406struct module *__module_address(unsigned long addr);
395bool is_module_address(unsigned long addr); 407bool is_module_address(unsigned long addr);
408bool is_module_percpu_address(unsigned long addr);
396bool is_module_text_address(unsigned long addr); 409bool is_module_text_address(unsigned long addr);
397 410
398static inline int within_module_core(unsigned long addr, struct module *mod) 411static inline int within_module_core(unsigned long addr, struct module *mod)
@@ -454,25 +467,15 @@ void __symbol_put(const char *symbol);
454#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) 467#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
455void symbol_put_addr(void *addr); 468void symbol_put_addr(void *addr);
456 469
457static inline local_t *__module_ref_addr(struct module *mod, int cpu)
458{
459#ifdef CONFIG_SMP
460 return (local_t *) (mod->refptr + per_cpu_offset(cpu));
461#else
462 return &mod->ref;
463#endif
464}
465
466/* Sometimes we know we already have a refcount, and it's easier not 470/* Sometimes we know we already have a refcount, and it's easier not
467 to handle the error case (which only happens with rmmod --wait). */ 471 to handle the error case (which only happens with rmmod --wait). */
468static inline void __module_get(struct module *module) 472static inline void __module_get(struct module *module)
469{ 473{
470 if (module) { 474 if (module) {
471 unsigned int cpu = get_cpu(); 475 preempt_disable();
472 local_inc(__module_ref_addr(module, cpu)); 476 __this_cpu_inc(module->refptr->incs);
473 trace_module_get(module, _THIS_IP_, 477 trace_module_get(module, _THIS_IP_);
474 local_read(__module_ref_addr(module, cpu))); 478 preempt_enable();
475 put_cpu();
476 } 479 }
477} 480}
478 481
@@ -481,15 +484,15 @@ static inline int try_module_get(struct module *module)
481 int ret = 1; 484 int ret = 1;
482 485
483 if (module) { 486 if (module) {
484 unsigned int cpu = get_cpu(); 487 preempt_disable();
488
485 if (likely(module_is_live(module))) { 489 if (likely(module_is_live(module))) {
486 local_inc(__module_ref_addr(module, cpu)); 490 __this_cpu_inc(module->refptr->incs);
487 trace_module_get(module, _THIS_IP_, 491 trace_module_get(module, _THIS_IP_);
488 local_read(__module_ref_addr(module, cpu))); 492 } else
489 }
490 else
491 ret = 0; 493 ret = 0;
492 put_cpu(); 494
495 preempt_enable();
493 } 496 }
494 return ret; 497 return ret;
495} 498}
@@ -571,6 +574,11 @@ static inline bool is_module_address(unsigned long addr)
571 return false; 574 return false;
572} 575}
573 576
577static inline bool is_module_percpu_address(unsigned long addr)
578{
579 return false;
580}
581
574static inline bool is_module_text_address(unsigned long addr) 582static inline bool is_module_text_address(unsigned long addr)
575{ 583{
576 return false; 584 return false;
@@ -664,43 +672,10 @@ static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
664 672
665#endif /* CONFIG_MODULES */ 673#endif /* CONFIG_MODULES */
666 674
667struct device_driver;
668#ifdef CONFIG_SYSFS 675#ifdef CONFIG_SYSFS
669struct module;
670
671extern struct kset *module_kset; 676extern struct kset *module_kset;
672extern struct kobj_type module_ktype; 677extern struct kobj_type module_ktype;
673extern int module_sysfs_initialized; 678extern int module_sysfs_initialized;
674
675int mod_sysfs_init(struct module *mod);
676int mod_sysfs_setup(struct module *mod,
677 struct kernel_param *kparam,
678 unsigned int num_params);
679int module_add_modinfo_attrs(struct module *mod);
680void module_remove_modinfo_attrs(struct module *mod);
681
682#else /* !CONFIG_SYSFS */
683
684static inline int mod_sysfs_init(struct module *mod)
685{
686 return 0;
687}
688
689static inline int mod_sysfs_setup(struct module *mod,
690 struct kernel_param *kparam,
691 unsigned int num_params)
692{
693 return 0;
694}
695
696static inline int module_add_modinfo_attrs(struct module *mod)
697{
698 return 0;
699}
700
701static inline void module_remove_modinfo_attrs(struct module *mod)
702{ }
703
704#endif /* CONFIG_SYSFS */ 679#endif /* CONFIG_SYSFS */
705 680
706#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) 681#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 5d5275364867..4bd05474d11d 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -34,7 +34,18 @@ struct mnt_namespace;
34 34
35#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 35#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
36#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 36#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
37#define MNT_PNODE_MASK 0x3000 /* propagation flag mask */ 37/*
38 * MNT_SHARED_MASK is the set of flags that should be cleared when a
39 * mount becomes shared. Currently, this is only the flag that says a
40 * mount cannot be bind mounted, since this is how we create a mount
41 * that shares events with another mount. If you add a new MNT_*
42 * flag, consider how it interacts with shared mounts.
43 */
44#define MNT_SHARED_MASK (MNT_UNBINDABLE)
45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE)
46
47
48#define MNT_INTERNAL 0x4000
38 49
39struct vfsmount { 50struct vfsmount {
40 struct list_head mnt_hash; 51 struct list_head mnt_hash;
@@ -66,7 +77,7 @@ struct vfsmount {
66 int mnt_pinned; 77 int mnt_pinned;
67 int mnt_ghosts; 78 int mnt_ghosts;
68#ifdef CONFIG_SMP 79#ifdef CONFIG_SMP
69 int *mnt_writers; 80 int __percpu *mnt_writers;
70#else 81#else
71 int mnt_writers; 82 int mnt_writers;
72#endif 83#endif
@@ -123,7 +134,6 @@ extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
123 134
124extern void mark_mounts_for_expiry(struct list_head *mounts); 135extern void mark_mounts_for_expiry(struct list_head *mounts);
125 136
126extern spinlock_t vfsmount_lock;
127extern dev_t name_to_dev_t(char *name); 137extern dev_t name_to_dev_t(char *name);
128 138
129#endif /* _LINUX_MOUNT_H */ 139#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index c5f3d53548e2..fa04b246c9ae 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -27,7 +27,8 @@
27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ 27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */
28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ 28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */
29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
31#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
31 32
32#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 33#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
33#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
@@ -191,10 +192,7 @@ struct vif_device {
191#define VIFF_STATIC 0x8000 192#define VIFF_STATIC 0x8000
192 193
193struct mfc_cache { 194struct mfc_cache {
194 struct mfc_cache *next; /* Next entry on cache line */ 195 struct list_head list;
195#ifdef CONFIG_NET_NS
196 struct net *mfc_net;
197#endif
198 __be32 mfc_mcastgrp; /* Group the entry belongs to */ 196 __be32 mfc_mcastgrp; /* Group the entry belongs to */
199 __be32 mfc_origin; /* Source of packet */ 197 __be32 mfc_origin; /* Source of packet */
200 vifi_t mfc_parent; /* Source interface */ 198 vifi_t mfc_parent; /* Source interface */
@@ -217,18 +215,6 @@ struct mfc_cache {
217 } mfc_un; 215 } mfc_un;
218}; 216};
219 217
220static inline
221struct net *mfc_net(const struct mfc_cache *mfc)
222{
223 return read_pnet(&mfc->mfc_net);
224}
225
226static inline
227void mfc_net_set(struct mfc_cache *mfc, struct net *net)
228{
229 write_pnet(&mfc->mfc_net, hold_net(net));
230}
231
232#define MFC_STATIC 1 218#define MFC_STATIC 1
233#define MFC_NOTIFY 2 219#define MFC_NOTIFY 2
234 220
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 2caa1a8e525d..6091ab77f388 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -24,7 +24,8 @@
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ 24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ 25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ 26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ 27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
28 29
29#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ 30#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
30#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) 31#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
@@ -182,10 +183,7 @@ struct mif_device {
182#define VIFF_STATIC 0x8000 183#define VIFF_STATIC 0x8000
183 184
184struct mfc6_cache { 185struct mfc6_cache {
185 struct mfc6_cache *next; /* Next entry on cache line */ 186 struct list_head list;
186#ifdef CONFIG_NET_NS
187 struct net *mfc6_net;
188#endif
189 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 187 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
190 struct in6_addr mf6c_origin; /* Source of packet */ 188 struct in6_addr mf6c_origin; /* Source of packet */
191 mifi_t mf6c_parent; /* Source interface */ 189 mifi_t mf6c_parent; /* Source interface */
@@ -208,18 +206,6 @@ struct mfc6_cache {
208 } mfc_un; 206 } mfc_un;
209}; 207};
210 208
211static inline
212struct net *mfc6_net(const struct mfc6_cache *mfc)
213{
214 return read_pnet(&mfc->mfc6_net);
215}
216
217static inline
218void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
219{
220 write_pnet(&mfc->mfc6_net, hold_net(net));
221}
222
223#define MFC_STATIC 1 209#define MFC_STATIC 1
224#define MFC_NOTIFY 2 210#define MFC_NOTIFY 2
225 211
@@ -244,14 +230,17 @@ extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
244 struct rtmsg *rtm, int nowait); 230 struct rtmsg *rtm, int nowait);
245 231
246#ifdef CONFIG_IPV6_MROUTE 232#ifdef CONFIG_IPV6_MROUTE
247static inline struct sock *mroute6_socket(struct net *net) 233extern struct sock *mroute6_socket(struct net *net, struct sk_buff *skb);
248{
249 return net->ipv6.mroute6_sk;
250}
251extern int ip6mr_sk_done(struct sock *sk); 234extern int ip6mr_sk_done(struct sock *sk);
252#else 235#else
253static inline struct sock *mroute6_socket(struct net *net) { return NULL; } 236static inline struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
254static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 237{
238 return NULL;
239}
240static inline int ip6mr_sk_done(struct sock *sk)
241{
242 return 0;
243}
255#endif 244#endif
256#endif 245#endif
257 246
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index ce38f1caa5e1..34066e65fdeb 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -15,6 +15,7 @@
15#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ 15#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */
16#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) 16#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
17#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ 17#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
18#define MSDOS_LONGNAME 256 /* maximum name length */
18#define CF_LE_W(v) le16_to_cpu(v) 19#define CF_LE_W(v) le16_to_cpu(v)
19#define CF_LE_L(v) le32_to_cpu(v) 20#define CF_LE_L(v) le32_to_cpu(v)
20#define CT_LE_W(v) cpu_to_le16(v) 21#define CT_LE_W(v) cpu_to_le16(v)
@@ -47,8 +48,8 @@
47#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ 48#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
48#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) 49#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
49 50
51#define FAT_LFN_LEN 255 /* maximum long name length */
50#define MSDOS_NAME 11 /* maximum name length */ 52#define MSDOS_NAME 11 /* maximum name length */
51#define MSDOS_LONGNAME 256 /* maximum name length */
52#define MSDOS_SLOTS 21 /* max # of slots for short and long names */ 53#define MSDOS_SLOTS 21 /* max # of slots for short and long names */
53#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ 54#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
54#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 55#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
new file mode 100644
index 000000000000..d11fe0f2f956
--- /dev/null
+++ b/include/linux/msm_mdp.h
@@ -0,0 +1,78 @@
1/* include/linux/msm_mdp.h
2 *
3 * Copyright (C) 2007 Google Incorporated
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef _MSM_MDP_H_
15#define _MSM_MDP_H_
16
17#include <linux/types.h>
18
19#define MSMFB_IOCTL_MAGIC 'm'
20#define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int)
21#define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int)
22
23enum {
24 MDP_RGB_565, /* RGB 565 planar */
25 MDP_XRGB_8888, /* RGB 888 padded */
26 MDP_Y_CBCR_H2V2, /* Y and CbCr, pseudo planar w/ Cb is in MSB */
27 MDP_ARGB_8888, /* ARGB 888 */
28 MDP_RGB_888, /* RGB 888 planar */
29 MDP_Y_CRCB_H2V2, /* Y and CrCb, pseudo planar w/ Cr is in MSB */
30 MDP_YCRYCB_H2V1, /* YCrYCb interleave */
31 MDP_Y_CRCB_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
32 MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
33 MDP_RGBA_8888, /* ARGB 888 */
34 MDP_BGRA_8888, /* ABGR 888 */
35 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */
36};
37
38enum {
39 PMEM_IMG,
40 FB_IMG,
41};
42
43/* flag values */
44#define MDP_ROT_NOP 0
45#define MDP_FLIP_LR 0x1
46#define MDP_FLIP_UD 0x2
47#define MDP_ROT_90 0x4
48#define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR)
49#define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR)
50#define MDP_DITHER 0x8
51#define MDP_BLUR 0x10
52
53#define MDP_TRANSP_NOP 0xffffffff
54#define MDP_ALPHA_NOP 0xff
55
56struct mdp_rect {
57 u32 x, y, w, h;
58};
59
60struct mdp_img {
61 u32 width, height, format, offset;
62 int memory_id; /* the file descriptor */
63};
64
65struct mdp_blit_req {
66 struct mdp_img src;
67 struct mdp_img dst;
68 struct mdp_rect src_rect;
69 struct mdp_rect dst_rect;
70 u32 alpha, transp_mask, flags;
71};
72
73struct mdp_blit_req_list {
74 u32 count;
75 struct mdp_blit_req req[];
76};
77
78#endif /* _MSM_MDP_H_ */
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 8b4aa0523db7..b481ccd7ff3c 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -9,6 +9,8 @@
9#define __MTD_TRANS_H__ 9#define __MTD_TRANS_H__
10 10
11#include <linux/mutex.h> 11#include <linux/mutex.h>
12#include <linux/kref.h>
13#include <linux/sysfs.h>
12 14
13struct hd_geometry; 15struct hd_geometry;
14struct mtd_info; 16struct mtd_info;
@@ -24,11 +26,16 @@ struct mtd_blktrans_dev {
24 int devnum; 26 int devnum;
25 unsigned long size; 27 unsigned long size;
26 int readonly; 28 int readonly;
27 void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */ 29 int open;
30 struct kref ref;
31 struct gendisk *disk;
32 struct attribute_group *disk_attributes;
33 struct task_struct *thread;
34 struct request_queue *rq;
35 spinlock_t queue_lock;
36 void *priv;
28}; 37};
29 38
30struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
31
32struct mtd_blktrans_ops { 39struct mtd_blktrans_ops {
33 char *name; 40 char *name;
34 int major; 41 int major;
@@ -60,8 +67,6 @@ struct mtd_blktrans_ops {
60 struct list_head devs; 67 struct list_head devs;
61 struct list_head list; 68 struct list_head list;
62 struct module *owner; 69 struct module *owner;
63
64 struct mtd_blkcore_priv *blkcore_priv;
65}; 70};
66 71
67extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); 72extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index df89f4275232..574d9ee066f1 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -253,6 +253,7 @@ struct cfi_bri_query {
253#define P_ID_MITSUBISHI_STD 0x0100 253#define P_ID_MITSUBISHI_STD 0x0100
254#define P_ID_MITSUBISHI_EXT 0x0101 254#define P_ID_MITSUBISHI_EXT 0x0101
255#define P_ID_SST_PAGE 0x0102 255#define P_ID_SST_PAGE 0x0102
256#define P_ID_SST_OLD 0x0701
256#define P_ID_INTEL_PERFORMANCE 0x0200 257#define P_ID_INTEL_PERFORMANCE 0x0200
257#define P_ID_INTEL_DATA 0x0210 258#define P_ID_INTEL_DATA 0x0210
258#define P_ID_RESERVED 0xffff 259#define P_ID_RESERVED 0xffff
@@ -297,7 +298,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
297 * and 32bit devices on 16 bit busses 298 * and 32bit devices on 16 bit busses
298 * set the low bit of the alternating bit sequence of the address. 299 * set the low bit of the alternating bit sequence of the address.
299 */ 300 */
300 if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa)) 301 if (((type * interleave) > bankwidth) && ((cmd_ofs & 0xff) == 0xaa))
301 addr |= (type >> 1)*interleave; 302 addr |= (type >> 1)*interleave;
302 303
303 return addr; 304 return addr;
@@ -515,14 +516,25 @@ struct cfi_fixup {
515 void* param; 516 void* param;
516}; 517};
517 518
518#define CFI_MFR_ANY 0xffff 519#define CFI_MFR_ANY 0xFFFF
519#define CFI_ID_ANY 0xffff 520#define CFI_ID_ANY 0xFFFF
520 521#define CFI_MFR_CONTINUATION 0x007F
521#define CFI_MFR_AMD 0x0001 522
522#define CFI_MFR_INTEL 0x0089 523#define CFI_MFR_AMD 0x0001
523#define CFI_MFR_ATMEL 0x001F 524#define CFI_MFR_ATMEL 0x001F
524#define CFI_MFR_SAMSUNG 0x00EC 525#define CFI_MFR_EON 0x001C
525#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 526#define CFI_MFR_FUJITSU 0x0004
527#define CFI_MFR_HYUNDAI 0x00AD
528#define CFI_MFR_INTEL 0x0089
529#define CFI_MFR_MACRONIX 0x00C2
530#define CFI_MFR_NEC 0x0010
531#define CFI_MFR_PMC 0x009D
532#define CFI_MFR_SAMSUNG 0x00EC
533#define CFI_MFR_SHARP 0x00B0
534#define CFI_MFR_SST 0x00BF
535#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
536#define CFI_MFR_TOSHIBA 0x0098
537#define CFI_MFR_WINBOND 0x00DA
526 538
527void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 539void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
528 540
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index d0bf422ae374..f43e9b49b751 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -15,6 +15,7 @@
15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h 15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
16 */ 16 */
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/mutex.h>
18 19
19typedef enum { 20typedef enum {
20 FL_READY, 21 FL_READY,
@@ -74,8 +75,7 @@ struct flchip {
74 unsigned int erase_suspended:1; 75 unsigned int erase_suspended:1;
75 unsigned long in_progress_block_addr; 76 unsigned long in_progress_block_addr;
76 77
77 spinlock_t *mutex; 78 struct mutex mutex;
78 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
79 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip 79 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
80 to be ready */ 80 to be ready */
81 int word_write_time; 81 int word_write_time;
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index b981b8772217..de89eca864ce 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -7,6 +7,7 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/bug.h>
10 11
11#include <linux/mtd/compatmac.h> 12#include <linux/mtd/compatmac.h>
12 13
@@ -386,6 +387,8 @@ static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
386#endif 387#endif
387 else if (map_bankwidth_is_large(map)) 388 else if (map_bankwidth_is_large(map))
388 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth); 389 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth);
390 else
391 BUG();
389 392
390 return r; 393 return r;
391} 394}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0f32a9b6ff55..5326435a7571 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -20,7 +20,6 @@
20 20
21#define MTD_CHAR_MAJOR 90 21#define MTD_CHAR_MAJOR 90
22#define MTD_BLOCK_MAJOR 31 22#define MTD_BLOCK_MAJOR 31
23#define MAX_MTD_DEVICES 32
24 23
25#define MTD_ERASE_PENDING 0x01 24#define MTD_ERASE_PENDING 0x01
26#define MTD_ERASING 0x02 25#define MTD_ERASING 0x02
@@ -61,9 +60,7 @@ struct mtd_erase_region_info {
61 * MTD_OOB_PLACE: oob data are placed at the given offset 60 * MTD_OOB_PLACE: oob data are placed at the given offset
62 * MTD_OOB_AUTO: oob data are automatically placed at the free areas 61 * MTD_OOB_AUTO: oob data are automatically placed at the free areas
63 * which are defined by the ecclayout 62 * which are defined by the ecclayout
64 * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data 63 * MTD_OOB_RAW: mode to read oob and data without doing ECC checking
65 * is inserted into the data. Thats a raw image of the
66 * flash contents.
67 */ 64 */
68typedef enum { 65typedef enum {
69 MTD_OOB_PLACE, 66 MTD_OOB_PLACE,
@@ -290,8 +287,9 @@ extern int add_mtd_device(struct mtd_info *mtd);
290extern int del_mtd_device (struct mtd_info *mtd); 287extern int del_mtd_device (struct mtd_info *mtd);
291 288
292extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); 289extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
290extern int __get_mtd_device(struct mtd_info *mtd);
291extern void __put_mtd_device(struct mtd_info *mtd);
293extern struct mtd_info *get_mtd_device_nm(const char *name); 292extern struct mtd_info *get_mtd_device_nm(const char *name);
294
295extern void put_mtd_device(struct mtd_info *mtd); 293extern void put_mtd_device(struct mtd_info *mtd);
296 294
297 295
diff --git a/include/linux/mtd/mtdram.h b/include/linux/mtd/mtdram.h
index 04fdc07b7353..68891313875d 100644
--- a/include/linux/mtd/mtdram.h
+++ b/include/linux/mtd/mtdram.h
@@ -3,6 +3,6 @@
3 3
4#include <linux/mtd/mtd.h> 4#include <linux/mtd/mtd.h>
5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, 5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
6 unsigned long size, char *name); 6 unsigned long size, char *name);
7 7
8#endif /* __MTD_MTDRAM_H__ */ 8#endif /* __MTD_MTDRAM_H__ */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ccab9dfc5217..a81b185e23a7 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -25,11 +25,13 @@
25#include <linux/mtd/bbm.h> 25#include <linux/mtd/bbm.h>
26 26
27struct mtd_info; 27struct mtd_info;
28struct nand_flash_dev;
28/* Scan and identify a NAND device */ 29/* Scan and identify a NAND device */
29extern int nand_scan (struct mtd_info *mtd, int max_chips); 30extern int nand_scan (struct mtd_info *mtd, int max_chips);
30/* Separate phases of nand_scan(), allowing board driver to intervene 31/* Separate phases of nand_scan(), allowing board driver to intervene
31 * and override command or ECC setup according to flash type */ 32 * and override command or ECC setup according to flash type */
32extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); 33extern int nand_scan_ident(struct mtd_info *mtd, int max_chips,
34 struct nand_flash_dev *table);
33extern int nand_scan_tail(struct mtd_info *mtd); 35extern int nand_scan_tail(struct mtd_info *mtd);
34 36
35/* Free resources held by the NAND device */ 37/* Free resources held by the NAND device */
@@ -38,6 +40,12 @@ extern void nand_release (struct mtd_info *mtd);
38/* Internal helper for board drivers which need to override command function */ 40/* Internal helper for board drivers which need to override command function */
39extern void nand_wait_ready(struct mtd_info *mtd); 41extern void nand_wait_ready(struct mtd_info *mtd);
40 42
43/* locks all blockes present in the device */
44extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
45
46/* unlocks specified locked blockes */
47extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
48
41/* The maximum number of NAND chips in an array */ 49/* The maximum number of NAND chips in an array */
42#define NAND_MAX_CHIPS 8 50#define NAND_MAX_CHIPS 8
43 51
@@ -45,7 +53,7 @@ extern void nand_wait_ready(struct mtd_info *mtd);
45 * is supported now. If you add a chip with bigger oobsize/page 53 * is supported now. If you add a chip with bigger oobsize/page
46 * adjust this accordingly. 54 * adjust this accordingly.
47 */ 55 */
48#define NAND_MAX_OOBSIZE 128 56#define NAND_MAX_OOBSIZE 256
49#define NAND_MAX_PAGESIZE 4096 57#define NAND_MAX_PAGESIZE 4096
50 58
51/* 59/*
@@ -82,6 +90,10 @@ extern void nand_wait_ready(struct mtd_info *mtd);
82#define NAND_CMD_ERASE2 0xd0 90#define NAND_CMD_ERASE2 0xd0
83#define NAND_CMD_RESET 0xff 91#define NAND_CMD_RESET 0xff
84 92
93#define NAND_CMD_LOCK 0x2a
94#define NAND_CMD_UNLOCK1 0x23
95#define NAND_CMD_UNLOCK2 0x24
96
85/* Extended commands for large page devices */ 97/* Extended commands for large page devices */
86#define NAND_CMD_READSTART 0x30 98#define NAND_CMD_READSTART 0x30
87#define NAND_CMD_RNDOUTSTART 0xE0 99#define NAND_CMD_RNDOUTSTART 0xE0
@@ -169,6 +181,14 @@ typedef enum {
169#define NAND_NO_READRDY 0x00000100 181#define NAND_NO_READRDY 0x00000100
170/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
171#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
184/* Chip stores bad block marker on the last page of the eraseblock */
185#define NAND_BB_LAST_PAGE 0x00000400
186
187/* Device is one of 'new' xD cards that expose fake nand command set */
188#define NAND_BROKEN_XD 0x00000400
189
190/* Device behaves just like nand, but is readonly */
191#define NAND_ROM 0x00000800
172 192
173/* Options valid for Samsung large page devices */ 193/* Options valid for Samsung large page devices */
174#define NAND_SAMSUNG_LP_OPTIONS \ 194#define NAND_SAMSUNG_LP_OPTIONS \
@@ -391,6 +411,7 @@ struct nand_chip {
391 int subpagesize; 411 int subpagesize;
392 uint8_t cellinfo; 412 uint8_t cellinfo;
393 int badblockpos; 413 int badblockpos;
414 int badblockbits;
394 415
395 flstate_t state; 416 flstate_t state;
396 417
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 5509eb06b326..c26ff86ad08a 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -125,6 +125,9 @@ struct onenand_chip {
125 flstate_t state; 125 flstate_t state;
126 unsigned char *page_buf; 126 unsigned char *page_buf;
127 unsigned char *oob_buf; 127 unsigned char *oob_buf;
128#ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
129 unsigned char *verify_buf;
130#endif
128 131
129 int subpagesize; 132 int subpagesize;
130 struct nand_ecclayout *ecclayout; 133 struct nand_ecclayout *ecclayout;
@@ -175,10 +178,14 @@ struct onenand_chip {
175#define ONENAND_HAS_CONT_LOCK (0x0001) 178#define ONENAND_HAS_CONT_LOCK (0x0001)
176#define ONENAND_HAS_UNLOCK_ALL (0x0002) 179#define ONENAND_HAS_UNLOCK_ALL (0x0002)
177#define ONENAND_HAS_2PLANE (0x0004) 180#define ONENAND_HAS_2PLANE (0x0004)
181#define ONENAND_HAS_4KB_PAGE (0x0008)
178#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 182#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
179#define ONENAND_PAGEBUF_ALLOC (0x1000) 183#define ONENAND_PAGEBUF_ALLOC (0x1000)
180#define ONENAND_OOBBUF_ALLOC (0x2000) 184#define ONENAND_OOBBUF_ALLOC (0x2000)
181 185
186#define ONENAND_IS_4KB_PAGE(this) \
187 (this->options & ONENAND_HAS_4KB_PAGE)
188
182/* 189/*
183 * OneNAND Flash Manufacturer ID Codes 190 * OneNAND Flash Manufacturer ID Codes
184 */ 191 */
@@ -205,6 +212,8 @@ struct mtd_partition;
205 212
206struct onenand_platform_data { 213struct onenand_platform_data {
207 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 214 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
215 int (*read_bufferram)(struct mtd_info *mtd, int area,
216 unsigned char *buffer, int offset, size_t count);
208 struct mtd_partition *parts; 217 struct mtd_partition *parts;
209 unsigned int nr_parts; 218 unsigned int nr_parts;
210}; 219};
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index e77c1cea404d..9cf4c4c79555 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -51,6 +51,8 @@
51#define _4ECCCNTEN (0x1 << 24) 51#define _4ECCCNTEN (0x1 << 24)
52#define _4ECCEN (0x1 << 23) 52#define _4ECCEN (0x1 << 23)
53#define _4ECCCORRECT (0x1 << 22) 53#define _4ECCCORRECT (0x1 << 22)
54#define SHBUSSEL (0x1 << 20)
55#define SEL_16BIT (0x1 << 19)
54#define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ 56#define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/
55#define QTSEL_E (0x1 << 17) 57#define QTSEL_E (0x1 << 17)
56#define ENDIAN (0x1 << 16) /* 1 = little endian */ 58#define ENDIAN (0x1 << 16) /* 1 = little endian */
@@ -91,11 +93,10 @@
91#define INIT_FL4ECCRESULT_VAL 0x03FF03FF 93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF
92#define LOOP_TIMEOUT_MAX 0x00010000 94#define LOOP_TIMEOUT_MAX 0x00010000
93 95
94#define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd)
95
96struct sh_flctl { 96struct sh_flctl {
97 struct mtd_info mtd; 97 struct mtd_info mtd;
98 struct nand_chip chip; 98 struct nand_chip chip;
99 struct platform_device *pdev;
99 void __iomem *reg; 100 void __iomem *reg;
100 101
101 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ 102 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
@@ -122,4 +123,9 @@ struct sh_flctl_platform_data {
122 unsigned has_hwecc:1; 123 unsigned has_hwecc:1;
123}; 124};
124 125
126static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
127{
128 return container_of(mtdinfo, struct sh_flctl, mtd);
129}
130
125#endif /* __SH_FLCTL_H__ */ 131#endif /* __SH_FLCTL_H__ */
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index cbbbe9bfecad..30b0c4e78f91 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi; 20 struct platform_device *shared_smi;
21 unsigned int t_clk; 21 unsigned int t_clk;
22 /*
23 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
24 * limit of 9KiB will be used.
25 */
26 int tx_csum_limit;
22}; 27};
23 28
24#define MV643XX_ETH_PHY_ADDR_DEFAULT 0 29#define MV643XX_ETH_PHY_ADDR_DEFAULT 0
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 30b06c893944..4522aed00906 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -210,7 +210,7 @@ int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
211 211
212/* linux/fs/ncpfs/ioctl.c */ 212/* linux/fs/ncpfs/ioctl.c */
213int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 213long ncp_ioctl(struct file *, unsigned int, unsigned long);
214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); 214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
215 215
216/* linux/fs/ncpfs/sock.c */ 216/* linux/fs/ncpfs/sock.c */
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index 6330fc76b00f..5ec9ca671687 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -12,6 +12,7 @@
12#include <linux/ncp_mount.h> 12#include <linux/ncp_mount.h>
13#include <linux/net.h> 13#include <linux/net.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/backing-dev.h>
15 16
16#ifdef __KERNEL__ 17#ifdef __KERNEL__
17 18
@@ -127,6 +128,7 @@ struct ncp_server {
127 size_t len; 128 size_t len;
128 __u8 data[128]; 129 __u8 data[128];
129 } unexpected_packet; 130 } unexpected_packet;
131 struct backing_dev_info bdi;
130}; 132};
131 133
132extern void ncp_tcp_rcv_proc(struct work_struct *work); 134extern void ncp_tcp_rcv_proc(struct work_struct *work);
diff --git a/include/linux/net.h b/include/linux/net.h
index 5e8083cacc8b..dee0b11a8759 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -59,6 +59,7 @@ typedef enum {
59#include <linux/wait.h> 59#include <linux/wait.h>
60#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 60#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
61#include <linux/kmemcheck.h> 61#include <linux/kmemcheck.h>
62#include <linux/rcupdate.h>
62 63
63struct poll_table_struct; 64struct poll_table_struct;
64struct pipe_inode_info; 65struct pipe_inode_info;
@@ -116,16 +117,21 @@ enum sock_shutdown_cmd {
116 SHUT_RDWR = 2, 117 SHUT_RDWR = 2,
117}; 118};
118 119
120struct socket_wq {
121 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list;
123 struct rcu_head rcu;
124} ____cacheline_aligned_in_smp;
125
119/** 126/**
120 * struct socket - general BSD socket 127 * struct socket - general BSD socket
121 * @state: socket state (%SS_CONNECTED, etc) 128 * @state: socket state (%SS_CONNECTED, etc)
122 * @type: socket type (%SOCK_STREAM, etc) 129 * @type: socket type (%SOCK_STREAM, etc)
123 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) 130 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
124 * @ops: protocol specific socket operations 131 * @ops: protocol specific socket operations
125 * @fasync_list: Asynchronous wake up list
126 * @file: File back pointer for gc 132 * @file: File back pointer for gc
127 * @sk: internal networking protocol agnostic socket representation 133 * @sk: internal networking protocol agnostic socket representation
128 * @wait: wait queue for several uses 134 * @wq: wait queue for several uses
129 */ 135 */
130struct socket { 136struct socket {
131 socket_state state; 137 socket_state state;
@@ -135,11 +141,8 @@ struct socket {
135 kmemcheck_bitfield_end(type); 141 kmemcheck_bitfield_end(type);
136 142
137 unsigned long flags; 143 unsigned long flags;
138 /* 144
139 * Please keep fasync_list & wait fields in the same cache line 145 struct socket_wq *wq;
140 */
141 struct fasync_struct *fasync_list;
142 wait_queue_head_t wait;
143 146
144 struct file *file; 147 struct file *file;
145 struct sock *sk; 148 struct sock *sk;
@@ -174,18 +177,22 @@ struct proto_ops {
174 struct poll_table_struct *wait); 177 struct poll_table_struct *wait);
175 int (*ioctl) (struct socket *sock, unsigned int cmd, 178 int (*ioctl) (struct socket *sock, unsigned int cmd,
176 unsigned long arg); 179 unsigned long arg);
180#ifdef CONFIG_COMPAT
177 int (*compat_ioctl) (struct socket *sock, unsigned int cmd, 181 int (*compat_ioctl) (struct socket *sock, unsigned int cmd,
178 unsigned long arg); 182 unsigned long arg);
183#endif
179 int (*listen) (struct socket *sock, int len); 184 int (*listen) (struct socket *sock, int len);
180 int (*shutdown) (struct socket *sock, int flags); 185 int (*shutdown) (struct socket *sock, int flags);
181 int (*setsockopt)(struct socket *sock, int level, 186 int (*setsockopt)(struct socket *sock, int level,
182 int optname, char __user *optval, unsigned int optlen); 187 int optname, char __user *optval, unsigned int optlen);
183 int (*getsockopt)(struct socket *sock, int level, 188 int (*getsockopt)(struct socket *sock, int level,
184 int optname, char __user *optval, int __user *optlen); 189 int optname, char __user *optval, int __user *optlen);
190#ifdef CONFIG_COMPAT
185 int (*compat_setsockopt)(struct socket *sock, int level, 191 int (*compat_setsockopt)(struct socket *sock, int level,
186 int optname, char __user *optval, unsigned int optlen); 192 int optname, char __user *optval, unsigned int optlen);
187 int (*compat_getsockopt)(struct socket *sock, int level, 193 int (*compat_getsockopt)(struct socket *sock, int level,
188 int optname, char __user *optval, int __user *optlen); 194 int optname, char __user *optval, int __user *optlen);
195#endif
189 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 196 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
190 struct msghdr *m, size_t total_len); 197 struct msghdr *m, size_t total_len);
191 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 198 int (*recvmsg) (struct kiocb *iocb, struct socket *sock,
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a3fccc85b1a0..b21e4054c12c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -28,8 +28,10 @@
28#include <linux/if.h> 28#include <linux/if.h>
29#include <linux/if_ether.h> 29#include <linux/if_ether.h>
30#include <linux/if_packet.h> 30#include <linux/if_packet.h>
31#include <linux/if_link.h>
31 32
32#ifdef __KERNEL__ 33#ifdef __KERNEL__
34#include <linux/pm_qos_params.h>
33#include <linux/timer.h> 35#include <linux/timer.h>
34#include <linux/delay.h> 36#include <linux/delay.h>
35#include <linux/mm.h> 37#include <linux/mm.h>
@@ -136,7 +138,7 @@ static inline bool dev_xmit_complete(int rc)
136 * used. 138 * used.
137 */ 139 */
138 140
139#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 141#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
140# if defined(CONFIG_MAC80211_MESH) 142# if defined(CONFIG_MAC80211_MESH)
141# define LL_MAX_HEADER 128 143# define LL_MAX_HEADER 128
142# else 144# else
@@ -217,34 +219,6 @@ struct neighbour;
217struct neigh_parms; 219struct neigh_parms;
218struct sk_buff; 220struct sk_buff;
219 221
220struct netif_rx_stats {
221 unsigned total;
222 unsigned dropped;
223 unsigned time_squeeze;
224 unsigned cpu_collision;
225};
226
227DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
228
229struct dev_addr_list {
230 struct dev_addr_list *next;
231 u8 da_addr[MAX_ADDR_LEN];
232 u8 da_addrlen;
233 u8 da_synced;
234 int da_users;
235 int da_gusers;
236};
237
238/*
239 * We tag multicasts with these structures.
240 */
241
242#define dev_mc_list dev_addr_list
243#define dmi_addr da_addr
244#define dmi_addrlen da_addrlen
245#define dmi_users da_users
246#define dmi_gusers da_gusers
247
248struct netdev_hw_addr { 222struct netdev_hw_addr {
249 struct list_head list; 223 struct list_head list;
250 unsigned char addr[MAX_ADDR_LEN]; 224 unsigned char addr[MAX_ADDR_LEN];
@@ -253,8 +227,10 @@ struct netdev_hw_addr {
253#define NETDEV_HW_ADDR_T_SAN 2 227#define NETDEV_HW_ADDR_T_SAN 2
254#define NETDEV_HW_ADDR_T_SLAVE 3 228#define NETDEV_HW_ADDR_T_SLAVE 3
255#define NETDEV_HW_ADDR_T_UNICAST 4 229#define NETDEV_HW_ADDR_T_UNICAST 4
230#define NETDEV_HW_ADDR_T_MULTICAST 5
256 int refcount; 231 int refcount;
257 bool synced; 232 bool synced;
233 bool global_use;
258 struct rcu_head rcu_head; 234 struct rcu_head rcu_head;
259}; 235};
260 236
@@ -263,6 +239,21 @@ struct netdev_hw_addr_list {
263 int count; 239 int count;
264}; 240};
265 241
242#define netdev_hw_addr_list_count(l) ((l)->count)
243#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
244#define netdev_hw_addr_list_for_each(ha, l) \
245 list_for_each_entry(ha, &(l)->list, list)
246
247#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
248#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
249#define netdev_for_each_uc_addr(ha, dev) \
250 netdev_hw_addr_list_for_each(ha, &(dev)->uc)
251
252#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
253#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
254#define netdev_for_each_mc_addr(ha, dev) \
255 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
256
266struct hh_cache { 257struct hh_cache {
267 struct hh_cache *hh_next; /* Next entry */ 258 struct hh_cache *hh_next; /* Next entry */
268 atomic_t hh_refcnt; /* number of users */ 259 atomic_t hh_refcnt; /* number of users */
@@ -518,6 +509,85 @@ struct netdev_queue {
518 unsigned long tx_dropped; 509 unsigned long tx_dropped;
519} ____cacheline_aligned_in_smp; 510} ____cacheline_aligned_in_smp;
520 511
512#ifdef CONFIG_RPS
513/*
514 * This structure holds an RPS map which can be of variable length. The
515 * map is an array of CPUs.
516 */
517struct rps_map {
518 unsigned int len;
519 struct rcu_head rcu;
520 u16 cpus[0];
521};
522#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
523
524/*
525 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the
526 * tail pointer for that CPU's input queue at the time of last enqueue.
527 */
528struct rps_dev_flow {
529 u16 cpu;
530 u16 fill;
531 unsigned int last_qtail;
532};
533
534/*
535 * The rps_dev_flow_table structure contains a table of flow mappings.
536 */
537struct rps_dev_flow_table {
538 unsigned int mask;
539 struct rcu_head rcu;
540 struct work_struct free_work;
541 struct rps_dev_flow flows[0];
542};
543#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
544 (_num * sizeof(struct rps_dev_flow)))
545
546/*
547 * The rps_sock_flow_table contains mappings of flows to the last CPU
548 * on which they were processed by the application (set in recvmsg).
549 */
550struct rps_sock_flow_table {
551 unsigned int mask;
552 u16 ents[0];
553};
554#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
555 (_num * sizeof(u16)))
556
557#define RPS_NO_CPU 0xffff
558
559static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
560 u32 hash)
561{
562 if (table && hash) {
563 unsigned int cpu, index = hash & table->mask;
564
565 /* We only give a hint, preemption can change cpu under us */
566 cpu = raw_smp_processor_id();
567
568 if (table->ents[index] != cpu)
569 table->ents[index] = cpu;
570 }
571}
572
573static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
574 u32 hash)
575{
576 if (table && hash)
577 table->ents[hash & table->mask] = RPS_NO_CPU;
578}
579
580extern struct rps_sock_flow_table *rps_sock_flow_table;
581
582/* This structure contains an instance of an RX queue. */
583struct netdev_rx_queue {
584 struct rps_map *rps_map;
585 struct rps_dev_flow_table *rps_flow_table;
586 struct kobject kobj;
587 struct netdev_rx_queue *first;
588 atomic_t count;
589} ____cacheline_aligned_in_smp;
590#endif /* CONFIG_RPS */
521 591
522/* 592/*
523 * This structure defines the management hooks for network devices. 593 * This structure defines the management hooks for network devices.
@@ -610,6 +680,16 @@ struct netdev_queue {
610 * this function is called when a VLAN id is unregistered. 680 * this function is called when a VLAN id is unregistered.
611 * 681 *
612 * void (*ndo_poll_controller)(struct net_device *dev); 682 * void (*ndo_poll_controller)(struct net_device *dev);
683 *
684 * SR-IOV management functions.
685 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
686 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
687 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
688 * int (*ndo_get_vf_config)(struct net_device *dev,
689 * int vf, struct ifla_vf_info *ivf);
690 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
691 * struct nlattr *port[]);
692 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
613 */ 693 */
614#define HAVE_NET_DEVICE_OPS 694#define HAVE_NET_DEVICE_OPS
615struct net_device_ops { 695struct net_device_ops {
@@ -621,30 +701,21 @@ struct net_device_ops {
621 struct net_device *dev); 701 struct net_device *dev);
622 u16 (*ndo_select_queue)(struct net_device *dev, 702 u16 (*ndo_select_queue)(struct net_device *dev,
623 struct sk_buff *skb); 703 struct sk_buff *skb);
624#define HAVE_CHANGE_RX_FLAGS
625 void (*ndo_change_rx_flags)(struct net_device *dev, 704 void (*ndo_change_rx_flags)(struct net_device *dev,
626 int flags); 705 int flags);
627#define HAVE_SET_RX_MODE
628 void (*ndo_set_rx_mode)(struct net_device *dev); 706 void (*ndo_set_rx_mode)(struct net_device *dev);
629#define HAVE_MULTICAST
630 void (*ndo_set_multicast_list)(struct net_device *dev); 707 void (*ndo_set_multicast_list)(struct net_device *dev);
631#define HAVE_SET_MAC_ADDR
632 int (*ndo_set_mac_address)(struct net_device *dev, 708 int (*ndo_set_mac_address)(struct net_device *dev,
633 void *addr); 709 void *addr);
634#define HAVE_VALIDATE_ADDR
635 int (*ndo_validate_addr)(struct net_device *dev); 710 int (*ndo_validate_addr)(struct net_device *dev);
636#define HAVE_PRIVATE_IOCTL
637 int (*ndo_do_ioctl)(struct net_device *dev, 711 int (*ndo_do_ioctl)(struct net_device *dev,
638 struct ifreq *ifr, int cmd); 712 struct ifreq *ifr, int cmd);
639#define HAVE_SET_CONFIG
640 int (*ndo_set_config)(struct net_device *dev, 713 int (*ndo_set_config)(struct net_device *dev,
641 struct ifmap *map); 714 struct ifmap *map);
642#define HAVE_CHANGE_MTU
643 int (*ndo_change_mtu)(struct net_device *dev, 715 int (*ndo_change_mtu)(struct net_device *dev,
644 int new_mtu); 716 int new_mtu);
645 int (*ndo_neigh_setup)(struct net_device *dev, 717 int (*ndo_neigh_setup)(struct net_device *dev,
646 struct neigh_parms *); 718 struct neigh_parms *);
647#define HAVE_TX_TIMEOUT
648 void (*ndo_tx_timeout) (struct net_device *dev); 719 void (*ndo_tx_timeout) (struct net_device *dev);
649 720
650 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 721 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
@@ -656,9 +727,23 @@ struct net_device_ops {
656 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 727 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
657 unsigned short vid); 728 unsigned short vid);
658#ifdef CONFIG_NET_POLL_CONTROLLER 729#ifdef CONFIG_NET_POLL_CONTROLLER
659#define HAVE_NETDEV_POLL
660 void (*ndo_poll_controller)(struct net_device *dev); 730 void (*ndo_poll_controller)(struct net_device *dev);
731 void (*ndo_netpoll_cleanup)(struct net_device *dev);
661#endif 732#endif
733 int (*ndo_set_vf_mac)(struct net_device *dev,
734 int queue, u8 *mac);
735 int (*ndo_set_vf_vlan)(struct net_device *dev,
736 int queue, u16 vlan, u8 qos);
737 int (*ndo_set_vf_tx_rate)(struct net_device *dev,
738 int vf, int rate);
739 int (*ndo_get_vf_config)(struct net_device *dev,
740 int vf,
741 struct ifla_vf_info *ivf);
742 int (*ndo_set_vf_port)(struct net_device *dev,
743 int vf,
744 struct nlattr *port[]);
745 int (*ndo_get_vf_port)(struct net_device *dev,
746 int vf, struct sk_buff *skb);
662#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 747#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
663 int (*ndo_fcoe_enable)(struct net_device *dev); 748 int (*ndo_fcoe_enable)(struct net_device *dev);
664 int (*ndo_fcoe_disable)(struct net_device *dev); 749 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -693,6 +778,9 @@ struct net_device {
693 * the interface. 778 * the interface.
694 */ 779 */
695 char name[IFNAMSIZ]; 780 char name[IFNAMSIZ];
781
782 struct pm_qos_request_list *pm_qos_req;
783
696 /* device name hash chain */ 784 /* device name hash chain */
697 struct hlist_node name_hlist; 785 struct hlist_node name_hlist;
698 /* snmp alias */ 786 /* snmp alias */
@@ -745,6 +833,8 @@ struct net_device {
745#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ 833#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
746#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ 834#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
747#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ 835#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
836#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
837#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
748 838
749 /* Segmentation offload features */ 839 /* Segmentation offload features */
750#define NETIF_F_GSO_SHIFT 16 840#define NETIF_F_GSO_SHIFT 16
@@ -801,7 +891,7 @@ struct net_device {
801 unsigned char operstate; /* RFC2863 operstate */ 891 unsigned char operstate; /* RFC2863 operstate */
802 unsigned char link_mode; /* mapping policy to operstate */ 892 unsigned char link_mode; /* mapping policy to operstate */
803 893
804 unsigned mtu; /* interface MTU value */ 894 unsigned int mtu; /* interface MTU value */
805 unsigned short type; /* interface hardware type */ 895 unsigned short type; /* interface hardware type */
806 unsigned short hard_header_len; /* hardware hdr length */ 896 unsigned short hard_header_len; /* hardware hdr length */
807 897
@@ -821,12 +911,10 @@ struct net_device {
821 unsigned char addr_len; /* hardware address length */ 911 unsigned char addr_len; /* hardware address length */
822 unsigned short dev_id; /* for shared network cards */ 912 unsigned short dev_id; /* for shared network cards */
823 913
824 struct netdev_hw_addr_list uc; /* Secondary unicast
825 mac addresses */
826 int uc_promisc;
827 spinlock_t addr_list_lock; 914 spinlock_t addr_list_lock;
828 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 915 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
829 int mc_count; /* Number of installed mcasts */ 916 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
917 int uc_promisc;
830 unsigned int promiscuity; 918 unsigned int promiscuity;
831 unsigned int allmulti; 919 unsigned int allmulti;
832 920
@@ -859,6 +947,15 @@ struct net_device {
859 947
860 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 948 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
861 949
950#ifdef CONFIG_RPS
951 struct kset *queues_kset;
952
953 struct netdev_rx_queue *_rx;
954
955 /* Number of RX queues allocated at alloc_netdev_mq() time */
956 unsigned int num_rx_queues;
957#endif
958
862 struct netdev_queue rx_queue; 959 struct netdev_queue rx_queue;
863 960
864 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 961 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
@@ -905,7 +1002,12 @@ struct net_device {
905 NETREG_UNREGISTERED, /* completed unregister todo */ 1002 NETREG_UNREGISTERED, /* completed unregister todo */
906 NETREG_RELEASED, /* called free_netdev */ 1003 NETREG_RELEASED, /* called free_netdev */
907 NETREG_DUMMY, /* dummy device for NAPI poll */ 1004 NETREG_DUMMY, /* dummy device for NAPI poll */
908 } reg_state; 1005 } reg_state:16;
1006
1007 enum {
1008 RTNL_LINK_INITIALIZED,
1009 RTNL_LINK_INITIALIZING,
1010 } rtnl_link_state:16;
909 1011
910 /* Called from unregister, can be used to call free_netdev */ 1012 /* Called from unregister, can be used to call free_netdev */
911 void (*destructor)(struct net_device *dev); 1013 void (*destructor)(struct net_device *dev);
@@ -953,6 +1055,8 @@ struct net_device {
953 /* max exchange id for FCoE LRO by ddp */ 1055 /* max exchange id for FCoE LRO by ddp */
954 unsigned int fcoe_ddp_xid; 1056 unsigned int fcoe_ddp_xid;
955#endif 1057#endif
1058 /* n-tuple filter list attached to this device */
1059 struct ethtool_rx_ntuple_list ethtool_ntuple_list;
956}; 1060};
957#define to_net_dev(d) container_of(d, struct net_device, dev) 1061#define to_net_dev(d) container_of(d, struct net_device, dev)
958 1062
@@ -1009,6 +1113,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
1009 return 0; 1113 return 0;
1010} 1114}
1011 1115
1116#ifndef CONFIG_NET_NS
1117static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1118{
1119 skb->dev = dev;
1120}
1121#else /* CONFIG_NET_NS */
1122void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
1123#endif
1124
1012static inline bool netdev_uses_trailer_tags(struct net_device *dev) 1125static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1013{ 1126{
1014#ifdef CONFIG_NET_DSA_TAG_TRAILER 1127#ifdef CONFIG_NET_DSA_TAG_TRAILER
@@ -1271,19 +1384,52 @@ static inline int unregister_gifconf(unsigned int family)
1271} 1384}
1272 1385
1273/* 1386/*
1274 * Incoming packets are placed on per-cpu queues so that 1387 * Incoming packets are placed on per-cpu queues
1275 * no locking is needed.
1276 */ 1388 */
1277struct softnet_data { 1389struct softnet_data {
1278 struct Qdisc *output_queue; 1390 struct Qdisc *output_queue;
1279 struct sk_buff_head input_pkt_queue; 1391 struct Qdisc **output_queue_tailp;
1280 struct list_head poll_list; 1392 struct list_head poll_list;
1281 struct sk_buff *completion_queue; 1393 struct sk_buff *completion_queue;
1282 1394 struct sk_buff_head process_queue;
1395
1396 /* stats */
1397 unsigned int processed;
1398 unsigned int time_squeeze;
1399 unsigned int cpu_collision;
1400 unsigned int received_rps;
1401
1402#ifdef CONFIG_RPS
1403 struct softnet_data *rps_ipi_list;
1404
1405 /* Elements below can be accessed between CPUs for RPS */
1406 struct call_single_data csd ____cacheline_aligned_in_smp;
1407 struct softnet_data *rps_ipi_next;
1408 unsigned int cpu;
1409 unsigned int input_queue_head;
1410 unsigned int input_queue_tail;
1411#endif
1412 unsigned dropped;
1413 struct sk_buff_head input_pkt_queue;
1283 struct napi_struct backlog; 1414 struct napi_struct backlog;
1284}; 1415};
1285 1416
1286DECLARE_PER_CPU(struct softnet_data,softnet_data); 1417static inline void input_queue_head_incr(struct softnet_data *sd)
1418{
1419#ifdef CONFIG_RPS
1420 sd->input_queue_head++;
1421#endif
1422}
1423
1424static inline void input_queue_tail_incr_save(struct softnet_data *sd,
1425 unsigned int *qtail)
1426{
1427#ifdef CONFIG_RPS
1428 *qtail = ++sd->input_queue_tail;
1429#endif
1430}
1431
1432DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1287 1433
1288#define HAVE_NETIF_QUEUE 1434#define HAVE_NETIF_QUEUE
1289 1435
@@ -1510,6 +1656,9 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
1510 return (dev->num_tx_queues > 1); 1656 return (dev->num_tx_queues > 1);
1511} 1657}
1512 1658
1659extern void netif_set_real_num_tx_queues(struct net_device *dev,
1660 unsigned int txq);
1661
1513/* Use this variant when it is known for sure that it 1662/* Use this variant when it is known for sure that it
1514 * is executing from hardware interrupt context or with hardware interrupts 1663 * is executing from hardware interrupt context or with hardware interrupts
1515 * disabled. 1664 * disabled.
@@ -1527,7 +1676,6 @@ extern int netif_rx(struct sk_buff *skb);
1527extern int netif_rx_ni(struct sk_buff *skb); 1676extern int netif_rx_ni(struct sk_buff *skb);
1528#define HAVE_NETIF_RECEIVE_SKB 1 1677#define HAVE_NETIF_RECEIVE_SKB 1
1529extern int netif_receive_skb(struct sk_buff *skb); 1678extern int netif_receive_skb(struct sk_buff *skb);
1530extern void napi_gro_flush(struct napi_struct *napi);
1531extern gro_result_t dev_gro_receive(struct napi_struct *napi, 1679extern gro_result_t dev_gro_receive(struct napi_struct *napi,
1532 struct sk_buff *skb); 1680 struct sk_buff *skb);
1533extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); 1681extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
@@ -1553,7 +1701,9 @@ extern int dev_valid_name(const char *name);
1553extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1701extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
1554extern int dev_ethtool(struct net *net, struct ifreq *); 1702extern int dev_ethtool(struct net *net, struct ifreq *);
1555extern unsigned dev_get_flags(const struct net_device *); 1703extern unsigned dev_get_flags(const struct net_device *);
1704extern int __dev_change_flags(struct net_device *, unsigned int flags);
1556extern int dev_change_flags(struct net_device *, unsigned); 1705extern int dev_change_flags(struct net_device *, unsigned);
1706extern void __dev_notify_flags(struct net_device *, unsigned int old_flags);
1557extern int dev_change_name(struct net_device *, const char *); 1707extern int dev_change_name(struct net_device *, const char *);
1558extern int dev_set_alias(struct net_device *, const char *, size_t); 1708extern int dev_set_alias(struct net_device *, const char *, size_t);
1559extern int dev_change_net_namespace(struct net_device *, 1709extern int dev_change_net_namespace(struct net_device *,
@@ -1909,6 +2059,22 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1909extern int register_netdev(struct net_device *dev); 2059extern int register_netdev(struct net_device *dev);
1910extern void unregister_netdev(struct net_device *dev); 2060extern void unregister_netdev(struct net_device *dev);
1911 2061
2062/* General hardware address lists handling functions */
2063extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2064 struct netdev_hw_addr_list *from_list,
2065 int addr_len, unsigned char addr_type);
2066extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2067 struct netdev_hw_addr_list *from_list,
2068 int addr_len, unsigned char addr_type);
2069extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2070 struct netdev_hw_addr_list *from_list,
2071 int addr_len);
2072extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2073 struct netdev_hw_addr_list *from_list,
2074 int addr_len);
2075extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2076extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2077
1912/* Functions used for device addresses handling */ 2078/* Functions used for device addresses handling */
1913extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2079extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1914 unsigned char addr_type); 2080 unsigned char addr_type);
@@ -1920,26 +2086,34 @@ extern int dev_addr_add_multiple(struct net_device *to_dev,
1920extern int dev_addr_del_multiple(struct net_device *to_dev, 2086extern int dev_addr_del_multiple(struct net_device *to_dev,
1921 struct net_device *from_dev, 2087 struct net_device *from_dev,
1922 unsigned char addr_type); 2088 unsigned char addr_type);
2089extern void dev_addr_flush(struct net_device *dev);
2090extern int dev_addr_init(struct net_device *dev);
2091
2092/* Functions used for unicast addresses handling */
2093extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2094extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2095extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2096extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2097extern void dev_uc_flush(struct net_device *dev);
2098extern void dev_uc_init(struct net_device *dev);
2099
2100/* Functions used for multicast addresses handling */
2101extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2102extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2103extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2104extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2105extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2106extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2107extern void dev_mc_flush(struct net_device *dev);
2108extern void dev_mc_init(struct net_device *dev);
1923 2109
1924/* Functions used for secondary unicast and multicast support */ 2110/* Functions used for secondary unicast and multicast support */
1925extern void dev_set_rx_mode(struct net_device *dev); 2111extern void dev_set_rx_mode(struct net_device *dev);
1926extern void __dev_set_rx_mode(struct net_device *dev); 2112extern void __dev_set_rx_mode(struct net_device *dev);
1927extern int dev_unicast_delete(struct net_device *dev, void *addr);
1928extern int dev_unicast_add(struct net_device *dev, void *addr);
1929extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1930extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1931extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
1932extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1933extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1934extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1935extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1936extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1937extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1938extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1939extern int dev_set_promiscuity(struct net_device *dev, int inc); 2113extern int dev_set_promiscuity(struct net_device *dev, int inc);
1940extern int dev_set_allmulti(struct net_device *dev, int inc); 2114extern int dev_set_allmulti(struct net_device *dev, int inc);
1941extern void netdev_state_change(struct net_device *dev); 2115extern void netdev_state_change(struct net_device *dev);
1942extern void netdev_bonding_change(struct net_device *dev, 2116extern int netdev_bonding_change(struct net_device *dev,
1943 unsigned long event); 2117 unsigned long event);
1944extern void netdev_features_change(struct net_device *dev); 2118extern void netdev_features_change(struct net_device *dev);
1945/* Load a device via the kmod */ 2119/* Load a device via the kmod */
@@ -1949,6 +2123,7 @@ extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1949extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); 2123extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats);
1950 2124
1951extern int netdev_max_backlog; 2125extern int netdev_max_backlog;
2126extern int netdev_tstamp_prequeue;
1952extern int weight_p; 2127extern int weight_p;
1953extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2128extern int netdev_set_master(struct net_device *dev, struct net_device *master);
1954extern int skb_checksum_help(struct sk_buff *skb); 2129extern int skb_checksum_help(struct sk_buff *skb);
@@ -2009,54 +2184,14 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2009 dev->gso_max_size = size; 2184 dev->gso_max_size = size;
2010} 2185}
2011 2186
2012static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, 2187extern int __skb_bond_should_drop(struct sk_buff *skb,
2013 struct net_device *master) 2188 struct net_device *master);
2014{
2015 if (skb->pkt_type == PACKET_HOST) {
2016 u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
2017 2189
2018 memcpy(dest, master->dev_addr, ETH_ALEN); 2190static inline int skb_bond_should_drop(struct sk_buff *skb,
2019 } 2191 struct net_device *master)
2020} 2192{
2021 2193 if (master)
2022/* On bonding slaves other than the currently active slave, suppress 2194 return __skb_bond_should_drop(skb, master);
2023 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
2024 * ARP on active-backup slaves with arp_validate enabled.
2025 */
2026static inline int skb_bond_should_drop(struct sk_buff *skb)
2027{
2028 struct net_device *dev = skb->dev;
2029 struct net_device *master = dev->master;
2030
2031 if (master) {
2032 if (master->priv_flags & IFF_MASTER_ARPMON)
2033 dev->last_rx = jiffies;
2034
2035 if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
2036 /* Do address unmangle. The local destination address
2037 * will be always the one master has. Provides the right
2038 * functionality in a bridge.
2039 */
2040 skb_bond_set_mac_by_master(skb, master);
2041 }
2042
2043 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
2044 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
2045 skb->protocol == __cpu_to_be16(ETH_P_ARP))
2046 return 0;
2047
2048 if (master->priv_flags & IFF_MASTER_ALB) {
2049 if (skb->pkt_type != PACKET_BROADCAST &&
2050 skb->pkt_type != PACKET_MULTICAST)
2051 return 0;
2052 }
2053 if (master->priv_flags & IFF_MASTER_8023AD &&
2054 skb->protocol == __cpu_to_be16(ETH_P_SLOW))
2055 return 0;
2056
2057 return 1;
2058 }
2059 }
2060 return 0; 2195 return 0;
2061} 2196}
2062 2197
@@ -2083,6 +2218,130 @@ static inline u32 dev_ethtool_get_flags(struct net_device *dev)
2083 return 0; 2218 return 0;
2084 return dev->ethtool_ops->get_flags(dev); 2219 return dev->ethtool_ops->get_flags(dev);
2085} 2220}
2221
2222/* Logging, debugging and troubleshooting/diagnostic helpers. */
2223
2224/* netdev_printk helpers, similar to dev_printk */
2225
2226static inline const char *netdev_name(const struct net_device *dev)
2227{
2228 if (dev->reg_state != NETREG_REGISTERED)
2229 return "(unregistered net_device)";
2230 return dev->name;
2231}
2232
2233#define netdev_printk(level, netdev, format, args...) \
2234 dev_printk(level, (netdev)->dev.parent, \
2235 "%s: " format, \
2236 netdev_name(netdev), ##args)
2237
2238#define netdev_emerg(dev, format, args...) \
2239 netdev_printk(KERN_EMERG, dev, format, ##args)
2240#define netdev_alert(dev, format, args...) \
2241 netdev_printk(KERN_ALERT, dev, format, ##args)
2242#define netdev_crit(dev, format, args...) \
2243 netdev_printk(KERN_CRIT, dev, format, ##args)
2244#define netdev_err(dev, format, args...) \
2245 netdev_printk(KERN_ERR, dev, format, ##args)
2246#define netdev_warn(dev, format, args...) \
2247 netdev_printk(KERN_WARNING, dev, format, ##args)
2248#define netdev_notice(dev, format, args...) \
2249 netdev_printk(KERN_NOTICE, dev, format, ##args)
2250#define netdev_info(dev, format, args...) \
2251 netdev_printk(KERN_INFO, dev, format, ##args)
2252
2253#if defined(DEBUG)
2254#define netdev_dbg(__dev, format, args...) \
2255 netdev_printk(KERN_DEBUG, __dev, format, ##args)
2256#elif defined(CONFIG_DYNAMIC_DEBUG)
2257#define netdev_dbg(__dev, format, args...) \
2258do { \
2259 dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \
2260 netdev_name(__dev), ##args); \
2261} while (0)
2262#else
2263#define netdev_dbg(__dev, format, args...) \
2264({ \
2265 if (0) \
2266 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
2267 0; \
2268})
2269#endif
2270
2271#if defined(VERBOSE_DEBUG)
2272#define netdev_vdbg netdev_dbg
2273#else
2274
2275#define netdev_vdbg(dev, format, args...) \
2276({ \
2277 if (0) \
2278 netdev_printk(KERN_DEBUG, dev, format, ##args); \
2279 0; \
2280})
2281#endif
2282
2283/*
2284 * netdev_WARN() acts like dev_printk(), but with the key difference
2285 * of using a WARN/WARN_ON to get the message out, including the
2286 * file/line information and a backtrace.
2287 */
2288#define netdev_WARN(dev, format, args...) \
2289 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args);
2290
2291/* netif printk helpers, similar to netdev_printk */
2292
2293#define netif_printk(priv, type, level, dev, fmt, args...) \
2294do { \
2295 if (netif_msg_##type(priv)) \
2296 netdev_printk(level, (dev), fmt, ##args); \
2297} while (0)
2298
2299#define netif_emerg(priv, type, dev, fmt, args...) \
2300 netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args)
2301#define netif_alert(priv, type, dev, fmt, args...) \
2302 netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args)
2303#define netif_crit(priv, type, dev, fmt, args...) \
2304 netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args)
2305#define netif_err(priv, type, dev, fmt, args...) \
2306 netif_printk(priv, type, KERN_ERR, dev, fmt, ##args)
2307#define netif_warn(priv, type, dev, fmt, args...) \
2308 netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args)
2309#define netif_notice(priv, type, dev, fmt, args...) \
2310 netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args)
2311#define netif_info(priv, type, dev, fmt, args...) \
2312 netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)
2313
2314#if defined(DEBUG)
2315#define netif_dbg(priv, type, dev, format, args...) \
2316 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
2317#elif defined(CONFIG_DYNAMIC_DEBUG)
2318#define netif_dbg(priv, type, netdev, format, args...) \
2319do { \
2320 if (netif_msg_##type(priv)) \
2321 dynamic_dev_dbg((netdev)->dev.parent, \
2322 "%s: " format, \
2323 netdev_name(netdev), ##args); \
2324} while (0)
2325#else
2326#define netif_dbg(priv, type, dev, format, args...) \
2327({ \
2328 if (0) \
2329 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
2330 0; \
2331})
2332#endif
2333
2334#if defined(VERBOSE_DEBUG)
2335#define netif_vdbg netif_dbg
2336#else
2337#define netif_vdbg(priv, type, dev, format, args...) \
2338({ \
2339 if (0) \
2340 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
2341 0; \
2342})
2343#endif
2344
2086#endif /* __KERNEL__ */ 2345#endif /* __KERNEL__ */
2087 2346
2088#endif /* _LINUX_NETDEVICE_H */ 2347#endif /* _LINUX_NETDEVICE_H */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 48c54960773c..89341c32631a 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -114,15 +114,17 @@ struct nf_sockopt_ops {
114 int set_optmin; 114 int set_optmin;
115 int set_optmax; 115 int set_optmax;
116 int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); 116 int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
117#ifdef CONFIG_COMPAT
117 int (*compat_set)(struct sock *sk, int optval, 118 int (*compat_set)(struct sock *sk, int optval,
118 void __user *user, unsigned int len); 119 void __user *user, unsigned int len);
119 120#endif
120 int get_optmin; 121 int get_optmin;
121 int get_optmax; 122 int get_optmax;
122 int (*get)(struct sock *sk, int optval, void __user *user, int *len); 123 int (*get)(struct sock *sk, int optval, void __user *user, int *len);
124#ifdef CONFIG_COMPAT
123 int (*compat_get)(struct sock *sk, int optval, 125 int (*compat_get)(struct sock *sk, int optval,
124 void __user *user, int *len); 126 void __user *user, int *len);
125 127#endif
126 /* Use the module struct to lock set/get code in place */ 128 /* Use the module struct to lock set/get code in place */
127 struct module *owner; 129 struct module *owner;
128}; 130};
@@ -161,11 +163,8 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
161 struct sk_buff *skb, 163 struct sk_buff *skb,
162 struct net_device *indev, 164 struct net_device *indev,
163 struct net_device *outdev, 165 struct net_device *outdev,
164 int (*okfn)(struct sk_buff *), int thresh, 166 int (*okfn)(struct sk_buff *), int thresh)
165 int cond)
166{ 167{
167 if (!cond)
168 return 1;
169#ifndef CONFIG_NETFILTER_DEBUG 168#ifndef CONFIG_NETFILTER_DEBUG
170 if (list_empty(&nf_hooks[pf][hook])) 169 if (list_empty(&nf_hooks[pf][hook]))
171 return 1; 170 return 1;
@@ -177,7 +176,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
177 struct net_device *indev, struct net_device *outdev, 176 struct net_device *indev, struct net_device *outdev,
178 int (*okfn)(struct sk_buff *)) 177 int (*okfn)(struct sk_buff *))
179{ 178{
180 return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN, 1); 179 return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN);
181} 180}
182 181
183/* Activate hook; either okfn or kfree_skb called, unless a hook 182/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -197,36 +196,49 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
197 coders :) 196 coders :)
198*/ 197*/
199 198
200/* This is gross, but inline doesn't cut it for avoiding the function 199static inline int
201 call in fast path: gcc doesn't inline (needs value tracking?). --RR */ 200NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb,
202 201 struct net_device *in, struct net_device *out,
203/* HX: It's slightly less gross now. */ 202 int (*okfn)(struct sk_buff *), int thresh)
203{
204 int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh);
205 if (ret == 1)
206 ret = okfn(skb);
207 return ret;
208}
204 209
205#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ 210static inline int
206({int __ret; \ 211NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb,
207if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh, 1)) == 1)\ 212 struct net_device *in, struct net_device *out,
208 __ret = (okfn)(skb); \ 213 int (*okfn)(struct sk_buff *), bool cond)
209__ret;}) 214{
215 int ret;
210 216
211#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ 217 if (!cond ||
212({int __ret; \ 218 (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1))
213if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\ 219 ret = okfn(skb);
214 __ret = (okfn)(skb); \ 220 return ret;
215__ret;}) 221}
216 222
217#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ 223static inline int
218 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) 224NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
225 struct net_device *in, struct net_device *out,
226 int (*okfn)(struct sk_buff *))
227{
228 return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN);
229}
219 230
220/* Call setsockopt() */ 231/* Call setsockopt() */
221int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 232int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
222 unsigned int len); 233 unsigned int len);
223int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 234int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
224 int *len); 235 int *len);
225 236#ifdef CONFIG_COMPAT
226int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, 237int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
227 char __user *opt, unsigned int len); 238 char __user *opt, unsigned int len);
228int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, 239int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
229 char __user *opt, int *len); 240 char __user *opt, int *len);
241#endif
230 242
231/* Call this before modifying an existing packet: ensures it is 243/* Call this before modifying an existing packet: ensures it is
232 modifiable and linear to the point you care about (writable_len). 244 modifiable and linear to the point you care about (writable_len).
@@ -325,8 +337,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
325 struct sk_buff *skb, 337 struct sk_buff *skb,
326 struct net_device *indev, 338 struct net_device *indev,
327 struct net_device *outdev, 339 struct net_device *outdev,
328 int (*okfn)(struct sk_buff *), int thresh, 340 int (*okfn)(struct sk_buff *), int thresh)
329 int cond)
330{ 341{
331 return okfn(skb); 342 return okfn(skb);
332} 343}
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 2aea50399c0b..48767cd16453 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -6,6 +6,7 @@ header-y += nfnetlink_queue.h
6header-y += xt_CLASSIFY.h 6header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h 7header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h 8header-y += xt_CONNSECMARK.h
9header-y += xt_CT.h
9header-y += xt_DSCP.h 10header-y += xt_DSCP.h
10header-y += xt_LED.h 11header-y += xt_LED.h
11header-y += xt_MARK.h 12header-y += xt_MARK.h
@@ -15,6 +16,7 @@ header-y += xt_RATEEST.h
15header-y += xt_SECMARK.h 16header-y += xt_SECMARK.h
16header-y += xt_TCPMSS.h 17header-y += xt_TCPMSS.h
17header-y += xt_TCPOPTSTRIP.h 18header-y += xt_TCPOPTSTRIP.h
19header-y += xt_TEE.h
18header-y += xt_TPROXY.h 20header-y += xt_TPROXY.h
19header-y += xt_comment.h 21header-y += xt_comment.h
20header-y += xt_connbytes.h 22header-y += xt_connbytes.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index a374787ed9b0..14e6d32002c4 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -72,6 +72,28 @@ enum ip_conntrack_status {
72 /* Connection has fixed timeout. */ 72 /* Connection has fixed timeout. */
73 IPS_FIXED_TIMEOUT_BIT = 10, 73 IPS_FIXED_TIMEOUT_BIT = 10,
74 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), 74 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
75
76 /* Conntrack is a template */
77 IPS_TEMPLATE_BIT = 11,
78 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
79};
80
81/* Connection tracking event types */
82enum ip_conntrack_events {
83 IPCT_NEW, /* new conntrack */
84 IPCT_RELATED, /* related conntrack */
85 IPCT_DESTROY, /* destroyed conntrack */
86 IPCT_REPLY, /* connection has seen two-way traffic */
87 IPCT_ASSURED, /* connection status has changed to assured */
88 IPCT_PROTOINFO, /* protocol information has changed */
89 IPCT_HELPER, /* new helper has been set */
90 IPCT_MARK, /* new mark has been set */
91 IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */
92 IPCT_SECMARK, /* new security mark has been set */
93};
94
95enum ip_conntrack_expect_events {
96 IPEXP_NEW, /* new expectation */
75}; 97};
76 98
77#ifdef __KERNEL__ 99#ifdef __KERNEL__
@@ -91,6 +113,7 @@ struct ip_conntrack_stat {
91 unsigned int expect_new; 113 unsigned int expect_new;
92 unsigned int expect_create; 114 unsigned int expect_create;
93 unsigned int expect_delete; 115 unsigned int expect_delete;
116 unsigned int search_restart;
94}; 117};
95 118
96/* call to create an explicit dependency on nf_conntrack. */ 119/* call to create an explicit dependency on nf_conntrack. */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 23aa2ec6b7b7..ff8cfbcf3b81 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -14,6 +14,7 @@ enum sip_expectation_classes {
14 SIP_EXPECT_SIGNALLING, 14 SIP_EXPECT_SIGNALLING,
15 SIP_EXPECT_AUDIO, 15 SIP_EXPECT_AUDIO,
16 SIP_EXPECT_VIDEO, 16 SIP_EXPECT_VIDEO,
17 SIP_EXPECT_IMAGE,
17 __SIP_EXPECT_MAX 18 __SIP_EXPECT_MAX
18}; 19};
19#define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) 20#define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1)
@@ -34,10 +35,10 @@ struct sdp_media_type {
34struct sip_handler { 35struct sip_handler {
35 const char *method; 36 const char *method;
36 unsigned int len; 37 unsigned int len;
37 int (*request)(struct sk_buff *skb, 38 int (*request)(struct sk_buff *skb, unsigned int dataoff,
38 const char **dptr, unsigned int *datalen, 39 const char **dptr, unsigned int *datalen,
39 unsigned int cseq); 40 unsigned int cseq);
40 int (*response)(struct sk_buff *skb, 41 int (*response)(struct sk_buff *skb, unsigned int dataoff,
41 const char **dptr, unsigned int *datalen, 42 const char **dptr, unsigned int *datalen,
42 unsigned int cseq, unsigned int code); 43 unsigned int cseq, unsigned int code);
43}; 44};
@@ -84,7 +85,8 @@ enum sip_header_types {
84 SIP_HDR_FROM, 85 SIP_HDR_FROM,
85 SIP_HDR_TO, 86 SIP_HDR_TO,
86 SIP_HDR_CONTACT, 87 SIP_HDR_CONTACT,
87 SIP_HDR_VIA, 88 SIP_HDR_VIA_UDP,
89 SIP_HDR_VIA_TCP,
88 SIP_HDR_EXPIRES, 90 SIP_HDR_EXPIRES,
89 SIP_HDR_CONTENT_LENGTH, 91 SIP_HDR_CONTENT_LENGTH,
90}; 92};
@@ -100,33 +102,40 @@ enum sdp_header_types {
100}; 102};
101 103
102extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 104extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
105 unsigned int dataoff,
103 const char **dptr, 106 const char **dptr,
104 unsigned int *datalen); 107 unsigned int *datalen);
108extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, s16 off);
105extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, 109extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
110 unsigned int dataoff,
106 const char **dptr, 111 const char **dptr,
107 unsigned int *datalen, 112 unsigned int *datalen,
108 struct nf_conntrack_expect *exp, 113 struct nf_conntrack_expect *exp,
109 unsigned int matchoff, 114 unsigned int matchoff,
110 unsigned int matchlen); 115 unsigned int matchlen);
111extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, 116extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
112 const char **dptr,
113 unsigned int dataoff, 117 unsigned int dataoff,
118 const char **dptr,
114 unsigned int *datalen, 119 unsigned int *datalen,
120 unsigned int sdpoff,
115 enum sdp_header_types type, 121 enum sdp_header_types type,
116 enum sdp_header_types term, 122 enum sdp_header_types term,
117 const union nf_inet_addr *addr); 123 const union nf_inet_addr *addr);
118extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, 124extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
125 unsigned int dataoff,
119 const char **dptr, 126 const char **dptr,
120 unsigned int *datalen, 127 unsigned int *datalen,
121 unsigned int matchoff, 128 unsigned int matchoff,
122 unsigned int matchlen, 129 unsigned int matchlen,
123 u_int16_t port); 130 u_int16_t port);
124extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, 131extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
125 const char **dptr,
126 unsigned int dataoff, 132 unsigned int dataoff,
133 const char **dptr,
127 unsigned int *datalen, 134 unsigned int *datalen,
135 unsigned int sdpoff,
128 const union nf_inet_addr *addr); 136 const union nf_inet_addr *addr);
129extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, 137extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
138 unsigned int dataoff,
130 const char **dptr, 139 const char **dptr,
131 unsigned int *datalen, 140 unsigned int *datalen,
132 struct nf_conntrack_expect *rtp_exp, 141 struct nf_conntrack_expect *rtp_exp,
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
index 8e145f0d61cb..2ea22b018a87 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -1,8 +1,7 @@
1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H 1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H
2#define _NF_CONNTRACK_TUPLE_COMMON_H 2#define _NF_CONNTRACK_TUPLE_COMMON_H
3 3
4enum ip_conntrack_dir 4enum ip_conntrack_dir {
5{
6 IP_CT_DIR_ORIGINAL, 5 IP_CT_DIR_ORIGINAL,
7 IP_CT_DIR_REPLY, 6 IP_CT_DIR_REPLY,
8 IP_CT_DIR_MAX 7 IP_CT_DIR_MAX
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 49d321f3ccd2..361d6b5630ee 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -73,11 +73,11 @@ struct nfnetlink_subsystem {
73extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); 73extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
74extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 74extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
75 75
76extern int nfnetlink_has_listeners(unsigned int group); 76extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 77extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group,
78 int echo, gfp_t flags); 78 int echo, gfp_t flags);
79extern void nfnetlink_set_err(u32 pid, u32 group, int error); 79extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
80extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 80extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
81 81
82extern void nfnl_lock(void); 82extern void nfnl_lock(void);
83extern void nfnl_unlock(void); 83extern void nfnl_unlock(void);
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index ed4ef8d0b11b..9ed534c991b9 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -40,6 +40,7 @@ enum ctattr_type {
40 CTA_NAT_SEQ_ADJ_ORIG, 40 CTA_NAT_SEQ_ADJ_ORIG,
41 CTA_NAT_SEQ_ADJ_REPLY, 41 CTA_NAT_SEQ_ADJ_REPLY,
42 CTA_SECMARK, 42 CTA_SECMARK,
43 CTA_ZONE,
43 __CTA_MAX 44 __CTA_MAX
44}; 45};
45#define CTA_MAX (__CTA_MAX - 1) 46#define CTA_MAX (__CTA_MAX - 1)
@@ -159,6 +160,7 @@ enum ctattr_expect {
159 CTA_EXPECT_TIMEOUT, 160 CTA_EXPECT_TIMEOUT,
160 CTA_EXPECT_ID, 161 CTA_EXPECT_ID,
161 CTA_EXPECT_HELP_NAME, 162 CTA_EXPECT_HELP_NAME,
163 CTA_EXPECT_ZONE,
162 __CTA_EXPECT_MAX 164 __CTA_EXPECT_MAX
163}; 165};
164#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) 166#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 378f27ae7772..24e5d01d27d0 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -1,9 +1,10 @@
1#ifndef _X_TABLES_H 1#ifndef _X_TABLES_H
2#define _X_TABLES_H 2#define _X_TABLES_H
3 3#include <linux/kernel.h>
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_FUNCTION_MAXNAMELEN 30 6#define XT_FUNCTION_MAXNAMELEN 30
7#define XT_EXTENSION_MAXNAMELEN 29
7#define XT_TABLE_MAXNAMELEN 32 8#define XT_TABLE_MAXNAMELEN 32
8 9
9struct xt_entry_match { 10struct xt_entry_match {
@@ -12,8 +13,7 @@ struct xt_entry_match {
12 __u16 match_size; 13 __u16 match_size;
13 14
14 /* Used by userspace */ 15 /* Used by userspace */
15 char name[XT_FUNCTION_MAXNAMELEN-1]; 16 char name[XT_EXTENSION_MAXNAMELEN];
16
17 __u8 revision; 17 __u8 revision;
18 } user; 18 } user;
19 struct { 19 struct {
@@ -36,8 +36,7 @@ struct xt_entry_target {
36 __u16 target_size; 36 __u16 target_size;
37 37
38 /* Used by userspace */ 38 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1]; 39 char name[XT_EXTENSION_MAXNAMELEN];
40
41 __u8 revision; 40 __u8 revision;
42 } user; 41 } user;
43 struct { 42 struct {
@@ -70,8 +69,7 @@ struct xt_standard_target {
70/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision 69/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
71 * kernel supports, if >= revision. */ 70 * kernel supports, if >= revision. */
72struct xt_get_revision { 71struct xt_get_revision {
73 char name[XT_FUNCTION_MAXNAMELEN-1]; 72 char name[XT_EXTENSION_MAXNAMELEN];
74
75 __u8 revision; 73 __u8 revision;
76}; 74};
77 75
@@ -93,8 +91,7 @@ struct _xt_align {
93 __u64 u64; 91 __u64 u64;
94}; 92};
95 93
96#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ 94#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
97 & ~(__alignof__(struct _xt_align)-1))
98 95
99/* Standard return verdict, or do jump. */ 96/* Standard return verdict, or do jump. */
100#define XT_STANDARD_TARGET "" 97#define XT_STANDARD_TARGET ""
@@ -121,6 +118,7 @@ struct xt_counters_info {
121 118
122#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 119#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
123 120
121#ifndef __KERNEL__
124/* fn returns 0 to continue iteration */ 122/* fn returns 0 to continue iteration */
125#define XT_MATCH_ITERATE(type, e, fn, args...) \ 123#define XT_MATCH_ITERATE(type, e, fn, args...) \
126({ \ 124({ \
@@ -164,47 +162,77 @@ struct xt_counters_info {
164#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ 162#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
165 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) 163 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
166 164
165#endif /* !__KERNEL__ */
166
167/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
168#define xt_entry_foreach(pos, ehead, esize) \
169 for ((pos) = (typeof(pos))(ehead); \
170 (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
171 (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
172
173/* can only be xt_entry_match, so no use of typeof here */
174#define xt_ematch_foreach(pos, entry) \
175 for ((pos) = (struct xt_entry_match *)entry->elems; \
176 (pos) < (struct xt_entry_match *)((char *)(entry) + \
177 (entry)->target_offset); \
178 (pos) = (struct xt_entry_match *)((char *)(pos) + \
179 (pos)->u.match_size))
180
167#ifdef __KERNEL__ 181#ifdef __KERNEL__
168 182
169#include <linux/netdevice.h> 183#include <linux/netdevice.h>
170 184
171/** 185/**
172 * struct xt_match_param - parameters for match extensions' match functions 186 * struct xt_action_param - parameters for matches/targets
173 * 187 *
188 * @match: the match extension
189 * @target: the target extension
190 * @matchinfo: per-match data
191 * @targetinfo: per-target data
174 * @in: input netdevice 192 * @in: input netdevice
175 * @out: output netdevice 193 * @out: output netdevice
176 * @match: struct xt_match through which this function was invoked
177 * @matchinfo: per-match data
178 * @fragoff: packet is a fragment, this is the data offset 194 * @fragoff: packet is a fragment, this is the data offset
179 * @thoff: position of transport header relative to skb->data 195 * @thoff: position of transport header relative to skb->data
180 * @hook: hook number given packet came from 196 * @hook: hook number given packet came from
181 * @family: Actual NFPROTO_* through which the function is invoked 197 * @family: Actual NFPROTO_* through which the function is invoked
182 * (helpful when match->family == NFPROTO_UNSPEC) 198 * (helpful when match->family == NFPROTO_UNSPEC)
199 *
200 * Fields written to by extensions:
201 *
183 * @hotdrop: drop packet if we had inspection problems 202 * @hotdrop: drop packet if we had inspection problems
203 * Network namespace obtainable using dev_net(in/out)
184 */ 204 */
185struct xt_match_param { 205struct xt_action_param {
206 union {
207 const struct xt_match *match;
208 const struct xt_target *target;
209 };
210 union {
211 const void *matchinfo, *targinfo;
212 };
186 const struct net_device *in, *out; 213 const struct net_device *in, *out;
187 const struct xt_match *match;
188 const void *matchinfo;
189 int fragoff; 214 int fragoff;
190 unsigned int thoff; 215 unsigned int thoff;
191 unsigned int hooknum; 216 unsigned int hooknum;
192 u_int8_t family; 217 u_int8_t family;
193 bool *hotdrop; 218 bool hotdrop;
194}; 219};
195 220
196/** 221/**
197 * struct xt_mtchk_param - parameters for match extensions' 222 * struct xt_mtchk_param - parameters for match extensions'
198 * checkentry functions 223 * checkentry functions
199 * 224 *
225 * @net: network namespace through which the check was invoked
200 * @table: table the rule is tried to be inserted into 226 * @table: table the rule is tried to be inserted into
201 * @entryinfo: the family-specific rule data 227 * @entryinfo: the family-specific rule data
202 * (struct ipt_ip, ip6t_ip, ebt_entry) 228 * (struct ipt_ip, ip6t_ip, arpt_arp or (note) ebt_entry)
203 * @match: struct xt_match through which this function was invoked 229 * @match: struct xt_match through which this function was invoked
204 * @matchinfo: per-match data 230 * @matchinfo: per-match data
205 * @hook_mask: via which hooks the new rule is reachable 231 * @hook_mask: via which hooks the new rule is reachable
232 * Other fields as above.
206 */ 233 */
207struct xt_mtchk_param { 234struct xt_mtchk_param {
235 struct net *net;
208 const char *table; 236 const char *table;
209 const void *entryinfo; 237 const void *entryinfo;
210 const struct xt_match *match; 238 const struct xt_match *match;
@@ -213,31 +241,18 @@ struct xt_mtchk_param {
213 u_int8_t family; 241 u_int8_t family;
214}; 242};
215 243
216/* Match destructor parameters */ 244/**
245 * struct xt_mdtor_param - match destructor parameters
246 * Fields as above.
247 */
217struct xt_mtdtor_param { 248struct xt_mtdtor_param {
249 struct net *net;
218 const struct xt_match *match; 250 const struct xt_match *match;
219 void *matchinfo; 251 void *matchinfo;
220 u_int8_t family; 252 u_int8_t family;
221}; 253};
222 254
223/** 255/**
224 * struct xt_target_param - parameters for target extensions' target functions
225 *
226 * @hooknum: hook through which this target was invoked
227 * @target: struct xt_target through which this function was invoked
228 * @targinfo: per-target data
229 *
230 * Other fields see above.
231 */
232struct xt_target_param {
233 const struct net_device *in, *out;
234 const struct xt_target *target;
235 const void *targinfo;
236 unsigned int hooknum;
237 u_int8_t family;
238};
239
240/**
241 * struct xt_tgchk_param - parameters for target extensions' 256 * struct xt_tgchk_param - parameters for target extensions'
242 * checkentry functions 257 * checkentry functions
243 * 258 *
@@ -247,6 +262,7 @@ struct xt_target_param {
247 * Other fields see above. 262 * Other fields see above.
248 */ 263 */
249struct xt_tgchk_param { 264struct xt_tgchk_param {
265 struct net *net;
250 const char *table; 266 const char *table;
251 const void *entryinfo; 267 const void *entryinfo;
252 const struct xt_target *target; 268 const struct xt_target *target;
@@ -257,6 +273,7 @@ struct xt_tgchk_param {
257 273
258/* Target destructor parameters */ 274/* Target destructor parameters */
259struct xt_tgdtor_param { 275struct xt_tgdtor_param {
276 struct net *net;
260 const struct xt_target *target; 277 const struct xt_target *target;
261 void *targinfo; 278 void *targinfo;
262 u_int8_t family; 279 u_int8_t family;
@@ -265,7 +282,7 @@ struct xt_tgdtor_param {
265struct xt_match { 282struct xt_match {
266 struct list_head list; 283 struct list_head list;
267 284
268 const char name[XT_FUNCTION_MAXNAMELEN-1]; 285 const char name[XT_EXTENSION_MAXNAMELEN];
269 u_int8_t revision; 286 u_int8_t revision;
270 287
271 /* Return true or false: return FALSE and set *hotdrop = 1 to 288 /* Return true or false: return FALSE and set *hotdrop = 1 to
@@ -274,27 +291,26 @@ struct xt_match {
274 non-linear skb, using skb_header_pointer and 291 non-linear skb, using skb_header_pointer and
275 skb_ip_make_writable. */ 292 skb_ip_make_writable. */
276 bool (*match)(const struct sk_buff *skb, 293 bool (*match)(const struct sk_buff *skb,
277 const struct xt_match_param *); 294 struct xt_action_param *);
278 295
279 /* Called when user tries to insert an entry of this type. */ 296 /* Called when user tries to insert an entry of this type. */
280 bool (*checkentry)(const struct xt_mtchk_param *); 297 int (*checkentry)(const struct xt_mtchk_param *);
281 298
282 /* Called when entry of this type deleted. */ 299 /* Called when entry of this type deleted. */
283 void (*destroy)(const struct xt_mtdtor_param *); 300 void (*destroy)(const struct xt_mtdtor_param *);
284 301#ifdef CONFIG_COMPAT
285 /* Called when userspace align differs from kernel space one */ 302 /* Called when userspace align differs from kernel space one */
286 void (*compat_from_user)(void *dst, void *src); 303 void (*compat_from_user)(void *dst, const void *src);
287 int (*compat_to_user)(void __user *dst, void *src); 304 int (*compat_to_user)(void __user *dst, const void *src);
288 305#endif
289 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 306 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
290 struct module *me; 307 struct module *me;
291 308
292 /* Free to use by each match */
293 unsigned long data;
294
295 const char *table; 309 const char *table;
296 unsigned int matchsize; 310 unsigned int matchsize;
311#ifdef CONFIG_COMPAT
297 unsigned int compatsize; 312 unsigned int compatsize;
313#endif
298 unsigned int hooks; 314 unsigned int hooks;
299 unsigned short proto; 315 unsigned short proto;
300 316
@@ -305,38 +321,40 @@ struct xt_match {
305struct xt_target { 321struct xt_target {
306 struct list_head list; 322 struct list_head list;
307 323
308 const char name[XT_FUNCTION_MAXNAMELEN-1]; 324 const char name[XT_EXTENSION_MAXNAMELEN];
325 u_int8_t revision;
309 326
310 /* Returns verdict. Argument order changed since 2.6.9, as this 327 /* Returns verdict. Argument order changed since 2.6.9, as this
311 must now handle non-linear skbs, using skb_copy_bits and 328 must now handle non-linear skbs, using skb_copy_bits and
312 skb_ip_make_writable. */ 329 skb_ip_make_writable. */
313 unsigned int (*target)(struct sk_buff *skb, 330 unsigned int (*target)(struct sk_buff *skb,
314 const struct xt_target_param *); 331 const struct xt_action_param *);
315 332
316 /* Called when user tries to insert an entry of this type: 333 /* Called when user tries to insert an entry of this type:
317 hook_mask is a bitmask of hooks from which it can be 334 hook_mask is a bitmask of hooks from which it can be
318 called. */ 335 called. */
319 /* Should return true or false. */ 336 /* Should return 0 on success or an error code otherwise (-Exxxx). */
320 bool (*checkentry)(const struct xt_tgchk_param *); 337 int (*checkentry)(const struct xt_tgchk_param *);
321 338
322 /* Called when entry of this type deleted. */ 339 /* Called when entry of this type deleted. */
323 void (*destroy)(const struct xt_tgdtor_param *); 340 void (*destroy)(const struct xt_tgdtor_param *);
324 341#ifdef CONFIG_COMPAT
325 /* Called when userspace align differs from kernel space one */ 342 /* Called when userspace align differs from kernel space one */
326 void (*compat_from_user)(void *dst, void *src); 343 void (*compat_from_user)(void *dst, const void *src);
327 int (*compat_to_user)(void __user *dst, void *src); 344 int (*compat_to_user)(void __user *dst, const void *src);
328 345#endif
329 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 346 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
330 struct module *me; 347 struct module *me;
331 348
332 const char *table; 349 const char *table;
333 unsigned int targetsize; 350 unsigned int targetsize;
351#ifdef CONFIG_COMPAT
334 unsigned int compatsize; 352 unsigned int compatsize;
353#endif
335 unsigned int hooks; 354 unsigned int hooks;
336 unsigned short proto; 355 unsigned short proto;
337 356
338 unsigned short family; 357 unsigned short family;
339 u_int8_t revision;
340}; 358};
341 359
342/* Furniture shopping... */ 360/* Furniture shopping... */
@@ -353,6 +371,7 @@ struct xt_table {
353 struct module *me; 371 struct module *me;
354 372
355 u_int8_t af; /* address/protocol family */ 373 u_int8_t af; /* address/protocol family */
374 int priority; /* hook order */
356 375
357 /* A unique name... */ 376 /* A unique name... */
358 const char name[XT_TABLE_MAXNAMELEN]; 377 const char name[XT_TABLE_MAXNAMELEN];
@@ -373,6 +392,13 @@ struct xt_table_info {
373 unsigned int hook_entry[NF_INET_NUMHOOKS]; 392 unsigned int hook_entry[NF_INET_NUMHOOKS];
374 unsigned int underflow[NF_INET_NUMHOOKS]; 393 unsigned int underflow[NF_INET_NUMHOOKS];
375 394
395 /*
396 * Number of user chains. Since tables cannot have loops, at most
397 * @stacksize jumps (number of user chains) can possibly be made.
398 */
399 unsigned int stacksize;
400 unsigned int __percpu *stackptr;
401 void ***jumpstack;
376 /* ipt_entry tables: one per CPU */ 402 /* ipt_entry tables: one per CPU */
377 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */ 403 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
378 void *entries[1]; 404 void *entries[1];
@@ -408,6 +434,8 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table,
408 434
409extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); 435extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
410extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); 436extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
437extern struct xt_match *xt_request_find_match(u8 af, const char *name,
438 u8 revision);
411extern struct xt_target *xt_request_find_target(u8 af, const char *name, 439extern struct xt_target *xt_request_find_target(u8 af, const char *name,
412 u8 revision); 440 u8 revision);
413extern int xt_find_revision(u8 af, const char *name, u8 revision, 441extern int xt_find_revision(u8 af, const char *name, u8 revision,
@@ -514,6 +542,9 @@ static inline unsigned long ifname_compare_aligned(const char *_a,
514 return ret; 542 return ret;
515} 543}
516 544
545extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
546extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
547
517#ifdef CONFIG_COMPAT 548#ifdef CONFIG_COMPAT
518#include <net/compat.h> 549#include <net/compat.h>
519 550
@@ -554,11 +585,7 @@ struct compat_xt_entry_target {
554 * current task alignment */ 585 * current task alignment */
555 586
556struct compat_xt_counters { 587struct compat_xt_counters {
557#if defined(CONFIG_X86_64) || defined(CONFIG_IA64) 588 compat_u64 pcnt, bcnt; /* Packet and byte counters */
558 u_int32_t cnt[4];
559#else
560 u_int64_t cnt[2];
561#endif
562}; 589};
563 590
564struct compat_xt_counters_info { 591struct compat_xt_counters_info {
@@ -567,26 +594,32 @@ struct compat_xt_counters_info {
567 struct compat_xt_counters counters[0]; 594 struct compat_xt_counters counters[0];
568}; 595};
569 596
570#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ 597struct _compat_xt_align {
571 & ~(__alignof__(struct compat_xt_counters)-1)) 598 __u8 u8;
599 __u16 u16;
600 __u32 u32;
601 compat_u64 u64;
602};
603
604#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
572 605
573extern void xt_compat_lock(u_int8_t af); 606extern void xt_compat_lock(u_int8_t af);
574extern void xt_compat_unlock(u_int8_t af); 607extern void xt_compat_unlock(u_int8_t af);
575 608
576extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); 609extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
577extern void xt_compat_flush_offsets(u_int8_t af); 610extern void xt_compat_flush_offsets(u_int8_t af);
578extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); 611extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
579 612
580extern int xt_compat_match_offset(const struct xt_match *match); 613extern int xt_compat_match_offset(const struct xt_match *match);
581extern int xt_compat_match_from_user(struct xt_entry_match *m, 614extern int xt_compat_match_from_user(struct xt_entry_match *m,
582 void **dstptr, unsigned int *size); 615 void **dstptr, unsigned int *size);
583extern int xt_compat_match_to_user(struct xt_entry_match *m, 616extern int xt_compat_match_to_user(const struct xt_entry_match *m,
584 void __user **dstptr, unsigned int *size); 617 void __user **dstptr, unsigned int *size);
585 618
586extern int xt_compat_target_offset(const struct xt_target *target); 619extern int xt_compat_target_offset(const struct xt_target *target);
587extern void xt_compat_target_from_user(struct xt_entry_target *t, 620extern void xt_compat_target_from_user(struct xt_entry_target *t,
588 void **dstptr, unsigned int *size); 621 void **dstptr, unsigned int *size);
589extern int xt_compat_target_to_user(struct xt_entry_target *t, 622extern int xt_compat_target_to_user(const struct xt_entry_target *t,
590 void __user **dstptr, unsigned int *size); 623 void __user **dstptr, unsigned int *size);
591 624
592#endif /* CONFIG_COMPAT */ 625#endif /* CONFIG_COMPAT */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 0a8545866752..2f2e48ec8023 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -1,26 +1,6 @@
1#ifndef _XT_CONNMARK_H_target 1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target 2#define _XT_CONNMARK_H_target
3 3
4#include <linux/types.h> 4#include <linux/netfilter/xt_connmark.h>
5
6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
7 * by Henrik Nordstrom <hno@marasystems.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15enum {
16 XT_CONNMARK_SET = 0,
17 XT_CONNMARK_SAVE,
18 XT_CONNMARK_RESTORE
19};
20
21struct xt_connmark_tginfo1 {
22 __u32 ctmark, ctmask, nfmask;
23 __u8 mode;
24};
25 5
26#endif /*_XT_CONNMARK_H_target*/ 6#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
new file mode 100644
index 000000000000..1b564106891d
--- /dev/null
+++ b/include/linux/netfilter/xt_CT.h
@@ -0,0 +1,17 @@
1#ifndef _XT_CT_H
2#define _XT_CT_H
3
4#define XT_CT_NOTRACK 0x1
5
6struct xt_ct_target_info {
7 u_int16_t flags;
8 u_int16_t zone;
9 u_int32_t ct_events;
10 u_int32_t exp_events;
11 char helper[16];
12
13 /* Used internally by the kernel */
14 struct nf_conn *ct __attribute__((aligned(8)));
15};
16
17#endif /* _XT_CT_H */
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index bc9561bdef79..41c456deba22 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -1,10 +1,6 @@
1#ifndef _XT_MARK_H_target 1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target 2#define _XT_MARK_H_target
3 3
4#include <linux/types.h> 4#include <linux/netfilter/xt_mark.h>
5
6struct xt_mark_tginfo2 {
7 __u32 mark, mask;
8};
9 5
10#endif /*_XT_MARK_H_target */ 6#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_TEE.h b/include/linux/netfilter/xt_TEE.h
new file mode 100644
index 000000000000..5c21d5c829af
--- /dev/null
+++ b/include/linux/netfilter/xt_TEE.h
@@ -0,0 +1,12 @@
1#ifndef _XT_TEE_TARGET_H
2#define _XT_TEE_TARGET_H
3
4struct xt_tee_tginfo {
5 union nf_inet_addr gw;
6 char oif[16];
7
8 /* used internally by the kernel */
9 struct xt_tee_priv *priv __attribute__((aligned(8)));
10};
11
12#endif /* _XT_TEE_TARGET_H */
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 619e47cde01a..efc17a8305fb 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -12,6 +12,17 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15enum {
16 XT_CONNMARK_SET = 0,
17 XT_CONNMARK_SAVE,
18 XT_CONNMARK_RESTORE
19};
20
21struct xt_connmark_tginfo1 {
22 __u32 ctmark, ctmask, nfmask;
23 __u8 mode;
24};
25
15struct xt_connmark_mtinfo1 { 26struct xt_connmark_mtinfo1 {
16 __u32 mark, mask; 27 __u32 mark, mask;
17 __u8 invert; 28 __u8 invert;
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 6607c8f38ea5..ecadc40d5cde 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -3,6 +3,10 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct xt_mark_tginfo2 {
7 __u32 mark, mask;
8};
9
6struct xt_mark_mtinfo1 { 10struct xt_mark_mtinfo1 {
7 __u32 mark, mask; 11 __u32 mark, mask;
8 __u8 invert; 12 __u8 invert;
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
index d2c276609925..83318e01425e 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/linux/netfilter/xt_recent.h
@@ -9,6 +9,7 @@ enum {
9 XT_RECENT_UPDATE = 1 << 2, 9 XT_RECENT_UPDATE = 1 << 2,
10 XT_RECENT_REMOVE = 1 << 3, 10 XT_RECENT_REMOVE = 1 << 3,
11 XT_RECENT_TTL = 1 << 4, 11 XT_RECENT_TTL = 1 << 4,
12 XT_RECENT_REAP = 1 << 5,
12 13
13 XT_RECENT_SOURCE = 0, 14 XT_RECENT_SOURCE = 0,
14 XT_RECENT_DEST = 1, 15 XT_RECENT_DEST = 1,
@@ -16,6 +17,12 @@ enum {
16 XT_RECENT_NAME_LEN = 200, 17 XT_RECENT_NAME_LEN = 200,
17}; 18};
18 19
20/* Only allowed with --rcheck and --update */
21#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
22
23#define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\
24 XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP)
25
19struct xt_recent_mtinfo { 26struct xt_recent_mtinfo {
20 __u32 seconds; 27 __u32 seconds;
21 __u32 hit_count; 28 __u32 hit_count;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index f2336523a9df..e9948c0560f6 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -211,9 +211,11 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
211 return (void *)e + e->target_offset; 211 return (void *)e + e->target_offset;
212} 212}
213 213
214#ifndef __KERNEL__
214/* fn returns 0 to continue iteration */ 215/* fn returns 0 to continue iteration */
215#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ 216#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
216 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) 217 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
218#endif
217 219
218/* 220/*
219 * Main firewall chains definitions and global var's definitions. 221 * Main firewall chains definitions and global var's definitions.
@@ -258,6 +260,7 @@ struct arpt_error {
258 .target.errorname = "ERROR", \ 260 .target.errorname = "ERROR", \
259} 261}
260 262
263extern void *arpt_alloc_initial_table(const struct xt_table *);
261extern struct xt_table *arpt_register_table(struct net *net, 264extern struct xt_table *arpt_register_table(struct net *net,
262 const struct xt_table *table, 265 const struct xt_table *table,
263 const struct arpt_replace *repl); 266 const struct arpt_replace *repl);
@@ -290,14 +293,6 @@ compat_arpt_get_target(struct compat_arpt_entry *e)
290 293
291#define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s) 294#define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s)
292 295
293/* fn returns 0 to continue iteration */
294#define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
295 XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args)
296
297#define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
298 XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \
299 fn, ## args)
300
301#endif /* CONFIG_COMPAT */ 296#endif /* CONFIG_COMPAT */
302#endif /*__KERNEL__*/ 297#endif /*__KERNEL__*/
303#endif /* _ARPTABLES_H */ 298#endif /* _ARPTABLES_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index f8105e54716a..0ddd161f3b06 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -41,10 +41,10 @@ enum nf_br_hook_priorities {
41 41
42#define BRNF_PKT_TYPE 0x01 42#define BRNF_PKT_TYPE 0x01
43#define BRNF_BRIDGED_DNAT 0x02 43#define BRNF_BRIDGED_DNAT 0x02
44#define BRNF_DONT_TAKE_PARENT 0x04 44#define BRNF_BRIDGED 0x04
45#define BRNF_BRIDGED 0x08 45#define BRNF_NF_BRIDGE_PREROUTING 0x08
46#define BRNF_NF_BRIDGE_PREROUTING 0x10 46#define BRNF_8021Q 0x10
47 47#define BRNF_PPPoE 0x20
48 48
49/* Only used in br_forward.c */ 49/* Only used in br_forward.c */
50extern int nf_bridge_copy_header(struct sk_buff *skb); 50extern int nf_bridge_copy_header(struct sk_buff *skb);
@@ -68,6 +68,27 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
68 } 68 }
69} 69}
70 70
71static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
72{
73 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
74 return PPPOE_SES_HLEN;
75 return 0;
76}
77
78extern int br_handle_frame_finish(struct sk_buff *skb);
79/* Only used in br_device.c */
80static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
81{
82 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
83
84 skb_pull(skb, ETH_HLEN);
85 nf_bridge->mask ^= BRNF_BRIDGED_DNAT;
86 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
87 skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
88 skb->dev = nf_bridge->physindev;
89 return br_handle_frame_finish(skb);
90}
91
71/* This is called by the IP fragmenting code and it ensures there is 92/* This is called by the IP fragmenting code and it ensures there is
72 * enough room for the encapsulating header (if there is one). */ 93 * enough room for the encapsulating header (if there is one). */
73static inline unsigned int nf_bridge_pad(const struct sk_buff *skb) 94static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 3cc40c131cc3..1c6f0c5f530e 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -289,7 +289,7 @@ struct ebt_table {
289 ~(__alignof__(struct ebt_replace)-1)) 289 ~(__alignof__(struct ebt_replace)-1))
290extern struct ebt_table *ebt_register_table(struct net *net, 290extern struct ebt_table *ebt_register_table(struct net *net,
291 const struct ebt_table *table); 291 const struct ebt_table *table);
292extern void ebt_unregister_table(struct ebt_table *table); 292extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
293extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 293extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
294 const struct net_device *in, const struct net_device *out, 294 const struct net_device *in, const struct net_device *out,
295 struct ebt_table *table); 295 struct ebt_table *table);
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 27b3f5807305..704a7b6e8169 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -223,6 +223,7 @@ ipt_get_target(struct ipt_entry *e)
223 return (void *)e + e->target_offset; 223 return (void *)e + e->target_offset;
224} 224}
225 225
226#ifndef __KERNEL__
226/* fn returns 0 to continue iteration */ 227/* fn returns 0 to continue iteration */
227#define IPT_MATCH_ITERATE(e, fn, args...) \ 228#define IPT_MATCH_ITERATE(e, fn, args...) \
228 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) 229 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
@@ -230,6 +231,7 @@ ipt_get_target(struct ipt_entry *e)
230/* fn returns 0 to continue iteration */ 231/* fn returns 0 to continue iteration */
231#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ 232#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
232 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) 233 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
234#endif
233 235
234/* 236/*
235 * Main firewall chains definitions and global var's definitions. 237 * Main firewall chains definitions and global var's definitions.
@@ -242,7 +244,7 @@ extern void ipt_init(void) __init;
242extern struct xt_table *ipt_register_table(struct net *net, 244extern struct xt_table *ipt_register_table(struct net *net,
243 const struct xt_table *table, 245 const struct xt_table *table,
244 const struct ipt_replace *repl); 246 const struct ipt_replace *repl);
245extern void ipt_unregister_table(struct xt_table *table); 247extern void ipt_unregister_table(struct net *net, struct xt_table *table);
246 248
247/* Standard entry. */ 249/* Standard entry. */
248struct ipt_standard { 250struct ipt_standard {
@@ -282,6 +284,7 @@ struct ipt_error {
282 .target.errorname = "ERROR", \ 284 .target.errorname = "ERROR", \
283} 285}
284 286
287extern void *ipt_alloc_initial_table(const struct xt_table *);
285extern unsigned int ipt_do_table(struct sk_buff *skb, 288extern unsigned int ipt_do_table(struct sk_buff *skb,
286 unsigned int hook, 289 unsigned int hook,
287 const struct net_device *in, 290 const struct net_device *in,
@@ -312,19 +315,6 @@ compat_ipt_get_target(struct compat_ipt_entry *e)
312 315
313#define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) 316#define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s)
314 317
315/* fn returns 0 to continue iteration */
316#define COMPAT_IPT_MATCH_ITERATE(e, fn, args...) \
317 XT_MATCH_ITERATE(struct compat_ipt_entry, e, fn, ## args)
318
319/* fn returns 0 to continue iteration */
320#define COMPAT_IPT_ENTRY_ITERATE(entries, size, fn, args...) \
321 XT_ENTRY_ITERATE(struct compat_ipt_entry, entries, size, fn, ## args)
322
323/* fn returns 0 to continue iteration */
324#define COMPAT_IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
325 XT_ENTRY_ITERATE_CONTINUE(struct compat_ipt_entry, entries, size, n, \
326 fn, ## args)
327
328#endif /* CONFIG_COMPAT */ 318#endif /* CONFIG_COMPAT */
329#endif /*__KERNEL__*/ 319#endif /*__KERNEL__*/
330#endif /* _IPTABLES_H */ 320#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index d654873aa25a..1f7e300094cd 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -59,6 +59,7 @@
59enum nf_ip6_hook_priorities { 59enum nf_ip6_hook_priorities {
60 NF_IP6_PRI_FIRST = INT_MIN, 60 NF_IP6_PRI_FIRST = INT_MIN,
61 NF_IP6_PRI_CONNTRACK_DEFRAG = -400, 61 NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
62 NF_IP6_PRI_RAW = -300,
62 NF_IP6_PRI_SELINUX_FIRST = -225, 63 NF_IP6_PRI_SELINUX_FIRST = -225,
63 NF_IP6_PRI_CONNTRACK = -200, 64 NF_IP6_PRI_CONNTRACK = -200,
64 NF_IP6_PRI_MANGLE = -150, 65 NF_IP6_PRI_MANGLE = -150,
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index b31050d20ae4..18442ff19c07 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -280,6 +280,7 @@ ip6t_get_target(struct ip6t_entry *e)
280 return (void *)e + e->target_offset; 280 return (void *)e + e->target_offset;
281} 281}
282 282
283#ifndef __KERNEL__
283/* fn returns 0 to continue iteration */ 284/* fn returns 0 to continue iteration */
284#define IP6T_MATCH_ITERATE(e, fn, args...) \ 285#define IP6T_MATCH_ITERATE(e, fn, args...) \
285 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) 286 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
@@ -287,6 +288,7 @@ ip6t_get_target(struct ip6t_entry *e)
287/* fn returns 0 to continue iteration */ 288/* fn returns 0 to continue iteration */
288#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ 289#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
289 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) 290 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
291#endif
290 292
291/* 293/*
292 * Main firewall chains definitions and global var's definitions. 294 * Main firewall chains definitions and global var's definitions.
@@ -297,10 +299,11 @@ ip6t_get_target(struct ip6t_entry *e)
297#include <linux/init.h> 299#include <linux/init.h>
298extern void ip6t_init(void) __init; 300extern void ip6t_init(void) __init;
299 301
302extern void *ip6t_alloc_initial_table(const struct xt_table *);
300extern struct xt_table *ip6t_register_table(struct net *net, 303extern struct xt_table *ip6t_register_table(struct net *net,
301 const struct xt_table *table, 304 const struct xt_table *table,
302 const struct ip6t_replace *repl); 305 const struct ip6t_replace *repl);
303extern void ip6t_unregister_table(struct xt_table *table); 306extern void ip6t_unregister_table(struct net *net, struct xt_table *table);
304extern unsigned int ip6t_do_table(struct sk_buff *skb, 307extern unsigned int ip6t_do_table(struct sk_buff *skb,
305 unsigned int hook, 308 unsigned int hook,
306 const struct net_device *in, 309 const struct net_device *in,
@@ -313,10 +316,6 @@ extern int ip6t_ext_hdr(u8 nexthdr);
313extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 316extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
314 int target, unsigned short *fragoff); 317 int target, unsigned short *fragoff);
315 318
316extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
317 const struct in6_addr *mask,
318 const struct in6_addr *addr2);
319
320#define IP6T_ALIGN(s) XT_ALIGN(s) 319#define IP6T_ALIGN(s) XT_ALIGN(s)
321 320
322#ifdef CONFIG_COMPAT 321#ifdef CONFIG_COMPAT
@@ -340,18 +339,6 @@ compat_ip6t_get_target(struct compat_ip6t_entry *e)
340 339
341#define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s) 340#define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s)
342 341
343/* fn returns 0 to continue iteration */
344#define COMPAT_IP6T_MATCH_ITERATE(e, fn, args...) \
345 XT_MATCH_ITERATE(struct compat_ip6t_entry, e, fn, ## args)
346
347/* fn returns 0 to continue iteration */
348#define COMPAT_IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
349 XT_ENTRY_ITERATE(struct compat_ip6t_entry, entries, size, fn, ## args)
350
351#define COMPAT_IP6T_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
352 XT_ENTRY_ITERATE_CONTINUE(struct compat_ip6t_entry, entries, size, n, \
353 fn, ## args)
354
355#endif /* CONFIG_COMPAT */ 342#endif /* CONFIG_COMPAT */
356#endif /*__KERNEL__*/ 343#endif /*__KERNEL__*/
357#endif /* _IP6_TABLES_H */ 344#endif /* _IP6_TABLES_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index fde27c017326..59d066936ab9 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -188,7 +188,11 @@ extern int netlink_has_listeners(struct sock *sk, unsigned int group);
188extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 188extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
189extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 189extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
190 __u32 group, gfp_t allocation); 190 __u32 group, gfp_t allocation);
191extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 191extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
192 __u32 pid, __u32 group, gfp_t allocation,
193 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
194 void *filter_data);
195extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
192extern int netlink_register_notifier(struct notifier_block *nb); 196extern int netlink_register_notifier(struct notifier_block *nb);
193extern int netlink_unregister_notifier(struct notifier_block *nb); 197extern int netlink_unregister_notifier(struct notifier_block *nb);
194 198
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 2524267210d3..e9e231215865 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -14,6 +14,7 @@
14 14
15struct netpoll { 15struct netpoll {
16 struct net_device *dev; 16 struct net_device *dev;
17 struct net_device *real_dev;
17 char dev_name[IFNAMSIZ]; 18 char dev_name[IFNAMSIZ];
18 const char *name; 19 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 20 void (*rx_hook)(struct netpoll *, int, char *, int);
@@ -21,18 +22,26 @@ struct netpoll {
21 __be32 local_ip, remote_ip; 22 __be32 local_ip, remote_ip;
22 u16 local_port, remote_port; 23 u16 local_port, remote_port;
23 u8 remote_mac[ETH_ALEN]; 24 u8 remote_mac[ETH_ALEN];
25
26 struct list_head rx; /* rx_np list element */
24}; 27};
25 28
26struct netpoll_info { 29struct netpoll_info {
27 atomic_t refcnt; 30 atomic_t refcnt;
31
28 int rx_flags; 32 int rx_flags;
29 spinlock_t rx_lock; 33 spinlock_t rx_lock;
30 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 34 struct list_head rx_np; /* netpolls that registered an rx_hook */
35
31 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 36 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
32 struct sk_buff_head txq; 37 struct sk_buff_head txq;
38
33 struct delayed_work tx_work; 39 struct delayed_work tx_work;
40
41 struct netpoll *netpoll;
34}; 42};
35 43
44void netpoll_poll_dev(struct net_device *dev);
36void netpoll_poll(struct netpoll *np); 45void netpoll_poll(struct netpoll *np);
37void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 46void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
38void netpoll_print_options(struct netpoll *np); 47void netpoll_print_options(struct netpoll *np);
@@ -42,22 +51,23 @@ int netpoll_trap(void);
42void netpoll_set_trap(int trap); 51void netpoll_set_trap(int trap);
43void netpoll_cleanup(struct netpoll *np); 52void netpoll_cleanup(struct netpoll *np);
44int __netpoll_rx(struct sk_buff *skb); 53int __netpoll_rx(struct sk_buff *skb);
54void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
45 55
46 56
47#ifdef CONFIG_NETPOLL 57#ifdef CONFIG_NETPOLL
48static inline int netpoll_rx(struct sk_buff *skb) 58static inline bool netpoll_rx(struct sk_buff *skb)
49{ 59{
50 struct netpoll_info *npinfo = skb->dev->npinfo; 60 struct netpoll_info *npinfo = skb->dev->npinfo;
51 unsigned long flags; 61 unsigned long flags;
52 int ret = 0; 62 bool ret = false;
53 63
54 if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) 64 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags))
55 return 0; 65 return false;
56 66
57 spin_lock_irqsave(&npinfo->rx_lock, flags); 67 spin_lock_irqsave(&npinfo->rx_lock, flags);
58 /* check rx_flags again with the lock held */ 68 /* check rx_flags again with the lock held */
59 if (npinfo->rx_flags && __netpoll_rx(skb)) 69 if (npinfo->rx_flags && __netpoll_rx(skb))
60 ret = 1; 70 ret = true;
61 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 71 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
62 72
63 return ret; 73 return ret;
@@ -67,7 +77,7 @@ static inline int netpoll_rx_on(struct sk_buff *skb)
67{ 77{
68 struct netpoll_info *npinfo = skb->dev->npinfo; 78 struct netpoll_info *npinfo = skb->dev->npinfo;
69 79
70 return npinfo && (npinfo->rx_np || npinfo->rx_flags); 80 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
71} 81}
72 82
73static inline int netpoll_receive_skb(struct sk_buff *skb) 83static inline int netpoll_receive_skb(struct sk_buff *skb)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index d09db1bc9083..bad4d121b16e 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -33,9 +33,6 @@
33#define FLUSH_STABLE 4 /* commit to stable storage */ 33#define FLUSH_STABLE 4 /* commit to stable storage */
34#define FLUSH_LOWPRI 8 /* low priority background flush */ 34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
37#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */
38#define FLUSH_NOWRITEPAGE 128 /* Don't call writepage() */
39 36
40#ifdef __KERNEL__ 37#ifdef __KERNEL__
41 38
@@ -166,6 +163,7 @@ struct nfs_inode {
166 struct radix_tree_root nfs_page_tree; 163 struct radix_tree_root nfs_page_tree;
167 164
168 unsigned long npages; 165 unsigned long npages;
166 unsigned long ncommit;
169 167
170 /* Open contexts for shared mmap writes */ 168 /* Open contexts for shared mmap writes */
171 struct list_head open_files; 169 struct list_head open_files;
@@ -211,6 +209,7 @@ struct nfs_inode {
211#define NFS_INO_FLUSHING (4) /* inode is flushing out data */ 209#define NFS_INO_FLUSHING (4) /* inode is flushing out data */
212#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 210#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
213#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 211#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
212#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
214 213
215static inline struct nfs_inode *NFS_I(const struct inode *inode) 214static inline struct nfs_inode *NFS_I(const struct inode *inode)
216{ 215{
@@ -349,7 +348,6 @@ extern int nfs_attribute_timeout(struct inode *inode);
349extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 348extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
350extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 349extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
351extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 350extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
352extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
353extern int nfs_setattr(struct dentry *, struct iattr *); 351extern int nfs_setattr(struct dentry *, struct iattr *);
354extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 352extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
355extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 353extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
@@ -358,6 +356,20 @@ extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struc
358extern u64 nfs_compat_user_ino64(u64 fileid); 356extern u64 nfs_compat_user_ino64(u64 fileid);
359extern void nfs_fattr_init(struct nfs_fattr *fattr); 357extern void nfs_fattr_init(struct nfs_fattr *fattr);
360 358
359extern struct nfs_fattr *nfs_alloc_fattr(void);
360
361static inline void nfs_free_fattr(const struct nfs_fattr *fattr)
362{
363 kfree(fattr);
364}
365
366extern struct nfs_fh *nfs_alloc_fhandle(void);
367
368static inline void nfs_free_fhandle(const struct nfs_fh *fh)
369{
370 kfree(fh);
371}
372
361/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 373/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
362extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 374extern __be32 root_nfs_parse_addr(char *name); /*__init*/
363extern unsigned long nfs_inc_attr_generation_counter(void); 375extern unsigned long nfs_inc_attr_generation_counter(void);
@@ -477,9 +489,7 @@ extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
477 * Try to write back everything synchronously (but check the 489 * Try to write back everything synchronously (but check the
478 * return value!) 490 * return value!)
479 */ 491 */
480extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int);
481extern int nfs_wb_all(struct inode *inode); 492extern int nfs_wb_all(struct inode *inode);
482extern int nfs_wb_nocommit(struct inode *inode);
483extern int nfs_wb_page(struct inode *inode, struct page* page); 493extern int nfs_wb_page(struct inode *inode, struct page* page);
484extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 494extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
485#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 495#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 34fc6be5bfcf..d6e10a4c06e5 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -44,7 +44,6 @@ struct nfs_client {
44 44
45#ifdef CONFIG_NFS_V4 45#ifdef CONFIG_NFS_V4
46 u64 cl_clientid; /* constant */ 46 u64 cl_clientid; /* constant */
47 nfs4_verifier cl_confirm;
48 unsigned long cl_state; 47 unsigned long cl_state;
49 48
50 struct rb_root cl_openowner_id; 49 struct rb_root cl_openowner_id;
@@ -105,7 +104,7 @@ struct nfs_server {
105 struct rpc_clnt * client; /* RPC client handle */ 104 struct rpc_clnt * client; /* RPC client handle */
106 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 105 struct rpc_clnt * client_acl; /* ACL RPC client handle */
107 struct nlm_host *nlm_host; /* NLM client handle */ 106 struct nlm_host *nlm_host; /* NLM client handle */
108 struct nfs_iostats * io_stats; /* I/O statistics */ 107 struct nfs_iostats __percpu *io_stats; /* I/O statistics */
109 struct backing_dev_info backing_dev_info; 108 struct backing_dev_info backing_dev_info;
110 atomic_long_t writeback; /* number of writeback pages */ 109 atomic_long_t writeback; /* number of writeback pages */
111 int flags; /* various flags */ 110 int flags; /* various flags */
@@ -176,6 +175,7 @@ struct nfs_server {
176#define NFS_CAP_ATIME (1U << 11) 175#define NFS_CAP_ATIME (1U << 11)
177#define NFS_CAP_CTIME (1U << 12) 176#define NFS_CAP_CTIME (1U << 12)
178#define NFS_CAP_MTIME (1U << 13) 177#define NFS_CAP_MTIME (1U << 13)
178#define NFS_CAP_POSIX_LOCK (1U << 14)
179 179
180 180
181/* maximum number of slots to use */ 181/* maximum number of slots to use */
@@ -193,6 +193,8 @@ struct nfs4_slot_table {
193 int max_slots; /* # slots in table */ 193 int max_slots; /* # slots in table */
194 int highest_used_slotid; /* sent to server on each SEQ. 194 int highest_used_slotid; /* sent to server on each SEQ.
195 * op for dynamic resizing */ 195 * op for dynamic resizing */
196 int target_max_slots; /* Set by CB_RECALL_SLOT as
197 * the new max_slots */
196}; 198};
197 199
198static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp) 200static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp)
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 89b28812ec24..51914d7d6cc4 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -386,8 +386,8 @@ struct nfs_removeargs {
386 386
387struct nfs_removeres { 387struct nfs_removeres {
388 const struct nfs_server *server; 388 const struct nfs_server *server;
389 struct nfs_fattr *dir_attr;
389 struct nfs4_change_info cinfo; 390 struct nfs4_change_info cinfo;
390 struct nfs_fattr dir_attr;
391 struct nfs4_sequence_res seq_res; 391 struct nfs4_sequence_res seq_res;
392}; 392};
393 393
@@ -824,6 +824,11 @@ struct nfs4_setclientid {
824 u32 sc_cb_ident; 824 u32 sc_cb_ident;
825}; 825};
826 826
827struct nfs4_setclientid_res {
828 u64 clientid;
829 nfs4_verifier confirm;
830};
831
827struct nfs4_statfs_arg { 832struct nfs4_statfs_arg {
828 const struct nfs_fh * fh; 833 const struct nfs_fh * fh;
829 const u32 * bitmask; 834 const u32 * bitmask;
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 65e333afaee4..80d55bbc5365 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -40,12 +40,12 @@ struct nfs_fhbase_old {
40 * This is the new flexible, extensible style NFSv2/v3 file handle. 40 * This is the new flexible, extensible style NFSv2/v3 file handle.
41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000 41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
42 * 42 *
43 * The file handle is seens as a list of 4byte words. 43 * The file handle starts with a sequence of four-byte words.
44 * The first word contains a version number (1) and four descriptor bytes 44 * The first word contains a version number (1) and three descriptor bytes
45 * that tell how the remaining 3 variable length fields should be handled. 45 * that tell how the remaining 3 variable length fields should be handled.
46 * These three bytes are auth_type, fsid_type and fileid_type. 46 * These three bytes are auth_type, fsid_type and fileid_type.
47 * 47 *
48 * All 4byte values are in host-byte-order. 48 * All four-byte values are in host-byte-order.
49 * 49 *
50 * The auth_type field specifies how the filehandle can be authenticated 50 * The auth_type field specifies how the filehandle can be authenticated
51 * This might allow a file to be confirmed to be in a writable part of a 51 * This might allow a file to be confirmed to be in a writable part of a
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 3fe02cf8b65a..8c2c6116e788 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -153,6 +153,7 @@ struct nilfs_super_root {
153 semantics also for data */ 153 semantics also for data */
154#define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during 154#define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during
155 mount-time recovery */ 155 mount-time recovery */
156#define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */
156 157
157 158
158/** 159/**
@@ -198,16 +199,15 @@ struct nilfs_super_block {
198 __le32 s_creator_os; /* OS */ 199 __le32 s_creator_os; /* OS */
199 __le16 s_def_resuid; /* Default uid for reserved blocks */ 200 __le16 s_def_resuid; /* Default uid for reserved blocks */
200 __le16 s_def_resgid; /* Default gid for reserved blocks */ 201 __le16 s_def_resgid; /* Default gid for reserved blocks */
201 __le32 s_first_ino; /* First non-reserved inode */ 202 __le32 s_first_ino; /* First non-reserved inode */
202 203
203 __le16 s_inode_size; /* Size of an inode */ 204 __le16 s_inode_size; /* Size of an inode */
204 __le16 s_dat_entry_size; /* Size of a dat entry */ 205 __le16 s_dat_entry_size; /* Size of a dat entry */
205 __le16 s_checkpoint_size; /* Size of a checkpoint */ 206 __le16 s_checkpoint_size; /* Size of a checkpoint */
206 __le16 s_segment_usage_size; /* Size of a segment usage */ 207 __le16 s_segment_usage_size; /* Size of a segment usage */
207 208
208 __u8 s_uuid[16]; /* 128-bit uuid for volume */ 209 __u8 s_uuid[16]; /* 128-bit uuid for volume */
209 char s_volume_name[16]; /* volume name */ 210 char s_volume_name[80]; /* volume name */
210 char s_last_mounted[64]; /* directory where last mounted */
211 211
212 __le32 s_c_interval; /* Commit interval of segment */ 212 __le32 s_c_interval; /* Commit interval of segment */
213 __le32 s_c_block_max; /* Threshold of data amount for 213 __le32 s_c_block_max; /* Threshold of data amount for
@@ -376,6 +376,7 @@ union nilfs_binfo {
376 * @ss_nfinfo: number of finfo structures 376 * @ss_nfinfo: number of finfo structures
377 * @ss_sumbytes: total size of segment summary in bytes 377 * @ss_sumbytes: total size of segment summary in bytes
378 * @ss_pad: padding 378 * @ss_pad: padding
379 * @ss_cno: checkpoint number
379 */ 380 */
380struct nilfs_segment_summary { 381struct nilfs_segment_summary {
381 __le32 ss_datasum; 382 __le32 ss_datasum;
@@ -390,6 +391,7 @@ struct nilfs_segment_summary {
390 __le32 ss_nfinfo; 391 __le32 ss_nfinfo;
391 __le32 ss_sumbytes; 392 __le32 ss_sumbytes;
392 __le32 ss_pad; 393 __le32 ss_pad;
394 __le64 ss_cno;
393 /* array of finfo structures */ 395 /* array of finfo structures */
394}; 396};
395 397
@@ -436,10 +438,10 @@ struct nilfs_palloc_group_desc {
436 438
437/** 439/**
438 * struct nilfs_dat_entry - disk address translation entry 440 * struct nilfs_dat_entry - disk address translation entry
439 * @dt_blocknr: block number 441 * @de_blocknr: block number
440 * @dt_start: start checkpoint number 442 * @de_start: start checkpoint number
441 * @dt_end: end checkpoint number 443 * @de_end: end checkpoint number
442 * @dt_rsv: reserved for future use 444 * @de_rsv: reserved for future use
443 */ 445 */
444struct nilfs_dat_entry { 446struct nilfs_dat_entry {
445 __le64 de_blocknr; 447 __le64 de_blocknr;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index da8ea2e19273..b7c77f9712f4 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * 802.11 netlink interface public header 4 * 802.11 netlink interface public header
5 * 5 *
6 * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net> 7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> 8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de> 9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
@@ -52,6 +52,8 @@
52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, 52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, 53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. 54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
55 * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
56 * instead, the support here is for backward compatibility only.
55 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 57 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
56 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 58 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
57 * %NL80211_ATTR_WIPHY_NAME. 59 * %NL80211_ATTR_WIPHY_NAME.
@@ -270,6 +272,75 @@
270 * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices 272 * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
271 * associated with this wiphy must be down and will follow. 273 * associated with this wiphy must be down and will follow.
272 * 274 *
275 * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified
276 * channel for the specified amount of time. This can be used to do
277 * off-channel operations like transmit a Public Action frame and wait for
278 * a response while being associated to an AP on another channel.
279 * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify which
280 * radio is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
281 * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be
282 * optionally used to specify additional channel parameters.
283 * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds
284 * to remain on the channel. This command is also used as an event to
285 * notify when the requested duration starts (it may take a while for the
286 * driver to schedule this time due to other concurrent needs for the
287 * radio).
288 * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE)
289 * that will be included with any events pertaining to this request;
290 * the cookie is also used to cancel the request.
291 * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a
292 * pending remain-on-channel duration if the desired operation has been
293 * completed prior to expiration of the originally requested duration.
294 * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the
295 * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to
296 * uniquely identify the request.
297 * This command is also used as an event to notify when a requested
298 * remain-on-channel duration has expired.
299 *
300 * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX
301 * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface
302 * and @NL80211_ATTR_TX_RATES the set of allowed rates.
303 *
304 * @NL80211_CMD_REGISTER_ACTION: Register for receiving certain action frames
305 * (via @NL80211_CMD_ACTION) for processing in userspace. This command
306 * requires an interface index and a match attribute containing the first
307 * few bytes of the frame that should match, e.g. a single byte for only
308 * a category match or four bytes for vendor frames including the OUI.
309 * The registration cannot be dropped, but is removed automatically
310 * when the netlink socket is closed. Multiple registrations can be made.
311 * @NL80211_CMD_ACTION: Action frame TX request and RX notification. This
312 * command is used both as a request to transmit an Action frame and as an
313 * event indicating reception of an Action frame that was not processed in
314 * kernel code, but is for us (i.e., which may need to be processed in a
315 * user space application). %NL80211_ATTR_FRAME is used to specify the
316 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and
317 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on
318 * which channel the frame is to be transmitted or was received. This
319 * channel has to be the current channel (remain-on-channel or the
320 * operational channel). When called, this operation returns a cookie
321 * (%NL80211_ATTR_COOKIE) that will be included with the TX status event
322 * pertaining to the TX request.
323 * @NL80211_CMD_ACTION_TX_STATUS: Report TX status of an Action frame
324 * transmitted with %NL80211_CMD_ACTION. %NL80211_ATTR_COOKIE identifies
325 * the TX command and %NL80211_ATTR_FRAME includes the contents of the
326 * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
327 * the frame.
328 * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command
329 * is used to configure connection quality monitoring notification trigger
330 * levels.
331 * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
332 * command is used as an event to indicate the that a trigger level was
333 * reached.
334 * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
335 * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed
336 * by %NL80211_ATTR_IFINDEX) shall operate on.
337 * In case multiple channels are supported by the device, the mechanism
338 * with which it switches channels is implementation-defined.
339 * When a monitor interface is given, it can only switch channel while
340 * no other interfaces are operating to avoid disturbing the operation
341 * of any other interfaces, and other interfaces will again take
342 * precedence when they are used.
343 *
273 * @NL80211_CMD_MAX: highest used command number 344 * @NL80211_CMD_MAX: highest used command number
274 * @__NL80211_CMD_AFTER_LAST: internal use 345 * @__NL80211_CMD_AFTER_LAST: internal use
275 */ 346 */
@@ -353,6 +424,23 @@ enum nl80211_commands {
353 NL80211_CMD_DEL_PMKSA, 424 NL80211_CMD_DEL_PMKSA,
354 NL80211_CMD_FLUSH_PMKSA, 425 NL80211_CMD_FLUSH_PMKSA,
355 426
427 NL80211_CMD_REMAIN_ON_CHANNEL,
428 NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
429
430 NL80211_CMD_SET_TX_BITRATE_MASK,
431
432 NL80211_CMD_REGISTER_ACTION,
433 NL80211_CMD_ACTION,
434 NL80211_CMD_ACTION_TX_STATUS,
435
436 NL80211_CMD_SET_POWER_SAVE,
437 NL80211_CMD_GET_POWER_SAVE,
438
439 NL80211_CMD_SET_CQM,
440 NL80211_CMD_NOTIFY_CQM,
441
442 NL80211_CMD_SET_CHANNEL,
443
356 /* add new commands above here */ 444 /* add new commands above here */
357 445
358 /* used to define NL80211_CMD_MAX below */ 446 /* used to define NL80211_CMD_MAX below */
@@ -402,6 +490,8 @@ enum nl80211_commands {
402 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length 490 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
403 * larger than or equal to this use RTS/CTS handshake); allowed range: 491 * larger than or equal to this use RTS/CTS handshake); allowed range:
404 * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 492 * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32
493 * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11
494 * section 7.3.2.9; dot11CoverageClass; u8
405 * 495 *
406 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 496 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
407 * @NL80211_ATTR_IFNAME: network interface name 497 * @NL80211_ATTR_IFNAME: network interface name
@@ -606,6 +696,35 @@ enum nl80211_commands {
606 * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can 696 * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can
607 * cache, a wiphy attribute. 697 * cache, a wiphy attribute.
608 * 698 *
699 * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32.
700 *
701 * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects.
702 *
703 * @NL80211_ATTR_TX_RATES: Nested set of attributes
704 * (enum nl80211_tx_rate_attributes) describing TX rates per band. The
705 * enum nl80211_band value is used as the index (nla_type() of the nested
706 * data. If a band is not included, it will be configured to allow all
707 * rates based on negotiated supported rates information. This attribute
708 * is used with %NL80211_CMD_SET_TX_BITRATE_MASK.
709 *
710 * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain
711 * at least one byte, currently used with @NL80211_CMD_REGISTER_ACTION.
712 *
713 * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was
714 * acknowledged by the recipient.
715 *
716 * @NL80211_ATTR_CQM: connection quality monitor configuration in a
717 * nested attribute with %NL80211_ATTR_CQM_* sub-attributes.
718 *
719 * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command
720 * is requesting a local authentication/association state change without
721 * invoking actual management frame exchange. This can be used with
722 * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE,
723 * NL80211_CMD_DISASSOCIATE.
724 *
725 * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
726 * connected to this BSS.
727 *
609 * @NL80211_ATTR_MAX: highest attribute number currently defined 728 * @NL80211_ATTR_MAX: highest attribute number currently defined
610 * @__NL80211_ATTR_AFTER_LAST: internal use 729 * @__NL80211_ATTR_AFTER_LAST: internal use
611 */ 730 */
@@ -743,6 +862,26 @@ enum nl80211_attrs {
743 NL80211_ATTR_PMKID, 862 NL80211_ATTR_PMKID,
744 NL80211_ATTR_MAX_NUM_PMKIDS, 863 NL80211_ATTR_MAX_NUM_PMKIDS,
745 864
865 NL80211_ATTR_DURATION,
866
867 NL80211_ATTR_COOKIE,
868
869 NL80211_ATTR_WIPHY_COVERAGE_CLASS,
870
871 NL80211_ATTR_TX_RATES,
872
873 NL80211_ATTR_FRAME_MATCH,
874
875 NL80211_ATTR_ACK,
876
877 NL80211_ATTR_PS_STATE,
878
879 NL80211_ATTR_CQM,
880
881 NL80211_ATTR_LOCAL_STATE_CHANGE,
882
883 NL80211_ATTR_AP_ISOLATE,
884
746 /* add attributes here, update the policy in nl80211.c */ 885 /* add attributes here, update the policy in nl80211.c */
747 886
748 __NL80211_ATTR_AFTER_LAST, 887 __NL80211_ATTR_AFTER_LAST,
@@ -1323,13 +1462,20 @@ enum nl80211_channel_type {
1323 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) 1462 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
1324 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) 1463 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
1325 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the 1464 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
1326 * raw information elements from the probe response/beacon (bin) 1465 * raw information elements from the probe response/beacon (bin);
1466 * if the %NL80211_BSS_BEACON_IES attribute is present, the IEs here are
1467 * from a Probe Response frame; otherwise they are from a Beacon frame.
1468 * However, if the driver does not indicate the source of the IEs, these
1469 * IEs may be from either frame subtype.
1327 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon 1470 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
1328 * in mBm (100 * dBm) (s32) 1471 * in mBm (100 * dBm) (s32)
1329 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon 1472 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
1330 * in unspecified units, scaled to 0..100 (u8) 1473 * in unspecified units, scaled to 0..100 (u8)
1331 * @NL80211_BSS_STATUS: status, if this BSS is "used" 1474 * @NL80211_BSS_STATUS: status, if this BSS is "used"
1332 * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms 1475 * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
1476 * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information
1477 * elements from a Beacon frame (bin); not present if no Beacon frame has
1478 * yet been received
1333 * @__NL80211_BSS_AFTER_LAST: internal 1479 * @__NL80211_BSS_AFTER_LAST: internal
1334 * @NL80211_BSS_MAX: highest BSS attribute 1480 * @NL80211_BSS_MAX: highest BSS attribute
1335 */ 1481 */
@@ -1345,6 +1491,7 @@ enum nl80211_bss {
1345 NL80211_BSS_SIGNAL_UNSPEC, 1491 NL80211_BSS_SIGNAL_UNSPEC,
1346 NL80211_BSS_STATUS, 1492 NL80211_BSS_STATUS,
1347 NL80211_BSS_SEEN_MS_AGO, 1493 NL80211_BSS_SEEN_MS_AGO,
1494 NL80211_BSS_BEACON_IES,
1348 1495
1349 /* keep last */ 1496 /* keep last */
1350 __NL80211_BSS_AFTER_LAST, 1497 __NL80211_BSS_AFTER_LAST,
@@ -1442,4 +1589,74 @@ enum nl80211_key_attributes {
1442 NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 1589 NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
1443}; 1590};
1444 1591
1592/**
1593 * enum nl80211_tx_rate_attributes - TX rate set attributes
1594 * @__NL80211_TXRATE_INVALID: invalid
1595 * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection
1596 * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with
1597 * 1 = 500 kbps) but without the IE length restriction (at most
1598 * %NL80211_MAX_SUPP_RATES in a single array).
1599 * @__NL80211_TXRATE_AFTER_LAST: internal
1600 * @NL80211_TXRATE_MAX: highest TX rate attribute
1601 */
1602enum nl80211_tx_rate_attributes {
1603 __NL80211_TXRATE_INVALID,
1604 NL80211_TXRATE_LEGACY,
1605
1606 /* keep last */
1607 __NL80211_TXRATE_AFTER_LAST,
1608 NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1
1609};
1610
1611/**
1612 * enum nl80211_band - Frequency band
1613 * @NL80211_BAND_2GHZ - 2.4 GHz ISM band
1614 * @NL80211_BAND_5GHZ - around 5 GHz band (4.9 - 5.7 GHz)
1615 */
1616enum nl80211_band {
1617 NL80211_BAND_2GHZ,
1618 NL80211_BAND_5GHZ,
1619};
1620
1621enum nl80211_ps_state {
1622 NL80211_PS_DISABLED,
1623 NL80211_PS_ENABLED,
1624};
1625
1626/**
1627 * enum nl80211_attr_cqm - connection quality monitor attributes
1628 * @__NL80211_ATTR_CQM_INVALID: invalid
1629 * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
1630 * the threshold for the RSSI level at which an event will be sent. Zero
1631 * to disable.
1632 * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
1633 * the minimum amount the RSSI level must change after an event before a
1634 * new event may be issued (to reduce effects of RSSI oscillation).
1635 * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
1636 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
1637 * @NL80211_ATTR_CQM_MAX: highest key attribute
1638 */
1639enum nl80211_attr_cqm {
1640 __NL80211_ATTR_CQM_INVALID,
1641 NL80211_ATTR_CQM_RSSI_THOLD,
1642 NL80211_ATTR_CQM_RSSI_HYST,
1643 NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
1644
1645 /* keep last */
1646 __NL80211_ATTR_CQM_AFTER_LAST,
1647 NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1
1648};
1649
1650/**
1651 * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event
1652 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW - The RSSI level is lower than the
1653 * configured threshold
1654 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH - The RSSI is higher than the
1655 * configured threshold
1656 */
1657enum nl80211_cqm_rssi_threshold_event {
1658 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
1659 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
1660};
1661
1445#endif /* __LINUX_NL80211_H */ 1662#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 454997cccbd8..dba35e413371 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -69,8 +69,6 @@
69 * int node_online(node) Is some node online? 69 * int node_online(node) Is some node online?
70 * int node_possible(node) Is some node possible? 70 * int node_possible(node) Is some node possible?
71 * 71 *
72 * int any_online_node(mask) First online node in mask
73 *
74 * node_set_online(node) set bit 'node' in node_online_map 72 * node_set_online(node) set bit 'node' in node_online_map
75 * node_set_offline(node) clear bit 'node' in node_online_map 73 * node_set_offline(node) clear bit 'node' in node_online_map
76 * 74 *
@@ -467,15 +465,6 @@ static inline int num_node_state(enum node_states state)
467#define node_online_map node_states[N_ONLINE] 465#define node_online_map node_states[N_ONLINE]
468#define node_possible_map node_states[N_POSSIBLE] 466#define node_possible_map node_states[N_POSSIBLE]
469 467
470#define any_online_node(mask) \
471({ \
472 int node; \
473 for_each_node_mask(node, (mask)) \
474 if (node_online(node)) \
475 break; \
476 node; \
477})
478
479#define num_online_nodes() num_node_state(N_ONLINE) 468#define num_online_nodes() num_node_state(N_ONLINE)
480#define num_possible_nodes() num_node_state(N_POSSIBLE) 469#define num_possible_nodes() num_node_state(N_POSSIBLE)
481#define node_online(node) node_state((node), N_ONLINE) 470#define node_online(node) node_state((node), N_ONLINE)
@@ -494,7 +483,7 @@ static inline int num_node_state(enum node_states state)
494 type *name = kmalloc(sizeof(*name), gfp_flags) 483 type *name = kmalloc(sizeof(*name), gfp_flags)
495#define NODEMASK_FREE(m) kfree(m) 484#define NODEMASK_FREE(m) kfree(m)
496#else 485#else
497#define NODEMASK_ALLOC(type, name, gfp_flags) type _name, *name = &_name 486#define NODEMASK_ALLOC(type, name, gfp_flags) type _##name, *name = &_##name
498#define NODEMASK_FREE(m) do {} while (0) 487#define NODEMASK_FREE(m) do {} while (0)
499#endif 488#endif
500 489
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index fee6c2f68075..540703b555cb 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -164,7 +164,10 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
164/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */ 164/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
165static inline int notifier_from_errno(int err) 165static inline int notifier_from_errno(int err)
166{ 166{
167 return NOTIFY_STOP_MASK | (NOTIFY_OK - err); 167 if (err)
168 return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
169
170 return NOTIFY_OK;
168} 171}
169 172
170/* Restore (negative) errno value from notify return value. */ 173/* Restore (negative) errno value from notify return value. */
@@ -182,7 +185,10 @@ static inline int notifier_to_errno(int ret)
182 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc... 185 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc...
183 */ 186 */
184 187
185/* netdevice notifier chain */ 188/* netdevice notifier chain. Please remember to update the rtnetlink
189 * notification exclusion list in rtnetlink_event() when adding new
190 * types.
191 */
186#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */ 192#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */
187#define NETDEV_DOWN 0x0002 193#define NETDEV_DOWN 0x0002
188#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface 194#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface
@@ -199,10 +205,11 @@ static inline int notifier_to_errno(int ret)
199#define NETDEV_FEAT_CHANGE 0x000B 205#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 206#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D 207#define NETDEV_PRE_UP 0x000D
202#define NETDEV_BONDING_OLDTYPE 0x000E 208#define NETDEV_PRE_TYPE_CHANGE 0x000E
203#define NETDEV_BONDING_NEWTYPE 0x000F 209#define NETDEV_POST_TYPE_CHANGE 0x000F
204#define NETDEV_POST_INIT 0x0010 210#define NETDEV_POST_INIT 0x0010
205#define NETDEV_UNREGISTER_BATCH 0x0011 211#define NETDEV_UNREGISTER_BATCH 0x0011
212#define NETDEV_BONDING_DESLAVE 0x0012
206 213
207#define SYS_DOWN 0x0001 /* Notify of system down */ 214#define SYS_DOWN 0x0001 /* Notify of system down */
208#define SYS_RESTART SYS_DOWN 215#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/of.h b/include/linux/of.h
index e7facd8fbce8..a367e19bb3af 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -19,6 +19,11 @@
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/kref.h> 20#include <linux/kref.h>
21#include <linux/mod_devicetable.h> 21#include <linux/mod_devicetable.h>
22#include <linux/spinlock.h>
23
24#include <asm/byteorder.h>
25
26#ifdef CONFIG_OF
22 27
23typedef u32 phandle; 28typedef u32 phandle;
24typedef u32 ihandle; 29typedef u32 ihandle;
@@ -39,10 +44,7 @@ struct of_irq_controller;
39struct device_node { 44struct device_node {
40 const char *name; 45 const char *name;
41 const char *type; 46 const char *type;
42 phandle node; 47 phandle phandle;
43#if !defined(CONFIG_SPARC)
44 phandle linux_phandle;
45#endif
46 char *full_name; 48 char *full_name;
47 49
48 struct property *properties; 50 struct property *properties;
@@ -63,6 +65,11 @@ struct device_node {
63#endif 65#endif
64}; 66};
65 67
68/* Pointer for first entry in chain of all nodes. */
69extern struct device_node *allnodes;
70extern struct device_node *of_chosen;
71extern rwlock_t devtree_lock;
72
66static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 73static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
67{ 74{
68 return test_bit(flag, &n->_flags); 75 return test_bit(flag, &n->_flags);
@@ -73,12 +80,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
73 set_bit(flag, &n->_flags); 80 set_bit(flag, &n->_flags);
74} 81}
75 82
76static inline void
77set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
78{
79 dn->pde = de;
80}
81
82extern struct device_node *of_find_all_nodes(struct device_node *prev); 83extern struct device_node *of_find_all_nodes(struct device_node *prev);
83 84
84#if defined(CONFIG_SPARC) 85#if defined(CONFIG_SPARC)
@@ -101,26 +102,36 @@ extern void of_node_put(struct device_node *node);
101 */ 102 */
102 103
103/* Helper to read a big number; size is in cells (not bytes) */ 104/* Helper to read a big number; size is in cells (not bytes) */
104static inline u64 of_read_number(const u32 *cell, int size) 105static inline u64 of_read_number(const __be32 *cell, int size)
105{ 106{
106 u64 r = 0; 107 u64 r = 0;
107 while (size--) 108 while (size--)
108 r = (r << 32) | *(cell++); 109 r = (r << 32) | be32_to_cpu(*(cell++));
109 return r; 110 return r;
110} 111}
111 112
112/* Like of_read_number, but we want an unsigned long result */ 113/* Like of_read_number, but we want an unsigned long result */
113#ifdef CONFIG_PPC32 114static inline unsigned long of_read_ulong(const __be32 *cell, int size)
114static inline unsigned long of_read_ulong(const u32 *cell, int size)
115{ 115{
116 return cell[size-1]; 116 /* toss away upper bits if unsigned long is smaller than u64 */
117 return of_read_number(cell, size);
117} 118}
118#else
119#define of_read_ulong(cell, size) of_read_number(cell, size)
120#endif
121 119
122#include <asm/prom.h> 120#include <asm/prom.h>
123 121
122/* Default #address and #size cells. Allow arch asm/prom.h to override */
123#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
124#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
125#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
126#endif
127
128/* Default string compare functions, Allow arch asm/prom.h to override */
129#if !defined(of_compat_cmp)
130#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
131#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
132#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
133#endif
134
124/* flag descriptions */ 135/* flag descriptions */
125#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 136#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
126#define OF_DETACHED 2 /* node has been detached from the device tree */ 137#define OF_DETACHED 2 /* node has been detached from the device tree */
@@ -187,4 +198,19 @@ extern int of_parse_phandles_with_args(struct device_node *np,
187 const char *list_name, const char *cells_name, int index, 198 const char *list_name, const char *cells_name, int index,
188 struct device_node **out_node, const void **out_args); 199 struct device_node **out_node, const void **out_args);
189 200
201extern int of_machine_is_compatible(const char *compat);
202
203extern int prom_add_property(struct device_node* np, struct property* prop);
204extern int prom_remove_property(struct device_node *np, struct property *prop);
205extern int prom_update_property(struct device_node *np,
206 struct property *newprop,
207 struct property *oldprop);
208
209#if defined(CONFIG_OF_DYNAMIC)
210/* For updating the device tree at runtime */
211extern void of_attach_node(struct device_node *);
212extern void of_detach_node(struct device_node *);
213#endif
214
215#endif /* CONFIG_OF */
190#endif /* _LINUX_OF_H */ 216#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index d3a74e00a3e1..11651facc5f1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4#ifdef CONFIG_OF_DEVICE
4#include <linux/device.h> 5#include <linux/device.h>
5#include <linux/of.h> 6#include <linux/of.h>
6#include <linux/mod_devicetable.h> 7#include <linux/mod_devicetable.h>
@@ -10,7 +11,7 @@
10#define to_of_device(d) container_of(d, struct of_device, dev) 11#define to_of_device(d) container_of(d, struct of_device, dev)
11 12
12extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
13 const struct of_device_id *matches, const struct of_device *dev); 14 const struct of_device_id *matches, const struct device *dev);
14 15
15extern struct of_device *of_dev_get(struct of_device *dev); 16extern struct of_device *of_dev_get(struct of_device *dev);
16extern void of_dev_put(struct of_device *dev); 17extern void of_dev_put(struct of_device *dev);
@@ -26,5 +27,6 @@ static inline void of_device_free(struct of_device *dev)
26 27
27extern ssize_t of_device_get_modalias(struct of_device *ofdev, 28extern ssize_t of_device_get_modalias(struct of_device *ofdev,
28 char *str, ssize_t len); 29 char *str, ssize_t len);
30#endif /* CONFIG_OF_DEVICE */
29 31
30#endif /* _LINUX_OF_DEVICE_H */ 32#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 41d432b13553..71e1a916d3fa 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -42,45 +42,66 @@
42 * ends when size is 0 42 * ends when size is 0
43 */ 43 */
44struct boot_param_header { 44struct boot_param_header {
45 u32 magic; /* magic word OF_DT_HEADER */ 45 __be32 magic; /* magic word OF_DT_HEADER */
46 u32 totalsize; /* total size of DT block */ 46 __be32 totalsize; /* total size of DT block */
47 u32 off_dt_struct; /* offset to structure */ 47 __be32 off_dt_struct; /* offset to structure */
48 u32 off_dt_strings; /* offset to strings */ 48 __be32 off_dt_strings; /* offset to strings */
49 u32 off_mem_rsvmap; /* offset to memory reserve map */ 49 __be32 off_mem_rsvmap; /* offset to memory reserve map */
50 u32 version; /* format version */ 50 __be32 version; /* format version */
51 u32 last_comp_version; /* last compatible version */ 51 __be32 last_comp_version; /* last compatible version */
52 /* version 2 fields below */ 52 /* version 2 fields below */
53 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ 53 __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
54 /* version 3 fields below */ 54 /* version 3 fields below */
55 u32 dt_strings_size; /* size of the DT strings block */ 55 __be32 dt_strings_size; /* size of the DT strings block */
56 /* version 17 fields below */ 56 /* version 17 fields below */
57 u32 dt_struct_size; /* size of the DT structure block */ 57 __be32 dt_struct_size; /* size of the DT structure block */
58}; 58};
59 59
60#if defined(CONFIG_OF_FLATTREE)
61/* TBD: Temporary export of fdt globals - remove when code fully merged */
62extern int __initdata dt_root_addr_cells;
63extern int __initdata dt_root_size_cells;
64extern struct boot_param_header *initial_boot_params;
65
60/* For scanning the flat device-tree at boot time */ 66/* For scanning the flat device-tree at boot time */
61extern int __init of_scan_flat_dt(int (*it)(unsigned long node, 67extern char *find_flat_dt_string(u32 offset);
62 const char *uname, int depth, 68extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
63 void *data), 69 int depth, void *data),
64 void *data); 70 void *data);
65extern void __init *of_get_flat_dt_prop(unsigned long node, const char *name, 71extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
66 unsigned long *size); 72 unsigned long *size);
67extern int __init of_flat_dt_is_compatible(unsigned long node, 73extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
68 const char *name); 74extern unsigned long of_get_flat_dt_root(void);
69extern unsigned long __init of_get_flat_dt_root(void); 75extern void early_init_dt_scan_chosen_arch(unsigned long node);
76extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
77 int depth, void *data);
78extern void early_init_dt_check_for_initrd(unsigned long node);
79extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
80 int depth, void *data);
81extern void early_init_dt_add_memory_arch(u64 base, u64 size);
82extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
83extern u64 dt_mem_next_cell(int s, __be32 **cellp);
84
85/*
86 * If BLK_DEV_INITRD, the fdt early init code will call this function,
87 * to be provided by the arch code. start and end are specified as
88 * physical addresses.
89 */
90#ifdef CONFIG_BLK_DEV_INITRD
91extern void early_init_dt_setup_initrd_arch(unsigned long start,
92 unsigned long end);
93#endif
94
95/* Early flat tree scan hooks */
96extern int early_init_dt_scan_root(unsigned long node, const char *uname,
97 int depth, void *data);
70 98
71/* Other Prototypes */ 99/* Other Prototypes */
72extern void finish_device_tree(void);
73extern void unflatten_device_tree(void); 100extern void unflatten_device_tree(void);
74extern void early_init_devtree(void *); 101extern void early_init_devtree(void *);
75extern int machine_is_compatible(const char *compat); 102#else /* CONFIG_OF_FLATTREE */
76extern void print_properties(struct device_node *node); 103static inline void unflatten_device_tree(void) {}
77extern int prom_n_intr_cells(struct device_node* np); 104#endif /* CONFIG_OF_FLATTREE */
78extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
79extern int prom_add_property(struct device_node* np, struct property* prop);
80extern int prom_remove_property(struct device_node *np, struct property *prop);
81extern int prom_update_property(struct device_node *np,
82 struct property *newprop,
83 struct property *oldprop);
84 105
85#endif /* __ASSEMBLY__ */ 106#endif /* __ASSEMBLY__ */
86#endif /* _LINUX_OF_FDT_H */ 107#endif /* _LINUX_OF_FDT_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 908406651330..1643d3761eb4 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -11,6 +11,7 @@
11 * 11 *
12 */ 12 */
13 13
14#ifdef CONFIG_OF_DEVICE
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/mod_devicetable.h> 17#include <linux/mod_devicetable.h>
@@ -30,10 +31,6 @@ extern struct bus_type of_platform_bus_type;
30 */ 31 */
31struct of_platform_driver 32struct of_platform_driver
32{ 33{
33 const char *name;
34 const struct of_device_id *match_table;
35 struct module *owner;
36
37 int (*probe)(struct of_device* dev, 34 int (*probe)(struct of_device* dev,
38 const struct of_device_id *match); 35 const struct of_device_id *match);
39 int (*remove)(struct of_device* dev); 36 int (*remove)(struct of_device* dev);
@@ -66,5 +63,6 @@ static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
66extern struct of_device *of_find_device_by_node(struct device_node *np); 63extern struct of_device *of_find_device_by_node(struct device_node *np);
67 64
68extern int of_bus_type_init(struct bus_type *bus, const char *name); 65extern int of_bus_type_init(struct bus_type *bus, const char *name);
66#endif /* CONFIG_OF_DEVICE */
69 67
70#endif /* _LINUX_OF_PLATFORM_H */ 68#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index f46c40ac6d45..9bdd91486b49 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -57,6 +57,7 @@
57#define OMAPFB_WAITFORGO OMAP_IO(60) 57#define OMAPFB_WAITFORGO OMAP_IO(60)
58#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) 58#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info)
59#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) 59#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info)
60#define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info)
60 61
61#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff 62#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
62#define OMAPFB_CAPS_LCDC_MASK 0x00fff000 63#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
@@ -206,6 +207,14 @@ struct omapfb_tearsync_info {
206 __u16 reserved2; 207 __u16 reserved2;
207}; 208};
208 209
210struct omapfb_display_info {
211 __u16 xres;
212 __u16 yres;
213 __u32 width; /* phys width of the display in micrometers */
214 __u32 height; /* phys height of the display in micrometers */
215 __u32 reserved[5];
216};
217
209#ifdef __KERNEL__ 218#ifdef __KERNEL__
210 219
211#include <plat/board.h> 220#include <plat/board.h>
diff --git a/include/linux/padata.h b/include/linux/padata.h
new file mode 100644
index 000000000000..8d8406246eef
--- /dev/null
+++ b/include/linux/padata.h
@@ -0,0 +1,143 @@
1/*
2 * padata.h - header for the padata parallelization interface
3 *
4 * Copyright (C) 2008, 2009 secunet Security Networks AG
5 * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
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#ifndef PADATA_H
22#define PADATA_H
23
24#include <linux/workqueue.h>
25#include <linux/spinlock.h>
26#include <linux/list.h>
27#include <linux/timer.h>
28
29/**
30 * struct padata_priv - Embedded to the users data structure.
31 *
32 * @list: List entry, to attach to the padata lists.
33 * @pd: Pointer to the internal control structure.
34 * @cb_cpu: Callback cpu for serializatioon.
35 * @seq_nr: Sequence number of the parallelized data object.
36 * @info: Used to pass information from the parallel to the serial function.
37 * @parallel: Parallel execution function.
38 * @serial: Serial complete function.
39 */
40struct padata_priv {
41 struct list_head list;
42 struct parallel_data *pd;
43 int cb_cpu;
44 int seq_nr;
45 int info;
46 void (*parallel)(struct padata_priv *padata);
47 void (*serial)(struct padata_priv *padata);
48};
49
50/**
51 * struct padata_list
52 *
53 * @list: List head.
54 * @lock: List lock.
55 */
56struct padata_list {
57 struct list_head list;
58 spinlock_t lock;
59};
60
61/**
62 * struct padata_queue - The percpu padata queues.
63 *
64 * @parallel: List to wait for parallelization.
65 * @reorder: List to wait for reordering after parallel processing.
66 * @serial: List to wait for serialization after reordering.
67 * @pwork: work struct for parallelization.
68 * @swork: work struct for serialization.
69 * @pd: Backpointer to the internal control structure.
70 * @num_obj: Number of objects that are processed by this cpu.
71 * @cpu_index: Index of the cpu.
72 */
73struct padata_queue {
74 struct padata_list parallel;
75 struct padata_list reorder;
76 struct padata_list serial;
77 struct work_struct pwork;
78 struct work_struct swork;
79 struct parallel_data *pd;
80 atomic_t num_obj;
81 int cpu_index;
82};
83
84/**
85 * struct parallel_data - Internal control structure, covers everything
86 * that depends on the cpumask in use.
87 *
88 * @pinst: padata instance.
89 * @queue: percpu padata queues.
90 * @seq_nr: The sequence number that will be attached to the next object.
91 * @reorder_objects: Number of objects waiting in the reorder queues.
92 * @refcnt: Number of objects holding a reference on this parallel_data.
93 * @max_seq_nr: Maximal used sequence number.
94 * @cpumask: cpumask in use.
95 * @lock: Reorder lock.
96 * @timer: Reorder timer.
97 */
98struct parallel_data {
99 struct padata_instance *pinst;
100 struct padata_queue *queue;
101 atomic_t seq_nr;
102 atomic_t reorder_objects;
103 atomic_t refcnt;
104 unsigned int max_seq_nr;
105 cpumask_var_t cpumask;
106 spinlock_t lock;
107 struct timer_list timer;
108};
109
110/**
111 * struct padata_instance - The overall control structure.
112 *
113 * @cpu_notifier: cpu hotplug notifier.
114 * @wq: The workqueue in use.
115 * @pd: The internal control structure.
116 * @cpumask: User supplied cpumask.
117 * @lock: padata instance lock.
118 * @flags: padata flags.
119 */
120struct padata_instance {
121 struct notifier_block cpu_notifier;
122 struct workqueue_struct *wq;
123 struct parallel_data *pd;
124 cpumask_var_t cpumask;
125 struct mutex lock;
126 u8 flags;
127#define PADATA_INIT 1
128#define PADATA_RESET 2
129};
130
131extern struct padata_instance *padata_alloc(const struct cpumask *cpumask,
132 struct workqueue_struct *wq);
133extern void padata_free(struct padata_instance *pinst);
134extern int padata_do_parallel(struct padata_instance *pinst,
135 struct padata_priv *padata, int cb_cpu);
136extern void padata_do_serial(struct padata_priv *padata);
137extern int padata_set_cpumask(struct padata_instance *pinst,
138 cpumask_var_t cpumask);
139extern int padata_add_cpu(struct padata_instance *pinst, int cpu);
140extern int padata_remove_cpu(struct padata_instance *pinst, int cpu);
141extern void padata_start(struct padata_instance *pinst);
142extern void padata_stop(struct padata_instance *pinst);
143#endif
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index b0e4eb126236..5bb13b3db84d 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -39,6 +39,8 @@ enum {
39 PCG_CACHE, /* charged as cache */ 39 PCG_CACHE, /* charged as cache */
40 PCG_USED, /* this object is in use. */ 40 PCG_USED, /* this object is in use. */
41 PCG_ACCT_LRU, /* page has been accounted for */ 41 PCG_ACCT_LRU, /* page has been accounted for */
42 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
43 PCG_MIGRATION, /* under page migration */
42}; 44};
43 45
44#define TESTPCGFLAG(uname, lname) \ 46#define TESTPCGFLAG(uname, lname) \
@@ -73,6 +75,15 @@ CLEARPCGFLAG(AcctLRU, ACCT_LRU)
73TESTPCGFLAG(AcctLRU, ACCT_LRU) 75TESTPCGFLAG(AcctLRU, ACCT_LRU)
74TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) 76TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
75 77
78
79SETPCGFLAG(FileMapped, FILE_MAPPED)
80CLEARPCGFLAG(FileMapped, FILE_MAPPED)
81TESTPCGFLAG(FileMapped, FILE_MAPPED)
82
83SETPCGFLAG(Migration, MIGRATION)
84CLEARPCGFLAG(Migration, MIGRATION)
85TESTPCGFLAG(Migration, MIGRATION)
86
76static inline int page_cgroup_nid(struct page_cgroup *pc) 87static inline int page_cgroup_nid(struct page_cgroup *pc)
77{ 88{
78 return page_to_nid(pc->page); 89 return page_to_nid(pc->page);
@@ -118,6 +129,8 @@ static inline void __init page_cgroup_init_flatmem(void)
118#include <linux/swap.h> 129#include <linux/swap.h>
119 130
120#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 131#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
132extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
133 unsigned short old, unsigned short new);
121extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 134extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
122extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 135extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
123extern int swap_cgroup_swapon(int type, unsigned long max_pages); 136extern int swap_cgroup_swapon(int type, unsigned long max_pages);
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 93a7c08f869d..c8b6473c5f42 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -11,6 +11,13 @@
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
14extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev,
15 struct pci_bus *pci_bus);
16extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev);
17extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
18 struct pci_dev *pci_dev);
19extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev);
20
14static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 21static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
15{ 22{
16 struct pci_bus *pbus = pdev->bus; 23 struct pci_bus *pbus = pdev->bus;
diff --git a/include/linux/pci-dma.h b/include/linux/pci-dma.h
new file mode 100644
index 000000000000..549a041f9c08
--- /dev/null
+++ b/include/linux/pci-dma.h
@@ -0,0 +1,11 @@
1#ifndef _LINUX_PCI_DMA_H
2#define _LINUX_PCI_DMA_H
3
4#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) DEFINE_DMA_UNMAP_ADDR(ADDR_NAME);
5#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) DEFINE_DMA_UNMAP_LEN(LEN_NAME);
6#define pci_unmap_addr dma_unmap_addr
7#define pci_unmap_addr_set dma_unmap_addr_set
8#define pci_unmap_len dma_unmap_len
9#define pci_unmap_len_set dma_unmap_len_set
10
11#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 174e5392e51e..f26fda76b87f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -187,6 +187,33 @@ enum pci_bus_flags {
187 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, 187 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
188}; 188};
189 189
190/* Based on the PCI Hotplug Spec, but some values are made up by us */
191enum pci_bus_speed {
192 PCI_SPEED_33MHz = 0x00,
193 PCI_SPEED_66MHz = 0x01,
194 PCI_SPEED_66MHz_PCIX = 0x02,
195 PCI_SPEED_100MHz_PCIX = 0x03,
196 PCI_SPEED_133MHz_PCIX = 0x04,
197 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
198 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
199 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
200 PCI_SPEED_66MHz_PCIX_266 = 0x09,
201 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
202 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
203 AGP_UNKNOWN = 0x0c,
204 AGP_1X = 0x0d,
205 AGP_2X = 0x0e,
206 AGP_4X = 0x0f,
207 AGP_8X = 0x10,
208 PCI_SPEED_66MHz_PCIX_533 = 0x11,
209 PCI_SPEED_100MHz_PCIX_533 = 0x12,
210 PCI_SPEED_133MHz_PCIX_533 = 0x13,
211 PCIE_SPEED_2_5GT = 0x14,
212 PCIE_SPEED_5_0GT = 0x15,
213 PCIE_SPEED_8_0GT = 0x16,
214 PCI_SPEED_UNKNOWN = 0xff,
215};
216
190struct pci_cap_saved_state { 217struct pci_cap_saved_state {
191 struct hlist_node next; 218 struct hlist_node next;
192 char cap_nr; 219 char cap_nr;
@@ -239,6 +266,7 @@ struct pci_dev {
239 configuration space */ 266 configuration space */
240 unsigned int pme_support:5; /* Bitmask of states from which PME# 267 unsigned int pme_support:5; /* Bitmask of states from which PME#
241 can be generated */ 268 can be generated */
269 unsigned int pme_interrupt:1;
242 unsigned int d1_support:1; /* Low power state D1 is supported */ 270 unsigned int d1_support:1; /* Low power state D1 is supported */
243 unsigned int d2_support:1; /* Low power state D2 is supported */ 271 unsigned int d2_support:1; /* Low power state D2 is supported */
244 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 272 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
@@ -260,6 +288,7 @@ struct pci_dev {
260 */ 288 */
261 unsigned int irq; 289 unsigned int irq;
262 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 290 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
291 resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */
263 292
264 /* These fields are used by common fixups */ 293 /* These fields are used by common fixups */
265 unsigned int transparent:1; /* Transparent PCI bridge */ 294 unsigned int transparent:1; /* Transparent PCI bridge */
@@ -275,14 +304,16 @@ struct pci_dev {
275 unsigned int msix_enabled:1; 304 unsigned int msix_enabled:1;
276 unsigned int ari_enabled:1; /* ARI forwarding */ 305 unsigned int ari_enabled:1; /* ARI forwarding */
277 unsigned int is_managed:1; 306 unsigned int is_managed:1;
278 unsigned int is_pcie:1; 307 unsigned int is_pcie:1; /* Obsolete. Will be removed.
308 Use pci_is_pcie() instead */
279 unsigned int needs_freset:1; /* Dev requires fundamental reset */ 309 unsigned int needs_freset:1; /* Dev requires fundamental reset */
280 unsigned int state_saved:1; 310 unsigned int state_saved:1;
281 unsigned int is_physfn:1; 311 unsigned int is_physfn:1;
282 unsigned int is_virtfn:1; 312 unsigned int is_virtfn:1;
283 unsigned int reset_fn:1; 313 unsigned int reset_fn:1;
284 unsigned int is_hotplug_bridge:1; 314 unsigned int is_hotplug_bridge:1;
285 unsigned int aer_firmware_first:1; 315 unsigned int __aer_firmware_first_valid:1;
316 unsigned int __aer_firmware_first:1;
286 pci_dev_flags_t dev_flags; 317 pci_dev_flags_t dev_flags;
287 atomic_t enable_cnt; /* pci_enable_device has been called */ 318 atomic_t enable_cnt; /* pci_enable_device has been called */
288 319
@@ -305,6 +336,16 @@ struct pci_dev {
305#endif 336#endif
306}; 337};
307 338
339static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
340{
341#ifdef CONFIG_PCI_IOV
342 if (dev->is_virtfn)
343 dev = dev->physfn;
344#endif
345
346 return dev;
347}
348
308extern struct pci_dev *alloc_pci_dev(void); 349extern struct pci_dev *alloc_pci_dev(void);
309 350
310#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) 351#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
@@ -335,9 +376,26 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
335 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 376 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
336} 377}
337 378
338#ifndef PCI_BUS_NUM_RESOURCES 379/*
339#define PCI_BUS_NUM_RESOURCES 16 380 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
340#endif 381 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
382 * buses below host bridges or subtractive decode bridges) go in the list.
383 * Use pci_bus_for_each_resource() to iterate through all the resources.
384 */
385
386/*
387 * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly
388 * and there's no way to program the bridge with the details of the window.
389 * This does not apply to ACPI _CRS windows, even with the _DEC subtractive-
390 * decode bit set, because they are explicit and can be programmed with _SRS.
391 */
392#define PCI_SUBTRACTIVE_DECODE 0x1
393
394struct pci_bus_resource {
395 struct list_head list;
396 struct resource *res;
397 unsigned int flags;
398};
341 399
342#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 400#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
343 401
@@ -348,8 +406,8 @@ struct pci_bus {
348 struct list_head devices; /* list of devices on this bus */ 406 struct list_head devices; /* list of devices on this bus */
349 struct pci_dev *self; /* bridge device as seen by parent */ 407 struct pci_dev *self; /* bridge device as seen by parent */
350 struct list_head slots; /* list of slots on this bus */ 408 struct list_head slots; /* list of slots on this bus */
351 struct resource *resource[PCI_BUS_NUM_RESOURCES]; 409 struct resource *resource[PCI_BRIDGE_RESOURCE_NUM];
352 /* address space routed to this bus */ 410 struct list_head resources; /* address space routed to this bus */
353 411
354 struct pci_ops *ops; /* configuration access functions */ 412 struct pci_ops *ops; /* configuration access functions */
355 void *sysdata; /* hook for sys-specific extension */ 413 void *sysdata; /* hook for sys-specific extension */
@@ -359,6 +417,8 @@ struct pci_bus {
359 unsigned char primary; /* number of primary bridge */ 417 unsigned char primary; /* number of primary bridge */
360 unsigned char secondary; /* number of secondary bridge */ 418 unsigned char secondary; /* number of secondary bridge */
361 unsigned char subordinate; /* max number of subordinate buses */ 419 unsigned char subordinate; /* max number of subordinate buses */
420 unsigned char max_bus_speed; /* enum pci_bus_speed */
421 unsigned char cur_bus_speed; /* enum pci_bus_speed */
362 422
363 char name[48]; 423 char name[48];
364 424
@@ -563,7 +623,8 @@ int __must_check pcibios_enable_device(struct pci_dev *, int mask);
563char *pcibios_setup(char *str); 623char *pcibios_setup(char *str);
564 624
565/* Used only when drivers/pci/setup.c is used */ 625/* Used only when drivers/pci/setup.c is used */
566void pcibios_align_resource(void *, struct resource *, resource_size_t, 626resource_size_t pcibios_align_resource(void *, const struct resource *,
627 resource_size_t,
567 resource_size_t); 628 resource_size_t);
568void pcibios_update_irq(struct pci_dev *, int irq); 629void pcibios_update_irq(struct pci_dev *, int irq);
569 630
@@ -572,6 +633,7 @@ void pci_fixup_cardbus(struct pci_bus *);
572 633
573/* Generic PCI functions used internally */ 634/* Generic PCI functions used internally */
574 635
636void pcibios_scan_specific_bus(int busn);
575extern struct pci_bus *pci_find_bus(int domain, int busnr); 637extern struct pci_bus *pci_find_bus(int domain, int busnr);
576void pci_bus_add_devices(const struct pci_bus *bus); 638void pci_bus_add_devices(const struct pci_bus *bus);
577struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 639struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
@@ -589,6 +651,7 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
589 struct pci_ops *ops, void *sysdata); 651 struct pci_ops *ops, void *sysdata);
590struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 652struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
591 int busnr); 653 int busnr);
654void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
592struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 655struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
593 const char *name, 656 const char *name,
594 struct hotplug_slot *hotplug); 657 struct hotplug_slot *hotplug);
@@ -612,15 +675,12 @@ extern void pci_remove_bus_device(struct pci_dev *dev);
612extern void pci_stop_bus_device(struct pci_dev *dev); 675extern void pci_stop_bus_device(struct pci_dev *dev);
613void pci_setup_cardbus(struct pci_bus *bus); 676void pci_setup_cardbus(struct pci_bus *bus);
614extern void pci_sort_breadthfirst(void); 677extern void pci_sort_breadthfirst(void);
678#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
679#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
680#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0))
615 681
616/* Generic PCI functions exported to card drivers */ 682/* Generic PCI functions exported to card drivers */
617 683
618#ifdef CONFIG_PCI_LEGACY
619struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
620 unsigned int device,
621 struct pci_dev *from);
622#endif /* CONFIG_PCI_LEGACY */
623
624enum pci_lost_interrupt_reason { 684enum pci_lost_interrupt_reason {
625 PCI_LOST_IRQ_NO_INFORMATION = 0, 685 PCI_LOST_IRQ_NO_INFORMATION = 0,
626 PCI_LOST_IRQ_DISABLE_MSI, 686 PCI_LOST_IRQ_DISABLE_MSI,
@@ -631,6 +691,8 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
631int pci_find_capability(struct pci_dev *dev, int cap); 691int pci_find_capability(struct pci_dev *dev, int cap);
632int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 692int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
633int pci_find_ext_capability(struct pci_dev *dev, int cap); 693int pci_find_ext_capability(struct pci_dev *dev, int cap);
694int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn,
695 int cap);
634int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); 696int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
635int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); 697int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
636struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 698struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
@@ -720,8 +782,6 @@ int pci_try_set_mwi(struct pci_dev *dev);
720void pci_clear_mwi(struct pci_dev *dev); 782void pci_clear_mwi(struct pci_dev *dev);
721void pci_intx(struct pci_dev *dev, int enable); 783void pci_intx(struct pci_dev *dev, int enable);
722void pci_msi_off(struct pci_dev *dev); 784void pci_msi_off(struct pci_dev *dev);
723int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
724int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
725int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 785int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
726int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 786int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
727int pcix_get_max_mmrbc(struct pci_dev *dev); 787int pcix_get_max_mmrbc(struct pci_dev *dev);
@@ -750,11 +810,23 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
750pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 810pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
751bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 811bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
752void pci_pme_active(struct pci_dev *dev, bool enable); 812void pci_pme_active(struct pci_dev *dev, bool enable);
753int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable); 813int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
814 bool runtime, bool enable);
754int pci_wake_from_d3(struct pci_dev *dev, bool enable); 815int pci_wake_from_d3(struct pci_dev *dev, bool enable);
755pci_power_t pci_target_state(struct pci_dev *dev); 816pci_power_t pci_target_state(struct pci_dev *dev);
756int pci_prepare_to_sleep(struct pci_dev *dev); 817int pci_prepare_to_sleep(struct pci_dev *dev);
757int pci_back_from_sleep(struct pci_dev *dev); 818int pci_back_from_sleep(struct pci_dev *dev);
819bool pci_dev_run_wake(struct pci_dev *dev);
820
821static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
822 bool enable)
823{
824 return __pci_enable_wake(dev, state, false, enable);
825}
826
827/* For use by arch with custom probe code */
828void set_pcie_port_type(struct pci_dev *pdev);
829void set_pcie_hotplug_bridge(struct pci_dev *pdev);
758 830
759/* Functions for PCI Hotplug drivers to use */ 831/* Functions for PCI Hotplug drivers to use */
760int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 832int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
@@ -772,6 +844,7 @@ void pci_bus_assign_resources(const struct pci_bus *bus);
772void pci_bus_size_bridges(struct pci_bus *bus); 844void pci_bus_size_bridges(struct pci_bus *bus);
773int pci_claim_resource(struct pci_dev *, int); 845int pci_claim_resource(struct pci_dev *, int);
774void pci_assign_unassigned_resources(void); 846void pci_assign_unassigned_resources(void);
847void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
775void pdev_enable_device(struct pci_dev *); 848void pdev_enable_device(struct pci_dev *);
776void pdev_sort_resources(struct pci_dev *, struct resource_list *); 849void pdev_sort_resources(struct pci_dev *, struct resource_list *);
777int pci_enable_resources(struct pci_dev *, int mask); 850int pci_enable_resources(struct pci_dev *, int mask);
@@ -789,12 +862,23 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
789void pci_release_selected_regions(struct pci_dev *, int); 862void pci_release_selected_regions(struct pci_dev *, int);
790 863
791/* drivers/pci/bus.c */ 864/* drivers/pci/bus.c */
865void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
866struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
867void pci_bus_remove_resources(struct pci_bus *bus);
868
869#define pci_bus_for_each_resource(bus, res, i) \
870 for (i = 0; \
871 (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \
872 i++)
873
792int __must_check pci_bus_alloc_resource(struct pci_bus *bus, 874int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
793 struct resource *res, resource_size_t size, 875 struct resource *res, resource_size_t size,
794 resource_size_t align, resource_size_t min, 876 resource_size_t align, resource_size_t min,
795 unsigned int type_mask, 877 unsigned int type_mask,
796 void (*alignf)(void *, struct resource *, 878 resource_size_t (*alignf)(void *,
797 resource_size_t, resource_size_t), 879 const struct resource *,
880 resource_size_t,
881 resource_size_t),
798 void *alignf_data); 882 void *alignf_data);
799void pci_enable_bridges(struct pci_bus *bus); 883void pci_enable_bridges(struct pci_bus *bus);
800 884
@@ -831,6 +915,7 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
831 unsigned int command_bits, bool change_bridge); 915 unsigned int command_bits, bool change_bridge);
832/* kmem_cache style wrapper around pci_alloc_consistent() */ 916/* kmem_cache style wrapper around pci_alloc_consistent() */
833 917
918#include <linux/pci-dma.h>
834#include <linux/dmapool.h> 919#include <linux/dmapool.h>
835 920
836#define pci_pool dma_pool 921#define pci_pool dma_pool
@@ -955,6 +1040,11 @@ static inline int pci_proc_domain(struct pci_bus *bus)
955} 1040}
956#endif /* CONFIG_PCI_DOMAINS */ 1041#endif /* CONFIG_PCI_DOMAINS */
957 1042
1043/* some architectures require additional setup to direct VGA traffic */
1044typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
1045 unsigned int command_bits, bool change_bridge);
1046extern void pci_register_set_vga_state(arch_set_vga_state_t func);
1047
958#else /* CONFIG_PCI is not enabled */ 1048#else /* CONFIG_PCI is not enabled */
959 1049
960/* 1050/*
@@ -973,13 +1063,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
973_PCI_NOP_ALL(read, *) 1063_PCI_NOP_ALL(read, *)
974_PCI_NOP_ALL(write,) 1064_PCI_NOP_ALL(write,)
975 1065
976static inline struct pci_dev *pci_find_device(unsigned int vendor,
977 unsigned int device,
978 struct pci_dev *from)
979{
980 return NULL;
981}
982
983static inline struct pci_dev *pci_get_device(unsigned int vendor, 1066static inline struct pci_dev *pci_get_device(unsigned int vendor,
984 unsigned int device, 1067 unsigned int device,
985 struct pci_dev *from) 1068 struct pci_dev *from)
@@ -1129,6 +1212,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1129 unsigned int devfn) 1212 unsigned int devfn)
1130{ return NULL; } 1213{ return NULL; }
1131 1214
1215#define dev_is_pci(d) (false)
1216#define dev_is_pf(d) (false)
1217#define dev_num_vf(d) (0)
1132#endif /* CONFIG_PCI */ 1218#endif /* CONFIG_PCI */
1133 1219
1134/* Include architecture-dependent settings and functions */ 1220/* Include architecture-dependent settings and functions */
@@ -1237,8 +1323,12 @@ enum pci_fixup_pass {
1237 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1323 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1238 suspend##vendor##device##hook, vendor, device, hook) 1324 suspend##vendor##device##hook, vendor, device, hook)
1239 1325
1240 1326#ifdef CONFIG_PCI_QUIRKS
1241void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1327void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1328#else
1329static inline void pci_fixup_device(enum pci_fixup_pass pass,
1330 struct pci_dev *dev) {}
1331#endif
1242 1332
1243void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1333void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
1244void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1334void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
@@ -1286,6 +1376,7 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1286extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1376extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1287extern void pci_disable_sriov(struct pci_dev *dev); 1377extern void pci_disable_sriov(struct pci_dev *dev);
1288extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1378extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1379extern int pci_num_vf(struct pci_dev *dev);
1289#else 1380#else
1290static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1381static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1291{ 1382{
@@ -1298,6 +1389,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1298{ 1389{
1299 return IRQ_NONE; 1390 return IRQ_NONE;
1300} 1391}
1392static inline int pci_num_vf(struct pci_dev *dev)
1393{
1394 return 0;
1395}
1301#endif 1396#endif
1302 1397
1303#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1398#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
@@ -1334,5 +1429,93 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
1334 1429
1335void pci_request_acs(void); 1430void pci_request_acs(void);
1336 1431
1432
1433#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */
1434#define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT)
1435
1436/* Large Resource Data Type Tag Item Names */
1437#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */
1438#define PCI_VPD_LTIN_RO_DATA 0x10 /* Read-Only Data */
1439#define PCI_VPD_LTIN_RW_DATA 0x11 /* Read-Write Data */
1440
1441#define PCI_VPD_LRDT_ID_STRING PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING)
1442#define PCI_VPD_LRDT_RO_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA)
1443#define PCI_VPD_LRDT_RW_DATA PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
1444
1445/* Small Resource Data Type Tag Item Names */
1446#define PCI_VPD_STIN_END 0x78 /* End */
1447
1448#define PCI_VPD_SRDT_END PCI_VPD_STIN_END
1449
1450#define PCI_VPD_SRDT_TIN_MASK 0x78
1451#define PCI_VPD_SRDT_LEN_MASK 0x07
1452
1453#define PCI_VPD_LRDT_TAG_SIZE 3
1454#define PCI_VPD_SRDT_TAG_SIZE 1
1455
1456#define PCI_VPD_INFO_FLD_HDR_SIZE 3
1457
1458#define PCI_VPD_RO_KEYWORD_PARTNO "PN"
1459#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
1460#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
1461
1462/**
1463 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
1464 * @lrdt: Pointer to the beginning of the Large Resource Data Type tag
1465 *
1466 * Returns the extracted Large Resource Data Type length.
1467 */
1468static inline u16 pci_vpd_lrdt_size(const u8 *lrdt)
1469{
1470 return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
1471}
1472
1473/**
1474 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
1475 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag
1476 *
1477 * Returns the extracted Small Resource Data Type length.
1478 */
1479static inline u8 pci_vpd_srdt_size(const u8 *srdt)
1480{
1481 return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
1482}
1483
1484/**
1485 * pci_vpd_info_field_size - Extracts the information field length
1486 * @lrdt: Pointer to the beginning of an information field header
1487 *
1488 * Returns the extracted information field length.
1489 */
1490static inline u8 pci_vpd_info_field_size(const u8 *info_field)
1491{
1492 return info_field[2];
1493}
1494
1495/**
1496 * pci_vpd_find_tag - Locates the Resource Data Type tag provided
1497 * @buf: Pointer to buffered vpd data
1498 * @off: The offset into the buffer at which to begin the search
1499 * @len: The length of the vpd buffer
1500 * @rdt: The Resource Data Type to search for
1501 *
1502 * Returns the index where the Resource Data Type was found or
1503 * -ENOENT otherwise.
1504 */
1505int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt);
1506
1507/**
1508 * pci_vpd_find_info_keyword - Locates an information field keyword in the VPD
1509 * @buf: Pointer to buffered vpd data
1510 * @off: The offset into the buffer at which to begin the search
1511 * @len: The length of the buffer area, relative to off, in which to search
1512 * @kw: The keyword to search for
1513 *
1514 * Returns the index where the information field keyword was found or
1515 * -ENOENT otherwise.
1516 */
1517int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
1518 unsigned int len, const char *kw);
1519
1337#endif /* __KERNEL__ */ 1520#endif /* __KERNEL__ */
1338#endif /* LINUX_PCI_H */ 1521#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 652ba797696d..5d09cbafa7db 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -28,26 +28,6 @@
28#ifndef _PCI_HOTPLUG_H 28#ifndef _PCI_HOTPLUG_H
29#define _PCI_HOTPLUG_H 29#define _PCI_HOTPLUG_H
30 30
31
32/* These values come from the PCI Hotplug Spec */
33enum pci_bus_speed {
34 PCI_SPEED_33MHz = 0x00,
35 PCI_SPEED_66MHz = 0x01,
36 PCI_SPEED_66MHz_PCIX = 0x02,
37 PCI_SPEED_100MHz_PCIX = 0x03,
38 PCI_SPEED_133MHz_PCIX = 0x04,
39 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
40 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
41 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
42 PCI_SPEED_66MHz_PCIX_266 = 0x09,
43 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
44 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
45 PCI_SPEED_66MHz_PCIX_533 = 0x11,
46 PCI_SPEED_100MHz_PCIX_533 = 0x12,
47 PCI_SPEED_133MHz_PCIX_533 = 0x13,
48 PCI_SPEED_UNKNOWN = 0xff,
49};
50
51/* These values come from the PCI Express Spec */ 31/* These values come from the PCI Express Spec */
52enum pcie_link_width { 32enum pcie_link_width {
53 PCIE_LNK_WIDTH_RESRV = 0x00, 33 PCIE_LNK_WIDTH_RESRV = 0x00,
@@ -61,12 +41,6 @@ enum pcie_link_width {
61 PCIE_LNK_WIDTH_UNKNOWN = 0xFF, 41 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
62}; 42};
63 43
64enum pcie_link_speed {
65 PCIE_2_5GB = 0x14,
66 PCIE_5_0GB = 0x15,
67 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
68};
69
70/** 44/**
71 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use 45 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
72 * @owner: The module owner of this structure 46 * @owner: The module owner of this structure
@@ -89,12 +63,6 @@ enum pcie_link_speed {
89 * @get_adapter_status: Called to get see if an adapter is present in the slot or not. 63 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
90 * If this field is NULL, the value passed in the struct hotplug_slot_info 64 * If this field is NULL, the value passed in the struct hotplug_slot_info
91 * will be used when this value is requested by a user. 65 * will be used when this value is requested by a user.
92 * @get_max_bus_speed: Called to get the max bus speed for a slot.
93 * If this field is NULL, the value passed in the struct hotplug_slot_info
94 * will be used when this value is requested by a user.
95 * @get_cur_bus_speed: Called to get the current bus speed for a slot.
96 * If this field is NULL, the value passed in the struct hotplug_slot_info
97 * will be used when this value is requested by a user.
98 * 66 *
99 * The table of function pointers that is passed to the hotplug pci core by a 67 * The table of function pointers that is passed to the hotplug pci core by a
100 * hotplug pci driver. These functions are called by the hotplug pci core when 68 * hotplug pci driver. These functions are called by the hotplug pci core when
@@ -112,17 +80,14 @@ struct hotplug_slot_ops {
112 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); 80 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
113 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); 81 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
114 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); 82 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
115 int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
116 int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
117}; 83};
118 84
119/** 85/**
120 * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot 86 * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot
121 * @power: if power is enabled or not (1/0) 87 * @power_status: if power is enabled or not (1/0)
122 * @attention_status: if the attention light is enabled or not (1/0) 88 * @attention_status: if the attention light is enabled or not (1/0)
123 * @latch_status: if the latch (if any) is open or closed (1/0) 89 * @latch_status: if the latch (if any) is open or closed (1/0)
124 * @adapter_present: if there is a pci board present in the slot or not (1/0) 90 * @adapter_status: if there is a pci board present in the slot or not (1/0)
125 * @address: (domain << 16 | bus << 8 | dev)
126 * 91 *
127 * Used to notify the hotplug pci core of the status of a specific slot. 92 * Used to notify the hotplug pci core of the status of a specific slot.
128 */ 93 */
@@ -131,8 +96,6 @@ struct hotplug_slot_info {
131 u8 attention_status; 96 u8 attention_status;
132 u8 latch_status; 97 u8 latch_status;
133 u8 adapter_status; 98 u8 adapter_status;
134 enum pci_bus_speed max_bus_speed;
135 enum pci_bus_speed cur_bus_speed;
136}; 99};
137 100
138/** 101/**
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cca8a044e2b6..3bedcc149c84 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -770,7 +770,6 @@
770#define PCI_VENDOR_ID_TI 0x104c 770#define PCI_VENDOR_ID_TI 0x104c
771#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 771#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
772#define PCI_DEVICE_ID_TI_4450 0x8011 772#define PCI_DEVICE_ID_TI_4450 0x8011
773#define PCI_DEVICE_ID_TI_TSB43AB22 0x8023
774#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 773#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031
775#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 774#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033
776#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 775#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034
@@ -1262,6 +1261,7 @@
1262#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1261#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1263#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 1262#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8
1264#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 1263#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2
1264#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85
1265 1265
1266#define PCI_VENDOR_ID_IMS 0x10e0 1266#define PCI_VENDOR_ID_IMS 0x10e0
1267#define PCI_DEVICE_ID_IMS_TT128 0x9128 1267#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -2322,6 +2322,7 @@
2322#define PCI_VENDOR_ID_JMICRON 0x197B 2322#define PCI_VENDOR_ID_JMICRON 0x197B
2323#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 2323#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
2324#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 2324#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
2325#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362
2325#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 2326#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363
2326#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 2327#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2327#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2328#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
@@ -2333,6 +2334,8 @@
2333#define PCI_VENDOR_ID_KORENIX 0x1982 2334#define PCI_VENDOR_ID_KORENIX 0x1982
2334#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2335#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
2335#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff 2336#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff
2337#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700
2338#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff
2336 2339
2337#define PCI_VENDOR_ID_QMI 0x1a32 2340#define PCI_VENDOR_ID_QMI 0x1a32
2338 2341
@@ -2417,6 +2420,9 @@
2417#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 2420#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21
2418#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2421#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2419#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 2422#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2423#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22
2424#define PCI_DEVICE_ID_INTEL_CPT_LPC_MIN 0x1c41
2425#define PCI_DEVICE_ID_INTEL_CPT_LPC_MAX 0x1c5f
2420#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2426#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2421#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2427#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2422#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2428#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
@@ -2528,11 +2534,63 @@
2528#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 2534#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2529#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 2535#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
2530#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 2536#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
2537#define PCI_DEVICE_ID_INTEL_I7_MCR 0x2c18
2538#define PCI_DEVICE_ID_INTEL_I7_MC_TAD 0x2c19
2539#define PCI_DEVICE_ID_INTEL_I7_MC_RAS 0x2c1a
2540#define PCI_DEVICE_ID_INTEL_I7_MC_TEST 0x2c1c
2541#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_CTRL 0x2c20
2542#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_ADDR 0x2c21
2543#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_RANK 0x2c22
2544#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_TC 0x2c23
2545#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_CTRL 0x2c28
2546#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_ADDR 0x2c29
2547#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_RANK 0x2c2a
2548#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_TC 0x2c2b
2549#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_CTRL 0x2c30
2550#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_ADDR 0x2c31
2551#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_RANK 0x2c32
2552#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_TC 0x2c33
2553#define PCI_DEVICE_ID_INTEL_I7_NONCORE 0x2c41
2554#define PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT 0x2c40
2555#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE 0x2c50
2556#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT 0x2c51
2557#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_REV2 0x2c70
2558#define PCI_DEVICE_ID_INTEL_LYNNFIELD_SAD 0x2c81
2559#define PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_LINK0 0x2c90
2560#define PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_PHY0 0x2c91
2561#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MCR 0x2c98
2562#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TAD 0x2c99
2563#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TEST 0x2c9C
2564#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_CTRL 0x2ca0
2565#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_ADDR 0x2ca1
2566#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_RANK 0x2ca2
2567#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_TC 0x2ca3
2568#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_CTRL 0x2ca8
2569#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_ADDR 0x2ca9
2570#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_RANK 0x2caa
2571#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_TC 0x2cab
2572#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MCR_REV2 0x2d98
2573#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TAD_REV2 0x2d99
2574#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_RAS_REV2 0x2d9a
2575#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TEST_REV2 0x2d9c
2576#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_CTRL_REV2 0x2da0
2577#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_ADDR_REV2 0x2da1
2578#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_RANK_REV2 0x2da2
2579#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_TC_REV2 0x2da3
2580#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_CTRL_REV2 0x2da8
2581#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_ADDR_REV2 0x2da9
2582#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_RANK_REV2 0x2daa
2583#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_TC_REV2 0x2dab
2584#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_CTRL_REV2 0x2db0
2585#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_ADDR_REV2 0x2db1
2586#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_RANK_REV2 0x2db2
2587#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_TC_REV2 0x2db3
2531#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2588#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2532#define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429 2589#define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429
2533#define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a 2590#define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a
2534#define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b 2591#define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b
2535#define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c 2592#define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c
2593#define PCI_DEVICE_ID_INTEL_X58_HUB_MGMT 0x342e
2536#define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430 2594#define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430
2537#define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431 2595#define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431
2538#define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432 2596#define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432
@@ -2694,6 +2752,7 @@
2694#define PCI_DEVICE_ID_NETMOS_9835 0x9835 2752#define PCI_DEVICE_ID_NETMOS_9835 0x9835
2695#define PCI_DEVICE_ID_NETMOS_9845 0x9845 2753#define PCI_DEVICE_ID_NETMOS_9845 0x9845
2696#define PCI_DEVICE_ID_NETMOS_9855 0x9855 2754#define PCI_DEVICE_ID_NETMOS_9855 0x9855
2755#define PCI_DEVICE_ID_NETMOS_9865 0x9865
2697#define PCI_DEVICE_ID_NETMOS_9901 0x9901 2756#define PCI_DEVICE_ID_NETMOS_9901 0x9901
2698 2757
2699#define PCI_VENDOR_ID_3COM_2 0xa727 2758#define PCI_VENDOR_ID_3COM_2 0xa727
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 9f2ad0aa3c39..455b9ccdfca7 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -442,7 +442,10 @@
442#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ 442#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */
443#define PCI_EXP_LNKSTA 18 /* Link Status */ 443#define PCI_EXP_LNKSTA 18 /* Link Status */
444#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ 444#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
445#define PCI_EXP_LNKSTA_CLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */
446#define PCI_EXP_LNKSTA_CLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */
445#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ 447#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */
448#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */
446#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ 449#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
447#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 450#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
448#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ 451#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */
@@ -507,6 +510,7 @@
507#define PCI_EXT_CAP_ID_VC 2 510#define PCI_EXT_CAP_ID_VC 2
508#define PCI_EXT_CAP_ID_DSN 3 511#define PCI_EXT_CAP_ID_DSN 3
509#define PCI_EXT_CAP_ID_PWR 4 512#define PCI_EXT_CAP_ID_PWR 4
513#define PCI_EXT_CAP_ID_VNDR 11
510#define PCI_EXT_CAP_ID_ACS 13 514#define PCI_EXT_CAP_ID_ACS 13
511#define PCI_EXT_CAP_ID_ARI 14 515#define PCI_EXT_CAP_ID_ARI 14
512#define PCI_EXT_CAP_ID_ATS 15 516#define PCI_EXT_CAP_ID_ATS 15
@@ -562,8 +566,7 @@
562#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ 566#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
563#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ 567#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
564#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ 568#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
565#define PCI_ERR_ROOT_COR_SRC 52 569#define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */
566#define PCI_ERR_ROOT_SRC 54
567 570
568/* Virtual Channel */ 571/* Virtual Channel */
569#define PCI_VC_PORT_REG1 4 572#define PCI_VC_PORT_REG1 4
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index d4cf7a2ceb3e..c9e4d814ff77 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -24,6 +24,8 @@ struct pda_power_pdata {
24 int (*is_usb_online)(void); 24 int (*is_usb_online)(void);
25 void (*set_charge)(int flags); 25 void (*set_charge)(int flags);
26 void (*exit)(struct device *dev); 26 void (*exit)(struct device *dev);
27 int (*suspend)(pm_message_t state);
28 int (*resume)(void);
27 29
28 char **supplied_to; 30 char **supplied_to;
29 size_t num_supplicants; 31 size_t num_supplicants;
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 2351191f8c82..ce2dc655cd1d 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -2,12 +2,6 @@
2#define _LINUX_PERCPU_DEFS_H 2#define _LINUX_PERCPU_DEFS_H
3 3
4/* 4/*
5 * Determine the real variable name from the name visible in the
6 * kernel sources.
7 */
8#define per_cpu_var(var) per_cpu__##var
9
10/*
11 * Base implementations of per-CPU variable declarations and definitions, where 5 * Base implementations of per-CPU variable declarations and definitions, where
12 * the section in which the variable is to be placed is provided by the 6 * the section in which the variable is to be placed is provided by the
13 * 'sec' argument. This may be used to affect the parameters governing the 7 * 'sec' argument. This may be used to affect the parameters governing the
@@ -18,13 +12,23 @@
18 * that section. 12 * that section.
19 */ 13 */
20#define __PCPU_ATTRS(sec) \ 14#define __PCPU_ATTRS(sec) \
21 __attribute__((section(PER_CPU_BASE_SECTION sec))) \ 15 __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
22 PER_CPU_ATTRIBUTES 16 PER_CPU_ATTRIBUTES
23 17
24#define __PCPU_DUMMY_ATTRS \ 18#define __PCPU_DUMMY_ATTRS \
25 __attribute__((section(".discard"), unused)) 19 __attribute__((section(".discard"), unused))
26 20
27/* 21/*
22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer.
25 */
26#define __verify_pcpu_ptr(ptr) do { \
27 const void __percpu *__vpp_verify = (typeof(ptr))NULL; \
28 (void)__vpp_verify; \
29} while (0)
30
31/*
28 * s390 and alpha modules require percpu variables to be defined as 32 * s390 and alpha modules require percpu variables to be defined as
29 * weak to force the compiler to generate GOT based external 33 * weak to force the compiler to generate GOT based external
30 * references for them. This is necessary because percpu sections 34 * references for them. This is necessary because percpu sections
@@ -56,24 +60,24 @@
56 */ 60 */
57#define DECLARE_PER_CPU_SECTION(type, name, sec) \ 61#define DECLARE_PER_CPU_SECTION(type, name, sec) \
58 extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ 62 extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
59 extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name 63 extern __PCPU_ATTRS(sec) __typeof__(type) name
60 64
61#define DEFINE_PER_CPU_SECTION(type, name, sec) \ 65#define DEFINE_PER_CPU_SECTION(type, name, sec) \
62 __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ 66 __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
63 extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ 67 extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \
64 __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ 68 __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \
65 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ 69 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \
66 __typeof__(type) per_cpu__##name 70 __typeof__(type) name
67#else 71#else
68/* 72/*
69 * Normal declaration and definition macros. 73 * Normal declaration and definition macros.
70 */ 74 */
71#define DECLARE_PER_CPU_SECTION(type, name, sec) \ 75#define DECLARE_PER_CPU_SECTION(type, name, sec) \
72 extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name 76 extern __PCPU_ATTRS(sec) __typeof__(type) name
73 77
74#define DEFINE_PER_CPU_SECTION(type, name, sec) \ 78#define DEFINE_PER_CPU_SECTION(type, name, sec) \
75 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ 79 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \
76 __typeof__(type) per_cpu__##name 80 __typeof__(type) name
77#endif 81#endif
78 82
79/* 83/*
@@ -135,10 +139,16 @@
135 __aligned(PAGE_SIZE) 139 __aligned(PAGE_SIZE)
136 140
137/* 141/*
138 * Intermodule exports for per-CPU variables. 142 * Intermodule exports for per-CPU variables. sparse forgets about
143 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
144 * noop if __CHECKER__.
139 */ 145 */
140#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 146#ifndef __CHECKER__
141#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) 147#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var)
142 148#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var)
149#else
150#define EXPORT_PER_CPU_SYMBOL(var)
151#define EXPORT_PER_CPU_SYMBOL_GPL(var)
152#endif
143 153
144#endif /* _LINUX_PERCPU_DEFS_H */ 154#endif /* _LINUX_PERCPU_DEFS_H */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index cf5efbcf716c..d3a38d687104 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -2,10 +2,10 @@
2#define __LINUX_PERCPU_H 2#define __LINUX_PERCPU_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <linux/slab.h> /* For kmalloc() */
6#include <linux/smp.h> 5#include <linux/smp.h>
7#include <linux/cpumask.h> 6#include <linux/cpumask.h>
8#include <linux/pfn.h> 7#include <linux/pfn.h>
8#include <linux/init.h>
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
@@ -27,10 +27,17 @@
27 * we force a syntax error here if it isn't. 27 * we force a syntax error here if it isn't.
28 */ 28 */
29#define get_cpu_var(var) (*({ \ 29#define get_cpu_var(var) (*({ \
30 extern int simple_identifier_##var(void); \
31 preempt_disable(); \ 30 preempt_disable(); \
32 &__get_cpu_var(var); })) 31 &__get_cpu_var(var); }))
33#define put_cpu_var(var) preempt_enable() 32
33/*
34 * The weird & is necessary because sparse considers (void)(var) to be
35 * a direct dereference of percpu variable (var).
36 */
37#define put_cpu_var(var) do { \
38 (void)&(var); \
39 preempt_enable(); \
40} while (0)
34 41
35#ifdef CONFIG_SMP 42#ifdef CONFIG_SMP
36 43
@@ -127,10 +134,8 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size,
127 */ 134 */
128#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) 135#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
129 136
130extern void *__alloc_reserved_percpu(size_t size, size_t align); 137extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align);
131extern void *__alloc_percpu(size_t size, size_t align); 138extern bool is_kernel_percpu_address(unsigned long addr);
132extern void free_percpu(void *__pdata);
133extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
134 139
135#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 140#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
136extern void __init setup_per_cpu_areas(void); 141extern void __init setup_per_cpu_areas(void);
@@ -140,25 +145,10 @@ extern void __init setup_per_cpu_areas(void);
140 145
141#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 146#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
142 147
143static inline void *__alloc_percpu(size_t size, size_t align) 148/* can't distinguish from other static vars, always false */
144{ 149static inline bool is_kernel_percpu_address(unsigned long addr)
145 /*
146 * Can't easily make larger alignment work with kmalloc. WARN
147 * on it. Larger alignment should only be used for module
148 * percpu sections on SMP for which this path isn't used.
149 */
150 WARN_ON_ONCE(align > SMP_CACHE_BYTES);
151 return kzalloc(size, GFP_KERNEL);
152}
153
154static inline void free_percpu(void *p)
155{
156 kfree(p);
157}
158
159static inline phys_addr_t per_cpu_ptr_to_phys(void *addr)
160{ 150{
161 return __pa(addr); 151 return false;
162} 152}
163 153
164static inline void __init setup_per_cpu_areas(void) { } 154static inline void __init setup_per_cpu_areas(void) { }
@@ -170,8 +160,12 @@ static inline void *pcpu_lpage_remapped(void *kaddr)
170 160
171#endif /* CONFIG_SMP */ 161#endif /* CONFIG_SMP */
172 162
163extern void __percpu *__alloc_percpu(size_t size, size_t align);
164extern void free_percpu(void __percpu *__pdata);
165extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166
173#define alloc_percpu(type) \ 167#define alloc_percpu(type) \
174 (typeof(type) *)__alloc_percpu(sizeof(type), __alignof__(type)) 168 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
175 169
176/* 170/*
177 * Optional methods for optimized non-lvalue per-cpu variable access. 171 * Optional methods for optimized non-lvalue per-cpu variable access.
@@ -188,17 +182,19 @@ static inline void *pcpu_lpage_remapped(void *kaddr)
188#ifndef percpu_read 182#ifndef percpu_read
189# define percpu_read(var) \ 183# define percpu_read(var) \
190 ({ \ 184 ({ \
191 typeof(per_cpu_var(var)) __tmp_var__; \ 185 typeof(var) *pr_ptr__ = &(var); \
192 __tmp_var__ = get_cpu_var(var); \ 186 typeof(var) pr_ret__; \
193 put_cpu_var(var); \ 187 pr_ret__ = get_cpu_var(*pr_ptr__); \
194 __tmp_var__; \ 188 put_cpu_var(*pr_ptr__); \
189 pr_ret__; \
195 }) 190 })
196#endif 191#endif
197 192
198#define __percpu_generic_to_op(var, val, op) \ 193#define __percpu_generic_to_op(var, val, op) \
199do { \ 194do { \
200 get_cpu_var(var) op val; \ 195 typeof(var) *pgto_ptr__ = &(var); \
201 put_cpu_var(var); \ 196 get_cpu_var(*pgto_ptr__) op val; \
197 put_cpu_var(*pgto_ptr__); \
202} while (0) 198} while (0)
203 199
204#ifndef percpu_write 200#ifndef percpu_write
@@ -234,6 +230,7 @@ extern void __bad_size_call_parameter(void);
234 230
235#define __pcpu_size_call_return(stem, variable) \ 231#define __pcpu_size_call_return(stem, variable) \
236({ typeof(variable) pscr_ret__; \ 232({ typeof(variable) pscr_ret__; \
233 __verify_pcpu_ptr(&(variable)); \
237 switch(sizeof(variable)) { \ 234 switch(sizeof(variable)) { \
238 case 1: pscr_ret__ = stem##1(variable);break; \ 235 case 1: pscr_ret__ = stem##1(variable);break; \
239 case 2: pscr_ret__ = stem##2(variable);break; \ 236 case 2: pscr_ret__ = stem##2(variable);break; \
@@ -247,6 +244,7 @@ extern void __bad_size_call_parameter(void);
247 244
248#define __pcpu_size_call(stem, variable, ...) \ 245#define __pcpu_size_call(stem, variable, ...) \
249do { \ 246do { \
247 __verify_pcpu_ptr(&(variable)); \
250 switch(sizeof(variable)) { \ 248 switch(sizeof(variable)) { \
251 case 1: stem##1(variable, __VA_ARGS__);break; \ 249 case 1: stem##1(variable, __VA_ARGS__);break; \
252 case 2: stem##2(variable, __VA_ARGS__);break; \ 250 case 2: stem##2(variable, __VA_ARGS__);break; \
@@ -259,8 +257,7 @@ do { \
259 257
260/* 258/*
261 * Optimized manipulation for memory allocated through the per cpu 259 * Optimized manipulation for memory allocated through the per cpu
262 * allocator or for addresses of per cpu variables (can be determined 260 * allocator or for addresses of per cpu variables.
263 * using per_cpu_var(xx).
264 * 261 *
265 * These operation guarantee exclusivity of access for other operations 262 * These operation guarantee exclusivity of access for other operations
266 * on the *same* processor. The assumption is that per cpu data is only 263 * on the *same* processor. The assumption is that per cpu data is only
@@ -311,7 +308,7 @@ do { \
311#define _this_cpu_generic_to_op(pcp, val, op) \ 308#define _this_cpu_generic_to_op(pcp, val, op) \
312do { \ 309do { \
313 preempt_disable(); \ 310 preempt_disable(); \
314 *__this_cpu_ptr(&pcp) op val; \ 311 *__this_cpu_ptr(&(pcp)) op val; \
315 preempt_enable(); \ 312 preempt_enable(); \
316} while (0) 313} while (0)
317 314
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index a7684a513994..c88d67b59394 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -21,7 +21,7 @@ struct percpu_counter {
21#ifdef CONFIG_HOTPLUG_CPU 21#ifdef CONFIG_HOTPLUG_CPU
22 struct list_head list; /* All percpu_counters are on a list */ 22 struct list_head list; /* All percpu_counters are on a list */
23#endif 23#endif
24 s32 *counters; 24 s32 __percpu *counters;
25}; 25};
26 26
27extern int percpu_counter_batch; 27extern int percpu_counter_batch;
@@ -98,9 +98,6 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
98 fbc->count = amount; 98 fbc->count = amount;
99} 99}
100 100
101#define __percpu_counter_add(fbc, amount, batch) \
102 percpu_counter_add(fbc, amount)
103
104static inline void 101static inline void
105percpu_counter_add(struct percpu_counter *fbc, s64 amount) 102percpu_counter_add(struct percpu_counter *fbc, s64 amount)
106{ 103{
@@ -109,6 +106,12 @@ percpu_counter_add(struct percpu_counter *fbc, s64 amount)
109 preempt_enable(); 106 preempt_enable();
110} 107}
111 108
109static inline void
110__percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
111{
112 percpu_counter_add(fbc, amount);
113}
114
112static inline s64 percpu_counter_read(struct percpu_counter *fbc) 115static inline s64 percpu_counter_read(struct percpu_counter *fbc)
113{ 116{
114 return fbc->count; 117 return fbc->count;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8fa71874113f..5d0266d94985 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -203,19 +203,28 @@ struct perf_event_attr {
203 enable_on_exec : 1, /* next exec enables */ 203 enable_on_exec : 1, /* next exec enables */
204 task : 1, /* trace fork/exit */ 204 task : 1, /* trace fork/exit */
205 watermark : 1, /* wakeup_watermark */ 205 watermark : 1, /* wakeup_watermark */
206 206 /*
207 __reserved_1 : 49; 207 * precise_ip:
208 *
209 * 0 - SAMPLE_IP can have arbitrary skid
210 * 1 - SAMPLE_IP must have constant skid
211 * 2 - SAMPLE_IP requested to have 0 skid
212 * 3 - SAMPLE_IP must have 0 skid
213 *
214 * See also PERF_RECORD_MISC_EXACT_IP
215 */
216 precise_ip : 2, /* skid constraint */
217
218 __reserved_1 : 47;
208 219
209 union { 220 union {
210 __u32 wakeup_events; /* wakeup every n events */ 221 __u32 wakeup_events; /* wakeup every n events */
211 __u32 wakeup_watermark; /* bytes before wakeup */ 222 __u32 wakeup_watermark; /* bytes before wakeup */
212 }; 223 };
213 224
214 __u32 __reserved_2;
215
216 __u64 bp_addr;
217 __u32 bp_type; 225 __u32 bp_type;
218 __u32 bp_len; 226 __u64 bp_addr;
227 __u64 bp_len;
219}; 228};
220 229
221/* 230/*
@@ -289,11 +298,24 @@ struct perf_event_mmap_page {
289 __u64 data_tail; /* user-space written tail */ 298 __u64 data_tail; /* user-space written tail */
290}; 299};
291 300
292#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) 301#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
293#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) 302#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
294#define PERF_RECORD_MISC_KERNEL (1 << 0) 303#define PERF_RECORD_MISC_KERNEL (1 << 0)
295#define PERF_RECORD_MISC_USER (2 << 0) 304#define PERF_RECORD_MISC_USER (2 << 0)
296#define PERF_RECORD_MISC_HYPERVISOR (3 << 0) 305#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
306#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
307#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
308
309/*
310 * Indicates that the content of PERF_SAMPLE_IP points to
311 * the actual instruction that triggered the event. See also
312 * perf_event_attr::precise_ip.
313 */
314#define PERF_RECORD_MISC_EXACT_IP (1 << 14)
315/*
316 * Reserve the last bit to indicate some extended misc field
317 */
318#define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
297 319
298struct perf_event_header { 320struct perf_event_header {
299 __u32 type; 321 __u32 type;
@@ -356,8 +378,8 @@ enum perf_event_type {
356 * u64 stream_id; 378 * u64 stream_id;
357 * }; 379 * };
358 */ 380 */
359 PERF_RECORD_THROTTLE = 5, 381 PERF_RECORD_THROTTLE = 5,
360 PERF_RECORD_UNTHROTTLE = 6, 382 PERF_RECORD_UNTHROTTLE = 6,
361 383
362 /* 384 /*
363 * struct { 385 * struct {
@@ -371,10 +393,10 @@ enum perf_event_type {
371 393
372 /* 394 /*
373 * struct { 395 * struct {
374 * struct perf_event_header header; 396 * struct perf_event_header header;
375 * u32 pid, tid; 397 * u32 pid, tid;
376 * 398 *
377 * struct read_format values; 399 * struct read_format values;
378 * }; 400 * };
379 */ 401 */
380 PERF_RECORD_READ = 8, 402 PERF_RECORD_READ = 8,
@@ -412,7 +434,7 @@ enum perf_event_type {
412 * char data[size];}&& PERF_SAMPLE_RAW 434 * char data[size];}&& PERF_SAMPLE_RAW
413 * }; 435 * };
414 */ 436 */
415 PERF_RECORD_SAMPLE = 9, 437 PERF_RECORD_SAMPLE = 9,
416 438
417 PERF_RECORD_MAX, /* non-ABI */ 439 PERF_RECORD_MAX, /* non-ABI */
418}; 440};
@@ -441,6 +463,12 @@ enum perf_callchain_context {
441# include <asm/perf_event.h> 463# include <asm/perf_event.h>
442#endif 464#endif
443 465
466struct perf_guest_info_callbacks {
467 int (*is_in_guest) (void);
468 int (*is_user_mode) (void);
469 unsigned long (*get_guest_ip) (void);
470};
471
444#ifdef CONFIG_HAVE_HW_BREAKPOINT 472#ifdef CONFIG_HAVE_HW_BREAKPOINT
445#include <asm/hw_breakpoint.h> 473#include <asm/hw_breakpoint.h>
446#endif 474#endif
@@ -454,7 +482,10 @@ enum perf_callchain_context {
454#include <linux/fs.h> 482#include <linux/fs.h>
455#include <linux/pid_namespace.h> 483#include <linux/pid_namespace.h>
456#include <linux/workqueue.h> 484#include <linux/workqueue.h>
485#include <linux/ftrace.h>
486#include <linux/cpu.h>
457#include <asm/atomic.h> 487#include <asm/atomic.h>
488#include <asm/local.h>
458 489
459#define PERF_MAX_STACK_DEPTH 255 490#define PERF_MAX_STACK_DEPTH 255
460 491
@@ -468,6 +499,17 @@ struct perf_raw_record {
468 void *data; 499 void *data;
469}; 500};
470 501
502struct perf_branch_entry {
503 __u64 from;
504 __u64 to;
505 __u64 flags;
506};
507
508struct perf_branch_stack {
509 __u64 nr;
510 struct perf_branch_entry entries[0];
511};
512
471struct task_struct; 513struct task_struct;
472 514
473/** 515/**
@@ -478,18 +520,19 @@ struct hw_perf_event {
478 union { 520 union {
479 struct { /* hardware */ 521 struct { /* hardware */
480 u64 config; 522 u64 config;
523 u64 last_tag;
481 unsigned long config_base; 524 unsigned long config_base;
482 unsigned long event_base; 525 unsigned long event_base;
483 int idx; 526 int idx;
527 int last_cpu;
484 }; 528 };
485 struct { /* software */ 529 struct { /* software */
486 s64 remaining; 530 s64 remaining;
487 struct hrtimer hrtimer; 531 struct hrtimer hrtimer;
488 }; 532 };
489#ifdef CONFIG_HAVE_HW_BREAKPOINT 533#ifdef CONFIG_HAVE_HW_BREAKPOINT
490 union { /* breakpoint */ 534 /* breakpoint */
491 struct arch_hw_breakpoint info; 535 struct arch_hw_breakpoint info;
492 };
493#endif 536#endif
494 }; 537 };
495 atomic64_t prev_count; 538 atomic64_t prev_count;
@@ -498,22 +541,35 @@ struct hw_perf_event {
498 atomic64_t period_left; 541 atomic64_t period_left;
499 u64 interrupts; 542 u64 interrupts;
500 543
501 u64 freq_count; 544 u64 freq_time_stamp;
502 u64 freq_interrupts; 545 u64 freq_count_stamp;
503 u64 freq_stamp;
504#endif 546#endif
505}; 547};
506 548
507struct perf_event; 549struct perf_event;
508 550
551#define PERF_EVENT_TXN_STARTED 1
552
509/** 553/**
510 * struct pmu - generic performance monitoring unit 554 * struct pmu - generic performance monitoring unit
511 */ 555 */
512struct pmu { 556struct pmu {
513 int (*enable) (struct perf_event *event); 557 int (*enable) (struct perf_event *event);
514 void (*disable) (struct perf_event *event); 558 void (*disable) (struct perf_event *event);
559 int (*start) (struct perf_event *event);
560 void (*stop) (struct perf_event *event);
515 void (*read) (struct perf_event *event); 561 void (*read) (struct perf_event *event);
516 void (*unthrottle) (struct perf_event *event); 562 void (*unthrottle) (struct perf_event *event);
563
564 /*
565 * group events scheduling is treated as a transaction,
566 * add group events as a whole and perform one schedulability test.
567 * If test fails, roll back the whole group
568 */
569
570 void (*start_txn) (const struct pmu *pmu);
571 void (*cancel_txn) (const struct pmu *pmu);
572 int (*commit_txn) (const struct pmu *pmu);
517}; 573};
518 574
519/** 575/**
@@ -529,24 +585,22 @@ enum perf_event_active_state {
529struct file; 585struct file;
530 586
531struct perf_mmap_data { 587struct perf_mmap_data {
588 atomic_t refcount;
532 struct rcu_head rcu_head; 589 struct rcu_head rcu_head;
533#ifdef CONFIG_PERF_USE_VMALLOC 590#ifdef CONFIG_PERF_USE_VMALLOC
534 struct work_struct work; 591 struct work_struct work;
592 int page_order; /* allocation order */
535#endif 593#endif
536 int data_order;
537 int nr_pages; /* nr of data pages */ 594 int nr_pages; /* nr of data pages */
538 int writable; /* are we writable */ 595 int writable; /* are we writable */
539 int nr_locked; /* nr pages mlocked */
540 596
541 atomic_t poll; /* POLL_ for wakeups */ 597 atomic_t poll; /* POLL_ for wakeups */
542 atomic_t events; /* event_id limit */
543 598
544 atomic_long_t head; /* write position */ 599 local_t head; /* write position */
545 atomic_long_t done_head; /* completed head */ 600 local_t nest; /* nested writers */
546 601 local_t events; /* event limit */
547 atomic_t lock; /* concurrent writes */ 602 local_t wakeup; /* wakeup stamp */
548 atomic_t wakeup; /* needs a wakeup */ 603 local_t lost; /* nr records lost */
549 atomic_t lost; /* nr records lost */
550 604
551 long watermark; /* wakeup watermark */ 605 long watermark; /* wakeup watermark */
552 606
@@ -565,6 +619,21 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
565 struct perf_sample_data *, 619 struct perf_sample_data *,
566 struct pt_regs *regs); 620 struct pt_regs *regs);
567 621
622enum perf_group_flag {
623 PERF_GROUP_SOFTWARE = 0x1,
624};
625
626#define SWEVENT_HLIST_BITS 8
627#define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS)
628
629struct swevent_hlist {
630 struct hlist_head heads[SWEVENT_HLIST_SIZE];
631 struct rcu_head rcu_head;
632};
633
634#define PERF_ATTACH_CONTEXT 0x01
635#define PERF_ATTACH_GROUP 0x02
636
568/** 637/**
569 * struct perf_event - performance event kernel representation: 638 * struct perf_event - performance event kernel representation:
570 */ 639 */
@@ -573,12 +642,14 @@ struct perf_event {
573 struct list_head group_entry; 642 struct list_head group_entry;
574 struct list_head event_entry; 643 struct list_head event_entry;
575 struct list_head sibling_list; 644 struct list_head sibling_list;
645 struct hlist_node hlist_entry;
576 int nr_siblings; 646 int nr_siblings;
647 int group_flags;
577 struct perf_event *group_leader; 648 struct perf_event *group_leader;
578 struct perf_event *output;
579 const struct pmu *pmu; 649 const struct pmu *pmu;
580 650
581 enum perf_event_active_state state; 651 enum perf_event_active_state state;
652 unsigned int attach_state;
582 atomic64_t count; 653 atomic64_t count;
583 654
584 /* 655 /*
@@ -636,6 +707,8 @@ struct perf_event {
636 /* mmap bits */ 707 /* mmap bits */
637 struct mutex mmap_mutex; 708 struct mutex mmap_mutex;
638 atomic_t mmap_count; 709 atomic_t mmap_count;
710 int mmap_locked;
711 struct user_struct *mmap_user;
639 struct perf_mmap_data *data; 712 struct perf_mmap_data *data;
640 713
641 /* poll related */ 714 /* poll related */
@@ -658,7 +731,8 @@ struct perf_event {
658 731
659 perf_overflow_handler_t overflow_handler; 732 perf_overflow_handler_t overflow_handler;
660 733
661#ifdef CONFIG_EVENT_PROFILE 734#ifdef CONFIG_EVENT_TRACING
735 struct ftrace_event_call *tp_event;
662 struct event_filter *filter; 736 struct event_filter *filter;
663#endif 737#endif
664 738
@@ -683,7 +757,8 @@ struct perf_event_context {
683 */ 757 */
684 struct mutex mutex; 758 struct mutex mutex;
685 759
686 struct list_head group_list; 760 struct list_head pinned_groups;
761 struct list_head flexible_groups;
687 struct list_head event_list; 762 struct list_head event_list;
688 int nr_events; 763 int nr_events;
689 int nr_active; 764 int nr_active;
@@ -718,6 +793,9 @@ struct perf_cpu_context {
718 int active_oncpu; 793 int active_oncpu;
719 int max_pertask; 794 int max_pertask;
720 int exclusive; 795 int exclusive;
796 struct swevent_hlist *swevent_hlist;
797 struct mutex hlist_mutex;
798 int hlist_refcount;
721 799
722 /* 800 /*
723 * Recursion avoidance: 801 * Recursion avoidance:
@@ -730,11 +808,12 @@ struct perf_cpu_context {
730struct perf_output_handle { 808struct perf_output_handle {
731 struct perf_event *event; 809 struct perf_event *event;
732 struct perf_mmap_data *data; 810 struct perf_mmap_data *data;
733 unsigned long head; 811 unsigned long wakeup;
734 unsigned long offset; 812 unsigned long size;
813 void *addr;
814 int page;
735 int nmi; 815 int nmi;
736 int sample; 816 int sample;
737 int locked;
738}; 817};
739 818
740#ifdef CONFIG_PERF_EVENTS 819#ifdef CONFIG_PERF_EVENTS
@@ -746,10 +825,9 @@ extern int perf_max_events;
746 825
747extern const struct pmu *hw_perf_event_init(struct perf_event *event); 826extern const struct pmu *hw_perf_event_init(struct perf_event *event);
748 827
749extern void perf_event_task_sched_in(struct task_struct *task, int cpu); 828extern void perf_event_task_sched_in(struct task_struct *task);
750extern void perf_event_task_sched_out(struct task_struct *task, 829extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
751 struct task_struct *next, int cpu); 830extern void perf_event_task_tick(struct task_struct *task);
752extern void perf_event_task_tick(struct task_struct *task, int cpu);
753extern int perf_event_init_task(struct task_struct *child); 831extern int perf_event_init_task(struct task_struct *child);
754extern void perf_event_exit_task(struct task_struct *child); 832extern void perf_event_exit_task(struct task_struct *child);
755extern void perf_event_free_task(struct task_struct *task); 833extern void perf_event_free_task(struct task_struct *task);
@@ -762,9 +840,6 @@ extern void perf_disable(void);
762extern void perf_enable(void); 840extern void perf_enable(void);
763extern int perf_event_task_disable(void); 841extern int perf_event_task_disable(void);
764extern int perf_event_task_enable(void); 842extern int perf_event_task_enable(void);
765extern int hw_perf_group_sched_in(struct perf_event *group_leader,
766 struct perf_cpu_context *cpuctx,
767 struct perf_event_context *ctx, int cpu);
768extern void perf_event_update_userpage(struct perf_event *event); 843extern void perf_event_update_userpage(struct perf_event *event);
769extern int perf_event_release_kernel(struct perf_event *event); 844extern int perf_event_release_kernel(struct perf_event *event);
770extern struct perf_event * 845extern struct perf_event *
@@ -796,6 +871,13 @@ struct perf_sample_data {
796 struct perf_raw_record *raw; 871 struct perf_raw_record *raw;
797}; 872};
798 873
874static inline
875void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
876{
877 data->addr = addr;
878 data->raw = NULL;
879}
880
799extern void perf_output_sample(struct perf_output_handle *handle, 881extern void perf_output_sample(struct perf_output_handle *handle,
800 struct perf_event_header *header, 882 struct perf_event_header *header,
801 struct perf_sample_data *data, 883 struct perf_sample_data *data,
@@ -828,11 +910,56 @@ extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
828 910
829extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); 911extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
830 912
913extern void
914perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip);
915
916/*
917 * Take a snapshot of the regs. Skip ip and frame pointer to
918 * the nth caller. We only need a few of the regs:
919 * - ip for PERF_SAMPLE_IP
920 * - cs for user_mode() tests
921 * - bp for callchains
922 * - eflags, for future purposes, just in case
923 */
924static inline void perf_fetch_caller_regs(struct pt_regs *regs, int skip)
925{
926 unsigned long ip;
927
928 memset(regs, 0, sizeof(*regs));
929
930 switch (skip) {
931 case 1 :
932 ip = CALLER_ADDR0;
933 break;
934 case 2 :
935 ip = CALLER_ADDR1;
936 break;
937 case 3 :
938 ip = CALLER_ADDR2;
939 break;
940 case 4:
941 ip = CALLER_ADDR3;
942 break;
943 /* No need to support further for now */
944 default:
945 ip = 0;
946 }
947
948 return perf_arch_fetch_caller_regs(regs, ip, skip);
949}
950
831static inline void 951static inline void
832perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) 952perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
833{ 953{
834 if (atomic_read(&perf_swevent_enabled[event_id])) 954 if (atomic_read(&perf_swevent_enabled[event_id])) {
955 struct pt_regs hot_regs;
956
957 if (!regs) {
958 perf_fetch_caller_regs(&hot_regs, 1);
959 regs = &hot_regs;
960 }
835 __perf_sw_event(event_id, nr, nmi, regs, addr); 961 __perf_sw_event(event_id, nr, nmi, regs, addr);
962 }
836} 963}
837 964
838extern void __perf_event_mmap(struct vm_area_struct *vma); 965extern void __perf_event_mmap(struct vm_area_struct *vma);
@@ -843,6 +970,10 @@ static inline void perf_event_mmap(struct vm_area_struct *vma)
843 __perf_event_mmap(vma); 970 __perf_event_mmap(vma);
844} 971}
845 972
973extern struct perf_guest_info_callbacks *perf_guest_cbs;
974extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
975extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
976
846extern void perf_event_comm(struct task_struct *tsk); 977extern void perf_event_comm(struct task_struct *tsk);
847extern void perf_event_fork(struct task_struct *tsk); 978extern void perf_event_fork(struct task_struct *tsk);
848 979
@@ -852,9 +983,25 @@ extern int sysctl_perf_event_paranoid;
852extern int sysctl_perf_event_mlock; 983extern int sysctl_perf_event_mlock;
853extern int sysctl_perf_event_sample_rate; 984extern int sysctl_perf_event_sample_rate;
854 985
986static inline bool perf_paranoid_tracepoint_raw(void)
987{
988 return sysctl_perf_event_paranoid > -1;
989}
990
991static inline bool perf_paranoid_cpu(void)
992{
993 return sysctl_perf_event_paranoid > 0;
994}
995
996static inline bool perf_paranoid_kernel(void)
997{
998 return sysctl_perf_event_paranoid > 1;
999}
1000
855extern void perf_event_init(void); 1001extern void perf_event_init(void);
856extern void perf_tp_event(int event_id, u64 addr, u64 count, 1002extern void perf_tp_event(u64 addr, u64 count, void *record,
857 void *record, int entry_size); 1003 int entry_size, struct pt_regs *regs,
1004 struct hlist_head *head);
858extern void perf_bp_event(struct perf_event *event, void *data); 1005extern void perf_bp_event(struct perf_event *event, void *data);
859 1006
860#ifndef perf_misc_flags 1007#ifndef perf_misc_flags
@@ -875,12 +1022,12 @@ extern void perf_event_enable(struct perf_event *event);
875extern void perf_event_disable(struct perf_event *event); 1022extern void perf_event_disable(struct perf_event *event);
876#else 1023#else
877static inline void 1024static inline void
878perf_event_task_sched_in(struct task_struct *task, int cpu) { } 1025perf_event_task_sched_in(struct task_struct *task) { }
879static inline void 1026static inline void
880perf_event_task_sched_out(struct task_struct *task, 1027perf_event_task_sched_out(struct task_struct *task,
881 struct task_struct *next, int cpu) { } 1028 struct task_struct *next) { }
882static inline void 1029static inline void
883perf_event_task_tick(struct task_struct *task, int cpu) { } 1030perf_event_task_tick(struct task_struct *task) { }
884static inline int perf_event_init_task(struct task_struct *child) { return 0; } 1031static inline int perf_event_init_task(struct task_struct *child) { return 0; }
885static inline void perf_event_exit_task(struct task_struct *child) { } 1032static inline void perf_event_exit_task(struct task_struct *child) { }
886static inline void perf_event_free_task(struct task_struct *task) { } 1033static inline void perf_event_free_task(struct task_struct *task) { }
@@ -895,13 +1042,18 @@ static inline void
895perf_sw_event(u32 event_id, u64 nr, int nmi, 1042perf_sw_event(u32 event_id, u64 nr, int nmi,
896 struct pt_regs *regs, u64 addr) { } 1043 struct pt_regs *regs, u64 addr) { }
897static inline void 1044static inline void
898perf_bp_event(struct perf_event *event, void *data) { } 1045perf_bp_event(struct perf_event *event, void *data) { }
1046
1047static inline int perf_register_guest_info_callbacks
1048(struct perf_guest_info_callbacks *callbacks) { return 0; }
1049static inline int perf_unregister_guest_info_callbacks
1050(struct perf_guest_info_callbacks *callbacks) { return 0; }
899 1051
900static inline void perf_event_mmap(struct vm_area_struct *vma) { } 1052static inline void perf_event_mmap(struct vm_area_struct *vma) { }
901static inline void perf_event_comm(struct task_struct *tsk) { } 1053static inline void perf_event_comm(struct task_struct *tsk) { }
902static inline void perf_event_fork(struct task_struct *tsk) { } 1054static inline void perf_event_fork(struct task_struct *tsk) { }
903static inline void perf_event_init(void) { } 1055static inline void perf_event_init(void) { }
904static inline int perf_swevent_get_recursion_context(void) { return -1; } 1056static inline int perf_swevent_get_recursion_context(void) { return -1; }
905static inline void perf_swevent_put_recursion_context(int rctx) { } 1057static inline void perf_swevent_put_recursion_context(int rctx) { }
906static inline void perf_event_enable(struct perf_event *event) { } 1058static inline void perf_event_enable(struct perf_event *event) { }
907static inline void perf_event_disable(struct perf_event *event) { } 1059static inline void perf_event_disable(struct perf_event *event) { }
@@ -910,5 +1062,21 @@ static inline void perf_event_disable(struct perf_event *event) { }
910#define perf_output_put(handle, x) \ 1062#define perf_output_put(handle, x) \
911 perf_output_copy((handle), &(x), sizeof(x)) 1063 perf_output_copy((handle), &(x), sizeof(x))
912 1064
1065/*
1066 * This has to have a higher priority than migration_notifier in sched.c.
1067 */
1068#define perf_cpu_notifier(fn) \
1069do { \
1070 static struct notifier_block fn##_nb __cpuinitdata = \
1071 { .notifier_call = fn, .priority = 20 }; \
1072 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
1073 (void *)(unsigned long)smp_processor_id()); \
1074 fn(&fn##_nb, (unsigned long)CPU_STARTING, \
1075 (void *)(unsigned long)smp_processor_id()); \
1076 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \
1077 (void *)(unsigned long)smp_processor_id()); \
1078 register_cpu_notifier(&fn##_nb); \
1079} while (0)
1080
913#endif /* __KERNEL__ */ 1081#endif /* __KERNEL__ */
914#endif /* _LINUX_PERF_EVENT_H */ 1082#endif /* _LINUX_PERF_EVENT_H */
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 126120819a0d..eec3bae164d4 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -12,7 +12,7 @@ struct pt_regs;
12 12
13extern int register_exec_domain(struct exec_domain *); 13extern int register_exec_domain(struct exec_domain *);
14extern int unregister_exec_domain(struct exec_domain *); 14extern int unregister_exec_domain(struct exec_domain *);
15extern int __set_personality(unsigned long); 15extern int __set_personality(unsigned int);
16 16
17#endif /* __KERNEL__ */ 17#endif /* __KERNEL__ */
18 18
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 228b0b6306b0..0b80c806631f 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -315,6 +315,7 @@ struct sadb_x_kmaddress {
315#define SADB_X_EALG_AES_GCM_ICV12 19 315#define SADB_X_EALG_AES_GCM_ICV12 19
316#define SADB_X_EALG_AES_GCM_ICV16 20 316#define SADB_X_EALG_AES_GCM_ICV16 20
317#define SADB_X_EALG_CAMELLIACBC 22 317#define SADB_X_EALG_CAMELLIACBC 22
318#define SADB_X_EALG_NULL_AES_GMAC 23
318#define SADB_EALG_MAX 253 /* last EALG */ 319#define SADB_EALG_MAX 253 /* last EALG */
319/* private allocations should use 249-255 (RFC2407) */ 320/* private allocations should use 249-255 (RFC2407) */
320#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ 321#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6a7eb402165d..987e111f7b11 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -24,6 +24,7 @@
24#include <linux/mii.h> 24#include <linux/mii.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/mod_devicetable.h>
27 28
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29 30
@@ -81,6 +82,10 @@ typedef enum {
81 */ 82 */
82#define MII_BUS_ID_SIZE (20 - 3) 83#define MII_BUS_ID_SIZE (20 - 3)
83 84
85/* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit
86 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
87#define MII_ADDR_C45 (1<<30)
88
84/* 89/*
85 * The Bus class for PHYs. Devices which provide access to 90 * The Bus class for PHYs. Devices which provide access to
86 * PHYs should register using this structure 91 * PHYs should register using this structure
@@ -127,8 +132,8 @@ int mdiobus_register(struct mii_bus *bus);
127void mdiobus_unregister(struct mii_bus *bus); 132void mdiobus_unregister(struct mii_bus *bus);
128void mdiobus_free(struct mii_bus *bus); 133void mdiobus_free(struct mii_bus *bus);
129struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 134struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
130int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); 135int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
131int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); 136int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
132 137
133 138
134#define PHY_INTERRUPT_DISABLED 0x0 139#define PHY_INTERRUPT_DISABLED 0x0
@@ -422,7 +427,7 @@ struct phy_fixup {
422 * because the bus read/write functions may wait for an interrupt 427 * because the bus read/write functions may wait for an interrupt
423 * to conclude the operation. 428 * to conclude the operation.
424 */ 429 */
425static inline int phy_read(struct phy_device *phydev, u16 regnum) 430static inline int phy_read(struct phy_device *phydev, u32 regnum)
426{ 431{
427 return mdiobus_read(phydev->bus, phydev->addr, regnum); 432 return mdiobus_read(phydev->bus, phydev->addr, regnum);
428} 433}
@@ -437,7 +442,7 @@ static inline int phy_read(struct phy_device *phydev, u16 regnum)
437 * because the bus read/write functions may wait for an interrupt 442 * because the bus read/write functions may wait for an interrupt
438 * to conclude the operation. 443 * to conclude the operation.
439 */ 444 */
440static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) 445static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
441{ 446{
442 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 447 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
443} 448}
@@ -452,6 +457,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
452 u32 flags, phy_interface_t interface); 457 u32 flags, phy_interface_t interface);
453struct phy_device * phy_attach(struct net_device *dev, 458struct phy_device * phy_attach(struct net_device *dev,
454 const char *bus_id, u32 flags, phy_interface_t interface); 459 const char *bus_id, u32 flags, phy_interface_t interface);
460struct phy_device *phy_find_first(struct mii_bus *bus);
455int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, 461int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
456 void (*handler)(struct net_device *), u32 flags, 462 void (*handler)(struct net_device *), u32 flags,
457 phy_interface_t interface); 463 phy_interface_t interface);
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index b43a9e039059..445796945ac9 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -3,7 +3,7 @@
3 3
4#define PIPEFS_MAGIC 0x50495045 4#define PIPEFS_MAGIC 0x50495045
5 5
6#define PIPE_BUFFERS (16) 6#define PIPE_DEF_BUFFERS 16
7 7
8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ 8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ 9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
@@ -44,17 +44,17 @@ struct pipe_buffer {
44 **/ 44 **/
45struct pipe_inode_info { 45struct pipe_inode_info {
46 wait_queue_head_t wait; 46 wait_queue_head_t wait;
47 unsigned int nrbufs, curbuf; 47 unsigned int nrbufs, curbuf, buffers;
48 struct page *tmp_page;
49 unsigned int readers; 48 unsigned int readers;
50 unsigned int writers; 49 unsigned int writers;
51 unsigned int waiting_writers; 50 unsigned int waiting_writers;
52 unsigned int r_counter; 51 unsigned int r_counter;
53 unsigned int w_counter; 52 unsigned int w_counter;
53 struct page *tmp_page;
54 struct fasync_struct *fasync_readers; 54 struct fasync_struct *fasync_readers;
55 struct fasync_struct *fasync_writers; 55 struct fasync_struct *fasync_writers;
56 struct inode *inode; 56 struct inode *inode;
57 struct pipe_buffer bufs[PIPE_BUFFERS]; 57 struct pipe_buffer *bufs;
58}; 58};
59 59
60/* 60/*
@@ -139,6 +139,10 @@ void pipe_lock(struct pipe_inode_info *);
139void pipe_unlock(struct pipe_inode_info *); 139void pipe_unlock(struct pipe_inode_info *);
140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *); 140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
141 141
142extern unsigned int pipe_max_size, pipe_min_size;
143int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);
144
145
142/* Drop the inode semaphore and wait for a pipe event, atomically */ 146/* Drop the inode semaphore and wait for a pipe event, atomically */
143void pipe_wait(struct pipe_inode_info *pipe); 147void pipe_wait(struct pipe_inode_info *pipe);
144 148
@@ -154,4 +158,7 @@ int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
154int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 158int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
155void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); 159void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
156 160
161/* for F_SETPIPE_SZ and F_GETPIPE_SZ */
162long pipe_fcntl(struct file *, unsigned int, unsigned long arg);
163
157#endif 164#endif
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 76e5053e1fac..721301b0a908 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -163,10 +163,8 @@ struct packet_iosched
163 atomic_t attention; /* Set to non-zero when queue processing is needed */ 163 atomic_t attention; /* Set to non-zero when queue processing is needed */
164 int writing; /* Non-zero when writing, zero when reading */ 164 int writing; /* Non-zero when writing, zero when reading */
165 spinlock_t lock; /* Protecting read/write queue manipulations */ 165 spinlock_t lock; /* Protecting read/write queue manipulations */
166 struct bio *read_queue; 166 struct bio_list read_queue;
167 struct bio *read_queue_tail; 167 struct bio_list write_queue;
168 struct bio *write_queue;
169 struct bio *write_queue_tail;
170 sector_t last_write; /* The sector where the last write ended */ 168 sector_t last_write; /* The sector where the last write ended */
171 int successive_reads; 169 int successive_reads;
172}; 170};
@@ -206,8 +204,8 @@ struct packet_data
206 spinlock_t lock; /* Lock protecting state transitions and */ 204 spinlock_t lock; /* Lock protecting state transitions and */
207 /* orig_bios list */ 205 /* orig_bios list */
208 206
209 struct bio *orig_bios; /* Original bios passed to pkt_make_request */ 207 struct bio_list orig_bios; /* Original bios passed to pkt_make_request */
210 struct bio *orig_bios_tail;/* that will be handled by this packet */ 208 /* that will be handled by this packet */
211 int write_size; /* Total size of all bios in the orig_bios */ 209 int write_size; /* Total size of all bios in the orig_bios */
212 /* list, measured in number of frames */ 210 /* list, measured in number of frames */
213 211
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 71ff887ca44e..5417944d3687 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -21,7 +21,7 @@ struct platform_device {
21 u32 num_resources; 21 u32 num_resources;
22 struct resource * resource; 22 struct resource * resource;
23 23
24 struct platform_device_id *id_entry; 24 const struct platform_device_id *id_entry;
25 25
26 /* arch specific additions */ 26 /* arch specific additions */
27 struct pdev_archdata archdata; 27 struct pdev_archdata archdata;
@@ -44,12 +44,14 @@ extern int platform_get_irq_byname(struct platform_device *, const char *);
44extern int platform_add_devices(struct platform_device **, int); 44extern int platform_add_devices(struct platform_device **, int);
45 45
46extern struct platform_device *platform_device_register_simple(const char *, int id, 46extern struct platform_device *platform_device_register_simple(const char *, int id,
47 struct resource *, unsigned int); 47 const struct resource *, unsigned int);
48extern struct platform_device *platform_device_register_data(struct device *, 48extern struct platform_device *platform_device_register_data(struct device *,
49 const char *, int, const void *, size_t); 49 const char *, int, const void *, size_t);
50 50
51extern struct platform_device *platform_device_alloc(const char *name, int id); 51extern struct platform_device *platform_device_alloc(const char *name, int id);
52extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 52extern int platform_device_add_resources(struct platform_device *pdev,
53 const struct resource *res,
54 unsigned int num);
53extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); 55extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size);
54extern int platform_device_add(struct platform_device *pdev); 56extern int platform_device_add(struct platform_device *pdev);
55extern void platform_device_del(struct platform_device *pdev); 57extern void platform_device_del(struct platform_device *pdev);
@@ -62,7 +64,7 @@ struct platform_driver {
62 int (*suspend)(struct platform_device *, pm_message_t state); 64 int (*suspend)(struct platform_device *, pm_message_t state);
63 int (*resume)(struct platform_device *); 65 int (*resume)(struct platform_device *);
64 struct device_driver driver; 66 struct device_driver driver;
65 struct platform_device_id *id_table; 67 const struct platform_device_id *id_table;
66}; 68};
67 69
68extern int platform_driver_register(struct platform_driver *); 70extern int platform_driver_register(struct platform_driver *);
@@ -77,6 +79,11 @@ extern int platform_driver_probe(struct platform_driver *driver,
77#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 79#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
78#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 80#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data))
79 81
82extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
83 int (*probe)(struct platform_device *),
84 struct resource *res, unsigned int n_res,
85 const void *data, size_t size);
86
80/* early platform driver interface */ 87/* early platform driver interface */
81struct early_platform_driver { 88struct early_platform_driver {
82 const char *class_str; 89 const char *class_str;
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 8227f717c70f..6898985e7b38 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -45,7 +45,7 @@
45 * the insertion of new nodes. There are no nodes with duplicate 45 * the insertion of new nodes. There are no nodes with duplicate
46 * priorites on the list. 46 * priorites on the list.
47 * 47 *
48 * The nodes on the node_list is ordered by priority and can contain 48 * The nodes on the node_list are ordered by priority and can contain
49 * entries which have the same priority. Those entries are ordered 49 * entries which have the same priority. Those entries are ordered
50 * FIFO 50 * FIFO
51 * 51 *
@@ -265,7 +265,7 @@ static inline int plist_node_empty(const struct plist_node *node)
265 * 265 *
266 * Assumes the plist is _not_ empty. 266 * Assumes the plist is _not_ empty.
267 */ 267 */
268static inline struct plist_node* plist_first(const struct plist_head *head) 268static inline struct plist_node *plist_first(const struct plist_head *head)
269{ 269{
270 return list_entry(head->node_list.next, 270 return list_entry(head->node_list.next,
271 struct plist_node, plist.node_list); 271 struct plist_node, plist.node_list);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 198b8f9fe05e..8e258c727971 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -26,6 +26,7 @@
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/timer.h> 28#include <linux/timer.h>
29#include <linux/completion.h>
29 30
30/* 31/*
31 * Callbacks for platform drivers to implement. 32 * Callbacks for platform drivers to implement.
@@ -214,20 +215,59 @@ struct dev_pm_ops {
214 int (*runtime_idle)(struct device *dev); 215 int (*runtime_idle)(struct device *dev);
215}; 216};
216 217
218#ifdef CONFIG_PM_SLEEP
219#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
220 .suspend = suspend_fn, \
221 .resume = resume_fn, \
222 .freeze = suspend_fn, \
223 .thaw = resume_fn, \
224 .poweroff = suspend_fn, \
225 .restore = resume_fn,
226#else
227#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
228#endif
229
230#ifdef CONFIG_PM_RUNTIME
231#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
232 .runtime_suspend = suspend_fn, \
233 .runtime_resume = resume_fn, \
234 .runtime_idle = idle_fn,
235#else
236#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
237#endif
238
217/* 239/*
218 * Use this if you want to use the same suspend and resume callbacks for suspend 240 * Use this if you want to use the same suspend and resume callbacks for suspend
219 * to RAM and hibernation. 241 * to RAM and hibernation.
220 */ 242 */
221#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ 243#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
222const struct dev_pm_ops name = { \ 244const struct dev_pm_ops name = { \
223 .suspend = suspend_fn, \ 245 SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
224 .resume = resume_fn, \ 246}
225 .freeze = suspend_fn, \ 247
226 .thaw = resume_fn, \ 248/*
227 .poweroff = suspend_fn, \ 249 * Use this for defining a set of PM operations to be used in all situations
228 .restore = resume_fn, \ 250 * (sustem suspend, hibernation or runtime PM).
251 */
252#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
253const struct dev_pm_ops name = { \
254 SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
255 SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
229} 256}
230 257
258/*
259 * Use this for subsystems (bus types, device types, device classes) that don't
260 * need any special suspend/resume handling in addition to invoking the PM
261 * callbacks provided by device drivers supporting both the system sleep PM and
262 * runtime PM, make the pm member point to generic_subsys_pm_ops.
263 */
264#ifdef CONFIG_PM_OPS
265extern struct dev_pm_ops generic_subsys_pm_ops;
266#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
267#else
268#define GENERIC_SUBSYS_PM_OPS NULL
269#endif
270
231/** 271/**
232 * PM_EVENT_ messages 272 * PM_EVENT_ messages
233 * 273 *
@@ -412,9 +452,11 @@ struct dev_pm_info {
412 pm_message_t power_state; 452 pm_message_t power_state;
413 unsigned int can_wakeup:1; 453 unsigned int can_wakeup:1;
414 unsigned int should_wakeup:1; 454 unsigned int should_wakeup:1;
455 unsigned async_suspend:1;
415 enum dpm_state status; /* Owned by the PM core */ 456 enum dpm_state status; /* Owned by the PM core */
416#ifdef CONFIG_PM_SLEEP 457#ifdef CONFIG_PM_SLEEP
417 struct list_head entry; 458 struct list_head entry;
459 struct completion completion;
418#endif 460#endif
419#ifdef CONFIG_PM_RUNTIME 461#ifdef CONFIG_PM_RUNTIME
420 struct timer_list suspend_timer; 462 struct timer_list suspend_timer;
@@ -430,6 +472,7 @@ struct dev_pm_info {
430 unsigned int request_pending:1; 472 unsigned int request_pending:1;
431 unsigned int deferred_resume:1; 473 unsigned int deferred_resume:1;
432 unsigned int run_wake:1; 474 unsigned int run_wake:1;
475 unsigned int runtime_auto:1;
433 enum rpm_request request; 476 enum rpm_request request;
434 enum rpm_status runtime_status; 477 enum rpm_status runtime_status;
435 int runtime_error; 478 int runtime_error;
@@ -508,6 +551,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
508 __suspend_report_result(__func__, fn, ret); \ 551 __suspend_report_result(__func__, fn, ret); \
509 } while (0) 552 } while (0)
510 553
554extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
511#else /* !CONFIG_PM_SLEEP */ 555#else /* !CONFIG_PM_SLEEP */
512 556
513#define device_pm_lock() do {} while (0) 557#define device_pm_lock() do {} while (0)
@@ -520,6 +564,7 @@ static inline int dpm_suspend_start(pm_message_t state)
520 564
521#define suspend_report_result(fn, ret) do {} while (0) 565#define suspend_report_result(fn, ret) do {} while (0)
522 566
567static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
523#endif /* !CONFIG_PM_SLEEP */ 568#endif /* !CONFIG_PM_SLEEP */
524 569
525/* How to reorder dpm_list after device_move() */ 570/* How to reorder dpm_list after device_move() */
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index d74f75ed1e47..8ba440e5eb7f 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -14,12 +14,14 @@
14#define PM_QOS_NUM_CLASSES 4 14#define PM_QOS_NUM_CLASSES 4
15#define PM_QOS_DEFAULT_VALUE -1 15#define PM_QOS_DEFAULT_VALUE -1
16 16
17int pm_qos_add_requirement(int qos, char *name, s32 value); 17struct pm_qos_request_list;
18int pm_qos_update_requirement(int qos, char *name, s32 new_value);
19void pm_qos_remove_requirement(int qos, char *name);
20 18
21int pm_qos_requirement(int qos); 19struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value);
20void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
21 s32 new_value);
22void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
22 23
23int pm_qos_add_notifier(int qos, struct notifier_block *notifier); 24int pm_qos_request(int pm_qos_class);
24int pm_qos_remove_notifier(int qos, struct notifier_block *notifier); 25int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
26int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
25 27
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 370ce0a6fe4a..6e81888c6222 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -28,6 +28,11 @@ extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
28extern int pm_runtime_barrier(struct device *dev); 28extern int pm_runtime_barrier(struct device *dev);
29extern void pm_runtime_enable(struct device *dev); 29extern void pm_runtime_enable(struct device *dev);
30extern void __pm_runtime_disable(struct device *dev, bool check_resume); 30extern void __pm_runtime_disable(struct device *dev, bool check_resume);
31extern void pm_runtime_allow(struct device *dev);
32extern void pm_runtime_forbid(struct device *dev);
33extern int pm_generic_runtime_idle(struct device *dev);
34extern int pm_generic_runtime_suspend(struct device *dev);
35extern int pm_generic_runtime_resume(struct device *dev);
31 36
32static inline bool pm_children_suspended(struct device *dev) 37static inline bool pm_children_suspended(struct device *dev)
33{ 38{
@@ -60,6 +65,11 @@ static inline void device_set_run_wake(struct device *dev, bool enable)
60 dev->power.run_wake = enable; 65 dev->power.run_wake = enable;
61} 66}
62 67
68static inline bool pm_runtime_suspended(struct device *dev)
69{
70 return dev->power.runtime_status == RPM_SUSPENDED;
71}
72
63#else /* !CONFIG_PM_RUNTIME */ 73#else /* !CONFIG_PM_RUNTIME */
64 74
65static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; } 75static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; }
@@ -78,6 +88,8 @@ static inline int __pm_runtime_set_status(struct device *dev,
78static inline int pm_runtime_barrier(struct device *dev) { return 0; } 88static inline int pm_runtime_barrier(struct device *dev) { return 0; }
79static inline void pm_runtime_enable(struct device *dev) {} 89static inline void pm_runtime_enable(struct device *dev) {}
80static inline void __pm_runtime_disable(struct device *dev, bool c) {} 90static inline void __pm_runtime_disable(struct device *dev, bool c) {}
91static inline void pm_runtime_allow(struct device *dev) {}
92static inline void pm_runtime_forbid(struct device *dev) {}
81 93
82static inline bool pm_children_suspended(struct device *dev) { return false; } 94static inline bool pm_children_suspended(struct device *dev) { return false; }
83static inline void pm_suspend_ignore_children(struct device *dev, bool en) {} 95static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
@@ -85,6 +97,11 @@ static inline void pm_runtime_get_noresume(struct device *dev) {}
85static inline void pm_runtime_put_noidle(struct device *dev) {} 97static inline void pm_runtime_put_noidle(struct device *dev) {}
86static inline bool device_run_wake(struct device *dev) { return false; } 98static inline bool device_run_wake(struct device *dev) { return false; }
87static inline void device_set_run_wake(struct device *dev, bool enable) {} 99static inline void device_set_run_wake(struct device *dev, bool enable) {}
100static inline bool pm_runtime_suspended(struct device *dev) { return false; }
101
102static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
103static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
104static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
88 105
89#endif /* !CONFIG_PM_RUNTIME */ 106#endif /* !CONFIG_PM_RUNTIME */
90 107
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 0aae7776185e..22d64c18056c 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -25,32 +25,34 @@
25# error "please don't include this file directly" 25# error "please don't include this file directly"
26#endif 26#endif
27 27
28#include <linux/types.h>
29
28#ifdef CONFIG_PM 30#ifdef CONFIG_PM
29 31
30/* changes to device_may_wakeup take effect on the next pm state change. 32/* changes to device_may_wakeup take effect on the next pm state change.
31 * by default, devices should wakeup if they can. 33 * by default, devices should wakeup if they can.
32 */ 34 */
33static inline void device_init_wakeup(struct device *dev, int val) 35static inline void device_init_wakeup(struct device *dev, bool val)
34{ 36{
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val; 37 dev->power.can_wakeup = dev->power.should_wakeup = val;
36} 38}
37 39
38static inline void device_set_wakeup_capable(struct device *dev, int val) 40static inline void device_set_wakeup_capable(struct device *dev, bool capable)
39{ 41{
40 dev->power.can_wakeup = !!val; 42 dev->power.can_wakeup = capable;
41} 43}
42 44
43static inline int device_can_wakeup(struct device *dev) 45static inline bool device_can_wakeup(struct device *dev)
44{ 46{
45 return dev->power.can_wakeup; 47 return dev->power.can_wakeup;
46} 48}
47 49
48static inline void device_set_wakeup_enable(struct device *dev, int val) 50static inline void device_set_wakeup_enable(struct device *dev, bool enable)
49{ 51{
50 dev->power.should_wakeup = !!val; 52 dev->power.should_wakeup = enable;
51} 53}
52 54
53static inline int device_may_wakeup(struct device *dev) 55static inline bool device_may_wakeup(struct device *dev)
54{ 56{
55 return dev->power.can_wakeup && dev->power.should_wakeup; 57 return dev->power.can_wakeup && dev->power.should_wakeup;
56} 58}
@@ -58,20 +60,28 @@ static inline int device_may_wakeup(struct device *dev)
58#else /* !CONFIG_PM */ 60#else /* !CONFIG_PM */
59 61
60/* For some reason the next two routines work even without CONFIG_PM */ 62/* For some reason the next two routines work even without CONFIG_PM */
61static inline void device_init_wakeup(struct device *dev, int val) 63static inline void device_init_wakeup(struct device *dev, bool val)
62{ 64{
63 dev->power.can_wakeup = !!val; 65 dev->power.can_wakeup = val;
64} 66}
65 67
66static inline void device_set_wakeup_capable(struct device *dev, int val) { } 68static inline void device_set_wakeup_capable(struct device *dev, bool capable)
69{
70}
67 71
68static inline int device_can_wakeup(struct device *dev) 72static inline bool device_can_wakeup(struct device *dev)
69{ 73{
70 return dev->power.can_wakeup; 74 return dev->power.can_wakeup;
71} 75}
72 76
73#define device_set_wakeup_enable(dev, val) do {} while (0) 77static inline void device_set_wakeup_enable(struct device *dev, bool enable)
74#define device_may_wakeup(dev) 0 78{
79}
80
81static inline bool device_may_wakeup(struct device *dev)
82{
83 return false;
84}
75 85
76#endif /* !CONFIG_PM */ 86#endif /* !CONFIG_PM */
77 87
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 2110a81c5e2a..34066ffd893d 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -48,6 +48,15 @@
48#define POISON_FREE 0x6b /* for use-after-free poisoning */ 48#define POISON_FREE 0x6b /* for use-after-free poisoning */
49#define POISON_END 0xa5 /* end-byte of poisoning */ 49#define POISON_END 0xa5 /* end-byte of poisoning */
50 50
51/********** mm/hugetlb.c **********/
52/*
53 * Private mappings of hugetlb pages use this poisoned value for
54 * page->mapping. The core VM should not be doing anything with this mapping
55 * but futex requires the existence of some page->mapping value even though it
56 * is unused if PAGE_MAPPING_ANON is set.
57 */
58#define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON))
59
51/********** arch/$ARCH/mm/init.c **********/ 60/********** arch/$ARCH/mm/init.c **********/
52#define POISON_FREE_INITMEM 0xcc 61#define POISON_FREE_INITMEM 0xcc
53 62
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 6673743946f7..600cc1fde64d 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -10,8 +10,10 @@
10#include <linux/wait.h> 10#include <linux/wait.h>
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/sysctl.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14 15
16extern struct ctl_table epoll_table[]; /* for sysctl */
15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating 17/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
16 additional memory. */ 18 additional memory. */
17#define MAX_STACK_ALLOC 832 19#define MAX_STACK_ALLOC 832
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index b5d096d3a9be..30083a896f36 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -82,6 +82,7 @@ enum power_supply_property {
82 POWER_SUPPLY_PROP_PRESENT, 82 POWER_SUPPLY_PROP_PRESENT,
83 POWER_SUPPLY_PROP_ONLINE, 83 POWER_SUPPLY_PROP_ONLINE,
84 POWER_SUPPLY_PROP_TECHNOLOGY, 84 POWER_SUPPLY_PROP_TECHNOLOGY,
85 POWER_SUPPLY_PROP_CYCLE_COUNT,
85 POWER_SUPPLY_PROP_VOLTAGE_MAX, 86 POWER_SUPPLY_PROP_VOLTAGE_MAX,
86 POWER_SUPPLY_PROP_VOLTAGE_MIN, 87 POWER_SUPPLY_PROP_VOLTAGE_MIN,
87 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 88 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
@@ -113,6 +114,7 @@ enum power_supply_property {
113 POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, 114 POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
114 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, 115 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
115 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 116 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
117 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
116 /* Properties of type `const char *' */ 118 /* Properties of type `const char *' */
117 POWER_SUPPLY_PROP_MODEL_NAME, 119 POWER_SUPPLY_PROP_MODEL_NAME,
118 POWER_SUPPLY_PROP_MANUFACTURER, 120 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -143,6 +145,11 @@ struct power_supply {
143 int (*get_property)(struct power_supply *psy, 145 int (*get_property)(struct power_supply *psy,
144 enum power_supply_property psp, 146 enum power_supply_property psp,
145 union power_supply_propval *val); 147 union power_supply_propval *val);
148 int (*set_property)(struct power_supply *psy,
149 enum power_supply_property psp,
150 const union power_supply_propval *val);
151 int (*property_is_writeable)(struct power_supply *psy,
152 enum power_supply_property psp);
146 void (*external_power_changed)(struct power_supply *psy); 153 void (*external_power_changed)(struct power_supply *psy);
147 void (*set_charged)(struct power_supply *psy); 154 void (*set_charged)(struct power_supply *psy);
148 155
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index 0d3fa63e90ea..bff98ec1bfed 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -72,6 +72,9 @@ extern int ppp_channel_index(struct ppp_channel *);
72/* Get the unit number associated with a channel, or -1 if none */ 72/* Get the unit number associated with a channel, or -1 if none */
73extern int ppp_unit_number(struct ppp_channel *); 73extern int ppp_unit_number(struct ppp_channel *);
74 74
75/* Get the device name associated with a channel, or NULL if none */
76extern char *ppp_dev_name(struct ppp_channel *);
77
75/* 78/*
76 * SMP locking notes: 79 * SMP locking notes:
77 * The channel code must ensure that when it calls ppp_unregister_channel, 80 * The channel code must ensure that when it calls ppp_unregister_channel,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 56f2d63a5cbb..4272521e29e9 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -27,6 +27,26 @@
27#define PTRACE_GETSIGINFO 0x4202 27#define PTRACE_GETSIGINFO 0x4202
28#define PTRACE_SETSIGINFO 0x4203 28#define PTRACE_SETSIGINFO 0x4203
29 29
30/*
31 * Generic ptrace interface that exports the architecture specific regsets
32 * using the corresponding NT_* types (which are also used in the core dump).
33 * Please note that the NT_PRSTATUS note type in a core dump contains a full
34 * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
35 * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
36 * other user_regset flavors, the user_regset layout and the ELF core dump note
37 * payload are exactly the same layout.
38 *
39 * This interface usage is as follows:
40 * struct iovec iov = { buf, len};
41 *
42 * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
43 *
44 * On the successful completion, iov.len will be updated by the kernel,
45 * specifying how much the kernel has written/read to/from the user's iov.buf.
46 */
47#define PTRACE_GETREGSET 0x4204
48#define PTRACE_SETREGSET 0x4205
49
30/* options set using PTRACE_SETOPTIONS */ 50/* options set using PTRACE_SETOPTIONS */
31#define PTRACE_O_TRACESYSGOOD 0x00000001 51#define PTRACE_O_TRACESYSGOOD 0x00000001
32#define PTRACE_O_TRACEFORK 0x00000002 52#define PTRACE_O_TRACEFORK 0x00000002
@@ -244,6 +264,9 @@ static inline void user_enable_single_step(struct task_struct *task)
244static inline void user_disable_single_step(struct task_struct *task) 264static inline void user_disable_single_step(struct task_struct *task)
245{ 265{
246} 266}
267#else
268extern void user_enable_single_step(struct task_struct *);
269extern void user_disable_single_step(struct task_struct *);
247#endif /* arch_has_single_step */ 270#endif /* arch_has_single_step */
248 271
249#ifndef arch_has_block_step 272#ifndef arch_has_block_step
@@ -271,6 +294,8 @@ static inline void user_enable_block_step(struct task_struct *task)
271{ 294{
272 BUG(); /* This can never be called. */ 295 BUG(); /* This can never be called. */
273} 296}
297#else
298extern void user_enable_block_step(struct task_struct *);
274#endif /* arch_has_block_step */ 299#endif /* arch_has_block_step */
275 300
276#ifdef ARCH_HAS_USER_SINGLE_STEP_INFO 301#ifdef ARCH_HAS_USER_SINGLE_STEP_INFO
@@ -320,18 +345,6 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
320#define arch_ptrace_stop(code, info) do { } while (0) 345#define arch_ptrace_stop(code, info) do { } while (0)
321#endif 346#endif
322 347
323#ifndef arch_ptrace_untrace
324/*
325 * Do machine-specific work before untracing child.
326 *
327 * This is called for a normal detach as well as from ptrace_exit()
328 * when the tracing task dies.
329 *
330 * Called with write_lock(&tasklist_lock) held.
331 */
332#define arch_ptrace_untrace(task) do { } while (0)
333#endif
334
335extern int task_current_syscall(struct task_struct *target, long *callno, 348extern int task_current_syscall(struct task_struct *target, long *callno,
336 unsigned long args[6], unsigned int maxargs, 349 unsigned long args[6], unsigned int maxargs,
337 unsigned long *sp, unsigned long *pc); 350 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index a6861f117480..94c1f03b50eb 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,6 +174,7 @@ enum {
174#include <linux/rwsem.h> 174#include <linux/rwsem.h>
175#include <linux/spinlock.h> 175#include <linux/spinlock.h>
176#include <linux/wait.h> 176#include <linux/wait.h>
177#include <linux/percpu_counter.h>
177 178
178#include <linux/dqblk_xfs.h> 179#include <linux/dqblk_xfs.h>
179#include <linux/dqblk_v1.h> 180#include <linux/dqblk_v1.h>
@@ -238,19 +239,36 @@ static inline int info_dirty(struct mem_dqinfo *info)
238 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags); 239 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
239} 240}
240 241
242enum {
243 DQST_LOOKUPS,
244 DQST_DROPS,
245 DQST_READS,
246 DQST_WRITES,
247 DQST_CACHE_HITS,
248 DQST_ALLOC_DQUOTS,
249 DQST_FREE_DQUOTS,
250 DQST_SYNCS,
251 _DQST_DQSTAT_LAST
252};
253
241struct dqstats { 254struct dqstats {
242 int lookups; 255 int stat[_DQST_DQSTAT_LAST];
243 int drops; 256 struct percpu_counter counter[_DQST_DQSTAT_LAST];
244 int reads;
245 int writes;
246 int cache_hits;
247 int allocated_dquots;
248 int free_dquots;
249 int syncs;
250}; 257};
251 258
259extern struct dqstats *dqstats_pcpu;
252extern struct dqstats dqstats; 260extern struct dqstats dqstats;
253 261
262static inline void dqstats_inc(unsigned int type)
263{
264 percpu_counter_inc(&dqstats.counter[type]);
265}
266
267static inline void dqstats_dec(unsigned int type)
268{
269 percpu_counter_dec(&dqstats.counter[type]);
270}
271
254#define DQ_MOD_B 0 /* dquot modified since read */ 272#define DQ_MOD_B 0 /* dquot modified since read */
255#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */ 273#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */
256#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */ 274#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */
@@ -279,9 +297,6 @@ struct dquot {
279 struct mem_dqblk dq_dqb; /* Diskquota usage */ 297 struct mem_dqblk dq_dqb; /* Diskquota usage */
280}; 298};
281 299
282#define QUOTA_OK 0
283#define NO_QUOTA 1
284
285/* Operations which must be implemented by each quota format */ 300/* Operations which must be implemented by each quota format */
286struct quota_format_ops { 301struct quota_format_ops {
287 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ 302 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */
@@ -295,13 +310,6 @@ struct quota_format_ops {
295 310
296/* Operations working with dquots */ 311/* Operations working with dquots */
297struct dquot_operations { 312struct dquot_operations {
298 int (*initialize) (struct inode *, int);
299 int (*drop) (struct inode *);
300 int (*alloc_space) (struct inode *, qsize_t, int);
301 int (*alloc_inode) (const struct inode *, qsize_t);
302 int (*free_space) (struct inode *, qsize_t);
303 int (*free_inode) (const struct inode *, qsize_t);
304 int (*transfer) (struct inode *, struct iattr *);
305 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 313 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
306 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ 314 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
307 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ 315 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
@@ -309,12 +317,6 @@ struct dquot_operations {
309 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 317 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
310 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 318 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
311 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ 319 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
312 /* reserve quota for delayed block allocation */
313 int (*reserve_space) (struct inode *, qsize_t, int);
314 /* claim reserved quota for delayed alloc */
315 int (*claim_space) (struct inode *, qsize_t);
316 /* release rsved quota for delayed alloc */
317 void (*release_rsv) (struct inode *, qsize_t);
318 /* get reserved quota for delayed alloc, value returned is managed by 320 /* get reserved quota for delayed alloc, value returned is managed by
319 * quota code only */ 321 * quota code only */
320 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
@@ -322,17 +324,15 @@ struct dquot_operations {
322 324
323/* Operations handling requests from userspace */ 325/* Operations handling requests from userspace */
324struct quotactl_ops { 326struct quotactl_ops {
325 int (*quota_on)(struct super_block *, int, int, char *, int); 327 int (*quota_on)(struct super_block *, int, int, char *);
326 int (*quota_off)(struct super_block *, int, int); 328 int (*quota_off)(struct super_block *, int);
327 int (*quota_sync)(struct super_block *, int); 329 int (*quota_sync)(struct super_block *, int, int);
328 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 330 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
329 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 331 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
330 int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 332 int (*get_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
331 int (*set_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 333 int (*set_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
332 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 334 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
333 int (*set_xstate)(struct super_block *, unsigned int, int); 335 int (*set_xstate)(struct super_block *, unsigned int, int);
334 int (*get_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
335 int (*set_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
336}; 336};
337 337
338struct quota_format_type { 338struct quota_format_type {
@@ -357,26 +357,25 @@ enum {
357#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ 357#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
358 DQUOT_SUSPENDED) 358 DQUOT_SUSPENDED)
359/* Other quota flags */ 359/* Other quota flags */
360#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special 360#define DQUOT_STATE_LAST (_DQUOT_STATE_FLAGS * MAXQUOTAS)
361#define DQUOT_QUOTA_SYS_FILE (1 << DQUOT_STATE_LAST)
362 /* Quota file is a special
361 * system file and user cannot 363 * system file and user cannot
362 * touch it. Filesystem is 364 * touch it. Filesystem is
363 * responsible for setting 365 * responsible for setting
364 * S_NOQUOTA, S_NOATIME flags 366 * S_NOQUOTA, S_NOATIME flags
365 */ 367 */
366#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ 368#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1))
369 /* Allow negative quota usage */
367 370
368static inline unsigned int dquot_state_flag(unsigned int flags, int type) 371static inline unsigned int dquot_state_flag(unsigned int flags, int type)
369{ 372{
370 if (type == USRQUOTA) 373 return flags << _DQUOT_STATE_FLAGS * type;
371 return flags;
372 return flags << _DQUOT_STATE_FLAGS;
373} 374}
374 375
375static inline unsigned int dquot_generic_flag(unsigned int flags, int type) 376static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
376{ 377{
377 if (type == USRQUOTA) 378 return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS;
378 return flags;
379 return flags >> _DQUOT_STATE_FLAGS;
380} 379}
381 380
382#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 381#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 3ebb23153640..aa36793b48bd 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -9,25 +9,34 @@
9 9
10#include <linux/fs.h> 10#include <linux/fs.h>
11 11
12#define DQUOT_SPACE_WARN 0x1
13#define DQUOT_SPACE_RESERVE 0x2
14#define DQUOT_SPACE_NOFAIL 0x4
15
12static inline struct quota_info *sb_dqopt(struct super_block *sb) 16static inline struct quota_info *sb_dqopt(struct super_block *sb)
13{ 17{
14 return &sb->s_dquot; 18 return &sb->s_dquot;
15} 19}
16 20
21/* i_mutex must being held */
22static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
23{
24 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
25 (ia->ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) ||
26 (ia->ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid);
27}
28
17#if defined(CONFIG_QUOTA) 29#if defined(CONFIG_QUOTA)
18 30
19/* 31/*
20 * declaration of quota_function calls in kernel. 32 * declaration of quota_function calls in kernel.
21 */ 33 */
22void sync_quota_sb(struct super_block *sb, int type); 34void inode_add_rsv_space(struct inode *inode, qsize_t number);
23static inline void writeout_quota_sb(struct super_block *sb, int type) 35void inode_claim_rsv_space(struct inode *inode, qsize_t number);
24{ 36void inode_sub_rsv_space(struct inode *inode, qsize_t number);
25 if (sb->s_qcop->quota_sync)
26 sb->s_qcop->quota_sync(sb, type);
27}
28 37
29int dquot_initialize(struct inode *inode, int type); 38void dquot_initialize(struct inode *inode);
30int dquot_drop(struct inode *inode); 39void dquot_drop(struct inode *inode);
31struct dquot *dqget(struct super_block *sb, unsigned int id, int type); 40struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
32void dqput(struct dquot *dquot); 41void dqput(struct dquot *dquot);
33int dquot_scan_active(struct super_block *sb, 42int dquot_scan_active(struct super_block *sb,
@@ -36,43 +45,49 @@ int dquot_scan_active(struct super_block *sb,
36struct dquot *dquot_alloc(struct super_block *sb, int type); 45struct dquot *dquot_alloc(struct super_block *sb, int type);
37void dquot_destroy(struct dquot *dquot); 46void dquot_destroy(struct dquot *dquot);
38 47
39int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 48int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags);
40int dquot_alloc_inode(const struct inode *inode, qsize_t number); 49void __dquot_free_space(struct inode *inode, qsize_t number, int flags);
41 50
42int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc); 51int dquot_alloc_inode(const struct inode *inode);
43int dquot_claim_space(struct inode *inode, qsize_t number);
44void dquot_release_reserved_space(struct inode *inode, qsize_t number);
45qsize_t dquot_get_reserved_space(struct inode *inode);
46 52
47int dquot_free_space(struct inode *inode, qsize_t number); 53int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
48int dquot_free_inode(const struct inode *inode, qsize_t number); 54void dquot_free_inode(const struct inode *inode);
55
56int dquot_disable(struct super_block *sb, int type, unsigned int flags);
57/* Suspend quotas on remount RO */
58static inline int dquot_suspend(struct super_block *sb, int type)
59{
60 return dquot_disable(sb, type, DQUOT_SUSPENDED);
61}
62int dquot_resume(struct super_block *sb, int type);
49 63
50int dquot_transfer(struct inode *inode, struct iattr *iattr);
51int dquot_commit(struct dquot *dquot); 64int dquot_commit(struct dquot *dquot);
52int dquot_acquire(struct dquot *dquot); 65int dquot_acquire(struct dquot *dquot);
53int dquot_release(struct dquot *dquot); 66int dquot_release(struct dquot *dquot);
54int dquot_commit_info(struct super_block *sb, int type); 67int dquot_commit_info(struct super_block *sb, int type);
55int dquot_mark_dquot_dirty(struct dquot *dquot); 68int dquot_mark_dquot_dirty(struct dquot *dquot);
56 69
57int vfs_quota_on(struct super_block *sb, int type, int format_id, 70int dquot_file_open(struct inode *inode, struct file *file);
58 char *path, int remount); 71
59int vfs_quota_enable(struct inode *inode, int type, int format_id, 72int dquot_quota_on(struct super_block *sb, int type, int format_id,
73 char *path);
74int dquot_enable(struct inode *inode, int type, int format_id,
60 unsigned int flags); 75 unsigned int flags);
61int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 76int dquot_quota_on_path(struct super_block *sb, int type, int format_id,
62 struct path *path); 77 struct path *path);
63int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 78int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
64 int format_id, int type); 79 int format_id, int type);
65int vfs_quota_off(struct super_block *sb, int type, int remount); 80int dquot_quota_off(struct super_block *sb, int type);
66int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); 81int dquot_quota_sync(struct super_block *sb, int type, int wait);
67int vfs_quota_sync(struct super_block *sb, int type); 82int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
68int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 83int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
69int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 84int dquot_get_dqblk(struct super_block *sb, int type, qid_t id,
70int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 85 struct fs_disk_quota *di);
71int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 86int dquot_set_dqblk(struct super_block *sb, int type, qid_t id,
72 87 struct fs_disk_quota *di);
73void vfs_dq_drop(struct inode *inode); 88
74int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); 89int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
75int vfs_dq_quota_on_remount(struct super_block *sb); 90int dquot_transfer(struct inode *inode, struct iattr *iattr);
76 91
77static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) 92static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
78{ 93{
@@ -83,189 +98,63 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
83 * Functions for checking status of quota 98 * Functions for checking status of quota
84 */ 99 */
85 100
86static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) 101static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type)
87{ 102{
88 return sb_dqopt(sb)->flags & 103 return sb_dqopt(sb)->flags &
89 dquot_state_flag(DQUOT_USAGE_ENABLED, type); 104 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
90} 105}
91 106
92static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) 107static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type)
93{ 108{
94 return sb_dqopt(sb)->flags & 109 return sb_dqopt(sb)->flags &
95 dquot_state_flag(DQUOT_LIMITS_ENABLED, type); 110 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
96} 111}
97 112
98static inline int sb_has_quota_suspended(struct super_block *sb, int type) 113static inline bool sb_has_quota_suspended(struct super_block *sb, int type)
99{ 114{
100 return sb_dqopt(sb)->flags & 115 return sb_dqopt(sb)->flags &
101 dquot_state_flag(DQUOT_SUSPENDED, type); 116 dquot_state_flag(DQUOT_SUSPENDED, type);
102} 117}
103 118
104static inline int sb_any_quota_suspended(struct super_block *sb) 119static inline unsigned sb_any_quota_suspended(struct super_block *sb)
105{ 120{
106 return sb_has_quota_suspended(sb, USRQUOTA) || 121 unsigned type, tmsk = 0;
107 sb_has_quota_suspended(sb, GRPQUOTA); 122 for (type = 0; type < MAXQUOTAS; type++)
123 tmsk |= sb_has_quota_suspended(sb, type) << type;
124 return tmsk;
108} 125}
109 126
110/* Does kernel know about any quota information for given sb + type? */ 127/* Does kernel know about any quota information for given sb + type? */
111static inline int sb_has_quota_loaded(struct super_block *sb, int type) 128static inline bool sb_has_quota_loaded(struct super_block *sb, int type)
112{ 129{
113 /* Currently if anything is on, then quota usage is on as well */ 130 /* Currently if anything is on, then quota usage is on as well */
114 return sb_has_quota_usage_enabled(sb, type); 131 return sb_has_quota_usage_enabled(sb, type);
115} 132}
116 133
117static inline int sb_any_quota_loaded(struct super_block *sb) 134static inline unsigned sb_any_quota_loaded(struct super_block *sb)
118{ 135{
119 return sb_has_quota_loaded(sb, USRQUOTA) || 136 unsigned type, tmsk = 0;
120 sb_has_quota_loaded(sb, GRPQUOTA); 137 for (type = 0; type < MAXQUOTAS; type++)
138 tmsk |= sb_has_quota_loaded(sb, type) << type;
139 return tmsk;
121} 140}
122 141
123static inline int sb_has_quota_active(struct super_block *sb, int type) 142static inline bool sb_has_quota_active(struct super_block *sb, int type)
124{ 143{
125 return sb_has_quota_loaded(sb, type) && 144 return sb_has_quota_loaded(sb, type) &&
126 !sb_has_quota_suspended(sb, type); 145 !sb_has_quota_suspended(sb, type);
127} 146}
128 147
129static inline int sb_any_quota_active(struct super_block *sb) 148static inline unsigned sb_any_quota_active(struct super_block *sb)
130{ 149{
131 return sb_has_quota_active(sb, USRQUOTA) || 150 return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb);
132 sb_has_quota_active(sb, GRPQUOTA);
133} 151}
134 152
135/* 153/*
136 * Operations supported for diskquotas. 154 * Operations supported for diskquotas.
137 */ 155 */
138extern const struct dquot_operations dquot_operations; 156extern const struct dquot_operations dquot_operations;
139extern const struct quotactl_ops vfs_quotactl_ops; 157extern const struct quotactl_ops dquot_quotactl_ops;
140
141#define sb_dquot_ops (&dquot_operations)
142#define sb_quotactl_ops (&vfs_quotactl_ops)
143
144/* It is better to call this function outside of any transaction as it might
145 * need a lot of space in journal for dquot structure allocation. */
146static inline void vfs_dq_init(struct inode *inode)
147{
148 BUG_ON(!inode->i_sb);
149 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
150 inode->i_sb->dq_op->initialize(inode, -1);
151}
152
153/* The following allocation/freeing/transfer functions *must* be called inside
154 * a transaction (deadlocks possible otherwise) */
155static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
156{
157 if (sb_any_quota_active(inode->i_sb)) {
158 /* Used space is updated in alloc_space() */
159 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
160 return 1;
161 }
162 else
163 inode_add_bytes(inode, nr);
164 return 0;
165}
166
167static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
168{
169 int ret;
170 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
171 mark_inode_dirty(inode);
172 return ret;
173}
174
175static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
176{
177 if (sb_any_quota_active(inode->i_sb)) {
178 /* Used space is updated in alloc_space() */
179 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
180 return 1;
181 }
182 else
183 inode_add_bytes(inode, nr);
184 return 0;
185}
186
187static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
188{
189 int ret;
190 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
191 mark_inode_dirty(inode);
192 return ret;
193}
194
195static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
196{
197 if (sb_any_quota_active(inode->i_sb)) {
198 /* Used space is updated in alloc_space() */
199 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
200 return 1;
201 }
202 return 0;
203}
204
205static inline int vfs_dq_alloc_inode(struct inode *inode)
206{
207 if (sb_any_quota_active(inode->i_sb)) {
208 vfs_dq_init(inode);
209 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
210 return 1;
211 }
212 return 0;
213}
214
215/*
216 * Convert in-memory reserved quotas to real consumed quotas
217 */
218static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
219{
220 if (sb_any_quota_active(inode->i_sb)) {
221 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
222 return 1;
223 } else
224 inode_add_bytes(inode, nr);
225
226 mark_inode_dirty(inode);
227 return 0;
228}
229
230/*
231 * Release reserved (in-memory) quotas
232 */
233static inline
234void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
235{
236 if (sb_any_quota_active(inode->i_sb))
237 inode->i_sb->dq_op->release_rsv(inode, nr);
238}
239
240static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
241{
242 if (sb_any_quota_active(inode->i_sb))
243 inode->i_sb->dq_op->free_space(inode, nr);
244 else
245 inode_sub_bytes(inode, nr);
246}
247
248static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
249{
250 vfs_dq_free_space_nodirty(inode, nr);
251 mark_inode_dirty(inode);
252}
253
254static inline void vfs_dq_free_inode(struct inode *inode)
255{
256 if (sb_any_quota_active(inode->i_sb))
257 inode->i_sb->dq_op->free_inode(inode, 1);
258}
259
260/* Cannot be called inside a transaction */
261static inline int vfs_dq_off(struct super_block *sb, int remount)
262{
263 int ret = -ENOSYS;
264
265 if (sb->s_qcop && sb->s_qcop->quota_off)
266 ret = sb->s_qcop->quota_off(sb, -1, remount);
267 return ret;
268}
269 158
270#else 159#else
271 160
@@ -310,151 +199,161 @@ static inline int sb_any_quota_active(struct super_block *sb)
310 return 0; 199 return 0;
311} 200}
312 201
313/* 202static inline void dquot_initialize(struct inode *inode)
314 * NO-OP when quota not configured.
315 */
316#define sb_dquot_ops (NULL)
317#define sb_quotactl_ops (NULL)
318
319static inline void vfs_dq_init(struct inode *inode)
320{ 203{
321} 204}
322 205
323static inline void vfs_dq_drop(struct inode *inode) 206static inline void dquot_drop(struct inode *inode)
324{ 207{
325} 208}
326 209
327static inline int vfs_dq_alloc_inode(struct inode *inode) 210static inline int dquot_alloc_inode(const struct inode *inode)
328{ 211{
329 return 0; 212 return 0;
330} 213}
331 214
332static inline void vfs_dq_free_inode(struct inode *inode) 215static inline void dquot_free_inode(const struct inode *inode)
333{ 216{
334} 217}
335 218
336static inline void sync_quota_sb(struct super_block *sb, int type) 219static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
337{ 220{
221 return 0;
338} 222}
339 223
340static inline void writeout_quota_sb(struct super_block *sb, int type) 224static inline int __dquot_alloc_space(struct inode *inode, qsize_t number,
225 int flags)
341{ 226{
227 if (!(flags & DQUOT_SPACE_RESERVE))
228 inode_add_bytes(inode, number);
229 return 0;
342} 230}
343 231
344static inline int vfs_dq_off(struct super_block *sb, int remount) 232static inline void __dquot_free_space(struct inode *inode, qsize_t number,
233 int flags)
345{ 234{
346 return 0; 235 if (!(flags & DQUOT_SPACE_RESERVE))
236 inode_sub_bytes(inode, number);
347} 237}
348 238
349static inline int vfs_dq_quota_on_remount(struct super_block *sb) 239static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
350{ 240{
241 inode_add_bytes(inode, number);
351 return 0; 242 return 0;
352} 243}
353 244
354static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) 245static inline int dquot_disable(struct super_block *sb, int type,
246 unsigned int flags)
355{ 247{
356 return 0; 248 return 0;
357} 249}
358 250
359static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) 251static inline int dquot_suspend(struct super_block *sb, int type)
360{ 252{
361 inode_add_bytes(inode, nr);
362 return 0; 253 return 0;
363} 254}
364 255
365static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) 256static inline int dquot_resume(struct super_block *sb, int type)
366{ 257{
367 vfs_dq_prealloc_space_nodirty(inode, nr);
368 mark_inode_dirty(inode);
369 return 0; 258 return 0;
370} 259}
371 260
372static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) 261#define dquot_file_open generic_file_open
262
263#endif /* CONFIG_QUOTA */
264
265static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr)
373{ 266{
374 inode_add_bytes(inode, nr); 267 return __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN);
375 return 0;
376} 268}
377 269
378static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) 270static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr)
379{ 271{
380 vfs_dq_alloc_space_nodirty(inode, nr); 272 __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL);
381 mark_inode_dirty(inode); 273 mark_inode_dirty(inode);
382 return 0;
383} 274}
384 275
385static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) 276static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
386{ 277{
387 return 0; 278 int ret;
388}
389 279
390static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) 280 ret = dquot_alloc_space_nodirty(inode, nr);
391{ 281 if (!ret)
392 return vfs_dq_alloc_space(inode, nr); 282 mark_inode_dirty(inode);
283 return ret;
393} 284}
394 285
395static inline 286static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr)
396int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
397{ 287{
398 return 0; 288 return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits);
399} 289}
400 290
401static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 291static inline void dquot_alloc_block_nofail(struct inode *inode, qsize_t nr)
402{ 292{
403 inode_sub_bytes(inode, nr); 293 dquot_alloc_space_nofail(inode, nr << inode->i_blkbits);
404} 294}
405 295
406static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) 296static inline int dquot_alloc_block(struct inode *inode, qsize_t nr)
407{ 297{
408 vfs_dq_free_space_nodirty(inode, nr); 298 return dquot_alloc_space(inode, nr << inode->i_blkbits);
409 mark_inode_dirty(inode); 299}
410}
411
412#endif /* CONFIG_QUOTA */
413 300
414static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) 301static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
415{ 302{
416 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits); 303 return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0);
417} 304}
418 305
419static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) 306static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr)
420{ 307{
421 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits); 308 int ret;
309
310 ret = dquot_prealloc_block_nodirty(inode, nr);
311 if (!ret)
312 mark_inode_dirty(inode);
313 return ret;
422} 314}
423 315
424static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) 316static inline int dquot_reserve_block(struct inode *inode, qsize_t nr)
425{ 317{
426 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits); 318 return __dquot_alloc_space(inode, nr << inode->i_blkbits,
319 DQUOT_SPACE_WARN|DQUOT_SPACE_RESERVE);
427} 320}
428 321
429static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) 322static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
430{ 323{
431 return vfs_dq_alloc_space(inode, nr << inode->i_blkbits); 324 int ret;
325
326 ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits);
327 if (!ret)
328 mark_inode_dirty(inode);
329 return ret;
432} 330}
433 331
434static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr) 332static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr)
435{ 333{
436 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits); 334 __dquot_free_space(inode, nr, 0);
437} 335}
438 336
439static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr) 337static inline void dquot_free_space(struct inode *inode, qsize_t nr)
440{ 338{
441 return vfs_dq_claim_space(inode, nr << inode->i_blkbits); 339 dquot_free_space_nodirty(inode, nr);
340 mark_inode_dirty(inode);
442} 341}
443 342
444static inline 343static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr)
445void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
446{ 344{
447 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits); 345 dquot_free_space_nodirty(inode, nr << inode->i_blkbits);
448} 346}
449 347
450static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) 348static inline void dquot_free_block(struct inode *inode, qsize_t nr)
451{ 349{
452 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits); 350 dquot_free_space(inode, nr << inode->i_blkbits);
453} 351}
454 352
455static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) 353static inline void dquot_release_reservation_block(struct inode *inode,
354 qsize_t nr)
456{ 355{
457 vfs_dq_free_space(inode, nr << inode->i_blkbits); 356 __dquot_free_space(inode, nr << inode->i_blkbits, DQUOT_SPACE_RESERVE);
458} 357}
459 358
460#endif /* _LINUX_QUOTAOPS_ */ 359#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index c5da74918096..55ca73cf25e5 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -121,6 +121,13 @@ do { \
121 * (Note, rcu_assign_pointer and rcu_dereference are not needed to control 121 * (Note, rcu_assign_pointer and rcu_dereference are not needed to control
122 * access to data items when inserting into or looking up from the radix tree) 122 * access to data items when inserting into or looking up from the radix tree)
123 * 123 *
124 * Note that the value returned by radix_tree_tag_get() may not be relied upon
125 * if only the RCU read lock is held. Functions to set/clear tags and to
126 * delete nodes running concurrently with it may affect its result such that
127 * two consecutive reads in the same locked section may return different
128 * values. If reliability is required, modification functions must also be
129 * excluded from concurrency.
130 *
124 * radix_tree_tagged is able to be called without locking or RCU. 131 * radix_tree_tagged is able to be called without locking or RCU.
125 */ 132 */
126 133
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index 6b537f1ac96c..31e1ff69efc8 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -32,6 +32,7 @@ enum raid_level {
32 RAID_LEVEL_0, 32 RAID_LEVEL_0,
33 RAID_LEVEL_1, 33 RAID_LEVEL_1,
34 RAID_LEVEL_10, 34 RAID_LEVEL_10,
35 RAID_LEVEL_1E,
35 RAID_LEVEL_3, 36 RAID_LEVEL_3,
36 RAID_LEVEL_4, 37 RAID_LEVEL_4,
37 RAID_LEVEL_5, 38 RAID_LEVEL_5,
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 4e768dda87b0..e7320b5e82fb 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_RAMFS_H 1#ifndef _LINUX_RAMFS_H
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev); 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev);
5extern int ramfs_get_sb(struct file_system_type *fs_type, 6extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 7 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 8
@@ -20,4 +21,6 @@ extern const struct file_operations ramfs_file_operations;
20extern const struct vm_operations_struct generic_file_vm_ops; 21extern const struct vm_operations_struct generic_file_vm_ops;
21extern int __init init_rootfs(void); 22extern int __init init_rootfs(void);
22 23
24int ramfs_fill_super(struct super_block *sb, void *data, int silent);
25
23#endif 26#endif
diff --git a/include/linux/random.h b/include/linux/random.h
index 25d02fe5c9b5..fb7ab9de5f36 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -40,6 +40,10 @@ struct rand_pool_info {
40 __u32 buf[0]; 40 __u32 buf[0];
41}; 41};
42 42
43struct rnd_state {
44 __u32 s1, s2, s3;
45};
46
43/* Exported functions */ 47/* Exported functions */
44 48
45#ifdef __KERNEL__ 49#ifdef __KERNEL__
@@ -74,6 +78,30 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l
74u32 random32(void); 78u32 random32(void);
75void srandom32(u32 seed); 79void srandom32(u32 seed);
76 80
81u32 prandom32(struct rnd_state *);
82
83/*
84 * Handle minimum values for seeds
85 */
86static inline u32 __seed(u32 x, u32 m)
87{
88 return (x < m) ? x + m : x;
89}
90
91/**
92 * prandom32_seed - set seed for prandom32().
93 * @state: pointer to state structure to receive the seed.
94 * @seed: arbitrary 64-bit value to use as a seed.
95 */
96static inline void prandom32_seed(struct rnd_state *state, u64 seed)
97{
98 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
99
100 state->s1 = __seed(i, 1);
101 state->s2 = __seed(i, 7);
102 state->s3 = __seed(i, 15);
103}
104
77#endif /* __KERNEL___ */ 105#endif /* __KERNEL___ */
78 106
79#endif /* _LINUX_RANDOM_H */ 107#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/range.h b/include/linux/range.h
new file mode 100644
index 000000000000..bd184a5db791
--- /dev/null
+++ b/include/linux/range.h
@@ -0,0 +1,30 @@
1#ifndef _LINUX_RANGE_H
2#define _LINUX_RANGE_H
3
4struct range {
5 u64 start;
6 u64 end;
7};
8
9int add_range(struct range *range, int az, int nr_range,
10 u64 start, u64 end);
11
12
13int add_range_with_merge(struct range *range, int az, int nr_range,
14 u64 start, u64 end);
15
16void subtract_range(struct range *range, int az, u64 start, u64 end);
17
18int clean_sort_range(struct range *range, int az);
19
20void sort_range(struct range *range, int nr_range);
21
22#define MAX_RESOURCE ((resource_size_t)~0)
23static inline resource_size_t cap_resource(u64 val)
24{
25 if (val > MAX_RESOURCE)
26 return MAX_RESOURCE;
27
28 return val;
29}
30#endif
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 668cf1bef030..8f69d09a41a5 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -2,7 +2,7 @@
2#define _LINUX_RATELIMIT_H 2#define _LINUX_RATELIMIT_H
3 3
4#include <linux/param.h> 4#include <linux/param.h>
5#include <linux/spinlock_types.h> 5#include <linux/spinlock.h>
6 6
7#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) 7#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
8#define DEFAULT_RATELIMIT_BURST 10 8#define DEFAULT_RATELIMIT_BURST 10
@@ -25,6 +25,17 @@ struct ratelimit_state {
25 .burst = burst_init, \ 25 .burst = burst_init, \
26 } 26 }
27 27
28static inline void ratelimit_state_init(struct ratelimit_state *rs,
29 int interval, int burst)
30{
31 spin_lock_init(&rs->lock);
32 rs->interval = interval;
33 rs->burst = burst;
34 rs->printed = 0;
35 rs->missed = 0;
36 rs->begin = 0;
37}
38
28extern int ___ratelimit(struct ratelimit_state *rs, const char *func); 39extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
29#define __ratelimit(state) ___ratelimit(state, __func__) 40#define __ratelimit(state) ___ratelimit(state, __func__)
30 41
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 9c295411d01f..7066acb2c530 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -25,10 +25,10 @@
25 25
26 Some example of insert and search follows here. The search is a plain 26 Some example of insert and search follows here. The search is a plain
27 normal search over an ordered tree. The insert instead must be implemented 27 normal search over an ordered tree. The insert instead must be implemented
28 int two steps: as first thing the code must insert the element in 28 in two steps: First, the code must insert the element in order as a red leaf
29 order as a red leaf in the tree, then the support library function 29 in the tree, and then the support library function rb_insert_color() must
30 rb_insert_color() must be called. Such function will do the 30 be called. Such function will do the not trivial work to rebalance the
31 not trivial work to rebalance the rbtree if necessary. 31 rbtree, if necessary.
32 32
33----------------------------------------------------------------------- 33-----------------------------------------------------------------------
34static inline struct page * rb_search_page_cache(struct inode * inode, 34static inline struct page * rb_search_page_cache(struct inode * inode,
@@ -139,6 +139,14 @@ static inline void rb_set_color(struct rb_node *rb, int color)
139extern void rb_insert_color(struct rb_node *, struct rb_root *); 139extern void rb_insert_color(struct rb_node *, struct rb_root *);
140extern void rb_erase(struct rb_node *, struct rb_root *); 140extern void rb_erase(struct rb_node *, struct rb_root *);
141 141
142typedef void (*rb_augment_f)(struct rb_node *node, void *data);
143
144extern void rb_augment_insert(struct rb_node *node,
145 rb_augment_f func, void *data);
146extern struct rb_node *rb_augment_erase_begin(struct rb_node *node);
147extern void rb_augment_erase_end(struct rb_node *node,
148 rb_augment_f func, void *data);
149
142/* Find logical next and previous nodes in a tree */ 150/* Find logical next and previous nodes in a tree */
143extern struct rb_node *rb_next(const struct rb_node *); 151extern struct rb_node *rb_next(const struct rb_node *);
144extern struct rb_node *rb_prev(const struct rb_node *); 152extern struct rb_node *rb_prev(const struct rb_node *);
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 1bf0f708c4fc..4ec3b38ce9c5 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -208,7 +208,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
208 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 208 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
209 */ 209 */
210#define list_entry_rcu(ptr, type, member) \ 210#define list_entry_rcu(ptr, type, member) \
211 container_of(rcu_dereference(ptr), type, member) 211 container_of(rcu_dereference_raw(ptr), type, member)
212 212
213/** 213/**
214 * list_first_entry_rcu - get the first element from a list 214 * list_first_entry_rcu - get the first element from a list
@@ -225,9 +225,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
225 list_entry_rcu((ptr)->next, type, member) 225 list_entry_rcu((ptr)->next, type, member)
226 226
227#define __list_for_each_rcu(pos, head) \ 227#define __list_for_each_rcu(pos, head) \
228 for (pos = rcu_dereference((head)->next); \ 228 for (pos = rcu_dereference_raw((head)->next); \
229 pos != (head); \ 229 pos != (head); \
230 pos = rcu_dereference(pos->next)) 230 pos = rcu_dereference_raw(pos->next))
231 231
232/** 232/**
233 * list_for_each_entry_rcu - iterate over rcu list of given type 233 * list_for_each_entry_rcu - iterate over rcu list of given type
@@ -257,9 +257,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
257 * as long as the traversal is guarded by rcu_read_lock(). 257 * as long as the traversal is guarded by rcu_read_lock().
258 */ 258 */
259#define list_for_each_continue_rcu(pos, head) \ 259#define list_for_each_continue_rcu(pos, head) \
260 for ((pos) = rcu_dereference((pos)->next); \ 260 for ((pos) = rcu_dereference_raw((pos)->next); \
261 prefetch((pos)->next), (pos) != (head); \ 261 prefetch((pos)->next), (pos) != (head); \
262 (pos) = rcu_dereference((pos)->next)) 262 (pos) = rcu_dereference_raw((pos)->next))
263 263
264/** 264/**
265 * list_for_each_entry_continue_rcu - continue iteration over list of given type 265 * list_for_each_entry_continue_rcu - continue iteration over list of given type
@@ -406,6 +406,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
406 n->next->pprev = &n->next; 406 n->next->pprev = &n->next;
407} 407}
408 408
409#define __hlist_for_each_rcu(pos, head) \
410 for (pos = rcu_dereference((head)->first); \
411 pos && ({ prefetch(pos->next); 1; }); \
412 pos = rcu_dereference(pos->next))
413
409/** 414/**
410 * hlist_for_each_entry_rcu - iterate over rcu list of given type 415 * hlist_for_each_entry_rcu - iterate over rcu list of given type
411 * @tpos: the type * to use as a loop cursor. 416 * @tpos: the type * to use as a loop cursor.
@@ -418,10 +423,52 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
418 * as long as the traversal is guarded by rcu_read_lock(). 423 * as long as the traversal is guarded by rcu_read_lock().
419 */ 424 */
420#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 425#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
421 for (pos = rcu_dereference((head)->first); \ 426 for (pos = rcu_dereference_raw((head)->first); \
427 pos && ({ prefetch(pos->next); 1; }) && \
428 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
429 pos = rcu_dereference_raw(pos->next))
430
431/**
432 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type
433 * @tpos: the type * to use as a loop cursor.
434 * @pos: the &struct hlist_node to use as a loop cursor.
435 * @head: the head for your list.
436 * @member: the name of the hlist_node within the struct.
437 *
438 * This list-traversal primitive may safely run concurrently with
439 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
440 * as long as the traversal is guarded by rcu_read_lock().
441 */
442#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \
443 for (pos = rcu_dereference_bh((head)->first); \
422 pos && ({ prefetch(pos->next); 1; }) && \ 444 pos && ({ prefetch(pos->next); 1; }) && \
423 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 445 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
424 pos = rcu_dereference(pos->next)) 446 pos = rcu_dereference_bh(pos->next))
447
448/**
449 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point
450 * @tpos: the type * to use as a loop cursor.
451 * @pos: the &struct hlist_node to use as a loop cursor.
452 * @member: the name of the hlist_node within the struct.
453 */
454#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \
455 for (pos = rcu_dereference((pos)->next); \
456 pos && ({ prefetch(pos->next); 1; }) && \
457 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
458 pos = rcu_dereference(pos->next))
459
460/**
461 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
462 * @tpos: the type * to use as a loop cursor.
463 * @pos: the &struct hlist_node to use as a loop cursor.
464 * @member: the name of the hlist_node within the struct.
465 */
466#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \
467 for (pos = rcu_dereference_bh((pos)->next); \
468 pos && ({ prefetch(pos->next); 1; }) && \
469 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
470 pos = rcu_dereference_bh(pos->next))
471
425 472
426#endif /* __KERNEL__ */ 473#endif /* __KERNEL__ */
427#endif 474#endif
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index 589a40919f01..b70ffe53cb9f 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -101,10 +101,10 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
101 * 101 *
102 */ 102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ 103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \ 104 for (pos = rcu_dereference_raw((head)->first); \
105 (!is_a_nulls(pos)) && \ 105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ 106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next)) 107 pos = rcu_dereference_raw(pos->next))
108 108
109#endif 109#endif
110#endif 110#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 24440f4bf476..b653b4aaa8a6 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -41,6 +41,10 @@
41#include <linux/lockdep.h> 41#include <linux/lockdep.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43 43
44#ifdef CONFIG_RCU_TORTURE_TEST
45extern int rcutorture_runnable; /* for sysctl */
46#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
47
44/** 48/**
45 * struct rcu_head - callback structure for use with RCU 49 * struct rcu_head - callback structure for use with RCU
46 * @next: next update requests in a list 50 * @next: next update requests in a list
@@ -52,8 +56,6 @@ struct rcu_head {
52}; 56};
53 57
54/* Exported common interfaces */ 58/* Exported common interfaces */
55extern void synchronize_rcu_bh(void);
56extern void synchronize_sched(void);
57extern void rcu_barrier(void); 59extern void rcu_barrier(void);
58extern void rcu_barrier_bh(void); 60extern void rcu_barrier_bh(void);
59extern void rcu_barrier_sched(void); 61extern void rcu_barrier_sched(void);
@@ -77,15 +79,204 @@ extern void rcu_init(void);
77 (ptr)->next = NULL; (ptr)->func = NULL; \ 79 (ptr)->next = NULL; (ptr)->func = NULL; \
78} while (0) 80} while (0)
79 81
82static inline void init_rcu_head_on_stack(struct rcu_head *head)
83{
84}
85
86static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
87{
88}
89
80#ifdef CONFIG_DEBUG_LOCK_ALLOC 90#ifdef CONFIG_DEBUG_LOCK_ALLOC
91
81extern struct lockdep_map rcu_lock_map; 92extern struct lockdep_map rcu_lock_map;
82# define rcu_read_acquire() \ 93# define rcu_read_acquire() \
83 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 94 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
84# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 95# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
85#else 96
86# define rcu_read_acquire() do { } while (0) 97extern struct lockdep_map rcu_bh_lock_map;
87# define rcu_read_release() do { } while (0) 98# define rcu_read_acquire_bh() \
88#endif 99 lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
100# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_)
101
102extern struct lockdep_map rcu_sched_lock_map;
103# define rcu_read_acquire_sched() \
104 lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
105# define rcu_read_release_sched() \
106 lock_release(&rcu_sched_lock_map, 1, _THIS_IP_)
107
108extern int debug_lockdep_rcu_enabled(void);
109
110/**
111 * rcu_read_lock_held - might we be in RCU read-side critical section?
112 *
113 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
114 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
115 * this assumes we are in an RCU read-side critical section unless it can
116 * prove otherwise.
117 *
118 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
119 * and while lockdep is disabled.
120 */
121static inline int rcu_read_lock_held(void)
122{
123 if (!debug_lockdep_rcu_enabled())
124 return 1;
125 return lock_is_held(&rcu_lock_map);
126}
127
128/*
129 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
130 * hell.
131 */
132extern int rcu_read_lock_bh_held(void);
133
134/**
135 * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
136 *
137 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an
138 * RCU-sched read-side critical section. In absence of
139 * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side
140 * critical section unless it can prove otherwise. Note that disabling
141 * of preemption (including disabling irqs) counts as an RCU-sched
142 * read-side critical section.
143 *
144 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
145 * and while lockdep is disabled.
146 */
147#ifdef CONFIG_PREEMPT
148static inline int rcu_read_lock_sched_held(void)
149{
150 int lockdep_opinion = 0;
151
152 if (!debug_lockdep_rcu_enabled())
153 return 1;
154 if (debug_locks)
155 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
156 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
157}
158#else /* #ifdef CONFIG_PREEMPT */
159static inline int rcu_read_lock_sched_held(void)
160{
161 return 1;
162}
163#endif /* #else #ifdef CONFIG_PREEMPT */
164
165#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
166
167# define rcu_read_acquire() do { } while (0)
168# define rcu_read_release() do { } while (0)
169# define rcu_read_acquire_bh() do { } while (0)
170# define rcu_read_release_bh() do { } while (0)
171# define rcu_read_acquire_sched() do { } while (0)
172# define rcu_read_release_sched() do { } while (0)
173
174static inline int rcu_read_lock_held(void)
175{
176 return 1;
177}
178
179static inline int rcu_read_lock_bh_held(void)
180{
181 return 1;
182}
183
184#ifdef CONFIG_PREEMPT
185static inline int rcu_read_lock_sched_held(void)
186{
187 return preempt_count() != 0 || irqs_disabled();
188}
189#else /* #ifdef CONFIG_PREEMPT */
190static inline int rcu_read_lock_sched_held(void)
191{
192 return 1;
193}
194#endif /* #else #ifdef CONFIG_PREEMPT */
195
196#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
197
198#ifdef CONFIG_PROVE_RCU
199
200extern int rcu_my_thread_group_empty(void);
201
202#define __do_rcu_dereference_check(c) \
203 do { \
204 static bool __warned; \
205 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
206 __warned = true; \
207 lockdep_rcu_dereference(__FILE__, __LINE__); \
208 } \
209 } while (0)
210
211/**
212 * rcu_dereference_check - rcu_dereference with debug checking
213 * @p: The pointer to read, prior to dereferencing
214 * @c: The conditions under which the dereference will take place
215 *
216 * Do an rcu_dereference(), but check that the conditions under which the
217 * dereference will take place are correct. Typically the conditions indicate
218 * the various locking conditions that should be held at that point. The check
219 * should return true if the conditions are satisfied.
220 *
221 * For example:
222 *
223 * bar = rcu_dereference_check(foo->bar, rcu_read_lock_held() ||
224 * lockdep_is_held(&foo->lock));
225 *
226 * could be used to indicate to lockdep that foo->bar may only be dereferenced
227 * if either the RCU read lock is held, or that the lock required to replace
228 * the bar struct at foo->bar is held.
229 *
230 * Note that the list of conditions may also include indications of when a lock
231 * need not be held, for example during initialisation or destruction of the
232 * target struct:
233 *
234 * bar = rcu_dereference_check(foo->bar, rcu_read_lock_held() ||
235 * lockdep_is_held(&foo->lock) ||
236 * atomic_read(&foo->usage) == 0);
237 */
238#define rcu_dereference_check(p, c) \
239 ({ \
240 __do_rcu_dereference_check(c); \
241 rcu_dereference_raw(p); \
242 })
243
244/**
245 * rcu_dereference_protected - fetch RCU pointer when updates prevented
246 *
247 * Return the value of the specified RCU-protected pointer, but omit
248 * both the smp_read_barrier_depends() and the ACCESS_ONCE(). This
249 * is useful in cases where update-side locks prevent the value of the
250 * pointer from changing. Please note that this primitive does -not-
251 * prevent the compiler from repeating this reference or combining it
252 * with other references, so it should not be used without protection
253 * of appropriate locks.
254 */
255#define rcu_dereference_protected(p, c) \
256 ({ \
257 __do_rcu_dereference_check(c); \
258 (p); \
259 })
260
261#else /* #ifdef CONFIG_PROVE_RCU */
262
263#define rcu_dereference_check(p, c) rcu_dereference_raw(p)
264#define rcu_dereference_protected(p, c) (p)
265
266#endif /* #else #ifdef CONFIG_PROVE_RCU */
267
268/**
269 * rcu_access_pointer - fetch RCU pointer with no dereferencing
270 *
271 * Return the value of the specified RCU-protected pointer, but omit the
272 * smp_read_barrier_depends() and keep the ACCESS_ONCE(). This is useful
273 * when the value of this pointer is accessed, but the pointer is not
274 * dereferenced, for example, when testing an RCU-protected pointer against
275 * NULL. This may also be used in cases where update-side locks prevent
276 * the value of the pointer from changing, but rcu_dereference_protected()
277 * is a lighter-weight primitive for this use case.
278 */
279#define rcu_access_pointer(p) ACCESS_ONCE(p)
89 280
90/** 281/**
91 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 282 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
@@ -160,7 +351,7 @@ static inline void rcu_read_lock_bh(void)
160{ 351{
161 __rcu_read_lock_bh(); 352 __rcu_read_lock_bh();
162 __acquire(RCU_BH); 353 __acquire(RCU_BH);
163 rcu_read_acquire(); 354 rcu_read_acquire_bh();
164} 355}
165 356
166/* 357/*
@@ -170,7 +361,7 @@ static inline void rcu_read_lock_bh(void)
170 */ 361 */
171static inline void rcu_read_unlock_bh(void) 362static inline void rcu_read_unlock_bh(void)
172{ 363{
173 rcu_read_release(); 364 rcu_read_release_bh();
174 __release(RCU_BH); 365 __release(RCU_BH);
175 __rcu_read_unlock_bh(); 366 __rcu_read_unlock_bh();
176} 367}
@@ -188,7 +379,7 @@ static inline void rcu_read_lock_sched(void)
188{ 379{
189 preempt_disable(); 380 preempt_disable();
190 __acquire(RCU_SCHED); 381 __acquire(RCU_SCHED);
191 rcu_read_acquire(); 382 rcu_read_acquire_sched();
192} 383}
193 384
194/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 385/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -205,7 +396,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
205 */ 396 */
206static inline void rcu_read_unlock_sched(void) 397static inline void rcu_read_unlock_sched(void)
207{ 398{
208 rcu_read_release(); 399 rcu_read_release_sched();
209 __release(RCU_SCHED); 400 __release(RCU_SCHED);
210 preempt_enable(); 401 preempt_enable();
211} 402}
@@ -219,22 +410,49 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
219 410
220 411
221/** 412/**
222 * rcu_dereference - fetch an RCU-protected pointer in an 413 * rcu_dereference_raw - fetch an RCU-protected pointer
223 * RCU read-side critical section. This pointer may later 414 *
224 * be safely dereferenced. 415 * The caller must be within some flavor of RCU read-side critical
416 * section, or must be otherwise preventing the pointer from changing,
417 * for example, by holding an appropriate lock. This pointer may later
418 * be safely dereferenced. It is the caller's responsibility to have
419 * done the right thing, as this primitive does no checking of any kind.
225 * 420 *
226 * Inserts memory barriers on architectures that require them 421 * Inserts memory barriers on architectures that require them
227 * (currently only the Alpha), and, more importantly, documents 422 * (currently only the Alpha), and, more importantly, documents
228 * exactly which pointers are protected by RCU. 423 * exactly which pointers are protected by RCU.
229 */ 424 */
230 425#define rcu_dereference_raw(p) ({ \
231#define rcu_dereference(p) ({ \
232 typeof(p) _________p1 = ACCESS_ONCE(p); \ 426 typeof(p) _________p1 = ACCESS_ONCE(p); \
233 smp_read_barrier_depends(); \ 427 smp_read_barrier_depends(); \
234 (_________p1); \ 428 (_________p1); \
235 }) 429 })
236 430
237/** 431/**
432 * rcu_dereference - fetch an RCU-protected pointer, checking for RCU
433 *
434 * Makes rcu_dereference_check() do the dirty work.
435 */
436#define rcu_dereference(p) \
437 rcu_dereference_check(p, rcu_read_lock_held())
438
439/**
440 * rcu_dereference_bh - fetch an RCU-protected pointer, checking for RCU-bh
441 *
442 * Makes rcu_dereference_check() do the dirty work.
443 */
444#define rcu_dereference_bh(p) \
445 rcu_dereference_check(p, rcu_read_lock_bh_held())
446
447/**
448 * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched
449 *
450 * Makes rcu_dereference_check() do the dirty work.
451 */
452#define rcu_dereference_sched(p) \
453 rcu_dereference_check(p, rcu_read_lock_sched_held())
454
455/**
238 * rcu_assign_pointer - assign (publicize) a pointer to a newly 456 * rcu_assign_pointer - assign (publicize) a pointer to a newly
239 * initialized structure that will be dereferenced by RCU read-side 457 * initialized structure that will be dereferenced by RCU read-side
240 * critical sections. Returns the value assigned. 458 * critical sections. Returns the value assigned.
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 96cc307ed9f4..e2e893144a84 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -29,6 +29,10 @@
29 29
30void rcu_sched_qs(int cpu); 30void rcu_sched_qs(int cpu);
31void rcu_bh_qs(int cpu); 31void rcu_bh_qs(int cpu);
32static inline void rcu_note_context_switch(int cpu)
33{
34 rcu_sched_qs(cpu);
35}
32 36
33#define __rcu_read_lock() preempt_disable() 37#define __rcu_read_lock() preempt_disable()
34#define __rcu_read_unlock() preempt_enable() 38#define __rcu_read_unlock() preempt_enable()
@@ -60,9 +64,29 @@ static inline long rcu_batches_completed_bh(void)
60 return 0; 64 return 0;
61} 65}
62 66
63extern int rcu_expedited_torture_stats(char *page); 67static inline void rcu_force_quiescent_state(void)
68{
69}
70
71static inline void rcu_bh_force_quiescent_state(void)
72{
73}
74
75static inline void rcu_sched_force_quiescent_state(void)
76{
77}
78
79extern void synchronize_sched(void);
80
81static inline void synchronize_rcu(void)
82{
83 synchronize_sched();
84}
64 85
65#define synchronize_rcu synchronize_sched 86static inline void synchronize_rcu_bh(void)
87{
88 synchronize_sched();
89}
66 90
67static inline void synchronize_rcu_expedited(void) 91static inline void synchronize_rcu_expedited(void)
68{ 92{
@@ -93,10 +117,6 @@ static inline void rcu_exit_nohz(void)
93 117
94#endif /* #else #ifdef CONFIG_NO_HZ */ 118#endif /* #else #ifdef CONFIG_NO_HZ */
95 119
96static inline void rcu_scheduler_starting(void)
97{
98}
99
100static inline void exit_rcu(void) 120static inline void exit_rcu(void)
101{ 121{
102} 122}
@@ -106,4 +126,17 @@ static inline int rcu_preempt_depth(void)
106 return 0; 126 return 0;
107} 127}
108 128
129#ifdef CONFIG_DEBUG_LOCK_ALLOC
130
131extern int rcu_scheduler_active __read_mostly;
132extern void rcu_scheduler_starting(void);
133
134#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
135
136static inline void rcu_scheduler_starting(void)
137{
138}
139
140#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
141
109#endif /* __LINUX_RCUTINY_H */ 142#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 8044b1b94333..c0ed1c056f29 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -34,9 +34,8 @@ struct notifier_block;
34 34
35extern void rcu_sched_qs(int cpu); 35extern void rcu_sched_qs(int cpu);
36extern void rcu_bh_qs(int cpu); 36extern void rcu_bh_qs(int cpu);
37extern void rcu_note_context_switch(int cpu);
37extern int rcu_needs_cpu(int cpu); 38extern int rcu_needs_cpu(int cpu);
38extern void rcu_scheduler_starting(void);
39extern int rcu_expedited_torture_stats(char *page);
40 39
41#ifdef CONFIG_TREE_PREEMPT_RCU 40#ifdef CONFIG_TREE_PREEMPT_RCU
42 41
@@ -87,6 +86,8 @@ static inline void __rcu_read_unlock_bh(void)
87 86
88extern void call_rcu_sched(struct rcu_head *head, 87extern void call_rcu_sched(struct rcu_head *head,
89 void (*func)(struct rcu_head *rcu)); 88 void (*func)(struct rcu_head *rcu));
89extern void synchronize_rcu_bh(void);
90extern void synchronize_sched(void);
90extern void synchronize_rcu_expedited(void); 91extern void synchronize_rcu_expedited(void);
91 92
92static inline void synchronize_rcu_bh_expedited(void) 93static inline void synchronize_rcu_bh_expedited(void)
@@ -99,6 +100,9 @@ extern void rcu_check_callbacks(int cpu, int user);
99extern long rcu_batches_completed(void); 100extern long rcu_batches_completed(void);
100extern long rcu_batches_completed_bh(void); 101extern long rcu_batches_completed_bh(void);
101extern long rcu_batches_completed_sched(void); 102extern long rcu_batches_completed_sched(void);
103extern void rcu_force_quiescent_state(void);
104extern void rcu_bh_force_quiescent_state(void);
105extern void rcu_sched_force_quiescent_state(void);
102 106
103#ifdef CONFIG_NO_HZ 107#ifdef CONFIG_NO_HZ
104void rcu_enter_nohz(void); 108void rcu_enter_nohz(void);
@@ -118,4 +122,7 @@ static inline int rcu_blocking_is_gp(void)
118 return num_online_cpus() == 1; 122 return num_online_cpus() == 1;
119} 123}
120 124
125extern void rcu_scheduler_starting(void);
126extern int rcu_scheduler_active __read_mostly;
127
121#endif /* __LINUX_RCUTREE_H */ 128#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 988e55fe649b..3005d5a7fce5 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -64,6 +64,7 @@ extern void kernel_restart(char *cmd);
64extern void kernel_halt(void); 64extern void kernel_halt(void);
65extern void kernel_power_off(void); 65extern void kernel_power_off(void);
66 66
67extern int C_A_D; /* for sysctl */
67void ctrl_alt_del(void); 68void ctrl_alt_del(void);
68 69
69#define POWEROFF_CMD_PATH_LEN 256 70#define POWEROFF_CMD_PATH_LEN 256
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 030d92255c7a..ebd747265294 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -89,8 +89,9 @@
89 * REGULATION_OUT Regulator output is out of regulation. 89 * REGULATION_OUT Regulator output is out of regulation.
90 * FAIL Regulator output has failed. 90 * FAIL Regulator output has failed.
91 * OVER_TEMP Regulator over temp. 91 * OVER_TEMP Regulator over temp.
92 * FORCE_DISABLE Regulator shut down by software. 92 * FORCE_DISABLE Regulator forcibly shut down by software.
93 * VOLTAGE_CHANGE Regulator voltage changed. 93 * VOLTAGE_CHANGE Regulator voltage changed.
94 * DISABLE Regulator was disabled.
94 * 95 *
95 * NOTE: These events can be OR'ed together when passed into handler. 96 * NOTE: These events can be OR'ed together when passed into handler.
96 */ 97 */
@@ -102,6 +103,7 @@
102#define REGULATOR_EVENT_OVER_TEMP 0x10 103#define REGULATOR_EVENT_OVER_TEMP 0x10
103#define REGULATOR_EVENT_FORCE_DISABLE 0x20 104#define REGULATOR_EVENT_FORCE_DISABLE 0x20
104#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 105#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
106#define REGULATOR_EVENT_DISABLE 0x80
105 107
106struct regulator; 108struct regulator;
107 109
@@ -181,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
181{ 183{
182 /* Nothing except the stubbed out regulator API should be 184 /* Nothing except the stubbed out regulator API should be
183 * looking at the value except to check if it is an error 185 * looking at the value except to check if it is an error
184 * value so the actual return value doesn't matter. 186 * value. Drivers are free to handle NULL specifically by
187 * skipping all regulator API calls, but they don't have to.
188 * Drivers which don't, should make sure they properly handle
189 * corner cases of the API, such as regulator_get_voltage()
190 * returning 0.
185 */ 191 */
186 return (struct regulator *)id; 192 return NULL;
187} 193}
188static inline void regulator_put(struct regulator *regulator) 194static inline void regulator_put(struct regulator *regulator)
189{ 195{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 31f2055eae28..592cd7c642c2 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -58,6 +58,9 @@ enum regulator_status {
58 * @get_optimum_mode: Get the most efficient operating mode for the regulator 58 * @get_optimum_mode: Get the most efficient operating mode for the regulator
59 * when running with the specified parameters. 59 * when running with the specified parameters.
60 * 60 *
61 * @enable_time: Time taken for the regulator voltage output voltage to
62 * stabalise after being enabled, in microseconds.
63 *
61 * @set_suspend_voltage: Set the voltage for the regulator when the system 64 * @set_suspend_voltage: Set the voltage for the regulator when the system
62 * is suspended. 65 * is suspended.
63 * @set_suspend_enable: Mark the regulator as enabled when the system is 66 * @set_suspend_enable: Mark the regulator as enabled when the system is
@@ -93,6 +96,9 @@ struct regulator_ops {
93 int (*set_mode) (struct regulator_dev *, unsigned int mode); 96 int (*set_mode) (struct regulator_dev *, unsigned int mode);
94 unsigned int (*get_mode) (struct regulator_dev *); 97 unsigned int (*get_mode) (struct regulator_dev *);
95 98
99 /* Time taken to enable the regulator */
100 int (*enable_time) (struct regulator_dev *);
101
96 /* report regulator status ... most other accessors report 102 /* report regulator status ... most other accessors report
97 * control inputs, this reports results of combining inputs 103 * control inputs, this reports results of combining inputs
98 * from Linux (and other sources) with the actual load. 104 * from Linux (and other sources) with the actual load.
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index e94a4a1c7c8a..ffd7d508e726 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -25,6 +25,7 @@ struct regulator_init_data;
25 * @microvolts: Output voltage of regulator 25 * @microvolts: Output voltage of regulator
26 * @gpio: GPIO to use for enable control 26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used 27 * set to -EINVAL if not used
28 * @startup_delay: Start-up time in microseconds
28 * @enable_high: Polarity of enable GPIO 29 * @enable_high: Polarity of enable GPIO
29 * 1 = Active high, 0 = Active low 30 * 1 = Active high, 0 = Active low
30 * @enabled_at_boot: Whether regulator has been enabled at 31 * @enabled_at_boot: Whether regulator has been enabled at
@@ -41,6 +42,7 @@ struct fixed_voltage_config {
41 const char *supply_name; 42 const char *supply_name;
42 int microvolts; 43 int microvolts;
43 int gpio; 44 int gpio;
45 unsigned startup_delay;
44 unsigned enable_high:1; 46 unsigned enable_high:1;
45 unsigned enabled_at_boot:1; 47 unsigned enabled_at_boot:1;
46 struct regulator_init_data *init_data; 48 struct regulator_init_data *init_data;
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 234a8476cba8..e2980287245e 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -157,7 +157,11 @@ struct regulator_consumer_supply {
157 * 157 *
158 * Initialisation constraints, our supply and consumers supplies. 158 * Initialisation constraints, our supply and consumers supplies.
159 * 159 *
160 * @supply_regulator_dev: Parent regulator (if any). 160 * @supply_regulator: Parent regulator. Specified using the regulator name
161 * as it appears in the name field in sysfs, which can
162 * be explicitly set using the constraints field 'name'.
163 * @supply_regulator_dev: Parent regulator (if any) - DEPRECATED in favour
164 * of supply_regulator.
161 * 165 *
162 * @constraints: Constraints. These must be specified for the regulator to 166 * @constraints: Constraints. These must be specified for the regulator to
163 * be usable. 167 * be usable.
@@ -168,7 +172,8 @@ struct regulator_consumer_supply {
168 * @driver_data: Data passed to regulator_init. 172 * @driver_data: Data passed to regulator_init.
169 */ 173 */
170struct regulator_init_data { 174struct regulator_init_data {
171 struct device *supply_regulator_dev; /* or NULL for LINE */ 175 const char *supply_regulator; /* or NULL for system supply */
176 struct device *supply_regulator_dev; /* or NULL for system supply */
172 177
173 struct regulation_constraints constraints; 178 struct regulation_constraints constraints;
174 179
diff --git a/include/linux/regulator/max8649.h b/include/linux/regulator/max8649.h
new file mode 100644
index 000000000000..417d14ecd5cb
--- /dev/null
+++ b/include/linux/regulator/max8649.h
@@ -0,0 +1,44 @@
1/*
2 * Interface of Maxim max8649
3 *
4 * Copyright (C) 2009-2010 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_REGULATOR_MAX8649_H
13#define __LINUX_REGULATOR_MAX8649_H
14
15#include <linux/regulator/machine.h>
16
17enum {
18 MAX8649_EXTCLK_26MHZ = 0,
19 MAX8649_EXTCLK_13MHZ,
20 MAX8649_EXTCLK_19MHZ, /* 19.2MHz */
21};
22
23enum {
24 MAX8649_RAMP_32MV = 0,
25 MAX8649_RAMP_16MV,
26 MAX8649_RAMP_8MV,
27 MAX8649_RAMP_4MV,
28 MAX8649_RAMP_2MV,
29 MAX8649_RAMP_1MV,
30 MAX8649_RAMP_0_5MV,
31 MAX8649_RAMP_0_25MV,
32};
33
34struct max8649_platform_data {
35 struct regulator_init_data *regulator;
36
37 unsigned mode:2; /* bit[1:0] = VID1,VID0 */
38 unsigned extclk_freq:2;
39 unsigned extclk:1;
40 unsigned ramp_timing:3;
41 unsigned ramp_down:1;
42};
43
44#endif /* __LINUX_REGULATOR_MAX8649_H */
diff --git a/include/linux/regulator/tps6507x.h b/include/linux/regulator/tps6507x.h
new file mode 100644
index 000000000000..4892f591bab1
--- /dev/null
+++ b/include/linux/regulator/tps6507x.h
@@ -0,0 +1,32 @@
1/*
2 * tps6507x.h -- Voltage regulation for the Texas Instruments TPS6507X
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef REGULATOR_TPS6507X
21#define REGULATOR_TPS6507X
22
23/**
24 * tps6507x_reg_platform_data - platform data for tps6507x
25 * @defdcdc_default: Defines whether DCDC high or the low register controls
26 * output voltage by default. Valid for DCDC2 and DCDC3 outputs only.
27 */
28struct tps6507x_reg_platform_data {
29 bool defdcdc_default;
30};
31
32#endif
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index b4448853900e..3fd8c4506bbb 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -53,8 +53,8 @@ int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry, 53 struct inode *dir, struct dentry *dentry,
54 struct inode *inode); 54 struct inode *inode);
55int reiserfs_cache_default_acl(struct inode *dir); 55int reiserfs_cache_default_acl(struct inode *dir);
56extern struct xattr_handler reiserfs_posix_acl_default_handler; 56extern const struct xattr_handler reiserfs_posix_acl_default_handler;
57extern struct xattr_handler reiserfs_posix_acl_access_handler; 57extern const struct xattr_handler reiserfs_posix_acl_access_handler;
58 58
59#else 59#else
60 60
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 1ba3cf6edfbb..3b603f474186 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2034,7 +2034,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
2034int reiserfs_find_actor(struct inode *inode, void *p); 2034int reiserfs_find_actor(struct inode *inode, void *p);
2035int reiserfs_init_locked_inode(struct inode *inode, void *p); 2035int reiserfs_init_locked_inode(struct inode *inode, void *p);
2036void reiserfs_delete_inode(struct inode *inode); 2036void reiserfs_delete_inode(struct inode *inode);
2037int reiserfs_write_inode(struct inode *inode, int); 2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2038int reiserfs_get_block(struct inode *inode, sector_t block, 2038int reiserfs_get_block(struct inode *inode, sector_t block,
2039 struct buffer_head *bh_result, int create); 2039 struct buffer_head *bh_result, int create);
2040struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, 2040struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 99928dce37ea..b2cf2089769b 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -58,9 +58,9 @@ int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
58 struct inode *, const char *, const void *, 58 struct inode *, const char *, const void *,
59 size_t, int); 59 size_t, int);
60 60
61extern struct xattr_handler reiserfs_xattr_user_handler; 61extern const struct xattr_handler reiserfs_xattr_user_handler;
62extern struct xattr_handler reiserfs_xattr_trusted_handler; 62extern const struct xattr_handler reiserfs_xattr_trusted_handler;
63extern struct xattr_handler reiserfs_xattr_security_handler; 63extern const struct xattr_handler reiserfs_xattr_security_handler;
64#ifdef CONFIG_REISERFS_FS_SECURITY 64#ifdef CONFIG_REISERFS_FS_SECURITY
65int reiserfs_security_init(struct inode *dir, struct inode *inode, 65int reiserfs_security_init(struct inode *dir, struct inode *inode,
66 struct reiserfs_security_handle *sec); 66 struct reiserfs_security_handle *sec);
@@ -70,6 +70,11 @@ int reiserfs_security_write(struct reiserfs_transaction_handle *th,
70void reiserfs_security_free(struct reiserfs_security_handle *sec); 70void reiserfs_security_free(struct reiserfs_security_handle *sec);
71#endif 71#endif
72 72
73static inline int reiserfs_xattrs_initialized(struct super_block *sb)
74{
75 return REISERFS_SB(sb)->priv_root != NULL;
76}
77
73#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) 78#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
74static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) 79static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
75{ 80{
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index c9ba2fdf807d..bc8c3881c729 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -6,6 +6,11 @@
6 6
7extern int pm_trace_enabled; 7extern int pm_trace_enabled;
8 8
9static inline int pm_trace_is_enabled(void)
10{
11 return pm_trace_enabled;
12}
13
9struct device; 14struct device;
10extern void set_trace_device(struct device *); 15extern void set_trace_device(struct device *);
11extern void generate_resume_trace(const void *tracedata, unsigned int user); 16extern void generate_resume_trace(const void *tracedata, unsigned int user);
@@ -17,6 +22,8 @@ extern void generate_resume_trace(const void *tracedata, unsigned int user);
17 22
18#else 23#else
19 24
25static inline int pm_trace_is_enabled(void) { return 0; }
26
20#define TRACE_DEVICE(dev) do { } while (0) 27#define TRACE_DEVICE(dev) do { } while (0)
21#define TRACE_RESUME(dev) do { } while (0) 28#define TRACE_RESUME(dev) do { } while (0)
22 29
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 97059d08a626..4f82326eb294 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -29,7 +29,7 @@
29/** 29/**
30 * enum rfkill_type - type of rfkill switch. 30 * enum rfkill_type - type of rfkill switch.
31 * 31 *
32 * @RFKILL_TYPE_ALL: toggles all switches (userspace only) 32 * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. 35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 5fcc31ed5771..25b4f686d918 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -120,12 +120,16 @@ int ring_buffer_write(struct ring_buffer *buffer,
120 unsigned long length, void *data); 120 unsigned long length, void *data);
121 121
122struct ring_buffer_event * 122struct ring_buffer_event *
123ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts); 123ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts,
124 unsigned long *lost_events);
124struct ring_buffer_event * 125struct ring_buffer_event *
125ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts); 126ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts,
127 unsigned long *lost_events);
126 128
127struct ring_buffer_iter * 129struct ring_buffer_iter *
128ring_buffer_read_start(struct ring_buffer *buffer, int cpu); 130ring_buffer_read_prepare(struct ring_buffer *buffer, int cpu);
131void ring_buffer_read_prepare_sync(void);
132void ring_buffer_read_start(struct ring_buffer_iter *iter);
129void ring_buffer_read_finish(struct ring_buffer_iter *iter); 133void ring_buffer_read_finish(struct ring_buffer_iter *iter);
130 134
131struct ring_buffer_event * 135struct ring_buffer_event *
diff --git a/include/linux/rio.h b/include/linux/rio.h
index dc0c75556c63..bd6eb0ed34a7 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -64,10 +64,13 @@
64#define RIO_INB_MBOX_RESOURCE 1 64#define RIO_INB_MBOX_RESOURCE 1
65#define RIO_OUTB_MBOX_RESOURCE 2 65#define RIO_OUTB_MBOX_RESOURCE 2
66 66
67#define RIO_PW_MSG_SIZE 64
68
67extern struct bus_type rio_bus_type; 69extern struct bus_type rio_bus_type;
68extern struct list_head rio_devices; /* list of all devices */ 70extern struct list_head rio_devices; /* list of all devices */
69 71
70struct rio_mport; 72struct rio_mport;
73union rio_pw_msg;
71 74
72/** 75/**
73 * struct rio_dev - RIO device info 76 * struct rio_dev - RIO device info
@@ -85,11 +88,15 @@ struct rio_mport;
85 * @swpinfo: Switch port info 88 * @swpinfo: Switch port info
86 * @src_ops: Source operation capabilities 89 * @src_ops: Source operation capabilities
87 * @dst_ops: Destination operation capabilities 90 * @dst_ops: Destination operation capabilities
91 * @comp_tag: RIO component tag
92 * @phys_efptr: RIO device extended features pointer
93 * @em_efptr: RIO Error Management features pointer
88 * @dma_mask: Mask of bits of RIO address this device implements 94 * @dma_mask: Mask of bits of RIO address this device implements
89 * @rswitch: Pointer to &struct rio_switch if valid for this device 95 * @rswitch: Pointer to &struct rio_switch if valid for this device
90 * @driver: Driver claiming this device 96 * @driver: Driver claiming this device
91 * @dev: Device model device 97 * @dev: Device model device
92 * @riores: RIO resources this device owns 98 * @riores: RIO resources this device owns
99 * @pwcback: port-write callback function for this device
93 * @destid: Network destination ID 100 * @destid: Network destination ID
94 */ 101 */
95struct rio_dev { 102struct rio_dev {
@@ -107,11 +114,15 @@ struct rio_dev {
107 u32 swpinfo; /* Only used for switches */ 114 u32 swpinfo; /* Only used for switches */
108 u32 src_ops; 115 u32 src_ops;
109 u32 dst_ops; 116 u32 dst_ops;
117 u32 comp_tag;
118 u32 phys_efptr;
119 u32 em_efptr;
110 u64 dma_mask; 120 u64 dma_mask;
111 struct rio_switch *rswitch; /* RIO switch info */ 121 struct rio_switch *rswitch; /* RIO switch info */
112 struct rio_driver *driver; /* RIO driver claiming this device */ 122 struct rio_driver *driver; /* RIO driver claiming this device */
113 struct device dev; /* LDM device structure */ 123 struct device dev; /* LDM device structure */
114 struct resource riores[RIO_MAX_DEV_RESOURCES]; 124 struct resource riores[RIO_MAX_DEV_RESOURCES];
125 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
115 u16 destid; 126 u16 destid;
116}; 127};
117 128
@@ -211,8 +222,14 @@ struct rio_net {
211 * @hopcount: Hopcount to this switch 222 * @hopcount: Hopcount to this switch
212 * @destid: Associated destid in the path 223 * @destid: Associated destid in the path
213 * @route_table: Copy of switch routing table 224 * @route_table: Copy of switch routing table
225 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
214 * @add_entry: Callback for switch-specific route add function 226 * @add_entry: Callback for switch-specific route add function
215 * @get_entry: Callback for switch-specific route get function 227 * @get_entry: Callback for switch-specific route get function
228 * @clr_table: Callback for switch-specific clear route table function
229 * @set_domain: Callback for switch-specific domain setting function
230 * @get_domain: Callback for switch-specific domain get function
231 * @em_init: Callback for switch-specific error management initialization function
232 * @em_handle: Callback for switch-specific error management handler function
216 */ 233 */
217struct rio_switch { 234struct rio_switch {
218 struct list_head node; 235 struct list_head node;
@@ -220,10 +237,19 @@ struct rio_switch {
220 u16 hopcount; 237 u16 hopcount;
221 u16 destid; 238 u16 destid;
222 u8 *route_table; 239 u8 *route_table;
240 u32 port_ok;
223 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 241 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
224 u16 table, u16 route_destid, u8 route_port); 242 u16 table, u16 route_destid, u8 route_port);
225 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 243 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
226 u16 table, u16 route_destid, u8 * route_port); 244 u16 table, u16 route_destid, u8 * route_port);
245 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
246 u16 table);
247 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
248 u8 sw_domain);
249 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
250 u8 *sw_domain);
251 int (*em_init) (struct rio_dev *dev);
252 int (*em_handle) (struct rio_dev *dev, u8 swport);
227}; 253};
228 254
229/* Low-level architecture-dependent routines */ 255/* Low-level architecture-dependent routines */
@@ -235,6 +261,7 @@ struct rio_switch {
235 * @cread: Callback to perform network read of config space. 261 * @cread: Callback to perform network read of config space.
236 * @cwrite: Callback to perform network write of config space. 262 * @cwrite: Callback to perform network write of config space.
237 * @dsend: Callback to send a doorbell message. 263 * @dsend: Callback to send a doorbell message.
264 * @pwenable: Callback to enable/disable port-write message handling.
238 */ 265 */
239struct rio_ops { 266struct rio_ops {
240 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 267 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -246,6 +273,7 @@ struct rio_ops {
246 int (*cwrite) (struct rio_mport *mport, int index, u16 destid, 273 int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
247 u8 hopcount, u32 offset, int len, u32 data); 274 u8 hopcount, u32 offset, int len, u32 data);
248 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); 275 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
276 int (*pwenable) (struct rio_mport *mport, int enable);
249}; 277};
250 278
251#define RIO_RESOURCE_MEM 0x00000100 279#define RIO_RESOURCE_MEM 0x00000100
@@ -302,21 +330,28 @@ struct rio_device_id {
302}; 330};
303 331
304/** 332/**
305 * struct rio_route_ops - Per-switch route operations 333 * struct rio_switch_ops - Per-switch operations
306 * @vid: RIO vendor ID 334 * @vid: RIO vendor ID
307 * @did: RIO device ID 335 * @did: RIO device ID
308 * @add_hook: Callback that adds a route entry 336 * @init_hook: Callback that performs switch device initialization
309 * @get_hook: Callback that gets a route entry
310 * 337 *
311 * Defines the operations that are necessary to manipulate the route 338 * Defines the operations that are necessary to initialize/control
312 * tables for a particular RIO switch device. 339 * a particular RIO switch device.
313 */ 340 */
314struct rio_route_ops { 341struct rio_switch_ops {
315 u16 vid, did; 342 u16 vid, did;
316 int (*add_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, 343 int (*init_hook) (struct rio_dev *rdev, int do_enum);
317 u16 table, u16 route_destid, u8 route_port); 344};
318 int (*get_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, 345
319 u16 table, u16 route_destid, u8 * route_port); 346union rio_pw_msg {
347 struct {
348 u32 comptag; /* Component Tag CSR */
349 u32 errdetect; /* Port N Error Detect CSR */
350 u32 is_port; /* Implementation specific + PortID */
351 u32 ltlerrdet; /* LTL Error Detect CSR */
352 u32 padding[12];
353 } em;
354 u32 raw[RIO_PW_MSG_SIZE/sizeof(u32)];
320}; 355};
321 356
322/* Architecture and hardware-specific functions */ 357/* Architecture and hardware-specific functions */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index c93a58a40033..edc55da717b3 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -413,6 +413,12 @@ void rio_release_regions(struct rio_dev *);
413int rio_request_region(struct rio_dev *, int, char *); 413int rio_request_region(struct rio_dev *, int, char *);
414void rio_release_region(struct rio_dev *, int); 414void rio_release_region(struct rio_dev *, int);
415 415
416/* Port-Write management */
417extern int rio_request_inb_pwrite(struct rio_dev *,
418 int (*)(struct rio_dev *, union rio_pw_msg*, int));
419extern int rio_release_inb_pwrite(struct rio_dev *);
420extern int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg);
421
416/* LDM support */ 422/* LDM support */
417int rio_register_driver(struct rio_driver *); 423int rio_register_driver(struct rio_driver *);
418void rio_unregister_driver(struct rio_driver *); 424void rio_unregister_driver(struct rio_driver *);
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index 919d4e07d54e..db50e1c288b7 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -20,5 +20,19 @@
20 20
21#define RIO_VID_TUNDRA 0x000d 21#define RIO_VID_TUNDRA 0x000d
22#define RIO_DID_TSI500 0x0500 22#define RIO_DID_TSI500 0x0500
23#define RIO_DID_TSI568 0x0568
24#define RIO_DID_TSI572 0x0572
25#define RIO_DID_TSI574 0x0574
26#define RIO_DID_TSI576 0x0578 /* Same ID as Tsi578 */
27#define RIO_DID_TSI577 0x0577
28#define RIO_DID_TSI578 0x0578
29
30#define RIO_VID_IDT 0x0038
31#define RIO_DID_IDT70K200 0x0310
32#define RIO_DID_IDTCPS8 0x035c
33#define RIO_DID_IDTCPS12 0x035d
34#define RIO_DID_IDTCPS16 0x035b
35#define RIO_DID_IDTCPS6Q 0x035f
36#define RIO_DID_IDTCPS10Q 0x035e
23 37
24#endif /* LINUX_RIO_IDS_H */ 38#endif /* LINUX_RIO_IDS_H */
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index 326540f9b54e..aedee0489fb4 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -39,6 +39,8 @@
39#define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */ 39#define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */
40#define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */ 40#define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */
41#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */ 41#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */
42#define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */
43#define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */
42#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ 44#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */
43#define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */ 45#define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */
44#define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */ 46#define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */
@@ -91,7 +93,10 @@
91#define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ 93#define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */
92#define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ 94#define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */
93 95
94 /* 0x20-0x3c *//* Reserved */ 96 /* 0x20-0x30 *//* Reserved */
97
98#define RIO_SWITCH_RT_LIMIT 0x34 /* [III, 1.3] Switch Route Table Destination ID Limit CAR */
99#define RIO_RT_MAX_DESTID 0x0000ffff
95 100
96#define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ 101#define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */
97#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ 102#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */
@@ -153,7 +158,11 @@
153#define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */ 158#define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */
154#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */ 159#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */
155 160
156 /* 0x70-0xf8 *//* Reserved */ 161#define RIO_STD_RTE_CONF_DESTID_SEL_CSR 0x70
162#define RIO_STD_RTE_CONF_PORT_SEL_CSR 0x74
163#define RIO_STD_RTE_DEFAULT_PORT 0x78
164
165 /* 0x7c-0xf8 *//* Reserved */
157 /* 0x100-0xfff8 *//* [I] Extended Features Space */ 166 /* 0x100-0xfff8 *//* [I] Extended Features Space */
158 /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */ 167 /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */
159 168
@@ -183,9 +192,14 @@
183#define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */ 192#define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */
184#define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */ 193#define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */
185#define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */ 194#define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */
195#define RIO_EFB_SER_EP_ID_V13P 0x0001 /* [VI] LP/Serial EP Devices, RapidIO Spec ver 1.3 and above */
196#define RIO_EFB_SER_EP_REC_ID_V13P 0x0002 /* [VI] LP/Serial EP Recovery Devices, RapidIO Spec ver 1.3 and above */
197#define RIO_EFB_SER_EP_FREE_ID_V13P 0x0003 /* [VI] LP/Serial EP Free Devices, RapidIO Spec ver 1.3 and above */
186#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */ 198#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */
187#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */ 199#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */
188#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */ 200#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */
201#define RIO_EFB_SER_EP_FREC_ID 0x0009 /* [VI] LP/Serial EP Free Recovery Devices */
202#define RIO_EFB_ERR_MGMNT 0x0007 /* [VIII] Error Management Extensions */
189 203
190/* 204/*
191 * Physical 8/16 LP-LVDS 205 * Physical 8/16 LP-LVDS
@@ -201,15 +215,71 @@
201#define RIO_PORT_MNT_HEADER 0x0000 215#define RIO_PORT_MNT_HEADER 0x0000
202#define RIO_PORT_REQ_CTL_CSR 0x0020 216#define RIO_PORT_REQ_CTL_CSR 0x0020
203#define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */ 217#define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */
218#define RIO_PORT_LINKTO_CTL_CSR 0x0020 /* Serial */
219#define RIO_PORT_RSPTO_CTL_CSR 0x0024 /* Serial */
204#define RIO_PORT_GEN_CTL_CSR 0x003c 220#define RIO_PORT_GEN_CTL_CSR 0x003c
205#define RIO_PORT_GEN_HOST 0x80000000 221#define RIO_PORT_GEN_HOST 0x80000000
206#define RIO_PORT_GEN_MASTER 0x40000000 222#define RIO_PORT_GEN_MASTER 0x40000000
207#define RIO_PORT_GEN_DISCOVERED 0x20000000 223#define RIO_PORT_GEN_DISCOVERED 0x20000000
208#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */ 224#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */
209#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */ 225#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */
226#define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */
227#define RIO_PORT_N_MNT_RSP_ASTAT 0x000003e0 /* ackID Status */
228#define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */
210#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */ 229#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */
211#define RIO_PORT_N_ERR_STS_CSR(x) (0x58 + x*0x20) 230#define RIO_PORT_N_ACK_CLEAR 0x80000000
212#define PORT_N_ERR_STS_PORT_OK 0x00000002 231#define RIO_PORT_N_ACK_INBOUND 0x1f000000
213#define RIO_PORT_N_CTL_CSR(x) (0x5c + x*0x20) 232#define RIO_PORT_N_ACK_OUTSTAND 0x00001f00
233#define RIO_PORT_N_ACK_OUTBOUND 0x0000001f
234#define RIO_PORT_N_ERR_STS_CSR(x) (0x0058 + x*0x20)
235#define RIO_PORT_N_ERR_STS_PW_OUT_ES 0x00010000 /* Output Error-stopped */
236#define RIO_PORT_N_ERR_STS_PW_INP_ES 0x00000100 /* Input Error-stopped */
237#define RIO_PORT_N_ERR_STS_PW_PEND 0x00000010 /* Port-Write Pending */
238#define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004
239#define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002
240#define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001
241#define RIO_PORT_N_ERR_STS_CLR_MASK 0x07120204
242#define RIO_PORT_N_CTL_CSR(x) (0x005c + x*0x20)
243#define RIO_PORT_N_CTL_PWIDTH 0xc0000000
244#define RIO_PORT_N_CTL_PWIDTH_1 0x00000000
245#define RIO_PORT_N_CTL_PWIDTH_4 0x40000000
246#define RIO_PORT_N_CTL_P_TYP_SER 0x00000001
247#define RIO_PORT_N_CTL_LOCKOUT 0x00000002
248#define RIO_PORT_N_CTL_EN_RX_SER 0x00200000
249#define RIO_PORT_N_CTL_EN_TX_SER 0x00400000
250#define RIO_PORT_N_CTL_EN_RX_PAR 0x08000000
251#define RIO_PORT_N_CTL_EN_TX_PAR 0x40000000
252
253/*
254 * Error Management Extensions (RapidIO 1.3+, Part 8)
255 *
256 * Extended Features Block ID=0x0007
257 */
258
259/* General EM Registers (Common for all Ports) */
260
261#define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */
262#define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */
263#define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */
264#define RIO_EM_LTL_HIADDR_CAP 0x010 /* Logical/Transport Layer High Address Capture CSR */
265#define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */
266#define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */
267#define RIO_EM_LTL_CTRL_CAP 0x01c /* Logical/Transport Layer Control Capture CSR */
268#define RIO_EM_PW_TGT_DEVID 0x028 /* Port-write Target deviceID CSR */
269#define RIO_EM_PKT_TTL 0x02c /* Packet Time-to-live CSR */
270
271/* Per-Port EM Registers */
272
273#define RIO_EM_PN_ERR_DETECT(x) (0x040 + x*0x40) /* Port N Error Detect CSR */
274#define REM_PED_IMPL_SPEC 0x80000000
275#define REM_PED_LINK_TO 0x00000001
276#define RIO_EM_PN_ERRRATE_EN(x) (0x044 + x*0x40) /* Port N Error Rate Enable CSR */
277#define RIO_EM_PN_ATTRIB_CAP(x) (0x048 + x*0x40) /* Port N Attributes Capture CSR */
278#define RIO_EM_PN_PKT_CAP_0(x) (0x04c + x*0x40) /* Port N Packet/Control Symbol Capture 0 CSR */
279#define RIO_EM_PN_PKT_CAP_1(x) (0x050 + x*0x40) /* Port N Packet Capture 1 CSR */
280#define RIO_EM_PN_PKT_CAP_2(x) (0x054 + x*0x40) /* Port N Packet Capture 2 CSR */
281#define RIO_EM_PN_PKT_CAP_3(x) (0x058 + x*0x40) /* Port N Packet Capture 3 CSR */
282#define RIO_EM_PN_ERRRATE(x) (0x068 + x*0x40) /* Port N Error Rate CSR */
283#define RIO_EM_PN_ERRRATE_TR(x) (0x06c + x*0x40) /* Port N Error Rate Threshold CSR */
214 284
215#endif /* LINUX_RIO_REGS_H */ 285#endif /* LINUX_RIO_REGS_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index b019ae64e2ab..77216742c178 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,8 +26,17 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29#ifdef CONFIG_KSM 29#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
30 atomic_t ksm_refcount; 30
31 /*
32 * The external_refcount is taken by either KSM or page migration
33 * to take a reference to an anon_vma when there is no
34 * guarantee that the vma of page tables will exist for
35 * the duration of the operation. A caller that takes
36 * the reference is responsible for clearing up the
37 * anon_vma if they are the last user on release
38 */
39 atomic_t external_refcount;
31#endif 40#endif
32 /* 41 /*
33 * NOTE: the LSB of the head.next is set by 42 * NOTE: the LSB of the head.next is set by
@@ -37,26 +46,46 @@ struct anon_vma {
37 * is serialized by a system wide lock only visible to 46 * is serialized by a system wide lock only visible to
38 * mm_take_all_locks() (mm_all_locks_mutex). 47 * mm_take_all_locks() (mm_all_locks_mutex).
39 */ 48 */
40 struct list_head head; /* List of private "related" vmas */ 49 struct list_head head; /* Chain of private "related" vmas */
50};
51
52/*
53 * The copy-on-write semantics of fork mean that an anon_vma
54 * can become associated with multiple processes. Furthermore,
55 * each child process will have its own anon_vma, where new
56 * pages for that process are instantiated.
57 *
58 * This structure allows us to find the anon_vmas associated
59 * with a VMA, or the VMAs associated with an anon_vma.
60 * The "same_vma" list contains the anon_vma_chains linking
61 * all the anon_vmas associated with this VMA.
62 * The "same_anon_vma" list contains the anon_vma_chains
63 * which link all the VMAs associated with this anon_vma.
64 */
65struct anon_vma_chain {
66 struct vm_area_struct *vma;
67 struct anon_vma *anon_vma;
68 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */
69 struct list_head same_anon_vma; /* locked by anon_vma->lock */
41}; 70};
42 71
43#ifdef CONFIG_MMU 72#ifdef CONFIG_MMU
44#ifdef CONFIG_KSM 73#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
45static inline void ksm_refcount_init(struct anon_vma *anon_vma) 74static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
46{ 75{
47 atomic_set(&anon_vma->ksm_refcount, 0); 76 atomic_set(&anon_vma->external_refcount, 0);
48} 77}
49 78
50static inline int ksm_refcount(struct anon_vma *anon_vma) 79static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
51{ 80{
52 return atomic_read(&anon_vma->ksm_refcount); 81 return atomic_read(&anon_vma->external_refcount);
53} 82}
54#else 83#else
55static inline void ksm_refcount_init(struct anon_vma *anon_vma) 84static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
56{ 85{
57} 86}
58 87
59static inline int ksm_refcount(struct anon_vma *anon_vma) 88static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
60{ 89{
61 return 0; 90 return 0;
62} 91}
@@ -89,15 +118,23 @@ static inline void anon_vma_unlock(struct vm_area_struct *vma)
89 */ 118 */
90void anon_vma_init(void); /* create anon_vma_cachep */ 119void anon_vma_init(void); /* create anon_vma_cachep */
91int anon_vma_prepare(struct vm_area_struct *); 120int anon_vma_prepare(struct vm_area_struct *);
92void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *); 121void unlink_anon_vmas(struct vm_area_struct *);
93void anon_vma_unlink(struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
94void anon_vma_link(struct vm_area_struct *); 123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
95void __anon_vma_link(struct vm_area_struct *); 124void __anon_vma_link(struct vm_area_struct *);
96void anon_vma_free(struct anon_vma *); 125void anon_vma_free(struct anon_vma *);
97 126
127static inline void anon_vma_merge(struct vm_area_struct *vma,
128 struct vm_area_struct *next)
129{
130 VM_BUG_ON(vma->anon_vma != next->anon_vma);
131 unlink_anon_vmas(next);
132}
133
98/* 134/*
99 * rmap interfaces called when adding or removing pte of page 135 * rmap interfaces called when adding or removing pte of page
100 */ 136 */
137void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
101void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 138void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
102void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 139void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
103void page_add_file_rmap(struct page *); 140void page_add_file_rmap(struct page *);
@@ -181,7 +218,7 @@ static inline int page_referenced(struct page *page, int is_locked,
181 unsigned long *vm_flags) 218 unsigned long *vm_flags)
182{ 219{
183 *vm_flags = 0; 220 *vm_flags = 0;
184 return TestClearPageReferenced(page); 221 return 0;
185} 222}
186 223
187#define try_to_unmap(page, refs) SWAP_FAIL 224#define try_to_unmap(page, refs) SWAP_FAIL
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
index 8ba646e610d9..e55d82cebf80 100644
--- a/include/linux/rtc-v3020.h
+++ b/include/linux/rtc-v3020.h
@@ -15,7 +15,7 @@
15struct v3020_platform_data { 15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */ 16 int leftshift; /* (1<<(leftshift)) & readl() */
17 17
18 int use_gpio:1; 18 unsigned int use_gpio:1;
19 unsigned int gpio_cs; 19 unsigned int gpio_cs;
20 unsigned int gpio_wr; 20 unsigned int gpio_wr;
21 unsigned int gpio_rd; 21 unsigned int gpio_rd;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 60f88a7fb13d..14dbc83ded20 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -238,6 +238,12 @@ static inline bool is_leap_year(unsigned int year)
238 return (!(year % 4) && (year % 100)) || !(year % 400); 238 return (!(year % 4) && (year % 100)) || !(year % 400);
239} 239}
240 240
241#ifdef CONFIG_RTC_HCTOSYS
242extern int rtc_hctosys_ret;
243#else
244#define rtc_hctosys_ret -ENODEV
245#endif
246
241#endif /* __KERNEL__ */ 247#endif /* __KERNEL__ */
242 248
243#endif /* _LINUX_RTC_H_ */ 249#endif /* _LINUX_RTC_H_ */
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 281d8fd775e8..8d522ffeda33 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -16,6 +16,8 @@
16#include <linux/plist.h> 16#include <linux/plist.h>
17#include <linux/spinlock_types.h> 17#include <linux/spinlock_types.h>
18 18
19extern int max_lock_depth; /* for sysctl */
20
19/** 21/**
20 * The rt_mutex structure 22 * The rt_mutex structure
21 * 23 *
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 05330fc5b436..fbc8cb0d48c3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -7,6 +7,13 @@
7#include <linux/if_addr.h> 7#include <linux/if_addr.h>
8#include <linux/neighbour.h> 8#include <linux/neighbour.h>
9 9
10/* rtnetlink families. Values up to 127 are reserved for real address
11 * families, values above 128 may be used arbitrarily.
12 */
13#define RTNL_FAMILY_IPMR 128
14#define RTNL_FAMILY_IP6MR 129
15#define RTNL_FAMILY_MAX 129
16
10/**** 17/****
11 * Routing/neighbour discovery messages. 18 * Routing/neighbour discovery messages.
12 ****/ 19 ****/
@@ -362,6 +369,8 @@ enum {
362#define RTAX_FEATURES RTAX_FEATURES 369#define RTAX_FEATURES RTAX_FEATURES
363 RTAX_RTO_MIN, 370 RTAX_RTO_MIN,
364#define RTAX_RTO_MIN RTAX_RTO_MIN 371#define RTAX_RTO_MIN RTAX_RTO_MIN
372 RTAX_INITRWND,
373#define RTAX_INITRWND RTAX_INITRWND
365 __RTAX_MAX 374 __RTAX_MAX
366}; 375};
367 376
@@ -735,6 +744,9 @@ extern void rtnl_lock(void);
735extern void rtnl_unlock(void); 744extern void rtnl_unlock(void);
736extern int rtnl_trylock(void); 745extern int rtnl_trylock(void);
737extern int rtnl_is_locked(void); 746extern int rtnl_is_locked(void);
747#ifdef CONFIG_PROVE_LOCKING
748extern int lockdep_rtnl_is_held(void);
749#endif /* #ifdef CONFIG_PROVE_LOCKING */
738 750
739extern void rtnetlink_init(void); 751extern void rtnetlink_init(void);
740extern void __rtnl_unlock(void); 752extern void __rtnl_unlock(void);
diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h
index 71e0b00b6f2c..bc2994ed66e1 100644
--- a/include/linux/rwlock.h
+++ b/include/linux/rwlock.h
@@ -29,25 +29,25 @@ do { \
29#endif 29#endif
30 30
31#ifdef CONFIG_DEBUG_SPINLOCK 31#ifdef CONFIG_DEBUG_SPINLOCK
32 extern void do_raw_read_lock(rwlock_t *lock); 32 extern void do_raw_read_lock(rwlock_t *lock) __acquires(lock);
33#define do_raw_read_lock_flags(lock, flags) do_raw_read_lock(lock) 33#define do_raw_read_lock_flags(lock, flags) do_raw_read_lock(lock)
34 extern int do_raw_read_trylock(rwlock_t *lock); 34 extern int do_raw_read_trylock(rwlock_t *lock);
35 extern void do_raw_read_unlock(rwlock_t *lock); 35 extern void do_raw_read_unlock(rwlock_t *lock) __releases(lock);
36 extern void do_raw_write_lock(rwlock_t *lock); 36 extern void do_raw_write_lock(rwlock_t *lock) __acquires(lock);
37#define do_raw_write_lock_flags(lock, flags) do_raw_write_lock(lock) 37#define do_raw_write_lock_flags(lock, flags) do_raw_write_lock(lock)
38 extern int do_raw_write_trylock(rwlock_t *lock); 38 extern int do_raw_write_trylock(rwlock_t *lock);
39 extern void do_raw_write_unlock(rwlock_t *lock); 39 extern void do_raw_write_unlock(rwlock_t *lock) __releases(lock);
40#else 40#else
41# define do_raw_read_lock(rwlock) arch_read_lock(&(rwlock)->raw_lock) 41# define do_raw_read_lock(rwlock) do {__acquire(lock); arch_read_lock(&(rwlock)->raw_lock); } while (0)
42# define do_raw_read_lock_flags(lock, flags) \ 42# define do_raw_read_lock_flags(lock, flags) \
43 arch_read_lock_flags(&(lock)->raw_lock, *(flags)) 43 do {__acquire(lock); arch_read_lock_flags(&(lock)->raw_lock, *(flags)); } while (0)
44# define do_raw_read_trylock(rwlock) arch_read_trylock(&(rwlock)->raw_lock) 44# define do_raw_read_trylock(rwlock) arch_read_trylock(&(rwlock)->raw_lock)
45# define do_raw_read_unlock(rwlock) arch_read_unlock(&(rwlock)->raw_lock) 45# define do_raw_read_unlock(rwlock) do {arch_read_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)
46# define do_raw_write_lock(rwlock) arch_write_lock(&(rwlock)->raw_lock) 46# define do_raw_write_lock(rwlock) do {__acquire(lock); arch_write_lock(&(rwlock)->raw_lock); } while (0)
47# define do_raw_write_lock_flags(lock, flags) \ 47# define do_raw_write_lock_flags(lock, flags) \
48 arch_write_lock_flags(&(lock)->raw_lock, *(flags)) 48 do {__acquire(lock); arch_write_lock_flags(&(lock)->raw_lock, *(flags)); } while (0)
49# define do_raw_write_trylock(rwlock) arch_write_trylock(&(rwlock)->raw_lock) 49# define do_raw_write_trylock(rwlock) arch_write_trylock(&(rwlock)->raw_lock)
50# define do_raw_write_unlock(rwlock) arch_write_unlock(&(rwlock)->raw_lock) 50# define do_raw_write_unlock(rwlock) do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)
51#endif 51#endif
52 52
53#define read_can_lock(rwlock) arch_read_can_lock(&(rwlock)->raw_lock) 53#define read_can_lock(rwlock) arch_read_can_lock(&(rwlock)->raw_lock)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index abdfacc58653..0478888c6899 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -97,9 +97,8 @@ struct sched_param {
97struct exec_domain; 97struct exec_domain;
98struct futex_pi_state; 98struct futex_pi_state;
99struct robust_list_head; 99struct robust_list_head;
100struct bio; 100struct bio_list;
101struct fs_struct; 101struct fs_struct;
102struct bts_context;
103struct perf_event_context; 102struct perf_event_context;
104 103
105/* 104/*
@@ -140,7 +139,7 @@ extern int nr_processes(void);
140extern unsigned long nr_running(void); 139extern unsigned long nr_running(void);
141extern unsigned long nr_uninterruptible(void); 140extern unsigned long nr_uninterruptible(void);
142extern unsigned long nr_iowait(void); 141extern unsigned long nr_iowait(void);
143extern unsigned long nr_iowait_cpu(void); 142extern unsigned long nr_iowait_cpu(int cpu);
144extern unsigned long this_cpu_load(void); 143extern unsigned long this_cpu_load(void);
145 144
146 145
@@ -215,6 +214,7 @@ extern char ___assert_task_state[1 - 2*!!(
215 214
216#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) 215#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
217#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) 216#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
217#define task_is_dead(task) ((task)->exit_state != 0)
218#define task_is_stopped_or_traced(task) \ 218#define task_is_stopped_or_traced(task) \
219 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 219 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
220#define task_contributes_to_load(task) \ 220#define task_contributes_to_load(task) \
@@ -258,6 +258,10 @@ extern spinlock_t mmlist_lock;
258 258
259struct task_struct; 259struct task_struct;
260 260
261#ifdef CONFIG_PROVE_RCU
262extern int lockdep_tasklist_lock_is_held(void);
263#endif /* #ifdef CONFIG_PROVE_RCU */
264
261extern void sched_init(void); 265extern void sched_init(void);
262extern void sched_init_smp(void); 266extern void sched_init_smp(void);
263extern asmlinkage void schedule_tail(struct task_struct *prev); 267extern asmlinkage void schedule_tail(struct task_struct *prev);
@@ -265,17 +269,22 @@ extern void init_idle(struct task_struct *idle, int cpu);
265extern void init_idle_bootup_task(struct task_struct *idle); 269extern void init_idle_bootup_task(struct task_struct *idle);
266 270
267extern int runqueue_is_locked(int cpu); 271extern int runqueue_is_locked(int cpu);
268extern void task_rq_unlock_wait(struct task_struct *p);
269 272
270extern cpumask_var_t nohz_cpu_mask; 273extern cpumask_var_t nohz_cpu_mask;
271#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
272extern int select_nohz_load_balancer(int cpu); 275extern int select_nohz_load_balancer(int cpu);
273extern int get_nohz_load_balancer(void); 276extern int get_nohz_load_balancer(void);
277extern int nohz_ratelimit(int cpu);
274#else 278#else
275static inline int select_nohz_load_balancer(int cpu) 279static inline int select_nohz_load_balancer(int cpu)
276{ 280{
277 return 0; 281 return 0;
278} 282}
283
284static inline int nohz_ratelimit(int cpu)
285{
286 return 0;
287}
279#endif 288#endif
280 289
281/* 290/*
@@ -310,6 +319,7 @@ extern void sched_show_task(struct task_struct *p);
310#ifdef CONFIG_DETECT_SOFTLOCKUP 319#ifdef CONFIG_DETECT_SOFTLOCKUP
311extern void softlockup_tick(void); 320extern void softlockup_tick(void);
312extern void touch_softlockup_watchdog(void); 321extern void touch_softlockup_watchdog(void);
322extern void touch_softlockup_watchdog_sync(void);
313extern void touch_all_softlockup_watchdogs(void); 323extern void touch_all_softlockup_watchdogs(void);
314extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 324extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
315 void __user *buffer, 325 void __user *buffer,
@@ -323,6 +333,9 @@ static inline void softlockup_tick(void)
323static inline void touch_softlockup_watchdog(void) 333static inline void touch_softlockup_watchdog(void)
324{ 334{
325} 335}
336static inline void touch_softlockup_watchdog_sync(void)
337{
338}
326static inline void touch_all_softlockup_watchdogs(void) 339static inline void touch_all_softlockup_watchdogs(void)
327{ 340{
328} 341}
@@ -371,7 +384,7 @@ struct user_namespace;
371 * 1-3 now and depends on arch. We use "5" as safe margin, here. 384 * 1-3 now and depends on arch. We use "5" as safe margin, here.
372 */ 385 */
373#define MAPCOUNT_ELF_CORE_MARGIN (5) 386#define MAPCOUNT_ELF_CORE_MARGIN (5)
374#define DEFAULT_MAX_MAP_COUNT (USHORT_MAX - MAPCOUNT_ELF_CORE_MARGIN) 387#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
375 388
376extern int sysctl_max_map_count; 389extern int sysctl_max_map_count;
377 390
@@ -392,60 +405,6 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
392static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} 405static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
393#endif 406#endif
394 407
395#if USE_SPLIT_PTLOCKS
396/*
397 * The mm counters are not protected by its page_table_lock,
398 * so must be incremented atomically.
399 */
400#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
401#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
402#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
403#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
404#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
405
406#else /* !USE_SPLIT_PTLOCKS */
407/*
408 * The mm counters are protected by its page_table_lock,
409 * so can be incremented directly.
410 */
411#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
412#define get_mm_counter(mm, member) ((mm)->_##member)
413#define add_mm_counter(mm, member, value) (mm)->_##member += (value)
414#define inc_mm_counter(mm, member) (mm)->_##member++
415#define dec_mm_counter(mm, member) (mm)->_##member--
416
417#endif /* !USE_SPLIT_PTLOCKS */
418
419#define get_mm_rss(mm) \
420 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
421#define update_hiwater_rss(mm) do { \
422 unsigned long _rss = get_mm_rss(mm); \
423 if ((mm)->hiwater_rss < _rss) \
424 (mm)->hiwater_rss = _rss; \
425} while (0)
426#define update_hiwater_vm(mm) do { \
427 if ((mm)->hiwater_vm < (mm)->total_vm) \
428 (mm)->hiwater_vm = (mm)->total_vm; \
429} while (0)
430
431static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
432{
433 return max(mm->hiwater_rss, get_mm_rss(mm));
434}
435
436static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
437 struct mm_struct *mm)
438{
439 unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
440
441 if (*maxrss < hiwater_rss)
442 *maxrss = hiwater_rss;
443}
444
445static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
446{
447 return max(mm->hiwater_vm, mm->total_vm);
448}
449 408
450extern void set_dumpable(struct mm_struct *mm, int value); 409extern void set_dumpable(struct mm_struct *mm, int value);
451extern int get_dumpable(struct mm_struct *mm); 410extern int get_dumpable(struct mm_struct *mm);
@@ -568,8 +527,9 @@ struct thread_group_cputimer {
568 * the locking of signal_struct. 527 * the locking of signal_struct.
569 */ 528 */
570struct signal_struct { 529struct signal_struct {
571 atomic_t count; 530 atomic_t sigcnt;
572 atomic_t live; 531 atomic_t live;
532 int nr_threads;
573 533
574 wait_queue_head_t wait_chldexit; /* for wait4() */ 534 wait_queue_head_t wait_chldexit; /* for wait4() */
575 535
@@ -736,14 +696,6 @@ struct user_struct {
736 uid_t uid; 696 uid_t uid;
737 struct user_namespace *user_ns; 697 struct user_namespace *user_ns;
738 698
739#ifdef CONFIG_USER_SCHED
740 struct task_group *tg;
741#ifdef CONFIG_SYSFS
742 struct kobject kobj;
743 struct delayed_work work;
744#endif
745#endif
746
747#ifdef CONFIG_PERF_EVENTS 699#ifdef CONFIG_PERF_EVENTS
748 atomic_long_t locked_vm; 700 atomic_long_t locked_vm;
749#endif 701#endif
@@ -874,7 +826,10 @@ static inline int sd_balance_for_mc_power(void)
874 if (sched_smt_power_savings) 826 if (sched_smt_power_savings)
875 return SD_POWERSAVINGS_BALANCE; 827 return SD_POWERSAVINGS_BALANCE;
876 828
877 return SD_PREFER_SIBLING; 829 if (!sched_mc_power_savings)
830 return SD_PREFER_SIBLING;
831
832 return 0;
878} 833}
879 834
880static inline int sd_balance_for_package_power(void) 835static inline int sd_balance_for_package_power(void)
@@ -1005,6 +960,7 @@ struct sched_domain {
1005 char *name; 960 char *name;
1006#endif 961#endif
1007 962
963 unsigned int span_weight;
1008 /* 964 /*
1009 * Span of all CPUs in this domain. 965 * Span of all CPUs in this domain.
1010 * 966 *
@@ -1077,11 +1033,17 @@ struct sched_domain;
1077#define WF_SYNC 0x01 /* waker goes to sleep after wakup */ 1033#define WF_SYNC 0x01 /* waker goes to sleep after wakup */
1078#define WF_FORK 0x02 /* child wakeup after fork */ 1034#define WF_FORK 0x02 /* child wakeup after fork */
1079 1035
1036#define ENQUEUE_WAKEUP 1
1037#define ENQUEUE_WAKING 2
1038#define ENQUEUE_HEAD 4
1039
1040#define DEQUEUE_SLEEP 1
1041
1080struct sched_class { 1042struct sched_class {
1081 const struct sched_class *next; 1043 const struct sched_class *next;
1082 1044
1083 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); 1045 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
1084 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 1046 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
1085 void (*yield_task) (struct rq *rq); 1047 void (*yield_task) (struct rq *rq);
1086 1048
1087 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); 1049 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
@@ -1090,16 +1052,9 @@ struct sched_class {
1090 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 1052 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1091 1053
1092#ifdef CONFIG_SMP 1054#ifdef CONFIG_SMP
1093 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); 1055 int (*select_task_rq)(struct rq *rq, struct task_struct *p,
1094 1056 int sd_flag, int flags);
1095 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
1096 struct rq *busiest, unsigned long max_load_move,
1097 struct sched_domain *sd, enum cpu_idle_type idle,
1098 int *all_pinned, int *this_best_prio);
1099 1057
1100 int (*move_one_task) (struct rq *this_rq, int this_cpu,
1101 struct rq *busiest, struct sched_domain *sd,
1102 enum cpu_idle_type idle);
1103 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1058 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1104 void (*post_schedule) (struct rq *this_rq); 1059 void (*post_schedule) (struct rq *this_rq);
1105 void (*task_waking) (struct rq *this_rq, struct task_struct *task); 1060 void (*task_waking) (struct rq *this_rq, struct task_struct *task);
@@ -1135,36 +1090,8 @@ struct load_weight {
1135 unsigned long weight, inv_weight; 1090 unsigned long weight, inv_weight;
1136}; 1091};
1137 1092
1138/*
1139 * CFS stats for a schedulable entity (task, task-group etc)
1140 *
1141 * Current field usage histogram:
1142 *
1143 * 4 se->block_start
1144 * 4 se->run_node
1145 * 4 se->sleep_start
1146 * 6 se->load.weight
1147 */
1148struct sched_entity {
1149 struct load_weight load; /* for load-balancing */
1150 struct rb_node run_node;
1151 struct list_head group_node;
1152 unsigned int on_rq;
1153
1154 u64 exec_start;
1155 u64 sum_exec_runtime;
1156 u64 vruntime;
1157 u64 prev_sum_exec_runtime;
1158
1159 u64 last_wakeup;
1160 u64 avg_overlap;
1161
1162 u64 nr_migrations;
1163
1164 u64 start_runtime;
1165 u64 avg_wakeup;
1166
1167#ifdef CONFIG_SCHEDSTATS 1093#ifdef CONFIG_SCHEDSTATS
1094struct sched_statistics {
1168 u64 wait_start; 1095 u64 wait_start;
1169 u64 wait_max; 1096 u64 wait_max;
1170 u64 wait_count; 1097 u64 wait_count;
@@ -1196,6 +1123,24 @@ struct sched_entity {
1196 u64 nr_wakeups_affine_attempts; 1123 u64 nr_wakeups_affine_attempts;
1197 u64 nr_wakeups_passive; 1124 u64 nr_wakeups_passive;
1198 u64 nr_wakeups_idle; 1125 u64 nr_wakeups_idle;
1126};
1127#endif
1128
1129struct sched_entity {
1130 struct load_weight load; /* for load-balancing */
1131 struct rb_node run_node;
1132 struct list_head group_node;
1133 unsigned int on_rq;
1134
1135 u64 exec_start;
1136 u64 sum_exec_runtime;
1137 u64 vruntime;
1138 u64 prev_sum_exec_runtime;
1139
1140 u64 nr_migrations;
1141
1142#ifdef CONFIG_SCHEDSTATS
1143 struct sched_statistics statistics;
1199#endif 1144#endif
1200 1145
1201#ifdef CONFIG_FAIR_GROUP_SCHED 1146#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1282,7 +1227,9 @@ struct task_struct {
1282 struct plist_node pushable_tasks; 1227 struct plist_node pushable_tasks;
1283 1228
1284 struct mm_struct *mm, *active_mm; 1229 struct mm_struct *mm, *active_mm;
1285 1230#if defined(SPLIT_RSS_COUNTING)
1231 struct task_rss_stat rss_stat;
1232#endif
1286/* task state */ 1233/* task state */
1287 int exit_state; 1234 int exit_state;
1288 int exit_code, exit_signal; 1235 int exit_code, exit_signal;
@@ -1328,12 +1275,6 @@ struct task_struct {
1328 struct list_head ptraced; 1275 struct list_head ptraced;
1329 struct list_head ptrace_entry; 1276 struct list_head ptrace_entry;
1330 1277
1331 /*
1332 * This is the tracer handle for the ptrace BTS extension.
1333 * This field actually belongs to the ptracer task.
1334 */
1335 struct bts_context *bts;
1336
1337 /* PID/PID hash table linkage. */ 1278 /* PID/PID hash table linkage. */
1338 struct pid_link pids[PIDTYPE_MAX]; 1279 struct pid_link pids[PIDTYPE_MAX];
1339 struct list_head thread_group; 1280 struct list_head thread_group;
@@ -1462,7 +1403,7 @@ struct task_struct {
1462 void *journal_info; 1403 void *journal_info;
1463 1404
1464/* stacked block device info */ 1405/* stacked block device info */
1465 struct bio *bio_list, **bio_tail; 1406 struct bio_list *bio_list;
1466 1407
1467/* VM state */ 1408/* VM state */
1468 struct reclaim_state *reclaim_state; 1409 struct reclaim_state *reclaim_state;
@@ -1481,7 +1422,9 @@ struct task_struct {
1481#endif 1422#endif
1482#ifdef CONFIG_CPUSETS 1423#ifdef CONFIG_CPUSETS
1483 nodemask_t mems_allowed; /* Protected by alloc_lock */ 1424 nodemask_t mems_allowed; /* Protected by alloc_lock */
1425 int mems_allowed_change_disable;
1484 int cpuset_mem_spread_rotor; 1426 int cpuset_mem_spread_rotor;
1427 int cpuset_slab_spread_rotor;
1485#endif 1428#endif
1486#ifdef CONFIG_CGROUPS 1429#ifdef CONFIG_CGROUPS
1487 /* Control Group info protected by css_set_lock */ 1430 /* Control Group info protected by css_set_lock */
@@ -1533,7 +1476,7 @@ struct task_struct {
1533 1476
1534 struct list_head *scm_work_list; 1477 struct list_head *scm_work_list;
1535#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1478#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1536 /* Index of current stored adress in ret_stack */ 1479 /* Index of current stored address in ret_stack */
1537 int curr_ret_stack; 1480 int curr_ret_stack;
1538 /* Stack of return addresses for return function tracing */ 1481 /* Stack of return addresses for return function tracing */
1539 struct ftrace_ret_stack *ret_stack; 1482 struct ftrace_ret_stack *ret_stack;
@@ -1553,7 +1496,6 @@ struct task_struct {
1553 /* bitmask of trace recursion */ 1496 /* bitmask of trace recursion */
1554 unsigned long trace_recursion; 1497 unsigned long trace_recursion;
1555#endif /* CONFIG_TRACING */ 1498#endif /* CONFIG_TRACING */
1556 unsigned long stack_start;
1557#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ 1499#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
1558 struct memcg_batch_info { 1500 struct memcg_batch_info {
1559 int do_batch; /* incremented when batch uncharge started */ 1501 int do_batch; /* incremented when batch uncharge started */
@@ -1903,6 +1845,7 @@ extern void sched_clock_idle_sleep_event(void);
1903extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1845extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1904 1846
1905#ifdef CONFIG_HOTPLUG_CPU 1847#ifdef CONFIG_HOTPLUG_CPU
1848extern void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p);
1906extern void idle_task_exit(void); 1849extern void idle_task_exit(void);
1907#else 1850#else
1908static inline void idle_task_exit(void) {} 1851static inline void idle_task_exit(void) {}
@@ -2094,7 +2037,7 @@ extern int do_notify_parent(struct task_struct *, int);
2094extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2037extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2095extern void force_sig(int, struct task_struct *); 2038extern void force_sig(int, struct task_struct *);
2096extern int send_sig(int, struct task_struct *, int); 2039extern int send_sig(int, struct task_struct *, int);
2097extern void zap_other_threads(struct task_struct *p); 2040extern int zap_other_threads(struct task_struct *p);
2098extern struct sigqueue *sigqueue_alloc(void); 2041extern struct sigqueue *sigqueue_alloc(void);
2099extern void sigqueue_free(struct sigqueue *); 2042extern void sigqueue_free(struct sigqueue *);
2100extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 2043extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
@@ -2159,7 +2102,6 @@ extern void flush_thread(void);
2159extern void exit_thread(void); 2102extern void exit_thread(void);
2160 2103
2161extern void exit_files(struct task_struct *); 2104extern void exit_files(struct task_struct *);
2162extern void __cleanup_signal(struct signal_struct *);
2163extern void __cleanup_sighand(struct sighand_struct *); 2105extern void __cleanup_sighand(struct sighand_struct *);
2164 2106
2165extern void exit_itimers(struct signal_struct *); 2107extern void exit_itimers(struct signal_struct *);
@@ -2179,10 +2121,8 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
2179extern char *get_task_comm(char *to, struct task_struct *tsk); 2121extern char *get_task_comm(char *to, struct task_struct *tsk);
2180 2122
2181#ifdef CONFIG_SMP 2123#ifdef CONFIG_SMP
2182extern void wait_task_context_switch(struct task_struct *p);
2183extern unsigned long wait_task_inactive(struct task_struct *, long match_state); 2124extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
2184#else 2125#else
2185static inline void wait_task_context_switch(struct task_struct *p) {}
2186static inline unsigned long wait_task_inactive(struct task_struct *p, 2126static inline unsigned long wait_task_inactive(struct task_struct *p,
2187 long match_state) 2127 long match_state)
2188{ 2128{
@@ -2208,6 +2148,11 @@ extern bool current_is_single_threaded(void);
2208#define while_each_thread(g, t) \ 2148#define while_each_thread(g, t) \
2209 while ((t = next_thread(t)) != g) 2149 while ((t = next_thread(t)) != g)
2210 2150
2151static inline int get_nr_threads(struct task_struct *tsk)
2152{
2153 return tsk->signal->nr_threads;
2154}
2155
2211/* de_thread depends on thread_group_leader not being a pid based check */ 2156/* de_thread depends on thread_group_leader not being a pid based check */
2212#define thread_group_leader(p) (p == p->group_leader) 2157#define thread_group_leader(p) (p == p->group_leader)
2213 2158
@@ -2451,13 +2396,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times);
2451 2396
2452static inline void thread_group_cputime_init(struct signal_struct *sig) 2397static inline void thread_group_cputime_init(struct signal_struct *sig)
2453{ 2398{
2454 sig->cputimer.cputime = INIT_CPUTIME;
2455 spin_lock_init(&sig->cputimer.lock); 2399 spin_lock_init(&sig->cputimer.lock);
2456 sig->cputimer.running = 0;
2457}
2458
2459static inline void thread_group_cputime_free(struct signal_struct *sig)
2460{
2461} 2400}
2462 2401
2463/* 2402/*
@@ -2513,13 +2452,9 @@ extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
2513 2452
2514extern void normalize_rt_tasks(void); 2453extern void normalize_rt_tasks(void);
2515 2454
2516#ifdef CONFIG_GROUP_SCHED 2455#ifdef CONFIG_CGROUP_SCHED
2517 2456
2518extern struct task_group init_task_group; 2457extern struct task_group init_task_group;
2519#ifdef CONFIG_USER_SCHED
2520extern struct task_group root_task_group;
2521extern void set_tg_uid(struct user_struct *user);
2522#endif
2523 2458
2524extern struct task_group *sched_create_group(struct task_group *parent); 2459extern struct task_group *sched_create_group(struct task_group *parent);
2525extern void sched_destroy_group(struct task_group *tg); 2460extern void sched_destroy_group(struct task_group *tg);
diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h
new file mode 100644
index 000000000000..0239bd70241e
--- /dev/null
+++ b/include/linux/sdhci-pltfm.h
@@ -0,0 +1,35 @@
1/*
2 * Platform data declarations for the sdhci-pltfm driver.
3 *
4 * Copyright (c) 2010 MontaVista Software, LLC.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.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 (at
11 * your option) any later version.
12 */
13
14#ifndef _SDHCI_PLTFM_H
15#define _SDHCI_PLTFM_H
16
17struct sdhci_ops;
18struct sdhci_host;
19
20/**
21 * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks
22 * @ops: optional pointer to the platform-provided SDHCI ops
23 * @quirks: optional SDHCI quirks
24 * @init: optional hook that is called during device probe, before the
25 * driver tries to access any SDHCI registers
26 * @exit: optional hook that is called during device removal
27 */
28struct sdhci_pltfm_data {
29 struct sdhci_ops *ops;
30 unsigned int quirks;
31 int (*init)(struct sdhci_host *host);
32 void (*exit)(struct sdhci_host *host);
33};
34
35#endif /* _SDHCI_PLTFM_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 2c627d361c02..0c8819170463 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -33,7 +33,7 @@
33#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/key.h> 34#include <linux/key.h>
35#include <linux/xfrm.h> 35#include <linux/xfrm.h>
36#include <linux/gfp.h> 36#include <linux/slab.h>
37#include <net/flow.h> 37#include <net/flow.h>
38 38
39/* Maximum number of letters for an LSM name string */ 39/* Maximum number of letters for an LSM name string */
@@ -76,7 +76,7 @@ extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
76extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); 76extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
77extern int cap_task_setioprio(struct task_struct *p, int ioprio); 77extern int cap_task_setioprio(struct task_struct *p, int ioprio);
78extern int cap_task_setnice(struct task_struct *p, int nice); 78extern int cap_task_setnice(struct task_struct *p, int nice);
79extern int cap_syslog(int type); 79extern int cap_syslog(int type, bool from_file);
80extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); 80extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
81 81
82struct msghdr; 82struct msghdr;
@@ -95,6 +95,8 @@ struct seq_file;
95extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 95extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
96extern int cap_netlink_recv(struct sk_buff *skb, int cap); 96extern int cap_netlink_recv(struct sk_buff *skb, int cap);
97 97
98void reset_security_ops(void);
99
98#ifdef CONFIG_MMU 100#ifdef CONFIG_MMU
99extern unsigned long mmap_min_addr; 101extern unsigned long mmap_min_addr;
100extern unsigned long dac_mmap_min_addr; 102extern unsigned long dac_mmap_min_addr;
@@ -265,49 +267,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
265 * @orig the original mount data copied from userspace. 267 * @orig the original mount data copied from userspace.
266 * @copy copied data which will be passed to the security module. 268 * @copy copied data which will be passed to the security module.
267 * Returns 0 if the copy was successful. 269 * Returns 0 if the copy was successful.
268 * @sb_check_sb:
269 * Check permission before the device with superblock @mnt->sb is mounted
270 * on the mount point named by @nd.
271 * @mnt contains the vfsmount for device being mounted.
272 * @path contains the path for the mount point.
273 * Return 0 if permission is granted.
274 * @sb_umount: 270 * @sb_umount:
275 * Check permission before the @mnt file system is unmounted. 271 * Check permission before the @mnt file system is unmounted.
276 * @mnt contains the mounted file system. 272 * @mnt contains the mounted file system.
277 * @flags contains the unmount flags, e.g. MNT_FORCE. 273 * @flags contains the unmount flags, e.g. MNT_FORCE.
278 * Return 0 if permission is granted. 274 * Return 0 if permission is granted.
279 * @sb_umount_close:
280 * Close any files in the @mnt mounted filesystem that are held open by
281 * the security module. This hook is called during an umount operation
282 * prior to checking whether the filesystem is still busy.
283 * @mnt contains the mounted filesystem.
284 * @sb_umount_busy:
285 * Handle a failed umount of the @mnt mounted filesystem, e.g. re-opening
286 * any files that were closed by umount_close. This hook is called during
287 * an umount operation if the umount fails after a call to the
288 * umount_close hook.
289 * @mnt contains the mounted filesystem.
290 * @sb_post_remount:
291 * Update the security module's state when a filesystem is remounted.
292 * This hook is only called if the remount was successful.
293 * @mnt contains the mounted file system.
294 * @flags contains the new filesystem flags.
295 * @data contains the filesystem-specific data.
296 * @sb_post_addmount:
297 * Update the security module's state when a filesystem is mounted.
298 * This hook is called any time a mount is successfully grafetd to
299 * the tree.
300 * @mnt contains the mounted filesystem.
301 * @mountpoint contains the path for the mount point.
302 * @sb_pivotroot: 275 * @sb_pivotroot:
303 * Check permission before pivoting the root filesystem. 276 * Check permission before pivoting the root filesystem.
304 * @old_path contains the path for the new location of the current root (put_old). 277 * @old_path contains the path for the new location of the current root (put_old).
305 * @new_path contains the path for the new root (new_root). 278 * @new_path contains the path for the new root (new_root).
306 * Return 0 if permission is granted. 279 * Return 0 if permission is granted.
307 * @sb_post_pivotroot:
308 * Update module state after a successful pivot.
309 * @old_path contains the path for the old root.
310 * @new_path contains the path for the new root.
311 * @sb_set_mnt_opts: 280 * @sb_set_mnt_opts:
312 * Set the security relevant mount options used for a superblock 281 * Set the security relevant mount options used for a superblock
313 * @sb the superblock to set security mount options for 282 * @sb the superblock to set security mount options for
@@ -509,12 +478,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
509 * @mnt is the vfsmount where the dentry was looked up 478 * @mnt is the vfsmount where the dentry was looked up
510 * @dentry contains the dentry structure for the file. 479 * @dentry contains the dentry structure for the file.
511 * Return 0 if permission is granted. 480 * Return 0 if permission is granted.
512 * @inode_delete:
513 * @inode contains the inode structure for deleted inode.
514 * This hook is called when a deleted inode is released (i.e. an inode
515 * with no hard links has its use count drop to zero). A security module
516 * can use this hook to release any persistent label associated with the
517 * inode.
518 * @inode_setxattr: 481 * @inode_setxattr:
519 * Check permission before setting the extended attributes 482 * Check permission before setting the extended attributes
520 * @value identified by @name for @dentry. 483 * @value identified by @name for @dentry.
@@ -689,10 +652,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
689 * @old points to the original credentials. 652 * @old points to the original credentials.
690 * @gfp indicates the atomicity of any memory allocations. 653 * @gfp indicates the atomicity of any memory allocations.
691 * Prepare a new set of credentials by copying the data from the old set. 654 * Prepare a new set of credentials by copying the data from the old set.
692 * @cred_commit:
693 * @new points to the new credentials.
694 * @old points to the original credentials.
695 * Install a new set of credentials.
696 * @cred_transfer: 655 * @cred_transfer:
697 * @new points to the new credentials. 656 * @new points to the new credentials.
698 * @old points to the original credentials. 657 * @old points to the original credentials.
@@ -715,18 +674,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
715 * userspace to load a kernel module with the given name. 674 * userspace to load a kernel module with the given name.
716 * @kmod_name name of the module requested by the kernel 675 * @kmod_name name of the module requested by the kernel
717 * Return 0 if successful. 676 * Return 0 if successful.
718 * @task_setuid:
719 * Check permission before setting one or more of the user identity
720 * attributes of the current process. The @flags parameter indicates
721 * which of the set*uid system calls invoked this hook and how to
722 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
723 * definitions at the beginning of this file for the @flags values and
724 * their meanings.
725 * @id0 contains a uid.
726 * @id1 contains a uid.
727 * @id2 contains a uid.
728 * @flags contains one of the LSM_SETID_* values.
729 * Return 0 if permission is granted.
730 * @task_fix_setuid: 677 * @task_fix_setuid:
731 * Update the module's state after setting one or more of the user 678 * Update the module's state after setting one or more of the user
732 * identity attributes of the current process. The @flags parameter 679 * identity attributes of the current process. The @flags parameter
@@ -736,18 +683,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
736 * @old is the set of credentials that are being replaces 683 * @old is the set of credentials that are being replaces
737 * @flags contains one of the LSM_SETID_* values. 684 * @flags contains one of the LSM_SETID_* values.
738 * Return 0 on success. 685 * Return 0 on success.
739 * @task_setgid:
740 * Check permission before setting one or more of the group identity
741 * attributes of the current process. The @flags parameter indicates
742 * which of the set*gid system calls invoked this hook and how to
743 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
744 * definitions at the beginning of this file for the @flags values and
745 * their meanings.
746 * @id0 contains a gid.
747 * @id1 contains a gid.
748 * @id2 contains a gid.
749 * @flags contains one of the LSM_SETID_* values.
750 * Return 0 if permission is granted.
751 * @task_setpgid: 686 * @task_setpgid:
752 * Check permission before setting the process group identifier of the 687 * Check permission before setting the process group identifier of the
753 * process @p to @pgid. 688 * process @p to @pgid.
@@ -769,11 +704,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
769 * @p contains the task_struct for the process and place is into @secid. 704 * @p contains the task_struct for the process and place is into @secid.
770 * In case of failure, @secid will be set to zero. 705 * In case of failure, @secid will be set to zero.
771 * 706 *
772 * @task_setgroups:
773 * Check permission before setting the supplementary group set of the
774 * current process.
775 * @group_info contains the new group information.
776 * Return 0 if permission is granted.
777 * @task_setnice: 707 * @task_setnice:
778 * Check permission before setting the nice value of @p to @nice. 708 * Check permission before setting the nice value of @p to @nice.
779 * @p contains the task_struct of process. 709 * @p contains the task_struct of process.
@@ -985,6 +915,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
985 * Check permissions on incoming network packets. This hook is distinct 915 * Check permissions on incoming network packets. This hook is distinct
986 * from Netfilter's IP input hooks since it is the first time that the 916 * from Netfilter's IP input hooks since it is the first time that the
987 * incoming sk_buff @skb has been associated with a particular socket, @sk. 917 * incoming sk_buff @skb has been associated with a particular socket, @sk.
918 * Must not sleep inside this hook because some callers hold spinlocks.
988 * @sk contains the sock (not socket) associated with the incoming sk_buff. 919 * @sk contains the sock (not socket) associated with the incoming sk_buff.
989 * @skb contains the incoming network data. 920 * @skb contains the incoming network data.
990 * @socket_getpeersec_stream: 921 * @socket_getpeersec_stream:
@@ -1136,13 +1067,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1136 * Return the length of the string (including terminating NUL) or -ve if 1067 * Return the length of the string (including terminating NUL) or -ve if
1137 * an error. 1068 * an error.
1138 * May also return 0 (and a NULL buffer pointer) if there is no label. 1069 * May also return 0 (and a NULL buffer pointer) if there is no label.
1139 * @key_session_to_parent:
1140 * Forcibly assign the session keyring from a process to its parent
1141 * process.
1142 * @cred: Pointer to process's credentials
1143 * @parent_cred: Pointer to parent process's credentials
1144 * @keyring: Proposed new session keyring
1145 * Return 0 if permission is granted, -ve error otherwise.
1146 * 1070 *
1147 * Security hooks affecting all System V IPC operations. 1071 * Security hooks affecting all System V IPC operations.
1148 * 1072 *
@@ -1330,13 +1254,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1330 * @cap contains the capability <include/linux/capability.h>. 1254 * @cap contains the capability <include/linux/capability.h>.
1331 * @audit: Whether to write an audit message or not 1255 * @audit: Whether to write an audit message or not
1332 * Return 0 if the capability is granted for @tsk. 1256 * Return 0 if the capability is granted for @tsk.
1333 * @acct:
1334 * Check permission before enabling or disabling process accounting. If
1335 * accounting is being enabled, then @file refers to the open file used to
1336 * store accounting records. If accounting is being disabled, then @file
1337 * is NULL.
1338 * @file contains the file structure for the accounting file (may be NULL).
1339 * Return 0 if permission is granted.
1340 * @sysctl: 1257 * @sysctl:
1341 * Check permission before accessing the @table sysctl variable in the 1258 * Check permission before accessing the @table sysctl variable in the
1342 * manner specified by @op. 1259 * manner specified by @op.
@@ -1348,6 +1265,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1348 * logging to the console. 1265 * logging to the console.
1349 * See the syslog(2) manual page for an explanation of the @type values. 1266 * See the syslog(2) manual page for an explanation of the @type values.
1350 * @type contains the type of action. 1267 * @type contains the type of action.
1268 * @from_file indicates the context of action (if it came from /proc).
1351 * Return 0 if permission is granted. 1269 * Return 0 if permission is granted.
1352 * @settime: 1270 * @settime:
1353 * Check permission to change the system time. 1271 * Check permission to change the system time.
@@ -1458,11 +1376,10 @@ struct security_operations {
1458 const kernel_cap_t *permitted); 1376 const kernel_cap_t *permitted);
1459 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1377 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1460 int cap, int audit); 1378 int cap, int audit);
1461 int (*acct) (struct file *file);
1462 int (*sysctl) (struct ctl_table *table, int op); 1379 int (*sysctl) (struct ctl_table *table, int op);
1463 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1380 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1464 int (*quota_on) (struct dentry *dentry); 1381 int (*quota_on) (struct dentry *dentry);
1465 int (*syslog) (int type); 1382 int (*syslog) (int type, bool from_file);
1466 int (*settime) (struct timespec *ts, struct timezone *tz); 1383 int (*settime) (struct timespec *ts, struct timezone *tz);
1467 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1384 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1468 1385
@@ -1480,18 +1397,9 @@ struct security_operations {
1480 int (*sb_statfs) (struct dentry *dentry); 1397 int (*sb_statfs) (struct dentry *dentry);
1481 int (*sb_mount) (char *dev_name, struct path *path, 1398 int (*sb_mount) (char *dev_name, struct path *path,
1482 char *type, unsigned long flags, void *data); 1399 char *type, unsigned long flags, void *data);
1483 int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
1484 int (*sb_umount) (struct vfsmount *mnt, int flags); 1400 int (*sb_umount) (struct vfsmount *mnt, int flags);
1485 void (*sb_umount_close) (struct vfsmount *mnt);
1486 void (*sb_umount_busy) (struct vfsmount *mnt);
1487 void (*sb_post_remount) (struct vfsmount *mnt,
1488 unsigned long flags, void *data);
1489 void (*sb_post_addmount) (struct vfsmount *mnt,
1490 struct path *mountpoint);
1491 int (*sb_pivotroot) (struct path *old_path, 1401 int (*sb_pivotroot) (struct path *old_path,
1492 struct path *new_path); 1402 struct path *new_path);
1493 void (*sb_post_pivotroot) (struct path *old_path,
1494 struct path *new_path);
1495 int (*sb_set_mnt_opts) (struct super_block *sb, 1403 int (*sb_set_mnt_opts) (struct super_block *sb,
1496 struct security_mnt_opts *opts); 1404 struct security_mnt_opts *opts);
1497 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1405 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
@@ -1540,7 +1448,6 @@ struct security_operations {
1540 int (*inode_permission) (struct inode *inode, int mask); 1448 int (*inode_permission) (struct inode *inode, int mask);
1541 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1449 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1542 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1450 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1543 void (*inode_delete) (struct inode *inode);
1544 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1451 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1545 const void *value, size_t size, int flags); 1452 const void *value, size_t size, int flags);
1546 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, 1453 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
@@ -1581,20 +1488,16 @@ struct security_operations {
1581 void (*cred_free) (struct cred *cred); 1488 void (*cred_free) (struct cred *cred);
1582 int (*cred_prepare)(struct cred *new, const struct cred *old, 1489 int (*cred_prepare)(struct cred *new, const struct cred *old,
1583 gfp_t gfp); 1490 gfp_t gfp);
1584 void (*cred_commit)(struct cred *new, const struct cred *old);
1585 void (*cred_transfer)(struct cred *new, const struct cred *old); 1491 void (*cred_transfer)(struct cred *new, const struct cred *old);
1586 int (*kernel_act_as)(struct cred *new, u32 secid); 1492 int (*kernel_act_as)(struct cred *new, u32 secid);
1587 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1493 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1588 int (*kernel_module_request)(char *kmod_name); 1494 int (*kernel_module_request)(char *kmod_name);
1589 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1590 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1495 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1591 int flags); 1496 int flags);
1592 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1593 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1497 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1594 int (*task_getpgid) (struct task_struct *p); 1498 int (*task_getpgid) (struct task_struct *p);
1595 int (*task_getsid) (struct task_struct *p); 1499 int (*task_getsid) (struct task_struct *p);
1596 void (*task_getsecid) (struct task_struct *p, u32 *secid); 1500 void (*task_getsecid) (struct task_struct *p, u32 *secid);
1597 int (*task_setgroups) (struct group_info *group_info);
1598 int (*task_setnice) (struct task_struct *p, int nice); 1501 int (*task_setnice) (struct task_struct *p, int nice);
1599 int (*task_setioprio) (struct task_struct *p, int ioprio); 1502 int (*task_setioprio) (struct task_struct *p, int ioprio);
1600 int (*task_getioprio) (struct task_struct *p); 1503 int (*task_getioprio) (struct task_struct *p);
@@ -1724,9 +1627,6 @@ struct security_operations {
1724 const struct cred *cred, 1627 const struct cred *cred,
1725 key_perm_t perm); 1628 key_perm_t perm);
1726 int (*key_getsecurity)(struct key *key, char **_buffer); 1629 int (*key_getsecurity)(struct key *key, char **_buffer);
1727 int (*key_session_to_parent)(const struct cred *cred,
1728 const struct cred *parent_cred,
1729 struct key *key);
1730#endif /* CONFIG_KEYS */ 1630#endif /* CONFIG_KEYS */
1731 1631
1732#ifdef CONFIG_AUDIT 1632#ifdef CONFIG_AUDIT
@@ -1757,11 +1657,10 @@ int security_capset(struct cred *new, const struct cred *old,
1757int security_capable(int cap); 1657int security_capable(int cap);
1758int security_real_capable(struct task_struct *tsk, int cap); 1658int security_real_capable(struct task_struct *tsk, int cap);
1759int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1659int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1760int security_acct(struct file *file);
1761int security_sysctl(struct ctl_table *table, int op); 1660int security_sysctl(struct ctl_table *table, int op);
1762int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1661int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1763int security_quota_on(struct dentry *dentry); 1662int security_quota_on(struct dentry *dentry);
1764int security_syslog(int type); 1663int security_syslog(int type, bool from_file);
1765int security_settime(struct timespec *ts, struct timezone *tz); 1664int security_settime(struct timespec *ts, struct timezone *tz);
1766int security_vm_enough_memory(long pages); 1665int security_vm_enough_memory(long pages);
1767int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1666int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
@@ -1779,14 +1678,8 @@ int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1779int security_sb_statfs(struct dentry *dentry); 1678int security_sb_statfs(struct dentry *dentry);
1780int security_sb_mount(char *dev_name, struct path *path, 1679int security_sb_mount(char *dev_name, struct path *path,
1781 char *type, unsigned long flags, void *data); 1680 char *type, unsigned long flags, void *data);
1782int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
1783int security_sb_umount(struct vfsmount *mnt, int flags); 1681int security_sb_umount(struct vfsmount *mnt, int flags);
1784void security_sb_umount_close(struct vfsmount *mnt);
1785void security_sb_umount_busy(struct vfsmount *mnt);
1786void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1787void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1788int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1682int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1789void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1790int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1683int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1791void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1684void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1792 struct super_block *newsb); 1685 struct super_block *newsb);
@@ -1812,7 +1705,6 @@ int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1812int security_inode_permission(struct inode *inode, int mask); 1705int security_inode_permission(struct inode *inode, int mask);
1813int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1706int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1814int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1707int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1815void security_inode_delete(struct inode *inode);
1816int security_inode_setxattr(struct dentry *dentry, const char *name, 1708int security_inode_setxattr(struct dentry *dentry, const char *name,
1817 const void *value, size_t size, int flags); 1709 const void *value, size_t size, int flags);
1818void security_inode_post_setxattr(struct dentry *dentry, const char *name, 1710void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -1846,20 +1738,16 @@ int security_task_create(unsigned long clone_flags);
1846int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1738int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1847void security_cred_free(struct cred *cred); 1739void security_cred_free(struct cred *cred);
1848int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1740int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1849void security_commit_creds(struct cred *new, const struct cred *old);
1850void security_transfer_creds(struct cred *new, const struct cred *old); 1741void security_transfer_creds(struct cred *new, const struct cred *old);
1851int security_kernel_act_as(struct cred *new, u32 secid); 1742int security_kernel_act_as(struct cred *new, u32 secid);
1852int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1743int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1853int security_kernel_module_request(char *kmod_name); 1744int security_kernel_module_request(char *kmod_name);
1854int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1855int security_task_fix_setuid(struct cred *new, const struct cred *old, 1745int security_task_fix_setuid(struct cred *new, const struct cred *old,
1856 int flags); 1746 int flags);
1857int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1858int security_task_setpgid(struct task_struct *p, pid_t pgid); 1747int security_task_setpgid(struct task_struct *p, pid_t pgid);
1859int security_task_getpgid(struct task_struct *p); 1748int security_task_getpgid(struct task_struct *p);
1860int security_task_getsid(struct task_struct *p); 1749int security_task_getsid(struct task_struct *p);
1861void security_task_getsecid(struct task_struct *p, u32 *secid); 1750void security_task_getsecid(struct task_struct *p, u32 *secid);
1862int security_task_setgroups(struct group_info *group_info);
1863int security_task_setnice(struct task_struct *p, int nice); 1751int security_task_setnice(struct task_struct *p, int nice);
1864int security_task_setioprio(struct task_struct *p, int ioprio); 1752int security_task_setioprio(struct task_struct *p, int ioprio);
1865int security_task_getioprio(struct task_struct *p); 1753int security_task_getioprio(struct task_struct *p);
@@ -1986,11 +1874,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1986 return ret; 1874 return ret;
1987} 1875}
1988 1876
1989static inline int security_acct(struct file *file)
1990{
1991 return 0;
1992}
1993
1994static inline int security_sysctl(struct ctl_table *table, int op) 1877static inline int security_sysctl(struct ctl_table *table, int op)
1995{ 1878{
1996 return 0; 1879 return 0;
@@ -2007,9 +1890,9 @@ static inline int security_quota_on(struct dentry *dentry)
2007 return 0; 1890 return 0;
2008} 1891}
2009 1892
2010static inline int security_syslog(int type) 1893static inline int security_syslog(int type, bool from_file)
2011{ 1894{
2012 return cap_syslog(type); 1895 return cap_syslog(type, from_file);
2013} 1896}
2014 1897
2015static inline int security_settime(struct timespec *ts, struct timezone *tz) 1898static inline int security_settime(struct timespec *ts, struct timezone *tz)
@@ -2095,41 +1978,17 @@ static inline int security_sb_mount(char *dev_name, struct path *path,
2095 return 0; 1978 return 0;
2096} 1979}
2097 1980
2098static inline int security_sb_check_sb(struct vfsmount *mnt,
2099 struct path *path)
2100{
2101 return 0;
2102}
2103
2104static inline int security_sb_umount(struct vfsmount *mnt, int flags) 1981static inline int security_sb_umount(struct vfsmount *mnt, int flags)
2105{ 1982{
2106 return 0; 1983 return 0;
2107} 1984}
2108 1985
2109static inline void security_sb_umount_close(struct vfsmount *mnt)
2110{ }
2111
2112static inline void security_sb_umount_busy(struct vfsmount *mnt)
2113{ }
2114
2115static inline void security_sb_post_remount(struct vfsmount *mnt,
2116 unsigned long flags, void *data)
2117{ }
2118
2119static inline void security_sb_post_addmount(struct vfsmount *mnt,
2120 struct path *mountpoint)
2121{ }
2122
2123static inline int security_sb_pivotroot(struct path *old_path, 1986static inline int security_sb_pivotroot(struct path *old_path,
2124 struct path *new_path) 1987 struct path *new_path)
2125{ 1988{
2126 return 0; 1989 return 0;
2127} 1990}
2128 1991
2129static inline void security_sb_post_pivotroot(struct path *old_path,
2130 struct path *new_path)
2131{ }
2132
2133static inline int security_sb_set_mnt_opts(struct super_block *sb, 1992static inline int security_sb_set_mnt_opts(struct super_block *sb,
2134 struct security_mnt_opts *opts) 1993 struct security_mnt_opts *opts)
2135{ 1994{
@@ -2245,9 +2104,6 @@ static inline int security_inode_getattr(struct vfsmount *mnt,
2245 return 0; 2104 return 0;
2246} 2105}
2247 2106
2248static inline void security_inode_delete(struct inode *inode)
2249{ }
2250
2251static inline int security_inode_setxattr(struct dentry *dentry, 2107static inline int security_inode_setxattr(struct dentry *dentry,
2252 const char *name, const void *value, size_t size, int flags) 2108 const char *name, const void *value, size_t size, int flags)
2253{ 2109{
@@ -2394,11 +2250,6 @@ static inline int security_prepare_creds(struct cred *new,
2394 return 0; 2250 return 0;
2395} 2251}
2396 2252
2397static inline void security_commit_creds(struct cred *new,
2398 const struct cred *old)
2399{
2400}
2401
2402static inline void security_transfer_creds(struct cred *new, 2253static inline void security_transfer_creds(struct cred *new,
2403 const struct cred *old) 2254 const struct cred *old)
2404{ 2255{
@@ -2420,12 +2271,6 @@ static inline int security_kernel_module_request(char *kmod_name)
2420 return 0; 2271 return 0;
2421} 2272}
2422 2273
2423static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2424 int flags)
2425{
2426 return 0;
2427}
2428
2429static inline int security_task_fix_setuid(struct cred *new, 2274static inline int security_task_fix_setuid(struct cred *new,
2430 const struct cred *old, 2275 const struct cred *old,
2431 int flags) 2276 int flags)
@@ -2433,12 +2278,6 @@ static inline int security_task_fix_setuid(struct cred *new,
2433 return cap_task_fix_setuid(new, old, flags); 2278 return cap_task_fix_setuid(new, old, flags);
2434} 2279}
2435 2280
2436static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2437 int flags)
2438{
2439 return 0;
2440}
2441
2442static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) 2281static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
2443{ 2282{
2444 return 0; 2283 return 0;
@@ -2459,11 +2298,6 @@ static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
2459 *secid = 0; 2298 *secid = 0;
2460} 2299}
2461 2300
2462static inline int security_task_setgroups(struct group_info *group_info)
2463{
2464 return 0;
2465}
2466
2467static inline int security_task_setnice(struct task_struct *p, int nice) 2301static inline int security_task_setnice(struct task_struct *p, int nice)
2468{ 2302{
2469 return cap_task_setnice(p, nice); 2303 return cap_task_setnice(p, nice);
@@ -3060,9 +2894,6 @@ void security_key_free(struct key *key);
3060int security_key_permission(key_ref_t key_ref, 2894int security_key_permission(key_ref_t key_ref,
3061 const struct cred *cred, key_perm_t perm); 2895 const struct cred *cred, key_perm_t perm);
3062int security_key_getsecurity(struct key *key, char **_buffer); 2896int security_key_getsecurity(struct key *key, char **_buffer);
3063int security_key_session_to_parent(const struct cred *cred,
3064 const struct cred *parent_cred,
3065 struct key *key);
3066 2897
3067#else 2898#else
3068 2899
@@ -3090,13 +2921,6 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
3090 return 0; 2921 return 0;
3091} 2922}
3092 2923
3093static inline int security_key_session_to_parent(const struct cred *cred,
3094 const struct cred *parent_cred,
3095 struct key *key)
3096{
3097 return 0;
3098}
3099
3100#endif 2924#endif
3101#endif /* CONFIG_KEYS */ 2925#endif /* CONFIG_KEYS */
3102 2926
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 8a4adbef8a0f..f2961afa2f66 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -79,6 +79,7 @@ struct seminfo {
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80#include <asm/atomic.h> 80#include <asm/atomic.h>
81#include <linux/rcupdate.h> 81#include <linux/rcupdate.h>
82#include <linux/cache.h>
82 83
83struct task_struct; 84struct task_struct;
84 85
@@ -91,7 +92,8 @@ struct sem {
91 92
92/* One sem_array data structure for each set of semaphores in the system. */ 93/* One sem_array data structure for each set of semaphores in the system. */
93struct sem_array { 94struct sem_array {
94 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */ 95 struct kern_ipc_perm ____cacheline_aligned_in_smp
96 sem_perm; /* permissions .. see ipc.h */
95 time_t sem_otime; /* last semop time */ 97 time_t sem_otime; /* last semop time */
96 time_t sem_ctime; /* last change time */ 98 time_t sem_ctime; /* last change time */
97 struct sem *sem_base; /* ptr to first semaphore in array */ 99 struct sem *sem_base; /* ptr to first semaphore in array */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 8366d8f12e53..03c0232b4169 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -135,4 +135,22 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
135extern struct list_head *seq_list_next(void *v, struct list_head *head, 135extern struct list_head *seq_list_next(void *v, struct list_head *head,
136 loff_t *ppos); 136 loff_t *ppos);
137 137
138/*
139 * Helpers for iteration over hlist_head-s in seq_files
140 */
141
142extern struct hlist_node *seq_hlist_start(struct hlist_head *head,
143 loff_t pos);
144extern struct hlist_node *seq_hlist_start_head(struct hlist_head *head,
145 loff_t pos);
146extern struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head,
147 loff_t *ppos);
148
149extern struct hlist_node *seq_hlist_start_rcu(struct hlist_head *head,
150 loff_t pos);
151extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head,
152 loff_t pos);
153extern struct hlist_node *seq_hlist_next_rcu(void *v,
154 struct hlist_head *head,
155 loff_t *ppos);
138#endif 156#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 8c3dd36fe91a..f10db6e5f3b5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -182,6 +182,10 @@
182/* Aeroflex Gaisler GRLIB APBUART */ 182/* Aeroflex Gaisler GRLIB APBUART */
183#define PORT_APBUART 90 183#define PORT_APBUART 90
184 184
185/* Altera UARTs */
186#define PORT_ALTERA_JTAGUART 91
187#define PORT_ALTERA_UART 92
188
185#ifdef __KERNEL__ 189#ifdef __KERNEL__
186 190
187#include <linux/compiler.h> 191#include <linux/compiler.h>
@@ -246,6 +250,7 @@ struct uart_ops {
246#endif 250#endif
247}; 251};
248 252
253#define NO_POLL_CHAR 0x00ff0000
249#define UART_CONFIG_TYPE (1 << 0) 254#define UART_CONFIG_TYPE (1 << 0)
250#define UART_CONFIG_IRQ (1 << 1) 255#define UART_CONFIG_IRQ (1 << 1)
251 256
@@ -491,9 +496,13 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
491{ 496{
492 struct uart_state *state = uport->state; 497 struct uart_state *state = uport->state;
493 struct tty_port *port = &state->port; 498 struct tty_port *port = &state->port;
499 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
500 struct timespec ts;
494 501
495 uport->icount.dcd++; 502 if (ld && ld->ops->dcd_change)
503 getnstimeofday(&ts);
496 504
505 uport->icount.dcd++;
497#ifdef CONFIG_HARD_PPS 506#ifdef CONFIG_HARD_PPS
498 if ((uport->flags & UPF_HARDPPS_CD) && status) 507 if ((uport->flags & UPF_HARDPPS_CD) && status)
499 hardpps(); 508 hardpps();
@@ -505,6 +514,11 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
505 else if (port->tty) 514 else if (port->tty)
506 tty_hangup(port->tty); 515 tty_hangup(port->tty);
507 } 516 }
517
518 if (ld && ld->ops->dcd_change)
519 ld->ops->dcd_change(port->tty, status, &ts);
520 if (ld)
521 tty_ldisc_deref(ld);
508} 522}
509 523
510/** 524/**
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 1c297ddc9d5a..baed2122c5a6 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -2,6 +2,7 @@
2#define __LINUX_SERIAL_SCI_H 2#define __LINUX_SERIAL_SCI_H
3 3
4#include <linux/serial_core.h> 4#include <linux/serial_core.h>
5#include <linux/sh_dma.h>
5 6
6/* 7/*
7 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
@@ -16,6 +17,8 @@ enum {
16 SCIx_NR_IRQS, 17 SCIx_NR_IRQS,
17}; 18};
18 19
20struct device;
21
19/* 22/*
20 * Platform device specific platform_data struct 23 * Platform device specific platform_data struct
21 */ 24 */
@@ -26,6 +29,11 @@ struct plat_sci_port {
26 unsigned int type; /* SCI / SCIF / IRDA */ 29 unsigned int type; /* SCI / SCIF / IRDA */
27 upf_t flags; /* UPF_* flags */ 30 upf_t flags; /* UPF_* flags */
28 char *clk; /* clock string */ 31 char *clk; /* clock string */
32 struct device *dma_dev;
33#ifdef CONFIG_SERIAL_SH_SCI_DMA
34 unsigned int dma_slave_tx;
35 unsigned int dma_slave_rx;
36#endif
29}; 37};
30 38
31#endif /* __LINUX_SERIAL_SCI_H */ 39#endif /* __LINUX_SERIAL_SCI_H */
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 813d26c247ec..b5552568178d 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -30,7 +30,6 @@ struct serio {
30 char phys[32]; 30 char phys[32];
31 31
32 bool manual_bind; 32 bool manual_bind;
33 bool registered; /* port has been fully registered with driver core */
34 33
35 struct serio_device_id id; 34 struct serio_device_id id;
36 35
@@ -197,5 +196,6 @@ static inline void serio_continue_rx(struct serio *serio)
197#define SERIO_TOUCHIT213 0x38 196#define SERIO_TOUCHIT213 0x38
198#define SERIO_W8001 0x39 197#define SERIO_W8001 0x39
199#define SERIO_DYNAPRO 0x3a 198#define SERIO_DYNAPRO 0x3a
199#define SERIO_HAMPSHIRE 0x3b
200 200
201#endif 201#endif
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
index 9a6f7607174e..0299b4ce63db 100644
--- a/include/linux/sfi.h
+++ b/include/linux/sfi.h
@@ -73,6 +73,8 @@
73#define SFI_SIG_SPIB "SPIB" 73#define SFI_SIG_SPIB "SPIB"
74#define SFI_SIG_I2CB "I2CB" 74#define SFI_SIG_I2CB "I2CB"
75#define SFI_SIG_GPEM "GPEM" 75#define SFI_SIG_GPEM "GPEM"
76#define SFI_SIG_DEVS "DEVS"
77#define SFI_SIG_GPIO "GPIO"
76 78
77#define SFI_SIGNATURE_SIZE 4 79#define SFI_SIGNATURE_SIZE 4
78#define SFI_OEM_ID_SIZE 6 80#define SFI_OEM_ID_SIZE 6
@@ -145,6 +147,27 @@ struct sfi_rtc_table_entry {
145 u32 irq; 147 u32 irq;
146} __packed; 148} __packed;
147 149
150struct sfi_device_table_entry {
151 u8 type; /* bus type, I2C, SPI or ...*/
152#define SFI_DEV_TYPE_SPI 0
153#define SFI_DEV_TYPE_I2C 1
154#define SFI_DEV_TYPE_UART 2
155#define SFI_DEV_TYPE_HSI 3
156#define SFI_DEV_TYPE_IPC 4
157
158 u8 host_num; /* attached to host 0, 1...*/
159 u16 addr;
160 u8 irq;
161 u32 max_freq;
162 char name[16];
163} __packed;
164
165struct sfi_gpio_table_entry {
166 char controller_name[16];
167 u16 pin_no;
168 char pin_name[16];
169} __packed;
170
148struct sfi_spi_table_entry { 171struct sfi_spi_table_entry {
149 u16 host_num; /* attached to host 0, 1...*/ 172 u16 host_num; /* attached to host 0, 1...*/
150 u16 cs; /* chip select */ 173 u16 cs; /* chip select */
@@ -166,7 +189,6 @@ struct sfi_gpe_table_entry {
166 u16 phys_id; /* physical GPE id */ 189 u16 phys_id; /* physical GPE id */
167} __packed; 190} __packed;
168 191
169
170typedef int (*sfi_table_handler) (struct sfi_table_header *table); 192typedef int (*sfi_table_handler) (struct sfi_table_header *table);
171 193
172#ifdef CONFIG_SFI 194#ifdef CONFIG_SFI
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
new file mode 100644
index 000000000000..1636d1e2a5f1
--- /dev/null
+++ b/include/linux/sh_clk.h
@@ -0,0 +1,150 @@
1#ifndef __SH_CLOCK_H
2#define __SH_CLOCK_H
3
4#include <linux/list.h>
5#include <linux/seq_file.h>
6#include <linux/cpufreq.h>
7#include <linux/clk.h>
8#include <linux/err.h>
9
10struct clk;
11
12struct clk_ops {
13 void (*init)(struct clk *clk);
14 int (*enable)(struct clk *clk);
15 void (*disable)(struct clk *clk);
16 unsigned long (*recalc)(struct clk *clk);
17 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
18 int (*set_parent)(struct clk *clk, struct clk *parent);
19 long (*round_rate)(struct clk *clk, unsigned long rate);
20};
21
22struct clk {
23 struct list_head node;
24 const char *name;
25 int id;
26
27 struct clk *parent;
28 struct clk_ops *ops;
29
30 struct list_head children;
31 struct list_head sibling; /* node for children */
32
33 int usecount;
34
35 unsigned long rate;
36 unsigned long flags;
37
38 void __iomem *enable_reg;
39 unsigned int enable_bit;
40
41 unsigned long arch_flags;
42 void *priv;
43 struct dentry *dentry;
44 struct cpufreq_frequency_table *freq_table;
45};
46
47#define CLK_ENABLE_ON_INIT (1 << 0)
48
49/* drivers/sh/clk.c */
50unsigned long followparent_recalc(struct clk *);
51void recalculate_root_clocks(void);
52void propagate_rate(struct clk *);
53int clk_reparent(struct clk *child, struct clk *parent);
54int clk_register(struct clk *);
55void clk_unregister(struct clk *);
56void clk_enable_init_clocks(void);
57
58/**
59 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
60 * @clk: clock source
61 * @rate: desired clock rate in Hz
62 * @algo_id: algorithm id to be passed down to ops->set_rate
63 *
64 * Returns success (0) or negative errno.
65 */
66int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
67
68enum clk_sh_algo_id {
69 NO_CHANGE = 0,
70
71 IUS_N1_N1,
72 IUS_322,
73 IUS_522,
74 IUS_N11,
75
76 SB_N1,
77
78 SB3_N1,
79 SB3_32,
80 SB3_43,
81 SB3_54,
82
83 BP_N1,
84
85 IP_N1,
86};
87
88struct clk_div_mult_table {
89 unsigned int *divisors;
90 unsigned int nr_divisors;
91 unsigned int *multipliers;
92 unsigned int nr_multipliers;
93};
94
95struct cpufreq_frequency_table;
96void clk_rate_table_build(struct clk *clk,
97 struct cpufreq_frequency_table *freq_table,
98 int nr_freqs,
99 struct clk_div_mult_table *src_table,
100 unsigned long *bitmap);
101
102long clk_rate_table_round(struct clk *clk,
103 struct cpufreq_frequency_table *freq_table,
104 unsigned long rate);
105
106int clk_rate_table_find(struct clk *clk,
107 struct cpufreq_frequency_table *freq_table,
108 unsigned long rate);
109
110#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
111{ \
112 .parent = _parent, \
113 .enable_reg = (void __iomem *)_enable_reg, \
114 .enable_bit = _enable_bit, \
115 .flags = _flags, \
116}
117
118int sh_clk_mstp32_register(struct clk *clks, int nr);
119
120#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
121{ \
122 .parent = _parent, \
123 .enable_reg = (void __iomem *)_reg, \
124 .enable_bit = _shift, \
125 .arch_flags = _div_bitmap, \
126 .flags = _flags, \
127}
128
129struct clk_div4_table {
130 struct clk_div_mult_table *div_mult_table;
131 void (*kick)(struct clk *clk);
132};
133
134int sh_clk_div4_register(struct clk *clks, int nr,
135 struct clk_div4_table *table);
136int sh_clk_div4_enable_register(struct clk *clks, int nr,
137 struct clk_div4_table *table);
138int sh_clk_div4_reparent_register(struct clk *clks, int nr,
139 struct clk_div4_table *table);
140
141#define SH_CLK_DIV6(_parent, _reg, _flags) \
142{ \
143 .parent = _parent, \
144 .enable_reg = (void __iomem *)_reg, \
145 .flags = _flags, \
146}
147
148int sh_clk_div6_register(struct clk *clks, int nr);
149
150#endif /* __SH_CLOCK_H */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
new file mode 100644
index 000000000000..b08cd4efa15c
--- /dev/null
+++ b/include/linux/sh_dma.h
@@ -0,0 +1,102 @@
1/*
2 * Header for the new SH dmaengine driver
3 *
4 * Copyright (C) 2010 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#ifndef SH_DMA_H
11#define SH_DMA_H
12
13#include <linux/list.h>
14#include <linux/dmaengine.h>
15
16/* Used by slave DMA clients to request DMA to/from a specific peripheral */
17struct sh_dmae_slave {
18 unsigned int slave_id; /* Set by the platform */
19 struct device *dma_dev; /* Set by the platform */
20 const struct sh_dmae_slave_config *config; /* Set by the driver */
21};
22
23struct sh_dmae_regs {
24 u32 sar; /* SAR / source address */
25 u32 dar; /* DAR / destination address */
26 u32 tcr; /* TCR / transfer count */
27};
28
29struct sh_desc {
30 struct sh_dmae_regs hw;
31 struct list_head node;
32 struct dma_async_tx_descriptor async_tx;
33 enum dma_data_direction direction;
34 dma_cookie_t cookie;
35 size_t partial;
36 int chunks;
37 int mark;
38};
39
40struct sh_dmae_slave_config {
41 unsigned int slave_id;
42 dma_addr_t addr;
43 u32 chcr;
44 char mid_rid;
45};
46
47struct sh_dmae_channel {
48 unsigned int offset;
49 unsigned int dmars;
50 unsigned int dmars_bit;
51};
52
53struct sh_dmae_pdata {
54 const struct sh_dmae_slave_config *slave;
55 int slave_num;
56 const struct sh_dmae_channel *channel;
57 int channel_num;
58 unsigned int ts_low_shift;
59 unsigned int ts_low_mask;
60 unsigned int ts_high_shift;
61 unsigned int ts_high_mask;
62 const unsigned int *ts_shift;
63 int ts_shift_num;
64 u16 dmaor_init;
65};
66
67/* DMA register */
68#define SAR 0x00
69#define DAR 0x04
70#define TCR 0x08
71#define CHCR 0x0C
72#define DMAOR 0x40
73
74/* DMAOR definitions */
75#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002
77#define DMAOR_DME 0x00000001
78
79/* Definitions for the SuperH DMAC */
80#define REQ_L 0x00000000
81#define REQ_E 0x00080000
82#define RACK_H 0x00000000
83#define RACK_L 0x00040000
84#define ACK_R 0x00000000
85#define ACK_W 0x00020000
86#define ACK_H 0x00000000
87#define ACK_L 0x00010000
88#define DM_INC 0x00004000
89#define DM_DEC 0x00008000
90#define DM_FIX 0x0000c000
91#define SM_INC 0x00001000
92#define SM_DEC 0x00002000
93#define SM_FIX 0x00003000
94#define RS_IN 0x00000200
95#define RS_OUT 0x00000300
96#define TS_BLK 0x00000040
97#define TM_BUR 0x00000020
98#define CHCR_DE 0x00000001
99#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004
101
102#endif
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 4ef246f14654..0d6cd38e673d 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -1,6 +1,8 @@
1#ifndef __SH_INTC_H 1#ifndef __SH_INTC_H
2#define __SH_INTC_H 2#define __SH_INTC_H
3 3
4#include <linux/ioport.h>
5
4typedef unsigned char intc_enum; 6typedef unsigned char intc_enum;
5 7
6struct intc_vect { 8struct intc_vect {
@@ -21,6 +23,9 @@ struct intc_group {
21struct intc_mask_reg { 23struct intc_mask_reg {
22 unsigned long set_reg, clr_reg, reg_width; 24 unsigned long set_reg, clr_reg, reg_width;
23 intc_enum enum_ids[32]; 25 intc_enum enum_ids[32];
26#ifdef CONFIG_INTC_BALANCING
27 unsigned long dist_reg;
28#endif
24#ifdef CONFIG_SMP 29#ifdef CONFIG_SMP
25 unsigned long smp; 30 unsigned long smp;
26#endif 31#endif
@@ -39,13 +44,19 @@ struct intc_sense_reg {
39 intc_enum enum_ids[16]; 44 intc_enum enum_ids[16];
40}; 45};
41 46
47#ifdef CONFIG_INTC_BALANCING
48#define INTC_SMP_BALANCING(reg) .dist_reg = (reg)
49#else
50#define INTC_SMP_BALANCING(reg)
51#endif
52
42#ifdef CONFIG_SMP 53#ifdef CONFIG_SMP
43#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8) 54#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
44#else 55#else
45#define INTC_SMP(stride, nr) 56#define INTC_SMP(stride, nr)
46#endif 57#endif
47 58
48struct intc_desc { 59struct intc_hw_desc {
49 struct intc_vect *vectors; 60 struct intc_vect *vectors;
50 unsigned int nr_vectors; 61 unsigned int nr_vectors;
51 struct intc_group *groups; 62 struct intc_group *groups;
@@ -56,34 +67,56 @@ struct intc_desc {
56 unsigned int nr_prio_regs; 67 unsigned int nr_prio_regs;
57 struct intc_sense_reg *sense_regs; 68 struct intc_sense_reg *sense_regs;
58 unsigned int nr_sense_regs; 69 unsigned int nr_sense_regs;
59 char *name;
60 struct intc_mask_reg *ack_regs; 70 struct intc_mask_reg *ack_regs;
61 unsigned int nr_ack_regs; 71 unsigned int nr_ack_regs;
62}; 72};
63 73
64#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) 74#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
75#define INTC_HW_DESC(vectors, groups, mask_regs, \
76 prio_regs, sense_regs, ack_regs) \
77{ \
78 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
79 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
80 _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \
81}
82
83struct intc_desc {
84 char *name;
85 struct resource *resource;
86 unsigned int num_resources;
87 intc_enum force_enable;
88 intc_enum force_disable;
89 struct intc_hw_desc hw;
90};
91
65#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \ 92#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
66 mask_regs, prio_regs, sense_regs) \ 93 mask_regs, prio_regs, sense_regs) \
67struct intc_desc symbol __initdata = { \ 94struct intc_desc symbol __initdata = { \
68 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ 95 .name = chipname, \
69 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ 96 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
70 _INTC_ARRAY(sense_regs), \ 97 prio_regs, sense_regs, NULL), \
71 chipname, \
72} 98}
73 99
74#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ 100#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
75 mask_regs, prio_regs, sense_regs, ack_regs) \ 101 mask_regs, prio_regs, sense_regs, ack_regs) \
76struct intc_desc symbol __initdata = { \ 102struct intc_desc symbol __initdata = { \
77 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ 103 .name = chipname, \
78 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ 104 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
79 _INTC_ARRAY(sense_regs), \ 105 prio_regs, sense_regs, ack_regs), \
80 chipname, \
81 _INTC_ARRAY(ack_regs), \
82} 106}
83 107
84void __init register_intc_controller(struct intc_desc *desc); 108int __init register_intc_controller(struct intc_desc *desc);
85int intc_set_priority(unsigned int irq, unsigned int prio); 109int intc_set_priority(unsigned int irq, unsigned int prio);
86 110
111#ifdef CONFIG_INTC_USERIMASK
112int register_intc_userimask(unsigned long addr);
113#else
114static inline int register_intc_userimask(unsigned long addr)
115{
116 return 0;
117}
118#endif
119
87int reserve_irq_vector(unsigned int irq); 120int reserve_irq_vector(unsigned int irq);
88void reserve_irq_legacy(void); 121void reserve_irq_legacy(void);
89 122
diff --git a/include/linux/signal.h b/include/linux/signal.h
index ab9272cc270c..fcd2b14b1932 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -7,6 +7,8 @@
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8#include <linux/list.h> 8#include <linux/list.h>
9 9
10/* for sysctl */
11extern int print_fatal_signals;
10/* 12/*
11 * Real Time signals may be queued. 13 * Real Time signals may be queued.
12 */ 14 */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ae836fded530..f89e7fd59a4c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -187,12 +187,8 @@ union skb_shared_tx {
187 * the end of the header data, ie. at skb->end. 187 * the end of the header data, ie. at skb->end.
188 */ 188 */
189struct skb_shared_info { 189struct skb_shared_info {
190 atomic_t dataref;
191 unsigned short nr_frags; 190 unsigned short nr_frags;
192 unsigned short gso_size; 191 unsigned short gso_size;
193#ifdef CONFIG_HAS_DMA
194 dma_addr_t dma_head;
195#endif
196 /* Warning: this field is not always filled in (UFO)! */ 192 /* Warning: this field is not always filled in (UFO)! */
197 unsigned short gso_segs; 193 unsigned short gso_segs;
198 unsigned short gso_type; 194 unsigned short gso_type;
@@ -200,10 +196,13 @@ struct skb_shared_info {
200 union skb_shared_tx tx_flags; 196 union skb_shared_tx tx_flags;
201 struct sk_buff *frag_list; 197 struct sk_buff *frag_list;
202 struct skb_shared_hwtstamps hwtstamps; 198 struct skb_shared_hwtstamps hwtstamps;
199
200 /*
201 * Warning : all fields before dataref are cleared in __alloc_skb()
202 */
203 atomic_t dataref;
204
203 skb_frag_t frags[MAX_SKB_FRAGS]; 205 skb_frag_t frags[MAX_SKB_FRAGS];
204#ifdef CONFIG_HAS_DMA
205 dma_addr_t dma_maps[MAX_SKB_FRAGS];
206#endif
207 /* Intermediate layers must ensure that destructor_arg 206 /* Intermediate layers must ensure that destructor_arg
208 * remains valid until skb destructor */ 207 * remains valid until skb destructor */
209 void * destructor_arg; 208 void * destructor_arg;
@@ -265,7 +264,7 @@ typedef unsigned char *sk_buff_data_t;
265 * @transport_header: Transport layer header 264 * @transport_header: Transport layer header
266 * @network_header: Network layer header 265 * @network_header: Network layer header
267 * @mac_header: Link layer header 266 * @mac_header: Link layer header
268 * @_skb_dst: destination entry 267 * @_skb_refdst: destination entry (with norefcount bit)
269 * @sp: the security path, used for xfrm 268 * @sp: the security path, used for xfrm
270 * @cb: Control buffer. Free for use by every layer. Put private vars here 269 * @cb: Control buffer. Free for use by every layer. Put private vars here
271 * @len: Length of actual data 270 * @len: Length of actual data
@@ -300,6 +299,7 @@ typedef unsigned char *sk_buff_data_t;
300 * @nfct_reasm: netfilter conntrack re-assembly pointer 299 * @nfct_reasm: netfilter conntrack re-assembly pointer
301 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 300 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
302 * @skb_iif: ifindex of device we arrived on 301 * @skb_iif: ifindex of device we arrived on
302 * @rxhash: the packet hash computed on receive
303 * @queue_mapping: Queue mapping for multiqueue devices 303 * @queue_mapping: Queue mapping for multiqueue devices
304 * @tc_index: Traffic control index 304 * @tc_index: Traffic control index
305 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
@@ -315,22 +315,23 @@ struct sk_buff {
315 struct sk_buff *next; 315 struct sk_buff *next;
316 struct sk_buff *prev; 316 struct sk_buff *prev;
317 317
318 struct sock *sk;
319 ktime_t tstamp; 318 ktime_t tstamp;
319
320 struct sock *sk;
320 struct net_device *dev; 321 struct net_device *dev;
321 322
322 unsigned long _skb_dst;
323#ifdef CONFIG_XFRM
324 struct sec_path *sp;
325#endif
326 /* 323 /*
327 * This is the control buffer. It is free to use for every 324 * This is the control buffer. It is free to use for every
328 * layer. Please put your private variables there. If you 325 * layer. Please put your private variables there. If you
329 * want to keep them across layers you have to do a skb_clone() 326 * want to keep them across layers you have to do a skb_clone()
330 * first. This is owned by whoever has the skb queued ATM. 327 * first. This is owned by whoever has the skb queued ATM.
331 */ 328 */
332 char cb[48]; 329 char cb[48] __aligned(8);
333 330
331 unsigned long _skb_refdst;
332#ifdef CONFIG_XFRM
333 struct sec_path *sp;
334#endif
334 unsigned int len, 335 unsigned int len,
335 data_len; 336 data_len;
336 __u16 mac_len, 337 __u16 mac_len,
@@ -354,8 +355,8 @@ struct sk_buff {
354 ipvs_property:1, 355 ipvs_property:1,
355 peeked:1, 356 peeked:1,
356 nf_trace:1; 357 nf_trace:1;
357 __be16 protocol:16;
358 kmemcheck_bitfield_end(flags1); 358 kmemcheck_bitfield_end(flags1);
359 __be16 protocol;
359 360
360 void (*destructor)(struct sk_buff *skb); 361 void (*destructor)(struct sk_buff *skb);
361#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 362#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -374,10 +375,15 @@ struct sk_buff {
374#endif 375#endif
375#endif 376#endif
376 377
378 __u32 rxhash;
379
377 kmemcheck_bitfield_begin(flags2); 380 kmemcheck_bitfield_begin(flags2);
378 __u16 queue_mapping:16; 381 __u16 queue_mapping:16;
379#ifdef CONFIG_IPV6_NDISC_NODETYPE 382#ifdef CONFIG_IPV6_NDISC_NODETYPE
380 __u8 ndisc_nodetype:2; 383 __u8 ndisc_nodetype:2,
384 deliver_no_wcard:1;
385#else
386 __u8 deliver_no_wcard:1;
381#endif 387#endif
382 kmemcheck_bitfield_end(flags2); 388 kmemcheck_bitfield_end(flags2);
383 389
@@ -416,14 +422,64 @@ struct sk_buff {
416 422
417#include <asm/system.h> 423#include <asm/system.h>
418 424
425/*
426 * skb might have a dst pointer attached, refcounted or not.
427 * _skb_refdst low order bit is set if refcount was _not_ taken
428 */
429#define SKB_DST_NOREF 1UL
430#define SKB_DST_PTRMASK ~(SKB_DST_NOREF)
431
432/**
433 * skb_dst - returns skb dst_entry
434 * @skb: buffer
435 *
436 * Returns skb dst_entry, regardless of reference taken or not.
437 */
419static inline struct dst_entry *skb_dst(const struct sk_buff *skb) 438static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
420{ 439{
421 return (struct dst_entry *)skb->_skb_dst; 440 /* If refdst was not refcounted, check we still are in a
441 * rcu_read_lock section
442 */
443 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) &&
444 !rcu_read_lock_held() &&
445 !rcu_read_lock_bh_held());
446 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK);
422} 447}
423 448
449/**
450 * skb_dst_set - sets skb dst
451 * @skb: buffer
452 * @dst: dst entry
453 *
454 * Sets skb dst, assuming a reference was taken on dst and should
455 * be released by skb_dst_drop()
456 */
424static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) 457static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
425{ 458{
426 skb->_skb_dst = (unsigned long)dst; 459 skb->_skb_refdst = (unsigned long)dst;
460}
461
462/**
463 * skb_dst_set_noref - sets skb dst, without a reference
464 * @skb: buffer
465 * @dst: dst entry
466 *
467 * Sets skb dst, assuming a reference was not taken on dst
468 * skb_dst_drop() should not dst_release() this dst
469 */
470static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
471{
472 WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
473 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
474}
475
476/**
477 * skb_dst_is_noref - Test if skb dst isnt refcounted
478 * @skb: buffer
479 */
480static inline bool skb_dst_is_noref(const struct sk_buff *skb)
481{
482 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb);
427} 483}
428 484
429static inline struct rtable *skb_rtable(const struct sk_buff *skb) 485static inline struct rtable *skb_rtable(const struct sk_buff *skb)
@@ -448,7 +504,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
448 return __alloc_skb(size, priority, 1, -1); 504 return __alloc_skb(size, priority, 1, -1);
449} 505}
450 506
451extern int skb_recycle_check(struct sk_buff *skb, int skb_size); 507extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
452 508
453extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 509extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
454extern struct sk_buff *skb_clone(struct sk_buff *skb, 510extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -472,11 +528,6 @@ extern int skb_cow_data(struct sk_buff *skb, int tailbits,
472 struct sk_buff **trailer); 528 struct sk_buff **trailer);
473extern int skb_pad(struct sk_buff *skb, int pad); 529extern int skb_pad(struct sk_buff *skb, int pad);
474#define dev_kfree_skb(a) consume_skb(a) 530#define dev_kfree_skb(a) consume_skb(a)
475#define dev_consume_skb(a) kfree_skb_clean(a)
476extern void skb_over_panic(struct sk_buff *skb, int len,
477 void *here);
478extern void skb_under_panic(struct sk_buff *skb, int len,
479 void *here);
480 531
481extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 532extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
482 int getfrag(void *from, char *to, int offset, 533 int getfrag(void *from, char *to, int offset,
@@ -738,7 +789,7 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
738} 789}
739 790
740/** 791/**
741 * skb_peek 792 * skb_peek - peek at the head of an &sk_buff_head
742 * @list_: list to peek at 793 * @list_: list to peek at
743 * 794 *
744 * Peek an &sk_buff. Unlike most other operations you _MUST_ 795 * Peek an &sk_buff. Unlike most other operations you _MUST_
@@ -759,7 +810,7 @@ static inline struct sk_buff *skb_peek(struct sk_buff_head *list_)
759} 810}
760 811
761/** 812/**
762 * skb_peek_tail 813 * skb_peek_tail - peek at the tail of an &sk_buff_head
763 * @list_: list to peek at 814 * @list_: list to peek at
764 * 815 *
765 * Peek an &sk_buff. Unlike most other operations you _MUST_ 816 * Peek an &sk_buff. Unlike most other operations you _MUST_
@@ -1135,6 +1186,11 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
1135 return skb->data += len; 1186 return skb->data += len;
1136} 1187}
1137 1188
1189static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len)
1190{
1191 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
1192}
1193
1138extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 1194extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1139 1195
1140static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1196static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
@@ -1358,9 +1414,12 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1358 * 1414 *
1359 * Various parts of the networking layer expect at least 32 bytes of 1415 * Various parts of the networking layer expect at least 32 bytes of
1360 * headroom, you should not reduce this. 1416 * headroom, you should not reduce this.
1417 * With RPS, we raised NET_SKB_PAD to 64 so that get_rps_cpus() fetches span
1418 * a 64 bytes aligned block to fit modern (>= 64 bytes) cache line sizes
1419 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
1361 */ 1420 */
1362#ifndef NET_SKB_PAD 1421#ifndef NET_SKB_PAD
1363#define NET_SKB_PAD 32 1422#define NET_SKB_PAD 64
1364#endif 1423#endif
1365 1424
1366extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1425extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 2da8372519f5..49d1247cd6d9 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -70,6 +70,11 @@
70#else 70#else
71# define SLAB_NOTRACK 0x00000000UL 71# define SLAB_NOTRACK 0x00000000UL
72#endif 72#endif
73#ifdef CONFIG_FAILSLAB
74# define SLAB_FAILSLAB 0x02000000UL /* Fault injection mark */
75#else
76# define SLAB_FAILSLAB 0x00000000UL
77#endif
73 78
74/* The following flags affect the page allocator grouping pages by mobility */ 79/* The following flags affect the page allocator grouping pages by mobility */
75#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 80#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
@@ -101,6 +106,7 @@ int kmem_cache_shrink(struct kmem_cache *);
101void kmem_cache_free(struct kmem_cache *, void *); 106void kmem_cache_free(struct kmem_cache *, void *);
102unsigned int kmem_cache_size(struct kmem_cache *); 107unsigned int kmem_cache_size(struct kmem_cache *);
103const char *kmem_cache_name(struct kmem_cache *); 108const char *kmem_cache_name(struct kmem_cache *);
109int kern_ptr_validate(const void *ptr, unsigned long size);
104int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr); 110int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
105 111
106/* 112/*
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index ca6b2b317991..1812dac8c496 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -16,6 +16,30 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/kmemtrace.h> 17#include <linux/kmemtrace.h>
18 18
19#ifndef ARCH_KMALLOC_MINALIGN
20/*
21 * Enforce a minimum alignment for the kmalloc caches.
22 * Usually, the kmalloc caches are cache_line_size() aligned, except when
23 * DEBUG and FORCED_DEBUG are enabled, then they are BYTES_PER_WORD aligned.
24 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
25 * alignment larger than the alignment of a 64-bit integer.
26 * ARCH_KMALLOC_MINALIGN allows that.
27 * Note that increasing this value may disable some debug features.
28 */
29#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
30#endif
31
32#ifndef ARCH_SLAB_MINALIGN
33/*
34 * Enforce a minimum alignment for all caches.
35 * Intended for archs that get misalignment faults even for BYTES_PER_WORD
36 * aligned buffers. Includes ARCH_KMALLOC_MINALIGN.
37 * If possible: Do not enable this flag for CONFIG_DEBUG_SLAB, it disables
38 * some debug features.
39 */
40#define ARCH_SLAB_MINALIGN 0
41#endif
42
19/* 43/*
20 * struct kmem_cache 44 * struct kmem_cache
21 * 45 *
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..62667f72c2ef 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,6 +1,14 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#ifndef ARCH_KMALLOC_MINALIGN
5#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
6#endif
7
8#ifndef ARCH_SLAB_MINALIGN
9#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
10#endif
11
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 12void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5 13
6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, 14static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 1e14beb23f9b..4ba59cfc1f75 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -38,8 +38,6 @@ struct kmem_cache_cpu {
38 void **freelist; /* Pointer to first free per cpu object */ 38 void **freelist; /* Pointer to first free per cpu object */
39 struct page *page; /* The slab from which we are allocating */ 39 struct page *page; /* The slab from which we are allocating */
40 int node; /* The node of the page (or -1 for debug) */ 40 int node; /* The node of the page (or -1 for debug) */
41 unsigned int offset; /* Freepointer offset (in word units) */
42 unsigned int objsize; /* Size of an object (from kmem_cache) */
43#ifdef CONFIG_SLUB_STATS 41#ifdef CONFIG_SLUB_STATS
44 unsigned stat[NR_SLUB_STAT_ITEMS]; 42 unsigned stat[NR_SLUB_STAT_ITEMS];
45#endif 43#endif
@@ -69,6 +67,7 @@ struct kmem_cache_order_objects {
69 * Slab cache management. 67 * Slab cache management.
70 */ 68 */
71struct kmem_cache { 69struct kmem_cache {
70 struct kmem_cache_cpu *cpu_slab;
72 /* Used for retriving partial slabs etc */ 71 /* Used for retriving partial slabs etc */
73 unsigned long flags; 72 unsigned long flags;
74 int size; /* The size of an object including meta data */ 73 int size; /* The size of an object including meta data */
@@ -76,12 +75,6 @@ struct kmem_cache {
76 int offset; /* Free pointer offset. */ 75 int offset; /* Free pointer offset. */
77 struct kmem_cache_order_objects oo; 76 struct kmem_cache_order_objects oo;
78 77
79 /*
80 * Avoid an extra cache line for UP, SMP and for the node local to
81 * struct kmem_cache.
82 */
83 struct kmem_cache_node local_node;
84
85 /* Allocation and freeing of slabs */ 78 /* Allocation and freeing of slabs */
86 struct kmem_cache_order_objects max; 79 struct kmem_cache_order_objects max;
87 struct kmem_cache_order_objects min; 80 struct kmem_cache_order_objects min;
@@ -103,11 +96,9 @@ struct kmem_cache {
103 */ 96 */
104 int remote_node_defrag_ratio; 97 int remote_node_defrag_ratio;
105 struct kmem_cache_node *node[MAX_NUMNODES]; 98 struct kmem_cache_node *node[MAX_NUMNODES];
106#endif
107#ifdef CONFIG_SMP
108 struct kmem_cache_cpu *cpu_slab[NR_CPUS];
109#else 99#else
110 struct kmem_cache_cpu cpu_slab; 100 /* Avoid an extra cache line for UP */
101 struct kmem_cache_node local_node;
111#endif 102#endif
112}; 103};
113 104
@@ -122,6 +113,14 @@ struct kmem_cache {
122 113
123#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 114#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
124 115
116#ifndef ARCH_KMALLOC_MINALIGN
117#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
118#endif
119
120#ifndef ARCH_SLAB_MINALIGN
121#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
122#endif
123
125/* 124/*
126 * Maximum kmalloc object size handled by SLUB. Larger object allocations 125 * Maximum kmalloc object size handled by SLUB. Larger object allocations
127 * are passed through to the page allocator. The page allocator "fastpath" 126 * are passed through to the page allocator. The page allocator "fastpath"
@@ -135,11 +134,21 @@ struct kmem_cache {
135 134
136#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2) 135#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
137 136
137#ifdef CONFIG_ZONE_DMA
138#define SLUB_DMA __GFP_DMA
139/* Reserve extra caches for potential DMA use */
140#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT)
141#else
142/* Disable DMA functionality */
143#define SLUB_DMA (__force gfp_t)0
144#define KMALLOC_CACHES SLUB_PAGE_SHIFT
145#endif
146
138/* 147/*
139 * We keep the general caches in an array of slab caches that are used for 148 * We keep the general caches in an array of slab caches that are used for
140 * 2^x bytes of allocations. 149 * 2^x bytes of allocations.
141 */ 150 */
142extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT]; 151extern struct kmem_cache kmalloc_caches[KMALLOC_CACHES];
143 152
144/* 153/*
145 * Sorry that the following has to be that ugly but some versions of GCC 154 * Sorry that the following has to be that ugly but some versions of GCC
@@ -207,13 +216,6 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
207 return &kmalloc_caches[index]; 216 return &kmalloc_caches[index];
208} 217}
209 218
210#ifdef CONFIG_ZONE_DMA
211#define SLUB_DMA __GFP_DMA
212#else
213/* Disable DMA functionality */
214#define SLUB_DMA (__force gfp_t)0
215#endif
216
217void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 219void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
218void *__kmalloc(size_t size, gfp_t flags); 220void *__kmalloc(size_t size, gfp_t flags);
219 221
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h
index 8a060a7040d8..bb947dd1fba9 100644
--- a/include/linux/smb_fs_sb.h
+++ b/include/linux/smb_fs_sb.h
@@ -10,6 +10,7 @@
10#define _SMB_FS_SB 10#define _SMB_FS_SB
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/backing-dev.h>
13#include <linux/smb.h> 14#include <linux/smb.h>
14 15
15/* 16/*
@@ -74,6 +75,8 @@ struct smb_sb_info {
74 struct smb_ops *ops; 75 struct smb_ops *ops;
75 76
76 struct super_block *super_block; 77 struct super_block *super_block;
78
79 struct backing_dev_info bdi;
77}; 80};
78 81
79static inline int 82static inline int
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 7a0570e6a596..cfa2d20e35f1 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -154,7 +154,7 @@ smp_call_function_any(const struct cpumask *mask, void (*func)(void *info),
154/* 154/*
155 * smp_processor_id(): get the current CPU ID. 155 * smp_processor_id(): get the current CPU ID.
156 * 156 *
157 * if DEBUG_PREEMPT is enabled the we check whether it is 157 * if DEBUG_PREEMPT is enabled then we check whether it is
158 * used in a preemption-safe way. (smp_processor_id() is safe 158 * used in a preemption-safe way. (smp_processor_id() is safe
159 * if it's used in a preemption-off critical section, or in 159 * if it's used in a preemption-off critical section, or in
160 * a thread that is bound to the current CPU.) 160 * a thread that is bound to the current CPU.)
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 0f953fe40413..52797714ade7 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -100,6 +100,7 @@ enum
100 ICMP6_MIB_INMSGS, /* InMsgs */ 100 ICMP6_MIB_INMSGS, /* InMsgs */
101 ICMP6_MIB_INERRORS, /* InErrors */ 101 ICMP6_MIB_INERRORS, /* InErrors */
102 ICMP6_MIB_OUTMSGS, /* OutMsgs */ 102 ICMP6_MIB_OUTMSGS, /* OutMsgs */
103 ICMP6_MIB_OUTERRORS, /* OutErrors */
103 __ICMP6_MIB_MAX 104 __ICMP6_MIB_MAX
104}; 105};
105 106
@@ -225,6 +226,9 @@ enum
225 LINUX_MIB_SACKSHIFTED, 226 LINUX_MIB_SACKSHIFTED,
226 LINUX_MIB_SACKMERGED, 227 LINUX_MIB_SACKMERGED,
227 LINUX_MIB_SACKSHIFTFALLBACK, 228 LINUX_MIB_SACKSHIFTFALLBACK,
229 LINUX_MIB_TCPBACKLOGDROP,
230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
231 LINUX_MIB_TCPDEFERACCEPTDROP,
228 __LINUX_MIB_MAX 232 __LINUX_MIB_MAX
229}; 233};
230 234
@@ -257,6 +261,7 @@ enum
257 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ 261 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */
258 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ 262 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */
259 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ 263 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */
264 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/
260 __LINUX_MIB_XFRMMAX 265 __LINUX_MIB_XFRMMAX
261}; 266};
262 267
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 7b3aae2052a6..032a19eb61b1 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -189,7 +189,8 @@ struct ucred {
189#define AF_ISDN 34 /* mISDN sockets */ 189#define AF_ISDN 34 /* mISDN sockets */
190#define AF_PHONET 35 /* Phonet sockets */ 190#define AF_PHONET 35 /* Phonet sockets */
191#define AF_IEEE802154 36 /* IEEE802154 sockets */ 191#define AF_IEEE802154 36 /* IEEE802154 sockets */
192#define AF_MAX 37 /* For now.. */ 192#define AF_CAIF 37 /* CAIF sockets */
193#define AF_MAX 38 /* For now.. */
193 194
194/* Protocol families, same as address families. */ 195/* Protocol families, same as address families. */
195#define PF_UNSPEC AF_UNSPEC 196#define PF_UNSPEC AF_UNSPEC
@@ -229,6 +230,7 @@ struct ucred {
229#define PF_ISDN AF_ISDN 230#define PF_ISDN AF_ISDN
230#define PF_PHONET AF_PHONET 231#define PF_PHONET AF_PHONET
231#define PF_IEEE802154 AF_IEEE802154 232#define PF_IEEE802154 AF_IEEE802154
233#define PF_CAIF AF_CAIF
232#define PF_MAX AF_MAX 234#define PF_MAX AF_MAX
233 235
234/* Maximum queue length specifiable by listen. */ 236/* Maximum queue length specifiable by listen. */
@@ -255,6 +257,7 @@ struct ucred {
255#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */ 257#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */
256#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ 258#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
257#define MSG_MORE 0x8000 /* Sender will send more */ 259#define MSG_MORE 0x8000 /* Sender will send more */
260#define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */
258 261
259#define MSG_EOF MSG_FIN 262#define MSG_EOF MSG_FIN
260 263
@@ -300,6 +303,7 @@ struct ucred {
300#define SOL_PNPIPE 275 303#define SOL_PNPIPE 275
301#define SOL_RDS 276 304#define SOL_RDS 276
302#define SOL_IUCV 277 305#define SOL_IUCV 277
306#define SOL_CAIF 278
303 307
304/* IPX options */ 308/* IPX options */
305#define IPX_TYPE 1 309#define IPX_TYPE 1
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 51948eb6927a..b4ae570d3c98 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -12,7 +12,7 @@ enum ads7846_filter {
12}; 12};
13 13
14struct ads7846_platform_data { 14struct ads7846_platform_data {
15 u16 model; /* 7843, 7845, 7846. */ 15 u16 model; /* 7843, 7845, 7846, 7873. */
16 u16 vref_delay_usecs; /* 0 for external vref; etc */ 16 u16 vref_delay_usecs; /* 0 for external vref; etc */
17 u16 vref_mv; /* external vref value, milliVolts */ 17 u16 vref_mv; /* external vref value, milliVolts */
18 bool keep_vref_on; /* set to keep vref on for differential 18 bool keep_vref_on; /* set to keep vref on for differential
@@ -53,5 +53,6 @@ struct ads7846_platform_data {
53 int (*filter) (void *filter_data, int data_idx, int *val); 53 int (*filter) (void *filter_data, int data_idx, int *val);
54 void (*filter_cleanup)(void *filter_data); 54 void (*filter_cleanup)(void *filter_data);
55 void (*wait_for_sync)(void); 55 void (*wait_for_sync)(void);
56 bool wakeup;
56}; 57};
57 58
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h
index 51b3e771a9a3..cc813f95a2f2 100644
--- a/include/linux/spi/dw_spi.h
+++ b/include/linux/spi/dw_spi.h
@@ -90,6 +90,7 @@ struct dw_spi {
90 unsigned long paddr; 90 unsigned long paddr;
91 u32 iolen; 91 u32 iolen;
92 int irq; 92 int irq;
93 u32 fifo_len; /* depth of the FIFO buffer */
93 u32 max_freq; /* max bus freq supported */ 94 u32 max_freq; /* max bus freq supported */
94 95
95 u16 bus_num; 96 u16 bus_num;
@@ -171,6 +172,10 @@ static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
171{ 172{
172 if (cs > dws->num_cs) 173 if (cs > dws->num_cs)
173 return; 174 return;
175
176 if (dws->cs_control)
177 dws->cs_control(1);
178
174 dw_writel(dws, ser, 1 << cs); 179 dw_writel(dws, ser, 1 << cs);
175} 180}
176 181
diff --git a/include/linux/spi/l4f00242t03.h b/include/linux/spi/l4f00242t03.h
new file mode 100644
index 000000000000..aee1dbda4edc
--- /dev/null
+++ b/include/linux/spi/l4f00242t03.h
@@ -0,0 +1,31 @@
1/*
2 * l4f00242t03.h -- Platform glue for Epson L4F00242T03 LCD
3 *
4 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
5 * Based on Marek Vasut work in lms283gf05.h
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20
21#ifndef _INCLUDE_LINUX_SPI_L4F00242T03_H_
22#define _INCLUDE_LINUX_SPI_L4F00242T03_H_
23
24struct l4f00242t03_pdata {
25 unsigned int reset_gpio;
26 unsigned int data_enable_gpio;
27 const char *io_supply; /* will be set to 1.8 V */
28 const char *core_supply; /* will be set to 2.8 V */
29};
30
31#endif /* _INCLUDE_LINUX_SPI_L4F00242T03_H_ */
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h
index 6dfd83f19b4b..34af0a3477bf 100644
--- a/include/linux/spi/max7301.h
+++ b/include/linux/spi/max7301.h
@@ -1,9 +1,27 @@
1#ifndef LINUX_SPI_MAX7301_H 1#ifndef LINUX_SPI_MAX7301_H
2#define LINUX_SPI_MAX7301_H 2#define LINUX_SPI_MAX7301_H
3 3
4#include <linux/gpio.h>
5
6/*
7 * Some registers must be read back to modify.
8 * To save time we cache them here in memory
9 */
10struct max7301 {
11 struct mutex lock;
12 u8 port_config[8]; /* field 0 is unused */
13 u32 out_level; /* cached output levels */
14 struct gpio_chip chip;
15 struct device *dev;
16 int (*write)(struct device *dev, unsigned int reg, unsigned int val);
17 int (*read)(struct device *dev, unsigned int reg);
18};
19
4struct max7301_platform_data { 20struct max7301_platform_data {
5 /* number assigned to the first GPIO */ 21 /* number assigned to the first GPIO */
6 unsigned base; 22 unsigned base;
7}; 23};
8 24
25extern int __max730x_remove(struct device *dev);
26extern int __max730x_probe(struct max7301 *ts);
9#endif 27#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 97b60b37f445..af56071b06f9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h> 23#include <linux/mod_devicetable.h>
24#include <linux/slab.h>
24 25
25/* 26/*
26 * INTERFACES between SPI master-side drivers and SPI infrastructure. 27 * INTERFACES between SPI master-side drivers and SPI infrastructure.
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 3274c507b8a9..f987a2bee16a 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -1,24 +1,6 @@
1#ifndef __SPI_BITBANG_H 1#ifndef __SPI_BITBANG_H
2#define __SPI_BITBANG_H 2#define __SPI_BITBANG_H
3 3
4/*
5 * Mix this utility code with some glue code to get one of several types of
6 * simple SPI master driver. Two do polled word-at-a-time I/O:
7 *
8 * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](),
9 * expanding the per-word routines from the inline templates below.
10 *
11 * - Drivers for controllers resembling bare shift registers. Provide
12 * chipselect() and txrx_word[](), with custom setup()/cleanup() methods
13 * that use your controller's clock and chipselect registers.
14 *
15 * Some hardware works well with requests at spi_transfer scope:
16 *
17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
18 * duplex (MicroWire) controllers. Provide chipselect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods.
20 */
21
22#include <linux/workqueue.h> 4#include <linux/workqueue.h>
23 5
24struct spi_bitbang { 6struct spi_bitbang {
@@ -68,86 +50,3 @@ extern int spi_bitbang_start(struct spi_bitbang *spi);
68extern int spi_bitbang_stop(struct spi_bitbang *spi); 50extern int spi_bitbang_stop(struct spi_bitbang *spi);
69 51
70#endif /* __SPI_BITBANG_H */ 52#endif /* __SPI_BITBANG_H */
71
72/*-------------------------------------------------------------------------*/
73
74#ifdef EXPAND_BITBANG_TXRX
75
76/*
77 * The code that knows what GPIO pins do what should have declared four
78 * functions, ideally as inlines, before #defining EXPAND_BITBANG_TXRX
79 * and including this header:
80 *
81 * void setsck(struct spi_device *, int is_on);
82 * void setmosi(struct spi_device *, int is_on);
83 * int getmiso(struct spi_device *);
84 * void spidelay(unsigned);
85 *
86 * setsck()'s is_on parameter is a zero/nonzero boolean.
87 *
88 * setmosi()'s is_on parameter is a zero/nonzero boolean.
89 *
90 * getmiso() is required to return 0 or 1 only. Any other value is invalid
91 * and will result in improper operation.
92 *
93 * A non-inlined routine would call bitbang_txrx_*() routines. The
94 * main loop could easily compile down to a handful of instructions,
95 * especially if the delay is a NOP (to run at peak speed).
96 *
97 * Since this is software, the timings may not be exactly what your board's
98 * chips need ... there may be several reasons you'd need to tweak timings
99 * in these routines, not just make to make it faster or slower to match a
100 * particular CPU clock rate.
101 */
102
103static inline u32
104bitbang_txrx_be_cpha0(struct spi_device *spi,
105 unsigned nsecs, unsigned cpol,
106 u32 word, u8 bits)
107{
108 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
109
110 /* clock starts at inactive polarity */
111 for (word <<= (32 - bits); likely(bits); bits--) {
112
113 /* setup MSB (to slave) on trailing edge */
114 setmosi(spi, word & (1 << 31));
115 spidelay(nsecs); /* T(setup) */
116
117 setsck(spi, !cpol);
118 spidelay(nsecs);
119
120 /* sample MSB (from slave) on leading edge */
121 word <<= 1;
122 word |= getmiso(spi);
123 setsck(spi, cpol);
124 }
125 return word;
126}
127
128static inline u32
129bitbang_txrx_be_cpha1(struct spi_device *spi,
130 unsigned nsecs, unsigned cpol,
131 u32 word, u8 bits)
132{
133 /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
134
135 /* clock starts at inactive polarity */
136 for (word <<= (32 - bits); likely(bits); bits--) {
137
138 /* setup MSB (to slave) on leading edge */
139 setsck(spi, !cpol);
140 setmosi(spi, word & (1 << 31));
141 spidelay(nsecs); /* T(setup) */
142
143 setsck(spi, cpol);
144 spidelay(nsecs);
145
146 /* sample MSB (from slave) on trailing edge */
147 word <<= 1;
148 word |= getmiso(spi);
149 }
150 return word;
151}
152
153#endif /* EXPAND_BITBANG_TXRX */
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
index aed64ed3dc8a..a223ecbc71ef 100644
--- a/include/linux/spi/wl12xx.h
+++ b/include/linux/spi/wl12xx.h
@@ -26,6 +26,8 @@
26 26
27struct wl12xx_platform_data { 27struct wl12xx_platform_data {
28 void (*set_power)(bool enable); 28 void (*set_power)(bool enable);
29 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
30 int irq;
29 bool use_eeprom; 31 bool use_eeprom;
30}; 32};
31 33
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index dd57af413266..f8854655860e 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -128,19 +128,21 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
128#define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock) 128#define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock)
129 129
130#ifdef CONFIG_DEBUG_SPINLOCK 130#ifdef CONFIG_DEBUG_SPINLOCK
131 extern void do_raw_spin_lock(raw_spinlock_t *lock); 131 extern void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock);
132#define do_raw_spin_lock_flags(lock, flags) do_raw_spin_lock(lock) 132#define do_raw_spin_lock_flags(lock, flags) do_raw_spin_lock(lock)
133 extern int do_raw_spin_trylock(raw_spinlock_t *lock); 133 extern int do_raw_spin_trylock(raw_spinlock_t *lock);
134 extern void do_raw_spin_unlock(raw_spinlock_t *lock); 134 extern void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock);
135#else 135#else
136static inline void do_raw_spin_lock(raw_spinlock_t *lock) 136static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock)
137{ 137{
138 __acquire(lock);
138 arch_spin_lock(&lock->raw_lock); 139 arch_spin_lock(&lock->raw_lock);
139} 140}
140 141
141static inline void 142static inline void
142do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) 143do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lock)
143{ 144{
145 __acquire(lock);
144 arch_spin_lock_flags(&lock->raw_lock, *flags); 146 arch_spin_lock_flags(&lock->raw_lock, *flags);
145} 147}
146 148
@@ -149,9 +151,10 @@ static inline int do_raw_spin_trylock(raw_spinlock_t *lock)
149 return arch_spin_trylock(&(lock)->raw_lock); 151 return arch_spin_trylock(&(lock)->raw_lock);
150} 152}
151 153
152static inline void do_raw_spin_unlock(raw_spinlock_t *lock) 154static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
153{ 155{
154 arch_spin_unlock(&lock->raw_lock); 156 arch_spin_unlock(&lock->raw_lock);
157 __release(lock);
155} 158}
156#endif 159#endif
157 160
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 18e7c7c0cae6..997c3b4c212b 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -82,4 +82,11 @@ extern ssize_t splice_to_pipe(struct pipe_inode_info *,
82extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, 82extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
83 splice_direct_actor *); 83 splice_direct_actor *);
84 84
85/*
86 * for dynamic pipe sizing
87 */
88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
89extern void splice_shrink_spd(struct pipe_inode_info *,
90 struct splice_pipe_desc *);
91
85#endif 92#endif
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 4765d97dcafb..4d5d2f546dbf 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -27,14 +27,19 @@
27#ifndef _LINUX_SRCU_H 27#ifndef _LINUX_SRCU_H
28#define _LINUX_SRCU_H 28#define _LINUX_SRCU_H
29 29
30#include <linux/mutex.h>
31
30struct srcu_struct_array { 32struct srcu_struct_array {
31 int c[2]; 33 int c[2];
32}; 34};
33 35
34struct srcu_struct { 36struct srcu_struct {
35 int completed; 37 int completed;
36 struct srcu_struct_array *per_cpu_ref; 38 struct srcu_struct_array __percpu *per_cpu_ref;
37 struct mutex mutex; 39 struct mutex mutex;
40#ifdef CONFIG_DEBUG_LOCK_ALLOC
41 struct lockdep_map dep_map;
42#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
38}; 43};
39 44
40#ifndef CONFIG_PREEMPT 45#ifndef CONFIG_PREEMPT
@@ -43,12 +48,100 @@ struct srcu_struct {
43#define srcu_barrier() 48#define srcu_barrier()
44#endif /* #else #ifndef CONFIG_PREEMPT */ 49#endif /* #else #ifndef CONFIG_PREEMPT */
45 50
51#ifdef CONFIG_DEBUG_LOCK_ALLOC
52
53int __init_srcu_struct(struct srcu_struct *sp, const char *name,
54 struct lock_class_key *key);
55
56#define init_srcu_struct(sp) \
57({ \
58 static struct lock_class_key __srcu_key; \
59 \
60 __init_srcu_struct((sp), #sp, &__srcu_key); \
61})
62
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 */
69
46int init_srcu_struct(struct srcu_struct *sp); 70int init_srcu_struct(struct srcu_struct *sp);
71
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 */
76
47void cleanup_srcu_struct(struct srcu_struct *sp); 77void cleanup_srcu_struct(struct srcu_struct *sp);
48int srcu_read_lock(struct srcu_struct *sp) __acquires(sp); 78int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
49void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); 79void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
50void synchronize_srcu(struct srcu_struct *sp); 80void synchronize_srcu(struct srcu_struct *sp);
51void synchronize_srcu_expedited(struct srcu_struct *sp); 81void synchronize_srcu_expedited(struct srcu_struct *sp);
52long srcu_batches_completed(struct srcu_struct *sp); 82long srcu_batches_completed(struct srcu_struct *sp);
53 83
84#ifdef CONFIG_DEBUG_LOCK_ALLOC
85
86/**
87 * srcu_read_lock_held - might we be in SRCU read-side critical section?
88 *
89 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU
90 * 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
92 * prove otherwise.
93 */
94static inline int srcu_read_lock_held(struct srcu_struct *sp)
95{
96 if (debug_locks)
97 return lock_is_held(&sp->dep_map);
98 return 1;
99}
100
101#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
102
103static inline int srcu_read_lock_held(struct srcu_struct *sp)
104{
105 return 1;
106}
107
108#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
109
110/**
111 * srcu_dereference - fetch SRCU-protected pointer with checking
112 *
113 * Makes rcu_dereference_check() do the dirty work.
114 */
115#define srcu_dereference(p, sp) \
116 rcu_dereference_check(p, srcu_read_lock_held(sp))
117
118/**
119 * srcu_read_lock - register a new reader for an SRCU-protected structure.
120 * @sp: srcu_struct in which to register the new reader.
121 *
122 * Enter an SRCU read-side critical section. Note that SRCU read-side
123 * critical sections may be nested.
124 */
125static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
126{
127 int retval = __srcu_read_lock(sp);
128
129 srcu_read_acquire(sp);
130 return retval;
131}
132
133/**
134 * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
135 * @sp: srcu_struct in which to unregister the old reader.
136 * @idx: return value from corresponding srcu_read_lock().
137 *
138 * Exit an SRCU read-side critical section.
139 */
140static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
141 __releases(sp)
142{
143 srcu_read_release(sp);
144 __srcu_read_unlock(sp, idx);
145}
146
54#endif 147#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 24f988547361..a2608bff9c78 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -305,6 +305,7 @@ struct ssb_bus {
305 /* ID information about the Chip. */ 305 /* ID information about the Chip. */
306 u16 chip_id; 306 u16 chip_id;
307 u16 chip_rev; 307 u16 chip_rev;
308 u16 sprom_offset;
308 u16 sprom_size; /* number of words in sprom */ 309 u16 sprom_size; /* number of words in sprom */
309 u8 chip_package; 310 u8 chip_package;
310 311
@@ -394,6 +395,9 @@ extern int ssb_bus_sdiobus_register(struct ssb_bus *bus,
394 395
395extern void ssb_bus_unregister(struct ssb_bus *bus); 396extern void ssb_bus_unregister(struct ssb_bus *bus);
396 397
398/* Does the device have an SPROM? */
399extern bool ssb_is_sprom_available(struct ssb_bus *bus);
400
397/* Set a fallback SPROM. 401/* Set a fallback SPROM.
398 * See kdoc at the function definition for complete documentation. */ 402 * See kdoc at the function definition for complete documentation. */
399extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom); 403extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 4e27acf0a92f..2cdf249b4e5f 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -53,6 +53,7 @@
53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ 53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */
54#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */ 54#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */
55#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */ 55#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */
56#define SSB_CHIPCO_CAP_SPROM 0x40000000 /* SPROM present */
56#define SSB_CHIPCO_CORECTL 0x0008 57#define SSB_CHIPCO_CORECTL 0x0008
57#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ 58#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */
58#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ 59#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
@@ -385,6 +386,7 @@
385 386
386 387
387/** Chip specific Chip-Status register contents. */ 388/** Chip specific Chip-Status register contents. */
389#define SSB_CHIPCO_CHST_4322_SPROM_EXISTS 0x00000040 /* SPROM present */
388#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003 390#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003
389#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */ 391#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */
390#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */ 392#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
@@ -398,6 +400,18 @@
398#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4 400#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4
399#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */ 401#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */
400 402
403/** Macros to determine SPROM presence based on Chip-Status register. */
404#define SSB_CHIPCO_CHST_4312_SPROM_PRESENT(status) \
405 ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
406 SSB_CHIPCO_CHST_4325_OTP_SEL)
407#define SSB_CHIPCO_CHST_4322_SPROM_PRESENT(status) \
408 (status & SSB_CHIPCO_CHST_4322_SPROM_EXISTS)
409#define SSB_CHIPCO_CHST_4325_SPROM_PRESENT(status) \
410 (((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
411 SSB_CHIPCO_CHST_4325_DEFCIS_SEL) && \
412 ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
413 SSB_CHIPCO_CHST_4325_OTP_SEL))
414
401 415
402 416
403/** Clockcontrol masks and values **/ 417/** Clockcontrol masks and values **/
@@ -564,6 +578,7 @@ struct ssb_chipcommon_pmu {
564struct ssb_chipcommon { 578struct ssb_chipcommon {
565 struct ssb_device *dev; 579 struct ssb_device *dev;
566 u32 capabilities; 580 u32 capabilities;
581 u32 status;
567 /* Fast Powerup Delay constant */ 582 /* Fast Powerup Delay constant */
568 u16 fast_pwrup_delay; 583 u16 fast_pwrup_delay;
569 struct ssb_chipcommon_pmu pmu; 584 struct ssb_chipcommon_pmu pmu;
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 9ae9082eaeb4..a6d5225b9275 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -170,26 +170,27 @@
170#define SSB_SPROMSIZE_WORDS_R4 220 170#define SSB_SPROMSIZE_WORDS_R4 220
171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
173#define SSB_SPROM_BASE 0x1000 173#define SSB_SPROM_BASE1 0x1000
174#define SSB_SPROM_REVISION 0x107E 174#define SSB_SPROM_BASE31 0x0800
175#define SSB_SPROM_REVISION 0x007E
175#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ 176#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
176#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ 177#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
177#define SSB_SPROM_REVISION_CRC_SHIFT 8 178#define SSB_SPROM_REVISION_CRC_SHIFT 8
178 179
179/* SPROM Revision 1 */ 180/* SPROM Revision 1 */
180#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ 181#define SSB_SPROM1_SPID 0x0004 /* Subsystem Product ID for PCI */
181#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ 182#define SSB_SPROM1_SVID 0x0006 /* Subsystem Vendor ID for PCI */
182#define SSB_SPROM1_PID 0x1008 /* Product ID for PCI */ 183#define SSB_SPROM1_PID 0x0008 /* Product ID for PCI */
183#define SSB_SPROM1_IL0MAC 0x1048 /* 6 bytes MAC address for 802.11b/g */ 184#define SSB_SPROM1_IL0MAC 0x0048 /* 6 bytes MAC address for 802.11b/g */
184#define SSB_SPROM1_ET0MAC 0x104E /* 6 bytes MAC address for Ethernet */ 185#define SSB_SPROM1_ET0MAC 0x004E /* 6 bytes MAC address for Ethernet */
185#define SSB_SPROM1_ET1MAC 0x1054 /* 6 bytes MAC address for 802.11a */ 186#define SSB_SPROM1_ET1MAC 0x0054 /* 6 bytes MAC address for 802.11a */
186#define SSB_SPROM1_ETHPHY 0x105A /* Ethernet PHY settings */ 187#define SSB_SPROM1_ETHPHY 0x005A /* Ethernet PHY settings */
187#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 188#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
188#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 189#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
189#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5 190#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5
190#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 191#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
191#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 192#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
192#define SSB_SPROM1_BINF 0x105C /* Board info */ 193#define SSB_SPROM1_BINF 0x005C /* Board info */
193#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ 194#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
194#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ 195#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
195#define SSB_SPROM1_BINF_CCODE_SHIFT 8 196#define SSB_SPROM1_BINF_CCODE_SHIFT 8
@@ -197,63 +198,63 @@
197#define SSB_SPROM1_BINF_ANTBG_SHIFT 12 198#define SSB_SPROM1_BINF_ANTBG_SHIFT 12
198#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */ 199#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
199#define SSB_SPROM1_BINF_ANTA_SHIFT 14 200#define SSB_SPROM1_BINF_ANTA_SHIFT 14
200#define SSB_SPROM1_PA0B0 0x105E 201#define SSB_SPROM1_PA0B0 0x005E
201#define SSB_SPROM1_PA0B1 0x1060 202#define SSB_SPROM1_PA0B1 0x0060
202#define SSB_SPROM1_PA0B2 0x1062 203#define SSB_SPROM1_PA0B2 0x0062
203#define SSB_SPROM1_GPIOA 0x1064 /* General Purpose IO pins 0 and 1 */ 204#define SSB_SPROM1_GPIOA 0x0064 /* General Purpose IO pins 0 and 1 */
204#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */ 205#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */
205#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */ 206#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */
206#define SSB_SPROM1_GPIOA_P1_SHIFT 8 207#define SSB_SPROM1_GPIOA_P1_SHIFT 8
207#define SSB_SPROM1_GPIOB 0x1066 /* General Purpuse IO pins 2 and 3 */ 208#define SSB_SPROM1_GPIOB 0x0066 /* General Purpuse IO pins 2 and 3 */
208#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */ 209#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */
209#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */ 210#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */
210#define SSB_SPROM1_GPIOB_P3_SHIFT 8 211#define SSB_SPROM1_GPIOB_P3_SHIFT 8
211#define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */ 212#define SSB_SPROM1_MAXPWR 0x0068 /* Power Amplifier Max Power */
212#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */ 213#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */
213#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */ 214#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */
214#define SSB_SPROM1_MAXPWR_A_SHIFT 8 215#define SSB_SPROM1_MAXPWR_A_SHIFT 8
215#define SSB_SPROM1_PA1B0 0x106A 216#define SSB_SPROM1_PA1B0 0x006A
216#define SSB_SPROM1_PA1B1 0x106C 217#define SSB_SPROM1_PA1B1 0x006C
217#define SSB_SPROM1_PA1B2 0x106E 218#define SSB_SPROM1_PA1B2 0x006E
218#define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */ 219#define SSB_SPROM1_ITSSI 0x0070 /* Idle TSSI Target */
219#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/ 220#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/
220#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */ 221#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */
221#define SSB_SPROM1_ITSSI_A_SHIFT 8 222#define SSB_SPROM1_ITSSI_A_SHIFT 8
222#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ 223#define SSB_SPROM1_BFLLO 0x0072 /* Boardflags (low 16 bits) */
223#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ 224#define SSB_SPROM1_AGAIN 0x0074 /* Antenna Gain (in dBm Q5.2) */
224#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */ 225#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
225#define SSB_SPROM1_AGAIN_BG_SHIFT 0 226#define SSB_SPROM1_AGAIN_BG_SHIFT 0
226#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ 227#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
227#define SSB_SPROM1_AGAIN_A_SHIFT 8 228#define SSB_SPROM1_AGAIN_A_SHIFT 8
228 229
229/* SPROM Revision 2 (inherits from rev 1) */ 230/* SPROM Revision 2 (inherits from rev 1) */
230#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ 231#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
231#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ 232#define SSB_SPROM2_MAXP_A 0x003A /* A-PHY Max Power */
232#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */ 233#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */
233#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */ 234#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */
234#define SSB_SPROM2_MAXP_A_LO_SHIFT 8 235#define SSB_SPROM2_MAXP_A_LO_SHIFT 8
235#define SSB_SPROM2_PA1LOB0 0x103C /* A-PHY PowerAmplifier Low Settings */ 236#define SSB_SPROM2_PA1LOB0 0x003C /* A-PHY PowerAmplifier Low Settings */
236#define SSB_SPROM2_PA1LOB1 0x103E /* A-PHY PowerAmplifier Low Settings */ 237#define SSB_SPROM2_PA1LOB1 0x003E /* A-PHY PowerAmplifier Low Settings */
237#define SSB_SPROM2_PA1LOB2 0x1040 /* A-PHY PowerAmplifier Low Settings */ 238#define SSB_SPROM2_PA1LOB2 0x0040 /* A-PHY PowerAmplifier Low Settings */
238#define SSB_SPROM2_PA1HIB0 0x1042 /* A-PHY PowerAmplifier High Settings */ 239#define SSB_SPROM2_PA1HIB0 0x0042 /* A-PHY PowerAmplifier High Settings */
239#define SSB_SPROM2_PA1HIB1 0x1044 /* A-PHY PowerAmplifier High Settings */ 240#define SSB_SPROM2_PA1HIB1 0x0044 /* A-PHY PowerAmplifier High Settings */
240#define SSB_SPROM2_PA1HIB2 0x1046 /* A-PHY PowerAmplifier High Settings */ 241#define SSB_SPROM2_PA1HIB2 0x0046 /* A-PHY PowerAmplifier High Settings */
241#define SSB_SPROM2_OPO 0x1078 /* OFDM Power Offset from CCK Level */ 242#define SSB_SPROM2_OPO 0x0078 /* OFDM Power Offset from CCK Level */
242#define SSB_SPROM2_OPO_VALUE 0x00FF 243#define SSB_SPROM2_OPO_VALUE 0x00FF
243#define SSB_SPROM2_OPO_UNUSED 0xFF00 244#define SSB_SPROM2_OPO_UNUSED 0xFF00
244#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ 245#define SSB_SPROM2_CCODE 0x007C /* Two char Country Code */
245 246
246/* SPROM Revision 3 (inherits most data from rev 2) */ 247/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ 248#define SSB_SPROM3_OFDMAPO 0x002C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
248#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 249#define SSB_SPROM3_OFDMALPO 0x0030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
249#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAHPO 0x0034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
250#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 251#define SSB_SPROM3_GPIOLDC 0x0042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
251#define SSB_SPROM3_GPIOLDC 0x1042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
252#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */ 252#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */
253#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8 253#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8
254#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */ 254#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */
255#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16 255#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16
256#define SSB_SPROM3_CCKPO 0x1078 /* CCK Power Offset */ 256#define SSB_SPROM3_IL0MAC 0x004A /* 6 bytes MAC address for 802.11b/g */
257#define SSB_SPROM3_CCKPO 0x0078 /* CCK Power Offset */
257#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */ 258#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */
258#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */ 259#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */
259#define SSB_SPROM3_CCKPO_2M_SHIFT 4 260#define SSB_SPROM3_CCKPO_2M_SHIFT 4
@@ -264,100 +265,100 @@
264#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 265#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
265 266
266/* SPROM Revision 4 */ 267/* SPROM Revision 4 */
267#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ 268#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
268#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ 269#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
270#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */
271#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */
272#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */
273#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
274#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
275#define SSB_SPROM4_GPIOA_P1_SHIFT 8
276#define SSB_SPROM4_GPIOB 0x0058 /* Gen. Purpose IO # 2 and 3 */
277#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
278#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
279#define SSB_SPROM4_GPIOB_P3_SHIFT 8
280#define SSB_SPROM4_ETHPHY 0x005A /* Ethernet PHY settings ?? */
269#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 281#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
270#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 282#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
271#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 283#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
272#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 284#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
273#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 285#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
274#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */ 286#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */
275#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */ 287#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
276#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ 288#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
277#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 289#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
278#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ 290#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
279#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 291#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */
280#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
281#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
282#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ 292#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
283#define SSB_SPROM4_AGAIN0_SHIFT 0 293#define SSB_SPROM4_AGAIN0_SHIFT 0
284#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */ 294#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
285#define SSB_SPROM4_AGAIN1_SHIFT 8 295#define SSB_SPROM4_AGAIN1_SHIFT 8
286#define SSB_SPROM4_AGAIN23 0x1060 296#define SSB_SPROM4_AGAIN23 0x0060
287#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */ 297#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
288#define SSB_SPROM4_AGAIN2_SHIFT 0 298#define SSB_SPROM4_AGAIN2_SHIFT 0
289#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ 299#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
290#define SSB_SPROM4_AGAIN3_SHIFT 8 300#define SSB_SPROM4_AGAIN3_SHIFT 8
291#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */ 301#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
292#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
293#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 302#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
294#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 303#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
295#define SSB_SPROM4_ITSSI_BG_SHIFT 8 304#define SSB_SPROM4_ITSSI_BG_SHIFT 8
296#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */ 305#define SSB_SPROM4_MAXP_A 0x008A /* Max Power A in path 1 */
297#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ 306#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
298#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 307#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
299#define SSB_SPROM4_ITSSI_A_SHIFT 8 308#define SSB_SPROM4_ITSSI_A_SHIFT 8
300#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */ 309#define SSB_SPROM4_PA0B0 0x0082 /* The paXbY locations are */
301#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */ 310#define SSB_SPROM4_PA0B1 0x0084 /* only guesses */
302#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */ 311#define SSB_SPROM4_PA0B2 0x0086
303#define SSB_SPROM4_GPIOA_P1_SHIFT 8 312#define SSB_SPROM4_PA1B0 0x008E
304#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */ 313#define SSB_SPROM4_PA1B1 0x0090
305#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */ 314#define SSB_SPROM4_PA1B2 0x0092
306#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
307#define SSB_SPROM4_GPIOB_P3_SHIFT 8
308#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
309#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
310#define SSB_SPROM4_PA0B2 0x1086
311#define SSB_SPROM4_PA1B0 0x108E
312#define SSB_SPROM4_PA1B1 0x1090
313#define SSB_SPROM4_PA1B2 0x1092
314 315
315/* SPROM Revision 5 (inherits most data from rev 4) */ 316/* SPROM Revision 5 (inherits most data from rev 4) */
316#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ 317#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */
317#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ 318#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */
318#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ 319#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */
319#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ 320#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */
320#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ 321#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */
321#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ 322#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
322#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ 323#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */
323#define SSB_SPROM5_GPIOA_P1_SHIFT 8 324#define SSB_SPROM5_GPIOA_P1_SHIFT 8
324#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ 325#define SSB_SPROM5_GPIOB 0x0078 /* Gen. Purpose IO # 2 and 3 */
325#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ 326#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ 327#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 328#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 329
329/* SPROM Revision 8 */ 330/* SPROM Revision 8 */
330#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */ 331#define SSB_SPROM8_BOARDREV 0x0082 /* Board revision */
331#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */ 332#define SSB_SPROM8_BFLLO 0x0084 /* Board flags (bits 0-15) */
332#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */ 333#define SSB_SPROM8_BFLHI 0x0086 /* Board flags (bits 16-31) */
333#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */ 334#define SSB_SPROM8_BFL2LO 0x0088 /* Board flags (bits 32-47) */
334#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */ 335#define SSB_SPROM8_BFL2HI 0x008A /* Board flags (bits 48-63) */
335#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */ 336#define SSB_SPROM8_IL0MAC 0x008C /* 6 byte MAC address */
336#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */ 337#define SSB_SPROM8_CCODE 0x0092 /* 2 byte country code */
337#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/ 338#define SSB_SPROM8_GPIOA 0x0096 /*Gen. Purpose IO # 0 and 1 */
338#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ 339#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
339#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 340#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
340#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ 341#define SSB_SPROM8_GPIOA_P1_SHIFT 8
341#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0 342#define SSB_SPROM8_GPIOB 0x0098 /* Gen. Purpose IO # 2 and 3 */
342#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */ 343#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
344#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
345#define SSB_SPROM8_GPIOB_P3_SHIFT 8
346#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
347#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
348#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
349#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
350#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
351#define SSB_SPROM8_AGAIN01 0x009E /* Antenna Gain (in dBm Q5.2) */
343#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */ 352#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */
344#define SSB_SPROM8_AGAIN0_SHIFT 0 353#define SSB_SPROM8_AGAIN0_SHIFT 0
345#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */ 354#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */
346#define SSB_SPROM8_AGAIN1_SHIFT 8 355#define SSB_SPROM8_AGAIN1_SHIFT 8
347#define SSB_SPROM8_AGAIN23 0x10A0 356#define SSB_SPROM8_AGAIN23 0x00A0
348#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */ 357#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */
349#define SSB_SPROM8_AGAIN2_SHIFT 0 358#define SSB_SPROM8_AGAIN2_SHIFT 0
350#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ 359#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
351#define SSB_SPROM8_AGAIN3_SHIFT 8 360#define SSB_SPROM8_AGAIN3_SHIFT 8
352#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */ 361#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
353#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
354#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
355#define SSB_SPROM8_GPIOA_P1_SHIFT 8
356#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */
357#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
358#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
359#define SSB_SPROM8_GPIOB_P3_SHIFT 8
360#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */
361#define SSB_SPROM8_RSSISMF2G 0x000F 362#define SSB_SPROM8_RSSISMF2G 0x000F
362#define SSB_SPROM8_RSSISMC2G 0x00F0 363#define SSB_SPROM8_RSSISMC2G 0x00F0
363#define SSB_SPROM8_RSSISMC2G_SHIFT 4 364#define SSB_SPROM8_RSSISMC2G_SHIFT 4
@@ -365,7 +366,7 @@
365#define SSB_SPROM8_RSSISAV2G_SHIFT 8 366#define SSB_SPROM8_RSSISAV2G_SHIFT 8
366#define SSB_SPROM8_BXA2G 0x1800 367#define SSB_SPROM8_BXA2G 0x1800
367#define SSB_SPROM8_BXA2G_SHIFT 11 368#define SSB_SPROM8_BXA2G_SHIFT 11
368#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */ 369#define SSB_SPROM8_RSSIPARM5G 0x00A6 /* RSSI params for 5GHz */
369#define SSB_SPROM8_RSSISMF5G 0x000F 370#define SSB_SPROM8_RSSISMF5G 0x000F
370#define SSB_SPROM8_RSSISMC5G 0x00F0 371#define SSB_SPROM8_RSSISMC5G 0x00F0
371#define SSB_SPROM8_RSSISMC5G_SHIFT 4 372#define SSB_SPROM8_RSSISMC5G_SHIFT 4
@@ -373,47 +374,47 @@
373#define SSB_SPROM8_RSSISAV5G_SHIFT 8 374#define SSB_SPROM8_RSSISAV5G_SHIFT 8
374#define SSB_SPROM8_BXA5G 0x1800 375#define SSB_SPROM8_BXA5G 0x1800
375#define SSB_SPROM8_BXA5G_SHIFT 11 376#define SSB_SPROM8_BXA5G_SHIFT 11
376#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */ 377#define SSB_SPROM8_TRI25G 0x00A8 /* TX isolation 2.4&5.3GHz */
377#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */ 378#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */
378#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */ 379#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */
379#define SSB_SPROM8_TRI5G_SHIFT 8 380#define SSB_SPROM8_TRI5G_SHIFT 8
380#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */ 381#define SSB_SPROM8_TRI5GHL 0x00AA /* TX isolation 5.2/5.8GHz */
381#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */ 382#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */
382#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */ 383#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */
383#define SSB_SPROM8_TRI5GH_SHIFT 8 384#define SSB_SPROM8_TRI5GH_SHIFT 8
384#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */ 385#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
385#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 386#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
386#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 387#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
387#define SSB_SPROM8_RXPO5G_SHIFT 8 388#define SSB_SPROM8_RXPO5G_SHIFT 8
388#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power 2GHz in path 1 */ 389#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
389#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 390#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
390#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 391#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
391#define SSB_SPROM8_ITSSI_BG_SHIFT 8 392#define SSB_SPROM8_ITSSI_BG_SHIFT 8
392#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */ 393#define SSB_SPROM8_PA0B0 0x00C2 /* 2GHz power amp settings */
393#define SSB_SPROM8_PA0B1 0x10C4 394#define SSB_SPROM8_PA0B1 0x00C4
394#define SSB_SPROM8_PA0B2 0x10C6 395#define SSB_SPROM8_PA0B2 0x00C6
395#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */ 396#define SSB_SPROM8_MAXP_A 0x00C8 /* Max Power 5.3GHz */
396#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */ 397#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */
397#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 398#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
398#define SSB_SPROM8_ITSSI_A_SHIFT 8 399#define SSB_SPROM8_ITSSI_A_SHIFT 8
399#define SSB_SPROM8_MAXP_AHL 0x10CA /* Max Power 5.2/5.8GHz */ 400#define SSB_SPROM8_MAXP_AHL 0x00CA /* Max Power 5.2/5.8GHz */
400#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */ 401#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */
401#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */ 402#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */
402#define SSB_SPROM8_MAXP_AL_SHIFT 8 403#define SSB_SPROM8_MAXP_AL_SHIFT 8
403#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */ 404#define SSB_SPROM8_PA1B0 0x00CC /* 5.3GHz power amp settings */
404#define SSB_SPROM8_PA1B1 0x10CE 405#define SSB_SPROM8_PA1B1 0x00CE
405#define SSB_SPROM8_PA1B2 0x10D0 406#define SSB_SPROM8_PA1B2 0x00D0
406#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */ 407#define SSB_SPROM8_PA1LOB0 0x00D2 /* 5.2GHz power amp settings */
407#define SSB_SPROM8_PA1LOB1 0x10D4 408#define SSB_SPROM8_PA1LOB1 0x00D4
408#define SSB_SPROM8_PA1LOB2 0x10D6 409#define SSB_SPROM8_PA1LOB2 0x00D6
409#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */ 410#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
410#define SSB_SPROM8_PA1HIB1 0x10DA 411#define SSB_SPROM8_PA1HIB1 0x00DA
411#define SSB_SPROM8_PA1HIB2 0x10DC 412#define SSB_SPROM8_PA1HIB2 0x00DC
412#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */ 413#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
413#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */ 414#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
414#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */ 415#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
415#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */ 416#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
416#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */ 417#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
417 418
418/* Values for SSB_SPROM1_BINF_CCODE */ 419/* Values for SSB_SPROM1_BINF_CCODE */
419enum { 420enum {
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
new file mode 100644
index 000000000000..632ff7c03280
--- /dev/null
+++ b/include/linux/stmmac.h
@@ -0,0 +1,54 @@
1/*******************************************************************************
2
3 Header file for stmmac platform data
4
5 Copyright (C) 2009 STMicroelectronics Ltd
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 The full GNU General Public License is included in this distribution in
21 the file called "COPYING".
22
23 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
24*******************************************************************************/
25
26#ifndef __STMMAC_PLATFORM_DATA
27#define __STMMAC_PLATFORM_DATA
28
29/* platfrom data for platfrom device structure's platfrom_data field */
30
31/* Private data for the STM on-board ethernet driver */
32struct plat_stmmacenet_data {
33 int bus_id;
34 int pbl;
35 int has_gmac;
36 int enh_desc;
37 void (*fix_mac_speed)(void *priv, unsigned int speed);
38 void (*bus_setup)(unsigned long ioaddr);
39#ifdef CONFIG_STM_DRIVERS
40 struct stm_pad_config *pad_config;
41#endif
42 void *bsp_priv;
43};
44
45struct plat_stmmacphy_data {
46 int bus_id;
47 int phy_addr;
48 unsigned int phy_mask;
49 int interface;
50 int (*phy_reset)(void *priv);
51 void *priv;
52};
53#endif
54
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index baba3a23a814..6b524a0d02e4 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -1,13 +1,101 @@
1#ifndef _LINUX_STOP_MACHINE 1#ifndef _LINUX_STOP_MACHINE
2#define _LINUX_STOP_MACHINE 2#define _LINUX_STOP_MACHINE
3/* "Bogolock": stop the entire machine, disable interrupts. This is a 3
4 very heavy lock, which is equivalent to grabbing every spinlock
5 (and more). So the "read" side to such a lock is anything which
6 disables preeempt. */
7#include <linux/cpu.h> 4#include <linux/cpu.h>
8#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/list.h>
9#include <asm/system.h> 7#include <asm/system.h>
10 8
9/*
10 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu
11 * monopolization mechanism. The caller can specify a non-sleeping
12 * function to be executed on a single or multiple cpus preempting all
13 * other processes and monopolizing those cpus until it finishes.
14 *
15 * Resources for this mechanism are preallocated when a cpu is brought
16 * up and requests are guaranteed to be served as long as the target
17 * cpus are online.
18 */
19typedef int (*cpu_stop_fn_t)(void *arg);
20
21#ifdef CONFIG_SMP
22
23struct cpu_stop_work {
24 struct list_head list; /* cpu_stopper->works */
25 cpu_stop_fn_t fn;
26 void *arg;
27 struct cpu_stop_done *done;
28};
29
30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
31void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
32 struct cpu_stop_work *work_buf);
33int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
34int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
35
36#else /* CONFIG_SMP */
37
38#include <linux/workqueue.h>
39
40struct cpu_stop_work {
41 struct work_struct work;
42 cpu_stop_fn_t fn;
43 void *arg;
44};
45
46static inline int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
47{
48 int ret = -ENOENT;
49 preempt_disable();
50 if (cpu == smp_processor_id())
51 ret = fn(arg);
52 preempt_enable();
53 return ret;
54}
55
56static void stop_one_cpu_nowait_workfn(struct work_struct *work)
57{
58 struct cpu_stop_work *stwork =
59 container_of(work, struct cpu_stop_work, work);
60 preempt_disable();
61 stwork->fn(stwork->arg);
62 preempt_enable();
63}
64
65static inline void stop_one_cpu_nowait(unsigned int cpu,
66 cpu_stop_fn_t fn, void *arg,
67 struct cpu_stop_work *work_buf)
68{
69 if (cpu == smp_processor_id()) {
70 INIT_WORK(&work_buf->work, stop_one_cpu_nowait_workfn);
71 work_buf->fn = fn;
72 work_buf->arg = arg;
73 schedule_work(&work_buf->work);
74 }
75}
76
77static inline int stop_cpus(const struct cpumask *cpumask,
78 cpu_stop_fn_t fn, void *arg)
79{
80 if (cpumask_test_cpu(raw_smp_processor_id(), cpumask))
81 return stop_one_cpu(raw_smp_processor_id(), fn, arg);
82 return -ENOENT;
83}
84
85static inline int try_stop_cpus(const struct cpumask *cpumask,
86 cpu_stop_fn_t fn, void *arg)
87{
88 return stop_cpus(cpumask, fn, arg);
89}
90
91#endif /* CONFIG_SMP */
92
93/*
94 * stop_machine "Bogolock": stop the entire machine, disable
95 * interrupts. This is a very heavy lock, which is equivalent to
96 * grabbing every spinlock (and more). So the "read" side to such a
97 * lock is anything which disables preeempt.
98 */
11#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 99#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
12 100
13/** 101/**
@@ -36,24 +124,7 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
36 */ 124 */
37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); 125int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38 126
39/** 127#else /* CONFIG_STOP_MACHINE && CONFIG_SMP */
40 * stop_machine_create: create all stop_machine threads
41 *
42 * Description: This causes all stop_machine threads to be created before
43 * stop_machine actually gets called. This can be used by subsystems that
44 * need a non failing stop_machine infrastructure.
45 */
46int stop_machine_create(void);
47
48/**
49 * stop_machine_destroy: destroy all stop_machine threads
50 *
51 * Description: This causes all stop_machine threads which were created with
52 * stop_machine_create to be destroyed again.
53 */
54void stop_machine_destroy(void);
55
56#else
57 128
58static inline int stop_machine(int (*fn)(void *), void *data, 129static inline int stop_machine(int (*fn)(void *), void *data,
59 const struct cpumask *cpus) 130 const struct cpumask *cpus)
@@ -65,8 +136,5 @@ static inline int stop_machine(int (*fn)(void *), void *data,
65 return ret; 136 return ret;
66} 137}
67 138
68static inline int stop_machine_create(void) { return 0; } 139#endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */
69static inline void stop_machine_destroy(void) { } 140#endif /* _LINUX_STOP_MACHINE */
70
71#endif /* CONFIG_SMP */
72#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 996df4dac7d4..87d7ec0bf779 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -54,6 +54,7 @@ struct rpc_cred {
54#define RPCAUTH_CRED_NEW 0 54#define RPCAUTH_CRED_NEW 0
55#define RPCAUTH_CRED_UPTODATE 1 55#define RPCAUTH_CRED_UPTODATE 1
56#define RPCAUTH_CRED_HASHED 2 56#define RPCAUTH_CRED_HASHED 2
57#define RPCAUTH_CRED_NEGATIVE 3
57 58
58#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 59#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0
59 60
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index d48d4e605f74..671538d25bc1 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -82,6 +82,7 @@ struct gss_cred {
82 enum rpc_gss_svc gc_service; 82 enum rpc_gss_svc gc_service;
83 struct gss_cl_ctx *gc_ctx; 83 struct gss_cl_ctx *gc_ctx;
84 struct gss_upcall_msg *gc_upcall; 84 struct gss_upcall_msg *gc_upcall;
85 unsigned long gc_upcall_timestamp;
85 unsigned char gc_machine_cred : 1; 86 unsigned char gc_machine_cred : 1;
86}; 87};
87 88
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index 6508f0dc0eff..7c91260c44a9 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -36,14 +36,32 @@ struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
36void xprt_free_bc_request(struct rpc_rqst *req); 36void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
38void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs); 38void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs);
39void bc_release_request(struct rpc_task *);
40int bc_send(struct rpc_rqst *req); 39int bc_send(struct rpc_rqst *req);
40
41/*
42 * Determine if a shared backchannel is in use
43 */
44static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
45{
46 if (rqstp->rq_server->bc_xprt)
47 return 1;
48 return 0;
49}
41#else /* CONFIG_NFS_V4_1 */ 50#else /* CONFIG_NFS_V4_1 */
42static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, 51static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
43 unsigned int min_reqs) 52 unsigned int min_reqs)
44{ 53{
45 return 0; 54 return 0;
46} 55}
56
57static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
58{
59 return 0;
60}
61
62static inline void xprt_free_bc_request(struct rpc_rqst *req)
63{
64}
47#endif /* CONFIG_NFS_V4_1 */ 65#endif /* CONFIG_NFS_V4_1 */
48#endif /* _LINUX_SUNRPC_BC_XPRT_H */ 66#endif /* _LINUX_SUNRPC_BC_XPRT_H */
49 67
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 03f33330ece2..5d8048beb051 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -35,7 +35,8 @@ int gss_import_sec_context(
35 const void* input_token, 35 const void* input_token,
36 size_t bufsize, 36 size_t bufsize,
37 struct gss_api_mech *mech, 37 struct gss_api_mech *mech,
38 struct gss_ctx **ctx_id); 38 struct gss_ctx **ctx_id,
39 gfp_t gfp_mask);
39u32 gss_get_mic( 40u32 gss_get_mic(
40 struct gss_ctx *ctx_id, 41 struct gss_ctx *ctx_id,
41 struct xdr_buf *message, 42 struct xdr_buf *message,
@@ -80,6 +81,8 @@ struct gss_api_mech {
80 /* pseudoflavors supported by this mechanism: */ 81 /* pseudoflavors supported by this mechanism: */
81 int gm_pf_num; 82 int gm_pf_num;
82 struct pf_desc * gm_pfs; 83 struct pf_desc * gm_pfs;
84 /* Should the following be a callback operation instead? */
85 const char *gm_upcall_enctypes;
83}; 86};
84 87
85/* and must provide the following operations: */ 88/* and must provide the following operations: */
@@ -87,7 +90,8 @@ struct gss_api_ops {
87 int (*gss_import_sec_context)( 90 int (*gss_import_sec_context)(
88 const void *input_token, 91 const void *input_token,
89 size_t bufsize, 92 size_t bufsize,
90 struct gss_ctx *ctx_id); 93 struct gss_ctx *ctx_id,
94 gfp_t gfp_mask);
91 u32 (*gss_get_mic)( 95 u32 (*gss_get_mic)(
92 struct gss_ctx *ctx_id, 96 struct gss_ctx *ctx_id,
93 struct xdr_buf *message, 97 struct xdr_buf *message,
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index e7bbdba474d5..5af2931cf58d 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -4,7 +4,7 @@
4 * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h, 4 * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h,
5 * lib/gssapi/krb5/gssapiP_krb5.h, and others 5 * lib/gssapi/krb5/gssapiP_krb5.h, and others
6 * 6 *
7 * Copyright (c) 2000 The Regents of the University of Michigan. 7 * Copyright (c) 2000-2008 The Regents of the University of Michigan.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Andy Adamson <andros@umich.edu> 10 * Andy Adamson <andros@umich.edu>
@@ -36,17 +36,86 @@
36 * 36 *
37 */ 37 */
38 38
39#include <linux/crypto.h>
39#include <linux/sunrpc/auth_gss.h> 40#include <linux/sunrpc/auth_gss.h>
40#include <linux/sunrpc/gss_err.h> 41#include <linux/sunrpc/gss_err.h>
41#include <linux/sunrpc/gss_asn1.h> 42#include <linux/sunrpc/gss_asn1.h>
42 43
44/* Length of constant used in key derivation */
45#define GSS_KRB5_K5CLENGTH (5)
46
47/* Maximum key length (in bytes) for the supported crypto algorithms*/
48#define GSS_KRB5_MAX_KEYLEN (32)
49
50/* Maximum checksum function output for the supported crypto algorithms */
51#define GSS_KRB5_MAX_CKSUM_LEN (20)
52
53/* Maximum blocksize for the supported crypto algorithms */
54#define GSS_KRB5_MAX_BLOCKSIZE (16)
55
56struct krb5_ctx;
57
58struct gss_krb5_enctype {
59 const u32 etype; /* encryption (key) type */
60 const u32 ctype; /* checksum type */
61 const char *name; /* "friendly" name */
62 const char *encrypt_name; /* crypto encrypt name */
63 const char *cksum_name; /* crypto checksum name */
64 const u16 signalg; /* signing algorithm */
65 const u16 sealalg; /* sealing algorithm */
66 const u32 blocksize; /* encryption blocksize */
67 const u32 conflen; /* confounder length
68 (normally the same as
69 the blocksize) */
70 const u32 cksumlength; /* checksum length */
71 const u32 keyed_cksum; /* is it a keyed cksum? */
72 const u32 keybytes; /* raw key len, in bytes */
73 const u32 keylength; /* final key len, in bytes */
74 u32 (*encrypt) (struct crypto_blkcipher *tfm,
75 void *iv, void *in, void *out,
76 int length); /* encryption function */
77 u32 (*decrypt) (struct crypto_blkcipher *tfm,
78 void *iv, void *in, void *out,
79 int length); /* decryption function */
80 u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,
81 struct xdr_netobj *in,
82 struct xdr_netobj *out); /* complete key generation */
83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
84 struct xdr_buf *buf, int ec,
85 struct page **pages); /* v2 encryption function */
86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
87 struct xdr_buf *buf, u32 *headskip,
88 u32 *tailskip); /* v2 decryption function */
89};
90
91/* krb5_ctx flags definitions */
92#define KRB5_CTX_FLAG_INITIATOR 0x00000001
93#define KRB5_CTX_FLAG_CFX 0x00000002
94#define KRB5_CTX_FLAG_ACCEPTOR_SUBKEY 0x00000004
95
43struct krb5_ctx { 96struct krb5_ctx {
44 int initiate; /* 1 = initiating, 0 = accepting */ 97 int initiate; /* 1 = initiating, 0 = accepting */
98 u32 enctype;
99 u32 flags;
100 const struct gss_krb5_enctype *gk5e; /* enctype-specific info */
45 struct crypto_blkcipher *enc; 101 struct crypto_blkcipher *enc;
46 struct crypto_blkcipher *seq; 102 struct crypto_blkcipher *seq;
103 struct crypto_blkcipher *acceptor_enc;
104 struct crypto_blkcipher *initiator_enc;
105 struct crypto_blkcipher *acceptor_enc_aux;
106 struct crypto_blkcipher *initiator_enc_aux;
107 u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
108 u8 cksum[GSS_KRB5_MAX_KEYLEN];
47 s32 endtime; 109 s32 endtime;
48 u32 seq_send; 110 u32 seq_send;
111 u64 seq_send64;
49 struct xdr_netobj mech_used; 112 struct xdr_netobj mech_used;
113 u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];
114 u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];
115 u8 initiator_seal[GSS_KRB5_MAX_KEYLEN];
116 u8 acceptor_seal[GSS_KRB5_MAX_KEYLEN];
117 u8 initiator_integ[GSS_KRB5_MAX_KEYLEN];
118 u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN];
50}; 119};
51 120
52extern spinlock_t krb5_seq_lock; 121extern spinlock_t krb5_seq_lock;
@@ -57,6 +126,18 @@ extern spinlock_t krb5_seq_lock;
57#define KG_TOK_MIC_MSG 0x0101 126#define KG_TOK_MIC_MSG 0x0101
58#define KG_TOK_WRAP_MSG 0x0201 127#define KG_TOK_WRAP_MSG 0x0201
59 128
129#define KG2_TOK_INITIAL 0x0101
130#define KG2_TOK_RESPONSE 0x0202
131#define KG2_TOK_MIC 0x0404
132#define KG2_TOK_WRAP 0x0504
133
134#define KG2_TOKEN_FLAG_SENTBYACCEPTOR 0x01
135#define KG2_TOKEN_FLAG_SEALED 0x02
136#define KG2_TOKEN_FLAG_ACCEPTORSUBKEY 0x04
137
138#define KG2_RESP_FLAG_ERROR 0x0001
139#define KG2_RESP_FLAG_DELEG_OK 0x0002
140
60enum sgn_alg { 141enum sgn_alg {
61 SGN_ALG_DES_MAC_MD5 = 0x0000, 142 SGN_ALG_DES_MAC_MD5 = 0x0000,
62 SGN_ALG_MD2_5 = 0x0001, 143 SGN_ALG_MD2_5 = 0x0001,
@@ -81,6 +162,9 @@ enum seal_alg {
81#define CKSUMTYPE_RSA_MD5_DES 0x0008 162#define CKSUMTYPE_RSA_MD5_DES 0x0008
82#define CKSUMTYPE_NIST_SHA 0x0009 163#define CKSUMTYPE_NIST_SHA 0x0009
83#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c 164#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c
165#define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f
166#define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010
167#define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /* Microsoft md5 hmac cksumtype */
84 168
85/* from gssapi_err_krb5.h */ 169/* from gssapi_err_krb5.h */
86#define KG_CCACHE_NOMATCH (39756032L) 170#define KG_CCACHE_NOMATCH (39756032L)
@@ -111,11 +195,56 @@ enum seal_alg {
111#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ 195#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */
112#define ENCTYPE_DES_HMAC_SHA1 0x0008 196#define ENCTYPE_DES_HMAC_SHA1 0x0008
113#define ENCTYPE_DES3_CBC_SHA1 0x0010 197#define ENCTYPE_DES3_CBC_SHA1 0x0010
198#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011
199#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012
200#define ENCTYPE_ARCFOUR_HMAC 0x0017
201#define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018
114#define ENCTYPE_UNKNOWN 0x01ff 202#define ENCTYPE_UNKNOWN 0x01ff
115 203
116s32 204/*
117make_checksum(char *, char *header, int hdrlen, struct xdr_buf *body, 205 * Constants used for key derivation
118 int body_offset, struct xdr_netobj *cksum); 206 */
207/* for 3DES */
208#define KG_USAGE_SEAL (22)
209#define KG_USAGE_SIGN (23)
210#define KG_USAGE_SEQ (24)
211
212/* from rfc3961 */
213#define KEY_USAGE_SEED_CHECKSUM (0x99)
214#define KEY_USAGE_SEED_ENCRYPTION (0xAA)
215#define KEY_USAGE_SEED_INTEGRITY (0x55)
216
217/* from rfc4121 */
218#define KG_USAGE_ACCEPTOR_SEAL (22)
219#define KG_USAGE_ACCEPTOR_SIGN (23)
220#define KG_USAGE_INITIATOR_SEAL (24)
221#define KG_USAGE_INITIATOR_SIGN (25)
222
223/*
224 * This compile-time check verifies that we will not exceed the
225 * slack space allotted by the client and server auth_gss code
226 * before they call gss_wrap().
227 */
228#define GSS_KRB5_MAX_SLACK_NEEDED \
229 (GSS_KRB5_TOK_HDR_LEN /* gss token header */ \
230 + GSS_KRB5_MAX_CKSUM_LEN /* gss token checksum */ \
231 + GSS_KRB5_MAX_BLOCKSIZE /* confounder */ \
232 + GSS_KRB5_MAX_BLOCKSIZE /* possible padding */ \
233 + GSS_KRB5_TOK_HDR_LEN /* encrypted hdr in v2 token */\
234 + GSS_KRB5_MAX_CKSUM_LEN /* encryption hmac */ \
235 + 4 + 4 /* RPC verifier */ \
236 + GSS_KRB5_TOK_HDR_LEN \
237 + GSS_KRB5_MAX_CKSUM_LEN)
238
239u32
240make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
241 struct xdr_buf *body, int body_offset, u8 *cksumkey,
242 unsigned int usage, struct xdr_netobj *cksumout);
243
244u32
245make_checksum_v2(struct krb5_ctx *, char *header, int hdrlen,
246 struct xdr_buf *body, int body_offset, u8 *key,
247 unsigned int usage, struct xdr_netobj *cksum);
119 248
120u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, 249u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *,
121 struct xdr_netobj *); 250 struct xdr_netobj *);
@@ -149,11 +278,54 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
149 int offset); 278 int offset);
150 279
151s32 280s32
152krb5_make_seq_num(struct crypto_blkcipher *key, 281krb5_make_seq_num(struct krb5_ctx *kctx,
282 struct crypto_blkcipher *key,
153 int direction, 283 int direction,
154 u32 seqnum, unsigned char *cksum, unsigned char *buf); 284 u32 seqnum, unsigned char *cksum, unsigned char *buf);
155 285
156s32 286s32
157krb5_get_seq_num(struct crypto_blkcipher *key, 287krb5_get_seq_num(struct krb5_ctx *kctx,
158 unsigned char *cksum, 288 unsigned char *cksum,
159 unsigned char *buf, int *direction, u32 *seqnum); 289 unsigned char *buf, int *direction, u32 *seqnum);
290
291int
292xdr_extend_head(struct xdr_buf *buf, unsigned int base, unsigned int shiftlen);
293
294u32
295krb5_derive_key(const struct gss_krb5_enctype *gk5e,
296 const struct xdr_netobj *inkey,
297 struct xdr_netobj *outkey,
298 const struct xdr_netobj *in_constant,
299 gfp_t gfp_mask);
300
301u32
302gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e,
303 struct xdr_netobj *randombits,
304 struct xdr_netobj *key);
305
306u32
307gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
308 struct xdr_netobj *randombits,
309 struct xdr_netobj *key);
310
311u32
312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
313 struct xdr_buf *buf, int ec,
314 struct page **pages);
315
316u32
317gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset,
318 struct xdr_buf *buf, u32 *plainoffset,
319 u32 *plainlen);
320
321int
322krb5_rc4_setup_seq_key(struct krb5_ctx *kctx,
323 struct crypto_blkcipher *cipher,
324 unsigned char *cksum);
325
326int
327krb5_rc4_setup_enc_key(struct krb5_ctx *kctx,
328 struct crypto_blkcipher *cipher,
329 s32 seqnum);
330void
331gss_krb5_make_confounder(char *p, u32 conflen);
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 77f78e56c481..b6edbc0ea83d 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -26,6 +26,7 @@
26#define _LINUX_SUNRPC_METRICS_H 26#define _LINUX_SUNRPC_METRICS_H
27 27
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/ktime.h>
29 30
30#define RPC_IOSTATS_VERS "1.0" 31#define RPC_IOSTATS_VERS "1.0"
31 32
@@ -58,9 +59,9 @@ struct rpc_iostats {
58 * and the total time the request spent from init to release 59 * and the total time the request spent from init to release
59 * are measured. 60 * are measured.
60 */ 61 */
61 unsigned long long om_queue, /* jiffies queued for xmit */ 62 ktime_t om_queue, /* queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */ 63 om_rtt, /* RPC RTT */
63 om_execute; /* jiffies for RPC execution */ 64 om_execute; /* RPC execution */
64} ____cacheline_aligned; 65} ____cacheline_aligned;
65 66
66struct rpc_task; 67struct rpc_task;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 7bc7fd5291ce..7be4f3a6d246 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -10,6 +10,7 @@
10#define _LINUX_SUNRPC_SCHED_H_ 10#define _LINUX_SUNRPC_SCHED_H_
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/ktime.h>
13#include <linux/sunrpc/types.h> 14#include <linux/sunrpc/types.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/wait.h> 16#include <linux/wait.h>
@@ -40,21 +41,15 @@ struct rpc_wait {
40 * This is the RPC task struct 41 * This is the RPC task struct
41 */ 42 */
42struct rpc_task { 43struct rpc_task {
43#ifdef RPC_DEBUG
44 unsigned long tk_magic; /* 0xf00baa */
45#endif
46 atomic_t tk_count; /* Reference count */ 44 atomic_t tk_count; /* Reference count */
47 struct list_head tk_task; /* global list of tasks */ 45 struct list_head tk_task; /* global list of tasks */
48 struct rpc_clnt * tk_client; /* RPC client */ 46 struct rpc_clnt * tk_client; /* RPC client */
49 struct rpc_rqst * tk_rqstp; /* RPC request */ 47 struct rpc_rqst * tk_rqstp; /* RPC request */
50 int tk_status; /* result of last operation */
51 48
52 /* 49 /*
53 * RPC call state 50 * RPC call state
54 */ 51 */
55 struct rpc_message tk_msg; /* RPC call info */ 52 struct rpc_message tk_msg; /* RPC call info */
56 __u8 tk_garb_retry;
57 __u8 tk_cred_retry;
58 53
59 /* 54 /*
60 * callback to be executed after waking up 55 * callback to be executed after waking up
@@ -67,7 +62,6 @@ struct rpc_task {
67 void * tk_calldata; 62 void * tk_calldata;
68 63
69 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 64 unsigned long tk_timeout; /* timeout for rpc_sleep() */
70 unsigned short tk_flags; /* misc flags */
71 unsigned long tk_runstate; /* Task run status */ 65 unsigned long tk_runstate; /* Task run status */
72 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 66 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
73 * be any workqueue 67 * be any workqueue
@@ -78,17 +72,19 @@ struct rpc_task {
78 struct rpc_wait tk_wait; /* RPC wait */ 72 struct rpc_wait tk_wait; /* RPC wait */
79 } u; 73 } u;
80 74
81 unsigned short tk_timeouts; /* maj timeouts */ 75 ktime_t tk_start; /* RPC task init timestamp */
82 size_t tk_bytes_sent; /* total bytes sent */
83 unsigned long tk_start; /* RPC task init timestamp */
84 long tk_rtt; /* round-trip time (jiffies) */
85 76
86 pid_t tk_owner; /* Process id for batching tasks */ 77 pid_t tk_owner; /* Process id for batching tasks */
87 unsigned char tk_priority : 2;/* Task priority */ 78 int tk_status; /* result of last operation */
79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */
88 81
89#ifdef RPC_DEBUG 82#ifdef RPC_DEBUG
90 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
91#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */
86 tk_garb_retry : 2,
87 tk_cred_retry : 2;
92}; 88};
93#define tk_xprt tk_client->cl_xprt 89#define tk_xprt tk_client->cl_xprt
94 90
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index f5cc0898bc53..35cf2e8cd7c6 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -1,7 +1,10 @@
1/* 1/*
2 * include/linux/sunrpc/xdr.h 2 * XDR standard data types and function declarations
3 * 3 *
4 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
5 *
6 * Based on:
7 * RFC 4506 "XDR: External Data Representation Standard", May 2006
5 */ 8 */
6 9
7#ifndef _SUNRPC_XDR_H_ 10#ifndef _SUNRPC_XDR_H_
@@ -62,7 +65,6 @@ struct xdr_buf {
62 65
63 unsigned int buflen, /* Total length of storage buffer */ 66 unsigned int buflen, /* Total length of storage buffer */
64 len; /* Length of XDR encoded message */ 67 len; /* Length of XDR encoded message */
65
66}; 68};
67 69
68/* 70/*
@@ -178,7 +180,7 @@ struct xdr_array2_desc {
178}; 180};
179 181
180extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, 182extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
181 struct xdr_array2_desc *desc); 183 struct xdr_array2_desc *desc);
182extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, 184extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
183 struct xdr_array2_desc *desc); 185 struct xdr_array2_desc *desc);
184 186
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6f9457a75b8f..b51470302399 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -13,6 +13,7 @@
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h> 15#include <linux/kref.h>
16#include <linux/ktime.h>
16#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
17#include <linux/sunrpc/xdr.h> 18#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/msg_prot.h> 19#include <linux/sunrpc/msg_prot.h>
@@ -65,8 +66,6 @@ struct rpc_rqst {
65 struct rpc_task * rq_task; /* RPC task data */ 66 struct rpc_task * rq_task; /* RPC task data */
66 __be32 rq_xid; /* request XID */ 67 __be32 rq_xid; /* request XID */
67 int rq_cong; /* has incremented xprt->cong */ 68 int rq_cong; /* has incremented xprt->cong */
68 int rq_reply_bytes_recvd; /* number of reply */
69 /* bytes received */
70 u32 rq_seqno; /* gss seq no. used on req. */ 69 u32 rq_seqno; /* gss seq no. used on req. */
71 int rq_enc_pages_num; 70 int rq_enc_pages_num;
72 struct page **rq_enc_pages; /* scratch pages for use by 71 struct page **rq_enc_pages; /* scratch pages for use by
@@ -77,12 +76,16 @@ struct rpc_rqst {
77 __u32 * rq_buffer; /* XDR encode buffer */ 76 __u32 * rq_buffer; /* XDR encode buffer */
78 size_t rq_callsize, 77 size_t rq_callsize,
79 rq_rcvsize; 78 rq_rcvsize;
79 size_t rq_xmit_bytes_sent; /* total bytes sent */
80 size_t rq_reply_bytes_recvd; /* total reply bytes */
81 /* received */
80 82
81 struct xdr_buf rq_private_buf; /* The receive buffer 83 struct xdr_buf rq_private_buf; /* The receive buffer
82 * used in the softirq. 84 * used in the softirq.
83 */ 85 */
84 unsigned long rq_majortimeo; /* major timeout alarm */ 86 unsigned long rq_majortimeo; /* major timeout alarm */
85 unsigned long rq_timeout; /* Current timeout value */ 87 unsigned long rq_timeout; /* Current timeout value */
88 ktime_t rq_rtt; /* round-trip time */
86 unsigned int rq_retries; /* # of retries */ 89 unsigned int rq_retries; /* # of retries */
87 unsigned int rq_connect_cookie; 90 unsigned int rq_connect_cookie;
88 /* A cookie used to track the 91 /* A cookie used to track the
@@ -94,7 +97,7 @@ struct rpc_rqst {
94 */ 97 */
95 u32 rq_bytes_sent; /* Bytes we have sent */ 98 u32 rq_bytes_sent; /* Bytes we have sent */
96 99
97 unsigned long rq_xtime; /* when transmitted */ 100 ktime_t rq_xtime; /* transmit time stamp */
98 int rq_ntrans; 101 int rq_ntrans;
99 102
100#if defined(CONFIG_NFS_V4_1) 103#if defined(CONFIG_NFS_V4_1)
@@ -174,8 +177,7 @@ struct rpc_xprt {
174 /* 177 /*
175 * Connection of transports 178 * Connection of transports
176 */ 179 */
177 unsigned long connect_timeout, 180 unsigned long bind_timeout,
178 bind_timeout,
179 reestablish_timeout; 181 reestablish_timeout;
180 unsigned int connect_cookie; /* A cookie that gets bumped 182 unsigned int connect_cookie; /* A cookie that gets bumped
181 every time the transport 183 every time the transport
@@ -294,7 +296,6 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
294void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 296void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
295void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); 297void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
296void xprt_write_space(struct rpc_xprt *xprt); 298void xprt_write_space(struct rpc_xprt *xprt);
297void xprt_update_rtt(struct rpc_task *task);
298void xprt_adjust_cwnd(struct rpc_task *task, int result); 299void xprt_adjust_cwnd(struct rpc_task *task, int result);
299struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 300struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
300void xprt_complete_rqst(struct rpc_task *task, int copied); 301void xprt_complete_rqst(struct rpc_task *task, int copied);
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 5e781d824e6d..bc7d6bb4cd8e 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -256,22 +256,22 @@ static inline int hibernate(void) { return -ENOSYS; }
256static inline bool system_entering_hibernation(void) { return false; } 256static inline bool system_entering_hibernation(void) { return false; }
257#endif /* CONFIG_HIBERNATION */ 257#endif /* CONFIG_HIBERNATION */
258 258
259#ifdef CONFIG_HIBERNATION_NVS 259#ifdef CONFIG_SUSPEND_NVS
260extern int hibernate_nvs_register(unsigned long start, unsigned long size); 260extern int suspend_nvs_register(unsigned long start, unsigned long size);
261extern int hibernate_nvs_alloc(void); 261extern int suspend_nvs_alloc(void);
262extern void hibernate_nvs_free(void); 262extern void suspend_nvs_free(void);
263extern void hibernate_nvs_save(void); 263extern void suspend_nvs_save(void);
264extern void hibernate_nvs_restore(void); 264extern void suspend_nvs_restore(void);
265#else /* CONFIG_HIBERNATION_NVS */ 265#else /* CONFIG_SUSPEND_NVS */
266static inline int hibernate_nvs_register(unsigned long a, unsigned long b) 266static inline int suspend_nvs_register(unsigned long a, unsigned long b)
267{ 267{
268 return 0; 268 return 0;
269} 269}
270static inline int hibernate_nvs_alloc(void) { return 0; } 270static inline int suspend_nvs_alloc(void) { return 0; }
271static inline void hibernate_nvs_free(void) {} 271static inline void suspend_nvs_free(void) {}
272static inline void hibernate_nvs_save(void) {} 272static inline void suspend_nvs_save(void) {}
273static inline void hibernate_nvs_restore(void) {} 273static inline void suspend_nvs_restore(void) {}
274#endif /* CONFIG_HIBERNATION_NVS */ 274#endif /* CONFIG_SUSPEND_NVS */
275 275
276#ifdef CONFIG_PM_SLEEP 276#ifdef CONFIG_PM_SLEEP
277void save_processor_state(void); 277void save_processor_state(void);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a2602a8207a6..ff4acea9bbdb 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -146,11 +146,13 @@ enum {
146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ 146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ 147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ 148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */
149 SWP_BLKDEV = (1 << 6), /* its a block device */
149 /* add others here before... */ 150 /* add others here before... */
150 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 151 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
151}; 152};
152 153
153#define SWAP_CLUSTER_MAX 32 154#define SWAP_CLUSTER_MAX 32
155#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
154 156
155#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ 157#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
156#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ 158#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
@@ -223,20 +225,15 @@ static inline void lru_cache_add_anon(struct page *page)
223 __lru_cache_add(page, LRU_INACTIVE_ANON); 225 __lru_cache_add(page, LRU_INACTIVE_ANON);
224} 226}
225 227
226static inline void lru_cache_add_active_anon(struct page *page)
227{
228 __lru_cache_add(page, LRU_ACTIVE_ANON);
229}
230
231static inline void lru_cache_add_file(struct page *page) 228static inline void lru_cache_add_file(struct page *page)
232{ 229{
233 __lru_cache_add(page, LRU_INACTIVE_FILE); 230 __lru_cache_add(page, LRU_INACTIVE_FILE);
234} 231}
235 232
236static inline void lru_cache_add_active_file(struct page *page) 233/* LRU Isolation modes. */
237{ 234#define ISOLATE_INACTIVE 0 /* Isolate inactive pages. */
238 __lru_cache_add(page, LRU_ACTIVE_FILE); 235#define ISOLATE_ACTIVE 1 /* Isolate active pages. */
239} 236#define ISOLATE_BOTH 2 /* Isolate both active and inactive pages. */
240 237
241/* linux/mm/vmscan.c */ 238/* linux/mm/vmscan.c */
242extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 239extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
@@ -285,6 +282,11 @@ extern void kswapd_stop(int nid);
285extern int shmem_unuse(swp_entry_t entry, struct page *page); 282extern int shmem_unuse(swp_entry_t entry, struct page *page);
286#endif /* CONFIG_MMU */ 283#endif /* CONFIG_MMU */
287 284
285#ifdef CONFIG_CGROUP_MEM_RES_CTLR
286extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
287 struct page **pagep, swp_entry_t *ent);
288#endif
289
288extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); 290extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
289 291
290#ifdef CONFIG_SWAP 292#ifdef CONFIG_SWAP
@@ -355,6 +357,7 @@ static inline void disable_swap_token(void)
355#ifdef CONFIG_CGROUP_MEM_RES_CTLR 357#ifdef CONFIG_CGROUP_MEM_RES_CTLR
356extern void 358extern void
357mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout); 359mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
360extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
358#else 361#else
359static inline void 362static inline void
360mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) 363mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
@@ -485,6 +488,14 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
485{ 488{
486} 489}
487 490
491#ifdef CONFIG_CGROUP_MEM_RES_CTLR
492static inline int
493mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep)
494{
495 return 0;
496}
497#endif
498
488#endif /* CONFIG_SWAP */ 499#endif /* CONFIG_SWAP */
489#endif /* __KERNEL__*/ 500#endif /* __KERNEL__*/
490#endif /* _LINUX_SWAP_H */ 501#endif /* _LINUX_SWAP_H */
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index febedcf67c7e..81a4e213c6cf 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -73,16 +73,6 @@ extern void
73swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 73swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
74 int nelems, enum dma_data_direction dir); 74 int nelems, enum dma_data_direction dir);
75 75
76extern void
77swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
78 unsigned long offset, size_t size,
79 enum dma_data_direction dir);
80
81extern void
82swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
83 unsigned long offset, size_t size,
84 enum dma_data_direction dir);
85
86extern int 76extern int
87swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); 77swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
88 78
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 207466a49f3d..13ebb5413a79 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -23,6 +23,7 @@ struct kexec_segment;
23struct linux_dirent; 23struct linux_dirent;
24struct linux_dirent64; 24struct linux_dirent64;
25struct list_head; 25struct list_head;
26struct mmap_arg_struct;
26struct msgbuf; 27struct msgbuf;
27struct msghdr; 28struct msghdr;
28struct mmsghdr; 29struct mmsghdr;
@@ -30,10 +31,13 @@ struct msqid_ds;
30struct new_utsname; 31struct new_utsname;
31struct nfsctl_arg; 32struct nfsctl_arg;
32struct __old_kernel_stat; 33struct __old_kernel_stat;
34struct oldold_utsname;
35struct old_utsname;
33struct pollfd; 36struct pollfd;
34struct rlimit; 37struct rlimit;
35struct rusage; 38struct rusage;
36struct sched_param; 39struct sched_param;
40struct sel_arg_struct;
37struct semaphore; 41struct semaphore;
38struct sembuf; 42struct sembuf;
39struct shmid_ds; 43struct shmid_ds;
@@ -99,22 +103,6 @@ struct perf_event_attr;
99#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) 103#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
100#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 104#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
101 105
102#ifdef CONFIG_EVENT_PROFILE
103
104#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
105 .profile_enable = prof_sysenter_enable, \
106 .profile_disable = prof_sysenter_disable,
107
108#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \
109 .profile_enable = prof_sysexit_enable, \
110 .profile_disable = prof_sysexit_disable,
111#else
112#define TRACE_SYS_ENTER_PROFILE(sname)
113#define TRACE_SYS_ENTER_PROFILE_INIT(sname)
114#define TRACE_SYS_EXIT_PROFILE(sname)
115#define TRACE_SYS_EXIT_PROFILE_INIT(sname)
116#endif
117
118#ifdef CONFIG_FTRACE_SYSCALLS 106#ifdef CONFIG_FTRACE_SYSCALLS
119#define __SC_STR_ADECL1(t, a) #a 107#define __SC_STR_ADECL1(t, a) #a
120#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 108#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__)
@@ -130,54 +118,45 @@ struct perf_event_attr;
130#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) 118#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
131#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) 119#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
132 120
121extern struct ftrace_event_class event_class_syscall_enter;
122extern struct ftrace_event_class event_class_syscall_exit;
123extern struct trace_event_functions enter_syscall_print_funcs;
124extern struct trace_event_functions exit_syscall_print_funcs;
125
133#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 126#define SYSCALL_TRACE_ENTER_EVENT(sname) \
134 static const struct syscall_metadata __syscall_meta_##sname; \ 127 static struct syscall_metadata \
135 static struct ftrace_event_call event_enter_##sname; \ 128 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
136 static struct trace_event enter_syscall_print_##sname = { \ 129 static struct ftrace_event_call \
137 .trace = print_syscall_enter, \ 130 __attribute__((__aligned__(4))) event_enter_##sname; \
138 }; \
139 static struct ftrace_event_call __used \ 131 static struct ftrace_event_call __used \
140 __attribute__((__aligned__(4))) \ 132 __attribute__((__aligned__(4))) \
141 __attribute__((section("_ftrace_events"))) \ 133 __attribute__((section("_ftrace_events"))) \
142 event_enter_##sname = { \ 134 event_enter_##sname = { \
143 .name = "sys_enter"#sname, \ 135 .name = "sys_enter"#sname, \
144 .system = "syscalls", \ 136 .class = &event_class_syscall_enter, \
145 .event = &enter_syscall_print_##sname, \ 137 .event.funcs = &enter_syscall_print_funcs, \
146 .raw_init = trace_event_raw_init, \
147 .show_format = syscall_enter_format, \
148 .define_fields = syscall_enter_define_fields, \
149 .regfunc = reg_event_syscall_enter, \
150 .unregfunc = unreg_event_syscall_enter, \
151 .data = (void *)&__syscall_meta_##sname,\ 138 .data = (void *)&__syscall_meta_##sname,\
152 TRACE_SYS_ENTER_PROFILE_INIT(sname) \
153 } 139 }
154 140
155#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 141#define SYSCALL_TRACE_EXIT_EVENT(sname) \
156 static const struct syscall_metadata __syscall_meta_##sname; \ 142 static struct syscall_metadata \
157 static struct ftrace_event_call event_exit_##sname; \ 143 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
158 static struct trace_event exit_syscall_print_##sname = { \ 144 static struct ftrace_event_call \
159 .trace = print_syscall_exit, \ 145 __attribute__((__aligned__(4))) event_exit_##sname; \
160 }; \
161 static struct ftrace_event_call __used \ 146 static struct ftrace_event_call __used \
162 __attribute__((__aligned__(4))) \ 147 __attribute__((__aligned__(4))) \
163 __attribute__((section("_ftrace_events"))) \ 148 __attribute__((section("_ftrace_events"))) \
164 event_exit_##sname = { \ 149 event_exit_##sname = { \
165 .name = "sys_exit"#sname, \ 150 .name = "sys_exit"#sname, \
166 .system = "syscalls", \ 151 .class = &event_class_syscall_exit, \
167 .event = &exit_syscall_print_##sname, \ 152 .event.funcs = &exit_syscall_print_funcs, \
168 .raw_init = trace_event_raw_init, \
169 .show_format = syscall_exit_format, \
170 .define_fields = syscall_exit_define_fields, \
171 .regfunc = reg_event_syscall_exit, \
172 .unregfunc = unreg_event_syscall_exit, \
173 .data = (void *)&__syscall_meta_##sname,\ 153 .data = (void *)&__syscall_meta_##sname,\
174 TRACE_SYS_EXIT_PROFILE_INIT(sname) \
175 } 154 }
176 155
177#define SYSCALL_METADATA(sname, nb) \ 156#define SYSCALL_METADATA(sname, nb) \
178 SYSCALL_TRACE_ENTER_EVENT(sname); \ 157 SYSCALL_TRACE_ENTER_EVENT(sname); \
179 SYSCALL_TRACE_EXIT_EVENT(sname); \ 158 SYSCALL_TRACE_EXIT_EVENT(sname); \
180 static const struct syscall_metadata __used \ 159 static struct syscall_metadata __used \
181 __attribute__((__aligned__(4))) \ 160 __attribute__((__aligned__(4))) \
182 __attribute__((section("__syscalls_metadata"))) \ 161 __attribute__((section("__syscalls_metadata"))) \
183 __syscall_meta_##sname = { \ 162 __syscall_meta_##sname = { \
@@ -187,12 +166,14 @@ struct perf_event_attr;
187 .args = args_##sname, \ 166 .args = args_##sname, \
188 .enter_event = &event_enter_##sname, \ 167 .enter_event = &event_enter_##sname, \
189 .exit_event = &event_exit_##sname, \ 168 .exit_event = &event_exit_##sname, \
169 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
170 .exit_fields = LIST_HEAD_INIT(__syscall_meta_##sname.exit_fields), \
190 }; 171 };
191 172
192#define SYSCALL_DEFINE0(sname) \ 173#define SYSCALL_DEFINE0(sname) \
193 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 174 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
194 SYSCALL_TRACE_EXIT_EVENT(_##sname); \ 175 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
195 static const struct syscall_metadata __used \ 176 static struct syscall_metadata __used \
196 __attribute__((__aligned__(4))) \ 177 __attribute__((__aligned__(4))) \
197 __attribute__((section("__syscalls_metadata"))) \ 178 __attribute__((section("__syscalls_metadata"))) \
198 __syscall_meta__##sname = { \ 179 __syscall_meta__##sname = { \
@@ -200,6 +181,8 @@ struct perf_event_attr;
200 .nb_args = 0, \ 181 .nb_args = 0, \
201 .enter_event = &event_enter__##sname, \ 182 .enter_event = &event_enter__##sname, \
202 .exit_event = &event_exit__##sname, \ 183 .exit_event = &event_exit__##sname, \
184 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
185 .exit_fields = LIST_HEAD_INIT(__syscall_meta__##sname.exit_fields), \
203 }; \ 186 }; \
204 asmlinkage long sys_##sname(void) 187 asmlinkage long sys_##sname(void)
205#else 188#else
@@ -308,7 +291,7 @@ asmlinkage long sys_capget(cap_user_header_t header,
308 cap_user_data_t dataptr); 291 cap_user_data_t dataptr);
309asmlinkage long sys_capset(cap_user_header_t header, 292asmlinkage long sys_capset(cap_user_header_t header,
310 const cap_user_data_t data); 293 const cap_user_data_t data);
311asmlinkage long sys_personality(u_long personality); 294asmlinkage long sys_personality(unsigned int personality);
312 295
313asmlinkage long sys_sigpending(old_sigset_t __user *set); 296asmlinkage long sys_sigpending(old_sigset_t __user *set);
314asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 297asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
@@ -638,6 +621,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
638 long timeout); 621 long timeout);
639asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 622asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
640 fd_set __user *exp, struct timeval __user *tvp); 623 fd_set __user *exp, struct timeval __user *tvp);
624asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
641asmlinkage long sys_epoll_create(int size); 625asmlinkage long sys_epoll_create(int size);
642asmlinkage long sys_epoll_create1(int flags); 626asmlinkage long sys_epoll_create1(int flags);
643asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, 627asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
@@ -652,6 +636,8 @@ asmlinkage long sys_gethostname(char __user *name, int len);
652asmlinkage long sys_sethostname(char __user *name, int len); 636asmlinkage long sys_sethostname(char __user *name, int len);
653asmlinkage long sys_setdomainname(char __user *name, int len); 637asmlinkage long sys_setdomainname(char __user *name, int len);
654asmlinkage long sys_newuname(struct new_utsname __user *name); 638asmlinkage long sys_newuname(struct new_utsname __user *name);
639asmlinkage long sys_uname(struct old_utsname __user *);
640asmlinkage long sys_olduname(struct oldold_utsname __user *);
655 641
656asmlinkage long sys_getrlimit(unsigned int resource, 642asmlinkage long sys_getrlimit(unsigned int resource,
657 struct rlimit __user *rlim); 643 struct rlimit __user *rlim);
@@ -681,6 +667,8 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
681asmlinkage long sys_shmget(key_t key, size_t size, int flag); 667asmlinkage long sys_shmget(key_t key, size_t size, int flag);
682asmlinkage long sys_shmdt(char __user *shmaddr); 668asmlinkage long sys_shmdt(char __user *shmaddr);
683asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 669asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
670asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
671 unsigned long third, void __user *ptr, long fifth);
684 672
685asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 673asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
686asmlinkage long sys_mq_unlink(const char __user *name); 674asmlinkage long sys_mq_unlink(const char __user *name);
@@ -836,4 +824,6 @@ asmlinkage long sys_perf_event_open(
836asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, 824asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
837 unsigned long prot, unsigned long flags, 825 unsigned long prot, unsigned long flags,
838 unsigned long fd, unsigned long pgoff); 826 unsigned long fd, unsigned long pgoff);
827asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
828
839#endif 829#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bd27fbc9db62..7bb5cb64f3b8 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -481,9 +481,6 @@ enum
481 NET_IPV4_CONF_PROMOTE_SECONDARIES=20, 481 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
482 NET_IPV4_CONF_ARP_ACCEPT=21, 482 NET_IPV4_CONF_ARP_ACCEPT=21,
483 NET_IPV4_CONF_ARP_NOTIFY=22, 483 NET_IPV4_CONF_ARP_NOTIFY=22,
484 NET_IPV4_CONF_ACCEPT_LOCAL=23,
485 NET_IPV4_CONF_SRC_VMARK=24,
486 __NET_IPV4_CONF_MAX
487}; 484};
488 485
489/* /proc/sys/net/ipv4/netfilter */ 486/* /proc/sys/net/ipv4/netfilter */
@@ -599,7 +596,6 @@ enum {
599 NET_NEIGH_GC_THRESH3=16, 596 NET_NEIGH_GC_THRESH3=16,
600 NET_NEIGH_RETRANS_TIME_MS=17, 597 NET_NEIGH_RETRANS_TIME_MS=17,
601 NET_NEIGH_REACHABLE_TIME_MS=18, 598 NET_NEIGH_REACHABLE_TIME_MS=18,
602 __NET_NEIGH_MAX
603}; 599};
604 600
605/* /proc/sys/net/dccp */ 601/* /proc/sys/net/dccp */
@@ -984,6 +980,8 @@ extern int proc_doulongvec_minmax(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *); 980 void __user *, size_t *, loff_t *);
985extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, 981extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
986 void __user *, size_t *, loff_t *); 982 void __user *, size_t *, loff_t *);
983extern int proc_do_large_bitmap(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *);
987 985
988/* 986/*
989 * Register a set of sysctl names by calling register_sysctl_table 987 * Register a set of sysctl names by calling register_sysctl_table
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index f395bb3fa2f2..1154c29f4101 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -27,10 +27,12 @@
27 27
28 28
29struct sys_device; 29struct sys_device;
30struct sysdev_class_attribute;
30 31
31struct sysdev_class { 32struct sysdev_class {
32 const char *name; 33 const char *name;
33 struct list_head drivers; 34 struct list_head drivers;
35 struct sysdev_class_attribute **attrs;
34 36
35 /* Default operations for these types of devices */ 37 /* Default operations for these types of devices */
36 int (*shutdown)(struct sys_device *); 38 int (*shutdown)(struct sys_device *);
@@ -41,8 +43,10 @@ struct sysdev_class {
41 43
42struct sysdev_class_attribute { 44struct sysdev_class_attribute {
43 struct attribute attr; 45 struct attribute attr;
44 ssize_t (*show)(struct sysdev_class *, char *); 46 ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *,
45 ssize_t (*store)(struct sysdev_class *, const char *, size_t); 47 char *);
48 ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *,
49 const char *, size_t);
46}; 50};
47 51
48#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ 52#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
@@ -119,6 +123,19 @@ struct sysdev_attribute {
119extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); 123extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
120extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); 124extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
121 125
126/* Create/remove NULL terminated attribute list */
127static inline int
128sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a)
129{
130 return sysfs_create_files(&d->kobj, (const struct attribute **)a);
131}
132
133static inline void
134sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a)
135{
136 return sysfs_remove_files(&d->kobj, (const struct attribute **)a);
137}
138
122struct sysdev_ext_attribute { 139struct sysdev_ext_attribute {
123 struct sysdev_attribute attr; 140 struct sysdev_attribute attr;
124 void *var; 141 void *var;
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index cfa83083a2d4..f2694eb4dd3d 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -15,10 +15,12 @@
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
20struct kobject; 21struct kobject;
21struct module; 22struct module;
23enum kobj_ns_type;
22 24
23/* FIXME 25/* FIXME
24 * The *owner field is no longer used. 26 * The *owner field is no longer used.
@@ -29,8 +31,33 @@ struct attribute {
29 const char *name; 31 const char *name;
30 struct module *owner; 32 struct module *owner;
31 mode_t mode; 33 mode_t mode;
34#ifdef CONFIG_DEBUG_LOCK_ALLOC
35 struct lock_class_key *key;
36 struct lock_class_key skey;
37#endif
32}; 38};
33 39
40/**
41 * sysfs_attr_init - initialize a dynamically allocated sysfs attribute
42 * @attr: struct attribute to initialize
43 *
44 * Initialize a dynamically allocated struct attribute so we can
45 * make lockdep happy. This is a new requirement for attributes
46 * and initially this is only needed when lockdep is enabled.
47 * Lockdep gives a nice error when your attribute is added to
48 * sysfs if you don't have this.
49 */
50#ifdef CONFIG_DEBUG_LOCK_ALLOC
51#define sysfs_attr_init(attr) \
52do { \
53 static struct lock_class_key __key; \
54 \
55 (attr)->key = &__key; \
56} while(0)
57#else
58#define sysfs_attr_init(attr) do {} while(0)
59#endif
60
34struct attribute_group { 61struct attribute_group {
35 const char *name; 62 const char *name;
36 mode_t (*is_visible)(struct kobject *, 63 mode_t (*is_visible)(struct kobject *,
@@ -60,20 +87,33 @@ struct attribute_group {
60 87
61#define attr_name(_attr) (_attr).attr.name 88#define attr_name(_attr) (_attr).attr.name
62 89
90struct file;
63struct vm_area_struct; 91struct vm_area_struct;
64 92
65struct bin_attribute { 93struct bin_attribute {
66 struct attribute attr; 94 struct attribute attr;
67 size_t size; 95 size_t size;
68 void *private; 96 void *private;
69 ssize_t (*read)(struct kobject *, struct bin_attribute *, 97 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
70 char *, loff_t, size_t); 98 char *, loff_t, size_t);
71 ssize_t (*write)(struct kobject *, struct bin_attribute *, 99 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *,
72 char *, loff_t, size_t); 100 char *, loff_t, size_t);
73 int (*mmap)(struct kobject *, struct bin_attribute *attr, 101 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
74 struct vm_area_struct *vma); 102 struct vm_area_struct *vma);
75}; 103};
76 104
105/**
106 * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
107 * @attr: struct bin_attribute to initialize
108 *
109 * Initialize a dynamically allocated struct bin_attribute so we
110 * can make lockdep happy. This is a new requirement for
111 * attributes and initially this is only needed when lockdep is
112 * enabled. Lockdep gives a nice error when your attribute is
113 * added to sysfs if you don't have this.
114 */
115#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
116
77struct sysfs_ops { 117struct sysfs_ops {
78 ssize_t (*show)(struct kobject *, struct attribute *,char *); 118 ssize_t (*show)(struct kobject *, struct attribute *,char *);
79 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 119 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
@@ -94,9 +134,12 @@ int __must_check sysfs_move_dir(struct kobject *kobj,
94 134
95int __must_check sysfs_create_file(struct kobject *kobj, 135int __must_check sysfs_create_file(struct kobject *kobj,
96 const struct attribute *attr); 136 const struct attribute *attr);
137int __must_check sysfs_create_files(struct kobject *kobj,
138 const struct attribute **attr);
97int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 139int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
98 mode_t mode); 140 mode_t mode);
99void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 141void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
142void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
100 143
101int __must_check sysfs_create_bin_file(struct kobject *kobj, 144int __must_check sysfs_create_bin_file(struct kobject *kobj,
102 const struct bin_attribute *attr); 145 const struct bin_attribute *attr);
@@ -110,6 +153,12 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
110 const char *name); 153 const char *name);
111void sysfs_remove_link(struct kobject *kobj, const char *name); 154void sysfs_remove_link(struct kobject *kobj, const char *name);
112 155
156int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
157 const char *old_name, const char *new_name);
158
159void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
160 const char *name);
161
113int __must_check sysfs_create_group(struct kobject *kobj, 162int __must_check sysfs_create_group(struct kobject *kobj,
114 const struct attribute_group *grp); 163 const struct attribute_group *grp);
115int sysfs_update_group(struct kobject *kobj, 164int sysfs_update_group(struct kobject *kobj,
@@ -124,10 +173,15 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
124void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 173void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
125void sysfs_notify_dirent(struct sysfs_dirent *sd); 174void sysfs_notify_dirent(struct sysfs_dirent *sd);
126struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 175struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
176 const void *ns,
127 const unsigned char *name); 177 const unsigned char *name);
128struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 178struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
129void sysfs_put(struct sysfs_dirent *sd); 179void sysfs_put(struct sysfs_dirent *sd);
130void sysfs_printk_last_file(void); 180void sysfs_printk_last_file(void);
181
182/* Called to clear a ns tag when it is no longer valid */
183void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
184
131int __must_check sysfs_init(void); 185int __must_check sysfs_init(void);
132 186
133#else /* CONFIG_SYSFS */ 187#else /* CONFIG_SYSFS */
@@ -164,6 +218,12 @@ static inline int sysfs_create_file(struct kobject *kobj,
164 return 0; 218 return 0;
165} 219}
166 220
221static inline int sysfs_create_files(struct kobject *kobj,
222 const struct attribute **attr)
223{
224 return 0;
225}
226
167static inline int sysfs_chmod_file(struct kobject *kobj, 227static inline int sysfs_chmod_file(struct kobject *kobj,
168 struct attribute *attr, mode_t mode) 228 struct attribute *attr, mode_t mode)
169{ 229{
@@ -175,6 +235,11 @@ static inline void sysfs_remove_file(struct kobject *kobj,
175{ 235{
176} 236}
177 237
238static inline void sysfs_remove_files(struct kobject *kobj,
239 const struct attribute **attr)
240{
241}
242
178static inline int sysfs_create_bin_file(struct kobject *kobj, 243static inline int sysfs_create_bin_file(struct kobject *kobj,
179 const struct bin_attribute *attr) 244 const struct bin_attribute *attr)
180{ 245{
@@ -203,6 +268,17 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
203{ 268{
204} 269}
205 270
271static inline int sysfs_rename_link(struct kobject *k, struct kobject *t,
272 const char *old_name, const char *new_name)
273{
274 return 0;
275}
276
277static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
278 const char *name)
279{
280}
281
206static inline int sysfs_create_group(struct kobject *kobj, 282static inline int sysfs_create_group(struct kobject *kobj,
207 const struct attribute_group *grp) 283 const struct attribute_group *grp)
208{ 284{
@@ -240,6 +316,7 @@ static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
240} 316}
241static inline 317static inline
242struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 318struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
319 const void *ns,
243 const unsigned char *name) 320 const unsigned char *name)
244{ 321{
245 return NULL; 322 return NULL;
@@ -252,6 +329,10 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
252{ 329{
253} 330}
254 331
332static inline void sysfs_exit_ns(int type, const void *tag)
333{
334}
335
255static inline int __must_check sysfs_init(void) 336static inline int __must_check sysfs_init(void)
256{ 337{
257 return 0; 338 return 0;
diff --git a/include/linux/syslog.h b/include/linux/syslog.h
new file mode 100644
index 000000000000..38911391a139
--- /dev/null
+++ b/include/linux/syslog.h
@@ -0,0 +1,52 @@
1/* Syslog internals
2 *
3 * Copyright 2010 Canonical, Ltd.
4 * Author: Kees Cook <kees.cook@canonical.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _LINUX_SYSLOG_H
22#define _LINUX_SYSLOG_H
23
24/* Close the log. Currently a NOP. */
25#define SYSLOG_ACTION_CLOSE 0
26/* Open the log. Currently a NOP. */
27#define SYSLOG_ACTION_OPEN 1
28/* Read from the log. */
29#define SYSLOG_ACTION_READ 2
30/* Read all messages remaining in the ring buffer. */
31#define SYSLOG_ACTION_READ_ALL 3
32/* Read and clear all messages remaining in the ring buffer */
33#define SYSLOG_ACTION_READ_CLEAR 4
34/* Clear ring buffer. */
35#define SYSLOG_ACTION_CLEAR 5
36/* Disable printk's to console */
37#define SYSLOG_ACTION_CONSOLE_OFF 6
38/* Enable printk's to console */
39#define SYSLOG_ACTION_CONSOLE_ON 7
40/* Set level of messages printed to console */
41#define SYSLOG_ACTION_CONSOLE_LEVEL 8
42/* Return number of unread characters in the log buffer */
43#define SYSLOG_ACTION_SIZE_UNREAD 9
44/* Return size of the log buffer */
45#define SYSLOG_ACTION_SIZE_BUFFER 10
46
47#define SYSLOG_FROM_CALL 0
48#define SYSLOG_FROM_FILE 1
49
50int do_syslog(int type, char __user *buf, int count, bool from_file);
51
52#endif /* _LINUX_SYSLOG_H */
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 99adcdc0d3ca..609e8ca5f534 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -39,13 +39,6 @@ struct sysrq_key_op {
39 39
40#ifdef CONFIG_MAGIC_SYSRQ 40#ifdef CONFIG_MAGIC_SYSRQ
41 41
42extern int sysrq_on(void);
43
44/*
45 * Do not use this one directly:
46 */
47extern int __sysrq_enabled;
48
49/* Generic SysRq interface -- you may call it from any device driver, supplying 42/* Generic SysRq interface -- you may call it from any device driver, supplying
50 * ASCII code of the key, pointer to registers and kbd/tty structs (if they 43 * ASCII code of the key, pointer to registers and kbd/tty structs (if they
51 * are available -- else NULL's). 44 * are available -- else NULL's).
@@ -57,23 +50,24 @@ int register_sysrq_key(int key, struct sysrq_key_op *op);
57int unregister_sysrq_key(int key, struct sysrq_key_op *op); 50int unregister_sysrq_key(int key, struct sysrq_key_op *op);
58struct sysrq_key_op *__sysrq_get_key_op(int key); 51struct sysrq_key_op *__sysrq_get_key_op(int key);
59 52
53int sysrq_toggle_support(int enable_mask);
54
60#else 55#else
61 56
62static inline int sysrq_on(void) 57static inline void handle_sysrq(int key, struct tty_struct *tty)
63{ 58{
64 return 0;
65} 59}
66static inline int __reterr(void) 60
61static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
67{ 62{
68 return -EINVAL; 63 return -EINVAL;
69} 64}
70static inline void handle_sysrq(int key, struct tty_struct *tty) 65
66static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
71{ 67{
68 return -EINVAL;
72} 69}
73 70
74#define register_sysrq_key(ig,nore) __reterr()
75#define unregister_sysrq_key(ig,nore) __reterr()
76
77#endif 71#endif
78 72
79#endif /* _LINUX_SYSRQ_H */ 73#endif /* _LINUX_SYSRQ_H */
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 3398f4553269..58de6edf751f 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -9,16 +9,12 @@
9 9
10#include <linux/taskstats.h> 10#include <linux/taskstats.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/slab.h>
12 13
13#ifdef CONFIG_TASKSTATS 14#ifdef CONFIG_TASKSTATS
14extern struct kmem_cache *taskstats_cache; 15extern struct kmem_cache *taskstats_cache;
15extern struct mutex taskstats_exit_mutex; 16extern struct mutex taskstats_exit_mutex;
16 17
17static inline void taskstats_tgid_init(struct signal_struct *sig)
18{
19 sig->stats = NULL;
20}
21
22static inline void taskstats_tgid_free(struct signal_struct *sig) 18static inline void taskstats_tgid_free(struct signal_struct *sig)
23{ 19{
24 if (sig->stats) 20 if (sig->stats)
@@ -30,8 +26,6 @@ extern void taskstats_init_early(void);
30#else 26#else
31static inline void taskstats_exit(struct task_struct *tsk, int group_dead) 27static inline void taskstats_exit(struct task_struct *tsk, int group_dead)
32{} 28{}
33static inline void taskstats_tgid_init(struct signal_struct *sig)
34{}
35static inline void taskstats_tgid_free(struct signal_struct *sig) 29static inline void taskstats_tgid_free(struct signal_struct *sig)
36{} 30{}
37static inline void taskstats_init_early(void) 31static inline void taskstats_init_early(void)
diff --git a/include/linux/tboot.h b/include/linux/tboot.h
index bf2a0c748878..1dba6ee55203 100644
--- a/include/linux/tboot.h
+++ b/include/linux/tboot.h
@@ -150,6 +150,7 @@ extern int tboot_force_iommu(void);
150 150
151#else 151#else
152 152
153#define tboot_enabled() 0
153#define tboot_probe() do { } while (0) 154#define tboot_probe() do { } while (0)
154#define tboot_shutdown(shutdown_type) do { } while (0) 155#define tboot_shutdown(shutdown_type) do { } while (0)
155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \ 156#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
diff --git a/include/linux/tca6416_keypad.h b/include/linux/tca6416_keypad.h
new file mode 100644
index 000000000000..7bd266f3525c
--- /dev/null
+++ b/include/linux/tca6416_keypad.h
@@ -0,0 +1,34 @@
1/*
2 * tca6416 keypad platform support
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * Author: Sriramakrishnan <srk@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _TCA6416_KEYS_H
14#define _TCA6416_KEYS_H
15
16#include <linux/types.h>
17
18struct tca6416_button {
19 /* Configuration parameters */
20 int code; /* input event code (KEY_*, SW_*) */
21 int active_low;
22 int type; /* input event type (EV_KEY, EV_SW) */
23};
24
25struct tca6416_keys_platform_data {
26 struct tca6416_button *buttons;
27 int nbuttons;
28 unsigned int rep:1; /* enable input subsystem auto repeat */
29 uint16_t pinmask;
30 uint16_t invert;
31 int irq_is_gpio;
32 int use_polling; /* use polling if Interrupt is not connected*/
33};
34#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7fee8a4df931..a778ee024590 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -103,6 +103,8 @@ enum {
103#define TCP_CONGESTION 13 /* Congestion control algorithm */ 103#define TCP_CONGESTION 13 /* Congestion control algorithm */
104#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ 104#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
105#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ 105#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
106 108
107/* for TCP_INFO socket option */ 109/* for TCP_INFO socket option */
108#define TCPI_OPT_TIMESTAMPS 1 110#define TCPI_OPT_TIMESTAMPS 1
@@ -340,7 +342,10 @@ struct tcp_sock {
340 u32 frto_highmark; /* snd_nxt when RTO occurred */ 342 u32 frto_highmark; /* snd_nxt when RTO occurred */
341 u16 advmss; /* Advertised MSS */ 343 u16 advmss; /* Advertised MSS */
342 u8 frto_counter; /* Number of new acks after RTO */ 344 u8 frto_counter; /* Number of new acks after RTO */
343 u8 nonagle; /* Disable Nagle algorithm? */ 345 u8 nonagle : 4,/* Disable Nagle algorithm? */
346 thin_lto : 1,/* Use linear timeouts for thin streams */
347 thin_dupack : 1,/* Fast retransmit on first dupack */
348 unused : 2;
344 349
345/* RTT measurement */ 350/* RTT measurement */
346 u32 srtt; /* smoothed round trip time << 3 */ 351 u32 srtt; /* smoothed round trip time << 3 */
diff --git a/include/linux/threads.h b/include/linux/threads.h
index 052b12bec8bd..383ab9592bec 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -33,4 +33,13 @@
33#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ 33#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
34 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) 34 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
35 35
36/*
37 * Define a minimum number of pids per cpu. Heuristically based
38 * on original pid max of 32k for 32 cpus. Also, increase the
39 * minimum settable value for pid_max on the running system based
40 * on similar defaults. See kernel/pid.c:pidmap_init() for details.
41 */
42#define PIDS_PER_CPU_DEFAULT 1024
43#define PIDS_PER_CPU_MIN 8
44
36#endif 45#endif
diff --git a/include/linux/tick.h b/include/linux/tick.h
index d2ae79e21be3..b232ccc0ee29 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -42,6 +42,7 @@ enum tick_nohz_mode {
42 * @idle_waketime: Time when the idle was interrupted 42 * @idle_waketime: Time when the idle was interrupted
43 * @idle_exittime: Time when the idle state was left 43 * @idle_exittime: Time when the idle state was left
44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
45 * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding
45 * @sleep_length: Duration of the current idle sleep 46 * @sleep_length: Duration of the current idle sleep
46 * @do_timer_lst: CPU was the last one doing do_timer before going idle 47 * @do_timer_lst: CPU was the last one doing do_timer before going idle
47 */ 48 */
@@ -60,7 +61,7 @@ struct tick_sched {
60 ktime_t idle_waketime; 61 ktime_t idle_waketime;
61 ktime_t idle_exittime; 62 ktime_t idle_exittime;
62 ktime_t idle_sleeptime; 63 ktime_t idle_sleeptime;
63 ktime_t idle_lastupdate; 64 ktime_t iowait_sleeptime;
64 ktime_t sleep_length; 65 ktime_t sleep_length;
65 unsigned long last_jiffies; 66 unsigned long last_jiffies;
66 unsigned long next_jiffies; 67 unsigned long next_jiffies;
@@ -124,6 +125,7 @@ extern void tick_nohz_stop_sched_tick(int inidle);
124extern void tick_nohz_restart_sched_tick(void); 125extern void tick_nohz_restart_sched_tick(void);
125extern ktime_t tick_nohz_get_sleep_length(void); 126extern ktime_t tick_nohz_get_sleep_length(void);
126extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 127extern 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);
127# else 129# else
128static inline void tick_nohz_stop_sched_tick(int inidle) { } 130static inline void tick_nohz_stop_sched_tick(int inidle) { }
129static inline void tick_nohz_restart_sched_tick(void) { } 131static inline void tick_nohz_restart_sched_tick(void) { }
@@ -134,6 +136,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
134 return len; 136 return len;
135} 137}
136static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 138static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
139static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
137# endif /* !NO_HZ */ 140# endif /* !NO_HZ */
138 141
139#endif 142#endif
diff --git a/include/linux/timb_dma.h b/include/linux/timb_dma.h
new file mode 100644
index 000000000000..bb043e970b96
--- /dev/null
+++ b/include/linux/timb_dma.h
@@ -0,0 +1,55 @@
1/*
2 * timb_dma.h timberdale FPGA DMA driver defines
3 * Copyright (c) 2010 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19/* Supports:
20 * Timberdale FPGA DMA engine
21 */
22
23#ifndef _LINUX_TIMB_DMA_H
24#define _LINUX_TIMB_DMA_H
25
26/**
27 * struct timb_dma_platform_data_channel - Description of each individual
28 * DMA channel for the timberdale DMA driver
29 * @rx: true if this channel handles data in the direction to
30 * the CPU.
31 * @bytes_per_line: Number of bytes per line, this is specific for channels
32 * handling video data. For other channels this shall be left to 0.
33 * @descriptors: Number of descriptors to allocate for this channel.
34 * @descriptor_elements: Number of elements in each descriptor.
35 *
36 */
37struct timb_dma_platform_data_channel {
38 bool rx;
39 unsigned int bytes_per_line;
40 unsigned int descriptors;
41 unsigned int descriptor_elements;
42};
43
44/**
45 * struct timb_dma_platform_data - Platform data of the timberdale DMA driver
46 * @nr_channels: Number of defined channels in the channels array.
47 * @channels: Definition of the each channel.
48 *
49 */
50struct timb_dma_platform_data {
51 unsigned nr_channels;
52 struct timb_dma_platform_data_channel channels[32];
53};
54
55#endif
diff --git a/include/linux/time.h b/include/linux/time.h
index 6e026e45a179..ea3559f0b3f2 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -150,7 +150,6 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
150extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
151extern u64 timekeeping_max_deferment(void); 151extern u64 timekeeping_max_deferment(void);
152extern void update_wall_time(void); 152extern void update_wall_time(void);
153extern void update_xtime_cache(u64 nsec);
154extern void timekeeping_leap_insert(int leapsecond); 153extern void timekeeping_leap_insert(int leapsecond);
155 154
156struct tms; 155struct tms;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a2d1eb6cb3f0..ea965b857a50 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -10,13 +10,19 @@
10struct tvec_base; 10struct tvec_base;
11 11
12struct timer_list { 12struct timer_list {
13 /*
14 * All fields that change during normal runtime grouped to the
15 * same cacheline
16 */
13 struct list_head entry; 17 struct list_head entry;
14 unsigned long expires; 18 unsigned long expires;
19 struct tvec_base *base;
15 20
16 void (*function)(unsigned long); 21 void (*function)(unsigned long);
17 unsigned long data; 22 unsigned long data;
18 23
19 struct tvec_base *base; 24 int slack;
25
20#ifdef CONFIG_TIMER_STATS 26#ifdef CONFIG_TIMER_STATS
21 void *start_site; 27 void *start_site;
22 char start_comm[16]; 28 char start_comm[16];
@@ -165,6 +171,8 @@ extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 171extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires); 172extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
167 173
174extern void set_timer_slack(struct timer_list *time, int slack_hz);
175
168#define TIMER_NOT_PINNED 0 176#define TIMER_NOT_PINNED 0
169#define TIMER_PINNED 1 177#define TIMER_PINNED 1
170/* 178/*
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 94f8faecdcbc..32d852f8cbe4 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -232,16 +232,11 @@ struct timex {
232 */ 232 */
233extern unsigned long tick_usec; /* USER_HZ period (usec) */ 233extern unsigned long tick_usec; /* USER_HZ period (usec) */
234extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ 234extern unsigned long tick_nsec; /* ACTHZ period (nsec) */
235extern int tickadj; /* amount of adjustment per tick */
236 235
237/* 236/*
238 * phase-lock loop variables 237 * phase-lock loop variables
239 */ 238 */
240extern int time_status; /* clock synchronization status bits */ 239extern int time_status; /* clock synchronization status bits */
241extern long time_maxerror; /* maximum error */
242extern long time_esterror; /* estimated error */
243
244extern long time_adjust; /* The amount of adjtime left */
245 240
246extern void ntp_init(void); 241extern void ntp_init(void);
247extern void ntp_clear(void); 242extern void ntp_clear(void);
@@ -274,9 +269,6 @@ extern void second_overflow(void);
274extern void update_ntp_one_tick(void); 269extern void update_ntp_one_tick(void);
275extern int do_adjtimex(struct timex *); 270extern int do_adjtimex(struct timex *);
276 271
277/* Don't use! Compatibility define for existing users. */
278#define tickadj (500/HZ ? : 1)
279
280int read_current_timer(unsigned long *timer_val); 272int read_current_timer(unsigned long *timer_val);
281 273
282/* The clock frequency of the i8253/i8254 PIT */ 274/* The clock frequency of the i8253/i8254 PIT */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 3d92396639de..181c8d0e6f73 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -107,7 +107,7 @@ static inline unsigned int tipc_node(__u32 addr)
107 * Message importance levels 107 * Message importance levels
108 */ 108 */
109 109
110#define TIPC_LOW_IMPORTANCE 0 /* default */ 110#define TIPC_LOW_IMPORTANCE 0
111#define TIPC_MEDIUM_IMPORTANCE 1 111#define TIPC_MEDIUM_IMPORTANCE 1
112#define TIPC_HIGH_IMPORTANCE 2 112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3 113#define TIPC_CRITICAL_IMPORTANCE 3
@@ -127,23 +127,17 @@ static inline unsigned int tipc_node(__u32 addr)
127 * TIPC topology subscription service definitions 127 * TIPC topology subscription service definitions
128 */ 128 */
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_SERVICE 0x00 /* Filter for service availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_PORTS 0x01 /* Filter for port availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ 132#define TIPC_SUB_CANCEL 0x04 /* Cancel a subscription */
133#if 0
134/* The following filter options are not currently implemented */
135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
136#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
137#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
138#endif
139 133
140#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ 134#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
141 135
142struct tipc_subscr { 136struct tipc_subscr {
143 struct tipc_name_seq seq; /* name sequence of interest */ 137 struct tipc_name_seq seq; /* NBO. Name sequence of interest */
144 __u32 timeout; /* subscription duration (in ms) */ 138 __u32 timeout; /* NBO. Subscription duration (in ms) */
145 __u32 filter; /* bitmask of filter options */ 139 __u32 filter; /* NBO. Bitmask of filter options */
146 char usr_handle[8]; /* available for subscriber use */ 140 char usr_handle[8]; /* Opaque. Available for subscriber use */
147}; 141};
148 142
149#define TIPC_PUBLISHED 1 /* publication event */ 143#define TIPC_PUBLISHED 1 /* publication event */
@@ -151,11 +145,11 @@ struct tipc_subscr {
151#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ 145#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
152 146
153struct tipc_event { 147struct tipc_event {
154 __u32 event; /* event type */ 148 __u32 event; /* NBO. Event type, as defined above */
155 __u32 found_lower; /* matching name seq instances */ 149 __u32 found_lower; /* NBO. Matching name seq instances */
156 __u32 found_upper; /* " " " " */ 150 __u32 found_upper; /* " " " " " */
157 struct tipc_portid port; /* associated port */ 151 struct tipc_portid port; /* NBO. Associated port */
158 struct tipc_subscr s; /* associated subscription */ 152 struct tipc_subscr s; /* Original, associated subscription */
159}; 153};
160 154
161/* 155/*
@@ -188,7 +182,7 @@ struct sockaddr_tipc {
188 struct tipc_name_seq nameseq; 182 struct tipc_name_seq nameseq;
189 struct { 183 struct {
190 struct tipc_name name; 184 struct tipc_name name;
191 __u32 domain; /* 0: own zone */ 185 __u32 domain;
192 } name; 186 } name;
193 } addr; 187 } addr;
194}; 188};
@@ -206,7 +200,7 @@ struct sockaddr_tipc {
206 */ 200 */
207 201
208#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ 202#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */
209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ 203#define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */
210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ 204#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ 205#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
212#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ 206#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 2bc6fa4adeb5..9cde86c32412 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -74,6 +74,7 @@
74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ 74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */
75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ 75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ 76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */
77 78
78#if 0 79#if 0
79#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ 80#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 5b81156780b1..c44df50a05ab 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -31,6 +31,7 @@
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/mmzone.h> 32#include <linux/mmzone.h>
33#include <linux/smp.h> 33#include <linux/smp.h>
34#include <linux/percpu.h>
34#include <asm/topology.h> 35#include <asm/topology.h>
35 36
36#ifndef node_has_online_mem 37#ifndef node_has_online_mem
@@ -203,8 +204,114 @@ int arch_update_cpu_topology(void);
203#ifndef SD_NODE_INIT 204#ifndef SD_NODE_INIT
204#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 205#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
205#endif 206#endif
207
206#endif /* CONFIG_NUMA */ 208#endif /* CONFIG_NUMA */
207 209
210#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
211DECLARE_PER_CPU(int, numa_node);
212
213#ifndef numa_node_id
214/* Returns the number of the current Node. */
215static inline int numa_node_id(void)
216{
217 return __this_cpu_read(numa_node);
218}
219#endif
220
221#ifndef cpu_to_node
222static inline int cpu_to_node(int cpu)
223{
224 return per_cpu(numa_node, cpu);
225}
226#endif
227
228#ifndef set_numa_node
229static inline void set_numa_node(int node)
230{
231 percpu_write(numa_node, node);
232}
233#endif
234
235#ifndef set_cpu_numa_node
236static inline void set_cpu_numa_node(int cpu, int node)
237{
238 per_cpu(numa_node, cpu) = node;
239}
240#endif
241
242#else /* !CONFIG_USE_PERCPU_NUMA_NODE_ID */
243
244/* Returns the number of the current Node. */
245#ifndef numa_node_id
246static inline int numa_node_id(void)
247{
248 return cpu_to_node(raw_smp_processor_id());
249}
250#endif
251
252#endif /* [!]CONFIG_USE_PERCPU_NUMA_NODE_ID */
253
254#ifdef CONFIG_HAVE_MEMORYLESS_NODES
255
256/*
257 * N.B., Do NOT reference the '_numa_mem_' per cpu variable directly.
258 * It will not be defined when CONFIG_HAVE_MEMORYLESS_NODES is not defined.
259 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
260 */
261DECLARE_PER_CPU(int, _numa_mem_);
262
263#ifndef set_numa_mem
264static inline void set_numa_mem(int node)
265{
266 percpu_write(_numa_mem_, node);
267}
268#endif
269
270#ifndef numa_mem_id
271/* Returns the number of the nearest Node with memory */
272static inline int numa_mem_id(void)
273{
274 return __this_cpu_read(_numa_mem_);
275}
276#endif
277
278#ifndef cpu_to_mem
279static inline int cpu_to_mem(int cpu)
280{
281 return per_cpu(_numa_mem_, cpu);
282}
283#endif
284
285#ifndef set_cpu_numa_mem
286static inline void set_cpu_numa_mem(int cpu, int node)
287{
288 per_cpu(_numa_mem_, cpu) = node;
289}
290#endif
291
292#else /* !CONFIG_HAVE_MEMORYLESS_NODES */
293
294static inline void set_numa_mem(int node) {}
295
296static inline void set_cpu_numa_mem(int cpu, int node) {}
297
298#ifndef numa_mem_id
299/* Returns the number of the nearest Node with memory */
300static inline int numa_mem_id(void)
301{
302 return numa_node_id();
303}
304#endif
305
306#ifndef cpu_to_mem
307static inline int cpu_to_mem(int cpu)
308{
309 return cpu_to_node(cpu);
310}
311#endif
312
313#endif /* [!]CONFIG_HAVE_MEMORYLESS_NODES */
314
208#ifndef topology_physical_package_id 315#ifndef topology_physical_package_id
209#define topology_physical_package_id(cpu) ((void)(cpu), -1) 316#define topology_physical_package_id(cpu) ((void)(cpu), -1)
210#endif 317#endif
@@ -218,9 +325,4 @@ int arch_update_cpu_topology(void);
218#define topology_core_cpumask(cpu) cpumask_of(cpu) 325#define topology_core_cpumask(cpu) cpumask_of(cpu)
219#endif 326#endif
220 327
221/* Returns the number of the current Node. */
222#ifndef numa_node_id
223#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
224#endif
225
226#endif /* _LINUX_TOPOLOGY_H */ 328#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index f59604ed0ec6..103d1b61aacb 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -14,18 +14,24 @@
14 * See the file COPYING for more details. 14 * See the file COPYING for more details.
15 */ 15 */
16 16
17#include <linux/errno.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
19 20
20struct module; 21struct module;
21struct tracepoint; 22struct tracepoint;
22 23
24struct tracepoint_func {
25 void *func;
26 void *data;
27};
28
23struct tracepoint { 29struct tracepoint {
24 const char *name; /* Tracepoint name */ 30 const char *name; /* Tracepoint name */
25 int state; /* State. */ 31 int state; /* State. */
26 void (*regfunc)(void); 32 void (*regfunc)(void);
27 void (*unregfunc)(void); 33 void (*unregfunc)(void);
28 void **funcs; 34 struct tracepoint_func *funcs;
29} __attribute__((aligned(32))); /* 35} __attribute__((aligned(32))); /*
30 * Aligned on 32 bytes because it is 36 * Aligned on 32 bytes because it is
31 * globally visible and gcc happily 37 * globally visible and gcc happily
@@ -33,6 +39,68 @@ struct tracepoint {
33 * Keep in sync with vmlinux.lds.h. 39 * Keep in sync with vmlinux.lds.h.
34 */ 40 */
35 41
42/*
43 * Connect a probe to a tracepoint.
44 * Internal API, should not be used directly.
45 */
46extern int tracepoint_probe_register(const char *name, void *probe, void *data);
47
48/*
49 * Disconnect a probe from a tracepoint.
50 * Internal API, should not be used directly.
51 */
52extern int
53tracepoint_probe_unregister(const char *name, void *probe, void *data);
54
55extern int tracepoint_probe_register_noupdate(const char *name, void *probe,
56 void *data);
57extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe,
58 void *data);
59extern void tracepoint_probe_update_all(void);
60
61struct tracepoint_iter {
62 struct module *module;
63 struct tracepoint *tracepoint;
64};
65
66extern void tracepoint_iter_start(struct tracepoint_iter *iter);
67extern void tracepoint_iter_next(struct tracepoint_iter *iter);
68extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
69extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
70extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
71 struct tracepoint *begin, struct tracepoint *end);
72
73/*
74 * tracepoint_synchronize_unregister must be called between the last tracepoint
75 * probe unregistration and the end of module exit to make sure there is no
76 * caller executing a probe when it is freed.
77 */
78static inline void tracepoint_synchronize_unregister(void)
79{
80 synchronize_sched();
81}
82
83#define PARAMS(args...) args
84
85#ifdef CONFIG_TRACEPOINTS
86extern void tracepoint_update_probe_range(struct tracepoint *begin,
87 struct tracepoint *end);
88#else
89static inline void tracepoint_update_probe_range(struct tracepoint *begin,
90 struct tracepoint *end)
91{ }
92#endif /* CONFIG_TRACEPOINTS */
93
94#endif /* _LINUX_TRACEPOINT_H */
95
96/*
97 * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include
98 * file ifdef protection.
99 * This is due to the way trace events work. If a file includes two
100 * trace event headers under one "CREATE_TRACE_POINTS" the first include
101 * will override the TRACE_EVENT and break the second include.
102 */
103
36#ifndef DECLARE_TRACE 104#ifndef DECLARE_TRACE
37 105
38#define TP_PROTO(args...) args 106#define TP_PROTO(args...) args
@@ -43,17 +111,27 @@ struct tracepoint {
43/* 111/*
44 * it_func[0] is never NULL because there is at least one element in the array 112 * it_func[0] is never NULL because there is at least one element in the array
45 * when the array itself is non NULL. 113 * when the array itself is non NULL.
114 *
115 * Note, the proto and args passed in includes "__data" as the first parameter.
116 * The reason for this is to handle the "void" prototype. If a tracepoint
117 * has a "void" prototype, then it is invalid to declare a function
118 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
119 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
46 */ 120 */
47#define __DO_TRACE(tp, proto, args) \ 121#define __DO_TRACE(tp, proto, args) \
48 do { \ 122 do { \
49 void **it_func; \ 123 struct tracepoint_func *it_func_ptr; \
124 void *it_func; \
125 void *__data; \
50 \ 126 \
51 rcu_read_lock_sched_notrace(); \ 127 rcu_read_lock_sched_notrace(); \
52 it_func = rcu_dereference((tp)->funcs); \ 128 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
53 if (it_func) { \ 129 if (it_func_ptr) { \
54 do { \ 130 do { \
55 ((void(*)(proto))(*it_func))(args); \ 131 it_func = (it_func_ptr)->func; \
56 } while (*(++it_func)); \ 132 __data = (it_func_ptr)->data; \
133 ((void(*)(proto))(it_func))(args); \
134 } while ((++it_func_ptr)->func); \
57 } \ 135 } \
58 rcu_read_unlock_sched_notrace(); \ 136 rcu_read_unlock_sched_notrace(); \
59 } while (0) 137 } while (0)
@@ -63,24 +141,32 @@ struct tracepoint {
63 * not add unwanted padding between the beginning of the section and the 141 * not add unwanted padding between the beginning of the section and the
64 * structure. Force alignment to the same alignment as the section start. 142 * structure. Force alignment to the same alignment as the section start.
65 */ 143 */
66#define DECLARE_TRACE(name, proto, args) \ 144#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \
67 extern struct tracepoint __tracepoint_##name; \ 145 extern struct tracepoint __tracepoint_##name; \
68 static inline void trace_##name(proto) \ 146 static inline void trace_##name(proto) \
69 { \ 147 { \
70 if (unlikely(__tracepoint_##name.state)) \ 148 if (unlikely(__tracepoint_##name.state)) \
71 __DO_TRACE(&__tracepoint_##name, \ 149 __DO_TRACE(&__tracepoint_##name, \
72 TP_PROTO(proto), TP_ARGS(args)); \ 150 TP_PROTO(data_proto), \
151 TP_ARGS(data_args)); \
73 } \ 152 } \
74 static inline int register_trace_##name(void (*probe)(proto)) \ 153 static inline int \
154 register_trace_##name(void (*probe)(data_proto), void *data) \
75 { \ 155 { \
76 return tracepoint_probe_register(#name, (void *)probe); \ 156 return tracepoint_probe_register(#name, (void *)probe, \
157 data); \
77 } \ 158 } \
78 static inline int unregister_trace_##name(void (*probe)(proto)) \ 159 static inline int \
160 unregister_trace_##name(void (*probe)(data_proto), void *data) \
161 { \
162 return tracepoint_probe_unregister(#name, (void *)probe, \
163 data); \
164 } \
165 static inline void \
166 check_trace_callback_type_##name(void (*cb)(data_proto)) \
79 { \ 167 { \
80 return tracepoint_probe_unregister(#name, (void *)probe);\
81 } 168 }
82 169
83
84#define DEFINE_TRACE_FN(name, reg, unreg) \ 170#define DEFINE_TRACE_FN(name, reg, unreg) \
85 static const char __tpstrtab_##name[] \ 171 static const char __tpstrtab_##name[] \
86 __attribute__((section("__tracepoints_strings"))) = #name; \ 172 __attribute__((section("__tracepoints_strings"))) = #name; \
@@ -96,22 +182,24 @@ struct tracepoint {
96#define EXPORT_TRACEPOINT_SYMBOL(name) \ 182#define EXPORT_TRACEPOINT_SYMBOL(name) \
97 EXPORT_SYMBOL(__tracepoint_##name) 183 EXPORT_SYMBOL(__tracepoint_##name)
98 184
99extern void tracepoint_update_probe_range(struct tracepoint *begin,
100 struct tracepoint *end);
101
102#else /* !CONFIG_TRACEPOINTS */ 185#else /* !CONFIG_TRACEPOINTS */
103#define DECLARE_TRACE(name, proto, args) \ 186#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \
104 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
105 { } \
106 static inline void trace_##name(proto) \ 187 static inline void trace_##name(proto) \
107 { } \ 188 { } \
108 static inline int register_trace_##name(void (*probe)(proto)) \ 189 static inline int \
190 register_trace_##name(void (*probe)(data_proto), \
191 void *data) \
109 { \ 192 { \
110 return -ENOSYS; \ 193 return -ENOSYS; \
111 } \ 194 } \
112 static inline int unregister_trace_##name(void (*probe)(proto)) \ 195 static inline int \
196 unregister_trace_##name(void (*probe)(data_proto), \
197 void *data) \
113 { \ 198 { \
114 return -ENOSYS; \ 199 return -ENOSYS; \
200 } \
201 static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
202 { \
115 } 203 }
116 204
117#define DEFINE_TRACE_FN(name, reg, unreg) 205#define DEFINE_TRACE_FN(name, reg, unreg)
@@ -119,60 +207,31 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
119#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 207#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
120#define EXPORT_TRACEPOINT_SYMBOL(name) 208#define EXPORT_TRACEPOINT_SYMBOL(name)
121 209
122static inline void tracepoint_update_probe_range(struct tracepoint *begin,
123 struct tracepoint *end)
124{ }
125#endif /* CONFIG_TRACEPOINTS */ 210#endif /* CONFIG_TRACEPOINTS */
126#endif /* DECLARE_TRACE */
127
128/*
129 * Connect a probe to a tracepoint.
130 * Internal API, should not be used directly.
131 */
132extern int tracepoint_probe_register(const char *name, void *probe);
133
134/*
135 * Disconnect a probe from a tracepoint.
136 * Internal API, should not be used directly.
137 */
138extern int tracepoint_probe_unregister(const char *name, void *probe);
139
140extern int tracepoint_probe_register_noupdate(const char *name, void *probe);
141extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe);
142extern void tracepoint_probe_update_all(void);
143
144struct tracepoint_iter {
145 struct module *module;
146 struct tracepoint *tracepoint;
147};
148
149extern void tracepoint_iter_start(struct tracepoint_iter *iter);
150extern void tracepoint_iter_next(struct tracepoint_iter *iter);
151extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
152extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
153extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
154 struct tracepoint *begin, struct tracepoint *end);
155 211
156/* 212/*
157 * tracepoint_synchronize_unregister must be called between the last tracepoint 213 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
158 * probe unregistration and the end of module exit to make sure there is no 214 * (void). "void" is a special value in a function prototype and can
159 * caller executing a probe when it is freed. 215 * not be combined with other arguments. Since the DECLARE_TRACE()
216 * macro adds a data element at the beginning of the prototype,
217 * we need a way to differentiate "(void *data, proto)" from
218 * "(void *data, void)". The second prototype is invalid.
219 *
220 * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype
221 * and "void *__data" as the callback prototype.
222 *
223 * DECLARE_TRACE() passes "proto" as the tracepoint protoype and
224 * "void *__data, proto" as the callback prototype.
160 */ 225 */
161static inline void tracepoint_synchronize_unregister(void) 226#define DECLARE_TRACE_NOARGS(name) \
162{ 227 __DECLARE_TRACE(name, void, , void *__data, __data)
163 synchronize_sched();
164}
165 228
166#define PARAMS(args...) args 229#define DECLARE_TRACE(name, proto, args) \
167 230 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
168#endif /* _LINUX_TRACEPOINT_H */ 231 PARAMS(void *__data, proto), \
232 PARAMS(__data, args))
169 233
170/* 234#endif /* DECLARE_TRACE */
171 * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
172 * This is due to the way trace events work. If a file includes two
173 * trace event headers under one "CREATE_TRACE_POINTS" the first include
174 * will override the TRACE_EVENT and break the second include.
175 */
176 235
177#ifndef TRACE_EVENT 236#ifndef TRACE_EVENT
178/* 237/*
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 6abfcf5b5887..931078b73226 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 20 26#define NR_LDISCS 30
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -46,8 +46,9 @@
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ 47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
48#define N_PPS 18 /* Pulse per Second */ 48#define N_PPS 18 /* Pulse per Second */
49
50#define N_V253 19 /* Codec control over voice modem */ 49#define N_V253 19 /* Codec control over voice modem */
50#define N_CAIF 20 /* CAIF protocol for talking to modems */
51#define N_GSM0710 21 /* GSM 0710 Mux */
51 52
52/* 53/*
53 * This character is the same as _POSIX_VDISABLE: it cannot be used as 54 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -68,6 +69,17 @@ struct tty_buffer {
68 unsigned long data[0]; 69 unsigned long data[0];
69}; 70};
70 71
72/*
73 * We default to dicing tty buffer allocations to this many characters
74 * in order to avoid multiple page allocations. We know the size of
75 * tty_buffer itself but it must also be taken into account that the
76 * the buffer is 256 byte aligned. See tty_buffer_find for the allocation
77 * logic this must match
78 */
79
80#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF)
81
82
71struct tty_bufhead { 83struct tty_bufhead {
72 struct delayed_work work; 84 struct delayed_work work;
73 spinlock_t lock; 85 spinlock_t lock;
@@ -213,6 +225,7 @@ struct tty_port {
213 wait_queue_head_t close_wait; /* Close waiters */ 225 wait_queue_head_t close_wait; /* Close waiters */
214 wait_queue_head_t delta_msr_wait; /* Modem status change */ 226 wait_queue_head_t delta_msr_wait; /* Modem status change */
215 unsigned long flags; /* TTY flags ASY_*/ 227 unsigned long flags; /* TTY flags ASY_*/
228 unsigned char console:1; /* port is a console */
216 struct mutex mutex; /* Locking */ 229 struct mutex mutex; /* Locking */
217 struct mutex buf_mutex; /* Buffer alloc lock */ 230 struct mutex buf_mutex; /* Buffer alloc lock */
218 unsigned char *xmit_buf; /* Optional buffer */ 231 unsigned char *xmit_buf; /* Optional buffer */
@@ -504,6 +517,7 @@ extern void tty_ldisc_enable(struct tty_struct *tty);
504 517
505/* n_tty.c */ 518/* n_tty.c */
506extern struct tty_ldisc_ops tty_ldisc_N_TTY; 519extern struct tty_ldisc_ops tty_ldisc_N_TTY;
520extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
507 521
508/* tty_audit.c */ 522/* tty_audit.c */
509#ifdef CONFIG_AUDIT 523#ifdef CONFIG_AUDIT
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index eb677cf56106..9239d033a0a3 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -2,8 +2,8 @@
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); 4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
5extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size);
6extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); 5extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size);
6extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); 7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); 8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9void tty_schedule_flip(struct tty_struct *tty); 9void tty_schedule_flip(struct tty_struct *tty);
@@ -20,4 +20,9 @@ static inline int tty_insert_flip_char(struct tty_struct *tty,
20 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 20 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
21} 21}
22 22
23static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size)
24{
25 return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size);
26}
27
23#endif /* _LINUX_TTY_FLIP_H */ 28#endif /* _LINUX_TTY_FLIP_H */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 0c4ee9b88f85..526d66f066a3 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -99,6 +99,12 @@
99 * cease I/O to the tty driver. Can sleep. The driver should 99 * cease I/O to the tty driver. Can sleep. The driver should
100 * seek to perform this action quickly but should wait until 100 * seek to perform this action quickly but should wait until
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status,
104 * struct timespec *ts)
105 *
106 * Tells the discipline that the DCD pin has changed its status and
107 * the relative timestamp. Pointer ts can be NULL.
102 */ 108 */
103 109
104#include <linux/fs.h> 110#include <linux/fs.h>
@@ -136,6 +142,8 @@ struct tty_ldisc_ops {
136 void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 142 void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
137 char *fp, int count); 143 char *fp, int count);
138 void (*write_wakeup)(struct tty_struct *); 144 void (*write_wakeup)(struct tty_struct *);
145 void (*dcd_change)(struct tty_struct *, unsigned int,
146 struct timespec *);
139 147
140 struct module *owner; 148 struct module *owner;
141 149
diff --git a/include/linux/types.h b/include/linux/types.h
index c42724f8c802..23d237a075e2 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -188,12 +188,12 @@ typedef u32 phys_addr_t;
188typedef phys_addr_t resource_size_t; 188typedef phys_addr_t resource_size_t;
189 189
190typedef struct { 190typedef struct {
191 volatile int counter; 191 int counter;
192} atomic_t; 192} atomic_t;
193 193
194#ifdef CONFIG_64BIT 194#ifdef CONFIG_64BIT
195typedef struct { 195typedef struct {
196 volatile long counter; 196 long counter;
197} atomic64_t; 197} atomic64_t;
198#endif 198#endif
199 199
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 15ddd4483b09..60c81da77f0f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -166,11 +166,11 @@ struct uinput_ff_erase {
166struct uinput_user_dev { 166struct uinput_user_dev {
167 char name[UINPUT_MAX_NAME_SIZE]; 167 char name[UINPUT_MAX_NAME_SIZE];
168 struct input_id id; 168 struct input_id id;
169 int ff_effects_max; 169 int ff_effects_max;
170 int absmax[ABS_MAX + 1]; 170 int absmax[ABS_CNT];
171 int absmin[ABS_MAX + 1]; 171 int absmin[ABS_CNT];
172 int absfuzz[ABS_MAX + 1]; 172 int absfuzz[ABS_CNT];
173 int absflat[ABS_MAX + 1]; 173 int absflat[ABS_CNT];
174}; 174};
175#endif /* __UINPUT_H_ */ 175#endif /* __UINPUT_H_ */
176 176
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d7ace1b80f09..d5922a877994 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -45,27 +45,14 @@ struct wusb_dev;
45 45
46struct ep_device; 46struct ep_device;
47 47
48/* For SS devices */
49/**
50 * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only
51 * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder
52 * @extra: descriptors following this endpoint companion descriptor
53 * @extralen: how many bytes of "extra" are valid
54 */
55struct usb_host_ss_ep_comp {
56 struct usb_ss_ep_comp_descriptor desc;
57 unsigned char *extra; /* Extra descriptors */
58 int extralen;
59};
60
61/** 48/**
62 * struct usb_host_endpoint - host-side endpoint descriptor and queue 49 * struct usb_host_endpoint - host-side endpoint descriptor and queue
63 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 50 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
51 * @ss_ep_comp: SuperSpeed companion descriptor for this endpoint
64 * @urb_list: urbs queued to this endpoint; maintained by usbcore 52 * @urb_list: urbs queued to this endpoint; maintained by usbcore
65 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 53 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
66 * with one or more transfer descriptors (TDs) per urb 54 * with one or more transfer descriptors (TDs) per urb
67 * @ep_dev: ep_device for sysfs info 55 * @ep_dev: ep_device for sysfs info
68 * @ss_ep_comp: companion descriptor information for this endpoint
69 * @extra: descriptors following this endpoint in the configuration 56 * @extra: descriptors following this endpoint in the configuration
70 * @extralen: how many bytes of "extra" are valid 57 * @extralen: how many bytes of "extra" are valid
71 * @enabled: URBs may be submitted to this endpoint 58 * @enabled: URBs may be submitted to this endpoint
@@ -74,11 +61,11 @@ struct usb_host_ss_ep_comp {
74 * descriptor within an active interface in a given USB configuration. 61 * descriptor within an active interface in a given USB configuration.
75 */ 62 */
76struct usb_host_endpoint { 63struct usb_host_endpoint {
77 struct usb_endpoint_descriptor desc; 64 struct usb_endpoint_descriptor desc;
65 struct usb_ss_ep_comp_descriptor ss_ep_comp;
78 struct list_head urb_list; 66 struct list_head urb_list;
79 void *hcpriv; 67 void *hcpriv;
80 struct ep_device *ep_dev; /* For sysfs info */ 68 struct ep_device *ep_dev; /* For sysfs info */
81 struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */
82 69
83 unsigned char *extra; /* Extra descriptors */ 70 unsigned char *extra; /* Extra descriptors */
84 int extralen; 71 int extralen;
@@ -109,8 +96,8 @@ enum usb_interface_condition {
109/** 96/**
110 * struct usb_interface - what usb device drivers talk to 97 * struct usb_interface - what usb device drivers talk to
111 * @altsetting: array of interface structures, one for each alternate 98 * @altsetting: array of interface structures, one for each alternate
112 * setting that may be selected. Each one includes a set of 99 * setting that may be selected. Each one includes a set of
113 * endpoint configurations. They will be in no particular order. 100 * endpoint configurations. They will be in no particular order.
114 * @cur_altsetting: the current altsetting. 101 * @cur_altsetting: the current altsetting.
115 * @num_altsetting: number of altsettings defined. 102 * @num_altsetting: number of altsettings defined.
116 * @intf_assoc: interface association descriptor 103 * @intf_assoc: interface association descriptor
@@ -122,7 +109,6 @@ enum usb_interface_condition {
122 * number from the USB core by calling usb_register_dev(). 109 * number from the USB core by calling usb_register_dev().
123 * @condition: binding state of the interface: not bound, binding 110 * @condition: binding state of the interface: not bound, binding
124 * (in probe()), bound to a driver, or unbinding (in disconnect()) 111 * (in probe()), bound to a driver, or unbinding (in disconnect())
125 * @is_active: flag set when the interface is bound and not suspended.
126 * @sysfs_files_created: sysfs attributes exist 112 * @sysfs_files_created: sysfs attributes exist
127 * @ep_devs_created: endpoint child pseudo-devices exist 113 * @ep_devs_created: endpoint child pseudo-devices exist
128 * @unregistering: flag set when the interface is being unregistered 114 * @unregistering: flag set when the interface is being unregistered
@@ -135,8 +121,7 @@ enum usb_interface_condition {
135 * @dev: driver model's view of this device 121 * @dev: driver model's view of this device
136 * @usb_dev: if an interface is bound to the USB major, this will point 122 * @usb_dev: if an interface is bound to the USB major, this will point
137 * to the sysfs representation for that device. 123 * to the sysfs representation for that device.
138 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 124 * @pm_usage_cnt: PM usage counter for this interface
139 * allowed unless the counter is 0.
140 * @reset_ws: Used for scheduling resets from atomic context. 125 * @reset_ws: Used for scheduling resets from atomic context.
141 * @reset_running: set to 1 if the interface is currently running a 126 * @reset_running: set to 1 if the interface is currently running a
142 * queued reset so that usb_cancel_queued_reset() doesn't try to 127 * queued reset so that usb_cancel_queued_reset() doesn't try to
@@ -184,7 +169,6 @@ struct usb_interface {
184 int minor; /* minor number this interface is 169 int minor; /* minor number this interface is
185 * bound to */ 170 * bound to */
186 enum usb_interface_condition condition; /* state of binding */ 171 enum usb_interface_condition condition; /* state of binding */
187 unsigned is_active:1; /* the interface is not suspended */
188 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 172 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
189 unsigned ep_devs_created:1; /* endpoint "devices" exist */ 173 unsigned ep_devs_created:1; /* endpoint "devices" exist */
190 unsigned unregistering:1; /* unregistration is in progress */ 174 unsigned unregistering:1; /* unregistration is in progress */
@@ -200,8 +184,6 @@ struct usb_interface {
200 struct work_struct reset_ws; /* for resets in atomic context */ 184 struct work_struct reset_ws; /* for resets in atomic context */
201}; 185};
202#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 186#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
203#define interface_to_usbdev(intf) \
204 container_of(intf->dev.parent, struct usb_device, dev)
205 187
206static inline void *usb_get_intfdata(struct usb_interface *intf) 188static inline void *usb_get_intfdata(struct usb_interface *intf)
207{ 189{
@@ -218,7 +200,7 @@ void usb_put_intf(struct usb_interface *intf);
218 200
219/* this maximum is arbitrary */ 201/* this maximum is arbitrary */
220#define USB_MAXINTERFACES 32 202#define USB_MAXINTERFACES 32
221#define USB_MAXIADS USB_MAXINTERFACES/2 203#define USB_MAXIADS (USB_MAXINTERFACES/2)
222 204
223/** 205/**
224 * struct usb_interface_cache - long-term representation of a device interface 206 * struct usb_interface_cache - long-term representation of a device interface
@@ -339,6 +321,7 @@ struct usb_bus {
339 321
340 struct usb_devmap devmap; /* device address allocation map */ 322 struct usb_devmap devmap; /* device address allocation map */
341 struct usb_device *root_hub; /* Root hub */ 323 struct usb_device *root_hub; /* Root hub */
324 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */
342 struct list_head bus_list; /* list of busses */ 325 struct list_head bus_list; /* list of busses */
343 326
344 int bandwidth_allocated; /* on this bus: how much of the time 327 int bandwidth_allocated; /* on this bus: how much of the time
@@ -400,7 +383,6 @@ struct usb_tt;
400 * @portnum: parent port number (origin 1) 383 * @portnum: parent port number (origin 1)
401 * @level: number of USB hub ancestors 384 * @level: number of USB hub ancestors
402 * @can_submit: URBs may be submitted 385 * @can_submit: URBs may be submitted
403 * @discon_suspended: disconnected while suspended
404 * @persist_enabled: USB_PERSIST enabled for this device 386 * @persist_enabled: USB_PERSIST enabled for this device
405 * @have_langid: whether string_langid is valid 387 * @have_langid: whether string_langid is valid
406 * @authorized: policy has said we can use it; 388 * @authorized: policy has said we can use it;
@@ -420,20 +402,14 @@ struct usb_tt;
420 * @usbfs_dentry: usbfs dentry entry for the device 402 * @usbfs_dentry: usbfs dentry entry for the device
421 * @maxchild: number of ports if hub 403 * @maxchild: number of ports if hub
422 * @children: child devices - USB devices that are attached to this hub 404 * @children: child devices - USB devices that are attached to this hub
423 * @pm_usage_cnt: usage counter for autosuspend
424 * @quirks: quirks of the whole device 405 * @quirks: quirks of the whole device
425 * @urbnum: number of URBs submitted for the whole device 406 * @urbnum: number of URBs submitted for the whole device
426 * @active_duration: total time device is not suspended 407 * @active_duration: total time device is not suspended
427 * @autosuspend: for delayed autosuspends
428 * @autoresume: for autoresumes requested while in_interrupt
429 * @pm_mutex: protects PM operations
430 * @last_busy: time of last use 408 * @last_busy: time of last use
431 * @autosuspend_delay: in jiffies 409 * @autosuspend_delay: in jiffies
432 * @connect_time: time device was first connected 410 * @connect_time: time device was first connected
433 * @do_remote_wakeup: remote wakeup should be enabled 411 * @do_remote_wakeup: remote wakeup should be enabled
434 * @reset_resume: needs reset instead of resume 412 * @reset_resume: needs reset instead of resume
435 * @autosuspend_disabled: autosuspend disabled by the user
436 * @skip_sys_resume: skip the next system resume
437 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 413 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
438 * specific data for the device. 414 * specific data for the device.
439 * @slot_id: Slot ID assigned by xHCI 415 * @slot_id: Slot ID assigned by xHCI
@@ -444,7 +420,7 @@ struct usb_tt;
444 */ 420 */
445struct usb_device { 421struct usb_device {
446 int devnum; 422 int devnum;
447 char devpath [16]; 423 char devpath[16];
448 u32 route; 424 u32 route;
449 enum usb_device_state state; 425 enum usb_device_state state;
450 enum usb_device_speed speed; 426 enum usb_device_speed speed;
@@ -474,11 +450,10 @@ struct usb_device {
474 u8 level; 450 u8 level;
475 451
476 unsigned can_submit:1; 452 unsigned can_submit:1;
477 unsigned discon_suspended:1;
478 unsigned persist_enabled:1; 453 unsigned persist_enabled:1;
479 unsigned have_langid:1; 454 unsigned have_langid:1;
480 unsigned authorized:1; 455 unsigned authorized:1;
481 unsigned authenticated:1; 456 unsigned authenticated:1;
482 unsigned wusb:1; 457 unsigned wusb:1;
483 int string_langid; 458 int string_langid;
484 459
@@ -498,38 +473,36 @@ struct usb_device {
498 int maxchild; 473 int maxchild;
499 struct usb_device *children[USB_MAXCHILDREN]; 474 struct usb_device *children[USB_MAXCHILDREN];
500 475
501 int pm_usage_cnt;
502 u32 quirks; 476 u32 quirks;
503 atomic_t urbnum; 477 atomic_t urbnum;
504 478
505 unsigned long active_duration; 479 unsigned long active_duration;
506 480
507#ifdef CONFIG_PM 481#ifdef CONFIG_PM
508 struct delayed_work autosuspend;
509 struct work_struct autoresume;
510 struct mutex pm_mutex;
511
512 unsigned long last_busy; 482 unsigned long last_busy;
513 int autosuspend_delay; 483 int autosuspend_delay;
514 unsigned long connect_time; 484 unsigned long connect_time;
515 485
516 unsigned do_remote_wakeup:1; 486 unsigned do_remote_wakeup:1;
517 unsigned reset_resume:1; 487 unsigned reset_resume:1;
518 unsigned autosuspend_disabled:1;
519 unsigned skip_sys_resume:1;
520#endif 488#endif
521 struct wusb_dev *wusb_dev; 489 struct wusb_dev *wusb_dev;
522 int slot_id; 490 int slot_id;
523}; 491};
524#define to_usb_device(d) container_of(d, struct usb_device, dev) 492#define to_usb_device(d) container_of(d, struct usb_device, dev)
525 493
494static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
495{
496 return to_usb_device(intf->dev.parent);
497}
498
526extern struct usb_device *usb_get_dev(struct usb_device *dev); 499extern struct usb_device *usb_get_dev(struct usb_device *dev);
527extern void usb_put_dev(struct usb_device *dev); 500extern void usb_put_dev(struct usb_device *dev);
528 501
529/* USB device locking */ 502/* USB device locking */
530#define usb_lock_device(udev) down(&(udev)->dev.sem) 503#define usb_lock_device(udev) device_lock(&(udev)->dev)
531#define usb_unlock_device(udev) up(&(udev)->dev.sem) 504#define usb_unlock_device(udev) device_unlock(&(udev)->dev)
532#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) 505#define usb_trylock_device(udev) device_trylock(&(udev)->dev)
533extern int usb_lock_device_for_reset(struct usb_device *udev, 506extern int usb_lock_device_for_reset(struct usb_device *udev,
534 const struct usb_interface *iface); 507 const struct usb_interface *iface);
535 508
@@ -537,25 +510,18 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
537extern int usb_reset_device(struct usb_device *dev); 510extern int usb_reset_device(struct usb_device *dev);
538extern void usb_queue_reset_device(struct usb_interface *dev); 511extern void usb_queue_reset_device(struct usb_interface *dev);
539 512
540extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
541 513
542/* USB autosuspend and autoresume */ 514/* USB autosuspend and autoresume */
543#ifdef CONFIG_USB_SUSPEND 515#ifdef CONFIG_USB_SUSPEND
516extern void usb_enable_autosuspend(struct usb_device *udev);
517extern void usb_disable_autosuspend(struct usb_device *udev);
518
544extern int usb_autopm_get_interface(struct usb_interface *intf); 519extern int usb_autopm_get_interface(struct usb_interface *intf);
545extern void usb_autopm_put_interface(struct usb_interface *intf); 520extern void usb_autopm_put_interface(struct usb_interface *intf);
546extern int usb_autopm_get_interface_async(struct usb_interface *intf); 521extern int usb_autopm_get_interface_async(struct usb_interface *intf);
547extern void usb_autopm_put_interface_async(struct usb_interface *intf); 522extern void usb_autopm_put_interface_async(struct usb_interface *intf);
548 523extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf);
549static inline void usb_autopm_get_interface_no_resume( 524extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf);
550 struct usb_interface *intf)
551{
552 atomic_inc(&intf->pm_usage_cnt);
553}
554static inline void usb_autopm_put_interface_no_suspend(
555 struct usb_interface *intf)
556{
557 atomic_dec(&intf->pm_usage_cnt);
558}
559 525
560static inline void usb_mark_last_busy(struct usb_device *udev) 526static inline void usb_mark_last_busy(struct usb_device *udev)
561{ 527{
@@ -564,6 +530,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
564 530
565#else 531#else
566 532
533static inline int usb_enable_autosuspend(struct usb_device *udev)
534{ return 0; }
535static inline int usb_disable_autosuspend(struct usb_device *udev)
536{ return 0; }
537
567static inline int usb_autopm_get_interface(struct usb_interface *intf) 538static inline int usb_autopm_get_interface(struct usb_interface *intf)
568{ return 0; } 539{ return 0; }
569static inline int usb_autopm_get_interface_async(struct usb_interface *intf) 540static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
@@ -588,6 +559,16 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
588/* for drivers using iso endpoints */ 559/* for drivers using iso endpoints */
589extern int usb_get_current_frame_number(struct usb_device *usb_dev); 560extern int usb_get_current_frame_number(struct usb_device *usb_dev);
590 561
562/* Sets up a group of bulk endpoints to support multiple stream IDs. */
563extern int usb_alloc_streams(struct usb_interface *interface,
564 struct usb_host_endpoint **eps, unsigned int num_eps,
565 unsigned int num_streams, gfp_t mem_flags);
566
567/* Reverts a group of bulk endpoints back to not using stream IDs. */
568extern void usb_free_streams(struct usb_interface *interface,
569 struct usb_host_endpoint **eps, unsigned int num_eps,
570 gfp_t mem_flags);
571
591/* used these for multi-interface device registration */ 572/* used these for multi-interface device registration */
592extern int usb_driver_claim_interface(struct usb_driver *driver, 573extern int usb_driver_claim_interface(struct usb_driver *driver,
593 struct usb_interface *iface, void *priv); 574 struct usb_interface *iface, void *priv);
@@ -683,7 +664,7 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
683 * This macro is used to create a struct usb_device_id that matches a 664 * This macro is used to create a struct usb_device_id that matches a
684 * specific device. 665 * specific device.
685 */ 666 */
686#define USB_DEVICE(vend,prod) \ 667#define USB_DEVICE(vend, prod) \
687 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ 668 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
688 .idVendor = (vend), \ 669 .idVendor = (vend), \
689 .idProduct = (prod) 670 .idProduct = (prod)
@@ -974,17 +955,25 @@ extern int usb_disabled(void);
974#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 955#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
975 * ignored */ 956 * ignored */
976#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 957#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
977#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
978#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 958#define URB_NO_FSBR 0x0020 /* UHCI-specific */
979#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 959#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
980#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt 960#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
981 * needed */ 961 * needed */
982#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 962#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
983 963
964/* The following flags are used internally by usbcore and HCDs */
984#define URB_DIR_IN 0x0200 /* Transfer from device to host */ 965#define URB_DIR_IN 0x0200 /* Transfer from device to host */
985#define URB_DIR_OUT 0 966#define URB_DIR_OUT 0
986#define URB_DIR_MASK URB_DIR_IN 967#define URB_DIR_MASK URB_DIR_IN
987 968
969#define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
970#define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
971#define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
972#define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
973#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */
974#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
975#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
976
988struct usb_iso_packet_descriptor { 977struct usb_iso_packet_descriptor {
989 unsigned int offset; 978 unsigned int offset;
990 unsigned int length; /* expected length */ 979 unsigned int length; /* expected length */
@@ -1061,17 +1050,14 @@ typedef void (*usb_complete_t)(struct urb *);
1061 * @setup_packet: Only used for control transfers, this points to eight bytes 1050 * @setup_packet: Only used for control transfers, this points to eight bytes
1062 * of setup data. Control transfers always start by sending this data 1051 * of setup data. Control transfers always start by sending this data
1063 * to the device. Then transfer_buffer is read or written, if needed. 1052 * to the device. Then transfer_buffer is read or written, if needed.
1064 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the 1053 * @setup_dma: DMA pointer for the setup packet. The caller must not use
1065 * device driver has provided this DMA address for the setup packet. 1054 * this field; setup_packet must point to a valid buffer.
1066 * The host controller driver should use this in preference to
1067 * setup_packet, but the HCD may chose to ignore the address if it must
1068 * copy the setup packet into internal structures. Therefore, setup_packet
1069 * must always point to a valid buffer.
1070 * @start_frame: Returns the initial frame for isochronous transfers. 1055 * @start_frame: Returns the initial frame for isochronous transfers.
1071 * @number_of_packets: Lists the number of ISO transfer buffers. 1056 * @number_of_packets: Lists the number of ISO transfer buffers.
1072 * @interval: Specifies the polling interval for interrupt or isochronous 1057 * @interval: Specifies the polling interval for interrupt or isochronous
1073 * transfers. The units are frames (milliseconds) for full and low 1058 * transfers. The units are frames (milliseconds) for full and low
1074 * speed devices, and microframes (1/8 millisecond) for highspeed ones. 1059 * speed devices, and microframes (1/8 millisecond) for highspeed
1060 * and SuperSpeed devices.
1075 * @error_count: Returns the number of ISO transfers that reported errors. 1061 * @error_count: Returns the number of ISO transfers that reported errors.
1076 * @context: For use in completion functions. This normally points to 1062 * @context: For use in completion functions. This normally points to
1077 * request-specific driver context. 1063 * request-specific driver context.
@@ -1097,13 +1083,14 @@ typedef void (*usb_complete_t)(struct urb *);
1097 * bounce buffer or talking to an IOMMU), 1083 * bounce buffer or talking to an IOMMU),
1098 * although they're cheap on commodity x86 and ppc hardware. 1084 * although they're cheap on commodity x86 and ppc hardware.
1099 * 1085 *
1100 * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags, 1086 * Alternatively, drivers may pass the URB_NO_TRANSFER_DMA_MAP transfer flag,
1101 * which tell the host controller driver that no such mapping is needed since 1087 * which tells the host controller driver that no such mapping is needed for
1088 * the transfer_buffer since
1102 * the device driver is DMA-aware. For example, a device driver might 1089 * the device driver is DMA-aware. For example, a device driver might
1103 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map(). 1090 * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map().
1104 * When these transfer flags are provided, host controller drivers will 1091 * When this transfer flag is provided, host controller drivers will
1105 * attempt to use the dma addresses found in the transfer_dma and/or 1092 * attempt to use the dma address found in the transfer_dma
1106 * setup_dma fields rather than determining a dma address themselves. 1093 * field rather than determining a dma address themselves.
1107 * 1094 *
1108 * Note that transfer_buffer must still be set if the controller 1095 * Note that transfer_buffer must still be set if the controller
1109 * does not support DMA (as indicated by bus.uses_dma) and when talking 1096 * does not support DMA (as indicated by bus.uses_dma) and when talking
@@ -1126,11 +1113,9 @@ typedef void (*usb_complete_t)(struct urb *);
1126 * should always terminate with a short packet, even if it means adding an 1113 * should always terminate with a short packet, even if it means adding an
1127 * extra zero length packet. 1114 * extra zero length packet.
1128 * 1115 *
1129 * Control URBs must provide a setup_packet. The setup_packet and 1116 * Control URBs must provide a valid pointer in the setup_packet field.
1130 * transfer_buffer may each be mapped for DMA or not, independently of 1117 * Unlike the transfer_buffer, the setup_packet may not be mapped for DMA
1131 * the other. The transfer_flags bits URB_NO_TRANSFER_DMA_MAP and 1118 * beforehand.
1132 * URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped.
1133 * URB_NO_SETUP_DMA_MAP is ignored for non-control URBs.
1134 * 1119 *
1135 * Interrupt URBs must provide an interval, saying how often (in milliseconds 1120 * Interrupt URBs must provide an interval, saying how often (in milliseconds
1136 * or, for highspeed devices, 125 microsecond units) 1121 * or, for highspeed devices, 125 microsecond units)
@@ -1201,14 +1186,15 @@ struct urb {
1201 * current owner */ 1186 * current owner */
1202 struct list_head anchor_list; /* the URB may be anchored */ 1187 struct list_head anchor_list; /* the URB may be anchored */
1203 struct usb_anchor *anchor; 1188 struct usb_anchor *anchor;
1204 struct usb_device *dev; /* (in) pointer to associated device */ 1189 struct usb_device *dev; /* (in) pointer to associated device */
1205 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ 1190 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
1206 unsigned int pipe; /* (in) pipe information */ 1191 unsigned int pipe; /* (in) pipe information */
1192 unsigned int stream_id; /* (in) stream ID */
1207 int status; /* (return) non-ISO status */ 1193 int status; /* (return) non-ISO status */
1208 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1194 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1209 void *transfer_buffer; /* (in) associated data buffer */ 1195 void *transfer_buffer; /* (in) associated data buffer */
1210 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1196 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1211 struct usb_sg_request *sg; /* (in) scatter gather buffer list */ 1197 struct scatterlist *sg; /* (in) scatter gather buffer list */
1212 int num_sgs; /* (in) number of entries in the sg list */ 1198 int num_sgs; /* (in) number of entries in the sg list */
1213 u32 transfer_buffer_length; /* (in) data buffer length */ 1199 u32 transfer_buffer_length; /* (in) data buffer length */
1214 u32 actual_length; /* (return) actual transfer length */ 1200 u32 actual_length; /* (return) actual transfer length */
@@ -1302,9 +1288,16 @@ static inline void usb_fill_bulk_urb(struct urb *urb,
1302 * 1288 *
1303 * Initializes a interrupt urb with the proper information needed to submit 1289 * Initializes a interrupt urb with the proper information needed to submit
1304 * it to a device. 1290 * it to a device.
1305 * Note that high speed interrupt endpoints use a logarithmic encoding of 1291 *
1306 * the endpoint interval, and express polling intervals in microframes 1292 * Note that High Speed and SuperSpeed interrupt endpoints use a logarithmic
1307 * (eight per millisecond) rather than in frames (one per millisecond). 1293 * encoding of the endpoint interval, and express polling intervals in
1294 * microframes (eight per millisecond) rather than in frames (one per
1295 * millisecond).
1296 *
1297 * Wireless USB also uses the logarithmic encoding, but specifies it in units of
1298 * 128us instead of 125us. For Wireless USB devices, the interval is passed
1299 * through to the host controller, rather than being translated into microframe
1300 * units.
1308 */ 1301 */
1309static inline void usb_fill_int_urb(struct urb *urb, 1302static inline void usb_fill_int_urb(struct urb *urb,
1310 struct usb_device *dev, 1303 struct usb_device *dev,
@@ -1321,7 +1314,7 @@ static inline void usb_fill_int_urb(struct urb *urb,
1321 urb->transfer_buffer_length = buffer_length; 1314 urb->transfer_buffer_length = buffer_length;
1322 urb->complete = complete_fn; 1315 urb->complete = complete_fn;
1323 urb->context = context; 1316 urb->context = context;
1324 if (dev->speed == USB_SPEED_HIGH) 1317 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER)
1325 urb->interval = 1 << (interval - 1); 1318 urb->interval = 1 << (interval - 1);
1326 else 1319 else
1327 urb->interval = interval; 1320 urb->interval = interval;
@@ -1374,9 +1367,9 @@ static inline int usb_urb_dir_out(struct urb *urb)
1374 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1367 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
1375} 1368}
1376 1369
1377void *usb_buffer_alloc(struct usb_device *dev, size_t size, 1370void *usb_alloc_coherent(struct usb_device *dev, size_t size,
1378 gfp_t mem_flags, dma_addr_t *dma); 1371 gfp_t mem_flags, dma_addr_t *dma);
1379void usb_buffer_free(struct usb_device *dev, size_t size, 1372void usb_free_coherent(struct usb_device *dev, size_t size,
1380 void *addr, dma_addr_t dma); 1373 void *addr, dma_addr_t dma);
1381 1374
1382#if 0 1375#if 0
@@ -1463,8 +1456,6 @@ struct usb_sg_request {
1463 1456
1464 struct usb_device *dev; 1457 struct usb_device *dev;
1465 int pipe; 1458 int pipe;
1466 struct scatterlist *sg;
1467 int nents;
1468 1459
1469 int entries; 1460 int entries;
1470 struct urb **urbs; 1461 struct urb **urbs;
@@ -1532,23 +1523,31 @@ static inline unsigned int __create_pipe(struct usb_device *dev,
1532} 1523}
1533 1524
1534/* Create various pipes... */ 1525/* Create various pipes... */
1535#define usb_sndctrlpipe(dev,endpoint) \ 1526#define usb_sndctrlpipe(dev, endpoint) \
1536 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) 1527 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
1537#define usb_rcvctrlpipe(dev,endpoint) \ 1528#define usb_rcvctrlpipe(dev, endpoint) \
1538 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1529 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1539#define usb_sndisocpipe(dev,endpoint) \ 1530#define usb_sndisocpipe(dev, endpoint) \
1540 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) 1531 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
1541#define usb_rcvisocpipe(dev,endpoint) \ 1532#define usb_rcvisocpipe(dev, endpoint) \
1542 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1533 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1543#define usb_sndbulkpipe(dev,endpoint) \ 1534#define usb_sndbulkpipe(dev, endpoint) \
1544 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) 1535 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
1545#define usb_rcvbulkpipe(dev,endpoint) \ 1536#define usb_rcvbulkpipe(dev, endpoint) \
1546 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1537 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1547#define usb_sndintpipe(dev,endpoint) \ 1538#define usb_sndintpipe(dev, endpoint) \
1548 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) 1539 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
1549#define usb_rcvintpipe(dev,endpoint) \ 1540#define usb_rcvintpipe(dev, endpoint) \
1550 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1541 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1551 1542
1543static inline struct usb_host_endpoint *
1544usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
1545{
1546 struct usb_host_endpoint **eps;
1547 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out;
1548 return eps[usb_pipeendpoint(pipe)];
1549}
1550
1552/*-------------------------------------------------------------------------*/ 1551/*-------------------------------------------------------------------------*/
1553 1552
1554static inline __u16 1553static inline __u16
@@ -1582,14 +1581,18 @@ extern void usb_register_notify(struct notifier_block *nb);
1582extern void usb_unregister_notify(struct notifier_block *nb); 1581extern void usb_unregister_notify(struct notifier_block *nb);
1583 1582
1584#ifdef DEBUG 1583#ifdef DEBUG
1585#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \ 1584#define dbg(format, arg...) \
1586 __FILE__ , ## arg) 1585 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg)
1587#else 1586#else
1588#define dbg(format, arg...) do {} while (0) 1587#define dbg(format, arg...) \
1588do { \
1589 if (0) \
1590 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
1591} while (0)
1589#endif 1592#endif
1590 1593
1591#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1594#define err(format, arg...) \
1592 format "\n" , ## arg) 1595 printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg)
1593 1596
1594/* debugfs stuff */ 1597/* debugfs stuff */
1595extern struct dentry *usb_debug_root; 1598extern struct dentry *usb_debug_root;
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 54c446309a2a..51410e0200cf 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,8 +1,8 @@
1header-y += audio.h 1header-y += audio.h
2header-y += cdc.h 2header-y += cdc.h
3header-y += ch9.h 3header-y += ch9.h
4header-y += ch11.h
4header-y += gadgetfs.h 5header-y += gadgetfs.h
5header-y += midi.h 6header-y += midi.h
6header-y += g_printer.h 7header-y += g_printer.h
7header-y += tmc.h 8header-y += tmc.h
8header-y += vstusb.h
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index 6311fa2d9f82..ba99af275a31 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,6 +15,7 @@ struct usba_ep_data {
15 15
16struct usba_platform_data { 16struct usba_platform_data {
17 int vbus_pin; 17 int vbus_pin;
18 int vbus_pin_inverted;
18 int num_ep; 19 int num_ep;
19 struct usba_ep_data ep[0]; 20 struct usba_ep_data ep[0];
20}; 21};
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
new file mode 100644
index 000000000000..383b94ba8c20
--- /dev/null
+++ b/include/linux/usb/audio-v2.h
@@ -0,0 +1,423 @@
1/*
2 * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de>
3 *
4 * This software is distributed under the terms of the GNU General Public
5 * License ("GPL") version 2, as published by the Free Software Foundation.
6 *
7 * This file holds USB constants and structures defined
8 * by the USB Device Class Definition for Audio Devices in version 2.0.
9 * Comments below reference relevant sections of the documents contained
10 * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip
11 */
12
13#ifndef __LINUX_USB_AUDIO_V2_H
14#define __LINUX_USB_AUDIO_V2_H
15
16#include <linux/types.h>
17
18/* v1.0 and v2.0 of this standard have many things in common. For the rest
19 * of the definitions, please refer to audio.h */
20
21static inline bool uac2_control_is_readable(u32 bmControls, u8 control)
22{
23 return (bmControls >> (control * 2)) & 0x1;
24}
25
26static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
27{
28 return (bmControls >> (control * 2)) & 0x2;
29}
30
31/* 4.7.2.1 Clock Source Descriptor */
32
33struct uac_clock_source_descriptor {
34 __u8 bLength;
35 __u8 bDescriptorType;
36 __u8 bDescriptorSubtype;
37 __u8 bClockID;
38 __u8 bmAttributes;
39 __u8 bmControls;
40 __u8 bAssocTerminal;
41 __u8 iClockSource;
42} __attribute__((packed));
43
44/* bmAttribute fields */
45#define UAC_CLOCK_SOURCE_TYPE_EXT 0x0
46#define UAC_CLOCK_SOURCE_TYPE_INT_FIXED 0x1
47#define UAC_CLOCK_SOURCE_TYPE_INT_VAR 0x2
48#define UAC_CLOCK_SOURCE_TYPE_INT_PROG 0x3
49#define UAC_CLOCK_SOURCE_SYNCED_TO_SOF (1 << 2)
50
51/* 4.7.2.2 Clock Source Descriptor */
52
53struct uac_clock_selector_descriptor {
54 __u8 bLength;
55 __u8 bDescriptorType;
56 __u8 bDescriptorSubtype;
57 __u8 bClockID;
58 __u8 bNrInPins;
59 __u8 baCSourceID[];
60 /* bmControls, bAssocTerminal and iClockSource omitted */
61} __attribute__((packed));
62
63/* 4.7.2.3 Clock Multiplier Descriptor */
64
65struct uac_clock_multiplier_descriptor {
66 __u8 bLength;
67 __u8 bDescriptorType;
68 __u8 bDescriptorSubtype;
69 __u8 bClockID;
70 __u8 bCSourceID;
71 __u8 bmControls;
72 __u8 iClockMultiplier;
73} __attribute__((packed));
74
75/* 4.7.2.4 Input terminal descriptor */
76
77struct uac2_input_terminal_descriptor {
78 __u8 bLength;
79 __u8 bDescriptorType;
80 __u8 bDescriptorSubtype;
81 __u8 bTerminalID;
82 __u16 wTerminalType;
83 __u8 bAssocTerminal;
84 __u8 bCSourceID;
85 __u8 bNrChannels;
86 __u32 bmChannelConfig;
87 __u8 iChannelNames;
88 __u16 bmControls;
89 __u8 iTerminal;
90} __attribute__((packed));
91
92/* 4.7.2.5 Output terminal descriptor */
93
94struct uac2_output_terminal_descriptor {
95 __u8 bLength;
96 __u8 bDescriptorType;
97 __u8 bDescriptorSubtype;
98 __u8 bTerminalID;
99 __u16 wTerminalType;
100 __u8 bAssocTerminal;
101 __u8 bSourceID;
102 __u8 bCSourceID;
103 __u16 bmControls;
104 __u8 iTerminal;
105} __attribute__((packed));
106
107
108
109/* 4.7.2.8 Feature Unit Descriptor */
110
111struct uac2_feature_unit_descriptor {
112 __u8 bLength;
113 __u8 bDescriptorType;
114 __u8 bDescriptorSubtype;
115 __u8 bUnitID;
116 __u8 bSourceID;
117 /* bmaControls is actually u32,
118 * but u8 is needed for the hybrid parser */
119 __u8 bmaControls[0]; /* variable length */
120} __attribute__((packed));
121
122/* 4.9.2 Class-Specific AS Interface Descriptor */
123
124struct uac_as_header_descriptor_v2 {
125 __u8 bLength;
126 __u8 bDescriptorType;
127 __u8 bDescriptorSubtype;
128 __u8 bTerminalLink;
129 __u8 bmControls;
130 __u8 bFormatType;
131 __u32 bmFormats;
132 __u8 bNrChannels;
133 __u32 bmChannelConfig;
134 __u8 iChannelNames;
135} __attribute__((packed));
136
137/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */
138
139struct uac2_iso_endpoint_descriptor {
140 __u8 bLength; /* in bytes: 8 */
141 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
142 __u8 bDescriptorSubtype; /* EP_GENERAL */
143 __u8 bmAttributes;
144 __u8 bmControls;
145 __u8 bLockDelayUnits;
146 __le16 wLockDelay;
147} __attribute__((packed));
148
149#define UAC2_CONTROL_PITCH (3 << 0)
150#define UAC2_CONTROL_DATA_OVERRUN (3 << 2)
151#define UAC2_CONTROL_DATA_UNDERRUN (3 << 4)
152
153/* 6.1 Interrupt Data Message */
154
155#define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0)
156#define UAC2_INTERRUPT_DATA_MSG_EP (1 << 1)
157
158struct uac2_interrupt_data_msg {
159 __u8 bInfo;
160 __u8 bAttribute;
161 __le16 wValue;
162 __le16 wIndex;
163} __attribute__((packed));
164
165/* A.7 Audio Function Category Codes */
166#define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00
167#define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01
168#define UAC2_FUNCTION_HOME_THEATER 0x02
169#define UAC2_FUNCTION_MICROPHONE 0x03
170#define UAC2_FUNCTION_HEADSET 0x04
171#define UAC2_FUNCTION_TELEPHONE 0x05
172#define UAC2_FUNCTION_CONVERTER 0x06
173#define UAC2_FUNCTION_SOUND_RECORDER 0x07
174#define UAC2_FUNCTION_IO_BOX 0x08
175#define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09
176#define UAC2_FUNCTION_PRO_AUDIO 0x0a
177#define UAC2_FUNCTION_AUDIO_VIDEO 0x0b
178#define UAC2_FUNCTION_CONTROL_PANEL 0x0c
179#define UAC2_FUNCTION_OTHER 0xff
180
181/* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */
182/* see audio.h for the rest, which is identical to v1 */
183#define UAC2_EFFECT_UNIT 0x07
184#define UAC2_PROCESSING_UNIT_V2 0x08
185#define UAC2_EXTENSION_UNIT_V2 0x09
186#define UAC2_CLOCK_SOURCE 0x0a
187#define UAC2_CLOCK_SELECTOR 0x0b
188#define UAC2_CLOCK_MULTIPLIER 0x0c
189#define UAC2_SAMPLE_RATE_CONVERTER 0x0d
190
191/* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */
192/* see audio.h for the rest, which is identical to v1 */
193#define UAC2_ENCODER 0x03
194#define UAC2_DECODER 0x04
195
196/* A.11 Effect Unit Effect Types */
197#define UAC2_EFFECT_UNDEFINED 0x00
198#define UAC2_EFFECT_PARAM_EQ 0x01
199#define UAC2_EFFECT_REVERB 0x02
200#define UAC2_EFFECT_MOD_DELAY 0x03
201#define UAC2_EFFECT_DYN_RANGE_COMP 0x04
202
203/* A.12 Processing Unit Process Types */
204#define UAC2_PROCESS_UNDEFINED 0x00
205#define UAC2_PROCESS_UP_DOWNMIX 0x01
206#define UAC2_PROCESS_DOLBY_PROLOCIC 0x02
207#define UAC2_PROCESS_STEREO_EXTENDER 0x03
208
209/* A.14 Audio Class-Specific Request Codes */
210#define UAC2_CS_CUR 0x01
211#define UAC2_CS_RANGE 0x02
212#define UAC2_CS_MEM 0x03
213
214/* A.15 Encoder Type Codes */
215#define UAC2_ENCODER_UNDEFINED 0x00
216#define UAC2_ENCODER_OTHER 0x01
217#define UAC2_ENCODER_MPEG 0x02
218#define UAC2_ENCODER_AC3 0x03
219#define UAC2_ENCODER_WMA 0x04
220#define UAC2_ENCODER_DTS 0x05
221
222/* A.16 Decoder Type Codes */
223#define UAC2_DECODER_UNDEFINED 0x00
224#define UAC2_DECODER_OTHER 0x01
225#define UAC2_DECODER_MPEG 0x02
226#define UAC2_DECODER_AC3 0x03
227#define UAC2_DECODER_WMA 0x04
228#define UAC2_DECODER_DTS 0x05
229
230/* A.17.1 Clock Source Control Selectors */
231#define UAC2_CS_UNDEFINED 0x00
232#define UAC2_CS_CONTROL_SAM_FREQ 0x01
233#define UAC2_CS_CONTROL_CLOCK_VALID 0x02
234
235/* A.17.2 Clock Selector Control Selectors */
236#define UAC2_CX_UNDEFINED 0x00
237#define UAC2_CX_CLOCK_SELECTOR 0x01
238
239/* A.17.3 Clock Multiplier Control Selectors */
240#define UAC2_CM_UNDEFINED 0x00
241#define UAC2_CM_NUMERATOR 0x01
242#define UAC2_CM_DENOMINTATOR 0x02
243
244/* A.17.4 Terminal Control Selectors */
245#define UAC2_TE_UNDEFINED 0x00
246#define UAC2_TE_COPY_PROTECT 0x01
247#define UAC2_TE_CONNECTOR 0x02
248#define UAC2_TE_OVERLOAD 0x03
249#define UAC2_TE_CLUSTER 0x04
250#define UAC2_TE_UNDERFLOW 0x05
251#define UAC2_TE_OVERFLOW 0x06
252#define UAC2_TE_LATENCY 0x07
253
254/* A.17.5 Mixer Control Selectors */
255#define UAC2_MU_UNDEFINED 0x00
256#define UAC2_MU_MIXER 0x01
257#define UAC2_MU_CLUSTER 0x02
258#define UAC2_MU_UNDERFLOW 0x03
259#define UAC2_MU_OVERFLOW 0x04
260#define UAC2_MU_LATENCY 0x05
261
262/* A.17.6 Selector Control Selectors */
263#define UAC2_SU_UNDEFINED 0x00
264#define UAC2_SU_SELECTOR 0x01
265#define UAC2_SU_LATENCY 0x02
266
267/* A.17.7 Feature Unit Control Selectors */
268/* see audio.h for the rest, which is identical to v1 */
269#define UAC2_FU_INPUT_GAIN 0x0b
270#define UAC2_FU_INPUT_GAIN_PAD 0x0c
271#define UAC2_FU_PHASE_INVERTER 0x0d
272#define UAC2_FU_UNDERFLOW 0x0e
273#define UAC2_FU_OVERFLOW 0x0f
274#define UAC2_FU_LATENCY 0x10
275
276/* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */
277#define UAC2_PE_UNDEFINED 0x00
278#define UAC2_PE_ENABLE 0x01
279#define UAC2_PE_CENTERFREQ 0x02
280#define UAC2_PE_QFACTOR 0x03
281#define UAC2_PE_GAIN 0x04
282#define UAC2_PE_UNDERFLOW 0x05
283#define UAC2_PE_OVERFLOW 0x06
284#define UAC2_PE_LATENCY 0x07
285
286/* A.17.8.2 Reverberation Effect Unit Control Selectors */
287#define UAC2_RV_UNDEFINED 0x00
288#define UAC2_RV_ENABLE 0x01
289#define UAC2_RV_TYPE 0x02
290#define UAC2_RV_LEVEL 0x03
291#define UAC2_RV_TIME 0x04
292#define UAC2_RV_FEEDBACK 0x05
293#define UAC2_RV_PREDELAY 0x06
294#define UAC2_RV_DENSITY 0x07
295#define UAC2_RV_HIFREQ_ROLLOFF 0x08
296#define UAC2_RV_UNDERFLOW 0x09
297#define UAC2_RV_OVERFLOW 0x0a
298#define UAC2_RV_LATENCY 0x0b
299
300/* A.17.8.3 Modulation Delay Effect Control Selectors */
301#define UAC2_MD_UNDEFINED 0x00
302#define UAC2_MD_ENABLE 0x01
303#define UAC2_MD_BALANCE 0x02
304#define UAC2_MD_RATE 0x03
305#define UAC2_MD_DEPTH 0x04
306#define UAC2_MD_TIME 0x05
307#define UAC2_MD_FEEDBACK 0x06
308#define UAC2_MD_UNDERFLOW 0x07
309#define UAC2_MD_OVERFLOW 0x08
310#define UAC2_MD_LATENCY 0x09
311
312/* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */
313#define UAC2_DR_UNDEFINED 0x00
314#define UAC2_DR_ENABLE 0x01
315#define UAC2_DR_COMPRESSION_RATE 0x02
316#define UAC2_DR_MAXAMPL 0x03
317#define UAC2_DR_THRESHOLD 0x04
318#define UAC2_DR_ATTACK_TIME 0x05
319#define UAC2_DR_RELEASE_TIME 0x06
320#define UAC2_DR_UNDEFLOW 0x07
321#define UAC2_DR_OVERFLOW 0x08
322#define UAC2_DR_LATENCY 0x09
323
324/* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */
325#define UAC2_UD_UNDEFINED 0x00
326#define UAC2_UD_ENABLE 0x01
327#define UAC2_UD_MODE_SELECT 0x02
328#define UAC2_UD_CLUSTER 0x03
329#define UAC2_UD_UNDERFLOW 0x04
330#define UAC2_UD_OVERFLOW 0x05
331#define UAC2_UD_LATENCY 0x06
332
333/* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */
334#define UAC2_DP_UNDEFINED 0x00
335#define UAC2_DP_ENABLE 0x01
336#define UAC2_DP_MODE_SELECT 0x02
337#define UAC2_DP_CLUSTER 0x03
338#define UAC2_DP_UNDERFFLOW 0x04
339#define UAC2_DP_OVERFLOW 0x05
340#define UAC2_DP_LATENCY 0x06
341
342/* A.17.9.3 Stereo Expander Processing Unit Control Selectors */
343#define UAC2_ST_EXT_UNDEFINED 0x00
344#define UAC2_ST_EXT_ENABLE 0x01
345#define UAC2_ST_EXT_WIDTH 0x02
346#define UAC2_ST_EXT_UNDEFLOW 0x03
347#define UAC2_ST_EXT_OVERFLOW 0x04
348#define UAC2_ST_EXT_LATENCY 0x05
349
350/* A.17.10 Extension Unit Control Selectors */
351#define UAC2_XU_UNDEFINED 0x00
352#define UAC2_XU_ENABLE 0x01
353#define UAC2_XU_CLUSTER 0x02
354#define UAC2_XU_UNDERFLOW 0x03
355#define UAC2_XU_OVERFLOW 0x04
356#define UAC2_XU_LATENCY 0x05
357
358/* A.17.11 AudioStreaming Interface Control Selectors */
359#define UAC2_AS_UNDEFINED 0x00
360#define UAC2_AS_ACT_ALT_SETTING 0x01
361#define UAC2_AS_VAL_ALT_SETTINGS 0x02
362#define UAC2_AS_AUDIO_DATA_FORMAT 0x03
363
364/* A.17.12 Encoder Control Selectors */
365#define UAC2_EN_UNDEFINED 0x00
366#define UAC2_EN_BIT_RATE 0x01
367#define UAC2_EN_QUALITY 0x02
368#define UAC2_EN_VBR 0x03
369#define UAC2_EN_TYPE 0x04
370#define UAC2_EN_UNDERFLOW 0x05
371#define UAC2_EN_OVERFLOW 0x06
372#define UAC2_EN_ENCODER_ERROR 0x07
373#define UAC2_EN_PARAM1 0x08
374#define UAC2_EN_PARAM2 0x09
375#define UAC2_EN_PARAM3 0x0a
376#define UAC2_EN_PARAM4 0x0b
377#define UAC2_EN_PARAM5 0x0c
378#define UAC2_EN_PARAM6 0x0d
379#define UAC2_EN_PARAM7 0x0e
380#define UAC2_EN_PARAM8 0x0f
381
382/* A.17.13.1 MPEG Decoder Control Selectors */
383#define UAC2_MPEG_UNDEFINED 0x00
384#define UAC2_MPEG_DUAL_CHANNEL 0x01
385#define UAC2_MPEG_SECOND_STEREO 0x02
386#define UAC2_MPEG_MULTILINGUAL 0x03
387#define UAC2_MPEG_DYN_RANGE 0x04
388#define UAC2_MPEG_SCALING 0x05
389#define UAC2_MPEG_HILO_SCALING 0x06
390#define UAC2_MPEG_UNDERFLOW 0x07
391#define UAC2_MPEG_OVERFLOW 0x08
392#define UAC2_MPEG_DECODER_ERROR 0x09
393
394/* A17.13.2 AC3 Decoder Control Selectors */
395#define UAC2_AC3_UNDEFINED 0x00
396#define UAC2_AC3_MODE 0x01
397#define UAC2_AC3_DYN_RANGE 0x02
398#define UAC2_AC3_SCALING 0x03
399#define UAC2_AC3_HILO_SCALING 0x04
400#define UAC2_AC3_UNDERFLOW 0x05
401#define UAC2_AC3_OVERFLOW 0x06
402#define UAC2_AC3_DECODER_ERROR 0x07
403
404/* A17.13.3 WMA Decoder Control Selectors */
405#define UAC2_WMA_UNDEFINED 0x00
406#define UAC2_WMA_UNDERFLOW 0x01
407#define UAC2_WMA_OVERFLOW 0x02
408#define UAC2_WMA_DECODER_ERROR 0x03
409
410/* A17.13.4 DTS Decoder Control Selectors */
411#define UAC2_DTS_UNDEFINED 0x00
412#define UAC2_DTS_UNDERFLOW 0x01
413#define UAC2_DTS_OVERFLOW 0x02
414#define UAC2_DTS_DECODER_ERROR 0x03
415
416/* A17.14 Endpoint Control Selectors */
417#define UAC2_EP_CS_UNDEFINED 0x00
418#define UAC2_EP_CS_PITCH 0x01
419#define UAC2_EP_CS_DATA_OVERRUN 0x02
420#define UAC2_EP_CS_DATA_UNDERRUN 0x03
421
422#endif /* __LINUX_USB_AUDIO_V2_H */
423
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index eaf9dffe0a01..c51200c715e5 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -13,6 +13,9 @@
13 * Comments below reference relevant sections of that document: 13 * Comments below reference relevant sections of that document:
14 * 14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf 15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 *
17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions.
16 */ 19 */
17 20
18#ifndef __LINUX_USB_AUDIO_H 21#ifndef __LINUX_USB_AUDIO_H
@@ -20,6 +23,10 @@
20 23
21#include <linux/types.h> 24#include <linux/types.h>
22 25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
23/* A.2 Audio Interface Subclass Codes */ 30/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 31#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
@@ -32,14 +39,23 @@
32#define UAC_MIXER_UNIT 0x04 39#define UAC_MIXER_UNIT 0x04
33#define UAC_SELECTOR_UNIT 0x05 40#define UAC_SELECTOR_UNIT 0x05
34#define UAC_FEATURE_UNIT 0x06 41#define UAC_FEATURE_UNIT 0x06
35#define UAC_PROCESSING_UNIT 0x07 42#define UAC_PROCESSING_UNIT_V1 0x07
36#define UAC_EXTENSION_UNIT 0x08 43#define UAC_EXTENSION_UNIT_V1 0x08
37 44
38/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
39#define UAC_AS_GENERAL 0x01 46#define UAC_AS_GENERAL 0x01
40#define UAC_FORMAT_TYPE 0x02 47#define UAC_FORMAT_TYPE 0x02
41#define UAC_FORMAT_SPECIFIC 0x03 48#define UAC_FORMAT_SPECIFIC 0x03
42 49
50/* A.7 Processing Unit Process Types */
51#define UAC_PROCESS_UNDEFINED 0x00
52#define UAC_PROCESS_UP_DOWNMIX 0x01
53#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54#define UAC_PROCESS_STEREO_EXTENDER 0x03
55#define UAC_PROCESS_REVERB 0x04
56#define UAC_PROCESS_CHORUS 0x05
57#define UAC_PROCESS_DYN_RANGE_COMP 0x06
58
43/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ 59/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
44#define UAC_EP_GENERAL 0x01 60#define UAC_EP_GENERAL 0x01
45 61
@@ -66,6 +82,60 @@
66 82
67#define UAC_GET_STAT 0xff 83#define UAC_GET_STAT 0xff
68 84
85/* A.10 Control Selector Codes */
86
87/* A.10.1 Terminal Control Selectors */
88#define UAC_TERM_COPY_PROTECT 0x01
89
90/* A.10.2 Feature Unit Control Selectors */
91#define UAC_FU_MUTE 0x01
92#define UAC_FU_VOLUME 0x02
93#define UAC_FU_BASS 0x03
94#define UAC_FU_MID 0x04
95#define UAC_FU_TREBLE 0x05
96#define UAC_FU_GRAPHIC_EQUALIZER 0x06
97#define UAC_FU_AUTOMATIC_GAIN 0x07
98#define UAC_FU_DELAY 0x08
99#define UAC_FU_BASS_BOOST 0x09
100#define UAC_FU_LOUDNESS 0x0a
101
102#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
103
104/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
105#define UAC_UD_ENABLE 0x01
106#define UAC_UD_MODE_SELECT 0x02
107
108/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
109#define UAC_DP_ENABLE 0x01
110#define UAC_DP_MODE_SELECT 0x02
111
112/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
113#define UAC_3D_ENABLE 0x01
114#define UAC_3D_SPACE 0x02
115
116/* A.10.3.4 Reverberation Processing Unit Control Selectors */
117#define UAC_REVERB_ENABLE 0x01
118#define UAC_REVERB_LEVEL 0x02
119#define UAC_REVERB_TIME 0x03
120#define UAC_REVERB_FEEDBACK 0x04
121
122/* A.10.3.5 Chorus Processing Unit Control Selectors */
123#define UAC_CHORUS_ENABLE 0x01
124#define UAC_CHORUS_LEVEL 0x02
125#define UAC_CHORUS_RATE 0x03
126#define UAC_CHORUS_DEPTH 0x04
127
128/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
129#define UAC_DCR_ENABLE 0x01
130#define UAC_DCR_RATE 0x02
131#define UAC_DCR_MAXAMPL 0x03
132#define UAC_DCR_THRESHOLD 0x04
133#define UAC_DCR_ATTACK_TIME 0x05
134#define UAC_DCR_RELEASE_TIME 0x06
135
136/* A.10.4 Extension Unit Control Selectors */
137#define UAC_XU_ENABLE 0x01
138
69/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ 139/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
70#define UAC_MS_HEADER 0x01 140#define UAC_MS_HEADER 0x01
71#define UAC_MIDI_IN_JACK 0x02 141#define UAC_MIDI_IN_JACK 0x02
@@ -81,7 +151,7 @@
81 151
82/* Terminal Control Selectors */ 152/* Terminal Control Selectors */
83/* 4.3.2 Class-Specific AC Interface Descriptor */ 153/* 4.3.2 Class-Specific AC Interface Descriptor */
84struct uac_ac_header_descriptor { 154struct uac_ac_header_descriptor_v1 {
85 __u8 bLength; /* 8 + n */ 155 __u8 bLength; /* 8 + n */
86 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
87 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ 157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
@@ -94,8 +164,8 @@ struct uac_ac_header_descriptor {
94#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) 164#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
95 165
96/* As above, but more useful for defining your own descriptors: */ 166/* As above, but more useful for defining your own descriptors: */
97#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ 167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
98struct uac_ac_header_descriptor_##n { \ 168struct uac_ac_header_descriptor_v1_##n { \
99 __u8 bLength; \ 169 __u8 bLength; \
100 __u8 bDescriptorType; \ 170 __u8 bDescriptorType; \
101 __u8 bDescriptorSubtype; \ 171 __u8 bDescriptorSubtype; \
@@ -130,8 +200,12 @@ struct uac_input_terminal_descriptor {
130#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 200#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
131#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 201#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
132 202
203/* Terminals - control selectors */
204
205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
206
133/* 4.3.2.2 Output Terminal Descriptor */ 207/* 4.3.2.2 Output Terminal Descriptor */
134struct uac_output_terminal_descriptor { 208struct uac_output_terminal_descriptor_v1 {
135 __u8 bLength; /* in bytes: 9 */ 209 __u8 bLength; /* in bytes: 9 */
136 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
137 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -158,7 +232,7 @@ struct uac_output_terminal_descriptor {
158#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 232#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
159 233
160/* As above, but more useful for defining your own descriptors: */ 234/* As above, but more useful for defining your own descriptors: */
161#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ 235#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
162struct uac_feature_unit_descriptor_##ch { \ 236struct uac_feature_unit_descriptor_##ch { \
163 __u8 bLength; \ 237 __u8 bLength; \
164 __u8 bDescriptorType; \ 238 __u8 bDescriptorType; \
@@ -170,8 +244,158 @@ struct uac_feature_unit_descriptor_##ch { \
170 __u8 iFeature; \ 244 __u8 iFeature; \
171} __attribute__ ((packed)) 245} __attribute__ ((packed))
172 246
247/* 4.3.2.3 Mixer Unit Descriptor */
248struct uac_mixer_unit_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubtype;
252 __u8 bUnitID;
253 __u8 bNrInPins;
254 __u8 baSourceID[];
255} __attribute__ ((packed));
256
257static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
258{
259 return desc->baSourceID[desc->bNrInPins];
260}
261
262static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
263 int protocol)
264{
265 if (protocol == UAC_VERSION_1)
266 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
267 desc->baSourceID[desc->bNrInPins + 1];
268 else
269 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
270 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
271 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
272 (desc->baSourceID[desc->bNrInPins + 1]);
273}
274
275static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
276 int protocol)
277{
278 return (protocol == UAC_VERSION_1) ?
279 desc->baSourceID[desc->bNrInPins + 3] :
280 desc->baSourceID[desc->bNrInPins + 5];
281}
282
283static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
284 int protocol)
285{
286 return (protocol == UAC_VERSION_1) ?
287 &desc->baSourceID[desc->bNrInPins + 4] :
288 &desc->baSourceID[desc->bNrInPins + 6];
289}
290
291static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
292{
293 __u8 *raw = (__u8 *) desc;
294 return raw[desc->bLength - 1];
295}
296
297/* 4.3.2.4 Selector Unit Descriptor */
298struct uac_selector_unit_descriptor {
299 __u8 bLength;
300 __u8 bDescriptorType;
301 __u8 bDescriptorSubtype;
302 __u8 bUintID;
303 __u8 bNrInPins;
304 __u8 baSourceID[];
305} __attribute__ ((packed));
306
307static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
308{
309 __u8 *raw = (__u8 *) desc;
310 return raw[desc->bLength - 1];
311}
312
313/* 4.3.2.5 Feature Unit Descriptor */
314struct uac_feature_unit_descriptor {
315 __u8 bLength;
316 __u8 bDescriptorType;
317 __u8 bDescriptorSubtype;
318 __u8 bUnitID;
319 __u8 bSourceID;
320 __u8 bControlSize;
321 __u8 bmaControls[0]; /* variable length */
322} __attribute__((packed));
323
324static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
325{
326 __u8 *raw = (__u8 *) desc;
327 return raw[desc->bLength - 1];
328}
329
330/* 4.3.2.6 Processing Unit Descriptors */
331struct uac_processing_unit_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype;
335 __u8 bUnitID;
336 __u16 wProcessType;
337 __u8 bNrInPins;
338 __u8 baSourceID[];
339} __attribute__ ((packed));
340
341static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
342{
343 return desc->baSourceID[desc->bNrInPins];
344}
345
346static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
347 int protocol)
348{
349 if (protocol == UAC_VERSION_1)
350 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
351 desc->baSourceID[desc->bNrInPins + 1];
352 else
353 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
354 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
355 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
356 (desc->baSourceID[desc->bNrInPins + 1]);
357}
358
359static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
360 int protocol)
361{
362 return (protocol == UAC_VERSION_1) ?
363 desc->baSourceID[desc->bNrInPins + 3] :
364 desc->baSourceID[desc->bNrInPins + 5];
365}
366
367static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
368 int protocol)
369{
370 return (protocol == UAC_VERSION_1) ?
371 desc->baSourceID[desc->bNrInPins + 4] :
372 desc->baSourceID[desc->bNrInPins + 6];
373}
374
375static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
376 int protocol)
377{
378 return (protocol == UAC_VERSION_1) ?
379 &desc->baSourceID[desc->bNrInPins + 5] :
380 &desc->baSourceID[desc->bNrInPins + 7];
381}
382
383static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
384 int protocol)
385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size];
388}
389
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol)
392{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
395}
396
173/* 4.5.2 Class-Specific AS Interface Descriptor */ 397/* 4.5.2 Class-Specific AS Interface Descriptor */
174struct uac_as_header_descriptor { 398struct uac_as_header_descriptor_v1 {
175 __u8 bLength; /* in bytes: 7 */ 399 __u8 bLength; /* in bytes: 7 */
176 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
177 __u8 bDescriptorSubtype; /* AS_GENERAL */ 401 __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -217,7 +441,7 @@ struct uac_format_type_i_discrete_descriptor {
217 __u8 tSamFreq[][3]; 441 __u8 tSamFreq[][3];
218} __attribute__ ((packed)); 442} __attribute__ ((packed));
219 443
220#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ 444#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
221struct uac_format_type_i_discrete_descriptor_##n { \ 445struct uac_format_type_i_discrete_descriptor_##n { \
222 __u8 bLength; \ 446 __u8 bLength; \
223 __u8 bDescriptorType; \ 447 __u8 bDescriptorType; \
@@ -232,11 +456,61 @@ struct uac_format_type_i_discrete_descriptor_##n { \
232 456
233#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) 457#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
234 458
459struct uac_format_type_i_ext_descriptor {
460 __u8 bLength;
461 __u8 bDescriptorType;
462 __u8 bDescriptorSubtype;
463 __u8 bFormatType;
464 __u8 bSubslotSize;
465 __u8 bBitResolution;
466 __u8 bHeaderLength;
467 __u8 bControlSize;
468 __u8 bSideBandProtocol;
469} __attribute__((packed));
470
471/* Formats - Audio Data Format Type I Codes */
472
473#define UAC_FORMAT_TYPE_II_MPEG 0x1001
474#define UAC_FORMAT_TYPE_II_AC3 0x1002
475
476struct uac_format_type_ii_discrete_descriptor {
477 __u8 bLength;
478 __u8 bDescriptorType;
479 __u8 bDescriptorSubtype;
480 __u8 bFormatType;
481 __le16 wMaxBitRate;
482 __le16 wSamplesPerFrame;
483 __u8 bSamFreqType;
484 __u8 tSamFreq[][3];
485} __attribute__((packed));
486
487struct uac_format_type_ii_ext_descriptor {
488 __u8 bLength;
489 __u8 bDescriptorType;
490 __u8 bDescriptorSubtype;
491 __u8 bFormatType;
492 __u16 wMaxBitRate;
493 __u16 wSamplesPerFrame;
494 __u8 bHeaderLength;
495 __u8 bSideBandProtocol;
496} __attribute__((packed));
497
498/* type III */
499#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
500#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
501#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
502#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
503#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
504#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
505
235/* Formats - A.2 Format Type Codes */ 506/* Formats - A.2 Format Type Codes */
236#define UAC_FORMAT_TYPE_UNDEFINED 0x0 507#define UAC_FORMAT_TYPE_UNDEFINED 0x0
237#define UAC_FORMAT_TYPE_I 0x1 508#define UAC_FORMAT_TYPE_I 0x1
238#define UAC_FORMAT_TYPE_II 0x2 509#define UAC_FORMAT_TYPE_II 0x2
239#define UAC_FORMAT_TYPE_III 0x3 510#define UAC_FORMAT_TYPE_III 0x3
511#define UAC_EXT_FORMAT_TYPE_I 0x81
512#define UAC_EXT_FORMAT_TYPE_II 0x82
513#define UAC_EXT_FORMAT_TYPE_III 0x83
240 514
241struct uac_iso_endpoint_descriptor { 515struct uac_iso_endpoint_descriptor {
242 __u8 bLength; /* in bytes: 7 */ 516 __u8 bLength; /* in bytes: 7 */
@@ -245,36 +519,27 @@ struct uac_iso_endpoint_descriptor {
245 __u8 bmAttributes; 519 __u8 bmAttributes;
246 __u8 bLockDelayUnits; 520 __u8 bLockDelayUnits;
247 __le16 wLockDelay; 521 __le16 wLockDelay;
248}; 522} __attribute__((packed));
249#define UAC_ISO_ENDPOINT_DESC_SIZE 7 523#define UAC_ISO_ENDPOINT_DESC_SIZE 7
250 524
251#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 525#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
252#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 526#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
253#define UAC_EP_CS_ATTR_FILL_MAX 0x80 527#define UAC_EP_CS_ATTR_FILL_MAX 0x80
254 528
255/* A.10.2 Feature Unit Control Selectors */ 529/* status word format (3.7.1.1) */
256#define UAC_FU_CONTROL_UNDEFINED 0x00 530
257#define UAC_MUTE_CONTROL 0x01 531#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
258#define UAC_VOLUME_CONTROL 0x02 532#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
259#define UAC_BASS_CONTROL 0x03 533#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
260#define UAC_MID_CONTROL 0x04 534#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
261#define UAC_TREBLE_CONTROL 0x05 535
262#define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06 536#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
263#define UAC_AUTOMATIC_GAIN_CONTROL 0x07 537#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
264#define UAC_DELAY_CONTROL 0x08 538
265#define UAC_BASS_BOOST_CONTROL 0x09 539struct uac1_status_word {
266#define UAC_LOUDNESS_CONTROL 0x0a 540 __u8 bStatusType;
267 541 __u8 bOriginator;
268#define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1)) 542} __attribute__((packed));
269#define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1))
270#define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1))
271#define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1))
272#define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1))
273#define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1))
274#define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1))
275#define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1))
276#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1))
277#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1))
278 543
279#ifdef __KERNEL__ 544#ifdef __KERNEL__
280 545
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index c24124a42ce5..c117a68d04a7 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -18,6 +18,7 @@
18#define USB_CDC_SUBCLASS_MDLM 0x0a 18#define USB_CDC_SUBCLASS_MDLM 0x0a
19#define USB_CDC_SUBCLASS_OBEX 0x0b 19#define USB_CDC_SUBCLASS_OBEX 0x0b
20#define USB_CDC_SUBCLASS_EEM 0x0c 20#define USB_CDC_SUBCLASS_EEM 0x0c
21#define USB_CDC_SUBCLASS_NCM 0x0d
21 22
22#define USB_CDC_PROTO_NONE 0 23#define USB_CDC_PROTO_NONE 0
23 24
@@ -49,6 +50,7 @@
49#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ 50#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
50#define USB_CDC_DMM_TYPE 0x14 51#define USB_CDC_DMM_TYPE 0x14
51#define USB_CDC_OBEX_TYPE 0x15 52#define USB_CDC_OBEX_TYPE 0x15
53#define USB_CDC_NCM_TYPE 0x1a
52 54
53/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ 55/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
54struct usb_cdc_header_desc { 56struct usb_cdc_header_desc {
@@ -174,6 +176,15 @@ struct usb_cdc_obex_desc {
174 __le16 bcdVersion; 176 __le16 bcdVersion;
175} __attribute__ ((packed)); 177} __attribute__ ((packed));
176 178
179/* "NCM Control Model Functional Descriptor" */
180struct usb_cdc_ncm_desc {
181 __u8 bLength;
182 __u8 bDescriptorType;
183 __u8 bDescriptorSubType;
184
185 __le16 bcdNcmVersion;
186 __u8 bmNetworkCapabilities;
187} __attribute__ ((packed));
177/*-------------------------------------------------------------------------*/ 188/*-------------------------------------------------------------------------*/
178 189
179/* 190/*
@@ -197,6 +208,17 @@ struct usb_cdc_obex_desc {
197#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 208#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
198#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 209#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
199#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 210#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
211#define USB_CDC_GET_NTB_PARAMETERS 0x80
212#define USB_CDC_GET_NET_ADDRESS 0x81
213#define USB_CDC_SET_NET_ADDRESS 0x82
214#define USB_CDC_GET_NTB_FORMAT 0x83
215#define USB_CDC_SET_NTB_FORMAT 0x84
216#define USB_CDC_GET_NTB_INPUT_SIZE 0x85
217#define USB_CDC_SET_NTB_INPUT_SIZE 0x86
218#define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87
219#define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88
220#define USB_CDC_GET_CRC_MODE 0x89
221#define USB_CDC_SET_CRC_MODE 0x8a
200 222
201/* Line Coding Structure from CDC spec 6.2.13 */ 223/* Line Coding Structure from CDC spec 6.2.13 */
202struct usb_cdc_line_coding { 224struct usb_cdc_line_coding {
@@ -247,4 +269,76 @@ struct usb_cdc_notification {
247 __le16 wLength; 269 __le16 wLength;
248} __attribute__ ((packed)); 270} __attribute__ ((packed));
249 271
272/*-------------------------------------------------------------------------*/
273
274/*
275 * Class Specific structures and constants
276 *
277 * CDC NCM parameter structure, CDC NCM subclass 6.2.1
278 *
279 */
280
281struct usb_cdc_ncm_ntb_parameter {
282 __le16 wLength;
283 __le16 bmNtbFormatSupported;
284 __le32 dwNtbInMaxSize;
285 __le16 wNdpInDivisor;
286 __le16 wNdpInPayloadRemainder;
287 __le16 wNdpInAlignment;
288 __le16 wPadding1;
289 __le32 dwNtbOutMaxSize;
290 __le16 wNdpOutDivisor;
291 __le16 wNdpOutPayloadRemainder;
292 __le16 wNdpOutAlignment;
293 __le16 wPadding2;
294} __attribute__ ((packed));
295
296/*
297 * CDC NCM transfer headers, CDC NCM subclass 3.2
298 */
299
300#define NCM_NTH16_SIGN 0x484D434E /* NCMH */
301#define NCM_NTH32_SIGN 0x686D636E /* ncmh */
302
303struct usb_cdc_ncm_nth16 {
304 __le32 dwSignature;
305 __le16 wHeaderLength;
306 __le16 wSequence;
307 __le16 wBlockLength;
308 __le16 wFpIndex;
309} __attribute__ ((packed));
310
311struct usb_cdc_ncm_nth32 {
312 __le32 dwSignature;
313 __le16 wHeaderLength;
314 __le16 wSequence;
315 __le32 dwBlockLength;
316 __le32 dwFpIndex;
317} __attribute__ ((packed));
318
319/*
320 * CDC NCM datagram pointers, CDC NCM subclass 3.3
321 */
322
323#define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */
324#define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */
325#define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
326#define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
327
328struct usb_cdc_ncm_ndp16 {
329 __le32 dwSignature;
330 __le16 wLength;
331 __le16 wNextFpIndex;
332 __u8 data[0];
333} __attribute__ ((packed));
334
335struct usb_cdc_ncm_ndp32 {
336 __le32 dwSignature;
337 __le16 wLength;
338 __le16 wReserved6;
339 __le32 dwNextFpIndex;
340 __le32 dwReserved12;
341 __u8 data[0];
342} __attribute__ ((packed));
343
250#endif /* __LINUX_USB_CDC_H */ 344#endif /* __LINUX_USB_CDC_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
new file mode 100644
index 000000000000..119194c85d10
--- /dev/null
+++ b/include/linux/usb/ch11.h
@@ -0,0 +1,167 @@
1/*
2 * This file holds Hub protocol constants and data structures that are
3 * defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
4 *
5 * It is used/shared between the USB core, the HCDs and couple of other USB
6 * drivers.
7 */
8
9#ifndef __LINUX_CH11_H
10#define __LINUX_CH11_H
11
12#include <linux/types.h> /* __u8 etc */
13
14/*
15 * Hub request types
16 */
17
18#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
19#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
20
21/*
22 * Hub class requests
23 * See USB 2.0 spec Table 11-16
24 */
25#define HUB_CLEAR_TT_BUFFER 8
26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11
29
30/*
31 * Hub Class feature numbers
32 * See USB 2.0 spec Table 11-17
33 */
34#define C_HUB_LOCAL_POWER 0
35#define C_HUB_OVER_CURRENT 1
36
37/*
38 * Port feature numbers
39 * See USB 2.0 spec Table 11-17
40 */
41#define USB_PORT_FEAT_CONNECTION 0
42#define USB_PORT_FEAT_ENABLE 1
43#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
44#define USB_PORT_FEAT_OVER_CURRENT 3
45#define USB_PORT_FEAT_RESET 4
46#define USB_PORT_FEAT_L1 5 /* L1 suspend */
47#define USB_PORT_FEAT_POWER 8
48#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
49#define USB_PORT_FEAT_C_CONNECTION 16
50#define USB_PORT_FEAT_C_ENABLE 17
51#define USB_PORT_FEAT_C_SUSPEND 18
52#define USB_PORT_FEAT_C_OVER_CURRENT 19
53#define USB_PORT_FEAT_C_RESET 20
54#define USB_PORT_FEAT_TEST 21
55#define USB_PORT_FEAT_INDICATOR 22
56#define USB_PORT_FEAT_C_PORT_L1 23
57
58/*
59 * Hub Status and Hub Change results
60 * See USB 2.0 spec Table 11-19 and Table 11-20
61 */
62struct usb_port_status {
63 __le16 wPortStatus;
64 __le16 wPortChange;
65} __attribute__ ((packed));
66
67/*
68 * wPortStatus bit field
69 * See USB 2.0 spec Table 11-21
70 */
71#define USB_PORT_STAT_CONNECTION 0x0001
72#define USB_PORT_STAT_ENABLE 0x0002
73#define USB_PORT_STAT_SUSPEND 0x0004
74#define USB_PORT_STAT_OVERCURRENT 0x0008
75#define USB_PORT_STAT_RESET 0x0010
76#define USB_PORT_STAT_L1 0x0020
77/* bits 6 to 7 are reserved */
78#define USB_PORT_STAT_POWER 0x0100
79#define USB_PORT_STAT_LOW_SPEED 0x0200
80#define USB_PORT_STAT_HIGH_SPEED 0x0400
81#define USB_PORT_STAT_TEST 0x0800
82#define USB_PORT_STAT_INDICATOR 0x1000
83/* bits 13 to 15 are reserved */
84#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */
85
86/*
87 * wPortChange bit field
88 * See USB 2.0 spec Table 11-22
89 * Bits 0 to 4 shown, bits 5 to 15 are reserved
90 */
91#define USB_PORT_STAT_C_CONNECTION 0x0001
92#define USB_PORT_STAT_C_ENABLE 0x0002
93#define USB_PORT_STAT_C_SUSPEND 0x0004
94#define USB_PORT_STAT_C_OVERCURRENT 0x0008
95#define USB_PORT_STAT_C_RESET 0x0010
96#define USB_PORT_STAT_C_L1 0x0020
97
98/*
99 * wHubCharacteristics (masks)
100 * See USB 2.0 spec Table 11-13, offset 3
101 */
102#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
103#define HUB_CHAR_COMPOUND 0x0004 /* D2 */
104#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
105#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
106#define HUB_CHAR_PORTIND 0x0080 /* D7 */
107
108struct usb_hub_status {
109 __le16 wHubStatus;
110 __le16 wHubChange;
111} __attribute__ ((packed));
112
113/*
114 * Hub Status & Hub Change bit masks
115 * See USB 2.0 spec Table 11-19 and Table 11-20
116 * Bits 0 and 1 for wHubStatus and wHubChange
117 * Bits 2 to 15 are reserved for both
118 */
119#define HUB_STATUS_LOCAL_POWER 0x0001
120#define HUB_STATUS_OVERCURRENT 0x0002
121#define HUB_CHANGE_LOCAL_POWER 0x0001
122#define HUB_CHANGE_OVERCURRENT 0x0002
123
124
125/*
126 * Hub descriptor
127 * See USB 2.0 spec Table 11-13
128 */
129
130#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
131#define USB_DT_HUB_NONVAR_SIZE 7
132
133struct usb_hub_descriptor {
134 __u8 bDescLength;
135 __u8 bDescriptorType;
136 __u8 bNbrPorts;
137 __le16 wHubCharacteristics;
138 __u8 bPwrOn2PwrGood;
139 __u8 bHubContrCurrent;
140 /* add 1 bit for hub status change; round to bytes */
141 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
142 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
143} __attribute__ ((packed));
144
145
146/* port indicator status selectors, tables 11-7 and 11-25 */
147#define HUB_LED_AUTO 0
148#define HUB_LED_AMBER 1
149#define HUB_LED_GREEN 2
150#define HUB_LED_OFF 3
151
152enum hub_led_mode {
153 INDICATOR_AUTO = 0,
154 INDICATOR_CYCLE,
155 /* software blinks for attention: software, hardware, reserved */
156 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
157 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
158 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
159} __attribute__ ((packed));
160
161/* Transaction Translator Think Times, in bits */
162#define HUB_TTTT_8_BITS 0x00
163#define HUB_TTTT_16_BITS 0x20
164#define HUB_TTTT_24_BITS 0x40
165#define HUB_TTTT_32_BITS 0x60
166
167#endif /* __LINUX_CH11_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 94012e649d86..da2ed77d3e8d 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -191,6 +191,8 @@ struct usb_ctrlrequest {
191#define USB_DT_WIRE_ADAPTER 0x21 191#define USB_DT_WIRE_ADAPTER 0x21
192#define USB_DT_RPIPE 0x22 192#define USB_DT_RPIPE 0x22
193#define USB_DT_CS_RADIO_CONTROL 0x23 193#define USB_DT_CS_RADIO_CONTROL 0x23
194/* From the T10 UAS specification */
195#define USB_DT_PIPE_USAGE 0x24
194/* From the USB 3.0 spec */ 196/* From the USB 3.0 spec */
195#define USB_DT_SS_ENDPOINT_COMP 0x30 197#define USB_DT_SS_ENDPOINT_COMP 0x30
196 198
@@ -475,7 +477,7 @@ static inline int usb_endpoint_xfer_isoc(
475static inline int usb_endpoint_is_bulk_in( 477static inline int usb_endpoint_is_bulk_in(
476 const struct usb_endpoint_descriptor *epd) 478 const struct usb_endpoint_descriptor *epd)
477{ 479{
478 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 480 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
479} 481}
480 482
481/** 483/**
@@ -488,7 +490,7 @@ static inline int usb_endpoint_is_bulk_in(
488static inline int usb_endpoint_is_bulk_out( 490static inline int usb_endpoint_is_bulk_out(
489 const struct usb_endpoint_descriptor *epd) 491 const struct usb_endpoint_descriptor *epd)
490{ 492{
491 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 493 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
492} 494}
493 495
494/** 496/**
@@ -501,7 +503,7 @@ static inline int usb_endpoint_is_bulk_out(
501static inline int usb_endpoint_is_int_in( 503static inline int usb_endpoint_is_int_in(
502 const struct usb_endpoint_descriptor *epd) 504 const struct usb_endpoint_descriptor *epd)
503{ 505{
504 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 506 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
505} 507}
506 508
507/** 509/**
@@ -514,7 +516,7 @@ static inline int usb_endpoint_is_int_in(
514static inline int usb_endpoint_is_int_out( 516static inline int usb_endpoint_is_int_out(
515 const struct usb_endpoint_descriptor *epd) 517 const struct usb_endpoint_descriptor *epd)
516{ 518{
517 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 519 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
518} 520}
519 521
520/** 522/**
@@ -527,7 +529,7 @@ static inline int usb_endpoint_is_int_out(
527static inline int usb_endpoint_is_isoc_in( 529static inline int usb_endpoint_is_isoc_in(
528 const struct usb_endpoint_descriptor *epd) 530 const struct usb_endpoint_descriptor *epd)
529{ 531{
530 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 532 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
531} 533}
532 534
533/** 535/**
@@ -540,7 +542,7 @@ static inline int usb_endpoint_is_isoc_in(
540static inline int usb_endpoint_is_isoc_out( 542static inline int usb_endpoint_is_isoc_out(
541 const struct usb_endpoint_descriptor *epd) 543 const struct usb_endpoint_descriptor *epd)
542{ 544{
543 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 545 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
544} 546}
545 547
546/*-------------------------------------------------------------------------*/ 548/*-------------------------------------------------------------------------*/
@@ -556,6 +558,8 @@ struct usb_ss_ep_comp_descriptor {
556} __attribute__ ((packed)); 558} __attribute__ ((packed));
557 559
558#define USB_DT_SS_EP_COMP_SIZE 6 560#define USB_DT_SS_EP_COMP_SIZE 6
561/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
562#define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f))
559 563
560/*-------------------------------------------------------------------------*/ 564/*-------------------------------------------------------------------------*/
561 565
@@ -775,7 +779,7 @@ enum usb_device_speed {
775 USB_SPEED_UNKNOWN = 0, /* enumerating */ 779 USB_SPEED_UNKNOWN = 0, /* enumerating */
776 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ 780 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
777 USB_SPEED_HIGH, /* usb 2.0 */ 781 USB_SPEED_HIGH, /* usb 2.0 */
778 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ 782 USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
779 USB_SPEED_SUPER, /* usb 3.0 */ 783 USB_SPEED_SUPER, /* usb 3.0 */
780}; 784};
781 785
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 738ea1a691cb..139353efad34 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -326,6 +326,7 @@ struct usb_composite_dev {
326 326
327 /* private: */ 327 /* private: */
328 /* internals */ 328 /* internals */
329 unsigned int suspended:1;
329 struct usb_device_descriptor desc; 330 struct usb_device_descriptor desc;
330 struct list_head configs; 331 struct list_head configs;
331 struct usb_composite_driver *driver; 332 struct usb_composite_driver *driver;
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index af4b86f3aca3..80287af2a738 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -45,7 +45,7 @@ struct ehci_caps {
45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ 45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ 46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ 47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
48 u8 portroute [8]; /* nibbles for routing - offset 0xC */ 48 u8 portroute[8]; /* nibbles for routing - offset 0xC */
49} __attribute__ ((packed)); 49} __attribute__ ((packed));
50 50
51 51
@@ -92,14 +92,14 @@ struct ehci_regs {
92 /* ASYNCLISTADDR: offset 0x18 */ 92 /* ASYNCLISTADDR: offset 0x18 */
93 u32 async_next; /* address of next async queue head */ 93 u32 async_next; /* address of next async queue head */
94 94
95 u32 reserved [9]; 95 u32 reserved[9];
96 96
97 /* CONFIGFLAG: offset 0x40 */ 97 /* CONFIGFLAG: offset 0x40 */
98 u32 configured_flag; 98 u32 configured_flag;
99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */ 99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
100 100
101 /* PORTSC: offset 0x44 */ 101 /* PORTSC: offset 0x44 */
102 u32 port_status [0]; /* up to N_PORTS */ 102 u32 port_status[0]; /* up to N_PORTS */
103/* 31:23 reserved */ 103/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ 104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
new file mode 100644
index 000000000000..a34a2a043b21
--- /dev/null
+++ b/include/linux/usb/functionfs.h
@@ -0,0 +1,199 @@
1#ifndef __LINUX_FUNCTIONFS_H__
2#define __LINUX_FUNCTIONFS_H__ 1
3
4
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | lenght | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string ther is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168#ifdef __KERNEL__
169
170struct ffs_data;
171struct usb_composite_dev;
172struct usb_configuration;
173
174
175static int functionfs_init(void) __attribute__((warn_unused_result));
176static void functionfs_cleanup(void);
177
178static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
179 __attribute__((warn_unused_result, nonnull));
180static void functionfs_unbind(struct ffs_data *ffs)
181 __attribute__((nonnull));
182
183static int functionfs_add(struct usb_composite_dev *cdev,
184 struct usb_configuration *c,
185 struct ffs_data *ffs)
186 __attribute__((warn_unused_result, nonnull));
187
188
189static int functionfs_ready_callback(struct ffs_data *ffs)
190 __attribute__((warn_unused_result, nonnull));
191static void functionfs_closed_callback(struct ffs_data *ffs)
192 __attribute__((nonnull));
193static int functionfs_check_dev_callback(const char *dev_name)
194 __attribute__((warn_unused_result, nonnull));
195
196
197#endif
198
199#endif
diff --git a/include/linux/usb/g_hid.h b/include/linux/usb/g_hid.h
new file mode 100644
index 000000000000..50f5745df28c
--- /dev/null
+++ b/include/linux/usb/g_hid.h
@@ -0,0 +1,32 @@
1/*
2 * g_hid.h -- Header file for USB HID gadget driver
3 *
4 * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __LINUX_USB_G_HID_H
22#define __LINUX_USB_G_HID_H
23
24struct hidg_func_descriptor {
25 unsigned char subclass;
26 unsigned char protocol;
27 unsigned short report_length;
28 unsigned short report_desc_length;
29 unsigned char report_desc[];
30};
31
32#endif /* __LINUX_USB_G_HID_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index bbf45d500b6d..d3ef42d7d2f0 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_USB_GADGET_H 15#ifndef __LINUX_USB_GADGET_H
16#define __LINUX_USB_GADGET_H 16#define __LINUX_USB_GADGET_H
17 17
18#include <linux/slab.h>
19
18struct usb_ep; 20struct usb_ep;
19 21
20/** 22/**
@@ -492,9 +494,13 @@ static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
492 { dev_set_drvdata(&gadget->dev, data); } 494 { dev_set_drvdata(&gadget->dev, data); }
493static inline void *get_gadget_data(struct usb_gadget *gadget) 495static inline void *get_gadget_data(struct usb_gadget *gadget)
494 { return dev_get_drvdata(&gadget->dev); } 496 { return dev_get_drvdata(&gadget->dev); }
497static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
498{
499 return container_of(dev, struct usb_gadget, dev);
500}
495 501
496/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ 502/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
497#define gadget_for_each_ep(tmp,gadget) \ 503#define gadget_for_each_ep(tmp, gadget) \
498 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) 504 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
499 505
500 506
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index 612102e4d75e..0bb12e0d4f8f 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -19,7 +19,7 @@
19#define __LINUX_USB_GADGETFS_H 19#define __LINUX_USB_GADGETFS_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <asm/ioctl.h> 22#include <linux/ioctl.h>
23 23
24#include <linux/usb/ch9.h> 24#include <linux/usb/ch9.h>
25 25
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
new file mode 100644
index 000000000000..2e3a4ea1a3da
--- /dev/null
+++ b/include/linux/usb/hcd.h
@@ -0,0 +1,625 @@
1/*
2 * Copyright (c) 2001-2002 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_HCD_H
20#define __USB_CORE_HCD_H
21
22#ifdef __KERNEL__
23
24#include <linux/rwsem.h>
25
26#define MAX_TOPO_LEVEL 6
27
28/* This file contains declarations of usbcore internals that are mostly
29 * used or exposed by Host Controller Drivers.
30 */
31
32/*
33 * USB Packet IDs (PIDs)
34 */
35#define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */
36#define USB_PID_OUT 0xe1
37#define USB_PID_ACK 0xd2
38#define USB_PID_DATA0 0xc3
39#define USB_PID_PING 0xb4 /* USB 2.0 */
40#define USB_PID_SOF 0xa5
41#define USB_PID_NYET 0x96 /* USB 2.0 */
42#define USB_PID_DATA2 0x87 /* USB 2.0 */
43#define USB_PID_SPLIT 0x78 /* USB 2.0 */
44#define USB_PID_IN 0x69
45#define USB_PID_NAK 0x5a
46#define USB_PID_DATA1 0x4b
47#define USB_PID_PREAMBLE 0x3c /* Token mode */
48#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
49#define USB_PID_SETUP 0x2d
50#define USB_PID_STALL 0x1e
51#define USB_PID_MDATA 0x0f /* USB 2.0 */
52
53/*-------------------------------------------------------------------------*/
54
55/*
56 * USB Host Controller Driver (usb_hcd) framework
57 *
58 * Since "struct usb_bus" is so thin, you can't share much code in it.
59 * This framework is a layer over that, and should be more sharable.
60 *
61 * @authorized_default: Specifies if new devices are authorized to
62 * connect by default or they require explicit
63 * user space authorization; this bit is settable
64 * through /sys/class/usb_host/X/authorized_default.
65 * For the rest is RO, so we don't lock to r/w it.
66 */
67
68/*-------------------------------------------------------------------------*/
69
70struct usb_hcd {
71
72 /*
73 * housekeeping
74 */
75 struct usb_bus self; /* hcd is-a bus */
76 struct kref kref; /* reference counter */
77
78 const char *product_desc; /* product/vendor string */
79 char irq_descr[24]; /* driver + bus # */
80
81 struct timer_list rh_timer; /* drives root-hub polling */
82 struct urb *status_urb; /* the current status urb */
83#ifdef CONFIG_USB_SUSPEND
84 struct work_struct wakeup_work; /* for remote wakeup */
85#endif
86
87 /*
88 * hardware info/state
89 */
90 const struct hc_driver *driver; /* hw-specific hooks */
91
92 /* Flags that need to be manipulated atomically */
93 unsigned long flags;
94#define HCD_FLAG_HW_ACCESSIBLE 0x00000001
95#define HCD_FLAG_SAW_IRQ 0x00000002
96
97 unsigned rh_registered:1;/* is root hub registered? */
98
99 /* The next flag is a stopgap, to be removed when all the HCDs
100 * support the new root-hub polling mechanism. */
101 unsigned uses_new_polling:1;
102 unsigned poll_rh:1; /* poll for rh status? */
103 unsigned poll_pending:1; /* status has changed? */
104 unsigned wireless:1; /* Wireless USB HCD */
105 unsigned authorized_default:1;
106 unsigned has_tt:1; /* Integrated TT in root hub */
107
108 int irq; /* irq allocated */
109 void __iomem *regs; /* device memory/io */
110 u64 rsrc_start; /* memory/io resource start */
111 u64 rsrc_len; /* memory/io resource length */
112 unsigned power_budget; /* in mA, 0 = no limit */
113
114 /* bandwidth_mutex should be taken before adding or removing
115 * any new bus bandwidth constraints:
116 * 1. Before adding a configuration for a new device.
117 * 2. Before removing the configuration to put the device into
118 * the addressed state.
119 * 3. Before selecting a different configuration.
120 * 4. Before selecting an alternate interface setting.
121 *
122 * bandwidth_mutex should be dropped after a successful control message
123 * to the device, or resetting the bandwidth after a failed attempt.
124 */
125 struct mutex bandwidth_mutex;
126
127
128#define HCD_BUFFER_POOLS 4
129 struct dma_pool *pool[HCD_BUFFER_POOLS];
130
131 int state;
132# define __ACTIVE 0x01
133# define __SUSPEND 0x04
134# define __TRANSIENT 0x80
135
136# define HC_STATE_HALT 0
137# define HC_STATE_RUNNING (__ACTIVE)
138# define HC_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE)
139# define HC_STATE_RESUMING (__SUSPEND|__TRANSIENT)
140# define HC_STATE_SUSPENDED (__SUSPEND)
141
142#define HC_IS_RUNNING(state) ((state) & __ACTIVE)
143#define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
144
145 /* more shared queuing code would be good; it should support
146 * smarter scheduling, handle transaction translators, etc;
147 * input size of periodic table to an interrupt scheduler.
148 * (ohci 32, uhci 1024, ehci 256/512/1024).
149 */
150
151 /* The HC driver's private data is stored at the end of
152 * this structure.
153 */
154 unsigned long hcd_priv[0]
155 __attribute__ ((aligned(sizeof(unsigned long))));
156};
157
158/* 2.4 does this a bit differently ... */
159static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd)
160{
161 return &hcd->self;
162}
163
164static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus)
165{
166 return container_of(bus, struct usb_hcd, self);
167}
168
169struct hcd_timeout { /* timeouts we allocate */
170 struct list_head timeout_list;
171 struct timer_list timer;
172};
173
174/*-------------------------------------------------------------------------*/
175
176
177struct hc_driver {
178 const char *description; /* "ehci-hcd" etc */
179 const char *product_desc; /* product/vendor string */
180 size_t hcd_priv_size; /* size of private data */
181
182 /* irq handler */
183 irqreturn_t (*irq) (struct usb_hcd *hcd);
184
185 int flags;
186#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
187#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
188#define HCD_USB11 0x0010 /* USB 1.1 */
189#define HCD_USB2 0x0020 /* USB 2.0 */
190#define HCD_USB3 0x0040 /* USB 3.0 */
191#define HCD_MASK 0x0070
192
193 /* called to init HCD and root hub */
194 int (*reset) (struct usb_hcd *hcd);
195 int (*start) (struct usb_hcd *hcd);
196
197 /* NOTE: these suspend/resume calls relate to the HC as
198 * a whole, not just the root hub; they're for PCI bus glue.
199 */
200 /* called after suspending the hub, before entering D3 etc */
201 int (*pci_suspend)(struct usb_hcd *hcd);
202
203 /* called after entering D0 (etc), before resuming the hub */
204 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
205
206 /* cleanly make HCD stop writing memory and doing I/O */
207 void (*stop) (struct usb_hcd *hcd);
208
209 /* shutdown HCD */
210 void (*shutdown) (struct usb_hcd *hcd);
211
212 /* return current frame number */
213 int (*get_frame_number) (struct usb_hcd *hcd);
214
215 /* manage i/o requests, device state */
216 int (*urb_enqueue)(struct usb_hcd *hcd,
217 struct urb *urb, gfp_t mem_flags);
218 int (*urb_dequeue)(struct usb_hcd *hcd,
219 struct urb *urb, int status);
220
221 /* hw synch, freeing endpoint resources that urb_dequeue can't */
222 void (*endpoint_disable)(struct usb_hcd *hcd,
223 struct usb_host_endpoint *ep);
224
225 /* (optional) reset any endpoint state such as sequence number
226 and current window */
227 void (*endpoint_reset)(struct usb_hcd *hcd,
228 struct usb_host_endpoint *ep);
229
230 /* root hub support */
231 int (*hub_status_data) (struct usb_hcd *hcd, char *buf);
232 int (*hub_control) (struct usb_hcd *hcd,
233 u16 typeReq, u16 wValue, u16 wIndex,
234 char *buf, u16 wLength);
235 int (*bus_suspend)(struct usb_hcd *);
236 int (*bus_resume)(struct usb_hcd *);
237 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
238
239 /* force handover of high-speed port to full-speed companion */
240 void (*relinquish_port)(struct usb_hcd *, int);
241 /* has a port been handed over to a companion? */
242 int (*port_handed_over)(struct usb_hcd *, int);
243
244 /* CLEAR_TT_BUFFER completion callback */
245 void (*clear_tt_buffer_complete)(struct usb_hcd *,
246 struct usb_host_endpoint *);
247
248 /* xHCI specific functions */
249 /* Called by usb_alloc_dev to alloc HC device structures */
250 int (*alloc_dev)(struct usb_hcd *, struct usb_device *);
251 /* Called by usb_disconnect to free HC device structures */
252 void (*free_dev)(struct usb_hcd *, struct usb_device *);
253 /* Change a group of bulk endpoints to support multiple stream IDs */
254 int (*alloc_streams)(struct usb_hcd *hcd, struct usb_device *udev,
255 struct usb_host_endpoint **eps, unsigned int num_eps,
256 unsigned int num_streams, gfp_t mem_flags);
257 /* Reverts a group of bulk endpoints back to not using stream IDs.
258 * Can fail if we run out of memory.
259 */
260 int (*free_streams)(struct usb_hcd *hcd, struct usb_device *udev,
261 struct usb_host_endpoint **eps, unsigned int num_eps,
262 gfp_t mem_flags);
263
264 /* Bandwidth computation functions */
265 /* Note that add_endpoint() can only be called once per endpoint before
266 * check_bandwidth() or reset_bandwidth() must be called.
267 * drop_endpoint() can only be called once per endpoint also.
268 * A call to xhci_drop_endpoint() followed by a call to
269 * xhci_add_endpoint() will add the endpoint to the schedule with
270 * possibly new parameters denoted by a different endpoint descriptor
271 * in usb_host_endpoint. A call to xhci_add_endpoint() followed by a
272 * call to xhci_drop_endpoint() is not allowed.
273 */
274 /* Allocate endpoint resources and add them to a new schedule */
275 int (*add_endpoint)(struct usb_hcd *, struct usb_device *,
276 struct usb_host_endpoint *);
277 /* Drop an endpoint from a new schedule */
278 int (*drop_endpoint)(struct usb_hcd *, struct usb_device *,
279 struct usb_host_endpoint *);
280 /* Check that a new hardware configuration, set using
281 * endpoint_enable and endpoint_disable, does not exceed bus
282 * bandwidth. This must be called before any set configuration
283 * or set interface requests are sent to the device.
284 */
285 int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
286 /* Reset the device schedule to the last known good schedule,
287 * which was set from a previous successful call to
288 * check_bandwidth(). This reverts any add_endpoint() and
289 * drop_endpoint() calls since that last successful call.
290 * Used for when a check_bandwidth() call fails due to resource
291 * or bandwidth constraints.
292 */
293 void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
294 /* Returns the hardware-chosen device address */
295 int (*address_device)(struct usb_hcd *, struct usb_device *udev);
296 /* Notifies the HCD after a hub descriptor is fetched.
297 * Will block.
298 */
299 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
300 struct usb_tt *tt, gfp_t mem_flags);
301 int (*reset_device)(struct usb_hcd *, struct usb_device *);
302};
303
304extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
305extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
306 int status);
307extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);
308
309extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
310extern int usb_hcd_unlink_urb(struct urb *urb, int status);
311extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
312 int status);
313extern void usb_hcd_flush_endpoint(struct usb_device *udev,
314 struct usb_host_endpoint *ep);
315extern void usb_hcd_disable_endpoint(struct usb_device *udev,
316 struct usb_host_endpoint *ep);
317extern void usb_hcd_reset_endpoint(struct usb_device *udev,
318 struct usb_host_endpoint *ep);
319extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
320extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
321 struct usb_host_config *new_config,
322 struct usb_host_interface *old_alt,
323 struct usb_host_interface *new_alt);
324extern int usb_hcd_get_frame_number(struct usb_device *udev);
325
326extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
327 struct device *dev, const char *bus_name);
328extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
329extern void usb_put_hcd(struct usb_hcd *hcd);
330extern int usb_add_hcd(struct usb_hcd *hcd,
331 unsigned int irqnum, unsigned long irqflags);
332extern void usb_remove_hcd(struct usb_hcd *hcd);
333
334struct platform_device;
335extern void usb_hcd_platform_shutdown(struct platform_device *dev);
336
337#ifdef CONFIG_PCI
338struct pci_dev;
339struct pci_device_id;
340extern int usb_hcd_pci_probe(struct pci_dev *dev,
341 const struct pci_device_id *id);
342extern void usb_hcd_pci_remove(struct pci_dev *dev);
343extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
344
345#ifdef CONFIG_PM_SLEEP
346extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
347#endif
348#endif /* CONFIG_PCI */
349
350/* pci-ish (pdev null is ok) buffer alloc/mapping support */
351int hcd_buffer_create(struct usb_hcd *hcd);
352void hcd_buffer_destroy(struct usb_hcd *hcd);
353
354void *hcd_buffer_alloc(struct usb_bus *bus, size_t size,
355 gfp_t mem_flags, dma_addr_t *dma);
356void hcd_buffer_free(struct usb_bus *bus, size_t size,
357 void *addr, dma_addr_t dma);
358
359/* generic bus glue, needed for host controllers that don't use PCI */
360extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
361
362extern void usb_hc_died(struct usb_hcd *hcd);
363extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
364
365/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
366#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
367#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
368#define usb_settoggle(dev, ep, out, bit) \
369 ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
370 ((bit) << (ep)))
371
372/* -------------------------------------------------------------------------- */
373
374/* Enumeration is only for the hub driver, or HCD virtual root hubs */
375extern struct usb_device *usb_alloc_dev(struct usb_device *parent,
376 struct usb_bus *, unsigned port);
377extern int usb_new_device(struct usb_device *dev);
378extern void usb_disconnect(struct usb_device **);
379
380extern int usb_get_configuration(struct usb_device *dev);
381extern void usb_destroy_configuration(struct usb_device *dev);
382
383/*-------------------------------------------------------------------------*/
384
385/*
386 * HCD Root Hub support
387 */
388
389#include <linux/usb/ch11.h>
390
391/*
392 * As of USB 2.0, full/low speed devices are segregated into trees.
393 * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
394 * The other type grows from high speed hubs when they connect to
395 * full/low speed devices using "Transaction Translators" (TTs).
396 *
397 * TTs should only be known to the hub driver, and high speed bus
398 * drivers (only EHCI for now). They affect periodic scheduling and
399 * sometimes control/bulk error recovery.
400 */
401
402struct usb_device;
403
404struct usb_tt {
405 struct usb_device *hub; /* upstream highspeed hub */
406 int multi; /* true means one TT per port */
407 unsigned think_time; /* think time in ns */
408
409 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
410 spinlock_t lock;
411 struct list_head clear_list; /* of usb_tt_clear */
412 struct work_struct clear_work;
413};
414
415struct usb_tt_clear {
416 struct list_head clear_list;
417 unsigned tt;
418 u16 devinfo;
419 struct usb_hcd *hcd;
420 struct usb_host_endpoint *ep;
421};
422
423extern int usb_hub_clear_tt_buffer(struct urb *urb);
424extern void usb_ep0_reinit(struct usb_device *);
425
426/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
427#define DeviceRequest \
428 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
429#define DeviceOutRequest \
430 ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
431
432#define InterfaceRequest \
433 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
434
435#define EndpointRequest \
436 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
437#define EndpointOutRequest \
438 ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
439
440/* class requests from the USB 2.0 hub spec, table 11-15 */
441/* GetBusState and SetHubDescriptor are optional, omitted */
442#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
443#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
444#define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR)
445#define GetHubStatus (0xa000 | USB_REQ_GET_STATUS)
446#define GetPortStatus (0xa300 | USB_REQ_GET_STATUS)
447#define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE)
448#define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE)
449
450
451/*-------------------------------------------------------------------------*/
452
453/*
454 * Generic bandwidth allocation constants/support
455 */
456#define FRAME_TIME_USECS 1000L
457#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
458 /* Trying not to use worst-case bit-stuffing
459 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
460 /* bytecount = data payload byte count */
461
462#define NS_TO_US(ns) ((ns + 500L) / 1000L)
463 /* convert & round nanoseconds to microseconds */
464
465
466/*
467 * Full/low speed bandwidth allocation constants/support.
468 */
469#define BW_HOST_DELAY 1000L /* nanoseconds */
470#define BW_HUB_LS_SETUP 333L /* nanoseconds */
471 /* 4 full-speed bit times (est.) */
472
473#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
474#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
475#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
476
477/*
478 * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
479 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
480 * to preallocate bandwidth)
481 */
482#define USB2_HOST_DELAY 5 /* nsec, guess */
483#define HS_NSECS(bytes) (((55 * 8 * 2083) \
484 + (2083UL * (3 + BitTime(bytes))))/1000 \
485 + USB2_HOST_DELAY)
486#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \
487 + (2083UL * (3 + BitTime(bytes))))/1000 \
488 + USB2_HOST_DELAY)
489#define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes))
490#define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes))
491
492extern long usb_calc_bus_time(int speed, int is_input,
493 int isoc, int bytecount);
494
495/*-------------------------------------------------------------------------*/
496
497extern void usb_set_device_state(struct usb_device *udev,
498 enum usb_device_state new_state);
499
500/*-------------------------------------------------------------------------*/
501
502/* exported only within usbcore */
503
504extern struct list_head usb_bus_list;
505extern struct mutex usb_bus_list_lock;
506extern wait_queue_head_t usb_kill_urb_queue;
507
508extern int usb_find_interface_driver(struct usb_device *dev,
509 struct usb_interface *interface);
510
511#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
512
513#ifdef CONFIG_PM
514extern void usb_root_hub_lost_power(struct usb_device *rhdev);
515extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
516extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
517#endif /* CONFIG_PM */
518
519#ifdef CONFIG_USB_SUSPEND
520extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
521#else
522static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
523{
524 return;
525}
526#endif /* CONFIG_USB_SUSPEND */
527
528
529/*
530 * USB device fs stuff
531 */
532
533#ifdef CONFIG_USB_DEVICEFS
534
535/*
536 * these are expected to be called from the USB core/hub thread
537 * with the kernel lock held
538 */
539extern void usbfs_update_special(void);
540extern int usbfs_init(void);
541extern void usbfs_cleanup(void);
542
543#else /* CONFIG_USB_DEVICEFS */
544
545static inline void usbfs_update_special(void) {}
546static inline int usbfs_init(void) { return 0; }
547static inline void usbfs_cleanup(void) { }
548
549#endif /* CONFIG_USB_DEVICEFS */
550
551/*-------------------------------------------------------------------------*/
552
553#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
554
555struct usb_mon_operations {
556 void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
557 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
558 void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
559 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
560};
561
562extern struct usb_mon_operations *mon_ops;
563
564static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)
565{
566 if (bus->monitored)
567 (*mon_ops->urb_submit)(bus, urb);
568}
569
570static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
571 int error)
572{
573 if (bus->monitored)
574 (*mon_ops->urb_submit_error)(bus, urb, error);
575}
576
577static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
578 int status)
579{
580 if (bus->monitored)
581 (*mon_ops->urb_complete)(bus, urb, status);
582}
583
584int usb_mon_register(struct usb_mon_operations *ops);
585void usb_mon_deregister(void);
586
587#else
588
589static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
590static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
591 int error) {}
592static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
593 int status) {}
594
595#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
596
597/*-------------------------------------------------------------------------*/
598
599/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */
600/* bleech -- resurfaced in 2.4.11 or 2.4.12 */
601#define bitmap DeviceRemovable
602
603
604/*-------------------------------------------------------------------------*/
605
606/* random stuff */
607
608#define RUN_CONTEXT (in_irq() ? "in_irq" \
609 : (in_interrupt() ? "in_interrupt" : "can sleep"))
610
611
612/* This rwsem is for use only by the hub driver and ehci-hcd.
613 * Nobody else should touch it.
614 */
615extern struct rw_semaphore ehci_cf_port_reset_rwsem;
616
617/* Keep track of which host controller drivers are loaded */
618#define USB_UHCI_LOADED 0
619#define USB_OHCI_LOADED 1
620#define USB_EHCI_LOADED 2
621extern unsigned long usb_hcds_loaded;
622
623#endif /* __KERNEL__ */
624
625#endif /* __USB_CORE_HCD_H */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
index c949178a6530..2d2d1bbad9d2 100644
--- a/include/linux/usb/langwell_udc.h
+++ b/include/linux/usb/langwell_udc.h
@@ -181,7 +181,7 @@ struct langwell_op_regs {
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ 181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */ 182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */ 183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */ 184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */ 185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */ 186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */ 187#define PORTS_SUSP BIT(7) /* suspend */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index d43755669261..ee2dd1d506ed 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -22,37 +22,73 @@ enum musb_mode {
22 22
23struct clk; 23struct clk;
24 24
25enum musb_fifo_style {
26 FIFO_RXTX,
27 FIFO_TX,
28 FIFO_RX
29} __attribute__ ((packed));
30
31enum musb_buf_mode {
32 BUF_SINGLE,
33 BUF_DOUBLE
34} __attribute__ ((packed));
35
36struct musb_fifo_cfg {
37 u8 hw_ep_num;
38 enum musb_fifo_style style;
39 enum musb_buf_mode mode;
40 u16 maxpacket;
41};
42
43#define MUSB_EP_FIFO(ep, st, m, pkt) \
44{ \
45 .hw_ep_num = ep, \
46 .style = st, \
47 .mode = m, \
48 .maxpacket = pkt, \
49}
50
51#define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
52 MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
53
54#define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
55 MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
56
25struct musb_hdrc_eps_bits { 57struct musb_hdrc_eps_bits {
26 const char name[16]; 58 const char name[16];
27 u8 bits; 59 u8 bits;
28}; 60};
29 61
30struct musb_hdrc_config { 62struct musb_hdrc_config {
63 struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
64 unsigned fifo_cfg_size; /* size of the fifo configuration */
65
31 /* MUSB configuration-specific details */ 66 /* MUSB configuration-specific details */
32 unsigned multipoint:1; /* multipoint device */ 67 unsigned multipoint:1; /* multipoint device */
33 unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ 68 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
34 unsigned soft_con:1; /* soft connect required */ 69 unsigned soft_con:1 __deprecated; /* soft connect required */
35 unsigned utm_16:1; /* utm data witdh is 16 bits */ 70 unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
36 unsigned big_endian:1; /* true if CPU uses big-endian */ 71 unsigned big_endian:1; /* true if CPU uses big-endian */
37 unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ 72 unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
38 unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ 73 unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
39 unsigned high_iso_tx:1; /* Tx ep required for HB iso */ 74 unsigned high_iso_tx:1; /* Tx ep required for HB iso */
40 unsigned high_iso_rx:1; /* Rx ep required for HD iso */ 75 unsigned high_iso_rx:1; /* Rx ep required for HD iso */
41 unsigned dma:1; /* supports DMA */ 76 unsigned dma:1 __deprecated; /* supports DMA */
42 unsigned vendor_req:1; /* vendor registers required */ 77 unsigned vendor_req:1 __deprecated; /* vendor registers required */
43 78
44 u8 num_eps; /* number of endpoints _with_ ep0 */ 79 u8 num_eps; /* number of endpoints _with_ ep0 */
45 u8 dma_channels; /* number of dma channels */ 80 u8 dma_channels __deprecated; /* number of dma channels */
46 u8 dyn_fifo_size; /* dynamic size in bytes */ 81 u8 dyn_fifo_size; /* dynamic size in bytes */
47 u8 vendor_ctrl; /* vendor control reg width */ 82 u8 vendor_ctrl __deprecated; /* vendor control reg width */
48 u8 vendor_stat; /* vendor status reg witdh */ 83 u8 vendor_stat __deprecated; /* vendor status reg witdh */
49 u8 dma_req_chan; /* bitmask for required dma channels */ 84 u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
50 u8 ram_bits; /* ram address size */ 85 u8 ram_bits; /* ram address size */
51 86
52 struct musb_hdrc_eps_bits *eps_bits; 87 struct musb_hdrc_eps_bits *eps_bits __deprecated;
53#ifdef CONFIG_BLACKFIN 88#ifdef CONFIG_BLACKFIN
54 /* A GPIO controlling VRSEL in Blackfin */ 89 /* A GPIO controlling VRSEL in Blackfin */
55 unsigned int gpio_vrsel; 90 unsigned int gpio_vrsel;
91 unsigned int gpio_vrsel_active;
56#endif 92#endif
57 93
58}; 94};
@@ -76,6 +112,9 @@ struct musb_hdrc_platform_data {
76 /* (HOST or OTG) msec/2 after VBUS on till power good */ 112 /* (HOST or OTG) msec/2 after VBUS on till power good */
77 u8 potpgt; 113 u8 potpgt;
78 114
115 /* (HOST or OTG) program PHY for external Vbus */
116 unsigned extvbus:1;
117
79 /* Power the device on or off */ 118 /* Power the device on or off */
80 int (*set_power)(int state); 119 int (*set_power)(int state);
81 120
@@ -84,6 +123,9 @@ struct musb_hdrc_platform_data {
84 123
85 /* MUSB configuration-specific details */ 124 /* MUSB configuration-specific details */
86 struct musb_hdrc_config *config; 125 struct musb_hdrc_config *config;
126
127 /* Architecture specific board data */
128 void *board_data;
87}; 129};
88 130
89 131
diff --git a/include/linux/usb/ncm.h b/include/linux/usb/ncm.h
new file mode 100644
index 000000000000..006d1064c8b2
--- /dev/null
+++ b/include/linux/usb/ncm.h
@@ -0,0 +1,114 @@
1/*
2 * USB CDC NCM auxiliary definitions
3 */
4
5#ifndef __LINUX_USB_NCM_H
6#define __LINUX_USB_NCM_H
7
8#include <linux/types.h>
9#include <linux/usb/cdc.h>
10#include <asm/unaligned.h>
11
12#define NCM_NTB_MIN_IN_SIZE 2048
13#define NCM_NTB_MIN_OUT_SIZE 2048
14
15#define NCM_CONTROL_TIMEOUT (5 * 1000)
16
17/* bmNetworkCapabilities */
18
19#define NCM_NCAP_ETH_FILTER (1 << 0)
20#define NCM_NCAP_NET_ADDRESS (1 << 1)
21#define NCM_NCAP_ENCAP_COMM (1 << 2)
22#define NCM_NCAP_MAX_DGRAM (1 << 3)
23#define NCM_NCAP_CRC_MODE (1 << 4)
24
25/*
26 * Here are options for NCM Datagram Pointer table (NDP) parser.
27 * There are 2 different formats: NDP16 and NDP32 in the spec (ch. 3),
28 * in NDP16 offsets and sizes fields are 1 16bit word wide,
29 * in NDP32 -- 2 16bit words wide. Also signatures are different.
30 * To make the parser code the same, put the differences in the structure,
31 * and switch pointers to the structures when the format is changed.
32 */
33
34struct ndp_parser_opts {
35 u32 nth_sign;
36 u32 ndp_sign;
37 unsigned nth_size;
38 unsigned ndp_size;
39 unsigned ndplen_align;
40 /* sizes in u16 units */
41 unsigned dgram_item_len; /* index or length */
42 unsigned block_length;
43 unsigned fp_index;
44 unsigned reserved1;
45 unsigned reserved2;
46 unsigned next_fp_index;
47};
48
49#define INIT_NDP16_OPTS { \
50 .nth_sign = NCM_NTH16_SIGN, \
51 .ndp_sign = NCM_NDP16_NOCRC_SIGN, \
52 .nth_size = sizeof(struct usb_cdc_ncm_nth16), \
53 .ndp_size = sizeof(struct usb_cdc_ncm_ndp16), \
54 .ndplen_align = 4, \
55 .dgram_item_len = 1, \
56 .block_length = 1, \
57 .fp_index = 1, \
58 .reserved1 = 0, \
59 .reserved2 = 0, \
60 .next_fp_index = 1, \
61 }
62
63
64#define INIT_NDP32_OPTS { \
65 .nth_sign = NCM_NTH32_SIGN, \
66 .ndp_sign = NCM_NDP32_NOCRC_SIGN, \
67 .nth_size = sizeof(struct usb_cdc_ncm_nth32), \
68 .ndp_size = sizeof(struct usb_cdc_ncm_ndp32), \
69 .ndplen_align = 8, \
70 .dgram_item_len = 2, \
71 .block_length = 2, \
72 .fp_index = 2, \
73 .reserved1 = 1, \
74 .reserved2 = 2, \
75 .next_fp_index = 2, \
76 }
77
78static inline void put_ncm(__le16 **p, unsigned size, unsigned val)
79{
80 switch (size) {
81 case 1:
82 put_unaligned_le16((u16)val, *p);
83 break;
84 case 2:
85 put_unaligned_le32((u32)val, *p);
86
87 break;
88 default:
89 BUG();
90 }
91
92 *p += size;
93}
94
95static inline unsigned get_ncm(__le16 **p, unsigned size)
96{
97 unsigned tmp;
98
99 switch (size) {
100 case 1:
101 tmp = get_unaligned_le16(*p);
102 break;
103 case 2:
104 tmp = get_unaligned_le32(*p);
105 break;
106 default:
107 BUG();
108 }
109
110 *p += size;
111 return tmp;
112}
113
114#endif /* __LINUX_USB_NCM_H */
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index 96ca549a778d..148b8fa5b1a2 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -353,7 +353,7 @@ struct net2280_dma_regs { /* [11.7] */
353#define DMA_TRANSACTION_DONE_INTERRUPT 24 353#define DMA_TRANSACTION_DONE_INTERRUPT 24
354#define DMA_ABORT 1 354#define DMA_ABORT 1
355#define DMA_START 0 355#define DMA_START 0
356 u32 _unused0 [2]; 356 u32 _unused0[2];
357 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ 357 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
358 u32 dmacount; 358 u32 dmacount;
359#define VALID_BIT 31 359#define VALID_BIT 31
@@ -374,7 +374,7 @@ struct net2280_dep_regs { /* [11.8] */
374 u32 dep_cfg; 374 u32 dep_cfg;
375 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ 375 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
376 u32 dep_rsp; 376 u32 dep_rsp;
377 u32 _unused [2]; 377 u32 _unused[2];
378} __attribute__ ((packed)); 378} __attribute__ ((packed));
379 379
380/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs 380/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
@@ -437,7 +437,7 @@ struct net2280_ep_regs { /* [11.9] */
437 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ 437 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
438 u32 ep_avail; 438 u32 ep_avail;
439 u32 ep_data; 439 u32 ep_data;
440 u32 _unused0 [2]; 440 u32 _unused0[2];
441} __attribute__ ((packed)); 441} __attribute__ ((packed));
442 442
443#endif /* __LINUX_USB_NET2280_H */ 443#endif /* __LINUX_USB_NET2280_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 52bb917641f0..f8302d036a76 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -9,6 +9,8 @@
9#ifndef __LINUX_USB_OTG_H 9#ifndef __LINUX_USB_OTG_H
10#define __LINUX_USB_OTG_H 10#define __LINUX_USB_OTG_H
11 11
12#include <linux/notifier.h>
13
12/* OTG defines lots of enumeration states before device reset */ 14/* OTG defines lots of enumeration states before device reset */
13enum usb_otg_state { 15enum usb_otg_state {
14 OTG_STATE_UNDEFINED = 0, 16 OTG_STATE_UNDEFINED = 0,
@@ -33,6 +35,14 @@ enum usb_otg_state {
33 OTG_STATE_A_VBUS_ERR, 35 OTG_STATE_A_VBUS_ERR,
34}; 36};
35 37
38enum usb_xceiv_events {
39 USB_EVENT_NONE, /* no events or cable disconnected */
40 USB_EVENT_VBUS, /* vbus valid event */
41 USB_EVENT_ID, /* id was grounded */
42 USB_EVENT_CHARGER, /* usb dedicated charger */
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44};
45
36#define USB_OTG_PULLUP_ID (1 << 0) 46#define USB_OTG_PULLUP_ID (1 << 0)
37#define USB_OTG_PULLDOWN_DP (1 << 1) 47#define USB_OTG_PULLDOWN_DP (1 << 1)
38#define USB_OTG_PULLDOWN_DM (1 << 2) 48#define USB_OTG_PULLDOWN_DM (1 << 2)
@@ -70,6 +80,9 @@ struct otg_transceiver {
70 struct otg_io_access_ops *io_ops; 80 struct otg_io_access_ops *io_ops;
71 void __iomem *io_priv; 81 void __iomem *io_priv;
72 82
83 /* for notification of usb_xceiv_events */
84 struct blocking_notifier_head notifier;
85
73 /* to pass extra port status to the root hub */ 86 /* to pass extra port status to the root hub */
74 u16 port_status; 87 u16 port_status;
75 u16 port_change; 88 u16 port_change;
@@ -110,9 +123,19 @@ struct otg_transceiver {
110/* for board-specific init logic */ 123/* for board-specific init logic */
111extern int otg_set_transceiver(struct otg_transceiver *); 124extern int otg_set_transceiver(struct otg_transceiver *);
112 125
126#if defined(CONFIG_NOP_USB_XCEIV) || defined(CONFIG_NOP_USB_XCEIV_MODULE)
113/* sometimes transceivers are accessed only through e.g. ULPI */ 127/* sometimes transceivers are accessed only through e.g. ULPI */
114extern void usb_nop_xceiv_register(void); 128extern void usb_nop_xceiv_register(void);
115extern void usb_nop_xceiv_unregister(void); 129extern void usb_nop_xceiv_unregister(void);
130#else
131static inline void usb_nop_xceiv_register(void)
132{
133}
134
135static inline void usb_nop_xceiv_unregister(void)
136{
137}
138#endif
116 139
117/* helpers for direct access thru low-level io interface */ 140/* helpers for direct access thru low-level io interface */
118static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) 141static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
@@ -203,6 +226,18 @@ otg_start_srp(struct otg_transceiver *otg)
203 return otg->start_srp(otg); 226 return otg->start_srp(otg);
204} 227}
205 228
229/* notifiers */
230static inline int
231otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
232{
233 return blocking_notifier_chain_register(&otg->notifier, nb);
234}
235
236static inline void
237otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
238{
239 blocking_notifier_chain_unregister(&otg->notifier, nb);
240}
206 241
207/* for OTG controller drivers (and maybe other stuff) */ 242/* for OTG controller drivers (and maybe other stuff) */
208extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 243extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 2526f3bbd273..16b7f3347545 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -19,4 +19,11 @@
19/* device can't handle its Configuration or Interface strings */ 19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
21 21
22/*device will morph if reset, don't use reset for handling errors */
23#define USB_QUIRK_RESET_MORPHS 0x00000010
24
25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
28
22#endif /* __LINUX_USB_QUIRKS_H */ 29#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 1ef1ebc2b04f..05ef52861988 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -34,10 +34,10 @@
34struct rndis_msg_hdr { 34struct rndis_msg_hdr {
35 __le32 msg_type; /* RNDIS_MSG_* */ 35 __le32 msg_type; /* RNDIS_MSG_* */
36 __le32 msg_len; 36 __le32 msg_len;
37 // followed by data that varies between messages 37 /* followed by data that varies between messages */
38 __le32 request_id; 38 __le32 request_id;
39 __le32 status; 39 __le32 status;
40 // ... and more 40 /* ... and more */
41} __attribute__ ((packed)); 41} __attribute__ ((packed));
42 42
43/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ 43/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
@@ -92,67 +92,67 @@ struct rndis_msg_hdr {
92 92
93struct rndis_data_hdr { 93struct rndis_data_hdr {
94 __le32 msg_type; /* RNDIS_MSG_PACKET */ 94 __le32 msg_type; /* RNDIS_MSG_PACKET */
95 __le32 msg_len; // rndis_data_hdr + data_len + pad 95 __le32 msg_len; /* rndis_data_hdr + data_len + pad */
96 __le32 data_offset; // 36 -- right after header 96 __le32 data_offset; /* 36 -- right after header */
97 __le32 data_len; // ... real packet size 97 __le32 data_len; /* ... real packet size */
98 98
99 __le32 oob_data_offset; // zero 99 __le32 oob_data_offset; /* zero */
100 __le32 oob_data_len; // zero 100 __le32 oob_data_len; /* zero */
101 __le32 num_oob; // zero 101 __le32 num_oob; /* zero */
102 __le32 packet_data_offset; // zero 102 __le32 packet_data_offset; /* zero */
103 103
104 __le32 packet_data_len; // zero 104 __le32 packet_data_len; /* zero */
105 __le32 vc_handle; // zero 105 __le32 vc_handle; /* zero */
106 __le32 reserved; // zero 106 __le32 reserved; /* zero */
107} __attribute__ ((packed)); 107} __attribute__ ((packed));
108 108
109struct rndis_init { /* OUT */ 109struct rndis_init { /* OUT */
110 // header and: 110 /* header and: */
111 __le32 msg_type; /* RNDIS_MSG_INIT */ 111 __le32 msg_type; /* RNDIS_MSG_INIT */
112 __le32 msg_len; // 24 112 __le32 msg_len; /* 24 */
113 __le32 request_id; 113 __le32 request_id;
114 __le32 major_version; // of rndis (1.0) 114 __le32 major_version; /* of rndis (1.0) */
115 __le32 minor_version; 115 __le32 minor_version;
116 __le32 max_transfer_size; 116 __le32 max_transfer_size;
117} __attribute__ ((packed)); 117} __attribute__ ((packed));
118 118
119struct rndis_init_c { /* IN */ 119struct rndis_init_c { /* IN */
120 // header and: 120 /* header and: */
121 __le32 msg_type; /* RNDIS_MSG_INIT_C */ 121 __le32 msg_type; /* RNDIS_MSG_INIT_C */
122 __le32 msg_len; 122 __le32 msg_len;
123 __le32 request_id; 123 __le32 request_id;
124 __le32 status; 124 __le32 status;
125 __le32 major_version; // of rndis (1.0) 125 __le32 major_version; /* of rndis (1.0) */
126 __le32 minor_version; 126 __le32 minor_version;
127 __le32 device_flags; 127 __le32 device_flags;
128 __le32 medium; // zero == 802.3 128 __le32 medium; /* zero == 802.3 */
129 __le32 max_packets_per_message; 129 __le32 max_packets_per_message;
130 __le32 max_transfer_size; 130 __le32 max_transfer_size;
131 __le32 packet_alignment; // max 7; (1<<n) bytes 131 __le32 packet_alignment; /* max 7; (1<<n) bytes */
132 __le32 af_list_offset; // zero 132 __le32 af_list_offset; /* zero */
133 __le32 af_list_size; // zero 133 __le32 af_list_size; /* zero */
134} __attribute__ ((packed)); 134} __attribute__ ((packed));
135 135
136struct rndis_halt { /* OUT (no reply) */ 136struct rndis_halt { /* OUT (no reply) */
137 // header and: 137 /* header and: */
138 __le32 msg_type; /* RNDIS_MSG_HALT */ 138 __le32 msg_type; /* RNDIS_MSG_HALT */
139 __le32 msg_len; 139 __le32 msg_len;
140 __le32 request_id; 140 __le32 request_id;
141} __attribute__ ((packed)); 141} __attribute__ ((packed));
142 142
143struct rndis_query { /* OUT */ 143struct rndis_query { /* OUT */
144 // header and: 144 /* header and: */
145 __le32 msg_type; /* RNDIS_MSG_QUERY */ 145 __le32 msg_type; /* RNDIS_MSG_QUERY */
146 __le32 msg_len; 146 __le32 msg_len;
147 __le32 request_id; 147 __le32 request_id;
148 __le32 oid; 148 __le32 oid;
149 __le32 len; 149 __le32 len;
150 __le32 offset; 150 __le32 offset;
151/*?*/ __le32 handle; // zero 151/*?*/ __le32 handle; /* zero */
152} __attribute__ ((packed)); 152} __attribute__ ((packed));
153 153
154struct rndis_query_c { /* IN */ 154struct rndis_query_c { /* IN */
155 // header and: 155 /* header and: */
156 __le32 msg_type; /* RNDIS_MSG_QUERY_C */ 156 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
157 __le32 msg_len; 157 __le32 msg_len;
158 __le32 request_id; 158 __le32 request_id;
@@ -162,18 +162,18 @@ struct rndis_query_c { /* IN */
162} __attribute__ ((packed)); 162} __attribute__ ((packed));
163 163
164struct rndis_set { /* OUT */ 164struct rndis_set { /* OUT */
165 // header and: 165 /* header and: */
166 __le32 msg_type; /* RNDIS_MSG_SET */ 166 __le32 msg_type; /* RNDIS_MSG_SET */
167 __le32 msg_len; 167 __le32 msg_len;
168 __le32 request_id; 168 __le32 request_id;
169 __le32 oid; 169 __le32 oid;
170 __le32 len; 170 __le32 len;
171 __le32 offset; 171 __le32 offset;
172/*?*/ __le32 handle; // zero 172/*?*/ __le32 handle; /* zero */
173} __attribute__ ((packed)); 173} __attribute__ ((packed));
174 174
175struct rndis_set_c { /* IN */ 175struct rndis_set_c { /* IN */
176 // header and: 176 /* header and: */
177 __le32 msg_type; /* RNDIS_MSG_SET_C */ 177 __le32 msg_type; /* RNDIS_MSG_SET_C */
178 __le32 msg_len; 178 __le32 msg_len;
179 __le32 request_id; 179 __le32 request_id;
@@ -181,14 +181,14 @@ struct rndis_set_c { /* IN */
181} __attribute__ ((packed)); 181} __attribute__ ((packed));
182 182
183struct rndis_reset { /* IN */ 183struct rndis_reset { /* IN */
184 // header and: 184 /* header and: */
185 __le32 msg_type; /* RNDIS_MSG_RESET */ 185 __le32 msg_type; /* RNDIS_MSG_RESET */
186 __le32 msg_len; 186 __le32 msg_len;
187 __le32 reserved; 187 __le32 reserved;
188} __attribute__ ((packed)); 188} __attribute__ ((packed));
189 189
190struct rndis_reset_c { /* OUT */ 190struct rndis_reset_c { /* OUT */
191 // header and: 191 /* header and: */
192 __le32 msg_type; /* RNDIS_MSG_RESET_C */ 192 __le32 msg_type; /* RNDIS_MSG_RESET_C */
193 __le32 msg_len; 193 __le32 msg_len;
194 __le32 status; 194 __le32 status;
@@ -196,7 +196,7 @@ struct rndis_reset_c { /* OUT */
196} __attribute__ ((packed)); 196} __attribute__ ((packed));
197 197
198struct rndis_indicate { /* IN (unrequested) */ 198struct rndis_indicate { /* IN (unrequested) */
199 // header and: 199 /* header and: */
200 __le32 msg_type; /* RNDIS_MSG_INDICATE */ 200 __le32 msg_type; /* RNDIS_MSG_INDICATE */
201 __le32 msg_len; 201 __le32 msg_len;
202 __le32 status; 202 __le32 status;
@@ -208,14 +208,14 @@ struct rndis_indicate { /* IN (unrequested) */
208} __attribute__ ((packed)); 208} __attribute__ ((packed));
209 209
210struct rndis_keepalive { /* OUT (optionally IN) */ 210struct rndis_keepalive { /* OUT (optionally IN) */
211 // header and: 211 /* header and: */
212 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ 212 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
213 __le32 msg_len; 213 __le32 msg_len;
214 __le32 request_id; 214 __le32 request_id;
215} __attribute__ ((packed)); 215} __attribute__ ((packed));
216 216
217struct rndis_keepalive_c { /* IN (optionally OUT) */ 217struct rndis_keepalive_c { /* IN (optionally OUT) */
218 // header and: 218 /* header and: */
219 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ 219 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
220 __le32 msg_len; 220 __le32 msg_len;
221 __le32 request_id; 221 __le32 request_id;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 1819396ed501..84a4c44c208b 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -35,6 +35,9 @@ enum port_dev_state {
35 PORT_UNREGISTERING, 35 PORT_UNREGISTERING,
36}; 36};
37 37
38/* USB serial flags */
39#define USB_SERIAL_WRITE_BUSY 0
40
38/** 41/**
39 * usb_serial_port: structure for the specific ports of a device. 42 * usb_serial_port: structure for the specific ports of a device.
40 * @serial: pointer back to the struct usb_serial owner of this port. 43 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -49,7 +52,7 @@ enum port_dev_state {
49 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. 52 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
50 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. 53 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
51 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe 54 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
52 * for this port. 55 * for this port.
53 * @bulk_in_buffer: pointer to the bulk in buffer for this port. 56 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
54 * @bulk_in_size: the size of the bulk_in_buffer, in bytes. 57 * @bulk_in_size: the size of the bulk_in_buffer, in bytes.
55 * @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.
@@ -60,13 +63,17 @@ enum port_dev_state {
60 * @write_urb: pointer to the bulk out struct urb for this port. 63 * @write_urb: pointer to the bulk out struct urb for this port.
61 * @write_fifo: kfifo used to buffer outgoing data 64 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs
69 * @tx_bytes: number of bytes currently in host stack queues
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 70 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 71 * port.
72 * @flags: usb serial port flags
65 * @write_wait: a wait_queue_head_t used by the port. 73 * @write_wait: a wait_queue_head_t used by the port.
66 * @work: work queue entry for the line discipline waking up. 74 * @work: work queue entry for the line discipline waking up.
67 * @throttled: nonzero if the read urb is inactive to throttle the device 75 * @throttled: nonzero if the read urb is inactive to throttle the device
68 * @throttle_req: nonzero if the tty wants to throttle us 76 * @throttle_req: nonzero if the tty wants to throttle us
69 * @console: attached usb serial console
70 * @dev: pointer to the serial device 77 * @dev: pointer to the serial device
71 * 78 *
72 * This structure is used by the usb-serial core and drivers for the specific 79 * This structure is used by the usb-serial core and drivers for the specific
@@ -97,16 +104,19 @@ struct usb_serial_port {
97 struct urb *write_urb; 104 struct urb *write_urb;
98 struct kfifo write_fifo; 105 struct kfifo write_fifo;
99 int write_urb_busy; 106 int write_urb_busy;
107
108 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2];
110 unsigned long write_urbs_free;
100 __u8 bulk_out_endpointAddress; 111 __u8 bulk_out_endpointAddress;
101 112
102 int tx_bytes_flight; 113 int tx_bytes;
103 int urbs_in_flight;
104 114
115 unsigned long flags;
105 wait_queue_head_t write_wait; 116 wait_queue_head_t write_wait;
106 struct work_struct work; 117 struct work_struct work;
107 char throttled; 118 char throttled;
108 char throttle_req; 119 char throttle_req;
109 char console;
110 unsigned long sysrq; /* sysrq timeout */ 120 unsigned long sysrq; /* sysrq timeout */
111 struct device dev; 121 struct device dev;
112 enum port_dev_state dev_state; 122 enum port_dev_state dev_state;
@@ -181,6 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * @id_table: pointer to a list of usb_device_id structures that define all 191 * @id_table: pointer to a list of usb_device_id structures that define all
182 * of the devices this structure can support. 192 * of the devices this structure can support.
183 * @num_ports: the number of different ports this device will have. 193 * @num_ports: the number of different ports this device will have.
194 * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
184 * @calc_num_ports: pointer to a function to determine how many ports this 196 * @calc_num_ports: pointer to a function to determine how many ports this
185 * device has dynamically. It will be called after the probe() 197 * device has dynamically. It will be called after the probe()
186 * callback is called, but before attach() 198 * callback is called, but before attach()
@@ -223,7 +235,9 @@ struct usb_serial_driver {
223 struct device_driver driver; 235 struct device_driver driver;
224 struct usb_driver *usb_driver; 236 struct usb_driver *usb_driver;
225 struct usb_dynids dynids; 237 struct usb_dynids dynids;
226 int max_in_flight_urbs; 238
239 size_t bulk_in_size;
240 size_t bulk_out_size;
227 241
228 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 242 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
229 int (*attach)(struct usb_serial *serial); 243 int (*attach)(struct usb_serial *serial);
@@ -269,6 +283,11 @@ struct usb_serial_driver {
269 void (*write_int_callback)(struct urb *urb); 283 void (*write_int_callback)(struct urb *urb);
270 void (*read_bulk_callback)(struct urb *urb); 284 void (*read_bulk_callback)(struct urb *urb);
271 void (*write_bulk_callback)(struct urb *urb); 285 void (*write_bulk_callback)(struct urb *urb);
286 /* Called by the generic read bulk callback */
287 void (*process_read_urb)(struct urb *urb);
288 /* Called by the generic write implementation */
289 int (*prepare_write_buffer)(struct usb_serial_port *port,
290 void *dest, size_t size);
272}; 291};
273#define to_usb_serial_driver(d) \ 292#define to_usb_serial_driver(d) \
274 container_of(d, struct usb_serial_driver, driver) 293 container_of(d, struct usb_serial_driver, driver)
@@ -318,8 +337,11 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
318extern void usb_serial_generic_release(struct usb_serial *serial); 337extern void usb_serial_generic_release(struct usb_serial *serial);
319extern int usb_serial_generic_register(int debug); 338extern int usb_serial_generic_register(int debug);
320extern void usb_serial_generic_deregister(void); 339extern void usb_serial_generic_deregister(void);
321extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, 340extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
322 gfp_t mem_flags); 341 gfp_t mem_flags);
342extern void usb_serial_generic_process_read_urb(struct urb *urb);
343extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
344 void *dest, size_t size);
323extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, 345extern int usb_serial_handle_sysrq_char(struct tty_struct *tty,
324 struct usb_serial_port *port, 346 struct usb_serial_port *port,
325 unsigned int ch); 347 unsigned int ch);
@@ -351,14 +373,11 @@ static inline void usb_serial_debug_data(int debug,
351 373
352/* Use our own dbg macro */ 374/* Use our own dbg macro */
353#undef dbg 375#undef dbg
354#define dbg(format, arg...) \ 376#define dbg(format, arg...) \
355 do { \ 377do { \
356 if (debug) \ 378 if (debug) \
357 printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ 379 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
358 ## arg); \ 380} while (0)
359 } while (0)
360
361
362 381
363#endif /* __LINUX_USB_SERIAL_H */ 382#endif /* __LINUX_USB_SERIAL_H */
364 383
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 20675c6ebc4d..2369d07c3c87 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -1,6 +1,146 @@
1/*
2 * ulpi.h -- ULPI defines and function prorotypes
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * This software is distributed under the terms of the GNU General
7 * Public License ("GPL") as published by the Free Software Foundation,
8 * version 2 of that License.
9 */
10
1#ifndef __LINUX_USB_ULPI_H 11#ifndef __LINUX_USB_ULPI_H
2#define __LINUX_USB_ULPI_H 12#define __LINUX_USB_ULPI_H
3 13
14/*-------------------------------------------------------------------------*/
15
16/*
17 * Macros for Set and Clear
18 * See ULPI 1.1 specification to find the registers with Set and Clear offsets
19 */
20#define ULPI_SET(a) (a + 1)
21#define ULPI_CLR(a) (a + 2)
22
23/*-------------------------------------------------------------------------*/
24
25/*
26 * Register Map
27 */
28#define ULPI_VENDOR_ID_LOW 0x00
29#define ULPI_VENDOR_ID_HIGH 0x01
30#define ULPI_PRODUCT_ID_LOW 0x02
31#define ULPI_PRODUCT_ID_HIGH 0x03
32#define ULPI_FUNC_CTRL 0x04
33#define ULPI_IFC_CTRL 0x07
34#define ULPI_OTG_CTRL 0x0a
35#define ULPI_USB_INT_EN_RISE 0x0d
36#define ULPI_USB_INT_EN_FALL 0x10
37#define ULPI_USB_INT_STS 0x13
38#define ULPI_USB_INT_LATCH 0x14
39#define ULPI_DEBUG 0x15
40#define ULPI_SCRATCH 0x16
41/* Optional Carkit Registers */
42#define ULPI_CARCIT_CTRL 0x19
43#define ULPI_CARCIT_INT_DELAY 0x1c
44#define ULPI_CARCIT_INT_EN 0x1d
45#define ULPI_CARCIT_INT_STS 0x20
46#define ULPI_CARCIT_INT_LATCH 0x21
47#define ULPI_CARCIT_PLS_CTRL 0x22
48/* Other Optional Registers */
49#define ULPI_TX_POS_WIDTH 0x25
50#define ULPI_TX_NEG_WIDTH 0x26
51#define ULPI_POLARITY_RECOVERY 0x27
52/* Access Extended Register Set */
53#define ULPI_ACCESS_EXTENDED 0x2f
54/* Vendor Specific */
55#define ULPI_VENDOR_SPECIFIC 0x30
56/* Extended Registers */
57#define ULPI_EXT_VENDOR_SPECIFIC 0x80
58
59/*-------------------------------------------------------------------------*/
60
61/* Function Control */
62#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0)
63#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0)
64#define ULPI_FUNC_CTRL_HIGH_SPEED (0 << 0)
65#define ULPI_FUNC_CTRL_FULL_SPEED (1 << 0)
66#define ULPI_FUNC_CTRL_LOW_SPEED (2 << 0)
67#define ULPI_FUNC_CTRL_FS4LS (3 << 0)
68#define ULPI_FUNC_CTRL_TERMSELECT (1 << 2)
69#define ULPI_FUNC_CTRL_OPMODE (1 << 3)
70#define ULPI_FUNC_CTRL_OPMODE_MASK (3 << 3)
71#define ULPI_FUNC_CTRL_OPMODE_NORMAL (0 << 3)
72#define ULPI_FUNC_CTRL_OPMODE_NONDRIVING (1 << 3)
73#define ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI (2 << 3)
74#define ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP (3 << 3)
75#define ULPI_FUNC_CTRL_RESET (1 << 5)
76#define ULPI_FUNC_CTRL_SUSPENDM (1 << 6)
77
78/* Interface Control */
79#define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE (1 << 0)
80#define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE (1 << 1)
81#define ULPI_IFC_CTRL_CARKITMODE (1 << 2)
82#define ULPI_IFC_CTRL_CLOCKSUSPENDM (1 << 3)
83#define ULPI_IFC_CTRL_AUTORESUME (1 << 4)
84#define ULPI_IFC_CTRL_EXTERNAL_VBUS (1 << 5)
85#define ULPI_IFC_CTRL_PASSTHRU (1 << 6)
86#define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE (1 << 7)
87
88/* OTG Control */
89#define ULPI_OTG_CTRL_ID_PULLUP (1 << 0)
90#define ULPI_OTG_CTRL_DP_PULLDOWN (1 << 1)
91#define ULPI_OTG_CTRL_DM_PULLDOWN (1 << 2)
92#define ULPI_OTG_CTRL_DISCHRGVBUS (1 << 3)
93#define ULPI_OTG_CTRL_CHRGVBUS (1 << 4)
94#define ULPI_OTG_CTRL_DRVVBUS (1 << 5)
95#define ULPI_OTG_CTRL_DRVVBUS_EXT (1 << 6)
96#define ULPI_OTG_CTRL_EXTVBUSIND (1 << 7)
97
98/* USB Interrupt Enable Rising,
99 * USB Interrupt Enable Falling,
100 * USB Interrupt Status and
101 * USB Interrupt Latch
102 */
103#define ULPI_INT_HOST_DISCONNECT (1 << 0)
104#define ULPI_INT_VBUS_VALID (1 << 1)
105#define ULPI_INT_SESS_VALID (1 << 2)
106#define ULPI_INT_SESS_END (1 << 3)
107#define ULPI_INT_IDGRD (1 << 4)
108
109/* Debug */
110#define ULPI_DEBUG_LINESTATE0 (1 << 0)
111#define ULPI_DEBUG_LINESTATE1 (1 << 1)
112
113/* Carkit Control */
114#define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0)
115#define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1)
116#define ULPI_CARKIT_CTRL_TXDEN (1 << 2)
117#define ULPI_CARKIT_CTRL_RXDEN (1 << 3)
118#define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4)
119#define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5)
120#define ULPI_CARKIT_CTRL_MICEN (1 << 6)
121
122/* Carkit Interrupt Enable */
123#define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0)
124#define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1)
125#define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2)
126#define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3)
127#define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4)
128
129/* Carkit Interrupt Status and
130 * Carkit Interrupt Latch
131 */
132#define ULPI_CARKIT_INT_IDFLOAT (1 << 0)
133#define ULPI_CARKIT_INT_CARINTDET (1 << 1)
134#define ULPI_CARKIT_INT_DP (1 << 2)
135
136/* Carkit Pulse Control*/
137#define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0)
138#define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1)
139#define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2)
140#define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3)
141
142/*-------------------------------------------------------------------------*/
143
4struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 144struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
5 unsigned int flags); 145 unsigned int flags);
6 146
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 8ce61359bf73..7ae27a473818 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -43,7 +43,7 @@ struct usbnet {
43 /* protocol/interface state */ 43 /* protocol/interface state */
44 struct net_device *net; 44 struct net_device *net;
45 int msg_enable; 45 int msg_enable;
46 unsigned long data [5]; 46 unsigned long data[5];
47 u32 xid; 47 u32 xid;
48 u32 hard_mtu; /* count any extra framing */ 48 u32 hard_mtu; /* count any extra framing */
49 size_t rx_urb_size; /* size for rx urbs */ 49 size_t rx_urb_size; /* size for rx urbs */
@@ -148,8 +148,8 @@ struct driver_info {
148 * much everything except custom framing and chip-specific stuff. 148 * much everything except custom framing and chip-specific stuff.
149 */ 149 */
150extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); 150extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
151extern int usbnet_suspend (struct usb_interface *, pm_message_t ); 151extern int usbnet_suspend(struct usb_interface *, pm_message_t);
152extern int usbnet_resume (struct usb_interface *); 152extern int usbnet_resume(struct usb_interface *);
153extern void usbnet_disconnect(struct usb_interface *); 153extern void usbnet_disconnect(struct usb_interface *);
154 154
155 155
@@ -165,8 +165,8 @@ struct cdc_state {
165 struct usb_interface *data; 165 struct usb_interface *data;
166}; 166};
167 167
168extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *); 168extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
169extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *); 169extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
170 170
171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
@@ -189,50 +189,31 @@ struct skb_data { /* skb->cb is one of these */
189 size_t length; 189 size_t length;
190}; 190};
191 191
192extern int usbnet_open (struct net_device *net); 192extern int usbnet_open(struct net_device *net);
193extern int usbnet_stop (struct net_device *net); 193extern int usbnet_stop(struct net_device *net);
194extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, 194extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,
195 struct net_device *net); 195 struct net_device *net);
196extern void usbnet_tx_timeout (struct net_device *net); 196extern void usbnet_tx_timeout(struct net_device *net);
197extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 197extern int usbnet_change_mtu(struct net_device *net, int new_mtu);
198 198
199extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 199extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
200extern int usbnet_get_ethernet_addr(struct usbnet *, int); 200extern int usbnet_get_ethernet_addr(struct usbnet *, int);
201extern void usbnet_defer_kevent (struct usbnet *, int); 201extern void usbnet_defer_kevent(struct usbnet *, int);
202extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 202extern void usbnet_skb_return(struct usbnet *, struct sk_buff *);
203extern void usbnet_unlink_rx_urbs(struct usbnet *); 203extern void usbnet_unlink_rx_urbs(struct usbnet *);
204 204
205extern void usbnet_pause_rx(struct usbnet *); 205extern void usbnet_pause_rx(struct usbnet *);
206extern void usbnet_resume_rx(struct usbnet *); 206extern void usbnet_resume_rx(struct usbnet *);
207extern void usbnet_purge_paused_rxq(struct usbnet *); 207extern void usbnet_purge_paused_rxq(struct usbnet *);
208 208
209extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); 209extern int usbnet_get_settings(struct net_device *net,
210extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); 210 struct ethtool_cmd *cmd);
211extern u32 usbnet_get_link (struct net_device *net); 211extern int usbnet_set_settings(struct net_device *net,
212extern u32 usbnet_get_msglevel (struct net_device *); 212 struct ethtool_cmd *cmd);
213extern void usbnet_set_msglevel (struct net_device *, u32); 213extern u32 usbnet_get_link(struct net_device *net);
214extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); 214extern u32 usbnet_get_msglevel(struct net_device *);
215extern void usbnet_set_msglevel(struct net_device *, u32);
216extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
215extern int usbnet_nway_reset(struct net_device *net); 217extern int usbnet_nway_reset(struct net_device *net);
216 218
217/* messaging support includes the interface name, so it must not be
218 * used before it has one ... notably, in minidriver bind() calls.
219 */
220#ifdef DEBUG
221#define devdbg(usbnet, fmt, arg...) \
222 printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
223#else
224#define devdbg(usbnet, fmt, arg...) \
225 ({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \
226 ## arg); 0; })
227#endif
228
229#define deverr(usbnet, fmt, arg...) \
230 printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
231#define devwarn(usbnet, fmt, arg...) \
232 printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
233
234#define devinfo(usbnet, fmt, arg...) \
235 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \
236
237
238#endif /* __LINUX_USB_USBNET_H */ 219#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h
deleted file mode 100644
index 1cfac67191ff..000000000000
--- a/include/linux/usb/vstusb.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/*****************************************************************************
2 * File: drivers/usb/misc/vstusb.h
3 *
4 * Purpose: Support for the bulk USB Vernier Spectrophotometers
5 *
6 * Author: EQware Engineering, Inc.
7 * Oregon City, OR, USA 97045
8 *
9 * Copyright: 2007, 2008
10 * Vernier Software & Technology
11 * Beaverton, OR, USA 97005
12 *
13 * Web: www.vernier.com
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 *
19 *****************************************************************************/
20/*****************************************************************************
21 *
22 * The vstusb module is a standard usb 'client' driver running on top of the
23 * standard usb host controller stack.
24 *
25 * In general, vstusb supports standard bulk usb pipes. It supports multiple
26 * devices and multiple pipes per device.
27 *
28 * The vstusb driver supports two interfaces:
29 * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg
30 * interface to any pipe with timeout support;
31 * 2 - standard read/write with ioctl config - offers standard read/write
32 * interface with ioctl configured pipes and timeouts.
33 *
34 * Both interfaces can be signal from other process and will abort its i/o
35 * operation.
36 *
37 * A timeout of 0 means NO timeout. The user can still terminate the read via
38 * signal.
39 *
40 * If using multiple threads with this driver, the user should ensure that
41 * any reads, writes, or ioctls are complete before closing the device.
42 * Changing read/write timeouts or pipes takes effect on next read/write.
43 *
44 *****************************************************************************/
45
46struct vstusb_args {
47 union {
48 /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, *
49 * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */
50 struct {
51 void __user *buffer;
52 size_t count;
53 unsigned int timeout_ms;
54 int pipe;
55 };
56
57 /* this one is used for IOCTL_VSTUSB_CONFIG_RW */
58 struct {
59 int rd_pipe;
60 int rd_timeout_ms;
61 int wr_pipe;
62 int wr_timeout_ms;
63 };
64 };
65};
66
67#define VST_IOC_MAGIC 'L'
68#define VST_IOC_FIRST 0x20
69#define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST)
70#define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1)
71#define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2)
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index fb7c359bdfba..f9dec37f617b 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -87,7 +87,7 @@ enum rpipe_crs {
87 * FIXME: explain rpipes 87 * FIXME: explain rpipes
88 */ 88 */
89struct usb_rpipe_descriptor { 89struct usb_rpipe_descriptor {
90 u8 bLength; 90 u8 bLength;
91 u8 bDescriptorType; 91 u8 bDescriptorType;
92 __le16 wRPipeIndex; 92 __le16 wRPipeIndex;
93 __le16 wRequests; 93 __le16 wRequests;
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
new file mode 100644
index 000000000000..5b7efbfcee4e
--- /dev/null
+++ b/include/linux/uuid.h
@@ -0,0 +1,70 @@
1/*
2 * UUID/GUID definition
3 *
4 * Copyright (C) 2010, Intel Corp.
5 * Huang Ying <ying.huang@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation;
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _LINUX_UUID_H_
22#define _LINUX_UUID_H_
23
24#include <linux/types.h>
25#include <linux/string.h>
26
27typedef struct {
28 __u8 b[16];
29} uuid_le;
30
31typedef struct {
32 __u8 b[16];
33} uuid_be;
34
35#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
36((uuid_le) \
37{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
38 (b) & 0xff, ((b) >> 8) & 0xff, \
39 (c) & 0xff, ((c) >> 8) & 0xff, \
40 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
41
42#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
43((uuid_be) \
44{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
45 ((b) >> 8) & 0xff, (b) & 0xff, \
46 ((c) >> 8) & 0xff, (c) & 0xff, \
47 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
48
49#define NULL_UUID_LE \
50 UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
51 0x00, 0x00, 0x00, 0x00)
52
53#define NULL_UUID_BE \
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00)
56
57static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
58{
59 return memcmp(&u1, &u2, sizeof(uuid_le));
60}
61
62static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
63{
64 return memcmp(&u1, &u2, sizeof(uuid_be));
65}
66
67extern void uuid_le_gen(uuid_le *u);
68extern void uuid_be_gen(uuid_be *u);
69
70#endif
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
new file mode 100644
index 000000000000..ae9ab13b963d
--- /dev/null
+++ b/include/linux/vga_switcheroo.h
@@ -0,0 +1,57 @@
1/*
2 * Copyright (c) 2010 Red Hat Inc.
3 * Author : Dave Airlie <airlied@redhat.com>
4 *
5 * Licensed under GPLv2
6 *
7 * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs
8 */
9
10#include <linux/fb.h>
11
12enum vga_switcheroo_state {
13 VGA_SWITCHEROO_OFF,
14 VGA_SWITCHEROO_ON,
15};
16
17enum vga_switcheroo_client_id {
18 VGA_SWITCHEROO_IGD,
19 VGA_SWITCHEROO_DIS,
20 VGA_SWITCHEROO_MAX_CLIENTS,
21};
22
23struct vga_switcheroo_handler {
24 int (*switchto)(enum vga_switcheroo_client_id id);
25 int (*power_state)(enum vga_switcheroo_client_id id,
26 enum vga_switcheroo_state state);
27 int (*init)(void);
28 int (*get_client_id)(struct pci_dev *pdev);
29};
30
31
32#if defined(CONFIG_VGA_SWITCHEROO)
33void vga_switcheroo_unregister_client(struct pci_dev *dev);
34int vga_switcheroo_register_client(struct pci_dev *dev,
35 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state),
36 bool (*can_switch)(struct pci_dev *dev));
37
38void vga_switcheroo_client_fb_set(struct pci_dev *dev,
39 struct fb_info *info);
40
41int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler);
42void vga_switcheroo_unregister_handler(void);
43
44int vga_switcheroo_process_delayed_switch(void);
45
46#else
47
48static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
49static inline int vga_switcheroo_register_client(struct pci_dev *dev,
50 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state),
51 bool (*can_switch)(struct pci_dev *dev)) { return 0; }
52static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
53static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
54static inline void vga_switcheroo_unregister_handler(void) {}
55static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
56
57#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2dfaa293ae8c..814f294d4cd0 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -5,9 +5,31 @@
5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> 5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com> 6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
7 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org> 7 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS
27 * IN THE SOFTWARE.
28 *
8 */ 29 */
9 30
10#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H
11 33
12#include <asm/vga.h> 34#include <asm/vga.h>
13 35
diff --git a/include/linux/vhost.h b/include/linux/vhost.h
new file mode 100644
index 000000000000..e847f1e30756
--- /dev/null
+++ b/include/linux/vhost.h
@@ -0,0 +1,130 @@
1#ifndef _LINUX_VHOST_H
2#define _LINUX_VHOST_H
3/* Userspace interface for in-kernel virtio accelerators. */
4
5/* vhost is used to reduce the number of system calls involved in virtio.
6 *
7 * Existing virtio net code is used in the guest without modification.
8 *
9 * This header includes interface used by userspace hypervisor for
10 * device configuration.
11 */
12
13#include <linux/types.h>
14#include <linux/compiler.h>
15#include <linux/ioctl.h>
16#include <linux/virtio_config.h>
17#include <linux/virtio_ring.h>
18
19struct vhost_vring_state {
20 unsigned int index;
21 unsigned int num;
22};
23
24struct vhost_vring_file {
25 unsigned int index;
26 int fd; /* Pass -1 to unbind from file. */
27
28};
29
30struct vhost_vring_addr {
31 unsigned int index;
32 /* Option flags. */
33 unsigned int flags;
34 /* Flag values: */
35 /* Whether log address is valid. If set enables logging. */
36#define VHOST_VRING_F_LOG 0
37
38 /* Start of array of descriptors (virtually contiguous) */
39 __u64 desc_user_addr;
40 /* Used structure address. Must be 32 bit aligned */
41 __u64 used_user_addr;
42 /* Available structure address. Must be 16 bit aligned */
43 __u64 avail_user_addr;
44 /* Logging support. */
45 /* Log writes to used structure, at offset calculated from specified
46 * address. Address must be 32 bit aligned. */
47 __u64 log_guest_addr;
48};
49
50struct vhost_memory_region {
51 __u64 guest_phys_addr;
52 __u64 memory_size; /* bytes */
53 __u64 userspace_addr;
54 __u64 flags_padding; /* No flags are currently specified. */
55};
56
57/* All region addresses and sizes must be 4K aligned. */
58#define VHOST_PAGE_SIZE 0x1000
59
60struct vhost_memory {
61 __u32 nregions;
62 __u32 padding;
63 struct vhost_memory_region regions[0];
64};
65
66/* ioctls */
67
68#define VHOST_VIRTIO 0xAF
69
70/* Features bitmask for forward compatibility. Transport bits are used for
71 * vhost specific features. */
72#define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64)
73#define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64)
74
75/* Set current process as the (exclusive) owner of this file descriptor. This
76 * must be called before any other vhost command. Further calls to
77 * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */
78#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
79/* Give up ownership, and reset the device to default values.
80 * Allows subsequent call to VHOST_OWNER_SET to succeed. */
81#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
82
83/* Set up/modify memory layout */
84#define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
85
86/* Write logging setup. */
87/* Memory writes can optionally be logged by setting bit at an offset
88 * (calculated from the physical address) from specified log base.
89 * The bit is set using an atomic 32 bit operation. */
90/* Set base address for logging. */
91#define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
92/* Specify an eventfd file descriptor to signal on log write. */
93#define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
94
95/* Ring setup. */
96/* Set number of descriptors in ring. This parameter can not
97 * be modified while ring is running (bound to a device). */
98#define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state)
99/* Set addresses for the ring. */
100#define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr)
101/* Base value where queue looks for available descriptors */
102#define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
103/* Get accessor: reads index, writes value in num */
104#define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
105
106/* The following ioctls use eventfd file descriptors to signal and poll
107 * for events. */
108
109/* Set eventfd to poll for added buffers */
110#define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file)
111/* Set eventfd to signal when buffers have beed used */
112#define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file)
113/* Set eventfd to signal an error */
114#define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file)
115
116/* VHOST_NET specific defines */
117
118/* Attach virtio net ring to a raw socket, or tap device.
119 * The socket must be already bound to an ethernet device, this device will be
120 * used for transmit. Pass fd -1 to unbind from the socket and the transmit
121 * device. This can be used to stop the ring (e.g. for migration). */
122#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
123
124/* Feature bits */
125/* Log all write descriptors. Can be changed while device is active. */
126#define VHOST_F_LOG_ALL 26
127/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
128#define VHOST_NET_F_VIRTIO_NET_HDR 27
129
130#endif
diff --git a/include/linux/via-core.h b/include/linux/via-core.h
new file mode 100644
index 000000000000..7ffb521e1a7a
--- /dev/null
+++ b/include/linux/via-core.h
@@ -0,0 +1,219 @@
1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2009-2010 Jonathan Corbet <corbet@lwn.net>
5 * Copyright 2010 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation;
10 * either version 2, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR
15 * A PARTICULAR PURPOSE.See the GNU General Public License
16 * 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.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __VIA_CORE_H__
25#define __VIA_CORE_H__
26#include <linux/types.h>
27#include <linux/io.h>
28#include <linux/spinlock.h>
29#include <linux/pci.h>
30
31/*
32 * A description of each known serial I2C/GPIO port.
33 */
34enum via_port_type {
35 VIA_PORT_NONE = 0,
36 VIA_PORT_I2C,
37 VIA_PORT_GPIO,
38};
39
40enum via_port_mode {
41 VIA_MODE_OFF = 0,
42 VIA_MODE_I2C, /* Used as I2C port */
43 VIA_MODE_GPIO, /* Two GPIO ports */
44};
45
46enum viafb_i2c_adap {
47 VIA_PORT_26 = 0,
48 VIA_PORT_31,
49 VIA_PORT_25,
50 VIA_PORT_2C,
51 VIA_PORT_3D,
52};
53#define VIAFB_NUM_PORTS 5
54
55struct via_port_cfg {
56 enum via_port_type type;
57 enum via_port_mode mode;
58 u16 io_port;
59 u8 ioport_index;
60};
61
62/*
63 * This is the global viafb "device" containing stuff needed by
64 * all subdevs.
65 */
66struct viafb_dev {
67 struct pci_dev *pdev;
68 int chip_type;
69 struct via_port_cfg *port_cfg;
70 /*
71 * Spinlock for access to device registers. Not yet
72 * globally used.
73 */
74 spinlock_t reg_lock;
75 /*
76 * The framebuffer MMIO region. Little, if anything, touches
77 * this memory directly, and certainly nothing outside of the
78 * framebuffer device itself. We *do* have to be able to allocate
79 * chunks of this memory for other devices, though.
80 */
81 unsigned long fbmem_start;
82 long fbmem_len;
83 void __iomem *fbmem;
84#if defined(CONFIG_FB_VIA_CAMERA) || defined(CONFIG_FB_VIA_CAMERA_MODULE)
85 long camera_fbmem_offset;
86 long camera_fbmem_size;
87#endif
88 /*
89 * The MMIO region for device registers.
90 */
91 unsigned long engine_start;
92 unsigned long engine_len;
93 void __iomem *engine_mmio;
94
95};
96
97/*
98 * Interrupt management.
99 */
100
101void viafb_irq_enable(u32 mask);
102void viafb_irq_disable(u32 mask);
103
104/*
105 * The global interrupt control register and its bits.
106 */
107#define VDE_INTERRUPT 0x200 /* Video interrupt flags/masks */
108#define VDE_I_DVISENSE 0x00000001 /* DVI sense int status */
109#define VDE_I_VBLANK 0x00000002 /* Vertical blank status */
110#define VDE_I_MCCFI 0x00000004 /* MCE compl. frame int status */
111#define VDE_I_VSYNC 0x00000008 /* VGA VSYNC int status */
112#define VDE_I_DMA0DDONE 0x00000010 /* DMA 0 descr done */
113#define VDE_I_DMA0TDONE 0x00000020 /* DMA 0 transfer done */
114#define VDE_I_DMA1DDONE 0x00000040 /* DMA 1 descr done */
115#define VDE_I_DMA1TDONE 0x00000080 /* DMA 1 transfer done */
116#define VDE_I_C1AV 0x00000100 /* Cap Eng 1 act vid end */
117#define VDE_I_HQV0 0x00000200 /* First HQV engine */
118#define VDE_I_HQV1 0x00000400 /* Second HQV engine */
119#define VDE_I_HQV1EN 0x00000800 /* Second HQV engine enable */
120#define VDE_I_C0AV 0x00001000 /* Cap Eng 0 act vid end */
121#define VDE_I_C0VBI 0x00002000 /* Cap Eng 0 VBI end */
122#define VDE_I_C1VBI 0x00004000 /* Cap Eng 1 VBI end */
123#define VDE_I_VSYNC2 0x00008000 /* Sec. Disp. VSYNC */
124#define VDE_I_DVISNSEN 0x00010000 /* DVI sense enable */
125#define VDE_I_VSYNC2EN 0x00020000 /* Sec Disp VSYNC enable */
126#define VDE_I_MCCFIEN 0x00040000 /* MC comp frame int mask enable */
127#define VDE_I_VSYNCEN 0x00080000 /* VSYNC enable */
128#define VDE_I_DMA0DDEN 0x00100000 /* DMA 0 descr done enable */
129#define VDE_I_DMA0TDEN 0x00200000 /* DMA 0 trans done enable */
130#define VDE_I_DMA1DDEN 0x00400000 /* DMA 1 descr done enable */
131#define VDE_I_DMA1TDEN 0x00800000 /* DMA 1 trans done enable */
132#define VDE_I_C1AVEN 0x01000000 /* cap 1 act vid end enable */
133#define VDE_I_HQV0EN 0x02000000 /* First hqv engine enable */
134#define VDE_I_C1VBIEN 0x04000000 /* Cap 1 VBI end enable */
135#define VDE_I_LVDSSI 0x08000000 /* LVDS sense interrupt */
136#define VDE_I_C0AVEN 0x10000000 /* Cap 0 act vid end enable */
137#define VDE_I_C0VBIEN 0x20000000 /* Cap 0 VBI end enable */
138#define VDE_I_LVDSSIEN 0x40000000 /* LVDS Sense enable */
139#define VDE_I_ENABLE 0x80000000 /* Global interrupt enable */
140
141/*
142 * DMA management.
143 */
144int viafb_request_dma(void);
145void viafb_release_dma(void);
146/* void viafb_dma_copy_out(unsigned int offset, dma_addr_t paddr, int len); */
147int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg);
148
149/*
150 * DMA Controller registers.
151 */
152#define VDMA_MR0 0xe00 /* Mod reg 0 */
153#define VDMA_MR_CHAIN 0x01 /* Chaining mode */
154#define VDMA_MR_TDIE 0x02 /* Transfer done int enable */
155#define VDMA_CSR0 0xe04 /* Control/status */
156#define VDMA_C_ENABLE 0x01 /* DMA Enable */
157#define VDMA_C_START 0x02 /* Start a transfer */
158#define VDMA_C_ABORT 0x04 /* Abort a transfer */
159#define VDMA_C_DONE 0x08 /* Transfer is done */
160#define VDMA_MARL0 0xe20 /* Mem addr low */
161#define VDMA_MARH0 0xe24 /* Mem addr high */
162#define VDMA_DAR0 0xe28 /* Device address */
163#define VDMA_DQWCR0 0xe2c /* Count (16-byte) */
164#define VDMA_TMR0 0xe30 /* Tile mode reg */
165#define VDMA_DPRL0 0xe34 /* Not sure */
166#define VDMA_DPR_IN 0x08 /* Inbound transfer to FB */
167#define VDMA_DPRH0 0xe38
168#define VDMA_PMR0 (0xe00 + 0x134) /* Pitch mode */
169
170/*
171 * Useful stuff that probably belongs somewhere global.
172 */
173#define VGA_WIDTH 640
174#define VGA_HEIGHT 480
175
176/*
177 * Indexed port operations. Note that these are all multi-op
178 * functions; every invocation will be racy if you're not holding
179 * reg_lock.
180 */
181
182#define VIAStatus 0x3DA /* Non-indexed port */
183#define VIACR 0x3D4
184#define VIASR 0x3C4
185#define VIAGR 0x3CE
186#define VIAAR 0x3C0
187
188static inline u8 via_read_reg(u16 port, u8 index)
189{
190 outb(index, port);
191 return inb(port + 1);
192}
193
194static inline void via_write_reg(u16 port, u8 index, u8 data)
195{
196 outb(index, port);
197 outb(data, port + 1);
198}
199
200static inline void via_write_reg_mask(u16 port, u8 index, u8 data, u8 mask)
201{
202 u8 old;
203
204 outb(index, port);
205 old = inb(port + 1);
206 outb((data & mask) | (old & ~mask), port + 1);
207}
208
209#define VIA_MISC_REG_READ 0x03CC
210#define VIA_MISC_REG_WRITE 0x03C2
211
212static inline void via_write_misc_reg_mask(u8 data, u8 mask)
213{
214 u8 old = inb(VIA_MISC_REG_READ);
215 outb((data & mask) | (old & ~mask), VIA_MISC_REG_WRITE);
216}
217
218
219#endif /* __VIA_CORE_H__ */
diff --git a/include/linux/via-gpio.h b/include/linux/via-gpio.h
new file mode 100644
index 000000000000..8281aea3dd6d
--- /dev/null
+++ b/include/linux/via-gpio.h
@@ -0,0 +1,14 @@
1/*
2 * Support for viafb GPIO ports.
3 *
4 * Copyright 2009 Jonathan Corbet <corbet@lwn.net>
5 * Distributable under version 2 of the GNU General Public License.
6 */
7
8#ifndef __VIA_GPIO_H__
9#define __VIA_GPIO_H__
10
11extern int viafb_gpio_lookup(const char *name);
12extern int viafb_gpio_init(void);
13extern void viafb_gpio_exit(void);
14#endif
diff --git a/include/linux/via_i2c.h b/include/linux/via_i2c.h
new file mode 100644
index 000000000000..44532e468c05
--- /dev/null
+++ b/include/linux/via_i2c.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation;
8 * either version 2, or (at your option) any later version.
9
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
12 * the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE.See the GNU General Public License
14 * for more details.
15
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21#ifndef __VIA_I2C_H__
22#define __VIA_I2C_H__
23
24#include <linux/i2c.h>
25#include <linux/i2c-algo-bit.h>
26
27struct via_i2c_stuff {
28 u16 i2c_port; /* GPIO or I2C port */
29 u16 is_active; /* Being used as I2C? */
30 struct i2c_adapter adapter;
31 struct i2c_algo_bit_data algo;
32};
33
34
35int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata);
36int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data);
37int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len);
38struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which);
39
40extern int viafb_i2c_init(void);
41extern void viafb_i2c_exit(void);
42#endif /* __VIA_I2C_H__ */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index d4962a782b8a..047f7e6edb86 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -160,16 +160,6 @@ enum v4l2_buf_type {
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 160 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 161};
162 162
163enum v4l2_ctrl_type {
164 V4L2_CTRL_TYPE_INTEGER = 1,
165 V4L2_CTRL_TYPE_BOOLEAN = 2,
166 V4L2_CTRL_TYPE_MENU = 3,
167 V4L2_CTRL_TYPE_BUTTON = 4,
168 V4L2_CTRL_TYPE_INTEGER64 = 5,
169 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
170 V4L2_CTRL_TYPE_STRING = 7,
171};
172
173enum v4l2_tuner_type { 163enum v4l2_tuner_type {
174 V4L2_TUNER_RADIO = 1, 164 V4L2_TUNER_RADIO = 1,
175 V4L2_TUNER_ANALOG_TV = 2, 165 V4L2_TUNER_ANALOG_TV = 2,
@@ -294,6 +284,8 @@ struct v4l2_pix_format {
294 284
295/* Grey formats */ 285/* Grey formats */
296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 286#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
287#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
288#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
297#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ 289#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
298#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
299 291
@@ -350,6 +342,7 @@ struct v4l2_pix_format {
350#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ 342#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
351 343
352/* Vendor-specific formats */ 344/* Vendor-specific formats */
345#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
353#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ 346#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
354#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ 347#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
355#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ 348#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
@@ -362,11 +355,13 @@ struct v4l2_pix_format {
362#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ 355#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
363#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ 356#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
364#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 357#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
358#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
365#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 359#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
366#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 360#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
367#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 361#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
368#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 362#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
369#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ 363#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
364#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
370 365
371/* 366/*
372 * F O R M A T E N U M E R A T I O N 367 * F O R M A T E N U M E R A T I O N
@@ -547,6 +542,8 @@ struct v4l2_buffer {
547#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ 542#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
548#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ 543#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
549#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ 544#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
545/* Buffer is ready, but the data contained within is corrupted. */
546#define V4L2_BUF_FLAG_ERROR 0x0040
550#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 547#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
551#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ 548#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
552 549
@@ -937,6 +934,16 @@ struct v4l2_ext_controls {
937#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 934#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
938#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 935#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
939 936
937enum v4l2_ctrl_type {
938 V4L2_CTRL_TYPE_INTEGER = 1,
939 V4L2_CTRL_TYPE_BOOLEAN = 2,
940 V4L2_CTRL_TYPE_MENU = 3,
941 V4L2_CTRL_TYPE_BUTTON = 4,
942 V4L2_CTRL_TYPE_INTEGER64 = 5,
943 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
944 V4L2_CTRL_TYPE_STRING = 7,
945};
946
940/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 947/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
941struct v4l2_queryctrl { 948struct v4l2_queryctrl {
942 __u32 id; 949 __u32 id;
@@ -1021,14 +1028,24 @@ enum v4l2_colorfx {
1021 V4L2_COLORFX_NONE = 0, 1028 V4L2_COLORFX_NONE = 0,
1022 V4L2_COLORFX_BW = 1, 1029 V4L2_COLORFX_BW = 1,
1023 V4L2_COLORFX_SEPIA = 2, 1030 V4L2_COLORFX_SEPIA = 2,
1031 V4L2_COLORFX_NEGATIVE = 3,
1032 V4L2_COLORFX_EMBOSS = 4,
1033 V4L2_COLORFX_SKETCH = 5,
1034 V4L2_COLORFX_SKY_BLUE = 6,
1035 V4L2_COLORFX_GRASS_GREEN = 7,
1036 V4L2_COLORFX_SKIN_WHITEN = 8,
1037 V4L2_COLORFX_VIVID = 9,
1024}; 1038};
1025#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 1039#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1026#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 1040#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
1027 1041
1028#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) 1042#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
1029#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) 1043#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
1044
1045#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1046
1030/* last CID + 1 */ 1047/* last CID + 1 */
1031#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) 1048#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37)
1032 1049
1033/* MPEG-class control IDs defined by V4L2 */ 1050/* MPEG-class control IDs defined by V4L2 */
1034#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1051#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1274,6 +1291,9 @@ enum v4l2_exposure_auto_type {
1274 1291
1275#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) 1292#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1276 1293
1294#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1295#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1296
1277/* FM Modulator class control IDs */ 1297/* FM Modulator class control IDs */
1278#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1298#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1279#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1299#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
@@ -1619,6 +1639,38 @@ struct v4l2_streamparm {
1619}; 1639};
1620 1640
1621/* 1641/*
1642 * E V E N T S
1643 */
1644
1645#define V4L2_EVENT_ALL 0
1646#define V4L2_EVENT_VSYNC 1
1647#define V4L2_EVENT_EOS 2
1648#define V4L2_EVENT_PRIVATE_START 0x08000000
1649
1650/* Payload for V4L2_EVENT_VSYNC */
1651struct v4l2_event_vsync {
1652 /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
1653 __u8 field;
1654} __attribute__ ((packed));
1655
1656struct v4l2_event {
1657 __u32 type;
1658 union {
1659 struct v4l2_event_vsync vsync;
1660 __u8 data[64];
1661 } u;
1662 __u32 pending;
1663 __u32 sequence;
1664 struct timespec timestamp;
1665 __u32 reserved[9];
1666};
1667
1668struct v4l2_event_subscription {
1669 __u32 type;
1670 __u32 reserved[7];
1671};
1672
1673/*
1622 * A D V A N C E D D E B U G G I N G 1674 * A D V A N C E D D E B U G G I N G
1623 * 1675 *
1624 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! 1676 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
@@ -1740,6 +1792,9 @@ struct v4l2_dbg_chip_ident {
1740#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) 1792#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1741#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1793#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1742#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) 1794#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1795#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
1796#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
1797#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
1743 1798
1744/* Reminder: when adding new ioctls please add support for them to 1799/* Reminder: when adding new ioctls please add support for them to
1745 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1800 drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 057a2e010758..aff5b4f74041 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -7,6 +7,7 @@
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
10#include <linux/gfp.h>
10 11
11/** 12/**
12 * virtqueue - a queue to register buffers for sending or receiving. 13 * virtqueue - a queue to register buffers for sending or receiving.
@@ -14,7 +15,6 @@
14 * @callback: the function to call when buffers are consumed (can be NULL). 15 * @callback: the function to call when buffers are consumed (can be NULL).
15 * @name: the name of this virtqueue (mainly for debugging) 16 * @name: the name of this virtqueue (mainly for debugging)
16 * @vdev: the virtio device this queue was created for. 17 * @vdev: the virtio device this queue was created for.
17 * @vq_ops: the operations for this virtqueue (see below).
18 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
19 */ 19 */
20struct virtqueue { 20struct virtqueue {
@@ -22,56 +22,71 @@ struct virtqueue {
22 void (*callback)(struct virtqueue *vq); 22 void (*callback)(struct virtqueue *vq);
23 const char *name; 23 const char *name;
24 struct virtio_device *vdev; 24 struct virtio_device *vdev;
25 struct virtqueue_ops *vq_ops;
26 void *priv; 25 void *priv;
27}; 26};
28 27
29/** 28/**
30 * virtqueue_ops - operations for virtqueue abstraction layer 29 * operations for virtqueue
31 * @add_buf: expose buffer to other end 30 * virtqueue_add_buf: expose buffer to other end
32 * vq: the struct virtqueue we're talking about. 31 * vq: the struct virtqueue we're talking about.
33 * sg: the description of the buffer(s). 32 * sg: the description of the buffer(s).
34 * out_num: the number of sg readable by other side 33 * out_num: the number of sg readable by other side
35 * in_num: the number of sg which are writable (after readable ones) 34 * in_num: the number of sg which are writable (after readable ones)
36 * data: the token identifying the buffer. 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. 37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * @kick: update after add_buf 38 * virtqueue_kick: update after add_buf
39 * vq: the struct virtqueue 39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side. 40 * After one or more add_buf calls, invoke this to kick the other side.
41 * @get_buf: get the next used buffer 41 * virtqueue_get_buf: get the next used buffer
42 * vq: the struct virtqueue we're talking about. 42 * vq: the struct virtqueue we're talking about.
43 * len: the length written into the buffer 43 * len: the length written into the buffer
44 * Returns NULL or the "data" token handed to add_buf. 44 * Returns NULL or the "data" token handed to add_buf.
45 * @disable_cb: disable callbacks 45 * virtqueue_disable_cb: disable callbacks
46 * vq: the struct virtqueue we're talking about. 46 * vq: the struct virtqueue we're talking about.
47 * Note that this is not necessarily synchronous, hence unreliable and only 47 * Note that this is not necessarily synchronous, hence unreliable and only
48 * useful as an optimization. 48 * useful as an optimization.
49 * @enable_cb: restart callbacks after disable_cb. 49 * virtqueue_enable_cb: restart callbacks after disable_cb.
50 * vq: the struct virtqueue we're talking about. 50 * vq: the struct virtqueue we're talking about.
51 * This re-enables callbacks; it returns "false" if there are pending 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 52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks. 53 * checking for more work, and enabling callbacks.
54 * virtqueue_detach_unused_buf: detach first unused buffer
55 * vq: the struct virtqueue we're talking about.
56 * Returns NULL or the "data" token handed to add_buf
54 * 57 *
55 * Locking rules are straightforward: the driver is responsible for 58 * Locking rules are straightforward: the driver is responsible for
56 * locking. No two operations may be invoked simultaneously, with the exception 59 * locking. No two operations may be invoked simultaneously, with the exception
57 * of @disable_cb. 60 * of virtqueue_disable_cb.
58 * 61 *
59 * All operations can be called in any context. 62 * All operations can be called in any context.
60 */ 63 */
61struct virtqueue_ops {
62 int (*add_buf)(struct virtqueue *vq,
63 struct scatterlist sg[],
64 unsigned int out_num,
65 unsigned int in_num,
66 void *data);
67 64
68 void (*kick)(struct virtqueue *vq); 65int virtqueue_add_buf_gfp(struct virtqueue *vq,
66 struct scatterlist sg[],
67 unsigned int out_num,
68 unsigned int in_num,
69 void *data,
70 gfp_t gfp);
69 71
70 void *(*get_buf)(struct virtqueue *vq, unsigned int *len); 72static inline int virtqueue_add_buf(struct virtqueue *vq,
73 struct scatterlist sg[],
74 unsigned int out_num,
75 unsigned int in_num,
76 void *data)
77{
78 return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC);
79}
71 80
72 void (*disable_cb)(struct virtqueue *vq); 81void virtqueue_kick(struct virtqueue *vq);
73 bool (*enable_cb)(struct virtqueue *vq); 82
74}; 83void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
84
85void virtqueue_disable_cb(struct virtqueue *vq);
86
87bool virtqueue_enable_cb(struct virtqueue *vq);
88
89void *virtqueue_detach_unused_buf(struct virtqueue *vq);
75 90
76/** 91/**
77 * virtio_device - representation of a device using virtio 92 * virtio_device - representation of a device using virtio
@@ -94,6 +109,7 @@ struct virtio_device {
94 void *priv; 109 void *priv;
95}; 110};
96 111
112#define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev)
97int register_virtio_device(struct virtio_device *dev); 113int register_virtio_device(struct virtio_device *dev);
98void unregister_virtio_device(struct virtio_device *dev); 114void unregister_virtio_device(struct virtio_device *dev);
99 115
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 095e10d148b4..5cf11765146b 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -5,7 +5,16 @@
5#include <linux/virtio_ids.h> 5#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
7 7
8/* Maximum number of virtio channels per partition (1 for now) */ 8/* The feature bitmap for virtio 9P */
9#define MAX_9P_CHAN 1 9
10/* The mount point is specified in a config variable */
11#define VIRTIO_9P_MOUNT_TAG 0
12
13struct virtio_9p_config {
14 /* length of the tag name */
15 __u16 tag_len;
16 /* non-NULL terminated tag name */
17 __u8 tag[0];
18} __attribute__((packed));
10 19
11#endif /* _LINUX_VIRTIO_9P_H */ 20#endif /* _LINUX_VIRTIO_9P_H */
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 1418f048cb34..a50ecd1b81a2 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -7,6 +7,7 @@
7 7
8/* The feature bitmap for virtio balloon */ 8/* The feature bitmap for virtio balloon */
9#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ 9#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
10#define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */
10 11
11/* Size of a PFN in the balloon interface. */ 12/* Size of a PFN in the balloon interface. */
12#define VIRTIO_BALLOON_PFN_SHIFT 12 13#define VIRTIO_BALLOON_PFN_SHIFT 12
@@ -18,4 +19,18 @@ struct virtio_balloon_config
18 /* Number of pages we've actually got in balloon. */ 19 /* Number of pages we've actually got in balloon. */
19 __le32 actual; 20 __le32 actual;
20}; 21};
22
23#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */
24#define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */
25#define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */
26#define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */
27#define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */
28#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */
29#define VIRTIO_BALLOON_S_NR 6
30
31struct virtio_balloon_stat {
32 u16 tag;
33 u64 val;
34} __attribute__((packed));
35
21#endif /* _LINUX_VIRTIO_BALLOON_H */ 36#endif /* _LINUX_VIRTIO_BALLOON_H */
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index fd294c56d571..167720d695ed 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -15,6 +15,9 @@
15#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 15#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
18#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
19
20#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
18 21
19struct virtio_blk_config { 22struct virtio_blk_config {
20 /* The capacity (in 512-byte sectors). */ 23 /* The capacity (in 512-byte sectors). */
@@ -29,8 +32,20 @@ struct virtio_blk_config {
29 __u8 heads; 32 __u8 heads;
30 __u8 sectors; 33 __u8 sectors;
31 } geometry; 34 } geometry;
35
32 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ 36 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
33 __u32 blk_size; 37 __u32 blk_size;
38
39 /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */
40 /* exponent for physical block per logical block. */
41 __u8 physical_block_exp;
42 /* alignment offset in logical blocks. */
43 __u8 alignment_offset;
44 /* minimum I/O size without performance penalty in logical blocks. */
45 __u16 min_io_size;
46 /* optimal sustained I/O size in logical blocks. */
47 __u32 opt_io_size;
48
34} __attribute__((packed)); 49} __attribute__((packed));
35 50
36/* 51/*
@@ -54,6 +69,9 @@ struct virtio_blk_config {
54/* Cache flush command */ 69/* Cache flush command */
55#define VIRTIO_BLK_T_FLUSH 4 70#define VIRTIO_BLK_T_FLUSH 4
56 71
72/* Get device ID command */
73#define VIRTIO_BLK_T_GET_ID 8
74
57/* Barrier before this op. */ 75/* Barrier before this op. */
58#define VIRTIO_BLK_T_BARRIER 0x80000000 76#define VIRTIO_BLK_T_BARRIER 0x80000000
59 77
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index fe885174cc1f..a85064db8f94 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -3,19 +3,47 @@
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/virtio_ids.h> 4#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
6/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 6/*
7 * anyone can use the definitions to implement compatible drivers/servers. */ 7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
8 * anyone can use the definitions to implement compatible drivers/servers.
9 *
10 * Copyright (C) Red Hat, Inc., 2009, 2010
11 */
8 12
9/* Feature bits */ 13/* Feature bits */
10#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 14#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
15#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
16
17#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
11 18
12struct virtio_console_config { 19struct virtio_console_config {
13 /* colums of the screens */ 20 /* colums of the screens */
14 __u16 cols; 21 __u16 cols;
15 /* rows of the screens */ 22 /* rows of the screens */
16 __u16 rows; 23 __u16 rows;
24 /* max. number of ports this device can hold */
25 __u32 max_nr_ports;
17} __attribute__((packed)); 26} __attribute__((packed));
18 27
28/*
29 * A message that's passed between the Host and the Guest for a
30 * particular port.
31 */
32struct virtio_console_control {
33 __u32 id; /* Port number */
34 __u16 event; /* The kind of control event (see below) */
35 __u16 value; /* Extra information for the key */
36};
37
38/* Some events for control messages */
39#define VIRTIO_CONSOLE_DEVICE_READY 0
40#define VIRTIO_CONSOLE_PORT_ADD 1
41#define VIRTIO_CONSOLE_PORT_REMOVE 2
42#define VIRTIO_CONSOLE_PORT_READY 3
43#define VIRTIO_CONSOLE_CONSOLE_PORT 4
44#define VIRTIO_CONSOLE_RESIZE 5
45#define VIRTIO_CONSOLE_PORT_OPEN 6
46#define VIRTIO_CONSOLE_PORT_NAME 7
19 47
20#ifdef __KERNEL__ 48#ifdef __KERNEL__
21int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 49int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index ee03bba9c5df..7f43ccdc1d38 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -43,6 +43,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
43 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 43 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
44 KSWAPD_SKIP_CONGESTION_WAIT, 44 KSWAPD_SKIP_CONGESTION_WAIT,
45 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 45 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
46#ifdef CONFIG_COMPACTION
47 COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED,
48 COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
49#endif
46#ifdef CONFIG_HUGETLB_PAGE 50#ifdef CONFIG_HUGETLB_PAGE
47 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 51 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
48#endif 52#endif
@@ -78,22 +82,22 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
78 82
79static inline void __count_vm_event(enum vm_event_item item) 83static inline void __count_vm_event(enum vm_event_item item)
80{ 84{
81 __this_cpu_inc(per_cpu_var(vm_event_states).event[item]); 85 __this_cpu_inc(vm_event_states.event[item]);
82} 86}
83 87
84static inline void count_vm_event(enum vm_event_item item) 88static inline void count_vm_event(enum vm_event_item item)
85{ 89{
86 this_cpu_inc(per_cpu_var(vm_event_states).event[item]); 90 this_cpu_inc(vm_event_states.event[item]);
87} 91}
88 92
89static inline void __count_vm_events(enum vm_event_item item, long delta) 93static inline void __count_vm_events(enum vm_event_item item, long delta)
90{ 94{
91 __this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); 95 __this_cpu_add(vm_event_states.event[item], delta);
92} 96}
93 97
94static inline void count_vm_events(enum vm_event_item item, long delta) 98static inline void count_vm_events(enum vm_event_item item, long delta)
95{ 99{
96 this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); 100 this_cpu_add(vm_event_states.event[item], delta);
97} 101}
98 102
99extern void all_vm_events(unsigned long *); 103extern void all_vm_events(unsigned long *);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b77d5e..0836ccc57121 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -127,12 +127,26 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
127/* 127/*
128 * Used for wake-one threads: 128 * Used for wake-one threads:
129 */ 129 */
130static inline void __add_wait_queue_exclusive(wait_queue_head_t *q,
131 wait_queue_t *wait)
132{
133 wait->flags |= WQ_FLAG_EXCLUSIVE;
134 __add_wait_queue(q, wait);
135}
136
130static inline void __add_wait_queue_tail(wait_queue_head_t *head, 137static inline void __add_wait_queue_tail(wait_queue_head_t *head,
131 wait_queue_t *new) 138 wait_queue_t *new)
132{ 139{
133 list_add_tail(&new->task_list, &head->task_list); 140 list_add_tail(&new->task_list, &head->task_list);
134} 141}
135 142
143static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q,
144 wait_queue_t *wait)
145{
146 wait->flags |= WQ_FLAG_EXCLUSIVE;
147 __add_wait_queue_tail(q, wait);
148}
149
136static inline void __remove_wait_queue(wait_queue_head_t *head, 150static inline void __remove_wait_queue(wait_queue_head_t *head,
137 wait_queue_t *old) 151 wait_queue_t *old)
138{ 152{
@@ -362,6 +376,155 @@ do { \
362 __ret; \ 376 __ret; \
363}) 377})
364 378
379
380#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
381({ \
382 int __ret = 0; \
383 DEFINE_WAIT(__wait); \
384 if (exclusive) \
385 __wait.flags |= WQ_FLAG_EXCLUSIVE; \
386 do { \
387 if (likely(list_empty(&__wait.task_list))) \
388 __add_wait_queue_tail(&(wq), &__wait); \
389 set_current_state(TASK_INTERRUPTIBLE); \
390 if (signal_pending(current)) { \
391 __ret = -ERESTARTSYS; \
392 break; \
393 } \
394 if (irq) \
395 spin_unlock_irq(&(wq).lock); \
396 else \
397 spin_unlock(&(wq).lock); \
398 schedule(); \
399 if (irq) \
400 spin_lock_irq(&(wq).lock); \
401 else \
402 spin_lock(&(wq).lock); \
403 } while (!(condition)); \
404 __remove_wait_queue(&(wq), &__wait); \
405 __set_current_state(TASK_RUNNING); \
406 __ret; \
407})
408
409
410/**
411 * wait_event_interruptible_locked - sleep until a condition gets true
412 * @wq: the waitqueue to wait on
413 * @condition: a C expression for the event to wait for
414 *
415 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
416 * @condition evaluates to true or a signal is received.
417 * The @condition is checked each time the waitqueue @wq is woken up.
418 *
419 * It must be called with wq.lock being held. This spinlock is
420 * unlocked while sleeping but @condition testing is done while lock
421 * is held and when this macro exits the lock is held.
422 *
423 * The lock is locked/unlocked using spin_lock()/spin_unlock()
424 * functions which must match the way they are locked/unlocked outside
425 * of this macro.
426 *
427 * wake_up_locked() has to be called after changing any variable that could
428 * change the result of the wait condition.
429 *
430 * The function will return -ERESTARTSYS if it was interrupted by a
431 * signal and 0 if @condition evaluated to true.
432 */
433#define wait_event_interruptible_locked(wq, condition) \
434 ((condition) \
435 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
436
437/**
438 * wait_event_interruptible_locked_irq - sleep until a condition gets true
439 * @wq: the waitqueue to wait on
440 * @condition: a C expression for the event to wait for
441 *
442 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
443 * @condition evaluates to true or a signal is received.
444 * The @condition is checked each time the waitqueue @wq is woken up.
445 *
446 * It must be called with wq.lock being held. This spinlock is
447 * unlocked while sleeping but @condition testing is done while lock
448 * is held and when this macro exits the lock is held.
449 *
450 * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq()
451 * functions which must match the way they are locked/unlocked outside
452 * of this macro.
453 *
454 * wake_up_locked() has to be called after changing any variable that could
455 * change the result of the wait condition.
456 *
457 * The function will return -ERESTARTSYS if it was interrupted by a
458 * signal and 0 if @condition evaluated to true.
459 */
460#define wait_event_interruptible_locked_irq(wq, condition) \
461 ((condition) \
462 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
463
464/**
465 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
466 * @wq: the waitqueue to wait on
467 * @condition: a C expression for the event to wait for
468 *
469 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
470 * @condition evaluates to true or a signal is received.
471 * The @condition is checked each time the waitqueue @wq is woken up.
472 *
473 * It must be called with wq.lock being held. This spinlock is
474 * unlocked while sleeping but @condition testing is done while lock
475 * is held and when this macro exits the lock is held.
476 *
477 * The lock is locked/unlocked using spin_lock()/spin_unlock()
478 * functions which must match the way they are locked/unlocked outside
479 * of this macro.
480 *
481 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
482 * set thus when other process waits process on the list if this
483 * process is awaken further processes are not considered.
484 *
485 * wake_up_locked() has to be called after changing any variable that could
486 * change the result of the wait condition.
487 *
488 * The function will return -ERESTARTSYS if it was interrupted by a
489 * signal and 0 if @condition evaluated to true.
490 */
491#define wait_event_interruptible_exclusive_locked(wq, condition) \
492 ((condition) \
493 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0))
494
495/**
496 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
497 * @wq: the waitqueue to wait on
498 * @condition: a C expression for the event to wait for
499 *
500 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
501 * @condition evaluates to true or a signal is received.
502 * The @condition is checked each time the waitqueue @wq is woken up.
503 *
504 * It must be called with wq.lock being held. This spinlock is
505 * unlocked while sleeping but @condition testing is done while lock
506 * is held and when this macro exits the lock is held.
507 *
508 * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq()
509 * functions which must match the way they are locked/unlocked outside
510 * of this macro.
511 *
512 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
513 * set thus when other process waits process on the list if this
514 * process is awaken further processes are not considered.
515 *
516 * wake_up_locked() has to be called after changing any variable that could
517 * change the result of the wait condition.
518 *
519 * The function will return -ERESTARTSYS if it was interrupted by a
520 * signal and 0 if @condition evaluated to true.
521 */
522#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
523 ((condition) \
524 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
525
526
527
365#define __wait_event_killable(wq, condition, ret) \ 528#define __wait_event_killable(wq, condition, ret) \
366do { \ 529do { \
367 DEFINE_WAIT(__wait); \ 530 DEFINE_WAIT(__wait); \
@@ -404,25 +567,6 @@ do { \
404}) 567})
405 568
406/* 569/*
407 * Must be called with the spinlock in the wait_queue_head_t held.
408 */
409static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q,
410 wait_queue_t * wait)
411{
412 wait->flags |= WQ_FLAG_EXCLUSIVE;
413 __add_wait_queue_tail(q, wait);
414}
415
416/*
417 * Must be called with the spinlock in the wait_queue_head_t held.
418 */
419static inline void remove_wait_queue_locked(wait_queue_head_t *q,
420 wait_queue_t * wait)
421{
422 __remove_wait_queue(q, wait);
423}
424
425/*
426 * These are the old interfaces to sleep waiting for an event. 570 * These are the old interfaces to sleep waiting for an event.
427 * They are racy. DO NOT use them, use the wait_event* interfaces above. 571 * They are racy. DO NOT use them, use the wait_event* interfaces above.
428 * We plan to remove these interfaces. 572 * We plan to remove these interfaces.
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index db8096e88533..57031b4d12f2 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -155,6 +155,7 @@
155 155
156#include <linux/types.h> 156#include <linux/types.h>
157#include <linux/device.h> 157#include <linux/device.h>
158#include <linux/slab.h>
158 159
159 160
160/* Backend stuff */ 161/* Backend stuff */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 5b4c6c772a9b..e6827eedf18b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -346,6 +346,8 @@
346#define SIOCIWFIRST 0x8B00 346#define SIOCIWFIRST 0x8B00
347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ 347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) 348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
349#define IW_HANDLER(id, func) \
350 [IW_IOCTL_IDX(id)] = func
349 351
350/* Odd : get (world access), even : set (root access) */ 352/* Odd : get (world access), even : set (root access) */
351#define IW_IS_SET(cmd) (!((cmd) & 0x1)) 353#define IW_IS_SET(cmd) (!((cmd) & 0x1))
@@ -648,7 +650,7 @@
648 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ 650 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
649#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ 651#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \
650 (cmd - SIOCIWFIRSTPRIV + 0x60) : \ 652 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
651 (cmd - SIOCSIWCOMMIT)) 653 (cmd - SIOCIWFIRST))
652#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) 654#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5)
653#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) 655#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
654/* Event capability constants - event autogenerated by the kernel 656/* Event capability constants - event autogenerated by the kernel
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 76e8903cd204..c24eca71e80c 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -27,13 +27,12 @@ enum writeback_sync_modes {
27 * in a manner such that unspecified fields are set to zero. 27 * in a manner such that unspecified fields are set to zero.
28 */ 28 */
29struct writeback_control { 29struct writeback_control {
30 struct backing_dev_info *bdi; /* If !NULL, only write back this
31 queue */
32 struct super_block *sb; /* if !NULL, only write inodes from
33 this super_block */
34 enum writeback_sync_modes sync_mode; 30 enum writeback_sync_modes sync_mode;
35 unsigned long *older_than_this; /* If !NULL, only write back inodes 31 unsigned long *older_than_this; /* If !NULL, only write back inodes
36 older than this */ 32 older than this */
33 unsigned long wb_start; /* Time writeback_inodes_wb was
34 called. This is needed to avoid
35 extra jobs and livelock */
37 long nr_to_write; /* Write this many pages, and decrement 36 long nr_to_write; /* Write this many pages, and decrement
38 this for each page written */ 37 this for each page written */
39 long pages_skipped; /* Pages which were not written */ 38 long pages_skipped; /* Pages which were not written */
@@ -53,15 +52,6 @@ struct writeback_control {
53 unsigned for_reclaim:1; /* Invoked from the page allocator */ 52 unsigned for_reclaim:1; /* Invoked from the page allocator */
54 unsigned range_cyclic:1; /* range_start is cyclic */ 53 unsigned range_cyclic:1; /* range_start is cyclic */
55 unsigned more_io:1; /* more io to be dispatched */ 54 unsigned more_io:1; /* more io to be dispatched */
56 /*
57 * write_cache_pages() won't update wbc->nr_to_write and
58 * mapping->writeback_index if no_nrwrite_index_update
59 * is set. write_cache_pages() may write more than we
60 * requested and we want to make sure nr_to_write and
61 * writeback_index are updated in a consistent manner
62 * so we use a single control to update them
63 */
64 unsigned no_nrwrite_index_update:1;
65}; 55};
66 56
67/* 57/*
@@ -72,7 +62,8 @@ int inode_wait(void *);
72void writeback_inodes_sb(struct super_block *); 62void writeback_inodes_sb(struct super_block *);
73int writeback_inodes_sb_if_idle(struct super_block *); 63int writeback_inodes_sb_if_idle(struct super_block *);
74void sync_inodes_sb(struct super_block *); 64void sync_inodes_sb(struct super_block *);
75void writeback_inodes_wbc(struct writeback_control *wbc); 65void writeback_inodes_wb(struct bdi_writeback *wb,
66 struct writeback_control *wbc);
76long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 67long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
77void wakeup_flusher_threads(long nr_pages); 68void wakeup_flusher_threads(long nr_pages);
78 69
@@ -93,8 +84,14 @@ static inline void inode_sync_wait(struct inode *inode)
93/* 84/*
94 * mm/page-writeback.c 85 * mm/page-writeback.c
95 */ 86 */
96void laptop_io_completion(void); 87#ifdef CONFIG_BLOCK
88void laptop_io_completion(struct backing_dev_info *info);
97void laptop_sync_completion(void); 89void laptop_sync_completion(void);
90void laptop_mode_sync(struct work_struct *work);
91void laptop_mode_timer_fn(unsigned long data);
92#else
93static inline void laptop_sync_completion(void) { }
94#endif
98void throttle_vm_writeout(gfp_t gfp_mask); 95void throttle_vm_writeout(gfp_t gfp_mask);
99 96
100/* These are exported to sysctl. */ 97/* These are exported to sysctl. */
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index fb9b7e6e1e2d..0cfa1e9c4cc1 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -37,7 +37,7 @@ struct inode;
37struct dentry; 37struct dentry;
38 38
39struct xattr_handler { 39struct xattr_handler {
40 char *prefix; 40 const char *prefix;
41 int flags; /* fs private flags passed back to the handlers */ 41 int flags; /* fs private flags passed back to the handlers */
42 size_t (*list)(struct dentry *dentry, char *list, size_t list_size, 42 size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
43 const char *name, size_t name_len, int handler_flags); 43 const char *name, size_t name_len, int handler_flags);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 29e04beb1fc9..b971e3848493 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -267,8 +267,8 @@ enum xfrm_attr_type_t {
267 XFRMA_ALG_COMP, /* struct xfrm_algo */ 267 XFRMA_ALG_COMP, /* struct xfrm_algo */
268 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ 268 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */
269 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 269 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
270 XFRMA_SA, 270 XFRMA_SA, /* struct xfrm_usersa_info */
271 XFRMA_POLICY, 271 XFRMA_POLICY, /*struct xfrm_userpolicy_info */
272 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ 272 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
273 XFRMA_LTIME_VAL, 273 XFRMA_LTIME_VAL,
274 XFRMA_REPLAY_VAL, 274 XFRMA_REPLAY_VAL,
@@ -276,17 +276,23 @@ enum xfrm_attr_type_t {
276 XFRMA_ETIMER_THRESH, 276 XFRMA_ETIMER_THRESH,
277 XFRMA_SRCADDR, /* xfrm_address_t */ 277 XFRMA_SRCADDR, /* xfrm_address_t */
278 XFRMA_COADDR, /* xfrm_address_t */ 278 XFRMA_COADDR, /* xfrm_address_t */
279 XFRMA_LASTUSED, 279 XFRMA_LASTUSED, /* unsigned long */
280 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 280 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
281 XFRMA_MIGRATE, 281 XFRMA_MIGRATE,
282 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ 282 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
283 XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ 283 XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */
284 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ 284 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */
285 XFRMA_MARK, /* struct xfrm_mark */
285 __XFRMA_MAX 286 __XFRMA_MAX
286 287
287#define XFRMA_MAX (__XFRMA_MAX - 1) 288#define XFRMA_MAX (__XFRMA_MAX - 1)
288}; 289};
289 290
291struct xfrm_mark {
292 __u32 v; /* value */
293 __u32 m; /* mask */
294};
295
290enum xfrm_sadattr_type_t { 296enum xfrm_sadattr_type_t {
291 XFRMA_SAD_UNSPEC, 297 XFRMA_SAD_UNSPEC,
292 XFRMA_SAD_CNT, 298 XFRMA_SAD_CNT,
diff --git a/include/linux/z2_battery.h b/include/linux/z2_battery.h
new file mode 100644
index 000000000000..7b9750404d22
--- /dev/null
+++ b/include/linux/z2_battery.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_Z2_BATTERY_H
2#define _LINUX_Z2_BATTERY_H
3
4struct z2_battery_info {
5 int batt_I2C_bus;
6 int batt_I2C_addr;
7 int batt_I2C_reg;
8 int charge_gpio;
9 int min_voltage;
10 int max_voltage;
11 int batt_div;
12 int batt_mult;
13 int batt_tech;
14 char *batt_name;
15};
16
17#endif
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 913bfc226dda..7bf9db525e9e 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -38,8 +38,6 @@
38typedef __u32 zorro_id; 38typedef __u32 zorro_id;
39 39
40 40
41#define ZORRO_WILDCARD (0xffffffff) /* not official */
42
43/* Include the ID list */ 41/* Include the ID list */
44#include <linux/zorro_ids.h> 42#include <linux/zorro_ids.h>
45 43
@@ -116,6 +114,7 @@ struct ConfigDev {
116 114
117#include <linux/init.h> 115#include <linux/init.h>
118#include <linux/ioport.h> 116#include <linux/ioport.h>
117#include <linux/mod_devicetable.h>
119 118
120#include <asm/zorro.h> 119#include <asm/zorro.h>
121 120
@@ -142,29 +141,10 @@ struct zorro_dev {
142 * Zorro bus 141 * Zorro bus
143 */ 142 */
144 143
145struct zorro_bus {
146 struct list_head devices; /* list of devices on this bus */
147 unsigned int num_resources; /* number of resources */
148 struct resource resources[4]; /* address space routed to this bus */
149 struct device dev;
150 char name[10];
151};
152
153extern struct zorro_bus zorro_bus; /* single Zorro bus */
154extern struct bus_type zorro_bus_type; 144extern struct bus_type zorro_bus_type;
155 145
156 146
157 /* 147 /*
158 * Zorro device IDs
159 */
160
161struct zorro_device_id {
162 zorro_id id; /* Device ID or ZORRO_WILDCARD */
163 unsigned long driver_data; /* Data private to the driver */
164};
165
166
167 /*
168 * Zorro device drivers 148 * Zorro device drivers
169 */ 149 */
170 150
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index f456534dcaf9..9696a5e2c437 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -29,7 +29,7 @@
29 _FP_FRAC_DECL_##wc(X) 29 _FP_FRAC_DECL_##wc(X)
30 30
31/* 31/*
32 * Finish truely unpacking a native fp value by classifying the kind 32 * Finish truly unpacking a native fp value by classifying the kind
33 * of fp value and normalizing both the exponent and the fraction. 33 * of fp value and normalizing both the exponent and the fraction.
34 */ 34 */
35 35
@@ -799,7 +799,7 @@ do { \
799 X##_e -= (_FP_W_TYPE_SIZE - rsize); \ 799 X##_e -= (_FP_W_TYPE_SIZE - rsize); \
800 X##_e = rsize - X##_e - 1; \ 800 X##_e = rsize - X##_e - 1; \
801 \ 801 \
802 if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \ 802 if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs <= X##_e) \
803 __FP_FRAC_SRS_1(ur_, (X##_e - _FP_WFRACBITS_##fs + 1), rsize);\ 803 __FP_FRAC_SRS_1(ur_, (X##_e - _FP_WFRACBITS_##fs + 1), rsize);\
804 _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \ 804 _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \
805 if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0) \ 805 if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0) \
diff --git a/include/media/ak881x.h b/include/media/ak881x.h
new file mode 100644
index 000000000000..b7f2add5ce7b
--- /dev/null
+++ b/include/media/ak881x.h
@@ -0,0 +1,25 @@
1/*
2 * Header for AK8813 / AK8814 TV-ecoders from Asahi Kasei Microsystems Co., Ltd. (AKM)
3 *
4 * Copyright (C) 2010, 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 AK881X_H
12#define AK881X_H
13
14#define AK881X_IF_MODE_MASK (3 << 0)
15#define AK881X_IF_MODE_BT656 (0 << 0)
16#define AK881X_IF_MODE_MASTER (1 << 0)
17#define AK881X_IF_MODE_SLAVE (2 << 0)
18#define AK881X_FIELD (1 << 2)
19#define AK881X_COMPONENT (1 << 3)
20
21struct ak881x_pdata {
22 unsigned long flags;
23};
24
25#endif
diff --git a/include/media/davinci/isif.h b/include/media/davinci/isif.h
new file mode 100644
index 000000000000..b0b74ad618cc
--- /dev/null
+++ b/include/media/davinci/isif.h
@@ -0,0 +1,531 @@
1/*
2 * Copyright (C) 2008-2009 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; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * isif header file
19 */
20#ifndef _ISIF_H
21#define _ISIF_H
22
23#include <media/davinci/ccdc_types.h>
24#include <media/davinci/vpfe_types.h>
25
26/* isif float type S8Q8/U8Q8 */
27struct isif_float_8 {
28 /* 8 bit integer part */
29 __u8 integer;
30 /* 8 bit decimal part */
31 __u8 decimal;
32};
33
34/* isif float type U16Q16/S16Q16 */
35struct isif_float_16 {
36 /* 16 bit integer part */
37 __u16 integer;
38 /* 16 bit decimal part */
39 __u16 decimal;
40};
41
42/************************************************************************
43 * Vertical Defect Correction parameters
44 ***********************************************************************/
45/* Defect Correction (DFC) table entry */
46struct isif_vdfc_entry {
47 /* vertical position of defect */
48 __u16 pos_vert;
49 /* horizontal position of defect */
50 __u16 pos_horz;
51 /*
52 * Defect level of Vertical line defect position. This is subtracted
53 * from the data at the defect position
54 */
55 __u8 level_at_pos;
56 /*
57 * Defect level of the pixels upper than the vertical line defect.
58 * This is subtracted from the data
59 */
60 __u8 level_up_pixels;
61 /*
62 * Defect level of the pixels lower than the vertical line defect.
63 * This is subtracted from the data
64 */
65 __u8 level_low_pixels;
66};
67
68#define ISIF_VDFC_TABLE_SIZE 8
69struct isif_dfc {
70 /* enable vertical defect correction */
71 __u8 en;
72 /* Defect level subtraction. Just fed through if saturating */
73#define ISIF_VDFC_NORMAL 0
74 /*
75 * Defect level subtraction. Horizontal interpolation ((i-2)+(i+2))/2
76 * if data saturating
77 */
78#define ISIF_VDFC_HORZ_INTERPOL_IF_SAT 1
79 /* Horizontal interpolation (((i-2)+(i+2))/2) */
80#define ISIF_VDFC_HORZ_INTERPOL 2
81 /* one of the vertical defect correction modes above */
82 __u8 corr_mode;
83 /* 0 - whole line corrected, 1 - not pixels upper than the defect */
84 __u8 corr_whole_line;
85#define ISIF_VDFC_NO_SHIFT 0
86#define ISIF_VDFC_SHIFT_1 1
87#define ISIF_VDFC_SHIFT_2 2
88#define ISIF_VDFC_SHIFT_3 3
89#define ISIF_VDFC_SHIFT_4 4
90 /*
91 * defect level shift value. level_at_pos, level_upper_pos,
92 * and level_lower_pos can be shifted up by this value. Choose
93 * one of the values above
94 */
95 __u8 def_level_shift;
96 /* defect saturation level */
97 __u16 def_sat_level;
98 /* number of vertical defects. Max is ISIF_VDFC_TABLE_SIZE */
99 __u16 num_vdefects;
100 /* VDFC table ptr */
101 struct isif_vdfc_entry table[ISIF_VDFC_TABLE_SIZE];
102};
103
104struct isif_horz_bclamp {
105
106 /* Horizontal clamp disabled. Only vertical clamp value is subtracted */
107#define ISIF_HORZ_BC_DISABLE 0
108 /*
109 * Horizontal clamp value is calculated and subtracted from image data
110 * along with vertical clamp value
111 */
112#define ISIF_HORZ_BC_CLAMP_CALC_ENABLED 1
113 /*
114 * Horizontal clamp value calculated from previous image is subtracted
115 * from image data along with vertical clamp value.
116 */
117#define ISIF_HORZ_BC_CLAMP_NOT_UPDATED 2
118 /* horizontal clamp mode. One of the values above */
119 __u8 mode;
120 /*
121 * pixel value limit enable.
122 * 0 - limit disabled
123 * 1 - pixel value limited to 1023
124 */
125 __u8 clamp_pix_limit;
126 /* Select Most left window for bc calculation */
127#define ISIF_SEL_MOST_LEFT_WIN 0
128 /* Select Most right window for bc calculation */
129#define ISIF_SEL_MOST_RIGHT_WIN 1
130 /* Select most left or right window for clamp val calculation */
131 __u8 base_win_sel_calc;
132 /* Window count per color for calculation. range 1-32 */
133 __u8 win_count_calc;
134 /* Window start position - horizontal for calculation. 0 - 8191 */
135 __u16 win_start_h_calc;
136 /* Window start position - vertical for calculation 0 - 8191 */
137 __u16 win_start_v_calc;
138#define ISIF_HORZ_BC_SZ_H_2PIXELS 0
139#define ISIF_HORZ_BC_SZ_H_4PIXELS 1
140#define ISIF_HORZ_BC_SZ_H_8PIXELS 2
141#define ISIF_HORZ_BC_SZ_H_16PIXELS 3
142 /* Width of the sample window in pixels for calculation */
143 __u8 win_h_sz_calc;
144#define ISIF_HORZ_BC_SZ_V_32PIXELS 0
145#define ISIF_HORZ_BC_SZ_V_64PIXELS 1
146#define ISIF_HORZ_BC_SZ_V_128PIXELS 2
147#define ISIF_HORZ_BC_SZ_V_256PIXELS 3
148 /* Height of the sample window in pixels for calculation */
149 __u8 win_v_sz_calc;
150};
151
152/************************************************************************
153 * Black Clamp parameters
154 ***********************************************************************/
155struct isif_vert_bclamp {
156 /* Reset value used is the clamp value calculated */
157#define ISIF_VERT_BC_USE_HORZ_CLAMP_VAL 0
158 /* Reset value used is reset_clamp_val configured */
159#define ISIF_VERT_BC_USE_CONFIG_CLAMP_VAL 1
160 /* No update, previous image value is used */
161#define ISIF_VERT_BC_NO_UPDATE 2
162 /*
163 * Reset value selector for vertical clamp calculation. Use one of
164 * the above values
165 */
166 __u8 reset_val_sel;
167 /* U8Q8. Line average coefficient used in vertical clamp calculation */
168 __u8 line_ave_coef;
169 /* Height of the optical black region for calculation */
170 __u16 ob_v_sz_calc;
171 /* Optical black region start position - horizontal. 0 - 8191 */
172 __u16 ob_start_h;
173 /* Optical black region start position - vertical 0 - 8191 */
174 __u16 ob_start_v;
175};
176
177struct isif_black_clamp {
178 /*
179 * This offset value is added irrespective of the clamp enable status.
180 * S13
181 */
182 __u16 dc_offset;
183 /*
184 * Enable black/digital clamp value to be subtracted from the image data
185 */
186 __u8 en;
187 /*
188 * black clamp mode. same/separate clamp for 4 colors
189 * 0 - disable - same clamp value for all colors
190 * 1 - clamp value calculated separately for all colors
191 */
192 __u8 bc_mode_color;
193 /* Vrtical start position for bc subtraction */
194 __u16 vert_start_sub;
195 /* Black clamp for horizontal direction */
196 struct isif_horz_bclamp horz;
197 /* Black clamp for vertical direction */
198 struct isif_vert_bclamp vert;
199};
200
201/*************************************************************************
202** Color Space Convertion (CSC)
203*************************************************************************/
204#define ISIF_CSC_NUM_COEFF 16
205struct isif_color_space_conv {
206 /* Enable color space conversion */
207 __u8 en;
208 /*
209 * csc coeffient table. S8Q5, M00 at index 0, M01 at index 1, and
210 * so forth
211 */
212 struct isif_float_8 coeff[ISIF_CSC_NUM_COEFF];
213};
214
215
216/*************************************************************************
217** Black Compensation parameters
218*************************************************************************/
219struct isif_black_comp {
220 /* Comp for Red */
221 __s8 r_comp;
222 /* Comp for Gr */
223 __s8 gr_comp;
224 /* Comp for Blue */
225 __s8 b_comp;
226 /* Comp for Gb */
227 __s8 gb_comp;
228};
229
230/*************************************************************************
231** Gain parameters
232*************************************************************************/
233struct isif_gain {
234 /* Gain for Red or ye */
235 struct isif_float_16 r_ye;
236 /* Gain for Gr or cy */
237 struct isif_float_16 gr_cy;
238 /* Gain for Gb or g */
239 struct isif_float_16 gb_g;
240 /* Gain for Blue or mg */
241 struct isif_float_16 b_mg;
242};
243
244#define ISIF_LINEAR_TAB_SIZE 192
245/*************************************************************************
246** Linearization parameters
247*************************************************************************/
248struct isif_linearize {
249 /* Enable or Disable linearization of data */
250 __u8 en;
251 /* Shift value applied */
252 __u8 corr_shft;
253 /* scale factor applied U11Q10 */
254 struct isif_float_16 scale_fact;
255 /* Size of the linear table */
256 __u16 table[ISIF_LINEAR_TAB_SIZE];
257};
258
259/* Color patterns */
260#define ISIF_RED 0
261#define ISIF_GREEN_RED 1
262#define ISIF_GREEN_BLUE 2
263#define ISIF_BLUE 3
264struct isif_col_pat {
265 __u8 olop;
266 __u8 olep;
267 __u8 elop;
268 __u8 elep;
269};
270
271/*************************************************************************
272** Data formatter parameters
273*************************************************************************/
274struct isif_fmtplen {
275 /*
276 * number of program entries for SET0, range 1 - 16
277 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
278 * ISIF_COMBINE
279 */
280 __u16 plen0;
281 /*
282 * number of program entries for SET1, range 1 - 16
283 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
284 * ISIF_COMBINE
285 */
286 __u16 plen1;
287 /**
288 * number of program entries for SET2, range 1 - 16
289 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
290 * ISIF_COMBINE
291 */
292 __u16 plen2;
293 /**
294 * number of program entries for SET3, range 1 - 16
295 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
296 * ISIF_COMBINE
297 */
298 __u16 plen3;
299};
300
301struct isif_fmt_cfg {
302#define ISIF_SPLIT 0
303#define ISIF_COMBINE 1
304 /* Split or combine or line alternate */
305 __u8 fmtmode;
306 /* enable or disable line alternating mode */
307 __u8 ln_alter_en;
308#define ISIF_1LINE 0
309#define ISIF_2LINES 1
310#define ISIF_3LINES 2
311#define ISIF_4LINES 3
312 /* Split/combine line number */
313 __u8 lnum;
314 /* Address increment Range 1 - 16 */
315 __u8 addrinc;
316};
317
318struct isif_fmt_addr_ptr {
319 /* Initial address */
320 __u32 init_addr;
321 /* output line number */
322#define ISIF_1STLINE 0
323#define ISIF_2NDLINE 1
324#define ISIF_3RDLINE 2
325#define ISIF_4THLINE 3
326 __u8 out_line;
327};
328
329struct isif_fmtpgm_ap {
330 /* program address pointer */
331 __u8 pgm_aptr;
332 /* program address increment or decrement */
333 __u8 pgmupdt;
334};
335
336struct isif_data_formatter {
337 /* Enable/Disable data formatter */
338 __u8 en;
339 /* data formatter configuration */
340 struct isif_fmt_cfg cfg;
341 /* Formatter program entries length */
342 struct isif_fmtplen plen;
343 /* first pixel in a line fed to formatter */
344 __u16 fmtrlen;
345 /* HD interval for output line. Only valid when split line */
346 __u16 fmthcnt;
347 /* formatter address pointers */
348 struct isif_fmt_addr_ptr fmtaddr_ptr[16];
349 /* program enable/disable */
350 __u8 pgm_en[32];
351 /* program address pointers */
352 struct isif_fmtpgm_ap fmtpgm_ap[32];
353};
354
355struct isif_df_csc {
356 /* Color Space Conversion confguration, 0 - csc, 1 - df */
357 __u8 df_or_csc;
358 /* csc configuration valid if df_or_csc is 0 */
359 struct isif_color_space_conv csc;
360 /* data formatter configuration valid if df_or_csc is 1 */
361 struct isif_data_formatter df;
362 /* start pixel in a line at the input */
363 __u32 start_pix;
364 /* number of pixels in input line */
365 __u32 num_pixels;
366 /* start line at the input */
367 __u32 start_line;
368 /* number of lines at the input */
369 __u32 num_lines;
370};
371
372struct isif_gain_offsets_adj {
373 /* Gain adjustment per color */
374 struct isif_gain gain;
375 /* Offset adjustment */
376 __u16 offset;
377 /* Enable or Disable Gain adjustment for SDRAM data */
378 __u8 gain_sdram_en;
379 /* Enable or Disable Gain adjustment for IPIPE data */
380 __u8 gain_ipipe_en;
381 /* Enable or Disable Gain adjustment for H3A data */
382 __u8 gain_h3a_en;
383 /* Enable or Disable Gain adjustment for SDRAM data */
384 __u8 offset_sdram_en;
385 /* Enable or Disable Gain adjustment for IPIPE data */
386 __u8 offset_ipipe_en;
387 /* Enable or Disable Gain adjustment for H3A data */
388 __u8 offset_h3a_en;
389};
390
391struct isif_cul {
392 /* Horizontal Cull pattern for odd lines */
393 __u8 hcpat_odd;
394 /* Horizontal Cull pattern for even lines */
395 __u8 hcpat_even;
396 /* Vertical Cull pattern */
397 __u8 vcpat;
398 /* Enable or disable lpf. Apply when cull is enabled */
399 __u8 en_lpf;
400};
401
402struct isif_compress {
403#define ISIF_ALAW 0
404#define ISIF_DPCM 1
405#define ISIF_NO_COMPRESSION 2
406 /* Compression Algorithm used */
407 __u8 alg;
408 /* Choose Predictor1 for DPCM compression */
409#define ISIF_DPCM_PRED1 0
410 /* Choose Predictor2 for DPCM compression */
411#define ISIF_DPCM_PRED2 1
412 /* Predictor for DPCM compression */
413 __u8 pred;
414};
415
416/* all the stuff in this struct will be provided by userland */
417struct isif_config_params_raw {
418 /* Linearization parameters for image sensor data input */
419 struct isif_linearize linearize;
420 /* Data formatter or CSC */
421 struct isif_df_csc df_csc;
422 /* Defect Pixel Correction (DFC) confguration */
423 struct isif_dfc dfc;
424 /* Black/Digital Clamp configuration */
425 struct isif_black_clamp bclamp;
426 /* Gain, offset adjustments */
427 struct isif_gain_offsets_adj gain_offset;
428 /* Culling */
429 struct isif_cul culling;
430 /* A-Law and DPCM compression options */
431 struct isif_compress compress;
432 /* horizontal offset for Gain/LSC/DFC */
433 __u16 horz_offset;
434 /* vertical offset for Gain/LSC/DFC */
435 __u16 vert_offset;
436 /* color pattern for field 0 */
437 struct isif_col_pat col_pat_field0;
438 /* color pattern for field 1 */
439 struct isif_col_pat col_pat_field1;
440#define ISIF_NO_SHIFT 0
441#define ISIF_1BIT_SHIFT 1
442#define ISIF_2BIT_SHIFT 2
443#define ISIF_3BIT_SHIFT 3
444#define ISIF_4BIT_SHIFT 4
445#define ISIF_5BIT_SHIFT 5
446#define ISIF_6BIT_SHIFT 6
447 /* Data shift applied before storing to SDRAM */
448 __u8 data_shift;
449 /* enable input test pattern generation */
450 __u8 test_pat_gen;
451};
452
453#ifdef __KERNEL__
454struct isif_ycbcr_config {
455 /* isif pixel format */
456 enum ccdc_pixfmt pix_fmt;
457 /* isif frame format */
458 enum ccdc_frmfmt frm_fmt;
459 /* ISIF crop window */
460 struct v4l2_rect win;
461 /* field polarity */
462 enum vpfe_pin_pol fid_pol;
463 /* interface VD polarity */
464 enum vpfe_pin_pol vd_pol;
465 /* interface HD polarity */
466 enum vpfe_pin_pol hd_pol;
467 /* isif pix order. Only used for ycbcr capture */
468 enum ccdc_pixorder pix_order;
469 /* isif buffer type. Only used for ycbcr capture */
470 enum ccdc_buftype buf_type;
471};
472
473/* MSB of image data connected to sensor port */
474enum isif_data_msb {
475 ISIF_BIT_MSB_15,
476 ISIF_BIT_MSB_14,
477 ISIF_BIT_MSB_13,
478 ISIF_BIT_MSB_12,
479 ISIF_BIT_MSB_11,
480 ISIF_BIT_MSB_10,
481 ISIF_BIT_MSB_9,
482 ISIF_BIT_MSB_8,
483 ISIF_BIT_MSB_7
484};
485
486enum isif_cfa_pattern {
487 ISIF_CFA_PAT_MOSAIC,
488 ISIF_CFA_PAT_STRIPE
489};
490
491struct isif_params_raw {
492 /* isif pixel format */
493 enum ccdc_pixfmt pix_fmt;
494 /* isif frame format */
495 enum ccdc_frmfmt frm_fmt;
496 /* video window */
497 struct v4l2_rect win;
498 /* field polarity */
499 enum vpfe_pin_pol fid_pol;
500 /* interface VD polarity */
501 enum vpfe_pin_pol vd_pol;
502 /* interface HD polarity */
503 enum vpfe_pin_pol hd_pol;
504 /* buffer type. Applicable for interlaced mode */
505 enum ccdc_buftype buf_type;
506 /* Gain values */
507 struct isif_gain gain;
508 /* cfa pattern */
509 enum isif_cfa_pattern cfa_pat;
510 /* Data MSB position */
511 enum isif_data_msb data_msb;
512 /* Enable horizontal flip */
513 unsigned char horz_flip_en;
514 /* Enable image invert vertically */
515 unsigned char image_invert_en;
516
517 /* all the userland defined stuff*/
518 struct isif_config_params_raw config_params;
519};
520
521enum isif_data_pack {
522 ISIF_PACK_16BIT,
523 ISIF_PACK_12BIT,
524 ISIF_PACK_8BIT
525};
526
527#define ISIF_WIN_NTSC {0, 0, 720, 480}
528#define ISIF_WIN_VGA {0, 0, 640, 480}
529
530#endif
531#endif
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index d863e5e8426d..cc973ed845a7 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -94,6 +94,8 @@ struct vpfe_config {
94 /* vpfe clock */ 94 /* vpfe clock */
95 struct clk *vpssclk; 95 struct clk *vpssclk;
96 struct clk *slaveclk; 96 struct clk *slaveclk;
97 /* Function for Clearing the interrupt */
98 void (*clr_intr)(int vdint);
97}; 99};
98 100
99struct vpfe_device { 101struct vpfe_device {
@@ -165,7 +167,7 @@ struct vpfe_device {
165 u8 started; 167 u8 started;
166 /* 168 /*
167 * offset where second field starts from the starting of the 169 * offset where second field starts from the starting of the
168 * buffer for field seperated YCbCr formats 170 * buffer for field separated YCbCr formats
169 */ 171 */
170 u32 field_off; 172 u32 field_off;
171}; 173};
diff --git a/include/media/davinci/vpss.h b/include/media/davinci/vpss.h
index fcdff745fae2..c59cc029c74a 100644
--- a/include/media/davinci/vpss.h
+++ b/include/media/davinci/vpss.h
@@ -29,7 +29,19 @@
29/* selector for ccdc input selection on DM355 */ 29/* selector for ccdc input selection on DM355 */
30enum vpss_ccdc_source_sel { 30enum vpss_ccdc_source_sel {
31 VPSS_CCDCIN, 31 VPSS_CCDCIN,
32 VPSS_HSSIIN 32 VPSS_HSSIIN,
33 VPSS_PGLPBK, /* for DM365 only */
34 VPSS_CCDCPG /* for DM365 only */
35};
36
37struct vpss_sync_pol {
38 unsigned int ccdpg_hdpol:1;
39 unsigned int ccdpg_vdpol:1;
40};
41
42struct vpss_pg_frame_size {
43 short hlpfr;
44 short pplen;
33}; 45};
34 46
35/* Used for enable/diable VPSS Clock */ 47/* Used for enable/diable VPSS Clock */
@@ -47,12 +59,38 @@ enum vpss_clock_sel {
47 */ 59 */
48 VPSS_VENC_CLOCK_SEL, 60 VPSS_VENC_CLOCK_SEL,
49 VPSS_VPBE_CLOCK, 61 VPSS_VPBE_CLOCK,
62 /* DM365 only clocks */
63 VPSS_IPIPEIF_CLOCK,
64 VPSS_RSZ_CLOCK,
65 VPSS_BL_CLOCK,
66 /*
67 * When using VPSS_PCLK_INTERNAL in vpss_enable_clock() api
68 * following applies:-
69 * en = 0 disable internal PCLK
70 * en = 1 enables internal PCLK
71 */
72 VPSS_PCLK_INTERNAL,
73 /*
74 * When using VPSS_PSYNC_CLOCK_SEL in vpss_enable_clock() api
75 * following applies:-
76 * en = 0 enables MMR clock
77 * en = 1 enables VPSS clock
78 */
79 VPSS_PSYNC_CLOCK_SEL,
80 VPSS_LDC_CLOCK_SEL,
81 VPSS_OSD_CLOCK_SEL,
82 VPSS_FDIF_CLOCK,
83 VPSS_LDC_CLOCK
50}; 84};
51 85
52/* select input to ccdc on dm355 */ 86/* select input to ccdc on dm355 */
53int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel); 87int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel);
54/* enable/disable a vpss clock, 0 - success, -1 - failure */ 88/* enable/disable a vpss clock, 0 - success, -1 - failure */
55int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en); 89int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en);
90/* set sync polarity, only for DM365*/
91void dm365_vpss_set_sync_pol(struct vpss_sync_pol);
92/* set the PG_FRAME_SIZE register, only for DM365 */
93void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size);
56 94
57/* wbl reset for dm644x */ 95/* wbl reset for dm644x */
58enum vpss_wbl_sel { 96enum vpss_wbl_sel {
@@ -65,5 +103,6 @@ enum vpss_wbl_sel {
65 VPSS_PCR_PREV_WBL_0, 103 VPSS_PCR_PREV_WBL_0,
66 VPSS_PCR_CCDC_WBL_O, 104 VPSS_PCR_CCDC_WBL_O,
67}; 105};
106/* clear wbl overflow flag for DM6446 */
68int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel); 107int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel);
69#endif 108#endif
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 2c6af24b905e..528050e39ad9 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -35,7 +35,7 @@
35 35
36struct ir_input_state { 36struct ir_input_state {
37 /* configuration */ 37 /* configuration */
38 int ir_type; 38 u64 ir_type;
39 39
40 /* key info */ 40 /* key info */
41 u32 ir_key; /* ir scancode */ 41 u32 ir_key; /* ir scancode */
@@ -50,6 +50,10 @@ struct card_ir {
50 struct ir_input_state ir; 50 struct ir_input_state ir;
51 char name[32]; 51 char name[32];
52 char phys[32]; 52 char phys[32];
53 int users;
54
55 u32 running:1;
56 struct ir_dev_props props;
53 57
54 /* Usual gpio signalling */ 58 /* Usual gpio signalling */
55 59
@@ -79,12 +83,15 @@ struct card_ir {
79 /* NEC decoding */ 83 /* NEC decoding */
80 u32 nec_gpio; 84 u32 nec_gpio;
81 struct tasklet_struct tlet; 85 struct tasklet_struct tlet;
86
87 /* IR core raw decoding */
88 u32 raw_decode;
82}; 89};
83 90
84/* Routines from ir-functions.c */ 91/* Routines from ir-functions.c */
85 92
86int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 93int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
87 int ir_type); 94 const u64 ir_type);
88void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 95void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
89void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 96void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
90 u32 ir_key); 97 u32 ir_key);
@@ -97,69 +104,4 @@ u32 ir_rc5_decode(unsigned int code);
97void ir_rc5_timer_end(unsigned long data); 104void ir_rc5_timer_end(unsigned long data);
98void ir_rc5_timer_keyup(unsigned long data); 105void ir_rc5_timer_keyup(unsigned long data);
99 106
100/* scancode->keycode map tables from ir-keymaps.c */
101
102extern struct ir_scancode_table ir_codes_empty_table;
103extern struct ir_scancode_table ir_codes_avermedia_table;
104extern struct ir_scancode_table ir_codes_avermedia_dvbt_table;
105extern struct ir_scancode_table ir_codes_avermedia_m135a_table;
106extern struct ir_scancode_table ir_codes_avermedia_cardbus_table;
107extern struct ir_scancode_table ir_codes_apac_viewcomp_table;
108extern struct ir_scancode_table ir_codes_pixelview_table;
109extern struct ir_scancode_table ir_codes_pixelview_new_table;
110extern struct ir_scancode_table ir_codes_nebula_table;
111extern struct ir_scancode_table ir_codes_dntv_live_dvb_t_table;
112extern struct ir_scancode_table ir_codes_iodata_bctv7e_table;
113extern struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table;
114extern struct ir_scancode_table ir_codes_msi_tvanywhere_table;
115extern struct ir_scancode_table ir_codes_cinergy_1400_table;
116extern struct ir_scancode_table ir_codes_avertv_303_table;
117extern struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table;
118extern struct ir_scancode_table ir_codes_em_terratec_table;
119extern struct ir_scancode_table ir_codes_pinnacle_grey_table;
120extern struct ir_scancode_table ir_codes_flyvideo_table;
121extern struct ir_scancode_table ir_codes_flydvb_table;
122extern struct ir_scancode_table ir_codes_cinergy_table;
123extern struct ir_scancode_table ir_codes_eztv_table;
124extern struct ir_scancode_table ir_codes_avermedia_table;
125extern struct ir_scancode_table ir_codes_videomate_tv_pvr_table;
126extern struct ir_scancode_table ir_codes_manli_table;
127extern struct ir_scancode_table ir_codes_gotview7135_table;
128extern struct ir_scancode_table ir_codes_purpletv_table;
129extern struct ir_scancode_table ir_codes_pctv_sedna_table;
130extern struct ir_scancode_table ir_codes_pv951_table;
131extern struct ir_scancode_table ir_codes_rc5_tv_table;
132extern struct ir_scancode_table ir_codes_winfast_table;
133extern struct ir_scancode_table ir_codes_pinnacle_color_table;
134extern struct ir_scancode_table ir_codes_hauppauge_new_table;
135extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table;
136extern struct ir_scancode_table ir_codes_npgtech_table;
137extern struct ir_scancode_table ir_codes_norwood_table;
138extern struct ir_scancode_table ir_codes_proteus_2309_table;
139extern struct ir_scancode_table ir_codes_budget_ci_old_table;
140extern struct ir_scancode_table ir_codes_asus_pc39_table;
141extern struct ir_scancode_table ir_codes_encore_enltv_table;
142extern struct ir_scancode_table ir_codes_encore_enltv2_table;
143extern struct ir_scancode_table ir_codes_tt_1500_table;
144extern struct ir_scancode_table ir_codes_fusionhdtv_mce_table;
145extern struct ir_scancode_table ir_codes_behold_table;
146extern struct ir_scancode_table ir_codes_behold_columbus_table;
147extern struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table;
148extern struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table;
149extern struct ir_scancode_table ir_codes_powercolor_real_angel_table;
150extern struct ir_scancode_table ir_codes_avermedia_a16d_table;
151extern struct ir_scancode_table ir_codes_encore_enltv_fm53_table;
152extern struct ir_scancode_table ir_codes_real_audio_220_32_keys_table;
153extern struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table;
154extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table;
155extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table;
156extern struct ir_scancode_table ir_codes_kaiomy_table;
157extern struct ir_scancode_table ir_codes_dm1105_nec_table;
158extern struct ir_scancode_table ir_codes_tevii_nec_table;
159extern struct ir_scancode_table ir_codes_tbs_nec_table;
160extern struct ir_scancode_table ir_codes_evga_indtube_table;
161extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
162extern struct ir_scancode_table ir_codes_videomate_s350_table;
163extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
164extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table;
165#endif 107#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 299d201e1339..ad1303f20e00 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * Remote Controller core header 2 * Remote Controller core header
3 * 3 *
4 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
5 *
4 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2 of the License. 8 * the Free Software Foundation version 2 of the License.
@@ -14,49 +16,133 @@
14#ifndef _IR_CORE 16#ifndef _IR_CORE
15#define _IR_CORE 17#define _IR_CORE
16 18
17#include <linux/input.h>
18#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/kfifo.h>
21#include <linux/time.h>
22#include <linux/timer.h>
23#include <media/rc-map.h>
19 24
20extern int ir_core_debug; 25extern int ir_core_debug;
21#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ 26#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
22 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) 27 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
23 28
24enum ir_type { 29enum rc_driver_type {
25 IR_TYPE_UNKNOWN = 0, 30 RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */
26 IR_TYPE_RC5 = 1, 31 RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */
27 IR_TYPE_PD = 2, /* Pulse distance encoded IR */
28 IR_TYPE_NEC = 3,
29 IR_TYPE_OTHER = 99,
30}; 32};
31 33
32struct ir_scancode { 34/**
33 u16 scancode; 35 * struct ir_dev_props - Allow caller drivers to set special properties
34 u32 keycode; 36 * @driver_type: specifies if the driver or hardware have already a decoder,
37 * or if it needs to use the IR raw event decoders to produce a scancode
38 * @allowed_protos: bitmask with the supported IR_TYPE_* protocols
39 * @scanmask: some hardware decoders are not capable of providing the full
40 * scancode to the application. As this is a hardware limit, we can't do
41 * anything with it. Yet, as the same keycode table can be used with other
42 * devices, a mask is provided to allow its usage. Drivers should generally
43 * leave this field in blank
44 * @priv: driver-specific data, to be used on the callbacks
45 * @change_protocol: allow changing the protocol used on hardware decoders
46 * @open: callback to allow drivers to enable polling/irq when IR input device
47 * is opened.
48 * @close: callback to allow drivers to disable polling/irq when IR input device
49 * is opened.
50 */
51struct ir_dev_props {
52 enum rc_driver_type driver_type;
53 unsigned long allowed_protos;
54 u32 scanmask;
55 void *priv;
56 int (*change_protocol)(void *priv, u64 ir_type);
57 int (*open)(void *priv);
58 void (*close)(void *priv);
35}; 59};
36 60
37struct ir_scancode_table { 61struct ir_input_dev {
38 struct ir_scancode *scan; 62 struct device dev; /* device */
39 int size; 63 char *driver_name; /* Name of the driver module */
40 enum ir_type ir_type; 64 struct ir_scancode_table rc_tab; /* scan/key table */
41 spinlock_t lock; 65 unsigned long devno; /* device number */
66 const struct ir_dev_props *props; /* Device properties */
67 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
68 struct input_dev *input_dev; /* the input device associated with this device */
69
70 /* key info - needed by IR keycode handlers */
71 spinlock_t keylock; /* protects the below members */
72 bool keypressed; /* current state */
73 unsigned long keyup_jiffies; /* when should the current keypress be released? */
74 struct timer_list timer_keyup; /* timer for releasing a keypress */
75 u32 last_keycode; /* keycode of last command */
76 u32 last_scancode; /* scancode of last command */
77 u8 last_toggle; /* toggle of last command */
42}; 78};
43 79
44struct ir_input_dev { 80enum raw_event_type {
45 struct input_dev *dev; 81 IR_SPACE = (1 << 0),
46 struct ir_scancode_table rc_tab; 82 IR_PULSE = (1 << 1),
83 IR_START_EVENT = (1 << 2),
84 IR_STOP_EVENT = (1 << 3),
47}; 85};
48 86
49/* Routines from ir-keytable.c */ 87#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
88
89/* From ir-keytable.c */
90int __ir_input_register(struct input_dev *dev,
91 const struct ir_scancode_table *ir_codes,
92 const struct ir_dev_props *props,
93 const char *driver_name);
94
95static inline int ir_input_register(struct input_dev *dev,
96 const char *map_name,
97 const struct ir_dev_props *props,
98 const char *driver_name) {
99 struct ir_scancode_table *ir_codes;
100 struct ir_input_dev *ir_dev;
101 int rc;
102
103 if (!map_name)
104 return -EINVAL;
105
106 ir_codes = get_rc_map(map_name);
107 if (!ir_codes)
108 return -EINVAL;
50 109
51u32 ir_g_keycode_from_table(struct input_dev *input_dev, 110 rc = __ir_input_register(dev, ir_codes, props, driver_name);
52 u32 scancode); 111 if (rc < 0)
112 return -EINVAL;
53 113
54int ir_set_keycode_table(struct input_dev *input_dev, 114 ir_dev = input_get_drvdata(dev);
55 struct ir_scancode_table *rc_tab); 115
116 if (!rc && ir_dev->props && ir_dev->props->change_protocol)
117 rc = ir_dev->props->change_protocol(ir_dev->props->priv,
118 ir_codes->ir_type);
119
120 return rc;
121}
56 122
57int ir_roundup_tablesize(int n_elems);
58int ir_input_register(struct input_dev *dev,
59 struct ir_scancode_table *ir_codes);
60void ir_input_unregister(struct input_dev *input_dev); 123void ir_input_unregister(struct input_dev *input_dev);
61 124
62#endif 125void ir_repeat(struct input_dev *dev);
126void ir_keydown(struct input_dev *dev, int scancode, u8 toggle);
127u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);
128
129/* From ir-raw-event.c */
130
131struct ir_raw_event {
132 unsigned pulse:1;
133 unsigned duration:31;
134};
135
136#define IR_MAX_DURATION 0x7FFFFFFF /* a bit more than 2 seconds */
137
138void ir_raw_event_handle(struct input_dev *input_dev);
139int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
140int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
141static inline void ir_raw_event_reset(struct input_dev *input_dev)
142{
143 struct ir_raw_event ev = { .pulse = false, .duration = 0 };
144 ir_raw_event_store(input_dev, &ev);
145 ir_raw_event_handle(input_dev);
146}
147
148#endif /* _IR_CORE */
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index aaf65e8b1a40..0506e45c9a4f 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -6,7 +6,7 @@
6struct IR_i2c; 6struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 struct ir_scancode_table *ir_codes; 9 char *ir_codes;
10 10
11 struct i2c_client *c; 11 struct i2c_client *c;
12 struct input_dev *input; 12 struct input_dev *input;
@@ -34,9 +34,9 @@ enum ir_kbd_get_key_fn {
34 34
35/* Can be passed when instantiating an ir_video i2c device */ 35/* Can be passed when instantiating an ir_video i2c device */
36struct IR_i2c_init_data { 36struct IR_i2c_init_data {
37 struct ir_scancode_table *ir_codes; 37 char *ir_codes;
38 const char *name; 38 const char *name;
39 int type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ 39 u64 type; /* IR_TYPE_RC5, etc */
40 /* 40 /*
41 * Specify either a function pointer or a value indicating one of 41 * Specify either a function pointer or a value indicating one of
42 * ir_kbd_i2c's internal get_key functions 42 * ir_kbd_i2c's internal get_key functions
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 14c77efd6a85..548bf1155c83 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -15,8 +15,9 @@
15#include <media/soc_camera.h> 15#include <media/soc_camera.h>
16 16
17/* for flags */ 17/* for flags */
18#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ 18#define OV772X_FLAG_VFLIP (1 << 0) /* Vertical flip image */
19#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ 19#define OV772X_FLAG_HFLIP (1 << 1) /* Horizontal flip image */
20#define OV772X_FLAG_8BIT (1 << 2) /* default 10 bit */
20 21
21/* 22/*
22 * for Edge ctrl 23 * for Edge ctrl
@@ -53,9 +54,8 @@ struct ov772x_edge_ctrl {
53 * ov772x camera info 54 * ov772x camera info
54 */ 55 */
55struct ov772x_camera_info { 56struct ov772x_camera_info {
56 unsigned long buswidth; 57 unsigned long flags;
57 unsigned long flags; 58 struct ov772x_edge_ctrl edgectrl;
58 struct ov772x_edge_ctrl edgectrl;
59}; 59};
60 60
61#endif /* __OV772X_H__ */ 61#endif /* __OV772X_H__ */
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
new file mode 100644
index 000000000000..c78e99a435b6
--- /dev/null
+++ b/include/media/rc-map.h
@@ -0,0 +1,122 @@
1/*
2 * rc-map.h - define RC map names used by RC drivers
3 *
4 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/input.h>
13
14#define IR_TYPE_UNKNOWN 0
15#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */
16#define IR_TYPE_NEC (1 << 1)
17#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */
18#define IR_TYPE_JVC (1 << 3) /* JVC protocol */
19#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */
20#define IR_TYPE_OTHER (1u << 31)
21
22struct ir_scancode {
23 u32 scancode;
24 u32 keycode;
25};
26
27struct ir_scancode_table {
28 struct ir_scancode *scan;
29 unsigned int size; /* Max number of entries */
30 unsigned int len; /* Used number of entries */
31 unsigned int alloc; /* Size of *scan in bytes */
32 u64 ir_type;
33 char *name;
34 spinlock_t lock;
35};
36
37struct rc_keymap {
38 struct list_head list;
39 struct ir_scancode_table map;
40};
41
42/* Routines from rc-map.c */
43
44int ir_register_map(struct rc_keymap *map);
45void ir_unregister_map(struct rc_keymap *map);
46struct ir_scancode_table *get_rc_map(const char *name);
47void rc_map_init(void);
48
49/* Names of the several keytables defined in-kernel */
50
51#define RC_MAP_ADSTECH_DVB_T_PCI "rc-adstech-dvb-t-pci"
52#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp"
53#define RC_MAP_ASUS_PC39 "rc-asus-pc39"
54#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600"
55#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d"
56#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus"
57#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt"
58#define RC_MAP_AVERMEDIA_M135A "rc-avermedia-m135a"
59#define RC_MAP_AVERMEDIA_M733A_RM_K6 "rc-avermedia-m733a-rm-k6"
60#define RC_MAP_AVERMEDIA "rc-avermedia"
61#define RC_MAP_AVERTV_303 "rc-avertv-303"
62#define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus"
63#define RC_MAP_BEHOLD "rc-behold"
64#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old"
65#define RC_MAP_CINERGY_1400 "rc-cinergy-1400"
66#define RC_MAP_CINERGY "rc-cinergy"
67#define RC_MAP_DM1105_NEC "rc-dm1105-nec"
68#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro"
69#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t"
70#define RC_MAP_EMPTY "rc-empty"
71#define RC_MAP_EM_TERRATEC "rc-em-terratec"
72#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2"
73#define RC_MAP_ENCORE_ENLTV_FM53 "rc-encore-enltv-fm53"
74#define RC_MAP_ENCORE_ENLTV "rc-encore-enltv"
75#define RC_MAP_EVGA_INDTUBE "rc-evga-indtube"
76#define RC_MAP_EZTV "rc-eztv"
77#define RC_MAP_FLYDVB "rc-flydvb"
78#define RC_MAP_FLYVIDEO "rc-flyvideo"
79#define RC_MAP_FUSIONHDTV_MCE "rc-fusionhdtv-mce"
80#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z"
81#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce"
82#define RC_MAP_GOTVIEW7135 "rc-gotview7135"
83#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new"
84#define RC_MAP_IMON_MCE "rc-imon-mce"
85#define RC_MAP_IMON_PAD "rc-imon-pad"
86#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
87#define RC_MAP_KAIOMY "rc-kaiomy"
88#define RC_MAP_KWORLD_315U "rc-kworld-315u"
89#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
90#define RC_MAP_MANLI "rc-manli"
91#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus"
92#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere"
93#define RC_MAP_NEBULA "rc-nebula"
94#define RC_MAP_NEC_TERRATEC_CINERGY_XS "rc-nec-terratec-cinergy-xs"
95#define RC_MAP_NORWOOD "rc-norwood"
96#define RC_MAP_NPGTECH "rc-npgtech"
97#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
98#define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color"
99#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
100#define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd"
101#define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new"
102#define RC_MAP_PIXELVIEW "rc-pixelview"
103#define RC_MAP_PIXELVIEW_MK12 "rc-pixelview-mk12"
104#define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel"
105#define RC_MAP_PROTEUS_2309 "rc-proteus-2309"
106#define RC_MAP_PURPLETV "rc-purpletv"
107#define RC_MAP_PV951 "rc-pv951"
108#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new"
109#define RC_MAP_RC5_TV "rc-rc5-tv"
110#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
111#define RC_MAP_TBS_NEC "rc-tbs-nec"
112#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"
113#define RC_MAP_TEVII_NEC "rc-tevii-nec"
114#define RC_MAP_TT_1500 "rc-tt-1500"
115#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350"
116#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr"
117#define RC_MAP_WINFAST "rc-winfast"
118#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
119/*
120 * Please, do not just append newer Remote Controller names at the end.
121 * The names should be ordered in alphabetical order
122 */
diff --git a/include/media/sh_vou.h b/include/media/sh_vou.h
new file mode 100644
index 000000000000..a3ef30242b00
--- /dev/null
+++ b/include/media/sh_vou.h
@@ -0,0 +1,34 @@
1/*
2 * SuperH Video Output Unit (VOU) driver header
3 *
4 * Copyright (C) 2010, 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#ifndef SH_VOU_H
11#define SH_VOU_H
12
13#include <linux/i2c.h>
14
15/* Bus flags */
16#define SH_VOU_PCLK_FALLING (1 << 0)
17#define SH_VOU_HSYNC_LOW (1 << 1)
18#define SH_VOU_VSYNC_LOW (1 << 2)
19
20enum sh_vou_bus_fmt {
21 SH_VOU_BUS_8BIT,
22 SH_VOU_BUS_16BIT,
23 SH_VOU_BUS_BT656,
24};
25
26struct sh_vou_pdata {
27 enum sh_vou_bus_fmt bus_fmt;
28 int i2c_adap;
29 struct i2c_board_info *board_info;
30 unsigned long flags;
31 char *module_name;
32};
33
34#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index dcc5b86bcb6c..b8289c2f609b 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -66,7 +66,7 @@ struct soc_camera_host_ops {
66 * .get_formats() fail, .put_formats() will not be called at all, the 66 * .get_formats() fail, .put_formats() will not be called at all, the
67 * failing .get_formats() must then clean up internally. 67 * failing .get_formats() must then clean up internally.
68 */ 68 */
69 int (*get_formats)(struct soc_camera_device *, int, 69 int (*get_formats)(struct soc_camera_device *, unsigned int,
70 struct soc_camera_format_xlate *); 70 struct soc_camera_format_xlate *);
71 void (*put_formats)(struct soc_camera_device *); 71 void (*put_formats)(struct soc_camera_device *);
72 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *); 72 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
@@ -81,6 +81,8 @@ struct soc_camera_host_ops {
81 int (*set_bus_param)(struct soc_camera_device *, __u32); 81 int (*set_bus_param)(struct soc_camera_device *, __u32);
82 int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *); 82 int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
83 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *); 83 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
84 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
85 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
84 unsigned int (*poll)(struct file *, poll_table *); 86 unsigned int (*poll)(struct file *, poll_table *);
85 const struct v4l2_queryctrl *controls; 87 const struct v4l2_queryctrl *controls;
86 int num_controls; 88 int num_controls;
@@ -264,8 +266,8 @@ static inline unsigned long soc_camera_bus_param_compatible(
264 common_flags; 266 common_flags;
265} 267}
266 268
267static inline void soc_camera_limit_side(unsigned int *start, 269static inline void soc_camera_limit_side(int *start, int *length,
268 unsigned int *length, unsigned int start_min, 270 unsigned int start_min,
269 unsigned int length_min, unsigned int length_max) 271 unsigned int length_min, unsigned int length_max)
270{ 272{
271 if (*length < length_min) 273 if (*length < length_min)
@@ -282,4 +284,12 @@ static inline void soc_camera_limit_side(unsigned int *start,
282extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 284extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
283 unsigned long flags); 285 unsigned long flags);
284 286
287/* This is only temporary here - until v4l2-subdev begins to link to video_device */
288#include <linux/i2c.h>
289static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client)
290{
291 struct soc_camera_device *icd = client->dev.platform_data;
292 return icd->vdev;
293}
294
285#endif 295#endif
diff --git a/include/media/timb_radio.h b/include/media/timb_radio.h
new file mode 100644
index 000000000000..fcd32a3696ba
--- /dev/null
+++ b/include/media/timb_radio.h
@@ -0,0 +1,36 @@
1/*
2 * timb_radio.h Platform struct for the Timberdale radio driver
3 * Copyright (c) 2009 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef _TIMB_RADIO_
20#define _TIMB_RADIO_ 1
21
22#include <linux/i2c.h>
23
24struct timb_radio_platform_data {
25 int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */
26 struct {
27 const char *module_name;
28 struct i2c_board_info *info;
29 } tuner;
30 struct {
31 const char *module_name;
32 struct i2c_board_info *info;
33 } dsp;
34};
35
36#endif
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 4d5b53ff17db..51811eac46f1 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -129,6 +129,8 @@
129#define TUNER_PARTSNIC_PTI_5NF05 81 129#define TUNER_PARTSNIC_PTI_5NF05 81
130#define TUNER_PHILIPS_CU1216L 82 130#define TUNER_PHILIPS_CU1216L 82
131#define TUNER_NXP_TDA18271 83 131#define TUNER_NXP_TDA18271 83
132#define TUNER_SONY_BTF_PXN01Z 84
133#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */
132 134
133/* tv card specific */ 135/* tv card specific */
134#define TDA9887_PRESENT (1<<0) 136#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/tvp7002.h b/include/media/tvp7002.h
new file mode 100644
index 000000000000..ee4353459ef5
--- /dev/null
+++ b/include/media/tvp7002.h
@@ -0,0 +1,56 @@
1/* Texas Instruments Triple 8-/10-BIT 165-/110-MSPS Video and Graphics
2 * Digitizer with Horizontal PLL registers
3 *
4 * Copyright (C) 2009 Texas Instruments Inc
5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
6 *
7 * This code is partially based upon the TVP5150 driver
8 * written by Mauro Carvalho Chehab (mchehab@infradead.org),
9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
10 * and the TVP7002 driver in the TI LSP 2.10.00.14
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#ifndef _TVP7002_H_
27#define _TVP7002_H_
28
29/* Platform-dependent data
30 *
31 * clk_polarity:
32 * 0 -> data clocked out on rising edge of DATACLK signal
33 * 1 -> data clocked out on falling edge of DATACLK signal
34 * hs_polarity:
35 * 0 -> active low HSYNC output
36 * 1 -> active high HSYNC output
37 * sog_polarity:
38 * 0 -> normal operation
39 * 1 -> operation with polarity inverted
40 * vs_polarity:
41 * 0 -> active low VSYNC output
42 * 1 -> active high VSYNC output
43 * fid_polarity:
44 * 0 -> the field ID output is set to logic 1 for an odd
45 * field (field 1) and set to logic 0 for an even
46 * field (field 0).
47 * 1 -> operation with polarity inverted.
48 */
49struct tvp7002_config {
50 u8 clk_polarity;
51 u8 hs_polarity;
52 u8 vs_polarity;
53 u8 fid_polarity;
54 u8 sog_polarity;
55};
56#endif
diff --git a/include/media/tw9910.h b/include/media/tw9910.h
index 5e2895a05e6b..90bcf1fa5421 100644
--- a/include/media/tw9910.h
+++ b/include/media/tw9910.h
@@ -30,8 +30,8 @@ enum tw9910_mpout_pin {
30}; 30};
31 31
32struct tw9910_video_info { 32struct tw9910_video_info {
33 unsigned long buswidth; 33 unsigned long buswidth;
34 enum tw9910_mpout_pin mpout; 34 enum tw9910_mpout_pin mpout;
35}; 35};
36 36
37 37
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 6cc107d198a0..21b4428c12ab 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -25,6 +25,10 @@
25#define V4L2_CHIP_IDENT_H_ 25#define V4L2_CHIP_IDENT_H_
26 26
27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */ 27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
28
29/* KEEP THIS LIST ORDERED BY ID!
30 Otherwise it will be hard to see which ranges are already in use when
31 adding support to a new chip family. */
28enum { 32enum {
29 /* general idents: reserved range 0-49 */ 33 /* general idents: reserved range 0-49 */
30 V4L2_IDENT_NONE = 0, /* No chip matched */ 34 V4L2_IDENT_NONE = 0, /* No chip matched */
@@ -39,6 +43,7 @@ enum {
39 43
40 /* module saa7115: reserved range 101-149 */ 44 /* module saa7115: reserved range 101-149 */
41 V4L2_IDENT_SAA7111 = 101, 45 V4L2_IDENT_SAA7111 = 101,
46 V4L2_IDENT_SAA7111A = 102,
42 V4L2_IDENT_SAA7113 = 103, 47 V4L2_IDENT_SAA7113 = 103,
43 V4L2_IDENT_SAA7114 = 104, 48 V4L2_IDENT_SAA7114 = 104,
44 V4L2_IDENT_SAA7115 = 105, 49 V4L2_IDENT_SAA7115 = 105,
@@ -76,17 +81,14 @@ enum {
76 V4L2_IDENT_CX23417 = 417, 81 V4L2_IDENT_CX23417 = 417,
77 V4L2_IDENT_CX23418 = 418, 82 V4L2_IDENT_CX23418 = 418,
78 83
79 /* module au0828 */
80 V4L2_IDENT_AU0828 = 828,
81
82 /* module indycam: just ident 2000 */
83 V4L2_IDENT_INDYCAM = 2000,
84
85 /* module bt819: reserved range 810-819 */ 84 /* module bt819: reserved range 810-819 */
86 V4L2_IDENT_BT815A = 815, 85 V4L2_IDENT_BT815A = 815,
87 V4L2_IDENT_BT817A = 817, 86 V4L2_IDENT_BT817A = 817,
88 V4L2_IDENT_BT819A = 819, 87 V4L2_IDENT_BT819A = 819,
89 88
89 /* module au0828 */
90 V4L2_IDENT_AU0828 = 828,
91
90 /* module bt856: just ident 856 */ 92 /* module bt856: just ident 856 */
91 V4L2_IDENT_BT856 = 856, 93 V4L2_IDENT_BT856 = 856,
92 94
@@ -98,6 +100,9 @@ enum {
98 V4L2_IDENT_KS0127 = 1127, 100 V4L2_IDENT_KS0127 = 1127,
99 V4L2_IDENT_KS0127B = 1128, 101 V4L2_IDENT_KS0127B = 1128,
100 102
103 /* module indycam: just ident 2000 */
104 V4L2_IDENT_INDYCAM = 2000,
105
101 /* module vp27smpx: just ident 2700 */ 106 /* module vp27smpx: just ident 2700 */
102 V4L2_IDENT_VP27SMPX = 2700, 107 V4L2_IDENT_VP27SMPX = 2700,
103 108
@@ -134,6 +139,9 @@ enum {
134 /* modules tef6862: just ident 6862 */ 139 /* modules tef6862: just ident 6862 */
135 V4L2_IDENT_TEF6862 = 6862, 140 V4L2_IDENT_TEF6862 = 6862,
136 141
142 /* module tvp7002: just ident 7002 */
143 V4L2_IDENT_TVP7002 = 7002,
144
137 /* module adv7170: just ident 7170 */ 145 /* module adv7170: just ident 7170 */
138 V4L2_IDENT_ADV7170 = 7170, 146 V4L2_IDENT_ADV7170 = 7170,
139 147
@@ -155,20 +163,24 @@ enum {
155 /* module adv7343: just ident 7343 */ 163 /* module adv7343: just ident 7343 */
156 V4L2_IDENT_ADV7343 = 7343, 164 V4L2_IDENT_ADV7343 = 7343,
157 165
166 /* module saa7706h: just ident 7706 */
167 V4L2_IDENT_SAA7706H = 7706,
168
169 /* module mt9v011, just ident 8243 */
170 V4L2_IDENT_MT9V011 = 8243,
171
158 /* module wm8739: just ident 8739 */ 172 /* module wm8739: just ident 8739 */
159 V4L2_IDENT_WM8739 = 8739, 173 V4L2_IDENT_WM8739 = 8739,
160 174
161 /* module wm8775: just ident 8775 */ 175 /* module wm8775: just ident 8775 */
162 V4L2_IDENT_WM8775 = 8775, 176 V4L2_IDENT_WM8775 = 8775,
163 177
164 /* module tda9840: just ident 9840 */
165 V4L2_IDENT_TDA9840 = 9840,
166
167 /* module cafe_ccic, just ident 8801 */ 178 /* module cafe_ccic, just ident 8801 */
168 V4L2_IDENT_CAFE = 8801, 179 V4L2_IDENT_CAFE = 8801,
169 180
170 /* module mt9v011, just ident 8243 */ 181 /* AKM AK8813/AK8814 */
171 V4L2_IDENT_MT9V011 = 8243, 182 V4L2_IDENT_AK8813 = 8813,
183 V4L2_IDENT_AK8814 = 8814,
172 184
173 /* module cx23885 and cx25840 */ 185 /* module cx23885 and cx25840 */
174 V4L2_IDENT_CX23885 = 8850, 186 V4L2_IDENT_CX23885 = 8850,
@@ -179,6 +191,9 @@ enum {
179 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ 191 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
180 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ 192 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
181 193
194 /* module tda9840: just ident 9840 */
195 V4L2_IDENT_TDA9840 = 9840,
196
182 /* module tw9910: just ident 9910 */ 197 /* module tw9910: just ident 9910 */
183 V4L2_IDENT_TW9910 = 9910, 198 V4L2_IDENT_TW9910 = 9910,
184 199
@@ -191,72 +206,70 @@ enum {
191 V4L2_IDENT_CX23101 = 23101, 206 V4L2_IDENT_CX23101 = 23101,
192 V4L2_IDENT_CX23102 = 23102, 207 V4L2_IDENT_CX23102 = 23102,
193 208
194 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 209 /* module msp3400: reserved range 34000-34999 for msp34xx */
195 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 210 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
196 use internally (tveeprom.c). */ 211 use internally (tveeprom.c). */
197 212
198 V4L2_IDENT_MSP3400B = 34002, 213 V4L2_IDENT_MSP3400B = 34002,
199 V4L2_IDENT_MSP3410B = 34102,
200
201 V4L2_IDENT_MSP3400C = 34003, 214 V4L2_IDENT_MSP3400C = 34003,
202 V4L2_IDENT_MSP3410C = 34103,
203
204 V4L2_IDENT_MSP3400D = 34004, 215 V4L2_IDENT_MSP3400D = 34004,
205 V4L2_IDENT_MSP3410D = 34104, 216 V4L2_IDENT_MSP3400G = 34007,
217 V4L2_IDENT_MSP3401G = 34017,
218 V4L2_IDENT_MSP3402G = 34027,
206 V4L2_IDENT_MSP3405D = 34054, 219 V4L2_IDENT_MSP3405D = 34054,
207 V4L2_IDENT_MSP3415D = 34154, 220 V4L2_IDENT_MSP3405G = 34057,
208 V4L2_IDENT_MSP3407D = 34074, 221 V4L2_IDENT_MSP3407D = 34074,
209 V4L2_IDENT_MSP3417D = 34174, 222 V4L2_IDENT_MSP3407G = 34077,
210 223
211 V4L2_IDENT_MSP3400G = 34007, 224 V4L2_IDENT_MSP3410B = 34102,
225 V4L2_IDENT_MSP3410C = 34103,
226 V4L2_IDENT_MSP3410D = 34104,
212 V4L2_IDENT_MSP3410G = 34107, 227 V4L2_IDENT_MSP3410G = 34107,
213 V4L2_IDENT_MSP3420G = 34207,
214 V4L2_IDENT_MSP3430G = 34307,
215 V4L2_IDENT_MSP3440G = 34407,
216 V4L2_IDENT_MSP3450G = 34507,
217 V4L2_IDENT_MSP3460G = 34607,
218
219 V4L2_IDENT_MSP3401G = 34017,
220 V4L2_IDENT_MSP3411G = 34117, 228 V4L2_IDENT_MSP3411G = 34117,
221 V4L2_IDENT_MSP3421G = 34217,
222 V4L2_IDENT_MSP3431G = 34317,
223 V4L2_IDENT_MSP3441G = 34417,
224 V4L2_IDENT_MSP3451G = 34517,
225 V4L2_IDENT_MSP3461G = 34617,
226
227 V4L2_IDENT_MSP3402G = 34027,
228 V4L2_IDENT_MSP3412G = 34127, 229 V4L2_IDENT_MSP3412G = 34127,
229 V4L2_IDENT_MSP3422G = 34227, 230 V4L2_IDENT_MSP3415D = 34154,
230 V4L2_IDENT_MSP3442G = 34427,
231 V4L2_IDENT_MSP3452G = 34527,
232
233 V4L2_IDENT_MSP3405G = 34057,
234 V4L2_IDENT_MSP3415G = 34157, 231 V4L2_IDENT_MSP3415G = 34157,
235 V4L2_IDENT_MSP3425G = 34257, 232 V4L2_IDENT_MSP3417D = 34174,
236 V4L2_IDENT_MSP3435G = 34357,
237 V4L2_IDENT_MSP3445G = 34457,
238 V4L2_IDENT_MSP3455G = 34557,
239 V4L2_IDENT_MSP3465G = 34657,
240
241 V4L2_IDENT_MSP3407G = 34077,
242 V4L2_IDENT_MSP3417G = 34177, 233 V4L2_IDENT_MSP3417G = 34177,
234
235 V4L2_IDENT_MSP3420G = 34207,
236 V4L2_IDENT_MSP3421G = 34217,
237 V4L2_IDENT_MSP3422G = 34227,
238 V4L2_IDENT_MSP3425G = 34257,
243 V4L2_IDENT_MSP3427G = 34277, 239 V4L2_IDENT_MSP3427G = 34277,
240
241 V4L2_IDENT_MSP3430G = 34307,
242 V4L2_IDENT_MSP3431G = 34317,
243 V4L2_IDENT_MSP3435G = 34357,
244 V4L2_IDENT_MSP3437G = 34377, 244 V4L2_IDENT_MSP3437G = 34377,
245
246 V4L2_IDENT_MSP3440G = 34407,
247 V4L2_IDENT_MSP3441G = 34417,
248 V4L2_IDENT_MSP3442G = 34427,
249 V4L2_IDENT_MSP3445G = 34457,
245 V4L2_IDENT_MSP3447G = 34477, 250 V4L2_IDENT_MSP3447G = 34477,
251
252 V4L2_IDENT_MSP3450G = 34507,
253 V4L2_IDENT_MSP3451G = 34517,
254 V4L2_IDENT_MSP3452G = 34527,
255 V4L2_IDENT_MSP3455G = 34557,
246 V4L2_IDENT_MSP3457G = 34577, 256 V4L2_IDENT_MSP3457G = 34577,
257
258 V4L2_IDENT_MSP3460G = 34607,
259 V4L2_IDENT_MSP3461G = 34617,
260 V4L2_IDENT_MSP3465G = 34657,
247 V4L2_IDENT_MSP3467G = 34677, 261 V4L2_IDENT_MSP3467G = 34677,
248 262
249 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 263 /* module msp3400: reserved range 44000-44999 for msp44xx */
250 V4L2_IDENT_MSP4400G = 44007, 264 V4L2_IDENT_MSP4400G = 44007,
251 V4L2_IDENT_MSP4410G = 44107,
252 V4L2_IDENT_MSP4420G = 44207,
253 V4L2_IDENT_MSP4440G = 44407,
254 V4L2_IDENT_MSP4450G = 44507,
255
256 V4L2_IDENT_MSP4408G = 44087, 265 V4L2_IDENT_MSP4408G = 44087,
266 V4L2_IDENT_MSP4410G = 44107,
257 V4L2_IDENT_MSP4418G = 44187, 267 V4L2_IDENT_MSP4418G = 44187,
268 V4L2_IDENT_MSP4420G = 44207,
258 V4L2_IDENT_MSP4428G = 44287, 269 V4L2_IDENT_MSP4428G = 44287,
270 V4L2_IDENT_MSP4440G = 44407,
259 V4L2_IDENT_MSP4448G = 44487, 271 V4L2_IDENT_MSP4448G = 44487,
272 V4L2_IDENT_MSP4450G = 44507,
260 V4L2_IDENT_MSP4458G = 44587, 273 V4L2_IDENT_MSP4458G = 44587,
261 274
262 /* Micron CMOS sensor chips: 45000-45099 */ 275 /* Micron CMOS sensor chips: 45000-45099 */
@@ -275,20 +288,27 @@ enum {
275 /* HV7131R CMOS sensor: just ident 46000 */ 288 /* HV7131R CMOS sensor: just ident 46000 */
276 V4L2_IDENT_HV7131R = 46000, 289 V4L2_IDENT_HV7131R = 46000,
277 290
291 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
292 V4L2_IDENT_RJ54N1CB0C = 51980,
293
294 /* module m52790: just ident 52790 */
295 V4L2_IDENT_M52790 = 52790,
296
278 /* module cs53132a: just ident 53132 */ 297 /* module cs53132a: just ident 53132 */
279 V4L2_IDENT_CS53l32A = 53132, 298 V4L2_IDENT_CS53l32A = 53132,
280 299
300 /* modules upd61151 MPEG2 encoder: just ident 54000 */
301 V4L2_IDENT_UPD61161 = 54000,
302 /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
303 V4L2_IDENT_UPD61162 = 54001,
304
281 /* module upd64031a: just ident 64031 */ 305 /* module upd64031a: just ident 64031 */
282 V4L2_IDENT_UPD64031A = 64031, 306 V4L2_IDENT_UPD64031A = 64031,
283 307
284 /* module upd64083: just ident 64083 */ 308 /* module upd64083: just ident 64083 */
285 V4L2_IDENT_UPD64083 = 64083, 309 V4L2_IDENT_UPD64083 = 64083,
286 310
287 /* module m52790: just ident 52790 */ 311 /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
288 V4L2_IDENT_M52790 = 52790,
289
290 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
291 V4L2_IDENT_RJ54N1CB0C = 51980,
292}; 312};
293 313
294#endif 314#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1c7b259f341c..98b32645e5a7 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -85,13 +85,13 @@
85struct v4l2_prio_state { 85struct v4l2_prio_state {
86 atomic_t prios[4]; 86 atomic_t prios[4];
87}; 87};
88int v4l2_prio_init(struct v4l2_prio_state *global); 88void v4l2_prio_init(struct v4l2_prio_state *global);
89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, 89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
90 enum v4l2_priority new); 90 enum v4l2_priority new);
91int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); 91void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
92int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); 92void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); 93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); 94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
95 95
96/* ------------------------------------------------------------------------- */ 96/* ------------------------------------------------------------------------- */
97 97
@@ -184,6 +184,25 @@ const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
184 184
185/* ------------------------------------------------------------------------- */ 185/* ------------------------------------------------------------------------- */
186 186
187/* SPI Helper functions */
188#if defined(CONFIG_SPI)
189
190#include <linux/spi/spi.h>
191
192struct spi_device;
193
194/* Load an spi module and return an initialized v4l2_subdev struct.
195 The client_type argument is the name of the chip that's on the adapter. */
196struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
197 struct spi_master *master, struct spi_board_info *info);
198
199/* Initialize an v4l2_subdev with data from an spi_device struct */
200void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
201 const struct v4l2_subdev_ops *ops);
202#endif
203
204/* ------------------------------------------------------------------------- */
205
187/* Note: these remaining ioctls/structs should be removed as well, but they are 206/* Note: these remaining ioctls/structs should be removed as well, but they are
188 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and 207 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
189 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup 208 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2dee93892ea2..bebe44b03e0f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -32,6 +32,7 @@ struct v4l2_device;
32 Drivers can clear this flag if they want to block all future 32 Drivers can clear this flag if they want to block all future
33 device access. It is cleared by video_unregister_device. */ 33 device access. It is cleared by video_unregister_device. */
34#define V4L2_FL_REGISTERED (0) 34#define V4L2_FL_REGISTERED (0)
35#define V4L2_FL_USES_V4L2_FH (1)
35 36
36struct v4l2_file_operations { 37struct v4l2_file_operations {
37 struct module *owner; 38 struct module *owner;
@@ -77,6 +78,10 @@ struct video_device
77 /* attribute to differentiate multiple indices on one physical device */ 78 /* attribute to differentiate multiple indices on one physical device */
78 int index; 79 int index;
79 80
81 /* V4L2 file handles */
82 spinlock_t fh_lock; /* Lock for all v4l2_fhs */
83 struct list_head fh_list; /* List of struct v4l2_fh */
84
80 int debug; /* Activates debug level*/ 85 int debug; /* Activates debug level*/
81 86
82 /* Video standard vars */ 87 /* Video standard vars */
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
new file mode 100644
index 000000000000..3b86177c8cd2
--- /dev/null
+++ b/include/media/v4l2-event.h
@@ -0,0 +1,67 @@
1/*
2 * v4l2-event.h
3 *
4 * V4L2 events.
5 *
6 * Copyright (C) 2009--2010 Nokia Corporation.
7 *
8 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef V4L2_EVENT_H
26#define V4L2_EVENT_H
27
28#include <linux/types.h>
29#include <linux/videodev2.h>
30#include <linux/wait.h>
31
32struct v4l2_fh;
33struct video_device;
34
35struct v4l2_kevent {
36 struct list_head list;
37 struct v4l2_event event;
38};
39
40struct v4l2_subscribed_event {
41 struct list_head list;
42 u32 type;
43};
44
45struct v4l2_events {
46 wait_queue_head_t wait;
47 struct list_head subscribed; /* Subscribed events */
48 struct list_head free; /* Events ready for use */
49 struct list_head available; /* Dequeueable event */
50 unsigned int navailable;
51 unsigned int nallocated; /* Number of allocated events */
52 u32 sequence;
53};
54
55int v4l2_event_init(struct v4l2_fh *fh);
56int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n);
57void v4l2_event_free(struct v4l2_fh *fh);
58int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event,
59 int nonblocking);
60void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
61int v4l2_event_pending(struct v4l2_fh *fh);
62int v4l2_event_subscribe(struct v4l2_fh *fh,
63 struct v4l2_event_subscription *sub);
64int v4l2_event_unsubscribe(struct v4l2_fh *fh,
65 struct v4l2_event_subscription *sub);
66
67#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
new file mode 100644
index 000000000000..1d72dde320bf
--- /dev/null
+++ b/include/media/v4l2-fh.h
@@ -0,0 +1,65 @@
1/*
2 * v4l2-fh.h
3 *
4 * V4L2 file handle. Store per file handle data for the V4L2
5 * framework. Using file handles is optional for the drivers.
6 *
7 * Copyright (C) 2009--2010 Nokia Corporation.
8 *
9 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
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
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 */
25
26#ifndef V4L2_FH_H
27#define V4L2_FH_H
28
29#include <linux/list.h>
30
31struct video_device;
32struct v4l2_events;
33
34struct v4l2_fh {
35 struct list_head list;
36 struct video_device *vdev;
37 struct v4l2_events *events; /* events, pending and subscribed */
38};
39
40/*
41 * Initialise the file handle. Parts of the V4L2 framework using the
42 * file handles should be initialised in this function. Must be called
43 * from driver's v4l2_file_operations->open() handler if the driver
44 * uses v4l2_fh.
45 */
46int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
47/*
48 * Add the fh to the list of file handles on a video_device. The file
49 * handle must be initialised first.
50 */
51void v4l2_fh_add(struct v4l2_fh *fh);
52/*
53 * Remove file handle from the list of file handles. Must be called in
54 * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
55 */
56void v4l2_fh_del(struct v4l2_fh *fh);
57/*
58 * Release resources related to a file handle. Parts of the V4L2
59 * framework using the v4l2_fh must release their resources here, too.
60 * Must be called in v4l2_file_operations->release() handler if the
61 * driver uses v4l2_fh.
62 */
63void v4l2_fh_exit(struct v4l2_fh *fh);
64
65#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e8ba0f2efbae..06daa6e8e051 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -21,6 +21,8 @@
21#include <linux/videodev2.h> 21#include <linux/videodev2.h>
22#endif 22#endif
23 23
24struct v4l2_fh;
25
24struct v4l2_ioctl_ops { 26struct v4l2_ioctl_ops {
25 /* ioctl callbacks */ 27 /* ioctl callbacks */
26 28
@@ -254,6 +256,11 @@ struct v4l2_ioctl_ops {
254 int (*vidioc_g_dv_timings) (struct file *file, void *fh, 256 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
255 struct v4l2_dv_timings *timings); 257 struct v4l2_dv_timings *timings);
256 258
259 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
260 struct v4l2_event_subscription *sub);
261 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
262 struct v4l2_event_subscription *sub);
263
257 /* For other private ioctls */ 264 /* For other private ioctls */
258 long (*vidioc_default) (struct file *file, void *fh, 265 long (*vidioc_default) (struct file *file, void *fh,
259 int cmd, void *arg); 266 int cmd, void *arg);
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 0dbe02ada259..865cda7cd611 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -40,6 +40,7 @@ enum v4l2_mbus_pixelcode {
40 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE, 40 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
41 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, 41 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
42 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, 42 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
43 V4L2_MBUS_FMT_SGRBG8_1X8,
43}; 44};
44 45
45/** 46/**
@@ -58,4 +59,24 @@ struct v4l2_mbus_framefmt {
58 enum v4l2_colorspace colorspace; 59 enum v4l2_colorspace colorspace;
59}; 60};
60 61
62static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
63 const struct v4l2_mbus_framefmt *mbus_fmt)
64{
65 pix_fmt->width = mbus_fmt->width;
66 pix_fmt->height = mbus_fmt->height;
67 pix_fmt->field = mbus_fmt->field;
68 pix_fmt->colorspace = mbus_fmt->colorspace;
69}
70
71static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
72 const struct v4l2_pix_format *pix_fmt,
73 enum v4l2_mbus_pixelcode code)
74{
75 mbus_fmt->width = pix_fmt->width;
76 mbus_fmt->height = pix_fmt->height;
77 mbus_fmt->field = pix_fmt->field;
78 mbus_fmt->colorspace = pix_fmt->colorspace;
79 mbus_fmt->code = code;
80}
81
61#endif 82#endif
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
new file mode 100644
index 000000000000..8d149f1c58d0
--- /dev/null
+++ b/include/media/v4l2-mem2mem.h
@@ -0,0 +1,201 @@
1/*
2 * Memory-to-memory device framework for Video for Linux 2.
3 *
4 * Helper functions for devices that use memory buffers for both source
5 * and destination.
6 *
7 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
8 * Pawel Osciak, <p.osciak@samsung.com>
9 * Marek Szyprowski, <m.szyprowski@samsung.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version
15 */
16
17#ifndef _MEDIA_V4L2_MEM2MEM_H
18#define _MEDIA_V4L2_MEM2MEM_H
19
20#include <media/videobuf-core.h>
21
22/**
23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks
24 * @device_run: required. Begin the actual job (transaction) inside this
25 * callback.
26 * The job does NOT have to end before this callback returns
27 * (and it will be the usual case). When the job finishes,
28 * v4l2_m2m_job_finish() has to be called.
29 * @job_ready: optional. Should return 0 if the driver does not have a job
30 * fully prepared to run yet (i.e. it will not be able to finish a
31 * transaction without sleeping). If not provided, it will be
32 * assumed that one source and one destination buffer are all
33 * that is required for the driver to perform one full transaction.
34 * This method may not sleep.
35 * @job_abort: required. Informs the driver that it has to abort the currently
36 * running transaction as soon as possible (i.e. as soon as it can
37 * stop the device safely; e.g. in the next interrupt handler),
38 * even if the transaction would not have been finished by then.
39 * After the driver performs the necessary steps, it has to call
40 * v4l2_m2m_job_finish() (as if the transaction ended normally).
41 * This function does not have to (and will usually not) wait
42 * until the device enters a state when it can be stopped.
43 */
44struct v4l2_m2m_ops {
45 void (*device_run)(void *priv);
46 int (*job_ready)(void *priv);
47 void (*job_abort)(void *priv);
48};
49
50struct v4l2_m2m_dev;
51
52struct v4l2_m2m_queue_ctx {
53/* private: internal use only */
54 struct videobuf_queue q;
55
56 /* Queue for buffers ready to be processed as soon as this
57 * instance receives access to the device */
58 struct list_head rdy_queue;
59 u8 num_rdy;
60};
61
62struct v4l2_m2m_ctx {
63/* private: internal use only */
64 struct v4l2_m2m_dev *m2m_dev;
65
66 /* Capture (output to memory) queue context */
67 struct v4l2_m2m_queue_ctx cap_q_ctx;
68
69 /* Output (input from memory) queue context */
70 struct v4l2_m2m_queue_ctx out_q_ctx;
71
72 /* For device job queue */
73 struct list_head queue;
74 unsigned long job_flags;
75
76 /* Instance private data */
77 void *priv;
78};
79
80void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
81
82struct videobuf_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
83 enum v4l2_buf_type type);
84
85void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
86 struct v4l2_m2m_ctx *m2m_ctx);
87
88int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
89 struct v4l2_requestbuffers *reqbufs);
90
91int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
92 struct v4l2_buffer *buf);
93
94int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
95 struct v4l2_buffer *buf);
96int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
97 struct v4l2_buffer *buf);
98
99int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
100 enum v4l2_buf_type type);
101int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
102 enum v4l2_buf_type type);
103
104unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
105 struct poll_table_struct *wait);
106
107int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
108 struct vm_area_struct *vma);
109
110struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops);
111void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
112
113struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(void *priv, struct v4l2_m2m_dev *m2m_dev,
114 void (*vq_init)(void *priv, struct videobuf_queue *,
115 enum v4l2_buf_type));
116void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx);
117
118void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct videobuf_queue *vq,
119 struct videobuf_buffer *vb);
120
121/**
122 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for
123 * use
124 */
125static inline
126unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
127{
128 return m2m_ctx->cap_q_ctx.num_rdy;
129}
130
131/**
132 * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers
133 * ready for use
134 */
135static inline
136unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
137{
138 return m2m_ctx->out_q_ctx.num_rdy;
139}
140
141void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type);
142
143/**
144 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready
145 * buffers
146 */
147static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
148{
149 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
150}
151
152/**
153 * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of
154 * ready buffers
155 */
156static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
157{
158 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
159}
160
161/**
162 * v4l2_m2m_get_src_vq() - return videobuf_queue for source buffers
163 */
164static inline
165struct videobuf_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
166{
167 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
168}
169
170/**
171 * v4l2_m2m_get_dst_vq() - return videobuf_queue for destination buffers
172 */
173static inline
174struct videobuf_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx)
175{
176 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
177}
178
179void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx,
180 enum v4l2_buf_type type);
181
182/**
183 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready
184 * buffers and return it
185 */
186static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
187{
188 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
189}
190
191/**
192 * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of
193 * ready buffers and return it
194 */
195static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
196{
197 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
198}
199
200#endif /* _MEDIA_V4L2_MEM2MEM_H */
201
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 9ba99cd39ee7..02c6f4d11ed3 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -180,31 +180,10 @@ struct v4l2_subdev_audio_ops {
180 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 180 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
181 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 181 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
182 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 182 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
183 int (*s_stream)(struct v4l2_subdev *sd, int enable);
183}; 184};
184 185
185/* 186/*
186 decode_vbi_line: video decoders that support sliced VBI need to implement
187 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
188 start of the VBI data that was generated by the decoder. The driver
189 then parses the sliced VBI data and sets the other fields in the
190 struct accordingly. The pointer p is updated to point to the start of
191 the payload which can be copied verbatim into the data field of the
192 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
193 type field is set to 0 on return.
194
195 s_vbi_data: used to generate VBI signals on a video signal.
196 v4l2_sliced_vbi_data is filled with the data packets that should be
197 output. Note that if you set the line field to 0, then that VBI signal
198 is disabled. If no valid VBI data was found, then the type field is
199 set to 0 on return.
200
201 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
202 Not all video decoders support this. If no data is available because
203 the readback register contains invalid or erroneous data -EIO is
204 returned. Note that you must fill in the 'id' member and the 'field'
205 member (to determine whether CC data from the first or second field
206 should be obtained).
207
208 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 187 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
209 video input devices. 188 video input devices.
210 189
@@ -242,10 +221,6 @@ struct v4l2_subdev_audio_ops {
242struct v4l2_subdev_video_ops { 221struct v4l2_subdev_video_ops {
243 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 222 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
244 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); 223 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
245 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
246 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
247 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
248 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
249 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 224 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
250 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); 225 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
251 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); 226 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
@@ -261,6 +236,8 @@ struct v4l2_subdev_video_ops {
261 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 236 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
262 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 237 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
263 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 238 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
239 int (*enum_dv_presets) (struct v4l2_subdev *sd,
240 struct v4l2_dv_enum_preset *preset);
264 int (*s_dv_preset)(struct v4l2_subdev *sd, 241 int (*s_dv_preset)(struct v4l2_subdev *sd,
265 struct v4l2_dv_preset *preset); 242 struct v4l2_dv_preset *preset);
266 int (*query_dv_preset)(struct v4l2_subdev *sd, 243 int (*query_dv_preset)(struct v4l2_subdev *sd,
@@ -269,7 +246,7 @@ struct v4l2_subdev_video_ops {
269 struct v4l2_dv_timings *timings); 246 struct v4l2_dv_timings *timings);
270 int (*g_dv_timings)(struct v4l2_subdev *sd, 247 int (*g_dv_timings)(struct v4l2_subdev *sd,
271 struct v4l2_dv_timings *timings); 248 struct v4l2_dv_timings *timings);
272 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, int index, 249 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
273 enum v4l2_mbus_pixelcode *code); 250 enum v4l2_mbus_pixelcode *code);
274 int (*g_mbus_fmt)(struct v4l2_subdev *sd, 251 int (*g_mbus_fmt)(struct v4l2_subdev *sd,
275 struct v4l2_mbus_framefmt *fmt); 252 struct v4l2_mbus_framefmt *fmt);
@@ -279,6 +256,45 @@ struct v4l2_subdev_video_ops {
279 struct v4l2_mbus_framefmt *fmt); 256 struct v4l2_mbus_framefmt *fmt);
280}; 257};
281 258
259/*
260 decode_vbi_line: video decoders that support sliced VBI need to implement
261 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
262 start of the VBI data that was generated by the decoder. The driver
263 then parses the sliced VBI data and sets the other fields in the
264 struct accordingly. The pointer p is updated to point to the start of
265 the payload which can be copied verbatim into the data field of the
266 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
267 type field is set to 0 on return.
268
269 s_vbi_data: used to generate VBI signals on a video signal.
270 v4l2_sliced_vbi_data is filled with the data packets that should be
271 output. Note that if you set the line field to 0, then that VBI signal
272 is disabled. If no valid VBI data was found, then the type field is
273 set to 0 on return.
274
275 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
276 Not all video decoders support this. If no data is available because
277 the readback register contains invalid or erroneous data -EIO is
278 returned. Note that you must fill in the 'id' member and the 'field'
279 member (to determine whether CC data from the first or second field
280 should be obtained).
281
282 s_raw_fmt: setup the video encoder/decoder for raw VBI.
283
284 g_sliced_fmt: retrieve the current sliced VBI settings.
285
286 s_sliced_fmt: setup the sliced VBI settings.
287 */
288struct v4l2_subdev_vbi_ops {
289 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
290 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
291 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
292 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
293 int (*s_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
294 int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
295 int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
296};
297
282/** 298/**
283 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations 299 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
284 * @g_skip_top_lines: number of lines at the top of the image to be skipped. 300 * @g_skip_top_lines: number of lines at the top of the image to be skipped.
@@ -378,6 +394,7 @@ struct v4l2_subdev_ops {
378 const struct v4l2_subdev_tuner_ops *tuner; 394 const struct v4l2_subdev_tuner_ops *tuner;
379 const struct v4l2_subdev_audio_ops *audio; 395 const struct v4l2_subdev_audio_ops *audio;
380 const struct v4l2_subdev_video_ops *video; 396 const struct v4l2_subdev_video_ops *video;
397 const struct v4l2_subdev_vbi_ops *vbi;
381 const struct v4l2_subdev_ir_ops *ir; 398 const struct v4l2_subdev_ir_ops *ir;
382 const struct v4l2_subdev_sensor_ops *sensor; 399 const struct v4l2_subdev_sensor_ops *sensor;
383}; 400};
@@ -386,6 +403,8 @@ struct v4l2_subdev_ops {
386 403
387/* Set this flag if this subdev is a i2c device. */ 404/* Set this flag if this subdev is a i2c device. */
388#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) 405#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
406/* Set this flag if this subdev is a spi device. */
407#define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
389 408
390/* Each instance of a subdev driver should create this struct, either 409/* Each instance of a subdev driver should create this struct, either
391 stand-alone or embedded in a larger struct. 410 stand-alone or embedded in a larger struct.
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 316fdccdcaa0..f91a736c133d 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -127,30 +127,16 @@ struct videobuf_queue_ops {
127struct videobuf_qtype_ops { 127struct videobuf_qtype_ops {
128 u32 magic; 128 u32 magic;
129 129
130 void *(*alloc) (size_t size); 130 struct videobuf_buffer *(*alloc)(size_t size);
131 void *(*vmalloc) (struct videobuf_buffer *buf); 131 void *(*vaddr) (struct videobuf_buffer *buf);
132 int (*iolock) (struct videobuf_queue* q, 132 int (*iolock) (struct videobuf_queue *q,
133 struct videobuf_buffer *vb, 133 struct videobuf_buffer *vb,
134 struct v4l2_framebuffer *fbuf); 134 struct v4l2_framebuffer *fbuf);
135 int (*mmap) (struct videobuf_queue *q, 135 int (*sync) (struct videobuf_queue *q,
136 unsigned int *count,
137 unsigned int *size,
138 enum v4l2_memory memory);
139 int (*sync) (struct videobuf_queue* q,
140 struct videobuf_buffer *buf); 136 struct videobuf_buffer *buf);
141 int (*video_copy_to_user)(struct videobuf_queue *q,
142 char __user *data,
143 size_t count,
144 int nonblocking);
145 int (*copy_stream) (struct videobuf_queue *q,
146 char __user *data,
147 size_t count,
148 size_t pos,
149 int vbihack,
150 int nonblocking);
151 int (*mmap_free) (struct videobuf_queue *q);
152 int (*mmap_mapper) (struct videobuf_queue *q, 137 int (*mmap_mapper) (struct videobuf_queue *q,
153 struct vm_area_struct *vma); 138 struct videobuf_buffer *buf,
139 struct vm_area_struct *vma);
154}; 140};
155 141
156struct videobuf_queue { 142struct videobuf_queue {
@@ -171,7 +157,6 @@ struct videobuf_queue {
171 157
172 unsigned int streaming:1; 158 unsigned int streaming:1;
173 unsigned int reading:1; 159 unsigned int reading:1;
174 unsigned int is_mmapped:1;
175 160
176 /* capture via mmap() + ioctl(QBUF/DQBUF) */ 161 /* capture via mmap() + ioctl(QBUF/DQBUF) */
177 struct list_head stream; 162 struct list_head stream;
@@ -185,14 +170,14 @@ struct videobuf_queue {
185}; 170};
186 171
187int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); 172int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
188int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, 173int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
189 struct v4l2_framebuffer *fbuf); 174 struct v4l2_framebuffer *fbuf);
190 175
191void *videobuf_alloc(struct videobuf_queue* q); 176struct videobuf_buffer *videobuf_alloc(struct videobuf_queue *q);
192 177
193/* Used on videobuf-dvb */ 178/* Used on videobuf-dvb */
194void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, 179void *videobuf_queue_to_vaddr(struct videobuf_queue *q,
195 struct videobuf_buffer *buf); 180 struct videobuf_buffer *buf);
196 181
197void videobuf_queue_core_init(struct videobuf_queue *q, 182void videobuf_queue_core_init(struct videobuf_queue *q,
198 const struct videobuf_queue_ops *ops, 183 const struct videobuf_queue_ops *ops,
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index 53e72f787175..a195f3b9c00a 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -17,6 +17,8 @@
17 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 18 * the Free Software Foundation; either version 2
19 */ 19 */
20#ifndef _VIDEOBUF_DMA_SG_H
21#define _VIDEOBUF_DMA_SG_H
20 22
21#include <media/videobuf-core.h> 23#include <media/videobuf-core.h>
22 24
@@ -27,14 +29,14 @@
27 * block (NULL on errors). Memory for the scatterlist is allocated 29 * block (NULL on errors). Memory for the scatterlist is allocated
28 * using kmalloc. The caller must free the memory. 30 * using kmalloc. The caller must free the memory.
29 */ 31 */
30struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); 32struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
31 33
32/* 34/*
33 * Return a scatterlist for a an array of userpages (NULL on errors). 35 * Return a scatterlist for a an array of userpages (NULL on errors).
34 * Memory for the scatterlist is allocated using kmalloc. The caller 36 * Memory for the scatterlist is allocated using kmalloc. The caller
35 * must free the memory. 37 * must free the memory.
36 */ 38 */
37struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, 39struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages,
38 int offset); 40 int offset);
39 41
40/* --------------------------------------------------------------------- */ 42/* --------------------------------------------------------------------- */
@@ -78,8 +80,7 @@ struct videobuf_dmabuf {
78 int direction; 80 int direction;
79}; 81};
80 82
81struct videobuf_dma_sg_memory 83struct videobuf_dma_sg_memory {
82{
83 u32 magic; 84 u32 magic;
84 85
85 /* for mmap'ed buffers */ 86 /* for mmap'ed buffers */
@@ -95,14 +96,13 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
95 dma_addr_t addr, int nr_pages); 96 dma_addr_t addr, int nr_pages);
96int videobuf_dma_free(struct videobuf_dmabuf *dma); 97int videobuf_dma_free(struct videobuf_dmabuf *dma);
97 98
98int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 99int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
99int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 100int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
100int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 101struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
101struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf);
102 102
103void *videobuf_sg_alloc(size_t size); 103void *videobuf_sg_alloc(size_t size);
104 104
105void videobuf_queue_sg_init(struct videobuf_queue* q, 105void videobuf_queue_sg_init(struct videobuf_queue *q,
106 const struct videobuf_queue_ops *ops, 106 const struct videobuf_queue_ops *ops,
107 struct device *dev, 107 struct device *dev,
108 spinlock_t *irqlock, 108 spinlock_t *irqlock,
@@ -111,9 +111,11 @@ void videobuf_queue_sg_init(struct videobuf_queue* q,
111 unsigned int msize, 111 unsigned int msize,
112 void *priv); 112 void *priv);
113 113
114 /*FIXME: these variants are used only on *-alsa code, where videobuf is 114/*FIXME: these variants are used only on *-alsa code, where videobuf is
115 * used without queue 115 * used without queue
116 */ 116 */
117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma); 117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); 118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
119 119
120#endif /* _VIDEOBUF_DMA_SG_H */
121
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index 4b419a257a7d..851eb1a2ff2a 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -19,17 +19,17 @@
19 19
20/* --------------------------------------------------------------------- */ 20/* --------------------------------------------------------------------- */
21 21
22struct videobuf_vmalloc_memory 22struct videobuf_vmalloc_memory {
23{
24 u32 magic; 23 u32 magic;
25 24
26 void *vmalloc; 25 void *vmalloc;
27 26
28 /* remap_vmalloc_range seems to need to run after mmap() on some cases */ 27 /* remap_vmalloc_range seems to need to run
28 * after mmap() on some cases */
29 struct vm_area_struct *vma; 29 struct vm_area_struct *vma;
30}; 30};
31 31
32void videobuf_queue_vmalloc_init(struct videobuf_queue* q, 32void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
33 const struct videobuf_queue_ops *ops, 33 const struct videobuf_queue_ops *ops,
34 struct device *dev, 34 struct device *dev,
35 spinlock_t *irqlock, 35 spinlock_t *irqlock,
@@ -38,8 +38,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
38 unsigned int msize, 38 unsigned int msize,
39 void *priv); 39 void *priv);
40 40
41void *videobuf_to_vmalloc (struct videobuf_buffer *buf); 41void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
42 42
43void videobuf_vmalloc_free (struct videobuf_buffer *buf); 43void videobuf_vmalloc_free(struct videobuf_buffer *buf);
44 44
45#endif 45#endif
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index a7fb54808a23..156c26bb8bd7 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -86,6 +86,10 @@ do { \
86 86
87/** 87/**
88 * enum p9_msg_t - 9P message types 88 * enum p9_msg_t - 9P message types
89 * @P9_TSTATFS: file system status request
90 * @P9_RSTATFS: file system status response
91 * @P9_TRENAME: rename request
92 * @P9_RRENAME: rename response
89 * @P9_TVERSION: version handshake request 93 * @P9_TVERSION: version handshake request
90 * @P9_RVERSION: version handshake response 94 * @P9_RVERSION: version handshake response
91 * @P9_TAUTH: request to establish authentication channel 95 * @P9_TAUTH: request to establish authentication channel
@@ -125,6 +129,10 @@ do { \
125 */ 129 */
126 130
127enum p9_msg_t { 131enum p9_msg_t {
132 P9_TSTATFS = 8,
133 P9_RSTATFS,
134 P9_TRENAME = 20,
135 P9_RRENAME,
128 P9_TVERSION = 100, 136 P9_TVERSION = 100,
129 P9_RVERSION, 137 P9_RVERSION,
130 P9_TAUTH = 102, 138 P9_TAUTH = 102,
@@ -350,6 +358,31 @@ struct p9_wstat {
350}; 358};
351 359
352/* Structures for Protocol Operations */ 360/* Structures for Protocol Operations */
361struct p9_tstatfs {
362 u32 fid;
363};
364
365struct p9_rstatfs {
366 u32 type;
367 u32 bsize;
368 u64 blocks;
369 u64 bfree;
370 u64 bavail;
371 u64 files;
372 u64 ffree;
373 u64 fsid;
374 u32 namelen;
375};
376
377struct p9_trename {
378 u32 fid;
379 u32 newdirfid;
380 struct p9_str name;
381};
382
383struct p9_rrename {
384};
385
353struct p9_tversion { 386struct p9_tversion {
354 u32 msize; 387 u32 msize;
355 struct p9_str version; 388 struct p9_str version;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index fb00b329f0d3..7dd3ed85c782 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -29,6 +29,19 @@
29/* Number of requests per row */ 29/* Number of requests per row */
30#define P9_ROW_MAXTAG 255 30#define P9_ROW_MAXTAG 255
31 31
32/** enum p9_proto_versions - 9P protocol versions
33 * @p9_proto_legacy: 9P Legacy mode, pre-9P2000.u
34 * @p9_proto_2000u: 9P2000.u extension
35 * @p9_proto_2000L: 9P2000.L extension
36 */
37
38enum p9_proto_versions{
39 p9_proto_legacy = 0,
40 p9_proto_2000u = 1,
41 p9_proto_2000L = 2,
42};
43
44
32/** 45/**
33 * enum p9_trans_status - different states of underlying transports 46 * enum p9_trans_status - different states of underlying transports
34 * @Connected: transport is connected and healthy 47 * @Connected: transport is connected and healthy
@@ -41,6 +54,7 @@
41 54
42enum p9_trans_status { 55enum p9_trans_status {
43 Connected, 56 Connected,
57 BeginDisconnect,
44 Disconnected, 58 Disconnected,
45 Hung, 59 Hung,
46}; 60};
@@ -111,6 +125,7 @@ struct p9_req_t {
111 * @lock: protect @fidlist 125 * @lock: protect @fidlist
112 * @msize: maximum data size negotiated by protocol 126 * @msize: maximum data size negotiated by protocol
113 * @dotu: extension flags negotiated by protocol 127 * @dotu: extension flags negotiated by protocol
128 * @proto_version: 9P protocol version to use
114 * @trans_mod: module API instantiated with this client 129 * @trans_mod: module API instantiated with this client
115 * @trans: tranport instance state and API 130 * @trans: tranport instance state and API
116 * @conn: connection state information used by trans_fd 131 * @conn: connection state information used by trans_fd
@@ -137,7 +152,7 @@ struct p9_req_t {
137struct p9_client { 152struct p9_client {
138 spinlock_t lock; /* protect client structure */ 153 spinlock_t lock; /* protect client structure */
139 int msize; 154 int msize;
140 unsigned char dotu; 155 unsigned char proto_version;
141 struct p9_trans_module *trans_mod; 156 struct p9_trans_module *trans_mod;
142 enum p9_trans_status status; 157 enum p9_trans_status status;
143 void *trans; 158 void *trans;
@@ -180,10 +195,13 @@ struct p9_fid {
180 struct list_head dlist; /* list of all fids attached to a dentry */ 195 struct list_head dlist; /* list of all fids attached to a dentry */
181}; 196};
182 197
198int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
199int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name);
183int p9_client_version(struct p9_client *); 200int p9_client_version(struct p9_client *);
184struct p9_client *p9_client_create(const char *dev_name, char *options); 201struct p9_client *p9_client_create(const char *dev_name, char *options);
185void p9_client_destroy(struct p9_client *clnt); 202void p9_client_destroy(struct p9_client *clnt);
186void p9_client_disconnect(struct p9_client *clnt); 203void p9_client_disconnect(struct p9_client *clnt);
204void p9_client_begin_disconnect(struct p9_client *clnt);
187struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, 205struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
188 char *uname, u32 n_uname, char *aname); 206 char *uname, u32 n_uname, char *aname);
189struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, 207struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname,
@@ -209,5 +227,7 @@ int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
209int p9stat_read(char *, int, struct p9_wstat *, int); 227int p9stat_read(char *, int, struct p9_wstat *, int);
210void p9stat_free(struct p9_wstat *); 228void p9stat_free(struct p9_wstat *);
211 229
230int p9_is_proto_dotu(struct p9_client *clnt);
231int p9_is_proto_dotl(struct p9_client *clnt);
212 232
213#endif /* NET_9P_CLIENT_H */ 233#endif /* NET_9P_CLIENT_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 0f7c37825fc1..45375b41a2a0 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb);
177static inline struct inet6_dev * 177static inline struct inet6_dev *
178__in6_dev_get(struct net_device *dev) 178__in6_dev_get(struct net_device *dev)
179{ 179{
180 return rcu_dereference(dev->ip6_ptr); 180 return rcu_dereference_check(dev->ip6_ptr,
181 rcu_read_lock_held() ||
182 lockdep_rtnl_is_held());
181} 183}
182 184
183static inline struct inet6_dev * 185static inline struct inet6_dev *
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 1614d78c60ed..20725e213aee 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -30,7 +30,7 @@ struct unix_skb_parms {
30#endif 30#endif
31}; 31};
32 32
33#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 33#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
35#define UNIXSID(skb) (&UNIXCB((skb)).secid) 35#define UNIXSID(skb) (&UNIXCB((skb)).secid)
36 36
@@ -45,21 +45,23 @@ struct unix_skb_parms {
45struct unix_sock { 45struct unix_sock {
46 /* WARNING: sk has to be the first member */ 46 /* WARNING: sk has to be the first member */
47 struct sock sk; 47 struct sock sk;
48 struct unix_address *addr; 48 struct unix_address *addr;
49 struct dentry *dentry; 49 struct dentry *dentry;
50 struct vfsmount *mnt; 50 struct vfsmount *mnt;
51 struct mutex readlock; 51 struct mutex readlock;
52 struct sock *peer; 52 struct sock *peer;
53 struct sock *other; 53 struct sock *other;
54 struct list_head link; 54 struct list_head link;
55 atomic_long_t inflight; 55 atomic_long_t inflight;
56 spinlock_t lock; 56 spinlock_t lock;
57 unsigned int gc_candidate : 1; 57 unsigned int gc_candidate : 1;
58 unsigned int gc_maybe_cycle : 1; 58 unsigned int gc_maybe_cycle : 1;
59 wait_queue_head_t peer_wait; 59 struct socket_wq peer_wq;
60}; 60};
61#define unix_sk(__sk) ((struct unix_sock *)__sk) 61#define unix_sk(__sk) ((struct unix_sock *)__sk)
62 62
63#define peer_wait peer_wq.wait
64
63#ifdef CONFIG_SYSCTL 65#ifdef CONFIG_SYSCTL
64extern int unix_sysctl_register(struct net *net); 66extern int unix_sysctl_register(struct net *net);
65extern void unix_sysctl_unregister(struct net *net); 67extern void unix_sysctl_unregister(struct net *net);
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 717e2192d521..206d22297ac3 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -10,6 +10,7 @@
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/slab.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14 15
15#define AX25_T1CLAMPLO 1 16#define AX25_T1CLAMPLO 1
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 04a6908e38d2..ff77e8f882f1 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -176,6 +176,6 @@ extern void hci_sock_cleanup(void);
176extern int bt_sysfs_init(void); 176extern int bt_sysfs_init(void);
177extern void bt_sysfs_cleanup(void); 177extern void bt_sysfs_cleanup(void);
178 178
179extern struct class *bt_class; 179extern struct dentry *bt_debugfs;
180 180
181#endif /* __BLUETOOTH_H */ 181#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ed3aea1605e8..fc0c502d9fd1 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -43,7 +43,7 @@
43#define HCI_NOTIFY_CONN_DEL 2 43#define HCI_NOTIFY_CONN_DEL 2
44#define HCI_NOTIFY_VOICE_SETTING 3 44#define HCI_NOTIFY_VOICE_SETTING 3
45 45
46/* HCI device types */ 46/* HCI bus types */
47#define HCI_VIRTUAL 0 47#define HCI_VIRTUAL 0
48#define HCI_USB 1 48#define HCI_USB 1
49#define HCI_PCCARD 2 49#define HCI_PCCARD 2
@@ -52,6 +52,10 @@
52#define HCI_PCI 5 52#define HCI_PCI 5
53#define HCI_SDIO 6 53#define HCI_SDIO 6
54 54
55/* HCI controller types */
56#define HCI_BREDR 0x00
57#define HCI_80211 0x01
58
55/* HCI device quirks */ 59/* HCI device quirks */
56enum { 60enum {
57 HCI_QUIRK_NO_RESET, 61 HCI_QUIRK_NO_RESET,
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7b86094a894b..e42f6ed5421c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -70,7 +70,8 @@ struct hci_dev {
70 char name[8]; 70 char name[8];
71 unsigned long flags; 71 unsigned long flags;
72 __u16 id; 72 __u16 id;
73 __u8 type; 73 __u8 bus;
74 __u8 dev_type;
74 bdaddr_t bdaddr; 75 bdaddr_t bdaddr;
75 __u8 dev_name[248]; 76 __u8 dev_name[248];
76 __u8 dev_class[3]; 77 __u8 dev_class[3];
@@ -106,6 +107,8 @@ struct hci_dev {
106 unsigned long acl_last_tx; 107 unsigned long acl_last_tx;
107 unsigned long sco_last_tx; 108 unsigned long sco_last_tx;
108 109
110 struct workqueue_struct *workqueue;
111
109 struct tasklet_struct cmd_task; 112 struct tasklet_struct cmd_task;
110 struct tasklet_struct rx_task; 113 struct tasklet_struct rx_task;
111 struct tasklet_struct tx_task; 114 struct tasklet_struct tx_task;
@@ -134,6 +137,8 @@ struct hci_dev {
134 137
135 atomic_t promisc; 138 atomic_t promisc;
136 139
140 struct dentry *debugfs;
141
137 struct device *parent; 142 struct device *parent;
138 struct device dev; 143 struct device dev;
139 144
@@ -633,8 +638,8 @@ int hci_register_notifier(struct notifier_block *nb);
633int hci_unregister_notifier(struct notifier_block *nb); 638int hci_unregister_notifier(struct notifier_block *nb);
634 639
635int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 640int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
636int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 641void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
637int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 642void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
638 643
639void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 644void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
640 645
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 17a689f27a6a..7c695bfd853c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -30,11 +30,12 @@
30#define L2CAP_DEFAULT_MIN_MTU 48 30#define L2CAP_DEFAULT_MIN_MTU 48
31#define L2CAP_DEFAULT_FLUSH_TO 0xffff 31#define L2CAP_DEFAULT_FLUSH_TO 0xffff
32#define L2CAP_DEFAULT_TX_WINDOW 63 32#define L2CAP_DEFAULT_TX_WINDOW 63
33#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
34#define L2CAP_DEFAULT_MAX_TX 3 33#define L2CAP_DEFAULT_MAX_TX 3
35#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ 34#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
36#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 35#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
37#define L2CAP_DEFAULT_MAX_PDU_SIZE 672 36#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
37#define L2CAP_DEFAULT_ACK_TO 200
38#define L2CAP_LOCAL_BUSY_TRIES 12
38 39
39#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 40#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
40#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 41#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -55,6 +56,8 @@ struct l2cap_options {
55 __u16 flush_to; 56 __u16 flush_to;
56 __u8 mode; 57 __u8 mode;
57 __u8 fcs; 58 __u8 fcs;
59 __u8 max_tx;
60 __u16 txwin_size;
58}; 61};
59 62
60#define L2CAP_CONNINFO 0x02 63#define L2CAP_CONNINFO 0x02
@@ -292,6 +295,7 @@ struct l2cap_conn {
292#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 295#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
293#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) 296#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
294#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) 297#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
298#define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue)
295#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) 299#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list)
296 300
297struct srej_list { 301struct srej_list {
@@ -320,7 +324,7 @@ struct l2cap_pinfo {
320 __u8 conf_req[64]; 324 __u8 conf_req[64];
321 __u8 conf_len; 325 __u8 conf_len;
322 __u8 conf_state; 326 __u8 conf_state;
323 __u8 conn_state; 327 __u16 conn_state;
324 328
325 __u8 next_tx_seq; 329 __u8 next_tx_seq;
326 __u8 expected_ack_seq; 330 __u8 expected_ack_seq;
@@ -328,27 +332,35 @@ struct l2cap_pinfo {
328 __u8 buffer_seq; 332 __u8 buffer_seq;
329 __u8 buffer_seq_srej; 333 __u8 buffer_seq_srej;
330 __u8 srej_save_reqseq; 334 __u8 srej_save_reqseq;
335 __u8 frames_sent;
331 __u8 unacked_frames; 336 __u8 unacked_frames;
332 __u8 retry_count; 337 __u8 retry_count;
333 __u8 num_to_ack; 338 __u8 num_acked;
334 __u16 sdu_len; 339 __u16 sdu_len;
335 __u16 partial_sdu_len; 340 __u16 partial_sdu_len;
336 struct sk_buff *sdu; 341 struct sk_buff *sdu;
337 342
338 __u8 ident; 343 __u8 ident;
339 344
345 __u8 tx_win;
346 __u8 max_tx;
340 __u8 remote_tx_win; 347 __u8 remote_tx_win;
341 __u8 remote_max_tx; 348 __u8 remote_max_tx;
342 __u16 retrans_timeout; 349 __u16 retrans_timeout;
343 __u16 monitor_timeout; 350 __u16 monitor_timeout;
344 __u16 max_pdu_size; 351 __u16 remote_mps;
352 __u16 mps;
345 353
346 __le16 sport; 354 __le16 sport;
347 355
356 spinlock_t send_lock;
348 struct timer_list retrans_timer; 357 struct timer_list retrans_timer;
349 struct timer_list monitor_timer; 358 struct timer_list monitor_timer;
359 struct timer_list ack_timer;
350 struct sk_buff_head tx_queue; 360 struct sk_buff_head tx_queue;
351 struct sk_buff_head srej_queue; 361 struct sk_buff_head srej_queue;
362 struct sk_buff_head busy_queue;
363 struct work_struct busy_work;
352 struct srej_list srej_l; 364 struct srej_list srej_l;
353 struct l2cap_conn *conn; 365 struct l2cap_conn *conn;
354 struct sock *next_c; 366 struct sock *next_c;
@@ -367,19 +379,24 @@ struct l2cap_pinfo {
367#define L2CAP_CONF_MAX_CONF_REQ 2 379#define L2CAP_CONF_MAX_CONF_REQ 2
368#define L2CAP_CONF_MAX_CONF_RSP 2 380#define L2CAP_CONF_MAX_CONF_RSP 2
369 381
370#define L2CAP_CONN_SAR_SDU 0x01 382#define L2CAP_CONN_SAR_SDU 0x0001
371#define L2CAP_CONN_SREJ_SENT 0x02 383#define L2CAP_CONN_SREJ_SENT 0x0002
372#define L2CAP_CONN_WAIT_F 0x04 384#define L2CAP_CONN_WAIT_F 0x0004
373#define L2CAP_CONN_SREJ_ACT 0x08 385#define L2CAP_CONN_SREJ_ACT 0x0008
374#define L2CAP_CONN_SEND_PBIT 0x10 386#define L2CAP_CONN_SEND_PBIT 0x0010
375#define L2CAP_CONN_REMOTE_BUSY 0x20 387#define L2CAP_CONN_REMOTE_BUSY 0x0020
376#define L2CAP_CONN_LOCAL_BUSY 0x40 388#define L2CAP_CONN_LOCAL_BUSY 0x0040
377#define L2CAP_CONN_REJ_ACT 0x80 389#define L2CAP_CONN_REJ_ACT 0x0080
390#define L2CAP_CONN_SEND_FBIT 0x0100
391#define L2CAP_CONN_RNR_SENT 0x0200
392#define L2CAP_CONN_SAR_RETRY 0x0400
378 393
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ 394#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); 395 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
381#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ 396#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
382 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); 397 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
398#define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \
399 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
383 400
384static inline int l2cap_tx_window_full(struct sock *sk) 401static inline int l2cap_tx_window_full(struct sock *sk)
385{ 402{
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
new file mode 100644
index 000000000000..318ab9478a44
--- /dev/null
+++ b/include/net/caif/caif_dev.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_DEV_H_
8#define CAIF_DEV_H_
9
10#include <net/caif/caif_layer.h>
11#include <net/caif/cfcnfg.h>
12#include <linux/caif/caif_socket.h>
13#include <linux/if.h>
14
15/**
16 * struct caif_param - CAIF parameters.
17 * @size: Length of data
18 * @data: Binary Data Blob
19 */
20struct caif_param {
21 u16 size;
22 u8 data[256];
23};
24
25/**
26 * struct caif_connect_request - Request data for CAIF channel setup.
27 * @protocol: Type of CAIF protocol to use (at, datagram etc)
28 * @sockaddr: Socket address to connect.
29 * @priority: Priority of the connection.
30 * @link_selector: Link selector (high bandwidth or low latency)
31 * @link_name: Name of the CAIF Link Layer to use.
32 * @param: Connect Request parameters (CAIF_SO_REQ_PARAM).
33 *
34 * This struct is used when connecting a CAIF channel.
35 * It contains all CAIF channel configuration options.
36 */
37struct caif_connect_request {
38 enum caif_protocol_type protocol;
39 struct sockaddr_caif sockaddr;
40 enum caif_channel_priority priority;
41 enum caif_link_selector link_selector;
42 char link_name[16];
43 struct caif_param param;
44};
45
46/**
47 * caif_connect_client - Connect a client to CAIF Core Stack.
48 * @config: Channel setup parameters, specifying what address
49 * to connect on the Modem.
50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions
52 * implemented.
53 *
54 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds
56 * receive functions and control callback functions. Control callback
57 * function will receive information about connect/disconnect responses,
58 * flow control etc (see enum caif_control).
59 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket.
61 */
62int caif_connect_client(struct caif_connect_request *config,
63 struct cflayer *client_layer);
64
65/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack.
67 *
68 * @client_layer: Client layer to be removed.
69 */
70int caif_disconnect_client(struct cflayer *client_layer);
71
72/**
73 * caif_release_client - Release adaptation layer reference to client.
74 *
75 * @client_layer: Client layer.
76 *
77 * Releases a client/adaptation layer use of the caif stack.
78 * This function must be used after caif_disconnect_client to
79 * decrease the reference count of the service layer.
80 */
81void caif_release_client(struct cflayer *client_layer);
82
83/**
84 * connect_req_to_link_param - Translate configuration parameters
85 * from socket format to internal format.
86 * @cnfg: Pointer to configuration handler
87 * @con_req: Configuration parameters supplied in function
88 * caif_connect_client
89 * @channel_setup_param: Parameters supplied to the CAIF Core stack for
90 * setting up channels.
91 *
92 */
93int connect_req_to_link_param(struct cfcnfg *cnfg,
94 struct caif_connect_request *con_req,
95 struct cfctrl_link_param *channel_setup_param);
96
97/**
98 * get_caif_conf() - Get the configuration handler.
99 */
100struct cfcnfg *get_caif_conf(void);
101
102
103#endif /* CAIF_DEV_H_ */
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h
new file mode 100644
index 000000000000..d02f044adb8a
--- /dev/null
+++ b/include/net/caif/caif_device.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_DEVICE_H_
8#define CAIF_DEVICE_H_
9#include <linux/kernel.h>
10#include <linux/net.h>
11#include <linux/netdevice.h>
12#include <linux/caif/caif_socket.h>
13#include <net/caif/caif_device.h>
14
15/**
16 * struct caif_dev_common - data shared between CAIF drivers and stack.
17 * @flowctrl: Flow Control callback function. This function is
18 * supplied by CAIF Core Stack and is used by CAIF
19 * Link Layer to send flow-stop to CAIF Core.
20 * The flow information will be distributed to all
21 * clients of CAIF.
22 *
23 * @link_select: Profile of device, either high-bandwidth or
24 * low-latency. This member is set by CAIF Link
25 * Layer Device in order to indicate if this device
26 * is a high bandwidth or low latency device.
27 *
28 * @use_frag: CAIF Frames may be fragmented.
29 * Is set by CAIF Link Layer in order to indicate if the
30 * interface receives fragmented frames that must be
31 * assembled by CAIF Core Layer.
32 *
33 * @use_fcs: Indicate if Frame CheckSum (fcs) is used.
34 * Is set if the physical interface is
35 * using Frame Checksum on the CAIF Frames.
36 *
37 * @use_stx: Indicate STart of frame eXtension (stx) in use.
38 * Is set if the CAIF Link Layer expects
39 * CAIF Frames to start with the STX byte.
40 *
41 * This structure is shared between the CAIF drivers and the CAIF stack.
42 * It is used by the device to register its behavior.
43 * CAIF Core layer must set the member flowctrl in order to supply
44 * CAIF Link Layer with the flow control function.
45 *
46 */
47 struct caif_dev_common {
48 void (*flowctrl)(struct net_device *net, int on);
49 enum caif_link_selector link_select;
50 int use_frag;
51 int use_fcs;
52 int use_stx;
53};
54
55#endif /* CAIF_DEVICE_H_ */
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
new file mode 100644
index 000000000000..25c472f0e5b8
--- /dev/null
+++ b/include/net/caif/caif_layer.h
@@ -0,0 +1,283 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_LAYER_H_
8#define CAIF_LAYER_H_
9
10#include <linux/list.h>
11
12struct cflayer;
13struct cfpkt;
14struct cfpktq;
15struct caif_payload_info;
16struct caif_packet_funcs;
17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22
23#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26
27/**
28 * caif_assert() - Assert function for CAIF.
29 * @assert: expression to evaluate.
30 *
31 * This function will print a error message and a do WARN_ON if the
32 * assertion failes. Normally this will do a stack up at the current location.
33 */
34#define caif_assert(assert) \
35do { \
36 if (!(assert)) { \
37 pr_err("caif:Assert detected:'%s'\n", #assert); \
38 WARN_ON(!(assert)); \
39 } \
40} while (0)
41
42
43/**
44 * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd().
45 *
46 * @CAIF_CTRLCMD_FLOW_OFF_IND: Flow Control is OFF, transmit function
47 * should stop sending data
48 *
49 * @CAIF_CTRLCMD_FLOW_ON_IND: Flow Control is ON, transmit function
50 * can start sending data
51 *
52 * @CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: Remote end modem has decided to close
53 * down channel
54 *
55 * @CAIF_CTRLCMD_INIT_RSP: Called initially when the layer below
56 * has finished initialization
57 *
58 * @CAIF_CTRLCMD_DEINIT_RSP: Called when de-initialization is
59 * complete
60 *
61 * @CAIF_CTRLCMD_INIT_FAIL_RSP: Called if initialization fails
62 *
63 * @_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: CAIF Link layer temporarily cannot
64 * send more packets.
65 * @_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND: Called if CAIF Link layer is able
66 * to send packets again.
67 * @_CAIF_CTRLCMD_PHYIF_DOWN_IND: Called if CAIF Link layer is going
68 * down.
69 *
70 * These commands are sent upwards in the CAIF stack to the CAIF Client.
71 * They are used for signaling originating from the modem or CAIF Link Layer.
72 * These are either responses (*_RSP) or events (*_IND).
73 */
74enum caif_ctrlcmd {
75 CAIF_CTRLCMD_FLOW_OFF_IND,
76 CAIF_CTRLCMD_FLOW_ON_IND,
77 CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND,
78 CAIF_CTRLCMD_INIT_RSP,
79 CAIF_CTRLCMD_DEINIT_RSP,
80 CAIF_CTRLCMD_INIT_FAIL_RSP,
81 _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND,
82 _CAIF_CTRLCMD_PHYIF_FLOW_ON_IND,
83 _CAIF_CTRLCMD_PHYIF_DOWN_IND,
84};
85
86/**
87 * enum caif_modemcmd - Modem Control Signaling, sent from CAIF Client
88 * to the CAIF Link Layer or modem.
89 *
90 * @CAIF_MODEMCMD_FLOW_ON_REQ: Flow Control is ON, transmit function
91 * can start sending data.
92 *
93 * @CAIF_MODEMCMD_FLOW_OFF_REQ: Flow Control is OFF, transmit function
94 * should stop sending data.
95 *
96 * @_CAIF_MODEMCMD_PHYIF_USEFULL: Notify physical layer that it is in use
97 *
98 * @_CAIF_MODEMCMD_PHYIF_USELESS: Notify physical layer that it is
99 * no longer in use.
100 *
101 * These are requests sent 'downwards' in the stack.
102 * Flow ON, OFF can be indicated to the modem.
103 */
104enum caif_modemcmd {
105 CAIF_MODEMCMD_FLOW_ON_REQ = 0,
106 CAIF_MODEMCMD_FLOW_OFF_REQ = 1,
107 _CAIF_MODEMCMD_PHYIF_USEFULL = 3,
108 _CAIF_MODEMCMD_PHYIF_USELESS = 4
109};
110
111/**
112 * enum caif_direction - CAIF Packet Direction.
113 * Indicate if a packet is to be sent out or to be received in.
114 * @CAIF_DIR_IN: Incoming packet received.
115 * @CAIF_DIR_OUT: Outgoing packet to be transmitted.
116 */
117enum caif_direction {
118 CAIF_DIR_IN = 0,
119 CAIF_DIR_OUT = 1
120};
121
122/**
123 * struct cflayer - CAIF Stack layer.
124 * Defines the framework for the CAIF Core Stack.
125 * @up: Pointer up to the layer above.
126 * @dn: Pointer down to the layer below.
127 * @node: List node used when layer participate in a list.
128 * @receive: Packet receive function.
129 * @transmit: Packet transmit funciton.
130 * @ctrlcmd: Used for control signalling upwards in the stack.
131 * @modemcmd: Used for control signaling downwards in the stack.
132 * @prio: Priority of this layer.
133 * @id: The identity of this layer
134 * @type: The type of this layer
135 * @name: Name of the layer.
136 *
137 * This structure defines the layered structure in CAIF.
138 *
139 * It defines CAIF layering structure, used by all CAIF Layers and the
140 * layers interfacing CAIF.
141 *
142 * In order to integrate with CAIF an adaptation layer on top of the CAIF stack
143 * and PHY layer below the CAIF stack
144 * must be implemented. These layer must follow the design principles below.
145 *
146 * Principles for layering of protocol layers:
147 * - All layers must use this structure. If embedding it, then place this
148 * structure first in the layer specific structure.
149 *
150 * - Each layer should not depend on any others layer private data.
151 *
152 * - In order to send data upwards do
153 * layer->up->receive(layer->up, packet);
154 *
155 * - In order to send data downwards do
156 * layer->dn->transmit(layer->dn, info, packet);
157 */
158struct cflayer {
159 struct cflayer *up;
160 struct cflayer *dn;
161 struct list_head node;
162
163 /*
164 * receive() - Receive Function.
165 * Contract: Each layer must implement a receive function passing the
166 * CAIF packets upwards in the stack.
167 * Packet handling rules:
168 * - The CAIF packet (cfpkt) cannot be accessed after
169 * passing it to the next layer using up->receive().
170 * - If parsing of the packet fails, the packet must be
171 * destroyed and -1 returned from the function.
172 * - If parsing succeeds (and above layers return OK) then
173 * the function must return a value > 0.
174 *
175 * Returns result < 0 indicates an error, 0 or positive value
176 * indicates success.
177 *
178 * @layr: Pointer to the current layer the receive function is
179 * implemented for (this pointer).
180 * @cfpkt: Pointer to CaifPacket to be handled.
181 */
182 int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt);
183
184 /*
185 * transmit() - Transmit Function.
186 * Contract: Each layer must implement a transmit function passing the
187 * CAIF packet downwards in the stack.
188 * Packet handling rules:
189 * - The CAIF packet (cfpkt) ownership is passed to the
190 * transmit function. This means that the the packet
191 * cannot be accessed after passing it to the below
192 * layer using dn->transmit().
193 *
194 * - If transmit fails, however, the ownership is returned
195 * to thecaller. The caller of "dn->transmit()" must
196 * destroy or resend packet.
197 *
198 * - Return value less than zero means error, zero or
199 * greater than zero means OK.
200 *
201 * result < 0 indicates an error, 0 or positive value
202 * indicate success.
203 *
204 * @layr: Pointer to the current layer the receive function
205 * isimplemented for (this pointer).
206 * @cfpkt: Pointer to CaifPacket to be handled.
207 */
208 int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt);
209
210 /*
211 * cttrlcmd() - Control Function upwards in CAIF Stack.
212 * Used for signaling responses (CAIF_CTRLCMD_*_RSP)
213 * and asynchronous events from the modem (CAIF_CTRLCMD_*_IND)
214 *
215 * @layr: Pointer to the current layer the receive function
216 * is implemented for (this pointer).
217 * @ctrl: Control Command.
218 */
219 void (*ctrlcmd) (struct cflayer *layr, enum caif_ctrlcmd ctrl,
220 int phyid);
221
222 /*
223 * modemctrl() - Control Function used for controlling the modem.
224 * Used to signal down-wards in the CAIF stack.
225 * Returns 0 on success, < 0 upon failure.
226 *
227 * @layr: Pointer to the current layer the receive function
228 * is implemented for (this pointer).
229 * @ctrl: Control Command.
230 */
231 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl);
232
233 unsigned short prio;
234 unsigned int id;
235 unsigned int type;
236 char name[CAIF_LAYER_NAME_SZ];
237};
238
239/**
240 * layer_set_up() - Set the up pointer for a specified layer.
241 * @layr: Layer where up pointer shall be set.
242 * @above: Layer above.
243 */
244#define layer_set_up(layr, above) ((layr)->up = (struct cflayer *)(above))
245
246/**
247 * layer_set_dn() - Set the down pointer for a specified layer.
248 * @layr: Layer where down pointer shall be set.
249 * @below: Layer below.
250 */
251#define layer_set_dn(layr, below) ((layr)->dn = (struct cflayer *)(below))
252
253/**
254 * struct dev_info - Physical Device info information about physical layer.
255 * @dev: Pointer to native physical device.
256 * @id: Physical ID of the physical connection used by the
257 * logical CAIF connection. Used by service layers to
258 * identify their physical id to Caif MUX (CFMUXL)so
259 * that the MUX can add the correct physical ID to the
260 * packet.
261 */
262struct dev_info {
263 void *dev;
264 unsigned int id;
265};
266
267/**
268 * struct caif_payload_info - Payload information embedded in packet (sk_buff).
269 *
270 * @dev_info: Information about the receiving device.
271 *
272 * @hdr_len: Header length, used to align pay load on 32bit boundary.
273 *
274 * @channel_id: Channel ID of the logical CAIF connection.
275 * Used by mux to insert channel id into the caif packet.
276 */
277struct caif_payload_info {
278 struct dev_info *dev_info;
279 unsigned short hdr_len;
280 unsigned short channel_id;
281};
282
283#endif /* CAIF_LAYER_H_ */
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
new file mode 100644
index 000000000000..9fc2fc20b884
--- /dev/null
+++ b/include/net/caif/cfcnfg.h
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCNFG_H_
8#define CFCNFG_H_
9#include <linux/spinlock.h>
10#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h>
12
13struct cfcnfg;
14
15/**
16 * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack
17 *
18 * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
19 * @CFPHYTYPE_CAIF: Generic CAIF physical interface
20 */
21enum cfcnfg_phy_type {
22 CFPHYTYPE_FRAG = 1,
23 CFPHYTYPE_CAIF,
24 CFPHYTYPE_MAX
25};
26
27/**
28 * enum cfcnfg_phy_preference - Physical preference HW Abstraction
29 *
30 * @CFPHYPREF_UNSPECIFIED: Default physical interface
31 *
32 * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
33 * traffic
34 * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
35 * traffic
36 * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
37 * responses.
38 *
39 */
40enum cfcnfg_phy_preference {
41 CFPHYPREF_UNSPECIFIED,
42 CFPHYPREF_LOW_LAT,
43 CFPHYPREF_HIGH_BW,
44 CFPHYPREF_LOOP
45};
46
47/**
48 * cfcnfg_create() - Create the CAIF configuration object.
49 */
50struct cfcnfg *cfcnfg_create(void);
51
52/**
53 * cfcnfg_remove() - Remove the CFCNFG object
54 * @cfg: config object
55 */
56void cfcnfg_remove(struct cfcnfg *cfg);
57
58/**
59 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
60 * @cnfg: Pointer to a CAIF configuration object, created by
61 * cfcnfg_create().
62 * @phy_type: Specifies the type of physical interface, e.g.
63 * CFPHYTYPE_FRAG.
64 * @dev: Pointer to link layer device
65 * @phy_layer: Specify the physical layer. The transmit function
66 * MUST be set in the structure.
67 * @phyid: The assigned physical ID for this layer, used in
68 * cfcnfg_add_adapt_layer to specify PHY for the link.
69 * @pref: The phy (link layer) preference.
70 * @fcs: Specify if checksum is used in CAIF Framing Layer.
71 * @stx: Specify if Start Of Frame eXtention is used.
72 */
73
74void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid,
77 enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx);
79
80/**
81 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
82 *
83 * @cnfg: Pointer to a CAIF configuration object, created by
84 * cfcnfg_create().
85 * @phy_layer: Adaptation layer to be removed.
86 */
87int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
88
89/**
90 * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer.
91 *
92 * @cnfg: Pointer to a CAIF configuration object, created by
93 * cfcnfg_create().
94 * @adap_layer: Adaptation layer to be removed.
95 */
96int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg,
97 struct cflayer *adap_layer);
98
99/**
100 * cfcnfg_release_adap_layer - Used by client to release the adaptation layer.
101 *
102 * @adap_layer: Adaptation layer.
103 */
104void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
105
106/**
107 * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
108 *
109 * The adaptation Layer is where the interface to application or higher-level
110 * driver functionality is implemented.
111 *
112 * @cnfg: Pointer to a CAIF configuration object, created by
113 * cfcnfg_create().
114 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure.
117 *
118 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer);
122
123/**
124 * cfcnfg_get_phyid() - Get physical ID, given type.
125 * Returns one of the physical interfaces matching the given type.
126 * Zero if no match is found.
127 * @cnfg: Configuration object
128 * @phy_pref: Caif Link Layer preference
129 */
130struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
131 enum cfcnfg_phy_preference phy_pref);
132
133/**
134 * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer
135 * @cnfg: Configuration object
136 * @name: Name of the Physical Layer (Caif Link Layer)
137 */
138int cfcnfg_get_named(struct cfcnfg *cnfg, char *name);
139
140#endif /* CFCNFG_H_ */
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
new file mode 100644
index 000000000000..9402543fc20d
--- /dev/null
+++ b/include/net/caif/cfctrl.h
@@ -0,0 +1,139 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCTRL_H_
8#define CFCTRL_H_
9#include <net/caif/caif_layer.h>
10#include <net/caif/cfsrvl.h>
11
12/* CAIF Control packet commands */
13enum cfctrl_cmd {
14 CFCTRL_CMD_LINK_SETUP = 0,
15 CFCTRL_CMD_LINK_DESTROY = 1,
16 CFCTRL_CMD_LINK_ERR = 2,
17 CFCTRL_CMD_ENUM = 3,
18 CFCTRL_CMD_SLEEP = 4,
19 CFCTRL_CMD_WAKE = 5,
20 CFCTRL_CMD_LINK_RECONF = 6,
21 CFCTRL_CMD_START_REASON = 7,
22 CFCTRL_CMD_RADIO_SET = 8,
23 CFCTRL_CMD_MODEM_SET = 9,
24 CFCTRL_CMD_MASK = 0xf
25};
26
27/* Channel types */
28enum cfctrl_srv {
29 CFCTRL_SRV_DECM = 0,
30 CFCTRL_SRV_VEI = 1,
31 CFCTRL_SRV_VIDEO = 2,
32 CFCTRL_SRV_DBG = 3,
33 CFCTRL_SRV_DATAGRAM = 4,
34 CFCTRL_SRV_RFM = 5,
35 CFCTRL_SRV_UTIL = 6,
36 CFCTRL_SRV_MASK = 0xf
37};
38
39#define CFCTRL_RSP_BIT 0x20
40#define CFCTRL_ERR_BIT 0x10
41
42struct cfctrl_rsp {
43 void (*linksetup_rsp)(struct cflayer *layer, u8 linkid,
44 enum cfctrl_srv serv, u8 phyid,
45 struct cflayer *adapt_layer);
46 void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid);
47 void (*linkerror_ind)(void);
48 void (*enum_rsp)(void);
49 void (*sleep_rsp)(void);
50 void (*wake_rsp)(void);
51 void (*restart_rsp)(void);
52 void (*radioset_rsp)(void);
53 void (*reject_rsp)(struct cflayer *layer, u8 linkid,
54 struct cflayer *client_layer);;
55};
56
57/* Link Setup Parameters for CAIF-Links. */
58struct cfctrl_link_param {
59 enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */
60 u8 priority; /* (P4,P0) Priority of the channel */
61 u8 phyid; /* (U2-U0) Physical interface to connect */
62 u8 endpoint; /* (E1,E0) Endpoint for data channels */
63 u8 chtype; /* (H1,H0) Channel-Type, applies to
64 * VEI, DEBUG */
65 union {
66 struct {
67 u8 connid; /* (D7,D0) Video LinkId */
68 } video;
69
70 struct {
71 u32 connid; /* (N31,Ngit0) Connection ID used
72 * for Datagram */
73 } datagram;
74
75 struct {
76 u32 connid; /* Connection ID used for RFM */
77 char volume[20]; /* Volume to mount for RFM */
78 } rfm; /* Configuration for RFM */
79
80 struct {
81 u16 fifosize_kb; /* Psock FIFO size in KB */
82 u16 fifosize_bufs; /* Psock # signal buffers */
83 char name[16]; /* Name of the PSOCK service */
84 u8 params[255]; /* Link setup Parameters> */
85 u16 paramlen; /* Length of Link Setup
86 * Parameters */
87 } utility; /* Configuration for Utility Links (Psock) */
88 } u;
89};
90
91/* This structure is used internally in CFCTRL */
92struct cfctrl_request_info {
93 int sequence_no;
94 enum cfctrl_cmd cmd;
95 u8 channel_id;
96 struct cfctrl_link_param param;
97 struct cflayer *client_layer;
98 struct list_head list;
99};
100
101struct cfctrl {
102 struct cfsrvl serv;
103 struct cfctrl_rsp res;
104 atomic_t req_seq_no;
105 atomic_t rsp_seq_no;
106 struct list_head list;
107 /* Protects from simultaneous access to first_req list */
108 spinlock_t info_list_lock;
109#ifndef CAIF_NO_LOOP
110 u8 loop_linkid;
111 int loop_linkused[256];
112 /* Protects simultaneous access to loop_linkid and loop_linkused */
113 spinlock_t loop_linkid_lock;
114#endif
115
116};
117
118void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid);
119int cfctrl_linkup_request(struct cflayer *cfctrl,
120 struct cfctrl_link_param *param,
121 struct cflayer *user_layer);
122int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid,
123 struct cflayer *client);
124void cfctrl_sleep_req(struct cflayer *cfctrl);
125void cfctrl_wake_req(struct cflayer *cfctrl);
126void cfctrl_getstartreason_req(struct cflayer *cfctrl);
127struct cflayer *cfctrl_create(void);
128void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn);
129void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up);
130struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer);
131bool cfctrl_req_eq(struct cfctrl_request_info *r1,
132 struct cfctrl_request_info *r2);
133void cfctrl_insert_req(struct cfctrl *ctrl,
134 struct cfctrl_request_info *req);
135struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,
136 struct cfctrl_request_info *req);
137void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer);
138
139#endif /* CFCTRL_H_ */
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h
new file mode 100644
index 000000000000..3f14d2e1ce61
--- /dev/null
+++ b/include/net/caif/cffrml.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFFRML_H_
8#define CFFRML_H_
9#include <net/caif/caif_layer.h>
10
11struct cffrml;
12struct cflayer *cffrml_create(u16 phyid, bool DoFCS);
13void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up);
14void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn);
15
16#endif /* CFFRML_H_ */
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h
new file mode 100644
index 000000000000..4e1b4f33423e
--- /dev/null
+++ b/include/net/caif/cfmuxl.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFMUXL_H_
8#define CFMUXL_H_
9#include <net/caif/caif_layer.h>
10
11struct cfsrvl;
12struct cffrml;
13
14struct cflayer *cfmuxl_create(void);
15int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid);
16struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid);
17int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid);
18struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid);
19bool cfmuxl_is_phy_inuse(struct cflayer *layr, u8 phyid);
20u8 cfmuxl_get_phyid(struct cflayer *layr, u8 channel_id);
21
22#endif /* CFMUXL_H_ */
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
new file mode 100644
index 000000000000..fbc681beff52
--- /dev/null
+++ b/include/net/caif/cfpkt.h
@@ -0,0 +1,274 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFPKT_H_
8#define CFPKT_H_
9#include <net/caif/caif_layer.h>
10#include <linux/types.h>
11struct cfpkt;
12
13/* Create a CAIF packet.
14 * len: Length of packet to be created
15 * @return New packet.
16 */
17struct cfpkt *cfpkt_create(u16 len);
18
19/* Create a CAIF packet.
20 * data Data to copy.
21 * len Length of packet to be created
22 * @return New packet.
23 */
24struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len);
25/*
26 * Destroy a CAIF Packet.
27 * pkt Packet to be destoyed.
28 */
29void cfpkt_destroy(struct cfpkt *pkt);
30
31/*
32 * Extract header from packet.
33 *
34 * pkt Packet to extract header data from.
35 * data Pointer to copy the header data into.
36 * len Length of head data to copy.
37 * @return zero on success and error code upon failure
38 */
39int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len);
40
41/*
42 * Peek header from packet.
43 * Reads data from packet without changing packet.
44 *
45 * pkt Packet to extract header data from.
46 * data Pointer to copy the header data into.
47 * len Length of head data to copy.
48 * @return zero on success and error code upon failure
49 */
50int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len);
51
52/*
53 * Extract header from trailer (end of packet).
54 *
55 * pkt Packet to extract header data from.
56 * data Pointer to copy the trailer data into.
57 * len Length of header data to copy.
58 * @return zero on success and error code upon failure
59 */
60int cfpkt_extr_trail(struct cfpkt *pkt, void *data, u16 len);
61
62/*
63 * Add header to packet.
64 *
65 *
66 * pkt Packet to add header data to.
67 * data Pointer to data to copy into the header.
68 * len Length of header data to copy.
69 * @return zero on success and error code upon failure
70 */
71int cfpkt_add_head(struct cfpkt *pkt, const void *data, u16 len);
72
73/*
74 * Add trailer to packet.
75 *
76 *
77 * pkt Packet to add trailer data to.
78 * data Pointer to data to copy into the trailer.
79 * len Length of trailer data to copy.
80 * @return zero on success and error code upon failure
81 */
82int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len);
83
84/*
85 * Pad trailer on packet.
86 * Moves data pointer in packet, no content copied.
87 *
88 * pkt Packet in which to pad trailer.
89 * len Length of padding to add.
90 * @return zero on success and error code upon failure
91 */
92int cfpkt_pad_trail(struct cfpkt *pkt, u16 len);
93
94/*
95 * Add a single byte to packet body (tail).
96 *
97 * pkt Packet in which to add byte.
98 * data Byte to add.
99 * @return zero on success and error code upon failure
100 */
101int cfpkt_addbdy(struct cfpkt *pkt, const u8 data);
102
103/*
104 * Add a data to packet body (tail).
105 *
106 * pkt Packet in which to add data.
107 * data Pointer to data to copy into the packet body.
108 * len Length of data to add.
109 * @return zero on success and error code upon failure
110 */
111int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len);
112
113/*
114 * Checks whether there are more data to process in packet.
115 * pkt Packet to check.
116 * @return true if more data are available in packet false otherwise
117 */
118bool cfpkt_more(struct cfpkt *pkt);
119
120/*
121 * Checks whether the packet is erroneous,
122 * i.e. if it has been attempted to extract more data than available in packet
123 * or writing more data than has been allocated in cfpkt_create().
124 * pkt Packet to check.
125 * @return true on error false otherwise
126 */
127bool cfpkt_erroneous(struct cfpkt *pkt);
128
129/*
130 * Get the packet length.
131 * pkt Packet to get length from.
132 * @return Number of bytes in packet.
133 */
134u16 cfpkt_getlen(struct cfpkt *pkt);
135
136/*
137 * Set the packet length, by adjusting the trailer pointer according to length.
138 * pkt Packet to set length.
139 * len Packet length.
140 * @return Number of bytes in packet.
141 */
142int cfpkt_setlen(struct cfpkt *pkt, u16 len);
143
144/*
145 * cfpkt_append - Appends a packet's data to another packet.
146 * dstpkt: Packet to append data into, WILL BE FREED BY THIS FUNCTION
147 * addpkt: Packet to be appended and automatically released,
148 * WILL BE FREED BY THIS FUNCTION.
149 * expectlen: Packet's expected total length. This should be considered
150 * as a hint.
151 * NB: Input packets will be destroyed after appending and cannot be used
152 * after calling this function.
153 * @return The new appended packet.
154 */
155struct cfpkt *cfpkt_append(struct cfpkt *dstpkt, struct cfpkt *addpkt,
156 u16 expectlen);
157
158/*
159 * cfpkt_split - Split a packet into two packets at the specified split point.
160 * pkt: Packet to be split (will contain the first part of the data on exit)
161 * pos: Position to split packet in two parts.
162 * @return The new packet, containing the second part of the data.
163 */
164struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos);
165
166/*
167 * Iteration function, iterates the packet buffers from start to end.
168 *
169 * Checksum iteration function used to iterate buffers
170 * (we may have packets consisting of a chain of buffers)
171 * pkt: Packet to calculate checksum for
172 * iter_func: Function pointer to iteration function
173 * chks: Checksum calculated so far.
174 * buf: Pointer to the buffer to checksum
175 * len: Length of buf.
176 * data: Initial checksum value.
177 * @return Checksum of buffer.
178 */
179
180u16 cfpkt_iterate(struct cfpkt *pkt,
181 u16 (*iter_func)(u16 chks, void *buf, u16 len),
182 u16 data);
183
184/* Append by giving user access to packet buffer
185 * cfpkt Packet to append to
186 * buf Buffer inside pkt that user shall copy data into
187 * buflen Length of buffer and number of bytes added to packet
188 * @return 0 on error, 1 on success
189 */
190int cfpkt_raw_append(struct cfpkt *cfpkt, void **buf, unsigned int buflen);
191
192/* Extract by giving user access to packet buffer
193 * cfpkt Packet to extract from
194 * buf Buffer inside pkt that user shall copy data from
195 * buflen Length of buffer and number of bytes removed from packet
196 * @return 0 on error, 1 on success
197 */
198int cfpkt_raw_extract(struct cfpkt *cfpkt, void **buf, unsigned int buflen);
199
200/* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet.
201 * dir - Direction indicating whether this packet is to be sent or received.
202 * nativepkt - The native packet to be transformed to a CAIF packet
203 * @return The mapped CAIF Packet CFPKT.
204 */
205struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt);
206
207/* Map from a CAIF packet to a "native" packet (e.g. Linux Socket Buffer).
208 * pkt - The CAIF packet to be transformed into a "native" packet.
209 * @return The native packet transformed from a CAIF packet.
210 */
211void *cfpkt_tonative(struct cfpkt *pkt);
212
213/*
214 * Insert a packet in the packet queue.
215 * pktq Packet queue to insert into
216 * pkt Packet to be inserted in queue
217 * prio Priority of packet
218 */
219void cfpkt_queue(struct cfpktq *pktq, struct cfpkt *pkt,
220 unsigned short prio);
221
222/*
223 * Remove a packet from the packet queue.
224 * pktq Packet queue to fetch packets from.
225 * @return Dequeued packet.
226 */
227struct cfpkt *cfpkt_dequeue(struct cfpktq *pktq);
228
229/*
230 * Peek into a packet from the packet queue.
231 * pktq Packet queue to fetch packets from.
232 * @return Peeked packet.
233 */
234struct cfpkt *cfpkt_qpeek(struct cfpktq *pktq);
235
236/*
237 * Initiates the packet queue.
238 * @return Pointer to new packet queue.
239 */
240struct cfpktq *cfpktq_create(void);
241
242/*
243 * Get the number of packets in the queue.
244 * pktq Packet queue to fetch count from.
245 * @return Number of packets in queue.
246 */
247int cfpkt_qcount(struct cfpktq *pktq);
248
249/*
250 * Put content of packet into buffer for debuging purposes.
251 * pkt Packet to copy data from
252 * buf Buffer to copy data into
253 * buflen Length of data to copy
254 * @return Pointer to copied data
255 */
256char *cfpkt_log_pkt(struct cfpkt *pkt, char *buf, int buflen);
257
258/*
259 * Clones a packet and releases the original packet.
260 * This is used for taking ownership of a packet e.g queueing.
261 * pkt Packet to clone and release.
262 * @return Cloned packet.
263 */
264struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt);
265
266
267/*
268 * Returns packet information for a packet.
269 * pkt Packet to get info from;
270 * @return Packet information
271 */
272struct caif_payload_info *cfpkt_info(struct cfpkt *pkt);
273/*! @} */
274#endif /* CFPKT_H_ */
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
new file mode 100644
index 000000000000..b8374321b362
--- /dev/null
+++ b/include/net/caif/cfserl.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSERL_H_
8#define CFSERL_H_
9#include <net/caif/caif_layer.h>
10
11struct cflayer *cfserl_create(int type, int instance, bool use_stx);
12#endif /* CFSERL_H_ */
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
new file mode 100644
index 000000000000..2dc9eb193ecf
--- /dev/null
+++ b/include/net/caif/cfsrvl.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSRVL_H_
8#define CFSRVL_H_
9#include <linux/list.h>
10#include <linux/stddef.h>
11#include <linux/types.h>
12#include <linux/kref.h>
13
14struct cfsrvl {
15 struct cflayer layer;
16 bool open;
17 bool phy_flow_on;
18 bool modem_flow_on;
19 struct dev_info dev_info;
20 struct kref ref;
21};
22
23void cfsrvl_release(struct kref *kref);
24struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info);
29struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
30bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
31void cfservl_destroy(struct cflayer *layer);
32void cfsrvl_init(struct cfsrvl *service,
33 u8 channel_id,
34 struct dev_info *dev_info);
35bool cfsrvl_ready(struct cfsrvl *service, int *err);
36u8 cfsrvl_getphyid(struct cflayer *layer);
37
38static inline void cfsrvl_get(struct cflayer *layr)
39{
40 struct cfsrvl *s;
41 if (layr == NULL)
42 return;
43 s = container_of(layr, struct cfsrvl, layer);
44 kref_get(&s->ref);
45}
46
47static inline void cfsrvl_put(struct cflayer *layr)
48{
49 struct cfsrvl *s;
50 if (layr == NULL)
51 return;
52 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release);
54}
55
56#endif /* CFSRVL_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0884b9a0f778..b44a2e5321a3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * 802.11 device and configuration interface 4 * 802.11 device and configuration interface
5 * 5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -39,8 +39,8 @@
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
40 */ 40 */
41enum ieee80211_band { 41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ, 42 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ, 43 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
44 44
45 /* keep last */ 45 /* keep last */
46 IEEE80211_NUM_BANDS 46 IEEE80211_NUM_BANDS
@@ -511,6 +511,7 @@ struct mpath_info {
511 * @basic_rates: basic rates in IEEE 802.11 format 511 * @basic_rates: basic rates in IEEE 802.11 format
512 * (or NULL for no change) 512 * (or NULL for no change)
513 * @basic_rates_len: number of basic rates 513 * @basic_rates_len: number of basic rates
514 * @ap_isolate: do not forward packets between connected stations
514 */ 515 */
515struct bss_parameters { 516struct bss_parameters {
516 int use_cts_prot; 517 int use_cts_prot;
@@ -518,6 +519,7 @@ struct bss_parameters {
518 int use_short_slot_time; 519 int use_short_slot_time;
519 u8 *basic_rates; 520 u8 *basic_rates;
520 u8 basic_rates_len; 521 u8 basic_rates_len;
522 int ap_isolate;
521}; 523};
522 524
523struct mesh_config { 525struct mesh_config {
@@ -626,8 +628,14 @@ enum cfg80211_signal_type {
626 * @beacon_interval: the beacon interval as from the frame 628 * @beacon_interval: the beacon interval as from the frame
627 * @capability: the capability field in host byte order 629 * @capability: the capability field in host byte order
628 * @information_elements: the information elements (Note that there 630 * @information_elements: the information elements (Note that there
629 * is no guarantee that these are well-formed!) 631 * is no guarantee that these are well-formed!); this is a pointer to
632 * either the beacon_ies or proberesp_ies depending on whether Probe
633 * Response frame has been received
630 * @len_information_elements: total length of the information elements 634 * @len_information_elements: total length of the information elements
635 * @beacon_ies: the information elements from the last Beacon frame
636 * @len_beacon_ies: total length of the beacon_ies
637 * @proberesp_ies: the information elements from the last Probe Response frame
638 * @len_proberesp_ies: total length of the proberesp_ies
631 * @signal: signal strength value (type depends on the wiphy's signal_type) 639 * @signal: signal strength value (type depends on the wiphy's signal_type)
632 * @free_priv: function pointer to free private data 640 * @free_priv: function pointer to free private data
633 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 641 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
@@ -641,6 +649,10 @@ struct cfg80211_bss {
641 u16 capability; 649 u16 capability;
642 u8 *information_elements; 650 u8 *information_elements;
643 size_t len_information_elements; 651 size_t len_information_elements;
652 u8 *beacon_ies;
653 size_t len_beacon_ies;
654 u8 *proberesp_ies;
655 size_t len_proberesp_ies;
644 656
645 s32 signal; 657 s32 signal;
646 658
@@ -694,6 +706,10 @@ struct cfg80211_crypto_settings {
694 * @key_len: length of WEP key for shared key authentication 706 * @key_len: length of WEP key for shared key authentication
695 * @key_idx: index of WEP key for shared key authentication 707 * @key_idx: index of WEP key for shared key authentication
696 * @key: WEP key for shared key authentication 708 * @key: WEP key for shared key authentication
709 * @local_state_change: This is a request for a local state only, i.e., no
710 * Authentication frame is to be transmitted and authentication state is
711 * to be changed without having to wait for a response from the peer STA
712 * (AP).
697 */ 713 */
698struct cfg80211_auth_request { 714struct cfg80211_auth_request {
699 struct cfg80211_bss *bss; 715 struct cfg80211_bss *bss;
@@ -702,6 +718,7 @@ struct cfg80211_auth_request {
702 enum nl80211_auth_type auth_type; 718 enum nl80211_auth_type auth_type;
703 const u8 *key; 719 const u8 *key;
704 u8 key_len, key_idx; 720 u8 key_len, key_idx;
721 bool local_state_change;
705}; 722};
706 723
707/** 724/**
@@ -734,12 +751,15 @@ struct cfg80211_assoc_request {
734 * @ie: Extra IEs to add to Deauthentication frame or %NULL 751 * @ie: Extra IEs to add to Deauthentication frame or %NULL
735 * @ie_len: Length of ie buffer in octets 752 * @ie_len: Length of ie buffer in octets
736 * @reason_code: The reason code for the deauthentication 753 * @reason_code: The reason code for the deauthentication
754 * @local_state_change: This is a request for a local state only, i.e., no
755 * Deauthentication frame is to be transmitted.
737 */ 756 */
738struct cfg80211_deauth_request { 757struct cfg80211_deauth_request {
739 struct cfg80211_bss *bss; 758 struct cfg80211_bss *bss;
740 const u8 *ie; 759 const u8 *ie;
741 size_t ie_len; 760 size_t ie_len;
742 u16 reason_code; 761 u16 reason_code;
762 bool local_state_change;
743}; 763};
744 764
745/** 765/**
@@ -752,12 +772,15 @@ struct cfg80211_deauth_request {
752 * @ie: Extra IEs to add to Disassociation frame or %NULL 772 * @ie: Extra IEs to add to Disassociation frame or %NULL
753 * @ie_len: Length of ie buffer in octets 773 * @ie_len: Length of ie buffer in octets
754 * @reason_code: The reason code for the disassociation 774 * @reason_code: The reason code for the disassociation
775 * @local_state_change: This is a request for a local state only, i.e., no
776 * Disassociation frame is to be transmitted.
755 */ 777 */
756struct cfg80211_disassoc_request { 778struct cfg80211_disassoc_request {
757 struct cfg80211_bss *bss; 779 struct cfg80211_bss *bss;
758 const u8 *ie; 780 const u8 *ie;
759 size_t ie_len; 781 size_t ie_len;
760 u16 reason_code; 782 u16 reason_code;
783 bool local_state_change;
761}; 784};
762 785
763/** 786/**
@@ -837,6 +860,7 @@ enum wiphy_params_flags {
837 WIPHY_PARAM_RETRY_LONG = 1 << 1, 860 WIPHY_PARAM_RETRY_LONG = 1 << 1,
838 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 861 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
839 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 862 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
863 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
840}; 864};
841 865
842/** 866/**
@@ -856,20 +880,11 @@ enum tx_power_setting {
856 * cfg80211_bitrate_mask - masks for bitrate control 880 * cfg80211_bitrate_mask - masks for bitrate control
857 */ 881 */
858struct cfg80211_bitrate_mask { 882struct cfg80211_bitrate_mask {
859/*
860 * As discussed in Berlin, this struct really
861 * should look like this:
862
863 struct { 883 struct {
864 u32 legacy; 884 u32 legacy;
865 u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 885 /* TODO: add support for masking MCS rates; e.g.: */
886 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
866 } control[IEEE80211_NUM_BANDS]; 887 } control[IEEE80211_NUM_BANDS];
867
868 * Since we can always fix in-kernel users, let's keep
869 * it simpler for now:
870 */
871 u32 fixed; /* fixed bitrate, 0 == not fixed */
872 u32 maxrate; /* in kbps, 0 == no limit */
873}; 888};
874/** 889/**
875 * struct cfg80211_pmksa - PMK Security Association 890 * struct cfg80211_pmksa - PMK Security Association
@@ -951,7 +966,11 @@ struct cfg80211_pmksa {
951 * 966 *
952 * @set_txq_params: Set TX queue parameters 967 * @set_txq_params: Set TX queue parameters
953 * 968 *
954 * @set_channel: Set channel 969 * @set_channel: Set channel for a given wireless interface. Some devices
970 * may support multi-channel operation (by channel hopping) so cfg80211
971 * doesn't verify much. Note, however, that the passed netdev may be
972 * %NULL as well if the user requested changing the channel for the
973 * device itself, or for a monitor interface.
955 * 974 *
956 * @scan: Request to do a scan. If returning zero, the scan request is given 975 * @scan: Request to do a scan. If returning zero, the scan request is given
957 * the driver, and will be valid until passed to cfg80211_scan_done(). 976 * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -988,6 +1007,16 @@ struct cfg80211_pmksa {
988 * 1007 *
989 * @dump_survey: get site survey information. 1008 * @dump_survey: get site survey information.
990 * 1009 *
1010 * @remain_on_channel: Request the driver to remain awake on the specified
1011 * channel for the specified duration to complete an off-channel
1012 * operation (e.g., public action frame exchange). When the driver is
1013 * ready on the requested channel, it must indicate this with an event
1014 * notification by calling cfg80211_ready_on_channel().
1015 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
1016 * This allows the operation to be terminated prior to timeout based on
1017 * the duration value.
1018 * @action: Transmit an action frame
1019 *
991 * @testmode_cmd: run a test mode command 1020 * @testmode_cmd: run a test mode command
992 * 1021 *
993 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 1022 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
@@ -995,6 +1024,9 @@ struct cfg80211_pmksa {
995 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 1024 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
996 * @del_pmksa: Delete a cached PMKID. 1025 * @del_pmksa: Delete a cached PMKID.
997 * @flush_pmksa: Flush all cached PMKIDs. 1026 * @flush_pmksa: Flush all cached PMKIDs.
1027 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
1028 * allows the driver to adjust the dynamic ps timeout value.
1029 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
998 * 1030 *
999 */ 1031 */
1000struct cfg80211_ops { 1032struct cfg80211_ops {
@@ -1067,7 +1099,7 @@ struct cfg80211_ops {
1067 int (*set_txq_params)(struct wiphy *wiphy, 1099 int (*set_txq_params)(struct wiphy *wiphy,
1068 struct ieee80211_txq_params *params); 1100 struct ieee80211_txq_params *params);
1069 1101
1070 int (*set_channel)(struct wiphy *wiphy, 1102 int (*set_channel)(struct wiphy *wiphy, struct net_device *dev,
1071 struct ieee80211_channel *chan, 1103 struct ieee80211_channel *chan,
1072 enum nl80211_channel_type channel_type); 1104 enum nl80211_channel_type channel_type);
1073 1105
@@ -1123,9 +1155,27 @@ struct cfg80211_ops {
1123 struct cfg80211_pmksa *pmksa); 1155 struct cfg80211_pmksa *pmksa);
1124 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 1156 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
1125 1157
1126 /* some temporary stuff to finish wext */ 1158 int (*remain_on_channel)(struct wiphy *wiphy,
1159 struct net_device *dev,
1160 struct ieee80211_channel *chan,
1161 enum nl80211_channel_type channel_type,
1162 unsigned int duration,
1163 u64 *cookie);
1164 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
1165 struct net_device *dev,
1166 u64 cookie);
1167
1168 int (*action)(struct wiphy *wiphy, struct net_device *dev,
1169 struct ieee80211_channel *chan,
1170 enum nl80211_channel_type channel_type,
1171 const u8 *buf, size_t len, u64 *cookie);
1172
1127 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1173 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1128 bool enabled, int timeout); 1174 bool enabled, int timeout);
1175
1176 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
1177 struct net_device *dev,
1178 s32 rssi_thold, u32 rssi_hyst);
1129}; 1179};
1130 1180
1131/* 1181/*
@@ -1174,6 +1224,10 @@ enum wiphy_flags {
1174 WIPHY_FLAG_4ADDR_STATION = BIT(6), 1224 WIPHY_FLAG_4ADDR_STATION = BIT(6),
1175}; 1225};
1176 1226
1227struct mac_address {
1228 u8 addr[ETH_ALEN];
1229};
1230
1177/** 1231/**
1178 * struct wiphy - wireless hardware description 1232 * struct wiphy - wireless hardware description
1179 * @idx: the wiphy index assigned to this item 1233 * @idx: the wiphy index assigned to this item
@@ -1192,12 +1246,28 @@ enum wiphy_flags {
1192 * -1 = fragmentation disabled, only odd values >= 256 used 1246 * -1 = fragmentation disabled, only odd values >= 256 used
1193 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1247 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1194 * @net: the network namespace this wiphy currently lives in 1248 * @net: the network namespace this wiphy currently lives in
1249 * @perm_addr: permanent MAC address of this device
1250 * @addr_mask: If the device supports multiple MAC addresses by masking,
1251 * set this to a mask with variable bits set to 1, e.g. if the last
1252 * four bits are variable then set it to 00:...:00:0f. The actual
1253 * variable bits shall be determined by the interfaces added, with
1254 * interfaces not matching the mask being rejected to be brought up.
1255 * @n_addresses: number of addresses in @addresses.
1256 * @addresses: If the device has more than one address, set this pointer
1257 * to a list of addresses (6 bytes each). The first one will be used
1258 * by default for perm_addr. In this case, the mask should be set to
1259 * all-zeroes. In this case it is assumed that the device can handle
1260 * the same number of arbitrary MAC addresses.
1195 */ 1261 */
1196struct wiphy { 1262struct wiphy {
1197 /* assign these fields before you register the wiphy */ 1263 /* assign these fields before you register the wiphy */
1198 1264
1199 /* permanent MAC address */ 1265 /* permanent MAC address(es) */
1200 u8 perm_addr[ETH_ALEN]; 1266 u8 perm_addr[ETH_ALEN];
1267 u8 addr_mask[ETH_ALEN];
1268
1269 u16 n_addresses;
1270 struct mac_address *addresses;
1201 1271
1202 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1272 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1203 u16 interface_modes; 1273 u16 interface_modes;
@@ -1217,6 +1287,7 @@ struct wiphy {
1217 u8 retry_long; 1287 u8 retry_long;
1218 u32 frag_threshold; 1288 u32 frag_threshold;
1219 u32 rts_threshold; 1289 u32 rts_threshold;
1290 u8 coverage_class;
1220 1291
1221 char fw_version[ETHTOOL_BUSINFO_LEN]; 1292 char fw_version[ETHTOOL_BUSINFO_LEN];
1222 u32 hw_version; 1293 u32 hw_version;
@@ -1394,6 +1465,8 @@ struct cfg80211_cached_keys;
1394 * @list: (private) Used to collect the interfaces 1465 * @list: (private) Used to collect the interfaces
1395 * @netdev: (private) Used to reference back to the netdev 1466 * @netdev: (private) Used to reference back to the netdev
1396 * @current_bss: (private) Used by the internal configuration code 1467 * @current_bss: (private) Used by the internal configuration code
1468 * @channel: (private) Used by the internal configuration code to track
1469 * user-set AP, monitor and WDS channels for wireless extensions
1397 * @bssid: (private) Used by the internal configuration code 1470 * @bssid: (private) Used by the internal configuration code
1398 * @ssid: (private) Used by the internal configuration code 1471 * @ssid: (private) Used by the internal configuration code
1399 * @ssid_len: (private) Used by the internal configuration code 1472 * @ssid_len: (private) Used by the internal configuration code
@@ -1403,6 +1476,8 @@ struct cfg80211_cached_keys;
1403 * set by driver (if supported) on add_interface BEFORE registering the 1476 * set by driver (if supported) on add_interface BEFORE registering the
1404 * netdev and may otherwise be used by driver read-only, will be update 1477 * netdev and may otherwise be used by driver read-only, will be update
1405 * by cfg80211 on change_interface 1478 * by cfg80211 on change_interface
1479 * @action_registrations: list of registrations for action frames
1480 * @action_registrations_lock: lock for the list
1406 */ 1481 */
1407struct wireless_dev { 1482struct wireless_dev {
1408 struct wiphy *wiphy; 1483 struct wiphy *wiphy;
@@ -1412,6 +1487,9 @@ struct wireless_dev {
1412 struct list_head list; 1487 struct list_head list;
1413 struct net_device *netdev; 1488 struct net_device *netdev;
1414 1489
1490 struct list_head action_registrations;
1491 spinlock_t action_registrations_lock;
1492
1415 struct mutex mtx; 1493 struct mutex mtx;
1416 1494
1417 struct work_struct cleanup_work; 1495 struct work_struct cleanup_work;
@@ -1435,6 +1513,10 @@ struct wireless_dev {
1435 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 1513 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
1436 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1514 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1437 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1515 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1516 struct ieee80211_channel *channel;
1517
1518 bool ps;
1519 int ps_timeout;
1438 1520
1439#ifdef CONFIG_CFG80211_WEXT 1521#ifdef CONFIG_CFG80211_WEXT
1440 /* wext data */ 1522 /* wext data */
@@ -1447,8 +1529,7 @@ struct wireless_dev {
1447 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1529 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
1448 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1530 u8 ssid[IEEE80211_MAX_SSID_LEN];
1449 s8 default_key, default_mgmt_key; 1531 s8 default_key, default_mgmt_key;
1450 bool ps, prev_bssid_valid; 1532 bool prev_bssid_valid;
1451 int ps_timeout;
1452 } wext; 1533 } wext;
1453#endif 1534#endif
1454}; 1535};
@@ -1519,37 +1600,82 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1519 * Documentation in Documentation/networking/radiotap-headers.txt 1600 * Documentation in Documentation/networking/radiotap-headers.txt
1520 */ 1601 */
1521 1602
1603struct radiotap_align_size {
1604 uint8_t align:4, size:4;
1605};
1606
1607struct ieee80211_radiotap_namespace {
1608 const struct radiotap_align_size *align_size;
1609 int n_bits;
1610 uint32_t oui;
1611 uint8_t subns;
1612};
1613
1614struct ieee80211_radiotap_vendor_namespaces {
1615 const struct ieee80211_radiotap_namespace *ns;
1616 int n_ns;
1617};
1618
1522/** 1619/**
1523 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 1620 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1524 * @rtheader: pointer to the radiotap header we are walking through 1621 * @this_arg_index: index of current arg, valid after each successful call
1525 * @max_length: length of radiotap header in cpu byte ordering 1622 * to ieee80211_radiotap_iterator_next()
1526 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 1623 * @this_arg: pointer to current radiotap arg; it is valid after each
1527 * @this_arg: pointer to current radiotap arg 1624 * call to ieee80211_radiotap_iterator_next() but also after
1528 * @arg_index: internal next argument index 1625 * ieee80211_radiotap_iterator_init() where it will point to
1529 * @arg: internal next argument pointer 1626 * the beginning of the actual data portion
1530 * @next_bitmap: internal pointer to next present u32 1627 * @this_arg_size: length of the current arg, for convenience
1531 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 1628 * @current_namespace: pointer to the current namespace definition
1629 * (or internally %NULL if the current namespace is unknown)
1630 * @is_radiotap_ns: indicates whether the current namespace is the default
1631 * radiotap namespace or not
1632 *
1633 * @overrides: override standard radiotap fields
1634 * @n_overrides: number of overrides
1635 *
1636 * @_rtheader: pointer to the radiotap header we are walking through
1637 * @_max_length: length of radiotap header in cpu byte ordering
1638 * @_arg_index: next argument index
1639 * @_arg: next argument pointer
1640 * @_next_bitmap: internal pointer to next present u32
1641 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1642 * @_vns: vendor namespace definitions
1643 * @_next_ns_data: beginning of the next namespace's data
1644 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
1645 * next bitmap word
1646 *
1647 * Describes the radiotap parser state. Fields prefixed with an underscore
1648 * must not be used by users of the parser, only by the parser internally.
1532 */ 1649 */
1533 1650
1534struct ieee80211_radiotap_iterator { 1651struct ieee80211_radiotap_iterator {
1535 struct ieee80211_radiotap_header *rtheader; 1652 struct ieee80211_radiotap_header *_rtheader;
1536 int max_length; 1653 const struct ieee80211_radiotap_vendor_namespaces *_vns;
1654 const struct ieee80211_radiotap_namespace *current_namespace;
1655
1656 unsigned char *_arg, *_next_ns_data;
1657 __le32 *_next_bitmap;
1658
1659 unsigned char *this_arg;
1537 int this_arg_index; 1660 int this_arg_index;
1538 u8 *this_arg; 1661 int this_arg_size;
1662
1663 int is_radiotap_ns;
1539 1664
1540 int arg_index; 1665 int _max_length;
1541 u8 *arg; 1666 int _arg_index;
1542 __le32 *next_bitmap; 1667 uint32_t _bitmap_shifter;
1543 u32 bitmap_shifter; 1668 int _reset_on_ext;
1544}; 1669};
1545 1670
1546extern int ieee80211_radiotap_iterator_init( 1671extern int ieee80211_radiotap_iterator_init(
1547 struct ieee80211_radiotap_iterator *iterator, 1672 struct ieee80211_radiotap_iterator *iterator,
1548 struct ieee80211_radiotap_header *radiotap_header, 1673 struct ieee80211_radiotap_header *radiotap_header,
1549 int max_length); 1674 int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
1550 1675
1551extern int ieee80211_radiotap_iterator_next( 1676extern int ieee80211_radiotap_iterator_next(
1552 struct ieee80211_radiotap_iterator *iterator); 1677 struct ieee80211_radiotap_iterator *iterator);
1678
1553 1679
1554extern const unsigned char rfc1042_header[6]; 1680extern const unsigned char rfc1042_header[6];
1555extern const unsigned char bridge_tunnel_header[6]; 1681extern const unsigned char bridge_tunnel_header[6];
@@ -1578,7 +1704,7 @@ unsigned int ieee80211_hdrlen(__le16 fc);
1578 * @addr: the device MAC address 1704 * @addr: the device MAC address
1579 * @iftype: the virtual interface type 1705 * @iftype: the virtual interface type
1580 */ 1706 */
1581int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, 1707int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
1582 enum nl80211_iftype iftype); 1708 enum nl80211_iftype iftype);
1583 1709
1584/** 1710/**
@@ -1589,15 +1715,49 @@ int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
1589 * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1715 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
1590 * @qos: build 802.11 QoS data frame 1716 * @qos: build 802.11 QoS data frame
1591 */ 1717 */
1592int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, 1718int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
1593 enum nl80211_iftype iftype, u8 *bssid, bool qos); 1719 enum nl80211_iftype iftype, u8 *bssid, bool qos);
1594 1720
1595/** 1721/**
1722 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
1723 *
1724 * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
1725 * 802.3 frames. The @list will be empty if the decode fails. The
1726 * @skb is consumed after the function returns.
1727 *
1728 * @skb: The input IEEE 802.11n A-MSDU frame.
1729 * @list: The output list of 802.3 frames. It must be allocated and
1730 * initialized by by the caller.
1731 * @addr: The device MAC address.
1732 * @iftype: The device interface type.
1733 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
1734 */
1735void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
1736 const u8 *addr, enum nl80211_iftype iftype,
1737 const unsigned int extra_headroom);
1738
1739/**
1596 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1740 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
1597 * @skb: the data frame 1741 * @skb: the data frame
1598 */ 1742 */
1599unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1743unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1600 1744
1745/**
1746 * cfg80211_find_ie - find information element in data
1747 *
1748 * @eid: element ID
1749 * @ies: data consisting of IEs
1750 * @len: length of data
1751 *
1752 * This function will return %NULL if the element ID could
1753 * not be found or if the element is invalid (claims to be
1754 * longer than the given data), or a pointer to the first byte
1755 * of the requested element, that is the byte containing the
1756 * element ID. There are no checks on the element length
1757 * other than having to fit into the given data.
1758 */
1759const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
1760
1601/* 1761/*
1602 * Regulatory helper functions for wiphys 1762 * Regulatory helper functions for wiphys
1603 */ 1763 */
@@ -2129,5 +2289,93 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
2129void cfg80211_disconnected(struct net_device *dev, u16 reason, 2289void cfg80211_disconnected(struct net_device *dev, u16 reason,
2130 u8 *ie, size_t ie_len, gfp_t gfp); 2290 u8 *ie, size_t ie_len, gfp_t gfp);
2131 2291
2292/**
2293 * cfg80211_ready_on_channel - notification of remain_on_channel start
2294 * @dev: network device
2295 * @cookie: the request cookie
2296 * @chan: The current channel (from remain_on_channel request)
2297 * @channel_type: Channel type
2298 * @duration: Duration in milliseconds that the driver intents to remain on the
2299 * channel
2300 * @gfp: allocation flags
2301 */
2302void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie,
2303 struct ieee80211_channel *chan,
2304 enum nl80211_channel_type channel_type,
2305 unsigned int duration, gfp_t gfp);
2306
2307/**
2308 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
2309 * @dev: network device
2310 * @cookie: the request cookie
2311 * @chan: The current channel (from remain_on_channel request)
2312 * @channel_type: Channel type
2313 * @gfp: allocation flags
2314 */
2315void cfg80211_remain_on_channel_expired(struct net_device *dev,
2316 u64 cookie,
2317 struct ieee80211_channel *chan,
2318 enum nl80211_channel_type channel_type,
2319 gfp_t gfp);
2320
2321
2322/**
2323 * cfg80211_new_sta - notify userspace about station
2324 *
2325 * @dev: the netdev
2326 * @mac_addr: the station's address
2327 * @sinfo: the station information
2328 * @gfp: allocation flags
2329 */
2330void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
2331 struct station_info *sinfo, gfp_t gfp);
2332
2333/**
2334 * cfg80211_rx_action - notification of received, unprocessed Action frame
2335 * @dev: network device
2336 * @freq: Frequency on which the frame was received in MHz
2337 * @buf: Action frame (header + body)
2338 * @len: length of the frame data
2339 * @gfp: context flags
2340 * Returns %true if a user space application is responsible for rejecting the
2341 * unrecognized Action frame; %false if no such application is registered
2342 * (i.e., the driver is responsible for rejecting the unrecognized Action
2343 * frame)
2344 *
2345 * This function is called whenever an Action frame is received for a station
2346 * mode interface, but is not processed in kernel.
2347 */
2348bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf,
2349 size_t len, gfp_t gfp);
2350
2351/**
2352 * cfg80211_action_tx_status - notification of TX status for Action frame
2353 * @dev: network device
2354 * @cookie: Cookie returned by cfg80211_ops::action()
2355 * @buf: Action frame (header + body)
2356 * @len: length of the frame data
2357 * @ack: Whether frame was acknowledged
2358 * @gfp: context flags
2359 *
2360 * This function is called whenever an Action frame was requested to be
2361 * transmitted with cfg80211_ops::action() to report the TX status of the
2362 * transmission attempt.
2363 */
2364void cfg80211_action_tx_status(struct net_device *dev, u64 cookie,
2365 const u8 *buf, size_t len, bool ack, gfp_t gfp);
2366
2367
2368/**
2369 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
2370 * @dev: network device
2371 * @rssi_event: the triggered RSSI event
2372 * @gfp: context flags
2373 *
2374 * This function is called when a configured connection quality monitoring
2375 * rssi threshold reached event occurs.
2376 */
2377void cfg80211_cqm_rssi_notify(struct net_device *dev,
2378 enum nl80211_cqm_rssi_threshold_event rssi_event,
2379 gfp_t gfp);
2132 2380
2133#endif /* __NET_CFG80211_H */ 2381#endif /* __NET_CFG80211_H */
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
new file mode 100644
index 000000000000..726cc3536409
--- /dev/null
+++ b/include/net/cls_cgroup.h
@@ -0,0 +1,63 @@
1/*
2 * cls_cgroup.h Control Group Classifier
3 *
4 * Authors: Thomas Graf <tgraf@suug.ch>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _NET_CLS_CGROUP_H
14#define _NET_CLS_CGROUP_H
15
16#include <linux/cgroup.h>
17#include <linux/hardirq.h>
18#include <linux/rcupdate.h>
19
20#ifdef CONFIG_CGROUPS
21struct cgroup_cls_state
22{
23 struct cgroup_subsys_state css;
24 u32 classid;
25};
26
27#ifdef CONFIG_NET_CLS_CGROUP
28static inline u32 task_cls_classid(struct task_struct *p)
29{
30 if (in_interrupt())
31 return 0;
32
33 return container_of(task_subsys_state(p, net_cls_subsys_id),
34 struct cgroup_cls_state, css)->classid;
35}
36#else
37extern int net_cls_subsys_id;
38
39static inline u32 task_cls_classid(struct task_struct *p)
40{
41 int id;
42 u32 classid = 0;
43
44 if (in_interrupt())
45 return 0;
46
47 rcu_read_lock();
48 id = rcu_dereference(net_cls_subsys_id);
49 if (id >= 0)
50 classid = container_of(task_subsys_state(p, id),
51 struct cgroup_cls_state, css)->classid;
52 rcu_read_unlock();
53
54 return classid;
55}
56#endif
57#else
58static inline u32 task_cls_classid(struct task_struct *p)
59{
60 return 0;
61}
62#endif
63#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 52da6c3dd50d..bbcde3238e58 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -50,10 +50,6 @@ struct dn_fib_info {
50 __le16 fib_prefsrc; 50 __le16 fib_prefsrc;
51 __u32 fib_priority; 51 __u32 fib_priority;
52 __u32 fib_metrics[RTAX_MAX]; 52 __u32 fib_metrics[RTAX_MAX];
53#define dn_fib_mtu fib_metrics[RTAX_MTU-1]
54#define dn_fib_window fib_metrics[RTAX_WINDOW-1]
55#define dn_fib_rtt fib_metrics[RTAX_RTT-1]
56#define dn_fib_advmss fib_metrics[RTAX_ADVMSS-1]
57 int fib_nhs; 53 int fib_nhs;
58 int fib_power; 54 int fib_power;
59 struct dn_fib_nh fib_nh[0]; 55 struct dn_fib_nh fib_nh[0];
diff --git a/include/net/dst.h b/include/net/dst.h
index 39c4a5963e12..81d1413a8701 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -83,8 +83,6 @@ struct dst_entry {
83 * (L1_CACHE_SIZE would be too much) 83 * (L1_CACHE_SIZE would be too much)
84 */ 84 */
85#ifdef CONFIG_64BIT 85#ifdef CONFIG_64BIT
86 long __pad_to_align_refcnt[2];
87#else
88 long __pad_to_align_refcnt[1]; 86 long __pad_to_align_refcnt[1];
89#endif 87#endif
90 /* 88 /*
@@ -170,6 +168,12 @@ static inline void dst_use(struct dst_entry *dst, unsigned long time)
170 dst->lastuse = time; 168 dst->lastuse = time;
171} 169}
172 170
171static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
172{
173 dst->__use++;
174 dst->lastuse = time;
175}
176
173static inline 177static inline
174struct dst_entry * dst_clone(struct dst_entry * dst) 178struct dst_entry * dst_clone(struct dst_entry * dst)
175{ 179{
@@ -179,22 +183,78 @@ struct dst_entry * dst_clone(struct dst_entry * dst)
179} 183}
180 184
181extern void dst_release(struct dst_entry *dst); 185extern void dst_release(struct dst_entry *dst);
186
187static inline void refdst_drop(unsigned long refdst)
188{
189 if (!(refdst & SKB_DST_NOREF))
190 dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
191}
192
193/**
194 * skb_dst_drop - drops skb dst
195 * @skb: buffer
196 *
197 * Drops dst reference count if a reference was taken.
198 */
182static inline void skb_dst_drop(struct sk_buff *skb) 199static inline void skb_dst_drop(struct sk_buff *skb)
183{ 200{
184 if (skb->_skb_dst) 201 if (skb->_skb_refdst) {
185 dst_release(skb_dst(skb)); 202 refdst_drop(skb->_skb_refdst);
186 skb->_skb_dst = 0UL; 203 skb->_skb_refdst = 0UL;
204 }
205}
206
207static inline void skb_dst_copy(struct sk_buff *nskb, const struct sk_buff *oskb)
208{
209 nskb->_skb_refdst = oskb->_skb_refdst;
210 if (!(nskb->_skb_refdst & SKB_DST_NOREF))
211 dst_clone(skb_dst(nskb));
212}
213
214/**
215 * skb_dst_force - makes sure skb dst is refcounted
216 * @skb: buffer
217 *
218 * If dst is not yet refcounted, let's do it
219 */
220static inline void skb_dst_force(struct sk_buff *skb)
221{
222 if (skb_dst_is_noref(skb)) {
223 WARN_ON(!rcu_read_lock_held());
224 skb->_skb_refdst &= ~SKB_DST_NOREF;
225 dst_clone(skb_dst(skb));
226 }
227}
228
229
230/**
231 * skb_tunnel_rx - prepare skb for rx reinsert
232 * @skb: buffer
233 * @dev: tunnel device
234 *
235 * After decapsulation, packet is going to re-enter (netif_rx()) our stack,
236 * so make some cleanups, and perform accounting.
237 */
238static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
239{
240 skb->dev = dev;
241 /* TODO : stats should be SMP safe */
242 dev->stats.rx_packets++;
243 dev->stats.rx_bytes += skb->len;
244 skb->rxhash = 0;
245 skb_dst_drop(skb);
246 nf_reset(skb);
187} 247}
188 248
189/* Children define the path of the packet through the 249/* Children define the path of the packet through the
190 * Linux networking. Thus, destinations are stackable. 250 * Linux networking. Thus, destinations are stackable.
191 */ 251 */
192 252
193static inline struct dst_entry *dst_pop(struct dst_entry *dst) 253static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
194{ 254{
195 struct dst_entry *child = dst_clone(dst->child); 255 struct dst_entry *child = skb_dst(skb)->child;
196 256
197 dst_release(dst); 257 skb_dst_drop(skb);
198 return child; 258 return child;
199} 259}
200 260
@@ -227,21 +287,6 @@ static inline void dst_confirm(struct dst_entry *dst)
227 neigh_confirm(dst->neighbour); 287 neigh_confirm(dst->neighbour);
228} 288}
229 289
230static inline void dst_negative_advice(struct dst_entry **dst_p,
231 struct sock *sk)
232{
233 struct dst_entry * dst = *dst_p;
234 if (dst && dst->ops->negative_advice) {
235 *dst_p = dst->ops->negative_advice(dst);
236
237 if (dst != *dst_p) {
238 extern void sk_reset_txq(struct sock *sk);
239
240 sk_reset_txq(sk);
241 }
242 }
243}
244
245static inline void dst_link_failure(struct sk_buff *skb) 290static inline void dst_link_failure(struct sk_buff *skb)
246{ 291{
247 struct dst_entry *dst = skb_dst(skb); 292 struct dst_entry *dst = skb_dst(skb);
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c07ac9650ebc..e8923bc20f9f 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -2,6 +2,7 @@
2#define __NET_FIB_RULES_H 2#define __NET_FIB_RULES_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/slab.h>
5#include <linux/netdevice.h> 6#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 7#include <linux/fib_rules.h>
7#include <net/flow.h> 8#include <net/flow.h>
@@ -103,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
103 return frh->table; 104 return frh->table;
104} 105}
105 106
106extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *); 107extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *);
107extern void fib_rules_unregister(struct fib_rules_ops *); 108extern void fib_rules_unregister(struct fib_rules_ops *);
108extern void fib_rules_cleanup_ops(struct fib_rules_ops *); 109extern void fib_rules_cleanup_ops(struct fib_rules_ops *);
109 110
@@ -113,4 +114,5 @@ extern int fib_rules_lookup(struct fib_rules_ops *,
113extern int fib_default_rule_add(struct fib_rules_ops *, 114extern int fib_default_rule_add(struct fib_rules_ops *,
114 u32 pref, u32 table, 115 u32 pref, u32 table,
115 u32 flags); 116 u32 flags);
117extern u32 fib_default_rule_pref(struct fib_rules_ops *ops);
116#endif 118#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 809970b7dfee..bb08692a20b0 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -86,11 +86,26 @@ struct flowi {
86 86
87struct net; 87struct net;
88struct sock; 88struct sock;
89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family, 89struct flow_cache_ops;
90 u8 dir, void **objp, atomic_t **obj_refp); 90
91struct flow_cache_object {
92 const struct flow_cache_ops *ops;
93};
94
95struct flow_cache_ops {
96 struct flow_cache_object *(*get)(struct flow_cache_object *);
97 int (*check)(struct flow_cache_object *);
98 void (*delete)(struct flow_cache_object *);
99};
100
101typedef struct flow_cache_object *(*flow_resolve_t)(
102 struct net *net, struct flowi *key, u16 family,
103 u8 dir, struct flow_cache_object *oldobj, void *ctx);
104
105extern struct flow_cache_object *flow_cache_lookup(
106 struct net *net, struct flowi *key, u16 family,
107 u8 dir, flow_resolve_t resolver, void *ctx);
91 108
92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
93 u8 dir, flow_resolve_t resolver);
94extern void flow_cache_flush(void); 109extern void flow_cache_flush(void);
95extern atomic_t flow_cache_genid; 110extern atomic_t flow_cache_genid;
96 111
diff --git a/include/net/icmp.h b/include/net/icmp.h
index dfa72d4e8907..6e991e0d0d6f 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -28,7 +28,7 @@ struct icmp_err {
28 unsigned fatal:1; 28 unsigned fatal:1;
29}; 29};
30 30
31extern 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((net)->mib.icmpmsg_statistics, field+256)
@@ -48,15 +48,4 @@ extern void icmp_out_count(struct net *net, unsigned char type);
48/* Move into dst.h ? */ 48/* Move into dst.h ? */
49extern int xrlim_allow(struct dst_entry *dst, int timeout); 49extern int xrlim_allow(struct dst_entry *dst, int timeout);
50 50
51struct raw_sock {
52 /* inet_sock has to be the first member */
53 struct inet_sock inet;
54 struct icmp_filter filter;
55};
56
57static inline struct raw_sock *raw_sk(const struct sock *sk)
58{
59 return (struct raw_sock *)sk;
60}
61
62#endif /* _ICMP_H */ 51#endif /* _ICMP_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 9d3d86aaccbb..af49f8ab7f81 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -198,6 +198,10 @@ enum ieee80211_radiotap_type {
198 IEEE80211_RADIOTAP_TX_FLAGS = 15, 198 IEEE80211_RADIOTAP_TX_FLAGS = 15,
199 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 199 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
200 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 200 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
201
202 /* valid in every it_present bitmap, even vendor namespaces */
203 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
204 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
201 IEEE80211_RADIOTAP_EXT = 31 205 IEEE80211_RADIOTAP_EXT = 31
202}; 206};
203 207
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index e9d69d198495..f95ff8d9aa47 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -32,6 +32,13 @@
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34 34
35enum {
36 INET6_IFADDR_STATE_DAD,
37 INET6_IFADDR_STATE_POSTDAD,
38 INET6_IFADDR_STATE_UP,
39 INET6_IFADDR_STATE_DEAD,
40};
41
35struct inet6_ifaddr { 42struct inet6_ifaddr {
36 struct in6_addr addr; 43 struct in6_addr addr;
37 __u32 prefix_len; 44 __u32 prefix_len;
@@ -40,6 +47,9 @@ struct inet6_ifaddr {
40 __u32 prefered_lft; 47 __u32 prefered_lft;
41 atomic_t refcnt; 48 atomic_t refcnt;
42 spinlock_t lock; 49 spinlock_t lock;
50 spinlock_t state_lock;
51
52 int state;
43 53
44 __u8 probes; 54 __u8 probes;
45 __u8 flags; 55 __u8 flags;
@@ -54,16 +64,15 @@ struct inet6_ifaddr {
54 struct inet6_dev *idev; 64 struct inet6_dev *idev;
55 struct rt6_info *rt; 65 struct rt6_info *rt;
56 66
57 struct inet6_ifaddr *lst_next; /* next addr in addr_lst */ 67 struct hlist_node addr_lst;
58 struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ 68 struct list_head if_list;
59 69
60#ifdef CONFIG_IPV6_PRIVACY 70#ifdef CONFIG_IPV6_PRIVACY
61 struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */ 71 struct list_head tmp_list;
62 struct inet6_ifaddr *ifpub; 72 struct inet6_ifaddr *ifpub;
63 int regen_count; 73 int regen_count;
64#endif 74#endif
65 75 struct rcu_head rcu;
66 int dead;
67}; 76};
68 77
69struct ip6_sf_socklist { 78struct ip6_sf_socklist {
@@ -151,13 +160,13 @@ struct ipv6_devstat {
151}; 160};
152 161
153struct inet6_dev { 162struct inet6_dev {
154 struct net_device *dev; 163 struct net_device *dev;
155 164
156 struct inet6_ifaddr *addr_list; 165 struct list_head addr_list;
157 166
158 struct ifmcaddr6 *mc_list; 167 struct ifmcaddr6 *mc_list;
159 struct ifmcaddr6 *mc_tomb; 168 struct ifmcaddr6 *mc_tomb;
160 rwlock_t mc_lock; 169 spinlock_t mc_lock;
161 unsigned char mc_qrv; 170 unsigned char mc_qrv;
162 unsigned char mc_gq_running; 171 unsigned char mc_gq_running;
163 unsigned char mc_ifc_count; 172 unsigned char mc_ifc_count;
@@ -175,7 +184,7 @@ struct inet6_dev {
175#ifdef CONFIG_IPV6_PRIVACY 184#ifdef CONFIG_IPV6_PRIVACY
176 u8 rndid[8]; 185 u8 rndid[8];
177 struct timer_list regen_timer; 186 struct timer_list regen_timer;
178 struct inet6_ifaddr *tempaddr_list; 187 struct list_head tempaddr_list;
179#endif 188#endif
180 189
181 struct neigh_parms *nd_parms; 190 struct neigh_parms *nd_parms;
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index f13ddc2543b1..aae08f686633 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
38 38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40 40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); 41extern int inet6_csk_xmit(struct sk_buff *skb);
42#endif /* _INET6_CONNECTION_SOCK_H */ 42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 696d6e4ce68a..b6d3b55da19b 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -36,9 +36,8 @@ struct tcp_congestion_ops;
36 * (i.e. things that depend on the address family) 36 * (i.e. things that depend on the address family)
37 */ 37 */
38struct inet_connection_sock_af_ops { 38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok); 39 int (*queue_xmit)(struct sk_buff *skb);
40 void (*send_check)(struct sock *sk, int len, 40 void (*send_check)(struct sock *sk, struct sk_buff *skb);
41 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk); 41 int (*rebuild_header)(struct sock *sk);
43 int (*conn_request)(struct sock *sk, struct sk_buff *skb); 42 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, 43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index bd4c53f75ac0..1653de515cee 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -21,6 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/jhash.h> 23#include <linux/jhash.h>
24#include <linux/netdevice.h>
24 25
25#include <net/flow.h> 26#include <net/flow.h>
26#include <net/sock.h> 27#include <net/sock.h>
@@ -122,10 +123,12 @@ struct inet_sock {
122 __be32 inet_saddr; 123 __be32 inet_saddr;
123 __s16 uc_ttl; 124 __s16 uc_ttl;
124 __u16 cmsg_flags; 125 __u16 cmsg_flags;
125 struct ip_options *opt;
126 __be16 inet_sport; 126 __be16 inet_sport;
127 __u16 inet_id; 127 __u16 inet_id;
128
129 struct ip_options *opt;
128 __u8 tos; 130 __u8 tos;
131 __u8 min_ttl;
129 __u8 mc_ttl; 132 __u8 mc_ttl;
130 __u8 pmtudisc; 133 __u8 pmtudisc;
131 __u8 recverr:1, 134 __u8 recverr:1,
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 79f67eae8a7e..a066fdd50da6 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -224,7 +224,9 @@ static inline
224struct net *twsk_net(const struct inet_timewait_sock *twsk) 224struct net *twsk_net(const struct inet_timewait_sock *twsk)
225{ 225{
226#ifdef CONFIG_NET_NS 226#ifdef CONFIG_NET_NS
227 return rcu_dereference(twsk->tw_net); 227 return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
228 /* reference counting, */
229 /* initialization, or RCU. */
228#else 230#else
229 return &init_net; 231 return &init_net;
230#endif 232#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index fb63371c07a8..452f229c380a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -101,7 +101,7 @@ extern int ip_do_nat(struct sk_buff *skb);
101extern void ip_send_check(struct iphdr *ip); 101extern void ip_send_check(struct iphdr *ip);
102extern int __ip_local_out(struct sk_buff *skb); 102extern int __ip_local_out(struct sk_buff *skb);
103extern int ip_local_out(struct sk_buff *skb); 103extern int ip_local_out(struct sk_buff *skb);
104extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 104extern int ip_queue_xmit(struct sk_buff *skb);
105extern void ip_init(void); 105extern void ip_init(void);
106extern int ip_append_data(struct sock *sk, 106extern int ip_append_data(struct sock *sk,
107 int getfrag(void *from, char *to, int offset, int len, 107 int getfrag(void *from, char *to, int offset, int len,
@@ -174,9 +174,9 @@ extern struct ipv4_config ipv4_config;
174#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 174#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
176 176
177extern unsigned long snmp_fold_field(void *mib[], int offt); 177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
178extern int snmp_mib_init(void *ptr[2], size_t mibsize); 178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize);
179extern void snmp_mib_free(void *ptr[2]); 179extern void snmp_mib_free(void __percpu *ptr[2]);
180 180
181extern struct local_ports { 181extern struct local_ports {
182 seqlock_t lock; 182 seqlock_t lock;
@@ -184,6 +184,12 @@ extern struct local_ports {
184} sysctl_local_ports; 184} sysctl_local_ports;
185extern void inet_get_local_port_range(int *low, int *high); 185extern void inet_get_local_port_range(int *low, int *high);
186 186
187extern unsigned long *sysctl_local_reserved_ports;
188static inline int inet_is_reserved_local_port(int port)
189{
190 return test_bit(port, sysctl_local_reserved_ports);
191}
192
187extern int sysctl_ip_default_ttl; 193extern int sysctl_ip_default_ttl;
188extern int sysctl_ip_nonlocal_bind; 194extern int sysctl_ip_nonlocal_bind;
189 195
@@ -352,8 +358,11 @@ enum ip_defrag_users {
352 IP_DEFRAG_LOCAL_DELIVER, 358 IP_DEFRAG_LOCAL_DELIVER,
353 IP_DEFRAG_CALL_RA_CHAIN, 359 IP_DEFRAG_CALL_RA_CHAIN,
354 IP_DEFRAG_CONNTRACK_IN, 360 IP_DEFRAG_CONNTRACK_IN,
361 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHRT_MAX,
355 IP_DEFRAG_CONNTRACK_OUT, 362 IP_DEFRAG_CONNTRACK_OUT,
363 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHRT_MAX,
356 IP_DEFRAG_CONNTRACK_BRIDGE_IN, 364 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
365 __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX,
357 IP_DEFRAG_VS_IN, 366 IP_DEFRAG_VS_IN,
358 IP_DEFRAG_VS_OUT, 367 IP_DEFRAG_VS_OUT,
359 IP_DEFRAG_VS_FWD 368 IP_DEFRAG_VS_FWD
@@ -390,6 +399,7 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
390 * Functions provided by ip_sockglue.c 399 * Functions provided by ip_sockglue.c
391 */ 400 */
392 401
402extern int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
393extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 403extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
394extern int ip_cmsg_send(struct net *net, 404extern int ip_cmsg_send(struct net *net,
395 struct msghdr *msg, struct ipcm_cookie *ipc); 405 struct msghdr *msg, struct ipcm_cookie *ipc);
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 257808188add..4b1dc1161c37 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -88,34 +88,37 @@ struct rt6_info {
88 struct dst_entry dst; 88 struct dst_entry dst;
89 } u; 89 } u;
90 90
91 struct inet6_dev *rt6i_idev;
92
93#define rt6i_dev u.dst.dev 91#define rt6i_dev u.dst.dev
94#define rt6i_nexthop u.dst.neighbour 92#define rt6i_nexthop u.dst.neighbour
95#define rt6i_expires u.dst.expires 93#define rt6i_expires u.dst.expires
96 94
95 /*
96 * Tail elements of dst_entry (__refcnt etc.)
97 * and these elements (rarely used in hot path) are in
98 * the same cache line.
99 */
100 struct fib6_table *rt6i_table;
97 struct fib6_node *rt6i_node; 101 struct fib6_node *rt6i_node;
98 102
99 struct in6_addr rt6i_gateway; 103 struct in6_addr rt6i_gateway;
100
101 u32 rt6i_flags;
102 u32 rt6i_metric;
103 atomic_t rt6i_ref;
104 104
105 /* more non-fragment space at head required */ 105 atomic_t rt6i_ref;
106 unsigned short rt6i_nfheader_len;
107
108 u8 rt6i_protocol;
109 106
110 struct fib6_table *rt6i_table; 107 /* These are in a separate cache line. */
108 struct rt6key rt6i_dst ____cacheline_aligned_in_smp;
109 u32 rt6i_flags;
110 struct rt6key rt6i_src;
111 u32 rt6i_metric;
111 112
112 struct rt6key rt6i_dst; 113 struct inet6_dev *rt6i_idev;
113 114
114#ifdef CONFIG_XFRM 115#ifdef CONFIG_XFRM
115 u32 rt6i_flow_cache_genid; 116 u32 rt6i_flow_cache_genid;
116#endif 117#endif
118 /* more non-fragment space at head required */
119 unsigned short rt6i_nfheader_len;
117 120
118 struct rt6key rt6i_src; 121 u8 rt6i_protocol;
119}; 122};
120 123
121static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) 124static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
@@ -124,11 +127,13 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
124} 127}
125 128
126struct fib6_walker_t { 129struct fib6_walker_t {
127 struct fib6_walker_t *prev, *next; 130 struct list_head lh;
128 struct fib6_node *root, *node; 131 struct fib6_node *root, *node;
129 struct rt6_info *leaf; 132 struct rt6_info *leaf;
130 unsigned char state; 133 unsigned char state;
131 unsigned char prune; 134 unsigned char prune;
135 unsigned int skip;
136 unsigned int count;
132 int (*func)(struct fib6_walker_t *); 137 int (*func)(struct fib6_walker_t *);
133 void *args; 138 void *args;
134}; 139};
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 4a808de7c0f6..278312c95f96 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -37,6 +37,24 @@ struct route_info {
37#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 37#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
38#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 38#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
39 39
40/*
41 * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
42 * between IPV6_ADDR_PREFERENCES socket option values
43 * IPV6_PREFER_SRC_TMP = 0x1
44 * IPV6_PREFER_SRC_PUBLIC = 0x2
45 * IPV6_PREFER_SRC_COA = 0x4
46 * and above RT6_LOOKUP_F_SRCPREF_xxx flags.
47 */
48static inline int rt6_srcprefs2flags(unsigned int srcprefs)
49{
50 /* No need to bitmask because srcprefs have only 3 bits. */
51 return srcprefs << 3;
52}
53
54static inline unsigned int rt6_flags2srcprefs(int flags)
55{
56 return (flags >> 3) & 7;
57}
40 58
41extern void ip6_route_input(struct sk_buff *skb); 59extern void ip6_route_input(struct sk_buff *skb);
42 60
@@ -134,9 +152,9 @@ static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst,
134static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, 152static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
135 struct in6_addr *daddr, struct in6_addr *saddr) 153 struct in6_addr *daddr, struct in6_addr *saddr)
136{ 154{
137 write_lock(&sk->sk_dst_lock); 155 spin_lock(&sk->sk_dst_lock);
138 __ip6_dst_store(sk, dst, daddr, saddr); 156 __ip6_dst_store(sk, dst, daddr, saddr);
139 write_unlock(&sk->sk_dst_lock); 157 spin_unlock(&sk->sk_dst_lock);
140} 158}
141 159
142static inline int ipv6_unicast_destination(struct sk_buff *skb) 160static inline int ipv6_unicast_destination(struct sk_buff *skb)
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 83b4e008b16d..fbf9d1cda27b 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -15,7 +15,6 @@
15struct ip6_tnl { 15struct ip6_tnl {
16 struct ip6_tnl *next; /* next tunnel in list */ 16 struct ip6_tnl *next; /* next tunnel in list */
17 struct net_device *dev; /* virtual device associated with tunnel */ 17 struct net_device *dev; /* virtual device associated with tunnel */
18 int recursion; /* depth of hard_start_xmit recursion */
19 struct ip6_tnl_parm parms; /* tunnel configuration parameters */ 18 struct ip6_tnl_parm parms; /* tunnel configuration parameters */
20 struct flowi fl; /* flowi template for xmit */ 19 struct flowi fl; /* flowi template for xmit */
21 struct dst_entry *dst_cache; /* cached dst */ 20 struct dst_entry *dst_cache; /* cached dst */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 8dc3296b7bea..fe82b1e10a29 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -26,6 +26,11 @@
26#include <linux/ipv6.h> /* for struct ipv6hdr */ 26#include <linux/ipv6.h> /* for struct ipv6hdr */
27#include <net/ipv6.h> /* for ipv6_addr_copy */ 27#include <net/ipv6.h> /* for ipv6_addr_copy */
28 28
29
30/* Connections' size value needed by ip_vs_ctl.c */
31extern int ip_vs_conn_tab_size;
32
33
29struct ip_vs_iphdr { 34struct ip_vs_iphdr {
30 int len; 35 int len;
31 __u8 protocol; 36 __u8 protocol;
@@ -220,6 +225,26 @@ enum {
220}; 225};
221 226
222/* 227/*
228 * SCTP State Values
229 */
230enum ip_vs_sctp_states {
231 IP_VS_SCTP_S_NONE,
232 IP_VS_SCTP_S_INIT_CLI,
233 IP_VS_SCTP_S_INIT_SER,
234 IP_VS_SCTP_S_INIT_ACK_CLI,
235 IP_VS_SCTP_S_INIT_ACK_SER,
236 IP_VS_SCTP_S_ECHO_CLI,
237 IP_VS_SCTP_S_ECHO_SER,
238 IP_VS_SCTP_S_ESTABLISHED,
239 IP_VS_SCTP_S_SHUT_CLI,
240 IP_VS_SCTP_S_SHUT_SER,
241 IP_VS_SCTP_S_SHUT_ACK_CLI,
242 IP_VS_SCTP_S_SHUT_ACK_SER,
243 IP_VS_SCTP_S_CLOSED,
244 IP_VS_SCTP_S_LAST
245};
246
247/*
223 * Delta sequence info structure 248 * Delta sequence info structure
224 * Each ip_vs_conn has 2 (output AND input seq. changes). 249 * Each ip_vs_conn has 2 (output AND input seq. changes).
225 * Only used in the VS/NAT. 250 * Only used in the VS/NAT.
@@ -592,17 +617,6 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
592 * (from ip_vs_conn.c) 617 * (from ip_vs_conn.c)
593 */ 618 */
594 619
595/*
596 * IPVS connection entry hash table
597 */
598#ifndef CONFIG_IP_VS_TAB_BITS
599#define CONFIG_IP_VS_TAB_BITS 12
600#endif
601
602#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS
603#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
604#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
605
606enum { 620enum {
607 IP_VS_DIR_INPUT = 0, 621 IP_VS_DIR_INPUT = 0,
608 IP_VS_DIR_OUTPUT, 622 IP_VS_DIR_OUTPUT,
@@ -747,7 +761,7 @@ extern struct ip_vs_protocol ip_vs_protocol_udp;
747extern struct ip_vs_protocol ip_vs_protocol_icmp; 761extern struct ip_vs_protocol ip_vs_protocol_icmp;
748extern struct ip_vs_protocol ip_vs_protocol_esp; 762extern struct ip_vs_protocol ip_vs_protocol_esp;
749extern struct ip_vs_protocol ip_vs_protocol_ah; 763extern struct ip_vs_protocol ip_vs_protocol_ah;
750 764extern struct ip_vs_protocol ip_vs_protocol_sctp;
751 765
752/* 766/*
753 * Registering/unregistering scheduler functions 767 * Registering/unregistering scheduler functions
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h
index 2a1092abaa07..cc4f30cd7315 100644
--- a/include/net/ipcomp.h
+++ b/include/net/ipcomp.h
@@ -9,7 +9,7 @@ struct crypto_comp;
9 9
10struct ipcomp_data { 10struct ipcomp_data {
11 u16 threshold; 11 u16 threshold;
12 struct crypto_comp **tfms; 12 struct crypto_comp * __percpu *tfms;
13}; 13};
14 14
15struct ip_comp_hdr; 15struct ip_comp_hdr;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index ccab5946c830..2600b69757b8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -73,7 +73,6 @@
73#define IPV6_ADDR_SCOPE_MASK 0x00f0U 73#define IPV6_ADDR_SCOPE_MASK 0x00f0U
74 74
75#define IPV6_ADDR_MAPPED 0x1000U 75#define IPV6_ADDR_MAPPED 0x1000U
76#define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */
77 76
78/* 77/*
79 * Addr scopes 78 * Addr scopes
@@ -246,7 +245,9 @@ extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
246int ip6_frag_nqueues(struct net *net); 245int ip6_frag_nqueues(struct net *net);
247int ip6_frag_mem(struct net *net); 246int ip6_frag_mem(struct net *net);
248 247
249#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ 248#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */
249#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */
250#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
250 251
251extern int __ipv6_addr_type(const struct in6_addr *addr); 252extern int __ipv6_addr_type(const struct in6_addr *addr);
252static inline int ipv6_addr_type(const struct in6_addr *addr) 253static inline int ipv6_addr_type(const struct in6_addr *addr)
@@ -353,8 +354,11 @@ struct inet_frag_queue;
353enum ip6_defrag_users { 354enum ip6_defrag_users {
354 IP6_DEFRAG_LOCAL_DELIVER, 355 IP6_DEFRAG_LOCAL_DELIVER,
355 IP6_DEFRAG_CONNTRACK_IN, 356 IP6_DEFRAG_CONNTRACK_IN,
357 __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHRT_MAX,
356 IP6_DEFRAG_CONNTRACK_OUT, 358 IP6_DEFRAG_CONNTRACK_OUT,
359 __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHRT_MAX,
357 IP6_DEFRAG_CONNTRACK_BRIDGE_IN, 360 IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
361 __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX,
358}; 362};
359 363
360struct ip6_create_arg { 364struct ip6_create_arg {
@@ -418,7 +422,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a
418 for (i = 0; i < addrlen; i++) { 422 for (i = 0; i < addrlen; i++) {
419 __be32 xb = a1[i] ^ a2[i]; 423 __be32 xb = a1[i] ^ a2[i];
420 if (xb) 424 if (xb)
421 return i * 32 + 32 - fls(ntohl(xb)); 425 return i * 32 + 31 - __fls(ntohl(xb));
422 } 426 }
423 427
424 /* 428 /*
@@ -478,8 +482,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
478extern int ip6_xmit(struct sock *sk, 482extern int ip6_xmit(struct sock *sk,
479 struct sk_buff *skb, 483 struct sk_buff *skb,
480 struct flowi *fl, 484 struct flowi *fl,
481 struct ipv6_txoptions *opt, 485 struct ipv6_txoptions *opt);
482 int ipfragok);
483 486
484extern int ip6_nd_hdr(struct sock *sk, 487extern int ip6_nd_hdr(struct sock *sk,
485 struct sk_buff *skb, 488 struct sk_buff *skb,
@@ -500,7 +503,8 @@ extern int ip6_append_data(struct sock *sk,
500 struct ipv6_txoptions *opt, 503 struct ipv6_txoptions *opt,
501 struct flowi *fl, 504 struct flowi *fl,
502 struct rt6_info *rt, 505 struct rt6_info *rt,
503 unsigned int flags); 506 unsigned int flags,
507 int dontfrag);
504 508
505extern int ip6_push_pending_frames(struct sock *sk); 509extern int ip6_push_pending_frames(struct sock *sk);
506 510
@@ -574,9 +578,11 @@ extern int ip6_datagram_connect(struct sock *sk,
574 struct sockaddr *addr, int addr_len); 578 struct sockaddr *addr, int addr_len);
575 579
576extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 580extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
581extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
577extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 582extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
578 u32 info, u8 *payload); 583 u32 info, u8 *payload);
579extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 584extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
585extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu);
580 586
581extern int inet6_release(struct socket *sock); 587extern int inet6_release(struct socket *sock);
582extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, 588extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
diff --git a/include/net/ipx.h b/include/net/ipx.h
index a14121dd1932..ef51a668ba19 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -13,6 +13,7 @@
13#include <net/datalink.h> 13#include <net/datalink.h>
14#include <linux/ipx.h> 14#include <linux/ipx.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/slab.h>
16 17
17struct ipx_address { 18struct ipx_address {
18 __be32 net; 19 __be32 net;
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h
index 0788c23d2828..11aee7a2972a 100644
--- a/include/net/irda/irttp.h
+++ b/include/net/irda/irttp.h
@@ -97,7 +97,7 @@
97#define TTP_MAX_SDU_SIZE 0x01 97#define TTP_MAX_SDU_SIZE 0x01
98 98
99/* 99/*
100 * This structure contains all data assosiated with one instance of a TTP 100 * This structure contains all data associated with one instance of a TTP
101 * connection. 101 * connection.
102 */ 102 */
103struct tsap_cb { 103struct tsap_cb {
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index 5e310c8d8e2f..205a3360156e 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/slab.h>
31#include <asm/debug.h> 32#include <asm/debug.h>
32 33
33/* 34/*
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index b2b98f3fa265..3afdb21cc31d 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -323,7 +323,7 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
323struct iw_handler_def { 323struct iw_handler_def {
324 324
325 /* Array of handlers for standard ioctls 325 /* Array of handlers for standard ioctls
326 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] 326 * We will call dev->wireless_handlers->standard[ioctl - SIOCIWFIRST]
327 */ 327 */
328 const iw_handler * standard; 328 const iw_handler * standard;
329 /* Number of handlers defined (more precisely, index of the 329 /* Number of handlers defined (more precisely, index of the
diff --git a/include/net/llc.h b/include/net/llc.h
index 7940da1606e7..5503b74ab170 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -16,6 +16,9 @@
16#include <linux/if_ether.h> 16#include <linux/if_ether.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/rculist_nulls.h>
20#include <linux/hash.h>
21#include <linux/jhash.h>
19 22
20#include <asm/atomic.h> 23#include <asm/atomic.h>
21 24
@@ -31,6 +34,12 @@ struct llc_addr {
31#define LLC_SAP_STATE_INACTIVE 1 34#define LLC_SAP_STATE_INACTIVE 1
32#define LLC_SAP_STATE_ACTIVE 2 35#define LLC_SAP_STATE_ACTIVE 2
33 36
37#define LLC_SK_DEV_HASH_BITS 6
38#define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS)
39
40#define LLC_SK_LADDR_HASH_BITS 6
41#define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS)
42
34/** 43/**
35 * struct llc_sap - Defines the SAP component 44 * struct llc_sap - Defines the SAP component
36 * 45 *
@@ -53,18 +62,38 @@ struct llc_sap {
53 struct net_device *orig_dev); 62 struct net_device *orig_dev);
54 struct llc_addr laddr; 63 struct llc_addr laddr;
55 struct list_head node; 64 struct list_head node;
56 struct { 65 spinlock_t sk_lock;
57 rwlock_t lock; 66 int sk_count;
58 struct hlist_head list; 67 struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES];
59 } sk_list; 68 struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
60}; 69};
61 70
71static inline
72struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
73{
74 return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
75}
76
77static inline
78u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr)
79{
80 return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0),
81 LLC_SK_LADDR_HASH_BITS);
82}
83
84static inline
85struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap,
86 const struct llc_addr *laddr)
87{
88 return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)];
89}
90
62#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ 91#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
63#define LLC_DEST_SAP 1 /* Type 1 goes here */ 92#define LLC_DEST_SAP 1 /* Type 1 goes here */
64#define LLC_DEST_CONN 2 /* Type 2 goes here */ 93#define LLC_DEST_CONN 2 /* Type 2 goes here */
65 94
66extern struct list_head llc_sap_list; 95extern struct list_head llc_sap_list;
67extern rwlock_t llc_sap_list_lock; 96extern spinlock_t llc_sap_list_lock;
68 97
69extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 98extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
70 struct packet_type *pt, struct net_device *orig_dev); 99 struct packet_type *pt, struct net_device *orig_dev);
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index e2374e34989f..2f97d8ddce92 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -76,6 +76,8 @@ struct llc_sock {
76 u32 rx_pdu_hdr; /* used for saving header of last pdu 76 u32 rx_pdu_hdr; /* used for saving header of last pdu
77 received and caused sending FRMR. 77 received and caused sending FRMR.
78 Used for resending FRMR */ 78 Used for resending FRMR */
79 u32 cmsg_flags;
80 struct hlist_node dev_hash_node;
79}; 81};
80 82
81static inline struct llc_sock *llc_sk(const struct sock *sk) 83static inline struct llc_sock *llc_sk(const struct sock *sk)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0bf369752274..de22cbfef232 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2002-2005, Devicescape Software, Inc. 4 * Copyright 2002-2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -107,25 +107,14 @@ enum ieee80211_max_queues {
107 * 2^n-1 in the range 1..32767] 107 * 2^n-1 in the range 1..32767]
108 * @cw_max: maximum contention window [like @cw_min] 108 * @cw_max: maximum contention window [like @cw_min]
109 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled 109 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
110 * @uapsd: is U-APSD mode enabled for the queue
110 */ 111 */
111struct ieee80211_tx_queue_params { 112struct ieee80211_tx_queue_params {
112 u16 txop; 113 u16 txop;
113 u16 cw_min; 114 u16 cw_min;
114 u16 cw_max; 115 u16 cw_max;
115 u8 aifs; 116 u8 aifs;
116}; 117 bool uapsd;
117
118/**
119 * struct ieee80211_tx_queue_stats - transmit queue statistics
120 *
121 * @len: number of packets in queue
122 * @limit: queue length limit
123 * @count: number of frames sent
124 */
125struct ieee80211_tx_queue_stats {
126 unsigned int len;
127 unsigned int limit;
128 unsigned int count;
129}; 118};
130 119
131struct ieee80211_low_level_stats { 120struct ieee80211_low_level_stats {
@@ -155,6 +144,8 @@ struct ieee80211_low_level_stats {
155 * new beacon (beaconing modes) 144 * new beacon (beaconing modes)
156 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be 145 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
157 * enabled/disabled (beaconing modes) 146 * enabled/disabled (beaconing modes)
147 * @BSS_CHANGED_CQM: Connection quality monitor config changed
148 * @BSS_CHANGED_IBSS: IBSS join status changed
158 */ 149 */
159enum ieee80211_bss_change { 150enum ieee80211_bss_change {
160 BSS_CHANGED_ASSOC = 1<<0, 151 BSS_CHANGED_ASSOC = 1<<0,
@@ -167,6 +158,10 @@ enum ieee80211_bss_change {
167 BSS_CHANGED_BSSID = 1<<7, 158 BSS_CHANGED_BSSID = 1<<7,
168 BSS_CHANGED_BEACON = 1<<8, 159 BSS_CHANGED_BEACON = 1<<8,
169 BSS_CHANGED_BEACON_ENABLED = 1<<9, 160 BSS_CHANGED_BEACON_ENABLED = 1<<9,
161 BSS_CHANGED_CQM = 1<<10,
162 BSS_CHANGED_IBSS = 1<<11,
163
164 /* when adding here, make sure to change ieee80211_reconfig */
170}; 165};
171 166
172/** 167/**
@@ -176,6 +171,8 @@ enum ieee80211_bss_change {
176 * to that BSS) that can change during the lifetime of the BSS. 171 * to that BSS) that can change during the lifetime of the BSS.
177 * 172 *
178 * @assoc: association status 173 * @assoc: association status
174 * @ibss_joined: indicates whether this station is part of an IBSS
175 * or not
179 * @aid: association ID number, valid only when @assoc is true 176 * @aid: association ID number, valid only when @assoc is true
180 * @use_cts_prot: use CTS protection 177 * @use_cts_prot: use CTS protection
181 * @use_short_preamble: use 802.11b short preamble; 178 * @use_short_preamble: use 802.11b short preamble;
@@ -184,7 +181,8 @@ enum ieee80211_bss_change {
184 * @use_short_slot: use short slot time (only relevant for ERP); 181 * @use_short_slot: use short slot time (only relevant for ERP);
185 * if the hardware cannot handle this it must set the 182 * if the hardware cannot handle this it must set the
186 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 183 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
187 * @dtim_period: num of beacons before the next DTIM, for PSM 184 * @dtim_period: num of beacons before the next DTIM, for beaconing,
185 * not valid in station mode (cf. hw conf ps_dtim_period)
188 * @timestamp: beacon timestamp 186 * @timestamp: beacon timestamp
189 * @beacon_int: beacon interval 187 * @beacon_int: beacon interval
190 * @assoc_capability: capabilities taken from assoc resp 188 * @assoc_capability: capabilities taken from assoc resp
@@ -193,13 +191,19 @@ enum ieee80211_bss_change {
193 * the current band. 191 * the current band.
194 * @bssid: The BSSID for this BSS 192 * @bssid: The BSSID for this BSS
195 * @enable_beacon: whether beaconing should be enabled or not 193 * @enable_beacon: whether beaconing should be enabled or not
194 * @channel_type: Channel type for this BSS -- the hardware might be
195 * configured for HT40+ while this BSS only uses no-HT, for
196 * example.
196 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). 197 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
197 * This field is only valid when the channel type is one of the HT types. 198 * This field is only valid when the channel type is one of the HT types.
199 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
200 * implies disabled
201 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
198 */ 202 */
199struct ieee80211_bss_conf { 203struct ieee80211_bss_conf {
200 const u8 *bssid; 204 const u8 *bssid;
201 /* association related data */ 205 /* association related data */
202 bool assoc; 206 bool assoc, ibss_joined;
203 u16 aid; 207 u16 aid;
204 /* erp related data */ 208 /* erp related data */
205 bool use_cts_prot; 209 bool use_cts_prot;
@@ -212,6 +216,9 @@ struct ieee80211_bss_conf {
212 u64 timestamp; 216 u64 timestamp;
213 u32 basic_rates; 217 u32 basic_rates;
214 u16 ht_operation_mode; 218 u16 ht_operation_mode;
219 s32 cqm_rssi_thold;
220 u32 cqm_rssi_hyst;
221 enum nl80211_channel_type channel_type;
215}; 222};
216 223
217/** 224/**
@@ -255,9 +262,6 @@ struct ieee80211_bss_conf {
255 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 262 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
256 * set by rate control algorithms to indicate probe rate, will 263 * set by rate control algorithms to indicate probe rate, will
257 * be cleared for fragmented frames (except on the last fragment) 264 * be cleared for fragmented frames (except on the last fragment)
258 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
259 * set this flag in the driver; indicates that the rate control
260 * algorithm was used and should be notified of TX status
261 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, 265 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
262 * used to indicate that a pending frame requires TX processing before 266 * used to indicate that a pending frame requires TX processing before
263 * it can be sent out. 267 * it can be sent out.
@@ -272,6 +276,17 @@ struct ieee80211_bss_conf {
272 * transmit function after the current frame, this can be used 276 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the 277 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full. 278 * queue gets full.
279 * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
280 * after TX status because the destination was asleep, it must not
281 * be modified again (no seqno assignment, crypto, etc.)
282 * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still
283 * has a radiotap header at skb->data.
284 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
285 * MLME command (internal to mac80211 to figure out whether to send TX
286 * status to user space)
287 * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
288 * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
289 * frame and selects the maximum number of streams that it can use.
275 */ 290 */
276enum mac80211_tx_control_flags { 291enum mac80211_tx_control_flags {
277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 292 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -287,12 +302,17 @@ enum mac80211_tx_control_flags {
287 IEEE80211_TX_STAT_AMPDU = BIT(10), 302 IEEE80211_TX_STAT_AMPDU = BIT(10),
288 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 303 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
289 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 304 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 305 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
292 IEEE80211_TX_INTFL_RETRIED = BIT(15), 306 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 307 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), 308 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 309 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
310 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
311 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20),
312 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
313 IEEE80211_TX_CTL_LDPC = BIT(22),
314 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
315#define IEEE80211_TX_CTL_STBC_SHIFT 23
296}; 316};
297 317
298/** 318/**
@@ -391,11 +411,11 @@ struct ieee80211_tx_rate {
391 * @status: union for status data 411 * @status: union for status data
392 * @driver_data: array of driver_data pointers 412 * @driver_data: array of driver_data pointers
393 * @ampdu_ack_len: number of acked aggregated frames. 413 * @ampdu_ack_len: number of acked aggregated frames.
394 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 414 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
395 * @ampdu_ack_map: block ack bit map for the aggregation. 415 * @ampdu_ack_map: block ack bit map for the aggregation.
396 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 416 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
397 * @ampdu_len: number of aggregated frames. 417 * @ampdu_len: number of aggregated frames.
398 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 418 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
399 * @ack_signal: signal strength of the ACK frame 419 * @ack_signal: signal strength of the ACK frame
400 */ 420 */
401struct ieee80211_tx_info { 421struct ieee80211_tx_info {
@@ -546,7 +566,6 @@ enum mac80211_rx_flags {
546 * @signal: signal strength when receiving this frame, either in dBm, in dB or 566 * @signal: signal strength when receiving this frame, either in dBm, in dB or
547 * unspecified depending on the hardware capabilities flags 567 * unspecified depending on the hardware capabilities flags
548 * @IEEE80211_HW_SIGNAL_* 568 * @IEEE80211_HW_SIGNAL_*
549 * @noise: noise when receiving this frame, in dBm.
550 * @antenna: antenna used 569 * @antenna: antenna used
551 * @rate_idx: index of data rate into band's supported rates or MCS index if 570 * @rate_idx: index of data rate into band's supported rates or MCS index if
552 * HT rates are use (RX_FLAG_HT) 571 * HT rates are use (RX_FLAG_HT)
@@ -557,7 +576,6 @@ struct ieee80211_rx_status {
557 enum ieee80211_band band; 576 enum ieee80211_band band;
558 int freq; 577 int freq;
559 int signal; 578 int signal;
560 int noise;
561 int antenna; 579 int antenna;
562 int rate_idx; 580 int rate_idx;
563 int flag; 581 int flag;
@@ -571,17 +589,27 @@ struct ieee80211_rx_status {
571 * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this 589 * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
572 * to determine for example whether to calculate timestamps for packets 590 * to determine for example whether to calculate timestamps for packets
573 * or not, do not use instead of filter flags! 591 * or not, do not use instead of filter flags!
574 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) 592 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only).
593 * This is the power save mode defined by IEEE 802.11-2007 section 11.2,
594 * meaning that the hardware still wakes up for beacons, is able to
595 * transmit frames and receive the possible acknowledgment frames.
596 * Not to be confused with hardware specific wakeup/sleep states,
597 * driver is responsible for that. See the section "Powersave support"
598 * for more.
575 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set 599 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
576 * the driver should be prepared to handle configuration requests but 600 * the driver should be prepared to handle configuration requests but
577 * may turn the device off as much as possible. Typically, this flag will 601 * may turn the device off as much as possible. Typically, this flag will
578 * be set when an interface is set UP but not associated or scanning, but 602 * be set when an interface is set UP but not associated or scanning, but
579 * it can also be unset in that case when monitor interfaces are active. 603 * it can also be unset in that case when monitor interfaces are active.
604 * @IEEE80211_CONF_QOS: Enable 802.11e QoS also know as WMM (Wireless
605 * Multimedia). On some drivers (iwlwifi is one of know) we have
606 * to enable/disable QoS explicitly.
580 */ 607 */
581enum ieee80211_conf_flags { 608enum ieee80211_conf_flags {
582 IEEE80211_CONF_MONITOR = (1<<0), 609 IEEE80211_CONF_MONITOR = (1<<0),
583 IEEE80211_CONF_PS = (1<<1), 610 IEEE80211_CONF_PS = (1<<1),
584 IEEE80211_CONF_IDLE = (1<<2), 611 IEEE80211_CONF_IDLE = (1<<2),
612 IEEE80211_CONF_QOS = (1<<3),
585}; 613};
586 614
587 615
@@ -595,8 +623,11 @@ enum ieee80211_conf_flags {
595 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 623 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
596 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 624 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
597 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 625 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
626 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
627 * @IEEE80211_CONF_CHANGE_QOS: Quality of service was enabled or disabled
598 */ 628 */
599enum ieee80211_conf_changed { 629enum ieee80211_conf_changed {
630 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
600 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 631 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
601 IEEE80211_CONF_CHANGE_MONITOR = BIT(3), 632 IEEE80211_CONF_CHANGE_MONITOR = BIT(3),
602 IEEE80211_CONF_CHANGE_PS = BIT(4), 633 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -604,6 +635,26 @@ enum ieee80211_conf_changed {
604 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 635 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
605 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 636 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
606 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 637 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
638 IEEE80211_CONF_CHANGE_QOS = BIT(9),
639};
640
641/**
642 * enum ieee80211_smps_mode - spatial multiplexing power save mode
643 *
644 * @IEEE80211_SMPS_AUTOMATIC: automatic
645 * @IEEE80211_SMPS_OFF: off
646 * @IEEE80211_SMPS_STATIC: static
647 * @IEEE80211_SMPS_DYNAMIC: dynamic
648 * @IEEE80211_SMPS_NUM_MODES: internal, don't use
649 */
650enum ieee80211_smps_mode {
651 IEEE80211_SMPS_AUTOMATIC,
652 IEEE80211_SMPS_OFF,
653 IEEE80211_SMPS_STATIC,
654 IEEE80211_SMPS_DYNAMIC,
655
656 /* keep last */
657 IEEE80211_SMPS_NUM_MODES,
607}; 658};
608 659
609/** 660/**
@@ -619,9 +670,15 @@ enum ieee80211_conf_changed {
619 * value will be only achievable between DTIM frames, the hardware 670 * value will be only achievable between DTIM frames, the hardware
620 * needs to check for the multicast traffic bit in DTIM beacons. 671 * needs to check for the multicast traffic bit in DTIM beacons.
621 * This variable is valid only when the CONF_PS flag is set. 672 * This variable is valid only when the CONF_PS flag is set.
673 * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
674 * in power saving. Power saving will not be enabled until a beacon
675 * has been received and the DTIM period is known.
622 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 676 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
623 * powersave documentation below. This variable is valid only when 677 * powersave documentation below. This variable is valid only when
624 * the CONF_PS flag is set. 678 * the CONF_PS flag is set.
679 * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
680 * by cfg80211 (essentially, wext) If set, this value overrules the value
681 * chosen by mac80211 based on ps qos network latency.
625 * 682 *
626 * @power_level: requested transmit power (in dBm) 683 * @power_level: requested transmit power (in dBm)
627 * 684 *
@@ -634,18 +691,46 @@ enum ieee80211_conf_changed {
634 * @short_frame_max_tx_count: Maximum number of transmissions for a "short" 691 * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
635 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the 692 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
636 * number of transmissions not the number of retries 693 * number of transmissions not the number of retries
694 *
695 * @smps_mode: spatial multiplexing powersave mode; note that
696 * %IEEE80211_SMPS_STATIC is used when the device is not
697 * configured for an HT channel
637 */ 698 */
638struct ieee80211_conf { 699struct ieee80211_conf {
639 u32 flags; 700 u32 flags;
640 int power_level, dynamic_ps_timeout; 701 int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout;
641 int max_sleep_period; 702 int max_sleep_period;
642 703
643 u16 listen_interval; 704 u16 listen_interval;
705 u8 ps_dtim_period;
644 706
645 u8 long_frame_max_tx_count, short_frame_max_tx_count; 707 u8 long_frame_max_tx_count, short_frame_max_tx_count;
646 708
647 struct ieee80211_channel *channel; 709 struct ieee80211_channel *channel;
648 enum nl80211_channel_type channel_type; 710 enum nl80211_channel_type channel_type;
711 enum ieee80211_smps_mode smps_mode;
712};
713
714/**
715 * struct ieee80211_channel_switch - holds the channel switch data
716 *
717 * The information provided in this structure is required for channel switch
718 * operation.
719 *
720 * @timestamp: value in microseconds of the 64-bit Time Synchronization
721 * Function (TSF) timer when the frame containing the channel switch
722 * announcement was received. This is simply the rx.mactime parameter
723 * the driver passed into mac80211.
724 * @block_tx: Indicates whether transmission must be blocked before the
725 * scheduled channel switch, as indicated by the AP.
726 * @channel: the new channel to switch to
727 * @count: the number of TBTT's until the channel switch event
728 */
729struct ieee80211_channel_switch {
730 u64 timestamp;
731 bool block_tx;
732 struct ieee80211_channel *channel;
733 u8 count;
649}; 734};
650 735
651/** 736/**
@@ -657,12 +742,14 @@ struct ieee80211_conf {
657 * @type: type of this virtual interface 742 * @type: type of this virtual interface
658 * @bss_conf: BSS configuration for this interface, either our own 743 * @bss_conf: BSS configuration for this interface, either our own
659 * or the BSS we're associated to 744 * or the BSS we're associated to
745 * @addr: address of this interface
660 * @drv_priv: data area for driver use, will always be aligned to 746 * @drv_priv: data area for driver use, will always be aligned to
661 * sizeof(void *). 747 * sizeof(void *).
662 */ 748 */
663struct ieee80211_vif { 749struct ieee80211_vif {
664 enum nl80211_iftype type; 750 enum nl80211_iftype type;
665 struct ieee80211_bss_conf bss_conf; 751 struct ieee80211_bss_conf bss_conf;
752 u8 addr[ETH_ALEN];
666 /* must be last */ 753 /* must be last */
667 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 754 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
668}; 755};
@@ -676,33 +763,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
676} 763}
677 764
678/** 765/**
679 * struct ieee80211_if_init_conf - initial configuration of an interface
680 *
681 * @vif: pointer to a driver-use per-interface structure. The pointer
682 * itself is also used for various functions including
683 * ieee80211_beacon_get() and ieee80211_get_buffered_bc().
684 * @type: one of &enum nl80211_iftype constants. Determines the type of
685 * added/removed interface.
686 * @mac_addr: pointer to MAC address of the interface. This pointer is valid
687 * until the interface is removed (i.e. it cannot be used after
688 * remove_interface() callback was called for this interface).
689 *
690 * This structure is used in add_interface() and remove_interface()
691 * callbacks of &struct ieee80211_hw.
692 *
693 * When you allow multiple interfaces to be added to your PHY, take care
694 * that the hardware can actually handle multiple MAC addresses. However,
695 * also take care that when there's no interface left with mac_addr != %NULL
696 * you remove the MAC address from the device to avoid acknowledging packets
697 * in pure monitor mode.
698 */
699struct ieee80211_if_init_conf {
700 enum nl80211_iftype type;
701 struct ieee80211_vif *vif;
702 void *mac_addr;
703};
704
705/**
706 * enum ieee80211_key_alg - key algorithm 766 * enum ieee80211_key_alg - key algorithm
707 * @ALG_WEP: WEP40 or WEP104 767 * @ALG_WEP: WEP40 or WEP104
708 * @ALG_TKIP: TKIP 768 * @ALG_TKIP: TKIP
@@ -755,6 +815,7 @@ enum ieee80211_key_flags {
755 * encrypted in hardware. 815 * encrypted in hardware.
756 * @alg: The key algorithm. 816 * @alg: The key algorithm.
757 * @flags: key flags, see &enum ieee80211_key_flags. 817 * @flags: key flags, see &enum ieee80211_key_flags.
818 * @ap_addr: AP's MAC address
758 * @keyidx: the key index (0-3) 819 * @keyidx: the key index (0-3)
759 * @keylen: key material length 820 * @keylen: key material length
760 * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) 821 * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte)
@@ -797,7 +858,7 @@ enum set_key_cmd {
797 * mac80211, any ieee80211_sta pointer you get access to must 858 * mac80211, any ieee80211_sta pointer you get access to must
798 * either be protected by rcu_read_lock() explicitly or implicitly, 859 * either be protected by rcu_read_lock() explicitly or implicitly,
799 * or you must take good care to not use such a pointer after a 860 * or you must take good care to not use such a pointer after a
800 * call to your sta_notify callback that removed it. 861 * call to your sta_remove callback that removed it.
801 * 862 *
802 * @addr: MAC address 863 * @addr: MAC address
803 * @aid: AID we assigned to the station if we're an AP 864 * @aid: AID we assigned to the station if we're an AP
@@ -823,8 +884,8 @@ struct ieee80211_sta {
823 * indicates addition and removal of a station to station table, 884 * indicates addition and removal of a station to station table,
824 * or if a associated station made a power state transition. 885 * or if a associated station made a power state transition.
825 * 886 *
826 * @STA_NOTIFY_ADD: a station was added to the station table 887 * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table
827 * @STA_NOTIFY_REMOVE: a station being removed from the station table 888 * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table
828 * @STA_NOTIFY_SLEEP: a station is now sleeping 889 * @STA_NOTIFY_SLEEP: a station is now sleeping
829 * @STA_NOTIFY_AWAKE: a sleeping station woke up 890 * @STA_NOTIFY_AWAKE: a sleeping station woke up
830 */ 891 */
@@ -899,10 +960,6 @@ enum ieee80211_tkip_key_type {
899 * one milliwatt. This is the preferred method since it is standardized 960 * one milliwatt. This is the preferred method since it is standardized
900 * between different devices. @max_signal does not need to be set. 961 * between different devices. @max_signal does not need to be set.
901 * 962 *
902 * @IEEE80211_HW_NOISE_DBM:
903 * Hardware can provide noise (radio interference) values in units dBm,
904 * decibel difference from one milliwatt.
905 *
906 * @IEEE80211_HW_SPECTRUM_MGMT: 963 * @IEEE80211_HW_SPECTRUM_MGMT:
907 * Hardware supports spectrum management defined in 802.11h 964 * Hardware supports spectrum management defined in 802.11h
908 * Measurement, Channel Switch, Quieting, TPC 965 * Measurement, Channel Switch, Quieting, TPC
@@ -926,6 +983,37 @@ enum ieee80211_tkip_key_type {
926 * @IEEE80211_HW_BEACON_FILTER: 983 * @IEEE80211_HW_BEACON_FILTER:
927 * Hardware supports dropping of irrelevant beacon frames to 984 * Hardware supports dropping of irrelevant beacon frames to
928 * avoid waking up cpu. 985 * avoid waking up cpu.
986 *
987 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
988 * Hardware supports static spatial multiplexing powersave,
989 * ie. can turn off all but one chain even on HT connections
990 * that should be using more chains.
991 *
992 * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS:
993 * Hardware supports dynamic spatial multiplexing powersave,
994 * ie. can turn off all but one chain and then wake the rest
995 * up as required after, for example, rts/cts handshake.
996 *
997 * @IEEE80211_HW_SUPPORTS_UAPSD:
998 * Hardware supports Unscheduled Automatic Power Save Delivery
999 * (U-APSD) in managed mode. The mode is configured with
1000 * conf_tx() operation.
1001 *
1002 * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
1003 * Hardware can provide ack status reports of Tx frames to
1004 * the stack.
1005 *
1006 * @IEEE80211_HW_CONNECTION_MONITOR:
1007 * The hardware performs its own connection monitoring, including
1008 * periodic keep-alives to the AP and probing the AP on beacon loss.
1009 * When this flag is set, signaling beacon-loss will cause an immediate
1010 * change to disassociated state.
1011 *
1012 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1013 * Hardware can do connection quality monitoring - i.e. it can monitor
1014 * connection quality related parameters, such as the RSSI level and
1015 * provide notifications if configured trigger levels are reached.
1016 *
929 */ 1017 */
930enum ieee80211_hw_flags { 1018enum ieee80211_hw_flags {
931 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1019 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -935,7 +1023,7 @@ enum ieee80211_hw_flags {
935 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 1023 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
936 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 1024 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
937 IEEE80211_HW_SIGNAL_DBM = 1<<6, 1025 IEEE80211_HW_SIGNAL_DBM = 1<<6,
938 IEEE80211_HW_NOISE_DBM = 1<<7, 1026 /* use this hole */
939 IEEE80211_HW_SPECTRUM_MGMT = 1<<8, 1027 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
940 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, 1028 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
941 IEEE80211_HW_SUPPORTS_PS = 1<<10, 1029 IEEE80211_HW_SUPPORTS_PS = 1<<10,
@@ -943,6 +1031,12 @@ enum ieee80211_hw_flags {
943 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1031 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
944 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1032 IEEE80211_HW_MFP_CAPABLE = 1<<13,
945 IEEE80211_HW_BEACON_FILTER = 1<<14, 1033 IEEE80211_HW_BEACON_FILTER = 1<<14,
1034 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1035 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1036 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1037 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1038 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1039 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20,
946}; 1040};
947 1041
948/** 1042/**
@@ -1121,18 +1215,24 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1121 * 1215 *
1122 * mac80211 has support for various powersave implementations. 1216 * mac80211 has support for various powersave implementations.
1123 * 1217 *
1124 * First, it can support hardware that handles all powersaving by 1218 * First, it can support hardware that handles all powersaving by itself,
1125 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS 1219 * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware
1126 * hardware flag. In that case, it will be told about the desired 1220 * flag. In that case, it will be told about the desired powersave mode
1127 * powersave mode depending on the association status, and the driver 1221 * with the %IEEE80211_CONF_PS flag depending on the association status.
1128 * must take care of sending nullfunc frames when necessary, i.e. when 1222 * The hardware must take care of sending nullfunc frames when necessary,
1129 * entering and leaving powersave mode. The driver is required to look at 1223 * i.e. when entering and leaving powersave mode. The hardware is required
1130 * the AID in beacons and signal to the AP that it woke up when it finds 1224 * to look at the AID in beacons and signal to the AP that it woke up when
1131 * traffic directed to it. This mode supports dynamic PS by simply 1225 * it finds traffic directed to it.
1132 * enabling/disabling PS. 1226 *
1133 * 1227 * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
1134 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS 1228 * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
1135 * flag to indicate that it can support dynamic PS mode itself (see below). 1229 * with hardware wakeup and sleep states. Driver is responsible for waking
1230 * up the hardware before issueing commands to the hardware and putting it
1231 * back to sleep at approriate times.
1232 *
1233 * When PS is enabled, hardware needs to wakeup for beacons and receive the
1234 * buffered multicast/broadcast frames after the beacon. Also it must be
1235 * possible to send frames and receive the acknowledment frame.
1136 * 1236 *
1137 * Other hardware designs cannot send nullfunc frames by themselves and also 1237 * Other hardware designs cannot send nullfunc frames by themselves and also
1138 * need software support for parsing the TIM bitmap. This is also supported 1238 * need software support for parsing the TIM bitmap. This is also supported
@@ -1140,14 +1240,35 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1140 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 1240 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1141 * required to pass up beacons. The hardware is still required to handle 1241 * required to pass up beacons. The hardware is still required to handle
1142 * waking up for multicast traffic; if it cannot the driver must handle that 1242 * waking up for multicast traffic; if it cannot the driver must handle that
1143 * as best as it can, mac80211 is too slow. 1243 * as best as it can, mac80211 is too slow to do that.
1144 * 1244 *
1145 * Dynamic powersave mode is an extension to normal powersave mode in which 1245 * Dynamic powersave is an extension to normal powersave in which the
1146 * the hardware stays awake for a user-specified period of time after sending 1246 * hardware stays awake for a user-specified period of time after sending a
1147 * a frame so that reply frames need not be buffered and therefore delayed 1247 * frame so that reply frames need not be buffered and therefore delayed to
1148 * to the next wakeup. This can either be supported by hardware, in which case 1248 * the next wakeup. It's compromise of getting good enough latency when
1149 * the driver needs to look at the @dynamic_ps_timeout hardware configuration 1249 * there's data traffic and still saving significantly power in idle
1150 * value, or by the stack if all nullfunc handling is in the stack. 1250 * periods.
1251 *
1252 * Dynamic powersave is supported by simply mac80211 enabling and disabling
1253 * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
1254 * flag and mac80211 will handle everything automatically. Additionally,
1255 * hardware having support for the dynamic PS feature may set the
1256 * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support
1257 * dynamic PS mode itself. The driver needs to look at the
1258 * @dynamic_ps_timeout hardware configuration value and use it that value
1259 * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable
1260 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
1261 * enabled whenever user has enabled powersave.
1262 *
1263 * Driver informs U-APSD client support by enabling
1264 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1265 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS
1266 * Nullfunc frames and stay awake until the service period has ended. To
1267 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
1268 * from that AC are transmitted with powersave enabled.
1269 *
1270 * Note: U-APSD client mode is not yet supported with
1271 * %IEEE80211_HW_PS_NULLFUNC_STACK.
1151 */ 1272 */
1152 1273
1153/** 1274/**
@@ -1211,6 +1332,31 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1211 */ 1332 */
1212 1333
1213/** 1334/**
1335 * DOC: Spatial multiplexing power save
1336 *
1337 * SMPS (Spatial multiplexing power save) is a mechanism to conserve
1338 * power in an 802.11n implementation. For details on the mechanism
1339 * and rationale, please refer to 802.11 (as amended by 802.11n-2009)
1340 * "11.2.3 SM power save".
1341 *
1342 * The mac80211 implementation is capable of sending action frames
1343 * to update the AP about the station's SMPS mode, and will instruct
1344 * the driver to enter the specific mode. It will also announce the
1345 * requested SMPS mode during the association handshake. Hardware
1346 * support for this feature is required, and can be indicated by
1347 * hardware flags.
1348 *
1349 * The default mode will be "automatic", which nl80211/cfg80211
1350 * defines to be dynamic SMPS in (regular) powersave, and SMPS
1351 * turned off otherwise.
1352 *
1353 * To support this feature, the driver must set the appropriate
1354 * hardware support flags, and handle the SMPS flag to the config()
1355 * operation. It will then with this mechanism be instructed to
1356 * enter the requested SMPS mode while associated to an HT AP.
1357 */
1358
1359/**
1214 * DOC: Frame filtering 1360 * DOC: Frame filtering
1215 * 1361 *
1216 * mac80211 requires to see many management frames for proper 1362 * mac80211 requires to see many management frames for proper
@@ -1347,7 +1493,7 @@ enum ieee80211_ampdu_mlme_action {
1347 * When the device is started it should not have a MAC address 1493 * When the device is started it should not have a MAC address
1348 * to avoid acknowledging frames before a non-monitor device 1494 * to avoid acknowledging frames before a non-monitor device
1349 * is added. 1495 * is added.
1350 * Must be implemented. 1496 * Must be implemented and can sleep.
1351 * 1497 *
1352 * @stop: Called after last netdevice attached to the hardware 1498 * @stop: Called after last netdevice attached to the hardware
1353 * is disabled. This should turn off the hardware (at least 1499 * is disabled. This should turn off the hardware (at least
@@ -1355,7 +1501,7 @@ enum ieee80211_ampdu_mlme_action {
1355 * May be called right after add_interface if that rejects 1501 * May be called right after add_interface if that rejects
1356 * an interface. If you added any work onto the mac80211 workqueue 1502 * an interface. If you added any work onto the mac80211 workqueue
1357 * you should ensure to cancel it on this callback. 1503 * you should ensure to cancel it on this callback.
1358 * Must be implemented. 1504 * Must be implemented and can sleep.
1359 * 1505 *
1360 * @add_interface: Called when a netdevice attached to the hardware is 1506 * @add_interface: Called when a netdevice attached to the hardware is
1361 * enabled. Because it is not called for monitor mode devices, @start 1507 * enabled. Because it is not called for monitor mode devices, @start
@@ -1365,7 +1511,7 @@ enum ieee80211_ampdu_mlme_action {
1365 * interface is given in the conf parameter. 1511 * interface is given in the conf parameter.
1366 * The callback may refuse to add an interface by returning a 1512 * The callback may refuse to add an interface by returning a
1367 * negative error code (which will be seen in userspace.) 1513 * negative error code (which will be seen in userspace.)
1368 * Must be implemented. 1514 * Must be implemented and can sleep.
1369 * 1515 *
1370 * @remove_interface: Notifies a driver that an interface is going down. 1516 * @remove_interface: Notifies a driver that an interface is going down.
1371 * The @stop callback is called after this if it is the last interface 1517 * The @stop callback is called after this if it is the last interface
@@ -1374,19 +1520,20 @@ enum ieee80211_ampdu_mlme_action {
1374 * must be cleared so the device no longer acknowledges packets, 1520 * must be cleared so the device no longer acknowledges packets,
1375 * the mac_addr member of the conf structure is, however, set to the 1521 * the mac_addr member of the conf structure is, however, set to the
1376 * MAC address of the device going away. 1522 * MAC address of the device going away.
1377 * Hence, this callback must be implemented. 1523 * Hence, this callback must be implemented. It can sleep.
1378 * 1524 *
1379 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1525 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1380 * function to change hardware configuration, e.g., channel. 1526 * function to change hardware configuration, e.g., channel.
1381 * This function should never fail but returns a negative error code 1527 * This function should never fail but returns a negative error code
1382 * if it does. 1528 * if it does. The callback can sleep.
1383 * 1529 *
1384 * @bss_info_changed: Handler for configuration requests related to BSS 1530 * @bss_info_changed: Handler for configuration requests related to BSS
1385 * parameters that may vary during BSS's lifespan, and may affect low 1531 * parameters that may vary during BSS's lifespan, and may affect low
1386 * level driver (e.g. assoc/disassoc status, erp parameters). 1532 * level driver (e.g. assoc/disassoc status, erp parameters).
1387 * This function should not be used if no BSS has been set, unless 1533 * This function should not be used if no BSS has been set, unless
1388 * for association indication. The @changed parameter indicates which 1534 * for association indication. The @changed parameter indicates which
1389 * of the bss parameters has changed when a call is made. 1535 * of the bss parameters has changed when a call is made. The callback
1536 * can sleep.
1390 * 1537 *
1391 * @prepare_multicast: Prepare for multicast filter configuration. 1538 * @prepare_multicast: Prepare for multicast filter configuration.
1392 * This callback is optional, and its return value is passed 1539 * This callback is optional, and its return value is passed
@@ -1394,20 +1541,22 @@ enum ieee80211_ampdu_mlme_action {
1394 * 1541 *
1395 * @configure_filter: Configure the device's RX filter. 1542 * @configure_filter: Configure the device's RX filter.
1396 * See the section "Frame filtering" for more information. 1543 * See the section "Frame filtering" for more information.
1397 * This callback must be implemented. 1544 * This callback must be implemented and can sleep.
1398 * 1545 *
1399 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1546 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1400 * must be set or cleared for a given STA. Must be atomic. 1547 * must be set or cleared for a given STA. Must be atomic.
1401 * 1548 *
1402 * @set_key: See the section "Hardware crypto acceleration" 1549 * @set_key: See the section "Hardware crypto acceleration"
1403 * This callback can sleep, and is only called between add_interface 1550 * This callback is only called between add_interface and
1404 * and remove_interface calls, i.e. while the given virtual interface 1551 * remove_interface calls, i.e. while the given virtual interface
1405 * is enabled. 1552 * is enabled.
1406 * Returns a negative error code if the key can't be added. 1553 * Returns a negative error code if the key can't be added.
1554 * The callback can sleep.
1407 * 1555 *
1408 * @update_tkip_key: See the section "Hardware crypto acceleration" 1556 * @update_tkip_key: See the section "Hardware crypto acceleration"
1409 * This callback will be called in the context of Rx. Called for drivers 1557 * This callback will be called in the context of Rx. Called for drivers
1410 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. 1558 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
1559 * The callback must be atomic.
1411 * 1560 *
1412 * @hw_scan: Ask the hardware to service the scan request, no need to start 1561 * @hw_scan: Ask the hardware to service the scan request, no need to start
1413 * the scan state machine in stack. The scan must honour the channel 1562 * the scan state machine in stack. The scan must honour the channel
@@ -1421,53 +1570,64 @@ enum ieee80211_ampdu_mlme_action {
1421 * When the scan finishes, ieee80211_scan_completed() must be called; 1570 * When the scan finishes, ieee80211_scan_completed() must be called;
1422 * note that it also must be called when the scan cannot finish due to 1571 * note that it also must be called when the scan cannot finish due to
1423 * any error unless this callback returned a negative error code. 1572 * any error unless this callback returned a negative error code.
1573 * The callback can sleep.
1424 * 1574 *
1425 * @sw_scan_start: Notifier function that is called just before a software scan 1575 * @sw_scan_start: Notifier function that is called just before a software scan
1426 * is started. Can be NULL, if the driver doesn't need this notification. 1576 * is started. Can be NULL, if the driver doesn't need this notification.
1577 * The callback can sleep.
1427 * 1578 *
1428 * @sw_scan_complete: Notifier function that is called just after a software scan 1579 * @sw_scan_complete: Notifier function that is called just after a
1429 * finished. Can be NULL, if the driver doesn't need this notification. 1580 * software scan finished. Can be NULL, if the driver doesn't need
1581 * this notification.
1582 * The callback can sleep.
1430 * 1583 *
1431 * @get_stats: Return low-level statistics. 1584 * @get_stats: Return low-level statistics.
1432 * Returns zero if statistics are available. 1585 * Returns zero if statistics are available.
1586 * The callback can sleep.
1433 * 1587 *
1434 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1588 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1435 * callback should be provided to read the TKIP transmit IVs (both IV32 1589 * callback should be provided to read the TKIP transmit IVs (both IV32
1436 * and IV16) for the given key from hardware. 1590 * and IV16) for the given key from hardware.
1591 * The callback must be atomic.
1437 * 1592 *
1438 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1593 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1594 * The callback can sleep.
1595 *
1596 * @sta_add: Notifies low level driver about addition of an associated station,
1597 * AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1598 *
1599 * @sta_remove: Notifies low level driver about removal of an associated
1600 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1439 * 1601 *
1440 * @sta_notify: Notifies low level driver about addition, removal or power 1602 * @sta_notify: Notifies low level driver about power state transition of an
1441 * state transition of an associated station, AP, IBSS/WDS/mesh peer etc. 1603 * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic.
1442 * Must be atomic.
1443 * 1604 *
1444 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1605 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1445 * bursting) for a hardware TX queue. 1606 * bursting) for a hardware TX queue.
1446 * Returns a negative error code on failure. 1607 * Returns a negative error code on failure.
1447 * 1608 * The callback can sleep.
1448 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1449 * to get number of currently queued packets (queue length), maximum queue
1450 * size (limit), and total number of packets sent using each TX queue
1451 * (count). The 'stats' pointer points to an array that has hw->queues
1452 * items.
1453 * 1609 *
1454 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1610 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1455 * this is only used for IBSS mode BSSID merging and debugging. Is not a 1611 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1456 * required function. 1612 * required function.
1613 * The callback can sleep.
1457 * 1614 *
1458 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. 1615 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1459 * Currently, this is only used for IBSS mode debugging. Is not a 1616 * Currently, this is only used for IBSS mode debugging. Is not a
1460 * required function. 1617 * required function.
1618 * The callback can sleep.
1461 * 1619 *
1462 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1620 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1463 * with other STAs in the IBSS. This is only used in IBSS mode. This 1621 * with other STAs in the IBSS. This is only used in IBSS mode. This
1464 * function is optional if the firmware/hardware takes full care of 1622 * function is optional if the firmware/hardware takes full care of
1465 * TSF synchronization. 1623 * TSF synchronization.
1624 * The callback can sleep.
1466 * 1625 *
1467 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1626 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1468 * This is needed only for IBSS mode and the result of this function is 1627 * This is needed only for IBSS mode and the result of this function is
1469 * used to determine whether to reply to Probe Requests. 1628 * used to determine whether to reply to Probe Requests.
1470 * Returns non-zero if this device sent the last beacon. 1629 * Returns non-zero if this device sent the last beacon.
1630 * The callback can sleep.
1471 * 1631 *
1472 * @ampdu_action: Perform a certain A-MPDU action 1632 * @ampdu_action: Perform a certain A-MPDU action
1473 * The RA/TID combination determines the destination and TID we want 1633 * The RA/TID combination determines the destination and TID we want
@@ -1476,28 +1636,46 @@ enum ieee80211_ampdu_mlme_action {
1476 * is the first frame we expect to perform the action on. Notice 1636 * is the first frame we expect to perform the action on. Notice
1477 * that TX/RX_STOP can pass NULL for this parameter. 1637 * that TX/RX_STOP can pass NULL for this parameter.
1478 * Returns a negative error code on failure. 1638 * Returns a negative error code on failure.
1639 * The callback must be atomic.
1640 *
1641 * @get_survey: Return per-channel survey information
1479 * 1642 *
1480 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1643 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1481 * need to set wiphy->rfkill_poll to %true before registration, 1644 * need to set wiphy->rfkill_poll to %true before registration,
1482 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1645 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1646 * The callback can sleep.
1647 *
1648 * @set_coverage_class: Set slot time for given coverage class as specified
1649 * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
1650 * accordingly. This callback is not required and may sleep.
1483 * 1651 *
1484 * @testmode_cmd: Implement a cfg80211 test mode command. 1652 * @testmode_cmd: Implement a cfg80211 test mode command.
1653 * The callback can sleep.
1654 *
1655 * @flush: Flush all pending frames from the hardware queue, making sure
1656 * that the hardware queues are empty. If the parameter @drop is set
1657 * to %true, pending frames may be dropped. The callback can sleep.
1658 *
1659 * @channel_switch: Drivers that need (or want) to offload the channel
1660 * switch operation for CSAs received from the AP may implement this
1661 * callback. They must then call ieee80211_chswitch_done() to indicate
1662 * completion of the channel switch.
1485 */ 1663 */
1486struct ieee80211_ops { 1664struct ieee80211_ops {
1487 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1665 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1488 int (*start)(struct ieee80211_hw *hw); 1666 int (*start)(struct ieee80211_hw *hw);
1489 void (*stop)(struct ieee80211_hw *hw); 1667 void (*stop)(struct ieee80211_hw *hw);
1490 int (*add_interface)(struct ieee80211_hw *hw, 1668 int (*add_interface)(struct ieee80211_hw *hw,
1491 struct ieee80211_if_init_conf *conf); 1669 struct ieee80211_vif *vif);
1492 void (*remove_interface)(struct ieee80211_hw *hw, 1670 void (*remove_interface)(struct ieee80211_hw *hw,
1493 struct ieee80211_if_init_conf *conf); 1671 struct ieee80211_vif *vif);
1494 int (*config)(struct ieee80211_hw *hw, u32 changed); 1672 int (*config)(struct ieee80211_hw *hw, u32 changed);
1495 void (*bss_info_changed)(struct ieee80211_hw *hw, 1673 void (*bss_info_changed)(struct ieee80211_hw *hw,
1496 struct ieee80211_vif *vif, 1674 struct ieee80211_vif *vif,
1497 struct ieee80211_bss_conf *info, 1675 struct ieee80211_bss_conf *info,
1498 u32 changed); 1676 u32 changed);
1499 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 1677 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1500 int mc_count, struct dev_addr_list *mc_list); 1678 struct netdev_hw_addr_list *mc_list);
1501 void (*configure_filter)(struct ieee80211_hw *hw, 1679 void (*configure_filter)(struct ieee80211_hw *hw,
1502 unsigned int changed_flags, 1680 unsigned int changed_flags,
1503 unsigned int *total_flags, 1681 unsigned int *total_flags,
@@ -1508,9 +1686,11 @@ struct ieee80211_ops {
1508 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 1686 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1509 struct ieee80211_key_conf *key); 1687 struct ieee80211_key_conf *key);
1510 void (*update_tkip_key)(struct ieee80211_hw *hw, 1688 void (*update_tkip_key)(struct ieee80211_hw *hw,
1511 struct ieee80211_key_conf *conf, const u8 *address, 1689 struct ieee80211_vif *vif,
1512 u32 iv32, u16 *phase1key); 1690 struct ieee80211_key_conf *conf,
1513 int (*hw_scan)(struct ieee80211_hw *hw, 1691 struct ieee80211_sta *sta,
1692 u32 iv32, u16 *phase1key);
1693 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1514 struct cfg80211_scan_request *req); 1694 struct cfg80211_scan_request *req);
1515 void (*sw_scan_start)(struct ieee80211_hw *hw); 1695 void (*sw_scan_start)(struct ieee80211_hw *hw);
1516 void (*sw_scan_complete)(struct ieee80211_hw *hw); 1696 void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -1519,12 +1699,14 @@ struct ieee80211_ops {
1519 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1699 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1520 u32 *iv32, u16 *iv16); 1700 u32 *iv32, u16 *iv16);
1521 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1701 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1702 int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1703 struct ieee80211_sta *sta);
1704 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1705 struct ieee80211_sta *sta);
1522 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1706 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1523 enum sta_notify_cmd, struct ieee80211_sta *sta); 1707 enum sta_notify_cmd, struct ieee80211_sta *sta);
1524 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1708 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1525 const struct ieee80211_tx_queue_params *params); 1709 const struct ieee80211_tx_queue_params *params);
1526 int (*get_tx_stats)(struct ieee80211_hw *hw,
1527 struct ieee80211_tx_queue_stats *stats);
1528 u64 (*get_tsf)(struct ieee80211_hw *hw); 1710 u64 (*get_tsf)(struct ieee80211_hw *hw);
1529 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); 1711 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1530 void (*reset_tsf)(struct ieee80211_hw *hw); 1712 void (*reset_tsf)(struct ieee80211_hw *hw);
@@ -1533,11 +1715,16 @@ struct ieee80211_ops {
1533 struct ieee80211_vif *vif, 1715 struct ieee80211_vif *vif,
1534 enum ieee80211_ampdu_mlme_action action, 1716 enum ieee80211_ampdu_mlme_action action,
1535 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1717 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1536 1718 int (*get_survey)(struct ieee80211_hw *hw, int idx,
1719 struct survey_info *survey);
1537 void (*rfkill_poll)(struct ieee80211_hw *hw); 1720 void (*rfkill_poll)(struct ieee80211_hw *hw);
1721 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
1538#ifdef CONFIG_NL80211_TESTMODE 1722#ifdef CONFIG_NL80211_TESTMODE
1539 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); 1723 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1540#endif 1724#endif
1725 void (*flush)(struct ieee80211_hw *hw, bool drop);
1726 void (*channel_switch)(struct ieee80211_hw *hw,
1727 struct ieee80211_channel_switch *ch_switch);
1541}; 1728};
1542 1729
1543/** 1730/**
@@ -1687,7 +1874,10 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
1687 * ieee80211_rx - receive frame 1874 * ieee80211_rx - receive frame
1688 * 1875 *
1689 * Use this function to hand received frames to mac80211. The receive 1876 * Use this function to hand received frames to mac80211. The receive
1690 * buffer in @skb must start with an IEEE 802.11 header. 1877 * buffer in @skb must start with an IEEE 802.11 header. In case of a
1878 * paged @skb is used, the driver is recommended to put the ieee80211
1879 * header of the frame on the linear part of the @skb to avoid memory
1880 * allocation and/or memcpy by the stack.
1691 * 1881 *
1692 * This function may not be called in IRQ context. Calls to this function 1882 * This function may not be called in IRQ context. Calls to this function
1693 * for a single hardware must be synchronized against each other. Calls to 1883 * for a single hardware must be synchronized against each other. Calls to
@@ -1777,7 +1967,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1777/** 1967/**
1778 * ieee80211_beacon_get_tim - beacon generation function 1968 * ieee80211_beacon_get_tim - beacon generation function
1779 * @hw: pointer obtained from ieee80211_alloc_hw(). 1969 * @hw: pointer obtained from ieee80211_alloc_hw().
1780 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1970 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1781 * @tim_offset: pointer to variable that will receive the TIM IE offset. 1971 * @tim_offset: pointer to variable that will receive the TIM IE offset.
1782 * Set to 0 if invalid (in non-AP modes). 1972 * Set to 0 if invalid (in non-AP modes).
1783 * @tim_length: pointer to variable that will receive the TIM IE length, 1973 * @tim_length: pointer to variable that will receive the TIM IE length,
@@ -1805,7 +1995,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
1805/** 1995/**
1806 * ieee80211_beacon_get - beacon generation function 1996 * ieee80211_beacon_get - beacon generation function
1807 * @hw: pointer obtained from ieee80211_alloc_hw(). 1997 * @hw: pointer obtained from ieee80211_alloc_hw().
1808 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1998 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1809 * 1999 *
1810 * See ieee80211_beacon_get_tim(). 2000 * See ieee80211_beacon_get_tim().
1811 */ 2001 */
@@ -1816,9 +2006,56 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1816} 2006}
1817 2007
1818/** 2008/**
2009 * ieee80211_pspoll_get - retrieve a PS Poll template
2010 * @hw: pointer obtained from ieee80211_alloc_hw().
2011 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2012 *
2013 * Creates a PS Poll a template which can, for example, uploaded to
2014 * hardware. The template must be updated after association so that correct
2015 * AID, BSSID and MAC address is used.
2016 *
2017 * Note: Caller (or hardware) is responsible for setting the
2018 * &IEEE80211_FCTL_PM bit.
2019 */
2020struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
2021 struct ieee80211_vif *vif);
2022
2023/**
2024 * ieee80211_nullfunc_get - retrieve a nullfunc template
2025 * @hw: pointer obtained from ieee80211_alloc_hw().
2026 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2027 *
2028 * Creates a Nullfunc template which can, for example, uploaded to
2029 * hardware. The template must be updated after association so that correct
2030 * BSSID and address is used.
2031 *
2032 * Note: Caller (or hardware) is responsible for setting the
2033 * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
2034 */
2035struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2036 struct ieee80211_vif *vif);
2037
2038/**
2039 * ieee80211_probereq_get - retrieve a Probe Request template
2040 * @hw: pointer obtained from ieee80211_alloc_hw().
2041 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2042 * @ssid: SSID buffer
2043 * @ssid_len: length of SSID
2044 * @ie: buffer containing all IEs except SSID for the template
2045 * @ie_len: length of the IE buffer
2046 *
2047 * Creates a Probe Request template which can, for example, be uploaded to
2048 * hardware.
2049 */
2050struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2051 struct ieee80211_vif *vif,
2052 const u8 *ssid, size_t ssid_len,
2053 const u8 *ie, size_t ie_len);
2054
2055/**
1819 * ieee80211_rts_get - RTS frame generation function 2056 * ieee80211_rts_get - RTS frame generation function
1820 * @hw: pointer obtained from ieee80211_alloc_hw(). 2057 * @hw: pointer obtained from ieee80211_alloc_hw().
1821 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2058 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1822 * @frame: pointer to the frame that is going to be protected by the RTS. 2059 * @frame: pointer to the frame that is going to be protected by the RTS.
1823 * @frame_len: the frame length (in octets). 2060 * @frame_len: the frame length (in octets).
1824 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2061 * @frame_txctl: &struct ieee80211_tx_info of the frame.
@@ -1837,7 +2074,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1837/** 2074/**
1838 * ieee80211_rts_duration - Get the duration field for an RTS frame 2075 * ieee80211_rts_duration - Get the duration field for an RTS frame
1839 * @hw: pointer obtained from ieee80211_alloc_hw(). 2076 * @hw: pointer obtained from ieee80211_alloc_hw().
1840 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2077 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1841 * @frame_len: the length of the frame that is going to be protected by the RTS. 2078 * @frame_len: the length of the frame that is going to be protected by the RTS.
1842 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2079 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1843 * 2080 *
@@ -1852,7 +2089,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1852/** 2089/**
1853 * ieee80211_ctstoself_get - CTS-to-self frame generation function 2090 * ieee80211_ctstoself_get - CTS-to-self frame generation function
1854 * @hw: pointer obtained from ieee80211_alloc_hw(). 2091 * @hw: pointer obtained from ieee80211_alloc_hw().
1855 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2092 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1856 * @frame: pointer to the frame that is going to be protected by the CTS-to-self. 2093 * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
1857 * @frame_len: the frame length (in octets). 2094 * @frame_len: the frame length (in octets).
1858 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2095 * @frame_txctl: &struct ieee80211_tx_info of the frame.
@@ -1872,7 +2109,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1872/** 2109/**
1873 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame 2110 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
1874 * @hw: pointer obtained from ieee80211_alloc_hw(). 2111 * @hw: pointer obtained from ieee80211_alloc_hw().
1875 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2112 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1876 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. 2113 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
1877 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2114 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1878 * 2115 *
@@ -1888,7 +2125,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1888/** 2125/**
1889 * ieee80211_generic_frame_duration - Calculate the duration field for a frame 2126 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
1890 * @hw: pointer obtained from ieee80211_alloc_hw(). 2127 * @hw: pointer obtained from ieee80211_alloc_hw().
1891 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2128 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1892 * @frame_len: the length of the frame. 2129 * @frame_len: the length of the frame.
1893 * @rate: the rate at which the frame is going to be transmitted. 2130 * @rate: the rate at which the frame is going to be transmitted.
1894 * 2131 *
@@ -1903,7 +2140,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1903/** 2140/**
1904 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames 2141 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
1905 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2142 * @hw: pointer as obtained from ieee80211_alloc_hw().
1906 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2143 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1907 * 2144 *
1908 * Function for accessing buffered broadcast and multicast frames. If 2145 * Function for accessing buffered broadcast and multicast frames. If
1909 * hardware/firmware does not implement buffering of broadcast/multicast 2146 * hardware/firmware does not implement buffering of broadcast/multicast
@@ -2071,7 +2308,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2071 2308
2072/** 2309/**
2073 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. 2310 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
2074 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2311 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2075 * @ra: receiver address of the BA session recipient. 2312 * @ra: receiver address of the BA session recipient.
2076 * @tid: the TID to BA on. 2313 * @tid: the TID to BA on.
2077 * 2314 *
@@ -2082,7 +2319,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
2082 2319
2083/** 2320/**
2084 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. 2321 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
2085 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2322 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2086 * @ra: receiver address of the BA session recipient. 2323 * @ra: receiver address of the BA session recipient.
2087 * @tid: the TID to BA on. 2324 * @tid: the TID to BA on.
2088 * 2325 *
@@ -2110,7 +2347,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
2110 2347
2111/** 2348/**
2112 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. 2349 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
2113 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2350 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2114 * @ra: receiver address of the BA session recipient. 2351 * @ra: receiver address of the BA session recipient.
2115 * @tid: the desired TID to BA on. 2352 * @tid: the desired TID to BA on.
2116 * 2353 *
@@ -2121,7 +2358,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2121 2358
2122/** 2359/**
2123 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. 2360 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
2124 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2361 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2125 * @ra: receiver address of the BA session recipient. 2362 * @ra: receiver address of the BA session recipient.
2126 * @tid: the desired TID to BA on. 2363 * @tid: the desired TID to BA on.
2127 * 2364 *
@@ -2200,14 +2437,54 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
2200/** 2437/**
2201 * ieee80211_beacon_loss - inform hardware does not receive beacons 2438 * ieee80211_beacon_loss - inform hardware does not receive beacons
2202 * 2439 *
2203 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2440 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2204 * 2441 *
2205 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and 2442 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and
2206 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the 2443 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2207 * hardware is not receiving beacons with this function. 2444 * hardware is not receiving beacons with this function.
2208 */ 2445 */
2209void ieee80211_beacon_loss(struct ieee80211_vif *vif); 2446void ieee80211_beacon_loss(struct ieee80211_vif *vif);
2210 2447
2448/**
2449 * ieee80211_connection_loss - inform hardware has lost connection to the AP
2450 *
2451 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2452 *
2453 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and
2454 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
2455 * needs to inform if the connection to the AP has been lost.
2456 *
2457 * This function will cause immediate change to disassociated state,
2458 * without connection recovery attempts.
2459 */
2460void ieee80211_connection_loss(struct ieee80211_vif *vif);
2461
2462/**
2463 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
2464 * rssi threshold triggered
2465 *
2466 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2467 * @rssi_event: the RSSI trigger event type
2468 * @gfp: context flags
2469 *
2470 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality
2471 * monitoring is configured with an rssi threshold, the driver will inform
2472 * whenever the rssi level reaches the threshold.
2473 */
2474void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
2475 enum nl80211_cqm_rssi_threshold_event rssi_event,
2476 gfp_t gfp);
2477
2478/**
2479 * ieee80211_chswitch_done - Complete channel switch process
2480 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2481 * @success: make the channel switch successful or not
2482 *
2483 * Complete the channel switch post-process: set the new operational channel
2484 * and wake up the suspended queues.
2485 */
2486void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
2487
2211/* Rate control API */ 2488/* Rate control API */
2212 2489
2213/** 2490/**
@@ -2234,8 +2511,12 @@ enum rate_control_changed {
2234 * @short_preamble: whether mac80211 will request short-preamble transmission 2511 * @short_preamble: whether mac80211 will request short-preamble transmission
2235 * if the selected rate supports it 2512 * if the selected rate supports it
2236 * @max_rate_idx: user-requested maximum rate (not MCS for now) 2513 * @max_rate_idx: user-requested maximum rate (not MCS for now)
2514 * (deprecated; this will be removed once drivers get updated to use
2515 * rate_idx_mask)
2516 * @rate_idx_mask: user-requested rate mask (not MCS for now)
2237 * @skb: the skb that will be transmitted, the control information in it needs 2517 * @skb: the skb that will be transmitted, the control information in it needs
2238 * to be filled in 2518 * to be filled in
2519 * @ap: whether this frame is sent out in AP mode
2239 */ 2520 */
2240struct ieee80211_tx_rate_control { 2521struct ieee80211_tx_rate_control {
2241 struct ieee80211_hw *hw; 2522 struct ieee80211_hw *hw;
@@ -2245,6 +2526,8 @@ struct ieee80211_tx_rate_control {
2245 struct ieee80211_tx_rate reported_rate; 2526 struct ieee80211_tx_rate reported_rate;
2246 bool rts, short_preamble; 2527 bool rts, short_preamble;
2247 u8 max_rate_idx; 2528 u8 max_rate_idx;
2529 u32 rate_idx_mask;
2530 bool ap;
2248}; 2531};
2249 2532
2250struct rate_control_ops { 2533struct rate_control_ops {
@@ -2258,7 +2541,8 @@ struct rate_control_ops {
2258 struct ieee80211_sta *sta, void *priv_sta); 2541 struct ieee80211_sta *sta, void *priv_sta);
2259 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, 2542 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2260 struct ieee80211_sta *sta, 2543 struct ieee80211_sta *sta,
2261 void *priv_sta, u32 changed); 2544 void *priv_sta, u32 changed,
2545 enum nl80211_channel_type oper_chan_type);
2262 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2546 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
2263 void *priv_sta); 2547 void *priv_sta);
2264 2548
diff --git a/include/net/mld.h b/include/net/mld.h
new file mode 100644
index 000000000000..467143cd4e2f
--- /dev/null
+++ b/include/net/mld.h
@@ -0,0 +1,75 @@
1#ifndef LINUX_MLD_H
2#define LINUX_MLD_H
3
4#include <linux/in6.h>
5#include <linux/icmpv6.h>
6
7/* MLDv1 Query/Report/Done */
8struct mld_msg {
9 struct icmp6hdr mld_hdr;
10 struct in6_addr mld_mca;
11};
12
13#define mld_type mld_hdr.icmp6_type
14#define mld_code mld_hdr.icmp6_code
15#define mld_cksum mld_hdr.icmp6_cksum
16#define mld_maxdelay mld_hdr.icmp6_maxdelay
17#define mld_reserved mld_hdr.icmp6_dataun.un_data16[1]
18
19/* Multicast Listener Discovery version 2 headers */
20/* MLDv2 Report */
21struct mld2_grec {
22 __u8 grec_type;
23 __u8 grec_auxwords;
24 __be16 grec_nsrcs;
25 struct in6_addr grec_mca;
26 struct in6_addr grec_src[0];
27};
28
29struct mld2_report {
30 struct icmp6hdr mld2r_hdr;
31 struct mld2_grec mld2r_grec[0];
32};
33
34#define mld2r_type mld2r_hdr.icmp6_type
35#define mld2r_resv1 mld2r_hdr.icmp6_code
36#define mld2r_cksum mld2r_hdr.icmp6_cksum
37#define mld2r_resv2 mld2r_hdr.icmp6_dataun.un_data16[0]
38#define mld2r_ngrec mld2r_hdr.icmp6_dataun.un_data16[1]
39
40/* MLDv2 Query */
41struct mld2_query {
42 struct icmp6hdr mld2q_hdr;
43 struct in6_addr mld2q_mca;
44#if defined(__LITTLE_ENDIAN_BITFIELD)
45 __u8 mld2q_qrv:3,
46 mld2q_suppress:1,
47 mld2q_resv2:4;
48#elif defined(__BIG_ENDIAN_BITFIELD)
49 __u8 mld2q_resv2:4,
50 mld2q_suppress:1,
51 mld2q_qrv:3;
52#else
53#error "Please fix <asm/byteorder.h>"
54#endif
55 __u8 mld2q_qqic;
56 __be16 mld2q_nsrcs;
57 struct in6_addr mld2q_srcs[0];
58};
59
60#define mld2q_type mld2q_hdr.icmp6_type
61#define mld2q_code mld2q_hdr.icmp6_code
62#define mld2q_cksum mld2q_hdr.icmp6_cksum
63#define mld2q_mrc mld2q_hdr.icmp6_maxdelay
64#define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1]
65
66/* Max Response Code */
67#define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
68#define MLDV2_EXP(thresh, nbmant, nbexp, value) \
69 ((value) < (thresh) ? (value) : \
70 ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \
71 (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp))))
72
73#define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value)
74
75#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index b0173202cad9..eb21340a573b 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -164,7 +164,7 @@ struct neigh_table {
164 rwlock_t lock; 164 rwlock_t lock;
165 unsigned long last_rand; 165 unsigned long last_rand;
166 struct kmem_cache *kmem_cachep; 166 struct kmem_cache *kmem_cachep;
167 struct neigh_statistics *stats; 167 struct neigh_statistics __percpu *stats;
168 struct neighbour **hash_buckets; 168 struct neighbour **hash_buckets;
169 unsigned int hash_mask; 169 unsigned int hash_mask;
170 __u32 hash_rnd; 170 __u32 hash_rnd;
@@ -251,7 +251,6 @@ extern void neigh_seq_stop(struct seq_file *, void *);
251 251
252extern int neigh_sysctl_register(struct net_device *dev, 252extern int neigh_sysctl_register(struct net_device *dev,
253 struct neigh_parms *p, 253 struct neigh_parms *p,
254 int p_id, int pdev_id,
255 char *p_name, 254 char *p_name,
256 proc_handler *proc_handler); 255 proc_handler *proc_handler);
257extern void neigh_sysctl_unregister(struct neigh_parms *p); 256extern void neigh_sysctl_unregister(struct neigh_parms *p);
@@ -300,6 +299,20 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
300 return 0; 299 return 0;
301} 300}
302 301
302#ifdef CONFIG_BRIDGE_NETFILTER
303static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
304{
305 unsigned seq, hh_alen;
306
307 do {
308 seq = read_seqbegin(&hh->hh_lock);
309 hh_alen = HH_DATA_ALIGN(ETH_HLEN);
310 memcpy(skb->data - hh_alen, hh->hh_data, ETH_ALEN + hh_alen - ETH_HLEN);
311 } while (read_seqretry(&hh->hh_lock, seq));
312 return 0;
313}
314#endif
315
303static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 316static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
304{ 317{
305 unsigned seq; 318 unsigned seq;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index f307e133d14c..bd10a7908993 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -81,6 +81,8 @@ struct net {
81#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 81#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
82 struct netns_ct ct; 82 struct netns_ct ct;
83#endif 83#endif
84 struct sock *nfnl;
85 struct sock *nfnl_stash;
84#endif 86#endif
85#ifdef CONFIG_XFRM 87#ifdef CONFIG_XFRM
86 struct netns_xfrm xfrm; 88 struct netns_xfrm xfrm;
@@ -98,14 +100,9 @@ struct net {
98extern struct net init_net; 100extern struct net init_net;
99 101
100#ifdef CONFIG_NET 102#ifdef CONFIG_NET
101#define INIT_NET_NS(net_ns) .net_ns = &init_net,
102
103extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); 103extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns);
104 104
105#else /* CONFIG_NET */ 105#else /* CONFIG_NET */
106
107#define INIT_NET_NS(net_ns)
108
109static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) 106static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
110{ 107{
111 /* There is nothing to copy so this is a noop */ 108 /* There is nothing to copy so this is a noop */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index a0904adfb8f7..bde095f7e845 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -70,7 +70,7 @@ union nf_conntrack_help {
70struct nf_conntrack_helper; 70struct nf_conntrack_helper;
71 71
72/* Must be kept in sync with the classes defined by helpers */ 72/* Must be kept in sync with the classes defined by helpers */
73#define NF_CT_MAX_EXPECT_CLASSES 3 73#define NF_CT_MAX_EXPECT_CLASSES 4
74 74
75/* nf_conn feature for connections that have a helper */ 75/* nf_conn feature for connections that have a helper */
76struct nf_conn_help { 76struct nf_conn_help {
@@ -198,7 +198,8 @@ extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int null
198extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); 198extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);
199 199
200extern struct nf_conntrack_tuple_hash * 200extern struct nf_conntrack_tuple_hash *
201__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 201__nf_conntrack_find(struct net *net, u16 zone,
202 const struct nf_conntrack_tuple *tuple);
202 203
203extern void nf_conntrack_hash_insert(struct nf_conn *ct); 204extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204extern void nf_ct_delete_from_lists(struct nf_conn *ct); 205extern void nf_ct_delete_from_lists(struct nf_conn *ct);
@@ -267,11 +268,16 @@ extern void
267nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); 268nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data);
268extern void nf_conntrack_free(struct nf_conn *ct); 269extern void nf_conntrack_free(struct nf_conn *ct);
269extern struct nf_conn * 270extern struct nf_conn *
270nf_conntrack_alloc(struct net *net, 271nf_conntrack_alloc(struct net *net, u16 zone,
271 const struct nf_conntrack_tuple *orig, 272 const struct nf_conntrack_tuple *orig,
272 const struct nf_conntrack_tuple *repl, 273 const struct nf_conntrack_tuple *repl,
273 gfp_t gfp); 274 gfp_t gfp);
274 275
276static inline int nf_ct_is_template(const struct nf_conn *ct)
277{
278 return test_bit(IPS_TEMPLATE_BIT, &ct->status);
279}
280
275/* It's confirmed if it is, or has been in the hash table. */ 281/* It's confirmed if it is, or has been in the hash table. */
276static inline int nf_ct_is_confirmed(struct nf_conn *ct) 282static inline int nf_ct_is_confirmed(struct nf_conn *ct)
277{ 283{
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 5a449b44ba33..3d7524fba194 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -49,7 +49,8 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 49
50/* Find a connection corresponding to a tuple. */ 50/* Find a connection corresponding to a tuple. */
51extern struct nf_conntrack_tuple_hash * 51extern struct nf_conntrack_tuple_hash *
52nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); 52nf_conntrack_find_get(struct net *net, u16 zone,
53 const struct nf_conntrack_tuple *tuple);
53 54
54extern int __nf_conntrack_confirm(struct sk_buff *skb); 55extern int __nf_conntrack_confirm(struct sk_buff *skb);
55 56
@@ -60,7 +61,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
60 int ret = NF_ACCEPT; 61 int ret = NF_ACCEPT;
61 62
62 if (ct && ct != &nf_conntrack_untracked) { 63 if (ct && ct != &nf_conntrack_untracked) {
63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 64 if (!nf_ct_is_confirmed(ct))
64 ret = __nf_conntrack_confirm(skb); 65 ret = __nf_conntrack_confirm(skb);
65 if (likely(ret == NF_ACCEPT)) 66 if (likely(ret == NF_ACCEPT))
66 nf_ct_deliver_cached_events(ct); 67 nf_ct_deliver_cached_events(ct);
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 475facc3051a..96ba5f7dcab6 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -12,27 +12,12 @@
12#include <linux/netfilter/nf_conntrack_tuple_common.h> 12#include <linux/netfilter/nf_conntrack_tuple_common.h>
13#include <net/netfilter/nf_conntrack_extend.h> 13#include <net/netfilter/nf_conntrack_extend.h>
14 14
15/* Connection tracking event types */
16enum ip_conntrack_events {
17 IPCT_NEW = 0, /* new conntrack */
18 IPCT_RELATED = 1, /* related conntrack */
19 IPCT_DESTROY = 2, /* destroyed conntrack */
20 IPCT_STATUS = 3, /* status has changed */
21 IPCT_PROTOINFO = 4, /* protocol information has changed */
22 IPCT_HELPER = 5, /* new helper has been set */
23 IPCT_MARK = 6, /* new mark has been set */
24 IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */
25 IPCT_SECMARK = 8, /* new security mark has been set */
26};
27
28enum ip_conntrack_expect_events {
29 IPEXP_NEW = 0, /* new expectation */
30};
31
32struct nf_conntrack_ecache { 15struct nf_conntrack_ecache {
33 unsigned long cache; /* bitops want long */ 16 unsigned long cache; /* bitops want long */
34 unsigned long missed; /* missed events */ 17 unsigned long missed; /* missed events */
35 u32 pid; /* netlink pid of destroyer */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 pid; /* netlink pid of destroyer */
36}; 21};
37 22
38static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
@@ -42,14 +27,24 @@ nf_ct_ecache_find(const struct nf_conn *ct)
42} 27}
43 28
44static inline struct nf_conntrack_ecache * 29static inline struct nf_conntrack_ecache *
45nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp) 30nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
46{ 31{
47 struct net *net = nf_ct_net(ct); 32 struct net *net = nf_ct_net(ct);
33 struct nf_conntrack_ecache *e;
48 34
49 if (!net->ct.sysctl_events) 35 if (!ctmask && !expmask && net->ct.sysctl_events) {
36 ctmask = ~0;
37 expmask = ~0;
38 }
39 if (!ctmask && !expmask)
50 return NULL; 40 return NULL;
51 41
52 return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); 42 e = nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp);
43 if (e) {
44 e->ctmask = ctmask;
45 e->expmask = expmask;
46 }
47 return e;
53}; 48};
54 49
55#ifdef CONFIG_NF_CONNTRACK_EVENTS 50#ifdef CONFIG_NF_CONNTRACK_EVENTS
@@ -82,6 +77,9 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
82 if (e == NULL) 77 if (e == NULL)
83 return; 78 return;
84 79
80 if (!(e->ctmask & (1 << event)))
81 return;
82
85 set_bit(event, &e->cache); 83 set_bit(event, &e->cache);
86} 84}
87 85
@@ -92,7 +90,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
92 int report) 90 int report)
93{ 91{
94 int ret = 0; 92 int ret = 0;
95 struct net *net = nf_ct_net(ct);
96 struct nf_ct_event_notifier *notify; 93 struct nf_ct_event_notifier *notify;
97 struct nf_conntrack_ecache *e; 94 struct nf_conntrack_ecache *e;
98 95
@@ -101,9 +98,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
101 if (notify == NULL) 98 if (notify == NULL)
102 goto out_unlock; 99 goto out_unlock;
103 100
104 if (!net->ct.sysctl_events)
105 goto out_unlock;
106
107 e = nf_ct_ecache_find(ct); 101 e = nf_ct_ecache_find(ct);
108 if (e == NULL) 102 if (e == NULL)
109 goto out_unlock; 103 goto out_unlock;
@@ -117,6 +111,9 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
117 /* This is a resent of a destroy event? If so, skip missed */ 111 /* This is a resent of a destroy event? If so, skip missed */
118 unsigned long missed = e->pid ? 0 : e->missed; 112 unsigned long missed = e->pid ? 0 : e->missed;
119 113
114 if (!((eventmask | missed) & e->ctmask))
115 goto out_unlock;
116
120 ret = notify->fcn(eventmask | missed, &item); 117 ret = notify->fcn(eventmask | missed, &item);
121 if (unlikely(ret < 0 || missed)) { 118 if (unlikely(ret < 0 || missed)) {
122 spin_lock_bh(&ct->lock); 119 spin_lock_bh(&ct->lock);
@@ -172,18 +169,19 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
172 u32 pid, 169 u32 pid,
173 int report) 170 int report)
174{ 171{
175 struct net *net = nf_ct_exp_net(exp);
176 struct nf_exp_event_notifier *notify; 172 struct nf_exp_event_notifier *notify;
173 struct nf_conntrack_ecache *e;
177 174
178 rcu_read_lock(); 175 rcu_read_lock();
179 notify = rcu_dereference(nf_expect_event_cb); 176 notify = rcu_dereference(nf_expect_event_cb);
180 if (notify == NULL) 177 if (notify == NULL)
181 goto out_unlock; 178 goto out_unlock;
182 179
183 if (!net->ct.sysctl_events) 180 e = nf_ct_ecache_find(exp->master);
181 if (e == NULL)
184 goto out_unlock; 182 goto out_unlock;
185 183
186 { 184 if (e->expmask & (1 << event)) {
187 struct nf_exp_event item = { 185 struct nf_exp_event item = {
188 .exp = exp, 186 .exp = exp,
189 .pid = pid, 187 .pid = pid,
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 9a2b9cb52271..11e815084fcf 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -56,16 +56,13 @@ struct nf_conntrack_expect {
56 56
57static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) 57static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
58{ 58{
59#ifdef CONFIG_NET_NS 59 return nf_ct_net(exp->master);
60 return exp->master->ct_net; /* by definition */
61#else
62 return &init_net;
63#endif
64} 60}
65 61
66struct nf_conntrack_expect_policy { 62struct nf_conntrack_expect_policy {
67 unsigned int max_expected; 63 unsigned int max_expected;
68 unsigned int timeout; 64 unsigned int timeout;
65 const char *name;
69}; 66};
70 67
71#define NF_CT_EXPECT_CLASS_DEFAULT 0 68#define NF_CT_EXPECT_CLASS_DEFAULT 0
@@ -77,13 +74,16 @@ int nf_conntrack_expect_init(struct net *net);
77void nf_conntrack_expect_fini(struct net *net); 74void nf_conntrack_expect_fini(struct net *net);
78 75
79struct nf_conntrack_expect * 76struct nf_conntrack_expect *
80__nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple); 77__nf_ct_expect_find(struct net *net, u16 zone,
78 const struct nf_conntrack_tuple *tuple);
81 79
82struct nf_conntrack_expect * 80struct nf_conntrack_expect *
83nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); 81nf_ct_expect_find_get(struct net *net, u16 zone,
82 const struct nf_conntrack_tuple *tuple);
84 83
85struct nf_conntrack_expect * 84struct nf_conntrack_expect *
86nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple); 85nf_ct_find_expectation(struct net *net, u16 zone,
86 const struct nf_conntrack_tuple *tuple);
87 87
88void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); 88void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
89void nf_ct_remove_expectations(struct nf_conn *ct); 89void nf_ct_remove_expectations(struct nf_conn *ct);
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index e192dc17c583..32d15bd6efa3 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -1,6 +1,8 @@
1#ifndef _NF_CONNTRACK_EXTEND_H 1#ifndef _NF_CONNTRACK_EXTEND_H
2#define _NF_CONNTRACK_EXTEND_H 2#define _NF_CONNTRACK_EXTEND_H
3 3
4#include <linux/slab.h>
5
4#include <net/netfilter/nf_conntrack.h> 6#include <net/netfilter/nf_conntrack.h>
5 7
6enum nf_ct_ext_id { 8enum nf_ct_ext_id {
@@ -8,6 +10,7 @@ enum nf_ct_ext_id {
8 NF_CT_EXT_NAT, 10 NF_CT_EXT_NAT,
9 NF_CT_EXT_ACCT, 11 NF_CT_EXT_ACCT,
10 NF_CT_EXT_ECACHE, 12 NF_CT_EXT_ECACHE,
13 NF_CT_EXT_ZONE,
11 NF_CT_EXT_NUM, 14 NF_CT_EXT_NUM,
12}; 15};
13 16
@@ -15,6 +18,7 @@ enum nf_ct_ext_id {
15#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 18#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
16#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 19#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
17#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 20#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
21#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
18 22
19/* Extensions: optional stuff which isn't permanently in struct. */ 23/* Extensions: optional stuff which isn't permanently in struct. */
20struct nf_ct_ext { 24struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index d015de92e03f..32c305dbdab6 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -40,14 +40,18 @@ struct nf_conntrack_helper {
40}; 40};
41 41
42extern struct nf_conntrack_helper * 42extern struct nf_conntrack_helper *
43__nf_conntrack_helper_find_byname(const char *name); 43__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum);
44
45extern struct nf_conntrack_helper *
46nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum);
44 47
45extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 48extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
46extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 49extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
47 50
48extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 51extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
49 52
50extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); 53extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
54 gfp_t flags);
51 55
52extern void nf_ct_helper_destroy(struct nf_conn *ct); 56extern void nf_ct_helper_destroy(struct nf_conn *ct);
53 57
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index ca6dcf3445ab..e3d3ee3c06a2 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -49,8 +49,8 @@ struct nf_conntrack_l4proto {
49 /* Called when a conntrack entry is destroyed */ 49 /* Called when a conntrack entry is destroyed */
50 void (*destroy)(struct nf_conn *ct); 50 void (*destroy)(struct nf_conn *ct);
51 51
52 int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, 52 int (*error)(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
53 enum ip_conntrack_info *ctinfo, 53 unsigned int dataoff, enum ip_conntrack_info *ctinfo,
54 u_int8_t pf, unsigned int hooknum); 54 u_int8_t pf, unsigned int hooknum);
55 55
56 /* Print out the per-protocol part of the tuple. Return like seq_* */ 56 /* Print out the per-protocol part of the tuple. Return like seq_* */
diff --git a/include/net/netfilter/nf_conntrack_zones.h b/include/net/netfilter/nf_conntrack_zones.h
new file mode 100644
index 000000000000..034efe8d45a5
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_zones.h
@@ -0,0 +1,25 @@
1#ifndef _NF_CONNTRACK_ZONES_H
2#define _NF_CONNTRACK_ZONES_H
3
4#define NF_CT_DEFAULT_ZONE 0
5
6#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
7#include <net/netfilter/nf_conntrack_extend.h>
8
9struct nf_conntrack_zone {
10 u16 id;
11};
12
13static inline u16 nf_ct_zone(const struct nf_conn *ct)
14{
15#ifdef CONFIG_NF_CONNTRACK_ZONES
16 struct nf_conntrack_zone *nf_ct_zone;
17 nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE);
18 if (nf_ct_zone)
19 return nf_ct_zone->id;
20#endif
21 return NF_CT_DEFAULT_ZONE;
22}
23
24#endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */
25#endif /* _NF_CONNTRACK_ZONES_H */
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 4222220920a5..02bb6c29dc3d 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,13 +7,27 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11 struct nf_conn *ct, 11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo, 12 enum ip_conntrack_info ctinfo,
13 unsigned int match_offset, 13 unsigned int match_offset,
14 unsigned int match_len, 14 unsigned int match_len,
15 const char *rep_buffer, 15 const char *rep_buffer,
16 unsigned int rep_len); 16 unsigned int rep_len, bool adjust);
17
18static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
19 struct nf_conn *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len)
25{
26 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
27 match_offset, match_len,
28 rep_buffer, rep_len, true);
29}
30
17extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 31extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
18 struct nf_conn *ct, 32 struct nf_conn *ct,
19 enum ip_conntrack_info ctinfo, 33 enum ip_conntrack_info ctinfo,
@@ -21,6 +35,10 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
21 unsigned int match_len, 35 unsigned int match_len,
22 const char *rep_buffer, 36 const char *rep_buffer,
23 unsigned int rep_len); 37 unsigned int rep_len);
38
39extern void nf_nat_set_seq_adjust(struct nf_conn *ct,
40 enum ip_conntrack_info ctinfo,
41 __be32 seq, s16 off);
24extern int nf_nat_seq_adjust(struct sk_buff *skb, 42extern int nf_nat_seq_adjust(struct sk_buff *skb,
25 struct nf_conn *ct, 43 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo); 44 enum ip_conntrack_info ctinfo);
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 60ebbc1fef46..9db401a8b4d9 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -31,6 +31,7 @@
31#define _NETLABEL_H 31#define _NETLABEL_H
32 32
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/slab.h>
34#include <linux/net.h> 35#include <linux/net.h>
35#include <linux/skbuff.h> 36#include <linux/skbuff.h>
36#include <linux/in.h> 37#include <linux/in.h>
diff --git a/include/net/netlink.h b/include/net/netlink.h
index a63b2192ac1c..4fc05b58503e 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -196,7 +196,7 @@ enum {
196 * All other Exact length of attribute payload 196 * All other Exact length of attribute payload
197 * 197 *
198 * Example: 198 * Example:
199 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 199 * static const struct nla_policy my_policy[ATTR_MAX+1] = {
200 * [ATTR_FOO] = { .type = NLA_U16 }, 200 * [ATTR_FOO] = { .type = NLA_U16 },
201 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, 201 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
202 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 202 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
@@ -945,7 +945,11 @@ static inline u64 nla_get_u64(const struct nlattr *nla)
945 */ 945 */
946static inline __be64 nla_get_be64(const struct nlattr *nla) 946static inline __be64 nla_get_be64(const struct nlattr *nla)
947{ 947{
948 return *(__be64 *) nla_data(nla); 948 __be64 tmp;
949
950 nla_memcpy(&tmp, nla, sizeof(tmp));
951
952 return tmp;
949} 953}
950 954
951/** 955/**
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index ba1ba0c5efd1..d4958d4c6574 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -11,11 +11,13 @@ struct nf_conntrack_ecache;
11struct netns_ct { 11struct netns_ct {
12 atomic_t count; 12 atomic_t count;
13 unsigned int expect_count; 13 unsigned int expect_count;
14 unsigned int htable_size;
15 struct kmem_cache *nf_conntrack_cachep;
14 struct hlist_nulls_head *hash; 16 struct hlist_nulls_head *hash;
15 struct hlist_head *expect_hash; 17 struct hlist_head *expect_hash;
16 struct hlist_nulls_head unconfirmed; 18 struct hlist_nulls_head unconfirmed;
17 struct hlist_nulls_head dying; 19 struct hlist_nulls_head dying;
18 struct ip_conntrack_stat *stat; 20 struct ip_conntrack_stat __percpu *stat;
19 int sysctl_events; 21 int sysctl_events;
20 unsigned int sysctl_events_retry_timeout; 22 unsigned int sysctl_events_retry_timeout;
21 int sysctl_acct; 23 int sysctl_acct;
@@ -28,5 +30,6 @@ struct netns_ct {
28#endif 30#endif
29 int hash_vmalloc; 31 int hash_vmalloc;
30 int expect_vmalloc; 32 int expect_vmalloc;
33 char *slabname;
31}; 34};
32#endif 35#endif
diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 24d4be76bbd1..78eb1ff75475 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -10,7 +10,7 @@ struct netns_core {
10 10
11 int sysctl_somaxconn; 11 int sysctl_somaxconn;
12 12
13 struct prot_inuse *inuse; 13 struct prot_inuse __percpu *inuse;
14}; 14};
15 15
16#endif 16#endif
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index ff4982ab84b6..81a31c0db3e7 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -14,11 +14,8 @@
14 * The rules are simple: 14 * The rules are simple:
15 * 1. set pernet_operations->id. After register_pernet_device you 15 * 1. set pernet_operations->id. After register_pernet_device you
16 * will have the id of your private pointer. 16 * will have the id of your private pointer.
17 * 2. Either set pernet_operations->size (to have the code allocate and 17 * 2. set pernet_operations->size to have the code allocate and free
18 * free a private structure pointed to from struct net ) or 18 * a private structure pointed to from struct net.
19 * call net_assign_generic() to put the private data on the struct
20 * net (most preferably this should be done in the ->init callback
21 * of the ops registered);
22 * 3. do not change this pointer while the net is alive; 19 * 3. do not change this pointer while the net is alive;
23 * 4. do not try to have any private reference on the net_generic object. 20 * 4. do not try to have any private reference on the net_generic object.
24 * 21 *
@@ -46,6 +43,4 @@ static inline void *net_generic(struct net *net, int id)
46 43
47 return ptr; 44 return ptr;
48} 45}
49
50extern int net_assign_generic(struct net *net, int id, void *data);
51#endif 46#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2eb3814d6258..d68c3f121774 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -37,9 +37,12 @@ struct netns_ipv4 {
37 struct xt_table *iptable_mangle; 37 struct xt_table *iptable_mangle;
38 struct xt_table *iptable_raw; 38 struct xt_table *iptable_raw;
39 struct xt_table *arptable_filter; 39 struct xt_table *arptable_filter;
40#ifdef CONFIG_SECURITY
40 struct xt_table *iptable_security; 41 struct xt_table *iptable_security;
42#endif
41 struct xt_table *nat_table; 43 struct xt_table *nat_table;
42 struct hlist_head *nat_bysource; 44 struct hlist_head *nat_bysource;
45 unsigned int nat_htable_size;
43 int nat_vmalloced; 46 int nat_vmalloced;
44#endif 47#endif
45 48
@@ -52,19 +55,14 @@ struct netns_ipv4 {
52 int sysctl_rt_cache_rebuild_count; 55 int sysctl_rt_cache_rebuild_count;
53 int current_rt_cache_rebuild_count; 56 int current_rt_cache_rebuild_count;
54 57
55 struct timer_list rt_secret_timer;
56 atomic_t rt_genid; 58 atomic_t rt_genid;
57 59
58#ifdef CONFIG_IP_MROUTE 60#ifdef CONFIG_IP_MROUTE
59 struct sock *mroute_sk; 61#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
60 struct mfc_cache **mfc_cache_array; 62 struct mr_table *mrt;
61 struct vif_device *vif_table; 63#else
62 int maxvif; 64 struct list_head mr_tables;
63 atomic_t cache_resolve_queue_len; 65 struct fib_rules_ops *mr_rules_ops;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
67 int mroute_reg_vif_num;
68#endif 66#endif
69#endif 67#endif
70}; 68};
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index dfeb2d7c425b..81abfcb2eb4e 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -36,8 +36,10 @@ struct netns_ipv6 {
36 struct xt_table *ip6table_filter; 36 struct xt_table *ip6table_filter;
37 struct xt_table *ip6table_mangle; 37 struct xt_table *ip6table_mangle;
38 struct xt_table *ip6table_raw; 38 struct xt_table *ip6table_raw;
39#ifdef CONFIG_SECURITY
39 struct xt_table *ip6table_security; 40 struct xt_table *ip6table_security;
40#endif 41#endif
42#endif
41 struct rt6_info *ip6_null_entry; 43 struct rt6_info *ip6_null_entry;
42 struct rt6_statistics *rt6_stats; 44 struct rt6_statistics *rt6_stats;
43 struct timer_list ip6_fib_timer; 45 struct timer_list ip6_fib_timer;
@@ -57,15 +59,11 @@ struct netns_ipv6 {
57 struct sock *tcp_sk; 59 struct sock *tcp_sk;
58 struct sock *igmp_sk; 60 struct sock *igmp_sk;
59#ifdef CONFIG_IPV6_MROUTE 61#ifdef CONFIG_IPV6_MROUTE
60 struct sock *mroute6_sk; 62#ifndef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
61 struct mfc6_cache **mfc6_cache_array; 63 struct mr6_table *mrt6;
62 struct mif_device *vif6_table; 64#else
63 int maxvif; 65 struct list_head mr6_tables;
64 atomic_t cache_resolve_queue_len; 66 struct fib_rules_ops *mr6_rules_ops;
65 int mroute_do_assert;
66 int mroute_do_pim;
67#ifdef CONFIG_IPV6_PIMSM_V2
68 int mroute_reg_vif_num;
69#endif 67#endif
70#endif 68#endif
71}; 69};
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index 637daf698884..cb4e894c0f8d 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -4,11 +4,11 @@
4#ifndef __NETNS_PACKET_H__ 4#ifndef __NETNS_PACKET_H__
5#define __NETNS_PACKET_H__ 5#define __NETNS_PACKET_H__
6 6
7#include <linux/list.h> 7#include <linux/rculist.h>
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9 9
10struct netns_packet { 10struct netns_packet {
11 rwlock_t sklist_lock; 11 spinlock_t sklist_lock;
12 struct hlist_head sklist; 12 struct hlist_head sklist;
13}; 13};
14 14
diff --git a/include/net/netrom.h b/include/net/netrom.h
index ab170a60e7d3..f0793c1cb5f8 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/netrom.h> 10#include <linux/netrom.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/slab.h>
12#include <net/sock.h> 13#include <net/sock.h>
13 14
14#define NR_NETWORK_LEN 15 15#define NR_NETWORK_LEN 15
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index 4c61cdce4e5f..35672b1cf44a 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -44,6 +44,7 @@ struct pep_sock {
44 u8 rx_fc; /* RX flow control */ 44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */ 45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 46 u8 init_enable; /* auto-enable at creation */
47 u8 aligned;
47}; 48};
48 49
49static inline struct pep_sock *pep_sk(struct sock *sk) 50static inline struct pep_sock *pep_sk(struct sock *sk)
@@ -77,6 +78,7 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
77 78
78enum { 79enum {
79 PNS_PIPE_DATA = 0x20, 80 PNS_PIPE_DATA = 0x20,
81 PNS_PIPE_ALIGNED_DATA,
80 82
81 PNS_PEP_CONNECT_REQ = 0x40, 83 PNS_PEP_CONNECT_REQ = 0x40,
82 PNS_PEP_CONNECT_RESP, 84 PNS_PEP_CONNECT_RESP,
@@ -138,6 +140,7 @@ enum {
138 PN_PIPE_SB_NEGOTIATED_FC, 140 PN_PIPE_SB_NEGOTIATED_FC,
139 PN_PIPE_SB_REQUIRED_FC_TX, 141 PN_PIPE_SB_REQUIRED_FC_TX,
140 PN_PIPE_SB_PREFERRED_FC_RX, 142 PN_PIPE_SB_PREFERRED_FC_RX,
143 PN_PIPE_SB_ALIGNED_DATA,
141}; 144};
142 145
143/* Phonet pipe flow control models */ 146/* Phonet pipe flow control models */
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 2d567265363e..9d4d87cc970e 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -12,7 +12,7 @@ struct qdisc_walker {
12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); 12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
13}; 13};
14 14
15#define QDISC_ALIGNTO 32 15#define QDISC_ALIGNTO 64
16#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) 16#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
17 17
18static inline void *qdisc_priv(struct Qdisc *q) 18static inline void *qdisc_priv(struct Qdisc *q)
@@ -71,6 +71,7 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
71 71
72extern struct Qdisc_ops pfifo_qdisc_ops; 72extern struct Qdisc_ops pfifo_qdisc_ops;
73extern struct Qdisc_ops bfifo_qdisc_ops; 73extern struct Qdisc_ops bfifo_qdisc_ops;
74extern struct Qdisc_ops pfifo_head_drop_qdisc_ops;
74 75
75extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); 76extern int fifo_set_limit(struct Qdisc *q, unsigned int limit);
76extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, 77extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
diff --git a/include/net/raw.h b/include/net/raw.h
index 6c14a656357a..43c57502659b 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -19,6 +19,7 @@
19 19
20 20
21#include <net/protocol.h> 21#include <net/protocol.h>
22#include <linux/icmp.h>
22 23
23extern struct proto raw_prot; 24extern struct proto raw_prot;
24 25
@@ -56,4 +57,16 @@ int raw_seq_open(struct inode *ino, struct file *file,
56void raw_hash_sk(struct sock *sk); 57void raw_hash_sk(struct sock *sk);
57void raw_unhash_sk(struct sock *sk); 58void raw_unhash_sk(struct sock *sk);
58 59
60struct raw_sock {
61 /* inet_sock has to be the first member */
62 struct inet_sock inet;
63 struct icmp_filter filter;
64 u32 ipmr_table;
65};
66
67static inline struct raw_sock *raw_sk(const struct sock *sk)
68{
69 return (struct raw_sock *)sk;
70}
71
59#endif /* _RAW_H */ 72#endif /* _RAW_H */
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 47995b81c5d7..f873ee37f7e4 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -39,6 +39,7 @@ enum environment_cap {
39 * 00 - World regulatory domain 39 * 00 - World regulatory domain
40 * 99 - built by driver but a specific alpha2 cannot be determined 40 * 99 - built by driver but a specific alpha2 cannot be determined
41 * 98 - result of an intersection between two regulatory domains 41 * 98 - result of an intersection between two regulatory domains
42 * 97 - regulatory domain has not yet been configured
42 * @intersect: indicates whether the wireless core should intersect 43 * @intersect: indicates whether the wireless core should intersect
43 * the requested regulatory domain with the presently set regulatory 44 * the requested regulatory domain with the presently set regulatory
44 * domain. 45 * domain.
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index c9b50ebd9ce9..99e6e19b57c2 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -45,6 +45,8 @@ struct request_sock_ops {
45 void (*send_reset)(struct sock *sk, 45 void (*send_reset)(struct sock *sk,
46 struct sk_buff *skb); 46 struct sk_buff *skb);
47 void (*destructor)(struct request_sock *req); 47 void (*destructor)(struct request_sock *req);
48 void (*syn_ack_timeout)(struct sock *sk,
49 struct request_sock *req);
48}; 50};
49 51
50/* struct request_sock - mini sock to represent a connection request 52/* struct request_sock - mini sock to represent a connection request
diff --git a/include/net/route.h b/include/net/route.h
index bce6dd68d27b..af6cf4b4c9dc 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -101,7 +101,7 @@ struct rt_cache_stat {
101 unsigned int out_hlist_search; 101 unsigned int out_hlist_search;
102}; 102};
103 103
104extern struct ip_rt_acct *ip_rt_acct; 104extern struct ip_rt_acct __percpu *ip_rt_acct;
105 105
106struct in_device; 106struct in_device;
107extern int ip_rt_init(void); 107extern int ip_rt_init(void);
@@ -112,7 +112,22 @@ extern void rt_cache_flush_batch(void);
112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
115extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); 115
116extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
117 u8 tos, struct net_device *devin, bool noref);
118
119static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
120 u8 tos, struct net_device *devin)
121{
122 return ip_route_input_common(skb, dst, src, tos, devin, false);
123}
124
125static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
126 u8 tos, struct net_device *devin)
127{
128 return ip_route_input_common(skb, dst, src, tos, devin, true);
129}
130
116extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); 131extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
117extern void ip_rt_send_redirect(struct sk_buff *skb); 132extern void ip_rt_send_redirect(struct sk_buff *skb);
118 133
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 48d3efcb0880..af60fd050844 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -87,6 +87,8 @@ extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
87extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 87extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
88extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net, 88extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
89 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]); 89 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
90extern int rtnl_configure_link(struct net_device *dev,
91 const struct ifinfomsg *ifm);
90extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 92extern const struct nla_policy ifla_policy[IFLA_MAX+1];
91 93
92#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 94#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index dad558bc06fa..433604bb3fe8 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -73,6 +73,7 @@ struct Qdisc {
73 struct sk_buff_head q; 73 struct sk_buff_head q;
74 struct gnet_stats_basic_packed bstats; 74 struct gnet_stats_basic_packed bstats;
75 struct gnet_stats_queue qstats; 75 struct gnet_stats_queue qstats;
76 struct rcu_head rcu_head;
76}; 77};
77 78
78struct Qdisc_class_ops { 79struct Qdisc_class_ops {
@@ -312,12 +313,24 @@ extern void qdisc_calculate_pkt_len(struct sk_buff *skb,
312extern void tcf_destroy(struct tcf_proto *tp); 313extern void tcf_destroy(struct tcf_proto *tp);
313extern void tcf_destroy_chain(struct tcf_proto **fl); 314extern void tcf_destroy_chain(struct tcf_proto **fl);
314 315
315/* Reset all TX qdiscs of a device. */ 316/* Reset all TX qdiscs greater then index of a device. */
317static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i)
318{
319 struct Qdisc *qdisc;
320
321 for (; i < dev->num_tx_queues; i++) {
322 qdisc = netdev_get_tx_queue(dev, i)->qdisc;
323 if (qdisc) {
324 spin_lock_bh(qdisc_lock(qdisc));
325 qdisc_reset(qdisc);
326 spin_unlock_bh(qdisc_lock(qdisc));
327 }
328 }
329}
330
316static inline void qdisc_reset_all_tx(struct net_device *dev) 331static inline void qdisc_reset_all_tx(struct net_device *dev)
317{ 332{
318 unsigned int i; 333 qdisc_reset_all_tx_gt(dev, 0);
319 for (i = 0; i < dev->num_tx_queues; i++)
320 qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc);
321} 334}
322 335
323/* Are all TX queues of the device empty? */ 336/* Are all TX queues of the device empty? */
@@ -427,6 +440,25 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
427 return __qdisc_dequeue_head(sch, &sch->q); 440 return __qdisc_dequeue_head(sch, &sch->q);
428} 441}
429 442
443static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
444 struct sk_buff_head *list)
445{
446 struct sk_buff *skb = __qdisc_dequeue_head(sch, list);
447
448 if (likely(skb != NULL)) {
449 unsigned int len = qdisc_pkt_len(skb);
450 kfree_skb(skb);
451 return len;
452 }
453
454 return 0;
455}
456
457static inline unsigned int qdisc_queue_drop_head(struct Qdisc *sch)
458{
459 return __qdisc_queue_drop_head(sch, &sch->q);
460}
461
430static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, 462static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
431 struct sk_buff_head *list) 463 struct sk_buff_head *list)
432{ 464{
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 8be5135ff7aa..2c55a7ea20af 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -107,6 +107,7 @@ typedef enum {
107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ 107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ 108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
109 SCTP_CMD_SEND_MSG, /* Send the whole use message */ 109 SCTP_CMD_SEND_MSG, /* Send the whole use message */
110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
110 SCTP_CMD_LAST 111 SCTP_CMD_LAST
111} sctp_verb_t; 112} sctp_verb_t;
112 113
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 78740ec57d5d..65946bc43d00 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
128int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 128int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
129int sctp_inet_listen(struct socket *sock, int backlog); 129int sctp_inet_listen(struct socket *sock, int backlog);
130void sctp_write_space(struct sock *sk); 130void sctp_write_space(struct sock *sk);
131void sctp_data_ready(struct sock *sk, int len);
131unsigned int sctp_poll(struct file *file, struct socket *sock, 132unsigned int sctp_poll(struct file *file, struct socket *sock,
132 poll_table *wait); 133 poll_table *wait);
133void sctp_sock_rfree(struct sk_buff *skb); 134void sctp_sock_rfree(struct sk_buff *skb);
@@ -268,7 +269,7 @@ enum {
268#define SCTP_MIB_MAX __SCTP_MIB_MAX 269#define SCTP_MIB_MAX __SCTP_MIB_MAX
269struct sctp_mib { 270struct sctp_mib {
270 unsigned long mibs[SCTP_MIB_MAX]; 271 unsigned long mibs[SCTP_MIB_MAX];
271} __SNMP_MIB_ALIGN__; 272};
272 273
273 274
274/* Print debugging messages. */ 275/* Print debugging messages. */
@@ -546,7 +547,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
546#define WORD_ROUND(s) (((s)+3)&~3) 547#define WORD_ROUND(s) (((s)+3)&~3)
547 548
548/* Make a new instance of type. */ 549/* Make a new instance of type. */
549#define t_new(type, flags) (type *)kmalloc(sizeof(type), flags) 550#define t_new(type, flags) (type *)kzalloc(sizeof(type), flags)
550 551
551/* Compare two timevals. */ 552/* Compare two timevals. */
552#define tv_lt(s, t) \ 553#define tv_lt(s, t) \
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 851c813adb3a..4088c89a9055 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -279,6 +279,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
279/* 2nd level prototypes */ 279/* 2nd level prototypes */
280void sctp_generate_t3_rtx_event(unsigned long peer); 280void sctp_generate_t3_rtx_event(unsigned long peer);
281void sctp_generate_heartbeat_event(unsigned long peer); 281void sctp_generate_heartbeat_event(unsigned long peer);
282void sctp_generate_proto_unreach_event(unsigned long peer);
282 283
283void sctp_ootb_pkt_free(struct sctp_packet *); 284void sctp_ootb_pkt_free(struct sctp_packet *);
284 285
@@ -437,7 +438,7 @@ sctp_vtag_verify_either(const struct sctp_chunk *chunk,
437 */ 438 */
438 if ((!sctp_test_T_bit(chunk) && 439 if ((!sctp_test_T_bit(chunk) &&
439 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) || 440 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) ||
440 (sctp_test_T_bit(chunk) && 441 (sctp_test_T_bit(chunk) && asoc->c.peer_vtag &&
441 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) { 442 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) {
442 return 1; 443 return 1;
443 } 444 }
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ff3017744711..4b860116e096 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -643,17 +643,15 @@ struct sctp_pf {
643struct sctp_datamsg { 643struct sctp_datamsg {
644 /* Chunks waiting to be submitted to lower layer. */ 644 /* Chunks waiting to be submitted to lower layer. */
645 struct list_head chunks; 645 struct list_head chunks;
646 /* Chunks that have been transmitted. */
647 size_t msg_size;
648 /* Reference counting. */ 646 /* Reference counting. */
649 atomic_t refcnt; 647 atomic_t refcnt;
650 /* When is this message no longer interesting to the peer? */ 648 /* When is this message no longer interesting to the peer? */
651 unsigned long expires_at; 649 unsigned long expires_at;
652 /* Did the messenge fail to send? */ 650 /* Did the messenge fail to send? */
653 int send_error; 651 int send_error;
654 char send_failed; 652 u8 send_failed:1,
655 /* Control whether chunks from this message can be abandoned. */ 653 can_abandon:1, /* can chunks from this message can be abandoned. */
656 char can_abandon; 654 can_delay; /* should this message be Nagle delayed */
657}; 655};
658 656
659struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 657struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
@@ -757,7 +755,6 @@ struct sctp_chunk {
757#define SCTP_NEED_FRTX 0x1 755#define SCTP_NEED_FRTX 0x1
758#define SCTP_DONT_FRTX 0x2 756#define SCTP_DONT_FRTX 0x2
759 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ 757 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
760 resent:1, /* Has this chunk ever been resent. */
761 has_tsn:1, /* Does this chunk have a TSN yet? */ 758 has_tsn:1, /* Does this chunk have a TSN yet? */
762 has_ssn:1, /* Does this chunk have a SSN yet? */ 759 has_ssn:1, /* Does this chunk have a SSN yet? */
763 singleton:1, /* Only chunk in the packet? */ 760 singleton:1, /* Only chunk in the packet? */
@@ -778,6 +775,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,
778 struct iovec *data); 775 struct iovec *data);
779void sctp_chunk_free(struct sctp_chunk *); 776void sctp_chunk_free(struct sctp_chunk *);
780void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 777void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
778void *sctp_addto_chunk_fixed(struct sctp_chunk *, int len, const void *data);
781struct sctp_chunk *sctp_chunkify(struct sk_buff *, 779struct sctp_chunk *sctp_chunkify(struct sk_buff *,
782 const struct sctp_association *, 780 const struct sctp_association *,
783 struct sock *); 781 struct sock *);
@@ -878,7 +876,30 @@ struct sctp_transport {
878 876
879 /* Reference counting. */ 877 /* Reference counting. */
880 atomic_t refcnt; 878 atomic_t refcnt;
881 int dead; 879 __u32 dead:1,
880 /* RTO-Pending : A flag used to track if one of the DATA
881 * chunks sent to this address is currently being
882 * used to compute a RTT. If this flag is 0,
883 * the next DATA chunk sent to this destination
884 * should be used to compute a RTT and this flag
885 * should be set. Every time the RTT
886 * calculation completes (i.e. the DATA chunk
887 * is SACK'd) clear this flag.
888 */
889 rto_pending:1,
890
891 /*
892 * hb_sent : a flag that signals that we have a pending
893 * heartbeat.
894 */
895 hb_sent:1,
896
897 /* Is the Path MTU update pending on this tranport */
898 pmtu_pending:1,
899
900 /* Is this structure kfree()able? */
901 malloced:1;
902
882 903
883 /* This is the peer's IP address and port. */ 904 /* This is the peer's IP address and port. */
884 union sctp_addr ipaddr; 905 union sctp_addr ipaddr;
@@ -908,22 +929,6 @@ struct sctp_transport {
908 /* SRTT : The current smoothed round trip time. */ 929 /* SRTT : The current smoothed round trip time. */
909 __u32 srtt; 930 __u32 srtt;
910 931
911 /* RTO-Pending : A flag used to track if one of the DATA
912 * chunks sent to this address is currently being
913 * used to compute a RTT. If this flag is 0,
914 * the next DATA chunk sent to this destination
915 * should be used to compute a RTT and this flag
916 * should be set. Every time the RTT
917 * calculation completes (i.e. the DATA chunk
918 * is SACK'd) clear this flag.
919 * hb_sent : a flag that signals that we have a pending heartbeat.
920 */
921 __u8 rto_pending;
922 __u8 hb_sent;
923
924 /* Flag to track the current fast recovery state */
925 __u8 fast_recovery;
926
927 /* 932 /*
928 * These are the congestion stats. 933 * These are the congestion stats.
929 */ 934 */
@@ -943,9 +948,6 @@ struct sctp_transport {
943 948
944 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ 949 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */
945 950
946 /* TSN marking the fast recovery exit point */
947 __u32 fast_recovery_exit;
948
949 /* Destination */ 951 /* Destination */
950 struct dst_entry *dst; 952 struct dst_entry *dst;
951 /* Source address. */ 953 /* Source address. */
@@ -976,9 +978,6 @@ struct sctp_transport {
976 */ 978 */
977 __u16 pathmaxrxt; 979 __u16 pathmaxrxt;
978 980
979 /* is the Path MTU update pending on this tranport */
980 __u8 pmtu_pending;
981
982 /* PMTU : The current known path MTU. */ 981 /* PMTU : The current known path MTU. */
983 __u32 pathmtu; 982 __u32 pathmtu;
984 983
@@ -1009,6 +1008,9 @@ struct sctp_transport {
1009 /* Heartbeat timer is per destination. */ 1008 /* Heartbeat timer is per destination. */
1010 struct timer_list hb_timer; 1009 struct timer_list hb_timer;
1011 1010
1011 /* Timer to handle ICMP proto unreachable envets */
1012 struct timer_list proto_unreach_timer;
1013
1012 /* Since we're using per-destination retransmission timers 1014 /* Since we're using per-destination retransmission timers
1013 * (see above), we're also using per-destination "transmitted" 1015 * (see above), we're also using per-destination "transmitted"
1014 * queues. This probably ought to be a private struct 1016 * queues. This probably ought to be a private struct
@@ -1022,8 +1024,6 @@ struct sctp_transport {
1022 /* This is the list of transports that have chunks to send. */ 1024 /* This is the list of transports that have chunks to send. */
1023 struct list_head send_ready; 1025 struct list_head send_ready;
1024 1026
1025 int malloced; /* Is this structure kfree()able? */
1026
1027 /* State information saved for SFR_CACC algorithm. The key 1027 /* State information saved for SFR_CACC algorithm. The key
1028 * idea in SFR_CACC is to maintain state at the sender on a 1028 * idea in SFR_CACC is to maintain state at the sender on a
1029 * per-destination basis when a changeover happens. 1029 * per-destination basis when a changeover happens.
@@ -1065,7 +1065,7 @@ void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
1065 struct sctp_sock *); 1065 struct sctp_sock *);
1066void sctp_transport_pmtu(struct sctp_transport *); 1066void sctp_transport_pmtu(struct sctp_transport *);
1067void sctp_transport_free(struct sctp_transport *); 1067void sctp_transport_free(struct sctp_transport *);
1068void sctp_transport_reset_timers(struct sctp_transport *, int); 1068void sctp_transport_reset_timers(struct sctp_transport *);
1069void sctp_transport_hold(struct sctp_transport *); 1069void sctp_transport_hold(struct sctp_transport *);
1070void sctp_transport_put(struct sctp_transport *); 1070void sctp_transport_put(struct sctp_transport *);
1071void sctp_transport_update_rto(struct sctp_transport *, __u32); 1071void sctp_transport_update_rto(struct sctp_transport *, __u32);
@@ -1719,6 +1719,12 @@ struct sctp_association {
1719 /* Highest TSN that is acknowledged by incoming SACKs. */ 1719 /* Highest TSN that is acknowledged by incoming SACKs. */
1720 __u32 highest_sacked; 1720 __u32 highest_sacked;
1721 1721
1722 /* TSN marking the fast recovery exit point */
1723 __u32 fast_recovery_exit;
1724
1725 /* Flag to track the current fast recovery state */
1726 __u8 fast_recovery;
1727
1722 /* The number of unacknowledged data chunks. Reported through 1728 /* The number of unacknowledged data chunks. Reported through
1723 * the SCTP_STATUS sockopt. 1729 * the SCTP_STATUS sockopt.
1724 */ 1730 */
diff --git a/include/net/snmp.h b/include/net/snmp.h
index f0d756f2ac99..899003d18db9 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -32,7 +32,7 @@
32 * - name of entries. 32 * - name of entries.
33 */ 33 */
34struct snmp_mib { 34struct snmp_mib {
35 char *name; 35 const char *name;
36 int entry; 36 int entry;
37}; 37};
38 38
@@ -52,26 +52,11 @@ struct snmp_mib {
52 * count on the 20Gb/s + networks people expect in a few years time! 52 * count on the 20Gb/s + networks people expect in a few years time!
53 */ 53 */
54 54
55/*
56 * The rule for padding:
57 * Best is power of two because then the right structure can be found by a
58 * simple shift. The structure should be always cache line aligned.
59 * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add
60 * instructions to emulate multiply in case it is not power-of-two.
61 * Currently n is always <=3 for all sizes so simple cache line alignment
62 * is enough.
63 *
64 * The best solution would be a global CPU local area , especially on 64
65 * and 128byte cacheline machine it makes a *lot* of sense -AK
66 */
67
68#define __SNMP_MIB_ALIGN__ ____cacheline_aligned
69
70/* IPstats */ 55/* IPstats */
71#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX 56#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
72struct ipstats_mib { 57struct ipstats_mib {
73 unsigned long mibs[IPSTATS_MIB_MAX]; 58 unsigned long mibs[IPSTATS_MIB_MAX];
74} __SNMP_MIB_ALIGN__; 59};
75 60
76/* ICMP */ 61/* ICMP */
77#define ICMP_MIB_DUMMY __ICMP_MIB_MAX 62#define ICMP_MIB_DUMMY __ICMP_MIB_MAX
@@ -79,36 +64,36 @@ struct ipstats_mib {
79 64
80struct icmp_mib { 65struct icmp_mib {
81 unsigned long mibs[ICMP_MIB_MAX]; 66 unsigned long mibs[ICMP_MIB_MAX];
82} __SNMP_MIB_ALIGN__; 67};
83 68
84#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX 69#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX
85struct icmpmsg_mib { 70struct icmpmsg_mib {
86 unsigned long mibs[ICMPMSG_MIB_MAX]; 71 unsigned long mibs[ICMPMSG_MIB_MAX];
87} __SNMP_MIB_ALIGN__; 72};
88 73
89/* ICMP6 (IPv6-ICMP) */ 74/* ICMP6 (IPv6-ICMP) */
90#define ICMP6_MIB_MAX __ICMP6_MIB_MAX 75#define ICMP6_MIB_MAX __ICMP6_MIB_MAX
91struct icmpv6_mib { 76struct icmpv6_mib {
92 unsigned long mibs[ICMP6_MIB_MAX]; 77 unsigned long mibs[ICMP6_MIB_MAX];
93} __SNMP_MIB_ALIGN__; 78};
94 79
95#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX 80#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX
96struct icmpv6msg_mib { 81struct icmpv6msg_mib {
97 unsigned long mibs[ICMP6MSG_MIB_MAX]; 82 unsigned long mibs[ICMP6MSG_MIB_MAX];
98} __SNMP_MIB_ALIGN__; 83};
99 84
100 85
101/* TCP */ 86/* TCP */
102#define TCP_MIB_MAX __TCP_MIB_MAX 87#define TCP_MIB_MAX __TCP_MIB_MAX
103struct tcp_mib { 88struct tcp_mib {
104 unsigned long mibs[TCP_MIB_MAX]; 89 unsigned long mibs[TCP_MIB_MAX];
105} __SNMP_MIB_ALIGN__; 90};
106 91
107/* UDP */ 92/* UDP */
108#define UDP_MIB_MAX __UDP_MIB_MAX 93#define UDP_MIB_MAX __UDP_MIB_MAX
109struct udp_mib { 94struct udp_mib {
110 unsigned long mibs[UDP_MIB_MAX]; 95 unsigned long mibs[UDP_MIB_MAX];
111} __SNMP_MIB_ALIGN__; 96};
112 97
113/* Linux */ 98/* Linux */
114#define LINUX_MIB_MAX __LINUX_MIB_MAX 99#define LINUX_MIB_MAX __LINUX_MIB_MAX
@@ -129,9 +114,9 @@ struct linux_xfrm_mib {
129 * nonlocked_atomic_inc() primitives -AK 114 * nonlocked_atomic_inc() primitives -AK
130 */ 115 */
131#define DEFINE_SNMP_STAT(type, name) \ 116#define DEFINE_SNMP_STAT(type, name) \
132 __typeof__(type) *name[2] 117 __typeof__(type) __percpu *name[2]
133#define DECLARE_SNMP_STAT(type, name) \ 118#define DECLARE_SNMP_STAT(type, name) \
134 extern __typeof__(type) *name[2] 119 extern __typeof__(type) __percpu *name[2]
135 120
136#define SNMP_STAT_BHPTR(name) (name[0]) 121#define SNMP_STAT_BHPTR(name) (name[0])
137#define SNMP_STAT_USRPTR(name) (name[1]) 122#define SNMP_STAT_USRPTR(name) (name[1])
@@ -148,9 +133,15 @@ struct linux_xfrm_mib {
148 __this_cpu_add(mib[0]->mibs[field], addend) 133 __this_cpu_add(mib[0]->mibs[field], addend)
149#define SNMP_ADD_STATS_USER(mib, field, addend) \ 134#define SNMP_ADD_STATS_USER(mib, field, addend) \
150 this_cpu_add(mib[1]->mibs[field], addend) 135 this_cpu_add(mib[1]->mibs[field], addend)
136#define SNMP_ADD_STATS(mib, field, addend) \
137 this_cpu_add(mib[!in_softirq()]->mibs[field], addend)
138/*
139 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
140 * to make @ptr a non-percpu pointer.
141 */
151#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 142#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
152 do { \ 143 do { \
153 __typeof__(mib[0]) ptr; \ 144 __typeof__(*mib[0]) *ptr; \
154 preempt_disable(); \ 145 preempt_disable(); \
155 ptr = this_cpu_ptr((mib)[!in_softirq()]); \ 146 ptr = this_cpu_ptr((mib)[!in_softirq()]); \
156 ptr->mibs[basefield##PKTS]++; \ 147 ptr->mibs[basefield##PKTS]++; \
@@ -159,7 +150,7 @@ struct linux_xfrm_mib {
159 } while (0) 150 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 151#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 152 do { \
162 __typeof__(mib[0]) ptr = \ 153 __typeof__(*mib[0]) *ptr = \
163 __this_cpu_ptr((mib)[!in_softirq()]); \ 154 __this_cpu_ptr((mib)[!in_softirq()]); \
164 ptr->mibs[basefield##PKTS]++; \ 155 ptr->mibs[basefield##PKTS]++; \
165 ptr->mibs[basefield##OCTETS] += addend;\ 156 ptr->mibs[basefield##OCTETS] += addend;\
diff --git a/include/net/sock.h b/include/net/sock.h
index 3f1a4804bb3f..0a691ea7654a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -51,6 +51,7 @@
51#include <linux/skbuff.h> /* struct sk_buff */ 51#include <linux/skbuff.h> /* struct sk_buff */
52#include <linux/mm.h> 52#include <linux/mm.h>
53#include <linux/security.h> 53#include <linux/security.h>
54#include <linux/slab.h>
54 55
55#include <linux/filter.h> 56#include <linux/filter.h>
56#include <linux/rculist_nulls.h> 57#include <linux/rculist_nulls.h>
@@ -73,7 +74,7 @@
73 printk(KERN_DEBUG msg); } while (0) 74 printk(KERN_DEBUG msg); } while (0)
74#else 75#else
75/* Validate arguments and do nothing */ 76/* Validate arguments and do nothing */
76static void inline int __attribute__ ((format (printf, 2, 3))) 77static inline void __attribute__ ((format (printf, 2, 3)))
77SOCK_DEBUG(struct sock *sk, const char *msg, ...) 78SOCK_DEBUG(struct sock *sk, const char *msg, ...)
78{ 79{
79} 80}
@@ -158,7 +159,7 @@ struct sock_common {
158 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings 159 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings
159 * @sk_lock: synchronizer 160 * @sk_lock: synchronizer
160 * @sk_rcvbuf: size of receive buffer in bytes 161 * @sk_rcvbuf: size of receive buffer in bytes
161 * @sk_sleep: sock wait queue 162 * @sk_wq: sock wait queue and async head
162 * @sk_dst_cache: destination cache 163 * @sk_dst_cache: destination cache
163 * @sk_dst_lock: destination cache lock 164 * @sk_dst_lock: destination cache lock
164 * @sk_policy: flow policy 165 * @sk_policy: flow policy
@@ -176,6 +177,7 @@ struct sock_common {
176 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 177 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
177 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 178 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
178 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 179 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
180 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
179 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 181 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
180 * @sk_gso_max_size: Maximum GSO segment size to build 182 * @sk_gso_max_size: Maximum GSO segment size to build
181 * @sk_lingertime: %SO_LINGER l_linger setting 183 * @sk_lingertime: %SO_LINGER l_linger setting
@@ -197,6 +199,7 @@ struct sock_common {
197 * @sk_rcvlowat: %SO_RCVLOWAT setting 199 * @sk_rcvlowat: %SO_RCVLOWAT setting
198 * @sk_rcvtimeo: %SO_RCVTIMEO setting 200 * @sk_rcvtimeo: %SO_RCVTIMEO setting
199 * @sk_sndtimeo: %SO_SNDTIMEO setting 201 * @sk_sndtimeo: %SO_SNDTIMEO setting
202 * @sk_rxhash: flow hash received from netif layer
200 * @sk_filter: socket filtering instructions 203 * @sk_filter: socket filtering instructions
201 * @sk_protinfo: private area, net family specific, when not using slab 204 * @sk_protinfo: private area, net family specific, when not using slab
202 * @sk_timer: sock cleanup timer 205 * @sk_timer: sock cleanup timer
@@ -253,13 +256,14 @@ struct sock {
253 struct { 256 struct {
254 struct sk_buff *head; 257 struct sk_buff *head;
255 struct sk_buff *tail; 258 struct sk_buff *tail;
259 int len;
256 } sk_backlog; 260 } sk_backlog;
257 wait_queue_head_t *sk_sleep; 261 struct socket_wq *sk_wq;
258 struct dst_entry *sk_dst_cache; 262 struct dst_entry *sk_dst_cache;
259#ifdef CONFIG_XFRM 263#ifdef CONFIG_XFRM
260 struct xfrm_policy *sk_policy[2]; 264 struct xfrm_policy *sk_policy[2];
261#endif 265#endif
262 rwlock_t sk_dst_lock; 266 spinlock_t sk_dst_lock;
263 atomic_t sk_rmem_alloc; 267 atomic_t sk_rmem_alloc;
264 atomic_t sk_wmem_alloc; 268 atomic_t sk_wmem_alloc;
265 atomic_t sk_omem_alloc; 269 atomic_t sk_omem_alloc;
@@ -273,9 +277,13 @@ struct sock {
273 int sk_forward_alloc; 277 int sk_forward_alloc;
274 gfp_t sk_allocation; 278 gfp_t sk_allocation;
275 int sk_route_caps; 279 int sk_route_caps;
280 int sk_route_nocaps;
276 int sk_gso_type; 281 int sk_gso_type;
277 unsigned int sk_gso_max_size; 282 unsigned int sk_gso_max_size;
278 int sk_rcvlowat; 283 int sk_rcvlowat;
284#ifdef CONFIG_RPS
285 __u32 sk_rxhash;
286#endif
279 unsigned long sk_flags; 287 unsigned long sk_flags;
280 unsigned long sk_lingertime; 288 unsigned long sk_lingertime;
281 struct sk_buff_head sk_error_queue; 289 struct sk_buff_head sk_error_queue;
@@ -304,7 +312,7 @@ struct sock {
304 void *sk_security; 312 void *sk_security;
305#endif 313#endif
306 __u32 sk_mark; 314 __u32 sk_mark;
307 /* XXX 4 bytes hole on 64 bit */ 315 u32 sk_classid;
308 void (*sk_state_change)(struct sock *sk); 316 void (*sk_state_change)(struct sock *sk);
309 void (*sk_data_ready)(struct sock *sk, int bytes); 317 void (*sk_data_ready)(struct sock *sk, int bytes);
310 void (*sk_write_space)(struct sock *sk); 318 void (*sk_write_space)(struct sock *sk);
@@ -317,6 +325,11 @@ struct sock {
317/* 325/*
318 * Hashed lists helper routines 326 * Hashed lists helper routines
319 */ 327 */
328static inline struct sock *sk_entry(const struct hlist_node *node)
329{
330 return hlist_entry(node, struct sock, sk_node);
331}
332
320static inline struct sock *__sk_head(const struct hlist_head *head) 333static inline struct sock *__sk_head(const struct hlist_head *head)
321{ 334{
322 return hlist_entry(head->first, struct sock, sk_node); 335 return hlist_entry(head->first, struct sock, sk_node);
@@ -376,6 +389,7 @@ static __inline__ void __sk_del_node(struct sock *sk)
376 __hlist_del(&sk->sk_node); 389 __hlist_del(&sk->sk_node);
377} 390}
378 391
392/* NB: equivalent to hlist_del_init_rcu */
379static __inline__ int __sk_del_node_init(struct sock *sk) 393static __inline__ int __sk_del_node_init(struct sock *sk)
380{ 394{
381 if (sk_hashed(sk)) { 395 if (sk_hashed(sk)) {
@@ -416,6 +430,7 @@ static __inline__ int sk_del_node_init(struct sock *sk)
416 } 430 }
417 return rc; 431 return rc;
418} 432}
433#define sk_del_node_init_rcu(sk) sk_del_node_init(sk)
419 434
420static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) 435static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
421{ 436{
@@ -449,6 +464,12 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
449 __sk_add_node(sk, list); 464 __sk_add_node(sk, list);
450} 465}
451 466
467static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
468{
469 sock_hold(sk);
470 hlist_add_head_rcu(&sk->sk_node, list);
471}
472
452static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 473static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
453{ 474{
454 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 475 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
@@ -473,6 +494,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
473 494
474#define sk_for_each(__sk, node, list) \ 495#define sk_for_each(__sk, node, list) \
475 hlist_for_each_entry(__sk, node, list, sk_node) 496 hlist_for_each_entry(__sk, node, list, sk_node)
497#define sk_for_each_rcu(__sk, node, list) \
498 hlist_for_each_entry_rcu(__sk, node, list, sk_node)
476#define sk_nulls_for_each(__sk, node, list) \ 499#define sk_nulls_for_each(__sk, node, list) \
477 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) 500 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
478#define sk_nulls_for_each_rcu(__sk, node, list) \ 501#define sk_nulls_for_each_rcu(__sk, node, list) \
@@ -574,23 +597,81 @@ static inline int sk_stream_memory_free(struct sock *sk)
574 return sk->sk_wmem_queued < sk->sk_sndbuf; 597 return sk->sk_wmem_queued < sk->sk_sndbuf;
575} 598}
576 599
577/* The per-socket spinlock must be held here. */ 600/* OOB backlog add */
578static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) 601static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
579{ 602{
580 if (!sk->sk_backlog.tail) { 603 /* dont let skb dst not refcounted, we are going to leave rcu lock */
581 sk->sk_backlog.head = sk->sk_backlog.tail = skb; 604 skb_dst_force(skb);
582 } else { 605
606 if (!sk->sk_backlog.tail)
607 sk->sk_backlog.head = skb;
608 else
583 sk->sk_backlog.tail->next = skb; 609 sk->sk_backlog.tail->next = skb;
584 sk->sk_backlog.tail = skb; 610
585 } 611 sk->sk_backlog.tail = skb;
586 skb->next = NULL; 612 skb->next = NULL;
587} 613}
588 614
615/*
616 * Take into account size of receive queue and backlog queue
617 */
618static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb)
619{
620 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
621
622 return qsize + skb->truesize > sk->sk_rcvbuf;
623}
624
625/* The per-socket spinlock must be held here. */
626static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb)
627{
628 if (sk_rcvqueues_full(sk, skb))
629 return -ENOBUFS;
630
631 __sk_add_backlog(sk, skb);
632 sk->sk_backlog.len += skb->truesize;
633 return 0;
634}
635
589static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) 636static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
590{ 637{
591 return sk->sk_backlog_rcv(sk, skb); 638 return sk->sk_backlog_rcv(sk, skb);
592} 639}
593 640
641static inline void sock_rps_record_flow(const struct sock *sk)
642{
643#ifdef CONFIG_RPS
644 struct rps_sock_flow_table *sock_flow_table;
645
646 rcu_read_lock();
647 sock_flow_table = rcu_dereference(rps_sock_flow_table);
648 rps_record_sock_flow(sock_flow_table, sk->sk_rxhash);
649 rcu_read_unlock();
650#endif
651}
652
653static inline void sock_rps_reset_flow(const struct sock *sk)
654{
655#ifdef CONFIG_RPS
656 struct rps_sock_flow_table *sock_flow_table;
657
658 rcu_read_lock();
659 sock_flow_table = rcu_dereference(rps_sock_flow_table);
660 rps_reset_sock_flow(sock_flow_table, sk->sk_rxhash);
661 rcu_read_unlock();
662#endif
663}
664
665static inline void sock_rps_save_rxhash(struct sock *sk, u32 rxhash)
666{
667#ifdef CONFIG_RPS
668 if (unlikely(sk->sk_rxhash != rxhash)) {
669 sock_rps_reset_flow(sk);
670 sk->sk_rxhash = rxhash;
671 }
672#endif
673}
674
594#define sk_wait_event(__sk, __timeo, __condition) \ 675#define sk_wait_event(__sk, __timeo, __condition) \
595 ({ int __rc; \ 676 ({ int __rc; \
596 release_sock(__sk); \ 677 release_sock(__sk); \
@@ -945,6 +1026,24 @@ extern void release_sock(struct sock *sk);
945 SINGLE_DEPTH_NESTING) 1026 SINGLE_DEPTH_NESTING)
946#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1027#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
947 1028
1029extern bool lock_sock_fast(struct sock *sk);
1030/**
1031 * unlock_sock_fast - complement of lock_sock_fast
1032 * @sk: socket
1033 * @slow: slow mode
1034 *
1035 * fast unlock socket for user context.
1036 * If slow mode is on, we call regular release_sock()
1037 */
1038static inline void unlock_sock_fast(struct sock *sk, bool slow)
1039{
1040 if (slow)
1041 release_sock(sk);
1042 else
1043 spin_unlock_bh(&sk->sk_lock.slock);
1044}
1045
1046
948extern struct sock *sk_alloc(struct net *net, int family, 1047extern struct sock *sk_alloc(struct net *net, int family,
949 gfp_t priority, 1048 gfp_t priority,
950 struct proto *prot); 1049 struct proto *prot);
@@ -983,6 +1082,14 @@ extern void *sock_kmalloc(struct sock *sk, int size,
983extern void sock_kfree_s(struct sock *sk, void *mem, int size); 1082extern void sock_kfree_s(struct sock *sk, void *mem, int size);
984extern void sk_send_sigurg(struct sock *sk); 1083extern void sk_send_sigurg(struct sock *sk);
985 1084
1085#ifdef CONFIG_CGROUPS
1086extern void sock_update_classid(struct sock *sk);
1087#else
1088static inline void sock_update_classid(struct sock *sk)
1089{
1090}
1091#endif
1092
986/* 1093/*
987 * Functions to fill in entries in struct proto_ops when a protocol 1094 * Functions to fill in entries in struct proto_ops when a protocol
988 * does not implement a particular function. 1095 * does not implement a particular function.
@@ -1044,7 +1151,7 @@ extern void sk_common_release(struct sock *sk);
1044extern void sock_init_data(struct socket *sock, struct sock *sk); 1151extern void sock_init_data(struct socket *sock, struct sock *sk);
1045 1152
1046/** 1153/**
1047 * sk_filter_release: Release a socket filter 1154 * sk_filter_release - release a socket filter
1048 * @fp: filter to remove 1155 * @fp: filter to remove
1049 * 1156 *
1050 * Remove a filter from a socket and release its resources. 1157 * Remove a filter from a socket and release its resources.
@@ -1117,12 +1224,7 @@ static inline void sk_tx_queue_clear(struct sock *sk)
1117 1224
1118static inline int sk_tx_queue_get(const struct sock *sk) 1225static inline int sk_tx_queue_get(const struct sock *sk)
1119{ 1226{
1120 return sk->sk_tx_queue_mapping; 1227 return sk ? sk->sk_tx_queue_mapping : -1;
1121}
1122
1123static inline bool sk_tx_queue_recorded(const struct sock *sk)
1124{
1125 return (sk && sk->sk_tx_queue_mapping >= 0);
1126} 1228}
1127 1229
1128static inline void sk_set_socket(struct sock *sk, struct socket *sock) 1230static inline void sk_set_socket(struct sock *sk, struct socket *sock)
@@ -1131,6 +1233,10 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1131 sk->sk_socket = sock; 1233 sk->sk_socket = sock;
1132} 1234}
1133 1235
1236static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1237{
1238 return &sk->sk_wq->wait;
1239}
1134/* Detach socket from process context. 1240/* Detach socket from process context.
1135 * Announce socket dead, detach it from wait queue and inode. 1241 * Announce socket dead, detach it from wait queue and inode.
1136 * Note that parent inode held reference count on this struct sock, 1242 * Note that parent inode held reference count on this struct sock,
@@ -1143,14 +1249,14 @@ static inline void sock_orphan(struct sock *sk)
1143 write_lock_bh(&sk->sk_callback_lock); 1249 write_lock_bh(&sk->sk_callback_lock);
1144 sock_set_flag(sk, SOCK_DEAD); 1250 sock_set_flag(sk, SOCK_DEAD);
1145 sk_set_socket(sk, NULL); 1251 sk_set_socket(sk, NULL);
1146 sk->sk_sleep = NULL; 1252 sk->sk_wq = NULL;
1147 write_unlock_bh(&sk->sk_callback_lock); 1253 write_unlock_bh(&sk->sk_callback_lock);
1148} 1254}
1149 1255
1150static inline void sock_graft(struct sock *sk, struct socket *parent) 1256static inline void sock_graft(struct sock *sk, struct socket *parent)
1151{ 1257{
1152 write_lock_bh(&sk->sk_callback_lock); 1258 write_lock_bh(&sk->sk_callback_lock);
1153 sk->sk_sleep = &parent->wait; 1259 rcu_assign_pointer(sk->sk_wq, parent->wq);
1154 parent->sk = sk; 1260 parent->sk = sk;
1155 sk_set_socket(sk, parent); 1261 sk_set_socket(sk, parent);
1156 security_sock_graft(sk, parent); 1262 security_sock_graft(sk, parent);
@@ -1163,7 +1269,9 @@ extern unsigned long sock_i_ino(struct sock *sk);
1163static inline struct dst_entry * 1269static inline struct dst_entry *
1164__sk_dst_get(struct sock *sk) 1270__sk_dst_get(struct sock *sk)
1165{ 1271{
1166 return sk->sk_dst_cache; 1272 return rcu_dereference_check(sk->sk_dst_cache, rcu_read_lock_held() ||
1273 sock_owned_by_user(sk) ||
1274 lockdep_is_held(&sk->sk_lock.slock));
1167} 1275}
1168 1276
1169static inline struct dst_entry * 1277static inline struct dst_entry *
@@ -1171,50 +1279,65 @@ sk_dst_get(struct sock *sk)
1171{ 1279{
1172 struct dst_entry *dst; 1280 struct dst_entry *dst;
1173 1281
1174 read_lock(&sk->sk_dst_lock); 1282 rcu_read_lock();
1175 dst = sk->sk_dst_cache; 1283 dst = rcu_dereference(sk->sk_dst_cache);
1176 if (dst) 1284 if (dst)
1177 dst_hold(dst); 1285 dst_hold(dst);
1178 read_unlock(&sk->sk_dst_lock); 1286 rcu_read_unlock();
1179 return dst; 1287 return dst;
1180} 1288}
1181 1289
1290extern void sk_reset_txq(struct sock *sk);
1291
1292static inline void dst_negative_advice(struct sock *sk)
1293{
1294 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
1295
1296 if (dst && dst->ops->negative_advice) {
1297 ndst = dst->ops->negative_advice(dst);
1298
1299 if (ndst != dst) {
1300 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1301 sk_reset_txq(sk);
1302 }
1303 }
1304}
1305
1182static inline void 1306static inline void
1183__sk_dst_set(struct sock *sk, struct dst_entry *dst) 1307__sk_dst_set(struct sock *sk, struct dst_entry *dst)
1184{ 1308{
1185 struct dst_entry *old_dst; 1309 struct dst_entry *old_dst;
1186 1310
1187 sk_tx_queue_clear(sk); 1311 sk_tx_queue_clear(sk);
1188 old_dst = sk->sk_dst_cache; 1312 /*
1189 sk->sk_dst_cache = dst; 1313 * This can be called while sk is owned by the caller only,
1314 * with no state that can be checked in a rcu_dereference_check() cond
1315 */
1316 old_dst = rcu_dereference_raw(sk->sk_dst_cache);
1317 rcu_assign_pointer(sk->sk_dst_cache, dst);
1190 dst_release(old_dst); 1318 dst_release(old_dst);
1191} 1319}
1192 1320
1193static inline void 1321static inline void
1194sk_dst_set(struct sock *sk, struct dst_entry *dst) 1322sk_dst_set(struct sock *sk, struct dst_entry *dst)
1195{ 1323{
1196 write_lock(&sk->sk_dst_lock); 1324 spin_lock(&sk->sk_dst_lock);
1197 __sk_dst_set(sk, dst); 1325 __sk_dst_set(sk, dst);
1198 write_unlock(&sk->sk_dst_lock); 1326 spin_unlock(&sk->sk_dst_lock);
1199} 1327}
1200 1328
1201static inline void 1329static inline void
1202__sk_dst_reset(struct sock *sk) 1330__sk_dst_reset(struct sock *sk)
1203{ 1331{
1204 struct dst_entry *old_dst; 1332 __sk_dst_set(sk, NULL);
1205
1206 sk_tx_queue_clear(sk);
1207 old_dst = sk->sk_dst_cache;
1208 sk->sk_dst_cache = NULL;
1209 dst_release(old_dst);
1210} 1333}
1211 1334
1212static inline void 1335static inline void
1213sk_dst_reset(struct sock *sk) 1336sk_dst_reset(struct sock *sk)
1214{ 1337{
1215 write_lock(&sk->sk_dst_lock); 1338 spin_lock(&sk->sk_dst_lock);
1216 __sk_dst_reset(sk); 1339 __sk_dst_reset(sk);
1217 write_unlock(&sk->sk_dst_lock); 1340 spin_unlock(&sk->sk_dst_lock);
1218} 1341}
1219 1342
1220extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1343extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
@@ -1228,6 +1351,12 @@ static inline int sk_can_gso(const struct sock *sk)
1228 1351
1229extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1352extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1230 1353
1354static inline void sk_nocaps_add(struct sock *sk, int flags)
1355{
1356 sk->sk_route_nocaps |= flags;
1357 sk->sk_route_caps &= ~flags;
1358}
1359
1231static inline int skb_copy_to_page(struct sock *sk, char __user *from, 1360static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1232 struct sk_buff *skb, struct page *page, 1361 struct sk_buff *skb, struct page *page,
1233 int off, int copy) 1362 int off, int copy)
@@ -1285,12 +1414,12 @@ static inline int sk_has_allocations(const struct sock *sk)
1285} 1414}
1286 1415
1287/** 1416/**
1288 * sk_has_sleeper - check if there are any waiting processes 1417 * wq_has_sleeper - check if there are any waiting processes
1289 * @sk: socket 1418 * @wq: struct socket_wq
1290 * 1419 *
1291 * Returns true if socket has waiting processes 1420 * Returns true if socket_wq has waiting processes
1292 * 1421 *
1293 * The purpose of the sk_has_sleeper and sock_poll_wait is to wrap the memory 1422 * The purpose of the wq_has_sleeper and sock_poll_wait is to wrap the memory
1294 * barrier call. They were added due to the race found within the tcp code. 1423 * barrier call. They were added due to the race found within the tcp code.
1295 * 1424 *
1296 * Consider following tcp code paths: 1425 * Consider following tcp code paths:
@@ -1303,9 +1432,10 @@ static inline int sk_has_allocations(const struct sock *sk)
1303 * ... ... 1432 * ... ...
1304 * tp->rcv_nxt check sock_def_readable 1433 * tp->rcv_nxt check sock_def_readable
1305 * ... { 1434 * ... {
1306 * schedule ... 1435 * schedule rcu_read_lock();
1307 * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1436 * wq = rcu_dereference(sk->sk_wq);
1308 * wake_up_interruptible(sk->sk_sleep) 1437 * if (wq && waitqueue_active(&wq->wait))
1438 * wake_up_interruptible(&wq->wait)
1309 * ... 1439 * ...
1310 * } 1440 * }
1311 * 1441 *
@@ -1314,19 +1444,18 @@ static inline int sk_has_allocations(const struct sock *sk)
1314 * could then endup calling schedule and sleep forever if there are no more 1444 * could then endup calling schedule and sleep forever if there are no more
1315 * data on the socket. 1445 * data on the socket.
1316 * 1446 *
1317 * The sk_has_sleeper is always called right after a call to read_lock, so we
1318 * can use smp_mb__after_lock barrier.
1319 */ 1447 */
1320static inline int sk_has_sleeper(struct sock *sk) 1448static inline bool wq_has_sleeper(struct socket_wq *wq)
1321{ 1449{
1450
1322 /* 1451 /*
1323 * We need to be sure we are in sync with the 1452 * We need to be sure we are in sync with the
1324 * add_wait_queue modifications to the wait queue. 1453 * add_wait_queue modifications to the wait queue.
1325 * 1454 *
1326 * This memory barrier is paired in the sock_poll_wait. 1455 * This memory barrier is paired in the sock_poll_wait.
1327 */ 1456 */
1328 smp_mb__after_lock(); 1457 smp_mb();
1329 return sk->sk_sleep && waitqueue_active(sk->sk_sleep); 1458 return wq && waitqueue_active(&wq->wait);
1330} 1459}
1331 1460
1332/** 1461/**
@@ -1335,7 +1464,7 @@ static inline int sk_has_sleeper(struct sock *sk)
1335 * @wait_address: socket wait queue 1464 * @wait_address: socket wait queue
1336 * @p: poll_table 1465 * @p: poll_table
1337 * 1466 *
1338 * See the comments in the sk_has_sleeper function. 1467 * See the comments in the wq_has_sleeper function.
1339 */ 1468 */
1340static inline void sock_poll_wait(struct file *filp, 1469static inline void sock_poll_wait(struct file *filp,
1341 wait_queue_head_t *wait_address, poll_table *p) 1470 wait_queue_head_t *wait_address, poll_table *p)
@@ -1346,7 +1475,7 @@ static inline void sock_poll_wait(struct file *filp,
1346 * We need to be sure we are in sync with the 1475 * We need to be sure we are in sync with the
1347 * socket flags modification. 1476 * socket flags modification.
1348 * 1477 *
1349 * This memory barrier is paired in the sk_has_sleeper. 1478 * This memory barrier is paired in the wq_has_sleeper.
1350 */ 1479 */
1351 smp_mb(); 1480 smp_mb();
1352 } 1481 }
@@ -1390,20 +1519,7 @@ extern void sk_stop_timer(struct sock *sk, struct timer_list* timer);
1390 1519
1391extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 1520extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
1392 1521
1393static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) 1522extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
1394{
1395 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
1396 number of warnings when compiling with -W --ANK
1397 */
1398 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
1399 (unsigned)sk->sk_rcvbuf)
1400 return -ENOMEM;
1401 skb_set_owner_r(skb, sk);
1402 skb_queue_tail(&sk->sk_error_queue, skb);
1403 if (!sock_flag(sk, SOCK_DEAD))
1404 sk->sk_data_ready(sk, skb->len);
1405 return 0;
1406}
1407 1523
1408/* 1524/*
1409 * Recover an error report and clear atomically 1525 * Recover an error report and clear atomically
@@ -1528,7 +1644,24 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1528 sk->sk_stamp = kt; 1644 sk->sk_stamp = kt;
1529} 1645}
1530 1646
1531extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); 1647extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1648 struct sk_buff *skb);
1649
1650static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1651 struct sk_buff *skb)
1652{
1653#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
1654 (1UL << SOCK_RCVTSTAMP) | \
1655 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \
1656 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
1657 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
1658 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
1659
1660 if (sk->sk_flags & FLAGS_TS_OR_DROPS)
1661 __sock_recv_ts_and_drops(msg, sk, skb);
1662 else
1663 sk->sk_stamp = skb->tstamp;
1664}
1532 1665
1533/** 1666/**
1534 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 1667 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index ceac661cdfd5..cfe2943690ff 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -9,6 +9,7 @@ struct tcf_mirred {
9 int tcfm_ifindex; 9 int tcfm_ifindex;
10 int tcfm_ok_push; 10 int tcfm_ok_push;
11 struct net_device *tcfm_dev; 11 struct net_device *tcfm_dev;
12 struct list_head tcfm_list;
12}; 13};
13#define to_mirred(pc) \ 14#define to_mirred(pc) \
14 container_of(pc, struct tcf_mirred, common) 15 container_of(pc, struct tcf_mirred, common)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 34f5cc24d903..a1449144848a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
196#define TCP_NAGLE_CORK 2 /* Socket is corked */ 196#define TCP_NAGLE_CORK 2 /* Socket is corked */
197#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ 197#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */
198 198
199/* TCP thin-stream limits */
200#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */
201
199extern struct inet_timewait_death_row tcp_death_row; 202extern struct inet_timewait_death_row tcp_death_row;
200 203
201/* sysctl variables for tcp */ 204/* sysctl variables for tcp */
@@ -241,6 +244,8 @@ extern int sysctl_tcp_workaround_signed_windows;
241extern int sysctl_tcp_slow_start_after_idle; 244extern int sysctl_tcp_slow_start_after_idle;
242extern int sysctl_tcp_max_ssthresh; 245extern int sysctl_tcp_max_ssthresh;
243extern int sysctl_tcp_cookie_size; 246extern int sysctl_tcp_cookie_size;
247extern int sysctl_tcp_thin_linear_timeouts;
248extern int sysctl_tcp_thin_dupack;
244 249
245extern atomic_t tcp_memory_allocated; 250extern atomic_t tcp_memory_allocated;
246extern struct percpu_counter tcp_sockets_allocated; 251extern struct percpu_counter tcp_sockets_allocated;
@@ -289,6 +294,7 @@ extern struct proto tcp_prot;
289#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field) 294#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field)
290#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) 295#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field)
291#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
292 298
293extern void tcp_v4_err(struct sk_buff *skb, u32); 299extern void tcp_v4_err(struct sk_buff *skb, u32);
294 300
@@ -400,6 +406,8 @@ extern int compat_tcp_setsockopt(struct sock *sk,
400 int level, int optname, 406 int level, int optname,
401 char __user *optval, unsigned int optlen); 407 char __user *optval, unsigned int optlen);
402extern void tcp_set_keepalive(struct sock *sk, int val); 408extern void tcp_set_keepalive(struct sock *sk, int val);
409extern void tcp_syn_ack_timeout(struct sock *sk,
410 struct request_sock *req);
403extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 411extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
404 struct msghdr *msg, 412 struct msghdr *msg,
405 size_t len, int nonblock, 413 size_t len, int nonblock,
@@ -416,7 +424,7 @@ extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
416 * TCP v4 functions exported for the inet6 API 424 * TCP v4 functions exported for the inet6 API
417 */ 425 */
418 426
419extern void tcp_v4_send_check(struct sock *sk, int len, 427extern void tcp_v4_send_check(struct sock *sk,
420 struct sk_buff *skb); 428 struct sk_buff *skb);
421 429
422extern int tcp_v4_conn_request(struct sock *sk, 430extern int tcp_v4_conn_request(struct sock *sk,
@@ -856,13 +864,6 @@ static inline void tcp_check_probe_timer(struct sock *sk)
856 icsk->icsk_rto, TCP_RTO_MAX); 864 icsk->icsk_rto, TCP_RTO_MAX);
857} 865}
858 866
859static inline void tcp_push_pending_frames(struct sock *sk)
860{
861 struct tcp_sock *tp = tcp_sk(sk);
862
863 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
864}
865
866static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) 867static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)
867{ 868{
868 tp->snd_wl1 = seq; 869 tp->snd_wl1 = seq;
@@ -939,7 +940,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
939 940
940 tp->ucopy.memory = 0; 941 tp->ucopy.memory = 0;
941 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { 942 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
942 wake_up_interruptible_poll(sk->sk_sleep, 943 wake_up_interruptible_sync_poll(sk_sleep(sk),
943 POLLIN | POLLRDNORM | POLLRDBAND); 944 POLLIN | POLLRDNORM | POLLRDBAND);
944 if (!inet_csk_ack_scheduled(sk)) 945 if (!inet_csk_ack_scheduled(sk))
945 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 946 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
@@ -972,7 +973,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
972/* Determine a window scaling and initial window to offer. */ 973/* Determine a window scaling and initial window to offer. */
973extern void tcp_select_initial_window(int __space, __u32 mss, 974extern void tcp_select_initial_window(int __space, __u32 mss,
974 __u32 *rcv_wnd, __u32 *window_clamp, 975 __u32 *rcv_wnd, __u32 *window_clamp,
975 int wscale_ok, __u8 *rcv_wscale); 976 int wscale_ok, __u8 *rcv_wscale,
977 __u32 init_rcv_wnd);
976 978
977static inline int tcp_win_from_space(int space) 979static inline int tcp_win_from_space(int space)
978{ 980{
@@ -1031,6 +1033,14 @@ static inline int keepalive_probes(const struct tcp_sock *tp)
1031 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; 1033 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
1032} 1034}
1033 1035
1036static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)
1037{
1038 const struct inet_connection_sock *icsk = &tp->inet_conn;
1039
1040 return min_t(u32, tcp_time_stamp - icsk->icsk_ack.lrcvtime,
1041 tcp_time_stamp - tp->rcv_tstamp);
1042}
1043
1034static inline int tcp_fin_time(const struct sock *sk) 1044static inline int tcp_fin_time(const struct sock *sk)
1035{ 1045{
1036 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1046 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
@@ -1193,33 +1203,18 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1193#define tcp_twsk_md5_key(twsk) NULL 1203#define tcp_twsk_md5_key(twsk) NULL
1194#endif 1204#endif
1195 1205
1196extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *); 1206extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1197extern void tcp_free_md5sig_pool(void); 1207extern void tcp_free_md5sig_pool(void);
1198 1208
1199extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1209extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1200extern void __tcp_put_md5sig_pool(void); 1210extern void tcp_put_md5sig_pool(void);
1211
1201extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); 1212extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1202extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, 1213extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
1203 unsigned header_len); 1214 unsigned header_len);
1204extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1215extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1205 struct tcp_md5sig_key *key); 1216 struct tcp_md5sig_key *key);
1206 1217
1207static inline
1208struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
1209{
1210 int cpu = get_cpu();
1211 struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu);
1212 if (!ret)
1213 put_cpu();
1214 return ret;
1215}
1216
1217static inline void tcp_put_md5sig_pool(void)
1218{
1219 __tcp_put_md5sig_pool();
1220 put_cpu();
1221}
1222
1223/* write queue abstraction */ 1218/* write queue abstraction */
1224static inline void tcp_write_queue_purge(struct sock *sk) 1219static inline void tcp_write_queue_purge(struct sock *sk)
1225{ 1220{
@@ -1342,6 +1337,15 @@ static inline int tcp_write_queue_empty(struct sock *sk)
1342 return skb_queue_empty(&sk->sk_write_queue); 1337 return skb_queue_empty(&sk->sk_write_queue);
1343} 1338}
1344 1339
1340static inline void tcp_push_pending_frames(struct sock *sk)
1341{
1342 if (tcp_send_head(sk)) {
1343 struct tcp_sock *tp = tcp_sk(sk);
1344
1345 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
1346 }
1347}
1348
1345/* Start sequence of the highest skb with SACKed bit, valid only if 1349/* Start sequence of the highest skb with SACKed bit, valid only if
1346 * sacked > 0 or when the caller has ensured validity by itself. 1350 * sacked > 0 or when the caller has ensured validity by itself.
1347 */ 1351 */
@@ -1381,6 +1385,14 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
1381 tcp_sk(sk)->highest_sack = new; 1385 tcp_sk(sk)->highest_sack = new;
1382} 1386}
1383 1387
1388/* Determines whether this is a thin stream (which may suffer from
1389 * increased latency). Used to trigger latency-reducing mechanisms.
1390 */
1391static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp)
1392{
1393 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp);
1394}
1395
1384/* /proc */ 1396/* /proc */
1385enum tcp_seq_states { 1397enum tcp_seq_states {
1386 TCP_SEQ_STATE_LISTENING, 1398 TCP_SEQ_STATE_LISTENING,
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h
index 9566608c88cf..15af6dca0b49 100644
--- a/include/net/tipc/tipc.h
+++ b/include/net/tipc/tipc.h
@@ -2,7 +2,7 @@
2 * include/net/tipc/tipc.h: Main include file for TIPC users 2 * include/net/tipc/tipc.h: Main include file for TIPC users
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005,2010 Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -126,7 +126,7 @@ int tipc_createport(unsigned int tipc_user,
126 tipc_msg_event message_cb, 126 tipc_msg_event message_cb,
127 tipc_named_msg_event named_message_cb, 127 tipc_named_msg_event named_message_cb,
128 tipc_conn_msg_event conn_message_cb, 128 tipc_conn_msg_event conn_message_cb,
129 tipc_continue_event continue_event_cb,/* May be zero */ 129 tipc_continue_event continue_event_cb,
130 u32 *portref); 130 u32 *portref);
131 131
132int tipc_deleteport(u32 portref); 132int tipc_deleteport(u32 portref);
@@ -145,13 +145,13 @@ int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
145int tipc_publish(u32 portref, unsigned int scope, 145int tipc_publish(u32 portref, unsigned int scope,
146 struct tipc_name_seq const *name_seq); 146 struct tipc_name_seq const *name_seq);
147int tipc_withdraw(u32 portref, unsigned int scope, 147int tipc_withdraw(u32 portref, unsigned int scope,
148 struct tipc_name_seq const *name_seq); /* 0: all */ 148 struct tipc_name_seq const *name_seq);
149 149
150int tipc_connect2port(u32 portref, struct tipc_portid const *port); 150int tipc_connect2port(u32 portref, struct tipc_portid const *port);
151 151
152int tipc_disconnect(u32 portref); 152int tipc_disconnect(u32 portref);
153 153
154int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */ 154int tipc_shutdown(u32 ref);
155 155
156int tipc_isconnected(u32 portref, int *isconnected); 156int tipc_isconnected(u32 portref, int *isconnected);
157 157
@@ -176,7 +176,7 @@ int tipc_send_buf(u32 portref,
176 176
177int tipc_send2name(u32 portref, 177int tipc_send2name(u32 portref,
178 struct tipc_name const *name, 178 struct tipc_name const *name,
179 u32 domain, /* 0:own zone */ 179 u32 domain,
180 unsigned int num_sect, 180 unsigned int num_sect,
181 struct iovec const *msg_sect); 181 struct iovec const *msg_sect);
182 182
@@ -188,7 +188,7 @@ int tipc_send_buf2name(u32 portref,
188 188
189int tipc_forward2name(u32 portref, 189int tipc_forward2name(u32 portref,
190 struct tipc_name const *name, 190 struct tipc_name const *name,
191 u32 domain, /*0: own zone */ 191 u32 domain,
192 unsigned int section_count, 192 unsigned int section_count,
193 struct iovec const *msg_sect, 193 struct iovec const *msg_sect,
194 struct tipc_portid const *origin, 194 struct tipc_portid const *origin,
@@ -228,14 +228,14 @@ int tipc_forward_buf2port(u32 portref,
228 228
229int tipc_multicast(u32 portref, 229int tipc_multicast(u32 portref,
230 struct tipc_name_seq const *seq, 230 struct tipc_name_seq const *seq,
231 u32 domain, /* 0:own zone */ 231 u32 domain, /* currently unused */
232 unsigned int section_count, 232 unsigned int section_count,
233 struct iovec const *msg); 233 struct iovec const *msg);
234 234
235#if 0 235#if 0
236int tipc_multicast_buf(u32 portref, 236int tipc_multicast_buf(u32 portref,
237 struct tipc_name_seq const *seq, 237 struct tipc_name_seq const *seq,
238 u32 domain, /* 0:own zone */ 238 u32 domain,
239 void *buf, 239 void *buf,
240 unsigned int size); 240 unsigned int size);
241#endif 241#endif
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index d65381cad0fc..42a0eb68b7b6 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,8 @@ extern int datagram_send_ctl(struct net *net,
44 struct msghdr *msg, 44 struct msghdr *msg,
45 struct flowi *fl, 45 struct flowi *fl,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass); 47 int *hlimit, int *tclass,
48 int *dontfrag);
48 49
49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) 50#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 51
diff --git a/include/net/x25.h b/include/net/x25.h
index 9baa07dc7d17..1479cb4a41fc 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -10,6 +10,7 @@
10#ifndef _X25_H 10#ifndef _X25_H
11#define _X25_H 11#define _X25_H
12#include <linux/x25.h> 12#include <linux/x25.h>
13#include <linux/slab.h>
13#include <net/sock.h> 14#include <net/sock.h>
14 15
15#define X25_ADDR_LEN 16 16#define X25_ADDR_LEN 16
@@ -79,8 +80,6 @@ enum {
79#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ 80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */
80#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ 81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */
81#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ 82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */
82#define X25_DENY_ACCPT_APPRV 0x01 /* Default value */
83#define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */
84 83
85#define X25_SMODULUS 8 84#define X25_SMODULUS 8
86#define X25_EMODULUS 128 85#define X25_EMODULUS 128
@@ -112,6 +111,11 @@ enum {
112#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ 111#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
113#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ 112#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
114 113
114/* Bitset in x25_sock->flags for misc flags */
115#define X25_Q_BIT_FLAG 0
116#define X25_INTERRUPT_FLAG 1
117#define X25_ACCPT_APPRV_FLAG 2
118
115/** 119/**
116 * struct x25_route - x25 routing entry 120 * struct x25_route - x25 routing entry
117 * @node - entry in x25_list_lock 121 * @node - entry in x25_list_lock
@@ -145,10 +149,11 @@ struct x25_sock {
145 struct x25_address source_addr, dest_addr; 149 struct x25_address source_addr, dest_addr;
146 struct x25_neigh *neighbour; 150 struct x25_neigh *neighbour;
147 unsigned int lci, cudmatchlength; 151 unsigned int lci, cudmatchlength;
148 unsigned char state, condition, qbitincl, intflag, accptapprv; 152 unsigned char state, condition;
149 unsigned short vs, vr, va, vl; 153 unsigned short vs, vr, va, vl;
150 unsigned long t2, t21, t22, t23; 154 unsigned long t2, t21, t22, t23;
151 unsigned short fraglen; 155 unsigned short fraglen;
156 unsigned long flags;
152 struct sk_buff_head ack_queue; 157 struct sk_buff_head ack_queue;
153 struct sk_buff_head fragment_queue; 158 struct sk_buff_head fragment_queue;
154 struct sk_buff_head interrupt_in_queue; 159 struct sk_buff_head interrupt_in_queue;
@@ -182,6 +187,10 @@ extern int sysctl_x25_clear_request_timeout;
182extern int sysctl_x25_ack_holdback_timeout; 187extern int sysctl_x25_ack_holdback_timeout;
183extern int sysctl_x25_forward; 188extern int sysctl_x25_forward;
184 189
190extern int x25_parse_address_block(struct sk_buff *skb,
191 struct x25_address *called_addr,
192 struct x25_address *calling_addr);
193
185extern int x25_addr_ntoa(unsigned char *, struct x25_address *, 194extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
186 struct x25_address *); 195 struct x25_address *);
187extern int x25_addr_aton(unsigned char *, struct x25_address *, 196extern int x25_addr_aton(unsigned char *, struct x25_address *,
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1415bcf93980..1fa08b49f1c2 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/if_ether.h> 4#include <linux/if_ether.h>
5#include <linux/if_packet.h> 5#include <linux/if_packet.h>
6#include <linux/if_x25.h>
6#include <linux/skbuff.h> 7#include <linux/skbuff.h>
7 8
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 9static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 60c27706e7b9..fc8f36dd0f5c 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -12,6 +12,7 @@
12#include <linux/in6.h> 12#include <linux/in6.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/audit.h> 14#include <linux/audit.h>
15#include <linux/slab.h>
15 16
16#include <net/sock.h> 17#include <net/sock.h>
17#include <net/dst.h> 18#include <net/dst.h>
@@ -19,6 +20,7 @@
19#include <net/route.h> 20#include <net/route.h>
20#include <net/ipv6.h> 21#include <net/ipv6.h>
21#include <net/ip6_fib.h> 22#include <net/ip6_fib.h>
23#include <net/flow.h>
22 24
23#include <linux/interrupt.h> 25#include <linux/interrupt.h>
24 26
@@ -140,6 +142,7 @@ struct xfrm_state {
140 142
141 struct xfrm_id id; 143 struct xfrm_id id;
142 struct xfrm_selector sel; 144 struct xfrm_selector sel;
145 struct xfrm_mark mark;
143 146
144 u32 genid; 147 u32 genid;
145 148
@@ -265,7 +268,6 @@ struct xfrm_policy_afinfo {
265 xfrm_address_t *saddr, 268 xfrm_address_t *saddr,
266 xfrm_address_t *daddr); 269 xfrm_address_t *daddr);
267 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); 270 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
268 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
269 void (*decode_session)(struct sk_buff *skb, 271 void (*decode_session)(struct sk_buff *skb,
270 struct flowi *fl, 272 struct flowi *fl,
271 int reverse); 273 int reverse);
@@ -274,7 +276,8 @@ struct xfrm_policy_afinfo {
274 struct dst_entry *dst, 276 struct dst_entry *dst,
275 int nfheader_len); 277 int nfheader_len);
276 int (*fill_dst)(struct xfrm_dst *xdst, 278 int (*fill_dst)(struct xfrm_dst *xdst,
277 struct net_device *dev); 279 struct net_device *dev,
280 struct flowi *fl);
278}; 281};
279 282
280extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 283extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
@@ -317,8 +320,8 @@ extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
317struct xfrm_type { 320struct xfrm_type {
318 char *description; 321 char *description;
319 struct module *owner; 322 struct module *owner;
320 __u8 proto; 323 u8 proto;
321 __u8 flags; 324 u8 flags;
322#define XFRM_TYPE_NON_FRAGMENT 1 325#define XFRM_TYPE_NON_FRAGMENT 1
323#define XFRM_TYPE_REPLAY_PROT 2 326#define XFRM_TYPE_REPLAY_PROT 2
324#define XFRM_TYPE_LOCAL_COADDR 4 327#define XFRM_TYPE_LOCAL_COADDR 4
@@ -434,24 +437,24 @@ struct xfrm_tmpl {
434 437
435 unsigned short encap_family; 438 unsigned short encap_family;
436 439
437 __u32 reqid; 440 u32 reqid;
438 441
439/* Mode: transport, tunnel etc. */ 442/* Mode: transport, tunnel etc. */
440 __u8 mode; 443 u8 mode;
441 444
442/* Sharing mode: unique, this session only, this user only etc. */ 445/* Sharing mode: unique, this session only, this user only etc. */
443 __u8 share; 446 u8 share;
444 447
445/* May skip this transfomration if no SA is found */ 448/* May skip this transfomration if no SA is found */
446 __u8 optional; 449 u8 optional;
447 450
448/* Skip aalgos/ealgos/calgos checks. */ 451/* Skip aalgos/ealgos/calgos checks. */
449 __u8 allalgs; 452 u8 allalgs;
450 453
451/* Bit mask of algos allowed for acquisition */ 454/* Bit mask of algos allowed for acquisition */
452 __u32 aalgos; 455 u32 aalgos;
453 __u32 ealgos; 456 u32 ealgos;
454 __u32 calgos; 457 u32 calgos;
455}; 458};
456 459
457#define XFRM_MAX_DEPTH 6 460#define XFRM_MAX_DEPTH 6
@@ -479,12 +482,14 @@ struct xfrm_policy {
479 atomic_t refcnt; 482 atomic_t refcnt;
480 struct timer_list timer; 483 struct timer_list timer;
481 484
485 struct flow_cache_object flo;
486 atomic_t genid;
482 u32 priority; 487 u32 priority;
483 u32 index; 488 u32 index;
489 struct xfrm_mark mark;
484 struct xfrm_selector selector; 490 struct xfrm_selector selector;
485 struct xfrm_lifetime_cfg lft; 491 struct xfrm_lifetime_cfg lft;
486 struct xfrm_lifetime_cur curlft; 492 struct xfrm_lifetime_cur curlft;
487 struct dst_entry *bundles;
488 struct xfrm_policy_walk_entry walk; 493 struct xfrm_policy_walk_entry walk;
489 u8 type; 494 u8 type;
490 u8 action; 495 u8 action;
@@ -731,19 +736,12 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy)
731 xfrm_policy_destroy(policy); 736 xfrm_policy_destroy(policy);
732} 737}
733 738
734#ifdef CONFIG_XFRM_SUB_POLICY
735static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) 739static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
736{ 740{
737 int i; 741 int i;
738 for (i = npols - 1; i >= 0; --i) 742 for (i = npols - 1; i >= 0; --i)
739 xfrm_pol_put(pols[i]); 743 xfrm_pol_put(pols[i]);
740} 744}
741#else
742static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
743{
744 xfrm_pol_put(pols[0]);
745}
746#endif
747 745
748extern void __xfrm_state_destroy(struct xfrm_state *); 746extern void __xfrm_state_destroy(struct xfrm_state *);
749 747
@@ -770,7 +768,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
770 int pdw; 768 int pdw;
771 int pbi; 769 int pbi;
772 770
773 pdw = prefixlen >> 5; /* num of whole __u32 in prefix */ 771 pdw = prefixlen >> 5; /* num of whole u32 in prefix */
774 pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ 772 pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
775 773
776 if (pdw) 774 if (pdw)
@@ -874,11 +872,15 @@ struct xfrm_dst {
874 struct rt6_info rt6; 872 struct rt6_info rt6;
875 } u; 873 } u;
876 struct dst_entry *route; 874 struct dst_entry *route;
875 struct flow_cache_object flo;
876 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
877 int num_pols, num_xfrms;
877#ifdef CONFIG_XFRM_SUB_POLICY 878#ifdef CONFIG_XFRM_SUB_POLICY
878 struct flowi *origin; 879 struct flowi *origin;
879 struct xfrm_selector *partner; 880 struct xfrm_selector *partner;
880#endif 881#endif
881 u32 genid; 882 u32 xfrm_genid;
883 u32 policy_genid;
882 u32 route_mtu_cached; 884 u32 route_mtu_cached;
883 u32 child_mtu_cached; 885 u32 child_mtu_cached;
884 u32 route_cookie; 886 u32 route_cookie;
@@ -888,6 +890,7 @@ struct xfrm_dst {
888#ifdef CONFIG_XFRM 890#ifdef CONFIG_XFRM
889static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) 891static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
890{ 892{
893 xfrm_pols_put(xdst->pols, xdst->num_pols);
891 dst_release(xdst->route); 894 dst_release(xdst->route);
892 if (likely(xdst->u.dst.xfrm)) 895 if (likely(xdst->u.dst.xfrm))
893 xfrm_state_put(xdst->u.dst.xfrm); 896 xfrm_state_put(xdst->u.dst.xfrm);
@@ -1259,7 +1262,7 @@ struct xfrm_algo_desc {
1259/* XFRM tunnel handlers. */ 1262/* XFRM tunnel handlers. */
1260struct xfrm_tunnel { 1263struct xfrm_tunnel {
1261 int (*handler)(struct sk_buff *skb); 1264 int (*handler)(struct sk_buff *skb);
1262 int (*err_handler)(struct sk_buff *skb, __u32 info); 1265 int (*err_handler)(struct sk_buff *skb, u32 info);
1263 1266
1264 struct xfrm_tunnel *next; 1267 struct xfrm_tunnel *next;
1265 int priority; 1268 int priority;
@@ -1317,7 +1320,7 @@ extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t
1317 struct flowi *fl, struct xfrm_tmpl *tmpl, 1320 struct flowi *fl, struct xfrm_tmpl *tmpl,
1318 struct xfrm_policy *pol, int *err, 1321 struct xfrm_policy *pol, int *err,
1319 unsigned short family); 1322 unsigned short family);
1320extern struct xfrm_state * xfrm_stateonly_find(struct net *net, 1323extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
1321 xfrm_address_t *daddr, 1324 xfrm_address_t *daddr,
1322 xfrm_address_t *saddr, 1325 xfrm_address_t *saddr,
1323 unsigned short family, 1326 unsigned short family,
@@ -1326,8 +1329,14 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
1326extern void xfrm_state_insert(struct xfrm_state *x); 1329extern void xfrm_state_insert(struct xfrm_state *x);
1327extern int xfrm_state_add(struct xfrm_state *x); 1330extern int xfrm_state_add(struct xfrm_state *x);
1328extern int xfrm_state_update(struct xfrm_state *x); 1331extern int xfrm_state_update(struct xfrm_state *x);
1329extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); 1332extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1330extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 1333 xfrm_address_t *daddr, __be32 spi,
1334 u8 proto, unsigned short family);
1335extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1336 xfrm_address_t *daddr,
1337 xfrm_address_t *saddr,
1338 u8 proto,
1339 unsigned short family);
1331#ifdef CONFIG_XFRM_SUB_POLICY 1340#ifdef CONFIG_XFRM_SUB_POLICY
1332extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1341extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1333 int n, unsigned short family); 1342 int n, unsigned short family);
@@ -1364,7 +1373,8 @@ struct xfrmk_spdinfo {
1364 u32 spdhmcnt; 1373 u32 spdhmcnt;
1365}; 1374};
1366 1375
1367extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq); 1376extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark,
1377 u32 seq);
1368extern int xfrm_state_delete(struct xfrm_state *x); 1378extern int xfrm_state_delete(struct xfrm_state *x);
1369extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1379extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1370extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1380extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
@@ -1408,9 +1418,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1408 xfrm_address_t *saddr, u8 proto); 1418 xfrm_address_t *saddr, u8 proto);
1409extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1419extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1410extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1420extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1411extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 1421extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1412extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 1422extern void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr);
1413extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 1423extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr);
1414extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1424extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1415extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1425extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1416extern int xfrm6_output(struct sk_buff *skb); 1426extern int xfrm6_output(struct sk_buff *skb);
@@ -1441,17 +1451,20 @@ extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1441 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1451 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1442extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1452extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1443int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1453int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1444struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir, 1454struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1455 u8 type, int dir,
1445 struct xfrm_selector *sel, 1456 struct xfrm_selector *sel,
1446 struct xfrm_sec_ctx *ctx, int delete, 1457 struct xfrm_sec_ctx *ctx, int delete,
1447 int *err); 1458 int *err);
1448struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err); 1459struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err);
1449int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1460int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1450u32 xfrm_get_acqseq(void); 1461u32 xfrm_get_acqseq(void);
1451extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1462extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1452struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto, 1463struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark,
1453 xfrm_address_t *daddr, xfrm_address_t *saddr, 1464 u8 mode, u32 reqid, u8 proto,
1454 int create, unsigned short family); 1465 xfrm_address_t *daddr,
1466 xfrm_address_t *saddr, int create,
1467 unsigned short family);
1455extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1468extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1456extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, 1469extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1457 struct flowi *fl, int family, int strict); 1470 struct flowi *fl, int family, int strict);
@@ -1500,7 +1513,7 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
1500 switch (family) { 1513 switch (family) {
1501 default: 1514 default:
1502 case AF_INET: 1515 case AF_INET:
1503 return (__force __u32)a->a4 - (__force __u32)b->a4; 1516 return (__force u32)a->a4 - (__force u32)b->a4;
1504 case AF_INET6: 1517 case AF_INET6:
1505 return ipv6_addr_cmp((struct in6_addr *)a, 1518 return ipv6_addr_cmp((struct in6_addr *)a,
1506 (struct in6_addr *)b); 1519 (struct in6_addr *)b);
@@ -1570,4 +1583,24 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1570} 1583}
1571#endif 1584#endif
1572 1585
1586static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1587{
1588 if (attrs[XFRMA_MARK])
1589 memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
1590 else
1591 m->v = m->m = 0;
1592
1593 return m->v & m->m;
1594}
1595
1596static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m)
1597{
1598 if (m->m | m->v)
1599 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
1600 return 0;
1601
1602nla_put_failure:
1603 return -1;
1604}
1605
1573#endif /* _NET_XFRM_H */ 1606#endif /* _NET_XFRM_H */
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 75fa3530345b..57d8d0393567 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -85,6 +85,7 @@ typedef struct config_req_t {
85#define CONF_ENABLE_IRQ 0x01 85#define CONF_ENABLE_IRQ 0x01
86#define CONF_ENABLE_DMA 0x02 86#define CONF_ENABLE_DMA 0x02
87#define CONF_ENABLE_SPKR 0x04 87#define CONF_ENABLE_SPKR 0x04
88#define CONF_ENABLE_PULSE_IRQ 0x08
88#define CONF_VALID_CLIENT 0x100 89#define CONF_VALID_CLIENT 0x100
89 90
90/* IntType field */ 91/* IntType field */
@@ -113,25 +114,7 @@ typedef struct io_req_t {
113#define IO_DATA_PATH_WIDTH_16 0x08 114#define IO_DATA_PATH_WIDTH_16 0x08
114#define IO_DATA_PATH_WIDTH_AUTO 0x10 115#define IO_DATA_PATH_WIDTH_AUTO 0x10
115 116
116/* For RequestIRQ and ReleaseIRQ */
117typedef struct irq_req_t {
118 u_int Attributes;
119 u_int AssignedIRQ;
120 irq_handler_t Handler;
121} irq_req_t;
122
123/* Attributes for RequestIRQ and ReleaseIRQ */
124#define IRQ_TYPE 0x03
125#define IRQ_TYPE_EXCLUSIVE 0x00
126#define IRQ_TYPE_TIME 0x01
127#define IRQ_TYPE_DYNAMIC_SHARING 0x02
128#define IRQ_FORCED_PULSE 0x04
129#define IRQ_FIRST_SHARED 0x08 /* unused */
130#define IRQ_HANDLE_PRESENT 0x10 /* unused */
131#define IRQ_PULSE_ALLOCATED 0x100
132
133/* Bits in IRQInfo1 field */ 117/* Bits in IRQInfo1 field */
134#define IRQ_MASK 0x0f
135#define IRQ_NMI_ID 0x01 118#define IRQ_NMI_ID 0x01
136#define IRQ_IOCK_ID 0x02 119#define IRQ_IOCK_ID 0x02
137#define IRQ_BERR_ID 0x04 120#define IRQ_BERR_ID 0x04
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h
index c33ea08352b8..63e5b8f6b7dd 100644
--- a/include/pcmcia/device_id.h
+++ b/include/pcmcia/device_id.h
@@ -34,6 +34,11 @@
34 .prod_id = { NULL, (v2), NULL, NULL }, \ 34 .prod_id = { NULL, (v2), NULL, NULL }, \
35 .prod_id_hash = { 0, (vh2), 0, 0 }, } 35 .prod_id_hash = { 0, (vh2), 0, 0 }, }
36 36
37#define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \
38 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \
39 .prod_id = { NULL, NULL, (v3), NULL }, \
40 .prod_id_hash = { 0, 0, (vh3), 0 }, }
41
37#define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \ 42#define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \
38 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 43 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
39 PCMCIA_DEV_ID_MATCH_PROD_ID2, \ 44 PCMCIA_DEV_ID_MATCH_PROD_ID2, \
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index ee148573c114..c180165fbd3e 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -26,6 +26,7 @@
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27#include <linux/device.h> 27#include <linux/device.h>
28#include <pcmcia/ss.h> 28#include <pcmcia/ss.h>
29#include <asm/atomic.h>
29 30
30/* 31/*
31 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus 32 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus
@@ -40,7 +41,7 @@ struct net_device;
40 * Documentation/pcmcia/driver.txt for details. 41 * Documentation/pcmcia/driver.txt for details.
41*/ 42*/
42struct pcmcia_dynids { 43struct pcmcia_dynids {
43 spinlock_t lock; 44 struct mutex lock;
44 struct list_head list; 45 struct list_head list;
45}; 46};
46 47
@@ -61,15 +62,6 @@ struct pcmcia_driver {
61int pcmcia_register_driver(struct pcmcia_driver *driver); 62int pcmcia_register_driver(struct pcmcia_driver *driver);
62void pcmcia_unregister_driver(struct pcmcia_driver *driver); 63void pcmcia_unregister_driver(struct pcmcia_driver *driver);
63 64
64/* Some drivers use dev_node_t to store char or block device information.
65 * Don't use this in new drivers, though.
66 */
67typedef struct dev_node_t {
68 char dev_name[DEV_NAME_LEN];
69 u_short major, minor;
70 struct dev_node_t *next;
71} dev_node_t;
72
73struct pcmcia_device { 65struct pcmcia_device {
74 /* the socket and the device_no [for multifunction devices] 66 /* the socket and the device_no [for multifunction devices]
75 uniquely define a pcmcia_device */ 67 uniquely define a pcmcia_device */
@@ -87,17 +79,16 @@ struct pcmcia_device {
87 struct list_head socket_device_list; 79 struct list_head socket_device_list;
88 80
89 /* deprecated, will be cleaned up soon */ 81 /* deprecated, will be cleaned up soon */
90 dev_node_t *dev_node;
91 u_int open; 82 u_int open;
92 io_req_t io; 83 io_req_t io;
93 irq_req_t irq;
94 config_req_t conf; 84 config_req_t conf;
95 window_handle_t win; 85 window_handle_t win;
96 86
97 /* Is the device suspended, or in the process of 87 /* device setup */
98 * being removed? */ 88 unsigned int irq;
89
90 /* Is the device suspended? */
99 u16 suspended:1; 91 u16 suspended:1;
100 u16 _removed:1;
101 92
102 /* Flags whether io, irq, win configurations were 93 /* Flags whether io, irq, win configurations were
103 * requested, and whether the configuration is "locked" */ 94 * requested, and whether the configuration is "locked" */
@@ -115,7 +106,7 @@ struct pcmcia_device {
115 u16 has_card_id:1; 106 u16 has_card_id:1;
116 u16 has_func_id:1; 107 u16 has_func_id:1;
117 108
118 u16 reserved:3; 109 u16 reserved:4;
119 110
120 u8 func_id; 111 u8 func_id;
121 u16 manf_id; 112 u16 manf_id;
@@ -192,7 +183,20 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
192 183
193/* device configuration */ 184/* device configuration */
194int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); 185int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
195int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); 186
187int __must_check
188__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
189 irq_handler_t handler);
190static inline __must_check __deprecated int
191pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
192 irq_handler_t handler)
193{
194 return __pcmcia_request_exclusive_irq(p_dev, handler);
195}
196
197int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev,
198 irq_handler_t handler);
199
196int pcmcia_request_configuration(struct pcmcia_device *p_dev, 200int pcmcia_request_configuration(struct pcmcia_device *p_dev,
197 config_req_t *req); 201 config_req_t *req);
198 202
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h
deleted file mode 100644
index 0fa06e5d5376..000000000000
--- a/include/pcmcia/mem_op.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * mem_op.h
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 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 *
12 * (C) 1999 David A. Hinds
13 */
14
15#ifndef _LINUX_MEM_OP_H
16#define _LINUX_MEM_OP_H
17
18#include <linux/io.h>
19#include <asm/uaccess.h>
20
21/*
22 If UNSAFE_MEMCPY is defined, we use the (optimized) system routines
23 to copy between a card and kernel memory. These routines do 32-bit
24 operations which may not work with all PCMCIA controllers. The
25 safe versions defined here will do only 8-bit and 16-bit accesses.
26*/
27
28#ifdef UNSAFE_MEMCPY
29
30#define copy_from_pc memcpy_fromio
31#define copy_to_pc memcpy_toio
32
33static inline void copy_pc_to_user(void *to, const void *from, size_t n)
34{
35 size_t odd = (n & 3);
36 n -= odd;
37 while (n) {
38 put_user(__raw_readl(from), (int *)to);
39 (char *)from += 4; (char *)to += 4; n -= 4;
40 }
41 while (odd--)
42 put_user(readb((char *)from++), (char *)to++);
43}
44
45static inline void copy_user_to_pc(void *to, const void *from, size_t n)
46{
47 int l;
48 char c;
49 size_t odd = (n & 3);
50 n -= odd;
51 while (n) {
52 get_user(l, (int *)from);
53 __raw_writel(l, to);
54 (char *)to += 4; (char *)from += 4; n -= 4;
55 }
56 while (odd--) {
57 get_user(c, (char *)from++);
58 writeb(c, (char *)to++);
59 }
60}
61
62#else /* UNSAFE_MEMCPY */
63
64static inline void copy_from_pc(void *to, void __iomem *from, size_t n)
65{
66 __u16 *t = to;
67 __u16 __iomem *f = from;
68 size_t odd = (n & 1);
69 for (n >>= 1; n; n--)
70 *t++ = __raw_readw(f++);
71 if (odd)
72 *(__u8 *)t = readb(f);
73}
74
75static inline void copy_to_pc(void __iomem *to, const void *from, size_t n)
76{
77 __u16 __iomem *t = to;
78 const __u16 *f = from;
79 size_t odd = (n & 1);
80 for (n >>= 1; n ; n--)
81 __raw_writew(*f++, t++);
82 if (odd)
83 writeb(*(__u8 *)f, t);
84}
85
86static inline void copy_pc_to_user(void __user *to, void __iomem *from, size_t n)
87{
88 __u16 __user *t = to;
89 __u16 __iomem *f = from;
90 size_t odd = (n & 1);
91 for (n >>= 1; n ; n--)
92 put_user(__raw_readw(f++), t++);
93 if (odd)
94 put_user(readb(f), (char __user *)t);
95}
96
97static inline void copy_user_to_pc(void __iomem *to, void __user *from, size_t n)
98{
99 __u16 __user *f = from;
100 __u16 __iomem *t = to;
101 short s;
102 char c;
103 size_t odd = (n & 1);
104 for (n >>= 1; n; n--) {
105 get_user(s, f++);
106 __raw_writew(s, t++);
107 }
108 if (odd) {
109 get_user(c, (char __user *)f);
110 writeb(c, t);
111 }
112}
113
114#endif /* UNSAFE_MEMCPY */
115
116#endif /* _LINUX_MEM_OP_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index cbfba885eb85..764281b29218 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -134,17 +134,13 @@ struct pccard_operations {
134 134
135struct pcmcia_socket { 135struct pcmcia_socket {
136 struct module *owner; 136 struct module *owner;
137 spinlock_t lock;
138 socket_state_t socket; 137 socket_state_t socket;
139 u_int state; 138 u_int state;
139 u_int suspended_state; /* state before suspend */
140 u_short functions; 140 u_short functions;
141 u_short lock_count; 141 u_short lock_count;
142 pccard_mem_map cis_mem; 142 pccard_mem_map cis_mem;
143 void __iomem *cis_virt; 143 void __iomem *cis_virt;
144 struct {
145 u_int AssignedIRQ;
146 u_int Config;
147 } irq;
148 io_window_t io[MAX_IO_WIN]; 144 io_window_t io[MAX_IO_WIN];
149 pccard_mem_map win[MAX_WIN]; 145 pccard_mem_map win[MAX_WIN];
150 struct list_head cis_cache; 146 struct list_head cis_cache;
@@ -200,9 +196,14 @@ struct pcmcia_socket {
200 struct task_struct *thread; 196 struct task_struct *thread;
201 struct completion thread_done; 197 struct completion thread_done;
202 unsigned int thread_events; 198 unsigned int thread_events;
203 /* protects socket h/w state */ 199 unsigned int sysfs_events;
200
201 /* For the non-trivial interaction between these locks,
202 * see Documentation/pcmcia/locking.txt */
204 struct mutex skt_mutex; 203 struct mutex skt_mutex;
205 /* protects thread_events */ 204 struct mutex ops_mutex;
205
206 /* protects thread_events and sysfs_events */
206 spinlock_t thread_lock; 207 spinlock_t thread_lock;
207 208
208 /* pcmcia (16-bit) */ 209 /* pcmcia (16-bit) */
@@ -219,23 +220,19 @@ struct pcmcia_socket {
219 220
220 /* 16-bit state: */ 221 /* 16-bit state: */
221 struct { 222 struct {
222 /* PCMCIA card is present in socket */
223 u8 present:1;
224 /* "master" ioctl is used */ 223 /* "master" ioctl is used */
225 u8 busy:1; 224 u8 busy:1;
226 /* pcmcia module is being unloaded */ 225 /* the PCMCIA card consists of two pseudo devices */
227 u8 dead:1; 226 u8 has_pfc:1;
228 /* a multifunction-device add event is pending */ 227
229 u8 device_add_pending:1; 228 u8 reserved:6;
230 /* the pending event adds a mfc (1) or pfc (0) */
231 u8 mfc_pfc:1;
232
233 u8 reserved:3;
234 } pcmcia_state; 229 } pcmcia_state;
235 230
231 /* non-zero if PCMCIA card is present */
232 atomic_t present;
236 233
237 /* for adding further pseudo-multifunction devices */ 234 /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */
238 struct work_struct device_add; 235 unsigned int pcmcia_irq;
239 236
240#ifdef CONFIG_PCMCIA_IOCTL 237#ifdef CONFIG_PCMCIA_IOCTL
241 struct user_info_t *user; 238 struct user_info_t *user;
@@ -243,12 +240,6 @@ struct pcmcia_socket {
243#endif /* CONFIG_PCMCIA_IOCTL */ 240#endif /* CONFIG_PCMCIA_IOCTL */
244#endif /* CONFIG_PCMCIA */ 241#endif /* CONFIG_PCMCIA */
245 242
246 /* cardbus (32-bit) */
247#ifdef CONFIG_CARDBUS
248 struct resource *cb_cis_res;
249 void __iomem *cb_cis_virt;
250#endif /* CONFIG_CARDBUS */
251
252 /* socket device */ 243 /* socket device */
253 struct device dev; 244 struct device dev;
254 /* data internal to the socket driver */ 245 /* data internal to the socket driver */
@@ -263,19 +254,25 @@ struct pcmcia_socket {
263 * - pccard_static_ops iomem and ioport areas are assigned statically 254 * - pccard_static_ops iomem and ioport areas are assigned statically
264 * - pccard_iodyn_ops iomem areas is assigned statically, ioport 255 * - pccard_iodyn_ops iomem areas is assigned statically, ioport
265 * areas dynamically 256 * areas dynamically
257 * If this option is selected, use
258 * "select PCCARD_IODYN" in Kconfig.
266 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. 259 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically.
267 * If this option is selected, use 260 * If this option is selected, use
268 * "select PCCARD_NONSTATIC" in Kconfig. 261 * "select PCCARD_NONSTATIC" in Kconfig.
262 *
269 */ 263 */
270extern struct pccard_resource_ops pccard_static_ops; 264extern struct pccard_resource_ops pccard_static_ops;
265#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
271extern struct pccard_resource_ops pccard_iodyn_ops; 266extern struct pccard_resource_ops pccard_iodyn_ops;
272extern struct pccard_resource_ops pccard_nonstatic_ops; 267extern struct pccard_resource_ops pccard_nonstatic_ops;
268#else
269/* If PCMCIA is not used, but only CARDBUS, these functions are not used
270 * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module
271 */
272#define pccard_iodyn_ops pccard_static_ops
273#define pccard_nonstatic_ops pccard_static_ops
274#endif
273 275
274/* socket drivers are expected to use these callbacks in their .drv struct */
275extern int pcmcia_socket_dev_suspend(struct device *dev);
276extern void pcmcia_socket_dev_early_resume(struct device *dev);
277extern void pcmcia_socket_dev_late_resume(struct device *dev);
278extern int pcmcia_socket_dev_resume(struct device *dev);
279 276
280/* socket drivers use this callback in their IRQ handler */ 277/* socket drivers use this callback in their IRQ handler */
281extern void pcmcia_parse_events(struct pcmcia_socket *socket, 278extern void pcmcia_parse_events(struct pcmcia_socket *socket,
diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h
index d7fc45c4eba9..cbb50f4da3dd 100644
--- a/include/rdma/ib_pack.h
+++ b/include/rdma/ib_pack.h
@@ -232,6 +232,7 @@ void ib_unpack(const struct ib_field *desc,
232 232
233void ib_ud_header_init(int payload_bytes, 233void ib_ud_header_init(int payload_bytes,
234 int grh_present, 234 int grh_present,
235 int immediate_present,
235 struct ib_ud_header *header); 236 struct ib_ud_header *header);
236 237
237int ib_ud_header_pack(struct ib_ud_header *header, 238int ib_ud_header_pack(struct ib_ud_header *header,
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 09509edb1c5f..f3e8f3c07725 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -136,6 +136,7 @@ struct ib_device_attr {
136 int max_qp_init_rd_atom; 136 int max_qp_init_rd_atom;
137 int max_ee_init_rd_atom; 137 int max_ee_init_rd_atom;
138 enum ib_atomic_cap atomic_cap; 138 enum ib_atomic_cap atomic_cap;
139 enum ib_atomic_cap masked_atomic_cap;
139 int max_ee; 140 int max_ee;
140 int max_rdd; 141 int max_rdd;
141 int max_mw; 142 int max_mw;
@@ -467,6 +468,8 @@ enum ib_wc_opcode {
467 IB_WC_LSO, 468 IB_WC_LSO,
468 IB_WC_LOCAL_INV, 469 IB_WC_LOCAL_INV,
469 IB_WC_FAST_REG_MR, 470 IB_WC_FAST_REG_MR,
471 IB_WC_MASKED_COMP_SWAP,
472 IB_WC_MASKED_FETCH_ADD,
470/* 473/*
471 * Set value of IB_WC_RECV so consumers can test if a completion is a 474 * Set value of IB_WC_RECV so consumers can test if a completion is a
472 * receive by testing (opcode & IB_WC_RECV). 475 * receive by testing (opcode & IB_WC_RECV).
@@ -689,6 +692,8 @@ enum ib_wr_opcode {
689 IB_WR_RDMA_READ_WITH_INV, 692 IB_WR_RDMA_READ_WITH_INV,
690 IB_WR_LOCAL_INV, 693 IB_WR_LOCAL_INV,
691 IB_WR_FAST_REG_MR, 694 IB_WR_FAST_REG_MR,
695 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
696 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
692}; 697};
693 698
694enum ib_send_flags { 699enum ib_send_flags {
@@ -731,6 +736,8 @@ struct ib_send_wr {
731 u64 remote_addr; 736 u64 remote_addr;
732 u64 compare_add; 737 u64 compare_add;
733 u64 swap; 738 u64 swap;
739 u64 compare_add_mask;
740 u64 swap_mask;
734 u32 rkey; 741 u32 rkey;
735 } atomic; 742 } atomic;
736 struct { 743 struct {
@@ -984,9 +991,9 @@ struct ib_device {
984 struct list_head event_handler_list; 991 struct list_head event_handler_list;
985 spinlock_t event_handler_lock; 992 spinlock_t event_handler_lock;
986 993
994 spinlock_t client_data_lock;
987 struct list_head core_list; 995 struct list_head core_list;
988 struct list_head client_data_list; 996 struct list_head client_data_list;
989 spinlock_t client_data_lock;
990 997
991 struct ib_cache cache; 998 struct ib_cache cache;
992 int *pkey_tbl_len; 999 int *pkey_tbl_len;
@@ -1144,8 +1151,8 @@ struct ib_device {
1144 IB_DEV_UNREGISTERED 1151 IB_DEV_UNREGISTERED
1145 } reg_state; 1152 } reg_state;
1146 1153
1147 u64 uverbs_cmd_mask;
1148 int uverbs_abi_ver; 1154 int uverbs_abi_ver;
1155 u64 uverbs_cmd_mask;
1149 1156
1150 char node_desc[64]; 1157 char node_desc[64];
1151 __be64 node_guid; 1158 __be64 node_guid;
@@ -1165,7 +1172,9 @@ struct ib_client {
1165struct ib_device *ib_alloc_device(size_t size); 1172struct ib_device *ib_alloc_device(size_t size);
1166void ib_dealloc_device(struct ib_device *device); 1173void ib_dealloc_device(struct ib_device *device);
1167 1174
1168int ib_register_device (struct ib_device *device); 1175int ib_register_device(struct ib_device *device,
1176 int (*port_callback)(struct ib_device *,
1177 u8, struct kobject *));
1169void ib_unregister_device(struct ib_device *device); 1178void ib_unregister_device(struct ib_device *device);
1170 1179
1171int ib_register_client (struct ib_client *client); 1180int ib_register_client (struct ib_client *client);
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index c6b2962315b3..4fae90304648 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -67,7 +67,6 @@ enum rdma_port_space {
67 RDMA_PS_IPOIB = 0x0002, 67 RDMA_PS_IPOIB = 0x0002,
68 RDMA_PS_TCP = 0x0106, 68 RDMA_PS_TCP = 0x0106,
69 RDMA_PS_UDP = 0x0111, 69 RDMA_PS_UDP = 0x0111,
70 RDMA_PS_SCTP = 0x0183
71}; 70};
72 71
73struct rdma_addr { 72struct rdma_addr {
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
index b3a0ee6b2f1c..f2b94918994d 100644
--- a/include/scsi/Kbuild
+++ b/include/scsi/Kbuild
@@ -1,4 +1,3 @@
1header-y += scsi.h
2header-y += scsi_netlink.h 1header-y += scsi_netlink.h
3header-y += scsi_netlink_fc.h 2header-y += scsi_netlink_fc.h
4header-y += scsi_bsg_fc.h 3header-y += scsi_bsg_fc.h
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 747e2c7d88d6..8e9b222251c2 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -76,6 +76,7 @@ struct fcp_cmnd32 {
76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */ 76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */
77#define FCP_PTA_ORDERED 2 /* ordered task attribute */ 77#define FCP_PTA_ORDERED 2 /* ordered task attribute */
78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */ 78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */
79#define FCP_PTA_MASK 7 /* mask for task attribute field */
79#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */ 80#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */
80#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */ 81#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */
81 82
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 8eb0a0fc0a71..9b4867c9c2d2 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -74,7 +74,7 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
74 adisc->adisc_cmd = ELS_ADISC; 74 adisc->adisc_cmd = ELS_ADISC;
75 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn); 75 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn);
76 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn); 76 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn);
77 hton24(adisc->adisc_port_id, fc_host_port_id(lport->host)); 77 hton24(adisc->adisc_port_id, lport->port_id);
78} 78}
79 79
80/** 80/**
@@ -127,15 +127,13 @@ static inline int fc_ct_fill(struct fc_lport *lport,
127 127
128 case FC_NS_RFT_ID: 128 case FC_NS_RFT_ID:
129 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 129 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft));
130 hton24(ct->payload.rft.fid.fp_fid, 130 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
131 fc_host_port_id(lport->host));
132 ct->payload.rft.fts = lport->fcts; 131 ct->payload.rft.fts = lport->fcts;
133 break; 132 break;
134 133
135 case FC_NS_RFF_ID: 134 case FC_NS_RFF_ID:
136 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); 135 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
137 hton24(ct->payload.rff.fr_fid.fp_fid, 136 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
138 fc_host_port_id(lport->host));
139 ct->payload.rff.fr_type = FC_TYPE_FCP; 137 ct->payload.rff.fr_type = FC_TYPE_FCP;
140 if (lport->service_params & FCP_SPPF_INIT_FCN) 138 if (lport->service_params & FCP_SPPF_INIT_FCN)
141 ct->payload.rff.fr_feat = FCP_FEAT_INIT; 139 ct->payload.rff.fr_feat = FCP_FEAT_INIT;
@@ -145,16 +143,14 @@ static inline int fc_ct_fill(struct fc_lport *lport,
145 143
146 case FC_NS_RNN_ID: 144 case FC_NS_RNN_ID:
147 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); 145 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
148 hton24(ct->payload.rn.fr_fid.fp_fid, 146 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
149 fc_host_port_id(lport->host));
150 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); 147 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
151 break; 148 break;
152 149
153 case FC_NS_RSPN_ID: 150 case FC_NS_RSPN_ID:
154 len = strnlen(fc_host_symbolic_name(lport->host), 255); 151 len = strnlen(fc_host_symbolic_name(lport->host), 255);
155 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); 152 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
156 hton24(ct->payload.spn.fr_fid.fp_fid, 153 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
157 fc_host_port_id(lport->host));
158 strncpy(ct->payload.spn.fr_name, 154 strncpy(ct->payload.spn.fr_name,
159 fc_host_symbolic_name(lport->host), len); 155 fc_host_symbolic_name(lport->host), len);
160 ct->payload.spn.fr_name_len = len; 156 ct->payload.spn.fr_name_len = len;
@@ -268,7 +264,7 @@ static inline void fc_logo_fill(struct fc_lport *lport, struct fc_frame *fp)
268 logo = fc_frame_payload_get(fp, sizeof(*logo)); 264 logo = fc_frame_payload_get(fp, sizeof(*logo));
269 memset(logo, 0, sizeof(*logo)); 265 memset(logo, 0, sizeof(*logo));
270 logo->fl_cmd = ELS_LOGO; 266 logo->fl_cmd = ELS_LOGO;
271 hton24(logo->fl_n_port_id, fc_host_port_id(lport->host)); 267 hton24(logo->fl_n_port_id, lport->port_id);
272 logo->fl_n_port_wwn = htonll(lport->wwpn); 268 logo->fl_n_port_wwn = htonll(lport->wwpn);
273} 269}
274 270
@@ -295,7 +291,7 @@ static inline void fc_rec_fill(struct fc_lport *lport, struct fc_frame *fp)
295 rec = fc_frame_payload_get(fp, sizeof(*rec)); 291 rec = fc_frame_payload_get(fp, sizeof(*rec));
296 memset(rec, 0, sizeof(*rec)); 292 memset(rec, 0, sizeof(*rec));
297 rec->rec_cmd = ELS_REC; 293 rec->rec_cmd = ELS_REC;
298 hton24(rec->rec_s_id, fc_host_port_id(lport->host)); 294 hton24(rec->rec_s_id, lport->port_id);
299 rec->rec_ox_id = htons(ep->oxid); 295 rec->rec_ox_id = htons(ep->oxid);
300 rec->rec_rx_id = htons(ep->rxid); 296 rec->rec_rx_id = htons(ep->rxid);
301} 297}
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 4b912eee33e5..7495c0ba67ee 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -47,13 +47,18 @@
47#define ntohll(x) be64_to_cpu(x) 47#define ntohll(x) be64_to_cpu(x)
48#define htonll(x) cpu_to_be64(x) 48#define htonll(x) cpu_to_be64(x)
49 49
50#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
51 50
52#define hton24(p, v) do { \ 51static inline u32 ntoh24(const u8 *p)
53 p[0] = (((v) >> 16) & 0xFF); \ 52{
54 p[1] = (((v) >> 8) & 0xFF); \ 53 return (p[0] << 16) | (p[1] << 8) | p[2];
55 p[2] = ((v) & 0xFF); \ 54}
56 } while (0) 55
56static inline void hton24(u8 *p, u32 v)
57{
58 p[0] = (v >> 16) & 0xff;
59 p[1] = (v >> 8) & 0xff;
60 p[2] = v & 0xff;
61}
57 62
58/** 63/**
59 * enum fc_lport_state - Local port states 64 * enum fc_lport_state - Local port states
@@ -775,6 +780,7 @@ struct fc_disc {
775 * @dev_stats: FCoE device stats (TODO: libfc should not be 780 * @dev_stats: FCoE device stats (TODO: libfc should not be
776 * FCoE aware) 781 * FCoE aware)
777 * @retry_count: Number of retries in the current state 782 * @retry_count: Number of retries in the current state
783 * @port_id: FC Port ID
778 * @wwpn: World Wide Port Name 784 * @wwpn: World Wide Port Name
779 * @wwnn: World Wide Node Name 785 * @wwnn: World Wide Node Name
780 * @service_params: Common service parameters 786 * @service_params: Common service parameters
@@ -821,6 +827,7 @@ struct fc_lport {
821 u8 retry_count; 827 u8 retry_count;
822 828
823 /* Fabric information */ 829 /* Fabric information */
830 u32 port_id;
824 u64 wwpn; 831 u64 wwpn;
825 u64 wwnn; 832 u64 wwnn;
826 unsigned int service_params; 833 unsigned int service_params;
@@ -918,15 +925,6 @@ static inline void fc_lport_free_stats(struct fc_lport *lport)
918} 925}
919 926
920/** 927/**
921 * fc_lport_get_stats() - Get a local port's statistics
922 * @lport: The local port whose statistics are to be retreived
923 */
924static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport)
925{
926 return per_cpu_ptr(lport->dev_stats, smp_processor_id());
927}
928
929/**
930 * lport_priv() - Return the private data from a local port 928 * lport_priv() - Return the private data from a local port
931 * @lport: The local port whose private data is to be retreived 929 * @lport: The local port whose private data is to be retreived
932 */ 930 */
@@ -1053,7 +1051,6 @@ void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
1053 * Functions for fc_functions_template 1051 * Functions for fc_functions_template
1054 */ 1052 */
1055void fc_get_host_speed(struct Scsi_Host *); 1053void fc_get_host_speed(struct Scsi_Host *);
1056void fc_get_host_port_type(struct Scsi_Host *);
1057void fc_get_host_port_state(struct Scsi_Host *); 1054void fc_get_host_port_state(struct Scsi_Host *);
1058void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout); 1055void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout);
1059struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); 1056struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index c603f4a7e7fc..ec13f51531f8 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -29,6 +29,8 @@
29#include <scsi/fc/fc_fcoe.h> 29#include <scsi/fc/fc_fcoe.h>
30#include <scsi/libfc.h> 30#include <scsi/libfc.h>
31 31
32#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
33
32/* 34/*
33 * FIP tunable parameters. 35 * FIP tunable parameters.
34 */ 36 */
@@ -65,14 +67,12 @@ enum fip_state {
65 * @port_ka_time: time of next port keep-alive. 67 * @port_ka_time: time of next port keep-alive.
66 * @ctlr_ka_time: time of next controller keep-alive. 68 * @ctlr_ka_time: time of next controller keep-alive.
67 * @timer: timer struct used for all delayed events. 69 * @timer: timer struct used for all delayed events.
68 * @link_work: &work_struct for doing FCF selection. 70 * @timer_work: &work_struct for doing keep-alives and resets.
69 * @recv_work: &work_struct for receiving FIP frames. 71 * @recv_work: &work_struct for receiving FIP frames.
70 * @fip_recv_list: list of received FIP frames. 72 * @fip_recv_list: list of received FIP frames.
71 * @user_mfs: configured maximum FC frame size, including FC header. 73 * @user_mfs: configured maximum FC frame size, including FC header.
72 * @flogi_oxid: exchange ID of most recent fabric login. 74 * @flogi_oxid: exchange ID of most recent fabric login.
73 * @flogi_count: number of FLOGI attempts in AUTO mode. 75 * @flogi_count: number of FLOGI attempts in AUTO mode.
74 * @link: current link status for libfc.
75 * @last_link: last link state reported to libfc.
76 * @map_dest: use the FC_MAP mode for destination MAC addresses. 76 * @map_dest: use the FC_MAP mode for destination MAC addresses.
77 * @spma: supports SPMA server-provided MACs mode 77 * @spma: supports SPMA server-provided MACs mode
78 * @send_ctlr_ka: need to send controller keep alive 78 * @send_ctlr_ka: need to send controller keep alive
@@ -100,14 +100,12 @@ struct fcoe_ctlr {
100 unsigned long port_ka_time; 100 unsigned long port_ka_time;
101 unsigned long ctlr_ka_time; 101 unsigned long ctlr_ka_time;
102 struct timer_list timer; 102 struct timer_list timer;
103 struct work_struct link_work; 103 struct work_struct timer_work;
104 struct work_struct recv_work; 104 struct work_struct recv_work;
105 struct sk_buff_head fip_recv_list; 105 struct sk_buff_head fip_recv_list;
106 u16 user_mfs; 106 u16 user_mfs;
107 u16 flogi_oxid; 107 u16 flogi_oxid;
108 u8 flogi_count; 108 u8 flogi_count;
109 u8 link;
110 u8 last_link;
111 u8 reset_req; 109 u8 reset_req;
112 u8 map_dest; 110 u8 map_dest;
113 u8 spma; 111 u8 spma;
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index ff92b46f5153..ae5196aae1a5 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -338,7 +338,8 @@ struct iscsi_host {
338extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, 338extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
339 int reason); 339 int reason);
340extern int iscsi_eh_abort(struct scsi_cmnd *sc); 340extern int iscsi_eh_abort(struct scsi_cmnd *sc);
341extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); 341extern int iscsi_eh_recover_target(struct scsi_cmnd *sc);
342extern int iscsi_eh_session_reset(struct scsi_cmnd *sc);
342extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 343extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
343extern int iscsi_queuecommand(struct scsi_cmnd *sc, 344extern int iscsi_queuecommand(struct scsi_cmnd *sc,
344 void (*done)(struct scsi_cmnd *)); 345 void (*done)(struct scsi_cmnd *));
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 9eaa3f05f954..3b586859669c 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -36,6 +36,7 @@
36#include <scsi/scsi_cmnd.h> 36#include <scsi/scsi_cmnd.h>
37#include <scsi/scsi_transport_sas.h> 37#include <scsi/scsi_transport_sas.h>
38#include <linux/scatterlist.h> 38#include <linux/scatterlist.h>
39#include <linux/slab.h>
39 40
40struct block_device; 41struct block_device;
41 42
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 8b4deca996ad..9ae5c613131b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -114,6 +114,7 @@ struct scsi_cmnd;
114#define READ_12 0xa8 114#define READ_12 0xa8
115#define WRITE_12 0xaa 115#define WRITE_12 0xaa
116#define WRITE_VERIFY_12 0xae 116#define WRITE_VERIFY_12 0xae
117#define VERIFY_12 0xaf
117#define SEARCH_HIGH_12 0xb0 118#define SEARCH_HIGH_12 0xb0
118#define SEARCH_EQUAL_12 0xb1 119#define SEARCH_EQUAL_12 0xb1
119#define SEARCH_LOW_12 0xb2 120#define SEARCH_LOW_12 0xb2
@@ -134,6 +135,7 @@ struct scsi_cmnd;
134#define MO_SET_TARGET_PGS 0x0a 135#define MO_SET_TARGET_PGS 0x0a
135/* values for variable length command */ 136/* values for variable length command */
136#define READ_32 0x09 137#define READ_32 0x09
138#define VERIFY_32 0x0a
137#define WRITE_32 0x0b 139#define WRITE_32 0x0b
138#define WRITE_SAME_32 0x0d 140#define WRITE_SAME_32 0x0d
139 141
@@ -423,6 +425,7 @@ static inline int scsi_is_wlun(unsigned int lun)
423#define ADD_TO_MLQUEUE 0x2006 425#define ADD_TO_MLQUEUE 0x2006
424#define TIMEOUT_ERROR 0x2007 426#define TIMEOUT_ERROR 0x2007
425#define SCSI_RETURN_NOT_HANDLED 0x2008 427#define SCSI_RETURN_NOT_HANDLED 0x2008
428#define FAST_IO_FAIL 0x2009
426 429
427/* 430/*
428 * Midlevel queue return values. 431 * Midlevel queue return values.
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 7c4449900c24..d80b6dbed1ca 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -348,7 +348,8 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp,
348 struct scsi_sense_hdr *); 348 struct scsi_sense_hdr *);
349extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, 349extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
350 int retries, struct scsi_sense_hdr *sshdr); 350 int retries, struct scsi_sense_hdr *sshdr);
351extern unsigned char *scsi_get_vpd_page(struct scsi_device *, u8 page); 351extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf,
352 int buf_len);
352extern int scsi_device_set_state(struct scsi_device *sdev, 353extern int scsi_device_set_state(struct scsi_device *sdev,
353 enum scsi_device_state state); 354 enum scsi_device_state state);
354extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, 355extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index c50a97fc76f9..b7bdecb7b76e 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -327,6 +327,14 @@ struct scsi_host_template {
327 sector_t, int []); 327 sector_t, int []);
328 328
329 /* 329 /*
330 * This function is called when one or more partitions on the
331 * device reach beyond the end of the device.
332 *
333 * Status: OPTIONAL
334 */
335 void (*unlock_native_capacity)(struct scsi_device *);
336
337 /*
330 * Can be used to export driver statistics and other infos to the 338 * Can be used to export driver statistics and other infos to the
331 * world outside the kernel ie. userspace and it also provides an 339 * world outside the kernel ie. userspace and it also provides an
332 * interface to feed the driver with information. 340 * interface to feed the driver with information.
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 8e86a94faf06..87d81b3ce564 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -807,6 +807,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, 807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
808 struct fc_vport_identifiers *); 808 struct fc_vport_identifiers *);
809int fc_vport_terminate(struct fc_vport *vport); 809int fc_vport_terminate(struct fc_vport *vport);
810void fc_block_scsi_eh(struct scsi_cmnd *cmnd); 810int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
811 811
812#endif /* SCSI_TRANSPORT_FC_H */ 812#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 61ad3594aad6..ffeebc34a4f7 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -107,6 +107,8 @@ struct sas_end_device {
107 struct sas_rphy rphy; 107 struct sas_rphy rphy;
108 /* flags */ 108 /* flags */
109 unsigned ready_led_meaning:1; 109 unsigned ready_led_meaning:1;
110 unsigned tlr_supported:1;
111 unsigned tlr_enabled:1;
110 /* parameters */ 112 /* parameters */
111 u16 I_T_nexus_loss_timeout; 113 u16 I_T_nexus_loss_timeout;
112 u16 initiator_response_timeout; 114 u16 initiator_response_timeout;
@@ -181,6 +183,11 @@ extern int sas_phy_add(struct sas_phy *);
181extern void sas_phy_delete(struct sas_phy *); 183extern void sas_phy_delete(struct sas_phy *);
182extern int scsi_is_sas_phy(const struct device *); 184extern int scsi_is_sas_phy(const struct device *);
183 185
186unsigned int sas_tlr_supported(struct scsi_device *);
187unsigned int sas_is_tlr_enabled(struct scsi_device *);
188void sas_disable_tlr(struct scsi_device *);
189void sas_enable_tlr(struct scsi_device *);
190
184extern struct sas_rphy *sas_end_device_alloc(struct sas_port *); 191extern struct sas_rphy *sas_end_device_alloc(struct sas_port *);
185extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type); 192extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type);
186void sas_rphy_free(struct sas_rphy *); 193void sas_rphy_free(struct sas_rphy *);
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 934ae389671d..a9f3c6fc3f57 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -70,6 +70,9 @@ Major new features in SG 3.x driver (cf SG 2.x drivers)
70 (for the lk 2.2 series). 70 (for the lk 2.2 series).
71*/ 71*/
72 72
73#ifdef __KERNEL__
74extern int sg_big_buff; /* for sysctl */
75#endif
73 76
74/* New interface introduced in the 3.x SG drivers follows */ 77/* New interface introduced in the 3.x SG drivers follows */
75 78
diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h
index 8988edae1609..2609048c1d44 100644
--- a/include/sound/ak4113.h
+++ b/include/sound/ak4113.h
@@ -307,7 +307,7 @@ struct ak4113 {
307 307
308int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read, 308int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
309 ak4113_write_t *write, 309 ak4113_write_t *write,
310 const unsigned char pgm[AK4113_WRITABLE_REGS], 310 const unsigned char *pgm,
311 void *private_data, struct ak4113 **r_ak4113); 311 void *private_data, struct ak4113 **r_ak4113);
312void snd_ak4113_reg_write(struct ak4113 *ak4113, unsigned char reg, 312void snd_ak4113_reg_write(struct ak4113 *ak4113, unsigned char reg,
313 unsigned char mask, unsigned char val); 313 unsigned char mask, unsigned char val);
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 1f57bb92eb5a..9f1eecf99e6b 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -544,7 +544,7 @@ struct snd_rawmidi_status {
544 * Timer section - /dev/snd/timer 544 * Timer section - /dev/snd/timer
545 */ 545 */
546 546
547#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) 547#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
548 548
549enum { 549enum {
550 SNDRV_TIMER_CLASS_NONE = -1, 550 SNDRV_TIMER_CLASS_NONE = -1,
@@ -574,7 +574,7 @@ enum {
574#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 574#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
575 575
576struct snd_timer_id { 576struct snd_timer_id {
577 int dev_class; 577 int dev_class;
578 int dev_sclass; 578 int dev_sclass;
579 int card; 579 int card;
580 int device; 580 int device;
@@ -762,7 +762,7 @@ struct snd_ctl_elem_id {
762 snd_ctl_elem_iface_t iface; /* interface identifier */ 762 snd_ctl_elem_iface_t iface; /* interface identifier */
763 unsigned int device; /* device/client number */ 763 unsigned int device; /* device/client number */
764 unsigned int subdevice; /* subdevice (substream) number */ 764 unsigned int subdevice; /* subdevice (substream) number */
765 unsigned char name[44]; /* ASCII name of item */ 765 unsigned char name[44]; /* ASCII name of item */
766 unsigned int index; /* index of item */ 766 unsigned int index; /* index of item */
767}; 767};
768 768
@@ -809,7 +809,7 @@ struct snd_ctl_elem_info {
809struct snd_ctl_elem_value { 809struct snd_ctl_elem_value {
810 struct snd_ctl_elem_id id; /* W: element ID */ 810 struct snd_ctl_elem_id id; /* W: element ID */
811 unsigned int indirect: 1; /* W: indirect access - obsoleted */ 811 unsigned int indirect: 1; /* W: indirect access - obsoleted */
812 union { 812 union {
813 union { 813 union {
814 long value[128]; 814 long value[128];
815 long *value_ptr; /* obsoleted */ 815 long *value_ptr; /* obsoleted */
@@ -827,15 +827,15 @@ struct snd_ctl_elem_value {
827 unsigned char *data_ptr; /* obsoleted */ 827 unsigned char *data_ptr; /* obsoleted */
828 } bytes; 828 } bytes;
829 struct snd_aes_iec958 iec958; 829 struct snd_aes_iec958 iec958;
830 } value; /* RO */ 830 } value; /* RO */
831 struct timespec tstamp; 831 struct timespec tstamp;
832 unsigned char reserved[128-sizeof(struct timespec)]; 832 unsigned char reserved[128-sizeof(struct timespec)];
833}; 833};
834 834
835struct snd_ctl_tlv { 835struct snd_ctl_tlv {
836 unsigned int numid; /* control element numeric identification */ 836 unsigned int numid; /* control element numeric identification */
837 unsigned int length; /* in bytes aligned to 4 */ 837 unsigned int length; /* in bytes aligned to 4 */
838 unsigned int tlv[0]; /* first TLV */ 838 unsigned int tlv[0]; /* first TLV */
839}; 839};
840 840
841#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) 841#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
@@ -886,8 +886,8 @@ struct snd_ctl_event {
886 unsigned int mask; 886 unsigned int mask;
887 struct snd_ctl_elem_id id; 887 struct snd_ctl_elem_id id;
888 } elem; 888 } elem;
889 unsigned char data8[60]; 889 unsigned char data8[60];
890 } data; 890 } data;
891}; 891};
892 892
893/* 893/*
diff --git a/include/sound/core.h b/include/sound/core.h
index a61499c22b0b..89e0ac17f44a 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -458,5 +458,8 @@ struct snd_pci_quirk {
458const struct snd_pci_quirk * 458const struct snd_pci_quirk *
459snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); 459snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
460 460
461const struct snd_pci_quirk *
462snd_pci_quirk_lookup_id(u16 vendor, u16 device,
463 const struct snd_pci_quirk *list);
461 464
462#endif /* __SOUND_CORE_H */ 465#endif /* __SOUND_CORE_H */
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h
index 7c44667e79a6..49b03c9e5e55 100644
--- a/include/sound/cs46xx_dsp_spos.h
+++ b/include/sound/cs46xx_dsp_spos.h
@@ -118,9 +118,11 @@ struct dsp_scb_descriptor {
118 118
119 struct snd_info_entry *proc_info; 119 struct snd_info_entry *proc_info;
120 int ref_count; 120 int ref_count;
121 spinlock_t lock;
122 121
123 int deleted; 122 u16 volume[2];
123 unsigned int deleted :1;
124 unsigned int updated :1;
125 unsigned int volume_set :1;
124}; 126};
125 127
126struct dsp_task_descriptor { 128struct dsp_task_descriptor {
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index 10fcf1465810..3ec7ecbe2502 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -44,7 +44,6 @@ struct snd_es1688 {
44 unsigned char pad; 44 unsigned char pad;
45 unsigned int dma_size; 45 unsigned int dma_size;
46 46
47 struct snd_card *card;
48 struct snd_pcm *pcm; 47 struct snd_pcm *pcm;
49 struct snd_pcm_substream *playback_substream; 48 struct snd_pcm_substream *playback_substream;
50 struct snd_pcm_substream *capture_substream; 49 struct snd_pcm_substream *capture_substream;
@@ -108,14 +107,16 @@ struct snd_es1688 {
108void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data); 107void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
109 108
110int snd_es1688_create(struct snd_card *card, 109int snd_es1688_create(struct snd_card *card,
110 struct snd_es1688 *chip,
111 unsigned long port, 111 unsigned long port,
112 unsigned long mpu_port, 112 unsigned long mpu_port,
113 int irq, 113 int irq,
114 int mpu_irq, 114 int mpu_irq,
115 int dma8, 115 int dma8,
116 unsigned short hardware, 116 unsigned short hardware);
117 struct snd_es1688 ** rchip); 117int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device,
118int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm); 118 struct snd_pcm **rpcm);
119int snd_es1688_mixer(struct snd_es1688 *chip); 119int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
120int snd_es1688_reset(struct snd_es1688 *chip);
120 121
121#endif /* __SOUND_ES1688_H */ 122#endif /* __SOUND_ES1688_H */
diff --git a/include/sound/info.h b/include/sound/info.h
index 112e8949e1a7..4e94cf1ff762 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -51,18 +51,18 @@ struct snd_info_entry_ops {
51 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
52 int (*release)(struct snd_info_entry *entry, 52 int (*release)(struct snd_info_entry *entry,
53 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
54 long (*read)(struct snd_info_entry *entry, void *file_private_data, 54 ssize_t (*read)(struct snd_info_entry *entry, void *file_private_data,
55 struct file *file, char __user *buf, 55 struct file *file, char __user *buf,
56 unsigned long count, unsigned long pos); 56 size_t count, loff_t pos);
57 long (*write)(struct snd_info_entry *entry, void *file_private_data, 57 ssize_t (*write)(struct snd_info_entry *entry, void *file_private_data,
58 struct file *file, const char __user *buf, 58 struct file *file, const char __user *buf,
59 unsigned long count, unsigned long pos); 59 size_t count, loff_t pos);
60 long long (*llseek)(struct snd_info_entry *entry, 60 loff_t (*llseek)(struct snd_info_entry *entry,
61 void *file_private_data, struct file *file, 61 void *file_private_data, struct file *file,
62 long long offset, int orig); 62 loff_t offset, int orig);
63 unsigned int(*poll)(struct snd_info_entry *entry, 63 unsigned int (*poll)(struct snd_info_entry *entry,
64 void *file_private_data, struct file *file, 64 void *file_private_data, struct file *file,
65 poll_table *wait); 65 poll_table *wait);
66 int (*ioctl)(struct snd_info_entry *entry, void *file_private_data, 66 int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
67 struct file *file, unsigned int cmd, unsigned long arg); 67 struct file *file, unsigned int cmd, unsigned long arg);
68 int (*mmap)(struct snd_info_entry *entry, void *file_private_data, 68 int (*mmap)(struct snd_info_entry *entry, void *file_private_data,
diff --git a/include/sound/jack.h b/include/sound/jack.h
index f236e426a706..d90b9fa32707 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -42,6 +42,11 @@ enum snd_jack_types {
42 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */ 42 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */
43 SND_JACK_VIDEOOUT = 0x0010, 43 SND_JACK_VIDEOOUT = 0x0010,
44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT, 44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
45
46 /* Kept separate from switches to facilitate implementation */
47 SND_JACK_BTN_0 = 0x4000,
48 SND_JACK_BTN_1 = 0x2000,
49 SND_JACK_BTN_2 = 0x1000,
45}; 50};
46 51
47struct snd_jack { 52struct snd_jack {
@@ -50,6 +55,7 @@ struct snd_jack {
50 int type; 55 int type;
51 const char *id; 56 const char *id;
52 char name[100]; 57 char name[100];
58 unsigned int key[3]; /* Keep in sync with definitions above */
53 void *private_data; 59 void *private_data;
54 void (*private_free)(struct snd_jack *); 60 void (*private_free)(struct snd_jack *);
55}; 61};
@@ -59,6 +65,8 @@ struct snd_jack {
59int snd_jack_new(struct snd_card *card, const char *id, int type, 65int snd_jack_new(struct snd_card *card, const char *id, int type,
60 struct snd_jack **jack); 66 struct snd_jack **jack);
61void snd_jack_set_parent(struct snd_jack *jack, struct device *parent); 67void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
68int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
69 int keytype);
62 70
63void snd_jack_report(struct snd_jack *jack, int status); 71void snd_jack_report(struct snd_jack *jack, int status);
64 72
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c83a4a79f16b..dd76cdede64d 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -29,6 +29,7 @@
29#include <linux/poll.h> 29#include <linux/poll.h>
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/pm_qos_params.h>
32 33
33#define snd_pcm_substream_chip(substream) ((substream)->private_data) 34#define snd_pcm_substream_chip(substream) ((substream)->private_data)
34#define snd_pcm_chip(pcm) ((pcm)->private_data) 35#define snd_pcm_chip(pcm) ((pcm)->private_data)
@@ -262,6 +263,8 @@ struct snd_pcm_hw_constraint_list {
262 unsigned int mask; 263 unsigned int mask;
263}; 264};
264 265
266struct snd_pcm_hwptr_log;
267
265struct snd_pcm_runtime { 268struct snd_pcm_runtime {
266 /* -- Status -- */ 269 /* -- Status -- */
267 struct snd_pcm_substream *trigger_master; 270 struct snd_pcm_substream *trigger_master;
@@ -310,7 +313,9 @@ struct snd_pcm_runtime {
310 struct snd_pcm_mmap_control *control; 313 struct snd_pcm_mmap_control *control;
311 314
312 /* -- locking / scheduling -- */ 315 /* -- locking / scheduling -- */
313 wait_queue_head_t sleep; 316 unsigned int twake: 1; /* do transfer (!poll) wakeup */
317 wait_queue_head_t sleep; /* poll sleep */
318 wait_queue_head_t tsleep; /* transfer sleep */
314 struct fasync_struct *fasync; 319 struct fasync_struct *fasync;
315 320
316 /* -- private section -- */ 321 /* -- private section -- */
@@ -340,6 +345,10 @@ struct snd_pcm_runtime {
340 /* -- OSS things -- */ 345 /* -- OSS things -- */
341 struct snd_pcm_oss_runtime oss; 346 struct snd_pcm_oss_runtime oss;
342#endif 347#endif
348
349#ifdef CONFIG_SND_PCM_XRUN_DEBUG
350 struct snd_pcm_hwptr_log *hwptr_log;
351#endif
343}; 352};
344 353
345struct snd_pcm_group { /* keep linked substreams */ 354struct snd_pcm_group { /* keep linked substreams */
@@ -357,7 +366,7 @@ struct snd_pcm_substream {
357 int number; 366 int number;
358 char name[32]; /* substream name */ 367 char name[32]; /* substream name */
359 int stream; /* stream (direction) */ 368 int stream; /* stream (direction) */
360 char latency_id[20]; /* latency identifier */ 369 struct pm_qos_request_list *latency_pm_qos_req; /* pm_qos request */
361 size_t buffer_bytes_max; /* limit ring buffer size */ 370 size_t buffer_bytes_max; /* limit ring buffer size */
362 struct snd_dma_buffer dma_buffer; 371 struct snd_dma_buffer dma_buffer;
363 unsigned int dma_buf_id; 372 unsigned int dma_buf_id;
@@ -834,6 +843,8 @@ void snd_pcm_set_sync(struct snd_pcm_substream *substream);
834int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); 843int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
835int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 844int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
836 unsigned int cmd, void *arg); 845 unsigned int cmd, void *arg);
846int snd_pcm_update_state(struct snd_pcm_substream *substream,
847 struct snd_pcm_runtime *runtime);
837int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream); 848int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
838int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream); 849int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
839int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); 850int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
@@ -905,6 +916,44 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
905int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); 916int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
906int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); 917int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
907 918
919int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream,
920 size_t size, gfp_t gfp_flags);
921int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream);
922struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
923 unsigned long offset);
924#if 0 /* for kernel-doc */
925/**
926 * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer
927 * @substream: the substream to allocate the buffer to
928 * @size: the requested buffer size, in bytes
929 *
930 * Allocates the PCM substream buffer using vmalloc(), i.e., the memory is
931 * contiguous in kernel virtual space, but not in physical memory. Use this
932 * if the buffer is accessed by kernel code but not by device DMA.
933 *
934 * Returns 1 if the buffer was changed, 0 if not changed, or a negative error
935 * code.
936 */
937static int snd_pcm_lib_alloc_vmalloc_buffer
938 (struct snd_pcm_substream *substream, size_t size);
939/**
940 * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer
941 * @substream: the substream to allocate the buffer to
942 * @size: the requested buffer size, in bytes
943 *
944 * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses
945 * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory.
946 */
947static int snd_pcm_lib_alloc_vmalloc_32_buffer
948 (struct snd_pcm_substream *substream, size_t size);
949#endif
950#define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \
951 _snd_pcm_lib_alloc_vmalloc_buffer \
952 (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO)
953#define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \
954 _snd_pcm_lib_alloc_vmalloc_buffer \
955 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO)
956
908#ifdef CONFIG_SND_DMA_SGBUF 957#ifdef CONFIG_SND_DMA_SGBUF
909/* 958/*
910 * SG-buffer handling 959 * SG-buffer handling
@@ -975,6 +1024,10 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
975#define snd_pcm_lib_mmap_iomem NULL 1024#define snd_pcm_lib_mmap_iomem NULL
976#endif 1025#endif
977 1026
1027int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
1028 struct vm_area_struct *area);
1029#define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached
1030
978static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) 1031static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
979{ 1032{
980 *max = dma < 4 ? 64 * 1024 : 128 * 1024; 1033 *max = dma < 4 ? 64 * 1024 : 128 * 1024;
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index cc4e226f35fd..760c969d885d 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -61,7 +61,7 @@ struct snd_pcm_oss_runtime {
61 struct snd_pcm_plugin *plugin_first; 61 struct snd_pcm_plugin *plugin_first;
62 struct snd_pcm_plugin *plugin_last; 62 struct snd_pcm_plugin *plugin_last;
63#endif 63#endif
64 unsigned int prev_hw_ptr_interrupt; 64 unsigned int prev_hw_ptr_period;
65}; 65};
66 66
67struct snd_pcm_oss_file { 67struct snd_pcm_oss_file {
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 4e62ee1e4115..95353542256a 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -33,6 +33,7 @@ enum sb_hw_type {
33 SB_HW_20, 33 SB_HW_20,
34 SB_HW_201, 34 SB_HW_201,
35 SB_HW_PRO, 35 SB_HW_PRO,
36 SB_HW_JAZZ16, /* Media Vision Jazz16 */
36 SB_HW_16, 37 SB_HW_16,
37 SB_HW_16CSP, /* SB16 with CSP chip */ 38 SB_HW_16CSP, /* SB16 with CSP chip */
38 SB_HW_ALS100, /* Avance Logic ALS100 chip */ 39 SB_HW_ALS100, /* Avance Logic ALS100 chip */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index ca24e7f7a3f5..377693a14385 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -16,6 +16,8 @@
16 16
17#include <linux/list.h> 17#include <linux/list.h>
18 18
19#include <sound/soc.h>
20
19struct snd_pcm_substream; 21struct snd_pcm_substream;
20 22
21/* 23/*
@@ -180,6 +182,12 @@ struct snd_soc_dai_ops {
180 struct snd_soc_dai *); 182 struct snd_soc_dai *);
181 int (*trigger)(struct snd_pcm_substream *, int, 183 int (*trigger)(struct snd_pcm_substream *, int,
182 struct snd_soc_dai *); 184 struct snd_soc_dai *);
185 /*
186 * For hardware based FIFO caused delay reporting.
187 * Optional.
188 */
189 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
190 struct snd_soc_dai *);
183}; 191};
184 192
185/* 193/*
@@ -213,11 +221,9 @@ struct snd_soc_dai {
213 unsigned int symmetric_rates:1; 221 unsigned int symmetric_rates:1;
214 222
215 /* DAI runtime info */ 223 /* DAI runtime info */
216 struct snd_pcm_runtime *runtime;
217 struct snd_soc_codec *codec; 224 struct snd_soc_codec *codec;
218 unsigned int active; 225 unsigned int active;
219 unsigned char pop_wait:1; 226 unsigned char pop_wait:1;
220 void *dma_data;
221 227
222 /* DAI private data */ 228 /* DAI private data */
223 void *private_data; 229 void *private_data;
@@ -228,4 +234,21 @@ struct snd_soc_dai {
228 struct list_head list; 234 struct list_head list;
229}; 235};
230 236
237static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
238 const struct snd_pcm_substream *ss)
239{
240 return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
241 dai->playback.dma_data : dai->capture.dma_data;
242}
243
244static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
245 const struct snd_pcm_substream *ss,
246 void *data)
247{
248 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
249 dai->playback.dma_data = data;
250 else
251 dai->capture.dma_data = data;
252}
253
231#endif 254#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c5c95e1da65b..66ff4c124dbd 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -95,6 +95,21 @@
95 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ 95 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
96 .num_kcontrols = 1} 96 .num_kcontrols = 1}
97 97
98/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
99#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
100 wcontrols) \
101{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
102 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
103#define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \
104 wcontrols)\
105{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
106 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)}
107#define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \
108 wcontrols)\
109{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \
110 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
111 .num_kcontrols = ARRAY_SIZE(wcontrols)}
112
98/* path domain with event - event handler must return 0 for success */ 113/* path domain with event - event handler must return 0 for success */
99#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ 114#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
100 wncontrols, wevent, wflags) \ 115 wncontrols, wevent, wflags) \
@@ -126,6 +141,23 @@
126 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 141 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
127 .event = wevent, .event_flags = wflags} 142 .event = wevent, .event_flags = wflags}
128 143
144/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
145#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
146 wevent, wflags) \
147{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
148 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
149 .event = wevent, .event_flags = wflags}
150#define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
151 wevent, wflags) \
152{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
153 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \
154 .event = wevent, .event_flags = wflags}
155#define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \
156 wcontrols, wevent, wflags) \
157{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
158 .invert = winvert, .kcontrols = wcontrols, \
159 .num_kcontrols = ARRAY_SIZE(wcontrols), .event = wevent, .event_flags = wflags}
160
129/* events that are pre and post DAPM */ 161/* events that are pre and post DAPM */
130#define SND_SOC_DAPM_PRE(wname, wevent) \ 162#define SND_SOC_DAPM_PRE(wname, wevent) \
131{ .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \ 163{ .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \
@@ -307,6 +339,9 @@ int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
307int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); 339int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
308int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); 340int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
309int snd_soc_dapm_sync(struct snd_soc_codec *codec); 341int snd_soc_dapm_sync(struct snd_soc_codec *codec);
342int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec,
343 const char *pin);
344int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin);
310 345
311/* dapm widget types */ 346/* dapm widget types */
312enum snd_soc_dapm_type { 347enum snd_soc_dapm_type {
@@ -393,9 +428,8 @@ struct snd_soc_dapm_widget {
393 unsigned char connected:1; /* connected codec pin */ 428 unsigned char connected:1; /* connected codec pin */
394 unsigned char new:1; /* cnew complete */ 429 unsigned char new:1; /* cnew complete */
395 unsigned char ext:1; /* has external widgets */ 430 unsigned char ext:1; /* has external widgets */
396 unsigned char muted:1; /* muted for pop reduction */ 431 unsigned char force:1; /* force state */
397 unsigned char suspend:1; /* was active before suspend */ 432 unsigned char ignore_suspend:1; /* kept enabled over suspend */
398 unsigned char pmdown:1; /* waiting for timeout */
399 433
400 int (*power_check)(struct snd_soc_dapm_widget *w); 434 int (*power_check)(struct snd_soc_dapm_widget *w);
401 435
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0d7718f9280d..697e7ffe39d7 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/notifier.h>
18#include <linux/workqueue.h> 19#include <linux/workqueue.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -29,10 +30,10 @@
29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ 30#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
30 ((unsigned long)&(struct soc_mixer_control) \ 31 ((unsigned long)&(struct soc_mixer_control) \
31 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \ 32 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
32 .invert = xinvert}) 33 .platform_max = xmax, .invert = xinvert})
33#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 34#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
34 ((unsigned long)&(struct soc_mixer_control) \ 35 ((unsigned long)&(struct soc_mixer_control) \
35 {.reg = xreg, .max = xmax, .invert = xinvert}) 36 {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
36#define SOC_SINGLE(xname, reg, shift, max, invert) \ 37#define SOC_SINGLE(xname, reg, shift, max, invert) \
37{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 38{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
38 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 39 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
@@ -52,14 +53,14 @@
52 .put = snd_soc_put_volsw, \ 53 .put = snd_soc_put_volsw, \
53 .private_value = (unsigned long)&(struct soc_mixer_control) \ 54 .private_value = (unsigned long)&(struct soc_mixer_control) \
54 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 55 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
55 .max = xmax, .invert = xinvert} } 56 .max = xmax, .platform_max = xmax, .invert = xinvert} }
56#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ 57#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
57{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 58{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
58 .info = snd_soc_info_volsw_2r, \ 59 .info = snd_soc_info_volsw_2r, \
59 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 60 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
60 .private_value = (unsigned long)&(struct soc_mixer_control) \ 61 .private_value = (unsigned long)&(struct soc_mixer_control) \
61 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 62 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
62 .max = xmax, .invert = xinvert} } 63 .max = xmax, .platform_max = xmax, .invert = xinvert} }
63#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \ 64#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
64{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 65{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
65 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 66 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -69,7 +70,7 @@
69 .put = snd_soc_put_volsw, \ 70 .put = snd_soc_put_volsw, \
70 .private_value = (unsigned long)&(struct soc_mixer_control) \ 71 .private_value = (unsigned long)&(struct soc_mixer_control) \
71 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ 72 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
72 .max = xmax, .invert = xinvert} } 73 .max = xmax, .platform_max = xmax, .invert = xinvert} }
73#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 74#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
74{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 75{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
75 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 76 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -79,7 +80,7 @@
79 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 80 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
80 .private_value = (unsigned long)&(struct soc_mixer_control) \ 81 .private_value = (unsigned long)&(struct soc_mixer_control) \
81 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 82 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
82 .max = xmax, .invert = xinvert} } 83 .max = xmax, .platform_max = xmax, .invert = xinvert} }
83#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 84#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
84{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 85{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
85 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 86 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -88,7 +89,8 @@
88 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 89 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
89 .put = snd_soc_put_volsw_s8, \ 90 .put = snd_soc_put_volsw_s8, \
90 .private_value = (unsigned long)&(struct soc_mixer_control) \ 91 .private_value = (unsigned long)&(struct soc_mixer_control) \
91 {.reg = xreg, .min = xmin, .max = xmax} } 92 {.reg = xreg, .min = xmin, .max = xmax, \
93 .platform_max = xmax} }
92#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 94#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
93{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 95{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
94 .max = xmax, .texts = xtexts } 96 .max = xmax, .texts = xtexts }
@@ -125,7 +127,7 @@
125 .get = xhandler_get, .put = xhandler_put, \ 127 .get = xhandler_get, .put = xhandler_put, \
126 .private_value = (unsigned long)&(struct soc_mixer_control) \ 128 .private_value = (unsigned long)&(struct soc_mixer_control) \
127 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 129 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
128 .max = xmax, .invert = xinvert} } 130 .max = xmax, .platform_max = xmax, .invert = xinvert} }
129#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 131#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
130 xhandler_get, xhandler_put, tlv_array) \ 132 xhandler_get, xhandler_put, tlv_array) \
131{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 133{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -145,7 +147,7 @@
145 .get = xhandler_get, .put = xhandler_put, \ 147 .get = xhandler_get, .put = xhandler_put, \
146 .private_value = (unsigned long)&(struct soc_mixer_control) \ 148 .private_value = (unsigned long)&(struct soc_mixer_control) \
147 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 149 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
148 .max = xmax, .invert = xinvert} } 150 .max = xmax, .platform_max = xmax, .invert = xinvert} }
149#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ 151#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
150 xhandler_get, xhandler_put, tlv_array) \ 152 xhandler_get, xhandler_put, tlv_array) \
151{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 153{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -156,7 +158,7 @@
156 .get = xhandler_get, .put = xhandler_put, \ 158 .get = xhandler_get, .put = xhandler_put, \
157 .private_value = (unsigned long)&(struct soc_mixer_control) \ 159 .private_value = (unsigned long)&(struct soc_mixer_control) \
158 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 160 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
159 .max = xmax, .invert = xinvert} } 161 .max = xmax, .platform_max = xmax, .invert = xinvert} }
160#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 162#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
161{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 163{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
162 .info = snd_soc_info_bool_ext, \ 164 .info = snd_soc_info_bool_ext, \
@@ -169,6 +171,23 @@
169 .private_value = (unsigned long)&xenum } 171 .private_value = (unsigned long)&xenum }
170 172
171/* 173/*
174 * Simplified versions of above macros, declaring a struct and calculating
175 * ARRAY_SIZE internally
176 */
177#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
178 struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
179 ARRAY_SIZE(xtexts), xtexts)
180#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
181 SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
182#define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
183 struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
184#define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
185 struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
186 ARRAY_SIZE(xtexts), xtexts, xvalues)
187#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
188 SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
189
190/*
172 * Bias levels 191 * Bias levels
173 * 192 *
174 * @ON: Bias is fully on for audio playback and capture operations. 193 * @ON: Bias is fully on for audio playback and capture operations.
@@ -195,6 +214,7 @@ struct snd_soc_dai_mode;
195struct snd_soc_pcm_runtime; 214struct snd_soc_pcm_runtime;
196struct snd_soc_dai; 215struct snd_soc_dai;
197struct snd_soc_platform; 216struct snd_soc_platform;
217struct snd_soc_dai_link;
198struct snd_soc_codec; 218struct snd_soc_codec;
199struct soc_enum; 219struct soc_enum;
200struct snd_soc_ac97_ops; 220struct snd_soc_ac97_ops;
@@ -243,6 +263,10 @@ int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
243void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 263void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
244int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 264int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
245 struct snd_soc_jack_pin *pins); 265 struct snd_soc_jack_pin *pins);
266void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
267 struct notifier_block *nb);
268void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
269 struct notifier_block *nb);
246#ifdef CONFIG_GPIOLIB 270#ifdef CONFIG_GPIOLIB
247int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 271int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
248 struct snd_soc_jack_gpio *gpios); 272 struct snd_soc_jack_gpio *gpios);
@@ -253,6 +277,9 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
253/* codec register bit access */ 277/* codec register bit access */
254int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 278int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
255 unsigned int mask, unsigned int value); 279 unsigned int mask, unsigned int value);
280int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
281 unsigned short reg, unsigned int mask,
282 unsigned int value);
256int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 283int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
257 unsigned int mask, unsigned int value); 284 unsigned int mask, unsigned int value);
258 285
@@ -300,6 +327,8 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
300 struct snd_ctl_elem_value *ucontrol); 327 struct snd_ctl_elem_value *ucontrol);
301int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 328int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
302 struct snd_ctl_elem_value *ucontrol); 329 struct snd_ctl_elem_value *ucontrol);
330int snd_soc_limit_volume(struct snd_soc_codec *codec,
331 const char *name, int max);
303 332
304/** 333/**
305 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection 334 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
@@ -343,6 +372,7 @@ struct snd_soc_jack {
343 struct snd_soc_card *card; 372 struct snd_soc_card *card;
344 struct list_head pins; 373 struct list_head pins;
345 int status; 374 int status;
375 struct blocking_notifier_head notifier;
346}; 376};
347 377
348/* SoC PCM stream information */ 378/* SoC PCM stream information */
@@ -354,7 +384,8 @@ struct snd_soc_pcm_stream {
354 unsigned int rate_max; /* max rate */ 384 unsigned int rate_max; /* max rate */
355 unsigned int channels_min; /* min channels */ 385 unsigned int channels_min; /* min channels */
356 unsigned int channels_max; /* max channels */ 386 unsigned int channels_max; /* max channels */
357 unsigned int active:1; /* stream is in use */ 387 unsigned int active; /* stream is in use */
388 void *dma_data; /* used by platform code */
358}; 389};
359 390
360/* SoC audio ops */ 391/* SoC audio ops */
@@ -386,7 +417,7 @@ struct snd_soc_codec {
386 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 417 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
387 unsigned int active; 418 unsigned int active;
388 unsigned int pcm_devs; 419 unsigned int pcm_devs;
389 void *private_data; 420 void *drvdata;
390 421
391 /* codec IO */ 422 /* codec IO */
392 void *control_data; /* codec control (i2c/3wire) data */ 423 void *control_data; /* codec control (i2c/3wire) data */
@@ -402,6 +433,10 @@ struct snd_soc_codec {
402 short reg_cache_size; 433 short reg_cache_size;
403 short reg_cache_step; 434 short reg_cache_step;
404 435
436 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
437 unsigned int cache_only:1; /* Suppress writes to hardware */
438 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
439
405 /* dapm */ 440 /* dapm */
406 u32 pop_time; 441 u32 pop_time;
407 struct list_head dapm_widgets; 442 struct list_head dapm_widgets;
@@ -437,14 +472,21 @@ struct snd_soc_platform {
437 472
438 int (*probe)(struct platform_device *pdev); 473 int (*probe)(struct platform_device *pdev);
439 int (*remove)(struct platform_device *pdev); 474 int (*remove)(struct platform_device *pdev);
440 int (*suspend)(struct snd_soc_dai *dai); 475 int (*suspend)(struct snd_soc_dai_link *dai_link);
441 int (*resume)(struct snd_soc_dai *dai); 476 int (*resume)(struct snd_soc_dai_link *dai_link);
442 477
443 /* pcm creation and destruction */ 478 /* pcm creation and destruction */
444 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 479 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
445 struct snd_pcm *); 480 struct snd_pcm *);
446 void (*pcm_free)(struct snd_pcm *); 481 void (*pcm_free)(struct snd_pcm *);
447 482
483 /*
484 * For platform caused delay reporting.
485 * Optional.
486 */
487 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
488 struct snd_soc_dai *);
489
448 /* platform stream ops */ 490 /* platform stream ops */
449 struct snd_pcm_ops *pcm_ops; 491 struct snd_pcm_ops *pcm_ops;
450}; 492};
@@ -464,6 +506,9 @@ struct snd_soc_dai_link {
464 /* codec/machine specific init - e.g. add machine controls */ 506 /* codec/machine specific init - e.g. add machine controls */
465 int (*init)(struct snd_soc_codec *codec); 507 int (*init)(struct snd_soc_codec *codec);
466 508
509 /* Keep DAI active over suspend */
510 unsigned int ignore_suspend:1;
511
467 /* Symmetry requirements */ 512 /* Symmetry requirements */
468 unsigned int symmetric_rates:1; 513 unsigned int symmetric_rates:1;
469 514
@@ -497,6 +542,8 @@ struct snd_soc_card {
497 int (*set_bias_level)(struct snd_soc_card *, 542 int (*set_bias_level)(struct snd_soc_card *,
498 enum snd_soc_bias_level level); 543 enum snd_soc_bias_level level);
499 544
545 long pmdown_time;
546
500 /* CPU <--> Codec DAI links */ 547 /* CPU <--> Codec DAI links */
501 struct snd_soc_dai_link *dai_link; 548 struct snd_soc_dai_link *dai_link;
502 int num_links; 549 int num_links;
@@ -526,7 +573,7 @@ struct snd_soc_pcm_runtime {
526 573
527/* mixer control */ 574/* mixer control */
528struct soc_mixer_control { 575struct soc_mixer_control {
529 int min, max; 576 int min, max, platform_max;
530 unsigned int reg, rreg, shift, rshift, invert; 577 unsigned int reg, rreg, shift, rshift, invert;
531}; 578};
532 579
@@ -556,6 +603,17 @@ static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
556 return codec->write(codec, reg, val); 603 return codec->write(codec, reg, val);
557} 604}
558 605
606static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
607 void *data)
608{
609 codec->drvdata = data;
610}
611
612static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
613{
614 return codec->drvdata;
615}
616
559#include <sound/soc-dai.h> 617#include <sound/soc-dai.h>
560 618
561#endif 619#endif
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h
new file mode 100644
index 000000000000..b1a5f34e5cfa
--- /dev/null
+++ b/include/sound/tlv320aic3x.h
@@ -0,0 +1,17 @@
1/*
2 * Platform data for Texas Instruments TLV320AIC3x codec
3 *
4 * Author: Jarkko Nikula <jhnikula@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __TLV320AIC3x_H__
11#define __TLV320AIC3x_H__
12
13struct aic3x_pdata {
14 int gpio_reset; /* < 0 if not used */
15};
16
17#endif \ No newline at end of file
diff --git a/include/sound/tlv320dac33-plat.h b/include/sound/tlv320dac33-plat.h
index 5858d06a7ffa..3f428d53195b 100644
--- a/include/sound/tlv320dac33-plat.h
+++ b/include/sound/tlv320dac33-plat.h
@@ -15,6 +15,8 @@
15 15
16struct tlv320dac33_platform_data { 16struct tlv320dac33_platform_data {
17 int power_gpio; 17 int power_gpio;
18 int keep_bclk; /* Keep the BCLK running in FIFO modes */
19 u8 burst_bclkdiv;
18}; 20};
19 21
20#endif /* __TLV320DAC33_PLAT_H */ 22#endif /* __TLV320DAC33_PLAT_H */
diff --git a/include/sound/tpa6130a2-plat.h b/include/sound/tpa6130a2-plat.h
index e8c901e749d8..e29fde6b5cbe 100644
--- a/include/sound/tpa6130a2-plat.h
+++ b/include/sound/tpa6130a2-plat.h
@@ -23,7 +23,13 @@
23#ifndef TPA6130A2_PLAT_H 23#ifndef TPA6130A2_PLAT_H
24#define TPA6130A2_PLAT_H 24#define TPA6130A2_PLAT_H
25 25
26enum tpa_model {
27 TPA6130A2,
28 TPA6140A2,
29};
30
26struct tpa6130a2_platform_data { 31struct tpa6130a2_platform_data {
32 enum tpa_model id;
27 int power_gpio; 33 int power_gpio;
28}; 34};
29 35
diff --git a/include/sound/uda134x.h b/include/sound/uda134x.h
index 475ef8bb7dcd..509efb050176 100644
--- a/include/sound/uda134x.h
+++ b/include/sound/uda134x.h
@@ -21,6 +21,7 @@ struct uda134x_platform_data {
21#define UDA134X_UDA1340 1 21#define UDA134X_UDA1340 1
22#define UDA134X_UDA1341 2 22#define UDA134X_UDA1341 2
23#define UDA134X_UDA1344 3 23#define UDA134X_UDA1344 3
24#define UDA134X_UDA1345 4
24}; 25};
25 26
26#endif /* _UDA134X_H */ 27#endif /* _UDA134X_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index 22939142dd23..bf69a5b7e65f 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.21" 2#define CONFIG_SND_VERSION "1.0.23"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm2000.h b/include/sound/wm2000.h
new file mode 100644
index 000000000000..aa388ca9ec64
--- /dev/null
+++ b/include/sound/wm2000.h
@@ -0,0 +1,26 @@
1/*
2 * linux/sound/wm2000.h -- Platform data for WM2000
3 *
4 * Copyright 2010 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM2000_H
12#define __LINUX_SND_WM2000_H
13
14struct wm2000_platform_data {
15 /** Filename for system-specific image to download to device. */
16 const char *download_file;
17
18 /** Divide MCLK by 2 for system clock? */
19 unsigned int mclkdiv2:1;
20
21 /** Disable speech clarity enhancement, for use when an
22 * external algorithm is used. */
23 unsigned int speech_enh_disable:1;
24};
25
26#endif
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h
new file mode 100644
index 000000000000..b4a0db2307ef
--- /dev/null
+++ b/include/sound/wm8903.h
@@ -0,0 +1,249 @@
1/*
2 * linux/sound/wm8903.h -- Platform data for WM8903
3 *
4 * Copyright 2010 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM8903_H
12#define __LINUX_SND_WM8903_H
13
14/* Used to enable configuration of a GPIO to all zeros */
15#define WM8903_GPIO_NO_CONFIG 0x8000
16
17/*
18 * R6 (0x06) - Mic Bias Control 0
19 */
20#define WM8903_MICDET_HYST_ENA 0x0080 /* MICDET_HYST_ENA */
21#define WM8903_MICDET_HYST_ENA_MASK 0x0080 /* MICDET_HYST_ENA */
22#define WM8903_MICDET_HYST_ENA_SHIFT 7 /* MICDET_HYST_ENA */
23#define WM8903_MICDET_HYST_ENA_WIDTH 1 /* MICDET_HYST_ENA */
24#define WM8903_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */
25#define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */
26#define WM8903_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */
27#define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */
28#define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */
29#define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */
30#define WM8903_MICDET_ENA 0x0002 /* MICDET_ENA */
31#define WM8903_MICDET_ENA_MASK 0x0002 /* MICDET_ENA */
32#define WM8903_MICDET_ENA_SHIFT 1 /* MICDET_ENA */
33#define WM8903_MICDET_ENA_WIDTH 1 /* MICDET_ENA */
34#define WM8903_MICBIAS_ENA 0x0001 /* MICBIAS_ENA */
35#define WM8903_MICBIAS_ENA_MASK 0x0001 /* MICBIAS_ENA */
36#define WM8903_MICBIAS_ENA_SHIFT 0 /* MICBIAS_ENA */
37#define WM8903_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */
38
39/*
40 * R116 (0x74) - GPIO Control 1
41 */
42#define WM8903_GP1_FN_MASK 0x1F00 /* GP1_FN - [12:8] */
43#define WM8903_GP1_FN_SHIFT 8 /* GP1_FN - [12:8] */
44#define WM8903_GP1_FN_WIDTH 5 /* GP1_FN - [12:8] */
45#define WM8903_GP1_DIR 0x0080 /* GP1_DIR */
46#define WM8903_GP1_DIR_MASK 0x0080 /* GP1_DIR */
47#define WM8903_GP1_DIR_SHIFT 7 /* GP1_DIR */
48#define WM8903_GP1_DIR_WIDTH 1 /* GP1_DIR */
49#define WM8903_GP1_OP_CFG 0x0040 /* GP1_OP_CFG */
50#define WM8903_GP1_OP_CFG_MASK 0x0040 /* GP1_OP_CFG */
51#define WM8903_GP1_OP_CFG_SHIFT 6 /* GP1_OP_CFG */
52#define WM8903_GP1_OP_CFG_WIDTH 1 /* GP1_OP_CFG */
53#define WM8903_GP1_IP_CFG 0x0020 /* GP1_IP_CFG */
54#define WM8903_GP1_IP_CFG_MASK 0x0020 /* GP1_IP_CFG */
55#define WM8903_GP1_IP_CFG_SHIFT 5 /* GP1_IP_CFG */
56#define WM8903_GP1_IP_CFG_WIDTH 1 /* GP1_IP_CFG */
57#define WM8903_GP1_LVL 0x0010 /* GP1_LVL */
58#define WM8903_GP1_LVL_MASK 0x0010 /* GP1_LVL */
59#define WM8903_GP1_LVL_SHIFT 4 /* GP1_LVL */
60#define WM8903_GP1_LVL_WIDTH 1 /* GP1_LVL */
61#define WM8903_GP1_PD 0x0008 /* GP1_PD */
62#define WM8903_GP1_PD_MASK 0x0008 /* GP1_PD */
63#define WM8903_GP1_PD_SHIFT 3 /* GP1_PD */
64#define WM8903_GP1_PD_WIDTH 1 /* GP1_PD */
65#define WM8903_GP1_PU 0x0004 /* GP1_PU */
66#define WM8903_GP1_PU_MASK 0x0004 /* GP1_PU */
67#define WM8903_GP1_PU_SHIFT 2 /* GP1_PU */
68#define WM8903_GP1_PU_WIDTH 1 /* GP1_PU */
69#define WM8903_GP1_INTMODE 0x0002 /* GP1_INTMODE */
70#define WM8903_GP1_INTMODE_MASK 0x0002 /* GP1_INTMODE */
71#define WM8903_GP1_INTMODE_SHIFT 1 /* GP1_INTMODE */
72#define WM8903_GP1_INTMODE_WIDTH 1 /* GP1_INTMODE */
73#define WM8903_GP1_DB 0x0001 /* GP1_DB */
74#define WM8903_GP1_DB_MASK 0x0001 /* GP1_DB */
75#define WM8903_GP1_DB_SHIFT 0 /* GP1_DB */
76#define WM8903_GP1_DB_WIDTH 1 /* GP1_DB */
77
78/*
79 * R117 (0x75) - GPIO Control 2
80 */
81#define WM8903_GP2_FN_MASK 0x1F00 /* GP2_FN - [12:8] */
82#define WM8903_GP2_FN_SHIFT 8 /* GP2_FN - [12:8] */
83#define WM8903_GP2_FN_WIDTH 5 /* GP2_FN - [12:8] */
84#define WM8903_GP2_DIR 0x0080 /* GP2_DIR */
85#define WM8903_GP2_DIR_MASK 0x0080 /* GP2_DIR */
86#define WM8903_GP2_DIR_SHIFT 7 /* GP2_DIR */
87#define WM8903_GP2_DIR_WIDTH 1 /* GP2_DIR */
88#define WM8903_GP2_OP_CFG 0x0040 /* GP2_OP_CFG */
89#define WM8903_GP2_OP_CFG_MASK 0x0040 /* GP2_OP_CFG */
90#define WM8903_GP2_OP_CFG_SHIFT 6 /* GP2_OP_CFG */
91#define WM8903_GP2_OP_CFG_WIDTH 1 /* GP2_OP_CFG */
92#define WM8903_GP2_IP_CFG 0x0020 /* GP2_IP_CFG */
93#define WM8903_GP2_IP_CFG_MASK 0x0020 /* GP2_IP_CFG */
94#define WM8903_GP2_IP_CFG_SHIFT 5 /* GP2_IP_CFG */
95#define WM8903_GP2_IP_CFG_WIDTH 1 /* GP2_IP_CFG */
96#define WM8903_GP2_LVL 0x0010 /* GP2_LVL */
97#define WM8903_GP2_LVL_MASK 0x0010 /* GP2_LVL */
98#define WM8903_GP2_LVL_SHIFT 4 /* GP2_LVL */
99#define WM8903_GP2_LVL_WIDTH 1 /* GP2_LVL */
100#define WM8903_GP2_PD 0x0008 /* GP2_PD */
101#define WM8903_GP2_PD_MASK 0x0008 /* GP2_PD */
102#define WM8903_GP2_PD_SHIFT 3 /* GP2_PD */
103#define WM8903_GP2_PD_WIDTH 1 /* GP2_PD */
104#define WM8903_GP2_PU 0x0004 /* GP2_PU */
105#define WM8903_GP2_PU_MASK 0x0004 /* GP2_PU */
106#define WM8903_GP2_PU_SHIFT 2 /* GP2_PU */
107#define WM8903_GP2_PU_WIDTH 1 /* GP2_PU */
108#define WM8903_GP2_INTMODE 0x0002 /* GP2_INTMODE */
109#define WM8903_GP2_INTMODE_MASK 0x0002 /* GP2_INTMODE */
110#define WM8903_GP2_INTMODE_SHIFT 1 /* GP2_INTMODE */
111#define WM8903_GP2_INTMODE_WIDTH 1 /* GP2_INTMODE */
112#define WM8903_GP2_DB 0x0001 /* GP2_DB */
113#define WM8903_GP2_DB_MASK 0x0001 /* GP2_DB */
114#define WM8903_GP2_DB_SHIFT 0 /* GP2_DB */
115#define WM8903_GP2_DB_WIDTH 1 /* GP2_DB */
116
117/*
118 * R118 (0x76) - GPIO Control 3
119 */
120#define WM8903_GP3_FN_MASK 0x1F00 /* GP3_FN - [12:8] */
121#define WM8903_GP3_FN_SHIFT 8 /* GP3_FN - [12:8] */
122#define WM8903_GP3_FN_WIDTH 5 /* GP3_FN - [12:8] */
123#define WM8903_GP3_DIR 0x0080 /* GP3_DIR */
124#define WM8903_GP3_DIR_MASK 0x0080 /* GP3_DIR */
125#define WM8903_GP3_DIR_SHIFT 7 /* GP3_DIR */
126#define WM8903_GP3_DIR_WIDTH 1 /* GP3_DIR */
127#define WM8903_GP3_OP_CFG 0x0040 /* GP3_OP_CFG */
128#define WM8903_GP3_OP_CFG_MASK 0x0040 /* GP3_OP_CFG */
129#define WM8903_GP3_OP_CFG_SHIFT 6 /* GP3_OP_CFG */
130#define WM8903_GP3_OP_CFG_WIDTH 1 /* GP3_OP_CFG */
131#define WM8903_GP3_IP_CFG 0x0020 /* GP3_IP_CFG */
132#define WM8903_GP3_IP_CFG_MASK 0x0020 /* GP3_IP_CFG */
133#define WM8903_GP3_IP_CFG_SHIFT 5 /* GP3_IP_CFG */
134#define WM8903_GP3_IP_CFG_WIDTH 1 /* GP3_IP_CFG */
135#define WM8903_GP3_LVL 0x0010 /* GP3_LVL */
136#define WM8903_GP3_LVL_MASK 0x0010 /* GP3_LVL */
137#define WM8903_GP3_LVL_SHIFT 4 /* GP3_LVL */
138#define WM8903_GP3_LVL_WIDTH 1 /* GP3_LVL */
139#define WM8903_GP3_PD 0x0008 /* GP3_PD */
140#define WM8903_GP3_PD_MASK 0x0008 /* GP3_PD */
141#define WM8903_GP3_PD_SHIFT 3 /* GP3_PD */
142#define WM8903_GP3_PD_WIDTH 1 /* GP3_PD */
143#define WM8903_GP3_PU 0x0004 /* GP3_PU */
144#define WM8903_GP3_PU_MASK 0x0004 /* GP3_PU */
145#define WM8903_GP3_PU_SHIFT 2 /* GP3_PU */
146#define WM8903_GP3_PU_WIDTH 1 /* GP3_PU */
147#define WM8903_GP3_INTMODE 0x0002 /* GP3_INTMODE */
148#define WM8903_GP3_INTMODE_MASK 0x0002 /* GP3_INTMODE */
149#define WM8903_GP3_INTMODE_SHIFT 1 /* GP3_INTMODE */
150#define WM8903_GP3_INTMODE_WIDTH 1 /* GP3_INTMODE */
151#define WM8903_GP3_DB 0x0001 /* GP3_DB */
152#define WM8903_GP3_DB_MASK 0x0001 /* GP3_DB */
153#define WM8903_GP3_DB_SHIFT 0 /* GP3_DB */
154#define WM8903_GP3_DB_WIDTH 1 /* GP3_DB */
155
156/*
157 * R119 (0x77) - GPIO Control 4
158 */
159#define WM8903_GP4_FN_MASK 0x1F00 /* GP4_FN - [12:8] */
160#define WM8903_GP4_FN_SHIFT 8 /* GP4_FN - [12:8] */
161#define WM8903_GP4_FN_WIDTH 5 /* GP4_FN - [12:8] */
162#define WM8903_GP4_DIR 0x0080 /* GP4_DIR */
163#define WM8903_GP4_DIR_MASK 0x0080 /* GP4_DIR */
164#define WM8903_GP4_DIR_SHIFT 7 /* GP4_DIR */
165#define WM8903_GP4_DIR_WIDTH 1 /* GP4_DIR */
166#define WM8903_GP4_OP_CFG 0x0040 /* GP4_OP_CFG */
167#define WM8903_GP4_OP_CFG_MASK 0x0040 /* GP4_OP_CFG */
168#define WM8903_GP4_OP_CFG_SHIFT 6 /* GP4_OP_CFG */
169#define WM8903_GP4_OP_CFG_WIDTH 1 /* GP4_OP_CFG */
170#define WM8903_GP4_IP_CFG 0x0020 /* GP4_IP_CFG */
171#define WM8903_GP4_IP_CFG_MASK 0x0020 /* GP4_IP_CFG */
172#define WM8903_GP4_IP_CFG_SHIFT 5 /* GP4_IP_CFG */
173#define WM8903_GP4_IP_CFG_WIDTH 1 /* GP4_IP_CFG */
174#define WM8903_GP4_LVL 0x0010 /* GP4_LVL */
175#define WM8903_GP4_LVL_MASK 0x0010 /* GP4_LVL */
176#define WM8903_GP4_LVL_SHIFT 4 /* GP4_LVL */
177#define WM8903_GP4_LVL_WIDTH 1 /* GP4_LVL */
178#define WM8903_GP4_PD 0x0008 /* GP4_PD */
179#define WM8903_GP4_PD_MASK 0x0008 /* GP4_PD */
180#define WM8903_GP4_PD_SHIFT 3 /* GP4_PD */
181#define WM8903_GP4_PD_WIDTH 1 /* GP4_PD */
182#define WM8903_GP4_PU 0x0004 /* GP4_PU */
183#define WM8903_GP4_PU_MASK 0x0004 /* GP4_PU */
184#define WM8903_GP4_PU_SHIFT 2 /* GP4_PU */
185#define WM8903_GP4_PU_WIDTH 1 /* GP4_PU */
186#define WM8903_GP4_INTMODE 0x0002 /* GP4_INTMODE */
187#define WM8903_GP4_INTMODE_MASK 0x0002 /* GP4_INTMODE */
188#define WM8903_GP4_INTMODE_SHIFT 1 /* GP4_INTMODE */
189#define WM8903_GP4_INTMODE_WIDTH 1 /* GP4_INTMODE */
190#define WM8903_GP4_DB 0x0001 /* GP4_DB */
191#define WM8903_GP4_DB_MASK 0x0001 /* GP4_DB */
192#define WM8903_GP4_DB_SHIFT 0 /* GP4_DB */
193#define WM8903_GP4_DB_WIDTH 1 /* GP4_DB */
194
195/*
196 * R120 (0x78) - GPIO Control 5
197 */
198#define WM8903_GP5_FN_MASK 0x1F00 /* GP5_FN - [12:8] */
199#define WM8903_GP5_FN_SHIFT 8 /* GP5_FN - [12:8] */
200#define WM8903_GP5_FN_WIDTH 5 /* GP5_FN - [12:8] */
201#define WM8903_GP5_DIR 0x0080 /* GP5_DIR */
202#define WM8903_GP5_DIR_MASK 0x0080 /* GP5_DIR */
203#define WM8903_GP5_DIR_SHIFT 7 /* GP5_DIR */
204#define WM8903_GP5_DIR_WIDTH 1 /* GP5_DIR */
205#define WM8903_GP5_OP_CFG 0x0040 /* GP5_OP_CFG */
206#define WM8903_GP5_OP_CFG_MASK 0x0040 /* GP5_OP_CFG */
207#define WM8903_GP5_OP_CFG_SHIFT 6 /* GP5_OP_CFG */
208#define WM8903_GP5_OP_CFG_WIDTH 1 /* GP5_OP_CFG */
209#define WM8903_GP5_IP_CFG 0x0020 /* GP5_IP_CFG */
210#define WM8903_GP5_IP_CFG_MASK 0x0020 /* GP5_IP_CFG */
211#define WM8903_GP5_IP_CFG_SHIFT 5 /* GP5_IP_CFG */
212#define WM8903_GP5_IP_CFG_WIDTH 1 /* GP5_IP_CFG */
213#define WM8903_GP5_LVL 0x0010 /* GP5_LVL */
214#define WM8903_GP5_LVL_MASK 0x0010 /* GP5_LVL */
215#define WM8903_GP5_LVL_SHIFT 4 /* GP5_LVL */
216#define WM8903_GP5_LVL_WIDTH 1 /* GP5_LVL */
217#define WM8903_GP5_PD 0x0008 /* GP5_PD */
218#define WM8903_GP5_PD_MASK 0x0008 /* GP5_PD */
219#define WM8903_GP5_PD_SHIFT 3 /* GP5_PD */
220#define WM8903_GP5_PD_WIDTH 1 /* GP5_PD */
221#define WM8903_GP5_PU 0x0004 /* GP5_PU */
222#define WM8903_GP5_PU_MASK 0x0004 /* GP5_PU */
223#define WM8903_GP5_PU_SHIFT 2 /* GP5_PU */
224#define WM8903_GP5_PU_WIDTH 1 /* GP5_PU */
225#define WM8903_GP5_INTMODE 0x0002 /* GP5_INTMODE */
226#define WM8903_GP5_INTMODE_MASK 0x0002 /* GP5_INTMODE */
227#define WM8903_GP5_INTMODE_SHIFT 1 /* GP5_INTMODE */
228#define WM8903_GP5_INTMODE_WIDTH 1 /* GP5_INTMODE */
229#define WM8903_GP5_DB 0x0001 /* GP5_DB */
230#define WM8903_GP5_DB_MASK 0x0001 /* GP5_DB */
231#define WM8903_GP5_DB_SHIFT 0 /* GP5_DB */
232#define WM8903_GP5_DB_WIDTH 1 /* GP5_DB */
233
234struct wm8903_platform_data {
235 bool irq_active_low; /* Set if IRQ active low, default high */
236
237 /* Default register value for R6 (Mic bias), used to configure
238 * microphone detection. In conjunction with gpio_cfg this
239 * can be used to route the microphone status signals out onto
240 * the GPIOs for use with snd_soc_jack_add_gpios().
241 */
242 u16 micdet_cfg;
243
244 int micdet_delay; /* Delay after microphone detection (ms) */
245
246 u32 gpio_cfg[5]; /* Default register values for GPIO pin mux */
247};
248
249#endif
diff --git a/include/sound/wm8904.h b/include/sound/wm8904.h
new file mode 100644
index 000000000000..898be3a8db9a
--- /dev/null
+++ b/include/sound/wm8904.h
@@ -0,0 +1,163 @@
1/*
2 * Platform data for WM8904
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MFD_WM8994_PDATA_H__
16#define __MFD_WM8994_PDATA_H__
17
18/* Used to enable configuration of a GPIO to all zeros */
19#define WM8904_GPIO_NO_CONFIG 0x8000
20
21/*
22 * R6 (0x06) - Mic Bias Control 0
23 */
24#define WM8904_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */
25#define WM8904_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */
26#define WM8904_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */
27#define WM8904_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */
28#define WM8904_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */
29#define WM8904_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */
30#define WM8904_MICDET_ENA 0x0002 /* MICDET_ENA */
31#define WM8904_MICDET_ENA_MASK 0x0002 /* MICDET_ENA */
32#define WM8904_MICDET_ENA_SHIFT 1 /* MICDET_ENA */
33#define WM8904_MICDET_ENA_WIDTH 1 /* MICDET_ENA */
34#define WM8904_MICBIAS_ENA 0x0001 /* MICBIAS_ENA */
35#define WM8904_MICBIAS_ENA_MASK 0x0001 /* MICBIAS_ENA */
36#define WM8904_MICBIAS_ENA_SHIFT 0 /* MICBIAS_ENA */
37#define WM8904_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */
38
39/*
40 * R7 (0x07) - Mic Bias Control 1
41 */
42#define WM8904_MIC_DET_FILTER_ENA 0x8000 /* MIC_DET_FILTER_ENA */
43#define WM8904_MIC_DET_FILTER_ENA_MASK 0x8000 /* MIC_DET_FILTER_ENA */
44#define WM8904_MIC_DET_FILTER_ENA_SHIFT 15 /* MIC_DET_FILTER_ENA */
45#define WM8904_MIC_DET_FILTER_ENA_WIDTH 1 /* MIC_DET_FILTER_ENA */
46#define WM8904_MIC_SHORT_FILTER_ENA 0x4000 /* MIC_SHORT_FILTER_ENA */
47#define WM8904_MIC_SHORT_FILTER_ENA_MASK 0x4000 /* MIC_SHORT_FILTER_ENA */
48#define WM8904_MIC_SHORT_FILTER_ENA_SHIFT 14 /* MIC_SHORT_FILTER_ENA */
49#define WM8904_MIC_SHORT_FILTER_ENA_WIDTH 1 /* MIC_SHORT_FILTER_ENA */
50#define WM8904_MICBIAS_SEL_MASK 0x0007 /* MICBIAS_SEL - [2:0] */
51#define WM8904_MICBIAS_SEL_SHIFT 0 /* MICBIAS_SEL - [2:0] */
52#define WM8904_MICBIAS_SEL_WIDTH 3 /* MICBIAS_SEL - [2:0] */
53
54
55/*
56 * R121 (0x79) - GPIO Control 1
57 */
58#define WM8904_GPIO1_PU 0x0020 /* GPIO1_PU */
59#define WM8904_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */
60#define WM8904_GPIO1_PU_SHIFT 5 /* GPIO1_PU */
61#define WM8904_GPIO1_PU_WIDTH 1 /* GPIO1_PU */
62#define WM8904_GPIO1_PD 0x0010 /* GPIO1_PD */
63#define WM8904_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */
64#define WM8904_GPIO1_PD_SHIFT 4 /* GPIO1_PD */
65#define WM8904_GPIO1_PD_WIDTH 1 /* GPIO1_PD */
66#define WM8904_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */
67#define WM8904_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */
68#define WM8904_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */
69
70/*
71 * R122 (0x7A) - GPIO Control 2
72 */
73#define WM8904_GPIO2_PU 0x0020 /* GPIO2_PU */
74#define WM8904_GPIO2_PU_MASK 0x0020 /* GPIO2_PU */
75#define WM8904_GPIO2_PU_SHIFT 5 /* GPIO2_PU */
76#define WM8904_GPIO2_PU_WIDTH 1 /* GPIO2_PU */
77#define WM8904_GPIO2_PD 0x0010 /* GPIO2_PD */
78#define WM8904_GPIO2_PD_MASK 0x0010 /* GPIO2_PD */
79#define WM8904_GPIO2_PD_SHIFT 4 /* GPIO2_PD */
80#define WM8904_GPIO2_PD_WIDTH 1 /* GPIO2_PD */
81#define WM8904_GPIO2_SEL_MASK 0x000F /* GPIO2_SEL - [3:0] */
82#define WM8904_GPIO2_SEL_SHIFT 0 /* GPIO2_SEL - [3:0] */
83#define WM8904_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [3:0] */
84
85/*
86 * R123 (0x7B) - GPIO Control 3
87 */
88#define WM8904_GPIO3_PU 0x0020 /* GPIO3_PU */
89#define WM8904_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */
90#define WM8904_GPIO3_PU_SHIFT 5 /* GPIO3_PU */
91#define WM8904_GPIO3_PU_WIDTH 1 /* GPIO3_PU */
92#define WM8904_GPIO3_PD 0x0010 /* GPIO3_PD */
93#define WM8904_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */
94#define WM8904_GPIO3_PD_SHIFT 4 /* GPIO3_PD */
95#define WM8904_GPIO3_PD_WIDTH 1 /* GPIO3_PD */
96#define WM8904_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */
97#define WM8904_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */
98#define WM8904_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */
99
100/*
101 * R124 (0x7C) - GPIO Control 4
102 */
103#define WM8904_GPI7_ENA 0x0200 /* GPI7_ENA */
104#define WM8904_GPI7_ENA_MASK 0x0200 /* GPI7_ENA */
105#define WM8904_GPI7_ENA_SHIFT 9 /* GPI7_ENA */
106#define WM8904_GPI7_ENA_WIDTH 1 /* GPI7_ENA */
107#define WM8904_GPI8_ENA 0x0100 /* GPI8_ENA */
108#define WM8904_GPI8_ENA_MASK 0x0100 /* GPI8_ENA */
109#define WM8904_GPI8_ENA_SHIFT 8 /* GPI8_ENA */
110#define WM8904_GPI8_ENA_WIDTH 1 /* GPI8_ENA */
111#define WM8904_GPIO_BCLK_MODE_ENA 0x0080 /* GPIO_BCLK_MODE_ENA */
112#define WM8904_GPIO_BCLK_MODE_ENA_MASK 0x0080 /* GPIO_BCLK_MODE_ENA */
113#define WM8904_GPIO_BCLK_MODE_ENA_SHIFT 7 /* GPIO_BCLK_MODE_ENA */
114#define WM8904_GPIO_BCLK_MODE_ENA_WIDTH 1 /* GPIO_BCLK_MODE_ENA */
115#define WM8904_GPIO_BCLK_SEL_MASK 0x000F /* GPIO_BCLK_SEL - [3:0] */
116#define WM8904_GPIO_BCLK_SEL_SHIFT 0 /* GPIO_BCLK_SEL - [3:0] */
117#define WM8904_GPIO_BCLK_SEL_WIDTH 4 /* GPIO_BCLK_SEL - [3:0] */
118
119#define WM8904_MIC_REGS 2
120#define WM8904_GPIO_REGS 4
121#define WM8904_DRC_REGS 4
122#define WM8904_EQ_REGS 25
123
124/**
125 * DRC configurations are specified with a label and a set of register
126 * values to write (the enable bits will be ignored). At runtime an
127 * enumerated control will be presented for each DRC block allowing
128 * the user to choose the configration to use.
129 *
130 * Configurations may be generated by hand or by using the DRC control
131 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
132 * for details.
133 */
134struct wm8904_drc_cfg {
135 const char *name;
136 u16 regs[WM8904_DRC_REGS];
137};
138
139/**
140 * ReTune Mobile configurations are specified with a label, sample
141 * rate and set of values to write (the enable bits will be ignored).
142 *
143 * Configurations are expected to be generated using the ReTune Mobile
144 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
145 */
146struct wm8904_retune_mobile_cfg {
147 const char *name;
148 unsigned int rate;
149 u16 regs[WM8904_EQ_REGS];
150};
151
152struct wm8904_pdata {
153 int num_drc_cfgs;
154 struct wm8904_drc_cfg *drc_cfgs;
155
156 int num_retune_mobile_cfgs;
157 struct wm8904_retune_mobile_cfg *retune_mobile_cfgs;
158
159 u32 gpio_cfg[WM8904_GPIO_REGS];
160 u32 mic_cfg[WM8904_MIC_REGS];
161};
162
163#endif
diff --git a/include/sound/wm8955.h b/include/sound/wm8955.h
new file mode 100644
index 000000000000..5074ef499f40
--- /dev/null
+++ b/include/sound/wm8955.h
@@ -0,0 +1,26 @@
1/*
2 * Platform data for WM8955
3 *
4 * Copyright 2009 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __WM8955_PDATA_H__
16#define __WM8955_PDATA_H__
17
18struct wm8955_pdata {
19 /* Configure LOUT2/ROUT2 to drive a speaker */
20 unsigned int out2_speaker:1;
21
22 /* Configure MONOIN+/- in differential mode */
23 unsigned int monoin_diff:1;
24};
25
26#endif
diff --git a/include/sound/wm8960.h b/include/sound/wm8960.h
new file mode 100644
index 000000000000..74e9a95529c5
--- /dev/null
+++ b/include/sound/wm8960.h
@@ -0,0 +1,24 @@
1/*
2 * wm8960.h -- WM8960 Soc Audio driver platform data
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 _WM8960_PDATA_H
10#define _WM8960_PDATA_H
11
12#define WM8960_DRES_400R 0
13#define WM8960_DRES_200R 1
14#define WM8960_DRES_600R 2
15#define WM8960_DRES_150R 3
16#define WM8960_DRES_MAX 3
17
18struct wm8960_data {
19 bool capless; /* Headphone outputs configured in capless mode */
20
21 int dres; /* Discharge resistance for headphone outputs */
22};
23
24#endif
diff --git a/include/sound/wm9090.h b/include/sound/wm9090.h
new file mode 100644
index 000000000000..3718928cde1a
--- /dev/null
+++ b/include/sound/wm9090.h
@@ -0,0 +1,28 @@
1/*
2 * linux/sound/wm9090.h -- Platform data for WM9090
3 *
4 * Copyright 2009, 2010 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM9090_H
12#define __LINUX_SND_WM9090_H
13
14struct wm9090_platform_data {
15 /* Line inputs 1 & 2 can optionally be differential */
16 unsigned int lin1_diff:1;
17 unsigned int lin2_diff:1;
18
19 /* AGC configuration. This is intended to protect the speaker
20 * against overdriving and will therefore depend on the
21 * hardware setup with incorrect runtime configuration
22 * potentially causing hardware damage.
23 */
24 unsigned int agc_ena:1;
25 u16 agc[3];
26};
27
28#endif
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 5acfb1eb4df9..1dfab5401511 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -65,6 +65,10 @@
65 65
66#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 66#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
67 67
68/* Make all open coded DECLARE_TRACE nops */
69#undef DECLARE_TRACE
70#define DECLARE_TRACE(name, proto, args)
71
68#ifdef CONFIG_EVENT_TRACING 72#ifdef CONFIG_EVENT_TRACING
69#include <trace/ftrace.h> 73#include <trace/ftrace.h>
70#endif 74#endif
@@ -75,6 +79,7 @@
75#undef DEFINE_EVENT 79#undef DEFINE_EVENT
76#undef DEFINE_EVENT_PRINT 80#undef DEFINE_EVENT_PRINT
77#undef TRACE_HEADER_MULTI_READ 81#undef TRACE_HEADER_MULTI_READ
82#undef DECLARE_TRACE
78 83
79/* Only undef what we defined in this file */ 84/* Only undef what we defined in this file */
80#ifdef UNDEF_TRACE_INCLUDE_FILE 85#ifdef UNDEF_TRACE_INCLUDE_FILE
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 5fb72733331e..d870a918559c 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -40,6 +40,16 @@ DECLARE_EVENT_CLASS(block_rq_with_error,
40 __entry->nr_sector, __entry->errors) 40 __entry->nr_sector, __entry->errors)
41); 41);
42 42
43/**
44 * block_rq_abort - abort block operation request
45 * @q: queue containing the block operation request
46 * @rq: block IO operation request
47 *
48 * Called immediately after pending block IO operation request @rq in
49 * queue @q is aborted. The fields in the operation request @rq
50 * can be examined to determine which device and sectors the pending
51 * operation would access.
52 */
43DEFINE_EVENT(block_rq_with_error, block_rq_abort, 53DEFINE_EVENT(block_rq_with_error, block_rq_abort,
44 54
45 TP_PROTO(struct request_queue *q, struct request *rq), 55 TP_PROTO(struct request_queue *q, struct request *rq),
@@ -47,6 +57,15 @@ DEFINE_EVENT(block_rq_with_error, block_rq_abort,
47 TP_ARGS(q, rq) 57 TP_ARGS(q, rq)
48); 58);
49 59
60/**
61 * block_rq_requeue - place block IO request back on a queue
62 * @q: queue holding operation
63 * @rq: block IO operation request
64 *
65 * The block operation request @rq is being placed back into queue
66 * @q. For some reason the request was not completed and needs to be
67 * put back in the queue.
68 */
50DEFINE_EVENT(block_rq_with_error, block_rq_requeue, 69DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
51 70
52 TP_PROTO(struct request_queue *q, struct request *rq), 71 TP_PROTO(struct request_queue *q, struct request *rq),
@@ -54,6 +73,17 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
54 TP_ARGS(q, rq) 73 TP_ARGS(q, rq)
55); 74);
56 75
76/**
77 * block_rq_complete - block IO operation completed by device driver
78 * @q: queue containing the block operation request
79 * @rq: block operations request
80 *
81 * The block_rq_complete tracepoint event indicates that some portion
82 * of operation request has been completed by the device driver. If
83 * the @rq->bio is %NULL, then there is absolutely no additional work to
84 * do for the request. If @rq->bio is non-NULL then there is
85 * additional work required to complete the request.
86 */
57DEFINE_EVENT(block_rq_with_error, block_rq_complete, 87DEFINE_EVENT(block_rq_with_error, block_rq_complete,
58 88
59 TP_PROTO(struct request_queue *q, struct request *rq), 89 TP_PROTO(struct request_queue *q, struct request *rq),
@@ -95,6 +125,16 @@ DECLARE_EVENT_CLASS(block_rq,
95 __entry->nr_sector, __entry->comm) 125 __entry->nr_sector, __entry->comm)
96); 126);
97 127
128/**
129 * block_rq_insert - insert block operation request into queue
130 * @q: target queue
131 * @rq: block IO operation request
132 *
133 * Called immediately before block operation request @rq is inserted
134 * into queue @q. The fields in the operation request @rq struct can
135 * be examined to determine which device and sectors the pending
136 * operation would access.
137 */
98DEFINE_EVENT(block_rq, block_rq_insert, 138DEFINE_EVENT(block_rq, block_rq_insert,
99 139
100 TP_PROTO(struct request_queue *q, struct request *rq), 140 TP_PROTO(struct request_queue *q, struct request *rq),
@@ -102,6 +142,14 @@ DEFINE_EVENT(block_rq, block_rq_insert,
102 TP_ARGS(q, rq) 142 TP_ARGS(q, rq)
103); 143);
104 144
145/**
146 * block_rq_issue - issue pending block IO request operation to device driver
147 * @q: queue holding operation
148 * @rq: block IO operation operation request
149 *
150 * Called when block operation request @rq from queue @q is sent to a
151 * device driver for processing.
152 */
105DEFINE_EVENT(block_rq, block_rq_issue, 153DEFINE_EVENT(block_rq, block_rq_issue,
106 154
107 TP_PROTO(struct request_queue *q, struct request *rq), 155 TP_PROTO(struct request_queue *q, struct request *rq),
@@ -109,6 +157,17 @@ DEFINE_EVENT(block_rq, block_rq_issue,
109 TP_ARGS(q, rq) 157 TP_ARGS(q, rq)
110); 158);
111 159
160/**
161 * block_bio_bounce - used bounce buffer when processing block operation
162 * @q: queue holding the block operation
163 * @bio: block operation
164 *
165 * A bounce buffer was used to handle the block operation @bio in @q.
166 * This occurs when hardware limitations prevent a direct transfer of
167 * data between the @bio data memory area and the IO device. Use of a
168 * bounce buffer requires extra copying of data and decreases
169 * performance.
170 */
112TRACE_EVENT(block_bio_bounce, 171TRACE_EVENT(block_bio_bounce,
113 172
114 TP_PROTO(struct request_queue *q, struct bio *bio), 173 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -138,6 +197,14 @@ TRACE_EVENT(block_bio_bounce,
138 __entry->nr_sector, __entry->comm) 197 __entry->nr_sector, __entry->comm)
139); 198);
140 199
200/**
201 * block_bio_complete - completed all work on the block operation
202 * @q: queue holding the block operation
203 * @bio: block operation completed
204 *
205 * This tracepoint indicates there is no further work to do on this
206 * block IO operation @bio.
207 */
141TRACE_EVENT(block_bio_complete, 208TRACE_EVENT(block_bio_complete,
142 209
143 TP_PROTO(struct request_queue *q, struct bio *bio), 210 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -193,6 +260,14 @@ DECLARE_EVENT_CLASS(block_bio,
193 __entry->nr_sector, __entry->comm) 260 __entry->nr_sector, __entry->comm)
194); 261);
195 262
263/**
264 * block_bio_backmerge - merging block operation to the end of an existing operation
265 * @q: queue holding operation
266 * @bio: new block operation to merge
267 *
268 * Merging block request @bio to the end of an existing block request
269 * in queue @q.
270 */
196DEFINE_EVENT(block_bio, block_bio_backmerge, 271DEFINE_EVENT(block_bio, block_bio_backmerge,
197 272
198 TP_PROTO(struct request_queue *q, struct bio *bio), 273 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -200,6 +275,14 @@ DEFINE_EVENT(block_bio, block_bio_backmerge,
200 TP_ARGS(q, bio) 275 TP_ARGS(q, bio)
201); 276);
202 277
278/**
279 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
280 * @q: queue holding operation
281 * @bio: new block operation to merge
282 *
283 * Merging block IO operation @bio to the beginning of an existing block
284 * operation in queue @q.
285 */
203DEFINE_EVENT(block_bio, block_bio_frontmerge, 286DEFINE_EVENT(block_bio, block_bio_frontmerge,
204 287
205 TP_PROTO(struct request_queue *q, struct bio *bio), 288 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -207,6 +290,13 @@ DEFINE_EVENT(block_bio, block_bio_frontmerge,
207 TP_ARGS(q, bio) 290 TP_ARGS(q, bio)
208); 291);
209 292
293/**
294 * block_bio_queue - putting new block IO operation in queue
295 * @q: queue holding operation
296 * @bio: new block operation
297 *
298 * About to place the block IO operation @bio into queue @q.
299 */
210DEFINE_EVENT(block_bio, block_bio_queue, 300DEFINE_EVENT(block_bio, block_bio_queue,
211 301
212 TP_PROTO(struct request_queue *q, struct bio *bio), 302 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -243,6 +333,15 @@ DECLARE_EVENT_CLASS(block_get_rq,
243 __entry->nr_sector, __entry->comm) 333 __entry->nr_sector, __entry->comm)
244); 334);
245 335
336/**
337 * block_getrq - get a free request entry in queue for block IO operations
338 * @q: queue for operations
339 * @bio: pending block IO operation
340 * @rw: low bit indicates a read (%0) or a write (%1)
341 *
342 * A request struct for queue @q has been allocated to handle the
343 * block IO operation @bio.
344 */
246DEFINE_EVENT(block_get_rq, block_getrq, 345DEFINE_EVENT(block_get_rq, block_getrq,
247 346
248 TP_PROTO(struct request_queue *q, struct bio *bio, int rw), 347 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
@@ -250,6 +349,17 @@ DEFINE_EVENT(block_get_rq, block_getrq,
250 TP_ARGS(q, bio, rw) 349 TP_ARGS(q, bio, rw)
251); 350);
252 351
352/**
353 * block_sleeprq - waiting to get a free request entry in queue for block IO operation
354 * @q: queue for operation
355 * @bio: pending block IO operation
356 * @rw: low bit indicates a read (%0) or a write (%1)
357 *
358 * In the case where a request struct cannot be provided for queue @q
359 * the process needs to wait for an request struct to become
360 * available. This tracepoint event is generated each time the
361 * process goes to sleep waiting for request struct become available.
362 */
253DEFINE_EVENT(block_get_rq, block_sleeprq, 363DEFINE_EVENT(block_get_rq, block_sleeprq,
254 364
255 TP_PROTO(struct request_queue *q, struct bio *bio, int rw), 365 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
@@ -257,6 +367,14 @@ DEFINE_EVENT(block_get_rq, block_sleeprq,
257 TP_ARGS(q, bio, rw) 367 TP_ARGS(q, bio, rw)
258); 368);
259 369
370/**
371 * block_plug - keep operations requests in request queue
372 * @q: request queue to plug
373 *
374 * Plug the request queue @q. Do not allow block operation requests
375 * to be sent to the device driver. Instead, accumulate requests in
376 * the queue to improve throughput performance of the block device.
377 */
260TRACE_EVENT(block_plug, 378TRACE_EVENT(block_plug,
261 379
262 TP_PROTO(struct request_queue *q), 380 TP_PROTO(struct request_queue *q),
@@ -293,6 +411,13 @@ DECLARE_EVENT_CLASS(block_unplug,
293 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) 411 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
294); 412);
295 413
414/**
415 * block_unplug_timer - timed release of operations requests in queue to device driver
416 * @q: request queue to unplug
417 *
418 * Unplug the request queue @q because a timer expired and allow block
419 * operation requests to be sent to the device driver.
420 */
296DEFINE_EVENT(block_unplug, block_unplug_timer, 421DEFINE_EVENT(block_unplug, block_unplug_timer,
297 422
298 TP_PROTO(struct request_queue *q), 423 TP_PROTO(struct request_queue *q),
@@ -300,6 +425,13 @@ DEFINE_EVENT(block_unplug, block_unplug_timer,
300 TP_ARGS(q) 425 TP_ARGS(q)
301); 426);
302 427
428/**
429 * block_unplug_io - release of operations requests in request queue
430 * @q: request queue to unplug
431 *
432 * Unplug request queue @q because device driver is scheduled to work
433 * on elements in the request queue.
434 */
303DEFINE_EVENT(block_unplug, block_unplug_io, 435DEFINE_EVENT(block_unplug, block_unplug_io,
304 436
305 TP_PROTO(struct request_queue *q), 437 TP_PROTO(struct request_queue *q),
@@ -307,6 +439,17 @@ DEFINE_EVENT(block_unplug, block_unplug_io,
307 TP_ARGS(q) 439 TP_ARGS(q)
308); 440);
309 441
442/**
443 * block_split - split a single bio struct into two bio structs
444 * @q: queue containing the bio
445 * @bio: block operation being split
446 * @new_sector: The starting sector for the new bio
447 *
448 * The bio request @bio in request queue @q needs to be split into two
449 * bio requests. The newly created @bio request starts at
450 * @new_sector. This split may be required due to hardware limitation
451 * such as operation crossing device boundaries in a RAID system.
452 */
310TRACE_EVENT(block_split, 453TRACE_EVENT(block_split,
311 454
312 TP_PROTO(struct request_queue *q, struct bio *bio, 455 TP_PROTO(struct request_queue *q, struct bio *bio,
@@ -337,6 +480,16 @@ TRACE_EVENT(block_split,
337 __entry->comm) 480 __entry->comm)
338); 481);
339 482
483/**
484 * block_remap - map request for a partition to the raw device
485 * @q: queue holding the operation
486 * @bio: revised operation
487 * @dev: device for the operation
488 * @from: original sector for the operation
489 *
490 * An operation for a partition on a block device has been mapped to the
491 * raw block device.
492 */
340TRACE_EVENT(block_remap, 493TRACE_EVENT(block_remap,
341 494
342 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, 495 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
@@ -370,6 +523,17 @@ TRACE_EVENT(block_remap,
370 (unsigned long long)__entry->old_sector) 523 (unsigned long long)__entry->old_sector)
371); 524);
372 525
526/**
527 * block_rq_remap - map request for a block operation request
528 * @q: queue holding the operation
529 * @rq: block IO operation request
530 * @dev: device for the operation
531 * @from: original sector for the operation
532 *
533 * The block operation request @rq in @q has been remapped. The block
534 * operation request @rq holds the current information and @from hold
535 * the original sector.
536 */
373TRACE_EVENT(block_rq_remap, 537TRACE_EVENT(block_rq_remap,
374 538
375 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev, 539 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index d0b6cd3afb2f..f3865c7b4166 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -306,7 +306,6 @@ TRACE_EVENT(ext4_da_writepages_result,
306 __field( int, pages_written ) 306 __field( int, pages_written )
307 __field( long, pages_skipped ) 307 __field( long, pages_skipped )
308 __field( char, more_io ) 308 __field( char, more_io )
309 __field( char, no_nrwrite_index_update )
310 __field( pgoff_t, writeback_index ) 309 __field( pgoff_t, writeback_index )
311 ), 310 ),
312 311
@@ -317,16 +316,14 @@ TRACE_EVENT(ext4_da_writepages_result,
317 __entry->pages_written = pages_written; 316 __entry->pages_written = pages_written;
318 __entry->pages_skipped = wbc->pages_skipped; 317 __entry->pages_skipped = wbc->pages_skipped;
319 __entry->more_io = wbc->more_io; 318 __entry->more_io = wbc->more_io;
320 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
321 __entry->writeback_index = inode->i_mapping->writeback_index; 319 __entry->writeback_index = inode->i_mapping->writeback_index;
322 ), 320 ),
323 321
324 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu", 322 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d writeback_index %lu",
325 jbd2_dev_to_name(__entry->dev), 323 jbd2_dev_to_name(__entry->dev),
326 (unsigned long) __entry->ino, __entry->ret, 324 (unsigned long) __entry->ino, __entry->ret,
327 __entry->pages_written, __entry->pages_skipped, 325 __entry->pages_written, __entry->pages_skipped,
328 __entry->more_io, 326 __entry->more_io,
329 __entry->no_nrwrite_index_update,
330 (unsigned long) __entry->writeback_index) 327 (unsigned long) __entry->writeback_index)
331); 328);
332 329
@@ -353,7 +350,7 @@ TRACE_EVENT(ext4_discard_blocks,
353 jbd2_dev_to_name(__entry->dev), __entry->blk, __entry->count) 350 jbd2_dev_to_name(__entry->dev), __entry->blk, __entry->count)
354); 351);
355 352
356TRACE_EVENT(ext4_mb_new_inode_pa, 353DECLARE_EVENT_CLASS(ext4__mb_new_pa,
357 TP_PROTO(struct ext4_allocation_context *ac, 354 TP_PROTO(struct ext4_allocation_context *ac,
358 struct ext4_prealloc_space *pa), 355 struct ext4_prealloc_space *pa),
359 356
@@ -381,32 +378,20 @@ TRACE_EVENT(ext4_mb_new_inode_pa,
381 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart) 378 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
382); 379);
383 380
384TRACE_EVENT(ext4_mb_new_group_pa, 381DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
382
385 TP_PROTO(struct ext4_allocation_context *ac, 383 TP_PROTO(struct ext4_allocation_context *ac,
386 struct ext4_prealloc_space *pa), 384 struct ext4_prealloc_space *pa),
387 385
388 TP_ARGS(ac, pa), 386 TP_ARGS(ac, pa)
389 387);
390 TP_STRUCT__entry(
391 __field( dev_t, dev )
392 __field( ino_t, ino )
393 __field( __u64, pa_pstart )
394 __field( __u32, pa_len )
395 __field( __u64, pa_lstart )
396 388
397 ), 389DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
398 390
399 TP_fast_assign( 391 TP_PROTO(struct ext4_allocation_context *ac,
400 __entry->dev = ac->ac_sb->s_dev; 392 struct ext4_prealloc_space *pa),
401 __entry->ino = ac->ac_inode->i_ino;
402 __entry->pa_pstart = pa->pa_pstart;
403 __entry->pa_len = pa->pa_len;
404 __entry->pa_lstart = pa->pa_lstart;
405 ),
406 393
407 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", 394 TP_ARGS(ac, pa)
408 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
409 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
410); 395);
411 396
412TRACE_EVENT(ext4_mb_release_inode_pa, 397TRACE_EVENT(ext4_mb_release_inode_pa,
@@ -618,9 +603,9 @@ TRACE_EVENT(ext4_free_blocks,
618); 603);
619 604
620TRACE_EVENT(ext4_sync_file, 605TRACE_EVENT(ext4_sync_file,
621 TP_PROTO(struct file *file, struct dentry *dentry, int datasync), 606 TP_PROTO(struct file *file, int datasync),
622 607
623 TP_ARGS(file, dentry, datasync), 608 TP_ARGS(file, datasync),
624 609
625 TP_STRUCT__entry( 610 TP_STRUCT__entry(
626 __field( dev_t, dev ) 611 __field( dev_t, dev )
@@ -630,6 +615,8 @@ TRACE_EVENT(ext4_sync_file,
630 ), 615 ),
631 616
632 TP_fast_assign( 617 TP_fast_assign(
618 struct dentry *dentry = file->f_path.dentry;
619
633 __entry->dev = dentry->d_inode->i_sb->s_dev; 620 __entry->dev = dentry->d_inode->i_sb->s_dev;
634 __entry->ino = dentry->d_inode->i_ino; 621 __entry->ino = dentry->d_inode->i_ino;
635 __entry->datasync = datasync; 622 __entry->datasync = datasync;
@@ -790,7 +777,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
790 __entry->result_len, __entry->result_logical) 777 __entry->result_len, __entry->result_logical)
791); 778);
792 779
793TRACE_EVENT(ext4_mballoc_discard, 780DECLARE_EVENT_CLASS(ext4__mballoc,
794 TP_PROTO(struct ext4_allocation_context *ac), 781 TP_PROTO(struct ext4_allocation_context *ac),
795 782
796 TP_ARGS(ac), 783 TP_ARGS(ac),
@@ -819,33 +806,18 @@ TRACE_EVENT(ext4_mballoc_discard,
819 __entry->result_len, __entry->result_logical) 806 __entry->result_len, __entry->result_logical)
820); 807);
821 808
822TRACE_EVENT(ext4_mballoc_free, 809DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
810
823 TP_PROTO(struct ext4_allocation_context *ac), 811 TP_PROTO(struct ext4_allocation_context *ac),
824 812
825 TP_ARGS(ac), 813 TP_ARGS(ac)
814);
826 815
827 TP_STRUCT__entry( 816DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
828 __field( dev_t, dev )
829 __field( ino_t, ino )
830 __field( __u32, result_logical )
831 __field( int, result_start )
832 __field( __u32, result_group )
833 __field( int, result_len )
834 ),
835 817
836 TP_fast_assign( 818 TP_PROTO(struct ext4_allocation_context *ac),
837 __entry->dev = ac->ac_inode->i_sb->s_dev;
838 __entry->ino = ac->ac_inode->i_ino;
839 __entry->result_logical = ac->ac_b_ex.fe_logical;
840 __entry->result_start = ac->ac_b_ex.fe_start;
841 __entry->result_group = ac->ac_b_ex.fe_group;
842 __entry->result_len = ac->ac_b_ex.fe_len;
843 ),
844 819
845 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ", 820 TP_ARGS(ac)
846 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
847 __entry->result_group, __entry->result_start,
848 __entry->result_len, __entry->result_logical)
849); 821);
850 822
851TRACE_EVENT(ext4_forget, 823TRACE_EVENT(ext4_forget,
@@ -874,6 +846,140 @@ TRACE_EVENT(ext4_forget,
874 __entry->mode, __entry->is_metadata, __entry->block) 846 __entry->mode, __entry->is_metadata, __entry->block)
875); 847);
876 848
849TRACE_EVENT(ext4_da_update_reserve_space,
850 TP_PROTO(struct inode *inode, int used_blocks),
851
852 TP_ARGS(inode, used_blocks),
853
854 TP_STRUCT__entry(
855 __field( dev_t, dev )
856 __field( ino_t, ino )
857 __field( umode_t, mode )
858 __field( __u64, i_blocks )
859 __field( int, used_blocks )
860 __field( int, reserved_data_blocks )
861 __field( int, reserved_meta_blocks )
862 __field( int, allocated_meta_blocks )
863 ),
864
865 TP_fast_assign(
866 __entry->dev = inode->i_sb->s_dev;
867 __entry->ino = inode->i_ino;
868 __entry->mode = inode->i_mode;
869 __entry->i_blocks = inode->i_blocks;
870 __entry->used_blocks = used_blocks;
871 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
872 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
873 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
874 ),
875
876 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
877 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
878 __entry->mode, (unsigned long long) __entry->i_blocks,
879 __entry->used_blocks, __entry->reserved_data_blocks,
880 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
881);
882
883TRACE_EVENT(ext4_da_reserve_space,
884 TP_PROTO(struct inode *inode, int md_needed),
885
886 TP_ARGS(inode, md_needed),
887
888 TP_STRUCT__entry(
889 __field( dev_t, dev )
890 __field( ino_t, ino )
891 __field( umode_t, mode )
892 __field( __u64, i_blocks )
893 __field( int, md_needed )
894 __field( int, reserved_data_blocks )
895 __field( int, reserved_meta_blocks )
896 ),
897
898 TP_fast_assign(
899 __entry->dev = inode->i_sb->s_dev;
900 __entry->ino = inode->i_ino;
901 __entry->mode = inode->i_mode;
902 __entry->i_blocks = inode->i_blocks;
903 __entry->md_needed = md_needed;
904 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
905 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
906 ),
907
908 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d",
909 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
910 __entry->mode, (unsigned long long) __entry->i_blocks,
911 __entry->md_needed, __entry->reserved_data_blocks,
912 __entry->reserved_meta_blocks)
913);
914
915TRACE_EVENT(ext4_da_release_space,
916 TP_PROTO(struct inode *inode, int freed_blocks),
917
918 TP_ARGS(inode, freed_blocks),
919
920 TP_STRUCT__entry(
921 __field( dev_t, dev )
922 __field( ino_t, ino )
923 __field( umode_t, mode )
924 __field( __u64, i_blocks )
925 __field( int, freed_blocks )
926 __field( int, reserved_data_blocks )
927 __field( int, reserved_meta_blocks )
928 __field( int, allocated_meta_blocks )
929 ),
930
931 TP_fast_assign(
932 __entry->dev = inode->i_sb->s_dev;
933 __entry->ino = inode->i_ino;
934 __entry->mode = inode->i_mode;
935 __entry->i_blocks = inode->i_blocks;
936 __entry->freed_blocks = freed_blocks;
937 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
938 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
939 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
940 ),
941
942 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
943 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
944 __entry->mode, (unsigned long long) __entry->i_blocks,
945 __entry->freed_blocks, __entry->reserved_data_blocks,
946 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
947);
948
949DECLARE_EVENT_CLASS(ext4__bitmap_load,
950 TP_PROTO(struct super_block *sb, unsigned long group),
951
952 TP_ARGS(sb, group),
953
954 TP_STRUCT__entry(
955 __field( dev_t, dev )
956 __field( __u32, group )
957
958 ),
959
960 TP_fast_assign(
961 __entry->dev = sb->s_dev;
962 __entry->group = group;
963 ),
964
965 TP_printk("dev %s group %u",
966 jbd2_dev_to_name(__entry->dev), __entry->group)
967);
968
969DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
970
971 TP_PROTO(struct super_block *sb, unsigned long group),
972
973 TP_ARGS(sb, group)
974);
975
976DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
977
978 TP_PROTO(struct super_block *sb, unsigned long group),
979
980 TP_ARGS(sb, group)
981);
982
877#endif /* _TRACE_EXT4_H */ 983#endif /* _TRACE_EXT4_H */
878 984
879/* This part must be outside protection */ 985/* This part must be outside protection */
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 96b370a050de..bf16545cc977 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -199,6 +199,34 @@ TRACE_EVENT(jbd2_checkpoint_stats,
199 __entry->forced_to_close, __entry->written, __entry->dropped) 199 __entry->forced_to_close, __entry->written, __entry->dropped)
200); 200);
201 201
202TRACE_EVENT(jbd2_cleanup_journal_tail,
203
204 TP_PROTO(journal_t *journal, tid_t first_tid,
205 unsigned long block_nr, unsigned long freed),
206
207 TP_ARGS(journal, first_tid, block_nr, freed),
208
209 TP_STRUCT__entry(
210 __field( dev_t, dev )
211 __field( tid_t, tail_sequence )
212 __field( tid_t, first_tid )
213 __field(unsigned long, block_nr )
214 __field(unsigned long, freed )
215 ),
216
217 TP_fast_assign(
218 __entry->dev = journal->j_fs_dev->bd_dev;
219 __entry->tail_sequence = journal->j_tail_sequence;
220 __entry->first_tid = first_tid;
221 __entry->block_nr = block_nr;
222 __entry->freed = freed;
223 ),
224
225 TP_printk("dev %s from %u to %u offset %lu freed %lu",
226 jbd2_dev_to_name(__entry->dev), __entry->tail_sequence,
227 __entry->first_tid, __entry->block_nr, __entry->freed)
228);
229
202#endif /* _TRACE_JBD2_H */ 230#endif /* _TRACE_JBD2_H */
203 231
204/* This part must be outside protection */ 232/* This part must be outside protection */
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index dbe108455275..6dd3a51ab1cb 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -5,7 +5,6 @@
5 5
6#undef TRACE_SYSTEM 6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm 7#define TRACE_SYSTEM kvm
8#define TRACE_INCLUDE_FILE kvm
9 8
10#if defined(__KVM_HAVE_IOAPIC) 9#if defined(__KVM_HAVE_IOAPIC)
11TRACE_EVENT(kvm_set_irq, 10TRACE_EVENT(kvm_set_irq,
@@ -145,6 +144,47 @@ TRACE_EVENT(kvm_mmio,
145 __entry->len, __entry->gpa, __entry->val) 144 __entry->len, __entry->gpa, __entry->val)
146); 145);
147 146
147#define kvm_fpu_load_symbol \
148 {0, "unload"}, \
149 {1, "load"}
150
151TRACE_EVENT(kvm_fpu,
152 TP_PROTO(int load),
153 TP_ARGS(load),
154
155 TP_STRUCT__entry(
156 __field( u32, load )
157 ),
158
159 TP_fast_assign(
160 __entry->load = load;
161 ),
162
163 TP_printk("%s", __print_symbolic(__entry->load, kvm_fpu_load_symbol))
164);
165
166TRACE_EVENT(kvm_age_page,
167 TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref),
168 TP_ARGS(hva, slot, ref),
169
170 TP_STRUCT__entry(
171 __field( u64, hva )
172 __field( u64, gfn )
173 __field( u8, referenced )
174 ),
175
176 TP_fast_assign(
177 __entry->hva = hva;
178 __entry->gfn =
179 slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT);
180 __entry->referenced = ref;
181 ),
182
183 TP_printk("hva %llx gfn %llx %s",
184 __entry->hva, __entry->gfn,
185 __entry->referenced ? "YOUNG" : "OLD")
186);
187
148#endif /* _TRACE_KVM_MAIN_H */ 188#endif /* _TRACE_KVM_MAIN_H */
149 189
150/* This part must be outside protection */ 190/* This part must be outside protection */
diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h
index a870ba125aa8..2821b86de63b 100644
--- a/include/trace/events/lock.h
+++ b/include/trace/events/lock.h
@@ -20,71 +20,61 @@ TRACE_EVENT(lock_acquire,
20 TP_STRUCT__entry( 20 TP_STRUCT__entry(
21 __field(unsigned int, flags) 21 __field(unsigned int, flags)
22 __string(name, lock->name) 22 __string(name, lock->name)
23 __field(void *, lockdep_addr)
23 ), 24 ),
24 25
25 TP_fast_assign( 26 TP_fast_assign(
26 __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0); 27 __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
27 __assign_str(name, lock->name); 28 __assign_str(name, lock->name);
29 __entry->lockdep_addr = lock;
28 ), 30 ),
29 31
30 TP_printk("%s%s%s", (__entry->flags & 1) ? "try " : "", 32 TP_printk("%p %s%s%s", __entry->lockdep_addr,
33 (__entry->flags & 1) ? "try " : "",
31 (__entry->flags & 2) ? "read " : "", 34 (__entry->flags & 2) ? "read " : "",
32 __get_str(name)) 35 __get_str(name))
33); 36);
34 37
35TRACE_EVENT(lock_release, 38DECLARE_EVENT_CLASS(lock,
36 39
37 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), 40 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
38 41
39 TP_ARGS(lock, nested, ip), 42 TP_ARGS(lock, ip),
40 43
41 TP_STRUCT__entry( 44 TP_STRUCT__entry(
42 __string(name, lock->name) 45 __string( name, lock->name )
46 __field( void *, lockdep_addr )
43 ), 47 ),
44 48
45 TP_fast_assign( 49 TP_fast_assign(
46 __assign_str(name, lock->name); 50 __assign_str(name, lock->name);
51 __entry->lockdep_addr = lock;
47 ), 52 ),
48 53
49 TP_printk("%s", __get_str(name)) 54 TP_printk("%p %s", __entry->lockdep_addr, __get_str(name))
50); 55);
51 56
52#ifdef CONFIG_LOCK_STAT 57DEFINE_EVENT(lock, lock_release,
53
54TRACE_EVENT(lock_contended,
55 58
56 TP_PROTO(struct lockdep_map *lock, unsigned long ip), 59 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
57 60
58 TP_ARGS(lock, ip), 61 TP_ARGS(lock, ip)
62);
59 63
60 TP_STRUCT__entry( 64#ifdef CONFIG_LOCK_STAT
61 __string(name, lock->name)
62 ),
63 65
64 TP_fast_assign( 66DEFINE_EVENT(lock, lock_contended,
65 __assign_str(name, lock->name); 67
66 ), 68 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
67 69
68 TP_printk("%s", __get_str(name)) 70 TP_ARGS(lock, ip)
69); 71);
70 72
71TRACE_EVENT(lock_acquired, 73DEFINE_EVENT(lock, lock_acquired,
72 TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime),
73 74
74 TP_ARGS(lock, ip, waittime), 75 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
75 76
76 TP_STRUCT__entry( 77 TP_ARGS(lock, ip)
77 __string(name, lock->name)
78 __field(unsigned long, wait_usec)
79 __field(unsigned long, wait_nsec_rem)
80 ),
81 TP_fast_assign(
82 __assign_str(name, lock->name);
83 __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC);
84 __entry->wait_usec = (unsigned long) waittime;
85 ),
86 TP_printk("%s (%lu.%03lu us)", __get_str(name), __entry->wait_usec,
87 __entry->wait_nsec_rem)
88); 78);
89 79
90#endif 80#endif
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 4b0f48ba16a6..c7bb2f0482fe 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -51,11 +51,14 @@ TRACE_EVENT(module_free,
51 TP_printk("%s", __get_str(name)) 51 TP_printk("%s", __get_str(name))
52); 52);
53 53
54#ifdef CONFIG_MODULE_UNLOAD
55/* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
56
54DECLARE_EVENT_CLASS(module_refcnt, 57DECLARE_EVENT_CLASS(module_refcnt,
55 58
56 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 59 TP_PROTO(struct module *mod, unsigned long ip),
57 60
58 TP_ARGS(mod, ip, refcnt), 61 TP_ARGS(mod, ip),
59 62
60 TP_STRUCT__entry( 63 TP_STRUCT__entry(
61 __field( unsigned long, ip ) 64 __field( unsigned long, ip )
@@ -65,7 +68,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
65 68
66 TP_fast_assign( 69 TP_fast_assign(
67 __entry->ip = ip; 70 __entry->ip = ip;
68 __entry->refcnt = refcnt; 71 __entry->refcnt = __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs);
69 __assign_str(name, mod->name); 72 __assign_str(name, mod->name);
70 ), 73 ),
71 74
@@ -75,17 +78,18 @@ DECLARE_EVENT_CLASS(module_refcnt,
75 78
76DEFINE_EVENT(module_refcnt, module_get, 79DEFINE_EVENT(module_refcnt, module_get,
77 80
78 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 81 TP_PROTO(struct module *mod, unsigned long ip),
79 82
80 TP_ARGS(mod, ip, refcnt) 83 TP_ARGS(mod, ip)
81); 84);
82 85
83DEFINE_EVENT(module_refcnt, module_put, 86DEFINE_EVENT(module_refcnt, module_put,
84 87
85 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 88 TP_PROTO(struct module *mod, unsigned long ip),
86 89
87 TP_ARGS(mod, ip, refcnt) 90 TP_ARGS(mod, ip)
88); 91);
92#endif /* CONFIG_MODULE_UNLOAD */
89 93
90TRACE_EVENT(module_request, 94TRACE_EVENT(module_request,
91 95
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h
index a8989c4547e7..188deca2f3c7 100644
--- a/include/trace/events/napi.h
+++ b/include/trace/events/napi.h
@@ -1,4 +1,7 @@
1#ifndef _TRACE_NAPI_H_ 1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM napi
3
4#if !defined(_TRACE_NAPI_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_NAPI_H_ 5#define _TRACE_NAPI_H_
3 6
4#include <linux/netdevice.h> 7#include <linux/netdevice.h>
@@ -8,4 +11,7 @@ DECLARE_TRACE(napi_poll,
8 TP_PROTO(struct napi_struct *napi), 11 TP_PROTO(struct napi_struct *napi),
9 TP_ARGS(napi)); 12 TP_ARGS(napi));
10 13
11#endif 14#endif /* _TRACE_NAPI_H_ */
15
16/* This part must be outside protection */
17#include <trace/define_trace.h>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b73e20..b9e1dd6c6208 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -51,15 +51,12 @@ TRACE_EVENT(sched_kthread_stop_ret,
51 51
52/* 52/*
53 * Tracepoint for waiting on task to unschedule: 53 * Tracepoint for waiting on task to unschedule:
54 *
55 * (NOTE: the 'rq' argument is not used by generic trace events,
56 * but used by the latency tracer plugin. )
57 */ 54 */
58TRACE_EVENT(sched_wait_task, 55TRACE_EVENT(sched_wait_task,
59 56
60 TP_PROTO(struct rq *rq, struct task_struct *p), 57 TP_PROTO(struct task_struct *p),
61 58
62 TP_ARGS(rq, p), 59 TP_ARGS(p),
63 60
64 TP_STRUCT__entry( 61 TP_STRUCT__entry(
65 __array( char, comm, TASK_COMM_LEN ) 62 __array( char, comm, TASK_COMM_LEN )
@@ -79,15 +76,12 @@ TRACE_EVENT(sched_wait_task,
79 76
80/* 77/*
81 * Tracepoint for waking up a task: 78 * Tracepoint for waking up a task:
82 *
83 * (NOTE: the 'rq' argument is not used by generic trace events,
84 * but used by the latency tracer plugin. )
85 */ 79 */
86DECLARE_EVENT_CLASS(sched_wakeup_template, 80DECLARE_EVENT_CLASS(sched_wakeup_template,
87 81
88 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 82 TP_PROTO(struct task_struct *p, int success),
89 83
90 TP_ARGS(rq, p, success), 84 TP_ARGS(p, success),
91 85
92 TP_STRUCT__entry( 86 TP_STRUCT__entry(
93 __array( char, comm, TASK_COMM_LEN ) 87 __array( char, comm, TASK_COMM_LEN )
@@ -111,31 +105,42 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
111); 105);
112 106
113DEFINE_EVENT(sched_wakeup_template, sched_wakeup, 107DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
114 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 108 TP_PROTO(struct task_struct *p, int success),
115 TP_ARGS(rq, p, success)); 109 TP_ARGS(p, success));
116 110
117/* 111/*
118 * Tracepoint for waking up a new task: 112 * Tracepoint for waking up a new task:
119 *
120 * (NOTE: the 'rq' argument is not used by generic trace events,
121 * but used by the latency tracer plugin. )
122 */ 113 */
123DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, 114DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
124 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 115 TP_PROTO(struct task_struct *p, int success),
125 TP_ARGS(rq, p, success)); 116 TP_ARGS(p, success));
117
118#ifdef CREATE_TRACE_POINTS
119static inline long __trace_sched_switch_state(struct task_struct *p)
120{
121 long state = p->state;
122
123#ifdef CONFIG_PREEMPT
124 /*
125 * For all intents and purposes a preempted task is a running task.
126 */
127 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE)
128 state = TASK_RUNNING;
129#endif
130
131 return state;
132}
133#endif
126 134
127/* 135/*
128 * Tracepoint for task switches, performed by the scheduler: 136 * Tracepoint for task switches, performed by the scheduler:
129 *
130 * (NOTE: the 'rq' argument is not used by generic trace events,
131 * but used by the latency tracer plugin. )
132 */ 137 */
133TRACE_EVENT(sched_switch, 138TRACE_EVENT(sched_switch,
134 139
135 TP_PROTO(struct rq *rq, struct task_struct *prev, 140 TP_PROTO(struct task_struct *prev,
136 struct task_struct *next), 141 struct task_struct *next),
137 142
138 TP_ARGS(rq, prev, next), 143 TP_ARGS(prev, next),
139 144
140 TP_STRUCT__entry( 145 TP_STRUCT__entry(
141 __array( char, prev_comm, TASK_COMM_LEN ) 146 __array( char, prev_comm, TASK_COMM_LEN )
@@ -151,7 +156,7 @@ TRACE_EVENT(sched_switch,
151 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); 156 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
152 __entry->prev_pid = prev->pid; 157 __entry->prev_pid = prev->pid;
153 __entry->prev_prio = prev->prio; 158 __entry->prev_prio = prev->prio;
154 __entry->prev_state = prev->state; 159 __entry->prev_state = __trace_sched_switch_state(prev);
155 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); 160 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
156 __entry->next_pid = next->pid; 161 __entry->next_pid = next->pid;
157 __entry->next_prio = next->prio; 162 __entry->next_prio = next->prio;
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
new file mode 100644
index 000000000000..25fbefdf2f2e
--- /dev/null
+++ b/include/trace/events/scsi.h
@@ -0,0 +1,345 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM scsi
3
4#if !defined(_TRACE_SCSI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SCSI_H
6
7#include <scsi/scsi_cmnd.h>
8#include <scsi/scsi_host.h>
9#include <linux/tracepoint.h>
10#include <linux/trace_seq.h>
11
12#define scsi_opcode_name(opcode) { opcode, #opcode }
13#define show_opcode_name(val) \
14 __print_symbolic(val, \
15 scsi_opcode_name(TEST_UNIT_READY), \
16 scsi_opcode_name(REZERO_UNIT), \
17 scsi_opcode_name(REQUEST_SENSE), \
18 scsi_opcode_name(FORMAT_UNIT), \
19 scsi_opcode_name(READ_BLOCK_LIMITS), \
20 scsi_opcode_name(REASSIGN_BLOCKS), \
21 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \
22 scsi_opcode_name(READ_6), \
23 scsi_opcode_name(WRITE_6), \
24 scsi_opcode_name(SEEK_6), \
25 scsi_opcode_name(READ_REVERSE), \
26 scsi_opcode_name(WRITE_FILEMARKS), \
27 scsi_opcode_name(SPACE), \
28 scsi_opcode_name(INQUIRY), \
29 scsi_opcode_name(RECOVER_BUFFERED_DATA), \
30 scsi_opcode_name(MODE_SELECT), \
31 scsi_opcode_name(RESERVE), \
32 scsi_opcode_name(RELEASE), \
33 scsi_opcode_name(COPY), \
34 scsi_opcode_name(ERASE), \
35 scsi_opcode_name(MODE_SENSE), \
36 scsi_opcode_name(START_STOP), \
37 scsi_opcode_name(RECEIVE_DIAGNOSTIC), \
38 scsi_opcode_name(SEND_DIAGNOSTIC), \
39 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \
40 scsi_opcode_name(SET_WINDOW), \
41 scsi_opcode_name(READ_CAPACITY), \
42 scsi_opcode_name(READ_10), \
43 scsi_opcode_name(WRITE_10), \
44 scsi_opcode_name(SEEK_10), \
45 scsi_opcode_name(POSITION_TO_ELEMENT), \
46 scsi_opcode_name(WRITE_VERIFY), \
47 scsi_opcode_name(VERIFY), \
48 scsi_opcode_name(SEARCH_HIGH), \
49 scsi_opcode_name(SEARCH_EQUAL), \
50 scsi_opcode_name(SEARCH_LOW), \
51 scsi_opcode_name(SET_LIMITS), \
52 scsi_opcode_name(PRE_FETCH), \
53 scsi_opcode_name(READ_POSITION), \
54 scsi_opcode_name(SYNCHRONIZE_CACHE), \
55 scsi_opcode_name(LOCK_UNLOCK_CACHE), \
56 scsi_opcode_name(READ_DEFECT_DATA), \
57 scsi_opcode_name(MEDIUM_SCAN), \
58 scsi_opcode_name(COMPARE), \
59 scsi_opcode_name(COPY_VERIFY), \
60 scsi_opcode_name(WRITE_BUFFER), \
61 scsi_opcode_name(READ_BUFFER), \
62 scsi_opcode_name(UPDATE_BLOCK), \
63 scsi_opcode_name(READ_LONG), \
64 scsi_opcode_name(WRITE_LONG), \
65 scsi_opcode_name(CHANGE_DEFINITION), \
66 scsi_opcode_name(WRITE_SAME), \
67 scsi_opcode_name(UNMAP), \
68 scsi_opcode_name(READ_TOC), \
69 scsi_opcode_name(LOG_SELECT), \
70 scsi_opcode_name(LOG_SENSE), \
71 scsi_opcode_name(XDWRITEREAD_10), \
72 scsi_opcode_name(MODE_SELECT_10), \
73 scsi_opcode_name(RESERVE_10), \
74 scsi_opcode_name(RELEASE_10), \
75 scsi_opcode_name(MODE_SENSE_10), \
76 scsi_opcode_name(PERSISTENT_RESERVE_IN), \
77 scsi_opcode_name(PERSISTENT_RESERVE_OUT), \
78 scsi_opcode_name(VARIABLE_LENGTH_CMD), \
79 scsi_opcode_name(REPORT_LUNS), \
80 scsi_opcode_name(MAINTENANCE_IN), \
81 scsi_opcode_name(MAINTENANCE_OUT), \
82 scsi_opcode_name(MOVE_MEDIUM), \
83 scsi_opcode_name(EXCHANGE_MEDIUM), \
84 scsi_opcode_name(READ_12), \
85 scsi_opcode_name(WRITE_12), \
86 scsi_opcode_name(WRITE_VERIFY_12), \
87 scsi_opcode_name(SEARCH_HIGH_12), \
88 scsi_opcode_name(SEARCH_EQUAL_12), \
89 scsi_opcode_name(SEARCH_LOW_12), \
90 scsi_opcode_name(READ_ELEMENT_STATUS), \
91 scsi_opcode_name(SEND_VOLUME_TAG), \
92 scsi_opcode_name(WRITE_LONG_2), \
93 scsi_opcode_name(READ_16), \
94 scsi_opcode_name(WRITE_16), \
95 scsi_opcode_name(VERIFY_16), \
96 scsi_opcode_name(WRITE_SAME_16), \
97 scsi_opcode_name(SERVICE_ACTION_IN), \
98 scsi_opcode_name(SAI_READ_CAPACITY_16), \
99 scsi_opcode_name(SAI_GET_LBA_STATUS), \
100 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
101 scsi_opcode_name(MO_SET_TARGET_PGS), \
102 scsi_opcode_name(READ_32), \
103 scsi_opcode_name(WRITE_32), \
104 scsi_opcode_name(WRITE_SAME_32), \
105 scsi_opcode_name(ATA_16), \
106 scsi_opcode_name(ATA_12))
107
108#define scsi_hostbyte_name(result) { result, #result }
109#define show_hostbyte_name(val) \
110 __print_symbolic(val, \
111 scsi_hostbyte_name(DID_OK), \
112 scsi_hostbyte_name(DID_NO_CONNECT), \
113 scsi_hostbyte_name(DID_BUS_BUSY), \
114 scsi_hostbyte_name(DID_TIME_OUT), \
115 scsi_hostbyte_name(DID_BAD_TARGET), \
116 scsi_hostbyte_name(DID_ABORT), \
117 scsi_hostbyte_name(DID_PARITY), \
118 scsi_hostbyte_name(DID_ERROR), \
119 scsi_hostbyte_name(DID_RESET), \
120 scsi_hostbyte_name(DID_BAD_INTR), \
121 scsi_hostbyte_name(DID_PASSTHROUGH), \
122 scsi_hostbyte_name(DID_SOFT_ERROR), \
123 scsi_hostbyte_name(DID_IMM_RETRY), \
124 scsi_hostbyte_name(DID_REQUEUE), \
125 scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED), \
126 scsi_hostbyte_name(DID_TRANSPORT_FAILFAST))
127
128#define scsi_driverbyte_name(result) { result, #result }
129#define show_driverbyte_name(val) \
130 __print_symbolic(val, \
131 scsi_driverbyte_name(DRIVER_OK), \
132 scsi_driverbyte_name(DRIVER_BUSY), \
133 scsi_driverbyte_name(DRIVER_SOFT), \
134 scsi_driverbyte_name(DRIVER_MEDIA), \
135 scsi_driverbyte_name(DRIVER_ERROR), \
136 scsi_driverbyte_name(DRIVER_INVALID), \
137 scsi_driverbyte_name(DRIVER_TIMEOUT), \
138 scsi_driverbyte_name(DRIVER_HARD), \
139 scsi_driverbyte_name(DRIVER_SENSE))
140
141#define scsi_msgbyte_name(result) { result, #result }
142#define show_msgbyte_name(val) \
143 __print_symbolic(val, \
144 scsi_msgbyte_name(COMMAND_COMPLETE), \
145 scsi_msgbyte_name(EXTENDED_MESSAGE), \
146 scsi_msgbyte_name(SAVE_POINTERS), \
147 scsi_msgbyte_name(RESTORE_POINTERS), \
148 scsi_msgbyte_name(DISCONNECT), \
149 scsi_msgbyte_name(INITIATOR_ERROR), \
150 scsi_msgbyte_name(ABORT_TASK_SET), \
151 scsi_msgbyte_name(MESSAGE_REJECT), \
152 scsi_msgbyte_name(NOP), \
153 scsi_msgbyte_name(MSG_PARITY_ERROR), \
154 scsi_msgbyte_name(LINKED_CMD_COMPLETE), \
155 scsi_msgbyte_name(LINKED_FLG_CMD_COMPLETE), \
156 scsi_msgbyte_name(TARGET_RESET), \
157 scsi_msgbyte_name(ABORT_TASK), \
158 scsi_msgbyte_name(CLEAR_TASK_SET), \
159 scsi_msgbyte_name(INITIATE_RECOVERY), \
160 scsi_msgbyte_name(RELEASE_RECOVERY), \
161 scsi_msgbyte_name(CLEAR_ACA), \
162 scsi_msgbyte_name(LOGICAL_UNIT_RESET), \
163 scsi_msgbyte_name(SIMPLE_QUEUE_TAG), \
164 scsi_msgbyte_name(HEAD_OF_QUEUE_TAG), \
165 scsi_msgbyte_name(ORDERED_QUEUE_TAG), \
166 scsi_msgbyte_name(IGNORE_WIDE_RESIDUE), \
167 scsi_msgbyte_name(ACA), \
168 scsi_msgbyte_name(QAS_REQUEST), \
169 scsi_msgbyte_name(BUS_DEVICE_RESET), \
170 scsi_msgbyte_name(ABORT))
171
172#define scsi_statusbyte_name(result) { result, #result }
173#define show_statusbyte_name(val) \
174 __print_symbolic(val, \
175 scsi_statusbyte_name(SAM_STAT_GOOD), \
176 scsi_statusbyte_name(SAM_STAT_CHECK_CONDITION), \
177 scsi_statusbyte_name(SAM_STAT_CONDITION_MET), \
178 scsi_statusbyte_name(SAM_STAT_BUSY), \
179 scsi_statusbyte_name(SAM_STAT_INTERMEDIATE), \
180 scsi_statusbyte_name(SAM_STAT_INTERMEDIATE_CONDITION_MET), \
181 scsi_statusbyte_name(SAM_STAT_RESERVATION_CONFLICT), \
182 scsi_statusbyte_name(SAM_STAT_COMMAND_TERMINATED), \
183 scsi_statusbyte_name(SAM_STAT_TASK_SET_FULL), \
184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \
185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED))
186
187const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int);
188#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len)
189
190TRACE_EVENT(scsi_dispatch_cmd_start,
191
192 TP_PROTO(struct scsi_cmnd *cmd),
193
194 TP_ARGS(cmd),
195
196 TP_STRUCT__entry(
197 __field( unsigned int, host_no )
198 __field( unsigned int, channel )
199 __field( unsigned int, id )
200 __field( unsigned int, lun )
201 __field( unsigned int, opcode )
202 __field( unsigned int, cmd_len )
203 __field( unsigned int, data_sglen )
204 __field( unsigned int, prot_sglen )
205 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
206 ),
207
208 TP_fast_assign(
209 __entry->host_no = cmd->device->host->host_no;
210 __entry->channel = cmd->device->channel;
211 __entry->id = cmd->device->id;
212 __entry->lun = cmd->device->lun;
213 __entry->opcode = cmd->cmnd[0];
214 __entry->cmd_len = cmd->cmd_len;
215 __entry->data_sglen = scsi_sg_count(cmd);
216 __entry->prot_sglen = scsi_prot_sg_count(cmd);
217 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
218 ),
219
220 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
221 " cmnd=(%s %s raw=%s)",
222 __entry->host_no, __entry->channel, __entry->id,
223 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
224 show_opcode_name(__entry->opcode),
225 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
226 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len))
227);
228
229TRACE_EVENT(scsi_dispatch_cmd_error,
230
231 TP_PROTO(struct scsi_cmnd *cmd, int rtn),
232
233 TP_ARGS(cmd, rtn),
234
235 TP_STRUCT__entry(
236 __field( unsigned int, host_no )
237 __field( unsigned int, channel )
238 __field( unsigned int, id )
239 __field( unsigned int, lun )
240 __field( int, rtn )
241 __field( unsigned int, opcode )
242 __field( unsigned int, cmd_len )
243 __field( unsigned int, data_sglen )
244 __field( unsigned int, prot_sglen )
245 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
246 ),
247
248 TP_fast_assign(
249 __entry->host_no = cmd->device->host->host_no;
250 __entry->channel = cmd->device->channel;
251 __entry->id = cmd->device->id;
252 __entry->lun = cmd->device->lun;
253 __entry->rtn = rtn;
254 __entry->opcode = cmd->cmnd[0];
255 __entry->cmd_len = cmd->cmd_len;
256 __entry->data_sglen = scsi_sg_count(cmd);
257 __entry->prot_sglen = scsi_prot_sg_count(cmd);
258 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
259 ),
260
261 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
262 " cmnd=(%s %s raw=%s) rtn=%d",
263 __entry->host_no, __entry->channel, __entry->id,
264 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
265 show_opcode_name(__entry->opcode),
266 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
267 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
268 __entry->rtn)
269);
270
271DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
272
273 TP_PROTO(struct scsi_cmnd *cmd),
274
275 TP_ARGS(cmd),
276
277 TP_STRUCT__entry(
278 __field( unsigned int, host_no )
279 __field( unsigned int, channel )
280 __field( unsigned int, id )
281 __field( unsigned int, lun )
282 __field( int, result )
283 __field( unsigned int, opcode )
284 __field( unsigned int, cmd_len )
285 __field( unsigned int, data_sglen )
286 __field( unsigned int, prot_sglen )
287 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
288 ),
289
290 TP_fast_assign(
291 __entry->host_no = cmd->device->host->host_no;
292 __entry->channel = cmd->device->channel;
293 __entry->id = cmd->device->id;
294 __entry->lun = cmd->device->lun;
295 __entry->result = cmd->result;
296 __entry->opcode = cmd->cmnd[0];
297 __entry->cmd_len = cmd->cmd_len;
298 __entry->data_sglen = scsi_sg_count(cmd);
299 __entry->prot_sglen = scsi_prot_sg_count(cmd);
300 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
301 ),
302
303 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \
304 "prot_sgl=%u cmnd=(%s %s raw=%s) result=(driver=%s host=%s " \
305 "message=%s status=%s)",
306 __entry->host_no, __entry->channel, __entry->id,
307 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
308 show_opcode_name(__entry->opcode),
309 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
310 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
311 show_driverbyte_name(((__entry->result) >> 24) & 0xff),
312 show_hostbyte_name(((__entry->result) >> 16) & 0xff),
313 show_msgbyte_name(((__entry->result) >> 8) & 0xff),
314 show_statusbyte_name(__entry->result & 0xff))
315);
316
317DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done,
318 TP_PROTO(struct scsi_cmnd *cmd),
319 TP_ARGS(cmd));
320
321DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_timeout,
322 TP_PROTO(struct scsi_cmnd *cmd),
323 TP_ARGS(cmd));
324
325TRACE_EVENT(scsi_eh_wakeup,
326
327 TP_PROTO(struct Scsi_Host *shost),
328
329 TP_ARGS(shost),
330
331 TP_STRUCT__entry(
332 __field( unsigned int, host_no )
333 ),
334
335 TP_fast_assign(
336 __entry->host_no = shost->host_no;
337 ),
338
339 TP_printk("host_no=%u", __entry->host_no)
340);
341
342#endif /* _TRACE_SCSI_H */
343
344/* This part must be outside protection */
345#include <trace/define_trace.h>
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
index a510b75ac304..17df43464df0 100644
--- a/include/trace/events/signal.h
+++ b/include/trace/events/signal.h
@@ -10,7 +10,8 @@
10 10
11#define TP_STORE_SIGINFO(__entry, info) \ 11#define TP_STORE_SIGINFO(__entry, info) \
12 do { \ 12 do { \
13 if (info == SEND_SIG_NOINFO) { \ 13 if (info == SEND_SIG_NOINFO || \
14 info == SEND_SIG_FORCED) { \
14 __entry->errno = 0; \ 15 __entry->errno = 0; \
15 __entry->code = SI_USER; \ 16 __entry->code = SI_USER; \
16 } else if (info == SEND_SIG_PRIV) { \ 17 } else if (info == SEND_SIG_PRIV) { \
@@ -100,18 +101,7 @@ TRACE_EVENT(signal_deliver,
100 __entry->sa_handler, __entry->sa_flags) 101 __entry->sa_handler, __entry->sa_flags)
101); 102);
102 103
103/** 104DECLARE_EVENT_CLASS(signal_queue_overflow,
104 * signal_overflow_fail - called when signal queue is overflow
105 * @sig: signal number
106 * @group: signal to process group or not (bool)
107 * @info: pointer to struct siginfo
108 *
109 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
110 * siginfo queue is overflow, and the signal is dropped.
111 * 'group' is not 0 if the signal will be sent to a process group.
112 * 'sig' is always one of RT signals.
113 */
114TRACE_EVENT(signal_overflow_fail,
115 105
116 TP_PROTO(int sig, int group, struct siginfo *info), 106 TP_PROTO(int sig, int group, struct siginfo *info),
117 107
@@ -135,6 +125,24 @@ TRACE_EVENT(signal_overflow_fail,
135); 125);
136 126
137/** 127/**
128 * signal_overflow_fail - called when signal queue is overflow
129 * @sig: signal number
130 * @group: signal to process group or not (bool)
131 * @info: pointer to struct siginfo
132 *
133 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
134 * siginfo queue is overflow, and the signal is dropped.
135 * 'group' is not 0 if the signal will be sent to a process group.
136 * 'sig' is always one of RT signals.
137 */
138DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail,
139
140 TP_PROTO(int sig, int group, struct siginfo *info),
141
142 TP_ARGS(sig, group, info)
143);
144
145/**
138 * signal_lose_info - called when siginfo is lost 146 * signal_lose_info - called when siginfo is lost
139 * @sig: signal number 147 * @sig: signal number
140 * @group: signal to process group or not (bool) 148 * @group: signal to process group or not (bool)
@@ -145,28 +153,13 @@ TRACE_EVENT(signal_overflow_fail,
145 * 'group' is not 0 if the signal will be sent to a process group. 153 * 'group' is not 0 if the signal will be sent to a process group.
146 * 'sig' is always one of non-RT signals. 154 * 'sig' is always one of non-RT signals.
147 */ 155 */
148TRACE_EVENT(signal_lose_info, 156DEFINE_EVENT(signal_queue_overflow, signal_lose_info,
149 157
150 TP_PROTO(int sig, int group, struct siginfo *info), 158 TP_PROTO(int sig, int group, struct siginfo *info),
151 159
152 TP_ARGS(sig, group, info), 160 TP_ARGS(sig, group, info)
153
154 TP_STRUCT__entry(
155 __field( int, sig )
156 __field( int, group )
157 __field( int, errno )
158 __field( int, code )
159 ),
160
161 TP_fast_assign(
162 __entry->sig = sig;
163 __entry->group = group;
164 TP_STORE_SIGINFO(__entry, info);
165 ),
166
167 TP_printk("sig=%d group=%d errno=%d code=%d",
168 __entry->sig, __entry->group, __entry->errno, __entry->code)
169); 161);
162
170#endif /* _TRACE_SIGNAL_H */ 163#endif /* _TRACE_SIGNAL_H */
171 164
172/* This part must be outside protection */ 165/* This part must be outside protection */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index c6fe03e902ca..5a64905d7278 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -62,10 +62,14 @@
62 struct trace_entry ent; \ 62 struct trace_entry ent; \
63 tstruct \ 63 tstruct \
64 char __data[0]; \ 64 char __data[0]; \
65 }; 65 }; \
66 \
67 static struct ftrace_event_class event_class_##name;
68
66#undef DEFINE_EVENT 69#undef DEFINE_EVENT
67#define DEFINE_EVENT(template, name, proto, args) \ 70#define DEFINE_EVENT(template, name, proto, args) \
68 static struct ftrace_event_call event_##name 71 static struct ftrace_event_call __used \
72 __attribute__((__aligned__(4))) event_##name
69 73
70#undef DEFINE_EVENT_PRINT 74#undef DEFINE_EVENT_PRINT
71#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 75#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
@@ -131,130 +135,6 @@
131#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 135#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
132 136
133/* 137/*
134 * Setup the showing format of trace point.
135 *
136 * int
137 * ftrace_format_##call(struct trace_seq *s)
138 * {
139 * struct ftrace_raw_##call field;
140 * int ret;
141 *
142 * ret = trace_seq_printf(s, #type " " #item ";"
143 * " offset:%u; size:%u;\n",
144 * offsetof(struct ftrace_raw_##call, item),
145 * sizeof(field.type));
146 *
147 * }
148 */
149
150#undef TP_STRUCT__entry
151#define TP_STRUCT__entry(args...) args
152
153#undef __field
154#define __field(type, item) \
155 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
156 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
157 (unsigned int)offsetof(typeof(field), item), \
158 (unsigned int)sizeof(field.item), \
159 (unsigned int)is_signed_type(type)); \
160 if (!ret) \
161 return 0;
162
163#undef __field_ext
164#define __field_ext(type, item, filter_type) __field(type, item)
165
166#undef __array
167#define __array(type, item, len) \
168 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
169 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
170 (unsigned int)offsetof(typeof(field), item), \
171 (unsigned int)sizeof(field.item), \
172 (unsigned int)is_signed_type(type)); \
173 if (!ret) \
174 return 0;
175
176#undef __dynamic_array
177#define __dynamic_array(type, item, len) \
178 ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
179 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
180 (unsigned int)offsetof(typeof(field), \
181 __data_loc_##item), \
182 (unsigned int)sizeof(field.__data_loc_##item), \
183 (unsigned int)is_signed_type(type)); \
184 if (!ret) \
185 return 0;
186
187#undef __string
188#define __string(item, src) __dynamic_array(char, item, -1)
189
190#undef __entry
191#define __entry REC
192
193#undef __print_symbolic
194#undef __get_dynamic_array
195#undef __get_str
196
197#undef TP_printk
198#define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args)
199
200#undef TP_fast_assign
201#define TP_fast_assign(args...) args
202
203#undef TP_perf_assign
204#define TP_perf_assign(args...)
205
206#undef DECLARE_EVENT_CLASS
207#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
208static int \
209ftrace_format_setup_##call(struct ftrace_event_call *unused, \
210 struct trace_seq *s) \
211{ \
212 struct ftrace_raw_##call field __attribute__((unused)); \
213 int ret = 0; \
214 \
215 tstruct; \
216 \
217 return ret; \
218} \
219 \
220static int \
221ftrace_format_##call(struct ftrace_event_call *unused, \
222 struct trace_seq *s) \
223{ \
224 int ret = 0; \
225 \
226 ret = ftrace_format_setup_##call(unused, s); \
227 if (!ret) \
228 return ret; \
229 \
230 ret = trace_seq_printf(s, "\nprint fmt: " print); \
231 \
232 return ret; \
233}
234
235#undef DEFINE_EVENT
236#define DEFINE_EVENT(template, name, proto, args)
237
238#undef DEFINE_EVENT_PRINT
239#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
240static int \
241ftrace_format_##name(struct ftrace_event_call *unused, \
242 struct trace_seq *s) \
243{ \
244 int ret = 0; \
245 \
246 ret = ftrace_format_setup_##template(unused, s); \
247 if (!ret) \
248 return ret; \
249 \
250 trace_seq_printf(s, "\nprint fmt: " print); \
251 \
252 return ret; \
253}
254
255#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
256
257/*
258 * Stage 3 of the trace events. 138 * Stage 3 of the trace events.
259 * 139 *
260 * Override the macros in <trace/trace_events.h> to include the following: 140 * Override the macros in <trace/trace_events.h> to include the following:
@@ -270,16 +150,18 @@ ftrace_format_##name(struct ftrace_event_call *unused, \
270 * 150 *
271 * entry = iter->ent; 151 * entry = iter->ent;
272 * 152 *
273 * if (entry->type != event_<call>.id) { 153 * if (entry->type != event_<call>->event.type) {
274 * WARN_ON_ONCE(1); 154 * WARN_ON_ONCE(1);
275 * return TRACE_TYPE_UNHANDLED; 155 * return TRACE_TYPE_UNHANDLED;
276 * } 156 * }
277 * 157 *
278 * field = (typeof(field))entry; 158 * field = (typeof(field))entry;
279 * 159 *
280 * p = get_cpu_var(ftrace_event_seq); 160 * p = &get_cpu_var(ftrace_event_seq);
281 * trace_seq_init(p); 161 * trace_seq_init(p);
282 * ret = trace_seq_printf(s, <TP_printk> "\n"); 162 * ret = trace_seq_printf(s, "%s: ", <call>);
163 * if (ret)
164 * ret = trace_seq_printf(s, <TP_printk> "\n");
283 * put_cpu(); 165 * put_cpu();
284 * if (!ret) 166 * if (!ret)
285 * return TRACE_TYPE_PARTIAL_LINE; 167 * return TRACE_TYPE_PARTIAL_LINE;
@@ -321,21 +203,28 @@ ftrace_format_##name(struct ftrace_event_call *unused, \
321 ftrace_print_symbols_seq(p, value, symbols); \ 203 ftrace_print_symbols_seq(p, value, symbols); \
322 }) 204 })
323 205
206#undef __print_hex
207#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
208
324#undef DECLARE_EVENT_CLASS 209#undef DECLARE_EVENT_CLASS
325#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 210#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
326static enum print_line_t \ 211static notrace enum print_line_t \
327ftrace_raw_output_id_##call(int event_id, const char *name, \ 212ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
328 struct trace_iterator *iter, int flags) \ 213 struct trace_event *trace_event) \
329{ \ 214{ \
215 struct ftrace_event_call *event; \
330 struct trace_seq *s = &iter->seq; \ 216 struct trace_seq *s = &iter->seq; \
331 struct ftrace_raw_##call *field; \ 217 struct ftrace_raw_##call *field; \
332 struct trace_entry *entry; \ 218 struct trace_entry *entry; \
333 struct trace_seq *p; \ 219 struct trace_seq *p; \
334 int ret; \ 220 int ret; \
335 \ 221 \
222 event = container_of(trace_event, struct ftrace_event_call, \
223 event); \
224 \
336 entry = iter->ent; \ 225 entry = iter->ent; \
337 \ 226 \
338 if (entry->type != event_id) { \ 227 if (entry->type != event->event.type) { \
339 WARN_ON_ONCE(1); \ 228 WARN_ON_ONCE(1); \
340 return TRACE_TYPE_UNHANDLED; \ 229 return TRACE_TYPE_UNHANDLED; \
341 } \ 230 } \
@@ -344,7 +233,7 @@ ftrace_raw_output_id_##call(int event_id, const char *name, \
344 \ 233 \
345 p = &get_cpu_var(ftrace_event_seq); \ 234 p = &get_cpu_var(ftrace_event_seq); \
346 trace_seq_init(p); \ 235 trace_seq_init(p); \
347 ret = trace_seq_printf(s, "%s: ", name); \ 236 ret = trace_seq_printf(s, "%s: ", event->name); \
348 if (ret) \ 237 if (ret) \
349 ret = trace_seq_printf(s, print); \ 238 ret = trace_seq_printf(s, print); \
350 put_cpu(); \ 239 put_cpu(); \
@@ -352,21 +241,16 @@ ftrace_raw_output_id_##call(int event_id, const char *name, \
352 return TRACE_TYPE_PARTIAL_LINE; \ 241 return TRACE_TYPE_PARTIAL_LINE; \
353 \ 242 \
354 return TRACE_TYPE_HANDLED; \ 243 return TRACE_TYPE_HANDLED; \
355} 244} \
356 245static struct trace_event_functions ftrace_event_type_funcs_##call = { \
357#undef DEFINE_EVENT 246 .trace = ftrace_raw_output_##call, \
358#define DEFINE_EVENT(template, name, proto, args) \ 247};
359static enum print_line_t \
360ftrace_raw_output_##name(struct trace_iterator *iter, int flags) \
361{ \
362 return ftrace_raw_output_id_##template(event_##name.id, \
363 #name, iter, flags); \
364}
365 248
366#undef DEFINE_EVENT_PRINT 249#undef DEFINE_EVENT_PRINT
367#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 250#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
368static enum print_line_t \ 251static notrace enum print_line_t \
369ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ 252ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
253 struct trace_event *event) \
370{ \ 254{ \
371 struct trace_seq *s = &iter->seq; \ 255 struct trace_seq *s = &iter->seq; \
372 struct ftrace_raw_##template *field; \ 256 struct ftrace_raw_##template *field; \
@@ -376,7 +260,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
376 \ 260 \
377 entry = iter->ent; \ 261 entry = iter->ent; \
378 \ 262 \
379 if (entry->type != event_##call.id) { \ 263 if (entry->type != event_##call.event.type) { \
380 WARN_ON_ONCE(1); \ 264 WARN_ON_ONCE(1); \
381 return TRACE_TYPE_UNHANDLED; \ 265 return TRACE_TYPE_UNHANDLED; \
382 } \ 266 } \
@@ -393,7 +277,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
393 return TRACE_TYPE_PARTIAL_LINE; \ 277 return TRACE_TYPE_PARTIAL_LINE; \
394 \ 278 \
395 return TRACE_TYPE_HANDLED; \ 279 return TRACE_TYPE_HANDLED; \
396} 280} \
281static struct trace_event_functions ftrace_event_type_funcs_##call = { \
282 .trace = ftrace_raw_output_##call, \
283};
397 284
398#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 285#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
399 286
@@ -431,7 +318,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
431 318
432#undef DECLARE_EVENT_CLASS 319#undef DECLARE_EVENT_CLASS
433#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ 320#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
434static int \ 321static int notrace \
435ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ 322ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
436{ \ 323{ \
437 struct ftrace_raw_##call field; \ 324 struct ftrace_raw_##call field; \
@@ -479,7 +366,7 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
479 366
480#undef DECLARE_EVENT_CLASS 367#undef DECLARE_EVENT_CLASS
481#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 368#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
482static inline int ftrace_get_offsets_##call( \ 369static inline notrace int ftrace_get_offsets_##call( \
483 struct ftrace_data_offsets_##call *__data_offsets, proto) \ 370 struct ftrace_data_offsets_##call *__data_offsets, proto) \
484{ \ 371{ \
485 int __data_size = 0; \ 372 int __data_size = 0; \
@@ -499,143 +386,85 @@ static inline int ftrace_get_offsets_##call( \
499 386
500#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 387#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
501 388
502#ifdef CONFIG_EVENT_PROFILE
503
504/*
505 * Generate the functions needed for tracepoint perf_event support.
506 *
507 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later
508 *
509 * static int ftrace_profile_enable_<call>(void)
510 * {
511 * return register_trace_<call>(ftrace_profile_<call>);
512 * }
513 *
514 * static void ftrace_profile_disable_<call>(void)
515 * {
516 * unregister_trace_<call>(ftrace_profile_<call>);
517 * }
518 *
519 */
520
521#undef DECLARE_EVENT_CLASS
522#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)
523
524#undef DEFINE_EVENT
525#define DEFINE_EVENT(template, name, proto, args) \
526 \
527static void ftrace_profile_##name(proto); \
528 \
529static int ftrace_profile_enable_##name(struct ftrace_event_call *unused)\
530{ \
531 return register_trace_##name(ftrace_profile_##name); \
532} \
533 \
534static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
535{ \
536 unregister_trace_##name(ftrace_profile_##name); \
537}
538
539#undef DEFINE_EVENT_PRINT
540#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
541 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
542
543#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
544
545#endif
546
547/* 389/*
548 * Stage 4 of the trace events. 390 * Stage 4 of the trace events.
549 * 391 *
550 * Override the macros in <trace/trace_events.h> to include the following: 392 * Override the macros in <trace/trace_events.h> to include the following:
551 * 393 *
552 * static void ftrace_event_<call>(proto)
553 * {
554 * event_trace_printk(_RET_IP_, "<call>: " <fmt>);
555 * }
556 *
557 * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused)
558 * {
559 * return register_trace_<call>(ftrace_event_<call>);
560 * }
561 *
562 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused)
563 * {
564 * unregister_trace_<call>(ftrace_event_<call>);
565 * }
566 *
567 *
568 * For those macros defined with TRACE_EVENT: 394 * For those macros defined with TRACE_EVENT:
569 * 395 *
570 * static struct ftrace_event_call event_<call>; 396 * static struct ftrace_event_call event_<call>;
571 * 397 *
572 * static void ftrace_raw_event_<call>(proto) 398 * static void ftrace_raw_event_<call>(void *__data, proto)
573 * { 399 * {
400 * struct ftrace_event_call *event_call = __data;
401 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
574 * struct ring_buffer_event *event; 402 * struct ring_buffer_event *event;
575 * struct ftrace_raw_<call> *entry; <-- defined in stage 1 403 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
576 * struct ring_buffer *buffer; 404 * struct ring_buffer *buffer;
577 * unsigned long irq_flags; 405 * unsigned long irq_flags;
406 * int __data_size;
578 * int pc; 407 * int pc;
579 * 408 *
580 * local_save_flags(irq_flags); 409 * local_save_flags(irq_flags);
581 * pc = preempt_count(); 410 * pc = preempt_count();
582 * 411 *
412 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
413 *
583 * event = trace_current_buffer_lock_reserve(&buffer, 414 * event = trace_current_buffer_lock_reserve(&buffer,
584 * event_<call>.id, 415 * event_<call>->event.type,
585 * sizeof(struct ftrace_raw_<call>), 416 * sizeof(*entry) + __data_size,
586 * irq_flags, pc); 417 * irq_flags, pc);
587 * if (!event) 418 * if (!event)
588 * return; 419 * return;
589 * entry = ring_buffer_event_data(event); 420 * entry = ring_buffer_event_data(event);
590 * 421 *
591 * <assign>; <-- Here we assign the entries by the __field and 422 * { <assign>; } <-- Here we assign the entries by the __field and
592 * __array macros. 423 * __array macros.
593 *
594 * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc);
595 * }
596 *
597 * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused)
598 * {
599 * int ret;
600 *
601 * ret = register_trace_<call>(ftrace_raw_event_<call>);
602 * if (!ret)
603 * pr_info("event trace: Could not activate trace point "
604 * "probe to <call>");
605 * return ret;
606 * }
607 * 424 *
608 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) 425 * if (!filter_current_check_discard(buffer, event_call, entry, event))
609 * { 426 * trace_current_buffer_unlock_commit(buffer,
610 * unregister_trace_<call>(ftrace_raw_event_<call>); 427 * event, irq_flags, pc);
611 * } 428 * }
612 * 429 *
613 * static struct trace_event ftrace_event_type_<call> = { 430 * static struct trace_event ftrace_event_type_<call> = {
614 * .trace = ftrace_raw_output_<call>, <-- stage 2 431 * .trace = ftrace_raw_output_<call>, <-- stage 2
615 * }; 432 * };
616 * 433 *
434 * static const char print_fmt_<call>[] = <TP_printk>;
435 *
436 * static struct ftrace_event_class __used event_class_<template> = {
437 * .system = "<system>",
438 * .define_fields = ftrace_define_fields_<call>,
439 * .fields = LIST_HEAD_INIT(event_class_##call.fields),
440 * .raw_init = trace_event_raw_init,
441 * .probe = ftrace_raw_event_##call,
442 * };
443 *
617 * static struct ftrace_event_call __used 444 * static struct ftrace_event_call __used
618 * __attribute__((__aligned__(4))) 445 * __attribute__((__aligned__(4)))
619 * __attribute__((section("_ftrace_events"))) event_<call> = { 446 * __attribute__((section("_ftrace_events"))) event_<call> = {
620 * .name = "<call>", 447 * .name = "<call>",
621 * .system = "<system>", 448 * .class = event_class_<template>,
622 * .raw_init = trace_event_raw_init, 449 * .event = &ftrace_event_type_<call>,
623 * .regfunc = ftrace_reg_event_<call>, 450 * .print_fmt = print_fmt_<call>,
624 * .unregfunc = ftrace_unreg_event_<call>, 451 * };
625 * .show_format = ftrace_format_<call>,
626 * }
627 * 452 *
628 */ 453 */
629 454
630#ifdef CONFIG_EVENT_PROFILE 455#ifdef CONFIG_PERF_EVENTS
456
457#define _TRACE_PERF_PROTO(call, proto) \
458 static notrace void \
459 perf_trace_##call(void *__data, proto);
631 460
632#define _TRACE_PROFILE_INIT(call) \ 461#define _TRACE_PERF_INIT(call) \
633 .profile_enable = ftrace_profile_enable_##call, \ 462 .perf_probe = perf_trace_##call,
634 .profile_disable = ftrace_profile_disable_##call,
635 463
636#else 464#else
637#define _TRACE_PROFILE_INIT(call) 465#define _TRACE_PERF_PROTO(call, proto)
638#endif 466#define _TRACE_PERF_INIT(call)
467#endif /* CONFIG_PERF_EVENTS */
639 468
640#undef __entry 469#undef __entry
641#define __entry entry 470#define __entry entry
@@ -657,12 +486,19 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
657#define __assign_str(dst, src) \ 486#define __assign_str(dst, src) \
658 strcpy(__get_str(dst), src); 487 strcpy(__get_str(dst), src);
659 488
489#undef TP_fast_assign
490#define TP_fast_assign(args...) args
491
492#undef TP_perf_assign
493#define TP_perf_assign(args...)
494
660#undef DECLARE_EVENT_CLASS 495#undef DECLARE_EVENT_CLASS
661#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 496#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
662 \ 497 \
663static void ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \ 498static notrace void \
664 proto) \ 499ftrace_raw_event_##call(void *__data, proto) \
665{ \ 500{ \
501 struct ftrace_event_call *event_call = __data; \
666 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 502 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
667 struct ring_buffer_event *event; \ 503 struct ring_buffer_event *event; \
668 struct ftrace_raw_##call *entry; \ 504 struct ftrace_raw_##call *entry; \
@@ -677,14 +513,13 @@ static void ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
677 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 513 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
678 \ 514 \
679 event = trace_current_buffer_lock_reserve(&buffer, \ 515 event = trace_current_buffer_lock_reserve(&buffer, \
680 event_call->id, \ 516 event_call->event.type, \
681 sizeof(*entry) + __data_size, \ 517 sizeof(*entry) + __data_size, \
682 irq_flags, pc); \ 518 irq_flags, pc); \
683 if (!event) \ 519 if (!event) \
684 return; \ 520 return; \
685 entry = ring_buffer_event_data(event); \ 521 entry = ring_buffer_event_data(event); \
686 \ 522 \
687 \
688 tstruct \ 523 tstruct \
689 \ 524 \
690 { assign; } \ 525 { assign; } \
@@ -693,37 +528,47 @@ static void ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
693 trace_nowake_buffer_unlock_commit(buffer, \ 528 trace_nowake_buffer_unlock_commit(buffer, \
694 event, irq_flags, pc); \ 529 event, irq_flags, pc); \
695} 530}
531/*
532 * The ftrace_test_probe is compiled out, it is only here as a build time check
533 * to make sure that if the tracepoint handling changes, the ftrace probe will
534 * fail to compile unless it too is updated.
535 */
696 536
697#undef DEFINE_EVENT 537#undef DEFINE_EVENT
698#define DEFINE_EVENT(template, call, proto, args) \ 538#define DEFINE_EVENT(template, call, proto, args) \
699 \ 539static inline void ftrace_test_probe_##call(void) \
700static void ftrace_raw_event_##call(proto) \
701{ \ 540{ \
702 ftrace_raw_event_id_##template(&event_##call, args); \ 541 check_trace_callback_type_##call(ftrace_raw_event_##template); \
703} \ 542}
704 \
705static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\
706{ \
707 return register_trace_##call(ftrace_raw_event_##call); \
708} \
709 \
710static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
711{ \
712 unregister_trace_##call(ftrace_raw_event_##call); \
713} \
714 \
715static struct trace_event ftrace_event_type_##call = { \
716 .trace = ftrace_raw_output_##call, \
717};
718 543
719#undef DEFINE_EVENT_PRINT 544#undef DEFINE_EVENT_PRINT
720#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 545#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
721 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
722 546
723#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 547#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
724 548
549#undef __entry
550#define __entry REC
551
552#undef __print_flags
553#undef __print_symbolic
554#undef __get_dynamic_array
555#undef __get_str
556
557#undef TP_printk
558#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
559
725#undef DECLARE_EVENT_CLASS 560#undef DECLARE_EVENT_CLASS
726#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) 561#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
562_TRACE_PERF_PROTO(call, PARAMS(proto)); \
563static const char print_fmt_##call[] = print; \
564static struct ftrace_event_class __used event_class_##call = { \
565 .system = __stringify(TRACE_SYSTEM), \
566 .define_fields = ftrace_define_fields_##call, \
567 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
568 .raw_init = trace_event_raw_init, \
569 .probe = ftrace_raw_event_##call, \
570 _TRACE_PERF_INIT(call) \
571};
727 572
728#undef DEFINE_EVENT 573#undef DEFINE_EVENT
729#define DEFINE_EVENT(template, call, proto, args) \ 574#define DEFINE_EVENT(template, call, proto, args) \
@@ -732,42 +577,34 @@ static struct ftrace_event_call __used \
732__attribute__((__aligned__(4))) \ 577__attribute__((__aligned__(4))) \
733__attribute__((section("_ftrace_events"))) event_##call = { \ 578__attribute__((section("_ftrace_events"))) event_##call = { \
734 .name = #call, \ 579 .name = #call, \
735 .system = __stringify(TRACE_SYSTEM), \ 580 .class = &event_class_##template, \
736 .event = &ftrace_event_type_##call, \ 581 .event.funcs = &ftrace_event_type_funcs_##template, \
737 .raw_init = trace_event_raw_init, \ 582 .print_fmt = print_fmt_##template, \
738 .regfunc = ftrace_raw_reg_event_##call, \ 583};
739 .unregfunc = ftrace_raw_unreg_event_##call, \
740 .show_format = ftrace_format_##template, \
741 .define_fields = ftrace_define_fields_##template, \
742 _TRACE_PROFILE_INIT(call) \
743}
744 584
745#undef DEFINE_EVENT_PRINT 585#undef DEFINE_EVENT_PRINT
746#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 586#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
747 \ 587 \
588static const char print_fmt_##call[] = print; \
589 \
748static struct ftrace_event_call __used \ 590static struct ftrace_event_call __used \
749__attribute__((__aligned__(4))) \ 591__attribute__((__aligned__(4))) \
750__attribute__((section("_ftrace_events"))) event_##call = { \ 592__attribute__((section("_ftrace_events"))) event_##call = { \
751 .name = #call, \ 593 .name = #call, \
752 .system = __stringify(TRACE_SYSTEM), \ 594 .class = &event_class_##template, \
753 .event = &ftrace_event_type_##call, \ 595 .event.funcs = &ftrace_event_type_funcs_##call, \
754 .raw_init = trace_event_raw_init, \ 596 .print_fmt = print_fmt_##call, \
755 .regfunc = ftrace_raw_reg_event_##call, \
756 .unregfunc = ftrace_raw_unreg_event_##call, \
757 .show_format = ftrace_format_##call, \
758 .define_fields = ftrace_define_fields_##template, \
759 _TRACE_PROFILE_INIT(call) \
760} 597}
761 598
762#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 599#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
763 600
764/* 601/*
765 * Define the insertion callback to profile events 602 * Define the insertion callback to perf events
766 * 603 *
767 * The job is very similar to ftrace_raw_event_<call> except that we don't 604 * The job is very similar to ftrace_raw_event_<call> except that we don't
768 * insert in the ring buffer but in a perf counter. 605 * insert in the ring buffer but in a perf counter.
769 * 606 *
770 * static void ftrace_profile_<call>(proto) 607 * static void ftrace_perf_<call>(proto)
771 * { 608 * {
772 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; 609 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
773 * struct ftrace_event_call *event_call = &event_<call>; 610 * struct ftrace_event_call *event_call = &event_<call>;
@@ -798,9 +635,9 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
798 * __cpu = smp_processor_id(); 635 * __cpu = smp_processor_id();
799 * 636 *
800 * if (in_nmi()) 637 * if (in_nmi())
801 * trace_buf = rcu_dereference(perf_trace_buf_nmi); 638 * trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
802 * else 639 * else
803 * trace_buf = rcu_dereference(perf_trace_buf); 640 * trace_buf = rcu_dereference_sched(perf_trace_buf);
804 * 641 *
805 * if (!trace_buf) 642 * if (!trace_buf)
806 * goto end; 643 * goto end;
@@ -835,7 +672,17 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
835 * } 672 * }
836 */ 673 */
837 674
838#ifdef CONFIG_EVENT_PROFILE 675#ifdef CONFIG_PERF_EVENTS
676
677#undef __entry
678#define __entry entry
679
680#undef __get_dynamic_array
681#define __get_dynamic_array(field) \
682 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
683
684#undef __get_str
685#define __get_str(field) (char *)__get_dynamic_array(field)
839 686
840#undef __perf_addr 687#undef __perf_addr
841#define __perf_addr(a) __addr = (a) 688#define __perf_addr(a) __addr = (a)
@@ -845,89 +692,63 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
845 692
846#undef DECLARE_EVENT_CLASS 693#undef DECLARE_EVENT_CLASS
847#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 694#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
848static void \ 695static notrace void \
849ftrace_profile_templ_##call(struct ftrace_event_call *event_call, \ 696perf_trace_##call(void *__data, proto) \
850 proto) \
851{ \ 697{ \
698 struct ftrace_event_call *event_call = __data; \
852 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 699 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
853 extern int perf_swevent_get_recursion_context(void); \
854 extern void perf_swevent_put_recursion_context(int rctx); \
855 extern void perf_tp_event(int, u64, u64, void *, int); \
856 struct ftrace_raw_##call *entry; \ 700 struct ftrace_raw_##call *entry; \
701 struct pt_regs __regs; \
857 u64 __addr = 0, __count = 1; \ 702 u64 __addr = 0, __count = 1; \
858 unsigned long irq_flags; \ 703 struct hlist_head *head; \
859 struct trace_entry *ent; \
860 int __entry_size; \ 704 int __entry_size; \
861 int __data_size; \ 705 int __data_size; \
862 char *trace_buf; \
863 char *raw_data; \
864 int __cpu; \
865 int rctx; \ 706 int rctx; \
866 int pc; \
867 \ 707 \
868 pc = preempt_count(); \ 708 perf_fetch_caller_regs(&__regs, 1); \
869 \ 709 \
870 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 710 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
871 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ 711 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
872 sizeof(u64)); \ 712 sizeof(u64)); \
873 __entry_size -= sizeof(u32); \ 713 __entry_size -= sizeof(u32); \
874 \ 714 \
875 if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \ 715 if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \
876 "profile buffer not large enough")) \ 716 "profile buffer not large enough")) \
877 return; \ 717 return; \
878 \ 718 \
879 local_irq_save(irq_flags); \ 719 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \
880 \ 720 __entry_size, event_call->event.type, &__regs, &rctx); \
881 rctx = perf_swevent_get_recursion_context(); \ 721 if (!entry) \
882 if (rctx < 0) \ 722 return; \
883 goto end_recursion; \
884 \
885 __cpu = smp_processor_id(); \
886 \
887 if (in_nmi()) \
888 trace_buf = rcu_dereference(perf_trace_buf_nmi); \
889 else \
890 trace_buf = rcu_dereference(perf_trace_buf); \
891 \
892 if (!trace_buf) \
893 goto end; \
894 \
895 raw_data = per_cpu_ptr(trace_buf, __cpu); \
896 \
897 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \
898 entry = (struct ftrace_raw_##call *)raw_data; \
899 ent = &entry->ent; \
900 tracing_generic_entry_update(ent, irq_flags, pc); \
901 ent->type = event_call->id; \
902 \ 723 \
903 tstruct \ 724 tstruct \
904 \ 725 \
905 { assign; } \ 726 { assign; } \
906 \ 727 \
907 perf_tp_event(event_call->id, __addr, __count, entry, \ 728 head = this_cpu_ptr(event_call->perf_events); \
908 __entry_size); \ 729 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
909 \ 730 __count, &__regs, head); \
910end: \
911 perf_swevent_put_recursion_context(rctx); \
912end_recursion: \
913 local_irq_restore(irq_flags); \
914} 731}
915 732
733/*
734 * This part is compiled out, it is only here as a build time check
735 * to make sure that if the tracepoint handling changes, the
736 * perf probe will fail to compile unless it too is updated.
737 */
916#undef DEFINE_EVENT 738#undef DEFINE_EVENT
917#define DEFINE_EVENT(template, call, proto, args) \ 739#define DEFINE_EVENT(template, call, proto, args) \
918static void ftrace_profile_##call(proto) \ 740static inline void perf_test_probe_##call(void) \
919{ \ 741{ \
920 struct ftrace_event_call *event_call = &event_##call; \ 742 check_trace_callback_type_##call(perf_trace_##template); \
921 \
922 ftrace_profile_templ_##template(event_call, args); \
923} 743}
924 744
745
925#undef DEFINE_EVENT_PRINT 746#undef DEFINE_EVENT_PRINT
926#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 747#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
927 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) 748 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
928 749
929#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 750#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
930#endif /* CONFIG_EVENT_PROFILE */ 751#endif /* CONFIG_PERF_EVENTS */
931 752
932#undef _TRACE_PROFILE_INIT 753#undef _TRACE_PROFILE_INIT
933 754
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 961fda3556bb..257e08960d7b 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -25,6 +25,8 @@ struct syscall_metadata {
25 int nb_args; 25 int nb_args;
26 const char **types; 26 const char **types;
27 const char **args; 27 const char **args;
28 struct list_head enter_fields;
29 struct list_head exit_fields;
28 30
29 struct ftrace_event_call *enter_event; 31 struct ftrace_event_call *enter_event;
30 struct ftrace_event_call *exit_event; 32 struct ftrace_event_call *exit_event;
@@ -34,27 +36,23 @@ struct syscall_metadata {
34extern unsigned long arch_syscall_addr(int nr); 36extern unsigned long arch_syscall_addr(int nr);
35extern int init_syscall_trace(struct ftrace_event_call *call); 37extern int init_syscall_trace(struct ftrace_event_call *call);
36 38
37extern int syscall_enter_format(struct ftrace_event_call *call,
38 struct trace_seq *s);
39extern int syscall_exit_format(struct ftrace_event_call *call,
40 struct trace_seq *s);
41extern int syscall_enter_define_fields(struct ftrace_event_call *call);
42extern int syscall_exit_define_fields(struct ftrace_event_call *call);
43extern int reg_event_syscall_enter(struct ftrace_event_call *call); 39extern int reg_event_syscall_enter(struct ftrace_event_call *call);
44extern void unreg_event_syscall_enter(struct ftrace_event_call *call); 40extern void unreg_event_syscall_enter(struct ftrace_event_call *call);
45extern int reg_event_syscall_exit(struct ftrace_event_call *call); 41extern int reg_event_syscall_exit(struct ftrace_event_call *call);
46extern void unreg_event_syscall_exit(struct ftrace_event_call *call); 42extern void unreg_event_syscall_exit(struct ftrace_event_call *call);
47extern int 43extern int
48ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s); 44ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
49enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); 45enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags,
50enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); 46 struct trace_event *event);
47enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags,
48 struct trace_event *event);
51#endif 49#endif
52#ifdef CONFIG_EVENT_PROFILE
53int prof_sysenter_enable(struct ftrace_event_call *call);
54void prof_sysenter_disable(struct ftrace_event_call *call);
55int prof_sysexit_enable(struct ftrace_event_call *call);
56void prof_sysexit_disable(struct ftrace_event_call *call);
57 50
51#ifdef CONFIG_PERF_EVENTS
52int perf_sysenter_enable(struct ftrace_event_call *call);
53void perf_sysenter_disable(struct ftrace_event_call *call);
54int perf_sysexit_enable(struct ftrace_event_call *call);
55void perf_sysexit_disable(struct ftrace_event_call *call);
58#endif 56#endif
59 57
60#endif /* _TRACE_SYSCALL_H */ 58#endif /* _TRACE_SYSCALL_H */
diff --git a/include/video/broadsheetfb.h b/include/video/broadsheetfb.h
index a758534c0272..548d28f4ec67 100644
--- a/include/video/broadsheetfb.h
+++ b/include/video/broadsheetfb.h
@@ -29,11 +29,19 @@
29#define BS_CMD_UPD_FULL 0x33 29#define BS_CMD_UPD_FULL 0x33
30#define BS_CMD_UPD_GDRV_CLR 0x37 30#define BS_CMD_UPD_GDRV_CLR 0x37
31 31
32/* Broadsheet register interface defines */
33#define BS_REG_REV 0x00
34#define BS_REG_PRC 0x02
35
32/* Broadsheet pin interface specific defines */ 36/* Broadsheet pin interface specific defines */
33#define BS_CS 0x01 37#define BS_CS 0x01
34#define BS_DC 0x02 38#define BS_DC 0x02
35#define BS_WR 0x03 39#define BS_WR 0x03
36 40
41/* Broadsheet IO interface specific defines */
42#define BS_MMIO_CMD 0x01
43#define BS_MMIO_DATA 0x02
44
37/* struct used by broadsheet. board specific stuff comes from *board */ 45/* struct used by broadsheet. board specific stuff comes from *board */
38struct broadsheetfb_par { 46struct broadsheetfb_par {
39 struct fb_info *info; 47 struct fb_info *info;
@@ -41,6 +49,8 @@ struct broadsheetfb_par {
41 void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val); 49 void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val);
42 u16 (*read_reg)(struct broadsheetfb_par *, u16 reg); 50 u16 (*read_reg)(struct broadsheetfb_par *, u16 reg);
43 wait_queue_head_t waitq; 51 wait_queue_head_t waitq;
52 int panel_index;
53 struct mutex io_lock;
44}; 54};
45 55
46/* board specific routines */ 56/* board specific routines */
@@ -48,12 +58,17 @@ struct broadsheet_board {
48 struct module *owner; 58 struct module *owner;
49 int (*init)(struct broadsheetfb_par *); 59 int (*init)(struct broadsheetfb_par *);
50 int (*wait_for_rdy)(struct broadsheetfb_par *); 60 int (*wait_for_rdy)(struct broadsheetfb_par *);
51 void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8);
52 void (*set_hdb)(struct broadsheetfb_par *, u16);
53 u16 (*get_hdb)(struct broadsheetfb_par *);
54 void (*cleanup)(struct broadsheetfb_par *); 61 void (*cleanup)(struct broadsheetfb_par *);
55 int (*get_panel_type)(void); 62 int (*get_panel_type)(void);
56 int (*setup_irq)(struct fb_info *); 63 int (*setup_irq)(struct fb_info *);
57};
58 64
65 /* Functions for boards that use GPIO */
66 void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8);
67 void (*set_hdb)(struct broadsheetfb_par *, u16);
68 u16 (*get_hdb)(struct broadsheetfb_par *);
69
70 /* Functions for boards that have specialized MMIO */
71 void (*mmio_write)(struct broadsheetfb_par *, int type, u16);
72 u16 (*mmio_read)(struct broadsheetfb_par *);
73};
59#endif 74#endif
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h
index 89d43b3d4cb9..6316cdabf73f 100644
--- a/include/video/da8xx-fb.h
+++ b/include/video/da8xx-fb.h
@@ -99,6 +99,7 @@ struct lcd_sync_arg {
99#define FBIPUT_COLOR _IOW('F', 6, int) 99#define FBIPUT_COLOR _IOW('F', 6, int)
100#define FBIPUT_HSYNC _IOW('F', 9, int) 100#define FBIPUT_HSYNC _IOW('F', 9, int)
101#define FBIPUT_VSYNC _IOW('F', 10, int) 101#define FBIPUT_VSYNC _IOW('F', 10, int)
102#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t)
102 103
103#endif /* ifndef DA8XX_FB_H */ 104#endif /* ifndef DA8XX_FB_H */
104 105
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b9763badbd77..43e2d7d33976 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -39,6 +39,7 @@
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/completion.h> 40#include <linux/completion.h>
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/slab.h>
42#include <xen/interface/xen.h> 43#include <xen/interface/xen.h>
43#include <xen/interface/grant_table.h> 44#include <xen/interface/grant_table.h>
44#include <xen/interface/io/xenbus.h> 45#include <xen/interface/io/xenbus.h>